python-weather 2.0.7__tar.gz → 2.1.1__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 (21) hide show
  1. {python_weather-2.0.7 → python_weather-2.1.1}/LICENSE +1 -1
  2. {python_weather-2.0.7 → python_weather-2.1.1}/MANIFEST.in +8 -1
  3. {python_weather-2.0.7/python_weather.egg-info → python_weather-2.1.1}/PKG-INFO +104 -104
  4. {python_weather-2.0.7 → python_weather-2.1.1}/README.md +24 -23
  5. {python_weather-2.0.7 → python_weather-2.1.1}/pyproject.toml +17 -8
  6. {python_weather-2.0.7 → python_weather-2.1.1}/python_weather/__init__.py +11 -3
  7. {python_weather-2.0.7 → python_weather-2.1.1}/python_weather/base.py +31 -23
  8. python_weather-2.1.1/python_weather/client.py +184 -0
  9. {python_weather-2.0.7 → python_weather-2.1.1}/python_weather/constants.py +11 -5
  10. {python_weather-2.0.7 → python_weather-2.1.1}/python_weather/enums.py +79 -64
  11. {python_weather-2.0.7 → python_weather-2.1.1}/python_weather/errors.py +17 -12
  12. {python_weather-2.0.7 → python_weather-2.1.1}/python_weather/forecast.py +47 -41
  13. python_weather-2.1.1/python_weather/version.py +1 -0
  14. {python_weather-2.0.7 → python_weather-2.1.1/python_weather.egg-info}/PKG-INFO +104 -104
  15. {python_weather-2.0.7 → python_weather-2.1.1}/python_weather.egg-info/SOURCES.txt +1 -0
  16. python_weather-2.1.1/python_weather.egg-info/requires.txt +1 -0
  17. {python_weather-2.0.7 → python_weather-2.1.1}/setup.cfg +4 -4
  18. python_weather-2.0.7/python_weather/client.py +0 -140
  19. python_weather-2.0.7/python_weather.egg-info/requires.txt +0 -1
  20. {python_weather-2.0.7 → python_weather-2.1.1}/python_weather.egg-info/dependency_links.txt +0 -0
  21. {python_weather-2.0.7 → python_weather-2.1.1}/python_weather.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021-2024 null8626
3
+ Copyright (c) 2021-2025 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,10 +1,17 @@
1
+ prune .pytest_cache
1
2
  prune .ruff_cache
2
3
  prune .github
4
+ prune tests
3
5
  prune docs
4
6
  exclude .gitattributes
5
7
  exclude .gitignore
6
8
  exclude .readthedocs.yml
9
+ exclude .coverage
7
10
  exclude ruff.toml
8
11
  exclude LICENSE
9
12
  exclude changelog.yml
