Coverage for pygeodesy / interns.py: 99%

353 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-07-26 22:05 -0400

1# -*- coding: utf-8 -*- 

2 

3u'''Single C{str}ing constants, C{intern}'ed across C{pygeodesy} 

4modules and function L{pygeodesy.machine}. 

5''' 

6import sys as _sys # in .internals, .lazily 

7try: 

8 _intern = intern # PYCHOK in .lazily, .trf 

9except NameError: # Python 3+ 

10 _intern = _sys.intern 

11 

12_COMMASPACE_ = ', ' # overriden below 

13_SUB_PACKAGES = 'auxilats', 'deprecated', 'geodesicx', 'rhumb', 'triaxials' # PYCHOK in ... 

14# ... .lazily, make._dist, MANIFEST, setup.setup, test/bases, test/testModules 

15 

16 

17class _Dash(str): 

18 '''(INTERNAL) Extended C{str} for prefix_DASH_. 

19 ''' 

20 def __call__(self, *args): 

21 '''Join C{self} plus all B{C{args}} like C{'-'.join((self,) + B{args})}. 

22 ''' 

23 return _DASH_(self, *args) # re-callable 

24 

25 

26class _Int(int): 

27 '''(INTERNAL) Unique C{int}. 

28 ''' 

29 pass 

30 

31 

32class Str_(str): 

33 '''Extended, I{callable} C{str} class, not nameable. 

34 

35 @see: Nameable and callable class L{Str<pygeodesy.unitsBase.Str>}. 

36 ''' 

37 def join_(self, *args): 

38 '''Join all positional B{C{args}} like C{self.join(B{args})}. 

39 

40 @return: All B{C{args}} joined by this instance (L{Str_}). 

41 

42 @note: An other L{Str_} instance is returned to make the 

43 result re-callable. 

44 ''' 

45 return Str_(str.join(self, map(str, args))) # re-callable 

46 

47 __call__ = join_ 

48 

49NN = Str_('') # PYCHOK Nomen Nescio <https://Wiktionary.org/wiki/N.N.> 

50 

51 

52class _Prefix(Str_): 

53 '''(INTERNAL) Extended C{str} for prefix. 

54 ''' 

55 def __call__(self, *args): 

56 '''Join C{self} plus all B{C{args}} like C{" ".join((self,) + B{args})}. 

57 ''' 

58 return _SPACE_.join_(self, *args) # re-callable 

59 

60 

61class _PyPy__(str): # overwritten by singleton below 

62 '''(INTERNAL) Extended C{str} for C{"PyPy"} and version. 

63 ''' 

64 def __call__(self, version=NN): 

65 '''Return C{"PyPy <version>"} or C{NN}. 

66 ''' 

67 v = version or _sys.version 

68 if _PyPy__ in v: 

69 v = v.split(_PyPy__)[1].split(None, 1)[0] # == _DOT_.join(_sys.pypy_version_info[:3]) 

70 return NN(_PyPy__, v) 

71 else: 

72 return NN 

73 

74 

75class _Python_(str): # overwritten by singleton below 

76 '''(INTERNAL) Extended C{str} for C{"Python"} and version. 

77 ''' 

78 def __call__(self, version=NN): 

79 '''Return C{"Python <version>"}. 

80 ''' 

81 v = version or _sys.version 

82 return _SPACE_(self, v.split(None, 1)[0]) 

83 

84 

85class _Range(str): 

86 '''(INTERNAL) Extended C{str} for C{range} strings. 

87 ''' 

88 def __call__(self, lo, hi, lopen=False, ropen=False, 

89 prec=0, sep=_COMMASPACE_): 

90 '''Return the range as C{"(lo, hi)"}, C{"(lo, hi]"}, 

91 C{"[lo, hi)"} or C{"[lo, hi]"}. 

92 ''' 

93 from pygeodesy.streprs import Fmt 

