def _add_aliases(): for name, info in _concrete_typeinfo.items(): # these are handled by _add_integer_aliases if name in _int_ctypes or name in _uint_ctypes: continue # insert bit-width version for this class (if relevant) base, bit, char = bitname(info.type) myname = "%s%d" % (base, bit) # ensure that (c)longdouble does not overwrite the aliases assigned to # (c)double if name in ("longdouble", "clongdouble") and myname in allTypes: continue allTypes[myname] = info.type # add mapping for both the bit name and the numarray name sctypeDict[myname] = info.type # add forward, reverse, and string mapping to numarray sctypeDict[char] = info.type # Add deprecated numeric-style type aliases manually, at some point # we may want to deprecate the lower case "bytes0" version as well. for name in ["Bytes0", "Datetime64", "Str0", "Uint32", "Uint64"]: if english_lower(name) not in allTypes: # Only one of Uint32 or Uint64, aliases of `np.uintp`, was (and is) defined, note that this # is not UInt32/UInt64 (capital i), which is removed. continue allTypes[name] = allTypes[english_lower(name)] sctypeDict[name] = sctypeDict[english_lower(name)]
'of numpy', VisibleDeprecationWarning, stacklevel=2) return dict.get(self, key, default) sctypeNA = TypeNADict( ) # Contails all leaf-node types -> numarray type equivalences allTypes = {} # Collect the types we will add to the module # separate the actual type info from the abstract base classes _abstract_types = {} _concrete_typeinfo = {} for k, v in typeinfo.items(): # make all the keys lowercase too k = english_lower(k) if isinstance(v, type): _abstract_types[k] = v else: _concrete_typeinfo[k] = v _concrete_types = set(v.type for k, v in _concrete_typeinfo.items()) def _bits_of(obj): try: info = next(v for v in _concrete_typeinfo.values() if v.type is obj) except StopIteration: if obj in _abstract_types.values(): raise ValueError("Cannot count the bits of an abstract type")
def get(self, key, default=None): # 2018-06-24, 1.16 warnings.warn('sctypeNA and typeNA will be removed in v1.18 ' 'of numpy', VisibleDeprecationWarning, stacklevel=2) return dict.get(self, key, default) sctypeNA = TypeNADict() # Contails all leaf-node types -> numarray type equivalences allTypes = {} # Collect the types we will add to the module # separate the actual type info from the abstract base classes _abstract_types = {} _concrete_typeinfo = {} for k, v in typeinfo.items(): # make all the keys lowercase too k = english_lower(k) if isinstance(v, type): _abstract_types[k] = v else: _concrete_typeinfo[k] = v _concrete_types = set(v.type for k, v in _concrete_typeinfo.items()) def _bits_of(obj): try: info = next(v for v in _concrete_typeinfo.values() if v.type is obj) except StopIteration: if obj in _abstract_types.values(): raise ValueError("Cannot count the bits of an abstract type")