Coverage for pychlv / __pygeodesy.py: 97%

33 statements  

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

1 

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

3 

4u'''(INTERNAL) C{pychlv} 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=.../PyChLV for development ONLY 

19 p = os_path.abspath(__file__) 

20 p = os_path.dirname(p) # pychlv_abspath 

21 p = os_path.dirname(p) # PyChLV 

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 _args_kwds_names, _isin # noqa: F401 

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

50 _100_0, _3600_0, _over) # noqa: F401 

51from pygeodesy.datums import _WGS84 # noqa: F401 

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

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

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

55from pygeodesy.fsums import _floor # noqa: F401 

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

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

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

59from pygeodesy.lazily import _ALL_OTHER 

60from pygeodesy.ltp import LocalError 

61from pygeodesy.named import _NamedTuple # noqa: F401 

62 

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

64 

65 

66class ChLVError(LocalError): 

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

68 ''' 

69 pass 

70 

71 

72def _all_OTHER(*objs): # PYCHOK shared 

73 # collect all __all__ lists or tuples 

74 _all = _ALL_OTHER(*objs) 

75 _all__all__.extend(_all) 

76 return _all 

77 

78_all__all__ = [] # PYCHOK in .__init__ 

79 

80__all__ = _all_OTHER(latDMS, lonDMS, machine, ChLVError) 

81__version__ = '26.07.16' 

82 

83 

84# **) MIT License 

85# 

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

87# 

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

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

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

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

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

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

94# 

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

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

97# 

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

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

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

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

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

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

104# OTHER DEALINGS IN THE SOFTWARE.