Return the named spec.
960191
def _spec(self, name):
        ""
        for s in self._framespec:
            if s.name == name:
                return s
        raise ValueError("Unknown spec: " + name)
164772
def named_module(name):
    """"""
    module = __import__(name)
    packages = name.split(".")[1:]
    m = module
    for p in packages:
        m = getattr(m, p)
    return m
160732
def get_experiment_spec(self, matrix_declaration):
        """"""
        parsed_data = Parser.parse(self, self._data, matrix_declaration)
        del parsed_data[self.HP_TUNING]
        validator.validate(spec=self, data=parsed_data)
        return ExperimentSpecification(values=[parsed_data, {'kind': self._EXPERIMENT}])
876539
def get_sort_spec(self):
        
        all_indexes = self.catalog.get_indexes()
        si = req.get_sort_on(allowed_indexes=all_indexes)
        so = req.get_sort_order()
        return si, so
660224
def find_spec(self, fullname, path, target=None):
        ''''''
        if not path:
            path = [os.getcwd()]
        if "." in fullname:
            name = fullname.split(".")[-1]
        else:
            name = fullname
        for entry in path:
            if os.path.isdir(os.path.join(entry, name)):
                # this module has child modules
                filename = os.path.join(entry, name, "__init__.py")
                submodule_locations = [os.path.join(entry, name)]
            else:
                filename = os.path.join(entry, name + ".py")
                submodule_locations = None
            if not os.path.exists(filename):
                continue

            return spec_from_file_location(fullname, filename,
                                           loader=MyLoader(filename),
                                           submodule_search_locations=submodule_locations)
        return None
1140882
def find_spec(self, fullname, target=None):
        
        spec = super().find_spec(fullname, target=target)

        if spec is None:
            original = fullname

            if "." in fullname:
                original, fullname = fullname.rsplit(".", 1)
            else:
                original, fullname = "", original

            if "_" in fullname:
                files = fuzzy_file_search(self.path, fullname)
                if files:
                    file = Path(sorted(files)[0])
                    spec = super().find_spec(
                        (original + "." + file.stem.split(".", 1)[0]).lstrip("."), target=target
                    )
                    fullname = (original + "." + fullname).lstrip(".")
                    if spec and fullname != spec.name:
                        spec = FuzzySpec(
                            spec.name,
                            spec.loader,
                            origin=spec.origin,
                            loader_state=spec.loader_state,
                            alias=fullname,
                            is_package=bool(spec.submodule_search_locations),
                        )
        return spec
1020451
def get_customizationspec_ref(si, customization_spec_name):
    '''
    

    '''
    customization_spec_name = si.content.customizationSpecManager.GetCustomizationSpec(name=customization_spec_name)
    return customization_spec_name
399281
def find_generic(self, name):
        """"""
        defgeneric = lib.EnvFindDefgeneric(self._env, name.encode())
        if defgeneric == ffi.NULL:
            raise LookupError("Generic '%s' not found" % name)

        return Generic(self._env, defgeneric)
651354
def spec(self):
        """"""
        from ambry_sources.sources import SourceSpec

        d = self.dict
        d['url'] = self.url

        # Will get the URL twice; once as ref and once as URL, but the ref is ignored

        return SourceSpec(**d)
1286670
def runtime_spec(self, id):
        
        try:
            return self.runtimes[id]
        except KeyError:
            raise UnregisteredRuntime('No registered runtime with name: {}'.format(id))
176681
def _get_specifications(specifications):
    
    if not specifications or specifications is object:
        raise ValueError("No specifications given")
    elif inspect.isclass(specifications):
        if Provides.USE_MODULE_QUALNAME:
            if sys.version_info < (3, 3, 0):
                raise ValueError(
                    "Qualified name capability requires Python 3.3+"
                )

            # Get the name of the class
            if not specifications.__module__:
                return [specifications.__qualname__]

            return [
                "{0}.{1}".format(
                    specifications.__module__, specifications.__qualname__
                )
            ]
        else:
            # Legacy behavior
            return [specifications.__name__]
    elif is_string(specifications):
        # Specification name
        specifications = specifications.strip()
        if not specifications:
            raise ValueError("Empty specification given")
        return [specifications]
    elif isinstance(specifications, (list, tuple)):
        # List given: normalize its content
        results = []
        for specification in specifications:
            results.extend(_get_specifications(specification))
        return results
    else:
        raise ValueError(
            "Unhandled specifications type : {0}".format(
                type(specifications).__name__
            )
        )
234945
def _get_dependency_specification(dep_spec: typing.List[tuple]) -> str:
    """"""
    return ",".join(dep_range[0] + dep_range[1] for dep_range in dep_spec)
480882
def authentications_spec(self):
        """"""
        return container_spec(authentication_objs.Authentication
              , dictof(string_spec(), set_options(
                  reading = optional_spec(authentication_spec())
                , writing = optional_spec(authentication_spec())
                )
              )
            )
879016
def spec(self):
        '''

        '''
        if self._spec_cache is None:
            self._spec_cache = self.registry.get(
                WORK_SPECS, self.work_spec_name)
        return self._spec_cache
974479
def get_schema_spec(self, fully_qualified_name: str) -> Dict[str, Any]:
        

        if fully_qualified_name not in self._spec_cache:
            self.add_errors(SpecNotFoundError(fully_qualified_name, {}))

        return self._spec_cache.get(fully_qualified_name, None)
969338
def get(self, name, strict=True):
        """"""
        if not isinstance(name, str) or name.startswith('_'):
            raise AttributeError(self.__class__.__name__, name)
        elif strict and name not in self._possible_attributes:
            raise AttributeError('%s is not a valid attribute of %r.' %
                                 (name, self))
        elif name in self._attributes:
            return self._attributes[name]
        else:
            raise exceptions.AttributeNotProvided(name)
65232
def named(self, name):
        ''''''
        name = self.serialize(name)
        return self.get_by('name', name)