94 r = NN(Fmt.f(lo, prec=prec), sep, 

95 Fmt.f(hi, prec=prec)) 

96 f = (Fmt.PAREN if ropen else Fmt.LOPEN) if lopen else \ 

97 (Fmt.ROPEN if ropen else Fmt.SQUARE) 

98 return f(r) 

99 

100 

101class _Slicer(str): 

102 '''(INTERNAL) String slicer C{.fromX} or C{.tillY}. 

103 ''' 

104 def __getattr__(self, name): # .fromX, .tillY 

105 n = len(name) - 4 

106 if n > 0: 

107 # assert len('till') == len(_from_) == 4 

108 if name.startswith('till'): 

109 i = self.find(name[4:]) 

110 return self if i < 0 else _Slicer(self[:i + n]) 

111 elif name.startswith(_from_): 

112 i = self.find(name[4:]) 

113 return self if i < 0 else _Slicer(self[i:]) 

114 return str.__getattr__(self, name) # PYCHOK no cover 

115 

116 

117class MISSING(object): 

118 '''(INTERNAL) Singleton C{str}. 

119 ''' 

120 def __init__(self): 

121 self.__name__ = type(self).__name__ 

122 

123 def toRepr(self, **unused): 

124 return type(self).__name__ 

125 

126 __repr__ = __str__ = toStr = toRepr 

127 

128MISSING = MISSING() # PYCHOK singleton 

129 

130# __DUNDER__-style names would get mangled in classes 

131_0_ = '0' # PYCHOK 'zero' 

132_0to9_ = '0123456789' # PYCHOK OK 

133_1_ = '1' # PYCHOK OK 

134_2_ = '2' # PYCHOK OK 

135_3_ = '3' # PYCHOK OK 

136_4_ = '4' # PYCHOK OK 

137_a_ = 'a' # PYCHOK OK 

138_A_ = 'A' # PYCHOK OK 

139_a12_ = 'a12' # PYCHOK OK 

140_area_ = 'area' # PYCHOK OK 

141_Airy1830_ = 'Airy1830' # PYCHOK OK 

142_AiryModified_ = 'AiryModified' # PYCHOK OK 

143_ambiguous_ = 'ambiguous' # PYCHOK OK 

144_AMPERSAND_ = Str_('&') # PYCHOK OK 

145_an_ = 'an' # PYCHOK OK 

146_and_ = 'and' # PYCHOK OK 

147# _AND_ = _AMPERSAND_ # PYCHOK OK 

148_angle_ = 'angle' # PYCHOK OK 

149_antipodal_ = 'antipodal' # PYCHOK OK 

150_arg_ = 'arg' # PYCHOK OK 

151# _ASTERISK_ = _STAR_ # PYCHOK OK 

152_AT_ = Str_('@') # PYCHOK OK 

153_AtoZnoIO_ = _Slicer('ABCDEFGHJKLMNPQRSTUVWXYZ') # PYCHOK in .gars, .mgrs and .wgrs 

154_attribute_ = 'attribute' # PYCHOK OK 

155_azi1_ = 'azi1' # PYCHOK OK 

156_azi12_ = 'azi12' # PYCHOK OK 

157_azi2_ = 'azi2' # PYCHOK OK 

158_azimuth_ = 'azimuth' # PYCHOK OK 

159_b_ = 'b' # PYCHOK OK 

160_B_ = 'B' # PYCHOK OK 

161_BACKSLASH_ = Str_('\\') # PYCHOK OK 

162_band_ = 'band' # PYCHOK OK 

163_BANG_ = Str_('!') # PYCHOK OK 

164_BAR_ = Str_('|') # PYCHOK OK 

165_bearing_ = 'bearing' # PYCHOK OK 

166_Bessel1841_ = 'Bessel1841' # PYCHOK OK 

167_beta_ = 'beta' # PYCHOK OK 

168_by_ = 'by' # PYCHOK OK 

169_c_ = 'c' # PYCHOK OK 

170_C_ = 'C' # PYCHOK OK 

171_cartesian_ = 'cartesian' # PYCHOK OK 

172_center_ = 'center' # PYCHOK OK 

173# _CIRCUMFLEX_ = Str_('^') # PYCHOK OK 

174_Clarke1866_ = 'Clarke1866' # PYCHOK OK 

175_Clarke1880IGN_ = 'Clarke1880IGN' # PYCHOK OK 

176_clip_ = 'clip' # PYCHOK OK 

177_clipid_ = 'clipid' # PYCHOK OK 

178_coincident_ = 'coincident' # PYCHOK OK 

179_colinear_ = 'colinear' # PYCHOK OK 

180_COLON_ = Str_(':') # PYCHOK OK 

181_COLONSPACE_ = Str_(': ') # PYCHOK OK 

182_COMMA_ = Str_(',') # PYCHOK OK 

183_COMMASPACE_ = Str_(_COMMASPACE_) # PYCHOK OK 

184_composite_ = 'composite' # PYCHOK OK 

185_concentric_ = 'concentric' # PYCHOK OK 

186_convergence_ = _Prefix('convergence') # PYCHOK OK 

187_conversion_ = 'conversion' # PYCHOK OK 

188_convex_ = 'convex' # PYCHOK OK 

189_d_ = 'd' # PYCHOK OK 

190_D_ = 'D' # PYCHOK OK 

191_DALL_ = '__all__' # PYCHOK _DUNDER_(NN, 'all', NN) 

192_DASH_ = Str_('-') # PYCHOK == _MINUS_ 

193_datum_ = 'datum' # PYCHOK OK 

194_decode3_ = 'decode3' # PYCHOK OK 

195_deg_ = 'deg' # PYCHOK OK 

196_degrees_ = 'degrees' # PYCHOK OK 

197_degrees2_ = 'degrees2' # PYCHOK SQUARED 

198_delta_ = 'delta' # PYCHOK OK 

199_DEPRECATED_ = 'DEPRECATED' # PYCHOK OK 

200_DEQUALSPACED_ = Str_(' == ') # PYCHOK OK 

201_distance_ = 'distance' # PYCHOK OK 

202_distant_ = _Prefix('distant') # PYCHOK OK 

203_DMAIN_ = '__main__' # PYCHOK _DUNDER_(NN, 'main', NN) 

204_DNAME_ = '__name__' # PYCHOK _DUNDER_(NN, _name_, NN) 

205_doesn_t_exist_ = "doesn't exist" # PYCHOK OK 

206_DOT_ = Str_('.') # PYCHOK OK 

207_duplicate_ = 'duplicate' # PYCHOK OK 

208_e_ = 'e' # PYCHOK OK 

209_E_ = 'E' # PYCHOK OK 

210_earth_ = 'earth' # PYCHOK OK 

211_easting_ = 'easting' # PYCHOK OK 

212_ecef_ = 'ecef' # PYCHOK OK 

213_ED50_ = 'ED50' # PYCHOK Intl1924 

214_edge_ = 'edge' # PYCHOK OK 

215_elevation_ = 'elevation' # PYCHOK OK 

216_ELLIPSIS_ = Str_('...') # PYCHOK OK 

217_ELLIPSIS4_ = Str_('....') # PYCHOK OK 

218# _ELLIPSISPACED_ = Str_(' ... ') # PYCHOK <https://www.ThePunctuationGuide.com/ellipses.html> 

219_ellipsoid_ = 'ellipsoid' # PYCHOK OK 

220_ellipsoidal_ = 'ellipsoidal' # PYCHOK OK 

221_encode_ = 'encode' # PYCHOK OK 

222_end_ = 'end' # PYCHOK OK 

223_epoch_ = 'epoch' # PYCHOK OK 

224_EQUAL_ = Str_('=') # PYCHOK OK 

225_EQUALSPACED_ = Str_(' = ') # PYCHOK OK 

