Skip to content

Commit

Permalink
Update dependencies (#2293)
Browse files Browse the repository at this point in the history
* chore: update-dependencies

* Reformat code with Ruff 0.9.1

---------

Co-authored-by: opensafely-github-bot <[email protected]>
Co-authored-by: Steven Maude <[email protected]>
  • Loading branch information
3 people authored Jan 16, 2025
1 parent c279c84 commit 086090c
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 143 deletions.
2 changes: 1 addition & 1 deletion codelists/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def clean_csv_data(self):
for i, value in enumerate(header):
if value != value.strip():
raise forms.ValidationError(
f'Header {i+1} ("{value}") contains extraneous whitespace'
f'Header {i + 1} ("{value}") contains extraneous whitespace'
)

# restrict the headers we expect
Expand Down
12 changes: 6 additions & 6 deletions codelists/tests/views/assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

def assert_unauthenticated(client, method, url):
response = getattr(client, method)(url)
assert (
response.status_code == 302
), f"Unexpected status code! Can unauthenticated user {method.upper()} to {url}?"
assert response.status_code == 302, (
f"Unexpected status code! Can unauthenticated user {method.upper()} to {url}?"
)
assert response.url.startswith("/accounts/login/")


Expand All @@ -23,9 +23,9 @@ def assert_unauthorised(client, method, url):
)
client.force_login(user)
response = getattr(client, method)(url)
assert (
response.status_code == 302
), f"Unexpected status code! Can unauthorised user {method.upper()} to to {url}?"
assert response.status_code == 302, (
f"Unexpected status code! Can unauthorised user {method.upper()} to to {url}?"
)
assert response.url == "/"


Expand Down
6 changes: 3 additions & 3 deletions coding_systems/base/coding_system_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ def validate_db_alias(cls, database_alias):
.filter(coding_system=cls.id)
.values_list("database_alias", flat=True)
)
assert (
database_alias in all_slugs
), f"{database_alias} is not a valid database alias for a {cls.short_name} release."
assert database_alias in all_slugs, (
f"{database_alias} is not a valid database alias for a {cls.short_name} release."
)
return database_alias

