.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.weather.DateTime Class Reference

Public Member Functions

 __init__ (self, datetime.datetime time)
 __str__ (self)
str l10n (self, DateTimeFormats|str fmt="medium", babel.Locale|GeoLocation|None locale=None)

Public Attributes

 datetime = time

Detailed Description

Class to represent date & time.  Essentially, it is a wrapper that
conveniently combines :py:obj:`datetime.datetime` and
:py:obj:`babel.dates.format_datetime`.  A conversion of time zones is not
provided (in the current version).

Definition at line 203 of file weather.py.

Constructor & Destructor Documentation

◆ __init__()

searx.weather.DateTime.__init__ ( self,
datetime.datetime time )

Definition at line 210 of file weather.py.

210 def __init__(self, time: datetime.datetime):
211 self.datetime = time
212

Member Function Documentation

◆ __str__()

searx.weather.DateTime.__str__ ( self)

Definition at line 213 of file weather.py.

213 def __str__(self):
214 return self.l10n()
215

References l10n().

Here is the call graph for this function:

◆ l10n()

str searx.weather.DateTime.l10n ( self,
DateTimeFormats | str fmt = "medium",
babel.Locale | GeoLocation | None locale = None )
Localized representation of date & time.

Definition at line 216 of file weather.py.

220 ) -> str:
221 """Localized representation of date & time."""
222 if isinstance(locale, GeoLocation):
223 locale = locale.locale()
224 elif locale is None:
225 locale = babel.Locale.parse(_get_sxng_locale_tag(), sep='-')
226 return babel.dates.format_datetime(self.datetime, format=fmt, locale=locale)
227
228
229@typing.final

References searx.weather._get_sxng_locale_tag(), searx.result_types.answer.WeatherAnswer.Item.datetime, and datetime.

Referenced by searx.weather.Compass.__str__(), __str__(), searx.weather.Pressure.__str__(), searx.weather.RelativeHumidity.__str__(), searx.weather.Temperature.__str__(), and searx.weather.WindSpeed.__str__().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ datetime

searx.weather.DateTime.datetime = time

Definition at line 211 of file weather.py.

Referenced by l10n().


The documentation for this class was generated from the following file:
  • /home/andrew/Documents/code/public/searxng/searx/weather.py