diff --git a/contracting_process/field_level/definitions.py b/contracting_process/field_level/definitions.py index 5ed43a2..3f67ba5 100644 --- a/contracting_process/field_level/definitions.py +++ b/contracting_process/field_level/definitions.py @@ -52,7 +52,7 @@ def _definitions(properties, path=None, refs=None): elif refs[-1] == "ContactPoint": if key == "email": checks.append((email.calculate, email.name)) - elif key in ("faxNumber", "telephone"): + elif key in {"faxNumber", "telephone"}: checks.append((telephone.calculate, telephone.name)) elif refs[-1] == "Document": if key == "description": @@ -82,7 +82,7 @@ def _definitions(properties, path=None, refs=None): if key == "numberOfTenderers": checks.append((number.calculate, number.name)) elif refs[-1] == "Value": # noqa: SIM102 # consistency - if key == "amount" and new_path[-3] in ("transactions", "unit"): + if key == "amount" and new_path[-3] in {"transactions", "unit"}: checks.append((number.calculate, number.name)) yield dot_path, checks diff --git a/contracting_process/resource_level/consistent/contracts_value.py b/contracting_process/resource_level/consistent/contracts_value.py index e518351..3e12903 100644 --- a/contracting_process/resource_level/consistent/contracts_value.py +++ b/contracting_process/resource_level/consistent/contracts_value.py @@ -71,7 +71,7 @@ def calculate(item): award_amount = get_amount(no_conversion, unconverted_amount, currency, date) # (2,5) Amount is zero or unconvertable. - if award_amount in (0, None): + if award_amount in {0, None}: continue contracts_amount_sum = 0 @@ -85,7 +85,7 @@ def calculate(item): contract_amount = get_amount(no_conversion, unconverted_amount, currency, date) # (2,5) Amount is zero or unconvertable. - if contract_amount in (0, None): + if contract_amount in {0, None}: break # (4) Different signs. diff --git a/contracting_process/resource_level/consistent/tender_value.py b/contracting_process/resource_level/consistent/tender_value.py index 3a7436d..1f3fb25 100644 --- a/contracting_process/resource_level/consistent/tender_value.py +++ b/contracting_process/resource_level/consistent/tender_value.py @@ -38,7 +38,7 @@ def calculate(item): planning_amount = convert(planning_amount, planning_currency, "USD", date) tender_amount = convert(tender_amount, tender_currency, "USD", date) - if planning_amount in (0, None) or tender_amount in (0, None): + if planning_amount in {0, None} or tender_amount in {0, None}: result["meta"] = {"reason": "an amount is zero or unconvertable"} return result diff --git a/manage.py b/manage.py index ee32051..8b0e799 100755 --- a/manage.py +++ b/manage.py @@ -46,7 +46,7 @@ def remove(dataset_id, include_filtered, force): {"dataset_id": dataset_id}, ) row = cursor.fetchone() - if not row or row[0] not in (Phase.CHECKED, Phase.DELETED) or row[1] != State.OK: + if not row or row[0] not in {Phase.CHECKED, Phase.DELETED} or row[1] != State.OK: if force: click.secho( f"Forcefully removing dataset {dataset_id} (phase={row[0]}, state={row[1]}). (Its phase should be " diff --git a/pelican/util/getter.py b/pelican/util/getter.py index abacf38..d3f9f6b 100644 --- a/pelican/util/getter.py +++ b/pelican/util/getter.py @@ -93,7 +93,7 @@ def deep_get(value: Any, path: str, force: type[Any] | None = None) -> Any: for part in path.split("."): if type(value) is dict and part in value: value = value[part] - elif force in (dict, list, str): + elif force in {dict, list, str}: return force() else: return None @@ -103,9 +103,9 @@ def deep_get(value: Any, path: str, force: type[Any] | None = None) -> Any: return parse_date(value) if force is datetime.datetime: return parse_datetime(value) - if force in (dict, list): + if force in {dict, list}: value = force() - elif force in (float, int, str): + elif force in {float, int, str}: try: value = force(value) except (ValueError, TypeError): diff --git a/workers/check/dataset.py b/workers/check/dataset.py index 7753851..3153281 100644 --- a/workers/check/dataset.py +++ b/workers/check/dataset.py @@ -44,7 +44,7 @@ def callback(client_state, channel, method, properties, input_message): logger.info("Dataset %s: DATASET phase already in-progress", dataset_id) ack(client_state, channel, delivery_tag) return - if dataset["phase"] in (Phase.DATASET, Phase.TIME_VARIANCE, Phase.CHECKED, Phase.DELETED): + if dataset["phase"] in {Phase.DATASET, Phase.TIME_VARIANCE, Phase.CHECKED, Phase.DELETED}: logger.info("Dataset %s: DATASET phase already complete", dataset_id) ack(client_state, channel, delivery_tag) return