From 75fa2b4bd251b04df7dbefee97f275bd6f8e7073 Mon Sep 17 00:00:00 2001 From: Uxio Fuentefria Date: Wed, 21 Feb 2024 14:14:59 +0100 Subject: [PATCH] Update precommit --- .pre-commit-config.yaml | 15 ++++++++------- config/gunicorn.py | 1 + config/wsgi.py | 1 + safe_transaction_service/contracts/tx_decoder.py | 6 +++--- .../commands/export_multisig_tx_data.py | 10 +++++++--- safe_transaction_service/history/serializers.py | 6 +++--- .../history/services/collectibles_service.py | 12 ++++++------ 7 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4a9665210..4da3abbae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,27 +2,28 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/psf/black - rev: 23.11.0 + rev: 24.2.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: + - id: check-added-large-files - id: check-docstring-first - id: check-merge-conflict + - id: check-symlinks + - id: check-yaml - id: debug-statements - id: detect-private-key - - id: requirements-txt-fixer - - id: trailing-whitespace - id: end-of-file-fixer types: [python] - - id: check-yaml - - id: check-added-large-files + - id: requirements-txt-fixer + - id: trailing-whitespace diff --git a/config/gunicorn.py b/config/gunicorn.py index 247ed43e4..83562955c 100644 --- a/config/gunicorn.py +++ b/config/gunicorn.py @@ -1,6 +1,7 @@ """ Store gunicorn variables in this file, so they can be read by Django """ + import os gunicorn_request_timeout = os.environ.get("WEB_WORKER_TIMEOUT", 60) diff --git a/config/wsgi.py b/config/wsgi.py index 234b47313..07bc8ad6e 100644 --- a/config/wsgi.py +++ b/config/wsgi.py @@ -13,6 +13,7 @@ framework. """ + import os import sys diff --git a/safe_transaction_service/contracts/tx_decoder.py b/safe_transaction_service/contracts/tx_decoder.py index 826c21b53..0fed44287 100644 --- a/safe_transaction_service/contracts/tx_decoder.py +++ b/safe_transaction_service/contracts/tx_decoder.py @@ -164,9 +164,9 @@ class SafeTxDecoder: def __init__(self): logger.info("%s: Loading contract ABIs for decoding", self.__class__.__name__) - self.fn_selectors_with_abis: Dict[ - bytes, ABIFunction - ] = self._generate_selectors_with_abis_from_abis(self.get_supported_abis()) + self.fn_selectors_with_abis: Dict[bytes, ABIFunction] = ( + self._generate_selectors_with_abis_from_abis(self.get_supported_abis()) + ) logger.info( "%s: Contract ABIs for decoding were loaded", self.__class__.__name__ ) diff --git a/safe_transaction_service/history/management/commands/export_multisig_tx_data.py b/safe_transaction_service/history/management/commands/export_multisig_tx_data.py index 6f880e211..a89398b8d 100644 --- a/safe_transaction_service/history/management/commands/export_multisig_tx_data.py +++ b/safe_transaction_service/history/management/commands/export_multisig_tx_data.py @@ -60,9 +60,13 @@ def handle(self, *args, **options): m.to, str(m.failed), m.origin, - json.dumps(decoder.get_data_decoded(m.data.tobytes())) - if m.data - else "", + ( + json.dumps( + decoder.get_data_decoded(m.data.tobytes()) + ) + if m.data + else "" + ), ] ) + "\n" diff --git a/safe_transaction_service/history/serializers.py b/safe_transaction_service/history/serializers.py index abb5db622..ca6a41ad7 100644 --- a/safe_transaction_service/history/serializers.py +++ b/safe_transaction_service/history/serializers.py @@ -299,9 +299,9 @@ def save(self, **kwargs): "safe": self.validated_data["safe"], "to": self.validated_data["to"], "value": self.validated_data["value"], - "data": self.validated_data["data"] - if self.validated_data["data"] - else None, + "data": ( + self.validated_data["data"] if self.validated_data["data"] else None + ), "operation": self.validated_data["operation"], "safe_tx_gas": self.validated_data["safe_tx_gas"], "base_gas": self.validated_data["base_gas"], diff --git a/safe_transaction_service/history/services/collectibles_service.py b/safe_transaction_service/history/services/collectibles_service.py index cdfeae6c8..7dd5d25f6 100644 --- a/safe_transaction_service/history/services/collectibles_service.py +++ b/safe_transaction_service/history/services/collectibles_service.py @@ -489,9 +489,9 @@ def _get_collectibles_with_metadata( # Creates a collectibles metadata keeping the initial order for collectible_metadata_cached_index in range(len(collectibles_with_metadata)): if collectibles_with_metadata[collectible_metadata_cached_index] is None: - collectibles_with_metadata[ - collectible_metadata_cached_index - ] = collectibles_with_metadata_not_cached.pop(0) + collectibles_with_metadata[collectible_metadata_cached_index] = ( + collectibles_with_metadata_not_cached.pop(0) + ) return collectibles_with_metadata, count @@ -607,9 +607,9 @@ def get_redis_key(address_with_token_id: Tuple[ChecksumAddress, int]) -> str: if blockchain_token_uris: pipe = self.redis.pipeline() redis_map_to_store = { - get_redis_key(address_with_token_id): token_uri - if token_uri is not None - else "" + get_redis_key(address_with_token_id): ( + token_uri if token_uri is not None else "" + ) for address_with_token_id, token_uri in blockchain_token_uris.items() } pipe.mset(redis_map_to_store)