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

# Class _NamedTuple

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

Known Subclasses:
  - ltpTuples._Abc4Tuple
  - , albers.Albers7Tuple
  - , karney.Area3Tuple
  - , ltpTuples.Attitude4Tuple
  - , azimuthal.Azimuthal7Tuple
  - , namedTuples.Bearing2Tuple
  - , namedTuples._NamedTupleTo
  - , namedTuples.Bounds2Tuple
  - , namedTuples.Bounds4Tuple
  - , ltpTuples.Local9Tuple
  - , ltpTuples.ChLVEN2Tuple
  - , ltpTuples.ChLVYX2Tuple
  - , ltpTuples.ChLVyx2Tuple
  - , vector2d.Circin6Tuple
  - , ellipsoids.Circle4Tuple
  - , vector2d.Circum3Tuple
  - , vector2d.Circum4Tuple
  - , clipy.ClipCS4Tuple
  - , clipy.ClipFHP4Tuple
  - , clipy.ClipLB6Tuple
  - , clipy.ClipSH3Tuple
  - , resections.Collins5Tuple
  - , ellipsoids.Curvature2Tuple
  - , namedTuples.Destination2Tuple
  - , namedTuples.Destination3Tuple
  - , karney._GTuple
  - , namedTuples.Distance2Tuple
  - , namedTuples.Distance3Tuple
  - , namedTuples.Distance4Tuple
  - , fsums.DivMod2Tuple
  - , namedTuples.EasNor2Tuple
  - , namedTuples.EasNor3Tuple
  - , css.EasNorAziRk4Tuple
  - , css.EasNorAziRkEqu6Tuple
  - , webmercator.EasNorRadius3Tuple
  - , ecef.Ecef9Tuple
  - , ecef.EcefMatrix
  - , elevations.Elevation2Tuple
  - , elliptic.Elliptic3Tuple
  - , ltpTuples.Footprint5Tuple
  - , namedTuples.Forward4Tuple
  - , frechet.Frechet6Tuple
  - , fsums.Fsum2Tuple
  - , elevations.GeoidHeight2Tuple
  - , geoids.GeoidHeight5Tuple
  - , hausdorff.Hausdorff6Tuple
  - , namedTuples.Intersection3Tuple
  - , namedTuples.LatLon2Tuple
  - , namedTuples.LatLon3Tuple
  - , css.LatLonAziRk4Tuple
  - , namedTuples.LatLonDatum3Tuple
  - , namedTuples.LatLonPrec3Tuple
  - , vector2d.Meeus2Tuple
  - , mgrs.Mgrs4Tuple
  - , mgrs.Mgrs6Tuple
  - , namedTuples.NearestOn2Tuple
  - , namedTuples.NearestOn3Tuple
  - , namedTuples.NearestOn6Tuple
  - , namedTuples.NearestOn8Tuple
  - , namedTuples.PhiLam2Tuple
  - , namedTuples.PhiLam3Tuple
  - , namedTuples.PhiLam4Tuple
  - , namedTuples.Point3Tuple
  - , namedTuples.Points2Tuple
  - , formy.Radical2Tuple
  - , vector2d.Radii11Tuple
  - , geohash.Resolutions2Tuple
  - , namedTuples.Reverse4Tuple
  - , points.Shape2Tuple
  - , vector2d.Soddy4Tuple
  - , resections.Survey3Tuple
  - , trf.TRFXform7Tuple
  - , resections.Tienstra7Tuple
  - , resections.TriAngle5Tuple
  - , resections.TriSide2Tuple
  - , resections.TriSide4Tuple
  - , namedTuples.Triangle7Tuple
  - , namedTuples.Triangle8Tuple
  - , namedTuples.Trilaterate5Tuple
  - , namedTuples.UtmUps2Tuple
  - , namedTuples.UtmUps5Tuple
  - , namedTuples.UtmUps8Tuple
  - , namedTuples.UtmUpsLatLon5Tuple
  - , ltpTuples.Uvw3Tuple
  - , namedTuples.Vector2Tuple
  - , namedTuples.Vector3Tuple
  - , namedTuples.Vector4Tuple
  - , ellipsoids.a_f2Tuple
  - , namedTuples.NearestOn5Tuple
  - , deprecated.classes._Deprecated_NamedTuple

(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`. |
__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) Yield the items, each as a `2-tuple (name, value`) with the value wrapped as an instance of its units class. |
reUnit(self, *Units, **name) Replace some of this `Named-Tuple`'s `Units`. |
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'>, **name) Return a copy of this `Named-Tuple` with each item value wrapped as an instance of its units class. |
units(self, **Error) Yield the items, each as a `2-tuple (name, value`) 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`, `renamed`, `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) |
Yield the items, each as a `2-tuple (name, value`) with the value wrapped as an instance of its units class. Arguments: `Error` - Optional `Error=UnitError` to raise for units issues. Raises: `Error` - Invalid `Named-Tuple` item or units class. See Also: Method `.items`.

### reUnit (self, *Units, **name) |
Replace some of this `Named-Tuple`'s `Units`. Arguments: `Units` - One or more `Unit` classes, all positional. `name` - Optional `name=NN` (`str`). Returns: This instance with updated `Units`. Note: This `Named-Tuple`'s values are not updated.

### 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'>, **name) |
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`). `name` - Optional `name=NN` (`str`). Returns: A duplicate of this `Named-Tuple` (``Named-Tuple``). Raises: `Error` - Invalid `Named-Tuple` item or units class.

### units (self, **Error) |
Yield the items, each as a `2-tuple (name, value`) with the value wrapped as an instance of its units class. Arguments: `Error` - Optional `Error=UnitError` to raise for units issues. Raises: `Error` - Invalid `Named-Tuple` item or units class. See Also: Method `.items`.