10
- exclude test.py
13
+ exclude codacy-coverage
14
+ exclude codecov*
15
+ exclude coverage.xml
16
+ exclude junit.xml
17
+ global-exclude __pycache__/*
@@ -1,104 +1,104 @@
1
- Metadata-Version: 2.1
2
- Name: python-weather
3
- Version: 2.0.7
4
- Summary: A free and asynchronous weather API wrapper made in Python, for Python.
5
- Author: null8626
6
- License: MIT
7
- Project-URL: Documentation, https://python-weather.readthedocs.io/en/latest/
8
- Project-URL: Repository, https://github.com/null8626/python-weather
9
- Project-URL: Changelog, https://python-weather.readthedocs.io/en/latest/changelog.html
10
- Project-URL: Donate via GitHub Sponsors, https://github.com/sponsors/null8626
11
- Project-URL: Donate via Ko-fi, https://ko-fi.com/null8626
12
- Keywords: weather,forecast,weather-api,weather-forecast
13
- Classifier: Development Status :: 5 - Production/Stable
14
- Classifier: Intended Audience :: Education
15
- Classifier: Intended Audience :: Developers
16
- Classifier: Intended Audience :: Information Technology
17
- Classifier: Natural Language :: English
18
- Classifier: Operating System :: OS Independent
19
- Classifier: Topic :: Education
20
- Classifier: Topic :: Internet
21
- Classifier: Topic :: Scientific/Engineering
22
- Classifier: Topic :: Scientific/Engineering :: Astronomy
23
- Classifier: Topic :: Software Development
24
- Classifier: Topic :: Software Development :: Libraries
25
- Classifier: License :: OSI Approved :: MIT License
26
- Classifier: Programming Language :: Python
27
- Classifier: Programming Language :: Python :: 3
28
- Classifier: Programming Language :: Python :: 3 :: Only
29
- Classifier: Programming Language :: Python :: 3.8
30
- Classifier: Programming Language :: Python :: 3.9
31
- Classifier: Programming Language :: Python :: 3.10
32
- Classifier: Programming Language :: Python :: 3.11
33
- Classifier: Programming Language :: Python :: 3.12
34
- Classifier: Programming Language :: Python :: 3.13
35
- Requires-Python: >=3.8
36
- Description-Content-Type: text/markdown
37
- License-File: LICENSE
38
- Requires-Dist: aiohttp>=3.10.10
39
-
40
- # [python-weather][pypi-url] [![pypi][pypi-image]][pypi-url] [![downloads][downloads-image]][pypi-url] [![codacy-badge][codacy-url]][codacy-image] [![ko-fi][ko-fi-brief-image]][ko-fi-url]
41
-
42
- [pypi-image]: https://img.shields.io/pypi/v/python-weather.svg?style=flat-square
43
- [pypi-url]: https://pypi.org/project/python-weather/
44
- [downloads-image]: https://img.shields.io/pypi/dm/python-weather?style=flat-square
45
- [ko-fi-brief-image]: https://img.shields.io/badge/donations-ko--fi-red?color=ff5e5b&style=flat-square
46
- [codacy-url]: https://app.codacy.com/project/badge/Grade/0f7721b7e4314a748c75a04f0a7e0ce3
47
- [codacy-image]: https://app.codacy.com/gh/null8626/python-weather/dashboard
48
- [ko-fi-image]: https://ko-fi.com/img/githubbutton_sm.svg
49
- [ko-fi-url]: https://ko-fi.com/null8626
50
-
51
- A free and asynchronous weather Python API wrapper made in Python, for Python.
52
-
53
- ## Installation
54
-
55
- ```console
56
- pip install python-weather
57
- ```
58
-
59
- ## Example
60
-
61
- For more information, please read the [documentation](https://python-weather.readthedocs.io/en/latest/).
62
-
63
- ```py
64
- # import the module
65
- import python_weather
66
-
67
- import asyncio
68
- import os
69
-
70
- async def getweather() -> None:
71
- # declare the client. the measuring unit used defaults to the metric system (celcius, km/h, etc.)
72
- async with python_weather.Client(unit=python_weather.IMPERIAL) as client:
73
- # fetch a weather forecast from a city
74
- weather = await client.get('New York')
75
-
76
- # returns the current day's forecast temperature (int)
77
- print(weather.temperature)
78
-
79
- # get the weather forecast for a few days
80
- for daily in weather:
81
- print(daily)
82
-
83
- # hourly forecasts
84
- for hourly in daily:
85
- print(f' --> {hourly!r}')
86
-
87
- if __name__ == '__main__':
88
- # see https://stackoverflow.com/questions/45600579/asyncio-event-loop-is-closed-when-getting-loop
89
- # for more details
90
- if os.name == 'nt':
91
- asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
92
-
93
- asyncio.run(getweather())
94
- ```
95
-
96
- ## Data source
97
-
98
- This library depends on [`wttr.in`](https://github.com/chubin/wttr.in), which uses data from the [World Weather Online API](https://www.worldweatheronline.com/weather-api/).
99
-
100
- ## Donations
101
-
102
- If you want to support this project, consider donating! ❤
103
-
104
- [![ko-fi][ko-fi-image]][ko-fi-url]
1
+ Metadata-Version: 2.4
2
+ Name: python-weather
3
+ Version: 2.1.1
4
+ Summary: A free and asynchronous weather API wrapper made in Python, for Python.
5
+ Author: null8626
6
+ License: MIT
7
+ Project-URL: Documentation, https://python-weather.readthedocs.io/en/latest/
8
+ Project-URL: Repository, https://github.com/null8626/python-weather
9
+ Project-URL: Changelog, https://python-weather.readthedocs.io/en/latest/changelog.html
10
+ Project-URL: Donate via GitHub Sponsors, https://github.com/sponsors/null8626
11
+ Project-URL: Donate via Ko-fi, https://ko-fi.com/null8626
12
+ Keywords: weather,forecast,weather-forecast
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Education
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Information Technology
17
+ Classifier: Natural Language :: English
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Topic :: Education
20
+ Classifier: Topic :: Internet
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
23
+ Classifier: Topic :: Software Development
24
+ Classifier: Topic :: Software Development :: Libraries
25
+ Classifier: Programming Language :: Python
26
+ Classifier: Programming Language :: Python :: 3
27
+ Classifier: Programming Language :: Python :: 3 :: Only
28
+ Classifier: Programming Language :: Python :: 3.10
29
+ Classifier: Programming Language :: Python :: 3.11
30
+ Classifier: Programming Language :: Python :: 3.12
31
+ Classifier: Programming Language :: Python :: 3.13
32
+ Classifier: Programming Language :: Python :: 3.14
33
+ Requires-Python: >=3.10
34
+ Description-Content-Type: text/markdown
35
+ License-File: LICENSE
36
+ Requires-Dist: aiohttp>=3.13.2
37
+ Dynamic: license-file
38
+
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]
40
+
41
+ [pypi-url]: https://pypi.org/project/python-weather/
42
+ [pypi-image]: https://img.shields.io/pypi/v/python-weather.svg?style=flat-square
43
+ [pypi-downloads-image]: https://img.shields.io/pypi/dm/python-weather?style=flat-square
44
+ [codacy-url]: https://app.codacy.com/gh/null8626/python-weather/dashboard
45
+ [codacy-image]: https://app.codacy.com/project/badge/Grade/0f7721b7e4314a748c75a04f0a7e0ce3
46
+ [codecov-url]: https://codecov.io/gh/null8626/python-weather
47
+ [codecov-image]: https://codecov.io/gh/null8626/python-weather/graph/badge.svg
48
+ [ko-fi-url]: https://ko-fi.com/null8626
49
+ [ko-fi-image]: https://ko-fi.com/img/githubbutton_sm.svg
50
+ [ko-fi-brief-image]: https://img.shields.io/badge/donations-ko--fi-red?color=ff5e5b&style=flat-square
51
+
52
+ A free and asynchronous weather Python API wrapper made in Python, for Python.
53
+
54
+ ## Getting started
55
+
56
+ Run the following command in your terminal:
57
+
58
+ ```console
59
+ pip install python-weather
60
+ ```
61
+
62
+ ## Example
63
+
64
+ For more information, please read the [documentation](https://python-weather.readthedocs.io/en/latest/).
65
+
66
+ ```py
67
+ # Import the module.
68
+ import python_weather
69
+
70
+ import asyncio
71
+
72
+
73
+ async def main() -> None:
74
+
75
+ # Declare the client. The measuring unit used defaults to the metric system (celcius, km/h, etc.)
76
+ async with python_weather.Client(unit=python_weather.IMPERIAL) as client:
77
+
78
+ # Fetch a weather forecast from a city.
79
+ weather = await client.get('New York')
80
+
81
+ # Fetch the temperature for today.
82
+ print(weather.temperature)
83
+
84
+ # Fetch weather forecast for upcoming days.
85
+ for daily in weather:
86
+ print(daily)
87
+
88
+ # Each daily forecast has their own hourly forecasts.
89
+ for hourly in daily:
90
+ print(f' --> {hourly!r}')
91
+
92
+ if __name__ == '__main__':
93
+ asyncio.run(main())
94
+ ```
95
+
96
+ ## Data source
97
+
98
+ This library depends on [`wttr.in`](https://github.com/chubin/wttr.in), which uses data from the [World Weather Online API](https://www.worldweatheronline.com/weather-api/).
99
+
100
+ ## Donations
101
+
102
+ If you want to support this project, consider donating! ❤
103
+
104
+ [![ko-fi][ko-fi-image]][ko-fi-url]
@@ -1,17 +1,21 @@
1
- # [python-weather][pypi-url] [![pypi][pypi-image]][pypi-url] [![downloads][downloads-image]][pypi-url] [![codacy-badge][codacy-url]][codacy-image] [![ko-fi][ko-fi-brief-image]][ko-fi-url]
1
+ # [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]
2
2
 
3
- [pypi-image]: https://img.shields.io/pypi/v/python-weather.svg?style=flat-square
4
3
  [pypi-url]: https://pypi.org/project/python-weather/
5
- [downloads-image]: https://img.shields.io/pypi/dm/python-weather?style=flat-square
6
- [ko-fi-brief-image]: https://img.shields.io/badge/donations-ko--fi-red?color=ff5e5b&style=flat-square
7
- [codacy-url]: https://app.codacy.com/project/badge/Grade/0f7721b7e4314a748c75a04f0a7e0ce3
8
- [codacy-image]: https://app.codacy.com/gh/null8626/python-weather/dashboard
9
- [ko-fi-image]: https://ko-fi.com/img/githubbutton_sm.svg
4
+ [pypi-image]: https://img.shields.io/pypi/v/python-weather.svg?style=flat-square
5
+ [pypi-downloads-image]: https://img.shields.io/pypi/dm/python-weather?style=flat-square
6
+ [codacy-url]: https://app.codacy.com/gh/null8626/python-weather/dashboard
7
+ [codacy-image]: https://app.codacy.com/project/badge/Grade/0f7721b7e4314a748c75a04f0a7e0ce3
8
+ [codecov-url]: https://codecov.io/gh/null8626/python-weather
9
+ [codecov-image]: https://codecov.io/gh/null8626/python-weather/graph/badge.svg
10
10
  [ko-fi-url]: https://ko-fi.com/null8626
11
+ [ko-fi-image]: https://ko-fi.com/img/githubbutton_sm.svg
12
+ [ko-fi-brief-image]: https://img.shields.io/badge/donations-ko--fi-red?color=ff5e5b&style=flat-square
11
13
 
12
14
  A free and asynchronous weather Python API wrapper made in Python, for Python.
13
15
 
14
- ## Installation
16
+ ## Getting started
17
+
18
+ Run the following command in your terminal:
15
19
 
16
20
  ```console
17
21
  pip install python-weather
@@ -22,36 +26,33 @@ pip install python-weather
22
26
  For more information, please read the [documentation](https://python-weather.readthedocs.io/en/latest/).
23
27
 
24
28
  ```py
25
- # import the module
29
+ # Import the module.
26
30
  import python_weather
27
31
 
28
32
  import asyncio
29
- import os
30
33
 
31
- async def getweather() -> None:
32
- # declare the client. the measuring unit used defaults to the metric system (celcius, km/h, etc.)
34
+
35
+ async def main() -> None:
36
+
37
+ # Declare the client. The measuring unit used defaults to the metric system (celcius, km/h, etc.)
33
38
  async with python_weather.Client(unit=python_weather.IMPERIAL) as client:
34
- # fetch a weather forecast from a city
39
+
40
+ # Fetch a weather forecast from a city.
35
41
  weather = await client.get('New York')
36
42
 
37
- # returns the current day's forecast temperature (int)
43
+ # Fetch the temperature for today.
38
44
  print(weather.temperature)
39
45
 
40
- # get the weather forecast for a few days
46
+ # Fetch weather forecast for upcoming days.
41
47
  for daily in weather:
42
48
  print(daily)
43
-
44
- # hourly forecasts
49
+
50
+ # Each daily forecast has their own hourly forecasts.
45
51
  for hourly in daily:
46
52
  print(f' --> {hourly!r}')
47
53
 
48
54
  if __name__ == '__main__':
49
- # see https://stackoverflow.com/questions/45600579/asyncio-event-loop-is-closed-when-getting-loop
50
- # for more details
51
- if os.name == 'nt':
52
- asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
53
-
54
- asyncio.run(getweather())
55
+ asyncio.run(main())
55
56
  ```
56
57
 
57
58
  ## Data source
@@ -3,13 +3,13 @@ requires = ["setuptools"]
3
3
 
4
4
  [project]
5
5
  name = "python-weather"
6
- version = "2.0.7"
6
+ version = "2.1.1"
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
- keywords = ["weather", "forecast", "weather-api", "weather-forecast"]
12
- dependencies = ["aiohttp>=3.10.10"]
11
+ keywords = ["weather", "forecast", "weather-forecast"]
12
+ dependencies = ["aiohttp>=3.13.2"]
13
13
  classifiers = [
14
14
  "Development Status :: 5 - Production/Stable",
15
15
  "Intended Audience :: Education",
@@ -23,18 +23,16 @@ classifiers = [
23
23
  "Topic :: Scientific/Engineering :: Astronomy",
24
24
  "Topic :: Software Development",
25
25
  "Topic :: Software Development :: Libraries",
26
- "License :: OSI Approved :: MIT License",
27
26
  "Programming Language :: Python",
28
27
  "Programming Language :: Python :: 3",
29
28
  "Programming Language :: Python :: 3 :: Only",
30
- "Programming Language :: Python :: 3.8",
31
- "Programming Language :: Python :: 3.9",
32
29
  "Programming Language :: Python :: 3.10",
33
30
  "Programming Language :: Python :: 3.11",
34
31
  "Programming Language :: Python :: 3.12",
35
- "Programming Language :: Python :: 3.13"
32
+ "Programming Language :: Python :: 3.13",
33
+ "Programming Language :: Python :: 3.14"
36
34
  ]
37
- requires-python = ">=3.8"
35
+ requires-python = ">=3.10"
38
36
 
39
37
  [project.urls]
40
38
  Documentation = "https://python-weather.readthedocs.io/en/latest/"
@@ -42,3 +40,14 @@ Repository = "https://github.com/null8626/python-weather"
42
40
  Changelog = "https://python-weather.readthedocs.io/en/latest/changelog.html"
43
41
  "Donate via GitHub Sponsors" = "https://github.com/sponsors/null8626"
44
42
  "Donate via Ko-fi" = "https://ko-fi.com/null8626"
43
+
44
+ [tool.pytest.ini_options]
45
+ minversion = "8.0"
46
+ testpaths = ["tests"]
47
+
48
+ [tool.coverage.report]
49
+ exclude_lines = [
50
+ "^\\s*async def __a\\w+__\\(",
51
+ "# pragma: nocover",
52
+ "TYPE_CHECKING:$"
53
+ ]
@@ -1,7 +1,7 @@
1
1
  """
2
2
  The MIT License (MIT)
3
3
 
4
- Copyright (c) 2021-2024 null8626
4
+ Copyright (c) 2021-2025 null8626
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  of this software and associated documentation files (the "Software"), to deal
@@ -25,23 +25,31 @@ SOFTWARE.
25
25
  from .enums import HeatIndex, Kind, Locale, Phase, UltraViolet, WindDirection
26
26
  from .constants import METRIC, IMPERIAL
27
27
  from .errors import Error, RequestError
28
+ from .forecast import Forecast
29
+ from .version import VERSION
28
30
  from .client import Client
29
31
 
32
+
30
33
  __title__ = 'python-weather'
31
34
  __author__ = 'null8626'
35
+ __credits__ = (__author__,)
36
+ __maintainer__ = __author__
37
+ __status__ = 'Production'
32
38
  __license__ = 'MIT'
33
- __copyright__ = 'Copyright (c) 2021-2024 null8626'
34
- __version__ = '2.0.7'
39
+ __copyright__ = 'Copyright (c) 2021-2025 null8626'
40
+ __version__ = VERSION
35
41
  __all__ = (
36
42
  'METRIC',
37
43
  'IMPERIAL',
38
44
  'Client',
39
45
  'Error',
46
+ 'Forecast',
40
47
  'RequestError',
41
48
  'HeatIndex',
42
49
  'Kind',
43
50
  'Locale',
44
51
  'Phase',
45
52
  'UltraViolet',
53
+ 'VERSION',
46
54
  'WindDirection',
47
55
  )
@@ -1,7 +1,7 @@
1
1
  """
2
2
  The MIT License (MIT)
3
3
 
4
- Copyright (c) 2021-2024 null8626
4
+ Copyright (c) 2021-2025 null8626
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  of this software and associated documentation files (the "Software"), to deal
@@ -22,15 +22,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  SOFTWARE.
23
23
  """
24
24
 
25
- from typing import Tuple
26
-
27
- from .errors import Error
28
25
  from .enums import WindDirection, Kind, Locale, UltraViolet
29
26
  from .constants import _Unit
27
+ from .errors import Error
30
28
 
31
29
 
32
30
  class CustomizableBase:
33
- __slots__: Tuple[str, ...] = ('__unit', '__locale')
31
+ __slots__: tuple[str, ...] = '_unit', '_locale'
32
+
33
+ _unit: _Unit
34
+ _locale: Locale
34
35
 
35
36
  def __init__(self, unit: _Unit, locale: Locale):
36
37
  self.unit = unit
@@ -38,48 +39,51 @@ class CustomizableBase:
38
39
 
39
40
  @property
40
41
  def unit(self) -> _Unit:
41
- """The measuring unit used to display information in this object."""
42
+ """The measuring unit used."""
42
43
 
43
- return self.__unit
44
+ return self._unit
44
45
 
45
46
  @unit.setter
46
47
  def unit(self, to: _Unit) -> None:
47
48
  """
48
- Sets the default measuring unit used to display information in this object.
49
+ Sets the default measuring unit used.
49
50
 
50
- :param to: The new default measuring unit to be used to display information in this object. Must be either ``METRIC`` or ``IMPERIAL``.
51
- :exception Error: If the ``to`` argument is not either ``METRIC`` or ``IMPERIAL``.
51
+ :param to: The new default measuring unit to be used.
52
+
53
+ :exception Error: ``to`` is not either :data:`~.constants.METRIC` or :data:`~.constants.IMPERIAL`.
52
54
  """
53
55
 
54
56
  if not isinstance(to, _Unit):
55
57
  raise Error('Invalid measuring unit specified!')
56
58
 
57
- self.__unit = to
59
+ self._unit = to
58
60
 
59
61
  @property
60
62
  def locale(self) -> Locale:
61
- """The localization used to display information in this object."""
63
+ """The localization used."""
62
64
 
63
- return self.__locale
65
+ return self._locale
64
66
 
65
67
  @locale.setter
66
68
  def locale(self, to: Locale) -> None:
67
69
  """
68
- Sets the default localization used to display information in this object.
70
+ Sets the default localization used.
71
+
72
+ :param to: The new :class:`.Locale` to be used.
73
+ :type to: :class:`.Locale`
69
74
 
70
- :param to: The new :class:`~python_weather.enums.Locale` to be used to display information in this object.
71
- :type to: Locale
72
- :exception Error: If the ``to`` argument is not a part of the :class:`~python_weather.enums.Locale` enum.
75
+ :exception Error: ``to`` is not a part of the :class:`.Locale` enum.
73
76
  """
74
77
 
75
78
  if not isinstance(to, Locale):
76
79
  raise Error(f'Expected {to!r} to be a Locale enum')
77
80
 
78
- self.__locale = to
81
+ self._locale = to
79
82
 
80
83
 
81
84
  class BaseForecast:
82
- __slots__: Tuple[str, ...] = (
85
+ __slots__: tuple[str, ...] = (
86
+ 'cloud_cover',
83
87
  'ultraviolet',
84
88
  'humidity',
85
89
  'wind_direction',
@@ -93,8 +97,11 @@ class BaseForecast:
93
97
  'description',
94
98
  )
95
99
 
100
+ cloud_cover: int
101
+ """The cloud cover value in percent."""
102
+
96
103
  ultraviolet: UltraViolet
97
- """The ultra-violet (UV) index."""
104
+ """The ultra-violet index."""
98
105
 
99
106
  humidity: int
100
107
  """The humidity value in percent."""
@@ -106,10 +113,10 @@ class BaseForecast:
106
113
  """The kind of the forecast."""
107
114
 
108
115
  feels_like: int
109
- """What it felt like, in celcius or fahrenheit."""
116
+ """What it felt like in either celcius or fahrenheit."""
110
117
 
111
118
  temperature: int
112
- """The temperature in either celcius or Fahrenheit."""
119
+ """The temperature in either celcius or fahrenheit."""
113
120
 
114
121
  precipitation: float
115
122
  """The precipitation in either millimeters or inches."""
@@ -124,7 +131,7 @@ class BaseForecast:
124
131
  """The wind speeds in either kilometers/hour or miles/hour."""
125
132
 
126
133
  description: str
127
- """The description regarding the forecast. This can be localized in different languages depending on the localization used."""
134
+ """The description regarding the forecast depending on the localization used."""
128
135
 
129
136
  def __init__(self, json: dict, unit: _Unit, locale: Locale):
130
137
  description = (
@@ -133,6 +140,7 @@ class BaseForecast:
133
140
  else json[f'lang_{locale.value}'][0]['value']
134
141
  )
135
142
 
143
+ self.cloud_cover = int(json['cloudcover'])
136
144
  self.ultraviolet = UltraViolet._new(int(json['uvIndex']))
137
145
  self.humidity = int(json['humidity'])
138
146
  self.wind_direction = WindDirection._new(