Retrieves instance to multilang interperter
546895
public function interpreter(array $restriction = [])
    {
        if (null === $this->_interpreter) {
            $this->_interpreter = new Interpreter($this->owner, $this->config, $this->allowCache, $this->attrActive);
        }

        $this->_interpreter->setRestriction($restriction);

        return $this->_interpreter;
    }
8079
def _get_languages(cls) -> set:
        """"""
        if not cls._server_is_alive():
            cls._start_server_on_free_port()
        url = urllib.parse.urljoin(cls._url, 'Languages')
        languages = set()
        for e in cls._get_root(url, num_tries=1):
            languages.add(e.get('abbr'))
            languages.add(e.get('abbrWithVariant'))
        return languages
733401
def _get_instance(user):
  

  inst = None
  f = Usuario.objects.filter(user=user)
  if f.exists():
    inst = f[0]
    for sub_u in Usuario.__subclasses__():
      if hasattr(inst, sub_u.__name__.lower()):
        inst = getattr(inst, sub_u.__name__.lower())
        break
  return inst
523465
private Long getLanguageId(final String _language)
    {
        Long ret = null;
        try {
            final QueryBuilder queryBldr = new QueryBuilder(CIAdmin.Language);
            queryBldr.addWhereAttrEqValue(CIAdmin.Language.Language, _language);
            final InstanceQuery query = queryBldr.getQuery();
            query.executeWithoutAccessCheck();
            if (query.next()) {
                ret = query.getCurrentValue().getId();
            } else {
                ret = insertNewLanguage(_language);
            }
        } catch (final EFapsException e) {
            DBPropertiesUpdate.LOG.error("getLanguageId()", e);
        }
        return ret;
    }
56126
static function getInstance($databaseNameOrResource = '*LOCAL', $userOrI5NamingFlag = '', $password = '', $transportType = '', $isPersistent = false)
    {
        return new Toolkit($databaseNameOrResource, $userOrI5NamingFlag, $password, $transportType, $isPersistent);
    }
930256
public <T> T getInstance(String instanceHint, Class<? extends T> apiInterface, T apiImpl) {
		return STR.notNullOrBlank(instanceHint) ? getInstance(instanceHint, apiInterface) : allowExceptions ? apiImpl : getInstance(apiImpl, apiInterface);
	}
630901
def language_contents(instance):
    
    if instance['type'] != 'language-content' or 'contents' not in instance:
        return

    for key, value in instance['contents'].items():
        if key not in enums.LANG_CODES:
            yield JSONError("Invalid key '%s' in 'contents' property must be"
                            " an RFC 5646 code" % key, instance['id'])
        for subkey, subvalue in value.items():
            if not PROPERTY_FORMAT_RE.match(subkey):
                yield JSONError("'%s' in '%s' of the 'contents' property is "
                                "invalid and must match a valid property name"
                                % (subkey, key), instance['id'], 'observable-dictionary-keys')
1244003
def get_localized_property(context, field=None, language=None):
    '''
    
    '''
    if language:
        return getattr(context, get_real_fieldname(field, language))
    
    if hasattr(settings, 'FALLBACK_LANGUAGES'):
        attrs = [translation.get_language()]
        attrs += get_fallback_languages()
    else:
        attrs = [
            translation.get_language(),
            translation.get_language()[:2],
            settings.LANGUAGE_CODE, 
        ]
    
    def predicate(x):
        value = getattr(context, get_real_fieldname(field, x), None)
        return value if valid_for_gettext(value) else None

    return first_match(predicate, attrs)
1025260
def get_grouped_translations(instances, **kwargs):
    
    grouped_translations = collections.defaultdict(list)

    if not instances:
        return grouped_translations

    if not isinstance(instances, collections.Iterable):
        instances = [instances]

    if isinstance(instances, QuerySet):
        model = instances.model
    else:
        model = instances[0]._meta.model

    instances_ids = []

    for instance in instances:
        instances_ids.append(instance.pk)

        if instance._meta.model != model:
            raise Exception(
                "You cannot use different model instances, only one authorized."
            )

    from .models import Translation
    from .mixins import ModelMixin

    decider = model._meta.linguist.get("decider", Translation)
    identifier = model._meta.linguist.get("identifier", None)
    chunks_length = kwargs.get("chunks_length", None)
    populate_missing = kwargs.get("populate_missing", True)

    if identifier is None:
        raise Exception('You must define Linguist "identifier" meta option')

    lookup = dict(identifier=identifier)
    for kwarg in ("field_names", "languages"):
        value = kwargs.get(kwarg, None)
        if value is not None:
            if not isinstance(value, (list, tuple)):
                value = [value]
            lookup["%s__in" % kwarg[:-1]] = value

    if chunks_length is not None:
        translations_qs = []
        for ids in utils.chunks(instances_ids, chunks_length):
            ids_lookup = copy.copy(lookup)
            ids_lookup["object_id__in"] = ids
            translations_qs.append(decider.objects.filter(**ids_lookup))
        translations = itertools.chain.from_iterable(translations_qs)
    else:
        lookup["object_id__in"] = instances_ids
        translations = decider.objects.filter(**lookup)

    for translation in translations:
        grouped_translations[translation.object_id].append(translation)

    return grouped_translations
184002
def get_instance(model, instance_id):
    
    try:
        model = get_model(model)
    except ImportError:
        return None

    return model.query.get(instance_id)
246642
def _get_instance(self, **kwargs):
        '''
        '''
        return session.query(self.response_class).filter_by(**kwargs).first()
1354591
def get_language_details(self, language):
        """"""
        for lang in self.user_data.languages:
            if language == lang['language_string']:
                return lang

        return {}
700173
def get_translation_objects(self, request, language_code, obj=None, inlines=True):
        
        if obj is not None:
            # A single model can hold multiple TranslatedFieldsModel objects.
            # Return them all.
            for translations_model in obj._parler_meta.get_all_models():
                try:
                    translation = translations_model.objects.get(master=obj, language_code=language_code)
                except translations_model.DoesNotExist:
                    continue
                yield [translation]

        if inlines:
            for inline, qs in self._get_inline_translations(request, language_code, obj=obj):
                yield qs
1197832
static function getInstance($databaseNameOrResource = '*LOCAL', $userOrI5NamingFlag = '', $password = '', $extensionPrefix = '', $isPersistent = false, $forceNew = false)
    {
        // if we're forcing a new instance, close db conn first if exists.
        if ($forceNew && self::hasInstance() && isset(self::$instance->conn))
        {
            self::$instance->disconnect();
        }

        // if we're forcing a new instance, or an instance hasn't been created yet, create one
        if ($forceNew || self::$instance == NULL) {
            $toolkitService = __CLASS__;
            self::$instance = new $toolkitService($databaseNameOrResource, $userOrI5NamingFlag, $password, $extensionPrefix, $isPersistent);
        }

        if (self::$instance) {
            // instance exists
            return self::$instance;
        } else {
            // some problem
            return false;
        }
    }
1008241
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'languages' in _dict:
            args['languages'] = [
                IdentifiableLanguage._from_dict(x)
                for x in (_dict.get('languages'))
            ]
        else:
            raise ValueError(
                'Required property \'languages\' not present in IdentifiableLanguages JSON'
            )
        return cls(**args)
539462
def get_cache(
        self,
        instance,
        translation=None,
        language=None,
        field_name=None,
        field_value=None,
    ):
        
        is_new = bool(instance.pk is None)

        try:
            cached_obj = instance._linguist_translations[field_name][language]
            if not cached_obj.field_name:
                cached_obj.field_name = field_name
            if not cached_obj.language:
                cached_obj.language = language
            if not cached_obj.identifier:
                cached_obj.identifier = self.instance.linguist_identifier
        except KeyError:
            cached_obj = None

            if not is_new:
                if translation is None:
                    try:
                        translation = self.decider.objects.get(
                            identifier=self.instance.linguist_identifier,
                            object_id=self.instance.pk,
                            language=language,
                            field_name=field_name,
                        )
                    except self.decider.DoesNotExist:
                        pass

            if cached_obj is None:
                if translation is not None:
                    cached_obj = CachedTranslation.from_object(translation)
                else:
                    cached_obj = CachedTranslation(
                        instance=instance,
                        language=language,
                        field_name=field_name,
                        field_value=field_value,
                    )

            instance._linguist_translations[cached_obj.field_name][
                cached_obj.language
            ] = cached_obj

        return cached_obj
657720
def getlanguages(self, event):
        """"""

        self.log('Client requests all languages.', lvl=verbose)
        result = {
            'component': 'hfos.ui.clientmanager',
            'action': 'getlanguages',
            'data': language_token_to_name(all_languages())
        }
        self.fireEvent(send(event.client.uuid, result))