Skip to content

Commit

Permalink
🐛 ruff formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
juftin committed Oct 27, 2023

Verified

This commit was signed with the committer’s verified signature.
Blarse Egor Ignatov
1 parent bcfdd8d commit 7d2fc96
Showing 11 changed files with 54 additions and 90 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ exclude: |
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
@@ -18,13 +18,13 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.9.0
rev: v2.11.0
hooks:
- id: pretty-format-toml
args: [--autofix]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.9-for-vscode
rev: v3.0.3
hooks:
- id: prettier
args: [--print-width=88, --tab-width=4]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ to book your spot!
[![Docker Image Version](https://img.shields.io/docker/v/juftin/camply?color=blue&label=docker&logo=docker)](https://hub.docker.com/r/juftin/camply)
[![Testing Status](https://github.com/juftin/camply/actions/workflows/tests.yaml/badge.svg?branch=main)](https://github.com/juftin/camply/actions/workflows/tests.yaml)
[![GitHub License](https://img.shields.io/github/license/juftin/camply?color=blue&label=License)](https://github.com/juftin/camply/blob/main/LICENSE)
[![Black Codestyle](https://img.shields.io/badge/code%20style-black-000000.svg)]()
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-lightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Gitmoji](https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg)](https://gitmoji.dev)
4 changes: 3 additions & 1 deletion camply/cli.py
Original file line number Diff line number Diff line change
@@ -237,7 +237,9 @@ def equipment_types(
elif provider.startswith(RecreationDotGov.__name__):
log_sorted_response(response_array=EquipmentOptions.__all_accepted_equipment__)
else:
logger.warning("That Provider doesn't support equipment based searching, yet 🙂")
logger.warning(
"That Provider doesn't support equipment based searching, yet 🙂"
)
sys.exit(0)


4 changes: 2 additions & 2 deletions camply/providers/going_to_camp/going_to_camp_provider.py
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ def rec_area_lookup(self, rec_area_id: int) -> Tuple[str, RecreationArea]:

def find_campgrounds(
self,
search_string: str = None,
search_string: Optional[str] = None,
rec_area_id: Optional[List[int]] = None,
campground_id: Optional[List[int]] = None,
campsite_id: Optional[List[int]] = None,
@@ -114,7 +114,7 @@ def find_campgrounds(
Parameters
----------
search_string: str
search_string: Optional[str]
Search Keyword(s)
rec_area_id: Optional[List[int]]
Recreation Area ID by which to filter
18 changes: 10 additions & 8 deletions camply/providers/recreation_dot_gov/recdotgov_provider.py
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ class RecreationDotGovBase(BaseProvider, ABC):
Python Class for Working with Recreation.gov API / NPS APIs
"""

def __init__(self, api_key: str = None):
def __init__(self, api_key: Optional[str] = None):
"""
Initialize with Search Dates
"""
@@ -117,13 +117,15 @@ def api_response_class(self) -> Type[CoreRecDotGovResponse]:
"""
pass

def find_recreation_areas(self, search_string: str = None, **kwargs) -> List[dict]:
def find_recreation_areas(
self, search_string: Optional[str] = None, **kwargs
) -> List[dict]:
"""
Find Matching Campsites Based on Search String
Parameters
----------
search_string: str
search_string: Optional[str]
Search Keyword(s)
Returns
@@ -167,7 +169,7 @@ def find_recreation_areas(self, search_string: str = None, **kwargs) -> List[dic

def find_campgrounds(
self,
search_string: str = None,
search_string: Optional[str] = None,
rec_area_id: Optional[List[int]] = None,
campground_id: Optional[List[int]] = None,
campsite_id: Optional[List[int]] = None,
@@ -178,7 +180,7 @@ def find_campgrounds(
Parameters
----------
search_string: str
search_string: Optional[str]
Search Keyword(s)
rec_area_id: Optional[List[int]]
Recreation Area ID to filter with
@@ -222,14 +224,14 @@ def find_campgrounds(
return facilities

def find_facilities_per_recreation_area(
self, rec_area_id: int = None, **kwargs
self, rec_area_id: Optional[int] = None, **kwargs
) -> List[CampgroundFacility]:
"""
Find Matching Campsites Based from Recreation Area
Parameters
----------
rec_area_id: int
rec_area_id: Optional[int]
Recreation Area ID
Returns
@@ -725,7 +727,7 @@ def get_campground_ids_by_campsites(
return list(set(campground_ids)), list(campgrounds)

def _process_specific_campsites_provided(
self, campsite_id: List[int] = None
self, campsite_id: Optional[List[int]] = None
) -> List[CampgroundFacility]:
"""
Process Requests for Campgrounds into Facilities
4 changes: 3 additions & 1 deletion camply/providers/xanterra/yellowstone_lodging.py
Original file line number Diff line number Diff line change
@@ -36,7 +36,9 @@ class Yellowstone(BaseProvider):
recreation_area_location="USA",
)

def _get_monthly_availability(self, month: datetime, nights: int = None) -> dict:
def _get_monthly_availability(
self, month: datetime, nights: Optional[int] = None
) -> dict:
"""
Check All Lodging in Yellowstone for Campground Data
8 changes: 4 additions & 4 deletions camply/utils/yaml_utils.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
from enum import Enum
from pathlib import Path
from re import compile
from typing import Any, Dict, Tuple
from typing import Any, Dict, Optional, Tuple

import yaml
from yaml import SafeLoader, load
@@ -19,7 +19,7 @@
logger = logging.getLogger(__name__)


def read_yaml(path: str = None):
def read_yaml(path: Optional[str] = None):
"""
Read a YAML File
@@ -29,7 +29,7 @@ def read_yaml(path: str = None):
Parameters
----------
path: str
path: Optional[str]
File Path of YAML Object to Read
Examples
@@ -92,7 +92,7 @@ def yaml_file_to_arguments(
Returns
-------
provider, provider_kwargs, search_kwargs: Tuple[str, Dict[str, object], Dict[str, object]]
Tuple[str, Dict[str, object], Dict[str, object]]
Tuple containing provider string, provider **kwargs, and search **kwargs
"""
yaml_search = read_yaml(path=file_path)
5 changes: 2 additions & 3 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -81,8 +81,8 @@ hatch run <script>

| Script | Script Description |
| -------------- | ------------------------------------------------------- |
| `format` | Code Formatting [black] and [ruff] |
| `lint` | Code Linting [black] and [ruff] |
| `format` | Code Formatting [ruff] |
| `lint` | Code Linting [ruff] |
| `check` | Type Checking with [mypy] |
| `test` | Unit Testing with [pytest] |
| `all` | Run multiple scripts: `format`, `lint`, `check`, `test` |
@@ -111,7 +111,6 @@ hatch run requirements
[gitmoji]: https://gitmoji.dev/
[conventional commits]: https://www.conventionalcommits.org/en/v1.0.0/
[semantic-release]: https://github.com/semantic-release/semantic-release
[black]: https://github.com/psf/black
[ruff]: https://github.com/charliermarsh/ruff
[mypy]: https://mypy.readthedocs.io/en/stable/
[pytest]: https://docs.pytest.org/en/stable/
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ to book your spot!
[![Docker Image Version](https://img.shields.io/docker/v/juftin/camply?color=blue&label=docker&logo=docker)](https://hub.docker.com/r/juftin/camply)
[![Testing Status](https://github.com/juftin/camply/actions/workflows/tests.yaml/badge.svg?branch=main)](https://github.com/juftin/camply/actions/workflows/tests.yaml)
[![GitHub License](https://img.shields.io/github/license/juftin/camply?color=blue&label=License)](https://github.com/juftin/camply/blob/main/LICENSE)
[![Black Codestyle](https://img.shields.io/badge/code%20style-black-000000.svg)]()
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-lightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Gitmoji](https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg)](https://gitmoji.dev)
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -87,8 +87,7 @@ dependencies = [
"mkdocs-section-index~=0.3.5",
"mkdocstrings[python]~=0.21.2",
"mkdocs-exclude-search~=0.6.5",
"black~=23.3.0",
"ruff~=0.0.261",
"ruff~=0.1.3",
"mypy~=1.2.0",
"pandas-stubs~=2.0.0.230412",
"pip-tools~=6.13.0"
@@ -111,8 +110,8 @@ check = [
docs-build = "python -m mkdocs build --clean --strict"
docs-deploy = "python -m mkdocs gh-deploy {args:}"
docs-serve = "python -m mkdocs serve --dev-addr localhost:8000"
format = ["ruff --fix {args:.}", "black {args:.}"]
lint = ["ruff {args:.}", "black --check {args:.}"]
format = ["ruff --fix {args:.}", "ruff format {args:.}"]
lint = ["ruff {args:.}", "ruff format --check {args:.}"]
requirements = [
"hatch dep show requirements --project-only --all > requirements.in",
"_pip_compile --output-file requirements/requirements-prod.txt",
@@ -164,9 +163,10 @@ filterwarnings = [

[tool.ruff]
ignore = [
"E501", # line too long, handled by black
"E501", # line too long
"PLR0913", # Too many arguments to function call
"PLW2901" # Outer for loop variable overwritten by inner assignment target
"PLW2901", # Outer for loop variable overwritten by inner assignment target
"RUF012" # Mutable class attributes should be annotated with `typing.ClassVar`
]
select = [
"E", # pycodestyle errors
79 changes: 19 additions & 60 deletions requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -8,33 +8,6 @@ apprise==1.3.0 \
--hash=sha256:2c50c19a5dd41317b1f659c52b21a990febe6c15e08464228a1ce8e6098f11bf \
--hash=sha256:ef0c1413a32182272b6ed60ddcee6057744dc683725651015332e063b9a6a4ad
# via camply (pyproject.toml)
black==23.3.0 \
--hash=sha256:064101748afa12ad2291c2b91c960be28b817c0c7eaa35bec09cc63aa56493c5 \
--hash=sha256:0945e13506be58bf7db93ee5853243eb368ace1c08a24c65ce108986eac65915 \
--hash=sha256:11c410f71b876f961d1de77b9699ad19f939094c3a677323f43d7a29855fe326 \
--hash=sha256:1c7b8d606e728a41ea1ccbd7264677e494e87cf630e399262ced92d4a8dac940 \
--hash=sha256:1d06691f1eb8de91cd1b322f21e3bfc9efe0c7ca1f0e1eb1db44ea367dff656b \
--hash=sha256:3238f2aacf827d18d26db07524e44741233ae09a584273aa059066d644ca7b30 \
--hash=sha256:32daa9783106c28815d05b724238e30718f34155653d4d6e125dc7daec8e260c \
--hash=sha256:35d1381d7a22cc5b2be2f72c7dfdae4072a3336060635718cc7e1ede24221d6c \
--hash=sha256:3a150542a204124ed00683f0db1f5cf1c2aaaa9cc3495b7a3b5976fb136090ab \
--hash=sha256:48f9d345675bb7fbc3dd85821b12487e1b9a75242028adad0333ce36ed2a6d27 \
--hash=sha256:50cb33cac881766a5cd9913e10ff75b1e8eb71babf4c7104f2e9c52da1fb7de2 \
--hash=sha256:562bd3a70495facf56814293149e51aa1be9931567474993c7942ff7d3533961 \
--hash=sha256:67de8d0c209eb5b330cce2469503de11bca4085880d62f1628bd9972cc3366b9 \
--hash=sha256:6b39abdfb402002b8a7d030ccc85cf5afff64ee90fa4c5aebc531e3ad0175ddb \
--hash=sha256:6f3c333ea1dd6771b2d3777482429864f8e258899f6ff05826c3a4fcc5ce3f70 \
--hash=sha256:714290490c18fb0126baa0fca0a54ee795f7502b44177e1ce7624ba1c00f2331 \
--hash=sha256:7c3eb7cea23904399866c55826b31c1f55bbcd3890ce22ff70466b907b6775c2 \
--hash=sha256:92c543f6854c28a3c7f39f4d9b7694f9a6eb9d3c5e2ece488c327b6e7ea9b266 \
--hash=sha256:a6f6886c9869d4daae2d1715ce34a19bbc4b95006d20ed785ca00fa03cba312d \
--hash=sha256:a8a968125d0a6a404842fa1bf0b349a568634f856aa08ffaff40ae0dfa52e7c6 \
--hash=sha256:c7ab5790333c448903c4b721b59c0d80b11fe5e9803d8703e84dcb8da56fec1b \
--hash=sha256:e114420bf26b90d4b9daa597351337762b63039752bdf72bf361364c1aa05925 \
--hash=sha256:e198cf27888ad6f4ff331ca1c48ffc038848ea9f031a3b40ba36aced7e22f2c8 \
--hash=sha256:ec751418022185b0c1bb7d7736e6933d40bbb14c14a0abcf9123d1b159f98dd4 \
--hash=sha256:f0bd2f4a58d6666500542b26354978218a9babcdc972722f4bf90779524515f3
# via camply (pyproject.toml)
build==0.10.0 \
--hash=sha256:af266720050a66c893a6096a2f410989eeac74ff9a68ba194b3f6473e8e26171 \
--hash=sha256:d5b71264afdb5951d6704482aac78de887c80691c52b88a9ad195983ca2c9269
@@ -128,7 +101,6 @@ click==8.1.3 \
# via
# camply (pyproject.toml)
# apprise
# black
# mkdocs
# mkdocs-click
# pip-tools
@@ -503,9 +475,7 @@ mypy==1.2.0 \
mypy-extensions==1.0.0 \
--hash=sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d \
--hash=sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782
# via
# black
# mypy
# via mypy
numpy==1.24.3 \
--hash=sha256:0ec87a7084caa559c36e0a2309e4ecb1baa03b687201d0a847c8b0ed476a7187 \
--hash=sha256:1a7d6acc2e7524c9955e5c903160aa4ea083736fde7e91276b0e5d98e6332812 \
@@ -544,7 +514,6 @@ packaging==23.1 \
--hash=sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61 \
--hash=sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f
# via
# black
# build
# mkdocs
# pytest
@@ -581,18 +550,10 @@ pandas-stubs==2.0.0.230412 \
--hash=sha256:016f567cb9947edd0067ea2665ab00b77fa47e73a65ce1a097de4f499b3485c0 \
--hash=sha256:311ab8b42ee574d9fea5061d1f63aeca297e472de6073ba84bf2a017c6cb1b6b
# via camply (pyproject.toml)
pathspec==0.11.1 \
--hash=sha256:2798de800fa92780e33acca925945e9a19a133b715067cf165b8866c15a31687 \
--hash=sha256:d8af70af76652554bd134c22b3e8a1cc46ed7d91edcdd721ef1a0c51a84a5293
# via black
pip-tools==6.13.0 \
--hash=sha256:50943f151d87e752abddec8158622c34ad7f292e193836e90e30d87da60b19d9 \
--hash=sha256:61d46bd2eb8016ed4a924e196e6e5b0a268cd3babd79e593048720db23522bb1
# via camply (pyproject.toml)
platformdirs==3.5.1 \
--hash=sha256:412dae91f52a6f84830f39a8078cecd0e866cb72294a5c66808e74d5e88d251f \
--hash=sha256:e2378146f1964972c03c085bb5662ae80b2b8c06226c54b2ff4aa9483e8a13a5
# via black
pluggy==1.0.0 \
--hash=sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159 \
--hash=sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3
@@ -867,24 +828,24 @@ rich-click==1.6.1 \
--hash=sha256:0fcf4d1a09029d79322dd814ab0b2e66ac183633037561881d45abae8a161d95 \
--hash=sha256:f8ff96693ec6e261d1544e9f7d9a5811c5ef5d74c8adb4978430fc0dac16777e
# via camply (pyproject.toml)
ruff==0.0.270 \
--hash=sha256:0012f9b7dc137ab7f1f0355e3c4ca49b562baf6c9fa1180948deeb6648c52957 \
--hash=sha256:08188f8351f4c0b6216e8463df0a76eb57894ca59a3da65e4ed205db980fd3ae \
--hash=sha256:0827b074635d37984fc98d99316bfab5c8b1231bb83e60dacc83bd92883eedb4 \
--hash=sha256:0bbfbf6fd2436165566ca85f6e57be03ed2f0a994faf40180cfbb3604c9232ef \
--hash=sha256:0d61ae4841313f6eeb8292dc349bef27b4ce426e62c36e80ceedc3824e408734 \
--hash=sha256:0eb412f20e77529a01fb94d578b19dcb8331b56f93632aa0cce4a2ea27b7aeba \
--hash=sha256:21f00e47ab2308617c44435c8dfd9e2e03897461c9e647ec942deb2a235b4cfd \
--hash=sha256:3ed3b198768d2b3a2300fb18f730cd39948a5cc36ba29ae9d4639a11040880be \
--hash=sha256:643de865fd35cb76c4f0739aea5afe7b8e4d40d623df7e9e6ea99054e5cead0a \
--hash=sha256:739495d2dbde87cf4e3110c8d27bc20febf93112539a968a4e02c26f0deccd1d \
--hash=sha256:8af391ef81f7be960be10886a3c1aac0b298bde7cb9a86ec2b05faeb2081ce6b \
--hash=sha256:95db07b7850b30ebf32b27fe98bc39e0ab99db3985edbbf0754d399eb2f0e690 \
--hash=sha256:9613456b0b375766244c25045e353bc8890c856431cd97893c97b10cc93bd28d \
--hash=sha256:b4c037fe2f75bcd9aed0c89c7c507cb7fa59abae2bd4c8b6fc331a28178655a4 \
--hash=sha256:b775e2c5fc869359daf8c8b8aa0fd67240201ab2e8d536d14a0edf279af18786 \
--hash=sha256:eca02e709b3308eb7255b5f74e779be23b5980fca3862eae28bb23069cd61ae4 \
--hash=sha256:f74c4d550f7b8e808455ac77bbce38daafc458434815ba0bc21ae4bdb276509b
ruff==0.1.3 \
--hash=sha256:0b6c55f5ef8d9dd05b230bb6ab80bc4381ecb60ae56db0330f660ea240cb0d4a \
--hash=sha256:0f75e670d529aa2288cd00fc0e9b9287603d95e1536d7a7e0cafe00f75e0dd9d \
--hash=sha256:12fd53696c83a194a2db7f9a46337ce06445fb9aa7d25ea6f293cf75b21aca9f \
--hash=sha256:1c595193881922cc0556a90f3af99b1c5681f0c552e7a2a189956141d8666fe8 \
--hash=sha256:2e3de9ed2e39160800281848ff4670e1698037ca039bda7b9274f849258d26ce \
--hash=sha256:3ba6145369a151401d5db79f0a47d50e470384d0d89d0d6f7fab0b589ad07c34 \
--hash=sha256:3e7afcbdcfbe3399c34e0f6370c30f6e529193c731b885316c5a09c9e4317eef \
--hash=sha256:4874c165f96c14a00590dcc727a04dca0cfd110334c24b039458c06cf78a672e \
--hash=sha256:76dd49f6cd945d82d9d4a9a6622c54a994689d8d7b22fa1322983389b4892e20 \
--hash=sha256:7a18df6638cec4a5bd75350639b2bb2a2366e01222825562c7346674bdceb7ea \
--hash=sha256:918b454bc4f8874a616f0d725590277c42949431ceb303950e87fef7a7d94cb3 \
--hash=sha256:b46d43d51f7061652eeadb426a9e3caa1e0002470229ab2fc19de8a7b0766901 \
--hash=sha256:b8afeb9abd26b4029c72adc9921b8363374f4e7edb78385ffaa80278313a15f9 \
--hash=sha256:ca3cf365bf32e9ba7e6db3f48a4d3e2c446cd19ebee04f05338bc3910114528b \
--hash=sha256:d8859605e729cd5e53aa38275568dbbdb4fe882d2ea2714c5453b678dca83784 \
--hash=sha256:dc3ec4edb3b73f21b4aa51337e16674c752f1d76a4a543af56d7d04e97769613 \
--hash=sha256:eec2dd31eed114e48ea42dbffc443e9b7221976554a504767ceaee3dd38edeb8
# via camply (pyproject.toml)
six==1.16.0 \
--hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \
@@ -904,7 +865,6 @@ tomli==2.0.1 \
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
# via
# black
# build
# coverage
# mypy
@@ -926,7 +886,6 @@ typing-extensions==4.6.3 \
--hash=sha256:88a4153d8505aabbb4e13aacb7c486c2b4a33ca3b3f807914a9b4c844c471c26 \
--hash=sha256:d91d5919357fe7f681a9f2b5b4cb2a5f1ef0a1e9f59c4d8ff0d3491e05c0ffd5
# via
# black
# mkdocstrings
# mypy
# pydantic

0 comments on commit 7d2fc96

Please sign in to comment.