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

# Class _NamedTuple

    object --+
             |
         tuple --+
                 |
    object --+   |
             |   |
        _Named --+
                 |
                _NamedTuple

Known Subclasses:
  - ecef.EcefMatrix
  - , ellipsoids.a_f2Tuple
  - , albers.Albers7Tuple
  - , azimuthal.Azimuthal7Tuple
  - , deprecated.UtmUps4Tuple
  - , ellipsoids.Curvature2Tuple
  - , clipy.ClipCS3Tuple
  - , clipy.ClipSH3Tuple
  - , css.EasNorAziRk4Tuple
  - , css.LatLonAziRk4Tuple
  - , ecef.Ecef9Tuple
  - , elevations.Elevation2Tuple
  - , elevations.GeoidHeight2Tuple
  - , ellipsoidalNvector.Ned3Tuple
  - , elliptic.Elliptic3Tuple
  - , etm.EasNorExact4Tuple
  - , etm.LatLonExact4Tuple
  - , formy.Radical2Tuple
  - , frechet.Frechet6Tuple
  - , geoids.GeoidHeight5Tuple
  - , hausdorff.Hausdorff6Tuple
  - , mgrs.Mgrs4Tuple
  - , mgrs.Mgrs6Tuple
  - , namedTuples.Bearing2Tuple
  - , namedTuples.Bounds2Tuple
  - , namedTuples.Bounds4Tuple
  - , namedTuples.Destination2Tuple
  - , namedTuples.Destination3Tuple
  - , namedTuples.Distance2Tuple
  - , namedTuples.Distance3Tuple
  - , namedTuples.Distance4Tuple
  - , namedTuples.EasNor2Tuple
  - , namedTuples.EasNor3Tuple
  - , namedTuples.LatLon2Tuple
  - , namedTuples.LatLon3Tuple
  - , namedTuples.LatLon4Tuple
  - , namedTuples.LatLonDatum3Tuple
  - , namedTuples.LatLonPrec3Tuple
  - , namedTuples.LatLonPrec5Tuple
  - , namedTuples.NearestOn3Tuple
  - , namedTuples.PhiLam2Tuple
  - , namedTuples.PhiLam3Tuple
  - , namedTuples.PhiLam4Tuple
  - , namedTuples.Points2Tuple
  - , namedTuples.Trilaterate5Tuple
  - , namedTuples.Vector3Tuple
  - , namedTuples.Vector4Tuple
  - , points.NearestOn5Tuple
  - , points.Point3Tuple
  - , points.Shape2Tuple
  - , webmercator.EasNorRadius3Tuple
  - , utmupsBase.LatLonDatum5Tuple
  - , utmupsBase.UtmUps2Tuple
  - , utmupsBase.UtmUps5Tuple
  - , utmupsBase.UtmUps8Tuple
  - , utmupsBase.UtmUpsLatLon5Tuple

(INTERNAL) Base for named `tuple`s 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`. |
__getitem__(self, item) Get the value of an item by `name`. |
__repr__(self) Default `repr(self)`. |
__setattr__(self, name, value) Set attribute or item `name` to `value`. |
__str__(self) Default `repr(self)`. |
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=`'``,` `'`, **unused) Return this `Named-Tuple` items as `name=value` string(s). |
toStr(self, prec=6, sep=`'``,` `'`, **unused) Return this `Named-Tuple` items as string(s). |
toStr2(self, prec=6, sep=`'``,` `'`, **unused) DEPRECATED, use method `toRepr`. |
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__`, `__getnewargs__`, `__getslice__`, `__gt__`, `__hash__`, `__iter__`, `__le__`, `__len__`, `__lt__`, `__mul__`, `__ne__`, `__rmul__`, `count`, `index` Inherited from `_Named`: `_dot_`, `attrs`, `classof`, `copy` Inherited from `object`: `__format__`, `__init__`, `__reduce__`, `__reduce_ex__`, `__sizeof__`, `__subclasshook__`

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

Class Variables
| _Names_ = ``(``)`` Tuple specifying the `name` of each `Named-Tuple` item.
| _Units_ = ``(``)`` Tuple defining the `units` of the value of each `Named-Tuple` item.

Properties
| iteration Get the iteration number (`int` or `None` if not available/applicable).
Inherited from `_Named`: `classname`, `classnaming`, `name`, `named`, `named2`, `named3`, `named4` Inherited from `object`: `__class__`

Method Details

### __delattr__ (self, name) |
Delete an attribute by `name`. Overrides: object.__delattr__ Note: Items can not be deleted.

### __getitem__ (self, item) (Indexing operator) |
Get the value of an item by `name`. Overrides: tuple.__getitem__

### __new__ (cls, *args, **name_only) Static Method |
New _NamedTuple initialized with `positional` arguments. Arguments: `args` - Tuple items (`any`), all positional arguments. `name_only` - Only `name='name'` is used, anu other keyword arguments are silently ignored. Returns: a new object with type S, a subtype of T Raises: `LenError` - The number of positional arguments does not match the number of item names in the `_Names_` attribute. `TypeError` - The `_Names_` attribute is not a `tuple` of at least 2 item names. `ValueError` - Item name is not a `str`, `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__

### 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=`'``,` `'`, **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` - Optional separator to join (`str`). Returns: Tuple items (`str`). Overrides: _Named.toRepr

### toStr (self, prec=6, sep=`'``,` `'`, **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` - Optional separator to join (`str`). Returns: Tuple items (`str`). Overrides: _Named.toStr

### toStr2 (self, prec=6, sep=`'``,` `'`, **unused) |
DEPRECATED, use method `toRepr`. 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` - Optional separator to join (`str`). Returns: Tuple items (`str`). Overrides: _Named.toRepr

### 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`.

Class Variable Details

  ### _Names_ Tuple specifying the `name` of each `Named-Tuple` item. Note: Specify at least 2 item names. Value:
      ()

  ### _Units_ Tuple defining the `units` of the value of each `Named-Tuple` item. Note: The `len(_Units_)` must match `len(_Names_)`. Value:
      ()

Property Details

### iteration Get the iteration number (`int` or `None` if not available/applicable). Get method: iteration(self) - Get the iteration number (`int` or `None` if not available/applicable). Set method: immutable(inst, value) - Throws an `AttributeError`, always.