python-weather 2.1.1__tar.gz → 2.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {python_weather-2.1.1 → python_weather-2.1.2}/LICENSE +1 -1
  2. {python_weather-2.1.1/python_weather.egg-info → python_weather-2.1.2}/PKG-INFO +2 -2
  3. {python_weather-2.1.1 → python_weather-2.1.2}/pyproject.toml +2 -2
  4. python_weather-2.1.2/python_weather/__init__.py +34 -0
  5. {python_weather-2.1.1 → python_weather-2.1.2}/python_weather/base.py +2 -23
  6. {python_weather-2.1.1 → python_weather-2.1.2}/python_weather/client.py +2 -23
  7. python_weather-2.1.2/python_weather/constants.py +69 -0
  8. {python_weather-2.1.1 → python_weather-2.1.2}/python_weather/enums.py +13 -111
  9. python_weather-2.1.2/python_weather/errors.py +29 -0
  10. {python_weather-2.1.1 → python_weather-2.1.2}/python_weather/forecast.py +2 -23
  11. python_weather-2.1.2/python_weather/version.py +4 -0
  12. {python_weather-2.1.1 → python_weather-2.1.2/python_weather.egg-info}/PKG-INFO +2 -2
  13. python_weather-2.1.2/python_weather.egg-info/requires.txt +1 -0
  14. python_weather-2.1.1/python_weather/__init__.py +0 -55
  15. python_weather-2.1.1/python_weather/constants.py +0 -69
  16. python_weather-2.1.1/python_weather/errors.py +0 -50
  17. python_weather-2.1.1/python_weather/version.py +0 -1
  18. python_weather-2.1.1/python_weather.egg-info/requires.txt +0 -1
  19. {python_weather-2.1.1 → python_weather-2.1.2}/MANIFEST.in +0 -0
  20. {python_weather-2.1.1 → python_weather-2.1.2}/README.md +0 -0
  21. {python_weather-2.1.1 → python_weather-2.1.2}/python_weather.egg-info/SOURCES.txt +0 -0
  22. {python_weather-2.1.1 → python_weather-2.1.2}/python_weather.egg-info/dependency_links.txt +0 -0
  23. {python_weather-2.1.1 → python_weather-2.1.2}/python_weather.egg-info/top_level.txt +0 -0
  24. {python_weather-2.1.1 → python_weather-2.1.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021-2025 null8626
3
+ Copyright (c) 2021-2026 null8626
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-weather
3
- Version: 2.1.1
3
+ Version: 2.1.2
4
4
  Summary: A free and asynchronous weather API wrapper made in Python, for Python.
5
5
  Author: null8626
6
6
  License: MIT
@@ -33,7 +33,7 @@ Classifier: Programming Language :: Python :: 3.14
33
33
  Requires-Python: >=3.10
34
34
  Description-Content-Type: text/markdown
35
35
  License-File: LICENSE
36
- Requires-Dist: aiohttp>=3.13.2
36
+ Requires-Dist: aiohttp>=3.13.3
37
37
  Dynamic: license-file
38
38
 
39
39
  # [python-weather][pypi-url] [![pypi][pypi-image]][pypi-url] [![pypi downloads][pypi-downloads-image]][pypi-url] [![codacy-badge][codacy-image]][codacy-url] [![codecov-badge][codecov-image]][codecov-url] [![ko-fi][ko-fi-brief-image]][ko-fi-url]
@@ -3,13 +3,13 @@ requires = ["setuptools"]
3
3
 
4
4
  [project]
5
5
  name = "python-weather"
6
- version = "2.1.1"
6
+ version = "2.1.2"
7
7
  description = "A free and asynchronous weather API wrapper made in Python, for Python."
8
8
  readme = "README.md"
9
9
  license = { text = "MIT" }
10
10
  authors = [{ name = "null8626" }]
11
11
  keywords = ["weather", "forecast", "weather-forecast"]
12
- dependencies = ["aiohttp>=3.13.2"]
12
+ dependencies = ["aiohttp>=3.13.3"]
13
13
  classifiers = [
14
14
  "Development Status :: 5 - Production/Stable",
15
15
  "Intended Audience :: Education",
@@ -0,0 +1,34 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # SPDX-FileCopyrightText: 2021-2026 null8626
3
+
4
+ from .enums import HeatIndex, Kind, Locale, Phase, UltraViolet, WindDirection
5
+ from .constants import METRIC, IMPERIAL
6
+ from .errors import Error, RequestError
7
+ from .forecast import Forecast
8
+ from .version import VERSION
9
+ from .client import Client
10
+
11
+
12
+ __title__ = 'python-weather'
13
+ __author__ = 'null8626'
14
+ __credits__ = (__author__,)
15
+ __maintainer__ = __author__
16
+ __status__ = 'Production'
17
+ __license__ = 'MIT'
18
+ __copyright__ = 'Copyright (c) 2021-2026 null8626'
19
+ __version__ = VERSION
20
+ __all__ = (
21
+ 'METRIC',
22
+ 'IMPERIAL',
23
+ 'Client',
24
+ 'Error',
25
+ 'Forecast',
26
+ 'RequestError',
27
+ 'HeatIndex',
28
+ 'Kind',
29
+ 'Locale',
30
+ 'Phase',
31
+ 'UltraViolet',
32
+ 'VERSION',
33
+ 'WindDirection',
34
+ )
@@ -1,26 +1,5 @@
1
- """
2
- The MIT License (MIT)
3
-
4
- Copyright (c) 2021-2025 null8626
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
23
- """
1
+ # SPDX-License-Identifier: MIT
2
+ # SPDX-FileCopyrightText: 2021-2026 null8626
24
3
 
25
4
  from .enums import WindDirection, Kind, Locale, UltraViolet
26
5
  from .constants import _Unit
@@ -1,26 +1,5 @@
1
- """
2
- The MIT License (MIT)
3
-
4
- Copyright (c) 2021-2025 null8626
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
23
- """
1
+ # SPDX-License-Identifier: MIT
2
+ # SPDX-FileCopyrightText: 2021-2026 null8626
24
3
 
25
4
  from aiohttp import ClientSession, ClientTimeout, ClientResponseError, TCPConnector
26
5
  from urllib.parse import quote_plus
@@ -0,0 +1,69 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # SPDX-FileCopyrightText: 2021-2026 null8626
3
+
4
+ import re
5
+
6
+
7
+ class _Unit:
8
+ __slots__: tuple[str, ...] = (
9
+ 'temperature',
10
+ 'velocity',
11
+ 'pressure',
12
+ 'precipitation',
13
+ 'visibility',
14
+ 'cm_divisor',
15
+ )
16
+
17
+ temperature: str
18
+ velocity: str
19
+ pressure: str
20
+ precipitation: str
21
+ visibility: str
22
+ cm_divisor: float | int
23
+
24
+ def __init__(
25
+ self,
26
+ temperature: str,
27
+ velocity: str,
28
+ pressure: str,
29
+ precipitation: str,
30
+ visibility: str,
31
+ cm_divisor: float | int,
32
+ ):
33
+ self.temperature = temperature
34
+ self.velocity = velocity
35
+ self.pressure = pressure
36
+ self.precipitation = precipitation
37
+ self.visibility = visibility
38
+ self.cm_divisor = cm_divisor
39
+
40
+ def __repr__(self) -> str:
41
+ return f'<Unit [{self.temperature}, {self.velocity}]>'
42
+
43
+
44
+ METRIC = _Unit('C', 'Kmph', '', 'MM', '', 1)
45
+ IMPERIAL = _Unit('F', 'Miles', 'Inches', 'Inches', 'Miles', 2.54)
46
+
47
+ LATLON_REGEX = re.compile(r'^Lat (\-?[\d\.]+) and Lon (\-?[\d\.]+)$')
48
+
49
+ KIND_EMOJIS = (
50
+ '☀️',
51
+ '⛅️',
52
+ '☁️',
53
+ '☁️',
54
+ '🌫',
55
+ '🌦',
56
+ '🌧',
57
+ '🌧',
58
+ '⛈',
59
+ '🌨',
60
+ '❄️',
61
+ '🌦',
62
+ '🌧',
63
+ '🌧',
64
+ '🌨',
65
+ '❄️',
66
+ '🌩',
67
+ '⛈',
68
+ )
69
+ WIND_DIRECTION_EMOJIS = '↑', '↖', '←', '↙', '↓', '↘', '→', '↗'
@@ -1,30 +1,9 @@
1
- """
2
- The MIT License (MIT)
3
-
4
- Copyright (c) 2021-2025 null8626
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
23
- """
1
+ # SPDX-License-Identifier: MIT
2
+ # SPDX-FileCopyrightText: 2021-2026 null8626
24
3
 
25
4
  from enum import Enum
26
5
 
27
- from .constants import WIND_DIRECTION_EMOJIS
6
+ from .constants import KIND_EMOJIS, WIND_DIRECTION_EMOJIS
28
7
 
29
8
 
30
9
  class BasicEnum(Enum):
@@ -36,6 +15,10 @@ class BasicEnum(Enum):
36
15
  def __str__(self) -> str:
37
16
  return self.name.replace('_', ' ').title()
38
17
 
18
+ @property
19
+ def _index(self) -> int:
20
+ return next(filter(lambda kind: self is kind[1], enumerate(self.__class__)))[0]
21
+
39
22
 
40
23
  class IndexedEnum(Enum):
41
24
  __slots__: tuple[str, ...] = ('index',)
@@ -167,40 +150,9 @@ class WindDirection(BasicEnum):
167
150
  return enum
168
151
 
169
152
  def __contains__(self, other: 'WindDirection | float | int') -> bool:
170
- other = float(other)
171
-
172
- if self is self.NORTH:
173
- return other > 348.75 or other <= 11.25
174
- elif self is self.NORTH_NORTHEAST:
175
- return 11.25 < other <= 33.75
176
- elif self is self.NORTHEAST:
177
- return 33.75 < other <= 56.25
178
- elif self is self.EAST_NORTHEAST:
179
- return 56.25 < other <= 78.75
180
- elif self is self.EAST:
181
- return 78.75 < other <= 101.25
182
- elif self is self.EAST_SOUTHEAST:
183
- return 101.25 < other <= 123.75
184
- elif self is self.SOUTHEAST:
185
- return 123.75 < other <= 146.25
186
- elif self is self.SOUTH_SOUTHEAST:
187
- return 146.25 < other <= 168.75
188
- elif self is self.SOUTH:
189
- return 168.75 < other <= 191.25
190
- elif self is self.SOUTH_SOUTHWEST:
191
- return 191.25 < other <= 213.75
192
- elif self is self.SOUTHWEST:
193
- return 213.75 < other <= 236.25
194
- elif self is self.WEST_SOUTHWEST:
195
- return 236.25 < other <= 258.75
196
- elif self is self.WEST:
197
- return 258.75 < other <= 281.25
198
- elif self is self.WEST_NORTHWEST:
199
- return 281.25 < other <= 303.75
200
- elif self is self.NORTHWEST:
201
- return 303.75 < other <= 326.25
202
- else:
203
- return 326.25 < other <= 348.75
153
+ members = list(self.__class__)
154
+
155
+ return self is members[int(((float(other) % 360) + 11.25) // 22.5) % len(members)]
204
156
 
205
157
  def __int__(self) -> int:
206
158
  return int(self.degrees)
@@ -212,7 +164,7 @@ class WindDirection(BasicEnum):
212
164
  def emoji(self) -> str:
213
165
  """Emoji representation."""
214
166
 
215
- return WIND_DIRECTION_EMOJIS[int(((self.degrees + 22.5) % 360) / 45.0)]
167
+ return WIND_DIRECTION_EMOJIS[int(((self.degrees + 22.5) % 360) // 45)]
216
168
 
217
169
 
218
170
  class Locale(Enum):
@@ -357,42 +309,7 @@ class Kind(BasicEnum):
357
309
  def emoji(self) -> str:
358
310
  """Emoji representation."""
359
311
 
360
- if self is self.CLOUDY:
361
- return '☁️'
362
- elif self is self.FOG:
363
- return '🌫'
364
- elif self is self.HEAVY_RAIN:
365
- return '🌧'
366
- elif self is self.HEAVY_SHOWERS:
367
- return '🌧'
368
- elif self is self.HEAVY_SNOW:
369
- return '❄️'
370
- elif self is self.HEAVY_SNOW_SHOWERS:
371
- return '❄️'
372
- elif self is self.LIGHT_RAIN:
373
- return '🌦'
374
- elif self is self.LIGHT_SHOWERS:
375
- return '🌦'
376
- elif self is self.LIGHT_SLEET:
377
- return '🌧'
378
- elif self is self.LIGHT_SLEET_SHOWERS:
379
- return '🌧'
380
- elif self is self.LIGHT_SNOW:
381
- return '🌨'
382
- elif self is self.LIGHT_SNOW_SHOWERS:
383
- return '🌨'
384
- elif self is self.PARTLY_CLOUDY:
385
- return '⛅️'
386
- elif self is self.SUNNY:
387
- return '☀️'
388
- elif self is self.THUNDERY_HEAVY_RAIN:
389
- return '🌩'
390
- elif self is self.THUNDERY_SHOWERS:
391
- return '⛈'
392
- elif self is self.THUNDERY_SNOW_SHOWERS:
393
- return '⛈'
394
- else:
395
- return '☁️'
312
+ return KIND_EMOJIS[self._index]
396
313
 
397
314
 
398
315
  class Phase(BasicEnum):
@@ -413,19 +330,4 @@ class Phase(BasicEnum):
413
330
  def emoji(self) -> str:
414
331
  """Emoji representation."""
415
332
 
416
- if self is self.NEW_MOON:
417
- return '🌑'
418
- elif self is self.WAXING_CRESCENT:
419
- return '🌒'
420
- elif self is self.FIRST_QUARTER:
421
- return '🌓'
422
- elif self is self.WAXING_GIBBOUS:
423
- return '🌔'
424
- elif self is self.FULL_MOON:
425
- return '🌕'
426
- elif self is self.WANING_GIBBOUS:
427
- return '🌖'
428
- elif self is self.LAST_QUARTER:
429
- return '🌗'
430
- else:
431
- return '🌘'
333
+ return chr(0x1F311 + self._index)
@@ -0,0 +1,29 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # SPDX-FileCopyrightText: 2021-2026 null8626
3
+
4
+
5
+ class Error(Exception):
6
+ """The base error class. Extends :py:class:`Exception`."""
7
+
8
+ __slots__: tuple[str, ...] = ()
9
+
10
+
11
+ class RequestError(Error):
12
+ """Thrown upon HTTP request failure. Extends :class:`.Error`."""
13
+
14
+ __slots__: tuple[str, ...] = 'status', 'reason'
15
+
16
+ status: int | None
17
+ """The status code."""
18
+
19
+ reason: str | None
20
+ """The reason for this status code."""
21
+
22
+ def __init__(self, status: int | None, reason: str | None):
23
+ self.status = status
24
+ self.reason = reason
25
+
26
+ super().__init__(f'{status}: {reason}')
27
+
28
+ def __repr__(self) -> str: # pragma: nocover
29
+ return f'<{__class__.__module__}.{__class__.__name__} status={self.status} reason={self.reason!r}>'
@@ -1,26 +1,5 @@
1
- """
2
- The MIT License (MIT)
3
-
4
- Copyright (c) 2021-2025 null8626
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
23
- """
1
+ # SPDX-License-Identifier: MIT
2
+ # SPDX-FileCopyrightText: 2021-2026 null8626
24
3
 
25
4
  from datetime import datetime, date, time
26
5
  from collections.abc import Iterator
@@ -0,0 +1,4 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # SPDX-FileCopyrightText: 2021-2026 null8626
3
+
4
+ VERSION = '2.1.2'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-weather
3
- Version: 2.1.1
3
+ Version: 2.1.2
4
4
  Summary: A free and asynchronous weather API wrapper made in Python, for Python.
5
5
  Author: null8626
6
6
  License: MIT
@@ -33,7 +33,7 @@ Classifier: Programming Language :: Python :: 3.14
33
33
  Requires-Python: >=3.10
34
34
  Description-Content-Type: text/markdown
35
35
  License-File: LICENSE
36
- Requires-Dist: aiohttp>=3.13.2
36
+ Requires-Dist: aiohttp>=3.13.3
37
37
  Dynamic: license-file
38
38
 
39
39
  # [python-weather][pypi-url] [![pypi][pypi-image]][pypi-url] [![pypi downloads][pypi-downloads-image]][pypi-url] [![codacy-badge][codacy-image]][codacy-url] [![codecov-badge][codecov-image]][codecov-url] [![ko-fi][ko-fi-brief-image]][ko-fi-url]
@@ -0,0 +1 @@
1
+ aiohttp>=3.13.3
@@ -1,55 +0,0 @@
1
- """
2
- The MIT License (MIT)
3
-
4
- Copyright (c) 2021-2025 null8626
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
23
- """
24
-
25
- from .enums import HeatIndex, Kind, Locale, Phase, UltraViolet, WindDirection
26
- from .constants import METRIC, IMPERIAL
27
- from .errors import Error, RequestError
28
- from .forecast import Forecast
29
- from .version import VERSION
30
- from .client import Client
31
-
32
-
33
- __title__ = 'python-weather'
34
- __author__ = 'null8626'
35
- __credits__ = (__author__,)
36
- __maintainer__ = __author__
37
- __status__ = 'Production'
38
- __license__ = 'MIT'
39
- __copyright__ = 'Copyright (c) 2021-2025 null8626'
40
- __version__ = VERSION
41
- __all__ = (
42
- 'METRIC',
43
- 'IMPERIAL',
44
- 'Client',
45
- 'Error',
46
- 'Forecast',
47
- 'RequestError',
48
- 'HeatIndex',
49
- 'Kind',
50
- 'Locale',
51
- 'Phase',
52
- 'UltraViolet',
53
- 'VERSION',
54
- 'WindDirection',
55
- )
@@ -1,69 +0,0 @@
1
- """
2
- The MIT License (MIT)
3
-
4
- Copyright (c) 2021-2025 null8626
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
23
- """
24
-
25
- import re
26
-
27
-
28
- class _Unit:
29
- __slots__: tuple[str, ...] = (
30
- 'temperature',
31
- 'velocity',
32
- 'pressure',
33
- 'precipitation',
34
- 'visibility',
35
- 'cm_divisor',
36
- )
37
-
38
- temperature: str
39
- velocity: str
40
- pressure: str
41
- precipitation: str
42
- visibility: str
43
- cm_divisor: float | int
44
-
45
- def __init__(
46
- self,
47
- temperature: str,
48
- velocity: str,
49
- pressure: str,
50
- precipitation: str,
51
- visibility: str,
52
- cm_divisor: float | int,
53
- ):
54
- self.temperature = temperature
55
- self.velocity = velocity
56
- self.pressure = pressure
57
- self.precipitation = precipitation
58
- self.visibility = visibility
59
- self.cm_divisor = cm_divisor
60
-
61
- def __repr__(self) -> str:
62
- return f'<Unit [{self.temperature}, {self.velocity}]>'
63
-
64
-
65
- METRIC = _Unit('C', 'Kmph', '', 'MM', '', 1)
66
- IMPERIAL = _Unit('F', 'Miles', 'Inches', 'Inches', 'Miles', 2.54)
67
-
68
- WIND_DIRECTION_EMOJIS = '↓', '↙', '←', '↖', '↑', '↗', '→', '↘'
69
- LATLON_REGEX = re.compile(r'^Lat (\-?[\d\.]+) and Lon (\-?[\d\.]+)$')
@@ -1,50 +0,0 @@
1
- """
2
- The MIT License (MIT)
3
-
4
- Copyright (c) 2021-2025 null8626
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
23
- """
24
-
25
-
26
- class Error(Exception):
27
- """The base error class. Extends :py:class:`Exception`."""
28
-
29
- __slots__: tuple[str, ...] = ()
30
-
31
-
32
- class RequestError(Error):
33
- """Thrown upon HTTP request failure. Extends :class:`.Error`."""
34
-
35
- __slots__: tuple[str, ...] = 'status', 'reason'
36
-
37
- status: int | None
38
- """The status code."""
39
-
40
- reason: str | None
41
- """The reason for this status code."""
42
-
43
- def __init__(self, status: int | None, reason: str | None):
44
- self.status = status
45
- self.reason = reason
46
-
47
- super().__init__(f'{status}: {reason}')
48
-
49
- def __repr__(self) -> str: # pragma: nocover
50
- return f'<{__class__.__module__}.{__class__.__name__} status={self.status} reason={self.reason!r}>'
@@ -1 +0,0 @@
1
- VERSION = '3.0.0'
@@ -1 +0,0 @@
1
- aiohttp>=3.13.2
File without changes
File without changes