Retrieve translation for weather type.
775259
async def weather_type_classe(self):
        """"""

        data = await self.retrieve(url=API_WEATHER_TYPE)

        self.weather_type = dict()

        for _type in data['data']:
            self.weather_type[_type['idWeatherType']] = _type['descIdWeatherTypePT']

        return self.weather_type
658668
def get_weather(test=False):
    
    if _Constants._TEST or test:
        rows = _Constants._DATABASE.execute("SELECT data FROM weather LIMIT {hardware}".format(
            hardware=_Constants._HARDWARE))
        data = [r[0] for r in rows]
        data = [_Auxiliary._byteify(_json.loads(r)) for r in data]
        
        return _Auxiliary._byteify(data)
        
    else:
        rows = _Constants._DATABASE.execute("SELECT data FROM weather".format(
            hardware=_Constants._HARDWARE))
        data = [r[0] for r in rows]
        data = [_Auxiliary._byteify(_json.loads(r)) for r in data]
        
        return _Auxiliary._byteify(data)
975331
def _get_translation_for_locale(self, locale):
        """"""
        translations = None

        for dirname in self.paths:
            # Load a single catalog.
            catalog = Translations.load(dirname, [locale], domain=self.domain)
            if translations is None:
                if isinstance(catalog, Translations):
                    translations = catalog
                continue

            try:
                # Merge catalog into global catalog
                translations.merge(catalog)
            except AttributeError:
                # Translations is probably NullTranslations
                if isinstance(catalog, NullTranslations):
                    current_app.logger.debug(
                        'Compiled translations seems to be missing'
                        ' in {0}.'.format(dirname))
                    continue
                raise

        return translations or NullTranslations()
672244
def get_translations(self, status=None):
        '''
            
        '''
        if status is not None:
            result = self.api_call('translation/?status=%s' % status)
        else:
            result = self.api_call('translation/')
        if result.status_code == 200:
            translations_json = json.loads(result.content)["objects"]
            translations = [Translation(**tj) for tj in translations_json]
        else:
            log.critical(
                'Error status when fetching translation from server: {'
                '}!'.format(
                    result.status_code))
            translations = []
        return translations
933084
def get_live_weather(lat, lon, writer):
    """"""
    requrl = FORECAST_BASE_URL+forecast_api_token+'/'+str(lat)+','+str(lon)
    req = requests.get(requrl)
    if req.status_code == requests.codes.ok:
        weather = req.json()
        if not weather['currently']:
            click.secho("No live weather currently", fg="red", bold=True)
            return
        writer.live_weather(weather)
    else:
        click.secho("There was problem getting live weather", fg="red", bold=True)
57705
def get_json_data(latitude=52.091579, longitude=5.119734):
    """"""
    final_result = {SUCCESS: False,
                    MESSAGE: None,
                    CONTENT: None,
                    RAINCONTENT: None}

    log.info("Getting buienradar json data for latitude=%s, longitude=%s",
             latitude, longitude)
    result = __get_ws_data()

    if result[SUCCESS]:
        # store json data:
        final_result[CONTENT] = result[CONTENT]
        final_result[SUCCESS] = True
    else:
        if STATUS_CODE in result and MESSAGE in result:
            msg = "Status: %d, Msg: %s" % (result[STATUS_CODE],
                                           result[MESSAGE])
        elif MESSAGE in result:
            msg = "Msg: %s" % (result[MESSAGE])
        else:
            msg = "Something went wrong (reason unknown)."

        log.warning(msg)
        final_result[MESSAGE] = msg

    # load forecasted precipitation:
    result = __get_precipfc_data(latitude,
                                 longitude)
    if result[SUCCESS]:
        final_result[RAINCONTENT] = result[CONTENT]
    else:
        if STATUS_CODE in result and MESSAGE in result:
            msg = "Status: %d, Msg: %s" % (result[STATUS_CODE],
                                           result[MESSAGE])
        elif MESSAGE in result:
            msg = "Msg: %s" % (result[MESSAGE])
        else:
            msg = "Something went wrong (reason unknown)."

        log.warning(msg)
        final_result[MESSAGE] = msg

    return final_result
212837
function getTranslation(m, dst) {
  dst = dst || v3.create();
  dst[0] = m[12];
  dst[1] = m[13];
  dst[2] = m[14];
  return dst;
}
65061
function dateStrGetter(name, width, form, extended) {
    if (form === void 0) { form = FormStyle.Format; }
    if (extended === void 0) { extended = false; }
    return function (date, locale) {
        return getDateTranslation(date, locale, name, width, form, extended);
    };
}
113309
def to_json(self):
        """"""
        return {
            'wind_speed': self.wind_speed,
            'wind_direction': self.wind_direction,
            'rain': self.rain,
            'snow_on_ground': self.snow_on_ground
        }
