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

Public Member Functions

 __init__ (self, float humidity)
 
 __str__ (self)
 
float value (self)
 
str l10n (self, babel.Locale|GeoLocation|None locale=None, str template="{value}{unit}", str num_pattern="#,##0")
 

Public Attributes

 humidity = humidity
 

Static Public Attributes

 Units = typing.Literal["%"]
 
 units = list(typing.get_args(Units))
 

Detailed Description

Amount of relative humidity in the air. The unit is ``%``

Definition at line 382 of file weather.py.

Constructor & Destructor Documentation

◆ __init__()

searx.weather.RelativeHumidity.__init__ ( self,
float humidity )

Definition at line 390 of file weather.py.

390 def __init__(self, humidity: float):
391 self.humidity = humidity
392

Member Function Documentation

◆ __str__()

searx.weather.RelativeHumidity.__str__ ( self)

Definition at line 393 of file weather.py.

393 def __str__(self):
394 return self.l10n()
395

References searx.weather.DateTime.l10n(), searx.weather.Pressure.l10n(), l10n(), searx.weather.Temperature.l10n(), and searx.weather.WindSpeed.l10n().

+ Here is the call graph for this function:

◆ l10n()

str searx.weather.RelativeHumidity.l10n ( self,
babel.Locale | GeoLocation | None locale = None,
str template = "{value}{unit}",
str num_pattern = "#,##0" )

Definition at line 399 of file weather.py.

404 ) -> str:
405 if isinstance(locale, GeoLocation):
406 locale = locale.locale()
407 elif locale is None:
408 locale = babel.Locale.parse(_get_sxng_locale_tag(), sep='-')
409
410 unit = "%"
411 val_str = babel.numbers.format_decimal(self.value(), locale=locale, format=num_pattern)
412 return template.format(value=val_str, unit=unit)
413
414

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, searx.weather.Pressure.value(), value(), searx.weather.Temperature.value(), and searx.weather.WindSpeed.value().

Referenced by searx.weather.Compass.__str__(), and __str__().

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

◆ value()

float searx.weather.RelativeHumidity.value ( self)

Definition at line 396 of file weather.py.

396 def value(self) -> float:
397 return self.humidity
398

References searx.result_types.answer.WeatherAnswer.Item.humidity, and humidity.

Referenced by searx.weather.Compass.l10n(), and l10n().

+ Here is the caller graph for this function:

Member Data Documentation

◆ humidity

searx.weather.RelativeHumidity.humidity = humidity

Definition at line 391 of file weather.py.

Referenced by value().

◆ Units

searx.weather.RelativeHumidity.Units = typing.Literal["%"]
static

Definition at line 385 of file weather.py.

◆ units

searx.weather.RelativeHumidity.units = list(typing.get_args(Units))
static

Definition at line 388 of file weather.py.


The documentation for this class was generated from the following file: