Generate stub for a single variable using runtime introspection. The result lines will be appended to 'output'. If necessary, any required names will be added to 'imports'.
(self, name: str, obj: object, output: list[str])
| 908 | output.append(f"{self._indent}class {class_name}{bases_str}: ...") |
| 909 | |
| 910 | def generate_variable_stub(self, name: str, obj: object, output: list[str]) -> None: |
| 911 | """Generate stub for a single variable using runtime introspection. |
| 912 | |
| 913 | The result lines will be appended to 'output'. If necessary, any |
| 914 | required names will be added to 'imports'. |
| 915 | """ |
| 916 | if self.is_private_name(name, f"{self.module_name}.{name}") or self.is_not_in_all(name): |
| 917 | return |
| 918 | self.record_name(name) |
| 919 | type_str = self.strip_or_import(self.get_type_annotation(obj)) |
| 920 | output.append(f"{name}: {type_str}") |
| 921 | |
| 922 | |
| 923 | def method_name_sort_key(name: str) -> tuple[int, str]: |
no test coverage detected