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
FlashArray._list_available_rest_versions
Return a list of the REST API versions supported by the array
purestorage/purestorage.py
def _list_available_rest_versions(self): """Return a list of the REST API versions supported by the array""" url = "https://{0}/api/api_version".format(self._target) data = self._request("GET", url, reestablish_session=False) return data["version"]
def _list_available_rest_versions(self): """Return a list of the REST API versions supported by the array""" url = "https://{0}/api/api_version".format(self._target) data = self._request("GET", url, reestablish_session=False) return data["version"]
[ "Return", "a", "list", "of", "the", "REST", "API", "versions", "supported", "by", "the", "array" ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L228-L233
[ "def", "_list_available_rest_versions", "(", "self", ")", ":", "url", "=", "\"https://{0}/api/api_version\"", ".", "format", "(", "self", ".", "_target", ")", "data", "=", "self", ".", "_request", "(", "\"GET\"", ",", "url", ",", "reestablish_session", "=", "F...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray._obtain_api_token
Use username and password to obtain and return an API token.
purestorage/purestorage.py
def _obtain_api_token(self, username, password): """Use username and password to obtain and return an API token.""" data = self._request("POST", "auth/apitoken", {"username": username, "password": password}, reestablish_session=False) ret...
def _obtain_api_token(self, username, password): """Use username and password to obtain and return an API token.""" data = self._request("POST", "auth/apitoken", {"username": username, "password": password}, reestablish_session=False) ret...
[ "Use", "username", "and", "password", "to", "obtain", "and", "return", "an", "API", "token", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L235-L240
[ "def", "_obtain_api_token", "(", "self", ",", "username", ",", "password", ")", ":", "data", "=", "self", ".", "_request", "(", "\"POST\"", ",", "\"auth/apitoken\"", ",", "{", "\"username\"", ":", "username", ",", "\"password\"", ":", "password", "}", ",", ...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.create_snapshots
Create snapshots of the listed volumes. :param volumes: List of names of the volumes to snapshot. :type volumes: list of str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **POST volume** ...
purestorage/purestorage.py
def create_snapshots(self, volumes, **kwargs): """Create snapshots of the listed volumes. :param volumes: List of names of the volumes to snapshot. :type volumes: list of str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the ...
def create_snapshots(self, volumes, **kwargs): """Create snapshots of the listed volumes. :param volumes: List of names of the volumes to snapshot. :type volumes: list of str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the ...
[ "Create", "snapshots", "of", "the", "listed", "volumes", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L381-L397
[ "def", "create_snapshots", "(", "self", ",", "volumes", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"source\"", ":", "volumes", ",", "\"snap\"", ":", "True", "}", "data", ".", "update", "(", "kwargs", ")", "return", "self", ".", "_request", ...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.create_volume
Create a volume and return a dictionary describing it. :param volume: Name of the volume to be created. :type volume: str :param size: Size in bytes, or string representing the size of the volume to be created. :type size: int or str :param \*\*kwargs: See t...
purestorage/purestorage.py
def create_volume(self, volume, size, **kwargs): """Create a volume and return a dictionary describing it. :param volume: Name of the volume to be created. :type volume: str :param size: Size in bytes, or string representing the size of the volume to be created. ...
def create_volume(self, volume, size, **kwargs): """Create a volume and return a dictionary describing it. :param volume: Name of the volume to be created. :type volume: str :param size: Size in bytes, or string representing the size of the volume to be created. ...
[ "Create", "a", "volume", "and", "return", "a", "dictionary", "describing", "it", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L399-L444
[ "def", "create_volume", "(", "self", ",", "volume", ",", "size", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"size\"", ":", "size", "}", "data", ".", "update", "(", "kwargs", ")", "return", "self", ".", "_request", "(", "\"POST\"", ",", ...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.extend_volume
Extend a volume to a new, larger size. :param volume: Name of the volume to be extended. :type volume: str :type size: int or str :param size: Size in bytes, or string representing the size of the volume to be created. :returns: A dictionary mapping "name" ...
purestorage/purestorage.py
def extend_volume(self, volume, size): """Extend a volume to a new, larger size. :param volume: Name of the volume to be extended. :type volume: str :type size: int or str :param size: Size in bytes, or string representing the size of the volume to be create...
def extend_volume(self, volume, size): """Extend a volume to a new, larger size. :param volume: Name of the volume to be extended. :type volume: str :type size: int or str :param size: Size in bytes, or string representing the size of the volume to be create...
[ "Extend", "a", "volume", "to", "a", "new", "larger", "size", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L529-L573
[ "def", "extend_volume", "(", "self", ",", "volume", ",", "size", ")", ":", "return", "self", ".", "set_volume", "(", "volume", ",", "size", "=", "size", ",", "truncate", "=", "False", ")" ]
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.truncate_volume
Truncate a volume to a new, smaller size. :param volume: Name of the volume to truncate. :type volume: str :param size: Size in bytes, or string representing the size of the volume to be created. :type size: int or str :returns: A dictionary mapping "name" ...
purestorage/purestorage.py
def truncate_volume(self, volume, size): """Truncate a volume to a new, smaller size. :param volume: Name of the volume to truncate. :type volume: str :param size: Size in bytes, or string representing the size of the volume to be created. :type size: int or...
def truncate_volume(self, volume, size): """Truncate a volume to a new, smaller size. :param volume: Name of the volume to truncate. :type volume: str :param size: Size in bytes, or string representing the size of the volume to be created. :type size: int or...
[ "Truncate", "a", "volume", "to", "a", "new", "smaller", "size", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L726-L750
[ "def", "truncate_volume", "(", "self", ",", "volume", ",", "size", ")", ":", "return", "self", ".", "set_volume", "(", "volume", ",", "size", "=", "size", ",", "truncate", "=", "True", ")" ]
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.connect_host
Create a connection between a host and a volume. :param host: Name of host to connect to volume. :type host: str :param volume: Name of volume to connect to host. :type volume: str :param \*\*kwargs: See the REST API Guide on your array for the documen...
purestorage/purestorage.py
def connect_host(self, host, volume, **kwargs): """Create a connection between a host and a volume. :param host: Name of host to connect to volume. :type host: str :param volume: Name of volume to connect to host. :type volume: str :param \*\*kwargs: See the REST API Gui...
def connect_host(self, host, volume, **kwargs): """Create a connection between a host and a volume. :param host: Name of host to connect to volume. :type host: str :param volume: Name of volume to connect to host. :type volume: str :param \*\*kwargs: See the REST API Gui...
[ "Create", "a", "connection", "between", "a", "host", "and", "a", "volume", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L776-L793
[ "def", "connect_host", "(", "self", ",", "host", ",", "volume", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_request", "(", "\"POST\"", ",", "\"host/{0}/volume/{1}\"", ".", "format", "(", "host", ",", "volume", ")", ",", "kwargs", ")" ]
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.connect_hgroup
Create a shared connection between a host group and a volume. :param hgroup: Name of hgroup to connect to volume. :type hgroup: str :param volume: Name of volume to connect to hgroup. :type volume: str :param \*\*kwargs: See the REST API Guide on your array for the ...
purestorage/purestorage.py
def connect_hgroup(self, hgroup, volume, **kwargs): """Create a shared connection between a host group and a volume. :param hgroup: Name of hgroup to connect to volume. :type hgroup: str :param volume: Name of volume to connect to hgroup. :type volume: str :param \*\*kwa...
def connect_hgroup(self, hgroup, volume, **kwargs): """Create a shared connection between a host group and a volume. :param hgroup: Name of hgroup to connect to volume. :type hgroup: str :param volume: Name of volume to connect to hgroup. :type volume: str :param \*\*kwa...
[ "Create", "a", "shared", "connection", "between", "a", "host", "group", "and", "a", "volume", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L952-L969
[ "def", "connect_hgroup", "(", "self", ",", "hgroup", ",", "volume", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_request", "(", "\"POST\"", ",", "\"hgroup/{0}/volume/{1}\"", ".", "format", "(", "hgroup", ",", "volume", ")", ",", "kwargs", ...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.get_offload
Return a dictionary describing the connected offload target. :param offload: Name of offload target to get information about. :type offload: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **...
purestorage/purestorage.py
def get_offload(self, name, **kwargs): """Return a dictionary describing the connected offload target. :param offload: Name of offload target to get information about. :type offload: str :param \*\*kwargs: See the REST API Guide on your array for the documenta...
def get_offload(self, name, **kwargs): """Return a dictionary describing the connected offload target. :param offload: Name of offload target to get information about. :type offload: str :param \*\*kwargs: See the REST API Guide on your array for the documenta...
[ "Return", "a", "dictionary", "describing", "the", "connected", "offload", "target", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L1222-L1242
[ "def", "get_offload", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "# Unbox if a list to accommodate a bug in REST 1.14", "result", "=", "self", ".", "_request", "(", "\"GET\"", ",", "\"offload/{0}\"", ".", "format", "(", "name", ")", ",", "kwa...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.create_subnet
Create a subnet. :param subnet: Name of subnet to be created. :type subnet: str :param prefix: Routing prefix of subnet to be created. :type prefix: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: ...
purestorage/purestorage.py
def create_subnet(self, subnet, prefix, **kwargs): """Create a subnet. :param subnet: Name of subnet to be created. :type subnet: str :param prefix: Routing prefix of subnet to be created. :type prefix: str :param \*\*kwargs: See the REST API Guide on your array for the ...
def create_subnet(self, subnet, prefix, **kwargs): """Create a subnet. :param subnet: Name of subnet to be created. :type subnet: str :param prefix: Routing prefix of subnet to be created. :type prefix: str :param \*\*kwargs: See the REST API Guide on your array for the ...
[ "Create", "a", "subnet", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L1347-L1374
[ "def", "create_subnet", "(", "self", ",", "subnet", ",", "prefix", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"prefix\"", ":", "prefix", "}", "data", ".", "update", "(", "kwargs", ")", "return", "self", ".", "_request", "(", "\"POST\"", "...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.create_vlan_interface
Create a vlan interface :param interface: Name of interface to be created. :type interface: str :param subnet: Subnet associated with interface to be created :type subnet: str :param \*\*kwargs: See the REST API Guide on your array for the documentatio...
purestorage/purestorage.py
def create_vlan_interface(self, interface, subnet, **kwargs): """Create a vlan interface :param interface: Name of interface to be created. :type interface: str :param subnet: Subnet associated with interface to be created :type subnet: str :param \*\*kwargs: See the RES...
def create_vlan_interface(self, interface, subnet, **kwargs): """Create a vlan interface :param interface: Name of interface to be created. :type interface: str :param subnet: Subnet associated with interface to be created :type subnet: str :param \*\*kwargs: See the RES...
[ "Create", "a", "vlan", "interface" ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L1496-L1518
[ "def", "create_vlan_interface", "(", "self", ",", "interface", ",", "subnet", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"subnet\"", ":", "subnet", "}", "data", ".", "update", "(", "kwargs", ")", "return", "self", ".", "_request", "(", "\"P...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.set_password
Set an admin's password. :param admin: Name of admin whose password is to be set. :type admin: str :param new_password: New password for admin. :type new_password: str :param old_password: Current password of admin. :type old_password: str :returns: A dictionary...
purestorage/purestorage.py
def set_password(self, admin, new_password, old_password): """Set an admin's password. :param admin: Name of admin whose password is to be set. :type admin: str :param new_password: New password for admin. :type new_password: str :param old_password: Current password of ...
def set_password(self, admin, new_password, old_password): """Set an admin's password. :param admin: Name of admin whose password is to be set. :type admin: str :param new_password: New password for admin. :type new_password: str :param old_password: Current password of ...
[ "Set", "an", "admin", "s", "password", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L1888-L1903
[ "def", "set_password", "(", "self", ",", "admin", ",", "new_password", ",", "old_password", ")", ":", "return", "self", ".", "set_admin", "(", "admin", ",", "password", "=", "new_password", ",", "old_password", "=", "old_password", ")" ]
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.disable_directory_service
Disable the directory service. :param check_peer: If True, disables server authenticity enforcement. If False, disables directory service integration. :type check_peer: bool, optional :returns: A dictionary describing the status of the dire...
purestorage/purestorage.py
def disable_directory_service(self, check_peer=False): """Disable the directory service. :param check_peer: If True, disables server authenticity enforcement. If False, disables directory service integration. :type check_peer: bool, optional...
def disable_directory_service(self, check_peer=False): """Disable the directory service. :param check_peer: If True, disables server authenticity enforcement. If False, disables directory service integration. :type check_peer: bool, optional...
[ "Disable", "the", "directory", "service", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L1907-L1921
[ "def", "disable_directory_service", "(", "self", ",", "check_peer", "=", "False", ")", ":", "if", "check_peer", ":", "return", "self", ".", "set_directory_service", "(", "check_peer", "=", "False", ")", "return", "self", ".", "set_directory_service", "(", "enabl...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.enable_directory_service
Enable the directory service. :param check_peer: If True, enables server authenticity enforcement. If False, enables directory service integration. :type check_peer: bool, optional :returns: A dictionary describing the status of the directo...
purestorage/purestorage.py
def enable_directory_service(self, check_peer=False): """Enable the directory service. :param check_peer: If True, enables server authenticity enforcement. If False, enables directory service integration. :type check_peer: bool, optional ...
def enable_directory_service(self, check_peer=False): """Enable the directory service. :param check_peer: If True, enables server authenticity enforcement. If False, enables directory service integration. :type check_peer: bool, optional ...
[ "Enable", "the", "directory", "service", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L1923-L1937
[ "def", "enable_directory_service", "(", "self", ",", "check_peer", "=", "False", ")", ":", "if", "check_peer", ":", "return", "self", ".", "set_directory_service", "(", "check_peer", "=", "True", ")", "return", "self", ".", "set_directory_service", "(", "enabled...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.create_snmp_manager
Create an SNMP manager. :param manager: Name of manager to be created. :type manager: str :param host: IP address or DNS name of SNMP server to be used. :type host: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on th...
purestorage/purestorage.py
def create_snmp_manager(self, manager, host, **kwargs): """Create an SNMP manager. :param manager: Name of manager to be created. :type manager: str :param host: IP address or DNS name of SNMP server to be used. :type host: str :param \*\*kwargs: See the REST API Guide o...
def create_snmp_manager(self, manager, host, **kwargs): """Create an SNMP manager. :param manager: Name of manager to be created. :type manager: str :param host: IP address or DNS name of SNMP server to be used. :type host: str :param \*\*kwargs: See the REST API Guide o...
[ "Create", "an", "SNMP", "manager", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L2335-L2353
[ "def", "create_snmp_manager", "(", "self", ",", "manager", ",", "host", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"host\"", ":", "host", "}", "data", ".", "update", "(", "kwargs", ")", "return", "self", ".", "_request", "(", "\"POST\"", ...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.connect_array
Connect this array with another one. :param address: IP address or DNS name of other array. :type address: str :param connection_key: Connection key of other array. :type connection_key: str :param connection_type: Type(s) of connection desired. :type connection_type: li...
purestorage/purestorage.py
def connect_array(self, address, connection_key, connection_type, **kwargs): """Connect this array with another one. :param address: IP address or DNS name of other array. :type address: str :param connection_key: Connection key of other array. :type connection_key: str ...
def connect_array(self, address, connection_key, connection_type, **kwargs): """Connect this array with another one. :param address: IP address or DNS name of other array. :type address: str :param connection_key: Connection key of other array. :type connection_key: str ...
[ "Connect", "this", "array", "with", "another", "one", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L2448-L2478
[ "def", "connect_array", "(", "self", ",", "address", ",", "connection_key", ",", "connection_type", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"management_address\"", ":", "address", ",", "\"connection_key\"", ":", "connection_key", ",", "\"type\"", ...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.create_pgroup_snapshot
Create snapshot of pgroup from specified source. :param source: Name of pgroup of which to take snapshot. :type source: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **POST pgroup** ...
purestorage/purestorage.py
def create_pgroup_snapshot(self, source, **kwargs): """Create snapshot of pgroup from specified source. :param source: Name of pgroup of which to take snapshot. :type source: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on ...
def create_pgroup_snapshot(self, source, **kwargs): """Create snapshot of pgroup from specified source. :param source: Name of pgroup of which to take snapshot. :type source: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on ...
[ "Create", "snapshot", "of", "pgroup", "from", "specified", "source", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L2552-L2579
[ "def", "create_pgroup_snapshot", "(", "self", ",", "source", ",", "*", "*", "kwargs", ")", ":", "# In REST 1.4, support was added for snapshotting multiple pgroups. As a", "# result, the endpoint response changed from an object to an array of", "# objects. To keep the response type cons...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.send_pgroup_snapshot
Send an existing pgroup snapshot to target(s) :param source: Name of pgroup snapshot to send. :type source: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **POST pgroup** :type \*\*k...
purestorage/purestorage.py
def send_pgroup_snapshot(self, source, **kwargs): """ Send an existing pgroup snapshot to target(s) :param source: Name of pgroup snapshot to send. :type source: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: ...
def send_pgroup_snapshot(self, source, **kwargs): """ Send an existing pgroup snapshot to target(s) :param source: Name of pgroup snapshot to send. :type source: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: ...
[ "Send", "an", "existing", "pgroup", "snapshot", "to", "target", "(", "s", ")" ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L2581-L2601
[ "def", "send_pgroup_snapshot", "(", "self", ",", "source", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"name\"", ":", "[", "source", "]", ",", "\"action\"", ":", "\"send\"", "}", "data", ".", "update", "(", "kwargs", ")", "return", "self", ...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.create_pgroup_snapshots
Create snapshots of pgroups from specified sources. :param sources: Names of pgroups of which to take snapshots. :type sources: list of str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **POST ...
purestorage/purestorage.py
def create_pgroup_snapshots(self, sources, **kwargs): """Create snapshots of pgroups from specified sources. :param sources: Names of pgroups of which to take snapshots. :type sources: list of str :param \*\*kwargs: See the REST API Guide on your array for the ...
def create_pgroup_snapshots(self, sources, **kwargs): """Create snapshots of pgroups from specified sources. :param sources: Names of pgroups of which to take snapshots. :type sources: list of str :param \*\*kwargs: See the REST API Guide on your array for the ...
[ "Create", "snapshots", "of", "pgroups", "from", "specified", "sources", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L2603-L2623
[ "def", "create_pgroup_snapshots", "(", "self", ",", "sources", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"source\"", ":", "sources", ",", "\"snap\"", ":", "True", "}", "data", ".", "update", "(", "kwargs", ")", "return", "self", ".", "_req...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.eradicate_pgroup
Eradicate a destroyed pgroup. :param pgroup: Name of pgroup to be eradicated. :type pgroup: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **DELETE pgroup/:pgroup** :type \*\*kwargs:...
purestorage/purestorage.py
def eradicate_pgroup(self, pgroup, **kwargs): """Eradicate a destroyed pgroup. :param pgroup: Name of pgroup to be eradicated. :type pgroup: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: ...
def eradicate_pgroup(self, pgroup, **kwargs): """Eradicate a destroyed pgroup. :param pgroup: Name of pgroup to be eradicated. :type pgroup: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: ...
[ "Eradicate", "a", "destroyed", "pgroup", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L2708-L2728
[ "def", "eradicate_pgroup", "(", "self", ",", "pgroup", ",", "*", "*", "kwargs", ")", ":", "eradicate", "=", "{", "\"eradicate\"", ":", "True", "}", "eradicate", ".", "update", "(", "kwargs", ")", "return", "self", ".", "_request", "(", "\"DELETE\"", ",",...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.clone_pod
Clone an existing pod to a new one. :param source: Name of the pod the be cloned. :type source: str :param dest: Name of the target pod to clone into :type dest: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the r...
purestorage/purestorage.py
def clone_pod(self, source, dest, **kwargs): """Clone an existing pod to a new one. :param source: Name of the pod the be cloned. :type source: str :param dest: Name of the target pod to clone into :type dest: str :param \*\*kwargs: See the REST API Guide on your array f...
def clone_pod(self, source, dest, **kwargs): """Clone an existing pod to a new one. :param source: Name of the pod the be cloned. :type source: str :param dest: Name of the target pod to clone into :type dest: str :param \*\*kwargs: See the REST API Guide on your array f...
[ "Clone", "an", "existing", "pod", "to", "a", "new", "one", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L3017-L3038
[ "def", "clone_pod", "(", "self", ",", "source", ",", "dest", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"source\"", ":", "source", "}", "data", ".", "update", "(", "kwargs", ")", "return", "self", ".", "_request", "(", "\"POST\"", ",", ...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.remove_pod
Remove arrays from a pod. :param pod: Name of the pod. :type pod: str :param array: Array to remove from pod. :type array: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **DE...
purestorage/purestorage.py
def remove_pod(self, pod, array, **kwargs): """Remove arrays from a pod. :param pod: Name of the pod. :type pod: str :param array: Array to remove from pod. :type array: str :param \*\*kwargs: See the REST API Guide on your array for the docume...
def remove_pod(self, pod, array, **kwargs): """Remove arrays from a pod. :param pod: Name of the pod. :type pod: str :param array: Array to remove from pod. :type array: str :param \*\*kwargs: See the REST API Guide on your array for the docume...
[ "Remove", "arrays", "from", "a", "pod", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L3125-L3144
[ "def", "remove_pod", "(", "self", ",", "pod", ",", "array", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_request", "(", "\"DELETE\"", ",", "\"pod/{0}/array/{1}\"", ".", "format", "(", "pod", ",", "array", ")", ",", "kwargs", ")" ]
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.get_certificate
Get the attributes of the current array certificate. :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **GET cert** :type \*\*kwargs: optional :returns: A dictionary describing the configured arra...
purestorage/purestorage.py
def get_certificate(self, **kwargs): """Get the attributes of the current array certificate. :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **GET cert** :type \*\*kwargs: optional :retu...
def get_certificate(self, **kwargs): """Get the attributes of the current array certificate. :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **GET cert** :type \*\*kwargs: optional :retu...
[ "Get", "the", "attributes", "of", "the", "current", "array", "certificate", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L3211-L3232
[ "def", "get_certificate", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_rest_version", ">=", "LooseVersion", "(", "\"1.12\"", ")", ":", "return", "self", ".", "_request", "(", "\"GET\"", ",", "\"cert/{0}\"", ".", "format", "(", "kw...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.list_certificates
Get the attributes of the current array certificate. :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **GET cert** :type \*\*kwargs: optional :returns: A list of dictionaries describing all confi...
purestorage/purestorage.py
def list_certificates(self): """Get the attributes of the current array certificate. :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **GET cert** :type \*\*kwargs: optional :returns: A l...
def list_certificates(self): """Get the attributes of the current array certificate. :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **GET cert** :type \*\*kwargs: optional :returns: A l...
[ "Get", "the", "attributes", "of", "the", "current", "array", "certificate", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L3234-L3260
[ "def", "list_certificates", "(", "self", ")", ":", "# This call takes no parameters.", "if", "self", ".", "_rest_version", ">=", "LooseVersion", "(", "\"1.12\"", ")", ":", "return", "self", ".", "_request", "(", "\"GET\"", ",", "\"cert\"", ")", "else", ":", "#...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.get_certificate_signing_request
Construct a certificate signing request (CSR) for signing by a certificate authority (CA). :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **GET cert/certificate_signing_request** :type \*\*kwarg...
purestorage/purestorage.py
def get_certificate_signing_request(self, **kwargs): """Construct a certificate signing request (CSR) for signing by a certificate authority (CA). :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: ...
def get_certificate_signing_request(self, **kwargs): """Construct a certificate signing request (CSR) for signing by a certificate authority (CA). :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: ...
[ "Construct", "a", "certificate", "signing", "request", "(", "CSR", ")", "for", "signing", "by", "a", "certificate", "authority", "(", "CA", ")", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L3262-L3289
[ "def", "get_certificate_signing_request", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_rest_version", ">=", "LooseVersion", "(", "\"1.12\"", ")", ":", "return", "self", ".", "_request", "(", "\"GET\"", ",", "\"cert/certificate_signing_req...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.set_certificate
Modify an existing certificate, creating a new self signed one or importing a certificate signed by a certificate authority (CA). :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **PUT cert** :typ...
purestorage/purestorage.py
def set_certificate(self, **kwargs): """Modify an existing certificate, creating a new self signed one or importing a certificate signed by a certificate authority (CA). :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: ...
def set_certificate(self, **kwargs): """Modify an existing certificate, creating a new self signed one or importing a certificate signed by a certificate authority (CA). :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: ...
[ "Modify", "an", "existing", "certificate", "creating", "a", "new", "self", "signed", "one", "or", "importing", "a", "certificate", "signed", "by", "a", "certificate", "authority", "(", "CA", ")", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L3291-L3317
[ "def", "set_certificate", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_rest_version", ">=", "LooseVersion", "(", "\"1.12\"", ")", ":", "return", "self", ".", "_request", "(", "\"PUT\"", ",", "\"cert/{0}\"", ".", "format", "(", "kw...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
FlashArray.page_through
Return an iterator over all pages of a REST operation. :param page_size: Number of elements to retrieve per call. :param function: FlashArray function that accepts limit as an argument. :param \*args: Positional arguments to be passed to function. :param \*\*kwargs: Keyword arguments to...
purestorage/purestorage.py
def page_through(page_size, function, *args, **kwargs): """Return an iterator over all pages of a REST operation. :param page_size: Number of elements to retrieve per call. :param function: FlashArray function that accepts limit as an argument. :param \*args: Positional arguments to be ...
def page_through(page_size, function, *args, **kwargs): """Return an iterator over all pages of a REST operation. :param page_size: Number of elements to retrieve per call. :param function: FlashArray function that accepts limit as an argument. :param \*args: Positional arguments to be ...
[ "Return", "an", "iterator", "over", "all", "pages", "of", "a", "REST", "operation", "." ]
PureStorage-OpenConnect/rest-client
python
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L3632-L3683
[ "def", "page_through", "(", "page_size", ",", "function", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "\"limit\"", "]", "=", "page_size", "def", "get_page", "(", "token", ")", ":", "page_kwargs", "=", "kwargs", ".", "copy", "(",...
097d5f2bc6facf607d7e4a92567b09fb8cf5cb34
train
SFTPServer.set_file_attr
Change a file's attributes on the local filesystem. The contents of C{attr} are used to change the permissions, owner, group ownership, and/or modification & access time of the file, depending on which attributes are present in C{attr}. This is meant to be a handy helper function for t...
ssh/sftp_server.py
def set_file_attr(filename, attr): """ Change a file's attributes on the local filesystem. The contents of C{attr} are used to change the permissions, owner, group ownership, and/or modification & access time of the file, depending on which attributes are present in C{attr}. ...
def set_file_attr(filename, attr): """ Change a file's attributes on the local filesystem. The contents of C{attr} are used to change the permissions, owner, group ownership, and/or modification & access time of the file, depending on which attributes are present in C{attr}. ...
[ "Change", "a", "file", "s", "attributes", "on", "the", "local", "filesystem", ".", "The", "contents", "of", "C", "{", "attr", "}", "are", "used", "to", "change", "the", "permissions", "owner", "group", "ownership", "and", "/", "or", "modification", "&", ...
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/sftp_server.py#L144-L169
[ "def", "set_file_attr", "(", "filename", ",", "attr", ")", ":", "if", "sys", ".", "platform", "!=", "'win32'", ":", "# mode operations are meaningless on win32", "if", "attr", ".", "_flags", "&", "attr", ".", "FLAG_PERMISSIONS", ":", "os", ".", "chmod", "(", ...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
Packetizer.read_all
Read as close to N bytes as possible, blocking as long as necessary. @param n: number of bytes to read @type n: int @return: the data read @rtype: str @raise EOFError: if the socket was closed before all the bytes could be read
ssh/packet.py
def read_all(self, n, check_rekey=False): """ Read as close to N bytes as possible, blocking as long as necessary. @param n: number of bytes to read @type n: int @return: the data read @rtype: str @raise EOFError: if the socket was closed before all the bytes cou...
def read_all(self, n, check_rekey=False): """ Read as close to N bytes as possible, blocking as long as necessary. @param n: number of bytes to read @type n: int @return: the data read @rtype: str @raise EOFError: if the socket was closed before all the bytes cou...
[ "Read", "as", "close", "to", "N", "bytes", "as", "possible", "blocking", "as", "long", "as", "necessary", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/packet.py#L191-L239
[ "def", "read_all", "(", "self", ",", "n", ",", "check_rekey", "=", "False", ")", ":", "out", "=", "''", "# handle over-reading from reading the banner line", "if", "len", "(", "self", ".", "__remainder", ")", ">", "0", ":", "out", "=", "self", ".", "__rema...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
Packetizer.readline
Read a line from the socket. We assume no data is pending after the line, so it's okay to attempt large reads.
ssh/packet.py
def readline(self, timeout): """ Read a line from the socket. We assume no data is pending after the line, so it's okay to attempt large reads. """ buf = self.__remainder while not '\n' in buf: buf += self._read_timeout(timeout) n = buf.index('\n') ...
def readline(self, timeout): """ Read a line from the socket. We assume no data is pending after the line, so it's okay to attempt large reads. """ buf = self.__remainder while not '\n' in buf: buf += self._read_timeout(timeout) n = buf.index('\n') ...
[ "Read", "a", "line", "from", "the", "socket", ".", "We", "assume", "no", "data", "is", "pending", "after", "the", "line", "so", "it", "s", "okay", "to", "attempt", "large", "reads", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/packet.py#L271-L284
[ "def", "readline", "(", "self", ",", "timeout", ")", ":", "buf", "=", "self", ".", "__remainder", "while", "not", "'\\n'", "in", "buf", ":", "buf", "+=", "self", ".", "_read_timeout", "(", "timeout", ")", "n", "=", "buf", ".", "index", "(", "'\\n'", ...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
Packetizer.send_message
Write a block of data using the current cipher, as an SSH block.
ssh/packet.py
def send_message(self, data): """ Write a block of data using the current cipher, as an SSH block. """ # encrypt this sucka data = str(data) cmd = ord(data[0]) if cmd in MSG_NAMES: cmd_name = MSG_NAMES[cmd] else: cmd_name = '$%x' % ...
def send_message(self, data): """ Write a block of data using the current cipher, as an SSH block. """ # encrypt this sucka data = str(data) cmd = ord(data[0]) if cmd in MSG_NAMES: cmd_name = MSG_NAMES[cmd] else: cmd_name = '$%x' % ...
[ "Write", "a", "block", "of", "data", "using", "the", "current", "cipher", "as", "an", "SSH", "block", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/packet.py#L286-L328
[ "def", "send_message", "(", "self", ",", "data", ")", ":", "# encrypt this sucka", "data", "=", "str", "(", "data", ")", "cmd", "=", "ord", "(", "data", "[", "0", "]", ")", "if", "cmd", "in", "MSG_NAMES", ":", "cmd_name", "=", "MSG_NAMES", "[", "cmd"...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
Packetizer.read_message
Only one thread should ever be in this function (no other locking is done). @raise SSHException: if the packet is mangled @raise NeedRekeyException: if the transport should rekey
ssh/packet.py
def read_message(self): """ Only one thread should ever be in this function (no other locking is done). @raise SSHException: if the packet is mangled @raise NeedRekeyException: if the transport should rekey """ header = self.read_all(self.__block_size_in, check_r...
def read_message(self): """ Only one thread should ever be in this function (no other locking is done). @raise SSHException: if the packet is mangled @raise NeedRekeyException: if the transport should rekey """ header = self.read_all(self.__block_size_in, check_r...
[ "Only", "one", "thread", "should", "ever", "be", "in", "this", "function", "(", "no", "other", "locking", "is", "done", ")", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/packet.py#L330-L404
[ "def", "read_message", "(", "self", ")", ":", "header", "=", "self", ".", "read_all", "(", "self", ".", "__block_size_in", ",", "check_rekey", "=", "True", ")", "if", "self", ".", "__block_engine_in", "!=", "None", ":", "header", "=", "self", ".", "__blo...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
make_tarball
Create a tar file from all the files under 'base_dir'. This file may be compressed. :param compress: Compression algorithms. Supported algorithms are: 'gzip': (the default) 'compress' 'bzip2' None For 'gzip' and 'bzip2' the internal tarfile module will be used. For 'comp...
setup_helper.py
def make_tarball(base_name, base_dir, compress='gzip', verbose=False, dry_run=False): """Create a tar file from all the files under 'base_dir'. This file may be compressed. :param compress: Compression algorithms. Supported algorithms are: 'gzip': (the default) 'compress' ...
def make_tarball(base_name, base_dir, compress='gzip', verbose=False, dry_run=False): """Create a tar file from all the files under 'base_dir'. This file may be compressed. :param compress: Compression algorithms. Supported algorithms are: 'gzip': (the default) 'compress' ...
[ "Create", "a", "tar", "file", "from", "all", "the", "files", "under", "base_dir", ".", "This", "file", "may", "be", "compressed", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/setup_helper.py#L34-L89
[ "def", "make_tarball", "(", "base_name", ",", "base_dir", ",", "compress", "=", "'gzip'", ",", "verbose", "=", "False", ",", "dry_run", "=", "False", ")", ":", "# XXX GNU tar 1.13 has a nifty option to add a prefix directory.", "# It's pretty new, though, so we certainly ca...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
AuthHandler.auth_interactive
response_list = handler(title, instructions, prompt_list)
ssh/auth_handler.py
def auth_interactive(self, username, handler, event, submethods=''): """ response_list = handler(title, instructions, prompt_list) """ self.transport.lock.acquire() try: self.auth_event = event self.auth_method = 'keyboard-interactive' self.use...
def auth_interactive(self, username, handler, event, submethods=''): """ response_list = handler(title, instructions, prompt_list) """ self.transport.lock.acquire() try: self.auth_event = event self.auth_method = 'keyboard-interactive' self.use...
[ "response_list", "=", "handler", "(", "title", "instructions", "prompt_list", ")" ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/auth_handler.py#L97-L110
[ "def", "auth_interactive", "(", "self", ",", "username", ",", "handler", ",", "event", ",", "submethods", "=", "''", ")", ":", "self", ".", "transport", ".", "lock", ".", "acquire", "(", ")", "try", ":", "self", ".", "auth_event", "=", "event", "self",...
e8bdad4c82a50158a749233dca58c29e47c60b76
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...
ssh/hostkeys.py
def from_line(cls, 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...
def from_line(cls, 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...
[ "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",...
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/hostkeys.py#L51-L85
[ "def", "from_line", "(", "cls", ",", "line", ")", ":", "fields", "=", "line", ".", "split", "(", "' '", ")", "if", "len", "(", "fields", ")", "<", "3", ":", "# Bad number of fields", "return", "None", "fields", "=", "fields", "[", ":", "3", "]", "n...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
HostKeyEntry.to_line
Returns a string in OpenSSH known_hosts file format, or None if the object is not in a valid state. A trailing newline is included.
ssh/hostkeys.py
def to_line(self): """ Returns a string in OpenSSH known_hosts file format, or None if the object is not in a valid state. A trailing newline is included. """ if self.valid: return '%s %s %s\n' % (','.join(self.hostnames), self.key.get_name(), ...
def to_line(self): """ Returns a string in OpenSSH known_hosts file format, or None if the object is not in a valid state. A trailing newline is included. """ if self.valid: return '%s %s %s\n' % (','.join(self.hostnames), self.key.get_name(), ...
[ "Returns", "a", "string", "in", "OpenSSH", "known_hosts", "file", "format", "or", "None", "if", "the", "object", "is", "not", "in", "a", "valid", "state", ".", "A", "trailing", "newline", "is", "included", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/hostkeys.py#L88-L97
[ "def", "to_line", "(", "self", ")", ":", "if", "self", ".", "valid", ":", "return", "'%s %s %s\\n'", "%", "(", "','", ".", "join", "(", "self", ".", "hostnames", ")", ",", "self", ".", "key", ".", "get_name", "(", ")", ",", "self", ".", "key", "....
e8bdad4c82a50158a749233dca58c29e47c60b76
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 C{os.path.expanduser("~/.ssh/known_hosts")}. If this method is called multiple times, the host keys are merged, ...
ssh/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 C{os.path.expanduser("~/.ssh/known_hosts")}. If this method is called mul...
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 C{os.path.expanduser("~/.ssh/known_hosts")}. If this method is called mul...
[ "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", ...
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/hostkeys.py#L146-L170
[ "def", "load", "(", "self", ",", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "'r'", ")", "for", "line", "in", "f", ":", "line", "=", "line", ".", "strip", "(", ")", "if", "(", "len", "(", "line", ")", "==", "0", ")", "or", ...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
HostKeys.save
Save host keys into a file, in the format used by openssh. The order of keys in the file will be preserved when possible (if these keys were loaded from a file originally). The single exception is that combined lines will be split into individual key lines, which is arguably a bug. @p...
ssh/hostkeys.py
def save(self, filename): """ Save host keys into a file, in the format used by openssh. The order of keys in the file will be preserved when possible (if these keys were loaded from a file originally). The single exception is that combined lines will be split into individual k...
def save(self, filename): """ Save host keys into a file, in the format used by openssh. The order of keys in the file will be preserved when possible (if these keys were loaded from a file originally). The single exception is that combined lines will be split into individual k...
[ "Save", "host", "keys", "into", "a", "file", "in", "the", "format", "used", "by", "openssh", ".", "The", "order", "of", "keys", "in", "the", "file", "will", "be", "preserved", "when", "possible", "(", "if", "these", "keys", "were", "loaded", "from", "a...
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/hostkeys.py#L172-L191
[ "def", "save", "(", "self", ",", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "'w'", ")", "for", "e", "in", "self", ".", "_entries", ":", "line", "=", "e", ".", "to_line", "(", ")", "if", "line", ":", "f", ".", "write", "(", ...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
HostKeys.lookup
Find a hostkey entry for a given hostname or IP. If no entry is found, C{None} is returned. Otherwise a dictionary of keytype to key is returned. The keytype will be either C{"ssh-rsa"} or C{"ssh-dss"}. @param hostname: the hostname (or IP) to lookup @type hostname: str @retu...
ssh/hostkeys.py
def lookup(self, hostname): """ Find a hostkey entry for a given hostname or IP. If no entry is found, C{None} is returned. Otherwise a dictionary of keytype to key is returned. The keytype will be either C{"ssh-rsa"} or C{"ssh-dss"}. @param hostname: the hostname (or IP) to ...
def lookup(self, hostname): """ Find a hostkey entry for a given hostname or IP. If no entry is found, C{None} is returned. Otherwise a dictionary of keytype to key is returned. The keytype will be either C{"ssh-rsa"} or C{"ssh-dss"}. @param hostname: the hostname (or IP) to ...
[ "Find", "a", "hostkey", "entry", "for", "a", "given", "hostname", "or", "IP", ".", "If", "no", "entry", "is", "found", "C", "{", "None", "}", "is", "returned", ".", "Otherwise", "a", "dictionary", "of", "keytype", "to", "key", "is", "returned", ".", ...
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/hostkeys.py#L193-L240
[ "def", "lookup", "(", "self", ",", "hostname", ")", ":", "class", "SubDict", "(", "UserDict", ".", "DictMixin", ")", ":", "def", "__init__", "(", "self", ",", "hostname", ",", "entries", ",", "hostkeys", ")", ":", "self", ".", "_hostname", "=", "hostna...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
HostKeys.check
Return True if the given key is associated with the given hostname in this dictionary. @param hostname: hostname (or IP) of the SSH server @type hostname: str @param key: the key to check @type key: L{PKey} @return: C{True} if the key is associated with the hostname; C{F...
ssh/hostkeys.py
def check(self, hostname, key): """ Return True if the given key is associated with the given hostname in this dictionary. @param hostname: hostname (or IP) of the SSH server @type hostname: str @param key: the key to check @type key: L{PKey} @return: C{T...
def check(self, hostname, key): """ Return True if the given key is associated with the given hostname in this dictionary. @param hostname: hostname (or IP) of the SSH server @type hostname: str @param key: the key to check @type key: L{PKey} @return: C{T...
[ "Return", "True", "if", "the", "given", "key", "is", "associated", "with", "the", "given", "hostname", "in", "this", "dictionary", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/hostkeys.py#L242-L261
[ "def", "check", "(", "self", ",", "hostname", ",", "key", ")", ":", "k", "=", "self", ".", "lookup", "(", "hostname", ")", "if", "k", "is", "None", ":", "return", "False", "host_key", "=", "k", ".", "get", "(", "key", ".", "get_name", "(", ")", ...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
HostKeys.hash_host
Return a "hashed" form of the hostname, as used by openssh when storing hashed hostnames in the known_hosts file. @param hostname: the hostname to hash @type hostname: str @param salt: optional salt to use when hashing (must be 20 bytes long) @type salt: str @return: the...
ssh/hostkeys.py
def hash_host(hostname, salt=None): """ Return a "hashed" form of the hostname, as used by openssh when storing hashed hostnames in the known_hosts file. @param hostname: the hostname to hash @type hostname: str @param salt: optional salt to use when hashing (must be 20 ...
def hash_host(hostname, salt=None): """ Return a "hashed" form of the hostname, as used by openssh when storing hashed hostnames in the known_hosts file. @param hostname: the hostname to hash @type hostname: str @param salt: optional salt to use when hashing (must be 20 ...
[ "Return", "a", "hashed", "form", "of", "the", "hostname", "as", "used", "by", "openssh", "when", "storing", "hashed", "hostnames", "in", "the", "known_hosts", "file", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/hostkeys.py#L305-L326
[ "def", "hash_host", "(", "hostname", ",", "salt", "=", "None", ")", ":", "if", "salt", "is", "None", ":", "salt", "=", "rng", ".", "read", "(", "SHA", ".", "digest_size", ")", "else", ":", "if", "salt", ".", "startswith", "(", "'|1|'", ")", ":", ...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
inflate_long
turns a normalized byte string into a long-int (adapted from Crypto.Util.number)
ssh/util.py
def inflate_long(s, always_positive=False): "turns a normalized byte string into a long-int (adapted from Crypto.Util.number)" out = 0L negative = 0 if not always_positive and (len(s) > 0) and (ord(s[0]) >= 0x80): negative = 1 if len(s) % 4: filler = '\x00' if negative: ...
def inflate_long(s, always_positive=False): "turns a normalized byte string into a long-int (adapted from Crypto.Util.number)" out = 0L negative = 0 if not always_positive and (len(s) > 0) and (ord(s[0]) >= 0x80): negative = 1 if len(s) % 4: filler = '\x00' if negative: ...
[ "turns", "a", "normalized", "byte", "string", "into", "a", "long", "-", "int", "(", "adapted", "from", "Crypto", ".", "Util", ".", "number", ")" ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/util.py#L49-L64
[ "def", "inflate_long", "(", "s", ",", "always_positive", "=", "False", ")", ":", "out", "=", "0L", "negative", "=", "0", "if", "not", "always_positive", "and", "(", "len", "(", "s", ")", ">", "0", ")", "and", "(", "ord", "(", "s", "[", "0", "]", ...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
deflate_long
turns a long-int into a normalized byte string (adapted from Crypto.Util.number)
ssh/util.py
def deflate_long(n, add_sign_padding=True): "turns a long-int into a normalized byte string (adapted from Crypto.Util.number)" # after much testing, this algorithm was deemed to be the fastest s = '' n = long(n) while (n != 0) and (n != -1): s = struct.pack('>I', n & 0xffffffffL) + s ...
def deflate_long(n, add_sign_padding=True): "turns a long-int into a normalized byte string (adapted from Crypto.Util.number)" # after much testing, this algorithm was deemed to be the fastest s = '' n = long(n) while (n != 0) and (n != -1): s = struct.pack('>I', n & 0xffffffffL) + s ...
[ "turns", "a", "long", "-", "int", "into", "a", "normalized", "byte", "string", "(", "adapted", "from", "Crypto", ".", "Util", ".", "number", ")" ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/util.py#L66-L93
[ "def", "deflate_long", "(", "n", ",", "add_sign_padding", "=", "True", ")", ":", "# after much testing, this algorithm was deemed to be the fastest", "s", "=", "''", "n", "=", "long", "(", "n", ")", "while", "(", "n", "!=", "0", ")", "and", "(", "n", "!=", ...
e8bdad4c82a50158a749233dca58c29e47c60b76
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 hashclass: class from L{Crypto.Hash} that can be used as a secure hashing function (like C{MD5} ...
ssh/util.py
def generate_key_bytes(hashclass, 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 hashclass: class from L{Crypto.Hash} t...
def generate_key_bytes(hashclass, 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 hashclass: class from L{Crypto.Hash} t...
[ "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...
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/util.py#L151-L183
[ "def", "generate_key_bytes", "(", "hashclass", ",", "salt", ",", "key", ",", "nbytes", ")", ":", "keydata", "=", "''", "digest", "=", "''", "if", "len", "(", "salt", ")", ">", "8", ":", "salt", "=", "salt", "[", ":", "8", "]", "while", "nbytes", ...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
retry_on_signal
Retries function until it doesn't raise an EINTR error
ssh/util.py
def retry_on_signal(function): """Retries function until it doesn't raise an EINTR error""" while True: try: return function() except EnvironmentError, e: if e.errno != errno.EINTR: raise
def retry_on_signal(function): """Retries function until it doesn't raise an EINTR error""" while True: try: return function() except EnvironmentError, e: if e.errno != errno.EINTR: raise
[ "Retries", "function", "until", "it", "doesn", "t", "raise", "an", "EINTR", "error" ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/util.py#L274-L281
[ "def", "retry_on_signal", "(", "function", ")", ":", "while", "True", ":", "try", ":", "return", "function", "(", ")", "except", "EnvironmentError", ",", "e", ":", "if", "e", ".", "errno", "!=", "errno", ".", "EINTR", ":", "raise" ]
e8bdad4c82a50158a749233dca58c29e47c60b76
train
RSAKey.generate
Generate a new private RSA key. This factory function can be used to generate a new host key or authentication key. @param bits: number of bits the generated key should be. @type bits: int @param progress_func: an optional function to call at key points in key generation (u...
ssh/rsakey.py
def generate(bits, progress_func=None): """ Generate a new private RSA key. This factory function can be used to generate a new host key or authentication key. @param bits: number of bits the generated key should be. @type bits: int @param progress_func: an optional fun...
def generate(bits, progress_func=None): """ Generate a new private RSA key. This factory function can be used to generate a new host key or authentication key. @param bits: number of bits the generated key should be. @type bits: int @param progress_func: an optional fun...
[ "Generate", "a", "new", "private", "RSA", "key", ".", "This", "factory", "function", "can", "be", "used", "to", "generate", "a", "new", "host", "key", "or", "authentication", "key", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/rsakey.py#L127-L145
[ "def", "generate", "(", "bits", ",", "progress_func", "=", "None", ")", ":", "rsa", "=", "RSA", ".", "generate", "(", "bits", ",", "rng", ".", "read", ",", "progress_func", ")", "key", "=", "RSAKey", "(", "vals", "=", "(", "rsa", ".", "e", ",", "...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
RSAKey._pkcs1imify
turn a 20-byte SHA1 hash into a blob of data as large as the key's N, using PKCS1's \"emsa-pkcs1-v1_5\" encoding. totally bizarre.
ssh/rsakey.py
def _pkcs1imify(self, data): """ turn a 20-byte SHA1 hash into a blob of data as large as the key's N, using PKCS1's \"emsa-pkcs1-v1_5\" encoding. totally bizarre. """ SHA1_DIGESTINFO = '\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14' size = len(util.deflat...
def _pkcs1imify(self, data): """ turn a 20-byte SHA1 hash into a blob of data as large as the key's N, using PKCS1's \"emsa-pkcs1-v1_5\" encoding. totally bizarre. """ SHA1_DIGESTINFO = '\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14' size = len(util.deflat...
[ "turn", "a", "20", "-", "byte", "SHA1", "hash", "into", "a", "blob", "of", "data", "as", "large", "as", "the", "key", "s", "N", "using", "PKCS1", "s", "\\", "emsa", "-", "pkcs1", "-", "v1_5", "\\", "encoding", ".", "totally", "bizarre", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/rsakey.py#L152-L160
[ "def", "_pkcs1imify", "(", "self", ",", "data", ")", ":", "SHA1_DIGESTINFO", "=", "'\\x30\\x21\\x30\\x09\\x06\\x05\\x2b\\x0e\\x03\\x02\\x1a\\x05\\x00\\x04\\x14'", "size", "=", "len", "(", "util", ".", "deflate_long", "(", "self", ".", "n", ",", "0", ")", ")", "fil...
e8bdad4c82a50158a749233dca58c29e47c60b76
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 bits: number of bits the generated key should be. @type bits: int @param progress_func: an optional function to call at key points in key generation (u...
ssh/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 bits: number of bits the generated key should be. @type bits: int @param progress_func: an optiona...
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 bits: number of bits the generated key should be. @type bits: int @param progress_func: an optiona...
[ "Generate", "a", "new", "private", "DSS", "key", ".", "This", "factory", "function", "can", "be", "used", "to", "generate", "a", "new", "host", "key", "or", "authentication", "key", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/dsskey.py#L151-L167
[ "def", "generate", "(", "bits", "=", "1024", ",", "progress_func", "=", "None", ")", ":", "dsa", "=", "DSA", ".", "generate", "(", "bits", ",", "rng", ".", "read", ",", "progress_func", ")", "key", "=", "DSSKey", "(", "vals", "=", "(", "dsa", ".", ...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
SSHConfig.parse
Read an OpenSSH config from the given file object. @param file_obj: a file-like object to read the config file from @type file_obj: file
ssh/config.py
def parse(self, file_obj): """ Read an OpenSSH config from the given file object. @param file_obj: a file-like object to read the config file from @type file_obj: file """ configs = [self._config[0]] for line in file_obj: line = line.rstrip('\n').lstr...
def parse(self, file_obj): """ Read an OpenSSH config from the given file object. @param file_obj: a file-like object to read the config file from @type file_obj: file """ configs = [self._config[0]] for line in file_obj: line = line.rstrip('\n').lstr...
[ "Read", "an", "OpenSSH", "config", "from", "the", "given", "file", "object", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/config.py#L46-L85
[ "def", "parse", "(", "self", ",", "file_obj", ")", ":", "configs", "=", "[", "self", ".", "_config", "[", "0", "]", "]", "for", "line", "in", "file_obj", ":", "line", "=", "line", ".", "rstrip", "(", "'\\n'", ")", ".", "lstrip", "(", ")", "if", ...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
SSHConfig.lookup
Return a dict of config options for a given hostname. The host-matching rules of OpenSSH's C{ssh_config} man page are used, which means that all configuration options from matching host specifications are merged, with more specific hostmasks taking precedence. In other words, if C{"Port...
ssh/config.py
def lookup(self, hostname): """ Return a dict of config options for a given hostname. The host-matching rules of OpenSSH's C{ssh_config} man page are used, which means that all configuration options from matching host specifications are merged, with more specific hostmasks takin...
def lookup(self, hostname): """ Return a dict of config options for a given hostname. The host-matching rules of OpenSSH's C{ssh_config} man page are used, which means that all configuration options from matching host specifications are merged, with more specific hostmasks takin...
[ "Return", "a", "dict", "of", "config", "options", "for", "a", "given", "hostname", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/config.py#L87-L117
[ "def", "lookup", "(", "self", ",", "hostname", ")", ":", "matches", "=", "[", "x", "for", "x", "in", "self", ".", "_config", "if", "fnmatch", ".", "fnmatch", "(", "hostname", ",", "x", "[", "'host'", "]", ")", "]", "# Move * to the end", "_star", "="...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
SSHConfig._expand_variables
Return a dict of config options with expanded substitutions for a given hostname. Please refer to man ssh_config(5) for the parameters that are replaced. @param config: the config for the hostname @type hostname: dict @param hostname: the hostname that the config belong...
ssh/config.py
def _expand_variables(self, config, hostname ): """ Return a dict of config options with expanded substitutions for a given hostname. Please refer to man ssh_config(5) for the parameters that are replaced. @param config: the config for the hostname @type hostnam...
def _expand_variables(self, config, hostname ): """ Return a dict of config options with expanded substitutions for a given hostname. Please refer to man ssh_config(5) for the parameters that are replaced. @param config: the config for the hostname @type hostnam...
[ "Return", "a", "dict", "of", "config", "options", "with", "expanded", "substitutions", "for", "a", "given", "hostname", "." ]
bitprophet/ssh
python
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/config.py#L119-L176
[ "def", "_expand_variables", "(", "self", ",", "config", ",", "hostname", ")", ":", "if", "'hostname'", "in", "config", ":", "config", "[", "'hostname'", "]", "=", "config", "[", "'hostname'", "]", ".", "replace", "(", "'%h'", ",", "hostname", ")", "else"...
e8bdad4c82a50158a749233dca58c29e47c60b76
train
RestHttp.url
Construct a URL from the given components.
stcrestclient/resthttp.py
def url(proto, server, port=None, uri=None): """Construct a URL from the given components.""" url_parts = [proto, '://', server] if port: port = int(port) if port < 1 or port > 65535: raise ValueError('invalid port value') if not ((proto == 'ht...
def url(proto, server, port=None, uri=None): """Construct a URL from the given components.""" url_parts = [proto, '://', server] if port: port = int(port) if port < 1 or port > 65535: raise ValueError('invalid port value') if not ((proto == 'ht...
[ "Construct", "a", "URL", "from", "the", "given", "components", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/resthttp.py#L112-L129
[ "def", "url", "(", "proto", ",", "server", ",", "port", "=", "None", ",", "uri", "=", "None", ")", ":", "url_parts", "=", "[", "proto", ",", "'://'", ",", "server", "]", "if", "port", ":", "port", "=", "int", "(", "port", ")", "if", "port", "<"...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
RestHttp.make_url
Create a URL from the specified parts.
stcrestclient/resthttp.py
def make_url(self, container=None, resource=None, query_items=None): """Create a URL from the specified parts.""" pth = [self._base_url] if container: pth.append(container.strip('/')) if resource: pth.append(resource) else: pth.append('') ...
def make_url(self, container=None, resource=None, query_items=None): """Create a URL from the specified parts.""" pth = [self._base_url] if container: pth.append(container.strip('/')) if resource: pth.append(resource) else: pth.append('') ...
[ "Create", "a", "URL", "from", "the", "specified", "parts", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/resthttp.py#L166-L181
[ "def", "make_url", "(", "self", ",", "container", "=", "None", ",", "resource", "=", "None", ",", "query_items", "=", "None", ")", ":", "pth", "=", "[", "self", ".", "_base_url", "]", "if", "container", ":", "pth", ".", "append", "(", "container", "....
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
RestHttp.head_request
Send a HEAD request.
stcrestclient/resthttp.py
def head_request(self, container, resource=None): """Send a HEAD request.""" url = self.make_url(container, resource) headers = self._make_headers(None) try: rsp = requests.head(url, headers=self._base_headers, verify=self._verify, timeout=sel...
def head_request(self, container, resource=None): """Send a HEAD request.""" url = self.make_url(container, resource) headers = self._make_headers(None) try: rsp = requests.head(url, headers=self._base_headers, verify=self._verify, timeout=sel...
[ "Send", "a", "HEAD", "request", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/resthttp.py#L183-L197
[ "def", "head_request", "(", "self", ",", "container", ",", "resource", "=", "None", ")", ":", "url", "=", "self", ".", "make_url", "(", "container", ",", "resource", ")", "headers", "=", "self", ".", "_make_headers", "(", "None", ")", "try", ":", "rsp"...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
RestHttp.post_request
Send a POST request.
stcrestclient/resthttp.py
def post_request(self, container, resource=None, params=None, accept=None): """Send a POST request.""" url = self.make_url(container, resource) headers = self._make_headers(accept) try: rsp = requests.post(url, data=params, headers=headers, ve...
def post_request(self, container, resource=None, params=None, accept=None): """Send a POST request.""" url = self.make_url(container, resource) headers = self._make_headers(accept) try: rsp = requests.post(url, data=params, headers=headers, ve...
[ "Send", "a", "POST", "request", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/resthttp.py#L220-L234
[ "def", "post_request", "(", "self", ",", "container", ",", "resource", "=", "None", ",", "params", "=", "None", ",", "accept", "=", "None", ")", ":", "url", "=", "self", ".", "make_url", "(", "container", ",", "resource", ")", "headers", "=", "self", ...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
RestHttp.delete_request
Send a DELETE request.
stcrestclient/resthttp.py
def delete_request(self, container, resource=None, query_items=None, accept=None): """Send a DELETE request.""" url = self.make_url(container, resource) headers = self._make_headers(accept) if query_items and isinstance(query_items, (list, tuple, set)): ...
def delete_request(self, container, resource=None, query_items=None, accept=None): """Send a DELETE request.""" url = self.make_url(container, resource) headers = self._make_headers(accept) if query_items and isinstance(query_items, (list, tuple, set)): ...
[ "Send", "a", "DELETE", "request", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/resthttp.py#L252-L271
[ "def", "delete_request", "(", "self", ",", "container", ",", "resource", "=", "None", ",", "query_items", "=", "None", ",", "accept", "=", "None", ")", ":", "url", "=", "self", ".", "make_url", "(", "container", ",", "resource", ")", "headers", "=", "s...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
RestHttp.download_file
Download a file. If a timeout defined, it is not a time limit on the entire download; rather, an exception is raised if the server has not issued a response for timeout seconds (more precisely, if no bytes have been received on the underlying socket for timeout seconds). If no timeout i...
stcrestclient/resthttp.py
def download_file(self, container, resource, save_path=None, accept=None, query_items=None): """Download a file. If a timeout defined, it is not a time limit on the entire download; rather, an exception is raised if the server has not issued a response for timeout ...
def download_file(self, container, resource, save_path=None, accept=None, query_items=None): """Download a file. If a timeout defined, it is not a time limit on the entire download; rather, an exception is raised if the server has not issued a response for timeout ...
[ "Download", "a", "file", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/resthttp.py#L273-L319
[ "def", "download_file", "(", "self", ",", "container", ",", "resource", ",", "save_path", "=", "None", ",", "accept", "=", "None", ",", "query_items", "=", "None", ")", ":", "url", "=", "self", ".", "make_url", "(", "container", ",", "resource", ")", "...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
RestHttp.upload_file
Upload a single file.
stcrestclient/resthttp.py
def upload_file(self, container, src_file_path, dst_name=None, put=True, content_type=None): """Upload a single file.""" if not os.path.exists(src_file_path): raise RuntimeError('file not found: ' + src_file_path) if not dst_name: dst_name = os.path.ba...
def upload_file(self, container, src_file_path, dst_name=None, put=True, content_type=None): """Upload a single file.""" if not os.path.exists(src_file_path): raise RuntimeError('file not found: ' + src_file_path) if not dst_name: dst_name = os.path.ba...
[ "Upload", "a", "single", "file", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/resthttp.py#L321-L350
[ "def", "upload_file", "(", "self", ",", "container", ",", "src_file_path", ",", "dst_name", "=", "None", ",", "put", "=", "True", ",", "content_type", "=", "None", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "src_file_path", ")", ":",...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
RestHttp.upload_file_mp
Upload a file using multi-part encoding.
stcrestclient/resthttp.py
def upload_file_mp(self, container, src_file_path, dst_name=None, content_type=None): """Upload a file using multi-part encoding.""" if not os.path.exists(src_file_path): raise RuntimeError('file not found: ' + src_file_path) if not dst_name: dst_na...
def upload_file_mp(self, container, src_file_path, dst_name=None, content_type=None): """Upload a file using multi-part encoding.""" if not os.path.exists(src_file_path): raise RuntimeError('file not found: ' + src_file_path) if not dst_name: dst_na...
[ "Upload", "a", "file", "using", "multi", "-", "part", "encoding", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/resthttp.py#L352-L371
[ "def", "upload_file_mp", "(", "self", ",", "container", ",", "src_file_path", ",", "dst_name", "=", "None", ",", "content_type", "=", "None", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "src_file_path", ")", ":", "raise", "RuntimeError", ...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
RestHttp.upload_files
Upload multiple files.
stcrestclient/resthttp.py
def upload_files(self, container, src_dst_map, content_type=None): """Upload multiple files.""" if not content_type: content_type = "application/octet.stream" url = self.make_url(container, None, None) headers = self._base_headers multi_files = [] try: ...
def upload_files(self, container, src_dst_map, content_type=None): """Upload multiple files.""" if not content_type: content_type = "application/octet.stream" url = self.make_url(container, None, None) headers = self._base_headers multi_files = [] try: ...
[ "Upload", "multiple", "files", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/resthttp.py#L373-L397
[ "def", "upload_files", "(", "self", ",", "container", ",", "src_dst_map", ",", "content_type", "=", "None", ")", ":", "if", "not", "content_type", ":", "content_type", "=", "\"application/octet.stream\"", "url", "=", "self", ".", "make_url", "(", "container", ...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcPythonRest.new_session
Create a new session or attach to existing. Normally, this function is called automatically, and gets its parameter values from the environment. It is provided as a public function for cases when extra control over session creation is required in an automation script that is adapted to...
stcrestclient/stcpythonrest.py
def new_session(self, server=None, session_name=None, user_name=None, existing_session=None): """Create a new session or attach to existing. Normally, this function is called automatically, and gets its parameter values from the environment. It is provided as a public funct...
def new_session(self, server=None, session_name=None, user_name=None, existing_session=None): """Create a new session or attach to existing. Normally, this function is called automatically, and gets its parameter values from the environment. It is provided as a public funct...
[ "Create", "a", "new", "session", "or", "attach", "to", "existing", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stcpythonrest.py#L192-L267
[ "def", "new_session", "(", "self", ",", "server", "=", "None", ",", "session_name", "=", "None", ",", "user_name", "=", "None", ",", "existing_session", "=", "None", ")", ":", "if", "not", "server", ":", "server", "=", "os", ".", "environ", ".", "get",...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcPythonRest._end_session
End the client session.
stcrestclient/stcpythonrest.py
def _end_session(self, kill=None): """End the client session.""" if self._stc: if kill is None: kill = os.environ.get('STC_SESSION_TERMINATE_ON_DISCONNECT') kill = _is_true(kill) self._stc.end_session(kill) self._stc = None
def _end_session(self, kill=None): """End the client session.""" if self._stc: if kill is None: kill = os.environ.get('STC_SESSION_TERMINATE_ON_DISCONNECT') kill = _is_true(kill) self._stc.end_session(kill) self._stc = None
[ "End", "the", "client", "session", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stcpythonrest.py#L274-L281
[ "def", "_end_session", "(", "self", ",", "kill", "=", "None", ")", ":", "if", "self", ".", "_stc", ":", "if", "kill", "is", "None", ":", "kill", "=", "os", ".", "environ", ".", "get", "(", "'STC_SESSION_TERMINATE_ON_DISCONNECT'", ")", "kill", "=", "_is...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
setup
This isn't used in Production, but allows this module to be used as a standalone extension.
readthedocs_ext/embed.py
def setup(app): """ This isn't used in Production, but allows this module to be used as a standalone extension. """ app.add_directive('readthedocs-embed', EmbedDirective) app.add_config_value('readthedocs_embed_project', '', 'html') app.add_config_value('readthedocs_embed_version', '', 'htm...
def setup(app): """ This isn't used in Production, but allows this module to be used as a standalone extension. """ app.add_directive('readthedocs-embed', EmbedDirective) app.add_config_value('readthedocs_embed_project', '', 'html') app.add_config_value('readthedocs_embed_version', '', 'htm...
[ "This", "isn", "t", "used", "in", "Production", "but", "allows", "this", "module", "to", "be", "used", "as", "a", "standalone", "extension", "." ]
rtfd/readthedocs-sphinx-ext
python
https://github.com/rtfd/readthedocs-sphinx-ext/blob/f1a01c51c675d36ac365162ea06814544c2aa410/readthedocs_ext/embed.py#L66-L77
[ "def", "setup", "(", "app", ")", ":", "app", ".", "add_directive", "(", "'readthedocs-embed'", ",", "EmbedDirective", ")", "app", ".", "add_config_value", "(", "'readthedocs_embed_project'", ",", "''", ",", "'html'", ")", "app", ".", "add_config_value", "(", "...
f1a01c51c675d36ac365162ea06814544c2aa410
train
finalize_media
Point media files at our media server.
readthedocs_ext/readthedocs.py
def finalize_media(app): """Point media files at our media server.""" if (app.builder.name == 'readthedocssinglehtmllocalmedia' or app.builder.format != 'html' or not hasattr(app.builder, 'script_files')): return # Use local media for downloadable files # Pull project data ...
def finalize_media(app): """Point media files at our media server.""" if (app.builder.name == 'readthedocssinglehtmllocalmedia' or app.builder.format != 'html' or not hasattr(app.builder, 'script_files')): return # Use local media for downloadable files # Pull project data ...
[ "Point", "media", "files", "at", "our", "media", "server", "." ]
rtfd/readthedocs-sphinx-ext
python
https://github.com/rtfd/readthedocs-sphinx-ext/blob/f1a01c51c675d36ac365162ea06814544c2aa410/readthedocs_ext/readthedocs.py#L43-L57
[ "def", "finalize_media", "(", "app", ")", ":", "if", "(", "app", ".", "builder", ".", "name", "==", "'readthedocssinglehtmllocalmedia'", "or", "app", ".", "builder", ".", "format", "!=", "'html'", "or", "not", "hasattr", "(", "app", ".", "builder", ",", ...
f1a01c51c675d36ac365162ea06814544c2aa410
train
update_body
Add Read the Docs content to Sphinx body content. This is the most reliable way to inject our content into the page.
readthedocs_ext/readthedocs.py
def update_body(app, pagename, templatename, context, doctree): """ Add Read the Docs content to Sphinx body content. This is the most reliable way to inject our content into the page. """ STATIC_URL = context.get('STATIC_URL', DEFAULT_STATIC_URL) online_builders = [ 'readthedocs', 're...
def update_body(app, pagename, templatename, context, doctree): """ Add Read the Docs content to Sphinx body content. This is the most reliable way to inject our content into the page. """ STATIC_URL = context.get('STATIC_URL', DEFAULT_STATIC_URL) online_builders = [ 'readthedocs', 're...
[ "Add", "Read", "the", "Docs", "content", "to", "Sphinx", "body", "content", "." ]
rtfd/readthedocs-sphinx-ext
python
https://github.com/rtfd/readthedocs-sphinx-ext/blob/f1a01c51c675d36ac365162ea06814544c2aa410/readthedocs_ext/readthedocs.py#L60-L142
[ "def", "update_body", "(", "app", ",", "pagename", ",", "templatename", ",", "context", ",", "doctree", ")", ":", "STATIC_URL", "=", "context", ".", "get", "(", "'STATIC_URL'", ",", "DEFAULT_STATIC_URL", ")", "online_builders", "=", "[", "'readthedocs'", ",", ...
f1a01c51c675d36ac365162ea06814544c2aa410
train
generate_json_artifacts
Generate JSON artifacts for each page. This way we can skip generating this in other build step.
readthedocs_ext/readthedocs.py
def generate_json_artifacts(app, pagename, templatename, context, doctree): """ Generate JSON artifacts for each page. This way we can skip generating this in other build step. """ try: # We need to get the output directory where the docs are built # _build/json. build_json ...
def generate_json_artifacts(app, pagename, templatename, context, doctree): """ Generate JSON artifacts for each page. This way we can skip generating this in other build step. """ try: # We need to get the output directory where the docs are built # _build/json. build_json ...
[ "Generate", "JSON", "artifacts", "for", "each", "page", "." ]
rtfd/readthedocs-sphinx-ext
python
https://github.com/rtfd/readthedocs-sphinx-ext/blob/f1a01c51c675d36ac365162ea06814544c2aa410/readthedocs_ext/readthedocs.py#L145-L178
[ "def", "generate_json_artifacts", "(", "app", ",", "pagename", ",", "templatename", ",", "context", ",", "doctree", ")", ":", "try", ":", "# We need to get the output directory where the docs are built", "# _build/json.", "build_json", "=", "os", ".", "path", ".", "ab...
f1a01c51c675d36ac365162ea06814544c2aa410
train
HtmlBuilderMixin._copy_searchtools
Copy and patch searchtools This uses the included Sphinx version's searchtools, but patches it to remove automatic initialization. This is a fork of ``sphinx.util.fileutil.copy_asset``
readthedocs_ext/readthedocs.py
def _copy_searchtools(self, renderer=None): """Copy and patch searchtools This uses the included Sphinx version's searchtools, but patches it to remove automatic initialization. This is a fork of ``sphinx.util.fileutil.copy_asset`` """ log.info(bold('copying searchtools....
def _copy_searchtools(self, renderer=None): """Copy and patch searchtools This uses the included Sphinx version's searchtools, but patches it to remove automatic initialization. This is a fork of ``sphinx.util.fileutil.copy_asset`` """ log.info(bold('copying searchtools....
[ "Copy", "and", "patch", "searchtools" ]
rtfd/readthedocs-sphinx-ext
python
https://github.com/rtfd/readthedocs-sphinx-ext/blob/f1a01c51c675d36ac365162ea06814544c2aa410/readthedocs_ext/readthedocs.py#L209-L247
[ "def", "_copy_searchtools", "(", "self", ",", "renderer", "=", "None", ")", ":", "log", ".", "info", "(", "bold", "(", "'copying searchtools... '", ")", ",", "nonl", "=", "True", ")", "if", "sphinx", ".", "version_info", "<", "(", "1", ",", "8", ")", ...
f1a01c51c675d36ac365162ea06814544c2aa410
train
stc_system_info
Return dictionary of STC and API information. If a session already exists, then use it to get STC information and avoid taking the time to start a new session. A session is necessary to get STC information.
stcrestclient/systeminfo.py
def stc_system_info(stc_addr): """Return dictionary of STC and API information. If a session already exists, then use it to get STC information and avoid taking the time to start a new session. A session is necessary to get STC information. """ stc = stchttp.StcHttp(stc_addr) sessions = s...
def stc_system_info(stc_addr): """Return dictionary of STC and API information. If a session already exists, then use it to get STC information and avoid taking the time to start a new session. A session is necessary to get STC information. """ stc = stchttp.StcHttp(stc_addr) sessions = s...
[ "Return", "dictionary", "of", "STC", "and", "API", "information", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/systeminfo.py#L23-L46
[ "def", "stc_system_info", "(", "stc_addr", ")", ":", "stc", "=", "stchttp", ".", "StcHttp", "(", "stc_addr", ")", "sessions", "=", "stc", ".", "sessions", "(", ")", "if", "sessions", ":", "# If a session already exists, use it to get STC information.", "stc", ".",...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.new_session
Create a new test session. The test session is identified by the specified user_name and optional session_name parameters. If a session name is not specified, then the server will create one. Arguments: user_name -- User name part of session ID. session_name -- Se...
stcrestclient/stchttp.py
def new_session(self, user_name=None, session_name=None, kill_existing=False, analytics=None): """Create a new test session. The test session is identified by the specified user_name and optional session_name parameters. If a session name is not specified, then the ...
def new_session(self, user_name=None, session_name=None, kill_existing=False, analytics=None): """Create a new test session. The test session is identified by the specified user_name and optional session_name parameters. If a session name is not specified, then the ...
[ "Create", "a", "new", "test", "session", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L87-L140
[ "def", "new_session", "(", "self", ",", "user_name", "=", "None", ",", "session_name", "=", "None", ",", "kill_existing", "=", "False", ",", "analytics", "=", "None", ")", ":", "if", "self", ".", "started", "(", ")", ":", "return", "False", "if", "not"...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.join_session
Attach to an existing session.
stcrestclient/stchttp.py
def join_session(self, sid): """Attach to an existing session.""" self._rest.add_header('X-STC-API-Session', sid) self._sid = sid try: status, data = self._rest.get_request('objects', 'system1', ['version', 'name']) ex...
def join_session(self, sid): """Attach to an existing session.""" self._rest.add_header('X-STC-API-Session', sid) self._sid = sid try: status, data = self._rest.get_request('objects', 'system1', ['version', 'name']) ex...
[ "Attach", "to", "an", "existing", "session", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L142-L154
[ "def", "join_session", "(", "self", ",", "sid", ")", ":", "self", ".", "_rest", ".", "add_header", "(", "'X-STC-API-Session'", ",", "sid", ")", "self", ".", "_sid", "=", "sid", "try", ":", "status", ",", "data", "=", "self", ".", "_rest", ".", "get_r...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.end_session
End this test session. A session can be ended in three ways, depending on the value of the end_tcsession parameter: - end_tcsession=None: Stop using session locally, do not contact server. - end_tcsession=False: End client controller, but leave te...
stcrestclient/stchttp.py
def end_session(self, end_tcsession=True, sid=None): """End this test session. A session can be ended in three ways, depending on the value of the end_tcsession parameter: - end_tcsession=None: Stop using session locally, do not contact server. - end_tcse...
def end_session(self, end_tcsession=True, sid=None): """End this test session. A session can be ended in three ways, depending on the value of the end_tcsession parameter: - end_tcsession=None: Stop using session locally, do not contact server. - end_tcse...
[ "End", "this", "test", "session", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L156-L234
[ "def", "end_session", "(", "self", ",", "end_tcsession", "=", "True", ",", "sid", "=", "None", ")", ":", "if", "not", "sid", "or", "sid", "==", "self", ".", "_sid", ":", "if", "not", "self", ".", "started", "(", ")", ":", "return", "False", "sid", ...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.session_info
Get information on session. If session_id is None, the default, then return information about this session. If a session ID is given, then get information about that session. Arguments: session_id -- Id of session to get info for, if not this session. Return: ...
stcrestclient/stchttp.py
def session_info(self, session_id=None): """Get information on session. If session_id is None, the default, then return information about this session. If a session ID is given, then get information about that session. Arguments: session_id -- Id of session to get info...
def session_info(self, session_id=None): """Get information on session. If session_id is None, the default, then return information about this session. If a session ID is given, then get information about that session. Arguments: session_id -- Id of session to get info...
[ "Get", "information", "on", "session", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L273-L292
[ "def", "session_info", "(", "self", ",", "session_id", "=", "None", ")", ":", "if", "not", "session_id", ":", "if", "not", "self", ".", "started", "(", ")", ":", "return", "[", "]", "session_id", "=", "self", ".", "_sid", "status", ",", "data", "=", ...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.files
Get list of files, for this session, on server.
stcrestclient/stchttp.py
def files(self): """Get list of files, for this session, on server.""" self._check_session() status, data = self._rest.get_request('files') return data
def files(self): """Get list of files, for this session, on server.""" self._check_session() status, data = self._rest.get_request('files') return data
[ "Get", "list", "of", "files", "for", "this", "session", "on", "server", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L294-L298
[ "def", "files", "(", "self", ")", ":", "self", ".", "_check_session", "(", ")", "status", ",", "data", "=", "self", ".", "_rest", ".", "get_request", "(", "'files'", ")", "return", "data" ]
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.bll_version
Get the BLL version this session is connected to. Return: Version string if session started. None if session not started.
stcrestclient/stchttp.py
def bll_version(self): """Get the BLL version this session is connected to. Return: Version string if session started. None if session not started. """ if not self.started(): return None status, data = self._rest.get_request('objects', 'system1', ...
def bll_version(self): """Get the BLL version this session is connected to. Return: Version string if session started. None if session not started. """ if not self.started(): return None status, data = self._rest.get_request('objects', 'system1', ...
[ "Get", "the", "BLL", "version", "this", "session", "is", "connected", "to", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L309-L320
[ "def", "bll_version", "(", "self", ")", ":", "if", "not", "self", ".", "started", "(", ")", ":", "return", "None", "status", ",", "data", "=", "self", ".", "_rest", ".", "get_request", "(", "'objects'", ",", "'system1'", ",", "[", "'version'", ",", "...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.get
Returns the value(s) of one or more object attributes. If multiple arguments, this method returns a dictionary of argument names mapped to the value returned by each argument. If a single argument is given, then the response is a list of values for that argument. Arguments: ...
stcrestclient/stchttp.py
def get(self, handle, *args): """Returns the value(s) of one or more object attributes. If multiple arguments, this method returns a dictionary of argument names mapped to the value returned by each argument. If a single argument is given, then the response is a list of values ...
def get(self, handle, *args): """Returns the value(s) of one or more object attributes. If multiple arguments, this method returns a dictionary of argument names mapped to the value returned by each argument. If a single argument is given, then the response is a list of values ...
[ "Returns", "the", "value", "(", "s", ")", "of", "one", "or", "more", "object", "attributes", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L336-L360
[ "def", "get", "(", "self", ",", "handle", ",", "*", "args", ")", ":", "self", ".", "_check_session", "(", ")", "status", ",", "data", "=", "self", ".", "_rest", ".", "get_request", "(", "'objects'", ",", "str", "(", "handle", ")", ",", "args", ")",...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.create
Create a new automation object. Arguments: object_type -- Type of object to create. under -- Handle of the parent of the new object. attributes -- Dictionary of attributes (name-value pairs). kwattrs -- Optional keyword attributes (name=value pairs). Return: ...
stcrestclient/stchttp.py
def create(self, object_type, under=None, attributes=None, **kwattrs): """Create a new automation object. Arguments: object_type -- Type of object to create. under -- Handle of the parent of the new object. attributes -- Dictionary of attributes (name-value pairs). ...
def create(self, object_type, under=None, attributes=None, **kwattrs): """Create a new automation object. Arguments: object_type -- Type of object to create. under -- Handle of the parent of the new object. attributes -- Dictionary of attributes (name-value pairs). ...
[ "Create", "a", "new", "automation", "object", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L362-L376
[ "def", "create", "(", "self", ",", "object_type", ",", "under", "=", "None", ",", "attributes", "=", "None", ",", "*", "*", "kwattrs", ")", ":", "data", "=", "self", ".", "createx", "(", "object_type", ",", "under", ",", "attributes", ",", "*", "*", ...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.createx
Create a new automation object. Arguments: object_type -- Type of object to create. under -- Handle of the parent of the new object. attributes -- Dictionary of attributes (name-value pairs). kwattrs -- Optional keyword attributes (name=value pairs). Return: ...
stcrestclient/stchttp.py
def createx(self, object_type, under=None, attributes=None, **kwattrs): """Create a new automation object. Arguments: object_type -- Type of object to create. under -- Handle of the parent of the new object. attributes -- Dictionary of attributes (name-value pairs). ...
def createx(self, object_type, under=None, attributes=None, **kwattrs): """Create a new automation object. Arguments: object_type -- Type of object to create. under -- Handle of the parent of the new object. attributes -- Dictionary of attributes (name-value pairs). ...
[ "Create", "a", "new", "automation", "object", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L378-L401
[ "def", "createx", "(", "self", ",", "object_type", ",", "under", "=", "None", ",", "attributes", "=", "None", ",", "*", "*", "kwattrs", ")", ":", "self", ".", "_check_session", "(", ")", "params", "=", "{", "'object_type'", ":", "object_type", "}", "if...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.delete
Delete the specified object. Arguments: handle -- Handle of object to delete.
stcrestclient/stchttp.py
def delete(self, handle): """Delete the specified object. Arguments: handle -- Handle of object to delete. """ self._check_session() self._rest.delete_request('objects', str(handle))
def delete(self, handle): """Delete the specified object. Arguments: handle -- Handle of object to delete. """ self._check_session() self._rest.delete_request('objects', str(handle))
[ "Delete", "the", "specified", "object", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L403-L411
[ "def", "delete", "(", "self", ",", "handle", ")", ":", "self", ".", "_check_session", "(", ")", "self", ".", "_rest", ".", "delete_request", "(", "'objects'", ",", "str", "(", "handle", ")", ")" ]
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.perform
Execute a command. Arguments can be supplied either as a dictionary or as keyword arguments. Examples: stc.perform('LoadFromXml', {'filename':'config.xml'}) stc.perform('LoadFromXml', filename='config.xml') Arguments: command -- Command to execute. para...
stcrestclient/stchttp.py
def perform(self, command, params=None, **kwargs): """Execute a command. Arguments can be supplied either as a dictionary or as keyword arguments. Examples: stc.perform('LoadFromXml', {'filename':'config.xml'}) stc.perform('LoadFromXml', filename='config.xml') ...
def perform(self, command, params=None, **kwargs): """Execute a command. Arguments can be supplied either as a dictionary or as keyword arguments. Examples: stc.perform('LoadFromXml', {'filename':'config.xml'}) stc.perform('LoadFromXml', filename='config.xml') ...
[ "Execute", "a", "command", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L413-L437
[ "def", "perform", "(", "self", ",", "command", ",", "params", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_check_session", "(", ")", "if", "not", "params", ":", "params", "=", "{", "}", "if", "kwargs", ":", "params", ".", "update"...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.config
Sets or modifies one or more object attributes or relations. Arguments can be supplied either as a dictionary or as keyword arguments. Examples: stc.config('port1', location='//10.1.2.3/1/1') stc.config('port2', {'location': '//10.1.2.3/1/2'}) Arguments: handle...
stcrestclient/stchttp.py
def config(self, handle, attributes=None, **kwattrs): """Sets or modifies one or more object attributes or relations. Arguments can be supplied either as a dictionary or as keyword arguments. Examples: stc.config('port1', location='//10.1.2.3/1/1') stc.config('port2', {...
def config(self, handle, attributes=None, **kwattrs): """Sets or modifies one or more object attributes or relations. Arguments can be supplied either as a dictionary or as keyword arguments. Examples: stc.config('port1', location='//10.1.2.3/1/1') stc.config('port2', {...
[ "Sets", "or", "modifies", "one", "or", "more", "object", "attributes", "or", "relations", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L439-L459
[ "def", "config", "(", "self", ",", "handle", ",", "attributes", "=", "None", ",", "*", "*", "kwattrs", ")", ":", "self", ".", "_check_session", "(", ")", "if", "kwattrs", ":", "if", "attributes", ":", "attributes", ".", "update", "(", "kwattrs", ")", ...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.chassis
Get list of chassis known to test session.
stcrestclient/stchttp.py
def chassis(self): """Get list of chassis known to test session.""" self._check_session() status, data = self._rest.get_request('chassis') return data
def chassis(self): """Get list of chassis known to test session.""" self._check_session() status, data = self._rest.get_request('chassis') return data
[ "Get", "list", "of", "chassis", "known", "to", "test", "session", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L461-L465
[ "def", "chassis", "(", "self", ")", ":", "self", ".", "_check_session", "(", ")", "status", ",", "data", "=", "self", ".", "_rest", ".", "get_request", "(", "'chassis'", ")", "return", "data" ]
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.chassis_info
Get information about the specified chassis.
stcrestclient/stchttp.py
def chassis_info(self, chassis): """Get information about the specified chassis.""" if not chassis or not isinstance(chassis, str): raise RuntimeError('missing chassis address') self._check_session() status, data = self._rest.get_request('chassis', chassis) return dat...
def chassis_info(self, chassis): """Get information about the specified chassis.""" if not chassis or not isinstance(chassis, str): raise RuntimeError('missing chassis address') self._check_session() status, data = self._rest.get_request('chassis', chassis) return dat...
[ "Get", "information", "about", "the", "specified", "chassis", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L467-L473
[ "def", "chassis_info", "(", "self", ",", "chassis", ")", ":", "if", "not", "chassis", "or", "not", "isinstance", "(", "chassis", ",", "str", ")", ":", "raise", "RuntimeError", "(", "'missing chassis address'", ")", "self", ".", "_check_session", "(", ")", ...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.connections
Get list of connections.
stcrestclient/stchttp.py
def connections(self): """Get list of connections.""" self._check_session() status, data = self._rest.get_request('connections') return data
def connections(self): """Get list of connections.""" self._check_session() status, data = self._rest.get_request('connections') return data
[ "Get", "list", "of", "connections", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L475-L479
[ "def", "connections", "(", "self", ")", ":", "self", ".", "_check_session", "(", ")", "status", ",", "data", "=", "self", ".", "_rest", ".", "get_request", "(", "'connections'", ")", "return", "data" ]
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.is_connected
Get Boolean connected status of the specified chassis.
stcrestclient/stchttp.py
def is_connected(self, chassis): """Get Boolean connected status of the specified chassis.""" self._check_session() try: status, data = self._rest.get_request('connections', chassis) except resthttp.RestHttpError as e: if int(e) == 404: # 404 NOT F...
def is_connected(self, chassis): """Get Boolean connected status of the specified chassis.""" self._check_session() try: status, data = self._rest.get_request('connections', chassis) except resthttp.RestHttpError as e: if int(e) == 404: # 404 NOT F...
[ "Get", "Boolean", "connected", "status", "of", "the", "specified", "chassis", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L481-L490
[ "def", "is_connected", "(", "self", ",", "chassis", ")", ":", "self", ".", "_check_session", "(", ")", "try", ":", "status", ",", "data", "=", "self", ".", "_rest", ".", "get_request", "(", "'connections'", ",", "chassis", ")", "except", "resthttp", ".",...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.connect
Establish connection to one or more chassis. Arguments: chassis_list -- List of chassis (IP addresses or DNS names) Return: List of chassis addresses.
stcrestclient/stchttp.py
def connect(self, chassis_list): """Establish connection to one or more chassis. Arguments: chassis_list -- List of chassis (IP addresses or DNS names) Return: List of chassis addresses. """ self._check_session() if not isinstance(chassis_list, (list, t...
def connect(self, chassis_list): """Establish connection to one or more chassis. Arguments: chassis_list -- List of chassis (IP addresses or DNS names) Return: List of chassis addresses. """ self._check_session() if not isinstance(chassis_list, (list, t...
[ "Establish", "connection", "to", "one", "or", "more", "chassis", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L492-L514
[ "def", "connect", "(", "self", ",", "chassis_list", ")", ":", "self", ".", "_check_session", "(", ")", "if", "not", "isinstance", "(", "chassis_list", ",", "(", "list", ",", "tuple", ",", "set", ",", "dict", ",", "frozenset", ")", ")", ":", "chassis_li...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.disconnect
Remove connection with one or more chassis. Arguments: chassis_list -- List of chassis (IP addresses or DNS names)
stcrestclient/stchttp.py
def disconnect(self, chassis_list): """Remove connection with one or more chassis. Arguments: chassis_list -- List of chassis (IP addresses or DNS names) """ self._check_session() if not isinstance(chassis_list, (list, tuple, set, dict, frozenset)): chassis_...
def disconnect(self, chassis_list): """Remove connection with one or more chassis. Arguments: chassis_list -- List of chassis (IP addresses or DNS names) """ self._check_session() if not isinstance(chassis_list, (list, tuple, set, dict, frozenset)): chassis_...
[ "Remove", "connection", "with", "one", "or", "more", "chassis", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L516-L532
[ "def", "disconnect", "(", "self", ",", "chassis_list", ")", ":", "self", ".", "_check_session", "(", ")", "if", "not", "isinstance", "(", "chassis_list", ",", "(", "list", ",", "tuple", ",", "set", ",", "dict", ",", "frozenset", ")", ")", ":", "chassis...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.help
Get help information about Automation API. The following values can be specified for the subject: None -- gets an overview of help. 'commands' -- gets a list of API functions command name -- get info about the specified command. object type -- get info about the...
stcrestclient/stchttp.py
def help(self, subject=None, args=None): """Get help information about Automation API. The following values can be specified for the subject: None -- gets an overview of help. 'commands' -- gets a list of API functions command name -- get info about the specified com...
def help(self, subject=None, args=None): """Get help information about Automation API. The following values can be specified for the subject: None -- gets an overview of help. 'commands' -- gets a list of API functions command name -- get info about the specified com...
[ "Get", "help", "information", "about", "Automation", "API", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L549-L580
[ "def", "help", "(", "self", ",", "subject", "=", "None", ",", "args", "=", "None", ")", ":", "if", "subject", ":", "if", "subject", "not", "in", "(", "'commands'", ",", "'create'", ",", "'config'", ",", "'get'", ",", "'delete'", ",", "'perform'", ","...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.log
Write a diagnostic message to a log file or to standard output. Arguments: level -- Severity level of entry. One of: INFO, WARN, ERROR, FATAL. msg -- Message to write to log.
stcrestclient/stchttp.py
def log(self, level, msg): """Write a diagnostic message to a log file or to standard output. Arguments: level -- Severity level of entry. One of: INFO, WARN, ERROR, FATAL. msg -- Message to write to log. """ self._check_session() level = level.upper() ...
def log(self, level, msg): """Write a diagnostic message to a log file or to standard output. Arguments: level -- Severity level of entry. One of: INFO, WARN, ERROR, FATAL. msg -- Message to write to log. """ self._check_session() level = level.upper() ...
[ "Write", "a", "diagnostic", "message", "to", "a", "log", "file", "or", "to", "standard", "output", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L582-L597
[ "def", "log", "(", "self", ",", "level", ",", "msg", ")", ":", "self", ".", "_check_session", "(", ")", "level", "=", "level", ".", "upper", "(", ")", "allowed_levels", "=", "(", "'INFO'", ",", "'WARN'", ",", "'ERROR'", ",", "'FATAL'", ")", "if", "...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.download
Download the specified file from the server. Arguments: file_name -- Name of file resource to save. save_as -- Optional path name to write file to. If not specified, then file named by the last part of the resource path is downloaded to current direc...
stcrestclient/stchttp.py
def download(self, file_name, save_as=None): """Download the specified file from the server. Arguments: file_name -- Name of file resource to save. save_as -- Optional path name to write file to. If not specified, then file named by the last part of the resource ...
def download(self, file_name, save_as=None): """Download the specified file from the server. Arguments: file_name -- Name of file resource to save. save_as -- Optional path name to write file to. If not specified, then file named by the last part of the resource ...
[ "Download", "the", "specified", "file", "from", "the", "server", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L599-L627
[ "def", "download", "(", "self", ",", "file_name", ",", "save_as", "=", "None", ")", ":", "self", ".", "_check_session", "(", ")", "try", ":", "if", "save_as", ":", "save_as", "=", "os", ".", "path", ".", "normpath", "(", "save_as", ")", "save_dir", "...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.download_all
Download all available files. Arguments: dst_dir -- Optional destination directory to write files to. If not specified, then files are downloaded current directory. Return: Dictionary of {file_name: file_size, ..}
stcrestclient/stchttp.py
def download_all(self, dst_dir=None): """Download all available files. Arguments: dst_dir -- Optional destination directory to write files to. If not specified, then files are downloaded current directory. Return: Dictionary of {file_name: file_size, ..}...
def download_all(self, dst_dir=None): """Download all available files. Arguments: dst_dir -- Optional destination directory to write files to. If not specified, then files are downloaded current directory. Return: Dictionary of {file_name: file_size, ..}...
[ "Download", "all", "available", "files", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L629-L647
[ "def", "download_all", "(", "self", ",", "dst_dir", "=", "None", ")", ":", "saved", "=", "{", "}", "save_as", "=", "None", "for", "f", "in", "self", ".", "files", "(", ")", ":", "if", "dst_dir", ":", "save_as", "=", "os", ".", "path", ".", "join"...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.upload
Upload the specified file to the server.
stcrestclient/stchttp.py
def upload(self, src_file_path, dst_file_name=None): """Upload the specified file to the server.""" self._check_session() status, data = self._rest.upload_file( 'files', src_file_path, dst_file_name) return data
def upload(self, src_file_path, dst_file_name=None): """Upload the specified file to the server.""" self._check_session() status, data = self._rest.upload_file( 'files', src_file_path, dst_file_name) return data
[ "Upload", "the", "specified", "file", "to", "the", "server", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L649-L654
[ "def", "upload", "(", "self", ",", "src_file_path", ",", "dst_file_name", "=", "None", ")", ":", "self", ".", "_check_session", "(", ")", "status", ",", "data", "=", "self", ".", "_rest", ".", "upload_file", "(", "'files'", ",", "src_file_path", ",", "ds...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
StcHttp.wait_until_complete
Wait until sequencer is finished. This method blocks your application until the sequencer has completed its operation. It returns once the sequencer has finished. Arguments: timeout -- Optional. Seconds to wait for sequencer to finish. If this time is exceeded, th...
stcrestclient/stchttp.py
def wait_until_complete(self, timeout=None): """Wait until sequencer is finished. This method blocks your application until the sequencer has completed its operation. It returns once the sequencer has finished. Arguments: timeout -- Optional. Seconds to wait for sequencer to ...
def wait_until_complete(self, timeout=None): """Wait until sequencer is finished. This method blocks your application until the sequencer has completed its operation. It returns once the sequencer has finished. Arguments: timeout -- Optional. Seconds to wait for sequencer to ...
[ "Wait", "until", "sequencer", "is", "finished", "." ]
Spirent/py-stcrestclient
python
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L656-L684
[ "def", "wait_until_complete", "(", "self", ",", "timeout", "=", "None", ")", ":", "timeout_at", "=", "None", "if", "timeout", ":", "timeout_at", "=", "time", ".", "time", "(", ")", "+", "int", "(", "timeout", ")", "sequencer", "=", "self", ".", "get", ...
80ee82bddf2fb2808f3da8ff2c80b7d588e165e8
train
ManagerMock
Set the results to two items: >>> objects = ManagerMock(Post.objects, 'queryset', 'result') >>> assert objects.filter() == objects.all() Force an exception: >>> objects = ManagerMock(Post.objects, Exception()) See QuerySetMock for more about how this works.
mock_django/managers.py
def ManagerMock(manager, *return_value): """ Set the results to two items: >>> objects = ManagerMock(Post.objects, 'queryset', 'result') >>> assert objects.filter() == objects.all() Force an exception: >>> objects = ManagerMock(Post.objects, Exception()) See QuerySetMock for more about h...
def ManagerMock(manager, *return_value): """ Set the results to two items: >>> objects = ManagerMock(Post.objects, 'queryset', 'result') >>> assert objects.filter() == objects.all() Force an exception: >>> objects = ManagerMock(Post.objects, Exception()) See QuerySetMock for more about h...
[ "Set", "the", "results", "to", "two", "items", ":" ]
dcramer/mock-django
python
https://github.com/dcramer/mock-django/blob/1168d3255e0d67fbf74a9c71feaccbdafef59d21/mock_django/managers.py#L17-L50
[ "def", "ManagerMock", "(", "manager", ",", "*", "return_value", ")", ":", "def", "make_get_query_set", "(", "self", ",", "model", ")", ":", "def", "_get", "(", "*", "a", ",", "*", "*", "k", ")", ":", "return", "QuerySetMock", "(", "model", ",", "*", ...
1168d3255e0d67fbf74a9c71feaccbdafef59d21
train
SharedMock.assert_chain_calls
Asserts that a chained method was called (parents in the chain do not matter, nor are they tracked). Use with `mock.call`. >>> obj.filter(foo='bar').select_related('baz') >>> obj.assert_chain_calls(mock.call.filter(foo='bar')) >>> obj.assert_chain_calls(mock.call.select_related('baz'))...
mock_django/shared.py
def assert_chain_calls(self, *calls): """ Asserts that a chained method was called (parents in the chain do not matter, nor are they tracked). Use with `mock.call`. >>> obj.filter(foo='bar').select_related('baz') >>> obj.assert_chain_calls(mock.call.filter(foo='bar')) >...
def assert_chain_calls(self, *calls): """ Asserts that a chained method was called (parents in the chain do not matter, nor are they tracked). Use with `mock.call`. >>> obj.filter(foo='bar').select_related('baz') >>> obj.assert_chain_calls(mock.call.filter(foo='bar')) >...
[ "Asserts", "that", "a", "chained", "method", "was", "called", "(", "parents", "in", "the", "chain", "do", "not", "matter", "nor", "are", "they", "tracked", ")", ".", "Use", "with", "mock", ".", "call", "." ]
dcramer/mock-django
python
https://github.com/dcramer/mock-django/blob/1168d3255e0d67fbf74a9c71feaccbdafef59d21/mock_django/shared.py#L50-L77
[ "def", "assert_chain_calls", "(", "self", ",", "*", "calls", ")", ":", "all_calls", "=", "self", ".", "__parent", ".", "mock_calls", "[", ":", "]", "not_found", "=", "[", "]", "for", "kall", "in", "calls", ":", "try", ":", "all_calls", ".", "remove", ...
1168d3255e0d67fbf74a9c71feaccbdafef59d21
train
mock_signal_receiver
Temporarily attaches a receiver to the provided ``signal`` within the scope of the context manager. The mocked receiver is returned as the ``as`` target of the ``with`` statement. To have the mocked receiver wrap a callable, pass the callable as the ``wraps`` keyword argument. All other keyword ar...
mock_django/signals.py
def mock_signal_receiver(signal, wraps=None, **kwargs): """ Temporarily attaches a receiver to the provided ``signal`` within the scope of the context manager. The mocked receiver is returned as the ``as`` target of the ``with`` statement. To have the mocked receiver wrap a callable, pass the ...
def mock_signal_receiver(signal, wraps=None, **kwargs): """ Temporarily attaches a receiver to the provided ``signal`` within the scope of the context manager. The mocked receiver is returned as the ``as`` target of the ``with`` statement. To have the mocked receiver wrap a callable, pass the ...
[ "Temporarily", "attaches", "a", "receiver", "to", "the", "provided", "signal", "within", "the", "scope", "of", "the", "context", "manager", "." ]
dcramer/mock-django
python
https://github.com/dcramer/mock-django/blob/1168d3255e0d67fbf74a9c71feaccbdafef59d21/mock_django/signals.py#L13-L36
[ "def", "mock_signal_receiver", "(", "signal", ",", "wraps", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "wraps", "is", "None", ":", "def", "wraps", "(", "*", "args", ",", "*", "*", "kwrags", ")", ":", "return", "None", "receiver", "=", "m...
1168d3255e0d67fbf74a9c71feaccbdafef59d21
train
QuerySetMock
Get a SharedMock that returns self for most attributes and a new copy of itself for any method that ordinarily generates QuerySets. Set the results to two items: >>> class Post(object): pass >>> objects = QuerySetMock(Post, 'return', 'values') >>> assert list(objects.filter()) == list(objects.all(...
mock_django/query.py
def QuerySetMock(model, *return_value): """ Get a SharedMock that returns self for most attributes and a new copy of itself for any method that ordinarily generates QuerySets. Set the results to two items: >>> class Post(object): pass >>> objects = QuerySetMock(Post, 'return', 'values') >>...
def QuerySetMock(model, *return_value): """ Get a SharedMock that returns self for most attributes and a new copy of itself for any method that ordinarily generates QuerySets. Set the results to two items: >>> class Post(object): pass >>> objects = QuerySetMock(Post, 'return', 'values') >>...
[ "Get", "a", "SharedMock", "that", "returns", "self", "for", "most", "attributes", "and", "a", "new", "copy", "of", "itself", "for", "any", "method", "that", "ordinarily", "generates", "QuerySets", "." ]
dcramer/mock-django
python
https://github.com/dcramer/mock-django/blob/1168d3255e0d67fbf74a9c71feaccbdafef59d21/mock_django/query.py#L21-L109
[ "def", "QuerySetMock", "(", "model", ",", "*", "return_value", ")", ":", "def", "make_get", "(", "self", ",", "model", ")", ":", "def", "_get", "(", "*", "a", ",", "*", "*", "k", ")", ":", "results", "=", "list", "(", "self", ")", "if", "len", ...
1168d3255e0d67fbf74a9c71feaccbdafef59d21
train
FlaskIni.read
Overridden read() method to call parse_flask_section() at the end
flask_ini.py
def read(self, *args, **kwargs): '''Overridden read() method to call parse_flask_section() at the end''' ret = configparser.SafeConfigParser.read(self, *args, **kwargs) self.parse_flask_section() return ret
def read(self, *args, **kwargs): '''Overridden read() method to call parse_flask_section() at the end''' ret = configparser.SafeConfigParser.read(self, *args, **kwargs) self.parse_flask_section() return ret
[ "Overridden", "read", "()", "method", "to", "call", "parse_flask_section", "()", "at", "the", "end" ]
trendmicro/flask-ini
python
https://github.com/trendmicro/flask-ini/blob/a1e4baa598c9a01021a1333d9c15e4d99c8334dd/flask_ini.py#L12-L16
[ "def", "read", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "configparser", ".", "SafeConfigParser", ".", "read", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "parse_flask_section", "(", ...
a1e4baa598c9a01021a1333d9c15e4d99c8334dd
train
FlaskIni.readfp
Overridden readfp() method to call parse_flask_section() at the end
flask_ini.py
def readfp(self, *args, **kwargs): '''Overridden readfp() method to call parse_flask_section() at the end''' ret = configparser.SafeConfigParser.readfp(self, *args, **kwargs) self.parse_flask_section() return ret
def readfp(self, *args, **kwargs): '''Overridden readfp() method to call parse_flask_section() at the end''' ret = configparser.SafeConfigParser.readfp(self, *args, **kwargs) self.parse_flask_section() return ret
[ "Overridden", "readfp", "()", "method", "to", "call", "parse_flask_section", "()", "at", "the", "end" ]
trendmicro/flask-ini
python
https://github.com/trendmicro/flask-ini/blob/a1e4baa598c9a01021a1333d9c15e4d99c8334dd/flask_ini.py#L18-L23
[ "def", "readfp", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "configparser", ".", "SafeConfigParser", ".", "readfp", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "parse_flask_section", "(...
a1e4baa598c9a01021a1333d9c15e4d99c8334dd
train
FlaskIni.parse_flask_section
Parse the [flask] section of your config and hand off the config to the app in context. Config vars should have the same name as their flask equivalent except in all lower-case.
flask_ini.py
def parse_flask_section(self): '''Parse the [flask] section of your config and hand off the config to the app in context. Config vars should have the same name as their flask equivalent except in all lower-case.''' if self.has_section('flask'): for item in self.items...
def parse_flask_section(self): '''Parse the [flask] section of your config and hand off the config to the app in context. Config vars should have the same name as their flask equivalent except in all lower-case.''' if self.has_section('flask'): for item in self.items...
[ "Parse", "the", "[", "flask", "]", "section", "of", "your", "config", "and", "hand", "off", "the", "config", "to", "the", "app", "in", "context", "." ]
trendmicro/flask-ini
python
https://github.com/trendmicro/flask-ini/blob/a1e4baa598c9a01021a1333d9c15e4d99c8334dd/flask_ini.py#L25-L35
[ "def", "parse_flask_section", "(", "self", ")", ":", "if", "self", ".", "has_section", "(", "'flask'", ")", ":", "for", "item", "in", "self", ".", "items", "(", "'flask'", ")", ":", "self", ".", "_load_item", "(", "item", "[", "0", "]", ")", "else", ...
a1e4baa598c9a01021a1333d9c15e4d99c8334dd
train
FlaskIni._load_item
Load the specified item from the [flask] section. Type is determined by the type of the equivalent value in app.default_config or string if unknown.
flask_ini.py
def _load_item(self, key): '''Load the specified item from the [flask] section. Type is determined by the type of the equivalent value in app.default_config or string if unknown.''' key_u = key.upper() default = current_app.default_config.get(key_u) # One of the defaul...
def _load_item(self, key): '''Load the specified item from the [flask] section. Type is determined by the type of the equivalent value in app.default_config or string if unknown.''' key_u = key.upper() default = current_app.default_config.get(key_u) # One of the defaul...
[ "Load", "the", "specified", "item", "from", "the", "[", "flask", "]", "section", ".", "Type", "is", "determined", "by", "the", "type", "of", "the", "equivalent", "value", "in", "app", ".", "default_config", "or", "string", "if", "unknown", "." ]
trendmicro/flask-ini
python
https://github.com/trendmicro/flask-ini/blob/a1e4baa598c9a01021a1333d9c15e4d99c8334dd/flask_ini.py#L38-L58
[ "def", "_load_item", "(", "self", ",", "key", ")", ":", "key_u", "=", "key", ".", "upper", "(", ")", "default", "=", "current_app", ".", "default_config", ".", "get", "(", "key_u", ")", "# One of the default config vars is a timedelta - interpret it", "# as an int...
a1e4baa598c9a01021a1333d9c15e4d99c8334dd