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

# Class _NamedTuple

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

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

(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` - 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__

### 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: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst)