repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
paramiko/paramiko | paramiko/buffered_pipe.py | BufferedPipe.set_event | def set_event(self, event):
"""
Set an event on this buffer. When data is ready to be read (or the
buffer has been closed), the event will be set. When no data is
ready, the event will be cleared.
:param threading.Event event: the event to set/clear
"""
self._l... | python | def set_event(self, event):
"""
Set an event on this buffer. When data is ready to be read (or the
buffer has been closed), the event will be set. When no data is
ready, the event will be cleared.
:param threading.Event event: the event to set/clear
"""
self._l... | [
"def",
"set_event",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_event",
"=",
"event",
"# Make sure the event starts in `set` state if we appear to already",
"# be closed; otherwise, if we start in `clea... | Set an event on this buffer. When data is ready to be read (or the
buffer has been closed), the event will be set. When no data is
ready, the event will be cleared.
:param threading.Event event: the event to set/clear | [
"Set",
"an",
"event",
"on",
"this",
"buffer",
".",
"When",
"data",
"is",
"ready",
"to",
"be",
"read",
"(",
"or",
"the",
"buffer",
"has",
"been",
"closed",
")",
"the",
"event",
"will",
"be",
"set",
".",
"When",
"no",
"data",
"is",
"ready",
"the",
"e... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/buffered_pipe.py#L69-L90 | train |
paramiko/paramiko | paramiko/buffered_pipe.py | BufferedPipe.feed | def feed(self, data):
"""
Feed new data into this pipe. This method is assumed to be called
from a separate thread, so synchronization is done.
:param data: the data to add, as a ``str`` or ``bytes``
"""
self._lock.acquire()
try:
if self._event is no... | python | def feed(self, data):
"""
Feed new data into this pipe. This method is assumed to be called
from a separate thread, so synchronization is done.
:param data: the data to add, as a ``str`` or ``bytes``
"""
self._lock.acquire()
try:
if self._event is no... | [
"def",
"feed",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"self",
".",
"_event",
"is",
"not",
"None",
":",
"self",
".",
"_event",
".",
"set",
"(",
")",
"self",
".",
"_buffer_frombytes",
"... | Feed new data into this pipe. This method is assumed to be called
from a separate thread, so synchronization is done.
:param data: the data to add, as a ``str`` or ``bytes`` | [
"Feed",
"new",
"data",
"into",
"this",
"pipe",
".",
"This",
"method",
"is",
"assumed",
"to",
"be",
"called",
"from",
"a",
"separate",
"thread",
"so",
"synchronization",
"is",
"done",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/buffered_pipe.py#L92-L106 | train |
paramiko/paramiko | paramiko/buffered_pipe.py | BufferedPipe.read_ready | def read_ready(self):
"""
Returns true if data is buffered and ready to be read from this
feeder. A ``False`` result does not mean that the feeder has closed;
it means you may need to wait before more data arrives.
:return:
``True`` if a `read` call would immediatel... | python | def read_ready(self):
"""
Returns true if data is buffered and ready to be read from this
feeder. A ``False`` result does not mean that the feeder has closed;
it means you may need to wait before more data arrives.
:return:
``True`` if a `read` call would immediatel... | [
"def",
"read_ready",
"(",
"self",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"len",
"(",
"self",
".",
"_buffer",
")",
"==",
"0",
":",
"return",
"False",
"return",
"True",
"finally",
":",
"self",
".",
"_lock",
".",
... | Returns true if data is buffered and ready to be read from this
feeder. A ``False`` result does not mean that the feeder has closed;
it means you may need to wait before more data arrives.
:return:
``True`` if a `read` call would immediately return at least one
byte; ``... | [
"Returns",
"true",
"if",
"data",
"is",
"buffered",
"and",
"ready",
"to",
"be",
"read",
"from",
"this",
"feeder",
".",
"A",
"False",
"result",
"does",
"not",
"mean",
"that",
"the",
"feeder",
"has",
"closed",
";",
"it",
"means",
"you",
"may",
"need",
"to... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/buffered_pipe.py#L108-L124 | train |
paramiko/paramiko | paramiko/buffered_pipe.py | BufferedPipe.read | def read(self, nbytes, timeout=None):
"""
Read data from the pipe. The return value is a string representing
the data received. The maximum amount of data to be received at once
is specified by ``nbytes``. If a string of length zero is returned,
the pipe has been closed.
... | python | def read(self, nbytes, timeout=None):
"""
Read data from the pipe. The return value is a string representing
the data received. The maximum amount of data to be received at once
is specified by ``nbytes``. If a string of length zero is returned,
the pipe has been closed.
... | [
"def",
"read",
"(",
"self",
",",
"nbytes",
",",
"timeout",
"=",
"None",
")",
":",
"out",
"=",
"bytes",
"(",
")",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"len",
"(",
"self",
".",
"_buffer",
")",
"==",
"0",
":",
"if",
... | Read data from the pipe. The return value is a string representing
the data received. The maximum amount of data to be received at once
is specified by ``nbytes``. If a string of length zero is returned,
the pipe has been closed.
The optional ``timeout`` argument can be a nonnegative... | [
"Read",
"data",
"from",
"the",
"pipe",
".",
"The",
"return",
"value",
"is",
"a",
"string",
"representing",
"the",
"data",
"received",
".",
"The",
"maximum",
"amount",
"of",
"data",
"to",
"be",
"received",
"at",
"once",
"is",
"specified",
"by",
"nbytes",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/buffered_pipe.py#L126-L178 | train |
paramiko/paramiko | paramiko/buffered_pipe.py | BufferedPipe.empty | def empty(self):
"""
Clear out the buffer and return all data that was in it.
:return:
any data that was in the buffer prior to clearing it out, as a
`str`
"""
self._lock.acquire()
try:
out = self._buffer_tobytes()
del self... | python | def empty(self):
"""
Clear out the buffer and return all data that was in it.
:return:
any data that was in the buffer prior to clearing it out, as a
`str`
"""
self._lock.acquire()
try:
out = self._buffer_tobytes()
del self... | [
"def",
"empty",
"(",
"self",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"out",
"=",
"self",
".",
"_buffer_tobytes",
"(",
")",
"del",
"self",
".",
"_buffer",
"[",
":",
"]",
"if",
"(",
"self",
".",
"_event",
"is",
"not",
... | Clear out the buffer and return all data that was in it.
:return:
any data that was in the buffer prior to clearing it out, as a
`str` | [
"Clear",
"out",
"the",
"buffer",
"and",
"return",
"all",
"data",
"that",
"was",
"in",
"it",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/buffered_pipe.py#L180-L196 | train |
paramiko/paramiko | paramiko/buffered_pipe.py | BufferedPipe.close | def close(self):
"""
Close this pipe object. Future calls to `read` after the buffer
has been emptied will return immediately with an empty string.
"""
self._lock.acquire()
try:
self._closed = True
self._cv.notifyAll()
if self._event i... | python | def close(self):
"""
Close this pipe object. Future calls to `read` after the buffer
has been emptied will return immediately with an empty string.
"""
self._lock.acquire()
try:
self._closed = True
self._cv.notifyAll()
if self._event i... | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_closed",
"=",
"True",
"self",
".",
"_cv",
".",
"notifyAll",
"(",
")",
"if",
"self",
".",
"_event",
"is",
"not",
"None",
":",
"self",... | Close this pipe object. Future calls to `read` after the buffer
has been emptied will return immediately with an empty string. | [
"Close",
"this",
"pipe",
"object",
".",
"Future",
"calls",
"to",
"read",
"after",
"the",
"buffer",
"has",
"been",
"emptied",
"will",
"return",
"immediately",
"with",
"an",
"empty",
"string",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/buffered_pipe.py#L198-L210 | train |
paramiko/paramiko | paramiko/config.py | SSHConfig.parse | def parse(self, file_obj):
"""
Read an OpenSSH config from the given file object.
:param file_obj: a file-like object to read the config file from
"""
host = {"host": ["*"], "config": {}}
for line in file_obj:
# Strip any leading or trailing whitespace from t... | python | def parse(self, file_obj):
"""
Read an OpenSSH config from the given file object.
:param file_obj: a file-like object to read the config file from
"""
host = {"host": ["*"], "config": {}}
for line in file_obj:
# Strip any leading or trailing whitespace from t... | [
"def",
"parse",
"(",
"self",
",",
"file_obj",
")",
":",
"host",
"=",
"{",
"\"host\"",
":",
"[",
"\"*\"",
"]",
",",
"\"config\"",
":",
"{",
"}",
"}",
"for",
"line",
"in",
"file_obj",
":",
"# Strip any leading or trailing whitespace from the line.",
"# Refer to ... | Read an OpenSSH config from the given file object.
:param file_obj: a file-like object to read the config file from | [
"Read",
"an",
"OpenSSH",
"config",
"from",
"the",
"given",
"file",
"object",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/config.py#L52-L94 | train |
paramiko/paramiko | paramiko/config.py | SSHConfig.lookup | def lookup(self, hostname):
"""
Return a dict (`SSHConfigDict`) of config options for a given hostname.
The host-matching rules of OpenSSH's ``ssh_config`` man page are used:
For each parameter, the first obtained value will be used. The
configuration files contain sections sep... | python | def lookup(self, hostname):
"""
Return a dict (`SSHConfigDict`) of config options for a given hostname.
The host-matching rules of OpenSSH's ``ssh_config`` man page are used:
For each parameter, the first obtained value will be used. The
configuration files contain sections sep... | [
"def",
"lookup",
"(",
"self",
",",
"hostname",
")",
":",
"matches",
"=",
"[",
"config",
"for",
"config",
"in",
"self",
".",
"_config",
"if",
"self",
".",
"_allowed",
"(",
"config",
"[",
"\"host\"",
"]",
",",
"hostname",
")",
"]",
"ret",
"=",
"SSHConf... | Return a dict (`SSHConfigDict`) of config options for a given hostname.
The host-matching rules of OpenSSH's ``ssh_config`` man page are used:
For each parameter, the first obtained value will be used. The
configuration files contain sections separated by ``Host``
specifications, and t... | [
"Return",
"a",
"dict",
"(",
"SSHConfigDict",
")",
"of",
"config",
"options",
"for",
"a",
"given",
"hostname",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/config.py#L96-L147 | train |
paramiko/paramiko | paramiko/config.py | SSHConfig.get_hostnames | def get_hostnames(self):
"""
Return the set of literal hostnames defined in the SSH config (both
explicit hostnames and wildcard entries).
"""
hosts = set()
for entry in self._config:
hosts.update(entry["host"])
return hosts | python | def get_hostnames(self):
"""
Return the set of literal hostnames defined in the SSH config (both
explicit hostnames and wildcard entries).
"""
hosts = set()
for entry in self._config:
hosts.update(entry["host"])
return hosts | [
"def",
"get_hostnames",
"(",
"self",
")",
":",
"hosts",
"=",
"set",
"(",
")",
"for",
"entry",
"in",
"self",
".",
"_config",
":",
"hosts",
".",
"update",
"(",
"entry",
"[",
"\"host\"",
"]",
")",
"return",
"hosts"
] | Return the set of literal hostnames defined in the SSH config (both
explicit hostnames and wildcard entries). | [
"Return",
"the",
"set",
"of",
"literal",
"hostnames",
"defined",
"in",
"the",
"SSH",
"config",
"(",
"both",
"explicit",
"hostnames",
"and",
"wildcard",
"entries",
")",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/config.py#L149-L157 | train |
paramiko/paramiko | paramiko/config.py | SSHConfig._expand_variables | def _expand_variables(self, config, hostname):
"""
Return a dict of config options with expanded substitutions
for a given hostname.
Please refer to man ``ssh_config`` for the parameters that
are replaced.
:param dict config: the config for the hostname
:param s... | python | def _expand_variables(self, config, hostname):
"""
Return a dict of config options with expanded substitutions
for a given hostname.
Please refer to man ``ssh_config`` for the parameters that
are replaced.
:param dict config: the config for the hostname
:param s... | [
"def",
"_expand_variables",
"(",
"self",
",",
"config",
",",
"hostname",
")",
":",
"if",
"\"hostname\"",
"in",
"config",
":",
"config",
"[",
"\"hostname\"",
"]",
"=",
"config",
"[",
"\"hostname\"",
"]",
".",
"replace",
"(",
"\"%h\"",
",",
"hostname",
")",
... | Return a dict of config options with expanded substitutions
for a given hostname.
Please refer to man ``ssh_config`` for the parameters that
are replaced.
:param dict config: the config for the hostname
:param str hostname: the hostname that the config belongs to | [
"Return",
"a",
"dict",
"of",
"config",
"options",
"with",
"expanded",
"substitutions",
"for",
"a",
"given",
"hostname",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/config.py#L168-L239 | train |
paramiko/paramiko | paramiko/config.py | SSHConfig._get_hosts | def _get_hosts(self, host):
"""
Return a list of host_names from host value.
"""
try:
return shlex.split(host)
except ValueError:
raise Exception("Unparsable host {}".format(host)) | python | def _get_hosts(self, host):
"""
Return a list of host_names from host value.
"""
try:
return shlex.split(host)
except ValueError:
raise Exception("Unparsable host {}".format(host)) | [
"def",
"_get_hosts",
"(",
"self",
",",
"host",
")",
":",
"try",
":",
"return",
"shlex",
".",
"split",
"(",
"host",
")",
"except",
"ValueError",
":",
"raise",
"Exception",
"(",
"\"Unparsable host {}\"",
".",
"format",
"(",
"host",
")",
")"
] | Return a list of host_names from host value. | [
"Return",
"a",
"list",
"of",
"host_names",
"from",
"host",
"value",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/config.py#L241-L248 | train |
paramiko/paramiko | paramiko/config.py | SSHConfigDict.as_bool | def as_bool(self, key):
"""
Express given key's value as a boolean type.
Typically, this is used for ``ssh_config``'s pseudo-boolean values
which are either ``"yes"`` or ``"no"``. In such cases, ``"yes"`` yields
``True`` and any other value becomes ``False``.
.. note::
... | python | def as_bool(self, key):
"""
Express given key's value as a boolean type.
Typically, this is used for ``ssh_config``'s pseudo-boolean values
which are either ``"yes"`` or ``"no"``. In such cases, ``"yes"`` yields
``True`` and any other value becomes ``False``.
.. note::
... | [
"def",
"as_bool",
"(",
"self",
",",
"key",
")",
":",
"val",
"=",
"self",
"[",
"key",
"]",
"if",
"isinstance",
"(",
"val",
",",
"bool",
")",
":",
"return",
"val",
"return",
"val",
".",
"lower",
"(",
")",
"==",
"\"yes\""
] | Express given key's value as a boolean type.
Typically, this is used for ``ssh_config``'s pseudo-boolean values
which are either ``"yes"`` or ``"no"``. In such cases, ``"yes"`` yields
``True`` and any other value becomes ``False``.
.. note::
If (for whatever reason) the sto... | [
"Express",
"given",
"key",
"s",
"value",
"as",
"a",
"boolean",
"type",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/config.py#L344-L361 | train |
paramiko/paramiko | paramiko/server.py | ServerInterface.check_auth_gssapi_with_mic | def check_auth_gssapi_with_mic(
self, username, gss_authenticated=AUTH_FAILED, cc_file=None
):
"""
Authenticate the given user to the server if he is a valid krb5
principal.
:param str username: The username of the authenticating client
:param int gss_authenticated: ... | python | def check_auth_gssapi_with_mic(
self, username, gss_authenticated=AUTH_FAILED, cc_file=None
):
"""
Authenticate the given user to the server if he is a valid krb5
principal.
:param str username: The username of the authenticating client
:param int gss_authenticated: ... | [
"def",
"check_auth_gssapi_with_mic",
"(",
"self",
",",
"username",
",",
"gss_authenticated",
"=",
"AUTH_FAILED",
",",
"cc_file",
"=",
"None",
")",
":",
"if",
"gss_authenticated",
"==",
"AUTH_SUCCESSFUL",
":",
"return",
"AUTH_SUCCESSFUL",
"return",
"AUTH_FAILED"
] | Authenticate the given user to the server if he is a valid krb5
principal.
:param str username: The username of the authenticating client
:param int gss_authenticated: The result of the krb5 authentication
:param str cc_filename: The krb5 client credentials cache filename
:retur... | [
"Authenticate",
"the",
"given",
"user",
"to",
"the",
"server",
"if",
"he",
"is",
"a",
"valid",
"krb5",
"principal",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/server.py#L239-L267 | train |
paramiko/paramiko | paramiko/server.py | ServerInterface.check_auth_gssapi_keyex | def check_auth_gssapi_keyex(
self, username, gss_authenticated=AUTH_FAILED, cc_file=None
):
"""
Authenticate the given user to the server if he is a valid krb5
principal and GSS-API Key Exchange was performed.
If GSS-API Key Exchange was not performed, this authentication met... | python | def check_auth_gssapi_keyex(
self, username, gss_authenticated=AUTH_FAILED, cc_file=None
):
"""
Authenticate the given user to the server if he is a valid krb5
principal and GSS-API Key Exchange was performed.
If GSS-API Key Exchange was not performed, this authentication met... | [
"def",
"check_auth_gssapi_keyex",
"(",
"self",
",",
"username",
",",
"gss_authenticated",
"=",
"AUTH_FAILED",
",",
"cc_file",
"=",
"None",
")",
":",
"if",
"gss_authenticated",
"==",
"AUTH_SUCCESSFUL",
":",
"return",
"AUTH_SUCCESSFUL",
"return",
"AUTH_FAILED"
] | Authenticate the given user to the server if he is a valid krb5
principal and GSS-API Key Exchange was performed.
If GSS-API Key Exchange was not performed, this authentication method
won't be available.
:param str username: The username of the authenticating client
:param int g... | [
"Authenticate",
"the",
"given",
"user",
"to",
"the",
"server",
"if",
"he",
"is",
"a",
"valid",
"krb5",
"principal",
"and",
"GSS",
"-",
"API",
"Key",
"Exchange",
"was",
"performed",
".",
"If",
"GSS",
"-",
"API",
"Key",
"Exchange",
"was",
"not",
"performed... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/server.py#L269-L299 | train |
paramiko/paramiko | paramiko/server.py | ServerInterface.check_channel_subsystem_request | def check_channel_subsystem_request(self, channel, name):
"""
Determine if a requested subsystem will be provided to the client on
the given channel. If this method returns ``True``, all future I/O
through this channel will be assumed to be connected to the requested
subsystem. ... | python | def check_channel_subsystem_request(self, channel, name):
"""
Determine if a requested subsystem will be provided to the client on
the given channel. If this method returns ``True``, all future I/O
through this channel will be assumed to be connected to the requested
subsystem. ... | [
"def",
"check_channel_subsystem_request",
"(",
"self",
",",
"channel",
",",
"name",
")",
":",
"transport",
"=",
"channel",
".",
"get_transport",
"(",
")",
"handler_class",
",",
"larg",
",",
"kwarg",
"=",
"transport",
".",
"_get_subsystem_handler",
"(",
"name",
... | Determine if a requested subsystem will be provided to the client on
the given channel. If this method returns ``True``, all future I/O
through this channel will be assumed to be connected to the requested
subsystem. An example of a subsystem is ``sftp``.
The default implementation ch... | [
"Determine",
"if",
"a",
"requested",
"subsystem",
"will",
"be",
"provided",
"to",
"the",
"client",
"on",
"the",
"given",
"channel",
".",
"If",
"this",
"method",
"returns",
"True",
"all",
"future",
"I",
"/",
"O",
"through",
"this",
"channel",
"will",
"be",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/server.py#L435-L463 | train |
paramiko/paramiko | paramiko/server.py | InteractiveQuery.add_prompt | def add_prompt(self, prompt, echo=True):
"""
Add a prompt to this query. The prompt should be a (reasonably short)
string. Multiple prompts can be added to the same query.
:param str prompt: the user prompt
:param bool echo:
``True`` (default) if the user's respons... | python | def add_prompt(self, prompt, echo=True):
"""
Add a prompt to this query. The prompt should be a (reasonably short)
string. Multiple prompts can be added to the same query.
:param str prompt: the user prompt
:param bool echo:
``True`` (default) if the user's respons... | [
"def",
"add_prompt",
"(",
"self",
",",
"prompt",
",",
"echo",
"=",
"True",
")",
":",
"self",
".",
"prompts",
".",
"append",
"(",
"(",
"prompt",
",",
"echo",
")",
")"
] | Add a prompt to this query. The prompt should be a (reasonably short)
string. Multiple prompts can be added to the same query.
:param str prompt: the user prompt
:param bool echo:
``True`` (default) if the user's response should be echoed;
``False`` if not (for a passw... | [
"Add",
"a",
"prompt",
"to",
"this",
"query",
".",
"The",
"prompt",
"should",
"be",
"a",
"(",
"reasonably",
"short",
")",
"string",
".",
"Multiple",
"prompts",
"can",
"be",
"added",
"to",
"the",
"same",
"query",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/server.py#L623-L633 | train |
paramiko/paramiko | paramiko/ssh_gss.py | GSSAuth | def GSSAuth(auth_method, gss_deleg_creds=True):
"""
Provide SSH2 GSS-API / SSPI authentication.
:param str auth_method: The name of the SSH authentication mechanism
(gssapi-with-mic or gss-keyex)
:param bool gss_deleg_creds: Delegate client credentials or not.
... | python | def GSSAuth(auth_method, gss_deleg_creds=True):
"""
Provide SSH2 GSS-API / SSPI authentication.
:param str auth_method: The name of the SSH authentication mechanism
(gssapi-with-mic or gss-keyex)
:param bool gss_deleg_creds: Delegate client credentials or not.
... | [
"def",
"GSSAuth",
"(",
"auth_method",
",",
"gss_deleg_creds",
"=",
"True",
")",
":",
"if",
"_API",
"==",
"\"MIT\"",
":",
"return",
"_SSH_GSSAPI",
"(",
"auth_method",
",",
"gss_deleg_creds",
")",
"elif",
"_API",
"==",
"\"SSPI\"",
"and",
"os",
".",
"name",
"... | Provide SSH2 GSS-API / SSPI authentication.
:param str auth_method: The name of the SSH authentication mechanism
(gssapi-with-mic or gss-keyex)
:param bool gss_deleg_creds: Delegate client credentials or not.
We delegate credentials by default.
:... | [
"Provide",
"SSH2",
"GSS",
"-",
"API",
"/",
"SSPI",
"authentication",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L68-L94 | train |
paramiko/paramiko | paramiko/ssh_gss.py | _SSH_GSSAuth.ssh_gss_oids | def ssh_gss_oids(self, mode="client"):
"""
This method returns a single OID, because we only support the
Kerberos V5 mechanism.
:param str mode: Client for client mode and server for server mode
:return: A byte sequence containing the number of supported
OIDs, t... | python | def ssh_gss_oids(self, mode="client"):
"""
This method returns a single OID, because we only support the
Kerberos V5 mechanism.
:param str mode: Client for client mode and server for server mode
:return: A byte sequence containing the number of supported
OIDs, t... | [
"def",
"ssh_gss_oids",
"(",
"self",
",",
"mode",
"=",
"\"client\"",
")",
":",
"from",
"pyasn1",
".",
"type",
".",
"univ",
"import",
"ObjectIdentifier",
"from",
"pyasn1",
".",
"codec",
".",
"der",
"import",
"encoder",
"OIDs",
"=",
"self",
".",
"_make_uint32... | This method returns a single OID, because we only support the
Kerberos V5 mechanism.
:param str mode: Client for client mode and server for server mode
:return: A byte sequence containing the number of supported
OIDs, the length of the OID and the actual OID encoded with
... | [
"This",
"method",
"returns",
"a",
"single",
"OID",
"because",
"we",
"only",
"support",
"the",
"Kerberos",
"V5",
"mechanism",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L150-L170 | train |
paramiko/paramiko | paramiko/ssh_gss.py | _SSH_GSSAuth.ssh_check_mech | def ssh_check_mech(self, desired_mech):
"""
Check if the given OID is the Kerberos V5 OID (server mode).
:param str desired_mech: The desired GSS-API mechanism of the client
:return: ``True`` if the given OID is supported, otherwise C{False}
"""
from pyasn1.codec.der imp... | python | def ssh_check_mech(self, desired_mech):
"""
Check if the given OID is the Kerberos V5 OID (server mode).
:param str desired_mech: The desired GSS-API mechanism of the client
:return: ``True`` if the given OID is supported, otherwise C{False}
"""
from pyasn1.codec.der imp... | [
"def",
"ssh_check_mech",
"(",
"self",
",",
"desired_mech",
")",
":",
"from",
"pyasn1",
".",
"codec",
".",
"der",
"import",
"decoder",
"mech",
",",
"__",
"=",
"decoder",
".",
"decode",
"(",
"desired_mech",
")",
"if",
"mech",
".",
"__str__",
"(",
")",
"!... | Check if the given OID is the Kerberos V5 OID (server mode).
:param str desired_mech: The desired GSS-API mechanism of the client
:return: ``True`` if the given OID is supported, otherwise C{False} | [
"Check",
"if",
"the",
"given",
"OID",
"is",
"the",
"Kerberos",
"V5",
"OID",
"(",
"server",
"mode",
")",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L172-L184 | train |
paramiko/paramiko | paramiko/ssh_gss.py | _SSH_GSSAuth._ssh_build_mic | def _ssh_build_mic(self, session_id, username, service, auth_method):
"""
Create the SSH2 MIC filed for gssapi-with-mic.
:param str session_id: The SSH session ID
:param str username: The name of the user who attempts to login
:param str service: The requested SSH service
... | python | def _ssh_build_mic(self, session_id, username, service, auth_method):
"""
Create the SSH2 MIC filed for gssapi-with-mic.
:param str session_id: The SSH session ID
:param str username: The name of the user who attempts to login
:param str service: The requested SSH service
... | [
"def",
"_ssh_build_mic",
"(",
"self",
",",
"session_id",
",",
"username",
",",
"service",
",",
"auth_method",
")",
":",
"mic",
"=",
"self",
".",
"_make_uint32",
"(",
"len",
"(",
"session_id",
")",
")",
"mic",
"+=",
"session_id",
"mic",
"+=",
"struct",
".... | Create the SSH2 MIC filed for gssapi-with-mic.
:param str session_id: The SSH session ID
:param str username: The name of the user who attempts to login
:param str service: The requested SSH service
:param str auth_method: The requested SSH authentication mechanism
:return: The ... | [
"Create",
"the",
"SSH2",
"MIC",
"filed",
"for",
"gssapi",
"-",
"with",
"-",
"mic",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L197-L223 | train |
paramiko/paramiko | paramiko/ssh_gss.py | _SSH_GSSAPI.ssh_init_sec_context | def ssh_init_sec_context(
self, target, desired_mech=None, username=None, recv_token=None
):
"""
Initialize a GSS-API context.
:param str username: The name of the user who attempts to login
:param str target: The hostname of the target to connect to
:param str desir... | python | def ssh_init_sec_context(
self, target, desired_mech=None, username=None, recv_token=None
):
"""
Initialize a GSS-API context.
:param str username: The name of the user who attempts to login
:param str target: The hostname of the target to connect to
:param str desir... | [
"def",
"ssh_init_sec_context",
"(",
"self",
",",
"target",
",",
"desired_mech",
"=",
"None",
",",
"username",
"=",
"None",
",",
"recv_token",
"=",
"None",
")",
":",
"from",
"pyasn1",
".",
"codec",
".",
"der",
"import",
"decoder",
"self",
".",
"_username",
... | Initialize a GSS-API context.
:param str username: The name of the user who attempts to login
:param str target: The hostname of the target to connect to
:param str desired_mech: The negotiated GSS-API mechanism
("pseudo negotiated" mechanism, because we
... | [
"Initialize",
"a",
"GSS",
"-",
"API",
"context",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L255-L305 | train |
paramiko/paramiko | paramiko/ssh_gss.py | _SSH_GSSAPI.ssh_accept_sec_context | def ssh_accept_sec_context(self, hostname, recv_token, username=None):
"""
Accept a GSS-API context (server mode).
:param str hostname: The servers hostname
:param str username: The name of the user who attempts to login
:param str recv_token: The GSS-API Token received from the... | python | def ssh_accept_sec_context(self, hostname, recv_token, username=None):
"""
Accept a GSS-API context (server mode).
:param str hostname: The servers hostname
:param str username: The name of the user who attempts to login
:param str recv_token: The GSS-API Token received from the... | [
"def",
"ssh_accept_sec_context",
"(",
"self",
",",
"hostname",
",",
"recv_token",
",",
"username",
"=",
"None",
")",
":",
"# hostname and username are not required for GSSAPI, but for SSPI",
"self",
".",
"_gss_host",
"=",
"hostname",
"self",
".",
"_username",
"=",
"us... | Accept a GSS-API context (server mode).
:param str hostname: The servers hostname
:param str username: The name of the user who attempts to login
:param str recv_token: The GSS-API Token received from the server,
if it's not the initial call.
:return: A ``... | [
"Accept",
"a",
"GSS",
"-",
"API",
"context",
"(",
"server",
"mode",
")",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L334-L352 | train |
paramiko/paramiko | paramiko/ssh_gss.py | _SSH_SSPI.ssh_init_sec_context | def ssh_init_sec_context(
self, target, desired_mech=None, username=None, recv_token=None
):
"""
Initialize a SSPI context.
:param str username: The name of the user who attempts to login
:param str target: The FQDN of the target to connect to
:param str desired_mech... | python | def ssh_init_sec_context(
self, target, desired_mech=None, username=None, recv_token=None
):
"""
Initialize a SSPI context.
:param str username: The name of the user who attempts to login
:param str target: The FQDN of the target to connect to
:param str desired_mech... | [
"def",
"ssh_init_sec_context",
"(",
"self",
",",
"target",
",",
"desired_mech",
"=",
"None",
",",
"username",
"=",
"None",
",",
"recv_token",
"=",
"None",
")",
":",
"from",
"pyasn1",
".",
"codec",
".",
"der",
"import",
"decoder",
"self",
".",
"_username",
... | Initialize a SSPI context.
:param str username: The name of the user who attempts to login
:param str target: The FQDN of the target to connect to
:param str desired_mech: The negotiated SSPI mechanism
("pseudo negotiated" mechanism, because we
... | [
"Initialize",
"a",
"SSPI",
"context",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L431-L481 | train |
paramiko/paramiko | paramiko/ssh_gss.py | _SSH_SSPI.ssh_get_mic | def ssh_get_mic(self, session_id, gss_kex=False):
"""
Create the MIC token for a SSH2 message.
:param str session_id: The SSH session ID
:param bool gss_kex: Generate the MIC for Key Exchange with SSPI or not
:return: gssapi-with-mic:
Returns the MIC token from ... | python | def ssh_get_mic(self, session_id, gss_kex=False):
"""
Create the MIC token for a SSH2 message.
:param str session_id: The SSH session ID
:param bool gss_kex: Generate the MIC for Key Exchange with SSPI or not
:return: gssapi-with-mic:
Returns the MIC token from ... | [
"def",
"ssh_get_mic",
"(",
"self",
",",
"session_id",
",",
"gss_kex",
"=",
"False",
")",
":",
"self",
".",
"_session_id",
"=",
"session_id",
"if",
"not",
"gss_kex",
":",
"mic_field",
"=",
"self",
".",
"_ssh_build_mic",
"(",
"self",
".",
"_session_id",
",",... | Create the MIC token for a SSH2 message.
:param str session_id: The SSH session ID
:param bool gss_kex: Generate the MIC for Key Exchange with SSPI or not
:return: gssapi-with-mic:
Returns the MIC token from SSPI for the message we created
with ``_ssh_build_mic... | [
"Create",
"the",
"MIC",
"token",
"for",
"a",
"SSH2",
"message",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L483-L508 | train |
paramiko/paramiko | paramiko/ssh_gss.py | _SSH_SSPI.ssh_accept_sec_context | def ssh_accept_sec_context(self, hostname, username, recv_token):
"""
Accept a SSPI context (server mode).
:param str hostname: The servers FQDN
:param str username: The name of the user who attempts to login
:param str recv_token: The SSPI Token received from the server,
... | python | def ssh_accept_sec_context(self, hostname, username, recv_token):
"""
Accept a SSPI context (server mode).
:param str hostname: The servers FQDN
:param str username: The name of the user who attempts to login
:param str recv_token: The SSPI Token received from the server,
... | [
"def",
"ssh_accept_sec_context",
"(",
"self",
",",
"hostname",
",",
"username",
",",
"recv_token",
")",
":",
"self",
".",
"_gss_host",
"=",
"hostname",
"self",
".",
"_username",
"=",
"username",
"targ_name",
"=",
"\"host/\"",
"+",
"self",
".",
"_gss_host",
"... | Accept a SSPI context (server mode).
:param str hostname: The servers FQDN
:param str username: The name of the user who attempts to login
:param str recv_token: The SSPI Token received from the server,
if it's not the initial call.
:return: A ``String`` i... | [
"Accept",
"a",
"SSPI",
"context",
"(",
"server",
"mode",
")",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L510-L530 | train |
paramiko/paramiko | paramiko/ssh_gss.py | _SSH_SSPI.ssh_check_mic | def ssh_check_mic(self, mic_token, session_id, username=None):
"""
Verify the MIC token for a SSH2 message.
:param str mic_token: The MIC token received from the client
:param str session_id: The SSH session ID
:param str username: The name of the user who attempts to login
... | python | def ssh_check_mic(self, mic_token, session_id, username=None):
"""
Verify the MIC token for a SSH2 message.
:param str mic_token: The MIC token received from the client
:param str session_id: The SSH session ID
:param str username: The name of the user who attempts to login
... | [
"def",
"ssh_check_mic",
"(",
"self",
",",
"mic_token",
",",
"session_id",
",",
"username",
"=",
"None",
")",
":",
"self",
".",
"_session_id",
"=",
"session_id",
"self",
".",
"_username",
"=",
"username",
"if",
"username",
"is",
"not",
"None",
":",
"# serve... | Verify the MIC token for a SSH2 message.
:param str mic_token: The MIC token received from the client
:param str session_id: The SSH session ID
:param str username: The name of the user who attempts to login
:return: None if the MIC check was successful
:raises: ``sspi.error`` -... | [
"Verify",
"the",
"MIC",
"token",
"for",
"a",
"SSH2",
"message",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L532-L560 | train |
paramiko/paramiko | paramiko/ssh_gss.py | _SSH_SSPI.credentials_delegated | def credentials_delegated(self):
"""
Checks if credentials are delegated (server mode).
:return: ``True`` if credentials are delegated, otherwise ``False``
"""
return self._gss_flags & sspicon.ISC_REQ_DELEGATE and (
self._gss_srv_ctxt_status or self._gss_flags
... | python | def credentials_delegated(self):
"""
Checks if credentials are delegated (server mode).
:return: ``True`` if credentials are delegated, otherwise ``False``
"""
return self._gss_flags & sspicon.ISC_REQ_DELEGATE and (
self._gss_srv_ctxt_status or self._gss_flags
... | [
"def",
"credentials_delegated",
"(",
"self",
")",
":",
"return",
"self",
".",
"_gss_flags",
"&",
"sspicon",
".",
"ISC_REQ_DELEGATE",
"and",
"(",
"self",
".",
"_gss_srv_ctxt_status",
"or",
"self",
".",
"_gss_flags",
")"
] | Checks if credentials are delegated (server mode).
:return: ``True`` if credentials are delegated, otherwise ``False`` | [
"Checks",
"if",
"credentials",
"are",
"delegated",
"(",
"server",
"mode",
")",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L563-L571 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient.from_transport | def from_transport(cls, t, window_size=None, max_packet_size=None):
"""
Create an SFTP client channel from an open `.Transport`.
Setting the window and packet sizes might affect the transfer speed.
The default settings in the `.Transport` class are the same as in
OpenSSH and sho... | python | def from_transport(cls, t, window_size=None, max_packet_size=None):
"""
Create an SFTP client channel from an open `.Transport`.
Setting the window and packet sizes might affect the transfer speed.
The default settings in the `.Transport` class are the same as in
OpenSSH and sho... | [
"def",
"from_transport",
"(",
"cls",
",",
"t",
",",
"window_size",
"=",
"None",
",",
"max_packet_size",
"=",
"None",
")",
":",
"chan",
"=",
"t",
".",
"open_session",
"(",
"window_size",
"=",
"window_size",
",",
"max_packet_size",
"=",
"max_packet_size",
")",... | Create an SFTP client channel from an open `.Transport`.
Setting the window and packet sizes might affect the transfer speed.
The default settings in the `.Transport` class are the same as in
OpenSSH and should work adequately for both files transfers and
interactive sessions.
... | [
"Create",
"an",
"SFTP",
"client",
"channel",
"from",
"an",
"open",
".",
"Transport",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L141-L170 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient.listdir_iter | def listdir_iter(self, path=".", read_aheads=50):
"""
Generator version of `.listdir_attr`.
See the API docs for `.listdir_attr` for overall details.
This function adds one more kwarg on top of `.listdir_attr`:
``read_aheads``, an integer controlling how many
``SSH_FXP_... | python | def listdir_iter(self, path=".", read_aheads=50):
"""
Generator version of `.listdir_attr`.
See the API docs for `.listdir_attr` for overall details.
This function adds one more kwarg on top of `.listdir_attr`:
``read_aheads``, an integer controlling how many
``SSH_FXP_... | [
"def",
"listdir_iter",
"(",
"self",
",",
"path",
"=",
"\".\"",
",",
"read_aheads",
"=",
"50",
")",
":",
"path",
"=",
"self",
".",
"_adjust_cwd",
"(",
"path",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"listdir({!r})\"",
".",
"format",
"(",
"path",
... | Generator version of `.listdir_attr`.
See the API docs for `.listdir_attr` for overall details.
This function adds one more kwarg on top of `.listdir_attr`:
``read_aheads``, an integer controlling how many
``SSH_FXP_READDIR`` requests are made to the server. The default of 50
s... | [
"Generator",
"version",
"of",
".",
"listdir_attr",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L262-L324 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient.rename | def rename(self, oldpath, newpath):
"""
Rename a file or folder from ``oldpath`` to ``newpath``.
.. note::
This method implements 'standard' SFTP ``RENAME`` behavior; those
seeking the OpenSSH "POSIX rename" extension behavior should use
`posix_rename`.
... | python | def rename(self, oldpath, newpath):
"""
Rename a file or folder from ``oldpath`` to ``newpath``.
.. note::
This method implements 'standard' SFTP ``RENAME`` behavior; those
seeking the OpenSSH "POSIX rename" extension behavior should use
`posix_rename`.
... | [
"def",
"rename",
"(",
"self",
",",
"oldpath",
",",
"newpath",
")",
":",
"oldpath",
"=",
"self",
".",
"_adjust_cwd",
"(",
"oldpath",
")",
"newpath",
"=",
"self",
".",
"_adjust_cwd",
"(",
"newpath",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"rename(... | Rename a file or folder from ``oldpath`` to ``newpath``.
.. note::
This method implements 'standard' SFTP ``RENAME`` behavior; those
seeking the OpenSSH "POSIX rename" extension behavior should use
`posix_rename`.
:param str oldpath:
existing name of the... | [
"Rename",
"a",
"file",
"or",
"folder",
"from",
"oldpath",
"to",
"newpath",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L402-L423 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient.posix_rename | def posix_rename(self, oldpath, newpath):
"""
Rename a file or folder from ``oldpath`` to ``newpath``, following
posix conventions.
:param str oldpath: existing name of the file or folder
:param str newpath: new name for the file or folder, will be
overwritten if it ... | python | def posix_rename(self, oldpath, newpath):
"""
Rename a file or folder from ``oldpath`` to ``newpath``, following
posix conventions.
:param str oldpath: existing name of the file or folder
:param str newpath: new name for the file or folder, will be
overwritten if it ... | [
"def",
"posix_rename",
"(",
"self",
",",
"oldpath",
",",
"newpath",
")",
":",
"oldpath",
"=",
"self",
".",
"_adjust_cwd",
"(",
"oldpath",
")",
"newpath",
"=",
"self",
".",
"_adjust_cwd",
"(",
"newpath",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"p... | Rename a file or folder from ``oldpath`` to ``newpath``, following
posix conventions.
:param str oldpath: existing name of the file or folder
:param str newpath: new name for the file or folder, will be
overwritten if it already exists
:raises:
``IOError`` -- if... | [
"Rename",
"a",
"file",
"or",
"folder",
"from",
"oldpath",
"to",
"newpath",
"following",
"posix",
"conventions",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L425-L445 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient.mkdir | def mkdir(self, path, mode=o777):
"""
Create a folder (directory) named ``path`` with numeric mode ``mode``.
The default mode is 0777 (octal). On some systems, mode is ignored.
Where it is used, the current umask value is first masked out.
:param str path: name of the folder to... | python | def mkdir(self, path, mode=o777):
"""
Create a folder (directory) named ``path`` with numeric mode ``mode``.
The default mode is 0777 (octal). On some systems, mode is ignored.
Where it is used, the current umask value is first masked out.
:param str path: name of the folder to... | [
"def",
"mkdir",
"(",
"self",
",",
"path",
",",
"mode",
"=",
"o777",
")",
":",
"path",
"=",
"self",
".",
"_adjust_cwd",
"(",
"path",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"mkdir({!r}, {!r})\"",
".",
"format",
"(",
"path",
",",
"mode",
")",
... | Create a folder (directory) named ``path`` with numeric mode ``mode``.
The default mode is 0777 (octal). On some systems, mode is ignored.
Where it is used, the current umask value is first masked out.
:param str path: name of the folder to create
:param int mode: permissions (posix-st... | [
"Create",
"a",
"folder",
"(",
"directory",
")",
"named",
"path",
"with",
"numeric",
"mode",
"mode",
".",
"The",
"default",
"mode",
"is",
"0777",
"(",
"octal",
")",
".",
"On",
"some",
"systems",
"mode",
"is",
"ignored",
".",
"Where",
"it",
"is",
"used",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L447-L460 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient.symlink | def symlink(self, source, dest):
"""
Create a symbolic link to the ``source`` path at ``destination``.
:param str source: path of the original file
:param str dest: path of the newly created symlink
"""
dest = self._adjust_cwd(dest)
self._log(DEBUG, "symlink({!r}... | python | def symlink(self, source, dest):
"""
Create a symbolic link to the ``source`` path at ``destination``.
:param str source: path of the original file
:param str dest: path of the newly created symlink
"""
dest = self._adjust_cwd(dest)
self._log(DEBUG, "symlink({!r}... | [
"def",
"symlink",
"(",
"self",
",",
"source",
",",
"dest",
")",
":",
"dest",
"=",
"self",
".",
"_adjust_cwd",
"(",
"dest",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"symlink({!r}, {!r})\"",
".",
"format",
"(",
"source",
",",
"dest",
")",
")",
"s... | Create a symbolic link to the ``source`` path at ``destination``.
:param str source: path of the original file
:param str dest: path of the newly created symlink | [
"Create",
"a",
"symbolic",
"link",
"to",
"the",
"source",
"path",
"at",
"destination",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L516-L526 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient.chown | def chown(self, path, uid, gid):
"""
Change the owner (``uid``) and group (``gid``) of a file. As with
Python's `os.chown` function, you must pass both arguments, so if you
only want to change one, use `stat` first to retrieve the current
owner and group.
:param str pat... | python | def chown(self, path, uid, gid):
"""
Change the owner (``uid``) and group (``gid``) of a file. As with
Python's `os.chown` function, you must pass both arguments, so if you
only want to change one, use `stat` first to retrieve the current
owner and group.
:param str pat... | [
"def",
"chown",
"(",
"self",
",",
"path",
",",
"uid",
",",
"gid",
")",
":",
"path",
"=",
"self",
".",
"_adjust_cwd",
"(",
"path",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"chown({!r}, {!r}, {!r})\"",
".",
"format",
"(",
"path",
",",
"uid",
",",... | Change the owner (``uid``) and group (``gid``) of a file. As with
Python's `os.chown` function, you must pass both arguments, so if you
only want to change one, use `stat` first to retrieve the current
owner and group.
:param str path: path of the file to change the owner and group of
... | [
"Change",
"the",
"owner",
"(",
"uid",
")",
"and",
"group",
"(",
"gid",
")",
"of",
"a",
"file",
".",
"As",
"with",
"Python",
"s",
"os",
".",
"chown",
"function",
"you",
"must",
"pass",
"both",
"arguments",
"so",
"if",
"you",
"only",
"want",
"to",
"c... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L543-L558 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient.utime | def utime(self, path, times):
"""
Set the access and modified times of the file specified by ``path``.
If ``times`` is ``None``, then the file's access and modified times
are set to the current time. Otherwise, ``times`` must be a 2-tuple
of numbers, of the form ``(atime, mtime)... | python | def utime(self, path, times):
"""
Set the access and modified times of the file specified by ``path``.
If ``times`` is ``None``, then the file's access and modified times
are set to the current time. Otherwise, ``times`` must be a 2-tuple
of numbers, of the form ``(atime, mtime)... | [
"def",
"utime",
"(",
"self",
",",
"path",
",",
"times",
")",
":",
"path",
"=",
"self",
".",
"_adjust_cwd",
"(",
"path",
")",
"if",
"times",
"is",
"None",
":",
"times",
"=",
"(",
"time",
".",
"time",
"(",
")",
",",
"time",
".",
"time",
"(",
")",... | Set the access and modified times of the file specified by ``path``.
If ``times`` is ``None``, then the file's access and modified times
are set to the current time. Otherwise, ``times`` must be a 2-tuple
of numbers, of the form ``(atime, mtime)``, which is used to set the
access and mo... | [
"Set",
"the",
"access",
"and",
"modified",
"times",
"of",
"the",
"file",
"specified",
"by",
"path",
".",
"If",
"times",
"is",
"None",
"then",
"the",
"file",
"s",
"access",
"and",
"modified",
"times",
"are",
"set",
"to",
"the",
"current",
"time",
".",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L560-L580 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient.truncate | def truncate(self, path, size):
"""
Change the size of the file specified by ``path``. This usually
extends or shrinks the size of the file, just like the `~file.truncate`
method on Python file objects.
:param str path: path of the file to modify
:param int size: the ne... | python | def truncate(self, path, size):
"""
Change the size of the file specified by ``path``. This usually
extends or shrinks the size of the file, just like the `~file.truncate`
method on Python file objects.
:param str path: path of the file to modify
:param int size: the ne... | [
"def",
"truncate",
"(",
"self",
",",
"path",
",",
"size",
")",
":",
"path",
"=",
"self",
".",
"_adjust_cwd",
"(",
"path",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"truncate({!r}, {!r})\"",
".",
"format",
"(",
"path",
",",
"size",
")",
")",
"att... | Change the size of the file specified by ``path``. This usually
extends or shrinks the size of the file, just like the `~file.truncate`
method on Python file objects.
:param str path: path of the file to modify
:param int size: the new size of the file | [
"Change",
"the",
"size",
"of",
"the",
"file",
"specified",
"by",
"path",
".",
"This",
"usually",
"extends",
"or",
"shrinks",
"the",
"size",
"of",
"the",
"file",
"just",
"like",
"the",
"~file",
".",
"truncate",
"method",
"on",
"Python",
"file",
"objects",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L582-L595 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient.putfo | def putfo(self, fl, remotepath, file_size=0, callback=None, confirm=True):
"""
Copy the contents of an open file object (``fl``) to the SFTP server as
``remotepath``. Any exception raised by operations will be passed
through.
The SFTP operations use pipelining for speed.
... | python | def putfo(self, fl, remotepath, file_size=0, callback=None, confirm=True):
"""
Copy the contents of an open file object (``fl``) to the SFTP server as
``remotepath``. Any exception raised by operations will be passed
through.
The SFTP operations use pipelining for speed.
... | [
"def",
"putfo",
"(",
"self",
",",
"fl",
",",
"remotepath",
",",
"file_size",
"=",
"0",
",",
"callback",
"=",
"None",
",",
"confirm",
"=",
"True",
")",
":",
"with",
"self",
".",
"file",
"(",
"remotepath",
",",
"\"wb\"",
")",
"as",
"fr",
":",
"fr",
... | Copy the contents of an open file object (``fl``) to the SFTP server as
``remotepath``. Any exception raised by operations will be passed
through.
The SFTP operations use pipelining for speed.
:param fl: opened file or file-like object to copy
:param str remotepath: the destina... | [
"Copy",
"the",
"contents",
"of",
"an",
"open",
"file",
"object",
"(",
"fl",
")",
"to",
"the",
"SFTP",
"server",
"as",
"remotepath",
".",
"Any",
"exception",
"raised",
"by",
"operations",
"will",
"be",
"passed",
"through",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L687-L727 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient.put | def put(self, localpath, remotepath, callback=None, confirm=True):
"""
Copy a local file (``localpath``) to the SFTP server as ``remotepath``.
Any exception raised by operations will be passed through. This
method is primarily provided as a convenience.
The SFTP operations use ... | python | def put(self, localpath, remotepath, callback=None, confirm=True):
"""
Copy a local file (``localpath``) to the SFTP server as ``remotepath``.
Any exception raised by operations will be passed through. This
method is primarily provided as a convenience.
The SFTP operations use ... | [
"def",
"put",
"(",
"self",
",",
"localpath",
",",
"remotepath",
",",
"callback",
"=",
"None",
",",
"confirm",
"=",
"True",
")",
":",
"file_size",
"=",
"os",
".",
"stat",
"(",
"localpath",
")",
".",
"st_size",
"with",
"open",
"(",
"localpath",
",",
"\... | Copy a local file (``localpath``) to the SFTP server as ``remotepath``.
Any exception raised by operations will be passed through. This
method is primarily provided as a convenience.
The SFTP operations use pipelining for speed.
:param str localpath: the local file to copy
:pa... | [
"Copy",
"a",
"local",
"file",
"(",
"localpath",
")",
"to",
"the",
"SFTP",
"server",
"as",
"remotepath",
".",
"Any",
"exception",
"raised",
"by",
"operations",
"will",
"be",
"passed",
"through",
".",
"This",
"method",
"is",
"primarily",
"provided",
"as",
"a... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L729-L759 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient.getfo | def getfo(self, remotepath, fl, callback=None):
"""
Copy a remote file (``remotepath``) from the SFTP server and write to
an open file or file-like object, ``fl``. Any exception raised by
operations will be passed through. This method is primarily provided
as a convenience.
... | python | def getfo(self, remotepath, fl, callback=None):
"""
Copy a remote file (``remotepath``) from the SFTP server and write to
an open file or file-like object, ``fl``. Any exception raised by
operations will be passed through. This method is primarily provided
as a convenience.
... | [
"def",
"getfo",
"(",
"self",
",",
"remotepath",
",",
"fl",
",",
"callback",
"=",
"None",
")",
":",
"file_size",
"=",
"self",
".",
"stat",
"(",
"remotepath",
")",
".",
"st_size",
"with",
"self",
".",
"open",
"(",
"remotepath",
",",
"\"rb\"",
")",
"as"... | Copy a remote file (``remotepath``) from the SFTP server and write to
an open file or file-like object, ``fl``. Any exception raised by
operations will be passed through. This method is primarily provided
as a convenience.
:param object remotepath: opened file or file-like object to c... | [
"Copy",
"a",
"remote",
"file",
"(",
"remotepath",
")",
"from",
"the",
"SFTP",
"server",
"and",
"write",
"to",
"an",
"open",
"file",
"or",
"file",
"-",
"like",
"object",
"fl",
".",
"Any",
"exception",
"raised",
"by",
"operations",
"will",
"be",
"passed",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L761-L783 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient.get | def get(self, remotepath, localpath, callback=None):
"""
Copy a remote file (``remotepath``) from the SFTP server to the local
host as ``localpath``. Any exception raised by operations will be
passed through. This method is primarily provided as a convenience.
:param str remot... | python | def get(self, remotepath, localpath, callback=None):
"""
Copy a remote file (``remotepath``) from the SFTP server to the local
host as ``localpath``. Any exception raised by operations will be
passed through. This method is primarily provided as a convenience.
:param str remot... | [
"def",
"get",
"(",
"self",
",",
"remotepath",
",",
"localpath",
",",
"callback",
"=",
"None",
")",
":",
"with",
"open",
"(",
"localpath",
",",
"\"wb\"",
")",
"as",
"fl",
":",
"size",
"=",
"self",
".",
"getfo",
"(",
"remotepath",
",",
"fl",
",",
"ca... | Copy a remote file (``remotepath``) from the SFTP server to the local
host as ``localpath``. Any exception raised by operations will be
passed through. This method is primarily provided as a convenience.
:param str remotepath: the remote file to copy
:param str localpath: the destinat... | [
"Copy",
"a",
"remote",
"file",
"(",
"remotepath",
")",
"from",
"the",
"SFTP",
"server",
"to",
"the",
"local",
"host",
"as",
"localpath",
".",
"Any",
"exception",
"raised",
"by",
"operations",
"will",
"be",
"passed",
"through",
".",
"This",
"method",
"is",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L785-L807 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient._convert_status | def _convert_status(self, msg):
"""
Raises EOFError or IOError on error status; otherwise does nothing.
"""
code = msg.get_int()
text = msg.get_text()
if code == SFTP_OK:
return
elif code == SFTP_EOF:
raise EOFError(text)
elif code ... | python | def _convert_status(self, msg):
"""
Raises EOFError or IOError on error status; otherwise does nothing.
"""
code = msg.get_int()
text = msg.get_text()
if code == SFTP_OK:
return
elif code == SFTP_EOF:
raise EOFError(text)
elif code ... | [
"def",
"_convert_status",
"(",
"self",
",",
"msg",
")",
":",
"code",
"=",
"msg",
".",
"get_int",
"(",
")",
"text",
"=",
"msg",
".",
"get_text",
"(",
")",
"if",
"code",
"==",
"SFTP_OK",
":",
"return",
"elif",
"code",
"==",
"SFTP_EOF",
":",
"raise",
... | Raises EOFError or IOError on error status; otherwise does nothing. | [
"Raises",
"EOFError",
"or",
"IOError",
"on",
"error",
"status",
";",
"otherwise",
"does",
"nothing",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L882-L898 | train |
paramiko/paramiko | paramiko/sftp_client.py | SFTPClient._adjust_cwd | def _adjust_cwd(self, path):
"""
Return an adjusted path if we're emulating a "current working
directory" for the server.
"""
path = b(path)
if self._cwd is None:
return path
if len(path) and path[0:1] == b_slash:
# absolute path
... | python | def _adjust_cwd(self, path):
"""
Return an adjusted path if we're emulating a "current working
directory" for the server.
"""
path = b(path)
if self._cwd is None:
return path
if len(path) and path[0:1] == b_slash:
# absolute path
... | [
"def",
"_adjust_cwd",
"(",
"self",
",",
"path",
")",
":",
"path",
"=",
"b",
"(",
"path",
")",
"if",
"self",
".",
"_cwd",
"is",
"None",
":",
"return",
"path",
"if",
"len",
"(",
"path",
")",
"and",
"path",
"[",
"0",
":",
"1",
"]",
"==",
"b_slash"... | Return an adjusted path if we're emulating a "current working
directory" for the server. | [
"Return",
"an",
"adjusted",
"path",
"if",
"we",
"re",
"emulating",
"a",
"current",
"working",
"directory",
"for",
"the",
"server",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L900-L913 | train |
paramiko/paramiko | tasks.py | coverage | def coverage(ctx, opts=""):
"""
Execute all tests (normal and slow) with coverage enabled.
"""
return test(ctx, coverage=True, include_slow=True, opts=opts) | python | def coverage(ctx, opts=""):
"""
Execute all tests (normal and slow) with coverage enabled.
"""
return test(ctx, coverage=True, include_slow=True, opts=opts) | [
"def",
"coverage",
"(",
"ctx",
",",
"opts",
"=",
"\"\"",
")",
":",
"return",
"test",
"(",
"ctx",
",",
"coverage",
"=",
"True",
",",
"include_slow",
"=",
"True",
",",
"opts",
"=",
"opts",
")"
] | Execute all tests (normal and slow) with coverage enabled. | [
"Execute",
"all",
"tests",
"(",
"normal",
"and",
"slow",
")",
"with",
"coverage",
"enabled",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/tasks.py#L78-L82 | train |
paramiko/paramiko | tasks.py | guard | def guard(ctx, opts=""):
"""
Execute all tests and then watch for changes, re-running.
"""
# TODO if coverage was run via pytest-cov, we could add coverage here too
return test(ctx, include_slow=True, loop_on_fail=True, opts=opts) | python | def guard(ctx, opts=""):
"""
Execute all tests and then watch for changes, re-running.
"""
# TODO if coverage was run via pytest-cov, we could add coverage here too
return test(ctx, include_slow=True, loop_on_fail=True, opts=opts) | [
"def",
"guard",
"(",
"ctx",
",",
"opts",
"=",
"\"\"",
")",
":",
"# TODO if coverage was run via pytest-cov, we could add coverage here too",
"return",
"test",
"(",
"ctx",
",",
"include_slow",
"=",
"True",
",",
"loop_on_fail",
"=",
"True",
",",
"opts",
"=",
"opts",... | Execute all tests and then watch for changes, re-running. | [
"Execute",
"all",
"tests",
"and",
"then",
"watch",
"for",
"changes",
"re",
"-",
"running",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/tasks.py#L86-L91 | train |
paramiko/paramiko | tasks.py | release | def release(ctx, sdist=True, wheel=True, sign=True, dry_run=False, index=None):
"""
Wraps invocations.packaging.publish to add baked-in docs folder.
"""
# Build docs first. Use terribad workaround pending invoke #146
ctx.run("inv docs", pty=True, hide=False)
# Move the built docs into where Epyd... | python | def release(ctx, sdist=True, wheel=True, sign=True, dry_run=False, index=None):
"""
Wraps invocations.packaging.publish to add baked-in docs folder.
"""
# Build docs first. Use terribad workaround pending invoke #146
ctx.run("inv docs", pty=True, hide=False)
# Move the built docs into where Epyd... | [
"def",
"release",
"(",
"ctx",
",",
"sdist",
"=",
"True",
",",
"wheel",
"=",
"True",
",",
"sign",
"=",
"True",
",",
"dry_run",
"=",
"False",
",",
"index",
"=",
"None",
")",
":",
"# Build docs first. Use terribad workaround pending invoke #146",
"ctx",
".",
"r... | Wraps invocations.packaging.publish to add baked-in docs folder. | [
"Wraps",
"invocations",
".",
"packaging",
".",
"publish",
"to",
"add",
"baked",
"-",
"in",
"docs",
"folder",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/tasks.py#L98-L117 | train |
paramiko/paramiko | paramiko/transport.py | Transport.set_gss_host | def set_gss_host(self, gss_host, trust_dns=True, gssapi_requested=True):
"""
Normalize/canonicalize ``self.gss_host`` depending on various factors.
:param str gss_host:
The explicitly requested GSS-oriented hostname to connect to (i.e.
what the host's name is in the Kerb... | python | def set_gss_host(self, gss_host, trust_dns=True, gssapi_requested=True):
"""
Normalize/canonicalize ``self.gss_host`` depending on various factors.
:param str gss_host:
The explicitly requested GSS-oriented hostname to connect to (i.e.
what the host's name is in the Kerb... | [
"def",
"set_gss_host",
"(",
"self",
",",
"gss_host",
",",
"trust_dns",
"=",
"True",
",",
"gssapi_requested",
"=",
"True",
")",
":",
"# No GSSAPI in play == nothing to do",
"if",
"not",
"gssapi_requested",
":",
"return",
"# Obtain the correct host first - did user request ... | Normalize/canonicalize ``self.gss_host`` depending on various factors.
:param str gss_host:
The explicitly requested GSS-oriented hostname to connect to (i.e.
what the host's name is in the Kerberos database.) Defaults to
``self.hostname`` (which will be the 'real' target ho... | [
"Normalize",
"/",
"canonicalize",
"self",
".",
"gss_host",
"depending",
"on",
"various",
"factors",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L502-L534 | train |
paramiko/paramiko | paramiko/transport.py | Transport.start_client | def start_client(self, event=None, timeout=None):
"""
Negotiate a new SSH2 session as a client. This is the first step after
creating a new `.Transport`. A separate thread is created for protocol
negotiation.
If an event is passed in, this method returns immediately. When
... | python | def start_client(self, event=None, timeout=None):
"""
Negotiate a new SSH2 session as a client. This is the first step after
creating a new `.Transport`. A separate thread is created for protocol
negotiation.
If an event is passed in, this method returns immediately. When
... | [
"def",
"start_client",
"(",
"self",
",",
"event",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"self",
".",
"active",
"=",
"True",
"if",
"event",
"is",
"not",
"None",
":",
"# async, return immediately and let the app poll for completion",
"self",
".",
"... | Negotiate a new SSH2 session as a client. This is the first step after
creating a new `.Transport`. A separate thread is created for protocol
negotiation.
If an event is passed in, this method returns immediately. When
negotiation is done (successful or not), the given ``Event`` will... | [
"Negotiate",
"a",
"new",
"SSH2",
"session",
"as",
"a",
"client",
".",
"This",
"is",
"the",
"first",
"step",
"after",
"creating",
"a",
"new",
".",
"Transport",
".",
"A",
"separate",
"thread",
"is",
"created",
"for",
"protocol",
"negotiation",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L536-L592 | train |
paramiko/paramiko | paramiko/transport.py | Transport.load_server_moduli | def load_server_moduli(filename=None):
"""
(optional)
Load a file of prime moduli for use in doing group-exchange key
negotiation in server mode. It's a rather obscure option and can be
safely ignored.
In server mode, the remote client may request "group-exchange" key
... | python | def load_server_moduli(filename=None):
"""
(optional)
Load a file of prime moduli for use in doing group-exchange key
negotiation in server mode. It's a rather obscure option and can be
safely ignored.
In server mode, the remote client may request "group-exchange" key
... | [
"def",
"load_server_moduli",
"(",
"filename",
"=",
"None",
")",
":",
"Transport",
".",
"_modulus_pack",
"=",
"ModulusPack",
"(",
")",
"# places to look for the openssh \"moduli\" file",
"file_list",
"=",
"[",
"\"/etc/ssh/moduli\"",
",",
"\"/usr/local/etc/moduli\"",
"]",
... | (optional)
Load a file of prime moduli for use in doing group-exchange key
negotiation in server mode. It's a rather obscure option and can be
safely ignored.
In server mode, the remote client may request "group-exchange" key
negotiation, which asks the server to send a random ... | [
"(",
"optional",
")",
"Load",
"a",
"file",
"of",
"prime",
"moduli",
"for",
"use",
"in",
"doing",
"group",
"-",
"exchange",
"key",
"negotiation",
"in",
"server",
"mode",
".",
"It",
"s",
"a",
"rather",
"obscure",
"option",
"and",
"can",
"be",
"safely",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L696-L734 | train |
paramiko/paramiko | paramiko/transport.py | Transport.close | def close(self):
"""
Close this session, and any open channels that are tied to it.
"""
if not self.active:
return
self.stop_thread()
for chan in list(self._channels.values()):
chan._unlink()
self.sock.close() | python | def close(self):
"""
Close this session, and any open channels that are tied to it.
"""
if not self.active:
return
self.stop_thread()
for chan in list(self._channels.values()):
chan._unlink()
self.sock.close() | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"active",
":",
"return",
"self",
".",
"stop_thread",
"(",
")",
"for",
"chan",
"in",
"list",
"(",
"self",
".",
"_channels",
".",
"values",
"(",
")",
")",
":",
"chan",
".",
"_unlink",
... | Close this session, and any open channels that are tied to it. | [
"Close",
"this",
"session",
"and",
"any",
"open",
"channels",
"that",
"are",
"tied",
"to",
"it",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L736-L745 | train |
paramiko/paramiko | paramiko/transport.py | Transport.open_session | def open_session(
self, window_size=None, max_packet_size=None, timeout=None
):
"""
Request a new channel to the server, of type ``"session"``. This is
just an alias for calling `open_channel` with an argument of
``"session"``.
.. note:: Modifying the the window and... | python | def open_session(
self, window_size=None, max_packet_size=None, timeout=None
):
"""
Request a new channel to the server, of type ``"session"``. This is
just an alias for calling `open_channel` with an argument of
``"session"``.
.. note:: Modifying the the window and... | [
"def",
"open_session",
"(",
"self",
",",
"window_size",
"=",
"None",
",",
"max_packet_size",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"return",
"self",
".",
"open_channel",
"(",
"\"session\"",
",",
"window_size",
"=",
"window_size",
",",
"max_pack... | Request a new channel to the server, of type ``"session"``. This is
just an alias for calling `open_channel` with an argument of
``"session"``.
.. note:: Modifying the the window and packet sizes might have adverse
effects on the session created. The default values are the same
... | [
"Request",
"a",
"new",
"channel",
"to",
"the",
"server",
"of",
"type",
"session",
".",
"This",
"is",
"just",
"an",
"alias",
"for",
"calling",
"open_channel",
"with",
"an",
"argument",
"of",
"session",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L774-L807 | train |
paramiko/paramiko | paramiko/transport.py | Transport.open_channel | def open_channel(
self,
kind,
dest_addr=None,
src_addr=None,
window_size=None,
max_packet_size=None,
timeout=None,
):
"""
Request a new channel to the server. `Channels <.Channel>` are
socket-like objects used for the actual transfer of... | python | def open_channel(
self,
kind,
dest_addr=None,
src_addr=None,
window_size=None,
max_packet_size=None,
timeout=None,
):
"""
Request a new channel to the server. `Channels <.Channel>` are
socket-like objects used for the actual transfer of... | [
"def",
"open_channel",
"(",
"self",
",",
"kind",
",",
"dest_addr",
"=",
"None",
",",
"src_addr",
"=",
"None",
",",
"window_size",
"=",
"None",
",",
"max_packet_size",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
")",
":",
"if",
"not",
"self",
".",
... | Request a new channel to the server. `Channels <.Channel>` are
socket-like objects used for the actual transfer of data across the
session. You may only request a channel after negotiating encryption
(using `connect` or `start_client`) and authenticating.
.. note:: Modifying the the win... | [
"Request",
"a",
"new",
"channel",
"to",
"the",
"server",
".",
"Channels",
"<",
".",
"Channel",
">",
"are",
"socket",
"-",
"like",
"objects",
"used",
"for",
"the",
"actual",
"transfer",
"of",
"data",
"across",
"the",
"session",
".",
"You",
"may",
"only",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L851-L944 | train |
paramiko/paramiko | paramiko/transport.py | Transport.request_port_forward | def request_port_forward(self, address, port, handler=None):
"""
Ask the server to forward TCP connections from a listening port on
the server, across this SSH session.
If a handler is given, that handler is called from a different thread
whenever a forwarded connection arrives.... | python | def request_port_forward(self, address, port, handler=None):
"""
Ask the server to forward TCP connections from a listening port on
the server, across this SSH session.
If a handler is given, that handler is called from a different thread
whenever a forwarded connection arrives.... | [
"def",
"request_port_forward",
"(",
"self",
",",
"address",
",",
"port",
",",
"handler",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"active",
":",
"raise",
"SSHException",
"(",
"\"SSH session not active\"",
")",
"port",
"=",
"int",
"(",
"port",
")",
... | Ask the server to forward TCP connections from a listening port on
the server, across this SSH session.
If a handler is given, that handler is called from a different thread
whenever a forwarded connection arrives. The handler parameters are::
handler(
channel,
... | [
"Ask",
"the",
"server",
"to",
"forward",
"TCP",
"connections",
"from",
"a",
"listening",
"port",
"on",
"the",
"server",
"across",
"this",
"SSH",
"session",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L946-L998 | train |
paramiko/paramiko | paramiko/transport.py | Transport.cancel_port_forward | def cancel_port_forward(self, address, port):
"""
Ask the server to cancel a previous port-forwarding request. No more
connections to the given address & port will be forwarded across this
ssh connection.
:param str address: the address to stop forwarding
:param int por... | python | def cancel_port_forward(self, address, port):
"""
Ask the server to cancel a previous port-forwarding request. No more
connections to the given address & port will be forwarded across this
ssh connection.
:param str address: the address to stop forwarding
:param int por... | [
"def",
"cancel_port_forward",
"(",
"self",
",",
"address",
",",
"port",
")",
":",
"if",
"not",
"self",
".",
"active",
":",
"return",
"self",
".",
"_tcp_handler",
"=",
"None",
"self",
".",
"global_request",
"(",
"\"cancel-tcpip-forward\"",
",",
"(",
"address"... | Ask the server to cancel a previous port-forwarding request. No more
connections to the given address & port will be forwarded across this
ssh connection.
:param str address: the address to stop forwarding
:param int port: the port to stop forwarding | [
"Ask",
"the",
"server",
"to",
"cancel",
"a",
"previous",
"port",
"-",
"forwarding",
"request",
".",
"No",
"more",
"connections",
"to",
"the",
"given",
"address",
"&",
"port",
"will",
"be",
"forwarded",
"across",
"this",
"ssh",
"connection",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1000-L1012 | train |
paramiko/paramiko | paramiko/transport.py | Transport.send_ignore | def send_ignore(self, byte_count=None):
"""
Send a junk packet across the encrypted link. This is sometimes used
to add "noise" to a connection to confuse would-be attackers. It can
also be used as a keep-alive for long lived connections traversing
firewalls.
:param in... | python | def send_ignore(self, byte_count=None):
"""
Send a junk packet across the encrypted link. This is sometimes used
to add "noise" to a connection to confuse would-be attackers. It can
also be used as a keep-alive for long lived connections traversing
firewalls.
:param in... | [
"def",
"send_ignore",
"(",
"self",
",",
"byte_count",
"=",
"None",
")",
":",
"m",
"=",
"Message",
"(",
")",
"m",
".",
"add_byte",
"(",
"cMSG_IGNORE",
")",
"if",
"byte_count",
"is",
"None",
":",
"byte_count",
"=",
"(",
"byte_ord",
"(",
"os",
".",
"ura... | Send a junk packet across the encrypted link. This is sometimes used
to add "noise" to a connection to confuse would-be attackers. It can
also be used as a keep-alive for long lived connections traversing
firewalls.
:param int byte_count:
the number of random bytes to send... | [
"Send",
"a",
"junk",
"packet",
"across",
"the",
"encrypted",
"link",
".",
"This",
"is",
"sometimes",
"used",
"to",
"add",
"noise",
"to",
"a",
"connection",
"to",
"confuse",
"would",
"-",
"be",
"attackers",
".",
"It",
"can",
"also",
"be",
"used",
"as",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1026-L1042 | train |
paramiko/paramiko | paramiko/transport.py | Transport.accept | def accept(self, timeout=None):
"""
Return the next channel opened by the client over this transport, in
server mode. If no channel is opened before the given timeout,
``None`` is returned.
:param int timeout:
seconds to wait for a channel, or ``None`` to wait forev... | python | def accept(self, timeout=None):
"""
Return the next channel opened by the client over this transport, in
server mode. If no channel is opened before the given timeout,
``None`` is returned.
:param int timeout:
seconds to wait for a channel, or ``None`` to wait forev... | [
"def",
"accept",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"len",
"(",
"self",
".",
"server_accepts",
")",
">",
"0",
":",
"chan",
"=",
"self",
".",
"server_accepts",
".",
... | Return the next channel opened by the client over this transport, in
server mode. If no channel is opened before the given timeout,
``None`` is returned.
:param int timeout:
seconds to wait for a channel, or ``None`` to wait forever
:return: a new `.Channel` opened by the c... | [
"Return",
"the",
"next",
"channel",
"opened",
"by",
"the",
"client",
"over",
"this",
"transport",
"in",
"server",
"mode",
".",
"If",
"no",
"channel",
"is",
"opened",
"before",
"the",
"given",
"timeout",
"None",
"is",
"returned",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1124-L1147 | train |
paramiko/paramiko | paramiko/transport.py | Transport.connect | def connect(
self,
hostkey=None,
username="",
password=None,
pkey=None,
gss_host=None,
gss_auth=False,
gss_kex=False,
gss_deleg_creds=True,
gss_trust_dns=True,
):
"""
Negotiate an SSH2 session, and optionally verify the ... | python | def connect(
self,
hostkey=None,
username="",
password=None,
pkey=None,
gss_host=None,
gss_auth=False,
gss_kex=False,
gss_deleg_creds=True,
gss_trust_dns=True,
):
"""
Negotiate an SSH2 session, and optionally verify the ... | [
"def",
"connect",
"(",
"self",
",",
"hostkey",
"=",
"None",
",",
"username",
"=",
"\"\"",
",",
"password",
"=",
"None",
",",
"pkey",
"=",
"None",
",",
"gss_host",
"=",
"None",
",",
"gss_auth",
"=",
"False",
",",
"gss_kex",
"=",
"False",
",",
"gss_del... | Negotiate an SSH2 session, and optionally verify the server's host key
and authenticate using a password or private key. This is a shortcut
for `start_client`, `get_remote_server_key`, and
`Transport.auth_password` or `Transport.auth_publickey`. Use those
methods if you want more contr... | [
"Negotiate",
"an",
"SSH2",
"session",
"and",
"optionally",
"verify",
"the",
"server",
"s",
"host",
"key",
"and",
"authenticate",
"using",
"a",
"password",
"or",
"private",
"key",
".",
"This",
"is",
"a",
"shortcut",
"for",
"start_client",
"get_remote_server_key",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1149-L1265 | train |
paramiko/paramiko | paramiko/transport.py | Transport.get_exception | def get_exception(self):
"""
Return any exception that happened during the last server request.
This can be used to fetch more specific error information after using
calls like `start_client`. The exception (if any) is cleared after
this call.
:return:
an ex... | python | def get_exception(self):
"""
Return any exception that happened during the last server request.
This can be used to fetch more specific error information after using
calls like `start_client`. The exception (if any) is cleared after
this call.
:return:
an ex... | [
"def",
"get_exception",
"(",
"self",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"try",
":",
"e",
"=",
"self",
".",
"saved_exception",
"self",
".",
"saved_exception",
"=",
"None",
"return",
"e",
"finally",
":",
"self",
".",
"lock",
".",
... | Return any exception that happened during the last server request.
This can be used to fetch more specific error information after using
calls like `start_client`. The exception (if any) is cleared after
this call.
:return:
an exception, or ``None`` if there is no stored ex... | [
"Return",
"any",
"exception",
"that",
"happened",
"during",
"the",
"last",
"server",
"request",
".",
"This",
"can",
"be",
"used",
"to",
"fetch",
"more",
"specific",
"error",
"information",
"after",
"using",
"calls",
"like",
"start_client",
".",
"The",
"excepti... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1267-L1285 | train |
paramiko/paramiko | paramiko/transport.py | Transport.set_subsystem_handler | def set_subsystem_handler(self, name, handler, *larg, **kwarg):
"""
Set the handler class for a subsystem in server mode. If a request
for this subsystem is made on an open ssh channel later, this handler
will be constructed and called -- see `.SubsystemHandler` for more
detaile... | python | def set_subsystem_handler(self, name, handler, *larg, **kwarg):
"""
Set the handler class for a subsystem in server mode. If a request
for this subsystem is made on an open ssh channel later, this handler
will be constructed and called -- see `.SubsystemHandler` for more
detaile... | [
"def",
"set_subsystem_handler",
"(",
"self",
",",
"name",
",",
"handler",
",",
"*",
"larg",
",",
"*",
"*",
"kwarg",
")",
":",
"try",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"self",
".",
"subsystem_table",
"[",
"name",
"]",
"=",
"(",
"ha... | Set the handler class for a subsystem in server mode. If a request
for this subsystem is made on an open ssh channel later, this handler
will be constructed and called -- see `.SubsystemHandler` for more
detailed documentation.
Any extra parameters (including keyword arguments) are sav... | [
"Set",
"the",
"handler",
"class",
"for",
"a",
"subsystem",
"in",
"server",
"mode",
".",
"If",
"a",
"request",
"for",
"this",
"subsystem",
"is",
"made",
"on",
"an",
"open",
"ssh",
"channel",
"later",
"this",
"handler",
"will",
"be",
"constructed",
"and",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1287-L1305 | train |
paramiko/paramiko | paramiko/transport.py | Transport.auth_password | def auth_password(self, username, password, event=None, fallback=True):
"""
Authenticate to the server using a password. The username and password
are sent over an encrypted link.
If an ``event`` is passed in, this method will return immediately, and
the event will be triggered... | python | def auth_password(self, username, password, event=None, fallback=True):
"""
Authenticate to the server using a password. The username and password
are sent over an encrypted link.
If an ``event`` is passed in, this method will return immediately, and
the event will be triggered... | [
"def",
"auth_password",
"(",
"self",
",",
"username",
",",
"password",
",",
"event",
"=",
"None",
",",
"fallback",
"=",
"True",
")",
":",
"if",
"(",
"not",
"self",
".",
"active",
")",
"or",
"(",
"not",
"self",
".",
"initial_kex_done",
")",
":",
"# we... | Authenticate to the server using a password. The username and password
are sent over an encrypted link.
If an ``event`` is passed in, this method will return immediately, and
the event will be triggered once authentication succeeds or fails. On
success, `is_authenticated` will return ... | [
"Authenticate",
"to",
"the",
"server",
"using",
"a",
"password",
".",
"The",
"username",
"and",
"password",
"are",
"sent",
"over",
"an",
"encrypted",
"link",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1375-L1458 | train |
paramiko/paramiko | paramiko/transport.py | Transport.auth_publickey | def auth_publickey(self, username, key, event=None):
"""
Authenticate to the server using a private key. The key is used to
sign data from the server, so it must include the private part.
If an ``event`` is passed in, this method will return immediately, and
the event will be t... | python | def auth_publickey(self, username, key, event=None):
"""
Authenticate to the server using a private key. The key is used to
sign data from the server, so it must include the private part.
If an ``event`` is passed in, this method will return immediately, and
the event will be t... | [
"def",
"auth_publickey",
"(",
"self",
",",
"username",
",",
"key",
",",
"event",
"=",
"None",
")",
":",
"if",
"(",
"not",
"self",
".",
"active",
")",
"or",
"(",
"not",
"self",
".",
"initial_kex_done",
")",
":",
"# we should never try to authenticate unless w... | Authenticate to the server using a private key. The key is used to
sign data from the server, so it must include the private part.
If an ``event`` is passed in, this method will return immediately, and
the event will be triggered once authentication succeeds or fails. On
success, `is_... | [
"Authenticate",
"to",
"the",
"server",
"using",
"a",
"private",
"key",
".",
"The",
"key",
"is",
"used",
"to",
"sign",
"data",
"from",
"the",
"server",
"so",
"it",
"must",
"include",
"the",
"private",
"part",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1460-L1507 | train |
paramiko/paramiko | paramiko/transport.py | Transport.auth_interactive | def auth_interactive(self, username, handler, submethods=""):
"""
Authenticate to the server interactively. A handler is used to answer
arbitrary questions from the server. On many servers, this is just a
dumb wrapper around PAM.
This method will block until the authentication... | python | def auth_interactive(self, username, handler, submethods=""):
"""
Authenticate to the server interactively. A handler is used to answer
arbitrary questions from the server. On many servers, this is just a
dumb wrapper around PAM.
This method will block until the authentication... | [
"def",
"auth_interactive",
"(",
"self",
",",
"username",
",",
"handler",
",",
"submethods",
"=",
"\"\"",
")",
":",
"if",
"(",
"not",
"self",
".",
"active",
")",
"or",
"(",
"not",
"self",
".",
"initial_kex_done",
")",
":",
"# we should never try to authentica... | Authenticate to the server interactively. A handler is used to answer
arbitrary questions from the server. On many servers, this is just a
dumb wrapper around PAM.
This method will block until the authentication succeeds or fails,
peroidically calling the handler asynchronously to get... | [
"Authenticate",
"to",
"the",
"server",
"interactively",
".",
"A",
"handler",
"is",
"used",
"to",
"answer",
"arbitrary",
"questions",
"from",
"the",
"server",
".",
"On",
"many",
"servers",
"this",
"is",
"just",
"a",
"dumb",
"wrapper",
"around",
"PAM",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1509-L1560 | train |
paramiko/paramiko | paramiko/transport.py | Transport.auth_interactive_dumb | def auth_interactive_dumb(self, username, handler=None, submethods=""):
"""
Autenticate to the server interactively but dumber.
Just print the prompt and / or instructions to stdout and send back
the response. This is good for situations where partial auth is
achieved by key and ... | python | def auth_interactive_dumb(self, username, handler=None, submethods=""):
"""
Autenticate to the server interactively but dumber.
Just print the prompt and / or instructions to stdout and send back
the response. This is good for situations where partial auth is
achieved by key and ... | [
"def",
"auth_interactive_dumb",
"(",
"self",
",",
"username",
",",
"handler",
"=",
"None",
",",
"submethods",
"=",
"\"\"",
")",
":",
"if",
"not",
"handler",
":",
"def",
"handler",
"(",
"title",
",",
"instructions",
",",
"prompt_list",
")",
":",
"answers",
... | Autenticate to the server interactively but dumber.
Just print the prompt and / or instructions to stdout and send back
the response. This is good for situations where partial auth is
achieved by key and then the user has to enter a 2fac token. | [
"Autenticate",
"to",
"the",
"server",
"interactively",
"but",
"dumber",
".",
"Just",
"print",
"the",
"prompt",
"and",
"/",
"or",
"instructions",
"to",
"stdout",
"and",
"send",
"back",
"the",
"response",
".",
"This",
"is",
"good",
"for",
"situations",
"where"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1562-L1583 | train |
paramiko/paramiko | paramiko/transport.py | Transport.auth_gssapi_with_mic | def auth_gssapi_with_mic(self, username, gss_host, gss_deleg_creds):
"""
Authenticate to the Server using GSS-API / SSPI.
:param str username: The username to authenticate as
:param str gss_host: The target host
:param bool gss_deleg_creds: Delegate credentials or not
:r... | python | def auth_gssapi_with_mic(self, username, gss_host, gss_deleg_creds):
"""
Authenticate to the Server using GSS-API / SSPI.
:param str username: The username to authenticate as
:param str gss_host: The target host
:param bool gss_deleg_creds: Delegate credentials or not
:r... | [
"def",
"auth_gssapi_with_mic",
"(",
"self",
",",
"username",
",",
"gss_host",
",",
"gss_deleg_creds",
")",
":",
"if",
"(",
"not",
"self",
".",
"active",
")",
"or",
"(",
"not",
"self",
".",
"initial_kex_done",
")",
":",
"# we should never try to authenticate unle... | Authenticate to the Server using GSS-API / SSPI.
:param str username: The username to authenticate as
:param str gss_host: The target host
:param bool gss_deleg_creds: Delegate credentials or not
:return: list of auth types permissible for the next stage of
authenticati... | [
"Authenticate",
"to",
"the",
"Server",
"using",
"GSS",
"-",
"API",
"/",
"SSPI",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1585-L1609 | train |
paramiko/paramiko | paramiko/transport.py | Transport.set_log_channel | def set_log_channel(self, name):
"""
Set the channel for this transport's logging. The default is
``"paramiko.transport"`` but it can be set to anything you want. (See
the `.logging` module for more info.) SSH Channels will log to a
sub-channel of the one specified.
:p... | python | def set_log_channel(self, name):
"""
Set the channel for this transport's logging. The default is
``"paramiko.transport"`` but it can be set to anything you want. (See
the `.logging` module for more info.) SSH Channels will log to a
sub-channel of the one specified.
:p... | [
"def",
"set_log_channel",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"log_name",
"=",
"name",
"self",
".",
"logger",
"=",
"util",
".",
"get_logger",
"(",
"name",
")",
"self",
".",
"packetizer",
".",
"set_log",
"(",
"self",
".",
"logger",
")"
] | Set the channel for this transport's logging. The default is
``"paramiko.transport"`` but it can be set to anything you want. (See
the `.logging` module for more info.) SSH Channels will log to a
sub-channel of the one specified.
:param str name: new channel name for logging
... | [
"Set",
"the",
"channel",
"for",
"this",
"transport",
"s",
"logging",
".",
"The",
"default",
"is",
"paramiko",
".",
"transport",
"but",
"it",
"can",
"be",
"set",
"to",
"anything",
"you",
"want",
".",
"(",
"See",
"the",
".",
"logging",
"module",
"for",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1634-L1647 | train |
paramiko/paramiko | paramiko/transport.py | Transport._next_channel | def _next_channel(self):
"""you are holding the lock"""
chanid = self._channel_counter
while self._channels.get(chanid) is not None:
self._channel_counter = (self._channel_counter + 1) & 0xffffff
chanid = self._channel_counter
self._channel_counter = (self._channe... | python | def _next_channel(self):
"""you are holding the lock"""
chanid = self._channel_counter
while self._channels.get(chanid) is not None:
self._channel_counter = (self._channel_counter + 1) & 0xffffff
chanid = self._channel_counter
self._channel_counter = (self._channe... | [
"def",
"_next_channel",
"(",
"self",
")",
":",
"chanid",
"=",
"self",
".",
"_channel_counter",
"while",
"self",
".",
"_channels",
".",
"get",
"(",
"chanid",
")",
"is",
"not",
"None",
":",
"self",
".",
"_channel_counter",
"=",
"(",
"self",
".",
"_channel_... | you are holding the lock | [
"you",
"are",
"holding",
"the",
"lock"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1752-L1759 | train |
paramiko/paramiko | paramiko/transport.py | Transport._compute_key | def _compute_key(self, id, nbytes):
"""id is 'A' - 'F' for the various keys used by ssh"""
m = Message()
m.add_mpint(self.K)
m.add_bytes(self.H)
m.add_byte(b(id))
m.add_bytes(self.session_id)
# Fallback to SHA1 for kex engines that fail to specify a hex
# ... | python | def _compute_key(self, id, nbytes):
"""id is 'A' - 'F' for the various keys used by ssh"""
m = Message()
m.add_mpint(self.K)
m.add_bytes(self.H)
m.add_byte(b(id))
m.add_bytes(self.session_id)
# Fallback to SHA1 for kex engines that fail to specify a hex
# ... | [
"def",
"_compute_key",
"(",
"self",
",",
"id",
",",
"nbytes",
")",
":",
"m",
"=",
"Message",
"(",
")",
"m",
".",
"add_mpint",
"(",
"self",
".",
"K",
")",
"m",
".",
"add_bytes",
"(",
"self",
".",
"H",
")",
"m",
".",
"add_byte",
"(",
"b",
"(",
... | id is 'A' - 'F' for the various keys used by ssh | [
"id",
"is",
"A",
"-",
"F",
"for",
"the",
"various",
"keys",
"used",
"by",
"ssh"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1821-L1849 | train |
paramiko/paramiko | paramiko/transport.py | Transport._ensure_authed | def _ensure_authed(self, ptype, message):
"""
Checks message type against current auth state.
If server mode, and auth has not succeeded, and the message is of a
post-auth type (channel open or global request) an appropriate error
response Message is crafted and returned to call... | python | def _ensure_authed(self, ptype, message):
"""
Checks message type against current auth state.
If server mode, and auth has not succeeded, and the message is of a
post-auth type (channel open or global request) an appropriate error
response Message is crafted and returned to call... | [
"def",
"_ensure_authed",
"(",
"self",
",",
"ptype",
",",
"message",
")",
":",
"if",
"(",
"not",
"self",
".",
"server_mode",
"or",
"ptype",
"<=",
"HIGHEST_USERAUTH_MESSAGE_ID",
"or",
"self",
".",
"is_authenticated",
"(",
")",
")",
":",
"return",
"None",
"# ... | Checks message type against current auth state.
If server mode, and auth has not succeeded, and the message is of a
post-auth type (channel open or global request) an appropriate error
response Message is crafted and returned to caller for sending.
Otherwise (client mode, authed, or pr... | [
"Checks",
"message",
"type",
"against",
"current",
"auth",
"state",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1904-L1940 | train |
paramiko/paramiko | paramiko/transport.py | Transport._activate_outbound | def _activate_outbound(self):
"""switch on newly negotiated encryption parameters for
outbound traffic"""
m = Message()
m.add_byte(cMSG_NEWKEYS)
self._send_message(m)
block_size = self._cipher_info[self.local_cipher]["block-size"]
if self.server_mode:
... | python | def _activate_outbound(self):
"""switch on newly negotiated encryption parameters for
outbound traffic"""
m = Message()
m.add_byte(cMSG_NEWKEYS)
self._send_message(m)
block_size = self._cipher_info[self.local_cipher]["block-size"]
if self.server_mode:
... | [
"def",
"_activate_outbound",
"(",
"self",
")",
":",
"m",
"=",
"Message",
"(",
")",
"m",
".",
"add_byte",
"(",
"cMSG_NEWKEYS",
")",
"self",
".",
"_send_message",
"(",
"m",
")",
"block_size",
"=",
"self",
".",
"_cipher_info",
"[",
"self",
".",
"local_ciphe... | switch on newly negotiated encryption parameters for
outbound traffic | [
"switch",
"on",
"newly",
"negotiated",
"encryption",
"parameters",
"for",
"outbound",
"traffic"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L2461-L2502 | train |
paramiko/paramiko | paramiko/file.py | BufferedFile.flush | def flush(self):
"""
Write out any data in the write buffer. This may do nothing if write
buffering is not turned on.
"""
self._write_all(self._wbuffer.getvalue())
self._wbuffer = BytesIO()
return | python | def flush(self):
"""
Write out any data in the write buffer. This may do nothing if write
buffering is not turned on.
"""
self._write_all(self._wbuffer.getvalue())
self._wbuffer = BytesIO()
return | [
"def",
"flush",
"(",
"self",
")",
":",
"self",
".",
"_write_all",
"(",
"self",
".",
"_wbuffer",
".",
"getvalue",
"(",
")",
")",
"self",
".",
"_wbuffer",
"=",
"BytesIO",
"(",
")",
"return"
] | Write out any data in the write buffer. This may do nothing if write
buffering is not turned on. | [
"Write",
"out",
"any",
"data",
"in",
"the",
"write",
"buffer",
".",
"This",
"may",
"do",
"nothing",
"if",
"write",
"buffering",
"is",
"not",
"turned",
"on",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/file.py#L87-L94 | train |
paramiko/paramiko | paramiko/file.py | BufferedFile.readinto | def readinto(self, buff):
"""
Read up to ``len(buff)`` bytes into ``bytearray`` *buff* and return the
number of bytes read.
:returns:
The number of bytes read.
"""
data = self.read(len(buff))
buff[: len(data)] = data
return len(data) | python | def readinto(self, buff):
"""
Read up to ``len(buff)`` bytes into ``bytearray`` *buff* and return the
number of bytes read.
:returns:
The number of bytes read.
"""
data = self.read(len(buff))
buff[: len(data)] = data
return len(data) | [
"def",
"readinto",
"(",
"self",
",",
"buff",
")",
":",
"data",
"=",
"self",
".",
"read",
"(",
"len",
"(",
"buff",
")",
")",
"buff",
"[",
":",
"len",
"(",
"data",
")",
"]",
"=",
"data",
"return",
"len",
"(",
"data",
")"
] | Read up to ``len(buff)`` bytes into ``bytearray`` *buff* and return the
number of bytes read.
:returns:
The number of bytes read. | [
"Read",
"up",
"to",
"len",
"(",
"buff",
")",
"bytes",
"into",
"bytearray",
"*",
"buff",
"*",
"and",
"return",
"the",
"number",
"of",
"bytes",
"read",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/file.py#L160-L170 | train |
paramiko/paramiko | paramiko/file.py | BufferedFile.readlines | def readlines(self, sizehint=None):
"""
Read all remaining lines using `readline` and return them as a list.
If the optional ``sizehint`` argument is present, instead of reading up
to EOF, whole lines totalling approximately sizehint bytes (possibly
after rounding up to an intern... | python | def readlines(self, sizehint=None):
"""
Read all remaining lines using `readline` and return them as a list.
If the optional ``sizehint`` argument is present, instead of reading up
to EOF, whole lines totalling approximately sizehint bytes (possibly
after rounding up to an intern... | [
"def",
"readlines",
"(",
"self",
",",
"sizehint",
"=",
"None",
")",
":",
"lines",
"=",
"[",
"]",
"byte_count",
"=",
"0",
"while",
"True",
":",
"line",
"=",
"self",
".",
"readline",
"(",
")",
"if",
"len",
"(",
"line",
")",
"==",
"0",
":",
"break",... | Read all remaining lines using `readline` and return them as a list.
If the optional ``sizehint`` argument is present, instead of reading up
to EOF, whole lines totalling approximately sizehint bytes (possibly
after rounding up to an internal buffer size) are read.
:param int sizehint: ... | [
"Read",
"all",
"remaining",
"lines",
"using",
"readline",
"and",
"return",
"them",
"as",
"a",
"list",
".",
"If",
"the",
"optional",
"sizehint",
"argument",
"is",
"present",
"instead",
"of",
"reading",
"up",
"to",
"EOF",
"whole",
"lines",
"totalling",
"approx... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/file.py#L336-L356 | train |
paramiko/paramiko | paramiko/file.py | BufferedFile.write | def write(self, data):
"""
Write data to the file. If write buffering is on (``bufsize`` was
specified and non-zero), some or all of the data may not actually be
written yet. (Use `flush` or `close` to force buffered data to be
written out.)
:param data: ``str``/``byte... | python | def write(self, data):
"""
Write data to the file. If write buffering is on (``bufsize`` was
specified and non-zero), some or all of the data may not actually be
written yet. (Use `flush` or `close` to force buffered data to be
written out.)
:param data: ``str``/``byte... | [
"def",
"write",
"(",
"self",
",",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"text_type",
")",
":",
"# Accept text and encode as utf-8 for compatibility only.",
"data",
"=",
"data",
".",
"encode",
"(",
"\"utf-8\"",
")",
"if",
"self",
".",
"_closed... | Write data to the file. If write buffering is on (``bufsize`` was
specified and non-zero), some or all of the data may not actually be
written yet. (Use `flush` or `close` to force buffered data to be
written out.)
:param data: ``str``/``bytes`` data to write | [
"Write",
"data",
"to",
"the",
"file",
".",
"If",
"write",
"buffering",
"is",
"on",
"(",
"bufsize",
"was",
"specified",
"and",
"non",
"-",
"zero",
")",
"some",
"or",
"all",
"of",
"the",
"data",
"may",
"not",
"actually",
"be",
"written",
"yet",
".",
"(... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/file.py#L388-L422 | train |
paramiko/paramiko | paramiko/hostkeys.py | HostKeys.add | def add(self, hostname, keytype, key):
"""
Add a host key entry to the table. Any existing entry for a
``(hostname, keytype)`` pair will be replaced.
:param str hostname: the hostname (or IP) to add
:param str keytype: key type (``"ssh-rsa"`` or ``"ssh-dss"``)
:param .P... | python | def add(self, hostname, keytype, key):
"""
Add a host key entry to the table. Any existing entry for a
``(hostname, keytype)`` pair will be replaced.
:param str hostname: the hostname (or IP) to add
:param str keytype: key type (``"ssh-rsa"`` or ``"ssh-dss"``)
:param .P... | [
"def",
"add",
"(",
"self",
",",
"hostname",
",",
"keytype",
",",
"key",
")",
":",
"for",
"e",
"in",
"self",
".",
"_entries",
":",
"if",
"(",
"hostname",
"in",
"e",
".",
"hostnames",
")",
"and",
"(",
"e",
".",
"key",
".",
"get_name",
"(",
")",
"... | Add a host key entry to the table. Any existing entry for a
``(hostname, keytype)`` pair will be replaced.
:param str hostname: the hostname (or IP) to add
:param str keytype: key type (``"ssh-rsa"`` or ``"ssh-dss"``)
:param .PKey key: the key to add | [
"Add",
"a",
"host",
"key",
"entry",
"to",
"the",
"table",
".",
"Any",
"existing",
"entry",
"for",
"a",
"(",
"hostname",
"keytype",
")",
"pair",
"will",
"be",
"replaced",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/hostkeys.py#L61-L74 | train |
paramiko/paramiko | paramiko/hostkeys.py | HostKeys.load | def load(self, filename):
"""
Read a file of known SSH host keys, in the format used by OpenSSH.
This type of file unfortunately doesn't exist on Windows, but on
posix, it will usually be stored in
``os.path.expanduser("~/.ssh/known_hosts")``.
If this method is called mu... | python | def load(self, filename):
"""
Read a file of known SSH host keys, in the format used by OpenSSH.
This type of file unfortunately doesn't exist on Windows, but on
posix, it will usually be stored in
``os.path.expanduser("~/.ssh/known_hosts")``.
If this method is called mu... | [
"def",
"load",
"(",
"self",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"\"r\"",
")",
"as",
"f",
":",
"for",
"lineno",
",",
"line",
"in",
"enumerate",
"(",
"f",
",",
"1",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")... | Read a file of known SSH host keys, in the format used by OpenSSH.
This type of file unfortunately doesn't exist on Windows, but on
posix, it will usually be stored in
``os.path.expanduser("~/.ssh/known_hosts")``.
If this method is called multiple times, the host keys are merged,
... | [
"Read",
"a",
"file",
"of",
"known",
"SSH",
"host",
"keys",
"in",
"the",
"format",
"used",
"by",
"OpenSSH",
".",
"This",
"type",
"of",
"file",
"unfortunately",
"doesn",
"t",
"exist",
"on",
"Windows",
"but",
"on",
"posix",
"it",
"will",
"usually",
"be",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/hostkeys.py#L76-L106 | train |
paramiko/paramiko | paramiko/hostkeys.py | HostKeys.lookup | def lookup(self, hostname):
"""
Find a hostkey entry for a given hostname or IP. If no entry is found,
``None`` is returned. Otherwise a dictionary of keytype to key is
returned. The keytype will be either ``"ssh-rsa"`` or ``"ssh-dss"``.
:param str hostname: the hostname (or ... | python | def lookup(self, hostname):
"""
Find a hostkey entry for a given hostname or IP. If no entry is found,
``None`` is returned. Otherwise a dictionary of keytype to key is
returned. The keytype will be either ``"ssh-rsa"`` or ``"ssh-dss"``.
:param str hostname: the hostname (or ... | [
"def",
"lookup",
"(",
"self",
",",
"hostname",
")",
":",
"class",
"SubDict",
"(",
"MutableMapping",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"hostname",
",",
"entries",
",",
"hostkeys",
")",
":",
"self",
".",
"_hostname",
"=",
"hostname",
"self",
... | Find a hostkey entry for a given hostname or IP. If no entry is found,
``None`` is returned. Otherwise a dictionary of keytype to key is
returned. The keytype will be either ``"ssh-rsa"`` or ``"ssh-dss"``.
:param str hostname: the hostname (or IP) to lookup
:return: dict of `str` -> ... | [
"Find",
"a",
"hostkey",
"entry",
"for",
"a",
"given",
"hostname",
"or",
"IP",
".",
"If",
"no",
"entry",
"is",
"found",
"None",
"is",
"returned",
".",
"Otherwise",
"a",
"dictionary",
"of",
"keytype",
"to",
"key",
"is",
"returned",
".",
"The",
"keytype",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/hostkeys.py#L127-L191 | train |
paramiko/paramiko | paramiko/hostkeys.py | HostKeys._hostname_matches | def _hostname_matches(self, hostname, entry):
"""
Tests whether ``hostname`` string matches given SubDict ``entry``.
:returns bool:
"""
for h in entry.hostnames:
if (
h == hostname
or h.startswith("|1|")
and not hostnam... | python | def _hostname_matches(self, hostname, entry):
"""
Tests whether ``hostname`` string matches given SubDict ``entry``.
:returns bool:
"""
for h in entry.hostnames:
if (
h == hostname
or h.startswith("|1|")
and not hostnam... | [
"def",
"_hostname_matches",
"(",
"self",
",",
"hostname",
",",
"entry",
")",
":",
"for",
"h",
"in",
"entry",
".",
"hostnames",
":",
"if",
"(",
"h",
"==",
"hostname",
"or",
"h",
".",
"startswith",
"(",
"\"|1|\"",
")",
"and",
"not",
"hostname",
".",
"s... | Tests whether ``hostname`` string matches given SubDict ``entry``.
:returns bool: | [
"Tests",
"whether",
"hostname",
"string",
"matches",
"given",
"SubDict",
"entry",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/hostkeys.py#L193-L207 | train |
paramiko/paramiko | paramiko/hostkeys.py | HostKeyEntry.from_line | def from_line(cls, line, lineno=None):
"""
Parses the given line of text to find the names for the host,
the type of key, and the key data. The line is expected to be in the
format used by the OpenSSH known_hosts file.
Lines are expected to not have leading or trailing whitespac... | python | def from_line(cls, line, lineno=None):
"""
Parses the given line of text to find the names for the host,
the type of key, and the key data. The line is expected to be in the
format used by the OpenSSH known_hosts file.
Lines are expected to not have leading or trailing whitespac... | [
"def",
"from_line",
"(",
"cls",
",",
"line",
",",
"lineno",
"=",
"None",
")",
":",
"log",
"=",
"get_logger",
"(",
"\"paramiko.hostkeys\"",
")",
"fields",
"=",
"line",
".",
"split",
"(",
"\" \"",
")",
"if",
"len",
"(",
"fields",
")",
"<",
"3",
":",
... | Parses the given line of text to find the names for the host,
the type of key, and the key data. The line is expected to be in the
format used by the OpenSSH known_hosts file.
Lines are expected to not have leading or trailing whitespace.
We don't bother to check for comments or empty l... | [
"Parses",
"the",
"given",
"line",
"of",
"text",
"to",
"find",
"the",
"names",
"for",
"the",
"host",
"the",
"type",
"of",
"key",
"and",
"the",
"key",
"data",
".",
"The",
"line",
"is",
"expected",
"to",
"be",
"in",
"the",
"format",
"used",
"by",
"the",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/hostkeys.py#L327-L370 | train |
paramiko/paramiko | paramiko/win_pageant.py | _query_pageant | def _query_pageant(msg):
"""
Communication with the Pageant process is done through a shared
memory-mapped file.
"""
hwnd = _get_pageant_window_object()
if not hwnd:
# Raise a failure to connect exception, pageant isn't running anymore!
return None
# create a name for the mm... | python | def _query_pageant(msg):
"""
Communication with the Pageant process is done through a shared
memory-mapped file.
"""
hwnd = _get_pageant_window_object()
if not hwnd:
# Raise a failure to connect exception, pageant isn't running anymore!
return None
# create a name for the mm... | [
"def",
"_query_pageant",
"(",
"msg",
")",
":",
"hwnd",
"=",
"_get_pageant_window_object",
"(",
")",
"if",
"not",
"hwnd",
":",
"# Raise a failure to connect exception, pageant isn't running anymore!",
"return",
"None",
"# create a name for the mmap",
"map_name",
"=",
"\"Page... | Communication with the Pageant process is done through a shared
memory-mapped file. | [
"Communication",
"with",
"the",
"Pageant",
"process",
"is",
"done",
"through",
"a",
"shared",
"memory",
"-",
"mapped",
"file",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/win_pageant.py#L79-L114 | train |
paramiko/paramiko | paramiko/message.py | Message.get_remainder | def get_remainder(self):
"""
Return the bytes (as a `str`) of this message that haven't already been
parsed and returned.
"""
position = self.packet.tell()
remainder = self.packet.read()
self.packet.seek(position)
return remainder | python | def get_remainder(self):
"""
Return the bytes (as a `str`) of this message that haven't already been
parsed and returned.
"""
position = self.packet.tell()
remainder = self.packet.read()
self.packet.seek(position)
return remainder | [
"def",
"get_remainder",
"(",
"self",
")",
":",
"position",
"=",
"self",
".",
"packet",
".",
"tell",
"(",
")",
"remainder",
"=",
"self",
".",
"packet",
".",
"read",
"(",
")",
"self",
".",
"packet",
".",
"seek",
"(",
"position",
")",
"return",
"remaind... | Return the bytes (as a `str`) of this message that haven't already been
parsed and returned. | [
"Return",
"the",
"bytes",
"(",
"as",
"a",
"str",
")",
"of",
"this",
"message",
"that",
"haven",
"t",
"already",
"been",
"parsed",
"and",
"returned",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/message.py#L81-L89 | train |
paramiko/paramiko | paramiko/message.py | Message.get_so_far | def get_so_far(self):
"""
Returns the `str` bytes of this message that have been parsed and
returned. The string passed into a message's constructor can be
regenerated by concatenating ``get_so_far`` and `get_remainder`.
"""
position = self.packet.tell()
self.rewi... | python | def get_so_far(self):
"""
Returns the `str` bytes of this message that have been parsed and
returned. The string passed into a message's constructor can be
regenerated by concatenating ``get_so_far`` and `get_remainder`.
"""
position = self.packet.tell()
self.rewi... | [
"def",
"get_so_far",
"(",
"self",
")",
":",
"position",
"=",
"self",
".",
"packet",
".",
"tell",
"(",
")",
"self",
".",
"rewind",
"(",
")",
"return",
"self",
".",
"packet",
".",
"read",
"(",
"position",
")"
] | Returns the `str` bytes of this message that have been parsed and
returned. The string passed into a message's constructor can be
regenerated by concatenating ``get_so_far`` and `get_remainder`. | [
"Returns",
"the",
"str",
"bytes",
"of",
"this",
"message",
"that",
"have",
"been",
"parsed",
"and",
"returned",
".",
"The",
"string",
"passed",
"into",
"a",
"message",
"s",
"constructor",
"can",
"be",
"regenerated",
"by",
"concatenating",
"get_so_far",
"and",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/message.py#L91-L99 | train |
paramiko/paramiko | paramiko/message.py | Message.get_bytes | def get_bytes(self, n):
"""
Return the next ``n`` bytes of the message (as a `str`), without
decomposing into an int, decoded string, etc. Just the raw bytes are
returned. Returns a string of ``n`` zero bytes if there weren't ``n``
bytes remaining in the message.
"""
... | python | def get_bytes(self, n):
"""
Return the next ``n`` bytes of the message (as a `str`), without
decomposing into an int, decoded string, etc. Just the raw bytes are
returned. Returns a string of ``n`` zero bytes if there weren't ``n``
bytes remaining in the message.
"""
... | [
"def",
"get_bytes",
"(",
"self",
",",
"n",
")",
":",
"b",
"=",
"self",
".",
"packet",
".",
"read",
"(",
"n",
")",
"max_pad_size",
"=",
"1",
"<<",
"20",
"# Limit padding to 1 MB",
"if",
"len",
"(",
"b",
")",
"<",
"n",
"<",
"max_pad_size",
":",
"retu... | Return the next ``n`` bytes of the message (as a `str`), without
decomposing into an int, decoded string, etc. Just the raw bytes are
returned. Returns a string of ``n`` zero bytes if there weren't ``n``
bytes remaining in the message. | [
"Return",
"the",
"next",
"n",
"bytes",
"of",
"the",
"message",
"(",
"as",
"a",
"str",
")",
"without",
"decomposing",
"into",
"an",
"int",
"decoded",
"string",
"etc",
".",
"Just",
"the",
"raw",
"bytes",
"are",
"returned",
".",
"Returns",
"a",
"string",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/message.py#L101-L112 | train |
paramiko/paramiko | paramiko/message.py | Message.add_boolean | def add_boolean(self, b):
"""
Add a boolean value to the stream.
:param bool b: boolean value to add
"""
if b:
self.packet.write(one_byte)
else:
self.packet.write(zero_byte)
return self | python | def add_boolean(self, b):
"""
Add a boolean value to the stream.
:param bool b: boolean value to add
"""
if b:
self.packet.write(one_byte)
else:
self.packet.write(zero_byte)
return self | [
"def",
"add_boolean",
"(",
"self",
",",
"b",
")",
":",
"if",
"b",
":",
"self",
".",
"packet",
".",
"write",
"(",
"one_byte",
")",
"else",
":",
"self",
".",
"packet",
".",
"write",
"(",
"zero_byte",
")",
"return",
"self"
] | Add a boolean value to the stream.
:param bool b: boolean value to add | [
"Add",
"a",
"boolean",
"value",
"to",
"the",
"stream",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/message.py#L214-L224 | train |
paramiko/paramiko | paramiko/message.py | Message.add_adaptive_int | def add_adaptive_int(self, n):
"""
Add an integer to the stream.
:param int n: integer to add
"""
if n >= Message.big_int:
self.packet.write(max_byte)
self.add_string(util.deflate_long(n))
else:
self.packet.write(struct.pack(">I", n))
... | python | def add_adaptive_int(self, n):
"""
Add an integer to the stream.
:param int n: integer to add
"""
if n >= Message.big_int:
self.packet.write(max_byte)
self.add_string(util.deflate_long(n))
else:
self.packet.write(struct.pack(">I", n))
... | [
"def",
"add_adaptive_int",
"(",
"self",
",",
"n",
")",
":",
"if",
"n",
">=",
"Message",
".",
"big_int",
":",
"self",
".",
"packet",
".",
"write",
"(",
"max_byte",
")",
"self",
".",
"add_string",
"(",
"util",
".",
"deflate_long",
"(",
"n",
")",
")",
... | Add an integer to the stream.
:param int n: integer to add | [
"Add",
"an",
"integer",
"to",
"the",
"stream",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/message.py#L235-L246 | train |
paramiko/paramiko | paramiko/message.py | Message.add_int64 | def add_int64(self, n):
"""
Add a 64-bit int to the stream.
:param long n: long int to add
"""
self.packet.write(struct.pack(">Q", n))
return self | python | def add_int64(self, n):
"""
Add a 64-bit int to the stream.
:param long n: long int to add
"""
self.packet.write(struct.pack(">Q", n))
return self | [
"def",
"add_int64",
"(",
"self",
",",
"n",
")",
":",
"self",
".",
"packet",
".",
"write",
"(",
"struct",
".",
"pack",
"(",
"\">Q\"",
",",
"n",
")",
")",
"return",
"self"
] | Add a 64-bit int to the stream.
:param long n: long int to add | [
"Add",
"a",
"64",
"-",
"bit",
"int",
"to",
"the",
"stream",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/message.py#L248-L255 | train |
paramiko/paramiko | paramiko/primes.py | _roll_random | def _roll_random(n):
"""returns a random # from 0 to N-1"""
bits = util.bit_length(n - 1)
byte_count = (bits + 7) // 8
hbyte_mask = pow(2, bits % 8) - 1
# so here's the plan:
# we fetch as many random bits as we'd need to fit N-1, and if the
# generated number is >= N, we try again. in the... | python | def _roll_random(n):
"""returns a random # from 0 to N-1"""
bits = util.bit_length(n - 1)
byte_count = (bits + 7) // 8
hbyte_mask = pow(2, bits % 8) - 1
# so here's the plan:
# we fetch as many random bits as we'd need to fit N-1, and if the
# generated number is >= N, we try again. in the... | [
"def",
"_roll_random",
"(",
"n",
")",
":",
"bits",
"=",
"util",
".",
"bit_length",
"(",
"n",
"-",
"1",
")",
"byte_count",
"=",
"(",
"bits",
"+",
"7",
")",
"//",
"8",
"hbyte_mask",
"=",
"pow",
"(",
"2",
",",
"bits",
"%",
"8",
")",
"-",
"1",
"#... | returns a random # from 0 to N-1 | [
"returns",
"a",
"random",
"#",
"from",
"0",
"to",
"N",
"-",
"1"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/primes.py#L30-L49 | train |
paramiko/paramiko | paramiko/primes.py | ModulusPack.read_file | def read_file(self, filename):
"""
:raises IOError: passed from any file operations that fail.
"""
self.pack = {}
with open(filename, "r") as f:
for line in f:
line = line.strip()
if (len(line) == 0) or (line[0] == "#"):
... | python | def read_file(self, filename):
"""
:raises IOError: passed from any file operations that fail.
"""
self.pack = {}
with open(filename, "r") as f:
for line in f:
line = line.strip()
if (len(line) == 0) or (line[0] == "#"):
... | [
"def",
"read_file",
"(",
"self",
",",
"filename",
")",
":",
"self",
".",
"pack",
"=",
"{",
"}",
"with",
"open",
"(",
"filename",
",",
"\"r\"",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if"... | :raises IOError: passed from any file operations that fail. | [
":",
"raises",
"IOError",
":",
"passed",
"from",
"any",
"file",
"operations",
"that",
"fail",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/primes.py#L109-L122 | train |
paramiko/paramiko | paramiko/ecdsakey.py | ECDSAKey.generate | def generate(cls, curve=ec.SECP256R1(), progress_func=None, bits=None):
"""
Generate a new private ECDSA key. This factory function can be used to
generate a new host key or authentication key.
:param progress_func: Not used for this type of key.
:returns: A new private key (`.... | python | def generate(cls, curve=ec.SECP256R1(), progress_func=None, bits=None):
"""
Generate a new private ECDSA key. This factory function can be used to
generate a new host key or authentication key.
:param progress_func: Not used for this type of key.
:returns: A new private key (`.... | [
"def",
"generate",
"(",
"cls",
",",
"curve",
"=",
"ec",
".",
"SECP256R1",
"(",
")",
",",
"progress_func",
"=",
"None",
",",
"bits",
"=",
"None",
")",
":",
"if",
"bits",
"is",
"not",
"None",
":",
"curve",
"=",
"cls",
".",
"_ECDSA_CURVES",
".",
"get_... | Generate a new private ECDSA key. This factory function can be used to
generate a new host key or authentication key.
:param progress_func: Not used for this type of key.
:returns: A new private key (`.ECDSAKey`) object | [
"Generate",
"a",
"new",
"private",
"ECDSA",
"key",
".",
"This",
"factory",
"function",
"can",
"be",
"used",
"to",
"generate",
"a",
"new",
"host",
"key",
"or",
"authentication",
"key",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ecdsakey.py#L258-L273 | train |
paramiko/paramiko | paramiko/pkey.py | PKey.from_private_key_file | def from_private_key_file(cls, filename, password=None):
"""
Create a key object by reading a private key file. If the private
key is encrypted and ``password`` is not ``None``, the given password
will be used to decrypt the key (otherwise `.PasswordRequiredException`
is thrown)... | python | def from_private_key_file(cls, filename, password=None):
"""
Create a key object by reading a private key file. If the private
key is encrypted and ``password`` is not ``None``, the given password
will be used to decrypt the key (otherwise `.PasswordRequiredException`
is thrown)... | [
"def",
"from_private_key_file",
"(",
"cls",
",",
"filename",
",",
"password",
"=",
"None",
")",
":",
"key",
"=",
"cls",
"(",
"filename",
"=",
"filename",
",",
"password",
"=",
"password",
")",
"return",
"key"
] | Create a key object by reading a private key file. If the private
key is encrypted and ``password`` is not ``None``, the given password
will be used to decrypt the key (otherwise `.PasswordRequiredException`
is thrown). Through the magic of Python, this factory method will
exist in all... | [
"Create",
"a",
"key",
"object",
"by",
"reading",
"a",
"private",
"key",
"file",
".",
"If",
"the",
"private",
"key",
"is",
"encrypted",
"and",
"password",
"is",
"not",
"None",
"the",
"given",
"password",
"will",
"be",
"used",
"to",
"decrypt",
"the",
"key"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L186-L207 | train |
paramiko/paramiko | paramiko/pkey.py | PKey.from_private_key | def from_private_key(cls, file_obj, password=None):
"""
Create a key object by reading a private key from a file (or file-like)
object. If the private key is encrypted and ``password`` is not
``None``, the given password will be used to decrypt the key (otherwise
`.PasswordRequi... | python | def from_private_key(cls, file_obj, password=None):
"""
Create a key object by reading a private key from a file (or file-like)
object. If the private key is encrypted and ``password`` is not
``None``, the given password will be used to decrypt the key (otherwise
`.PasswordRequi... | [
"def",
"from_private_key",
"(",
"cls",
",",
"file_obj",
",",
"password",
"=",
"None",
")",
":",
"key",
"=",
"cls",
"(",
"file_obj",
"=",
"file_obj",
",",
"password",
"=",
"password",
")",
"return",
"key"
] | Create a key object by reading a private key from a file (or file-like)
object. If the private key is encrypted and ``password`` is not
``None``, the given password will be used to decrypt the key (otherwise
`.PasswordRequiredException` is thrown).
:param file_obj: the file-like object... | [
"Create",
"a",
"key",
"object",
"by",
"reading",
"a",
"private",
"key",
"from",
"a",
"file",
"(",
"or",
"file",
"-",
"like",
")",
"object",
".",
"If",
"the",
"private",
"key",
"is",
"encrypted",
"and",
"password",
"is",
"not",
"None",
"the",
"given",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L210-L228 | train |
paramiko/paramiko | paramiko/pkey.py | PKey._write_private_key_file | def _write_private_key_file(self, filename, key, format, password=None):
"""
Write an SSH2-format private key file in a form that can be read by
paramiko or openssh. If no password is given, the key is written in
a trivially-encoded format (base64) which is completely insecure. If
... | python | def _write_private_key_file(self, filename, key, format, password=None):
"""
Write an SSH2-format private key file in a form that can be read by
paramiko or openssh. If no password is given, the key is written in
a trivially-encoded format (base64) which is completely insecure. If
... | [
"def",
"_write_private_key_file",
"(",
"self",
",",
"filename",
",",
"key",
",",
"format",
",",
"password",
"=",
"None",
")",
":",
"with",
"open",
"(",
"filename",
",",
"\"w\"",
")",
"as",
"f",
":",
"os",
".",
"chmod",
"(",
"filename",
",",
"o600",
"... | Write an SSH2-format private key file in a form that can be read by
paramiko or openssh. If no password is given, the key is written in
a trivially-encoded format (base64) which is completely insecure. If
a password is given, DES-EDE3-CBC is used.
:param str tag:
``"RSA"``... | [
"Write",
"an",
"SSH2",
"-",
"format",
"private",
"key",
"file",
"in",
"a",
"form",
"that",
"can",
"be",
"read",
"by",
"paramiko",
"or",
"openssh",
".",
"If",
"no",
"password",
"is",
"given",
"the",
"key",
"is",
"written",
"in",
"a",
"trivially",
"-",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L340-L357 | train |
paramiko/paramiko | paramiko/pkey.py | PKey._check_type_and_load_cert | def _check_type_and_load_cert(self, msg, key_type, cert_type):
"""
Perform message type-checking & optional certificate loading.
This includes fast-forwarding cert ``msg`` objects past the nonce, so
that the subsequent fields are the key numbers; thus the caller may
expect to tr... | python | def _check_type_and_load_cert(self, msg, key_type, cert_type):
"""
Perform message type-checking & optional certificate loading.
This includes fast-forwarding cert ``msg`` objects past the nonce, so
that the subsequent fields are the key numbers; thus the caller may
expect to tr... | [
"def",
"_check_type_and_load_cert",
"(",
"self",
",",
"msg",
",",
"key_type",
",",
"cert_type",
")",
":",
"# Normalization; most classes have a single key type and give a string,",
"# but eg ECDSA is a 1:N mapping.",
"key_types",
"=",
"key_type",
"cert_types",
"=",
"cert_type",... | Perform message type-checking & optional certificate loading.
This includes fast-forwarding cert ``msg`` objects past the nonce, so
that the subsequent fields are the key numbers; thus the caller may
expect to treat the message as key material afterwards either way.
The obtained key ty... | [
"Perform",
"message",
"type",
"-",
"checking",
"&",
"optional",
"certificate",
"loading",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L371-L416 | train |
paramiko/paramiko | paramiko/pkey.py | PKey.load_certificate | def load_certificate(self, value):
"""
Supplement the private key contents with data loaded from an OpenSSH
public key (``.pub``) or certificate (``-cert.pub``) file, a string
containing such a file, or a `.Message` object.
The .pub contents adds no real value, since the private... | python | def load_certificate(self, value):
"""
Supplement the private key contents with data loaded from an OpenSSH
public key (``.pub``) or certificate (``-cert.pub``) file, a string
containing such a file, or a `.Message` object.
The .pub contents adds no real value, since the private... | [
"def",
"load_certificate",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Message",
")",
":",
"constructor",
"=",
"\"from_message\"",
"elif",
"os",
".",
"path",
".",
"isfile",
"(",
"value",
")",
":",
"constructor",
"=",
"\"f... | Supplement the private key contents with data loaded from an OpenSSH
public key (``.pub``) or certificate (``-cert.pub``) file, a string
containing such a file, or a `.Message` object.
The .pub contents adds no real value, since the private key
file includes sufficient information to de... | [
"Supplement",
"the",
"private",
"key",
"contents",
"with",
"data",
"loaded",
"from",
"an",
"OpenSSH",
"public",
"key",
"(",
".",
"pub",
")",
"or",
"certificate",
"(",
"-",
"cert",
".",
"pub",
")",
"file",
"a",
"string",
"containing",
"such",
"a",
"file",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L418-L447 | train |
paramiko/paramiko | paramiko/pkey.py | PublicBlob.from_file | def from_file(cls, filename):
"""
Create a public blob from a ``-cert.pub``-style file on disk.
"""
with open(filename) as f:
string = f.read()
return cls.from_string(string) | python | def from_file(cls, filename):
"""
Create a public blob from a ``-cert.pub``-style file on disk.
"""
with open(filename) as f:
string = f.read()
return cls.from_string(string) | [
"def",
"from_file",
"(",
"cls",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
")",
"as",
"f",
":",
"string",
"=",
"f",
".",
"read",
"(",
")",
"return",
"cls",
".",
"from_string",
"(",
"string",
")"
] | Create a public blob from a ``-cert.pub``-style file on disk. | [
"Create",
"a",
"public",
"blob",
"from",
"a",
"-",
"cert",
".",
"pub",
"-",
"style",
"file",
"on",
"disk",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L482-L488 | train |
paramiko/paramiko | paramiko/pkey.py | PublicBlob.from_string | def from_string(cls, string):
"""
Create a public blob from a ``-cert.pub``-style string.
"""
fields = string.split(None, 2)
if len(fields) < 2:
msg = "Not enough fields for public blob: {}"
raise ValueError(msg.format(fields))
key_type = fields[0]... | python | def from_string(cls, string):
"""
Create a public blob from a ``-cert.pub``-style string.
"""
fields = string.split(None, 2)
if len(fields) < 2:
msg = "Not enough fields for public blob: {}"
raise ValueError(msg.format(fields))
key_type = fields[0]... | [
"def",
"from_string",
"(",
"cls",
",",
"string",
")",
":",
"fields",
"=",
"string",
".",
"split",
"(",
"None",
",",
"2",
")",
"if",
"len",
"(",
"fields",
")",
"<",
"2",
":",
"msg",
"=",
"\"Not enough fields for public blob: {}\"",
"raise",
"ValueError",
... | Create a public blob from a ``-cert.pub``-style string. | [
"Create",
"a",
"public",
"blob",
"from",
"a",
"-",
"cert",
".",
"pub",
"-",
"style",
"string",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L491-L515 | train |
paramiko/paramiko | paramiko/pkey.py | PublicBlob.from_message | def from_message(cls, message):
"""
Create a public blob from a network `.Message`.
Specifically, a cert-bearing pubkey auth packet, because by definition
OpenSSH-style certificates 'are' their own network representation."
"""
type_ = message.get_text()
return cl... | python | def from_message(cls, message):
"""
Create a public blob from a network `.Message`.
Specifically, a cert-bearing pubkey auth packet, because by definition
OpenSSH-style certificates 'are' their own network representation."
"""
type_ = message.get_text()
return cl... | [
"def",
"from_message",
"(",
"cls",
",",
"message",
")",
":",
"type_",
"=",
"message",
".",
"get_text",
"(",
")",
"return",
"cls",
"(",
"type_",
"=",
"type_",
",",
"blob",
"=",
"message",
".",
"asbytes",
"(",
")",
")"
] | Create a public blob from a network `.Message`.
Specifically, a cert-bearing pubkey auth packet, because by definition
OpenSSH-style certificates 'are' their own network representation." | [
"Create",
"a",
"public",
"blob",
"from",
"a",
"network",
".",
"Message",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L518-L526 | train |
paramiko/paramiko | paramiko/pipe.py | make_or_pipe | def make_or_pipe(pipe):
"""
wraps a pipe into two pipe-like objects which are "or"d together to
affect the real pipe. if either returned pipe is set, the wrapped pipe
is set. when both are cleared, the wrapped pipe is cleared.
"""
p1 = OrPipe(pipe)
p2 = OrPipe(pipe)
p1._partner = p2
... | python | def make_or_pipe(pipe):
"""
wraps a pipe into two pipe-like objects which are "or"d together to
affect the real pipe. if either returned pipe is set, the wrapped pipe
is set. when both are cleared, the wrapped pipe is cleared.
"""
p1 = OrPipe(pipe)
p2 = OrPipe(pipe)
p1._partner = p2
... | [
"def",
"make_or_pipe",
"(",
"pipe",
")",
":",
"p1",
"=",
"OrPipe",
"(",
"pipe",
")",
"p2",
"=",
"OrPipe",
"(",
"pipe",
")",
"p1",
".",
"_partner",
"=",
"p2",
"p2",
".",
"_partner",
"=",
"p1",
"return",
"p1",
",",
"p2"
] | wraps a pipe into two pipe-like objects which are "or"d together to
affect the real pipe. if either returned pipe is set, the wrapped pipe
is set. when both are cleared, the wrapped pipe is cleared. | [
"wraps",
"a",
"pipe",
"into",
"two",
"pipe",
"-",
"like",
"objects",
"which",
"are",
"or",
"d",
"together",
"to",
"affect",
"the",
"real",
"pipe",
".",
"if",
"either",
"returned",
"pipe",
"is",
"set",
"the",
"wrapped",
"pipe",
"is",
"set",
".",
"when",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pipe.py#L138-L148 | train |
paramiko/paramiko | paramiko/agent.py | AgentLocalProxy.get_connection | def get_connection(self):
"""
Return a pair of socket object and string address.
May block!
"""
conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
conn.bind(self._agent._get_filename())
conn.listen(1)
(r, addr) = conn.accept... | python | def get_connection(self):
"""
Return a pair of socket object and string address.
May block!
"""
conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
conn.bind(self._agent._get_filename())
conn.listen(1)
(r, addr) = conn.accept... | [
"def",
"get_connection",
"(",
"self",
")",
":",
"conn",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_UNIX",
",",
"socket",
".",
"SOCK_STREAM",
")",
"try",
":",
"conn",
".",
"bind",
"(",
"self",
".",
"_agent",
".",
"_get_filename",
"(",
")",
... | Return a pair of socket object and string address.
May block! | [
"Return",
"a",
"pair",
"of",
"socket",
"object",
"and",
"string",
"address",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/agent.py#L167-L180 | train |
paramiko/paramiko | paramiko/agent.py | AgentClientProxy.close | def close(self):
"""
Close the current connection and terminate the agent
Should be called manually
"""
if hasattr(self, "thread"):
self.thread._exit = True
self.thread.join(1000)
if self._conn is not None:
self._conn.close() | python | def close(self):
"""
Close the current connection and terminate the agent
Should be called manually
"""
if hasattr(self, "thread"):
self.thread._exit = True
self.thread.join(1000)
if self._conn is not None:
self._conn.close() | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"\"thread\"",
")",
":",
"self",
".",
"thread",
".",
"_exit",
"=",
"True",
"self",
".",
"thread",
".",
"join",
"(",
"1000",
")",
"if",
"self",
".",
"_conn",
"is",
"not",
"No... | Close the current connection and terminate the agent
Should be called manually | [
"Close",
"the",
"current",
"connection",
"and",
"terminate",
"the",
"agent",
"Should",
"be",
"called",
"manually"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/agent.py#L243-L252 | train |
paramiko/paramiko | paramiko/agent.py | AgentServerProxy.close | def close(self):
"""
Terminate the agent, clean the files, close connections
Should be called manually
"""
os.remove(self._file)
os.rmdir(self._dir)
self.thread._exit = True
self.thread.join(1000)
self._close() | python | def close(self):
"""
Terminate the agent, clean the files, close connections
Should be called manually
"""
os.remove(self._file)
os.rmdir(self._dir)
self.thread._exit = True
self.thread.join(1000)
self._close() | [
"def",
"close",
"(",
"self",
")",
":",
"os",
".",
"remove",
"(",
"self",
".",
"_file",
")",
"os",
".",
"rmdir",
"(",
"self",
".",
"_dir",
")",
"self",
".",
"thread",
".",
"_exit",
"=",
"True",
"self",
".",
"thread",
".",
"join",
"(",
"1000",
")... | Terminate the agent, clean the files, close connections
Should be called manually | [
"Terminate",
"the",
"agent",
"clean",
"the",
"files",
"close",
"connections",
"Should",
"be",
"called",
"manually"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/agent.py#L281-L290 | train |
paramiko/paramiko | paramiko/packet.py | Packetizer.set_outbound_cipher | def set_outbound_cipher(
self,
block_engine,
block_size,
mac_engine,
mac_size,
mac_key,
sdctr=False,
):
"""
Switch outbound data cipher.
"""
self.__block_engine_out = block_engine
self.__sdctr_out = sdctr
self.__... | python | def set_outbound_cipher(
self,
block_engine,
block_size,
mac_engine,
mac_size,
mac_key,
sdctr=False,
):
"""
Switch outbound data cipher.
"""
self.__block_engine_out = block_engine
self.__sdctr_out = sdctr
self.__... | [
"def",
"set_outbound_cipher",
"(",
"self",
",",
"block_engine",
",",
"block_size",
",",
"mac_engine",
",",
"mac_size",
",",
"mac_key",
",",
"sdctr",
"=",
"False",
",",
")",
":",
"self",
".",
"__block_engine_out",
"=",
"block_engine",
"self",
".",
"__sdctr_out"... | Switch outbound data cipher. | [
"Switch",
"outbound",
"data",
"cipher",
"."
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/packet.py#L137-L162 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.