Yields a formatted table to print address translations.

    :param List[dict] address_translations: List of address translations.
    :return Table: Formatted for address translation output.
168762
def _get_address_translations_table(address_translations):
    
    table = formatting.Table(['id',
                              'static IP address',
                              'static IP address id',
                              'remote IP address',
                              'remote IP address id',
                              'note'])
    for address_translation in address_translations:
        table.add_row([address_translation.get('id', ''),
                       address_translation.get('internalIpAddressRecord', {})
                       .get('ipAddress', ''),
                       address_translation.get('internalIpAddressId', ''),
                       address_translation.get('customerIpAddressRecord', {})
                       .get('ipAddress', ''),
                       address_translation.get('customerIpAddressId', ''),
                       address_translation.get('notes', '')])
    return table
337857
def get_translations(self, domain=None, locale=None):
        
        if locale is None:

            if self.locale is None:
                return support.NullTranslations()

            locale = self.locale

        if domain is None:
            domain = self.cfg.domain

        if (domain, locale.language) not in self.translations:
            translations = None
            for locales_dir in reversed(self.cfg.locales_dirs):
                trans = support.Translations.load(
                    locales_dir, locales=locale, domain=domain)
                if translations:
                    translations._catalog.update(trans._catalog)
                else:
                    translations = trans

            self.translations[(domain, locale.language)] = translations

        return self.translations[(domain, locale.language)]
1250804
def read_tables(fstream):
    
    table = read_table(fstream)
    while table is not None:
        yield table
        table = read_table(fstream)
899910
def format_addresses(addrs):
    
    return ', '.join(
        formataddr(item) if isinstance(item, tuple) else item
        for item in addrs
    )
157544
def print_table(columns, formatter)
      columns.transpose.each { |row| puts sprintf(formatter, *row) }
    end
1330700
def list_locales(self) -> List[Optional[Text]]:
        

        locales = list(self.dict.keys())

        if not locales:
            locales.append(None)

        return locales
761925
def _load_translations(instance, lang=None):
	
	# Gets field translations
	translations = _get_fieldtranslations(instance=instance, lang=lang)
	for translation_i in translations:
		# Sets translated field lang for this language
		field_lang = trans_attr(translation_i.field, translation_i.lang)
		setattr(instance, field_lang, translation_i.translation)
		# Sets is_fuzzy value for this language
		field_isfuzzy_lang = trans_is_fuzzy_attr(translation_i.field, translation_i.lang)
		#print "{0} ({1}), attr_name={2} value={3}".format(translation.field, translation.lang, isfuzzy_lang,translation.is_fuzzy)
		setattr(instance, field_isfuzzy_lang, translation_i.is_fuzzy)
	return True
153825
def translations(self):
        
        rc = self.reverseComplement().sequence
        for reverseComplemented in False, True:
            for frame in 0, 1, 2:
                seq = rc if reverseComplemented else self.sequence
                # Get the suffix of the sequence for translation. I.e.,
                # skip 0, 1, or 2 initial bases, depending on the frame.
                # Note that this makes a copy of the sequence, which we can
                # then safely append 'N' bases to to adjust its length to
                # be zero mod 3.
                suffix = seq[frame:]
                lengthMod3 = len(suffix) % 3
                if lengthMod3:
                    suffix += ('NN' if lengthMod3 == 1 else 'N')
                yield TranslatedRead(self, translate(suffix), frame,
                                     reverseComplemented)
524332
def _pop_translated_data(self):
        
        translated_data = {}
        for meta in self.Meta.model._parler_meta:
            translations = self.validated_data.pop(meta.rel_name, {})
            if translations:
                translated_data[meta.rel_name] = translations
        return translated_data
439554
def _type_translation(self, str_type):
        
        if str_type == 'Indicator':
            return 'indicators'
        if str_type == 'Domain':
            return 'domains'
        if str_type == 'IP':
            return 'ips'
        if str_type == 'Sample':
            return 'samples'
        if str_type == 'Event':
            return 'events'
        if str_type == 'Actor':
            return 'actors'
        if str_type == 'Email':
            return 'emails'
        if str_type == 'Backdoor':
            return 'backdoors'

        raise CRITsInvalidTypeError('Invalid object type specified: '
                                    '{}'.format(str_type))
107580
def translate(root_list, use_bag_semantics=False):
    
    translator = (Translator() if use_bag_semantics else SetTranslator())
    return [translator.translate(root).to_sql() for root in root_list]
1033755
def to_tables(cols):
  
  tables = OrderedDict()
  for col in cols:
    tname = col["table_name"]
    if tname not in tables:
      tables[tname] = OrderedDict()
    tables[tname][col["column_name"]] = col
  return tables
251926
def _tables(self):
        
        return dict(
            (tag, _TableFactory(tag, self._stream, off, len_))
            for tag, off, len_ in self._iter_table_records()
        )
911011
def translation_instances(self):
        
        return [
            instance
            for k, v in six.iteritems(self.instance._linguist_translations)
            for instance in v.values()
        ]
1204026
def append_translated(model, fields):
    ""
    fields = set(fields)
    from modeltranslation.translator import translator
    opts = translator.get_options_for_model(model)
    for key, translated in opts.fields.items():
        if key in fields:
            fields = fields.union(f.name for f in translated)
    return fields
1324615
def get_column_listing(self, table):
        
        sql = self._grammar.compile_column_exists()
        database = self._connection.get_database_name()
        table = self._connection.get_table_prefix() + table

        results = []
        for result in self._connection.select(sql, [database, table]):
            new_result = {}
            for key, value in result.items():
                new_result[key.lower()] = value

            results.append(new_result)

        return self._connection.get_post_processor().process_column_listing(results)
1070453
def translate(self):
        
        translations = []
        for lang in settings.LANGUAGES:
            # do not create an translations for default language.
            # we will use the original model for this
            if lang[0] == self._get_default_language():
                continue
            # create translations for all fields of each language
            if self.translatable_slug is not None:
                if self.translatable_slug not in self.translatable_fields:
                    self.translatable_fields = self.translatable_fields + (self.translatable_slug,)

            for field in self.translatable_fields:
                trans, created = Translation.objects.get_or_create(
                    object_id=self.id,
                    content_type=ContentType.objects.get_for_model(self),
                    field=field,
                    lang=lang[0],
                )
                translations.append(trans)

        return translations