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

Class GithubClass

scripts/openapi.py:222–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220
221@dataclasses.dataclass(frozen=True)
222class GithubClass:
223 ids: list[str]
224 package: str
225 module: str
226 name: str
227 filename: str
228 test_filename: str
229 bases: list[str]
230 inheritance: list[str]
231 methods: dict
232 properties: dict
233 schemas: list[str]
234 inherited_schemas: list[str]
235 docstring: str
236
237 def __hash__(self):
238 return hash(self.__repr__())
239
240 def __repr__(self):
241 return ".".join([self.package, self.module, self.name])
242
243 def __lt__(self, other) -> bool:
244 return self.__repr__() < other.__repr__()
245
246 @property
247 def short_class_name(self) -> str:
248 return self.name.split(".")[-1]
249
250 @property
251 def full_class_name(self) -> str:
252 return f"{self.package}.{self.module}.{self.name}"
253
254 @staticmethod
255 def from_class_name(
256 class_name: str, index: dict[str, Any] | None = None, github_parent_path: str = ""
257 ) -> GithubClass:
258 if github_parent_path and not github_parent_path.endswith("/"):
259 github_parent_path = f"{github_parent_path}/"
260 if "." in class_name:
261 full_class_name = class_name
262 package, module, class_name = full_class_name.split(".", 2)
263 if index is not None:
264 clazz = GithubClass.from_class_name(class_name, index)
265 if clazz.package != package or clazz.module != module or clazz.name != class_name:
266 raise ValueError(f"Class mismatch: {full_class_name} vs {clazz}")
267 return clazz
268 else:
269 return GithubClass(
270 ids=[],
271 package="github",
272 module=class_name,
273 name=class_name,
274 filename=f"{github_parent_path}{package}/{module}.py",
275 test_filename=f"{github_parent_path}tests/{module}.py",
276 bases=[],
277 inheritance=[],
278 methods={},
279 properties={},

Callers 2

as_python_typeFunction · 0.85
from_class_nameMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…