Create a new enumerate with current values merged with new enumerate values
        :param namespace: same as __init__
        :param name: same as __init__
        :param kwargs: same as __init__
        :returns: a new enumerate type
436008
def extend(self, namespace = None, name = None, **kwargs):
        '''
        
        '''
        if name is None:
            name = self._readablename
        d = dict(self._values)
        d.update(kwargs)
        return enum(name, namespace, self, self._bitwise, **d)
867743
def from_namespace(cls, namespace):
        """"""
        config = cls()
        for slot in cls.__slots__:
            if slot.startswith('_'):
                slot = slot[1:]
            if not hasattr(namespace, slot):
                continue
            setattr(config, slot, getattr(namespace, slot))

        return config
639335
def create_namespace(
        name,
        **kwargs):
    '''
    
    '''

    meta_obj = kubernetes.client.V1ObjectMeta(name=name)
    body = kubernetes.client.V1Namespace(metadata=meta_obj)
    body.metadata.name = name

    cfg = _setup_conn(**kwargs)

    try:
        api_instance = kubernetes.client.CoreV1Api()
        api_response = api_instance.create_namespace(body)

        return api_response.to_dict()
    except (ApiException, HTTPError) as exc:
        if isinstance(exc, ApiException) and exc.status == 404:
            return None
        else:
            log.exception(
                'Exception when calling '
                'CoreV1Api->create_namespace'
            )
            raise CommandExecutionError(exc)
    finally:
        _cleanup(**cfg)
1301753
def enum(enum_type='enum', base_classes=None, methods=None, **attrs):
    
    # Enumerations can not be initalized as a new instance
    def __init__(instance, *args, **kwargs):
        raise RuntimeError('%s types can not be initialized.' % enum_type)

    if base_classes is None:
        base_classes = ()

    if methods is None:
        methods = {}

    base_classes = base_classes + (object,)
    for k, v in methods.items():
        methods[k] = classmethod(v)

    attrs['enums'] = attrs.copy()
    methods.update(attrs)
    methods['__init__'] = __init__
    return type(to_string(enum_type), base_classes, methods)
1283734
def create_inst(inst_type, **init_args):
    ''''''
    args, kwargs = get_init_args(inst_type, init_args)
    return inst_type(*args, **kwargs)
1117946
def _build_new_template(self, stack, parameters):
        
        log_lines = ["New template parameters:"]
        for param in sorted(parameters,
                            key=lambda param: param['ParameterKey']):
            log_lines.append("%s = %s" % (param['ParameterKey'],
                                          param['ParameterValue']))

        log_lines.append("\nNew template contents:")
        log_lines.append("".join(stack))
        return log_lines
1021017
def _lookup_enum_in_ns(namespace, value):
    """"""
    for attribute in dir(namespace):
        if getattr(namespace, attribute) == value:
            return attribute
569587
def _fake_openenumerateinstancepaths(self, namespace, **params):
        # pylint: disable=invalid-name
        
        self._validate_namespace(namespace)
        self._validate_open_params(**params)

        result_t = self._fake_enumerateinstancenames(namespace, **params)

        return self._open_response(result_t[0][2], namespace,
                                   'PullInstancePaths', **params)
264816
def _fake_enumerateinstancenames(self, namespace, **params):
        
        cname = params['ClassName']
        assert isinstance(cname, CIMClassName)
        cname = cname.classname

        # Validate namespace
        instance_repo = self._get_instance_repo(namespace)

        clns = self._get_subclass_list_for_enums(cname, namespace)

        inst_paths = [inst.path for inst in instance_repo
                      if inst.path.classname in clns]

        rtn_paths = [deepcopy(path) for path in inst_paths]

        return self._make_tuple(rtn_paths)
143852
def _init_options(self, kwargs):
        
        self.options = self.task_config.options
        if self.options is None:
            self.options = {}
        if kwargs:
            self.options.update(kwargs)

        # Handle dynamic lookup of project_config values via $project_config.attr
        for option, value in list(self.options.items()):
            try:
                if value.startswith("$project_config."):
                    attr = value.replace("$project_config.", "", 1)
                    self.options[option] = getattr(self.project_config, attr, None)
            except AttributeError:
                pass
97520
def get_init_args(inst_type, init_args: dict, add_kwargs=False) -> Tuple[List, Dict]:
    ''''''
    try:
        parameters = signature(inst_type).parameters.values()
        args_keys = [p.name for p in parameters \
                if p.kind in [Parameter.POSITIONAL_ONLY, Parameter.POSITIONAL_OR_KEYWORD] \
                and p.default == Parameter.empty]
        args = [init_args[key] for key in args_keys]
        kwargs = _get_var_kwargs(parameters, args_keys, init_args)\
                 if add_kwargs else\
                 _get_kwargs(parameters, init_args)
    except KeyError as key_error:
        msg_format = 'parameter with key "{0}" is not found in node args'
        raise RenderingError(msg_format.format(key_error.args[0]))
    return (args, kwargs)
483581
def withNamedBits(cls, **values):
        
        enums = set(cls.namedValues.items())
        enums.update(values.items())

        class X(cls):
            namedValues = namedval.NamedValues(*enums)

        X.__name__ = cls.__name__
        return X
83929
def create_object(self, cls: Type[T], additional_kwargs=None) -> T:
        """"""
        additional_kwargs = additional_kwargs or {}
        log.debug('%sCreating %r object with %r', self._log_prefix, cls, additional_kwargs)

        try:
            instance = cls.__new__(cls)
        except TypeError as e:
            reraise(
                e,
                CallError(cls, getattr(cls.__new__, '__func__', cls.__new__), (), {}, e, self._stack),
                maximum_frames=2,
            )
        try:
            init = cls.__init__
            self.call_with_injection(init, self_=instance, kwargs=additional_kwargs)
        except TypeError as e:
            # The reason why getattr() fallback is used here is that
            # __init__.__func__ apparently doesn't exist for Key-type objects
            reraise(
                e,
                CallError(
                    instance,
                    getattr(instance.__init__, '__func__', instance.__init__),
                    (),
                    additional_kwargs,
                    e,
                    self._stack,
                ),
            )
        return instance
1308041
def newNsProp(self, ns, name, value):
        
        if ns is None: ns__o = None
        else: ns__o = ns._o
        ret = libxml2mod.xmlNewNsProp(self._o, ns__o, name, value)
        if ret is None:raise treeError('xmlNewNsProp() failed')
        __tmp = xmlAttr(_obj=ret)
        return __tmp
724500
def new(arg_name, annotated_with=None):
    
    if annotated_with is not None:
        annotation = annotations.Annotation(annotated_with)
    else:
        annotation = annotations.NO_ANNOTATION
    return BindingKey(arg_name, annotation)
753575
def extract_kwargs(names:Collection[str], kwargs:KWArgs):
    ""
    new_kwargs = {}
    for arg_name in names:
        if arg_name in kwargs:
            arg_val = kwargs.pop(arg_name)
            new_kwargs[arg_name] = arg_val
    return new_kwargs, kwargs
1272891
def createNode(self, cls, name, *args, **kw):
        
        m = self.findNode(name)
        if m is None:
            m = cls(name, *args, **kw)
            self.addNode(m)
        return m