Coverage for pygeodesy/geodsolve.py: 94%
81 statements
« prev ^ index » next coverage.py v7.2.2, created at 2024-06-01 11:43 -0400
« prev ^ index » next coverage.py v7.2.2, created at 2024-06-01 11:43 -0400
2# -*- coding: utf-8 -*-
4u'''Wrapper to invoke I{Karney}'s U{GeodSolve
5<https://GeographicLib.SourceForge.io/C++/doc/GeodSolve.1.html>} utility
6as an (exact) geodesic, but intended I{for testing purposes only}.
8Set env variable C{PYGEODESY_GEODSOLVE} to the (fully qualified) path
9of the C{GeodSolve} executable.
10'''
12from pygeodesy.basics import _xinstanceof
13# from pygeodesy.geodesicx import GeodesicAreaExact # _MODS
14from pygeodesy.interns import NN, _a12_, _azi1_, _azi2_, \
15 _lat1_, _lat2_, _lon1_, _lon2_, _m12_, \
16 _M12_, _M21_, _s12_, _S12_, _UNDER_
17from pygeodesy.interns import _UNUSED_, _not_ # PYCHOK used!
18from pygeodesy.karney import _Azi, Caps, _Deg, GeodesicError, _GTuple, \
19 _Pass, _Lat, _Lon, _M, _M2, _sincos2d
20from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS, \
21 _getenv, _PYGEODESY_GEODSOLVE_
22from pygeodesy.named import _name1__
23from pygeodesy.namedTuples import Destination3Tuple, Distance3Tuple
24from pygeodesy.props import Property, Property_RO
25from pygeodesy.solveBase import _SolveBase, _SolveLineBase
26from pygeodesy.utily import _unrollon, _Wrap, wrap360
28__all__ = _ALL_LAZY.geodsolve
29__version__ = '24.05.31'
32class GeodSolve12Tuple(_GTuple):
33 '''12-Tuple C{(lat1, lon1, azi1, lat2, lon2, azi2, s12, a12, m12, M12, M21, S12)} with
34 angles C{lat1}, C{lon1}, C{azi1}, C{lat2}, C{lon2} and C{azi2} and arc C{a12} all in
35 C{degrees}, initial C{azi1} and final C{azi2} forward azimuths, distance C{s12} and
36 reduced length C{m12} in C{meter}, area C{S12} in C{meter} I{squared} and geodesic
37 scale factors C{M12} and C{M21}, both C{scalar}, see U{GeodSolve
38 <https://GeographicLib.SourceForge.io/C++/doc/GeodSolve.1.html>}.
39 '''
40 # from GeodSolve --help option -f ... lat1 lon1 azi1 lat2 lon2 azi2 s12 a12 m12 M12 M21 S12
41 _Names_ = (_lat1_, _lon1_, _azi1_, _lat2_, _lon2_, _azi2_, _s12_, _a12_, _m12_, _M12_, _M21_, _S12_)
42 _Units_ = (_Lat, _Lon, _Azi, _Lat, _Lon, _Azi, _M, _Deg, _Pass, _Pass, _Pass, _M2)
45class _GeodesicSolveBase(_SolveBase):
46 '''(INTERNAL) Base class for L{GeodesicSolve} and L{GeodesicLineSolve}.
47 '''
48 _Error = GeodesicError
49 _Names_Direct = \
50 _Names_Inverse = GeodSolve12Tuple._Names_
51 _Solve_name = 'GeodSolve'
52 _Solve_path = _getenv(_PYGEODESY_GEODSOLVE_, _PYGEODESY_GEODSOLVE_)
54 @Property_RO
55 def _b_option(self):
56 return ('-b',) if self.reverse2 else ()
58 @Property_RO
59 def _cmdBasic(self):
60 '''(INTERNAL) Get the basic C{GeodSolve} cmd (C{tuple}).
61 '''
62 return (self.GeodSolve,) + self._b_option \
63 + self._e_option \
64 + self._E_option \
65 + self._p_option \
66 + self._u_option + ('-f',)
68 @Property_RO
69 def _E_option(self):
70 return ('-E',) if self.Exact else ()
72 @Property
73 def GeodSolve(self):
74 '''Get the U{GeodSolve<https://GeographicLib.SourceForge.io/C++/doc/GeodSolve.1.html>}
75 executable (C{filename}).
76 '''
77 return self._Solve_path
79 @GeodSolve.setter # PYCHOK setter!
80 def GeodSolve(self, path):
81 '''Set the U{GeodSolve<https://GeographicLib.SourceForge.io/C++/doc/GeodSolve.1.html>}
82 executable (C{filename}), the (fully qualified) path to the C{GeodSolve} executable.
84 @raise GeodesicError: Invalid B{C{path}}, B{C{path}} doesn't exist or
85 isn't the C{GeodSolve} executable.
86 '''
87 self._setSolve(path)
89 def toStr(self, **prec_sep): # PYCHOK signature
90 '''Return this C{GeodesicSolve} as string.
92 @kwarg prec_sep: Keyword argumens C{B{prec}=6} and C{B{sep}=', '}
93 for the C{float} C{prec}ision, number of decimal digits
94 (0..9) and the C{sep}arator string to join. Trailing
95 zero decimals are stripped for B{C{prec}} values of
96 1 and above, but kept for negative B{C{prec}} values.
98 @return: GeodesicSolve items (C{str}).
99 '''
100 return _SolveBase._toStr(self, GeodSolve=self.GeodSolve, **prec_sep)
102 @Property_RO
103 def _u_option(self):
104 return ('-u',) if self.unroll else ()
107class GeodesicSolve(_GeodesicSolveBase):
108 '''Wrapper to invoke I{Karney}'s U{GeodSolve<https://GeographicLib.SourceForge.io/C++/doc/GeodSolve.1.html>}
109 as an C{Exact} version of I{Karney}'s Python class U{Geodesic<https://GeographicLib.SourceForge.io/C++/doc/
110 python/code.html#geographiclib.geodesic.Geodesic>}.
112 @note: Use property C{GeodSolve} or env variable C{PYGEODESY_GEODSOLVE} to specify the (fully
113 qualified) path to the C{GeodSolve} executable.
115 @note: This C{geodesic} is intended I{for testing purposes only}, it invokes the C{GeodSolve}
116 executable for I{every} method call.
117 '''
119 def Area(self, polyline=False, **name):
120 '''Set up a L{GeodesicAreaExact} to compute area and
121 perimeter of a polygon.
123 @kwarg polyline: If C{True} perimeter only, otherwise
124 area and perimeter (C{bool}).
125 @kwarg name: Optional C{B{name}=NN} (C{str}).
127 @return: A L{GeodesicAreaExact} instance.
129 @note: The B{C{debug}} setting is passed as C{verbose}
130 to the returned L{GeodesicAreaExact} instance.
131 '''
132 gaX = _MODS.geodesicx.GeodesicAreaExact(self, polyline=polyline, **name)
133 if self.verbose or self.debug: # PYCHOK no cover
134 gaX.verbose = True
135 return gaX
137 Polygon = Area # for C{geographiclib} compatibility
139 def Direct3(self, lat1, lon1, azi1, s12): # PYCHOK outmask
140 '''Return the destination lat, lon and reverse azimuth
141 (final bearing) in C{degrees}.
143 @return: L{Destination3Tuple}C{(lat, lon, final)}.
144 '''
145 r = self._GDictDirect(lat1, lon1, azi1, False, s12, floats=False)
146 return Destination3Tuple(float(r.lat2), float(r.lon2), wrap360(r.azi2),
147 iteration=r._iteration)
149 def _DirectLine(self, ll1, azi12, **caps_name): # PYCHOK no cover
150 '''(INTERNAL) Short-cut version.
151 '''
152 return self.DirectLine(ll1.lat, ll1.lon, azi12, **caps_name)
154 def DirectLine(self, lat1, lon1, azi1, **caps_name):
155 '''Set up a L{GeodesicLineSolve} to compute several points
156 on a single geodesic.
158 @arg lat1: Latitude of the first point (C{degrees}).
159 @arg lon1: Longitude of the first point (C{degrees}).
160 @arg azi1: Azimuth at the first point (compass C{degrees}).
161 @kwarg caps_name: Optional C{B{name}=NN} (C{str}) and keyword
162 argument C{B{caps}=Caps.ALL}, bit-or'ed combination
163 of L{Caps} values specifying the capabilities the
164 L{GeodesicLineSolve} instance should possess.
166 @return: A L{GeodesicLineSolve} instance.
168 @note: If the point is at a pole, the azimuth is defined by keeping
169 B{C{lon1}} fixed, writing C{B{lat1} = ±(90 − ε)}, and taking
170 the limit C{ε → 0+}.
172 @see: C++ U{GeodesicExact.Line
173 <https://GeographicLib.SourceForge.io/C++/doc/classGeographicLib_1_1GeodesicExact.html>}
174 and Python U{Geodesic.Line<https://GeographicLib.SourceForge.io/Python/doc/code.html>}.
175 '''
176 return GeodesicLineSolve(self, lat1, lon1, azi1, **_name1__(caps_name, _or_nameof=self))
178 Line = DirectLine
180 def _Inverse(self, ll1, ll2, wrap, **outmask): # PYCHOK no cover
181 '''(INTERNAL) Short-cut version, see .ellipsoidalBaseDI.intersecant2.
182 '''
183 if wrap:
184 ll2 = _unrollon(ll1, _Wrap.point(ll2))
185 return self.Inverse(ll1.lat, ll1.lon, ll2.lat, ll2.lon, **outmask)
187 def Inverse3(self, lat1, lon1, lat2, lon2): # PYCHOK outmask
188 '''Return the distance in C{meter} and the forward and
189 reverse azimuths (initial and final bearing) in C{degrees}.
191 @return: L{Distance3Tuple}C{(distance, initial, final)}.
192 '''
193 r = self._GDictInverse(lat1, lon1, lat2, lon2, floats=False)
194 return Distance3Tuple(float(r.s12), wrap360(r.azi1), wrap360(r.azi2),
195 iteration=r._iteration)
197 def _InverseLine(self, ll1, ll2, wrap, **caps_name): # PYCHOK no cover
198 '''(INTERNAL) Short-cut version.
199 '''
200 if wrap:
201 ll2 = _unrollon(ll1, _Wrap.point(ll2))
202 return self.InverseLine(ll1.lat, ll1.lon, ll2.lat, ll2.lon, **caps_name)
204 def InverseLine(self, lat1, lon1, lat2, lon2, **caps_name): # PYCHOK no cover
205 '''Set up a L{GeodesicLineSolve} to compute several points
206 on a single geodesic.
208 @arg lat1: Latitude of the first point (C{degrees}).
209 @arg lon1: Longitude of the first point (C{degrees}).
210 @arg lat2: Latitude of the second point (C{degrees}).
211 @arg lon2: Longitude of the second point (C{degrees}).
212 @kwarg caps_name: Optional C{B{name}=NN} (C{str}) and keyword
213 argument C{B{caps}=Caps.ALL}, bit-or'ed combination
214 of L{Caps} values specifying the capabilities the
215 L{GeodesicLineSolve} instance should possess.
217 @return: A L{GeodesicLineSolve} instance.
219 @note: Both B{C{lat1}} and B{C{lat2}} should in the range C{[-90, +90]}.
221 @see: C++ U{GeodesicExact.InverseLine
222 <https://GeographicLib.SourceForge.io/C++/doc/classGeographicLib_1_1GeodesicExact.html>} and
223 Python U{Geodesic.InverseLine<https://GeographicLib.SourceForge.io/Python/doc/code.html>}.
224 '''
225 r = self.Inverse(lat1, lon1, lat2, lon2)
226 return GeodesicLineSolve(self, lat1, lon1, r.azi1, **_name1__(caps_name, _or_nameof=self))
229class GeodesicLineSolve(_GeodesicSolveBase, _SolveLineBase):
230 '''Wrapper to invoke I{Karney}'s U{GeodSolve<https://GeographicLib.SourceForge.io/C++/doc/GeodSolve.1.html>}
231 as an C{Exact} version of I{Karney}'s Python class U{GeodesicLine<https://GeographicLib.SourceForge.io/C++/doc/
232 python/code.html#geographiclib.geodesicline.GeodesicLine>}.
234 @note: Use property C{GeodSolve} or env variable C{PYGEODESY_GEODSOLVE} to specify the (fully
235 qualified) path to the C{GeodSolve} executable.
237 @note: This C{geodesic} is intended I{for testing purposes only}, it invokes the C{GeodSolve}
238 executable for I{every} method call.
239 '''
241 def __init__(self, geodesic, lat1, lon1, azi1, caps=Caps.ALL, **name):
242 '''New L{GeodesicLineSolve} instance, allowing points to be found along
243 a geodesic starting at C{(B{lat1}, B{lon1})} with azimuth B{C{azi1}}.
245 @arg geodesic: The geodesic to use (L{GeodesicSolve}).
246 @arg lat1: Latitude of the first point (C{degrees}).
247 @arg lon1: Longitude of the first point (C{degrees}).
248 @arg azi1: Azimuth at the first points (compass C{degrees}).
249 @kwarg caps: Bit-or'ed combination of L{Caps} values specifying the
250 capabilities the L{GeodesicLineSolve} instance should possess,
251 C{B{caps}=Caps.ALL} always. Include C{Caps.LINE_OFF} if
252 updates to the B{C{geodesic}} should I{not} be reflected in
253 this L{GeodesicLineSolve} instance.
254 @kwarg name: Optional C{B{name}=NN} (C{str}).
256 @raise GeodesicError: Invalid path for the C{GeodSolve} executable
257 or isn't the C{GeodSolve} executable, see
258 property C{geodesic.GeodSolve}.
260 @raise TypeError: Invalid B{C{geodesic}}.
261 '''
262 _xinstanceof(GeodesicSolve, geodesic=geodesic)
263 if (caps & Caps.LINE_OFF): # copy to avoid updates
264 geodesic = geodesic.copy(deep=False, name=_UNDER_(NN, geodesic.name)) # NOT _under!
265 _SolveLineBase.__init__(self, geodesic, lat1, lon1, caps, azi1=azi1, **name)
266 try:
267 self.GeodSolve = geodesic.GeodSolve # geodesic or copy of geodesic
268 except GeodesicError:
269 pass
271 def ArcPosition(self, a12, outmask=_UNUSED_): # PYCHOK unused
272 '''Find the position on the line given B{C{a12}}.
274 @arg a12: Spherical arc length from the first point to the
275 second point (C{degrees}).
277 @return: A C{GDict} with 12 items C{lat1, lon1, azi1, lat2, lon2,
278 azi2, m12, a12, s12, M12, M21, S12}.
279 '''
280 return self._GDictInvoke(self._cmdArc, True, self._Names_Direct, a12)
282 @Property_RO
283 def azi1(self):
284 '''Get the azimuth at the first point (compass C{degrees}).
285 '''
286 return self._lla1.azi1
288 azi12 = azi1 # like RhumbLineSolve
290 @Property_RO
291 def azi1_sincos2(self):
292 '''Get the sine and cosine of the first point's azimuth (2-tuple C{(sin, cos)}).
293 '''
294 return _sincos2d(self.azi1)
296 azi12_sincos2 = azi1_sincos2
298 @Property_RO
299 def _cmdArc(self):
300 '''(INTERNAL) Get the C{GeodSolve} I{-a -L} cmd (C{tuple}).
301 '''
302 return self._cmdDistance + ('-a',)
304 def Intersecant2(self, lat0, lon0, radius, **kwds): # PYCHOK no cover
305 '''B{Not implemented}, throws a C{NotImplementedError} always.'''
306 self._notImplemented(lat0, lon0, radius, **kwds)
308 def PlumbTo(self, lat0, lon0, **kwds): # PYCHOK no cover
309 '''B{Not implemented}, throws a C{NotImplementedError} always.'''
310 self._notImplemented(lat0, lon0, **kwds)
312 def Position(self, s12, outmask=_UNUSED_): # PYCHOK unused
313 '''Find the position on the line given B{C{s12}}.
315 @arg s12: Distance from the first point to the second (C{meter}).
317 @return: A C{GDict} with 12 items C{lat1, lon1, azi1, lat2, lon2,
318 azi2, m12, a12, s12, M12, M21, S12}, possibly C{a12=NAN}.
319 '''
320 return self._GDictInvoke(self._cmdDistance, True, self._Names_Direct, s12)
322 def toStr(self, **prec_sep): # PYCHOK signature
323 '''Return this C{GeodesicLineSolve} as string.
325 @kwarg prec_sep: Keyword argumens C{B{prec}=6} and C{B{sep}=', '}
326 for the C{float} C{prec}ision, number of decimal digits
327 (0..9) and the C{sep}arator string to join. Trailing
328 zero decimals are stripped for B{C{prec}} values of
329 1 and above, but kept for negative B{C{prec}} values.
331 @return: GeodesicLineSolve items (C{str}).
332 '''
333 return _SolveLineBase._toStr(self, azi1=self.azi1, geodesic=self._solve,
334 GeodSolve=self.GeodSolve, **prec_sep)
337__all__ += _ALL_DOCS(_GeodesicSolveBase)
339if __name__ == '__main__':
341 from pygeodesy import printf
342 from sys import argv
344 gS = GeodesicSolve(name='Test')
345 gS.verbose = '--verbose' in argv # or '-v' in argv
347 if gS.GeodSolve in (_PYGEODESY_GEODSOLVE_, None): # not set
348 gS.GeodSolve = '/opt/local/bin/GeodSolve' # '/opt/local/Cellar/geographiclib/1.51/bin/GeodSolve' # HomeBrew
349 printf('version: %s', gS.version)
351 r = gS.Direct(40.6, -73.8, 51, 5.5e6)
352 printf('Direct: %r', r, nl=1)
353 printf('Direct3: %r', gS.Direct3(40.6, -73.8, 51, 5.5e6))
355 printf('Inverse: %r', gS.Inverse( 40.6, -73.8, 51.6, -0.5), nl=1)
356 printf('Inverse1: %r', gS.Inverse1(40.6, -73.8, 51.6, -0.5))
357 printf('Inverse3: %r', gS.Inverse3(40.6, -73.8, 51.6, -0.5))
359 glS = GeodesicLineSolve(gS, 40.6, -73.8, 51, name='LineTest')
360 p = glS.Position(5.5e6)
361 printf('Position: %s %r', p == r, p, nl=1)
362 p = glS.ArcPosition(49.475527)
363 printf('ArcPosition: %s %r', p == r, p)
365# % python3 -m pygeodesy.geodsolve
367# version: /opt/local/bin/GeodSolve: GeographicLib version 1.51
369# version: /opt/local/bin/GeodSolve: GeographicLib version 1.51
371# Direct: GDict(M12=0.650911, M21=0.651229, S12=39735075134877.09375, a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141173, m12=4844148.703101, s12=5500000.0)
372# Direct3: Destination3Tuple(lat=51.884565, lon=-1.141173, final=107.189397)
374# Inverse: GDict(M12=0.64473, M21=0.645046, S12=40041368848742.53125, a12=49.94131, azi1=51.198883, azi2=107.821777, lat1=40.6, lat2=51.6, lon1=-73.8, lon2=-0.5, m12=4877684.602706, s12=5551759.400319)
375# Inverse1: 49.94131021789904
376# Inverse3: Distance3Tuple(distance=5551759.400319, initial=51.198883, final=107.821777)
378# Position: True GDict(M12=0.650911, M21=0.651229, S12=39735075134877.09375, a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141173, m12=4844148.703101, s12=5500000.0)
379# ArcPosition: False GDict(M12=0.650911, M21=0.651229, S12=39735074737272.734375, a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141174, m12=4844148.669561, s12=5499999.948497)
382# % python3 -m pygeodesy.geodsolve --verbose
384# GeodesicSolve 'Test' 1: /opt/local/bin/GeodSolve --version (invoke)
385# GeodesicSolve 'Test' 1: /opt/local/bin/GeodSolve: GeographicLib version 1.51 (0)
386# version: /opt/local/bin/GeodSolve: GeographicLib version 1.51
387# GeodesicSolve 'Test' 2: /opt/local/bin/GeodSolve -E -p 10 -f \ 40.600000000000001 -73.799999999999997 51.0 5500000.0 (Direct)
388# GeodesicSolve 'Test' 2: lat1=40.600000000000001, lon1=-73.799999999999997, azi1=51.0, lat2=51.884564505606761, lon2=-1.141172861200829, azi2=107.189397162605886, s12=5500000.0, a12=49.475527463251467, m12=4844148.703101486, M12=0.65091056699808603, M21=0.65122865892196558, S12=39735075134877.094 (0)
390# Direct: GDict(M12=0.650911, M21=0.651229, S12=39735075134877.09375, a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141173, m12=4844148.703101, s12=5500000.0)
391# GeodesicSolve 'Test' 3: /opt/local/bin/GeodSolve -E -p 10 -f \ 40.600000000000001 -73.799999999999997 51.0 5500000.0 (Direct3)
392# GeodesicSolve 'Test' 3: lat1=40.600000000000001, lon1=-73.799999999999997, azi1=51.0, lat2=51.884564505606761, lon2=-1.141172861200829, azi2=107.189397162605886, s12=5500000.0, a12=49.475527463251467, m12=4844148.703101486, M12=0.65091056699808603, M21=0.65122865892196558, S12=39735075134877.094 (0)
393# Direct3: Destination3Tuple(lat=51.884565, lon=-1.141173, final=107.189397)
394# GeodesicSolve 'Test' 4: /opt/local/bin/GeodSolve -E -p 10 -f -i \ 40.600000000000001 -73.799999999999997 51.600000000000001 -0.5 (Inverse)
395# GeodesicSolve 'Test' 4: lat1=40.600000000000001, lon1=-73.799999999999997, azi1=51.198882845579824, lat2=51.600000000000001, lon2=-0.5, azi2=107.821776735514248, s12=5551759.4003186841, a12=49.941310217899037, m12=4877684.6027061976, M12=0.64472969205948238, M21=0.64504567852134398, S12=40041368848742.531 (0)
397# Inverse: GDict(M12=0.64473, M21=0.645046, S12=40041368848742.53125, a12=49.94131, azi1=51.198883, azi2=107.821777, lat1=40.6, lat2=51.6, lon1=-73.8, lon2=-0.5, m12=4877684.602706, s12=5551759.400319)
398# GeodesicSolve 'Test' 5: /opt/local/bin/GeodSolve -E -p 10 -f -i \ 40.600000000000001 -73.799999999999997 51.600000000000001 -0.5 (Inverse1)
399# GeodesicSolve 'Test' 5: lat1=40.600000000000001, lon1=-73.799999999999997, azi1=51.198882845579824, lat2=51.600000000000001, lon2=-0.5, azi2=107.821776735514248, s12=5551759.4003186841, a12=49.941310217899037, m12=4877684.6027061976, M12=0.64472969205948238, M21=0.64504567852134398, S12=40041368848742.531 (0)
400# Inverse1: 49.94131021789904
401# GeodesicSolve 'Test' 6: /opt/local/bin/GeodSolve -E -p 10 -f -i \ 40.600000000000001 -73.799999999999997 51.600000000000001 -0.5 (Inverse3)
402# GeodesicSolve 'Test' 6: lat1=40.600000000000001, lon1=-73.799999999999997, azi1=51.198882845579824, lat2=51.600000000000001, lon2=-0.5, azi2=107.821776735514248, s12=5551759.4003186841, a12=49.941310217899037, m12=4877684.6027061976, M12=0.64472969205948238, M21=0.64504567852134398, S12=40041368848742.531 (0)
403# Inverse3: Distance3Tuple(distance=5551759.400319, initial=51.198883, final=107.821777)
405# Position: True GDict(M12=0.650911, M21=0.651229, S12=39735075134877.09375, a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141173, m12=4844148.703101, s12=5500000.0)
406# ArcPosition: False GDict(M12=0.650911, M21=0.651229, S12=39735074737272.734375, a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141174, m12=4844148.669561, s12=5499999.948497)
409# **) MIT License
410#
411# Copyright (C) 2016-2024 -- mrJean1 at Gmail -- All Rights Reserved.
412#
413# Permission is hereby granted, free of charge, to any person obtaining a
414# copy of this software and associated documentation files (the "Software"),
415# to deal in the Software without restriction, including without limitation
416# the rights to use, copy, modify, merge, publish, distribute, sublicense,
417# and/or sell copies of the Software, and to permit persons to whom the
418# Software is furnished to do so, subject to the following conditions:
419#
420# The above copyright notice and this permission notice shall be included
421# in all copies or substantial portions of the Software.
422#
423# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
424# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
425# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
426# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
427# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
428# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
429# OTHER DEALINGS IN THE SOFTWARE.