MCPcopy Create free account
hub / github.com/SooLab/CGFormer / __get__

Method __get__

bert/file_utils.py:773–784  ·  view source on GitHub ↗
(self, obj, objtype=None)

Source from the content-addressed store, hash-verified

771 """
772
773 def __get__(self, obj, objtype=None):
774 # See docs.python.org/3/howto/descriptor.html#properties
775 if obj is None:
776 return self
777 if self.fget is None:
778 raise AttributeError("unreadable attribute")
779 attr = "__cached_" + self.fget.__name__
780 cached = getattr(obj, attr, None)
781 if cached is None:
782 cached = self.fget(obj)
783 setattr(obj, attr, cached)
784 return cached
785
786
787def torch_required(func):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected