query
stringlengths
9
60
language
stringclasses
1 value
code
stringlengths
105
25.7k
url
stringlengths
91
217
get name of enumerated value
python
def GetName(self, number): """Retrieves the name of an enumeration value by number. Args: number (int): number. Returns: str: name of the enumeration value or None if no corresponding enumeration value was found. """ value = self._data_type_definition.values_per_number.get(number, None) if not value: return None return value.name
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1986-L2000
get name of enumerated value
python
def getName(self, value, defaultName = None): ''' Get the enumerate name of a specified value. :param value: the enumerate value :param defaultName: returns if the enumerate value is not defined :returns: the corresponding enumerate value or *defaultName* if not found ''' for k,v in self._values.items(): if v == value: return k return defaultName
https://github.com/hubo1016/namedstruct/blob/5039026e0df4ce23003d212358918dbe1a6e1d76/namedstruct/namedstruct.py#L2559-L2569
get name of enumerated value
python
def has_value_name(self, name): """Check if this `enum` has a particular name among its values. :param name: Enumeration value name :type name: str :rtype: True if there is an enumeration value with the given name """ for val, _ in self._values: if val == name: return True return False
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/enumeration.py#L116-L126
get name of enumerated value
python
def name(self): """Get the enumeration name of this cursor kind.""" if self._name_map is None: self._name_map = {} for key, value in self.__class__.__dict__.items(): if isinstance(value, self.__class__): self._name_map[value] = key return self._name_map[self]
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/clang/cindex.py#L643-L650
get name of enumerated value
python
def get_name2value_dict(self): """returns a dictionary, that maps between `enum` name( key ) and `enum` value( value )""" x = {} for val, num in self._values: x[val] = num return x
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/enumeration.py#L128-L134
get name of enumerated value
python
def Name(self, number): """Returns a string containing the name of an enum value.""" if number in self._enum_type.values_by_number: return self._enum_type.values_by_number[number].name raise ValueError('Enum %s has no name defined for value %d' % ( self._enum_type.name, number))
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/enum_type_wrapper.py#L51-L56
get name of enumerated value
python
def get(self, value): """ Get an enumeration item for an enumeration value. :param unicode value: Enumeration value. :raise InvalidEnumItem: If ``value`` does not match any known enumeration value. :rtype: EnumItem """ _nothing = object() item = self._values.get(value, _nothing) if item is _nothing: raise InvalidEnumItem(value) return item
https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/enums.py#L89-L102
get name of enumerated value
python
def get_name(self): """Get the name of the item. :return: the name of the item or `None`. :returntype: `unicode`""" var = self.xmlnode.prop("name") if not var: var = "" return var.decode("utf-8")
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L316-L324
get name of enumerated value
python
def get_name_value(self): """Returns zipped name and value pairs. Returns ------- list of tuples A (name, value) tuple list. """ name, value = self.get() if not isinstance(name, list): name = [name] if not isinstance(value, list): value = [value] return list(zip(name, value))
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/metric.py#L194-L207
get name of enumerated value
python
def EnumValueName(self, enum, value): """Returns the string name of an enum value. This is just a small helper method to simplify a common operation. Args: enum: string name of the Enum. value: int, value of the enum. Returns: string name of the enum value. Raises: KeyError if either the Enum doesn't exist or the value is not a valid value for the enum. """ return self.enum_types_by_name[enum].values_by_number[value].name
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L321-L337
get name of enumerated value
python
def get_name(self,item): """ Return the name for this item registered with this NameSelector. If no name has previously been registered, then generate a new one. """ if not isinstance(item,ford.sourceform.FortranBase): raise Exception('{} is not of a type derived from FortranBase'.format(str(item))) if item in self._items: return self._items[item] else: if item.get_dir() not in self._counts: self._counts[item.get_dir()] = {} if item.name in self._counts[item.get_dir()]: num = self._counts[item.get_dir()][item.name] + 1 else: num = 1 self._counts[item.get_dir()][item.name] = num name = item.name.lower().replace('<','lt') # name is already lower name = name.replace('>','gt') name = name.replace('/','SLASH') if name == '': name = '__unnamed__' if num > 1: name = name + '~' + str(num) self._items[item] = name return name
https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/sourceform.py#L2466-L2493
get name of enumerated value
python
def get_enum_from_name(self, enum_name): """ Return an enum from a name Args: enum_name (str): name of the enum Returns: Enum """ return next((e for e in self.enums if e.name == enum_name), None)
https://github.com/crytic/slither/blob/04c147f7e50223c6af458ca430befae747ccd259/slither/core/declarations/contract.py#L431-L439
get name of enumerated value
python
def get_value_name(self, pretty=False): """ Get the name of the value :param Boolean pretty: Return the name in a pretty format :return: The name :rtype: String """ if pretty: return "%s (%x)" % ( self.enums.get(self._value, "n/a"), self._value ) return self.enums.get(self._value, "n/a")
https://github.com/DinoTools/python-flextls/blob/c73448f20e79b1969adcc2271b91d8edda517857/flextls/field.py#L157-L171
get name of enumerated value
python
def get_enumeration(rq, v, endpoint, metadata={}, auth=None): """ Returns a list of enumerated values for variable 'v' in query 'rq' """ # glogger.debug("Metadata before processing enums: {}".format(metadata)) # We only fire the enum filling queries if indicated by the query metadata if 'enumerate' not in metadata: return None enumDict = _getDictWithKey(v, metadata['enumerate']) if enumDict: return enumDict[v] if v in metadata['enumerate']: return get_enumeration_sparql(rq, v, endpoint, auth) return None
https://github.com/CLARIAH/grlc/blob/f5664e34f039010c00ef8ebb69917c05e8ce75d7/src/gquery.py#L196-L209
get name of enumerated value
python
def _name(named): """Get the name out of an object. This varies based on the type of the input: * the "name" of a string is itself * the "name" of None is itself * the "name" of an object with a property named name is that property - as long as it's a string * otherwise, we raise a ValueError """ if isinstance(named, basestring) or named is None: return named elif hasattr(named, 'name') and isinstance(named.name, basestring): return named.name else: raise ValueError("Can't interpret %s as a name or a configuration object" % named)
https://github.com/boundlessgeo/gsconfig/blob/532f561f32b91ea8debea0573c503dd20988bf40/src/geoserver/catalog.py#L72-L85
get name of enumerated value
python
def get_value(self, label): """ Get value from a single fully-qualified name """ for (key, value) in self.items: if key == label: return value
https://github.com/shaded-enmity/docker-hica/blob/bc425586297e1eb228b70ee6fca8c499849ec87d/base/hica_base.py#L87-L91
get name of enumerated value
python
def names(self): """List of selected enum names. Returns: list: Enum names. """ result = [] for key, value in self.iteritems(): if value & self.bitmask: result.append(key) return result
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/foundation/base.py#L895-L906
get name of enumerated value
python
def get_extended_name(self, index): """ manages extensible names """ field_descriptor = self.get_field_descriptor(index) if self.extensible_info is None: return field_descriptor.name cycle_start, cycle_len, _ = self.extensible_info cycle_num = (index - cycle_start) // cycle_len return None if field_descriptor.name is None else field_descriptor.name.replace("1", str(cycle_num))
https://github.com/openergy/oplus/blob/f095868d1990c1d126e906ada6acbab26348b3d3/oplus/epm/table_descriptor.py#L146-L155
get name of enumerated value
python
def _get_names(self): """Get the names of the objects to include in the table. :returns: The names of the objects to include. :rtype: generator(str) """ for line in self.content: line = line.strip() if line and re.search("^[a-zA-Z0-9]", line): yield line
https://github.com/rtfd/sphinx-autoapi/blob/9735f43a8d9ff4620c7bcbd177fd1bb7608052e9/autoapi/directives.py#L39-L48
get name of enumerated value
python
def get_name(self, name, objid): ''' Paramters: name -- element tag objid -- ID type, unique id ''' if type(name) is tuple: return name ns = self.nspname n = name or self.pname or ('E' + objid) return ns,n
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TC.py#L378-L389
get name of enumerated value
python
def GetValueByName(self, name): """Retrieves a value by name. Value names are not unique and pyregf provides first match for the value. Args: name (str): name of the value or an empty string for the default value. Returns: WinRegistryValue: Windows Registry value if a corresponding value was found or None if not. """ pyregf_value = self._pyregf_key.get_value_by_name(name) if not pyregf_value: return None return REGFWinRegistryValue(pyregf_value)
https://github.com/log2timeline/dfwinreg/blob/9d488bb1db562197dbfb48de9613d6b29dea056e/dfwinreg/regf.py#L202-L218
get name of enumerated value
python
def get_name(self, **values) -> str: """Get a new name string from this object's name values. :param values: Variable keyword arguments where the **key** should refer to a field on this object that will use the provided **value** to build the new name. """ if not values and self.name: return self.name if values: # if values are provided, solve compounds that may be affected for ck, cvs in _sorted_items(self.compounds): if ck in cvs and ck in values: # redefined compound name to outer scope e.g. fifth = (fifth, sixth) continue comp_values = [values.pop(cv, getattr(self, cv)) for cv in cvs] if None not in comp_values: values[ck] = ''.join(rf'{v}' for v in comp_values) return self._get_nice_name(**values)
https://github.com/chrizzFTD/naming/blob/ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c/naming/base.py#L205-L221
get name of enumerated value
python
def formatter(self, value): ''' Format a enumerate value to enumerate names if possible. Used to generate human readable dump result. ''' if not self._bitwise: n = self.getName(value) if n is None: return value else: return n else: names = [] for k,v in sorted(self._values.items(), key=lambda x: x[1], reverse=True): if (v & value) == v: names.append(k) value = value ^ v names.reverse() if value != 0: names.append(hex(value)) if not names: return 0 return ' '.join(names)
https://github.com/hubo1016/namedstruct/blob/5039026e0df4ce23003d212358918dbe1a6e1d76/namedstruct/namedstruct.py#L2626-L2648
get name of enumerated value
python
def get_enum_from_canonical_name(self, enum_name): """ Return an enum from a canonical name Args: enum_name (str): canonical name of the enum Returns: Enum """ return next((e for e in self.enums if e.canonical_name == enum_name), None)
https://github.com/crytic/slither/blob/04c147f7e50223c6af458ca430befae747ccd259/slither/core/declarations/contract.py#L441-L449
get name of enumerated value
python
def get_name(self): """ Return the name of the field :rtype: string """ if self.name_idx_value == None: self.name_idx_value = self.CM.get_string(self.name_idx) return self.name_idx_value
https://github.com/zeaphoo/reston/blob/96502487b2259572df55237c9526f92627465088/reston/core/dvm.py#L2319-L2328
get name of enumerated value
python
def get_from_name(self, name): """ Returns the item with the given name, or None if no such item is known. """ with self.condition: try: item_id = self.name2id[name] except KeyError: return None return self.id2item[item_id] return None
https://github.com/knipknap/exscript/blob/72718eee3e87b345d5a5255be9824e867e42927b/Exscript/workqueue/pipeline.py#L72-L83
get name of enumerated value
python
def get_name(self): """Name accessor""" if self.type is not None and self.name.endswith("." + self.type): return self.name[:len(self.name) - len(self.type) - 1] return self.name
https://github.com/svinota/mdns/blob/295f6407132616a0ff7401124b9057d89555f91d/mdns/zeroconf.py#L1420-L1424
get name of enumerated value
python
def _from_attr_(mcs, cls, attr_name: str, attr_value: Any) -> TypeVar: """ Returns the enumeration item regarding to the attribute name and value, or None if not found for the given cls :param attr_name: str: attribute's name :param attr_value: different values: key to search for :return: Enumeration Item """ return next(iter(filter(lambda x: getattr(x, attr_name) == attr_value, list(cls))), None)
https://github.com/KnightConan/sspdatatables/blob/1179a11358734e5e472e5eee703e8d34fa49e9bf/src/sspdatatables/utils/enum.py#L65-L75
get name of enumerated value
python
def get_entity_names(self, data): """Return serialized list of entity names on data that user has `view` permission on.""" entities = self._filter_queryset('view_entity', data.entity_set.all()) return list(entities.values_list('name', flat=True))
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/flow/serializers/data.py#L105-L108
get name of enumerated value
python
def get_name_and_value(self, label_type): """ Return tuple of (label name, label value) Raises KeyError if label doesn't exist """ if label_type in self._label_values: return self._label_values[label_type] else: return (label_type, self._df_labels[label_type])
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L648-L656
get name of enumerated value
python
def value(self): """ Field value as an enum name string. Fall back is an unsigned integer number.""" if self._enum and issubclass(self._enum, Enumeration): name = self._enum.get_name(self._value) if name: return name return self._value
https://github.com/JoeVirtual/KonFoo/blob/0c62ef5c2bed4deaf908b34082e4de2544532fdc/konfoo/core.py#L3761-L3767
get name of enumerated value
python
def get_appended_name(name, columns): """ Append numbers to a name until it no longer conflicts with the other names in a column. Necessary to avoid overwriting columns and losing data. Loop a preset amount of times to avoid an infinite loop. There shouldn't ever be more than two or three identical variable names in a table. :param str name: Variable name in question :param dict columns: Columns listed by variable name :return str: Appended variable name """ loop = 0 while name in columns: loop += 1 if loop > 10: logger_misc.warn("get_appended_name: Too many loops: Tried to get appended name but something looks wrong") break tmp = name + "-" + str(loop) if tmp not in columns: return tmp return name + "-99"
https://github.com/nickmckay/LiPD-utilities/blob/5dab6bbeffc5effd68e3a6beaca6b76aa928e860/Python/lipd/misc.py#L185-L204
get name of enumerated value
python
def get_enumeration_sparql(rq, v, endpoint, auth=None): """ Returns a list of enumerated values for variable 'v' in query 'rq' """ glogger.info('Retrieving enumeration for variable {}'.format(v)) vcodes = [] # tpattern_matcher = re.compile(".*(FROM\s+)?(?P<gnames>.*)\s+WHERE.*[\.\{][\n\t\s]*(?P<tpattern>.*\?" + re.escape(v) + ".*?\.).*", flags=re.DOTALL) # tpattern_matcher = re.compile(".*?((FROM\s*)(?P<gnames>(\<.*\>)+))?\s*WHERE\s*\{(?P<tpattern>.*)\}.*", flags=re.DOTALL) # WHERE is optional too!! tpattern_matcher = re.compile(".*?(FROM\s*(?P<gnames>\<.*\>+))?\s*(WHERE\s*)?\{(?P<tpattern>.*)\}.*", flags=re.DOTALL) glogger.debug(rq) tp_match = tpattern_matcher.match(rq) if tp_match: vtpattern = tp_match.group('tpattern') gnames = tp_match.group('gnames') glogger.debug("Detected graph names: {}".format(gnames)) glogger.debug("Detected BGP: {}".format(vtpattern)) glogger.debug("Matched triple pattern with parameter") if gnames: codes_subquery = re.sub("SELECT.*\{.*\}.*", "SELECT DISTINCT ?" + v + " FROM " + gnames + " WHERE { " + vtpattern + " }", rq, flags=re.DOTALL) else: codes_subquery = re.sub("SELECT.*\{.*\}.*", "SELECT DISTINCT ?" + v + " WHERE { " + vtpattern + " }", rq, flags=re.DOTALL) glogger.debug("Codes subquery: {}".format(codes_subquery)) glogger.debug(endpoint) codes_json = requests.get(endpoint, params={'query': codes_subquery}, headers={'Accept': static.mimetypes['json'], 'Authorization': 'token {}'.format(static.ACCESS_TOKEN)}, auth=auth).json() for code in codes_json['results']['bindings']: vcodes.append(list(code.values())[0]["value"]) else: glogger.debug("No match between variable name and query.") return vcodes
https://github.com/CLARIAH/grlc/blob/f5664e34f039010c00ef8ebb69917c05e8ce75d7/src/gquery.py#L212-L251
get name of enumerated value
python
def get_inventory_by_name(nme, character): """ returns the inventory index by name """ for ndx, sk in enumerate(character["inventory"]): #print("sk = ", sk, " , nme = ", nme) if sk["name"] == nme: return ndx return 0
https://github.com/acutesoftware/virtual-AI-simulator/blob/57de679a5b1a58c38fefe6aea58af1f3a7e79c58/vais/examples/game_incremental.py#L202-L211
get name of enumerated value
python
def extra(self, value, extra_name, default=None): """ Get the additional enumeration value for ``extra_name``. :param unicode value: Enumeration value. :param str extra_name: Extra name. :param default: Default value in the case ``extra_name`` doesn't exist. """ try: return self.get(value).get(extra_name, default) except InvalidEnumItem: return default
https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/enums.py#L123-L134
get name of enumerated value
python
def get_xy_name(self, yidx, xidx=0): """ Return variable names for the given indices :param yidx: :param xidx: :return: """ assert isinstance(xidx, int) if isinstance(yidx, int): yidx = [yidx] uname = ['Time [s]'] + self.uname fname = ['$Time\\ [s]$'] + self.fname xname = [list(), list()] yname = [list(), list()] xname[0] = uname[xidx] xname[1] = fname[xidx] yname[0] = [uname[i] for i in yidx] yname[1] = [fname[i] for i in yidx] return xname, yname
https://github.com/cuihantao/andes/blob/7067898d4f26ce7534e968b8486c4aa8fe3a511a/andes/variables/varname.py#L89-L113
get name of enumerated value
python
def get_var_name(self, i): """ Return variable name """ method = "get_var_name" A = None metadata = {method: i} send_array(self.socket, A, metadata) A, metadata = recv_array( self.socket, poll=self.poll, poll_timeout=self.poll_timeout, flags=self.zmq_flags) return metadata[method]
https://github.com/openearth/mmi-python/blob/a2f4ac96b1e7f2fa903f668b3e05c4e86ad42e8d/mmi/mmi_client.py#L103-L118
get name of enumerated value
python
def get(cls, name_or_numeric): """ Get Enum.Value object matching the value argument. :param name_or_numeric: Integer value or attribute name :type name_or_numeric: int or str :rtype: Enum.Value """ if isinstance(name_or_numeric, six.string_types): name_or_numeric = getattr(cls, name_or_numeric.upper()) return cls.values.get(name_or_numeric)
https://github.com/5monkeys/django-enumfield/blob/6cf20c0fba013d39960af0f4d2c9a3b399955eb3/django_enumfield/enum.py#L105-L114
get name of enumerated value
python
def parse_names(cls, names: List[str]) -> T: """Parse specified names for IntEnum; return default if not found.""" value = 0 iterable = cls # type: Iterable for name in names: name = name.lower() flag = next((item for item in iterable if name == item.name.lower()), None) if not flag: raise ValueError("{} is not a member of {}".format( name, cls.__name__)) value = value | int(flag) return cls(value)
https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/enums.py#L46-L57
get name of enumerated value
python
def get_anon_name(rec): # type: (MutableMapping[Text, Any]) -> Text """Calculate a reproducible name for anonymous types.""" if "name" in rec: return rec["name"] anon_name = "" if rec['type'] in ('enum', 'https://w3id.org/cwl/salad#enum'): for sym in rec["symbols"]: anon_name += sym return "enum_"+hashlib.sha1(anon_name.encode("UTF-8")).hexdigest() if rec['type'] in ('record', 'https://w3id.org/cwl/salad#record'): for field in rec["fields"]: anon_name += field["name"] return "record_"+hashlib.sha1(anon_name.encode("UTF-8")).hexdigest() if rec['type'] in ('array', 'https://w3id.org/cwl/salad#array'): return "" raise validate.ValidationException("Expected enum or record, was %s" % rec['type'])
https://github.com/common-workflow-language/schema_salad/blob/608ba207b9058fe0a9c3db161058ab3782eef015/schema_salad/schema.py#L363-L379
get name of enumerated value
python
def _get_name_from_structure(item, default): """ Given a possibly sparsely populated item dictionary, try to retrieve the item name. First try the default field. If that doesn't exist, try to parse the from the ARN. :param item: dict containing (at the very least) item_name and/or arn :return: item name """ if item.get(default): return item.get(default) if item.get('Arn'): arn = item.get('Arn') item_arn = ARN(arn) if item_arn.error: raise CloudAuxException('Bad ARN: {arn}'.format(arn=arn)) return item_arn.parsed_name raise MissingFieldException('Cannot extract item name from input: {input}.'.format(input=item))
https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/orchestration/aws/__init__.py#L28-L45
get name of enumerated value
python
def name(self): """ Get the ``mets:name`` element value. """ el_name = self._el.find('mets:name', NS) if el_name is not None: return el_name.text
https://github.com/OCR-D/core/blob/57e68c578526cb955fd2e368207f5386c459d91d/ocrd_models/ocrd_models/ocrd_agent.py#L115-L121
get name of enumerated value
python
def paramname(param=""): """ Get the param name from the dict index value. """ try: name = pinfo[str(param)][0].strip().split(" ")[1] except (KeyError, ValueError) as err: ## TODO: paramsinfo get description by param string not working. ## It would be cool to have an assembly object bcz then you could ## just do this: ## ## print(pinfo[data.paramsinfo.keys().index(param)]) print("\tKey name/number not recognized - ".format(param), err) raise return name
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/paramsinfo.py#L415-L430
get name of enumerated value
python
def get_var_name(self, i): """ Return variable name """ i = c_int(i) name = create_string_buffer(MAXSTRLEN) self.library.get_var_name.argtypes = [c_int, c_char_p] self.library.get_var_name(i, name) return name.value
https://github.com/openearth/bmi-python/blob/2f53f24d45515eb0711c2d28ddd6c1582045248f/bmi/wrapper.py#L409-L417
get name of enumerated value
python
def getConstName(self, val): """ Get constant name for value name of constant is reused if same value was used before """ try: return self._cache[val] except KeyError: if isinstance(val.val, int): name = "const_%d_" % val.val else: name = "const_" c = self.nameCheckFn(name, val) self._cache[val] = c return c
https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/serializer/generic/constCache.py#L14-L29
get name of enumerated value
python
def _get_argname_value(self, argname): ''' Return the argname value looking up on all possible attributes ''' # Let's see if there's a private function to get the value argvalue = getattr(self, '__get_{0}__'.format(argname), None) if argvalue is not None and callable(argvalue): argvalue = argvalue() if argvalue is None: # Let's see if the value is defined as a public class variable argvalue = getattr(self, argname, None) if argvalue is None: # Let's see if it's defined as a private class variable argvalue = getattr(self, '__{0}__'.format(argname), None) if argvalue is None: # Let's look for it in the extra dictionary argvalue = self.extra.get(argname, None) return argvalue
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schema.py#L731-L748
get name of enumerated value
python
def get(self, item_name): """ Retrieve the value of an option. :param str item_name: The name of the option to retrieve. :return: The value of *item_name* in the configuration. """ if self.prefix: item_name = self.prefix + self.seperator + item_name item_names = item_name.split(self.seperator) node = self._storage for item_name in item_names: node = node[item_name] return node
https://github.com/zeroSteiner/smoke-zephyr/blob/a6d2498aeacc72ee52e7806f783a4d83d537ffb2/smoke_zephyr/configuration.py#L80-L93
get name of enumerated value
python
def get_name(self, label_type): """ returns the most preferred label name if there isn't any correct name in the list it will return newest label name """ if label_type in self._label_values: return self._label_values[label_type][0] else: return Labels.LABEL_NAMES[label_type][0]
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L627-L636
get name of enumerated value
python
def getElementsByName(self, name): """ get element with given name, return list of element objects regarding to 'name' :param name: element name, case sensitive, if elements are auto-generated from LteParser, the name should be lower cased. """ try: return filter(lambda x: x.name == name, self._lattice_eleobjlist) except: return []
https://github.com/archman/beamline/blob/417bc5dc13e754bc89d246427984590fced64d07/beamline/models.py#L216-L226
get name of enumerated value
python
def getValueByName(node, name): """ A helper function to pull the values out of those annoying namespace prefixed tags """ try: value = node.xpath("*[local-name() = '%s']" % name)[0].text.strip() except: return None return value
https://github.com/unt-libraries/codalib/blob/458d117bb48938c1a0e26d9161cb5f730461b4c7/codalib/bagatom.py#L144-L154
get name of enumerated value
python
def get_arg_name(self, param): """ gets the argument name used in the command table for a parameter """ if self.current_command in self.cmdtab: for arg in self.cmdtab[self.current_command].arguments: for name in self.cmdtab[self.current_command].arguments[arg].options_list: if name == param: return arg return None
https://github.com/Azure/azure-cli-extensions/blob/3d4854205b0f0d882f688cfa12383d14506c2e35/src/interactive/azext_interactive/azclishell/az_completer.py#L191-L199
get name of enumerated value
python
def _get_names_part(self, part): """Get some part of the "N" entry in the vCard as a list :param part: the name to get e.g. "prefix" or "given" :type part: str :returns: a list of entries for this name part :rtype: list(str) """ try: the_list = getattr(self.vcard.n.value, part) except AttributeError: return [] else: # check if list only contains empty strings if not ''.join(the_list): return [] return the_list if isinstance(the_list, list) else [the_list]
https://github.com/scheibler/khard/blob/0f69430c2680f1ff5f073a977a3c5b753b96cc17/khard/carddav_object.py#L184-L201
get name of enumerated value
python
def extract_name_value_type(self, name, value, limit_size=False): """Extracts value of any object, eventually reduces it's size and returns name, truncated value and type (for str with size appended) """ MAX_STRING_LEN_TO_RETURN = 487 try: t_value = repr(value) except: t_value = "Error while extracting value" # convert all var names to string if isinstance(name, str): r_name = name else: r_name = repr(name) # truncate value to limit data flow between ikpdb and client if len(t_value) > MAX_STRING_LEN_TO_RETURN: r_value = "%s ... (truncated by ikpdb)" % (t_value[:MAX_STRING_LEN_TO_RETURN],) r_name = "%s*" % r_name # add a visual marker to truncated var's name else: r_value = t_value if isinstance(value, str): r_type = "%s [%s]" % (IKPdbRepr(value), len(value),) else: r_type = IKPdbRepr(value) return r_name, r_value, r_type
https://github.com/cmorisse/ikp3db/blob/a0f318d4e8494b2e6f2f07ec0f1202ca023c920f/ikp3db.py#L844-L872
get name of enumerated value
python
def get_input_var_names(self): """Return a list of variables names that can be set as input. Returns ------- var_names : list[str] A list of variable names that can be set from the outside """ in_vars = copy.copy(self.input_vars) for idx, var in enumerate(in_vars): if self._map_in_out(var) is not None: in_vars[idx] = self._map_in_out(var) return in_vars
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/bmi_wrapper.py#L203-L215
get name of enumerated value
python
def get_name_str(self, element): '''get_name_str High-level api: Produce a string that represents the name of a node. Parameters ---------- element : `Element` A node in model tree. Returns ------- str A string that represents the name of a node. ''' name = self.remove_model_prefix(self.url_to_prefix(element.tag)) flags = self.get_flags_str(element) type_info = element.get('type') if type_info is None: pass elif type_info == 'choice': if element.get('mandatory') == 'true': return flags + ' ({})'.format(name) else: return flags + ' ({})?'.format(name) elif type_info == 'case': return ':({})'.format(name) elif type_info == 'container': return flags + ' {}'.format(name) elif type_info == 'leaf' or \ type_info == 'anyxml' or \ type_info == 'anydata': if element.get('mandatory') == 'true': return flags + ' {}'.format(name) else: return flags + ' {}?'.format(name) elif type_info == 'list': if element.get('key') is not None: return flags + ' {}* [{}]'.format(name, element.get('key')) else: return flags + ' {}*'.format(name) elif type_info == 'leaf-list': return flags + ' {}*'.format(name) else: return flags + ' {}'.format(name)
https://github.com/CiscoTestAutomation/yang/blob/c70ec5ac5a91f276c4060009203770ece92e76b4/ncdiff/src/yang/ncdiff/model.py#L236-L283
get name of enumerated value
python
def _get_name(self): """ Property getter. """ if (self.tail_node is not None) and (self.head_node is not None): return "%s %s %s" % (self.tail_node.ID, self.conn, self.head_node.ID) else: return "Edge"
https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/edge.py#L693-L700
get name of enumerated value
python
def get_parameter(self, name): """ Gets a single parameter by its name. :param str name: Either a fully-qualified XTCE name or an alias in the format ``NAMESPACE/NAME``. :rtype: .Parameter """ name = adapt_name_for_rest(name) url = '/mdb/{}/parameters{}'.format(self._instance, name) response = self._client.get_proto(url) message = mdb_pb2.ParameterInfo() message.ParseFromString(response.content) return Parameter(message)
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/mdb/client.py#L74-L87
get name of enumerated value
python
def _get_fieldnames(item): """Return fieldnames of either a namedtuple or GOEnrichmentRecord.""" if hasattr(item, "_fldsdefprt"): # Is a GOEnrichmentRecord return item.get_prtflds_all() if hasattr(item, "_fields"): # Is a namedtuple return item._fields
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/rpt/goea_nt_xfrm.py#L111-L116
get name of enumerated value
python
def __get_name_or_id(values, known): """ Return list of values that match attribute ``.id`` or ``.name`` of any object in list `known`. :param str values: comma-separated list (i.e., a Python string) of items :param list known: list of libcloud items to filter :return: list of the libcloud items that match the given values """ result = list() for element in [e.strip() for e in values.split(',')]: for item in [i for i in known if i.name == element or i.id == element]: result.append(item) return result
https://github.com/gc3-uzh-ch/elasticluster/blob/e6345633308c76de13b889417df572815aabe744/elasticluster/providers/libcloud_provider.py#L261-L273
get name of enumerated value
python
def ENUM_CONSTANT_DECL(self, cursor): """Gets the enumeration values""" name = cursor.displayname value = cursor.enum_value pname = self.get_unique_name(cursor.semantic_parent) parent = self.get_registered(pname) obj = typedesc.EnumValue(name, value, parent) parent.add_value(obj) return obj
https://github.com/trolldbois/ctypeslib/blob/2aeb1942a5a32a5cc798c287cd0d9e684a0181a8/ctypeslib/codegen/cursorhandler.py#L132-L140
get name of enumerated value
python
def get_name_at( self, name, block_number, include_expired=False ): """ Generate and return the sequence of of states a name record was in at a particular block number. """ cur = self.db.cursor() return namedb_get_name_at(cur, name, block_number, include_expired=include_expired)
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L912-L918
get name of enumerated value
python
def name(self, name): """ Get the ``mets:name`` element value. """ if name is not None: el_name = self._el.find('mets:name', NS) if el_name is None: el_name = ET.SubElement(self._el, TAG_METS_NAME) el_name.text = name
https://github.com/OCR-D/core/blob/57e68c578526cb955fd2e368207f5386c459d91d/ocrd_models/ocrd_models/ocrd_agent.py#L124-L132
get name of enumerated value
python
def get_parameter_names(self, include_frozen=False): """ Get a list of the parameter names Args: include_frozen (Optional[bool]): Should the frozen parameters be included in the returned value? (default: ``False``) """ if include_frozen: return self.parameter_names return tuple(p for p, f in zip(self.parameter_names, self.unfrozen_mask) if f)
https://github.com/dfm/george/blob/44819680036387625ee89f81c55104f3c1600759/george/modeling.py#L190-L203
get name of enumerated value
python
def GET_names( self, path_info ): """ Get all names in existence If `all=true` is set, then include expired names. Returns the list on success Returns 400 on invalid arguments Returns 502 on failure to get names """ include_expired = False qs_values = path_info['qs_values'] page = qs_values.get('page', None) if page is None: log.error("Page required") return self._reply_json({'error': 'page= argument required'}, status_code=400) try: page = int(page) if page < 0: raise ValueError("Page is negative") except ValueError: log.error("Invalid page") return self._reply_json({'error': 'Invalid page= value'}, status_code=400) if qs_values.get('all', '').lower() in ['1', 'true']: include_expired = True offset = page * 100 count = 100 blockstackd_url = get_blockstackd_url() res = blockstackd_client.get_all_names(offset, count, include_expired=include_expired, hostport=blockstackd_url) if json_is_error(res): log.error("Failed to list all names (offset={}, count={}): {}".format(offset, count, res['error'])) return self._reply_json({'error': 'Failed to list all names'}, status_code=res.get('http_status', 502)) return self._reply_json(res)
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/rpc.py#L458-L496
get name of enumerated value
python
def _get_names(self): """Get the list of first names. :return: A list of first name entries. """ names = self._read_name_file('names.json') names = self._compute_weights(names) return names
https://github.com/abusque/qng/blob/93d2efd637b2a6bba7d3872fb9ff2bb3fc5c979d/qng/generator.py#L83-L91
get name of enumerated value
python
def get_colname(self, colnum): """ Get the name associated with the given column number parameters ---------- colnum: integer The number for the column, zero offset """ if colnum < 0 or colnum > (len(self._colnames)-1): raise ValueError( "colnum out of range [0,%s-1]" % (0, len(self._colnames))) return self._colnames[colnum]
https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L84-L96
get name of enumerated value
python
def get_names(cs): """Return list of every name.""" records = [] for c in cs: records.extend(c.get('names', [])) return records
https://github.com/mcs07/ChemDataExtractor/blob/349a3bea965f2073141d62043b89319222e46af1/chemdataextractor/cli/evaluate.py#L75-L80
get name of enumerated value
python
def get_name_str(self, element): '''get_name_str High-level api: Produce a string that represents the name of a node. Parameters ---------- element : `Element` A node in model tree. Returns ------- str A string that represents the name of a node. ''' if element.get('diff') == 'added': return self.model2.get_name_str(element) else: return self.model1.get_name_str(element)
https://github.com/CiscoTestAutomation/yang/blob/c70ec5ac5a91f276c4060009203770ece92e76b4/ncdiff/src/yang/ncdiff/model.py#L790-L811
get name of enumerated value
python
def get_absolute_name(self): """ Returns the full dotted name of this field """ res = [] current = self while type(current) != type(None): if current.__matched_index: res.append('$') res.append(current.get_type().db_field) current = current._get_parent() return '.'.join(reversed(res))
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/query_expression.py#L121-L131
get name of enumerated value
python
def ToName(param_type): """ Gets the name of a ContractParameterType based on its value Args: param_type (ContractParameterType): type to get the name of Returns: str """ items = inspect.getmembers(ContractParameterType) if type(param_type) is bytes: param_type = int.from_bytes(param_type, 'little') for item in items: name = item[0] val = int(item[1].value) if val == param_type: return name return None
https://github.com/CityOfZion/neo-python/blob/fe90f62e123d720d4281c79af0598d9df9e776fb/neo/SmartContract/ContractParameterType.py#L83-L104
get name of enumerated value
python
def name(self, value): """ :type: string """ self._completeIfNotSet(self._name) self._name.value = value
https://github.com/PyGithub/PyGithub/blob/f716df86bbe7dc276c6596699fa9712b61ef974c/github/GitReleaseAsset.py#L64-L69
get name of enumerated value
python
def get_value(self, name): """ Returns the value of the parameter with the specified name. """ # first clean up the name name = self._clean_up_name(name) # now get the parameter object x = self._find_parameter(name.split('/')) # quit if it pooped. if x == None: return None # get the value and test the bounds value = x.value() # handles the two versions of pyqtgraph bounds = None # For lists, just make sure it's a valid value if x.opts['type'] == 'list': # If it's not one from the master list, choose # and return the default value. if not value in x.opts['values']: # Only choose a default if there exists one if len(x.opts('values')): self.set_value(name, x.opts['values'][0]) return x.opts['values'][0] # Otherwise, just return None and do nothing else: return None # For strings, make sure the returned value is always a string. elif x.opts['type'] in ['str']: return str(value) # Otherwise assume it is a value with bounds or limits (depending on # the version of pyqtgraph) else: if 'limits' in x.opts: bounds = x.opts['limits'] elif 'bounds' in x.opts: bounds = x.opts['bounds'] if not bounds == None: if not bounds[1]==None and value > bounds[1]: value = bounds[1] if not bounds[0]==None and value < bounds[0]: value = bounds[0] # return it return value
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2162-L2209
get name of enumerated value
python
def get_property_names(obj): """ Gets names of all properties implemented in specified object. :param obj: an objec to introspect. :return: a list with property names. """ property_names = [] for property_name in dir(obj): property = getattr(obj, property_name) if PropertyReflector._is_property(property, property_name): property_names.append(property_name) return property_names
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/reflect/PropertyReflector.py#L106-L123
get name of enumerated value
python
def name(self, value): """The name property. Args: value (string). the property value. """ if value == self._defaults['name'] and 'name' in self._values: del self._values['name'] else: self._values['name'] = value
https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/channel/contracts/RequestData.py#L108-L117
get name of enumerated value
python
def _rec_get_names(args, names=None): """return a list of all argument names""" if names is None: names = [] for arg in args: if isinstance(arg, node_classes.Tuple): _rec_get_names(arg.elts, names) else: names.append(arg.name) return names
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/scoped_nodes.py#L1707-L1716
get name of enumerated value
python
def get_name_arg(argd, *argnames, default=None): """ Return the first argument value given in a docopt arg dict. When not given, return default. """ val = None for argname in argnames: if argd[argname]: val = argd[argname].lower().strip() break return val if val else default
https://github.com/welbornprod/colr/blob/417117fdbddbc53142096685ac2af006b2bd0220/colr/__main__.py#L288-L297
get name of enumerated value
python
def has_enumerated_namespace_name(self, namespace: str, name: str) -> bool: """Check that the namespace is defined by an enumeration and that the name is a member.""" return self.has_enumerated_namespace(namespace) and name in self.namespace_to_terms[namespace]
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/parser/parse_identifier.py#L74-L76
get name of enumerated value
python
def get(self, block, name): """ Retrieve the value for the field named `name`. If a value is provided for `default`, then it will be returned if no value is set """ return self._kvs.get(self._key(block, name))
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L193-L200
get name of enumerated value
python
def yield_name2value(self, idx1=None, idx2=None) \ -> Iterator[Tuple[str, str]]: """Sequentially return name-value-pairs describing the current state of the target variables. The names are automatically generated and contain both the name of the |Device| of the respective |Variable| object and the target description: >>> from hydpy.core.examples import prepare_full_example_2 >>> hp, pub, TestIO = prepare_full_example_2() >>> from hydpy.core.itemtools import SetItem >>> item = GetItem('hland_v1', 'states.lz') >>> item.collect_variables(pub.selections) >>> hp.elements.land_dill.model.sequences.states.lz = 100.0 >>> for name, value in item.yield_name2value(): ... print(name, value) land_dill_states_lz 100.0 land_lahn_1_states_lz 8.18711 land_lahn_2_states_lz 10.14007 land_lahn_3_states_lz 7.52648 >>> item = GetItem('hland_v1', 'states.sm') >>> item.collect_variables(pub.selections) >>> hp.elements.land_dill.model.sequences.states.sm = 2.0 >>> for name, value in item.yield_name2value(): ... print(name, value) # doctest: +ELLIPSIS land_dill_states_sm [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, \ 2.0, 2.0, 2.0, 2.0] land_lahn_1_states_sm [99.27505, ..., 142.84148] ... When querying time series, one can restrict the span of interest by passing index values: >>> item = GetItem('nodes', 'sim.series') >>> item.collect_variables(pub.selections) >>> hp.nodes.dill.sequences.sim.series = 1.0, 2.0, 3.0, 4.0 >>> for name, value in item.yield_name2value(): ... print(name, value) # doctest: +ELLIPSIS dill_sim_series [1.0, 2.0, 3.0, 4.0] lahn_1_sim_series [nan, ... ... >>> for name, value in item.yield_name2value(2, 3): ... print(name, value) # doctest: +ELLIPSIS dill_sim_series [3.0] lahn_1_sim_series [nan] ... """ for device, name in self._device2name.items(): target = self.device2target[device] if self.targetspecs.series: values = target.series[idx1:idx2] else: values = target.values if self.ndim == 0: values = objecttools.repr_(float(values)) else: values = objecttools.repr_list(values.tolist()) yield name, values
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/itemtools.py#L604-L662
get name of enumerated value
python
def getColumnName(self, attribute): """ Retreive the fully qualified column name for a particular attribute in this store. The attribute must be bound to an Item subclass (its type must be valid). If the underlying table does not exist in the database, it will be created as a side-effect. @param tableClass: an Item subclass @return: a string """ if attribute not in self.attrToColumnNameCache: self.attrToColumnNameCache[attribute] = '.'.join( (self.getTableName(attribute.type), self.getShortColumnName(attribute))) return self.attrToColumnNameCache[attribute]
https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L2047-L2063
get name of enumerated value
python
def get_by(self, name): """get element by name""" return next((item for item in self if item.name == name), None)
https://github.com/RedHatQE/Sentaku/blob/b336cef5b6ee2db4e8dff28dcdb2be35a1f3d01c/examples/todo_example/api.py#L14-L16
get name of enumerated value
python
def get_name(self, seq=None): """Returns ([tokens], next_token_info).""" if seq is not None: it = iter(seq) def get_next_token(): return next(it) else: get_next_token = self._get_next_token next_token = get_next_token() tokens = [] last_token_was_name = False while (next_token.token_type == tokenize.NAME or (next_token.token_type == tokenize.SYNTAX and next_token.name in ('::', '<'))): # Two NAMEs in a row means the identifier should terminate. # It's probably some sort of variable declaration. if last_token_was_name and next_token.token_type == tokenize.NAME: break last_token_was_name = next_token.token_type == tokenize.NAME tokens.append(next_token) # Handle templated names. if next_token.name == '<': tokens.extend(self._get_matching_char('<', '>', get_next_token)) last_token_was_name = True next_token = get_next_token() return tokens, next_token
https://github.com/myint/cppclean/blob/8a20c943dca1049e87d57137938f92d7735828dc/cpp/ast.py#L913-L941
get name of enumerated value
python
def attget(self, attribute=None, entry=None, to_np=True): """ Returns the value of the attribute at the entry number provided. A variable name can be used instead of its corresponding entry number. A dictionary is returned with the following defined keys +-----------------+--------------------------------------------------------------------------------+ | ['Item_Size'] | the number of bytes for each entry value | +-----------------+--------------------------------------------------------------------------------+ | ['Num_Items'] | total number of values extracted | +-----------------+--------------------------------------------------------------------------------+ | ['Data_Type'] | the CDF data type | +-----------------+--------------------------------------------------------------------------------+ | ['Data'] | retrieved attribute data as a scalar value, a numpy array or a string | +-----------------+--------------------------------------------------------------------------------+ Parameters ---------- attribute : str, int, optional Attribute name or number to get. entry : int, optional tp_np : bool, optional """ # Starting position position = self._first_adr # Get Correct ADR adr_info = None if isinstance(attribute, str): for _ in range(0, self._num_att): name, next_adr = self._read_adr_fast(position) if (name.strip().lower() == attribute.strip().lower()): adr_info = self._read_adr(position) break else: position = next_adr if adr_info is None: raise KeyError('No attribute {}'.format(attribute)) elif isinstance(attribute, int): if (attribute < 0) or (attribute > self._num_att): raise KeyError('No attribute {}'.format(attribute)) if not isinstance(entry, int): raise TypeError('{} has to be a number.'.format(entry)) for _ in range(0, attribute): name, next_adr = self._read_adr_fast(position) position = next_adr adr_info = self._read_adr(position) else: print('Please set attribute keyword equal to the name or ', 'number of an attribute') for x in range(0, self._num_att): name, next_adr = self._read_adr_fast(position) print('NAME:' + name + ' NUMBER: ' + str(x)) position = next_adr return # Find the correct entry from the "entry" variable if adr_info['scope'] == 1: if not isinstance(entry, int): print('Global entry should be an integer') return num_entry_string = 'num_gr_entry' first_entry_string = 'first_gr_entry' max_entry_string = 'max_gr_entry' entry_num = entry else: var_num = -1 zvar = False if isinstance(entry, str): # a zVariable? positionx = self._first_zvariable for x in range(0, self._num_zvariable): if (self.cdfversion == 3): name, vdr_next = self._read_vdr_fast(positionx) else: name, vdr_next = self._read_vdr_fast2(positionx) if (name.strip().lower() == entry.strip().lower()): var_num = x zvar = True break positionx = vdr_next if var_num == -1: # a rVariable? positionx = self._first_rvariable for x in range(0, self._num_rvariable): if (self.cdfversion == 3): name, vdr_next = self._read_vdr_fast(positionx) else: name, vdr_next = self._read_vdr_fast2(positionx) if (name.strip().lower() == entry.strip().lower()): var_num = x break positionx = vdr_next if var_num == -1: print('No variable by this name:', entry) return entry_num = var_num else: if (self._num_zvariable > 0 and self._num_rvariable > 0): print('This CDF has both r and z variables. Use variable name') return if self._num_zvariable > 0: zvar = True entry_num = entry if zvar: num_entry_string = 'num_z_entry' first_entry_string = 'first_z_entry' max_entry_string = 'max_z_entry' else: num_entry_string = 'num_gr_entry' first_entry_string = 'first_gr_entry' max_entry_string = 'max_gr_entry' if entry_num > adr_info[max_entry_string]: print('The entry does not exist') return return self._get_attdata(adr_info, entry_num, adr_info[num_entry_string], adr_info[first_entry_string], to_np=to_np)
https://github.com/MAVENSDC/cdflib/blob/d237c60e5db67db0f92d96054209c25c4042465c/cdflib/cdfread.py#L285-L405
get name of enumerated value
python
def get(self, name, *df): """ Get the value of a property by I{name}. @param name: The property name. @type name: str @param df: An optional value to be returned when the value is not set @type df: [1]. @return: The stored value, or I{df[0]} if not set. @rtype: any """ return self.provider(name).__get(name, *df)
https://github.com/cackharot/suds-py3/blob/7387ec7806e9be29aad0a711bea5cb3c9396469c/suds/properties.py#L297-L308
get name of enumerated value
python
def get_name(self, data): """ For non-specific queries, this will return the actual name in the result. """ if self.node.specific_attribute: return self.node.name name = data.get(self.predicate_var) if str(RDF.type) in [self.node.name, name]: return '$schema' if name.startswith(PRED): name = name[len(PRED):] return name
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/query.py#L56-L66
get name of enumerated value
python
def get_property_names(obj): """ Recursively gets names of all properties implemented in specified object and its subobjects. The object can be a user defined object, map or array. Returned property name correspondently are object properties, map keys or array indexes. :param obj: an object to introspect. :return: a list with property names. """ property_names = [] if obj != None: cycle_detect = [] RecursiveObjectReader._perform_get_property_names(obj, None, property_names, cycle_detect) return property_names
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/reflect/RecursiveObjectReader.py#L130-L147
get name of enumerated value
python
def get_all_names( self, offset=None, count=None, include_expired=False ): """ Get the set of all registered names, with optional pagination Returns the list of names. """ if offset is not None and offset < 0: offset = None if count is not None and count < 0: count = None cur = self.db.cursor() names = namedb_get_all_names( cur, self.lastblock, offset=offset, count=count, include_expired=include_expired ) return names
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1048-L1061
get name of enumerated value
python
def getTableName(self, tableClass): """ Retrieve the fully qualified name of the table holding items of a particular class in this store. If the table does not exist in the database, it will be created as a side-effect. @param tableClass: an Item subclass @raises axiom.errors.ItemClassesOnly: if an object other than a subclass of Item is passed. @return: a string """ if not (isinstance(tableClass, type) and issubclass(tableClass, item.Item)): raise errors.ItemClassesOnly("Only subclasses of Item have table names.") if tableClass not in self.typeToTableNameCache: self.typeToTableNameCache[tableClass] = self._tableNameFor(tableClass.typeName, tableClass.schemaVersion) # make sure the table exists self.getTypeID(tableClass) return self.typeToTableNameCache[tableClass]
https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L2001-L2021
get name of enumerated value
python
def _GetValue(self, name): """Returns the TextFSMValue object natching the requested name.""" for value in self.values: if value.name == name: return value
https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/parser.py#L622-L626
get name of enumerated value
python
def get_i_name(self, num, is_oai=None): """ This method is used mainly internally, but it can be handy if you work with with raw MARC XML object and not using getters. Args: num (int): Which indicator you need (1/2). is_oai (bool/None): If None, :attr:`.oai_marc` is used. Returns: str: current name of ``i1``/``ind1`` parameter based on \ :attr:`oai_marc` property. """ if num not in (1, 2): raise ValueError("`num` parameter have to be 1 or 2!") if is_oai is None: is_oai = self.oai_marc i_name = "ind" if not is_oai else "i" return i_name + str(num)
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/parser.py#L290-L312
get name of enumerated value
python
def get_item_name(self, item, parent): """ Returns the value of the first name element found inside of element """ names = self.get_name_elements(item) if not names: raise MissingNameElementError name = names[0].text prefix = self.item_name_prefix(parent) if prefix: name = prefix + name return name
https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/tasks/metadata/package.py#L298-L309
get name of enumerated value
python
def _get_names(node, result): """Recursively finds all names.""" if isinstance(node, ast.Name): return node.id + result elif isinstance(node, ast.Subscript): return result elif isinstance(node, ast.Starred): return _get_names(node.value, result) else: return _get_names(node.value, result + '.' + node.attr)
https://github.com/python-security/pyt/blob/efc0cfb716e40e0c8df4098f1cc8cf43723cd31f/pyt/cfg/stmt_visitor_helper.py#L76-L85
get name of enumerated value
python
def get(self, name): """ Get labels by name :param name: The label name, it must be an exact match. :type name: str :return: A list of matching labels. An empty list is returned if there are not any matches :rtype: list of dict :raises: This will raise a :class:`ServerException<logentries_api.exceptions.ServerException>` if there is an error from Logentries """ labels = self.list() return [ label for label in labels if name == label.get('name') ]
https://github.com/ambitioninc/python-logentries-api/blob/77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc/logentries_api/resources.py#L128-L149
get name of enumerated value
python
def get_value_by_parameter(self, parameter_id=None): """Gets a ``Value`` for the given parameter ``Id``. If more than one value exists for the given parameter, the most preferred value is returned. This method can be used as a convenience when only one value is expected. ``get_values_by_parameters()`` should be used for getting all the active values. arg: parameter_id (osid.id.Id): the ``Id`` of the ``Parameter`` to retrieve return: (osid.configuration.Value) - the value raise: NotFound - the ``parameter_id`` not found or no value available raise: NullArgument - the ``parameter_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *compliance: mandatory -- This method must be implemented.* """ pass if parameter_id is None: raise NullArgument try: parameter_key = parameter_id.get_identifier() + '.' + parameter_id.get_identifier_namespace() parameter_map = self._catalog._config_map['parameters'][parameter_key] except KeyError: try: parameter_key = parameter_id.get_identifier() parameter_map = self._catalog._config_map['parameters'][parameter_key] except KeyError: raise NotFound(str(parameter_id)) if len(parameter_map['values']) == 0: raise NotFound() lowest_priority_value_map = None for value_map in parameter_map['values']: if lowest_priority_value_map is None or lowest_priority_value_map['priority'] < value_map['priority']: lowest_priority_value_map = value_map return Value(lowest_priority_value_map, Parameter(parameter_map))
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/runtime/impls/configuration/sessions.py#L166-L204
get name of enumerated value
python
def getNamedItem(self, name: str) -> Optional[Attr]: """Get ``Attr`` object which has ``name``. If does not have ``name`` attr, return None. """ return self._dict.get(name, None)
https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/element.py#L258-L263
get name of enumerated value
python
def get_entity_propnames(entity): """ Get entity property names :param entity: Entity :type entity: sqlalchemy.ext.declarative.api.DeclarativeMeta :returns: Set of entity property names :rtype: set """ ins = entity if isinstance(entity, InstanceState) else inspect(entity) return set( ins.mapper.column_attrs.keys() + # Columns ins.mapper.relationships.keys() # Relationships )
https://github.com/kolypto/py-flask-jsontools/blob/1abee2d40e6db262e43f0c534e90faaa9b26246a/flask_jsontools/formatting.py#L31-L43
get name of enumerated value
python
def namedb_get_historic_names_by_address( cur, address, offset=None, count=None ): """ Get the list of all names ever owned by this address (except the current one), ordered by creation date. Return a list of {'name': ..., 'block_id': ..., 'vtxindex': ...}} """ query = "SELECT name_records.name,history.block_id,history.vtxindex FROM name_records JOIN history ON name_records.name = history.history_id " + \ "WHERE history.creator_address = ? ORDER BY history.block_id, history.vtxindex " args = (address,) offset_count_query, offset_count_args = namedb_offset_count_predicate( offset=offset, count=count ) query += offset_count_query + ";" args += offset_count_args name_rows = namedb_query_execute( cur, query, args ) names = [] for name_row in name_rows: info = { 'name': name_row['name'], 'block_id': name_row['block_id'], 'vtxindex': name_row['vtxindex'] } names.append( info ) if len(names) == 0: return None else: return names
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/db.py#L2283-L2313
get name of enumerated value
python
def value_name(cls, value): """ Returns the label from a value if label exists otherwise returns the value since method does a reverse look up it is slow """ for k, v in list(cls.__dict__.items()): if v == value: return k return value
https://github.com/nickmilon/Hellas/blob/542e4778692fbec90753942946f20100412ec9ee/Hellas/Sparta.py#L253-L261
get name of enumerated value
python
def get_name(tags_or_instance_or_id): """Helper utility to extract name out of tags dictionary or intancce. [{'Key': 'Name', 'Value': 'nexus'}] -> 'nexus' Assert fails if there's more than one name. Returns '' if there's less than one name. """ ec2 = get_ec2_resource() if hasattr(tags_or_instance_or_id, 'tags'): tags = tags_or_instance_or_id.tags elif isinstance(tags_or_instance_or_id, str): tags = ec2.Instance(tags_or_instance_or_id).tags elif tags_or_instance_or_id is None: return EMPTY_NAME else: assert isinstance(tags_or_instance_or_id, Iterable), "expected iterable of tags" tags = tags_or_instance_or_id if not tags: return EMPTY_NAME names = [entry['Value'] for entry in tags if entry['Key'] == 'Name'] if not names: return '' if len(names) > 1: assert False, "have more than one name: " + str(names) return names[0]
https://github.com/diux-dev/ncluster/blob/2fd359621896717197b479c7174d06d80df1529b/ncluster/aws_util.py#L645-L672
get name of enumerated value
python
def get_fieldname(self, field, arnum): """Generate a new fieldname with a '-<arnum>' suffix """ name = field.getName() # ensure we have only *one* suffix base_name = name.split("-")[0] suffix = "-{}".format(arnum) return "{}{}".format(base_name, suffix)
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/analysisrequest/add2.py#L166-L173