def get_first_param_type(self): """ Return the type annotation of the first argument if it's not empty. """ ifnot self.sig: returnNone
params = list(self.sig.parameters.values()) if params and params[0].annotation isnot inspect.Parameter.empty: return params[0].annotation
returnNone
def get_return_type(self): """ Return the return type if it's not empty. """ if (
self.sig and self.sig.return_annotation isnot inspect.Signature.empty
): return self.sig.return_annotation
returnNone
# Thread-local global to track attrs instances which are already being repr'd. # This is needed because there is no other (thread-safe) way to pass info # about the instances that are already being repr'd through the call stack # in order to ensure we don't perform infinite recursion. # # For instance, if an instance contains a dict which contains that instance, # we need to know that we're already repr'ing the outside instance from within # the dict's repr() call. # # This lives here rather than in _make.py so that the functions in _make.py # don't have a direct reference to the thread-local in their globals dict. # If they have such a reference, it breaks cloudpickle.
repr_context = threading.local()
def get_generic_base(cl): """If this is a generic class (A[str]), return the generic base for it.""" if cl.__class__ is _GenericAlias: return cl.__origin__ returnNone
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.19 Sekunden
(vorverarbeitet am 2026-08-25)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.