Skip to content

Commit

Permalink
refactor: no need for checks here
Browse files Browse the repository at this point in the history
  • Loading branch information
null8626 committed Oct 19, 2024
1 parent 58b7a19 commit 41271e1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions python_weather/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,15 @@ async def get(
:param locale: Overrides the locale used by this object. Defaults to the one used by this object.
:type locale: Optional[:class:`.Locale`]
:exception Error: If the :class:`~aiohttp.ClientSession` used by the :class:`.Client` object is already closed.
:exception RequestError: If the :class:`.Client` can't send a web request to the web server.
:exception Error: If the `location` argument is not a :py:class:`str` or is empty.
:exception RequestError: If the :class:`~aiohttp.ClientSession` used by the :class:`.Client` object is already closed, or if the :class:`.Client` cannot send a web request to the web server.
:returns: The requested weather forecast.
:rtype: Forecast
"""

if (not isinstance(location, str)) or (not location):
raise Error(f'Expected a proper location str, got {location!r}')
elif self.__session.closed:
raise Error('Client is already closed')

if not isinstance(unit, _Unit):
unit = self._CustomizableBase__unit
Expand Down

0 comments on commit 41271e1

Please sign in to comment.