add or get excisting spec from __specs dictionary
343734
function getSpec(spec) {
            __specs[spec.id] = extend(__specs[spec.id] || {}, spec);
            return __specs[spec.id];
        }
1253991
def CopyToDict(self):
    
    path_spec_dict = {}
    for attribute_name, attribute_value in iter(self.__dict__.items()):
      if attribute_value is None:
        continue

      if attribute_name == 'parent':
        attribute_value = attribute_value.CopyToDict()

      path_spec_dict[attribute_name] = attribute_value

    return path_spec_dict
830620
def from_module_dict(cls, environment, module_dict, globals):
        
        return cls._from_namespace(environment, module_dict, globals)
980608
def add_service_spec(self, service_spec):
        
        assert service_spec is not None

        if service_spec.name in self.service_specs:
            raise ThriftCompilerError(
                'Cannot define service "%s". That name is already taken.'
                % service_spec.name
            )
        self.service_specs[service_spec.name] = service_spec
734123
def spec(self) -> list:
        """"""
        spec = [item
                for op, pat in self.ops.items()
                for item in [('{' + op, {'pat': pat, 'postf': self.postf, 'regex': None}),
                             ('˱' + op, {'pat': pat, 'postf': self.postf, 'regex': None})]
                ]
        spec[0][1]['regex'] = self.regex_pat.format(_ops_regex(self.ops.keys()))
        return spec
948000
def _get_spec(tree_base, spec, template, saltenv='base'):
    '''
    
    '''
    spec_tgt = os.path.basename(spec)
    dest = os.path.join(tree_base, 'SPECS', spec_tgt)
    return __salt__['cp.get_url'](
        spec,
        dest,
        saltenv=saltenv)
95309
def from_json(cls, name, spec):
        
        if "run" not in spec:
            raise TuneError("No trainable specified!")

        # Special case the `env` param for RLlib by automatically
        # moving it into the `config` section.
        if "env" in spec:
            spec["config"] = spec.get("config", {})
            spec["config"]["env"] = spec["env"]
            del spec["env"]

        spec = copy.deepcopy(spec)

        run_value = spec.pop("run")
        try:
            exp = cls(name, run_value, **spec)
        except TypeError:
            raise TuneError("Improper argument from JSON: {}.".format(spec))
        return exp
484176
def parse_spec(self, spec):
    

    if spec.endswith('::'):
      spec_path = spec[:-len('::')]
      return DescendantAddresses(self._normalize_spec_path(spec_path))
    elif spec.endswith(':'):
      spec_path = spec[:-len(':')]
      return SiblingAddresses(self._normalize_spec_path(spec_path))
    else:
      spec_parts = spec.rsplit(':', 1)
      spec_path = self._normalize_spec_path(spec_parts[0]) 
      name = spec_parts[1] if len(spec_parts) > 1 else os.path.basename(spec_path)
      return SingleAddress(spec_path, name)
857050
def combine(specs):
        
        new_specs = {}
        for spec in specs:
            if new_specs.get(spec, None) is None:
                new_specs[spec] = spec
            else:
                new_specs[spec].add(spec)
        return list(new_specs.values())
