Signature info for a single argument.
| 34 | |
| 35 | |
| 36 | class ArgSig: |
| 37 | """Signature info for a single argument.""" |
| 38 | |
| 39 | def __init__( |
| 40 | self, |
| 41 | name: str, |
| 42 | type: str | None = None, |
| 43 | *, |
| 44 | default: bool = False, |
| 45 | default_value: str = "...", |
| 46 | ) -> None: |
| 47 | self.name = name |
| 48 | self.type = type |
| 49 | # Does this argument have a default value? |
| 50 | self.default = default |
| 51 | self.default_value = default_value |
| 52 | |
| 53 | def is_star_arg(self) -> bool: |
| 54 | return self.name.startswith("*") and not self.name.startswith("**") |
| 55 | |
| 56 | def is_star_kwarg(self) -> bool: |
| 57 | return self.name.startswith("**") |
| 58 | |
| 59 | def __repr__(self) -> str: |
| 60 | return "ArgSig(name={}, type={}, default={})".format( |
| 61 | repr(self.name), repr(self.type), repr(self.default) |
| 62 | ) |
| 63 | |
| 64 | def __eq__(self, other: Any) -> bool: |
| 65 | if isinstance(other, ArgSig): |
| 66 | return ( |
| 67 | self.name == other.name |
| 68 | and self.type == other.type |
| 69 | and self.default == other.default |
| 70 | and self.default_value == other.default_value |
| 71 | ) |
| 72 | return False |
| 73 | |
| 74 | |
| 75 | class FunctionSig(NamedTuple): |
no outgoing calls
searching dependent graphs…