Skip to content

Commit

Permalink
Replace code made for Python <= 3.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlesieur committed Nov 8, 2023
1 parent 71c11be commit 09e4db1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ select = [
"TCH", # flake8-type-checking
"PGH", # pygrep-hooks
"PL", # Pylint
# TODO: "UP", # pyupgrade
"UP", # pyupgrade
# TODO: "B", # flake8-bugbear
# TODO: "C4", # flake8-comprehensions
# TODO: "EM", # flake8-errmsg
Expand Down
2 changes: 1 addition & 1 deletion src/kerko/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,4 +754,4 @@ class SortDateExtractor(Extractor):
def extract(self, item, library_context, spec):
parsed_date = item.get("meta", {}).get("parsedDate", "")
year, month, day = parse_partial_date(parsed_date)
return int("{:04d}{:02d}{:02d}".format(year, month, day))
return int(f"{year:04d}{month:02d}{day:02d}")
2 changes: 1 addition & 1 deletion src/kerko/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def load_object(storage, key, default=None):
try:
with open(get_storage_dir(storage) / f"{key}.pickle", "rb") as f:
return pickle.load(f)
except IOError:
except OSError:
return default


Expand Down
10 changes: 2 additions & 8 deletions tests/integration_testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import pathlib
import re
import sys
import tempfile
import unittest

Expand Down Expand Up @@ -181,9 +180,8 @@ def setUpClass(cls):

cls.add_responses()

if sys.version_info[:2] > (3, 7):
cls.addClassCleanup(cls.responses.stop)
cls.addClassCleanup(cls.responses.reset)
cls.addClassCleanup(cls.responses.stop)
cls.addClassCleanup(cls.responses.reset)

# Make sure the data directory is empty before synchronizing.
delete_storage("cache")
Expand All @@ -193,10 +191,6 @@ def setUpClass(cls):
def tearDownClass(cls):
cls.temp_dir.cleanup()

if sys.version_info[:2] <= (3, 7):
cls.responses.stop()
cls.responses.reset()


class PopulatedLibraryTestCase(MockLibraryTestCase):
"""Test case providing mock Zotero API responses for a populated library."""
Expand Down

0 comments on commit 09e4db1

Please sign in to comment.