226_Error_ = 'Error' # PYCHOK OK 

227_exceed_PI_radians_ = 'exceed PI radians' # PYCHOK OK 

228_exceeds_ = _Prefix('exceeds') # PYCHOK OK 

229# _EXCLAMATION_ = _BANG_ # PYCHOK OK 

230_exists_ = 'exists' # PYCHOK OK 

231_f_ = 'f' # PYCHOK OK 

232_F_ = 'F' # PYCHOK OK 

233_feet_ = 'feet' # PYCHOK OK 

234_few_ = 'few' # PYCHOK OK 

235_fi_ = 'fi' # PYCHOK OK 

236_finite_ = 'finite' # PYCHOK OK 

237_from_ = 'from' # PYCHOK OK 

238_g_ = 'g' # PYCHOK OK 

239_gamma_ = 'gamma' # PYCHOK OK 

240_GRS80_ = 'GRS80' # PYCHOK OK 

241_h_ = 'h' # PYCHOK OK 

242_H_ = 'H' # PYCHOK OK 

243_HASH_ = '#' # PYCHOK OK 

244_height_ = 'height' # PYCHOK OK 

245_hemipole_ = 'hemipole' # PYCHOK OK 

246_i_ = 'i' # PYCHOK OK 

247_immutable_ = 'immutable' # PYCHOK OK 

248_in_ = 'in' # PYCHOK OK 

249_incompatible_ = 'incompatible' # PYCHOK OK 

250_INF_ = 'INF' # PYCHOK OK 

251_infinite_ = 'infinite' # PYCHOK _not_finite_ 

252_initial_ = 'initial' # PYCHOK OK 

253_inside_ = 'inside' # PYCHOK OK 

254_insufficient_ = 'insufficient' # PYCHOK OK 

255_intersection_ = 'intersection' # PYCHOK OK 

256_Intl1924_ = 'Intl1924' # PYCHOK OK 

257_INV_ = 'INV' # PYCHOK INValid 

258_invalid_ = 'invalid' # PYCHOK OK 

259_invokation_ = 'invokation' # PYCHOK OK 

260_j_ = 'j' # PYCHOK OK 

261_k0_ = 'k0' # PYCHOK OK 

262_keyword_ = 'keyword' # PYCHOK OK 

263_kind_ = 'kind' # PYCHOK OK 

264_Krassovski1940_ = 'Krassovski1940' # PYCHOK OK 

265_Krassowsky1940_ = 'Krassowsky1940' # PYCHOK OK 

266_LANGLE_ = '<' # PYCHOK OK 

267_lam_ = 'lam' # PYCHOK OK 

268_lat_ = 'lat' # PYCHOK OK 

269_lat0_ = 'lat0' # PYCHOK OK 

270_lat1_ = 'lat1' # PYCHOK OK 

271_lat2_ = 'lat2' # PYCHOK OK 

272_latlon_ = 'latlon' # PYCHOK OK 

273_LatLon_ = 'LatLon' # PYCHOK OK 

274_LCURLY_ = '{' # PYCHOK LBRACE 

275_len_ = 'len' # PYCHOK OK 

276_limit_ = 'limit' # PYCHOK OK 

277_line_ = 'line' # PYCHOK OK 

278_LPAREN_ = '(' # PYCHOK OK 

279_lon_ = 'lon' # PYCHOK OK 

280_lon0_ = 'lon0' # PYCHOK OK 

281_lon1_ = 'lon1' # PYCHOK OK 

282_lon2_ = 'lon2' # PYCHOK OK 

283_low_ = 'low' # PYCHOK OK 

284_LSQUARE_ = '[' # PYCHOK LBRACK 

285_ltp_ = 'ltp' # PYCHOK OK 

286_m_ = 'm' # PYCHOK OK 

287_M_ = 'M' # PYCHOK OK 

288_m12_ = 'm12' # PYCHOK OK 

289_M12_ = 'M12' # PYCHOK OK 

290_M21_ = 'M21' # PYCHOK OK 

291_MANT_DIG_ = 'MANT_DIG' # PYCHOK OK 

292_MAX_ = 'MAX' # PYCHOK OK 

293_mean_ = 'mean' # PYCHOK OK 

294_meanOf_ = 'meanOf' # PYCHOK OK 

295_meridional_ = 'meridional' # PYCHOK OK 

296_meter_ = 'meter' # PYCHOK OK 

297_meter2_ = 'meter2' # PYCHOK SQUARED 

298_MGRS_ = 'MGRS' # PYCHOK OK 

299_MIN_ = 'MIN' # PYCHOK OK 

300_MINUS_ = _DASH_ # PYCHOK OK 

301_module_ = 'module' # PYCHOK OK 

302_n_ = 'n' # PYCHOK OK 

303_N_ = 'N' # PYCHOK OK 

304_n_a_ = 'n/a' # PYCHOK OK 

305_N_A_ = 'N/A' # PYCHOK OK 

306_NAD27_ = 'NAD27' # PYCHOK OK 

307_NAD83_ = 'NAD83' # PYCHOK OK 

308_name_ = 'name' # PYCHOK OK 

309_NAN_ = 'NAN' # PYCHOK OK 

310_near_ = _Dash('near') # PYCHOK OK 

311_nearestOn2_ = 'nearestOn2' # PYCHOK OK 

312_negative_ = 'negative' # PYCHOK OK 

313_NL_ = Str_('\n') # PYCHOK OK 

314_NLATvar_ = Str_(_NL_ + '@var ') # PYCHOK OK 

315_NLHASH_ = Str_(_NL_ + '# ') # PYCHOK OK 

316_NN_ = 'NN' # PYCHOK OK 

317_no_ = _Prefix('no') # PYCHOK OK 

318_northing_ = 'northing' # PYCHOK OK 

319_not_ = _Prefix('not') # PYCHOK OK 

320_NOTEQUAL_ = _BANG_ + _EQUAL_ # PYCHOK OK 

321_not_finite_ = 'not finite' # PYCHOK _not_(_finite_), _infinite_ 

322_not_scalar_ = 'not scalar' # PYCHOK _not_(_scalar_) 

323_NTF_ = 'NTF' # PYCHOK OK 

324_null_ = 'null' # PYCHOK OK 

325_number_ = 'number' # PYCHOK OK 

326_numpy_ = 'numpy' # PYCHOK OK 

327_Nv00_ = 'Nv00' # PYCHOK OK 

328_odd_ = 'odd' # PYCHOK OK 

329_of_ = 'of' # PYCHOK OK 

330_on_ = 'on' # PYCHOK OK 

331_opposite_ = 'opposite' # PYCHOK OK 

332_or_ = 'or' # PYCHOK OK 

333_other_ = 'other' # PYCHOK OK 

334_outside_ = 'outside' # PYCHOK OK 

335_overlap_ = 'overlap' # PYCHOK OK 

336_parallel_ = 'parallel' # PYCHOK OK 

337_PERCENT_ = '%' # PYCHOK OK 

338_PERCENTDOTSTAR_ = '%.*' # PYCHOK _DOT_(_PERCENT_, _STAR_) 

339_phi_ = 'phi' # PYCHOK OK 

340_PLUS_ = Str_('+') # PYCHOK OK 

341_PLUSMINUS_ = _PLUS_ + _MINUS_ # PYCHOK OK 

342_point_ = 'point' # PYCHOK OK 

343_points_ = 'points' # PYCHOK OK 

344_pole_ = 'pole' # PYCHOK OK 

345_precision_ = 'precision' # PYCHOK OK 

346_prime_vertical_ = 'prime_vertical' # PYCHOK OK 

347_pygeodesy_ = 'pygeodesy' # PYCHOK OK # in test/bases 

348_pygeodesy_abspath_ = 'pygeodesy_abspath' # PYCHOK OK 

349_PyPy__ = _PyPy__('PyPy ') # PYCHOK + _SPACE_ 

350_Python_ = _Python_('Python') # PYCHOK singleton 

351_python_ = 'python' # PYCHOK OK 

352_QUOTE1_ = "'" # PYCHOK OK 

353_QUOTE2_ = '"' # PYCHOK OK 

354_QUOTE3_ = "'''" # PYCHOK OK 

355# _QUOTE6_ = '"""' # PYCHOK OK 

356_R_ = 'R' # PYCHOK OK 

357_radians_ = 'radians' # PYCHOK OK 

358_radians2_ = 'radians2' # PYCHOK SQUARED 

359_radius_ = 'radius' # PYCHOK OK 

360_radius1_ = 'radius1' # PYCHOK OK 

361_radius2_ = 'radius2' # PYCHOK OK 

362_range_ = _Range('range') # PYCHOK OK 

363_RANGLE_ = '>' # PYCHOK OK 

364_RCURLY_ = '}' # PYCHOK RBRACE 

365_reciprocal_ = 'reciprocal' # PYCHOK OK 

366_reframe_ = 'reframe' # PYCHOK OK 

367_resolution_ = 'resolution' # PYCHOK OK 

368_rIn_ = 'rIn' # PYCHOK OK 

369_RPAREN_ = ')' # PYCHOK OK 

370_RSQUARE_ = ']' # PYCHOK RBRACK 

371_s_ = 's' # PYCHOK OK 

372_S_ = 'S' # PYCHOK OK 

373_s12_ = 's12' # PYCHOK OK 

374_S12_ = 'S12' # PYCHOK OK 

375_scalar_ = 'scalar' # PYCHOK OK 

376_scale_ = 'scale' # PYCHOK OK 

377_scale0_ = 'scale0' # PYCHOK OK 

378_scipy_ = 'scipy' # PYCHOK OK 

379_semi_circular_ = 'semi-circular' # PYCHOK OK 

380_sep_ = 'sep' # PYCHOK OK 

381_singular_ = 'singular' # PYCHOK OK 

382_SLASH_ = Str_('/') # PYCHOK OK 

383_small_ = 'small' # PYCHOK OK 

384_Sphere_ = 'Sphere' # PYCHOK OK 

385_spherical_ = 'spherical' # PYCHOK OK 

386_SPACE_ = Str_(' ') # PYCHOK OK 

387_specified_ = 'specified' # PYCHOK OK 

388_STAR_ = Str_('*') # PYCHOK OK 

389_start_ = 'start' # PYCHOK OK 

390_std_ = 'std' # PYCHOK OK 

391_stdev_ = 'stdev' # PYCHOK OK 

392_tbd_ = 'tbd' # PYCHOK OK 

393_TILDE_ = '~' # PYCHOK OK 

394_to_ = 'to' # PYCHOK OK 

395_tolerance_ = _Prefix('tolerance') # PYCHOK OK 

396_too_ = _Prefix('too') # PYCHOK OK 

397_transform_ = 'transform' # PYCHOK OK 

398_UNDER_ = Str_('_') # PYCHOK OK 

399_units_ = 'units' # PYCHOK OK 

400_UNUSED_ = 'UNUSED' # PYCHOK OK 

401_up_ = 'up' # PYCHOK OK 

402_UPS_ = 'UPS' # PYCHOK OK 

403_utf_8_ = 'utf-8' # PYCHOK OK 

404_UTM_ = 'UTM' # PYCHOK OK 

405_V_ = 'V' # PYCHOK OK 

406_valid_ = 'valid' # PYCHOK OK 

407_value_ = 'value' # PYCHOK OK 

408_version_ = 'version' # PYCHOK OK 

409_vs_ = 'vs' # PYCHOK OK 

410_W_ = 'W' # PYCHOK OK 

411_WGS72_ = 'WGS72' # PYCHOK OK 

412_WGS84_ = 'WGS84' # PYCHOK OK 

413_width_ = 'width' # PYCHOK OK 

414_with_ = 'with' # PYCHOK OK 

415_x_ = 'x' # PYCHOK OK 

416_X_ = 'X' # PYCHOK OK 

417_xyz_ = 'xyz' # PYCHOK OK 

418_y_ = 'y' # PYCHOK OK 

419_Y_ = 'Y' # PYCHOK OK 

420_z_ = 'z' # PYCHOK OK 

421_Z_ = 'Z' # PYCHOK OK 

422_zone_ = 'zone' # PYCHOK OK 

423 

424_EW_ = _E_ + _W_ # PYCHOK common cardinals 

425_NE_ = _N_ + _E_ # PYCHOK positive ones 

426_NS_ = _N_ + _S_ # PYCHOK OK 

427_NSEW_ = _NS_ + _EW_ # PYCHOK OK 

428_NW_ = _N_ + _W_ # PYCHOK OK 

429_SE_ = _S_ + _E_ # PYCHOK OK 

430_SW_ = _S_ + _W_ # PYCHOK negative ones 

431# _NESW_ = _NE_ + _SW_ # PYCHOK clockwise 

432 

433_DDOT_ = Str_(_DOT_ * 2) # PYCHOK OK 

434# _DEQUAL_ = Str_(_EQUAL_ * 2) # PYCHOK OK 

435# _DNL_ = Str_(_NL_ * 2) # PYCHOK OK 

436_DSLASH_ = Str_(_SLASH_ * 2) # PYCHOK OK 

437_DSTAR_ = Str_(_STAR_ * 2) # PYCHOK OK 

438_DUNDER_ = Str_(_UNDER_ * 2) # PYCHOK OK 

439 

440_LR_PAIRS = {_LANGLE_: _RANGLE_, 

441 _LCURLY_: _RCURLY_, 

442 _LPAREN_: _RPAREN_, 

443 _LSQUARE_: _RSQUARE_} # PYCHOK OK 

444 

445_Txyzsxyz7 = 'tx', 'ty', 'tz', _s_, 'sx', 'sy', 'sz' # PYCHOK in .datums, .trf 

446 

447__all__ = (_NN_, # NOT MISSING! 

448 Str_.__name__) # classes 

449__version__ = '26.07.21' 

450 

451if __name__ == _DMAIN_: 

452 

453 def _main(globalocals): 

454 from pygeodesy import itemsorted, printf 

455 

456 t = b = 0 

457 for n, v in itemsorted(globalocals, asorted=False, reverse=True): 

458 if n.endswith(_UNDER_) and n.startswith(_UNDER_) and \ 

459 not n.startswith(_DUNDER_): 

460 t += 1 

461 b += len(v) 

462 m = n[1:-1] 

463 if m != v and m.replace(_UNDER_, _SPACE_) != v: 

464 printf('%4d: %s = %r', t, n, v) 

465 n = len(globalocals) 

466 printf('%4d (%d) names, %s chars total, %.2f chars avg', t, n, b, float(b) / t, nl=1) 

467 

468 _main(globals()) # or locals() 

469 

470# **) MIT License 

471# 

472# Copyright (C) 2016-2026 -- mrJean1 at Gmail -- All Rights Reserved. 

473# 

474# Permission is hereby granted, free of charge, to any person obtaining a 

475# copy of this software and associated documentation files (the "Software"), 

476# to deal in the Software without restriction, including without limitation 

477# the rights to use, copy, modify, merge, publish, distribute, sublicense, 

478# and/or sell copies of the Software, and to permit persons to whom the 

479# Software is furnished to do so, subject to the following conditions: 

480# 

481# The above copyright notice and this permission notice shall be included 

482# in all copies or substantial portions of the Software. 

483# 

484# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 

485# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 

486# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 

487# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 

488# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 

489# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 

490# OTHER DEALINGS IN THE SOFTWARE.