partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | _SSH_SSPI.ssh_accept_sec_context | 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... | paramiko/ssh_gss.py | 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):
"""
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,
... | [
"Accept",
"a",
"SSPI",
"context",
"(",
"server",
"mode",
")",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L510-L530 | [
"def",
"ssh_accept_sec_context",
"(",
"self",
",",
"hostname",
",",
"username",
",",
"recv_token",
")",
":",
"self",
".",
"_gss_host",
"=",
"hostname",
"self",
".",
"_username",
"=",
"username",
"targ_name",
"=",
"\"host/\"",
"+",
"self",
".",
"_gss_host",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | _SSH_SSPI.ssh_check_mic | 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`` -... | paramiko/ssh_gss.py | 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):
"""
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
... | [
"Verify",
"the",
"MIC",
"token",
"for",
"a",
"SSH2",
"message",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L532-L560 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | _SSH_SSPI.credentials_delegated | Checks if credentials are delegated (server mode).
:return: ``True`` if credentials are delegated, otherwise ``False`` | paramiko/ssh_gss.py | 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):
"""
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
... | [
"Checks",
"if",
"credentials",
"are",
"delegated",
"(",
"server",
"mode",
")",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L563-L571 | [
"def",
"credentials_delegated",
"(",
"self",
")",
":",
"return",
"self",
".",
"_gss_flags",
"&",
"sspicon",
".",
"ISC_REQ_DELEGATE",
"and",
"(",
"self",
".",
"_gss_srv_ctxt_status",
"or",
"self",
".",
"_gss_flags",
")"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient.from_transport | 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.
... | paramiko/sftp_client.py | 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):
"""
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... | [
"Create",
"an",
"SFTP",
"client",
"channel",
"from",
"an",
"open",
".",
"Transport",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L141-L170 | [
"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",
")",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient.listdir_iter | 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... | paramiko/sftp_client.py | 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):
"""
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_... | [
"Generator",
"version",
"of",
".",
"listdir_attr",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L262-L324 | [
"def",
"listdir_iter",
"(",
"self",
",",
"path",
"=",
"\".\"",
",",
"read_aheads",
"=",
"50",
")",
":",
"path",
"=",
"self",
".",
"_adjust_cwd",
"(",
"path",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"listdir({!r})\"",
".",
"format",
"(",
"path",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient.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... | paramiko/sftp_client.py | 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):
"""
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`.
... | [
"Rename",
"a",
"file",
"or",
"folder",
"from",
"oldpath",
"to",
"newpath",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L402-L423 | [
"def",
"rename",
"(",
"self",
",",
"oldpath",
",",
"newpath",
")",
":",
"oldpath",
"=",
"self",
".",
"_adjust_cwd",
"(",
"oldpath",
")",
"newpath",
"=",
"self",
".",
"_adjust_cwd",
"(",
"newpath",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"rename(... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient.posix_rename | 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... | paramiko/sftp_client.py | 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):
"""
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 ... | [
"Rename",
"a",
"file",
"or",
"folder",
"from",
"oldpath",
"to",
"newpath",
"following",
"posix",
"conventions",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L425-L445 | [
"def",
"posix_rename",
"(",
"self",
",",
"oldpath",
",",
"newpath",
")",
":",
"oldpath",
"=",
"self",
".",
"_adjust_cwd",
"(",
"oldpath",
")",
"newpath",
"=",
"self",
".",
"_adjust_cwd",
"(",
"newpath",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"p... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient.mkdir | 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... | paramiko/sftp_client.py | 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):
"""
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",
"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",... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L447-L460 | [
"def",
"mkdir",
"(",
"self",
",",
"path",
",",
"mode",
"=",
"o777",
")",
":",
"path",
"=",
"self",
".",
"_adjust_cwd",
"(",
"path",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"mkdir({!r}, {!r})\"",
".",
"format",
"(",
"path",
",",
"mode",
")",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient.symlink | 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 | paramiko/sftp_client.py | 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):
"""
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}... | [
"Create",
"a",
"symbolic",
"link",
"to",
"the",
"source",
"path",
"at",
"destination",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L516-L526 | [
"def",
"symlink",
"(",
"self",
",",
"source",
",",
"dest",
")",
":",
"dest",
"=",
"self",
".",
"_adjust_cwd",
"(",
"dest",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"symlink({!r}, {!r})\"",
".",
"format",
"(",
"source",
",",
"dest",
")",
")",
"s... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient.chown | 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
... | paramiko/sftp_client.py | 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):
"""
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... | [
"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... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L543-L558 | [
"def",
"chown",
"(",
"self",
",",
"path",
",",
"uid",
",",
"gid",
")",
":",
"path",
"=",
"self",
".",
"_adjust_cwd",
"(",
"path",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"chown({!r}, {!r}, {!r})\"",
".",
"format",
"(",
"path",
",",
"uid",
",",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient.utime | 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... | paramiko/sftp_client.py | 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):
"""
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)... | [
"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",
".",
"... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L560-L580 | [
"def",
"utime",
"(",
"self",
",",
"path",
",",
"times",
")",
":",
"path",
"=",
"self",
".",
"_adjust_cwd",
"(",
"path",
")",
"if",
"times",
"is",
"None",
":",
"times",
"=",
"(",
"time",
".",
"time",
"(",
")",
",",
"time",
".",
"time",
"(",
")",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient.truncate | 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 | paramiko/sftp_client.py | 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):
"""
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... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L582-L595 | [
"def",
"truncate",
"(",
"self",
",",
"path",
",",
"size",
")",
":",
"path",
"=",
"self",
".",
"_adjust_cwd",
"(",
"path",
")",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"truncate({!r}, {!r})\"",
".",
"format",
"(",
"path",
",",
"size",
")",
")",
"att... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient.putfo | 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... | paramiko/sftp_client.py | 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):
"""
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.
... | [
"Copy",
"the",
"contents",
"of",
"an",
"open",
"file",
"object",
"(",
"fl",
")",
"to",
"the",
"SFTP",
"server",
"as",
"remotepath",
".",
"Any",
"exception",
"raised",
"by",
"operations",
"will",
"be",
"passed",
"through",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L687-L727 | [
"def",
"putfo",
"(",
"self",
",",
"fl",
",",
"remotepath",
",",
"file_size",
"=",
"0",
",",
"callback",
"=",
"None",
",",
"confirm",
"=",
"True",
")",
":",
"with",
"self",
".",
"file",
"(",
"remotepath",
",",
"\"wb\"",
")",
"as",
"fr",
":",
"fr",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient.put | 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... | paramiko/sftp_client.py | 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):
"""
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 ... | [
"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... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L729-L759 | [
"def",
"put",
"(",
"self",
",",
"localpath",
",",
"remotepath",
",",
"callback",
"=",
"None",
",",
"confirm",
"=",
"True",
")",
":",
"file_size",
"=",
"os",
".",
"stat",
"(",
"localpath",
")",
".",
"st_size",
"with",
"open",
"(",
"localpath",
",",
"\... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient.getfo | 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... | paramiko/sftp_client.py | 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):
"""
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.
... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L761-L783 | [
"def",
"getfo",
"(",
"self",
",",
"remotepath",
",",
"fl",
",",
"callback",
"=",
"None",
")",
":",
"file_size",
"=",
"self",
".",
"stat",
"(",
"remotepath",
")",
".",
"st_size",
"with",
"self",
".",
"open",
"(",
"remotepath",
",",
"\"rb\"",
")",
"as"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient.get | 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... | paramiko/sftp_client.py | 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):
"""
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... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L785-L807 | [
"def",
"get",
"(",
"self",
",",
"remotepath",
",",
"localpath",
",",
"callback",
"=",
"None",
")",
":",
"with",
"open",
"(",
"localpath",
",",
"\"wb\"",
")",
"as",
"fl",
":",
"size",
"=",
"self",
".",
"getfo",
"(",
"remotepath",
",",
"fl",
",",
"ca... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient._convert_status | Raises EOFError or IOError on error status; otherwise does nothing. | paramiko/sftp_client.py | 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):
"""
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 ... | [
"Raises",
"EOFError",
"or",
"IOError",
"on",
"error",
"status",
";",
"otherwise",
"does",
"nothing",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L882-L898 | [
"def",
"_convert_status",
"(",
"self",
",",
"msg",
")",
":",
"code",
"=",
"msg",
".",
"get_int",
"(",
")",
"text",
"=",
"msg",
".",
"get_text",
"(",
")",
"if",
"code",
"==",
"SFTP_OK",
":",
"return",
"elif",
"code",
"==",
"SFTP_EOF",
":",
"raise",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPClient._adjust_cwd | Return an adjusted path if we're emulating a "current working
directory" for the server. | paramiko/sftp_client.py | 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):
"""
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
... | [
"Return",
"an",
"adjusted",
"path",
"if",
"we",
"re",
"emulating",
"a",
"current",
"working",
"directory",
"for",
"the",
"server",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L900-L913 | [
"def",
"_adjust_cwd",
"(",
"self",
",",
"path",
")",
":",
"path",
"=",
"b",
"(",
"path",
")",
"if",
"self",
".",
"_cwd",
"is",
"None",
":",
"return",
"path",
"if",
"len",
"(",
"path",
")",
"and",
"path",
"[",
"0",
":",
"1",
"]",
"==",
"b_slash"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | coverage | Execute all tests (normal and slow) with coverage enabled. | tasks.py | 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=""):
"""
Execute all tests (normal and slow) with coverage enabled.
"""
return test(ctx, coverage=True, include_slow=True, opts=opts) | [
"Execute",
"all",
"tests",
"(",
"normal",
"and",
"slow",
")",
"with",
"coverage",
"enabled",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/tasks.py#L78-L82 | [
"def",
"coverage",
"(",
"ctx",
",",
"opts",
"=",
"\"\"",
")",
":",
"return",
"test",
"(",
"ctx",
",",
"coverage",
"=",
"True",
",",
"include_slow",
"=",
"True",
",",
"opts",
"=",
"opts",
")"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | guard | Execute all tests and then watch for changes, re-running. | tasks.py | 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=""):
"""
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) | [
"Execute",
"all",
"tests",
"and",
"then",
"watch",
"for",
"changes",
"re",
"-",
"running",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/tasks.py#L86-L91 | [
"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",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | release | Wraps invocations.packaging.publish to add baked-in docs folder. | tasks.py | 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):
"""
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... | [
"Wraps",
"invocations",
".",
"packaging",
".",
"publish",
"to",
"add",
"baked",
"-",
"in",
"docs",
"folder",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/tasks.py#L98-L117 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.set_gss_host | 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... | paramiko/transport.py | 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):
"""
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... | [
"Normalize",
"/",
"canonicalize",
"self",
".",
"gss_host",
"depending",
"on",
"various",
"factors",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L502-L534 | [
"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 ... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.start_client | 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... | paramiko/transport.py | 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):
"""
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
... | [
"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",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L536-L592 | [
"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",
".",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.load_server_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 ... | paramiko/transport.py | 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):
"""
(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
... | [
"(",
"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",
"... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L696-L734 | [
"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\"",
"]",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.close | Close this session, and any open channels that are tied to it. | paramiko/transport.py | 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):
"""
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() | [
"Close",
"this",
"session",
"and",
"any",
"open",
"channels",
"that",
"are",
"tied",
"to",
"it",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L736-L745 | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"active",
":",
"return",
"self",
".",
"stop_thread",
"(",
")",
"for",
"chan",
"in",
"list",
"(",
"self",
".",
"_channels",
".",
"values",
"(",
")",
")",
":",
"chan",
".",
"_unlink",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.open_session | 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
... | paramiko/transport.py | 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
):
"""
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... | [
"Request",
"a",
"new",
"channel",
"to",
"the",
"server",
"of",
"type",
"session",
".",
"This",
"is",
"just",
"an",
"alias",
"for",
"calling",
"open_channel",
"with",
"an",
"argument",
"of",
"session",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L774-L807 | [
"def",
"open_session",
"(",
"self",
",",
"window_size",
"=",
"None",
",",
"max_packet_size",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"return",
"self",
".",
"open_channel",
"(",
"\"session\"",
",",
"window_size",
"=",
"window_size",
",",
"max_pack... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.open_channel | 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... | paramiko/transport.py | 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,
):
"""
Request a new channel to the server. `Channels <.Channel>` are
socket-like objects used for the actual transfer of... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L851-L944 | [
"def",
"open_channel",
"(",
"self",
",",
"kind",
",",
"dest_addr",
"=",
"None",
",",
"src_addr",
"=",
"None",
",",
"window_size",
"=",
"None",
",",
"max_packet_size",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
")",
":",
"if",
"not",
"self",
".",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.request_port_forward | 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,
... | paramiko/transport.py | 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):
"""
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.... | [
"Ask",
"the",
"server",
"to",
"forward",
"TCP",
"connections",
"from",
"a",
"listening",
"port",
"on",
"the",
"server",
"across",
"this",
"SSH",
"session",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L946-L998 | [
"def",
"request_port_forward",
"(",
"self",
",",
"address",
",",
"port",
",",
"handler",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"active",
":",
"raise",
"SSHException",
"(",
"\"SSH session not active\"",
")",
"port",
"=",
"int",
"(",
"port",
")",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.cancel_port_forward | 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 | paramiko/transport.py | 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):
"""
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... | [
"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",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1000-L1012 | [
"def",
"cancel_port_forward",
"(",
"self",
",",
"address",
",",
"port",
")",
":",
"if",
"not",
"self",
".",
"active",
":",
"return",
"self",
".",
"_tcp_handler",
"=",
"None",
"self",
".",
"global_request",
"(",
"\"cancel-tcpip-forward\"",
",",
"(",
"address"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.send_ignore | 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... | paramiko/transport.py | 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):
"""
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... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1026-L1042 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.accept | 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... | paramiko/transport.py | 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):
"""
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... | [
"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",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1124-L1147 | [
"def",
"accept",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"len",
"(",
"self",
".",
"server_accepts",
")",
">",
"0",
":",
"chan",
"=",
"self",
".",
"server_accepts",
".",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.connect | 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... | paramiko/transport.py | 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_deleg_creds=True,
gss_trust_dns=True,
):
"""
Negotiate an SSH2 session, and optionally verify the ... | [
"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",... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1149-L1265 | [
"def",
"connect",
"(",
"self",
",",
"hostkey",
"=",
"None",
",",
"username",
"=",
"\"\"",
",",
"password",
"=",
"None",
",",
"pkey",
"=",
"None",
",",
"gss_host",
"=",
"None",
",",
"gss_auth",
"=",
"False",
",",
"gss_kex",
"=",
"False",
",",
"gss_del... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.get_exception | 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... | paramiko/transport.py | 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):
"""
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... | [
"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... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1267-L1285 | [
"def",
"get_exception",
"(",
"self",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"try",
":",
"e",
"=",
"self",
".",
"saved_exception",
"self",
".",
"saved_exception",
"=",
"None",
"return",
"e",
"finally",
":",
"self",
".",
"lock",
".",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.set_subsystem_handler | 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... | paramiko/transport.py | 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):
"""
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... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1287-L1305 | [
"def",
"set_subsystem_handler",
"(",
"self",
",",
"name",
",",
"handler",
",",
"*",
"larg",
",",
"*",
"*",
"kwarg",
")",
":",
"try",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"self",
".",
"subsystem_table",
"[",
"name",
"]",
"=",
"(",
"ha... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.auth_password | 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 ... | paramiko/transport.py | 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):
"""
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... | [
"Authenticate",
"to",
"the",
"server",
"using",
"a",
"password",
".",
"The",
"username",
"and",
"password",
"are",
"sent",
"over",
"an",
"encrypted",
"link",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1375-L1458 | [
"def",
"auth_password",
"(",
"self",
",",
"username",
",",
"password",
",",
"event",
"=",
"None",
",",
"fallback",
"=",
"True",
")",
":",
"if",
"(",
"not",
"self",
".",
"active",
")",
"or",
"(",
"not",
"self",
".",
"initial_kex_done",
")",
":",
"# we... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.auth_publickey | 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_... | paramiko/transport.py | 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):
"""
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... | [
"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",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1460-L1507 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.auth_interactive | 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... | paramiko/transport.py | 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=""):
"""
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... | [
"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",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1509-L1560 | [
"def",
"auth_interactive",
"(",
"self",
",",
"username",
",",
"handler",
",",
"submethods",
"=",
"\"\"",
")",
":",
"if",
"(",
"not",
"self",
".",
"active",
")",
"or",
"(",
"not",
"self",
".",
"initial_kex_done",
")",
":",
"# we should never try to authentica... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.auth_interactive_dumb | 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. | paramiko/transport.py | 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=""):
"""
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 ... | [
"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"... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1562-L1583 | [
"def",
"auth_interactive_dumb",
"(",
"self",
",",
"username",
",",
"handler",
"=",
"None",
",",
"submethods",
"=",
"\"\"",
")",
":",
"if",
"not",
"handler",
":",
"def",
"handler",
"(",
"title",
",",
"instructions",
",",
"prompt_list",
")",
":",
"answers",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.auth_gssapi_with_mic | 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... | paramiko/transport.py | 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):
"""
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... | [
"Authenticate",
"to",
"the",
"Server",
"using",
"GSS",
"-",
"API",
"/",
"SSPI",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1585-L1609 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport.set_log_channel | 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
... | paramiko/transport.py | 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):
"""
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... | [
"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",
"... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1634-L1647 | [
"def",
"set_log_channel",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"log_name",
"=",
"name",
"self",
".",
"logger",
"=",
"util",
".",
"get_logger",
"(",
"name",
")",
"self",
".",
"packetizer",
".",
"set_log",
"(",
"self",
".",
"logger",
")"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport._next_channel | you are holding the lock | paramiko/transport.py | 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):
"""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... | [
"you",
"are",
"holding",
"the",
"lock"
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1752-L1759 | [
"def",
"_next_channel",
"(",
"self",
")",
":",
"chanid",
"=",
"self",
".",
"_channel_counter",
"while",
"self",
".",
"_channels",
".",
"get",
"(",
"chanid",
")",
"is",
"not",
"None",
":",
"self",
".",
"_channel_counter",
"=",
"(",
"self",
".",
"_channel_... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport._compute_key | id is 'A' - 'F' for the various keys used by ssh | paramiko/transport.py | 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):
"""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
# ... | [
"id",
"is",
"A",
"-",
"F",
"for",
"the",
"various",
"keys",
"used",
"by",
"ssh"
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1821-L1849 | [
"def",
"_compute_key",
"(",
"self",
",",
"id",
",",
"nbytes",
")",
":",
"m",
"=",
"Message",
"(",
")",
"m",
".",
"add_mpint",
"(",
"self",
".",
"K",
")",
"m",
".",
"add_bytes",
"(",
"self",
".",
"H",
")",
"m",
".",
"add_byte",
"(",
"b",
"(",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport._ensure_authed | 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... | paramiko/transport.py | 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):
"""
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... | [
"Checks",
"message",
"type",
"against",
"current",
"auth",
"state",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L1904-L1940 | [
"def",
"_ensure_authed",
"(",
"self",
",",
"ptype",
",",
"message",
")",
":",
"if",
"(",
"not",
"self",
".",
"server_mode",
"or",
"ptype",
"<=",
"HIGHEST_USERAUTH_MESSAGE_ID",
"or",
"self",
".",
"is_authenticated",
"(",
")",
")",
":",
"return",
"None",
"# ... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Transport._activate_outbound | switch on newly negotiated encryption parameters for
outbound traffic | paramiko/transport.py | 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):
"""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:
... | [
"switch",
"on",
"newly",
"negotiated",
"encryption",
"parameters",
"for",
"outbound",
"traffic"
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L2461-L2502 | [
"def",
"_activate_outbound",
"(",
"self",
")",
":",
"m",
"=",
"Message",
"(",
")",
"m",
".",
"add_byte",
"(",
"cMSG_NEWKEYS",
")",
"self",
".",
"_send_message",
"(",
"m",
")",
"block_size",
"=",
"self",
".",
"_cipher_info",
"[",
"self",
".",
"local_ciphe... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | BufferedFile.flush | Write out any data in the write buffer. This may do nothing if write
buffering is not turned on. | paramiko/file.py | 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):
"""
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 | [
"Write",
"out",
"any",
"data",
"in",
"the",
"write",
"buffer",
".",
"This",
"may",
"do",
"nothing",
"if",
"write",
"buffering",
"is",
"not",
"turned",
"on",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/file.py#L87-L94 | [
"def",
"flush",
"(",
"self",
")",
":",
"self",
".",
"_write_all",
"(",
"self",
".",
"_wbuffer",
".",
"getvalue",
"(",
")",
")",
"self",
".",
"_wbuffer",
"=",
"BytesIO",
"(",
")",
"return"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | BufferedFile.readinto | Read up to ``len(buff)`` bytes into ``bytearray`` *buff* and return the
number of bytes read.
:returns:
The number of bytes read. | paramiko/file.py | 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):
"""
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) | [
"Read",
"up",
"to",
"len",
"(",
"buff",
")",
"bytes",
"into",
"bytearray",
"*",
"buff",
"*",
"and",
"return",
"the",
"number",
"of",
"bytes",
"read",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/file.py#L160-L170 | [
"def",
"readinto",
"(",
"self",
",",
"buff",
")",
":",
"data",
"=",
"self",
".",
"read",
"(",
"len",
"(",
"buff",
")",
")",
"buff",
"[",
":",
"len",
"(",
"data",
")",
"]",
"=",
"data",
"return",
"len",
"(",
"data",
")"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | BufferedFile.readlines | 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: ... | paramiko/file.py | 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):
"""
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... | [
"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... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/file.py#L336-L356 | [
"def",
"readlines",
"(",
"self",
",",
"sizehint",
"=",
"None",
")",
":",
"lines",
"=",
"[",
"]",
"byte_count",
"=",
"0",
"while",
"True",
":",
"line",
"=",
"self",
".",
"readline",
"(",
")",
"if",
"len",
"(",
"line",
")",
"==",
"0",
":",
"break",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | BufferedFile.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. (Use `flush` or `close` to force buffered data to be
written out.)
:param data: ``str``/``bytes`` data to write | paramiko/file.py | 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):
"""
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... | [
"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",
".",
"(... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/file.py#L388-L422 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | HostKeys.add | 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 | paramiko/hostkeys.py | 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):
"""
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... | [
"Add",
"a",
"host",
"key",
"entry",
"to",
"the",
"table",
".",
"Any",
"existing",
"entry",
"for",
"a",
"(",
"hostname",
"keytype",
")",
"pair",
"will",
"be",
"replaced",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/hostkeys.py#L61-L74 | [
"def",
"add",
"(",
"self",
",",
"hostname",
",",
"keytype",
",",
"key",
")",
":",
"for",
"e",
"in",
"self",
".",
"_entries",
":",
"if",
"(",
"hostname",
"in",
"e",
".",
"hostnames",
")",
"and",
"(",
"e",
".",
"key",
".",
"get_name",
"(",
")",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | HostKeys.load | 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,
... | paramiko/hostkeys.py | 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):
"""
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... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/hostkeys.py#L76-L106 | [
"def",
"load",
"(",
"self",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"\"r\"",
")",
"as",
"f",
":",
"for",
"lineno",
",",
"line",
"in",
"enumerate",
"(",
"f",
",",
"1",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | HostKeys.lookup | 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` -> ... | paramiko/hostkeys.py | 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):
"""
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 ... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/hostkeys.py#L127-L191 | [
"def",
"lookup",
"(",
"self",
",",
"hostname",
")",
":",
"class",
"SubDict",
"(",
"MutableMapping",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"hostname",
",",
"entries",
",",
"hostkeys",
")",
":",
"self",
".",
"_hostname",
"=",
"hostname",
"self",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | HostKeys._hostname_matches | Tests whether ``hostname`` string matches given SubDict ``entry``.
:returns bool: | paramiko/hostkeys.py | 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):
"""
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... | [
"Tests",
"whether",
"hostname",
"string",
"matches",
"given",
"SubDict",
"entry",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/hostkeys.py#L193-L207 | [
"def",
"_hostname_matches",
"(",
"self",
",",
"hostname",
",",
"entry",
")",
":",
"for",
"h",
"in",
"entry",
".",
"hostnames",
":",
"if",
"(",
"h",
"==",
"hostname",
"or",
"h",
".",
"startswith",
"(",
"\"|1|\"",
")",
"and",
"not",
"hostname",
".",
"s... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | HostKeyEntry.from_line | 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... | paramiko/hostkeys.py | 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):
"""
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... | [
"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",... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/hostkeys.py#L327-L370 | [
"def",
"from_line",
"(",
"cls",
",",
"line",
",",
"lineno",
"=",
"None",
")",
":",
"log",
"=",
"get_logger",
"(",
"\"paramiko.hostkeys\"",
")",
"fields",
"=",
"line",
".",
"split",
"(",
"\" \"",
")",
"if",
"len",
"(",
"fields",
")",
"<",
"3",
":",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | _query_pageant | Communication with the Pageant process is done through a shared
memory-mapped file. | paramiko/win_pageant.py | 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):
"""
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... | [
"Communication",
"with",
"the",
"Pageant",
"process",
"is",
"done",
"through",
"a",
"shared",
"memory",
"-",
"mapped",
"file",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/win_pageant.py#L79-L114 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Message.get_remainder | Return the bytes (as a `str`) of this message that haven't already been
parsed and returned. | paramiko/message.py | 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):
"""
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 | [
"Return",
"the",
"bytes",
"(",
"as",
"a",
"str",
")",
"of",
"this",
"message",
"that",
"haven",
"t",
"already",
"been",
"parsed",
"and",
"returned",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/message.py#L81-L89 | [
"def",
"get_remainder",
"(",
"self",
")",
":",
"position",
"=",
"self",
".",
"packet",
".",
"tell",
"(",
")",
"remainder",
"=",
"self",
".",
"packet",
".",
"read",
"(",
")",
"self",
".",
"packet",
".",
"seek",
"(",
"position",
")",
"return",
"remaind... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Message.get_so_far | 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`. | paramiko/message.py | 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):
"""
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... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/message.py#L91-L99 | [
"def",
"get_so_far",
"(",
"self",
")",
":",
"position",
"=",
"self",
".",
"packet",
".",
"tell",
"(",
")",
"self",
".",
"rewind",
"(",
")",
"return",
"self",
".",
"packet",
".",
"read",
"(",
"position",
")"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Message.get_bytes | 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. | paramiko/message.py | 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):
"""
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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/message.py#L101-L112 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Message.add_boolean | Add a boolean value to the stream.
:param bool b: boolean value to add | paramiko/message.py | 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):
"""
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 | [
"Add",
"a",
"boolean",
"value",
"to",
"the",
"stream",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/message.py#L214-L224 | [
"def",
"add_boolean",
"(",
"self",
",",
"b",
")",
":",
"if",
"b",
":",
"self",
".",
"packet",
".",
"write",
"(",
"one_byte",
")",
"else",
":",
"self",
".",
"packet",
".",
"write",
"(",
"zero_byte",
")",
"return",
"self"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Message.add_adaptive_int | Add an integer to the stream.
:param int n: integer to add | paramiko/message.py | 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):
"""
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))
... | [
"Add",
"an",
"integer",
"to",
"the",
"stream",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/message.py#L235-L246 | [
"def",
"add_adaptive_int",
"(",
"self",
",",
"n",
")",
":",
"if",
"n",
">=",
"Message",
".",
"big_int",
":",
"self",
".",
"packet",
".",
"write",
"(",
"max_byte",
")",
"self",
".",
"add_string",
"(",
"util",
".",
"deflate_long",
"(",
"n",
")",
")",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Message.add_int64 | Add a 64-bit int to the stream.
:param long n: long int to add | paramiko/message.py | 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):
"""
Add a 64-bit int to the stream.
:param long n: long int to add
"""
self.packet.write(struct.pack(">Q", n))
return self | [
"Add",
"a",
"64",
"-",
"bit",
"int",
"to",
"the",
"stream",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/message.py#L248-L255 | [
"def",
"add_int64",
"(",
"self",
",",
"n",
")",
":",
"self",
".",
"packet",
".",
"write",
"(",
"struct",
".",
"pack",
"(",
"\">Q\"",
",",
"n",
")",
")",
"return",
"self"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | _roll_random | returns a random # from 0 to N-1 | paramiko/primes.py | 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):
"""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... | [
"returns",
"a",
"random",
"#",
"from",
"0",
"to",
"N",
"-",
"1"
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/primes.py#L30-L49 | [
"def",
"_roll_random",
"(",
"n",
")",
":",
"bits",
"=",
"util",
".",
"bit_length",
"(",
"n",
"-",
"1",
")",
"byte_count",
"=",
"(",
"bits",
"+",
"7",
")",
"//",
"8",
"hbyte_mask",
"=",
"pow",
"(",
"2",
",",
"bits",
"%",
"8",
")",
"-",
"1",
"#... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | ModulusPack.read_file | :raises IOError: passed from any file operations that fail. | paramiko/primes.py | 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):
"""
: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] == "#"):
... | [
":",
"raises",
"IOError",
":",
"passed",
"from",
"any",
"file",
"operations",
"that",
"fail",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/primes.py#L109-L122 | [
"def",
"read_file",
"(",
"self",
",",
"filename",
")",
":",
"self",
".",
"pack",
"=",
"{",
"}",
"with",
"open",
"(",
"filename",
",",
"\"r\"",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | ECDSAKey.generate | 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 | paramiko/ecdsakey.py | 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):
"""
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 (`.... | [
"Generate",
"a",
"new",
"private",
"ECDSA",
"key",
".",
"This",
"factory",
"function",
"can",
"be",
"used",
"to",
"generate",
"a",
"new",
"host",
"key",
"or",
"authentication",
"key",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ecdsakey.py#L258-L273 | [
"def",
"generate",
"(",
"cls",
",",
"curve",
"=",
"ec",
".",
"SECP256R1",
"(",
")",
",",
"progress_func",
"=",
"None",
",",
"bits",
"=",
"None",
")",
":",
"if",
"bits",
"is",
"not",
"None",
":",
"curve",
"=",
"cls",
".",
"_ECDSA_CURVES",
".",
"get_... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | PKey.from_private_key_file | 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... | paramiko/pkey.py | 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):
"""
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)... | [
"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"... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L186-L207 | [
"def",
"from_private_key_file",
"(",
"cls",
",",
"filename",
",",
"password",
"=",
"None",
")",
":",
"key",
"=",
"cls",
"(",
"filename",
"=",
"filename",
",",
"password",
"=",
"password",
")",
"return",
"key"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | PKey.from_private_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... | paramiko/pkey.py | 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):
"""
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... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L210-L228 | [
"def",
"from_private_key",
"(",
"cls",
",",
"file_obj",
",",
"password",
"=",
"None",
")",
":",
"key",
"=",
"cls",
"(",
"file_obj",
"=",
"file_obj",
",",
"password",
"=",
"password",
")",
"return",
"key"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | PKey._write_private_key_file | 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"``... | paramiko/pkey.py | 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):
"""
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
... | [
"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",
"-",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L340-L357 | [
"def",
"_write_private_key_file",
"(",
"self",
",",
"filename",
",",
"key",
",",
"format",
",",
"password",
"=",
"None",
")",
":",
"with",
"open",
"(",
"filename",
",",
"\"w\"",
")",
"as",
"f",
":",
"os",
".",
"chmod",
"(",
"filename",
",",
"o600",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | PKey._check_type_and_load_cert | 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... | paramiko/pkey.py | 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):
"""
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... | [
"Perform",
"message",
"type",
"-",
"checking",
"&",
"optional",
"certificate",
"loading",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L371-L416 | [
"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",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | PKey.load_certificate | 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... | paramiko/pkey.py | 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):
"""
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... | [
"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",... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L418-L447 | [
"def",
"load_certificate",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Message",
")",
":",
"constructor",
"=",
"\"from_message\"",
"elif",
"os",
".",
"path",
".",
"isfile",
"(",
"value",
")",
":",
"constructor",
"=",
"\"f... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | PublicBlob.from_file | Create a public blob from a ``-cert.pub``-style file on disk. | paramiko/pkey.py | 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):
"""
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) | [
"Create",
"a",
"public",
"blob",
"from",
"a",
"-",
"cert",
".",
"pub",
"-",
"style",
"file",
"on",
"disk",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L482-L488 | [
"def",
"from_file",
"(",
"cls",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
")",
"as",
"f",
":",
"string",
"=",
"f",
".",
"read",
"(",
")",
"return",
"cls",
".",
"from_string",
"(",
"string",
")"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | PublicBlob.from_string | Create a public blob from a ``-cert.pub``-style string. | paramiko/pkey.py | 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):
"""
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]... | [
"Create",
"a",
"public",
"blob",
"from",
"a",
"-",
"cert",
".",
"pub",
"-",
"style",
"string",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L491-L515 | [
"def",
"from_string",
"(",
"cls",
",",
"string",
")",
":",
"fields",
"=",
"string",
".",
"split",
"(",
"None",
",",
"2",
")",
"if",
"len",
"(",
"fields",
")",
"<",
"2",
":",
"msg",
"=",
"\"Not enough fields for public blob: {}\"",
"raise",
"ValueError",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | PublicBlob.from_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." | paramiko/pkey.py | 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):
"""
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... | [
"Create",
"a",
"public",
"blob",
"from",
"a",
"network",
".",
"Message",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L518-L526 | [
"def",
"from_message",
"(",
"cls",
",",
"message",
")",
":",
"type_",
"=",
"message",
".",
"get_text",
"(",
")",
"return",
"cls",
"(",
"type_",
"=",
"type_",
",",
"blob",
"=",
"message",
".",
"asbytes",
"(",
")",
")"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | make_or_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. | paramiko/pipe.py | 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):
"""
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
... | [
"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",... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pipe.py#L138-L148 | [
"def",
"make_or_pipe",
"(",
"pipe",
")",
":",
"p1",
"=",
"OrPipe",
"(",
"pipe",
")",
"p2",
"=",
"OrPipe",
"(",
"pipe",
")",
"p1",
".",
"_partner",
"=",
"p2",
"p2",
".",
"_partner",
"=",
"p1",
"return",
"p1",
",",
"p2"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | AgentLocalProxy.get_connection | Return a pair of socket object and string address.
May block! | paramiko/agent.py | 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):
"""
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... | [
"Return",
"a",
"pair",
"of",
"socket",
"object",
"and",
"string",
"address",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/agent.py#L167-L180 | [
"def",
"get_connection",
"(",
"self",
")",
":",
"conn",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_UNIX",
",",
"socket",
".",
"SOCK_STREAM",
")",
"try",
":",
"conn",
".",
"bind",
"(",
"self",
".",
"_agent",
".",
"_get_filename",
"(",
")",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | AgentClientProxy.close | Close the current connection and terminate the agent
Should be called manually | paramiko/agent.py | 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):
"""
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() | [
"Close",
"the",
"current",
"connection",
"and",
"terminate",
"the",
"agent",
"Should",
"be",
"called",
"manually"
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/agent.py#L243-L252 | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"\"thread\"",
")",
":",
"self",
".",
"thread",
".",
"_exit",
"=",
"True",
"self",
".",
"thread",
".",
"join",
"(",
"1000",
")",
"if",
"self",
".",
"_conn",
"is",
"not",
"No... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | AgentServerProxy.close | Terminate the agent, clean the files, close connections
Should be called manually | paramiko/agent.py | 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):
"""
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() | [
"Terminate",
"the",
"agent",
"clean",
"the",
"files",
"close",
"connections",
"Should",
"be",
"called",
"manually"
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/agent.py#L281-L290 | [
"def",
"close",
"(",
"self",
")",
":",
"os",
".",
"remove",
"(",
"self",
".",
"_file",
")",
"os",
".",
"rmdir",
"(",
"self",
".",
"_dir",
")",
"self",
".",
"thread",
".",
"_exit",
"=",
"True",
"self",
".",
"thread",
".",
"join",
"(",
"1000",
")... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Packetizer.set_outbound_cipher | Switch outbound data cipher. | paramiko/packet.py | 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,
):
"""
Switch outbound data cipher.
"""
self.__block_engine_out = block_engine
self.__sdctr_out = sdctr
self.__... | [
"Switch",
"outbound",
"data",
"cipher",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/packet.py#L137-L162 | [
"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"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Packetizer.set_inbound_cipher | Switch inbound data cipher. | paramiko/packet.py | def set_inbound_cipher(
self, block_engine, block_size, mac_engine, mac_size, mac_key
):
"""
Switch inbound data cipher.
"""
self.__block_engine_in = block_engine
self.__block_size_in = block_size
self.__mac_engine_in = mac_engine
self.__mac_size_in = ... | def set_inbound_cipher(
self, block_engine, block_size, mac_engine, mac_size, mac_key
):
"""
Switch inbound data cipher.
"""
self.__block_engine_in = block_engine
self.__block_size_in = block_size
self.__mac_engine_in = mac_engine
self.__mac_size_in = ... | [
"Switch",
"inbound",
"data",
"cipher",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/packet.py#L164-L184 | [
"def",
"set_inbound_cipher",
"(",
"self",
",",
"block_engine",
",",
"block_size",
",",
"mac_engine",
",",
"mac_size",
",",
"mac_key",
")",
":",
"self",
".",
"__block_engine_in",
"=",
"block_engine",
"self",
".",
"__block_size_in",
"=",
"block_size",
"self",
".",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Packetizer.set_keepalive | Turn on/off the callback keepalive. If ``interval`` seconds pass with
no data read from or written to the socket, the callback will be
executed and the timer will be reset. | paramiko/packet.py | def set_keepalive(self, interval, callback):
"""
Turn on/off the callback keepalive. If ``interval`` seconds pass with
no data read from or written to the socket, the callback will be
executed and the timer will be reset.
"""
self.__keepalive_interval = interval
... | def set_keepalive(self, interval, callback):
"""
Turn on/off the callback keepalive. If ``interval`` seconds pass with
no data read from or written to the socket, the callback will be
executed and the timer will be reset.
"""
self.__keepalive_interval = interval
... | [
"Turn",
"on",
"/",
"off",
"the",
"callback",
"keepalive",
".",
"If",
"interval",
"seconds",
"pass",
"with",
"no",
"data",
"read",
"from",
"or",
"written",
"to",
"the",
"socket",
"the",
"callback",
"will",
"be",
"executed",
"and",
"the",
"timer",
"will",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/packet.py#L216-L224 | [
"def",
"set_keepalive",
"(",
"self",
",",
"interval",
",",
"callback",
")",
":",
"self",
".",
"__keepalive_interval",
"=",
"interval",
"self",
".",
"__keepalive_callback",
"=",
"callback",
"self",
".",
"__keepalive_last",
"=",
"time",
".",
"time",
"(",
")"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Packetizer.start_handshake | Tells `Packetizer` that the handshake process started.
Starts a book keeping timer that can signal a timeout in the
handshake process.
:param float timeout: amount of seconds to wait before timing out | paramiko/packet.py | def start_handshake(self, timeout):
"""
Tells `Packetizer` that the handshake process started.
Starts a book keeping timer that can signal a timeout in the
handshake process.
:param float timeout: amount of seconds to wait before timing out
"""
if not self.__time... | def start_handshake(self, timeout):
"""
Tells `Packetizer` that the handshake process started.
Starts a book keeping timer that can signal a timeout in the
handshake process.
:param float timeout: amount of seconds to wait before timing out
"""
if not self.__time... | [
"Tells",
"Packetizer",
"that",
"the",
"handshake",
"process",
"started",
".",
"Starts",
"a",
"book",
"keeping",
"timer",
"that",
"can",
"signal",
"a",
"timeout",
"in",
"the",
"handshake",
"process",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/packet.py#L229-L239 | [
"def",
"start_handshake",
"(",
"self",
",",
"timeout",
")",
":",
"if",
"not",
"self",
".",
"__timer",
":",
"self",
".",
"__timer",
"=",
"threading",
".",
"Timer",
"(",
"float",
"(",
"timeout",
")",
",",
"self",
".",
"read_timer",
")",
"self",
".",
"_... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Packetizer.handshake_timed_out | Checks if the handshake has timed out.
If `start_handshake` wasn't called before the call to this function,
the return value will always be `False`. If the handshake completed
before a timeout was reached, the return value will be `False`
:return: handshake time out status, as a `bool` | paramiko/packet.py | def handshake_timed_out(self):
"""
Checks if the handshake has timed out.
If `start_handshake` wasn't called before the call to this function,
the return value will always be `False`. If the handshake completed
before a timeout was reached, the return value will be `False`
... | def handshake_timed_out(self):
"""
Checks if the handshake has timed out.
If `start_handshake` wasn't called before the call to this function,
the return value will always be `False`. If the handshake completed
before a timeout was reached, the return value will be `False`
... | [
"Checks",
"if",
"the",
"handshake",
"has",
"timed",
"out",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/packet.py#L241-L255 | [
"def",
"handshake_timed_out",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__timer",
":",
"return",
"False",
"if",
"self",
".",
"__handshake_complete",
":",
"return",
"False",
"return",
"self",
".",
"__timer_expired"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Packetizer.complete_handshake | Tells `Packetizer` that the handshake has completed. | paramiko/packet.py | def complete_handshake(self):
"""
Tells `Packetizer` that the handshake has completed.
"""
if self.__timer:
self.__timer.cancel()
self.__timer_expired = False
self.__handshake_complete = True | def complete_handshake(self):
"""
Tells `Packetizer` that the handshake has completed.
"""
if self.__timer:
self.__timer.cancel()
self.__timer_expired = False
self.__handshake_complete = True | [
"Tells",
"Packetizer",
"that",
"the",
"handshake",
"has",
"completed",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/packet.py#L257-L264 | [
"def",
"complete_handshake",
"(",
"self",
")",
":",
"if",
"self",
".",
"__timer",
":",
"self",
".",
"__timer",
".",
"cancel",
"(",
")",
"self",
".",
"__timer_expired",
"=",
"False",
"self",
".",
"__handshake_complete",
"=",
"True"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPHandle.close | When a client closes a file, this method is called on the handle.
Normally you would use this method to close the underlying OS level
file object(s).
The default implementation checks for attributes on ``self`` named
``readfile`` and/or ``writefile``, and if either or both are present,
... | paramiko/sftp_handle.py | def close(self):
"""
When a client closes a file, this method is called on the handle.
Normally you would use this method to close the underlying OS level
file object(s).
The default implementation checks for attributes on ``self`` named
``readfile`` and/or ``writefile``... | def close(self):
"""
When a client closes a file, this method is called on the handle.
Normally you would use this method to close the underlying OS level
file object(s).
The default implementation checks for attributes on ``self`` named
``readfile`` and/or ``writefile``... | [
"When",
"a",
"client",
"closes",
"a",
"file",
"this",
"method",
"is",
"called",
"on",
"the",
"handle",
".",
"Normally",
"you",
"would",
"use",
"this",
"method",
"to",
"close",
"the",
"underlying",
"OS",
"level",
"file",
"object",
"(",
"s",
")",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_handle.py#L55-L72 | [
"def",
"close",
"(",
"self",
")",
":",
"readfile",
"=",
"getattr",
"(",
"self",
",",
"\"readfile\"",
",",
"None",
")",
"if",
"readfile",
"is",
"not",
"None",
":",
"readfile",
".",
"close",
"(",
")",
"writefile",
"=",
"getattr",
"(",
"self",
",",
"\"w... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPHandle._get_next_files | Used by the SFTP server code to retrieve a cached directory
listing. | paramiko/sftp_handle.py | def _get_next_files(self):
"""
Used by the SFTP server code to retrieve a cached directory
listing.
"""
fnlist = self.__files[:16]
self.__files = self.__files[16:]
return fnlist | def _get_next_files(self):
"""
Used by the SFTP server code to retrieve a cached directory
listing.
"""
fnlist = self.__files[:16]
self.__files = self.__files[16:]
return fnlist | [
"Used",
"by",
"the",
"SFTP",
"server",
"code",
"to",
"retrieve",
"a",
"cached",
"directory",
"listing",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_handle.py#L180-L187 | [
"def",
"_get_next_files",
"(",
"self",
")",
":",
"fnlist",
"=",
"self",
".",
"__files",
"[",
":",
"16",
"]",
"self",
".",
"__files",
"=",
"self",
".",
"__files",
"[",
"16",
":",
"]",
"return",
"fnlist"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | generate_key_bytes | Given a password, passphrase, or other human-source key, scramble it
through a secure hash into some keyworthy bytes. This specific algorithm
is used for encrypting/decrypting private key files.
:param function hash_alg: A function which creates a new hash object, such
as ``hashlib.sha256``.
:... | paramiko/util.py | def generate_key_bytes(hash_alg, salt, key, nbytes):
"""
Given a password, passphrase, or other human-source key, scramble it
through a secure hash into some keyworthy bytes. This specific algorithm
is used for encrypting/decrypting private key files.
:param function hash_alg: A function which cre... | def generate_key_bytes(hash_alg, salt, key, nbytes):
"""
Given a password, passphrase, or other human-source key, scramble it
through a secure hash into some keyworthy bytes. This specific algorithm
is used for encrypting/decrypting private key files.
:param function hash_alg: A function which cre... | [
"Given",
"a",
"password",
"passphrase",
"or",
"other",
"human",
"-",
"source",
"key",
"scramble",
"it",
"through",
"a",
"secure",
"hash",
"into",
"some",
"keyworthy",
"bytes",
".",
"This",
"specific",
"algorithm",
"is",
"used",
"for",
"encrypting",
"/",
"dec... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/util.py#L142-L170 | [
"def",
"generate_key_bytes",
"(",
"hash_alg",
",",
"salt",
",",
"key",
",",
"nbytes",
")",
":",
"keydata",
"=",
"bytes",
"(",
")",
"digest",
"=",
"bytes",
"(",
")",
"if",
"len",
"(",
"salt",
")",
">",
"8",
":",
"salt",
"=",
"salt",
"[",
":",
"8",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | log_to_file | send paramiko logs to a logfile,
if they're not already going somewhere | paramiko/util.py | def log_to_file(filename, level=DEBUG):
"""send paramiko logs to a logfile,
if they're not already going somewhere"""
logger = logging.getLogger("paramiko")
if len(logger.handlers) > 0:
return
logger.setLevel(level)
f = open(filename, "a")
handler = logging.StreamHandler(f)
frm =... | def log_to_file(filename, level=DEBUG):
"""send paramiko logs to a logfile,
if they're not already going somewhere"""
logger = logging.getLogger("paramiko")
if len(logger.handlers) > 0:
return
logger.setLevel(level)
f = open(filename, "a")
handler = logging.StreamHandler(f)
frm =... | [
"send",
"paramiko",
"logs",
"to",
"a",
"logfile",
"if",
"they",
"re",
"not",
"already",
"going",
"somewhere"
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/util.py#L245-L257 | [
"def",
"log_to_file",
"(",
"filename",
",",
"level",
"=",
"DEBUG",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"\"paramiko\"",
")",
"if",
"len",
"(",
"logger",
".",
"handlers",
")",
">",
"0",
":",
"return",
"logger",
".",
"setLevel",
"("... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | ProxyCommand.send | Write the content received from the SSH client to the standard
input of the forked command.
:param str content: string to be sent to the forked command | paramiko/proxy.py | def send(self, content):
"""
Write the content received from the SSH client to the standard
input of the forked command.
:param str content: string to be sent to the forked command
"""
try:
self.process.stdin.write(content)
except IOError as e:
... | def send(self, content):
"""
Write the content received from the SSH client to the standard
input of the forked command.
:param str content: string to be sent to the forked command
"""
try:
self.process.stdin.write(content)
except IOError as e:
... | [
"Write",
"the",
"content",
"received",
"from",
"the",
"SSH",
"client",
"to",
"the",
"standard",
"input",
"of",
"the",
"forked",
"command",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/proxy.py#L61-L76 | [
"def",
"send",
"(",
"self",
",",
"content",
")",
":",
"try",
":",
"self",
".",
"process",
".",
"stdin",
".",
"write",
"(",
"content",
")",
"except",
"IOError",
"as",
"e",
":",
"# There was a problem with the child process. It probably",
"# died and we can't procee... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | ProxyCommand.recv | Read from the standard output of the forked program.
:param int size: how many chars should be read
:return: the string of bytes read, which may be shorter than requested | paramiko/proxy.py | def recv(self, size):
"""
Read from the standard output of the forked program.
:param int size: how many chars should be read
:return: the string of bytes read, which may be shorter than requested
"""
try:
buffer = b""
start = time.time()
... | def recv(self, size):
"""
Read from the standard output of the forked program.
:param int size: how many chars should be read
:return: the string of bytes read, which may be shorter than requested
"""
try:
buffer = b""
start = time.time()
... | [
"Read",
"from",
"the",
"standard",
"output",
"of",
"the",
"forked",
"program",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/proxy.py#L78-L109 | [
"def",
"recv",
"(",
"self",
",",
"size",
")",
":",
"try",
":",
"buffer",
"=",
"b\"\"",
"start",
"=",
"time",
".",
"time",
"(",
")",
"while",
"len",
"(",
"buffer",
")",
"<",
"size",
":",
"select_timeout",
"=",
"None",
"if",
"self",
".",
"timeout",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | format_system_message | Call FormatMessage with a system error number to retrieve
the descriptive error message. | paramiko/_winapi.py | def format_system_message(errno):
"""
Call FormatMessage with a system error number to retrieve
the descriptive error message.
"""
# first some flags used by FormatMessageW
ALLOCATE_BUFFER = 0x100
FROM_SYSTEM = 0x1000
# Let FormatMessageW allocate the buffer (we'll free it below)
# ... | def format_system_message(errno):
"""
Call FormatMessage with a system error number to retrieve
the descriptive error message.
"""
# first some flags used by FormatMessageW
ALLOCATE_BUFFER = 0x100
FROM_SYSTEM = 0x1000
# Let FormatMessageW allocate the buffer (we'll free it below)
# ... | [
"Call",
"FormatMessage",
"with",
"a",
"system",
"error",
"number",
"to",
"retrieve",
"the",
"descriptive",
"error",
"message",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/_winapi.py#L19-L52 | [
"def",
"format_system_message",
"(",
"errno",
")",
":",
"# first some flags used by FormatMessageW",
"ALLOCATE_BUFFER",
"=",
"0x100",
"FROM_SYSTEM",
"=",
"0x1000",
"# Let FormatMessageW allocate the buffer (we'll free it below)",
"# Also, let it know we want a system error message.",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | GetTokenInformation | Given a token, get the token information for it. | paramiko/_winapi.py | def GetTokenInformation(token, information_class):
"""
Given a token, get the token information for it.
"""
data_size = ctypes.wintypes.DWORD()
ctypes.windll.advapi32.GetTokenInformation(
token, information_class.num, 0, 0, ctypes.byref(data_size)
)
data = ctypes.create_string_buffer... | def GetTokenInformation(token, information_class):
"""
Given a token, get the token information for it.
"""
data_size = ctypes.wintypes.DWORD()
ctypes.windll.advapi32.GetTokenInformation(
token, information_class.num, 0, 0, ctypes.byref(data_size)
)
data = ctypes.create_string_buffer... | [
"Given",
"a",
"token",
"get",
"the",
"token",
"information",
"for",
"it",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/_winapi.py#L351-L369 | [
"def",
"GetTokenInformation",
"(",
"token",
",",
"information_class",
")",
":",
"data_size",
"=",
"ctypes",
".",
"wintypes",
".",
"DWORD",
"(",
")",
"ctypes",
".",
"windll",
".",
"advapi32",
".",
"GetTokenInformation",
"(",
"token",
",",
"information_class",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | get_current_user | Return a TOKEN_USER for the owner of this process. | paramiko/_winapi.py | def get_current_user():
"""
Return a TOKEN_USER for the owner of this process.
"""
process = OpenProcessToken(
ctypes.windll.kernel32.GetCurrentProcess(), TokenAccess.TOKEN_QUERY
)
return GetTokenInformation(process, TOKEN_USER) | def get_current_user():
"""
Return a TOKEN_USER for the owner of this process.
"""
process = OpenProcessToken(
ctypes.windll.kernel32.GetCurrentProcess(), TokenAccess.TOKEN_QUERY
)
return GetTokenInformation(process, TOKEN_USER) | [
"Return",
"a",
"TOKEN_USER",
"for",
"the",
"owner",
"of",
"this",
"process",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/_winapi.py#L383-L390 | [
"def",
"get_current_user",
"(",
")",
":",
"process",
"=",
"OpenProcessToken",
"(",
"ctypes",
".",
"windll",
".",
"kernel32",
".",
"GetCurrentProcess",
"(",
")",
",",
"TokenAccess",
".",
"TOKEN_QUERY",
")",
"return",
"GetTokenInformation",
"(",
"process",
",",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | DSSKey.generate | Generate a new private DSS key. This factory function can be used to
generate a new host key or authentication key.
:param int bits: number of bits the generated key should be.
:param progress_func: Unused
:return: new `.DSSKey` private key | paramiko/dsskey.py | def generate(bits=1024, progress_func=None):
"""
Generate a new private DSS key. This factory function can be used to
generate a new host key or authentication key.
:param int bits: number of bits the generated key should be.
:param progress_func: Unused
:return: new `.... | def generate(bits=1024, progress_func=None):
"""
Generate a new private DSS key. This factory function can be used to
generate a new host key or authentication key.
:param int bits: number of bits the generated key should be.
:param progress_func: Unused
:return: new `.... | [
"Generate",
"a",
"new",
"private",
"DSS",
"key",
".",
"This",
"factory",
"function",
"can",
"be",
"used",
"to",
"generate",
"a",
"new",
"host",
"key",
"or",
"authentication",
"key",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/dsskey.py#L198-L219 | [
"def",
"generate",
"(",
"bits",
"=",
"1024",
",",
"progress_func",
"=",
"None",
")",
":",
"numbers",
"=",
"dsa",
".",
"generate_private_key",
"(",
"bits",
",",
"backend",
"=",
"default_backend",
"(",
")",
")",
".",
"private_numbers",
"(",
")",
"key",
"="... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHClient.load_system_host_keys | Load host keys from a system (read-only) file. Host keys read with
this method will not be saved back by `save_host_keys`.
This method can be called multiple times. Each new set of host keys
will be merged with the existing set (new replacing old if there are
conflicts).
If `... | paramiko/client.py | def load_system_host_keys(self, filename=None):
"""
Load host keys from a system (read-only) file. Host keys read with
this method will not be saved back by `save_host_keys`.
This method can be called multiple times. Each new set of host keys
will be merged with the existing s... | def load_system_host_keys(self, filename=None):
"""
Load host keys from a system (read-only) file. Host keys read with
this method will not be saved back by `save_host_keys`.
This method can be called multiple times. Each new set of host keys
will be merged with the existing s... | [
"Load",
"host",
"keys",
"from",
"a",
"system",
"(",
"read",
"-",
"only",
")",
"file",
".",
"Host",
"keys",
"read",
"with",
"this",
"method",
"will",
"not",
"be",
"saved",
"back",
"by",
"save_host_keys",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/client.py#L81-L108 | [
"def",
"load_system_host_keys",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"# try the user's .ssh key file, and mask exceptions",
"filename",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"\"~/.ssh/known_hosts\"",
")"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHClient.load_host_keys | Load host keys from a local host-key file. Host keys read with this
method will be checked after keys loaded via `load_system_host_keys`,
but will be saved back by `save_host_keys` (so they can be modified).
The missing host key policy `.AutoAddPolicy` adds keys to this set and
saves th... | paramiko/client.py | def load_host_keys(self, filename):
"""
Load host keys from a local host-key file. Host keys read with this
method will be checked after keys loaded via `load_system_host_keys`,
but will be saved back by `save_host_keys` (so they can be modified).
The missing host key policy `.A... | def load_host_keys(self, filename):
"""
Load host keys from a local host-key file. Host keys read with this
method will be checked after keys loaded via `load_system_host_keys`,
but will be saved back by `save_host_keys` (so they can be modified).
The missing host key policy `.A... | [
"Load",
"host",
"keys",
"from",
"a",
"local",
"host",
"-",
"key",
"file",
".",
"Host",
"keys",
"read",
"with",
"this",
"method",
"will",
"be",
"checked",
"after",
"keys",
"loaded",
"via",
"load_system_host_keys",
"but",
"will",
"be",
"saved",
"back",
"by",... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/client.py#L110-L127 | [
"def",
"load_host_keys",
"(",
"self",
",",
"filename",
")",
":",
"self",
".",
"_host_keys_filename",
"=",
"filename",
"self",
".",
"_host_keys",
".",
"load",
"(",
"filename",
")"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHClient.set_missing_host_key_policy | Set policy to use when connecting to servers without a known host key.
Specifically:
* A **policy** is a "policy class" (or instance thereof), namely some
subclass of `.MissingHostKeyPolicy` such as `.RejectPolicy` (the
default), `.AutoAddPolicy`, `.WarningPolicy`, or a user-create... | paramiko/client.py | def set_missing_host_key_policy(self, policy):
"""
Set policy to use when connecting to servers without a known host key.
Specifically:
* A **policy** is a "policy class" (or instance thereof), namely some
subclass of `.MissingHostKeyPolicy` such as `.RejectPolicy` (the
... | def set_missing_host_key_policy(self, policy):
"""
Set policy to use when connecting to servers without a known host key.
Specifically:
* A **policy** is a "policy class" (or instance thereof), namely some
subclass of `.MissingHostKeyPolicy` such as `.RejectPolicy` (the
... | [
"Set",
"policy",
"to",
"use",
"when",
"connecting",
"to",
"servers",
"without",
"a",
"known",
"host",
"key",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/client.py#L172-L192 | [
"def",
"set_missing_host_key_policy",
"(",
"self",
",",
"policy",
")",
":",
"if",
"inspect",
".",
"isclass",
"(",
"policy",
")",
":",
"policy",
"=",
"policy",
"(",
")",
"self",
".",
"_policy",
"=",
"policy"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHClient._families_and_addresses | Yield pairs of address families and addresses to try for connecting.
:param str hostname: the server to connect to
:param int port: the server port to connect to
:returns: Yields an iterable of ``(family, address)`` tuples | paramiko/client.py | def _families_and_addresses(self, hostname, port):
"""
Yield pairs of address families and addresses to try for connecting.
:param str hostname: the server to connect to
:param int port: the server port to connect to
:returns: Yields an iterable of ``(family, address)`` tuples
... | def _families_and_addresses(self, hostname, port):
"""
Yield pairs of address families and addresses to try for connecting.
:param str hostname: the server to connect to
:param int port: the server port to connect to
:returns: Yields an iterable of ``(family, address)`` tuples
... | [
"Yield",
"pairs",
"of",
"address",
"families",
"and",
"addresses",
"to",
"try",
"for",
"connecting",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/client.py#L194-L216 | [
"def",
"_families_and_addresses",
"(",
"self",
",",
"hostname",
",",
"port",
")",
":",
"guess",
"=",
"True",
"addrinfos",
"=",
"socket",
".",
"getaddrinfo",
"(",
"hostname",
",",
"port",
",",
"socket",
".",
"AF_UNSPEC",
",",
"socket",
".",
"SOCK_STREAM",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHClient.connect | Connect to an SSH server and authenticate to it. The server's host key
is checked against the system host keys (see `load_system_host_keys`)
and any local host keys (`load_host_keys`). If the server's hostname
is not found in either set of host keys, the missing host key policy
is used... | paramiko/client.py | def connect(
self,
hostname,
port=SSH_PORT,
username=None,
password=None,
pkey=None,
key_filename=None,
timeout=None,
allow_agent=True,
look_for_keys=True,
compress=False,
sock=None,
gss_auth=False,
gss_kex=F... | def connect(
self,
hostname,
port=SSH_PORT,
username=None,
password=None,
pkey=None,
key_filename=None,
timeout=None,
allow_agent=True,
look_for_keys=True,
compress=False,
sock=None,
gss_auth=False,
gss_kex=F... | [
"Connect",
"to",
"an",
"SSH",
"server",
"and",
"authenticate",
"to",
"it",
".",
"The",
"server",
"s",
"host",
"key",
"is",
"checked",
"against",
"the",
"system",
"host",
"keys",
"(",
"see",
"load_system_host_keys",
")",
"and",
"any",
"local",
"host",
"keys... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/client.py#L218-L438 | [
"def",
"connect",
"(",
"self",
",",
"hostname",
",",
"port",
"=",
"SSH_PORT",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"pkey",
"=",
"None",
",",
"key_filename",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"allow_agent",
"=",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHClient.close | Close this SSHClient and its underlying `.Transport`.
.. warning::
Failure to do this may, in some situations, cause your Python
interpreter to hang at shutdown (often due to race conditions).
It's good practice to `close` your client objects anytime you're
done ... | paramiko/client.py | def close(self):
"""
Close this SSHClient and its underlying `.Transport`.
.. warning::
Failure to do this may, in some situations, cause your Python
interpreter to hang at shutdown (often due to race conditions).
It's good practice to `close` your client obj... | def close(self):
"""
Close this SSHClient and its underlying `.Transport`.
.. warning::
Failure to do this may, in some situations, cause your Python
interpreter to hang at shutdown (often due to race conditions).
It's good practice to `close` your client obj... | [
"Close",
"this",
"SSHClient",
"and",
"its",
"underlying",
".",
"Transport",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/client.py#L440-L457 | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"_transport",
"is",
"None",
":",
"return",
"self",
".",
"_transport",
".",
"close",
"(",
")",
"self",
".",
"_transport",
"=",
"None",
"if",
"self",
".",
"_agent",
"is",
"not",
"None",
":",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHClient.exec_command | Execute a command on the SSH server. A new `.Channel` is opened and
the requested command is executed. The command's input and output
streams are returned as Python ``file``-like objects representing
stdin, stdout, and stderr.
:param str command: the command to execute
:param ... | paramiko/client.py | def exec_command(
self,
command,
bufsize=-1,
timeout=None,
get_pty=False,
environment=None,
):
"""
Execute a command on the SSH server. A new `.Channel` is opened and
the requested command is executed. The command's input and output
s... | def exec_command(
self,
command,
bufsize=-1,
timeout=None,
get_pty=False,
environment=None,
):
"""
Execute a command on the SSH server. A new `.Channel` is opened and
the requested command is executed. The command's input and output
s... | [
"Execute",
"a",
"command",
"on",
"the",
"SSH",
"server",
".",
"A",
"new",
".",
"Channel",
"is",
"opened",
"and",
"the",
"requested",
"command",
"is",
"executed",
".",
"The",
"command",
"s",
"input",
"and",
"output",
"streams",
"are",
"returned",
"as",
"P... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/client.py#L459-L509 | [
"def",
"exec_command",
"(",
"self",
",",
"command",
",",
"bufsize",
"=",
"-",
"1",
",",
"timeout",
"=",
"None",
",",
"get_pty",
"=",
"False",
",",
"environment",
"=",
"None",
",",
")",
":",
"chan",
"=",
"self",
".",
"_transport",
".",
"open_session",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHClient.invoke_shell | Start an interactive shell session on the SSH server. A new `.Channel`
is opened and connected to a pseudo-terminal using the requested
terminal type and size.
:param str term:
the terminal type to emulate (for example, ``"vt100"``)
:param int width: the width (in character... | paramiko/client.py | def invoke_shell(
self,
term="vt100",
width=80,
height=24,
width_pixels=0,
height_pixels=0,
environment=None,
):
"""
Start an interactive shell session on the SSH server. A new `.Channel`
is opened and connected to a pseudo-terminal us... | def invoke_shell(
self,
term="vt100",
width=80,
height=24,
width_pixels=0,
height_pixels=0,
environment=None,
):
"""
Start an interactive shell session on the SSH server. A new `.Channel`
is opened and connected to a pseudo-terminal us... | [
"Start",
"an",
"interactive",
"shell",
"session",
"on",
"the",
"SSH",
"server",
".",
"A",
"new",
".",
"Channel",
"is",
"opened",
"and",
"connected",
"to",
"a",
"pseudo",
"-",
"terminal",
"using",
"the",
"requested",
"terminal",
"type",
"and",
"size",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/client.py#L511-L539 | [
"def",
"invoke_shell",
"(",
"self",
",",
"term",
"=",
"\"vt100\"",
",",
"width",
"=",
"80",
",",
"height",
"=",
"24",
",",
"width_pixels",
"=",
"0",
",",
"height_pixels",
"=",
"0",
",",
"environment",
"=",
"None",
",",
")",
":",
"chan",
"=",
"self",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHClient._key_from_filepath | Attempt to derive a `.PKey` from given string path ``filename``:
- If ``filename`` appears to be a cert, the matching private key is
loaded.
- Otherwise, the filename is assumed to be a private key, and the
matching public cert will be loaded if it exists. | paramiko/client.py | def _key_from_filepath(self, filename, klass, password):
"""
Attempt to derive a `.PKey` from given string path ``filename``:
- If ``filename`` appears to be a cert, the matching private key is
loaded.
- Otherwise, the filename is assumed to be a private key, and the
... | def _key_from_filepath(self, filename, klass, password):
"""
Attempt to derive a `.PKey` from given string path ``filename``:
- If ``filename`` appears to be a cert, the matching private key is
loaded.
- Otherwise, the filename is assumed to be a private key, and the
... | [
"Attempt",
"to",
"derive",
"a",
".",
"PKey",
"from",
"given",
"string",
"path",
"filename",
":"
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/client.py#L559-L589 | [
"def",
"_key_from_filepath",
"(",
"self",
",",
"filename",
",",
"klass",
",",
"password",
")",
":",
"cert_suffix",
"=",
"\"-cert.pub\"",
"# Assume privkey, not cert, by default",
"if",
"filename",
".",
"endswith",
"(",
"cert_suffix",
")",
":",
"key_path",
"=",
"fi... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.