diff --git a/Makefile b/Makefile index be9f4c1..35e86a1 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ run: deps ## Start the api locally on port 28900. @FLASK_APP=${FLASK_APP} poetry run gunicorn "app.main:create_app()" -b 0.0.0.0:${BERLIN_API_PORT} -c gunicorn_config.py run-container: build ## Runs a container from the pre-build image - docker run -p 28900:28900 --env BERLIN_API_BUILD_TIME='${BERLIN_API_BUILD_TIME}' -e BERLIN_API_BUILD_TIME="${BERLIN_API_BUILD_TIME}" -e BERLIN_API_VERSION="${BERLIN_API_VERSION}" -ti berlin_api + docker run -p 28940:28900 --env BERLIN_API_BUILD_TIME='${BERLIN_API_BUILD_TIME}' -e BERLIN_API_BUILD_TIME="${BERLIN_API_BUILD_TIME}" -e BERLIN_API_VERSION="${BERLIN_API_VERSION}" -ti berlin_api test: deps ## runs all tests poetry run pytest -v tests/ @@ -63,4 +63,3 @@ help: ## Show this help. if (/^[a-zA-Z_-]+:.*?##.*$$/) {printf " ${YELLOW}%-20s${GREEN}%s${RESET}\n", $$1, $$2} \ else if (/^## .*$$/) {printf " ${CYAN}%s${RESET}\n", substr($$1,4)} \ }' $(MAKEFILE_LIST) - diff --git a/README.md b/README.md index 89fbdca..9bb0b1e 100644 --- a/README.md +++ b/README.md @@ -66,26 +66,36 @@ curl 'http://localhost:28900/berlin/search?q=house+prices+in+londo&state=gb' | j replacing `localhost` with the local endpoint (`jq` used for formatting). -This will return results of the form: - ```json { "matches": [ { - "encoding": "UN-LOCODE", - "id": "ca:lod", - "key": "UN-LOCODE-ca:lod", - "words": [ - "london" - ] + "loc": { + "encoding": "UN-LOCODE", + "id": "ca:lod", + "key": "UN-LOCODE-ca:lod", + "words": [ + "london" + ] + }, + "match": { + "score": 1008, + "offset": [17, 22] + } }, { - "encoding": "UN-LOCODE", - "id": "us:ldn", - "key": "UN-LOCODE-us:ldn", - "words": [ - "london" - ] + "loc": { + "encoding": "UN-LOCODE", + "id": "us:ldn", + "key": "UN-LOCODE-us:ldn", + "words": [ + "london" + ] + }, + "match": { + "score": 1008, + "offset": [17, 22] + } } ... ] diff --git a/app/logger.py b/app/logger.py index 55af94a..f5ca73b 100644 --- a/app/logger.py +++ b/app/logger.py @@ -1,28 +1,68 @@ +import logging +import logging.config from datetime import datetime import structlog +import structlog._log_levels from app.settings import settings -def configure_logging(): +def add_severity_level(logger, method_name, event_dict): + if method_name == "info": + event_dict[0][0]["severity"] = 0 + elif method_name == "error": + event_dict[0][0]["severity"] = 1 + + return event_dict + + +def setup_logging(): + shared_processors = [] + processors = shared_processors + [ + structlog.stdlib.PositionalArgumentsFormatter(), + structlog.stdlib.ProcessorFormatter.wrap_for_formatter, + add_severity_level, + ] structlog.configure( - processors=[ - structlog.processors.TimeStamper(fmt="iso", utc=True), - structlog.processors.dict_tracebacks, - structlog.processors.JSONRenderer(), - ], - context_class=structlog.threadlocal.wrap_dict(dict), + cache_logger_on_first_use=True, + wrapper_class=structlog.make_filtering_bound_logger(logging.INFO), + processors=processors, + context_class=dict, logger_factory=structlog.stdlib.LoggerFactory(), ) + stdlib_config = { + "version": 1, + "disable_existing_loggers": False, + "formatters": { + "json": { + "()": structlog.stdlib.ProcessorFormatter, + "processor": structlog.processors.JSONRenderer(), + "foreign_pre_chain": shared_processors, + }, + }, + "handlers": { + "stream": { + "level": "DEBUG", + "formatter": "json", + "class": "logging.StreamHandler", + "stream": "ext://sys.stderr", + }, + }, + "loggers": { + "": { + "handlers": ["stream"], + "level": "DEBUG", + "propagate": True, + }, + }, + } + logging.config.dictConfig(stdlib_config) -def setup_logger(): return structlog.get_logger( namespace=settings.NAMESPACE, created_at=datetime.utcnow().isoformat(), + event="", + severity=0, # default ) - - -configure_logging() -logger = setup_logger() diff --git a/app/main.py b/app/main.py index 8d86514..c7bfaf3 100644 --- a/app/main.py +++ b/app/main.py @@ -1,22 +1,11 @@ -import logging -import sys - from flask import Flask -from app.logger import logger -from app.settings import get_custom_settings, settings +from app.logger import setup_logging +from app.settings import settings from app.views.berlin import berlin_blueprint from app.views.health import health_blueprint -logging.basicConfig( - format="%(message)s", - stream=sys.stdout, - level=logging.INFO, -) - -logger.info( - "initial configuration", data=get_custom_settings(), level="INFO", severity=0 -) +logger = setup_logging() def create_app(): diff --git a/app/models.py b/app/models.py index 7ce257e..6a0f424 100644 --- a/app/models.py +++ b/app/models.py @@ -3,6 +3,26 @@ from berlin import Location +from app.logger import setup_logging + +logger = setup_logging() + + +@dataclass +class MatchModel: + score: int | None + offset: list[int] | None + + @classmethod + def from_location(cls, loc: Location) -> "MatchModel": + try: + return cls(score=loc.get_score(), offset=loc.get_offset()) + except AttributeError: + logger.error("no offset or score available") + + def to_json(self): + return asdict(self) + @dataclass class LocationModel: diff --git a/app/views/berlin.py b/app/views/berlin.py index bcb1f35..730edb1 100644 --- a/app/views/berlin.py +++ b/app/views/berlin.py @@ -1,9 +1,10 @@ from flask import Blueprint, jsonify, request -from app.logger import logger -from app.models import LocationModel +from app.logger import setup_logging +from app.models import LocationModel, MatchModel from app.store import get_db +logger = setup_logging() db = get_db() berlin_blueprint = Blueprint("berlin", __name__) @@ -17,9 +18,7 @@ def berlin_code(key): except Exception as e: logger.error( event="error retrieving key from database ", - stack_trace=str(e), - level="ERROR", - severity=1, + error=str(e), ) return jsonify({"key": key, "error": "Not found"}), 404 @@ -36,24 +35,37 @@ def berlin_search(): lev_distance = request.args.get("lev_distance", type=int) or 2 try: - log_message = f"Querying database with q={q}, state={state}, limit={limit}, lev_distance={lev_distance}" - logger.info(log_message, severity=0) + logger.info( + event="Querying database", + data={ + "q": q, + "state": state, + "limit": limit, + "lev_distance": lev_distance, + }, + ) result = db.query(q, state=state, limit=limit, lev_distance=lev_distance) - locations = { - "matches": [ - LocationModel.from_location(loc, db).to_json() for loc in result - ] - } + matches = [ + { + "loc": LocationModel.from_location(loc, db).to_json(), + "scores": MatchModel.from_location(loc).to_json(), + } + for loc in result + ] + + start_idx = matches[0]["scores"]["offset"][0] + end_idx = matches[0]["scores"]["offset"][1] + q = q[:start_idx] + q[end_idx:] + + locations = {"query": q, "matches": matches} return jsonify(locations), 200 except Exception as e: logger.error( event="error querying the database ", - stack_trace=str(e), - level="ERROR", - severity=1, + error=str(e), ) return ( jsonify({"error": "error querying the database"}), diff --git a/gunicorn_config.py b/gunicorn_config.py index 8a18ce5..2820650 100644 --- a/gunicorn_config.py +++ b/gunicorn_config.py @@ -39,10 +39,6 @@ def json_record( "method": record.args["m"], "path": url, "status": str(record.args["s"]), - "user_agent": record.args["a"], - "referer": record.args["f"], - "duration_in_ms": record.args["M"], - "pid": record.args["p"], }, severity=severity, ) @@ -66,6 +62,7 @@ def json_record( 0 if record.levelname == "INFO" else 1 if record.levelname == "ERROR" else 2 ) payload.pop("time", None) + payload.pop("taskName", None) payload.pop("message", None) return payload diff --git a/poetry.lock b/poetry.lock index 9960b6f..6ff8b78 100644 --- a/poetry.lock +++ b/poetry.lock @@ -50,69 +50,71 @@ tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "p [[package]] name = "berlin" -version = "0.3.10" +version = "0.3.12" description = "Identify locations and tag them with UN-LOCODEs and ISO-3166-2 subdivisions." optional = false python-versions = ">=3.8" files = [ - {file = "berlin-0.3.10-cp310-cp310-macosx_10_7_x86_64.whl", hash = "sha256:cb1bc3183718c3cfbe6e3bd4e0cac6c4877e59e9bf8b0e27b502cdf21e19cb02"}, - {file = "berlin-0.3.10-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d2c2750697daf5546e29c7521144cd45a3373085b1f5fc7a93a6de848f96acfb"}, - {file = "berlin-0.3.10-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:9e8a8948260ce68f407332657106f8a31de79dbbb16437e1e36508a742b09a1b"}, - {file = "berlin-0.3.10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:12fcfa35d548eb099cf4a764ce9ff9244402c2d090ce7453796d7f544ef751db"}, - {file = "berlin-0.3.10-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:dbac76e8de4644ddd314d2583bdf63cd817389cdcdcf941f21b8c5d0b3807e0a"}, - {file = "berlin-0.3.10-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:17fd4084100a78e5865a48eef1c2e13c7dff22be6f6521eca40b670671bd391b"}, - {file = "berlin-0.3.10-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8561e7923132940fbff02daa753bde961d6a559fdc5108fcbf5b30ee4854b986"}, - {file = "berlin-0.3.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ab823ba412cfad9e09c66de7140a251d4e44829ce9a9b79c6d4fda3e52b087b5"}, - {file = "berlin-0.3.10-cp310-none-win32.whl", hash = "sha256:27d291e521659127d6c69f29d89985b30e4c8b1d580657cd0d76babf405192b9"}, - {file = "berlin-0.3.10-cp310-none-win_amd64.whl", hash = "sha256:8da573cb6a3551f2b77dde85832cc2802db5758c1c23d7a91c6a1e5b7748c982"}, - {file = "berlin-0.3.10-cp311-cp311-macosx_10_7_x86_64.whl", hash = "sha256:0f4b3773ad063ec26173dfbe76b622d6d14b203fc80c1427315b30ace5fa91fd"}, - {file = "berlin-0.3.10-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ceeb841b269dbb102cf7f10e645a4cdf97bf92aac587d53d2402c70fc74418f0"}, - {file = "berlin-0.3.10-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:ebaf93df50bbd2b6720cdfe469b875d1efb058c3c8c72e71d49955bcb74958bb"}, - {file = "berlin-0.3.10-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:171e11bb975621927cce21e7456586e12aa4febfe4e98495cc87ca39721e0523"}, - {file = "berlin-0.3.10-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:950169857a9c23c25dab59546ad9620489ef3700c4acf120f858e7f7324deae3"}, - {file = "berlin-0.3.10-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e0ba9ffb34a535bd1ab66e077fec97868b0eda7a2a64ecb21c5e822e8c2849d8"}, - {file = "berlin-0.3.10-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:73faeab9c3185f604c5c9786e5eb77472693919b1905285b19fece5c0182f822"}, - {file = "berlin-0.3.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cab2d58f491aa0a40099a21ea37e77181780af7e9d29d990ef500b786d198363"}, - {file = "berlin-0.3.10-cp311-none-win32.whl", hash = "sha256:d5dd183f19f85bc0912ecc343057201b7d75fe81fb8c37510edcf24ed815cc78"}, - {file = "berlin-0.3.10-cp311-none-win_amd64.whl", hash = "sha256:3025089262adbb7b8379534711ae65f3d2536d7d1eea074444b2f3a7c3a44d3b"}, - {file = "berlin-0.3.10-cp312-cp312-macosx_10_7_x86_64.whl", hash = "sha256:e056a4b710aff7f135964a01ecaee7547c9b68737fa4ed7a48d600b8dcbf6f70"}, - {file = "berlin-0.3.10-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:747aa2bb4660210b16f7efd7d636b1545e2f6cdc5237de221d8977876b654518"}, - {file = "berlin-0.3.10-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8339280dffd93682fc143fa52d0c5f72ceb9b20e01f264af25d5495609edd0cb"}, - {file = "berlin-0.3.10-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fedec123b2f6ef4824250153c43f9088c21891ee2f24063f5b3224c37830a878"}, - {file = "berlin-0.3.10-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ff42734e888d50845ac28d85094516dd804176605aba8dc3187d493eca795c28"}, - {file = "berlin-0.3.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c33bac7d4b9b746fe241534e336755a70956bc3ee49a63ad501a07082ff95510"}, - {file = "berlin-0.3.10-cp312-none-win_amd64.whl", hash = "sha256:18bca13391e45aa1772bca3683fd10fa2f553b6ba80b0193189c68cb96dbda36"}, - {file = "berlin-0.3.10-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:57950b2d9a397e78dd70b98f302d501d418a797439e873fc65771c878ec0c7db"}, - {file = "berlin-0.3.10-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:60b53a8387b3c5b4347b1a9fe09429034c9fbc6e7cd6b92311d80dd785731075"}, - {file = "berlin-0.3.10-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2afb2f410181a9da1f6797a6450fcf7432582b1479b2b3c7257b5ccb80bf9fe7"}, - {file = "berlin-0.3.10-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1062db9333834c95224f6e369e761c6fc84fcce1470fe61490ac1a945d067f7f"}, - {file = "berlin-0.3.10-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:54f7c558ff9bf6bff160ca9da5a507713aa1b03c86250f93fce98311f5d13af5"}, - {file = "berlin-0.3.10-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bdbb7952ec26b29f76db1c2e49358be7783e7a763762e8be6d951f85a4fa72fc"}, - {file = "berlin-0.3.10-cp38-none-win32.whl", hash = "sha256:03f7187acffcbb9ff86fbe940a2ca640cff68a1233937a5b80a70a91a89c844d"}, - {file = "berlin-0.3.10-cp38-none-win_amd64.whl", hash = "sha256:3034d2b2926fdeb468e8ae419fd4074fa21e6d3a95fe9177dac3c592d6b54b90"}, - {file = "berlin-0.3.10-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:45aca0cf2405c726b47d023b2cb3c3a6707a2a2d240ae90d1a2a91595c83c680"}, - {file = "berlin-0.3.10-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4669e0f64e056a7d1d0c828359c2af146e6a7974a290b4ec4666fd1c561d1942"}, - {file = "berlin-0.3.10-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f98d343812d8a4c88f3f908f2469e6fe21b7b74ea4cb04e6b725c2ef91400c0d"}, - {file = "berlin-0.3.10-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:45bc99bc41293b81094615b60124f1cce2bac8ad474891ac895868aa433306cc"}, - {file = "berlin-0.3.10-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:826ba0c7bdc7ed4e469f06d448ea3832bfb06ddee19001c1251e1d9288d3940c"}, - {file = "berlin-0.3.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:134404fa68119473a1783d9e902d478cce530859cb0a2931fbc2bc5280a661ad"}, - {file = "berlin-0.3.10-cp39-none-win32.whl", hash = "sha256:98344b50ebab014ec8c08cfe4115c724c16c8d53329a56406eb1ad45f2f17f20"}, - {file = "berlin-0.3.10-cp39-none-win_amd64.whl", hash = "sha256:361559e9a12195261d3969d4881feafe2070f7c1c810a3cf4d6e0da7acd3c48f"}, - {file = "berlin-0.3.10-pp310-pypy310_pp73-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:cf837e85cca95a44c60642ab6faa6f4ef9ee1e5b6122084e16bc709cb55ecd1c"}, - {file = "berlin-0.3.10-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e4444836bf44d8da49f184c93c54eb19be356321873832f05fafc9ced96a39e"}, - {file = "berlin-0.3.10-pp38-pypy38_pp73-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:222413813303a6c0953d09ce4be845c1f8e83e8d55e87cc152d5d31cf797620f"}, - {file = "berlin-0.3.10-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d5d0983c0f9250c2b0d170c13726439ef8f0c3e5f7dc79366dc45cf37f7473e3"}, - {file = "berlin-0.3.10-pp38-pypy38_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:82c14ee1676baf24ff852441b8757e8352d407bcfc930b49106e714d0d3d16a6"}, - {file = "berlin-0.3.10-pp38-pypy38_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0e70e6f20683ece2c3b4cb575d7b6f17bf2107e93998c82aa0cdda94fe31e361"}, - {file = "berlin-0.3.10-pp38-pypy38_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ebd4c71f5e011f0044076fc2724f56d6e2d3040c793b8c38372cd81c288aa950"}, - {file = "berlin-0.3.10-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:166377b61c685fc86a14fb25f5c92a13e93ab79d33b5c2f398392cefffd951c2"}, - {file = "berlin-0.3.10-pp39-pypy39_pp73-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:23e13bfe4fc7985bb1e08e634ceb52b64deaf7b76f363dc5d727f76095111a91"}, - {file = "berlin-0.3.10-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:272b13ae4c35be1a46b169b2266bedec411fe7b1a450d90199427e402f82af25"}, - {file = "berlin-0.3.10-pp39-pypy39_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:31e2a725344f615b9a3f4266b12e9e5d7c1c3c560ea8a69328d49e02910785d0"}, - {file = "berlin-0.3.10-pp39-pypy39_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6bafcfe48b9fa598479eec4e07f1cdae53a7617268f93d1f28118bcbc96980d4"}, - {file = "berlin-0.3.10-pp39-pypy39_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4d023d14786686f78953312cc3675d544a4225ce80ae3bbb290579b2e8e43f4d"}, - {file = "berlin-0.3.10-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d235c930355ec1e319c6f01b5340e2df681553f256fab28378a770e2d08af6fa"}, - {file = "berlin-0.3.10.tar.gz", hash = "sha256:0e6f5ce294d463c72c9b92b2eb9ed173d6cf4abb4e047c8ca2c20cc2eedd66cd"}, + {file = "berlin-0.3.12-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:a4038f31fb8d975ff769d6a1128b2f002f6b57b5a8fd28bd3c5d64129ab05211"}, + {file = "berlin-0.3.12-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8aa18ee05a5ca0b5333ea7159005da80b556e6be7b17e23b7e8a3c09e0aea71f"}, + {file = "berlin-0.3.12-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:7743571280d45096c80461b06c190ed36f4b4a6b3bb51830a9ba9db2b93ede4c"}, + {file = "berlin-0.3.12-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d4507e3fe304a6223d8eff754c2cec14e2975d3881a00a02e710d0b49a8be264"}, + {file = "berlin-0.3.12-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f3234c535880478f8d0cb06692f1c30381c92417576fa2abf1f7ad8e44506463"}, + {file = "berlin-0.3.12-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1b9e681213b50e8c4748f09c8f2d36e3c73727cd445b95b73eb3063530ddcca3"}, + {file = "berlin-0.3.12-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:65f0663bd7a140100a8a58860109935a877ae2b6c562270f3efde6468aa2732d"}, + {file = "berlin-0.3.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:647184c97878c76100a03d44867fdb4ccdadcb0bfb5d6d4cd8e9536420362517"}, + {file = "berlin-0.3.12-cp310-none-win32.whl", hash = "sha256:d8158e4231c525797d9b51a71fe716e41da90a791422036f64b259e78234a8b6"}, + {file = "berlin-0.3.12-cp310-none-win_amd64.whl", hash = "sha256:2fdceb19b1812f9288f94e198f96b066f42f11c6acf520e0b3c4386ec08c8001"}, + {file = "berlin-0.3.12-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:36964dc08ed67d4b663fc51c8ace802d218969de904c46281fc8d5cd0e175a59"}, + {file = "berlin-0.3.12-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:9cf19b8254d6c35aa6386beff78ea56251e67648e6ec71d0dda323bd6c4cb13f"}, + {file = "berlin-0.3.12-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:71eca1d9116a86f1907ded01753d05e4fbcf10f3bd509d8739b9347981f4203c"}, + {file = "berlin-0.3.12-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1ef2b5c9790a37e5013255e4d0241a9bcbf90c9c41087d4f244c5be5465a39e7"}, + {file = "berlin-0.3.12-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:45b85c4d421b7a8f99c2832877f8e294b2b72f2acbe0151bd3118d25b0ce4a10"}, + {file = "berlin-0.3.12-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:55ddd55c5b919ceda63b3c0791e496255c1a73a66b325c2539143515c1881bc5"}, + {file = "berlin-0.3.12-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b480a3b99df83958e1dad4301d6c0aac44c6fb5a126b3216a1a9220a96daa8a1"}, + {file = "berlin-0.3.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6a493f793cc420ea073615df206f143b3bd4fd19c3e6e4e198a293fef354c637"}, + {file = "berlin-0.3.12-cp311-none-win32.whl", hash = "sha256:5d1749fb210f44550b5cae5796d4e695ca100236689677481cb2db429d90d604"}, + {file = "berlin-0.3.12-cp311-none-win_amd64.whl", hash = "sha256:766d704563e440a240ca2e58e2580431295399d84fa620e8329a9423824b7357"}, + {file = "berlin-0.3.12-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:9ce18dc37dfac90c86f28732d38ceb2bb0409ea84bb1570ac5d553ccc654737f"}, + {file = "berlin-0.3.12-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:26377d72d752f44f7683a945258eced10a10e70452d1a23de3221c40a598569d"}, + {file = "berlin-0.3.12-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:697ddf16e552901f84ecc2bc58077cca18b5137197f0a4b4caa36a6db0678545"}, + {file = "berlin-0.3.12-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c00653dea71f2f0c5556ab2f03ec871b72430c8ed1215c83b4315f9d4618bc70"}, + {file = "berlin-0.3.12-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:66fa0993dae33a9db41955131d3291c79103b3a6142f8d0420266581ece76a16"}, + {file = "berlin-0.3.12-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f8201a74320392f9375849e0e4b6e05cc99c5fd863b05ec68d6c8237055c059b"}, + {file = "berlin-0.3.12-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:538918b17388cb36c37aa67efe20d17bee5f51d20a89fbbb5b69cecc5eefc415"}, + {file = "berlin-0.3.12-cp312-none-win32.whl", hash = "sha256:5e44da4ba8302d71bf96147d72c400ad01c279fde430eba33f3212dc02afa7e9"}, + {file = "berlin-0.3.12-cp312-none-win_amd64.whl", hash = "sha256:8bd27ef93ea8f9ba14155674277e8f7e16eb8973093c2754fa379b2c64d759af"}, + {file = "berlin-0.3.12-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:ef5912548fe503808571351255727ae0f4aec6ea20dfa242fc227f611a0211a2"}, + {file = "berlin-0.3.12-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f67de26278fa4830af856cb69f93ad5d141321ef08a0701da0e8c2d693e95f9"}, + {file = "berlin-0.3.12-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9b766fe88268e1bdd0926e4835216f96281e611bb2ad00e09e3cb7d211276e70"}, + {file = "berlin-0.3.12-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a3c5bb9fe917a1d321071a5cce1ea89c1a0e767c6deeded137bc70f58ddedccf"}, + {file = "berlin-0.3.12-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:36e3e3949e89257cd1a4e77b60559b73d41ebd5e8e5659400d270b61dc9a5442"}, + {file = "berlin-0.3.12-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2caf4584e001a44a0942605a88453187214a09e7f259025aae1655639e24652"}, + {file = "berlin-0.3.12-cp38-none-win32.whl", hash = "sha256:a838e2574273c92f19ebd3103d1f78f8b3b003055ab45592c2feb230818e39ef"}, + {file = "berlin-0.3.12-cp38-none-win_amd64.whl", hash = "sha256:070633a5fdcca34aead1d09369446943914bbfbcaa954c83bdc2e8a207c0fc11"}, + {file = "berlin-0.3.12-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:79b1066d8aa81edc207ebbea78b5b90ceaae20a6a0dc4657f9657e5d74cd346b"}, + {file = "berlin-0.3.12-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1472d6968974d08f29bb9bdf0f39c1dbc294be449aa5a00645e2e98b330b27dc"}, + {file = "berlin-0.3.12-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:13d5f2328006ee86727e02df6f929b7c234e5b5e9a2c28f6cf540dd09995e6c8"}, + {file = "berlin-0.3.12-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86e11bf18707cd119e62c24232adadc200aeb1a547f7396daeda15c1f0ea9d66"}, + {file = "berlin-0.3.12-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5bea1351fd9293e50834535f64c9240b54a61db585a82e435fdf31457402365a"}, + {file = "berlin-0.3.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8778b2458c8f9b5208a32ed0a3e8e5205daa2c1f1ec497edb8364861b91c1455"}, + {file = "berlin-0.3.12-cp39-none-win32.whl", hash = "sha256:f5d68fb704c6b5396ca995a4137595178fdc0ad34d1c1b0238d0f3769774b490"}, + {file = "berlin-0.3.12-cp39-none-win_amd64.whl", hash = "sha256:5d17eefe60d8bf54d3995548dad8fdf0ca2e10a67f5b8b44dca48721da019ed1"}, + {file = "berlin-0.3.12-pp310-pypy310_pp73-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:fd95ae8c2c16c86d064049701b71a6867390bdeccc084422d5d2e5a6bc62e20a"}, + {file = "berlin-0.3.12-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3d6ee75483c31f97ee1c2fb9213cb143760a130c4406c08108f419d72f8721c2"}, + {file = "berlin-0.3.12-pp38-pypy38_pp73-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:bee3a194950cc8a8ca816975e9720c94828266ed0a9620e5b53f04421e090d51"}, + {file = "berlin-0.3.12-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:da71fae22c5d848c1750c53cd0e3003510e42fdf0a2633d728de2b380799f7bb"}, + {file = "berlin-0.3.12-pp38-pypy38_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b7dc73caf3ce3635e08aedfddce4f54c5bbb02d14d6e740db47122bbd93f1df4"}, + {file = "berlin-0.3.12-pp38-pypy38_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a82f4a929c5cedb56e2dadbeec5702ac9f5796fb9257a1761872755e4c9750e5"}, + {file = "berlin-0.3.12-pp38-pypy38_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3298f0f7058c73c07049f1e4c1671fb88fab6fed1cfee835f2d66c1ce5bf4a6c"}, + {file = "berlin-0.3.12-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e30e139abf4f4eb521900c1107ae8aa482626319c616d967aee3e82fa0aa2a18"}, + {file = "berlin-0.3.12-pp39-pypy39_pp73-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:250f0e6844d4af194593efff6e0db369828c5681fd88a2d9f27dffeb603d3a5e"}, + {file = "berlin-0.3.12-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:71b8a78e3937167f9e9e8e133c0e341dea127c2468ecc507fb9df01eeffbcbd4"}, + {file = "berlin-0.3.12-pp39-pypy39_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a2d0b8747849a5957f3c659eca3d1a378bb96b7a553bef4bceec998bddd938b7"}, + {file = "berlin-0.3.12-pp39-pypy39_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:87be2672031078ed6ab030ad10a133470c2d7cb83ca1d2c1a1741ba69c38075f"}, + {file = "berlin-0.3.12-pp39-pypy39_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f47b6cee41ad20f1f7f8f2de7a6c6bfb85f96b0604a81e028d54d8fbc7a16778"}, + {file = "berlin-0.3.12-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6216cffc69cf95972c3301cb680805a73781c16252f5333a69ad066e744f1b68"}, + {file = "berlin-0.3.12.tar.gz", hash = "sha256:93143e36c7542fb1227d93a5130a1329876de7bbef631b0d1de9338509022e6e"}, ] [[package]] @@ -297,63 +299,63 @@ files = [ [[package]] name = "coverage" -version = "7.4.1" +version = "7.4.3" description = "Code coverage measurement for Python" optional = false python-versions = ">=3.8" files = [ - {file = "coverage-7.4.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:077d366e724f24fc02dbfe9d946534357fda71af9764ff99d73c3c596001bbd7"}, - {file = "coverage-7.4.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0193657651f5399d433c92f8ae264aff31fc1d066deee4b831549526433f3f61"}, - {file = "coverage-7.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d17bbc946f52ca67adf72a5ee783cd7cd3477f8f8796f59b4974a9b59cacc9ee"}, - {file = "coverage-7.4.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a3277f5fa7483c927fe3a7b017b39351610265308f5267ac6d4c2b64cc1d8d25"}, - {file = "coverage-7.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6dceb61d40cbfcf45f51e59933c784a50846dc03211054bd76b421a713dcdf19"}, - {file = "coverage-7.4.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:6008adeca04a445ea6ef31b2cbaf1d01d02986047606f7da266629afee982630"}, - {file = "coverage-7.4.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:c61f66d93d712f6e03369b6a7769233bfda880b12f417eefdd4f16d1deb2fc4c"}, - {file = "coverage-7.4.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:b9bb62fac84d5f2ff523304e59e5c439955fb3b7f44e3d7b2085184db74d733b"}, - {file = "coverage-7.4.1-cp310-cp310-win32.whl", hash = "sha256:f86f368e1c7ce897bf2457b9eb61169a44e2ef797099fb5728482b8d69f3f016"}, - {file = "coverage-7.4.1-cp310-cp310-win_amd64.whl", hash = "sha256:869b5046d41abfea3e381dd143407b0d29b8282a904a19cb908fa24d090cc018"}, - {file = "coverage-7.4.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b8ffb498a83d7e0305968289441914154fb0ef5d8b3157df02a90c6695978295"}, - {file = "coverage-7.4.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3cacfaefe6089d477264001f90f55b7881ba615953414999c46cc9713ff93c8c"}, - {file = "coverage-7.4.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5d6850e6e36e332d5511a48a251790ddc545e16e8beaf046c03985c69ccb2676"}, - {file = "coverage-7.4.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:18e961aa13b6d47f758cc5879383d27b5b3f3dcd9ce8cdbfdc2571fe86feb4dd"}, - {file = "coverage-7.4.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dfd1e1b9f0898817babf840b77ce9fe655ecbe8b1b327983df485b30df8cc011"}, - {file = "coverage-7.4.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:6b00e21f86598b6330f0019b40fb397e705135040dbedc2ca9a93c7441178e74"}, - {file = "coverage-7.4.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:536d609c6963c50055bab766d9951b6c394759190d03311f3e9fcf194ca909e1"}, - {file = "coverage-7.4.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:7ac8f8eb153724f84885a1374999b7e45734bf93a87d8df1e7ce2146860edef6"}, - {file = "coverage-7.4.1-cp311-cp311-win32.whl", hash = "sha256:f3771b23bb3675a06f5d885c3630b1d01ea6cac9e84a01aaf5508706dba546c5"}, - {file = "coverage-7.4.1-cp311-cp311-win_amd64.whl", hash = "sha256:9d2f9d4cc2a53b38cabc2d6d80f7f9b7e3da26b2f53d48f05876fef7956b6968"}, - {file = "coverage-7.4.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f68ef3660677e6624c8cace943e4765545f8191313a07288a53d3da188bd8581"}, - {file = "coverage-7.4.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:23b27b8a698e749b61809fb637eb98ebf0e505710ec46a8aa6f1be7dc0dc43a6"}, - {file = "coverage-7.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e3424c554391dc9ef4a92ad28665756566a28fecf47308f91841f6c49288e66"}, - {file = "coverage-7.4.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e0860a348bf7004c812c8368d1fc7f77fe8e4c095d661a579196a9533778e156"}, - {file = "coverage-7.4.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fe558371c1bdf3b8fa03e097c523fb9645b8730399c14fe7721ee9c9e2a545d3"}, - {file = "coverage-7.4.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:3468cc8720402af37b6c6e7e2a9cdb9f6c16c728638a2ebc768ba1ef6f26c3a1"}, - {file = "coverage-7.4.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:02f2edb575d62172aa28fe00efe821ae31f25dc3d589055b3fb64d51e52e4ab1"}, - {file = "coverage-7.4.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:ca6e61dc52f601d1d224526360cdeab0d0712ec104a2ce6cc5ccef6ed9a233bc"}, - {file = "coverage-7.4.1-cp312-cp312-win32.whl", hash = "sha256:ca7b26a5e456a843b9b6683eada193fc1f65c761b3a473941efe5a291f604c74"}, - {file = "coverage-7.4.1-cp312-cp312-win_amd64.whl", hash = "sha256:85ccc5fa54c2ed64bd91ed3b4a627b9cce04646a659512a051fa82a92c04a448"}, - {file = "coverage-7.4.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8bdb0285a0202888d19ec6b6d23d5990410decb932b709f2b0dfe216d031d218"}, - {file = "coverage-7.4.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:918440dea04521f499721c039863ef95433314b1db00ff826a02580c1f503e45"}, - {file = "coverage-7.4.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:379d4c7abad5afbe9d88cc31ea8ca262296480a86af945b08214eb1a556a3e4d"}, - {file = "coverage-7.4.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b094116f0b6155e36a304ff912f89bbb5067157aff5f94060ff20bbabdc8da06"}, - {file = "coverage-7.4.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f2f5968608b1fe2a1d00d01ad1017ee27efd99b3437e08b83ded9b7af3f6f766"}, - {file = "coverage-7.4.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:10e88e7f41e6197ea0429ae18f21ff521d4f4490aa33048f6c6f94c6045a6a75"}, - {file = "coverage-7.4.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:a4a3907011d39dbc3e37bdc5df0a8c93853c369039b59efa33a7b6669de04c60"}, - {file = "coverage-7.4.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6d224f0c4c9c98290a6990259073f496fcec1b5cc613eecbd22786d398ded3ad"}, - {file = "coverage-7.4.1-cp38-cp38-win32.whl", hash = "sha256:23f5881362dcb0e1a92b84b3c2809bdc90db892332daab81ad8f642d8ed55042"}, - {file = "coverage-7.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:a07f61fc452c43cd5328b392e52555f7d1952400a1ad09086c4a8addccbd138d"}, - {file = "coverage-7.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8e738a492b6221f8dcf281b67129510835461132b03024830ac0e554311a5c54"}, - {file = "coverage-7.4.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:46342fed0fff72efcda77040b14728049200cbba1279e0bf1188f1f2078c1d70"}, - {file = "coverage-7.4.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9641e21670c68c7e57d2053ddf6c443e4f0a6e18e547e86af3fad0795414a628"}, - {file = "coverage-7.4.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:aeb2c2688ed93b027eb0d26aa188ada34acb22dceea256d76390eea135083950"}, - {file = "coverage-7.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d12c923757de24e4e2110cf8832d83a886a4cf215c6e61ed506006872b43a6d1"}, - {file = "coverage-7.4.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:0491275c3b9971cdbd28a4595c2cb5838f08036bca31765bad5e17edf900b2c7"}, - {file = "coverage-7.4.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:8dfc5e195bbef80aabd81596ef52a1277ee7143fe419efc3c4d8ba2754671756"}, - {file = "coverage-7.4.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:1a78b656a4d12b0490ca72651fe4d9f5e07e3c6461063a9b6265ee45eb2bdd35"}, - {file = "coverage-7.4.1-cp39-cp39-win32.whl", hash = "sha256:f90515974b39f4dea2f27c0959688621b46d96d5a626cf9c53dbc653a895c05c"}, - {file = "coverage-7.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:64e723ca82a84053dd7bfcc986bdb34af8d9da83c521c19d6b472bc6880e191a"}, - {file = "coverage-7.4.1-pp38.pp39.pp310-none-any.whl", hash = "sha256:32a8d985462e37cfdab611a6f95b09d7c091d07668fdc26e47a725ee575fe166"}, - {file = "coverage-7.4.1.tar.gz", hash = "sha256:1ed4b95480952b1a26d863e546fa5094564aa0065e1e5f0d4d0041f293251d04"}, + {file = "coverage-7.4.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:8580b827d4746d47294c0e0b92854c85a92c2227927433998f0d3320ae8a71b6"}, + {file = "coverage-7.4.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:718187eeb9849fc6cc23e0d9b092bc2348821c5e1a901c9f8975df0bc785bfd4"}, + {file = "coverage-7.4.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:767b35c3a246bcb55b8044fd3a43b8cd553dd1f9f2c1eeb87a302b1f8daa0524"}, + {file = "coverage-7.4.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ae7f19afe0cce50039e2c782bff379c7e347cba335429678450b8fe81c4ef96d"}, + {file = "coverage-7.4.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba3a8aaed13770e970b3df46980cb068d1c24af1a1968b7818b69af8c4347efb"}, + {file = "coverage-7.4.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:ee866acc0861caebb4f2ab79f0b94dbfbdbfadc19f82e6e9c93930f74e11d7a0"}, + {file = "coverage-7.4.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:506edb1dd49e13a2d4cac6a5173317b82a23c9d6e8df63efb4f0380de0fbccbc"}, + {file = "coverage-7.4.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fd6545d97c98a192c5ac995d21c894b581f1fd14cf389be90724d21808b657e2"}, + {file = "coverage-7.4.3-cp310-cp310-win32.whl", hash = "sha256:f6a09b360d67e589236a44f0c39218a8efba2593b6abdccc300a8862cffc2f94"}, + {file = "coverage-7.4.3-cp310-cp310-win_amd64.whl", hash = "sha256:18d90523ce7553dd0b7e23cbb28865db23cddfd683a38fb224115f7826de78d0"}, + {file = "coverage-7.4.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cbbe5e739d45a52f3200a771c6d2c7acf89eb2524890a4a3aa1a7fa0695d2a47"}, + {file = "coverage-7.4.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:489763b2d037b164846ebac0cbd368b8a4ca56385c4090807ff9fad817de4113"}, + {file = "coverage-7.4.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:451f433ad901b3bb00184d83fd83d135fb682d780b38af7944c9faeecb1e0bfe"}, + {file = "coverage-7.4.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fcc66e222cf4c719fe7722a403888b1f5e1682d1679bd780e2b26c18bb648cdc"}, + {file = "coverage-7.4.3-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b3ec74cfef2d985e145baae90d9b1b32f85e1741b04cd967aaf9cfa84c1334f3"}, + {file = "coverage-7.4.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:abbbd8093c5229c72d4c2926afaee0e6e3140de69d5dcd918b2921f2f0c8baba"}, + {file = "coverage-7.4.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:35eb581efdacf7b7422af677b92170da4ef34500467381e805944a3201df2079"}, + {file = "coverage-7.4.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:8249b1c7334be8f8c3abcaaa996e1e4927b0e5a23b65f5bf6cfe3180d8ca7840"}, + {file = "coverage-7.4.3-cp311-cp311-win32.whl", hash = "sha256:cf30900aa1ba595312ae41978b95e256e419d8a823af79ce670835409fc02ad3"}, + {file = "coverage-7.4.3-cp311-cp311-win_amd64.whl", hash = "sha256:18c7320695c949de11a351742ee001849912fd57e62a706d83dfc1581897fa2e"}, + {file = "coverage-7.4.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:b51bfc348925e92a9bd9b2e48dad13431b57011fd1038f08316e6bf1df107d10"}, + {file = "coverage-7.4.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d6cdecaedea1ea9e033d8adf6a0ab11107b49571bbb9737175444cea6eb72328"}, + {file = "coverage-7.4.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3b2eccb883368f9e972e216c7b4c7c06cabda925b5f06dde0650281cb7666a30"}, + {file = "coverage-7.4.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6c00cdc8fa4e50e1cc1f941a7f2e3e0f26cb2a1233c9696f26963ff58445bac7"}, + {file = "coverage-7.4.3-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b9a4a8dd3dcf4cbd3165737358e4d7dfbd9d59902ad11e3b15eebb6393b0446e"}, + {file = "coverage-7.4.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:062b0a75d9261e2f9c6d071753f7eef0fc9caf3a2c82d36d76667ba7b6470003"}, + {file = "coverage-7.4.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:ebe7c9e67a2d15fa97b77ea6571ce5e1e1f6b0db71d1d5e96f8d2bf134303c1d"}, + {file = "coverage-7.4.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:c0a120238dd71c68484f02562f6d446d736adcc6ca0993712289b102705a9a3a"}, + {file = "coverage-7.4.3-cp312-cp312-win32.whl", hash = "sha256:37389611ba54fd6d278fde86eb2c013c8e50232e38f5c68235d09d0a3f8aa352"}, + {file = "coverage-7.4.3-cp312-cp312-win_amd64.whl", hash = "sha256:d25b937a5d9ffa857d41be042b4238dd61db888533b53bc76dc082cb5a15e914"}, + {file = "coverage-7.4.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:28ca2098939eabab044ad68850aac8f8db6bf0b29bc7f2887d05889b17346454"}, + {file = "coverage-7.4.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:280459f0a03cecbe8800786cdc23067a8fc64c0bd51dc614008d9c36e1659d7e"}, + {file = "coverage-7.4.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6c0cdedd3500e0511eac1517bf560149764b7d8e65cb800d8bf1c63ebf39edd2"}, + {file = "coverage-7.4.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9a9babb9466fe1da12417a4aed923e90124a534736de6201794a3aea9d98484e"}, + {file = "coverage-7.4.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dec9de46a33cf2dd87a5254af095a409ea3bf952d85ad339751e7de6d962cde6"}, + {file = "coverage-7.4.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:16bae383a9cc5abab9bb05c10a3e5a52e0a788325dc9ba8499e821885928968c"}, + {file = "coverage-7.4.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:2c854ce44e1ee31bda4e318af1dbcfc929026d12c5ed030095ad98197eeeaed0"}, + {file = "coverage-7.4.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:ce8c50520f57ec57aa21a63ea4f325c7b657386b3f02ccaedeccf9ebe27686e1"}, + {file = "coverage-7.4.3-cp38-cp38-win32.whl", hash = "sha256:708a3369dcf055c00ddeeaa2b20f0dd1ce664eeabde6623e516c5228b753654f"}, + {file = "coverage-7.4.3-cp38-cp38-win_amd64.whl", hash = "sha256:1bf25fbca0c8d121a3e92a2a0555c7e5bc981aee5c3fdaf4bb7809f410f696b9"}, + {file = "coverage-7.4.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3b253094dbe1b431d3a4ac2f053b6d7ede2664ac559705a704f621742e034f1f"}, + {file = "coverage-7.4.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:77fbfc5720cceac9c200054b9fab50cb2a7d79660609200ab83f5db96162d20c"}, + {file = "coverage-7.4.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6679060424faa9c11808598504c3ab472de4531c571ab2befa32f4971835788e"}, + {file = "coverage-7.4.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4af154d617c875b52651dd8dd17a31270c495082f3d55f6128e7629658d63765"}, + {file = "coverage-7.4.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8640f1fde5e1b8e3439fe482cdc2b0bb6c329f4bb161927c28d2e8879c6029ee"}, + {file = "coverage-7.4.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:69b9f6f66c0af29642e73a520b6fed25ff9fd69a25975ebe6acb297234eda501"}, + {file = "coverage-7.4.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:0842571634f39016a6c03e9d4aba502be652a6e4455fadb73cd3a3a49173e38f"}, + {file = "coverage-7.4.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a78ed23b08e8ab524551f52953a8a05d61c3a760781762aac49f8de6eede8c45"}, + {file = "coverage-7.4.3-cp39-cp39-win32.whl", hash = "sha256:c0524de3ff096e15fcbfe8f056fdb4ea0bf497d584454f344d59fce069d3e6e9"}, + {file = "coverage-7.4.3-cp39-cp39-win_amd64.whl", hash = "sha256:0209a6369ccce576b43bb227dc8322d8ef9e323d089c6f3f26a597b09cb4d2aa"}, + {file = "coverage-7.4.3-pp38.pp39.pp310-none-any.whl", hash = "sha256:7cbde573904625509a3f37b6fecea974e363460b556a627c60dc2f47e2fffa51"}, + {file = "coverage-7.4.3.tar.gz", hash = "sha256:276f6077a5c61447a48d133ed13e759c09e62aff0dc84274a68dc18660104d52"}, ] [package.dependencies] @@ -1115,19 +1117,19 @@ gitlab = ["python-gitlab (>=1.3.0)"] [[package]] name = "setuptools" -version = "69.1.0" +version = "69.1.1" description = "Easily download, build, install, upgrade, and uninstall Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "setuptools-69.1.0-py3-none-any.whl", hash = "sha256:c054629b81b946d63a9c6e732bc8b2513a7c3ea645f11d0139a2191d735c60c6"}, - {file = "setuptools-69.1.0.tar.gz", hash = "sha256:850894c4195f09c4ed30dba56213bf7c3f21d86ed6bdaafb5df5972593bfc401"}, + {file = "setuptools-69.1.1-py3-none-any.whl", hash = "sha256:02fa291a0471b3a18b2b2481ed902af520c69e8ae0919c13da936542754b4c56"}, + {file = "setuptools-69.1.1.tar.gz", hash = "sha256:5c0806c7d9af348e6dd3777b4f4dbb42c7ad85b190104837488eab9a7c945cf8"}, ] [package.extras] docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff (>=0.2.1)", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] -testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.1)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.2)", "pip (>=19.1)", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff (>=0.2.1)", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.2)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] [[package]] name = "six" @@ -1206,24 +1208,24 @@ files = [ [[package]] name = "typing-extensions" -version = "4.9.0" +version = "4.10.0" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.9.0-py3-none-any.whl", hash = "sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd"}, - {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"}, + {file = "typing_extensions-4.10.0-py3-none-any.whl", hash = "sha256:69b1a937c3a517342112fb4c6df7e72fc39a38e7891a5730ed4985b5214b5475"}, + {file = "typing_extensions-4.10.0.tar.gz", hash = "sha256:b0abd7c89e8fb96f98db18d86106ff1d90ab692004eb746cf6eda2682f91b3cb"}, ] [[package]] name = "urllib3" -version = "2.2.0" +version = "2.2.1" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.8" files = [ - {file = "urllib3-2.2.0-py3-none-any.whl", hash = "sha256:ce3711610ddce217e6d113a2732fafad960a03fd0318c91faa79481e35c11224"}, - {file = "urllib3-2.2.0.tar.gz", hash = "sha256:051d961ad0c62a94e50ecf1af379c3aba230c66c710493493560c0c223c49f20"}, + {file = "urllib3-2.2.1-py3-none-any.whl", hash = "sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d"}, + {file = "urllib3-2.2.1.tar.gz", hash = "sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19"}, ] [package.extras] @@ -1331,4 +1333,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "a3aba2a2ea4462418b62b7857dba7ce9f2ab342dbd5235eab500571693e40c7d" +content-hash = "03bcad4e3f6c3ac1f3b0d9230be5b3c79c6588e06621de1baee00dff49725dd4" diff --git a/pyproject.toml b/pyproject.toml index fa5bd87..5162be1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ dependencies = [ "gunicorn", "structlog>=21.5.0,<21.6", "python-dateutil>=2.8.2,<2.9", - "berlin>=0.3.10,<4", + "berlin>=0.3.12,<4", ] [project.optional-dependencies] @@ -62,15 +62,17 @@ Flask = "^2.0.2" structlog = "^23.3.0" python-dateutil = "^2.8.2" requests = "^2.30.0" -berlin = ">=0.3.10,<0.4" +berlin = ">=0.3.12,<0.4" ruff = "^0.0.265" safety = "^2.3.5" dynaconf = "^3.1.12" pip = "^23.1.2" gunicorn = "^21.2.0" json-log-formatter = "^0.5.2" +Jinja2 = ">=3.1.3" [tool.poetry.dev-dependencies] +Jinja2 = ">=3.1.3" pytest = "^6.2.5" flake8 = "^4.0.1" pylint = "^2.15.4" diff --git a/tests/api/conftest.py b/tests/api/conftest.py index 59e6521..92671c7 100644 --- a/tests/api/conftest.py +++ b/tests/api/conftest.py @@ -101,6 +101,13 @@ def get_subdiv_code(self): def get_state_code(self): return "gb" + + def get_score(self): + return 1010 + + def get_offset(self): + return [0, 10] + class FakeBerlinDbProxy: def query(self, query, state, limit, lev_distance): diff --git a/tests/api/server_test.py b/tests/api/server_test.py index 1430575..6675e22 100644 --- a/tests/api/server_test.py +++ b/tests/api/server_test.py @@ -23,40 +23,83 @@ def test_code_with_berlin(test_client_with_berlin): print(response.json) -def test_search_with_state_with_berlin(test_client_with_berlin): +def test_search_with_scores_with_berlin(test_client_with_berlin): response = test_client_with_berlin.get( - "/berlin/search?q=Lyuliakovo&state=BG&limit=2" + "/berlin/search?q=Dentists+in+Lyuliakovo&state=BG&limit=2&with_scores=1" ) + print(response.json) assert response.status_code == 200 assert isinstance(response.json, dict) assert response.json == { "matches": [{ - "encoding": "UN-LOCODE", - "id": "bg:blo", - "key": "UN-LOCODE-bg:blo", - "names": ["lyuliakovo"], - "words": ["lyuliakovo"], - "codes": ["blo"], - "state": ["bg", "ISO-3166-1-bg"], - "subdiv": ["02", "ISO-3166-2-bg:02"], - }] + "loc": { + "encoding": "UN-LOCODE", + "id": "bg:blo", + "key": "UN-LOCODE-bg:blo", + "names": ["lyuliakovo"], + "words": ["lyuliakovo"], + "codes": ["blo"], + "state": ["bg", "ISO-3166-1-bg"], + "subdiv": ["02", "ISO-3166-2-bg:02"], + }, + 'scores': { + 'offset': [12, 22], + 'score': 1010 + } + }], + 'query': 'Dentists in ' + } + +def test_search_with_state_with_berlin(test_client_with_berlin): + response = test_client_with_berlin.get( + "/berlin/search?q=Lyuliakovo&state=BG&limit=2&with_scores=1" + ) + assert response.status_code == 200 + assert isinstance(response.json, dict) + assert response.json == { + 'matches': [{ + 'loc': { + 'codes': ['blo'], + 'encoding': 'UN-LOCODE', + 'id': 'bg:blo', + 'key': 'UN-LOCODE-bg:blo', + 'names': ['lyuliakovo'], + 'state': ['bg', 'ISO-3166-1-bg'], + 'subdiv': ['02', 'ISO-3166-2-bg:02'], + 'words': ['lyuliakovo'] + }, + 'scores': { + 'offset': [0, 10], + 'score': 1010 + } + }], + 'query': '' } print(response.json) def test_search_with_state(test_client): - response = test_client.get("/berlin/search?q=Manch&state=GB&limit=2") + response = test_client.get("/berlin/search?q=Manch&state=GB&limit=2&with_scores=1") assert response.status_code == 200 assert isinstance(response.json, dict) assert response.json == { - "matches": [{ - "encoding": "B", - "id": "X", - "key": "A", - "names": ["manc"], - "words": ["Manchester"], - "codes": ["mnc"], - "state": ["gb", "gb-nom"], - "subdiv": ["mac", "gb-mac-name"], - }] + 'matches': [{ + 'loc': { + 'codes': ['mnc'], + 'encoding': 'B', + 'id': 'X', + 'key': 'A', + 'names': ['manc'], + 'state': ['gb', 'gb-nom'], + 'subdiv': ['mac', 'gb-mac-name'], + 'words': ['Manchester'] + }, + 'scores': { + 'offset': [0, 10], + 'score': 1010 + } + }], + 'query': '' } + print(response.json) +