Skip to content

Commit

Permalink
uprev deps (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin authored Apr 27, 2023
1 parent 5ebf9ed commit 6ca308e
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 109 deletions.
12 changes: 5 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.DEFAULT_GOAL := all
isort = isort dirty_equals tests
black = black dirty_equals tests
sources = dirty_equals tests

.PHONY: install
install:
Expand All @@ -9,14 +8,13 @@ install:

.PHONY: format
format:
$(isort)
$(black)
black $(sources)
ruff --fix $(sources)

.PHONY: lint
lint:
flake8 --max-complexity 10 --max-line-length 120 --ignore E203,W503 dirty_equals tests
$(isort) --check-only --df
$(black) --check
ruff $(sources)
black $(sources) --check --diff

.PHONY: test
test:
Expand Down
2 changes: 0 additions & 2 deletions dirty_equals/_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ def _get_now(self) -> datetime:
return datetime.utcnow().replace(tzinfo=timezone.utc).astimezone(self.tz)

def prepare(self, other: Any) -> datetime:

# update approx for every comparing, to check if other value is dirty equal
# to current moment of time
self.approx = self._get_now()
Expand All @@ -212,7 +211,6 @@ def __init__(
iso_string: bool = False,
format_string: Optional[str] = None,
):

"""
Args:
approx: A value to approximately compare to.
Expand Down
18 changes: 9 additions & 9 deletions dirty_equals/_dict.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Any, Callable, Container, Dict, Optional, Union, overload
from typing import Any, Callable, Container, Dict, overload

from ._base import DirtyEquals, DirtyEqualsMeta
from ._utils import get_dict_arg
Expand All @@ -17,14 +17,14 @@ class IsDict(DirtyEquals[Dict[Any, Any]]):
"""

@overload
def __init__(self, expected: Dict[Any, Any]):
def __init__(self, expected: dict[Any, Any]):
...

@overload
def __init__(self, **expected: Any):
...

def __init__(self, *expected_args: Dict[Any, Any], **expected_kwargs: Any):
def __init__(self, *expected_args: dict[Any, Any], **expected_kwargs: Any):
"""
Can be created from either keyword arguments or an existing dictionary (same as `dict()`).
Expand All @@ -42,7 +42,7 @@ def __init__(self, *expected_args: Dict[Any, Any], **expected_kwargs: Any):

self.strict = False
self.partial = False
self.ignore: Union[None, Container[Any], Callable[[Any], bool]] = None
self.ignore: None | Container[Any] | Callable[[Any], bool] = None
self._post_init()
super().__init__()

Expand All @@ -52,9 +52,9 @@ def _post_init(self) -> None:
def settings(
self,
*,
strict: Optional[bool] = None,
partial: Optional[bool] = None,
ignore: Union[None, Container[Any], Callable[[Any], bool]] = NotGiven, # type: ignore[assignment]
strict: bool | None = None,
partial: bool | None = None,
ignore: None | Container[Any] | Callable[[Any], bool] = NotGiven, # type: ignore[assignment]
) -> IsDict:
"""
Allows you to customise the behaviour of `IsDict`, technically a new `IsDict` is required to allow chaining.
Expand Down Expand Up @@ -97,7 +97,7 @@ def settings(

return new_cls

def equals(self, other: Dict[Any, Any]) -> bool:
def equals(self, other: dict[Any, Any]) -> bool:
if not isinstance(other, dict):
return False

Expand All @@ -117,7 +117,7 @@ def equals(self, other: Dict[Any, Any]) -> bool:

return True

def _filter_dict(self, d: Dict[Any, Any]) -> Dict[Any, Any]:
def _filter_dict(self, d: dict[Any, Any]) -> dict[Any, Any]:
return {k: v for k, v in d.items() if not self._ignore_value(v)}

def _ignore_value(self, v: Any) -> bool:
Expand Down
2 changes: 0 additions & 2 deletions dirty_equals/_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ def __init__(self) -> None:
self._repr_kwargs = {}

def equals(self, other: Any) -> bool:

return self.bounds_checks(other) and super().equals(other)


Expand All @@ -458,7 +457,6 @@ def __init__(self) -> None:
self._repr_kwargs = {}

def equals(self, other: Any) -> bool:

return self.bounds_checks(other) and super().equals(other)


Expand Down
4 changes: 1 addition & 3 deletions dirty_equals/_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal # type: ignore[misc]
from typing_extensions import Literal # type: ignore[assignment]


class IsUUID(DirtyEquals[UUID]):
Expand Down Expand Up @@ -251,7 +251,6 @@ def __init__(
super().__init__(url_type)

def equals(self, other: Any) -> bool:

try:
parsed = self.parse_obj_as(self.url_type, other)
except self.ValidationError:
Expand Down Expand Up @@ -349,7 +348,6 @@ def __init__(self, *, version: Literal[None, 4, 6] = None, netmask: Optional[str
super().__init__(version=version or Omit, netmask=netmask or Omit)

def equals(self, other: Any) -> bool:

if isinstance(other, (IPv4Network, IPv6Network)):
ip = other
elif isinstance(other, (str, bytes, int, IPv4Address, IPv6Address)):
Expand Down
2 changes: 1 addition & 1 deletion dirty_equals/_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def __init__(
check_order=self.check_order and Omit,
)

def equals(self, other: Any) -> bool: # noqa: C901
def equals(self, other: Any) -> bool:
if not isinstance(other, self.allowed_type):
return False

Expand Down
2 changes: 1 addition & 1 deletion dirty_equals/_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal # type: ignore[misc]
from typing_extensions import Literal # type: ignore[assignment]

T = TypeVar('T', str, bytes)

Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ Funding = 'https://github.com/sponsors/samuelcolvin'
Source = 'https://github.com/samuelcolvin/dirty-equals'
Changelog = 'https://github.com/samuelcolvin/dirty-equals/releases'

[tool.ruff]
line-length = 120
extend-select = ['Q', 'RUF100', 'C90', 'UP', 'I']
flake8-quotes = {inline-quotes = 'single', multiline-quotes = 'double'}
mccabe = { max-complexity = 14 }
isort = { known-first-party = ['tests'] }
target-version = 'py37'

[tool.pytest.ini_options]
testpaths = "tests"
filterwarnings = "error"
Expand Down
61 changes: 37 additions & 24 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=requirements/docs.txt requirements/docs.in
#
black==22.6.0
black==23.3.0
# via -r requirements/docs.in
certifi==2022.12.7
# via requests
charset-normalizer==3.1.0
# via requests
click==8.1.3
# via
# black
# mkdocs
colorama==0.4.6
# via
# griffe
# mkdocs-material
ghp-import==2.1.0
# via mkdocs
griffe==0.22.0
griffe==0.27.1
# via mkdocstrings-python
importlib-metadata==4.12.0
# via mkdocs
idna==3.4
# via requests
jinja2==3.1.2
# via
# mkdocs
Expand All @@ -28,13 +36,13 @@ markdown==3.3.7
# mkdocs-material
# mkdocstrings
# pymdown-extensions
markupsafe==2.1.1
markupsafe==2.1.2
# via
# jinja2
# mkdocstrings
mergedeep==1.3.4
# via mkdocs
mkdocs==1.3.1
mkdocs==1.4.2
# via
# -r requirements/docs.in
# mkdocs-autorefs
Expand All @@ -43,47 +51,52 @@ mkdocs==1.3.1
# mkdocstrings
mkdocs-autorefs==0.4.1
# via mkdocstrings
mkdocs-material==8.4.1
mkdocs-material==9.1.8
# via -r requirements/docs.in
mkdocs-material-extensions==1.0.3
mkdocs-material-extensions==1.1.1
# via mkdocs-material
mkdocs-simple-hooks==0.1.5
# via -r requirements/docs.in
mkdocstrings[python]==0.19.0
mkdocstrings[python]==0.21.2
# via
# -r requirements/docs.in
# mkdocstrings-python
mkdocstrings-python==0.7.1
mkdocstrings-python==0.9.0
# via mkdocstrings
mypy-extensions==0.4.3
mypy-extensions==1.0.0
# via black
packaging==21.3
# via mkdocs
pathspec==0.9.0
packaging==23.1
# via
# black
# mkdocs
pathspec==0.11.1
# via black
platformdirs==2.5.2
platformdirs==3.4.0
# via black
pygments==2.13.0
pygments==2.15.1
# via mkdocs-material
pymdown-extensions==9.5
pymdown-extensions==9.11
# via
# mkdocs-material
# mkdocstrings
pyparsing==3.0.9
# via packaging
python-dateutil==2.8.2
# via ghp-import
pyyaml==6.0
# via
# mkdocs
# pymdown-extensions
# pyyaml-env-tag
pyyaml-env-tag==0.1
# via mkdocs
regex==2023.3.23
# via mkdocs-material
requests==2.29.0
# via mkdocs-material
six==1.16.0
# via python-dateutil
tomli==2.0.1
# via black
watchdog==2.1.9
urllib3==1.26.15
# via requests
watchdog==3.0.0
# via mkdocs
zipp==3.8.1
# via importlib-metadata
6 changes: 1 addition & 5 deletions requirements/linting.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
black
flake8
flake8-quotes
isort[colors]
mypy
pre-commit
pydantic
pycodestyle
pyflakes
ruff
types-pytz
Loading

0 comments on commit 6ca308e

Please sign in to comment.