@cached_property
Expand Down
6 changes: 3 additions & 3 deletions coding_systems/bnf/import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def import_data(
logger.info("Extracting", release_zip=release_zip.filename)
release_zip.extractall(path=tempdir)
paths = list(Path(tempdir).glob("*.csv"))
assert (
len(paths) == 1
), f"Expected 1 and only one .csv file (found {len(paths)})"
assert len(paths) == 1, (
f"Expected 1 and only one .csv file (found {len(paths)})"
)
path = paths[0]

records = {type: set() for type in TYPES}
Expand Down
2 changes: 1 addition & 1 deletion coding_systems/dmd/data_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ class Downloader(TrudDownloader):
coding_system_id = "dmd"

def get_release_name_from_release_metadata(self, metadata):
return f'{metadata["valid_from"].year} {metadata["release"]}'
return f"{metadata['valid_from'].year} {metadata['release']}"
24 changes: 12 additions & 12 deletions coding_systems/dmd/import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ def import_coding_system(release_dir, database_alias):
# gtin
elements = next(load_elements(filepaths["gtin"]))
for element in elements:
assert (
element[0].tag == "AMPPID"
), f"Expected AMPPID as first element, got {element[0].tag}"
assert (
element[1].tag == "GTINDATA"
), f"Expected GTINDATA as second element, got {element[1].tag}"
assert element[0].tag == "AMPPID", (
f"Expected AMPPID as first element, got {element[0].tag}"
)
assert element[1].tag == "GTINDATA", (
f"Expected GTINDATA as second element, got {element[1].tag}"
)

element[0].tag = "APPID"
for gtinelt in element[1]:
Expand All @@ -228,9 +228,9 @@ def import_coding_system(release_dir, database_alias):

def get_filepath(release_dir, filename_fragment):
paths = list(release_dir.glob(f"f_{filename_fragment}2_*.xml"))
assert (
len(paths) == 1
), f"Expected 1 path for {f'f_{filename_fragment}2_*.xml'}, found {len(paths)}"
assert len(paths) == 1, (
f"Expected 1 path for {f'f_{filename_fragment}2_*.xml'}, found {len(paths)}"
)
return paths[0]


Expand All @@ -243,9 +243,9 @@ def load_elements(filepath):
iterelements = root.iterchildren()
first_element = next(iterelements)

assert isinstance(
first_element, etree._Comment
), f"Expected etree._Comment first row, got {type(first_element)}"
assert isinstance(first_element, etree._Comment), (
f"Expected etree._Comment first row, got {type(first_element)}"
)
yield from iterelements


Expand Down
6 changes: 3 additions & 3 deletions coding_systems/icd10/import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ def import_data(

release_zip.extractall(path=tempdir)
paths = list(Path(tempdir).glob("*.xml"))
assert (
len(paths) == 1
), f"Expected 1 and only one .xml file (found {len(paths)})"
assert len(paths) == 1, (
f"Expected 1 and only one .xml file (found {len(paths)})"
)
release_path = paths[0]

with open(release_path) as f:
Expand Down
6 changes: 3 additions & 3 deletions coding_systems/versioning/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def save(self, *args, **kwargs):
f"{self.coding_system}_{self.release_name}_{self.valid_from.strftime('%Y%m%d')}"
)
if self.database_alias:
assert (
self.database_alias == database_alias
), f"database_alias {self.database_alias} does not follow required pattern (expected '{database_alias}'"
assert self.database_alias == database_alias, (
f"database_alias {self.database_alias} does not follow required pattern (expected '{database_alias}'"
)
else:
self.database_alias = database_alias
return super().save(*args, **kwargs)
Expand Down
4 changes: 2 additions & 2 deletions opencodelists/db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def _get_db_from_instance(self, model, **hints):
return hints["instance"]._state.db
raise ValueError(
f'"{model._meta.app_label}" models must select a valid version database '
f'with a `using` argument. {hints["instance"]._state.db} is not a valid '
f'database for {hints["instance"]}'
f"with a `using` argument. {hints['instance']._state.db} is not a valid "
f"database for {hints['instance']}"
)
raise ValueError(
f'"{model._meta.app_label}" models must be accessed with a `using` argument '
Expand Down
62 changes: 31 additions & 31 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,9 @@ filelock==3.16.1 \
--hash=sha256:2082e5703d51fbf98ea75855d9d5527e33d8ff23099bec374a134febee6946b0 \
--hash=sha256:c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435
# via virtualenv
hypothesis==6.123.2 \
--hash=sha256:02c25552783764146b191c69eef69d8375827b58a75074055705ab8fdbc95fc5 \
--hash=sha256:0a8bf07753f1436f1b8697a13ea955f3fef3ef7b477c2972869b1d142bcdb30e
hypothesis==6.123.16 \
--hash=sha256:2af13b9795d2c4b9c66865569a944f2d8c3812b087989bc0f408e825bb10c8e6 \
--hash=sha256:ab898adf001823868ff21a20355944c2eb5ce776f20e9983c7d79b535675e6c3
# via -r requirements.dev.in
identify==2.6.5 \
--hash=sha256:14181a47091eb75b337af4c23078c9d09225cd4c48929f521f3bf16b09d02566 \
Expand Down Expand Up @@ -513,9 +513,9 @@ pycparser==2.22 \
--hash=sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6 \
--hash=sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc
# via cffi
pygments==2.19.0 \
--hash=sha256:4755e6e64d22161d5b61432c0600c923c5927214e7c956e31c23923c89251a9b \
--hash=sha256:afc4146269910d4bdfabcd27c24923137a74d562a23a320a41a55ad303e19783
pygments==2.19.1 \
--hash=sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f \
--hash=sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c
# via
# cli-helpers
# litecli
Expand Down Expand Up @@ -627,29 +627,29 @@ requests==2.32.3 \
# via
# -c /home/runner/work/opencodelists/opencodelists/requirements.prod.txt
# responses
responses==0.25.3 \
--hash=sha256:521efcbc82081ab8daa588e08f7e8a64ce79b91c39f6e62199b19159bea7dbcb \
--hash=sha256:617b9247abd9ae28313d57a75880422d55ec63c29d33d629697590a034358dba
responses==0.25.5 \
--hash=sha256:b3e1ae252f69301b84146ff615a869a4182fbe17e8b606f1ac54142515dad5eb \
--hash=sha256:e53991613f76d17ba293c1e3cce8af107c5c7a6a513edf25195aafd89a870dd3
# via -r requirements.dev.in
ruff==0.8.6 \
--hash=sha256:0509e8da430228236a18a677fcdb0c1f102dd26d5520f71f79b094963322ed25 \
--hash=sha256:0c000a471d519b3e6cfc9c6680025d923b4ca140ce3e4612d1a2ef58e11f11fe \
--hash=sha256:248b1fb3f739d01d528cc50b35ee9c4812aa58cc5935998e776bf8ed5b251e75 \
--hash=sha256:45a56f61b24682f6f6709636949ae8cc82ae229d8d773b4c76c09ec83964a95a \
--hash=sha256:496dd38a53aa173481a7d8866bcd6451bd934d06976a2505028a50583e001b76 \
--hash=sha256:52d587092ab8df308635762386f45f4638badb0866355b2b86760f6d3c076188 \
--hash=sha256:54799ca3d67ae5e0b7a7ac234baa657a9c1784b48ec954a094da7c206e0365b1 \
--hash=sha256:61323159cf21bc3897674e5adb27cd9e7700bab6b84de40d7be28c3d46dc67cf \
--hash=sha256:7ae4478b1471fc0c44ed52a6fb787e641a2ac58b1c1f91763bafbc2faddc5117 \
--hash=sha256:7d7fc2377a04b6e04ffe588caad613d0c460eb2ecba4c0ccbbfe2bc973cbc162 \
--hash=sha256:91a7ddb221779871cf226100e677b5ea38c2d54e9e2c8ed847450ebbdf99b32d \
--hash=sha256:9257aa841e9e8d9b727423086f0fa9a86b6b420fbf4bf9e1465d1250ce8e4d8d \
--hash=sha256:bc3c083c50390cf69e7e1b5a5a7303898966be973664ec0c4a4acea82c1d4315 \
--hash=sha256:dcad24b81b62650b0eb8814f576fc65cfee8674772a6e24c9b747911801eeaa5 \
--hash=sha256:defed167955d42c68b407e8f2e6f56ba52520e790aba4ca707a9c88619e580e3 \
--hash=sha256:e169ea1b9eae61c99b257dc83b9ee6c76f89042752cb2d83486a7d6e48e8f764 \
--hash=sha256:e88b8f6d901477c41559ba540beeb5a671e14cd29ebd5683903572f4b40a9807 \
--hash=sha256:f1d70bef3d16fdc897ee290d7d20da3cbe4e26349f62e8a0274e7a3f4ce7a905
ruff==0.9.1 \
--hash=sha256:186c2313de946f2c22bdf5954b8dd083e124bcfb685732cfb0beae0c47233d9b \
--hash=sha256:1cd76c7f9c679e6e8f2af8f778367dca82b95009bc7b1a85a47f1521ae524fa7 \
--hash=sha256:2f312c86fb40c5c02b44a29a750ee3b21002bd813b5233facdaf63a51d9a85e1 \
--hash=sha256:342a824b46ddbcdddd3abfbb332fa7fcaac5488bf18073e841236aadf4ad5c19 \
--hash=sha256:39d0174ccc45c439093971cc06ed3ac4dc545f5e8bdacf9f067adf879544d969 \
--hash=sha256:3cae39ba5d137054b0e5b472aee3b78a7c884e61591b100aeb544bcd1fc38d4f \
--hash=sha256:3f94942a3bb767675d9a051867c036655fe9f6c8a491539156a6f7e6b5f31831 \
--hash=sha256:46ebf5cc106cf7e7378ca3c28ce4293b61b449cd121b98699be727d40b79ba72 \
--hash=sha256:50c647ff96f4ba288db0ad87048257753733763b409b2faf2ea78b45c8bb7fcb \
--hash=sha256:5dc40a378a0e21b4cfe2b8a0f1812a6572fc7b230ef12cd9fac9161aa91d807f \
--hash=sha256:69572926c0f0c9912288915214ca9b2809525ea263603370b9e00bed2ba56dbd \
--hash=sha256:728d791b769cc28c05f12c280f99e8896932e9833fef1dd8756a6af2261fd1ab \
--hash=sha256:84330dda7abcc270e6055551aca93fdde1b0685fc4fd358f26410f9349cf1743 \
--hash=sha256:937267afce0c9170d6d29f01fcd1f4378172dec6760a9f4dface48cdabf9610a \
--hash=sha256:ae017c3a29bee341ba584f3823f805abbe5fe9cd97f87ed07ecbf533c4c88366 \
--hash=sha256:beb3298604540c884d8b282fe7625651378e1986c25df51dec5b2f60cafc31ce \
--hash=sha256:f0c8b149e9c7353cace7d698e1656ffcf1e36e50f8ea3b5d5f7f87ff9986a7ca \
--hash=sha256:fd2b25ecaf907d6458fa842675382c8597b3c746a2dde6717fe3415425df0c17
# via -r requirements.dev.in
six==1.17.0 \
--hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 \
Expand Down Expand Up @@ -704,7 +704,7 @@ pip==24.3.1 \
--hash=sha256:3790624780082365f47549d032f3770eeb2b1e8bd1f7b2e02dace1afa361b4ed \
--hash=sha256:ebcb60557f2aefabc2e0f918751cd24ea0d56d8ec5445fe1807f1d2109660b99
# via pip-tools
setuptools==75.7.0 \
--hash=sha256:84fb203f278ebcf5cd08f97d3fb96d3fbed4b629d500b29ad60d11e00769b183 \
--hash=sha256:886ff7b16cd342f1d1defc16fc98c9ce3fde69e087a4e1983d7ab634e5f41f4f
setuptools==75.8.0 \
--hash=sha256:c5afc8f407c626b8313a86e10311dd3f661c6cd9c09d4bf8c15c0e11f9f2b0e6 \
--hash=sha256:e3982f444617239225d675215d51f6ba05f845d4eec313da4418fdbb56fb27e3
# via pip-tools
Loading

0 comments on commit 086090c

Please sign in to comment.