diff --git a/custom/.bandit.yaml b/custom/.bandit.yaml deleted file mode 100644 index 6db076a13..000000000 --- a/custom/.bandit.yaml +++ /dev/null @@ -1,3 +0,0 @@ -skips: - - B101 # Use of assert detected. - - B113 # Requests call without timeout. Done internally diff --git a/custom/.prospector.yaml b/custom/.prospector.yaml index 2e066f823..5bde363b0 100644 --- a/custom/.prospector.yaml +++ b/custom/.prospector.yaml @@ -2,12 +2,15 @@ inherits: - utils:base - utils:fix - utils:no-design-checks + - utils:c2cwsgiutils - duplicated -pylint: +ruff: disable: - - missing-timeout # Default timeout set by c2cwsgiutils + - D101 # Missing docstring in public class + - D102 # Missing docstring in public method + - D103 # Missing docstring in public function -bandit: +mypy: options: - config: .bandit.yaml + python_version: '3.10' diff --git a/custom/custom/__init__.py b/custom/custom/__init__.py index af76f4a12..a82af1da1 100644 --- a/custom/custom/__init__.py +++ b/custom/custom/__init__.py @@ -5,7 +5,7 @@ def main(global_config, **settings): - """This function returns a Pyramid WSGI application.""" + """Get the Pyramid WSGI application.""" del global_config # Unused. with Configurator(settings=settings) as config: config.include("pyramid_mako") diff --git a/custom/custom/scripts/initialize_db.py b/custom/custom/scripts/initialize_db.py index 3de37d181..59f5de510 100644 --- a/custom/custom/scripts/initialize_db.py +++ b/custom/custom/scripts/initialize_db.py @@ -8,10 +8,7 @@ def setup_models(dbsession): - """ - Add or update models / fixtures in the database. - - """ + """Add or update models / fixtures in the database.""" del dbsession # Unused diff --git a/custom/custom/views/swisscom_heatmap/query_swisscom_heatmap_api.py b/custom/custom/views/swisscom_heatmap/query_swisscom_heatmap_api.py index e166d6d8f..93ad2b1be 100644 --- a/custom/custom/views/swisscom_heatmap/query_swisscom_heatmap_api.py +++ b/custom/custom/views/swisscom_heatmap/query_swisscom_heatmap_api.py @@ -103,7 +103,7 @@ def get_dwell_demographics(self, postal_code: int, date_time: datetime) -> Featu return self.error return self.response_to_geojson_result(response.json()) - def check_api_error(self, response: Response): + def check_api_error(self, response: Response) -> None: if response.status_code != 200: err_code = response.status_code err_txt = response.text @@ -111,9 +111,10 @@ def check_api_error(self, response: Response): self.error = Response(err_txt, status=err_code) raise ExternalAPIError("External api error") - def limit_query(self): + def limit_query(self) -> None: """ Limit amount of allowed queries per day. + [bgerber] It's rude, but we are using my own key ! """ delta = datetime.now() - self.request_date diff --git a/custom/poetry.lock b/custom/poetry.lock index 82831724f..3f3fbfc07 100644 --- a/custom/poetry.lock +++ b/custom/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand. [[package]] name = "alembic" @@ -30,17 +30,6 @@ files = [ {file = "astroid-3.3.5.tar.gz", hash = "sha256:5cfc40ae9f68311075d27ef68a4841bdc5cc7f6cf86671b49f00607d30188e2d"}, ] -[[package]] -name = "async-timeout" -version = "5.0.1" -description = "Timeout context manager for asyncio programs" -optional = false -python-versions = ">=3.8" -files = [ - {file = "async_timeout-5.0.1-py3-none-any.whl", hash = "sha256:39e3809566ff85354557ec2398b55e096c8364bacac9405a7a1fa429e77fe76c"}, - {file = "async_timeout-5.0.1.tar.gz", hash = "sha256:d9321a7a3d5a6a5e187e824d2fa0793ce379a202935782d555d6e9d2735677d3"}, -] - [[package]] name = "azure-core" version = "1.32.0" @@ -767,6 +756,17 @@ files = [ [package.extras] colors = ["colorama (>=0.4.6)"] +[[package]] +name = "legacy-cgi" +version = "2.6.1" +description = "Fork of the standard library cgi and cgitb modules, being deprecated in PEP-594" +optional = false +python-versions = "<4.0,>=3.10" +files = [ + {file = "legacy_cgi-2.6.1-py3-none-any.whl", hash = "sha256:8eacc1522d9f76451337a4b5a0abf494158d39250754b0d1bc19a14c6512af9b"}, + {file = "legacy_cgi-2.6.1.tar.gz", hash = "sha256:f2ada99c747c3d72a473a6aaff6259a61f226b06fe9f3106e495ab83fd8f7a42"}, +] + [[package]] name = "mako" version = "1.3.6" @@ -1259,6 +1259,7 @@ pylint-flask = "0.6" pyroma = {version = ">=2.4", optional = true, markers = "extra == \"with-pyroma\" or extra == \"with_everything\""} PyYAML = "*" requirements-detector = ">=1.3.2" +ruff = {version = "*", optional = true, markers = "extra == \"with-ruff\" or extra == \"with_everything\""} setoptconf-tmp = ">=0.3.1,<0.4.0" toml = ">=0.10.2,<0.11.0" @@ -1273,24 +1274,24 @@ with-vulture = ["vulture (>=1.5)"] [[package]] name = "prospector-profile-duplicated" -version = "1.8.0" +version = "1.8.1" description = "Profile that can be used to disable the duplicated or conflict rules between Prospector and other tools" optional = false python-versions = "*" files = [ - {file = "prospector_profile_duplicated-1.8.0-py2.py3-none-any.whl", hash = "sha256:c36ca647848739e1ca52cf220b00ba1fbdf7105217d5534a5bf2e65279ad6011"}, - {file = "prospector_profile_duplicated-1.8.0.tar.gz", hash = "sha256:1565109b016fac05c61dbce38b952bfce3ff054d0c5493d1acad1fc8e9909704"}, + {file = "prospector_profile_duplicated-1.8.1-py2.py3-none-any.whl", hash = "sha256:a3c23517b9749ea0e61cc9b23d1526752c1eeb6c899cd0d9ec1fa77b1f373a49"}, + {file = "prospector_profile_duplicated-1.8.1.tar.gz", hash = "sha256:a08fa1f5aa77bdbc908b0c4f66b2bdb306aba10c44c5db51e389cd5cf79bda04"}, ] [[package]] name = "prospector-profile-utils" -version = "1.12.2" +version = "1.14.0" description = "Some utility Prospector profiles." optional = false python-versions = "<4.0,>=3.9" files = [ - {file = "prospector_profile_utils-1.12.2-py3-none-any.whl", hash = "sha256:74e487babdf38f2255f54e800fef200a80f67cb27014da2dc785c7c245daf965"}, - {file = "prospector_profile_utils-1.12.2.tar.gz", hash = "sha256:0d152bfc54bea059c13483d43727b9031b4c3cdfde21e4e6fa6edc5cc482c5fa"}, + {file = "prospector_profile_utils-1.14.0-py3-none-any.whl", hash = "sha256:15853e984314f90d688052c7dc09c9206779fdfb7f0606f6a4a617d167c6e693"}, + {file = "prospector_profile_utils-1.14.0.tar.gz", hash = "sha256:258bbe70c7411c7c11a7a7fc202c9a021db3d775a3bf45e7e8bd9f96206bcc48"}, ] [package.dependencies] @@ -1412,10 +1413,7 @@ files = [ [package.dependencies] astroid = ">=3.3.5,<=3.4.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} -dill = [ - {version = ">=0.3.7", markers = "python_version >= \"3.12\""}, - {version = ">=0.3.6", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, -] +dill = {version = ">=0.3.7", markers = "python_version >= \"3.12\""} isort = ">=4.2.5,<5.13.0 || >5.13.0,<6" mccabe = ">=0.6,<0.8" platformdirs = ">=2.2.0" @@ -1722,9 +1720,6 @@ files = [ {file = "redis-5.2.0.tar.gz", hash = "sha256:0b1087665a771b1ff2e003aa5bdd354f15a70c9e25d5a7dbf9c722c16528a7b0"}, ] -[package.dependencies] -async-timeout = {version = ">=4.0.3", markers = "python_full_version < \"3.11.3\""} - [package.extras] hiredis = ["hiredis (>=3.0.0)"] ocsp = ["cryptography (>=36.0.1)", "pyopenssl (==23.2.1)", "requests (>=2.31.0)"] @@ -1802,6 +1797,33 @@ pygments = ">=2.13.0,<3.0.0" [package.extras] jupyter = ["ipywidgets (>=7.5.1,<9)"] +[[package]] +name = "ruff" +version = "0.8.1" +description = "An extremely fast Python linter and code formatter, written in Rust." +optional = false +python-versions = ">=3.7" +files = [ + {file = "ruff-0.8.1-py3-none-linux_armv6l.whl", hash = "sha256:fae0805bd514066f20309f6742f6ee7904a773eb9e6c17c45d6b1600ca65c9b5"}, + {file = "ruff-0.8.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b8a4f7385c2285c30f34b200ca5511fcc865f17578383db154e098150ce0a087"}, + {file = "ruff-0.8.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:cd054486da0c53e41e0086e1730eb77d1f698154f910e0cd9e0d64274979a209"}, + {file = "ruff-0.8.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2029b8c22da147c50ae577e621a5bfbc5d1fed75d86af53643d7a7aee1d23871"}, + {file = "ruff-0.8.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2666520828dee7dfc7e47ee4ea0d928f40de72056d929a7c5292d95071d881d1"}, + {file = "ruff-0.8.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:333c57013ef8c97a53892aa56042831c372e0bb1785ab7026187b7abd0135ad5"}, + {file = "ruff-0.8.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:288326162804f34088ac007139488dcb43de590a5ccfec3166396530b58fb89d"}, + {file = "ruff-0.8.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b12c39b9448632284561cbf4191aa1b005882acbc81900ffa9f9f471c8ff7e26"}, + {file = "ruff-0.8.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:364e6674450cbac8e998f7b30639040c99d81dfb5bbc6dfad69bc7a8f916b3d1"}, + {file = "ruff-0.8.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b22346f845fec132aa39cd29acb94451d030c10874408dbf776af3aaeb53284c"}, + {file = "ruff-0.8.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b2f2f7a7e7648a2bfe6ead4e0a16745db956da0e3a231ad443d2a66a105c04fa"}, + {file = "ruff-0.8.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:adf314fc458374c25c5c4a4a9270c3e8a6a807b1bec018cfa2813d6546215540"}, + {file = "ruff-0.8.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:a885d68342a231b5ba4d30b8c6e1b1ee3a65cf37e3d29b3c74069cdf1ee1e3c9"}, + {file = "ruff-0.8.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:d2c16e3508c8cc73e96aa5127d0df8913d2290098f776416a4b157657bee44c5"}, + {file = "ruff-0.8.1-py3-none-win32.whl", hash = "sha256:93335cd7c0eaedb44882d75a7acb7df4b77cd7cd0d2255c93b28791716e81790"}, + {file = "ruff-0.8.1-py3-none-win_amd64.whl", hash = "sha256:2954cdbe8dfd8ab359d4a30cd971b589d335a44d444b6ca2cb3d1da21b75e4b6"}, + {file = "ruff-0.8.1-py3-none-win_arm64.whl", hash = "sha256:55873cc1a473e5ac129d15eccb3c008c096b94809d693fc7053f588b67822737"}, + {file = "ruff-0.8.1.tar.gz", hash = "sha256:3583db9a6450364ed5ca3f3b4225958b24f78178908d5c4bc0f46251ccca898f"}, +] + [[package]] name = "semver" version = "3.0.2" @@ -2375,6 +2397,9 @@ files = [ {file = "webob-1.8.9.tar.gz", hash = "sha256:ad6078e2edb6766d1334ec3dee072ac6a7f95b1e32ce10def8ff7f0f02d56589"}, ] +[package.dependencies] +legacy-cgi = {version = ">=2.6", markers = "python_version >= \"3.13\""} + [package.extras] docs = ["Sphinx (>=1.7.5)", "pylons-sphinx-themes"] testing = ["coverage", "pytest (>=3.1.0)", "pytest-cov", "pytest-xdist"] @@ -2474,5 +2499,5 @@ test = ["zope.testing"] [metadata] lock-version = "2.0" -python-versions = ">=3.11,<3.13" -content-hash = "4da08c332d303629b21c7fc47ca4f31b21f3c92f9d87ca9f2f1eaef9c987f260" +python-versions = ">=3.12,<3.14" +content-hash = "d23589d3fabe2866f8c01de292b7a55c470a5d67a3cd52241eb360bbe2d080aa" diff --git a/custom/pyproject.toml b/custom/pyproject.toml index d0034217c..862170a4e 100644 --- a/custom/pyproject.toml +++ b/custom/pyproject.toml @@ -5,7 +5,7 @@ description = 'Not used' authors = [] [tool.poetry.dependencies] -python = ">=3.11,<3.13" +python = ">=3.12,<3.14" gunicorn = "23.0.0" plaster-pastedeploy = "1.0.1" pyramid = "2.0.2" @@ -40,8 +40,8 @@ webob = { version = "1.8.9", optional = true } cryptography = { version = "43.0.3", optional = true } [tool.poetry.group.dev.dependencies] -prospector = { version = "1.13.3", extras = ["with_bandit", "with_mypy", "with_pyroma"] } -prospector-profile-utils = "1.12.2" -prospector-profile-duplicated = "1.8.0" +prospector = { version = "1.13.3", extras = ["with_bandit", "with_mypy", "with_pyroma", "with_ruff"] } +prospector-profile-utils = "1.14.0" +prospector-profile-duplicated = "1.8.1" types-requests = "2.32.0.20241016" types-oauthlib = "3.2.0.20240806"