Coverage for pyrdnap / __pygeodesy.py: 97%

30 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-07-11 10:57 -0400

1 

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

3 

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

5''' 

6_requires = '26.7.7' # in README.rst, requirements.txt, setup.py 

7 

8 

9def _PyGeodesy_dir(requires): 

10 # Adjust sys.path to enable import pygeodesy 

11 d = None 

12 try: 

13 from pygeodesy import version as _v 

14 except ImportError: 

15 import os.path as os_path 

16 import sys # PYCHOK used! 

17 _v = 'missing' 

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

19 p = os_path.abspath(__file__) 

20 p = os_path.dirname(p) # pyrdnap_abspath 

21 p = os_path.dirname(p) # PyRDNAP 

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

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

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

25 sys.path.insert(0, g) 

26 try: 

27 from pygeodesy import version as _v # PYCHOK redef 

28 d = g 

29 except ImportError: 

30 pass 

31# finally: 

32# try: 

33# sys.path.remove(g) 

34# except ValueError: 

35# pass 

36 

37 def _t(v): 

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

39 

40 if _v == 'missing' or _t(_v) < _t(requires): 

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

42 raise ImportError('pygeodesy' + _v) 

43 

44 return d # or None 

45 

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

47 

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

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

50 _isNAN, _isNAN0) # noqa: F401 

51from pygeodesy.datums import _earth_datum # noqa: F401 

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

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

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

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

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

57 _name_, _NAN_, _NL_, _SPACE_, _STAR_) # noqa: F401 

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

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

60from pygeodesy.streprs import Fmt # noqa: F401 

61 

62 

63class RDNAPError(_ValueError): 

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

65 ''' 

66 pass 

67 

68 

69def _all_OTHER(*objs): # PYCHOK shared 

70 # collect all __all__ lists or tuples 

71 _all = _ALL_OTHER(*objs) 

72 _all__all__.extend(_all) 

73 return _all 

74 

75_all__all__ = [] # PYCHOK in .__init__ 

76 

77__all__ = _all_OTHER(machine, RDNAPError) 

78__version__ = '26.07.07' 

79 

80 

81# **) MIT License 

82# 

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

84# 

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

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

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

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

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

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

91# 

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

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

94# 

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

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

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

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

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

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

101# OTHER DEALINGS IN THE SOFTWARE.