pygeodesy 24.5.2__py2.py3-none-any.whl → 24.5.8__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pygeodesy/interns.py CHANGED
@@ -151,7 +151,6 @@ _antipodal_ = 'antipodal' # PYCHOK OK
151
151
  _areaOf_ = 'areaOf' # PYCHOK OK
152
152
  _arg_ = 'arg' # PYCHOK OK
153
153
  # _ASTERISK_ = _STAR_ # PYCHOK OK
154
- _at_ = 'at' # PYCHOK OK
155
154
  _AT_ = Str_('@') # PYCHOK OK
156
155
  _AtoZnoIO_ = _Slicer('ABCDEFGHJKLMNPQRSTUVWXYZ') # PYCHOK in .gars, .mgrs and .wgrs
157
156
  _attribute_ = 'attribute' # PYCHOK OK
@@ -333,6 +332,7 @@ _null_ = 'null' # PYCHOK OK
333
332
  _number_ = 'number' # PYCHOK OK
334
333
  _numpy_ = 'numpy' # PYCHOK OK
335
334
  _Nv00_ = 'Nv00' # PYCHOK OK
335
+ _odd_ = 'odd' # PYCHOK OK
336
336
  _of_ = 'of' # PYCHOK OK
337
337
  _on_ = 'on' # PYCHOK OK
338
338
  _opposite_ = 'opposite' # PYCHOK OK
@@ -462,11 +462,14 @@ def _dunder_nameof(inst, *dflt):
462
462
  return dflt[0] if dflt else inst.__class__.__name__
463
463
 
464
464
 
465
- def _enquote(strs, quote=_QUOTE2_): # in .basics, .solveBase
466
- '''(INTERNAL) Enquote a string containing whitespace.
465
+ def _enquote(strs, quote=_QUOTE2_, white=NN): # in .basics, .solveBase
466
+ '''(INTERNAL) Enquote a string containing whitespace or replace
467
+ whitespace by C{white} if specified.
467
468
  '''
468
- if len(strs.split()) > 1:
469
- strs = NN(quote, strs, quote)
469
+ if strs:
470
+ t = strs.split()
471
+ if len(t) > 1:
472
+ strs = white.join(t if white else (quote, strs, quote))
470
473
  return strs
471
474
 
472
475
 
@@ -645,7 +648,7 @@ def _version_ints(vs):
645
648
  __all__ = (_NN_, # not MISSING!
646
649
  Str_.__name__, # classes
647
650
  machine.__name__) # in .lazily
648
- __version__ = '24.03.20'
651
+ __version__ = '24.05.08'
649
652
 
650
653
  if __name__ == '__main__':
651
654
 
pygeodesy/named.py CHANGED
@@ -20,7 +20,7 @@ from pygeodesy.errors import _AssertionError, _AttributeError, _incompatible, \
20
20
  _NameError, _NotImplementedError, _TypeError, \
21
21
  _TypesError, UnitError, _ValueError, _xattr, _xkwds, \
22
22
  _xkwds_get, _xkwds_item2, _xkwds_pop2
23
- from pygeodesy.interns import MISSING, NN, _at_, _AT_, _COLON_, _COLONSPACE_, _COMMA_, \
23
+ from pygeodesy.interns import MISSING, NN, _AT_, _COLON_, _COLONSPACE_, _COMMA_, \
24
24
  _COMMASPACE_, _doesn_t_exist_, _DOT_, _DUNDER_, _EQUAL_, \
25
25
  _exists_, _immutable_, _name_, _NL_, _NN_, _no_, _other_, \
26
26
  _s_, _SPACE_, _std_, _UNDER_, _valid_, _vs_, \
@@ -32,7 +32,7 @@ from pygeodesy.props import _allPropertiesOf_n, deprecated_method, _hasProperty,
32
32
  from pygeodesy.streprs import attrs, Fmt, lrstrip, pairs, reprs, unstr
33
33
 
34
34
  __all__ = _ALL_LAZY.named
35
- __version__ = '24.04.07'
35
+ __version__ = '24.05.04'
36
36
 
37
37
  _COMMANL_ = _COMMA_ + _NL_
38
38
  _COMMASPACEDOT_ = _COMMASPACE_ + _DOT_
@@ -48,10 +48,16 @@ _Units_ = '_Units_'
48
48
  _UP = 2
49
49
 
50
50
 
51
- def _xjoined_(prefix, name):
51
+ def _xjoined_(prefix, name, enquote=True):
52
52
  '''(INTERNAL) Join C{pref} and non-empty C{name}.
53
53
  '''
54
- return _SPACE_(prefix, repr(name)) if name and prefix else (prefix or name)
54
+ if name and prefix:
55
+ if enquote:
56
+ name = repr(name)
57
+ n = _SPACE_(prefix, name)
58
+ else:
59
+ n = prefix or name
60
+ return n
55
61
 
56
62
 
57
63
  def _xnamed(inst, name, force=False):
@@ -192,7 +198,7 @@ class _Named(object):
192
198
  def __repr__(self):
193
199
  '''Default C{repr(self)}.
