Skip to content

Commit

Permalink
chore: Run pyupgrade --py38-plus **/*.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Oct 10, 2023
1 parent ba1ae4b commit 6522dac
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
3 changes: 1 addition & 2 deletions ocdsextensionregistry/codelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ def __getitem__(self, index):
return self.rows[index]

def __iter__(self):
for row in self.rows:
yield row
yield from self.rows

def __len__(self):
return len(self.rows)
Expand Down
3 changes: 1 addition & 2 deletions ocdsextensionregistry/extension_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ def __iter__(self):
"""
Iterates over the extension versions in the registry.
"""
for version in self.versions:
yield version
yield from self.versions

def _handle_attribute_error(self, e):
if "'category'" in str(e.args) or "'core'" in str(e.args):
Expand Down
5 changes: 1 addition & 4 deletions tests/test_codelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ def test_len():
def test_repr():
obj = fixture()

if sys.version_info >= (3, 8):
expected = "Codelist(name='test.csv', rows=[CodelistCode(data={'Code': 'open', 'Title': 'Open', 'Description': 'All interested suppliers may submit a tender.'}, extension_name='OCDS Core'), CodelistCode(data={'Code': 'selective', 'Title': 'Selective', 'Description': 'Only qualified suppliers are invited to submit a tender.'}, extension_name='OCDS Core'), CodelistCode(data={'Code': 'limited', 'Title': 'Limited', 'Description': 'The procuring entity contacts a number of suppliers of its choice.'}, extension_name='OCDS Core'), CodelistCode(data={'Code': 'direct', 'Title': 'Direct', 'Description': 'The contract is awarded to a single supplier without competition.'}, extension_name='OCDS Core')])" # noqa: E501
else:
expected = "Codelist(name='test.csv', rows=[CodelistCode(data=OrderedDict([('Code', 'open'), ('Title', 'Open'), ('Description', 'All interested suppliers may submit a tender.')]), extension_name='OCDS Core'), CodelistCode(data=OrderedDict([('Code', 'selective'), ('Title', 'Selective'), ('Description', 'Only qualified suppliers are invited to submit a tender.')]), extension_name='OCDS Core'), CodelistCode(data=OrderedDict([('Code', 'limited'), ('Title', 'Limited'), ('Description', 'The procuring entity contacts a number of suppliers of its choice.')]), extension_name='OCDS Core'), CodelistCode(data=OrderedDict([('Code', 'direct'), ('Title', 'Direct'), ('Description', 'The contract is awarded to a single supplier without competition.')]), extension_name='OCDS Core')])" # noqa: E501
expected = "Codelist(name='test.csv', rows=[CodelistCode(data={'Code': 'open', 'Title': 'Open', 'Description': 'All interested suppliers may submit a tender.'}, extension_name='OCDS Core'), CodelistCode(data={'Code': 'selective', 'Title': 'Selective', 'Description': 'Only qualified suppliers are invited to submit a tender.'}, extension_name='OCDS Core'), CodelistCode(data={'Code': 'limited', 'Title': 'Limited', 'Description': 'The procuring entity contacts a number of suppliers of its choice.'}, extension_name='OCDS Core'), CodelistCode(data={'Code': 'direct', 'Title': 'Direct', 'Description': 'The contract is awarded to a single supplier without competition.'}, extension_name='OCDS Core')])" # noqa: E501

assert repr(obj) == expected

Expand Down

0 comments on commit 6522dac

Please sign in to comment.