MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / __makeTransformedAttribute

Method __makeTransformedAttribute

github/GithubObject.py:315–324  ·  view source on GitHub ↗
(value: T, type: type[T], transform: Callable[[T], K])

Source from the content-addressed store, hash-verified

313
314 @staticmethod
315 def __makeTransformedAttribute(value: T, type: type[T], transform: Callable[[T], K]) -> Attribute[K]:
316 if value is None:
317 return _ValuedAttribute(None) # type: ignore
318 elif isinstance(value, type):
319 try:
320 return _ValuedAttribute(transform(value))
321 except Exception as e:
322 return _BadAttribute(value, type, e) # type: ignore
323 else:
324 return _BadAttribute(value, type) # type: ignore
325
326 @staticmethod
327 def _makeStringAttribute(value: int | str | None) -> Attribute[str]:

Callers 4

_makeClassAttributeMethod · 0.80

Calls 2

_ValuedAttributeClass · 0.85
_BadAttributeClass · 0.85

Tested by

no test coverage detected