Skip to content

Commit

Permalink
fix: drop support for python 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Rizhiy committed Mar 3, 2024
1 parent 8d1a119 commit a659887
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_and_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
22 changes: 11 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "replete"
maintainers = [{ name = "Artem Vasenin", email = "[email protected]" }]
authors = [{ name = "Anton Vasilev" }, { name = "Artem Vasenin" }]
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.10"
dynamic = ["description", "version"]
dependencies = ["coloredlogs", "docstring-parser", "python-dateutil", "xxhash"]

Expand Down Expand Up @@ -36,7 +36,7 @@ strictParameterNoneValue = false
typeCheckingMode = "basic"

[tool.ruff]
target-version = "py39"
target-version = "py310"
line-length = 120
[tool.ruff.lint]
preview = true
Expand All @@ -45,17 +45,17 @@ fixable = ["ALL"]
ignore = ["A003", "E203", "FIX002", "FURB113", "N817", "PTH123", "RET503", "S113", "TD002", "TD003", "TRY003", "UP007", "UP035"]
[tool.ruff.lint.per-file-ignores]
"**/__init__.py" = [
"F401", # Allow unused imports in module files
"F401", # Allow unused imports in module files
]
"tests/test_cli.py" = [
"W291", # Need to ignore it for correct formatting
"W291", # Need to ignore it for correct formatting
]
"tests/**/*.py" = [
"E501", # Test strings can be long
"FBT001", # We don't expect to call the tests
"S101", # Asserts in tests are fine
"T201", # Prints are useful for debugging
"TCH001",
"TCH002",
"TCH003", # Tests don't need to be super performant, prefer simpler code
"E501", # Test strings can be long
"FBT001", # We don't expect to call the tests
"S101", # Asserts in tests are fine
"T201", # Prints are useful for debugging
"TCH001",
"TCH002",
"TCH003", # Tests don't need to be super performant, prefer simpler code
]
4 changes: 2 additions & 2 deletions replete/consistent_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def consistent_hash_raw_update(
param_items = sorted((str(key), value) for key, value in param.items())
hasher.update(b"\x04")
consistent_hash_raw_update(hasher, param_items)
elif param_type is list or param_type is tuple or isinstance(param, (list, tuple)):
elif param_type is list or param_type is tuple or isinstance(param, list | tuple):
hasher.update(b"\x05")
consistent_hash_raw_update(hasher, param)
else:
Expand Down Expand Up @@ -94,7 +94,7 @@ def _normalize(value: Any) -> Any:
chashmeth = getattr(value, "consistent_hash", None)
if chashmeth is not None and getattr(chashmeth, "__self__", None) is not None:
return chashmeth() # Note: makes the result type-independent.
if value_type is list or value_type is tuple or isinstance(value, (list, tuple)):
if value_type is list or value_type is tuple or isinstance(value, list | tuple):
return [_normalize(subvalue) for subvalue in value]
if value_type is dict or isinstance(value, collections.abc.Mapping):
res_value = [(str(subkey), _normalize(subvalue)) for subkey, subvalue in value.items()]
Expand Down
2 changes: 1 addition & 1 deletion replete/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def func_with_idx(idx, *args, **kwargs) -> tuple[int, Any]:
raise

with futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
idx_args_gen = enumerate(zip(args_list, kwargs_list))
idx_args_gen = enumerate(zip(args_list, kwargs_list, strict=False))
results = [executor.submit(func_with_idx, idx, *args, **kwargs) for idx, (args, kwargs) in idx_args_gen]

cache_results = {}
Expand Down
4 changes: 2 additions & 2 deletions tests/test_consistent_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def consistent_hash_ref(*args: Any, **kwargs: Any) -> int:
for param in params:
if isinstance(param, Mapping):
hashes.append(consistent_hash(**{str(key): value for key, value in param.items()}))
elif isinstance(param, (list, tuple)):
elif isinstance(param, list | tuple):
hashes.append(consistent_hash(*param))
else:
hashes.append(repr(param))
Expand All @@ -77,7 +77,7 @@ def consistent_hash_ref2_raw(args: Sequence[Any] = (), kwargs: dict[str, Any] |
elif isinstance(param, Mapping):
rec = consistent_hash_ref2_raw((), {str(key): value for key, value in param.items()})
hasher.update(rec.digest())
elif isinstance(param, (list, tuple)):
elif isinstance(param, list | tuple):
rec = consistent_hash_ref2_raw(param)
hasher.update(rec.digest())
else:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_futures_processing(futures_processing_test_vars):

with Timer() as timer:
result = set(futures_processing(func, args, kwargs)) # type: ignore
simple_results = {func(*a, **kw) for a, kw in zip(args, kwargs)} # type: ignore
simple_results = {func(*a, **kw) for a, kw in zip(args, kwargs, strict=False)} # type: ignore

assert result == simple_results
assert timer.time < wait_time * 3
Expand All @@ -60,7 +60,7 @@ def test_futures_processing_in_order(futures_processing_test_vars):

with Timer() as timer:
result = list(futures_processing(func, args, kwargs, in_order=True)) # type: ignore
simple_results = [func(*a, **kw) for a, kw in zip(args, kwargs)] # type: ignore
simple_results = [func(*a, **kw) for a, kw in zip(args, kwargs, strict=False)] # type: ignore

assert result == simple_results
assert timer.time < wait_time * 3
Expand Down

0 comments on commit a659887

Please sign in to comment.