Coverage for pychlv / __pygeodesy.py: 97%

29 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-08-21 15:21 -0400

1 

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

3 

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

5''' 

6_missing_ = 'missing' # PYCHOK used! 

7_requires = '26.8.18' # in README.rst, requirements.txt, setup.py 

8 

9 

10def _PyGeodesy_dir(requires): 

11 # Adjust sys.path to enable import pygeodesy 

12 d = None 

13 try: 

14 from pygeodesy import version as _v 

15 except ImportError: 

16 import os.path as os_path 

17 import sys # PYCHOK used! 

18 _v = _missing_ 

19 # PYTHONPATH=.../PyChLV for development ONLY 

20 p = os_path.abspath(__file__) 

21 p = os_path.dirname(p) # pychlv_abspath 

22 p = os_path.dirname(p) # PyChLV 

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

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

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

26 sys.path.insert(0, g) 

27 try: 

28 from pygeodesy import version as _v # PYCHOK redef 

29 d = g 

30 except ImportError: 

31 pass 

32# finally: 

33# try: 

34# sys.path.remove(g) 

35# except ValueError: 

36# pass 

37 

38 def _t(v): 

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

40 

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

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

43 raise ImportError('pygeodesy' + _v) 

44 

45 return d # or None 

46 

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

48 

49from pygeodesy.basics import _args_kwds_names, _isin # noqa: F401 

50from pygeodesy.constants import (_0_01, _0_5, _1_0, _2_0, _60_0, # noqa: F401 

51 _100_0, _3600_0, _over) # noqa: F401 

52from pygeodesy.datums import _WGS84 # noqa: F401 

53from pygeodesy.dms import latDMS, lonDMS # noqa: F401 

54from pygeodesy.ecef import _llhn4, _xyzn4 # noqa: F401 

55from pygeodesy.errors import _NotImplementedError, _or, _xkwds # noqa: F401 

56from pygeodesy.fsums import _floor # noqa: F401 

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

58from pygeodesy.interns import (_DASH_, _DOT_, _ELLIPSIS_, _invalid_, # noqa: F401 

59 _not_, _SPACE_, _X_, _Y_) # noqa: F401 

60from pygeodesy.lazily import _ALL_OTHER, _ALL_STAR # noqa: F401 

61from pygeodesy.ltp import LocalError 

62from pygeodesy.named import _NamedTuple # noqa: F401 

63 

64_not_falsed_ = _or(_not_('falsed'), _invalid_) # PYCHOK in .chlvs 

65 

66 

67class ChLVError(LocalError): 

68 '''Error raised for C{ChLV}, C{ChLVa}, C{ChLVe} or C{ChLVr} or other issues. 

69 ''' 

70 pass 

71 

72 

73__all__ = _ALL_OTHER(ChLVError, latDMS, lonDMS, machine) 

74__version__ = '26.08.18' 

75 

76 

77# **) MIT License 

78# 

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

80# 

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

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

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

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

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

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

87# 

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

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

90# 

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

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

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

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

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

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

97# OTHER DEALINGS IN THE SOFTWARE.