https://github.com/brandon-rhodes/python-jplephem
Raw File
Tip revision: 8927698a8502222d822c0b9c8c783fabe9629b74 authored by Brandon Rhodes on 13 December 2019, 21:05:11 UTC
Release 2.12 that stops using new NumPy flip()
Tip revision: 8927698
descriptorlib.py
from functools import update_wrapper

class reify(object):
    """Adapted from Pyramid's `reify()` memoizing decorator."""
    def __init__(self, method):
        self.method = method
        update_wrapper(self, method)

    def __get__(self, instance, objtype=None):
        if instance is None:
            return self
        value = self.method(instance)
        instance.__dict__[self.__name__] = value
        return value
back to top