Coverage for pygeodesy/props.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
''' _immutable_, _invalid_, _N_A_, \ _SPACE_, _UNDER_
'''(INTERNAL) Zap all I{cached} L{property_RO}s, L{Property_RO}s and the named C{attrs} from an instance' C{__dict__}.
@return: The number of updates (C{int}), if any. '''
else: # PYCHOK no cover from pygeodesy.named import classname n = classname(inst, prefixed=True) a = _DOT_(n, _SPACE_(a, _invalid_)) raise _AssertionError(a, txt=repr(inst))
'''(INTERNAL) Base class for C{P/property/_RO}. '''
self.getter(method) # PYCHOK no cover
self.__doc__ = method.__doc__ # PYCHOK no cover
self._update(inst, None) # PYCHOK no cover
# cache the value in the instance' __dict__
'''Throws an C{AttributeError}, always. '''
raise _AttributeError(e, txt=name)
raise _AttributeError(e, txt=name)
'''(INTERNAL) Zap the I{cached} C{inst.__dict__[name]} item. '''
'''Throws an C{AttributeError}, always. '''
'''Throws an C{AttributeError}, always. '''
'''Throws an C{AttributeError}, always. '''
# No __doc__ on purpose '''New I{immutable}, I{caching} C{property} I{Factory} to be used as C{decorator}.
@arg method: The callable being decorated as this C{property}'s getter, to be invoked only once.
@note: Like standard Python C{property} without a setter, but with a more descriptive error message when set.
@see: Python 3's U{functools.cached_property<https://docs.Python.org/3/ library/functools.html#functools.cached_property>} and U{-.cache <https://Docs.Python.org/3/library/functools.html#functools.cache>} to I{memoize} the property value.
@see: Luciano Ramalho, "Fluent Python", page 636, O'Reilly, 2016, "Coding a Property Factory", especially Example 19-24 and U{class Property<https://docs.Python.org/3/howto/descriptor.html>}. '''
# No __doc__ on purpose '''New I{mutable}, I{caching} C{property} I{Factory} to be used as C{decorator}.
@see: L{Property_RO} for some more details.
@note: Unless and until the C{setter} is defined, this L{Property} behaves like an I{immutable}, I{caching} L{Property_RO}. '''
'''Make this C{Property} I{mutable}.
@arg method: The callable being decorated as this C{Property}'s setter. ''' _PropertyBase.setter(self, method) # PYCHOK no cover
# class Property <https://docs.Python.org/3/howto/descriptor.html>
# No __doc__ on purpose '''New I{immutable}, standard C{property} to be used as C{decorator}.
@arg method: The callable being decorated as C{property}'s getter.
@note: Like standard Python C{property} without a setter, but with a more descriptive error message when set.
@see: L{Property_RO}. '''
'''(INTERNAL) Zap the I{cached} C{inst.__dict__[_name]} item. '''
'''Decorator for a standard C{property} with basic documentation.
@arg doc: The property documentation (C{str}).
@example:
>>> @property_doc_("documentation text.") >>> def name(self): >>> ... >>> >>> @name.setter >>> def name(self, value): >>> ... ''' # See Luciano Ramalho, "Fluent Python", page 212ff, O'Reilly, 2016, # "Parameterized Decorators", especially Example 7-23. Also, see # <https://Python-3-Patterns-Idioms-Test.ReadTheDocs.io/en/latest/PythonDecorators.html>
'''(INTERNAL) Return the documented C{property}. '''
# **) MIT License # # Copyright (C) 2016-2021 -- mrJean1 at Gmail -- All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. |