Package pygeodesy :: Module named :: Class _NamedTuple
[frames] | no frames]

Class _NamedTuple

object --+    
         |    
     tuple --+
             |
object --+   |
         |   |
    _Named --+
             |
            _NamedTuple
Known Subclasses:

(INTERNAL) Base for named tuples with both index and attribute name access to the items.


Note: This class is similar to Python's namedtuple, but statically defined, lighter and limited.

Instance Methods
 
__delattr__(self, name)
Delete an attribute by name.
 
__getattr__(self, name)
Get the value of an attribute or item by name.
 
__hash__(self)
hash(x)
 
__repr__(self)
Default repr(self).
 
__setattr__(self, name, value)
Set attribute or item name to value.
 
__str__(self)
Default repr(self).
 
dup(self, name='', **items)
Duplicate this tuple replacing one or more items.
 
items(self)
Yield the items, each as a (name, value) pair (2-tuple).
 
iteritems(self)
Yield the items, each as a (name, value) pair (2-tuple).
 
iterunits(self, Error=<class 'pygeodesy.errors.UnitError'>)
Yield the items, each as a (name, value) pair (2-tuple) with the value wrapped as an instance of its units class.
 
toRepr(self, prec=6, sep=', ', fmt='F', **unused)
Return this Named-Tuple items as name=value string(s).
 
toStr(self, prec=6, sep=', ', fmt='F', **unused)
Return this Named-Tuple items as string(s).
 
toUnits(self, Error=<class 'pygeodesy.errors.UnitError'>)
Return a copy of this Named-Tuple with each item value wrapped as an instance of its units class.
 
units(self, Error=<class 'pygeodesy.errors.UnitError'>)
Yield the items, each as a (name, value) pair (2-tuple) with the value wrapped as an instance of its units class.

Inherited from tuple: __add__, __contains__, __eq__, __ge__, __getattribute__, __getitem__, __getnewargs__, __getslice__, __gt__, __iter__, __le__, __len__, __lt__, __mul__, __ne__, __rmul__, count, index

Inherited from _Named: __imatmul__, __matmul__, __rmatmul__, attrs, classof, copy, methodname, rename, toStr2

Inherited from object: __format__, __init__, __reduce__, __reduce_ex__, __sizeof__, __subclasshook__

Static Methods
a new object with type S, a subtype of T
__new__(cls, arg, *args, **iteration_name)
New _NamedTuple initialized with positional arguments.
Properties

Inherited from _Named: classname, classnaming, iteration, name, named, named2, named3, named4, sizeof

Inherited from object: __class__

Method Details

__delattr__ (self, name)

 

Delete an attribute by name.

Overrides: object.__delattr__

Note: Items can not be deleted.

__hash__ (self)
(Hashing function)

 

hash(x)

Overrides: object.__hash__
(inherited documentation)

__new__ (cls, arg, *args, **iteration_name)
Static Method

 

New _NamedTuple initialized with positional arguments.

Arguments:
  • arg - Tuple items (tuple, list, ...) or first tuple item of several more in other positional arguments.
  • args - Tuple items (any), all positional arguments.
  • iteration_name - Only keyword arguments iteration=None and name=NN are used, any other are silently ignored.
Returns: a new object with type S, a subtype of T
Raises:
  • LenError - Unequal number of positional arguments and number of item _Names_ or _Units_.
  • TypeError - The _Names_ or _Units_ attribute is not a tuple of at least 2 items.
  • ValueError - Item name is not a str or valid identifier or starts with underscore.
Overrides: object.__new__

__repr__ (self)
(Representation operator)

 

Default repr(self).

Overrides: object.__repr__

__setattr__ (self, name, value)

 

Set attribute or item name to value.

Overrides: object.__setattr__

__str__ (self)
(Informal representation operator)

 

Default repr(self).

Overrides: object.__str__

dup (self, name='', **items)

 

Duplicate this tuple replacing one or more items.

Arguments:
  • name - Optional new name (str).
  • items - Items to be replaced (name=value pairs), if any.
Returns:
A copy of this tuple with items.
Raises:
  • NameError - Some items invalid.
Overrides: _Named.dup

items (self)

 

Yield the items, each as a (name, value) pair (2-tuple).

See Also: Method .units.

iteritems (self)

 

Yield the items, each as a (name, value) pair (2-tuple).

See Also: Method .units.

iterunits (self, Error=<class 'pygeodesy.errors.UnitError'>)

 

Yield the items, each as a (name, value) pair (2-tuple) with the value wrapped as an instance of its units class.

Arguments:
  • Error - Error to raise for units issues (UnitError).
Raises:
  • Error - Invalid Named-Tuple item or units class.

See Also: Method .items.

toRepr (self, prec=6, sep=', ', fmt='F', **unused)

 

Return this Named-Tuple items as name=value string(s).

Arguments:
  • prec - The float precision, number of decimal digits (0..9). Trailing zero decimals are stripped for prec values of 1 and above, but kept for negative prec values.
  • sep - Separator to join (str).
  • fmt - Optional float format (letter).
Returns:
Tuple items (str).
Overrides: _Named.toRepr

toStr (self, prec=6, sep=', ', fmt='F', **unused)

 

Return this Named-Tuple items as string(s).

Arguments:
  • prec - The float precision, number of decimal digits (0..9). Trailing zero decimals are stripped for prec values of 1 and above, but kept for negative prec values.
  • sep - Separator to join (str).
  • fmt - Optional float format (letter).
Returns:
Tuple items (str).
Overrides: _Named.toStr

toUnits (self, Error=<class 'pygeodesy.errors.UnitError'>)

 

Return a copy of this Named-Tuple with each item value wrapped as an instance of its units class.

Arguments:
  • Error - Error to raise for units issues (UnitError).
Returns:
A duplicate of this Named-Tuple (Named-Tuple).
Raises:
  • Error - Invalid Named-Tuple item or units class.

units (self, Error=<class 'pygeodesy.errors.UnitError'>)

 

Yield the items, each as a (name, value) pair (2-tuple) with the value wrapped as an instance of its units class.

Arguments:
  • Error - Error to raise for units issues (UnitError).
Raises:
  • Error - Invalid Named-Tuple item or units class.

See Also: Method .items.