MCPcopy Create free account
hub / github.com/libgit2/pygit2 / RemoteCallbacks

Class RemoteCallbacks

pygit2/callbacks.py:113–263  ·  view source on GitHub ↗

Base class for pygit2 remote callbacks. Inherit from this class and override the callbacks which you want to use in your class, which you can then pass to the network operations. For the credentials, you can either subclass and override the 'credentials' method, or if it's a consta

Source from the content-addressed store, hash-verified

111
112
113class RemoteCallbacks(Payload):
114 """Base class for pygit2 remote callbacks.
115
116 Inherit from this class and override the callbacks which you want to use
117 in your class, which you can then pass to the network operations.
118
119 For the credentials, you can either subclass and override the 'credentials'
120 method, or if it's a constant value, pass the value to the constructor,
121 e.g. RemoteCallbacks(credentials=credentials).
122
123 You can as well pass the certificate the same way, for example:
124 RemoteCallbacks(certificate=certificate).
125 """
126
127 push_options: Any
128
129 def __init__(
130 self,
131 credentials: _Credentials | None = None,
132 certificate_check: Callable[[None, bool, bytes], bool] | None = None,
133 ) -> None:
134 super().__init__()
135 if credentials is not None:
136 self.credentials = credentials # type: ignore[method-assign, assignment]
137 if certificate_check is not None:
138 self.certificate_check = certificate_check # type: ignore[method-assign, assignment]
139
140 def sideband_progress(self, string: str) -> None:
141 """
142 Progress output callback. Override this function with your own
143 progress reporting function
144
145 Parameters:
146
147 string : str
148 Progress output from the remote.
149 """
150
151 def credentials(
152 self,
153 url: str,
154 username_from_url: str | None,
155 allowed_types: CredentialType,
156 ) -> _Credentials:
157 """
158 Credentials callback. If the remote server requires authentication,
159 this function will be called and its return value used for
160 authentication. Override it if you want to be able to perform
161 authentication.
162
163 Returns: credential
164
165 Parameters:
166
167 url : str
168 The url of the remote.
169
170 username_from_url : str or None

Callers 6

test_push_optionsFunction · 0.90
test_push_threadsFunction · 0.90
clone_repositoryFunction · 0.85
git_fetch_optionsFunction · 0.85
git_push_optionsFunction · 0.85
git_remote_callbacksFunction · 0.85

Calls

no outgoing calls

Tested by 2

test_push_optionsFunction · 0.72
test_push_threadsFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…