300379
def get_lang_dict(self):
        """"""
        r = self.yandex_translate_request("getLangs")
        self.handle_errors(r)

        return r.json()["langs"]
946849
def string(self):  # noqa: C901
        
        lines = ["station: %s" % self.station_id]
        if self.type:
            lines.append("type: %s" % self.report_type())
        if self.time:
            lines.append("time: %s" % self.time.ctime())
        if self.temp:
            lines.append("temperature: %s" % self.temp.string("C"))
        if self.dewpt:
            lines.append("dew point: %s" % self.dewpt.string("C"))
        if self.wind_speed:
            lines.append("wind: %s" % self.wind())
        if self.wind_speed_peak:
            lines.append("peak wind: %s" % self.peak_wind())
        if self.wind_shift_time:
            lines.append("wind shift: %s" % self.wind_shift())
        if self.vis:
            lines.append("visibility: %s" % self.visibility())
        if self.runway:
            lines.append("visual range: %s" % self.runway_visual_range())
        if self.press:
            lines.append(f"pressure: {self.press.string('MB')} {self.press.string('IN')} {self.press.string('MM')}")
        if self.weather:
            lines.append("weather: %s" % self.present_weather())
        if self.sky:
            lines.append("sky: %s" % self.sky_conditions("\n     "))
        if self.press_sea_level:
            lines.append("sea-level pressure: %s" % self.press_sea_level.string("mb"))
        if self.max_temp_6hr:
            lines.append("6-hour max temp: %s" % str(self.max_temp_6hr))
        if self.max_temp_6hr:
            lines.append("6-hour min temp: %s" % str(self.min_temp_6hr))
        if self.max_temp_24hr:
            lines.append("24-hour max temp: %s" % str(self.max_temp_24hr))
        if self.max_temp_24hr:
            lines.append("24-hour min temp: %s" % str(self.min_temp_24hr))
        if self.precip_1hr:
            lines.append("1-hour precipitation: %s" % str(self.precip_1hr))
        if self.precip_3hr:
            lines.append("3-hour precipitation: %s" % str(self.precip_3hr))
        if self.precip_6hr:
            lines.append("6-hour precipitation: %s" % str(self.precip_6hr))
        if self.precip_24hr:
            lines.append("24-hour precipitation: %s" % str(self.precip_24hr))
        if self._remarks:
            lines.append("remarks:")
            lines.append("- " + self.remarks("\n- "))
        if self._unparsed_remarks:
            lines.append("- " + ' '.join(self._unparsed_remarks))
        lines.append("METAR: " + self.code)
        return "\n".join(lines)
62986
def get_language_from_json(language, key):
    """"""

    file_name = os.path.join(
        os.path.dirname(__file__),
        'languages',
        '{0}.json').format(key.lower())

    if os.path.exists(file_name):
        try:
            with open(file_name, 'r', encoding='utf-8') as fh:
                languages = json.loads(fh.read())
                if languages.get(language.lower()):
                    return languages[language.lower()]
        except:
            log.traceback(logging.DEBUG)

    return None
201446
def get_weather_code(self, ip):
        '''  '''
        rec = self.get_all(ip)
        return rec and rec.weather_code
694199
def get_catalog(self, locale):
        """"""
        with translation.override(locale):
            translation_engine = DjangoTranslation(locale, domain=self.domain, localedirs=self.paths)

            trans_cat = translation_engine._catalog
            trans_fallback_cat = translation_engine._fallback._catalog if translation_engine._fallback else {}

            return trans_cat, trans_fallback_cat
704897
def _translate(self, options):
        
        translation = dict()
        for key, val in iteritems_(options):
            self._validate(key, val, feed_arg_types(self._source))
            try:
                if isinstance(val, STRTYPE):
                    translation[key] = val
                elif not isinstance(val, NONETYPE):
                    arg_converter = TYPE_CONVERTERS.get(type(val), json.dumps)
                    translation[key] = arg_converter(val)
            except Exception as ex:
                raise CloudantArgumentError(115, key, ex)
        return translation
760533
def get_language():
    """"""

    global sensor_graph, statement

    if sensor_graph is not None:
        return sensor_graph

    _create_primitives()
    _create_simple_statements()
    _create_block_bnf()

    sensor_graph = ZeroOrMore(statement) + StringEnd()
    sensor_graph.ignore(comment)

    return sensor_graph
147818
def get_headers_lang (headers):
    """"""
    if 'Accept-Language' not in headers:
        return default_language
    languages = headers['Accept-Language'].split(",")
    # sort with preference values
    pref_languages = []
    for lang in languages:
        pref = 1.0
        if ";" in lang:
            lang, _pref = lang.split(';', 1)
            try:
                pref = float(_pref)
            except ValueError:
                pass
        pref_languages.append((pref, lang))
    pref_languages.sort()
    # search for lang
    for lang in (x[1] for x in pref_languages):
        if lang in supported_languages:
            return lang
    return default_language