194
200
  '''
195
- return Fmt.ANGLE(_SPACE_(self, _at_, hex(id(self))))
201
+ return Fmt.repr_at(self)
196
202
 
197
203
  def __rmatmul__(self, other): # PYCHOK no cover
198
204
  '''Not implemented.'''
@@ -360,9 +366,15 @@ class _Named(object):
360
366
  '''
361
367
  return self.name or self.classname
362
368
 
369
+ # @Property_RO
370
+ # def named_(self):
371
+ # '''Get the C{class} name I{and/or} the str(name) or C{""} (C{str}).
372
+ # '''
373
+ # return _xjoined_(self.classname, self.name, enquote=False)
374
+
363
375
  @Property_RO
364
376
  def named2(self):
365
- '''Get the C{class} name I{and/or} the name or C{""} (C{str}).
377
+ '''Get the C{class} name I{and/or} the repr(name) or C{""} (C{str}).
366
378
  '''
367
379
  return _xjoined_(self.classname, self.name)
368
380
 
pygeodesy/props.py CHANGED
@@ -25,7 +25,7 @@ from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS, \
25
25
  from functools import wraps as _wraps
26
26
 
27
27
  __all__ = _ALL_LAZY.props
28
- __version__ = '24.03.06'
28
+ __version__ = '24.05.03'
29
29
 
30
30
  _class_ = 'class'
31
31
  _dont_use_ = _DEPRECATED_ + ", don't use."
@@ -36,9 +36,9 @@ _method_ = 'method'
36
36
  _not_an_inst_ = _not_(_an_, 'instance')
37
37
 
38
38
 
39
- def _allPropertiesOf(Clas_or_inst, *Bases):
39
+ def _allPropertiesOf(Clas_or_inst, *Bases, **excls):
40
40
  '''(INTERNAL) Yield all C{R/property/_RO}s at C{Clas_or_inst}
41
- as specified in the C{Bases} arguments.
41
+ as specified in the C{Bases} arguments, except C{excls}.
42
42
  '''
43
43
  if _isclass(Clas_or_inst):
44
44
  S = Clas_or_inst, # just this Clas
@@ -48,17 +48,18 @@ def _allPropertiesOf(Clas_or_inst, *Bases):
48
48
  except AttributeError:
49
49
  raise
50
50
  S = () # not an inst
51
- B = Bases or _PropertyBase
51
+ B = Bases or _PropertyBase
52
+ _is = isinstance
52
53
  for C in S:
53
54
  for n, p in C.__dict__.items():
54
- if isinstance(p, B) and p.name == n:
55
+ if _is(p, B) and p.name == n and n not in excls:
55
56
  yield p
56
57
 
57
58
 
58
- def _allPropertiesOf_n(n, Clas_or_inst, *Bases):
59
+ def _allPropertiesOf_n(n, Clas_or_inst, *Bases, **excls):
59
60
  '''(INTERNAL) Assert the number of C{R/property/_RO}s at C{Clas_or_inst}.
60
61
  '''
61
- t = tuple(p.name for p in _allPropertiesOf(Clas_or_inst, *Bases))
62
+ t = tuple(p.name for p in _allPropertiesOf(Clas_or_inst, *Bases, **excls))
62
63
  if len(t) != n:
63
64
  raise _AssertionError(_COMMASPACE_.join(t), Clas_or_inst,
64
65
  txt=_COMMASPACE_(len(t), _not_(n)))
pygeodesy/streprs.py CHANGED
@@ -21,8 +21,9 @@ from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS
21
21
  from math import fabs, log10 as _log10
22
22
 
23
23
  __all__ = _ALL_LAZY.streprs
24
- __version__ = '24.04.28'
24
+ __version__ = '24.05.04'
25
25
 
26
+ _at_ = 'at' # PYCHOK used!
26
27
  _EN_PREC = 6 # max MGRS/OSGR precision, 1 micrometer
27
28
  _EN_WIDE = 5 # number of MGRS/OSGR units, log10(_100km)
28
29
  _OKd_ = '._-' # acceptable name characters
@@ -43,8 +44,8 @@ class _Fmt(str):
43
44
  for n, v in name_value.items():
44
45
  break
45
46
  else:
46
- n, v = name_value_[:2] if len(name_value_) > 1 else (NN,
47
- (name_value_[0] if name_value_ else MISSING))
47
+ n, v = name_value_[:2] if len(name_value_) > 1 else \
48
+ (NN, (name_value_ or MISSING))
48
49
  t = str.__mod__(self, v)
49
50
  return NN(n, t) if n else t
50
51
 
@@ -175,6 +176,11 @@ class Fmt(object):
175
176
  t = t.replace(_tolerance_, _threshold_)
176
177
  return _no_(t)
177
178
 
179
+ def repr_at(self, inst, text=NN):
180
+ '''Return a C{repr} string C{"<B{text} at B{hex_id}>"}.
181
+ '''
182
+ return self.ANGLE(_SPACE_((text or inst), _at_, hex(id(inst))))
183
+
178
184
  Fmt = Fmt() # PYCHOK singleton
179
185
  Fmt.__name__ = Fmt.__class__.__name__
180
186
 
@@ -288,7 +294,7 @@ def _enstr2m3(estr, nstr, wide=_EN_WIDE): # in .mgrs, .osgr
288
294
  return e, n, m
289
295
 
290
296
 
291
- def fstr(floats, prec=6, fmt=Fmt.F, ints=False, sep=_COMMASPACE_, strepr=None):
297
+ def fstr(floats, prec=6, fmt=Fmt.F, ints=False, sep=_COMMASPACE_, strepr=None, force=True):
292
298
  '''Convert one or more floats to string, optionally stripped of trailing zero decimals.
