Skip to content

Commit

Permalink
Switch to black and isort. (#260)
Browse files Browse the repository at this point in the history
* Latest test cassettes.
  • Loading branch information
jheddings authored Sep 22, 2024
1 parent 45d18d9 commit aa9a43a
Show file tree
Hide file tree
Showing 14 changed files with 479 additions and 526 deletions.
28 changes: 18 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: "24.4.2"
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: "5.13.2"
hooks:
- id: isort

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.6"
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format

- repo: https://github.com/adrienverge/yamllint.git
rev: "v1.33.0"
hooks:
- id: yamllint

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: trailing-whitespace
627 changes: 327 additions & 300 deletions poetry.lock

Large diffs are not rendered by default.

16 changes: 6 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,18 @@ gitpython = "^3.1.43"
[tool.poetry.scripts]
wxdat = "wxdat.__main__:main"

[tool.black]
line_length = 88

[tool.isort]
profile = "black"

[tool.ruff]
line-length = 88
indent-width = 4

[tool.ruff.lint]
select = [
"I", # isort
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
Expand All @@ -50,15 +55,6 @@ ignore = [
"E501", # line-too-long
]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

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

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
4 changes: 2 additions & 2 deletions tests/cassettes/test_accuweather_bad_api_key.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interactions:
Connection:
- keep-alive
User-Agent:
- wxdat/1.4.1-04bd5a1+ (+https://github.com/jheddings/wxdat)
- wxdat/1.5.0-d5f119b-static-checks+ (+https://github.com/jheddings/wxdat)
method: GET
uri: http://dataservice.accuweather.com/currentconditions/v1/2626674?details=True&language=en-US
response:
Expand All @@ -23,7 +23,7 @@ interactions:
Content-Type:
- application/json
Date:
- Thu, 23 Nov 2023 01:57:19 GMT
- Sun, 22 Sep 2024 21:12:31 GMT
status:
code: 401
message: Unauthorized
Expand Down
31 changes: 24 additions & 7 deletions tests/cassettes/test_accuweather_conditions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,29 @@ interactions:
Connection:
- keep-alive
User-Agent:
- wxdat/1.4.1-42c7262 (+https://github.com/jheddings/wxdat)
- wxdat/1.5.0-d5f119b-static-checks+ (+https://github.com/jheddings/wxdat)
method: GET
uri: http://dataservice.accuweather.com/currentconditions/v1/2207713?details=True&language=en-US
response:
body:
string: '[{"LocalObservationDateTime":"2023-11-22T21:23:00-07:00","EpochTime":1700713380,"WeatherText":"Clear","WeatherIcon":33,"HasPrecipitation":false,"PrecipitationType":null,"IsDayTime":false,"Temperature":{"Metric":{"Value":1.0,"Unit":"C","UnitType":17},"Imperial":{"Value":34.0,"Unit":"F","UnitType":18}},"RealFeelTemperature":{"Metric":{"Value":1.8,"Unit":"C","UnitType":17,"Phrase":"Cold"},"Imperial":{"Value":35.0,"Unit":"F","UnitType":18,"Phrase":"Cold"}},"RealFeelTemperatureShade":{"Metric":{"Value":1.8,"Unit":"C","UnitType":17,"Phrase":"Cold"},"Imperial":{"Value":35.0,"Unit":"F","UnitType":18,"Phrase":"Cold"}},"RelativeHumidity":45,"IndoorRelativeHumidity":27,"DewPoint":{"Metric":{"Value":-9.6,"Unit":"C","UnitType":17},"Imperial":{"Value":15.0,"Unit":"F","UnitType":18}},"Wind":{"Direction":{"Degrees":158,"Localized":"SSE","English":"SSE"},"Speed":{"Metric":{"Value":4.4,"Unit":"km/h","UnitType":7},"Imperial":{"Value":2.8,"Unit":"mi/h","UnitType":9}}},"WindGust":{"Speed":{"Metric":{"Value":6.2,"Unit":"km/h","UnitType":7},"Imperial":{"Value":3.8,"Unit":"mi/h","UnitType":9}}},"UVIndex":0,"UVIndexText":"Low","Visibility":{"Metric":{"Value":6.4,"Unit":"km","UnitType":6},"Imperial":{"Value":4.0,"Unit":"mi","UnitType":2}},"ObstructionsToVisibility":"","CloudCover":2,"Ceiling":{"Metric":{"Value":12192.0,"Unit":"m","UnitType":5},"Imperial":{"Value":40000.0,"Unit":"ft","UnitType":0}},"Pressure":{"Metric":{"Value":1015.9,"Unit":"mb","UnitType":14},"Imperial":{"Value":30.0,"Unit":"inHg","UnitType":12}},"PressureTendency":{"LocalizedText":"Steady","Code":"S"},"Past24HourTemperatureDeparture":{"Metric":{"Value":0.7,"Unit":"C","UnitType":17},"Imperial":{"Value":1.0,"Unit":"F","UnitType":18}},"ApparentTemperature":{"Metric":{"Value":1.1,"Unit":"C","UnitType":17},"Imperial":{"Value":34.0,"Unit":"F","UnitType":18}},"WindChillTemperature":{"Metric":{"Value":0.0,"Unit":"C","UnitType":17},"Imperial":{"Value":32.0,"Unit":"F","UnitType":18}},"WetBulbTemperature":{"Metric":{"Value":-2.4,"Unit":"C","UnitType":17},"Imperial":{"Value":28.0,"Unit":"F","UnitType":18}},"Precip1hr":{"Metric":{"Value":0.0,"Unit":"mm","UnitType":3},"Imperial":{"Value":0.0,"Unit":"in","UnitType":1}},"PrecipitationSummary":{"Precipitation":{"Metric":{"Value":0.0,"Unit":"mm","UnitType":3},"Imperial":{"Value":0.0,"Unit":"in","UnitType":1}},"PastHour":{"Metric":{"Value":0.0,"Unit":"mm","UnitType":3},"Imperial":{"Value":0.0,"Unit":"in","UnitType":1}},"Past3Hours":{"Metric":{"Value":0.0,"Unit":"mm","UnitType":3},"Imperial":{"Value":0.0,"Unit":"in","UnitType":1}},"Past6Hours":{"Metric":{"Value":0.0,"Unit":"mm","UnitType":3},"Imperial":{"Value":0.0,"Unit":"in","UnitType":1}},"Past9Hours":{"Metric":{"Value":0.0,"Unit":"mm","UnitType":3},"Imperial":{"Value":0.0,"Unit":"in","UnitType":1}},"Past12Hours":{"Metric":{"Value":0.0,"Unit":"mm","UnitType":3},"Imperial":{"Value":0.0,"Unit":"in","UnitType":1}},"Past18Hours":{"Metric":{"Value":0.0,"Unit":"mm","UnitType":3},"Imperial":{"Value":0.0,"Unit":"in","UnitType":1}},"Past24Hours":{"Metric":{"Value":0.0,"Unit":"mm","UnitType":3},"Imperial":{"Value":0.0,"Unit":"in","UnitType":1}}},"TemperatureSummary":{"Past6HourRange":{"Minimum":{"Metric":{"Value":1.0,"Unit":"C","UnitType":17},"Imperial":{"Value":34.0,"Unit":"F","UnitType":18}},"Maximum":{"Metric":{"Value":17.2,"Unit":"C","UnitType":17},"Imperial":{"Value":63.0,"Unit":"F","UnitType":18}}},"Past12HourRange":{"Minimum":{"Metric":{"Value":1.0,"Unit":"C","UnitType":17},"Imperial":{"Value":34.0,"Unit":"F","UnitType":18}},"Maximum":{"Metric":{"Value":18.4,"Unit":"C","UnitType":17},"Imperial":{"Value":65.0,"Unit":"F","UnitType":18}}},"Past24HourRange":{"Minimum":{"Metric":{"Value":-1.0,"Unit":"C","UnitType":17},"Imperial":{"Value":30.0,"Unit":"F","UnitType":18}},"Maximum":{"Metric":{"Value":18.4,"Unit":"C","UnitType":17},"Imperial":{"Value":65.0,"Unit":"F","UnitType":18}}}},"MobileLink":"http://www.accuweather.com/en/us/todd-creek-co/80602/current-weather/2207713?lang=en-us","Link":"http://www.accuweather.com/en/us/todd-creek-co/80602/current-weather/2207713?lang=en-us"}]'
string: !!binary |
H4sIAAAAAAAAAM2XXY+bOBSG/0rl6wDG4SuRVtVu0umMNKOOmnTmYtULh7jBGmNHGCaTVvnve4A0
NV0IZNUd9SYi4OPnPZ+Yv7+hWxVT8WGlWfZMc67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VzuE4DB0x28FxPAPJq1CA/h/Bhw+/wO9dUEMhBAA
AA==
headers:
Accept:
- '*/*'
Expand All @@ -32,7 +49,7 @@ interactions:
Access-Control-Max-Age:
- '3628800'
Akamai-GRN:
- 0.57853417.1700713731.207b8caa
- 0.4fcf5868.1727039552.f73303f
Cache-Control:
- public, max-age=600
Connection:
Expand All @@ -42,21 +59,21 @@ interactions:
Content-Type:
- application/json; charset=utf-8
Date:
- Thu, 23 Nov 2023 04:28:51 GMT
- Sun, 22 Sep 2024 21:12:32 GMT
Expires:
- Thu, 23 Nov 2023 04:38:51 GMT
- Sun, 22 Sep 2024 21:22:32 GMT
Host:
- api.accuweather.com
RateLimit-Limit:
- '50'
RateLimit-Remaining:
- '47'
- '12'
Request-Context:
- appId=cid-v1:0158d69b-75d9-4a19-9e5f-a14693f847e4
Transfer-Encoding:
- chunked
User-Agent:
- wxdat/1.4.1-42c7262 (+https://github.com/jheddings/wxdat)
- wxdat/1.5.0-d5f119b-static-checks+ (+https://github.com/jheddings/wxdat)
Vary:
- Accept-Encoding
X-Forwarded-For:
Expand Down
8 changes: 4 additions & 4 deletions tests/cassettes/test_ambientwx_bad_api_key.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interactions:
Connection:
- keep-alive
User-Agent:
- wxdat/1.4.1-04bd5a1+ (+https://github.com/jheddings/wxdat)
- wxdat/1.5.0-d5f119b-static-checks+ (+https://github.com/jheddings/wxdat)
method: GET
uri: https://rt.ambientweather.net/v1/devices/eb:8d:60:8a:33:e7?limit=1
response:
Expand All @@ -21,21 +21,21 @@ interactions:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 82a5cd068d4e5209-DEN
- 8c754b39d86251f4-DEN
Connection:
- keep-alive
Content-Length:
- '34'
Content-Type:
- application/json; charset=utf-8
Date:
- Thu, 23 Nov 2023 01:57:21 GMT
- Sun, 22 Sep 2024 21:12:33 GMT
ETag:
- W/"22-vHMvCrpjdAeQKnCuNYODXQ"
NEL:
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
Report-To:
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=yHE1LHIEApzEXH3r6pjbA9rBX7uHsMv218K9PIOiZcfgpVGWOmA%2Fe4esRpbVstY3fhNoMCu%2FT81G3UNIX2OwXFcscJhnikolFDEcIJPWShW%2BunHLtQcdWta7qM3VKcTq9TheebMDZQ%3D%3D"}],"group":"cf-nel","max_age":604800}'
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=1PnddJyT6GrEBFyacy3xdESVmFIll33Ge2PM6ZVf%2FW4umQ0KGzc2US4Ov0ClbwwU9dDFvTMGlTx2GlVz0h1cKjOYwnRKu2UnaS2MjpmAx4xTtZaU%2F75g3gRZDnuGPAmBypsp12m7Fg%3D%3D"}],"group":"cf-nel","max_age":604800}'
Server:
- cloudflare
Strict-Transport-Security:
Expand Down
18 changes: 12 additions & 6 deletions tests/cassettes/test_ambientwx_conditions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,39 @@ interactions:
Connection:
- keep-alive
User-Agent:
- wxdat/1.4.1-04bd5a1+ (+https://github.com/jheddings/wxdat)
- wxdat/1.5.0-d5f119b-static-checks+ (+https://github.com/jheddings/wxdat)
method: GET
uri: https://rt.ambientweather.net/v1/devices/98:CD:AC:22:F4:07?limit=1
response:
body:
string: '[{"dateutc":1700704500000,"tempinf":76.1,"humidityin":26,"baromrelin":30.186,"baromabsin":24.835,"tempf":48.7,"humidity":29,"winddir":74,"winddir_avg10m":65,"windspeedmph":0,"windspdmph_avg10m":1.3,"windgustmph":2.5,"maxdailygust":12.8,"hourlyrainin":0,"eventrainin":0,"dailyrainin":0,"weeklyrainin":0.012,"monthlyrainin":0.016,"yearlyrainin":18.516,"solarradiation":0,"uv":0,"feelsLike":48.7,"dewPoint":17.89,"feelsLikein":74.6,"dewPointin":38.7,"lastRain":"2023-11-20T17:07:00.000Z","date":"2023-11-23T01:55:00.000Z"}]'
string: !!binary |
H4sIAAAAAAAAA2SRQW7DIBBF7zJrgmYwxDFn6KKqumpVVaSQGMXgCOOkVtW7VziNk6rs/tPjMxpe
v8Ca7Mb8AZpqUWPVSCyHQXbh6OMOdC0YtGPw1ufJR9DVhsHWpD4k180ZeaXELzPboTChOCJdSnag
18TrWwlopRicfbTWJ9BUiSW9m9OeMBS4vsDh6JwNxxa0vIISF1Hy6sL345Bnb1NIMJ/W+G4qtLTx
hkHbj6mbkvGxjIgM3MnFvGS+UQzmSzdUN2VS5w7/YOhjbm+UOK2JweTM3ROEHBUxGPrOpGSsN9n3
sawDuRQMxhNoxWDnXDc8+IO7Lsq682PvYwYtFa/qO6O01njvFCIVg84M+cmUBAKFXGGzEuKZlCap
ETkivgCbP/uvIUgTLsb32w8AAAD//wMADiZF3xICAAA=
headers:
Access-Control-Allow-Origin:
- '*'
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 82a5cd0cb9151f38-DEN
- 8c754b3d2b1c5202-DEN
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json; charset=utf-8
Date:
- Thu, 23 Nov 2023 01:57:22 GMT
- Sun, 22 Sep 2024 21:12:34 GMT
ETag:
- W/"208-AfpzQrhgrrJmoBLYtupr6A"
- W/"212-p9lpV6Aj+BJJYh9PFa+Wgw"
NEL:
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
Report-To:
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=2wQClTswQfDt2zi10tBKSPa0Iu9Q1k5ofeDm09ToNqV3a3SGqu5sFMaOU05f4UEWVDL%2BdK8qOahpvRN1iZ0pEUtFD9UbPdJ9rpNUkhpdZdMuWoV%2F7N%2BFeA9Ol%2BZlLDSyN90Q2OEUeg%3D%3D"}],"group":"cf-nel","max_age":604800}'
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=wjmOQ0edriKYHfUrLd4vZEJFzzoF3uoGyIBoIsS2UjTRBpOigRUoE9GoJ4Y%2BQ6WBRzwgqIqrFfT1yBmMFRqBdf3HiC%2F%2Fu8vhA41bFbR4ecwyImyFxNZISJExH2Ra8nEpWDm%2F8ZP6OQ%3D%3D"}],"group":"cf-nel","max_age":604800}'
Server:
- cloudflare
Strict-Transport-Security:
Expand Down
21 changes: 10 additions & 11 deletions tests/cassettes/test_bad_station.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ interactions:
Connection:
- keep-alive
User-Agent:
- wxdat/1.4.1-04bd5a1+ (+https://github.com/jheddings/wxdat)
- wxdat/1.5.0-d5f119b-static-checks+ (+https://github.com/jheddings/wxdat)
method: GET
uri: https://api.weather.gov/stations//XXXX/observations/latest
response:
body:
string: "{\n \"correlationId\": \"69d3db4\",\n \"title\": \"Not Found\"\
,\n \"type\": \"https://api.weather.gov/problems/NotFound\",\n \"status\"\
: 404,\n \"detail\": \"Not Found\",\n \"instance\": \"https://api.weather.gov/requests/69d3db4\"\
\n}"
string: "{\n \"correlationId\": \"d31309e\",\n \"title\": \"Not Found\",\n
\ \"type\": \"https://api.weather.gov/problems/NotFound\",\n \"status\":
404,\n \"detail\": \"Not Found\",\n \"instance\": \"https://api.weather.gov/requests/d31309e\"\n}"
headers:
Access-Control-Allow-Origin:
- '*'
Expand All @@ -32,9 +31,9 @@ interactions:
Content-Type:
- application/problem+json
Date:
- Thu, 23 Nov 2023 01:57:23 GMT
- Sun, 22 Sep 2024 21:12:35 GMT
Expires:
- Thu, 23 Nov 2023 02:02:23 GMT
- Sun, 22 Sep 2024 21:17:35 GMT
Pragma:
- no-cache
Server:
Expand All @@ -44,13 +43,13 @@ interactions:
Vary:
- Accept,Feature-Flags,Accept-Language
X-Correlation-ID:
- 69d3db4
- d31309e
X-Edge-Request-ID:
- 2fee0900
- 40fab666
X-Request-ID:
- be6916c9-5e90-4e08-885e-d50f7f441ff9
- 47404ad4-791c-4c3d-a20c-fd03fabc0de0
X-Server-ID:
- vm-bldr-nids-apiapp3.ncep.noaa.gov
- vm-lnx-nids-apiapp11.ncep.noaa.gov
status:
code: 404
message: Not Found
Expand Down
Loading

0 comments on commit aa9a43a

Please sign in to comment.