263183
def add_function_signature_help(spec_dict: dict) -> dict:
    
    for f in spec_dict["functions"]["signatures"]:
        for argset_idx, argset in enumerate(spec_dict["functions"]["signatures"][f]["signatures"]):
            args_summary = ""
            args_list = []
            arg_idx = 0
            for arg_idx, arg in enumerate(
                spec_dict["functions"]["signatures"][f]["signatures"][argset_idx]["arguments"]
            ):
                if arg["type"] in ["Function", "Modifier"]:
                    vals = [
                        spec_dict["functions"]["to_short"].get(
                            val, spec_dict["functions"]["to_short"].get(val)
                        )
                        for val in arg["values"]
                    ]
                    args_summary += "|".join(vals) + "()"
                    arg_idx += 1

                    if arg.get("optional", False) and arg.get("multiple", False) is False:
                        args_summary += "?"
                        text = f'Zero or one of each function(s): {", ".join([val for val in arg["values"]])}'
                    elif arg.get("optional", False):
                        args_summary += "*"
                        text = f'Zero or more of each function(s): {", ".join([val for val in arg["values"]])}'
                    else:
                        text = f'One of following function(s): {", ".join([val for val in arg["values"]])}'

                elif arg["type"] in ["NSArg", "StrArg", "StrArgNSArg"]:
                    args_summary += f'{arg["type"]}'
                    if arg.get("optional", False) and arg.get("multiple", False) is False:
                        args_summary += "?"
                        if arg["type"] in ["NSArg"]:
                            text = f'Zero or one namespace argument of following type(s): {", ".join([val for val in arg["values"]])}'
                        elif arg["type"] == "StrArgNSArg":
                            text = f'Zero or one amespace argument or default namespace argument (without prefix) of following type(s): {", ".join([val for val in arg["values"]])}'
                        else:
                            text = f'Zero or one string argument of following type(s): {", ".join([val for val in arg["values"]])}'
                    elif arg.get("optional", False):
                        args_summary += "*"
                        if arg["type"] in ["NSArg"]:
                            text = f'Zero or more namespace arguments of following type(s): {", ".join([val for val in arg["values"]])}'
                        elif arg["type"] == "StrArgNSArg":
                            text = f'Zero or more namespace arguments or default namespace arguments (without prefix) of following type(s): {", ".join([val for val in arg["values"]])}'
                        else:
                            text = f'Zero or more of string arguments of following type(s): {", ".join([val for val in arg["values"]])}'
                    else:
                        if arg["type"] in ["NSArg"]:
                            text = f'Namespace argument of following type(s): {", ".join([val for val in arg["values"]])}'
                        elif arg["type"] == "StrArgNSArg":
                            text = f'Namespace argument or default namespace argument (without prefix) of following type(s): {", ".join([val for val in arg["values"]])}'
                        else:
                            text = f'String argument of following type(s): {", ".join([val for val in arg["values"]])}'

                args_summary += ", "
                args_list.append(text)

            args_summary = re.sub(", $", "", args_summary)
            spec_dict["functions"]["signatures"][f]["signatures"][argset_idx][
                "argument_summary"
            ] = f"{f}({args_summary})"
            spec_dict["functions"]["signatures"][f]["signatures"][argset_idx][
                "argument_help_listing"
            ] = args_list

            # print(f'{f}({args_summary})')
            # print(args_list)

    return spec_dict
1070392
def _fetch_attribute_specs_from_doc(cls, cls_in, attribute_name):
        

        pattern = cls._TEMPLATE_PATTERN_PARAM_TYPES.format(attribute_name)
        match = re.search(pattern, cls_in.__doc__)

        if match is not None:
            return ValueSpecs(
                cls._fetch_name(match),
                ValueTypes(
                    cls._fetch_type_main(cls_in, match),
                    cls._fetch_type_sub(cls_in, match)
                )
            )
        else:
            return None
173227
function normalize (specs) {
  const arrayedSpecs = Array.isArray(specs) ? specs : [specs]
  const objectifiedSpecs = arrayedSpecs.map(normalizeSpec)
  return objectifiedSpecs
}
439304
def _combine_core_aux_specs(self):
        """"""
        all_specs = []
        for core_dict in self._permute_core_specs():
            for aux_dict in self._permute_aux_specs():
                all_specs.append(_merge_dicts(core_dict, aux_dict))
        return all_specs
27357
def get_spec_list(image_specs, container_args):
    

    spec_list = [spec.strip() for spec in image_specs.split('|')]
    original_count = len(spec_list)

    if 'count' in container_args:
        if 'count_offset' in container_args:
            spec_list = spec_list[container_args['count_offset']:]
        spec_list = spec_list[:container_args['count']]

    return spec_list, original_count
1119644
def split_spec(spec, sep):
    """"""
    parts = spec.rsplit(sep, 1)
    spec_start = parts[0].strip()
    spec_end = ''
    if len(parts) == 2:
        spec_end = parts[-1].strip()
    return spec_start, spec_end
952651
def __dict_to_service_spec(spec):
    '''
    
    '''
    spec_obj = kubernetes.client.V1ServiceSpec()
    for key, value in iteritems(spec):  # pylint: disable=too-many-nested-blocks
        if key == 'ports':
            spec_obj.ports = []
            for port in value:
                kube_port = kubernetes.client.V1ServicePort()
                if isinstance(port, dict):
                    for port_key, port_value in iteritems(port):
                        if hasattr(kube_port, port_key):
                            setattr(kube_port, port_key, port_value)
                else:
                    kube_port.port = port
                spec_obj.ports.append(kube_port)
        elif hasattr(spec_obj, key):
            setattr(spec_obj, key, value)

    return spec_obj
912634
def mock_add_spec(self, spec, spec_set=False):
        """"""
        self._mock_add_spec(spec, spec_set)
        self._mock_set_magics()