Determine if attribute in specific class. Args: cls: target class. attribute_name: the attribute name. Returns: The attribute in the class or not.
(cls, attribute_name)
| 524 | |
| 525 | |
| 526 | def has_attr_in_class(cls, attribute_name) -> bool: |
| 527 | """ |
| 528 | Determine if attribute in specific class. |
| 529 | |
| 530 | Args: |
| 531 | cls: target class. |
| 532 | attribute_name: the attribute name. |
| 533 | |
| 534 | Returns: |
| 535 | The attribute in the class or not. |
| 536 | """ |
| 537 | init_method = cls.__init__ |
| 538 | signature = inspect.signature(init_method) |
| 539 | |
| 540 | parameters = signature.parameters |
| 541 | param_names = list(parameters.keys()) |
| 542 | |
| 543 | return attribute_name in param_names |
no test coverage detected
searching dependent graphs…