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

Method __init__

github/GithubObject.py:525–570  ·  view source on GitHub ↗

A CompletableGithubObject can be partially initialised (completed=False). Accessing attributes that are not initialized will then trigger a request to complete all attributes. A partially initialized CompletableGithubObject (completed=False) can be completed via ``c

(
        self,
        requester: Requester,
        headers: dict[str, str | int] | None = None,
        attributes: dict[str, Any] | None = None,
        completed: bool | None = None,
        *,
        url: str | None = None,
        accept: str | None = None,
    )

Source from the content-addressed store, hash-verified

523
524class CompletableGithubObject(GithubObject, ABC):
525 def __init__(
526 self,
527 requester: Requester,
528 headers: dict[str, str | int] | None = None,
529 attributes: dict[str, Any] | None = None,
530 completed: bool | None = None,
531 *,
532 url: str | None = None,
533 accept: str | None = None,
534 ):
535 """
536 A CompletableGithubObject can be partially initialised (completed=False). Accessing attributes that are not
537 initialized will then trigger a request to complete all attributes.
538
539 A partially initialized CompletableGithubObject (completed=False) can be completed
540 via ``complete()``. This requires the url to be given via parameter ``url`` or ``attributes``.
541
542 With a requester where ``Requester.is_lazy == True``, this CompletableGithubObjects is
543 partially initialized. This requires the url to be given via parameter ``url`` or ``attributes``.
544 Any CompletableGithubObject created from this lazy object will be lazy itself if created with
545 parameter ``url`` or ``attributes``.
546
547 :param requester: requester
548 :param headers: response headers
549 :param attributes: attributes to initialize
550 :param completed: do not update non-initialized attributes when True
551 :param url: url of this instance, overrides attributes['url']
552 :param accept: use this accept header when completing this instance
553
554 """
555 response_given = headers is not None
556
557 if headers is None:
558 headers = {}
559 if attributes is None:
560 attributes = {}
561 if url is not None:
562 attributes["url"] = url
563 super().__init__(requester, headers, attributes)
564 self.__completed = completed if isinstance(completed, bool) else False
565 self.__completeHeaders = {"Accept": accept} if accept else None
566
567 # complete this completable object when requester indicates non-laziness and
568 # neither of complete and headers are given
569 if requester.is_not_lazy and completed is None and not response_given:
570 self.complete()
571
572 def _initAttributes(self) -> None:
573 self._url: Attribute[str] = NotSet

Callers

nothing calls this directly

Calls 2

completeMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected