Coverage for pyrdnap / __pygeodesy.py: 97%

31 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-07-31 14:31 -0400

1 

2# -*- coding: utf-8 -*- 

3 

4u'''(INTERNAL) C{pyrdnap} access to some private C{pygeodesy} attributes. 

5''' 

6 

7_missing_ = 'missing' # PYCHOK used! 

8_requires = '26.7.27' # in README.rst, requirements.txt, setup.py 

9 

10 

11def _PyGeodesy_dir(requires): 

12 # Adjust sys.path to enable import pygeodesy 

13 d = None 

14 try: 

15 from pygeodesy import version as _v 

16 except ImportError: 

17 import os.path as os_path 

18 import sys # PYCHOK used! 

19 _v = _missing_ 

20 # PYTHONPATH=.../PyRDNAP for development ONLY 

21 p = os_path.abspath(__file__) 

22 p = os_path.dirname(p) # pyrdnap_abspath 

23 p = os_path.dirname(p) # PyRDNAP 

24 p = os_path.dirname(p) # ../ 

25 g = os_path.join(p, 'PyGeodesy') 

26 if g != p and g not in sys.path: 

27 sys.path.insert(0, g) 

28 try: 

29 from pygeodesy import version as _v # PYCHOK redef 

30 d = g 

31 except ImportError: 

32 pass 

33# finally: 

34# try: 

35# sys.path.remove(g) 

36# except ValueError: 

37# pass 

38 

39 def _t(v): 

40 return tuple(map(int, v.split('.'))) # _DOT_ 

41 

42 if _v == _missing_ or _t(_v) < _t(requires): 

43 _v = ' %s, need %s or newer' % (_v, requires) 

44 raise ImportError('pygeodesy' + _v) 

45 

46 return d # or None 

47 

48_PyGeodesy_dir = _PyGeodesy_dir(_requires) # PYCHOK path or None 

49 

50from pygeodesy.basics import _xinstanceof, _xsubclassof # noqa: F401 

51from pygeodesy.constants import (_0_0, _0_0s, _0_5, _1_0, _2_0, # noqa: F401 

52 _isNAN, _isNAN0) # noqa: F401 

53from pygeodesy.datums import _earth_datum # noqa: F401 

54from pygeodesy.ellipsoidalBase import LatLonEllipsoidalBase as _LLEB # noqa: F401 

55from pygeodesy.errors import _ValueError, _xkwds, _xkwds_pop2 # noqa: F401 

56from pygeodesy.internals import machine, _secs2str, _versions # noqa: F401 

57from pygeodesy.interns import (_COMMASPACE_, _DASH_, _datum_, # noqa: F401 

58 _EQUAL_, _height_, _lat_, _lon_, # noqa: F401 

59 _N_, _name_, _NAN_, _NL_, _SPACE_, _STAR_) # noqa: F401 

60from pygeodesy.lazily import _ALL_DOCS, _ALL_OTHER, _FOR_DOCS, import_module # noqa: F401 

61from pygeodesy.named import _NamedBase, _NamedTuple, _Pass # noqa: F401 

62from pygeodesy.streprs import Fmt # noqa: F401 

63 

64 

65class RDNAPError(_ValueError): 

66 '''Error raised for C{RD}, C{NAP}, unzip and other issues. 

67 ''' 

68 pass 

69 

70 

71def _all_OTHER(*objs): # PYCHOK shared 

72 # collect all __all__ lists or tuples 

73 _all = _ALL_OTHER(*objs) 

74 _all__all__.extend(_all) 

75 return _all 

76 

77_all__all__ = [] # PYCHOK in .__init__ 

78 

79__all__ = _all_OTHER(machine, RDNAPError) 

80__version__ = '26.07.29' 

81 

82 

83# **) MIT License 

84# 

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

86# 

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

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

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

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

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

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

93# 

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

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

96# 

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

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

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

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

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

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

103# OTHER DEALINGS IN THE SOFTWARE.