.oO SearXNG Developer Documentation Oo.
|
Public Member Functions | |
__init__ (self, float value, Units unit) | |
__str__ (self) | |
float | value (self, Units unit) |
str | l10n (self, Units|None unit=None, babel.Locale|GeoLocation|None locale=None, str template="{value} {unit}", str num_pattern="#,##0") |
Public Attributes | |
float | si |
Static Public Attributes | |
str | si_name = "Q11579" |
Units = typing.Literal["°C", "°F", "K"] | |
units = list(typing.get_args(Units)) | |
Class for converting temperature units and for string representation of measured values.
Definition at line 224 of file weather.py.
searx.weather.Temperature.__init__ | ( | self, | |
float | value, | ||
Units | unit ) |
Definition at line 235 of file weather.py.
References units.
searx.weather.Temperature.__str__ | ( | self | ) |
Definition at line 244 of file weather.py.
References searx.weather.DateTime.l10n(), and l10n().
str searx.weather.Temperature.l10n | ( | self, | |
Units | None | unit = None, | ||
babel.Locale | GeoLocation | None | locale = None, | ||
str | template = "{value} {unit}", | ||
str | num_pattern = "#,##0" ) |
Localized representation of a measured value. If the ``unit`` is not set, an attempt is made to determine a ``unit`` matching the territory of the ``locale``. If the locale is not set, an attempt is made to determine it from the HTTP request. The value is converted into the respective unit before formatting. The argument ``num_pattern`` is used to determine the string formatting of the numerical value: - https://babel.pocoo.org/en/latest/numbers.html#pattern-syntax - https://unicode.org/reports/tr35/tr35-numbers.html#Number_Format_Patterns The argument ``template`` specifies how the **string formatted** value and unit are to be arranged. - `Format Specification Mini-Language <https://docs.python.org/3/library/string.html#format-specification-mini-language>`.
Definition at line 250 of file weather.py.
References searx.weather._get_sxng_locale_tag(), searx.preferences.BooleanSetting.value, searx.preferences.EnumStringSetting.value, searx.preferences.MapSetting.value, searx.preferences.MultipleChoiceSetting.value, searx.preferences.SearchLanguageSetting.value, searx.preferences.Setting.value, and value().
Referenced by searx.weather.Compass.__str__(), searx.weather.Pressure.__str__(), searx.weather.RelativeHumidity.__str__(), __str__(), and searx.weather.WindSpeed.__str__().
float searx.weather.Temperature.value | ( | self, | |
Units | unit ) |
Definition at line 247 of file weather.py.
Referenced by searx.weather.Compass.l10n(), searx.weather.Pressure.l10n(), searx.weather.RelativeHumidity.l10n(), l10n(), and searx.weather.WindSpeed.l10n().
float searx.weather.Temperature.si |
Definition at line 238 of file weather.py.
Referenced by searx.weather.Pressure.value(), value(), and searx.weather.WindSpeed.value().
|
static |
Definition at line 228 of file weather.py.
Referenced by searx.weather.Pressure.value(), value(), and searx.weather.WindSpeed.value().
|
static |
Definition at line 230 of file weather.py.
|
static |
Definition at line 233 of file weather.py.
Referenced by searx.weather.Pressure.__init__(), __init__(), and searx.weather.WindSpeed.__init__().