293
299
 
294
300
  @arg floats: Single or a list, sequence, tuple, etc. (C{scalar}s).
@@ -302,15 +308,18 @@ def fstr(floats, prec=6, fmt=Fmt.F, ints=False, sep=_COMMASPACE_, strepr=None):
302
308
  @kwarg ints: Optionally, remove the decimal dot for C{int} values (C{bool}).
303
309
  @kwarg sep: Separator joining the B{C{floats}} (C{str}).
304
310
  @kwarg strepr: Optional callable to format non-C{floats} (typically
305
- C{repr}, C{str}) or C{None} to raise a TypeError.
311
+ C{repr}, C{str}) or C{None} to raise a TypeError and used
312
+ only if C{B{force} is not True}.
313
+ @kwarg force: If C{True} format all B{C{floats}} using B{C{fmt}},
314
+ otherwise use B{C{strepr}} for non-C{floats}.
306
315
 
307
316
  @return: The C{sep.join(strs(floats, ...)} joined (C{str}) or single
308
317
  C{strs((floats,), ...)} (C{str}) if B{C{floats}} is C{scalar}.
309
318
  '''
310
319
  if isscalar(floats): # see Fstr.__call__ above
311
- return next(_streprs(prec, (floats,), fmt, ints, True, strepr))
320
+ return next(_streprs(prec, (floats,), fmt, ints, force, strepr))
312
321
  else:
313
- return sep.join(_streprs(prec, floats, fmt, ints, True, strepr))
322
+ return sep.join(_streprs(prec, floats, fmt, ints, force, strepr))
314
323
 
315
324
 
316
325
  def _fstrENH2(inst, prec, m, fmt=Fmt.F): # in .css, .lcc, .utmupsBase
pygeodesy/vector2d.py CHANGED
@@ -30,7 +30,7 @@ from contextlib import contextmanager
30
30
  # from math import fabs, sqrt # from .fmath
31
31
 
32
32
  __all__ = _ALL_LAZY.vector2d
33
- __version__ = '24.04.18'
33
+ __version__ = '24.05.04'
34
34
 
35
35
  _cA_ = 'cA'
36
36
  _cB_ = 'cB'
@@ -663,7 +663,7 @@ def _trilaterate2d2(x1, y1, radius1, x2, y2, radius2, x3, y3, radius3,
663
663
  return t
664
664
 
665
665
 
666
- def _trilaterate3d2(c1, r1, c2, r2, c3, r3, eps=EPS, coin=False,
666
+ def _trilaterate3d2(c1, r1, c2, r2, c3, r3, eps=EPS4, coin=False,
667
667
  **clas_Vector_and_kwds):
668
668
  # (INTERNAL) Intersect three spheres or circles, see function
669
669
  # L{pygeodesy.trilaterate3d2}, separated to allow callers to
pygeodesy/vector3d.py CHANGED
@@ -301,7 +301,7 @@ class Vector3d(Vector3dBase):
301
301
  '''
302
302
  return _MODS.vector2d.soddy4(self, point2, point3, eps=eps, useZ=True)
303
303
 
304
- def trilaterate2d2(self, radius, center2, radius2, center3, radius3, eps=EPS, z=INT0):
304
+ def trilaterate2d2(self, radius, center2, radius2, center3, radius3, eps=EPS4, z=INT0):
305
305
  '''Trilaterate this and two other circles, each given as a (2-D) center
306
306
  and a radius.
307
307
 
@@ -344,7 +344,7 @@ class Vector3d(Vector3dBase):
344
344
  center2=center2, radius2=radius2,
345
345
  center3=center3, radius3=radius3)
346
346
 
347
- def trilaterate3d2(self, radius, center2, radius2, center3, radius3, eps=EPS):
347
+ def trilaterate3d2(self, radius, center2, radius2, center3, radius3, eps=EPS4):
348
348
  '''Trilaterate this and two other spheres, each given as a (3-D) center
349
349
  and a radius.
350
350