Coverage for pyrdnap / __pygeodesy.py: 96%

23 statements  

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

1 

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

3 

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

5''' 

6_requires = '26.5.26' # in 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 # PYTHONPATH=.../PyRDNAP for development ONLY 

18 p = os_path.abspath(__file__) 

19 p = os_path.dirname(p) # pyrdnap_abspath 

20 p = os_path.dirname(p) # PyRDNAP 

21 g = p.replace('PyRDNAP', 'PyGeodesy') 

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

23 sys.path.insert(0, g) 

24 try: 

25 from pygeodesy import version as _v # PYCHOK redef 

26 d = g 

27 except ImportError: 

28 _v = 'missing' 

29# finally: 

30# try: 

31# sys.path.remove(g) 

32# except ValueError: 

33# pass 

34 

35 def _t(v): 

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

37 

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

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

40 raise ImportError('pygeodesy' + _v) 

41 

42 return d # or None 

43 

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

45 

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

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

48 _isNAN, _isNAN0) # noqa: F401 

49from pygeodesy.datums import _earth_datum # noqa: F401 

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

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

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

53from pygeodesy.interns import (_COLONSPACE_, _COMMASPACE_, _DASH_, _datum_, _E_, # noqa: F401 

54 _EQUAL_, _height_, _lat_, _lon_, _N_, _NAN_, _NL_, # noqa: F401 

55 _S_, _SPACE_, _STAR_, _W_) # noqa: F401 

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

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

58from pygeodesy.streprs import Fmt # noqa: F401 

59 

60__all__ = () 

61__version__ = '26.05.26' 

62 

63# **) MIT License 

64# 

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

66# 

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

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

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

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

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

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

73# 

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

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

76# 

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

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

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

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

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

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

83# OTHER DEALINGS IN THE SOFTWARE.