Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ Update dependency ruff to v0.2.1 #394

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/ruff.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This extend our general Ruff rules specifically for the examples
extend = "../pyproject.toml"

extend-ignore = [
lint.extend-ignore = [
"T201", # Allow the use of print() in examples
]
38 changes: 19 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ pytz = ">=2024.1,<2024.2.0"
Changelog = "https://github.com/klaasnicolaas/python-liege/releases"

[tool.poetry.group.dev.dependencies]
ruff = "0.1.14"
aresponses = "3.0.0"
codespell = "2.2.6"
covdefaults = "2.3.0"
coverage = {version = "7.4.1", extras = ["toml"]}
mypy = "1.8.0"
pre-commit = "3.6.1"
Expand All @@ -46,9 +46,9 @@ pylint = "3.0.3"
pytest = "8.0.0"
pytest-asyncio = "0.23.5"
pytest-cov = "4.1.0"
yamllint = "1.34.0"
covdefaults = "2.3.0"
ruff = "0.2.1"
types-pytz = "2024.1.0.20240203"
yamllint = "1.34.0"

[tool.coverage.run]
plugins = ["covdefaults"]
Expand Down Expand Up @@ -120,8 +120,8 @@ asyncio_mode = "auto"

[tool.ruff]
target-version = "py311"
select = ["ALL"]
ignore = [
lint.select = ["ALL"]
lint.ignore = [
"ANN101", # Self... explanatory
"ANN102", # cls... just as useless
"ANN401", # Opinioated warning on disallowing dynamically typed expressions
Expand All @@ -136,14 +136,14 @@ ignore = [
"ISC001",
]

[tool.ruff.flake8-pytest-style]
[tool.ruff.lint.flake8-pytest-style]
mark-parentheses = false
fixture-parentheses = false

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["liege"]

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 25

[build-system]
Expand Down
7 changes: 6 additions & 1 deletion src/liege/liege.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ async def _request(
ODPLiegeConnectionError: Timeout occurred while
connecting to the Open Data Platform API.
ODPLiegeError: If the data is not valid.

"""
version = metadata.version(__package__)
url = URL.build(
Expand Down Expand Up @@ -76,7 +77,7 @@ async def _request(
ssl=True,
)
response.raise_for_status()
except asyncio.TimeoutError as exception:
except TimeoutError as exception:
msg = "Timeout occurred while connecting to the Open Data Platform API."
raise ODPLiegeConnectionError(
msg,
Expand Down Expand Up @@ -108,6 +109,7 @@ async def disabled_parkings(self, limit: int = 10) -> list[DisabledParking]:
Returns:
-------
A list of DisabledParking objects.

"""
locations = await self._request(
"search/",
Expand All @@ -125,6 +127,7 @@ async def garages(self, limit: int = 10) -> list[Garage]:
Returns:
-------
A list of Garage objects.

"""
locations = await self._request(
"search/",
Expand All @@ -143,6 +146,7 @@ async def __aenter__(self) -> Self:
Returns
-------
The Open Data Platform Liège object.

"""
return self

Expand All @@ -152,5 +156,6 @@ async def __aexit__(self, *_exc_info: object) -> None:
Args:
----
_exc_info: Exec type.

"""
await self.close()
4 changes: 4 additions & 0 deletions src/liege/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def from_dict(cls: type[Garage], data: dict[str, Any]) -> Garage:
Returns:
-------
A Garage object.

"""
attr = data["fields"]
geo = data["geometry"]["coordinates"]
Expand Down Expand Up @@ -91,6 +92,7 @@ def from_dict(cls: type[DisabledParking], data: dict[str, Any]) -> DisabledParki
Returns:
-------
A DisabledParking object.

"""
attr = data["fields"]
geo = data["geometry"]["coordinates"]
Expand Down Expand Up @@ -124,6 +126,7 @@ def strptime(date_string: str, date_format: str, default: None = None) -> Any:
Returns:
-------
The datetime object.

"""
try:
return datetime.strptime(date_string, date_format).astimezone(tz=pytz.utc)
Expand All @@ -144,5 +147,6 @@ def set_address(street: str, number: str, postal_code: str) -> str:
Returns:
-------
The address.

"""
return f"{street} {number}, {postal_code}"
4 changes: 2 additions & 2 deletions tests/ruff.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# This extend our general Ruff rules specifically for tests
extend = "../pyproject.toml"

extend-select = [
lint.extend-select = [
"PT", # Use @pytest.fixture without parentheses
]

extend-ignore = [
lint.extend-ignore = [
"S101", # Use of assert detected. As these are tests...
"SLF001", # Tests will access private/protected members...
"TCH002", # pytest doesn't like this one...
Expand Down
Loading