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
valid
raise_hostname
Raises a TLSVerificationError due to a hostname mismatch :param certificate: An asn1crypto.x509.Certificate object :raises: TLSVerificationError
oscrypto/_tls.py
def raise_hostname(certificate, hostname): """ Raises a TLSVerificationError due to a hostname mismatch :param certificate: An asn1crypto.x509.Certificate object :raises: TLSVerificationError """ is_ip = re.match('^\\d+\\.\\d+\\.\\d+\\.\\d+$', hostname) or hostname.find(':') !...
def raise_hostname(certificate, hostname): """ Raises a TLSVerificationError due to a hostname mismatch :param certificate: An asn1crypto.x509.Certificate object :raises: TLSVerificationError """ is_ip = re.match('^\\d+\\.\\d+\\.\\d+\\.\\d+$', hostname) or hostname.find(':') !...
[ "Raises", "a", "TLSVerificationError", "due", "to", "a", "hostname", "mismatch" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L352-L377
[ "def", "raise_hostname", "(", "certificate", ",", "hostname", ")", ":", "is_ip", "=", "re", ".", "match", "(", "'^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\\.\\\\d+$'", ",", "hostname", ")", "or", "hostname", ".", "find", "(", "':'", ")", "!=", "-", "1", "if", "is_ip",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
raise_expired_not_yet_valid
Raises a TLSVerificationError due to certificate being expired, or not yet being valid :param certificate: An asn1crypto.x509.Certificate object :raises: TLSVerificationError
oscrypto/_tls.py
def raise_expired_not_yet_valid(certificate): """ Raises a TLSVerificationError due to certificate being expired, or not yet being valid :param certificate: An asn1crypto.x509.Certificate object :raises: TLSVerificationError """ validity = certificate['tbs_certificate']['v...
def raise_expired_not_yet_valid(certificate): """ Raises a TLSVerificationError due to certificate being expired, or not yet being valid :param certificate: An asn1crypto.x509.Certificate object :raises: TLSVerificationError """ validity = certificate['tbs_certificate']['v...
[ "Raises", "a", "TLSVerificationError", "due", "to", "certificate", "being", "expired", "or", "not", "yet", "being", "valid" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L470-L495
[ "def", "raise_expired_not_yet_valid", "(", "certificate", ")", ":", "validity", "=", "certificate", "[", "'tbs_certificate'", "]", "[", "'validity'", "]", "not_after", "=", "validity", "[", "'not_after'", "]", ".", "native", "not_before", "=", "validity", "[", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
detect_other_protocol
Looks at the server handshake bytes to try and detect a different protocol :param server_handshake_bytes: A byte string of the handshake data received from the server :return: None, or a unicode string of "ftp", "http", "imap", "pop3", "smtp"
oscrypto/_tls.py
def detect_other_protocol(server_handshake_bytes): """ Looks at the server handshake bytes to try and detect a different protocol :param server_handshake_bytes: A byte string of the handshake data received from the server :return: None, or a unicode string of "ftp", "http", "imap", "po...
def detect_other_protocol(server_handshake_bytes): """ Looks at the server handshake bytes to try and detect a different protocol :param server_handshake_bytes: A byte string of the handshake data received from the server :return: None, or a unicode string of "ftp", "http", "imap", "po...
[ "Looks", "at", "the", "server", "handshake", "bytes", "to", "try", "and", "detect", "a", "different", "protocol" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L561-L590
[ "def", "detect_other_protocol", "(", "server_handshake_bytes", ")", ":", "if", "server_handshake_bytes", "[", "0", ":", "5", "]", "==", "b'HTTP/'", ":", "return", "'HTTP'", "if", "server_handshake_bytes", "[", "0", ":", "4", "]", "==", "b'220 '", ":", "if", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
constant_compare
Compares two byte strings in constant time to see if they are equal :param a: The first byte string :param b: The second byte string :return: A boolean if the two byte strings are equal
oscrypto/util.py
def constant_compare(a, b): """ Compares two byte strings in constant time to see if they are equal :param a: The first byte string :param b: The second byte string :return: A boolean if the two byte strings are equal """ if not isinstance(a, byte_cls): ra...
def constant_compare(a, b): """ Compares two byte strings in constant time to see if they are equal :param a: The first byte string :param b: The second byte string :return: A boolean if the two byte strings are equal """ if not isinstance(a, byte_cls): ra...
[ "Compares", "two", "byte", "strings", "in", "constant", "time", "to", "see", "if", "they", "are", "equal" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/util.py#L23-L63
[ "def", "constant_compare", "(", "a", ",", "b", ")", ":", "if", "not", "isinstance", "(", "a", ",", "byte_cls", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n a must be a byte string, not %s\n '''", ",", "type_name", "(", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_try_decode
Tries decoding a byte string from the OS into a unicode string :param byte_string: A byte string :return: A unicode string
oscrypto/_win/_decode.py
def _try_decode(byte_string): """ Tries decoding a byte string from the OS into a unicode string :param byte_string: A byte string :return: A unicode string """ try: return str_cls(byte_string, _encoding) # If the "correct" encoding did not work, try some defaults...
def _try_decode(byte_string): """ Tries decoding a byte string from the OS into a unicode string :param byte_string: A byte string :return: A unicode string """ try: return str_cls(byte_string, _encoding) # If the "correct" encoding did not work, try some defaults...
[ "Tries", "decoding", "a", "byte", "string", "from", "the", "OS", "into", "a", "unicode", "string" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/_decode.py#L13-L36
[ "def", "_try_decode", "(", "byte_string", ")", ":", "try", ":", "return", "str_cls", "(", "byte_string", ",", "_encoding", ")", "# If the \"correct\" encoding did not work, try some defaults, and then just", "# obliterate characters that we can't seen to decode properly", "except",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_read_callback
Callback called by Secure Transport to actually read the socket :param connection_id: An integer identifing the connection :param data_buffer: A char pointer FFI type to write the data to :param data_length_pointer: A size_t pointer FFI type of the amount of data to read. Will be ...
oscrypto/_osx/tls.py
def _read_callback(connection_id, data_buffer, data_length_pointer): """ Callback called by Secure Transport to actually read the socket :param connection_id: An integer identifing the connection :param data_buffer: A char pointer FFI type to write the data to :param data_length_p...
def _read_callback(connection_id, data_buffer, data_length_pointer): """ Callback called by Secure Transport to actually read the socket :param connection_id: An integer identifing the connection :param data_buffer: A char pointer FFI type to write the data to :param data_length_p...
[ "Callback", "called", "by", "Secure", "Transport", "to", "actually", "read", "the", "socket" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L99-L187
[ "def", "_read_callback", "(", "connection_id", ",", "data_buffer", ",", "data_length_pointer", ")", ":", "self", "=", "None", "try", ":", "self", "=", "_connection_refs", ".", "get", "(", "connection_id", ")", "if", "not", "self", ":", "socket", "=", "_socke...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_read_remaining
Reads everything available from the socket - used for debugging when there is a protocol error :param socket: The socket to read from :return: A byte string of the remaining data
oscrypto/_osx/tls.py
def _read_remaining(socket): """ Reads everything available from the socket - used for debugging when there is a protocol error :param socket: The socket to read from :return: A byte string of the remaining data """ output = b'' old_timeout = socket.gettimeout() tr...
def _read_remaining(socket): """ Reads everything available from the socket - used for debugging when there is a protocol error :param socket: The socket to read from :return: A byte string of the remaining data """ output = b'' old_timeout = socket.gettimeout() tr...
[ "Reads", "everything", "available", "from", "the", "socket", "-", "used", "for", "debugging", "when", "there", "is", "a", "protocol", "error" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L190-L211
[ "def", "_read_remaining", "(", "socket", ")", ":", "output", "=", "b''", "old_timeout", "=", "socket", ".", "gettimeout", "(", ")", "try", ":", "socket", ".", "settimeout", "(", "0.0", ")", "output", "+=", "socket", ".", "recv", "(", "8192", ")", "exce...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_write_callback
Callback called by Secure Transport to actually write to the socket :param connection_id: An integer identifing the connection :param data_buffer: A char pointer FFI type containing the data to write :param data_length_pointer: A size_t pointer FFI type of the amount of data to wr...
oscrypto/_osx/tls.py
def _write_callback(connection_id, data_buffer, data_length_pointer): """ Callback called by Secure Transport to actually write to the socket :param connection_id: An integer identifing the connection :param data_buffer: A char pointer FFI type containing the data to write :param ...
def _write_callback(connection_id, data_buffer, data_length_pointer): """ Callback called by Secure Transport to actually write to the socket :param connection_id: An integer identifing the connection :param data_buffer: A char pointer FFI type containing the data to write :param ...
[ "Callback", "called", "by", "Secure", "Transport", "to", "actually", "write", "to", "the", "socket" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L214-L266
[ "def", "_write_callback", "(", "connection_id", ",", "data_buffer", ",", "data_length_pointer", ")", ":", "try", ":", "self", "=", "_connection_refs", ".", "get", "(", "connection_id", ")", "if", "not", "self", ":", "socket", "=", "_socket_refs", ".", "get", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket._handshake
Perform an initial TLS handshake
oscrypto/_osx/tls.py
def _handshake(self): """ Perform an initial TLS handshake """ session_context = None ssl_policy_ref = None crl_search_ref = None crl_policy_ref = None ocsp_search_ref = None ocsp_policy_ref = None policy_array_ref = None try: ...
def _handshake(self): """ Perform an initial TLS handshake """ session_context = None ssl_policy_ref = None crl_search_ref = None crl_policy_ref = None ocsp_search_ref = None ocsp_policy_ref = None policy_array_ref = None try: ...
[ "Perform", "an", "initial", "TLS", "handshake" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L531-L1004
[ "def", "_handshake", "(", "self", ")", ":", "session_context", "=", "None", "ssl_policy_ref", "=", "None", "crl_search_ref", "=", "None", "crl_policy_ref", "=", "None", "ocsp_search_ref", "=", "None", "ocsp_policy_ref", "=", "None", "policy_array_ref", "=", "None"...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.read
Reads data from the TLS-wrapped socket :param max_length: The number of bytes to read - output may be less than this :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs oscrypto.errors.TL...
oscrypto/_osx/tls.py
def read(self, max_length): """ Reads data from the TLS-wrapped socket :param max_length: The number of bytes to read - output may be less than this :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-rel...
def read(self, max_length): """ Reads data from the TLS-wrapped socket :param max_length: The number of bytes to read - output may be less than this :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-rel...
[ "Reads", "data", "from", "the", "TLS", "-", "wrapped", "socket" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L1006-L1087
[ "def", "read", "(", "self", ",", "max_length", ")", ":", "if", "not", "isinstance", "(", "max_length", ",", "int_types", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n max_length must be an integer, not %s\n '''", ",", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.read_until
Reads data from the socket until a marker is found. Data read includes the marker. :param marker: A byte string or regex object from re.compile(). Used to determine when to stop reading. Regex objects are more inefficient since they must scan the entire byte string o...
oscrypto/_osx/tls.py
def read_until(self, marker): """ Reads data from the socket until a marker is found. Data read includes the marker. :param marker: A byte string or regex object from re.compile(). Used to determine when to stop reading. Regex objects are more inefficient since ...
def read_until(self, marker): """ Reads data from the socket until a marker is found. Data read includes the marker. :param marker: A byte string or regex object from re.compile(). Used to determine when to stop reading. Regex objects are more inefficient since ...
[ "Reads", "data", "from", "the", "socket", "until", "a", "marker", "is", "found", ".", "Data", "read", "includes", "the", "marker", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L1109-L1163
[ "def", "read_until", "(", "self", ",", "marker", ")", ":", "if", "not", "isinstance", "(", "marker", ",", "byte_cls", ")", "and", "not", "isinstance", "(", "marker", ",", "Pattern", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket._os_buffered_size
Returns the number of bytes of decrypted data stored in the Secure Transport read buffer. This amount of data can be read from SSLRead() without calling self._socket.recv(). :return: An integer - the number of available bytes
oscrypto/_osx/tls.py
def _os_buffered_size(self): """ Returns the number of bytes of decrypted data stored in the Secure Transport read buffer. This amount of data can be read from SSLRead() without calling self._socket.recv(). :return: An integer - the number of available bytes ...
def _os_buffered_size(self): """ Returns the number of bytes of decrypted data stored in the Secure Transport read buffer. This amount of data can be read from SSLRead() without calling self._socket.recv(). :return: An integer - the number of available bytes ...
[ "Returns", "the", "number", "of", "bytes", "of", "decrypted", "data", "stored", "in", "the", "Secure", "Transport", "read", "buffer", ".", "This", "amount", "of", "data", "can", "be", "read", "from", "SSLRead", "()", "without", "calling", "self", ".", "_so...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L1165-L1182
[ "def", "_os_buffered_size", "(", "self", ")", ":", "num_bytes_pointer", "=", "new", "(", "Security", ",", "'size_t *'", ")", "result", "=", "Security", ".", "SSLGetBufferedReadSize", "(", "self", ".", "_session_context", ",", "num_bytes_pointer", ")", "handle_sec_...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.write
Writes data to the TLS-wrapped socket :param data: A byte string to write to the socket :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs oscrypto.errors.TLSDisconnectError - when the c...
oscrypto/_osx/tls.py
def write(self, data): """ Writes data to the TLS-wrapped socket :param data: A byte string to write to the socket :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs oscr...
def write(self, data): """ Writes data to the TLS-wrapped socket :param data: A byte string to write to the socket :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs oscr...
[ "Writes", "data", "to", "the", "TLS", "-", "wrapped", "socket" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L1214-L1255
[ "def", "write", "(", "self", ",", "data", ")", ":", "if", "self", ".", "_session_context", "is", "None", ":", "self", ".", "_raise_closed", "(", ")", "processed_pointer", "=", "new", "(", "Security", ",", "'size_t *'", ")", "data_len", "=", "len", "(", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket._shutdown
Shuts down the TLS session and then shuts down the underlying socket :param manual: A boolean if the connection was manually shutdown
oscrypto/_osx/tls.py
def _shutdown(self, manual): """ Shuts down the TLS session and then shuts down the underlying socket :param manual: A boolean if the connection was manually shutdown """ if self._session_context is None: return # Ignore error during close in ca...
def _shutdown(self, manual): """ Shuts down the TLS session and then shuts down the underlying socket :param manual: A boolean if the connection was manually shutdown """ if self._session_context is None: return # Ignore error during close in ca...
[ "Shuts", "down", "the", "TLS", "session", "and", "then", "shuts", "down", "the", "underlying", "socket" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L1273-L1302
[ "def", "_shutdown", "(", "self", ",", "manual", ")", ":", "if", "self", ".", "_session_context", "is", "None", ":", "return", "# Ignore error during close in case other end closed already", "result", "=", "Security", ".", "SSLClose", "(", "self", ".", "_session_cont...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.close
Shuts down the TLS session and socket and forcibly closes it
oscrypto/_osx/tls.py
def close(self): """ Shuts down the TLS session and socket and forcibly closes it """ try: self.shutdown() finally: if self._socket: try: self._socket.close() except (socket_.error): ...
def close(self): """ Shuts down the TLS session and socket and forcibly closes it """ try: self.shutdown() finally: if self._socket: try: self._socket.close() except (socket_.error): ...
[ "Shuts", "down", "the", "TLS", "session", "and", "socket", "and", "forcibly", "closes", "it" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L1311-L1328
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "shutdown", "(", ")", "finally", ":", "if", "self", ".", "_socket", ":", "try", ":", "self", ".", "_socket", ".", "close", "(", ")", "except", "(", "socket_", ".", "error", ")", ":",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket._read_certificates
Reads end-entity and intermediate certificate information from the TLS session
oscrypto/_osx/tls.py
def _read_certificates(self): """ Reads end-entity and intermediate certificate information from the TLS session """ trust_ref = None cf_data_ref = None result = None try: trust_ref_pointer = new(Security, 'SecTrustRef *') result ...
def _read_certificates(self): """ Reads end-entity and intermediate certificate information from the TLS session """ trust_ref = None cf_data_ref = None result = None try: trust_ref_pointer = new(Security, 'SecTrustRef *') result ...
[ "Reads", "end", "-", "entity", "and", "intermediate", "certificate", "information", "from", "the", "TLS", "session" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L1330-L1380
[ "def", "_read_certificates", "(", "self", ")", ":", "trust_ref", "=", "None", "cf_data_ref", "=", "None", "result", "=", "None", "try", ":", "trust_ref_pointer", "=", "new", "(", "Security", ",", "'SecTrustRef *'", ")", "result", "=", "Security", ".", "SSLCo...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.certificate
An asn1crypto.x509.Certificate object of the end-entity certificate presented by the server
oscrypto/_osx/tls.py
def certificate(self): """ An asn1crypto.x509.Certificate object of the end-entity certificate presented by the server """ if self._session_context is None: self._raise_closed() if self._certificate is None: self._read_certificates() ret...
def certificate(self): """ An asn1crypto.x509.Certificate object of the end-entity certificate presented by the server """ if self._session_context is None: self._raise_closed() if self._certificate is None: self._read_certificates() ret...
[ "An", "asn1crypto", ".", "x509", ".", "Certificate", "object", "of", "the", "end", "-", "entity", "certificate", "presented", "by", "the", "server" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L1396-L1408
[ "def", "certificate", "(", "self", ")", ":", "if", "self", ".", "_session_context", "is", "None", ":", "self", ".", "_raise_closed", "(", ")", "if", "self", ".", "_certificate", "is", "None", ":", "self", ".", "_read_certificates", "(", ")", "return", "s...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.intermediates
A list of asn1crypto.x509.Certificate objects that were presented as intermediates by the server
oscrypto/_osx/tls.py
def intermediates(self): """ A list of asn1crypto.x509.Certificate objects that were presented as intermediates by the server """ if self._session_context is None: self._raise_closed() if self._certificate is None: self._read_certificates() ...
def intermediates(self): """ A list of asn1crypto.x509.Certificate objects that were presented as intermediates by the server """ if self._session_context is None: self._raise_closed() if self._certificate is None: self._read_certificates() ...
[ "A", "list", "of", "asn1crypto", ".", "x509", ".", "Certificate", "objects", "that", "were", "presented", "as", "intermediates", "by", "the", "server" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/tls.py#L1411-L1423
[ "def", "intermediates", "(", "self", ")", ":", "if", "self", ".", "_session_context", "is", "None", ":", "self", ".", "_raise_closed", "(", ")", "if", "self", ".", "_certificate", "is", "None", ":", "self", ".", "_read_certificates", "(", ")", "return", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
get_path
Get the filesystem path to a file that contains OpenSSL-compatible CA certs. On OS X and Windows, there are extracted from the system certificate store and cached in a file on the filesystem. This path should not be writable by other users, otherwise they could inject CA certs into the trust list. :pa...
oscrypto/trust_list.py
def get_path(temp_dir=None, cache_length=24, cert_callback=None): """ Get the filesystem path to a file that contains OpenSSL-compatible CA certs. On OS X and Windows, there are extracted from the system certificate store and cached in a file on the filesystem. This path should not be writable by o...
def get_path(temp_dir=None, cache_length=24, cert_callback=None): """ Get the filesystem path to a file that contains OpenSSL-compatible CA certs. On OS X and Windows, there are extracted from the system certificate store and cached in a file on the filesystem. This path should not be writable by o...
[ "Get", "the", "filesystem", "path", "to", "a", "file", "that", "contains", "OpenSSL", "-", "compatible", "CA", "certs", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/trust_list.py#L67-L140
[ "def", "get_path", "(", "temp_dir", "=", "None", ",", "cache_length", "=", "24", ",", "cert_callback", "=", "None", ")", ":", "ca_path", ",", "temp", "=", "_ca_path", "(", "temp_dir", ")", "# Windows and OS X", "if", "temp", "and", "_cached_path_needs_update",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
get_list
Retrieves (and caches in memory) the list of CA certs from the OS. Includes trust information from the OS - purposes the certificate should be trusted or rejected for. Trust information is encoded via object identifiers (OIDs) that are sourced from various RFCs and vendors (Apple and Microsoft). This t...
oscrypto/trust_list.py
def get_list(cache_length=24, map_vendor_oids=True, cert_callback=None): """ Retrieves (and caches in memory) the list of CA certs from the OS. Includes trust information from the OS - purposes the certificate should be trusted or rejected for. Trust information is encoded via object identifiers (O...
def get_list(cache_length=24, map_vendor_oids=True, cert_callback=None): """ Retrieves (and caches in memory) the list of CA certs from the OS. Includes trust information from the OS - purposes the certificate should be trusted or rejected for. Trust information is encoded via object identifiers (O...
[ "Retrieves", "(", "and", "caches", "in", "memory", ")", "the", "list", "of", "CA", "certs", "from", "the", "OS", ".", "Includes", "trust", "information", "from", "the", "OS", "-", "purposes", "the", "certificate", "should", "be", "trusted", "or", "rejected...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/trust_list.py#L143-L209
[ "def", "get_list", "(", "cache_length", "=", "24", ",", "map_vendor_oids", "=", "True", ",", "cert_callback", "=", "None", ")", ":", "if", "not", "_in_memory_up_to_date", "(", "cache_length", ")", ":", "with", "memory_lock", ":", "if", "not", "_in_memory_up_to...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
clear_cache
Clears any cached info that was exported from the OS trust store. This will ensure the latest changes are returned from calls to get_list() and get_path(), but at the expense of re-exporting and parsing all certificates. :param temp_dir: The temporary directory to cache the CA certs in on OS X and ...
oscrypto/trust_list.py
def clear_cache(temp_dir=None): """ Clears any cached info that was exported from the OS trust store. This will ensure the latest changes are returned from calls to get_list() and get_path(), but at the expense of re-exporting and parsing all certificates. :param temp_dir: The temporary dir...
def clear_cache(temp_dir=None): """ Clears any cached info that was exported from the OS trust store. This will ensure the latest changes are returned from calls to get_list() and get_path(), but at the expense of re-exporting and parsing all certificates. :param temp_dir: The temporary dir...
[ "Clears", "any", "cached", "info", "that", "was", "exported", "from", "the", "OS", "trust", "store", ".", "This", "will", "ensure", "the", "latest", "changes", "are", "returned", "from", "calls", "to", "get_list", "()", "and", "get_path", "()", "but", "at"...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/trust_list.py#L212-L232
[ "def", "clear_cache", "(", "temp_dir", "=", "None", ")", ":", "with", "memory_lock", ":", "_module_values", "[", "'last_update'", "]", "=", "None", "_module_values", "[", "'certs'", "]", "=", "None", "ca_path", ",", "temp", "=", "_ca_path", "(", "temp_dir", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_ca_path
Returns the file path to the CA certs file :param temp_dir: The temporary directory to cache the CA certs in on OS X and Windows. Needs to have secure permissions so other users can not modify the contents. :return: A 2-element tuple: - 0: A unicode string of the file ...
oscrypto/trust_list.py
def _ca_path(temp_dir=None): """ Returns the file path to the CA certs file :param temp_dir: The temporary directory to cache the CA certs in on OS X and Windows. Needs to have secure permissions so other users can not modify the contents. :return: A 2-element tuple: ...
def _ca_path(temp_dir=None): """ Returns the file path to the CA certs file :param temp_dir: The temporary directory to cache the CA certs in on OS X and Windows. Needs to have secure permissions so other users can not modify the contents. :return: A 2-element tuple: ...
[ "Returns", "the", "file", "path", "to", "the", "CA", "certs", "file" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/trust_list.py#L235-L268
[ "def", "_ca_path", "(", "temp_dir", "=", "None", ")", ":", "ca_path", "=", "system_path", "(", ")", "# Windows and OS X", "if", "ca_path", "is", "None", ":", "if", "temp_dir", "is", "None", ":", "temp_dir", "=", "tempfile", ".", "gettempdir", "(", ")", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_map_oids
Takes a set of unicode string OIDs and converts vendor-specific OIDs into generics OIDs from RFCs. - 1.2.840.113635.100.1.3 (apple_ssl) -> 1.3.6.1.5.5.7.3.1 (server_auth) - 1.2.840.113635.100.1.3 (apple_ssl) -> 1.3.6.1.5.5.7.3.2 (client_auth) - 1.2.840.113635.100.1.8 (apple_smime) -> 1.3.6.1.5.5.7.3...
oscrypto/trust_list.py
def _map_oids(oids): """ Takes a set of unicode string OIDs and converts vendor-specific OIDs into generics OIDs from RFCs. - 1.2.840.113635.100.1.3 (apple_ssl) -> 1.3.6.1.5.5.7.3.1 (server_auth) - 1.2.840.113635.100.1.3 (apple_ssl) -> 1.3.6.1.5.5.7.3.2 (client_auth) - 1.2.840.113635.100.1.8...
def _map_oids(oids): """ Takes a set of unicode string OIDs and converts vendor-specific OIDs into generics OIDs from RFCs. - 1.2.840.113635.100.1.3 (apple_ssl) -> 1.3.6.1.5.5.7.3.1 (server_auth) - 1.2.840.113635.100.1.3 (apple_ssl) -> 1.3.6.1.5.5.7.3.2 (client_auth) - 1.2.840.113635.100.1.8...
[ "Takes", "a", "set", "of", "unicode", "string", "OIDs", "and", "converts", "vendor", "-", "specific", "OIDs", "into", "generics", "OIDs", "from", "RFCs", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/trust_list.py#L271-L300
[ "def", "_map_oids", "(", "oids", ")", ":", "new_oids", "=", "set", "(", ")", "for", "oid", "in", "oids", ":", "if", "oid", "in", "_oid_map", ":", "new_oids", "|=", "_oid_map", "[", "oid", "]", "return", "oids", "|", "new_oids" ]
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_cached_path_needs_update
Checks to see if a cache file needs to be refreshed :param ca_path: A unicode string of the path to the cache file :param cache_length: An integer representing the number of hours the cache is valid for :return: A boolean - True if the cache needs to be updated, False if the file ...
oscrypto/trust_list.py
def _cached_path_needs_update(ca_path, cache_length): """ Checks to see if a cache file needs to be refreshed :param ca_path: A unicode string of the path to the cache file :param cache_length: An integer representing the number of hours the cache is valid for :return: A b...
def _cached_path_needs_update(ca_path, cache_length): """ Checks to see if a cache file needs to be refreshed :param ca_path: A unicode string of the path to the cache file :param cache_length: An integer representing the number of hours the cache is valid for :return: A b...
[ "Checks", "to", "see", "if", "a", "cache", "file", "needs", "to", "be", "refreshed" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/trust_list.py#L303-L330
[ "def", "_cached_path_needs_update", "(", "ca_path", ",", "cache_length", ")", ":", "exists", "=", "os", ".", "path", ".", "exists", "(", "ca_path", ")", "if", "not", "exists", ":", "return", "True", "stats", "=", "os", ".", "stat", "(", "ca_path", ")", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
rand_bytes
Returns a number of random bytes suitable for cryptographic purposes :param length: The desired number of bytes :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are of the wrong type OSError - when an error is retu...
oscrypto/_rand.py
def rand_bytes(length): """ Returns a number of random bytes suitable for cryptographic purposes :param length: The desired number of bytes :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are of the wrong type ...
def rand_bytes(length): """ Returns a number of random bytes suitable for cryptographic purposes :param length: The desired number of bytes :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are of the wrong type ...
[ "Returns", "a", "number", "of", "random", "bytes", "suitable", "for", "cryptographic", "purposes" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_rand.py#L15-L45
[ "def", "rand_bytes", "(", "length", ")", ":", "if", "not", "isinstance", "(", "length", ",", "int_types", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n length must be an integer, not %s\n '''", ",", "type_name", "(", "length"...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
pbkdf2
Implements PBKDF2 from PKCS#5 v2.2 in pure Python :param hash_algorithm: The string name of the hash algorithm to use: "md5", "sha1", "sha224", "sha256", "sha384", "sha512" :param password: A byte string of the password to use an input to the KDF :param salt: A cryptograph...
oscrypto/_pkcs5.py
def pbkdf2(hash_algorithm, password, salt, iterations, key_length): """ Implements PBKDF2 from PKCS#5 v2.2 in pure Python :param hash_algorithm: The string name of the hash algorithm to use: "md5", "sha1", "sha224", "sha256", "sha384", "sha512" :param password: A byte string of...
def pbkdf2(hash_algorithm, password, salt, iterations, key_length): """ Implements PBKDF2 from PKCS#5 v2.2 in pure Python :param hash_algorithm: The string name of the hash algorithm to use: "md5", "sha1", "sha224", "sha256", "sha384", "sha512" :param password: A byte string of...
[ "Implements", "PBKDF2", "from", "PKCS#5", "v2", ".", "2", "in", "pure", "Python" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_pkcs5.py#L28-L140
[ "def", "pbkdf2", "(", "hash_algorithm", ",", "password", ",", "salt", ",", "iterations", ",", "key_length", ")", ":", "if", "not", "isinstance", "(", "password", ",", "byte_cls", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n pas...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
generate_pair
Generates a public/private key pair :param algorithm: The key algorithm - "rsa", "dsa" or "ec" :param bit_size: An integer - used for "rsa" and "dsa". For "rsa" the value maye be 1024, 2048, 3072 or 4096. For "dsa" the value may be 1024. :param curve: A unicode string - us...
oscrypto/_osx/asymmetric.py
def generate_pair(algorithm, bit_size=None, curve=None): """ Generates a public/private key pair :param algorithm: The key algorithm - "rsa", "dsa" or "ec" :param bit_size: An integer - used for "rsa" and "dsa". For "rsa" the value maye be 1024, 2048, 3072 or 4096. For "dsa" th...
def generate_pair(algorithm, bit_size=None, curve=None): """ Generates a public/private key pair :param algorithm: The key algorithm - "rsa", "dsa" or "ec" :param bit_size: An integer - used for "rsa" and "dsa". For "rsa" the value maye be 1024, 2048, 3072 or 4096. For "dsa" th...
[ "Generates", "a", "public", "/", "private", "key", "pair" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/asymmetric.py#L263-L420
[ "def", "generate_pair", "(", "algorithm", ",", "bit_size", "=", "None", ",", "curve", "=", "None", ")", ":", "if", "algorithm", "not", "in", "set", "(", "[", "'rsa'", ",", "'dsa'", ",", "'ec'", "]", ")", ":", "raise", "ValueError", "(", "pretty_message...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
generate_dh_parameters
Generates DH parameters for use with Diffie-Hellman key exchange. Returns a structure in the format of DHParameter defined in PKCS#3, which is also used by the OpenSSL dhparam tool. THIS CAN BE VERY TIME CONSUMING! :param bit_size: The integer bit size of the parameters to generate. Must be be...
oscrypto/_osx/asymmetric.py
def generate_dh_parameters(bit_size): """ Generates DH parameters for use with Diffie-Hellman key exchange. Returns a structure in the format of DHParameter defined in PKCS#3, which is also used by the OpenSSL dhparam tool. THIS CAN BE VERY TIME CONSUMING! :param bit_size: The integer ...
def generate_dh_parameters(bit_size): """ Generates DH parameters for use with Diffie-Hellman key exchange. Returns a structure in the format of DHParameter defined in PKCS#3, which is also used by the OpenSSL dhparam tool. THIS CAN BE VERY TIME CONSUMING! :param bit_size: The integer ...
[ "Generates", "DH", "parameters", "for", "use", "with", "Diffie", "-", "Hellman", "key", "exchange", ".", "Returns", "a", "structure", "in", "the", "format", "of", "DHParameter", "defined", "in", "PKCS#3", "which", "is", "also", "used", "by", "the", "OpenSSL"...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/asymmetric.py#L426-L529
[ "def", "generate_dh_parameters", "(", "bit_size", ")", ":", "if", "not", "isinstance", "(", "bit_size", ",", "int_types", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n bit_size must be an integer, not %s\n '''", ",", "type_name",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_load_x509
Loads an ASN.1 object of an x509 certificate into a Certificate object :param certificate: An asn1crypto.x509.Certificate object :return: A Certificate object
oscrypto/_osx/asymmetric.py
def _load_x509(certificate): """ Loads an ASN.1 object of an x509 certificate into a Certificate object :param certificate: An asn1crypto.x509.Certificate object :return: A Certificate object """ source = certificate.dump() cf_source = None try: cf_source = CF...
def _load_x509(certificate): """ Loads an ASN.1 object of an x509 certificate into a Certificate object :param certificate: An asn1crypto.x509.Certificate object :return: A Certificate object """ source = certificate.dump() cf_source = None try: cf_source = CF...
[ "Loads", "an", "ASN", ".", "1", "object", "of", "an", "x509", "certificate", "into", "a", "Certificate", "object" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/asymmetric.py#L574-L595
[ "def", "_load_x509", "(", "certificate", ")", ":", "source", "=", "certificate", ".", "dump", "(", ")", "cf_source", "=", "None", "try", ":", "cf_source", "=", "CFHelpers", ".", "cf_data_from_bytes", "(", "source", ")", "sec_key_ref", "=", "Security", ".", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_load_key
Common code to load public and private keys into PublicKey and PrivateKey objects :param key_object: An asn1crypto.keys.PublicKeyInfo or asn1crypto.keys.PrivateKeyInfo object :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of t...
oscrypto/_osx/asymmetric.py
def _load_key(key_object): """ Common code to load public and private keys into PublicKey and PrivateKey objects :param key_object: An asn1crypto.keys.PublicKeyInfo or asn1crypto.keys.PrivateKeyInfo object :raises: ValueError - when any of the parameters contain an invalid ...
def _load_key(key_object): """ Common code to load public and private keys into PublicKey and PrivateKey objects :param key_object: An asn1crypto.keys.PublicKeyInfo or asn1crypto.keys.PrivateKeyInfo object :raises: ValueError - when any of the parameters contain an invalid ...
[ "Common", "code", "to", "load", "public", "and", "private", "keys", "into", "PublicKey", "and", "PrivateKey", "objects" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/asymmetric.py#L694-L782
[ "def", "_load_key", "(", "key_object", ")", ":", "if", "key_object", ".", "algorithm", "==", "'ec'", ":", "curve_type", ",", "details", "=", "key_object", ".", "curve", "if", "curve_type", "!=", "'named'", ":", "raise", "AsymmetricKeyError", "(", "'OS X only s...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
rsa_pkcs1v15_encrypt
Encrypts a byte string using an RSA public key or certificate. Uses PKCS#1 v1.5 padding. :param certificate_or_public_key: A PublicKey or Certificate object :param data: A byte string, with a maximum length 11 bytes less than the key length (in bytes) :raises: ValueErr...
oscrypto/_osx/asymmetric.py
def rsa_pkcs1v15_encrypt(certificate_or_public_key, data): """ Encrypts a byte string using an RSA public key or certificate. Uses PKCS#1 v1.5 padding. :param certificate_or_public_key: A PublicKey or Certificate object :param data: A byte string, with a maximum length 11 bytes les...
def rsa_pkcs1v15_encrypt(certificate_or_public_key, data): """ Encrypts a byte string using an RSA public key or certificate. Uses PKCS#1 v1.5 padding. :param certificate_or_public_key: A PublicKey or Certificate object :param data: A byte string, with a maximum length 11 bytes les...
[ "Encrypts", "a", "byte", "string", "using", "an", "RSA", "public", "key", "or", "certificate", ".", "Uses", "PKCS#1", "v1", ".", "5", "padding", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/asymmetric.py#L846-L897
[ "def", "rsa_pkcs1v15_encrypt", "(", "certificate_or_public_key", ",", "data", ")", ":", "if", "not", "isinstance", "(", "certificate_or_public_key", ",", "(", "Certificate", ",", "PublicKey", ")", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
rsa_pkcs1v15_decrypt
Decrypts a byte string using an RSA private key. Uses PKCS#1 v1.5 padding. :param private_key: A PrivateKey object :param ciphertext: A byte string of the encrypted data :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the p...
oscrypto/_osx/asymmetric.py
def rsa_pkcs1v15_decrypt(private_key, ciphertext): """ Decrypts a byte string using an RSA private key. Uses PKCS#1 v1.5 padding. :param private_key: A PrivateKey object :param ciphertext: A byte string of the encrypted data :raises: ValueError - when any of the parameters...
def rsa_pkcs1v15_decrypt(private_key, ciphertext): """ Decrypts a byte string using an RSA private key. Uses PKCS#1 v1.5 padding. :param private_key: A PrivateKey object :param ciphertext: A byte string of the encrypted data :raises: ValueError - when any of the parameters...
[ "Decrypts", "a", "byte", "string", "using", "an", "RSA", "private", "key", ".", "Uses", "PKCS#1", "v1", ".", "5", "padding", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/asymmetric.py#L900-L959
[ "def", "rsa_pkcs1v15_decrypt", "(", "private_key", ",", "ciphertext", ")", ":", "if", "not", "isinstance", "(", "private_key", ",", "PrivateKey", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n private_key must an instance of the PrivateKey c...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_encrypt
Encrypts plaintext using an RSA public key or certificate :param certificate_or_public_key: A Certificate or PublicKey object :param data: The plaintext - a byte string :param padding: The padding mode to use, specified as a kSecPadding*Key value :raises: ValueError -...
oscrypto/_osx/asymmetric.py
def _encrypt(certificate_or_public_key, data, padding): """ Encrypts plaintext using an RSA public key or certificate :param certificate_or_public_key: A Certificate or PublicKey object :param data: The plaintext - a byte string :param padding: The padding mode to use, spe...
def _encrypt(certificate_or_public_key, data, padding): """ Encrypts plaintext using an RSA public key or certificate :param certificate_or_public_key: A Certificate or PublicKey object :param data: The plaintext - a byte string :param padding: The padding mode to use, spe...
[ "Encrypts", "plaintext", "using", "an", "RSA", "public", "key", "or", "certificate" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/asymmetric.py#L1009-L1090
[ "def", "_encrypt", "(", "certificate_or_public_key", ",", "data", ",", "padding", ")", ":", "if", "not", "isinstance", "(", "certificate_or_public_key", ",", "(", "Certificate", ",", "PublicKey", ")", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_decrypt
Decrypts RSA ciphertext using a private key :param private_key: A PrivateKey object :param ciphertext: The ciphertext - a byte string :param padding: The padding mode to use, specified as a kSecPadding*Key value :raises: ValueError - when any of the parameters contain...
oscrypto/_osx/asymmetric.py
def _decrypt(private_key, ciphertext, padding): """ Decrypts RSA ciphertext using a private key :param private_key: A PrivateKey object :param ciphertext: The ciphertext - a byte string :param padding: The padding mode to use, specified as a kSecPadding*Key value :rai...
def _decrypt(private_key, ciphertext, padding): """ Decrypts RSA ciphertext using a private key :param private_key: A PrivateKey object :param ciphertext: The ciphertext - a byte string :param padding: The padding mode to use, specified as a kSecPadding*Key value :rai...
[ "Decrypts", "RSA", "ciphertext", "using", "a", "private", "key" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/asymmetric.py#L1093-L1172
[ "def", "_decrypt", "(", "private_key", ",", "ciphertext", ",", "padding", ")", ":", "if", "not", "isinstance", "(", "private_key", ",", "PrivateKey", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n private_key must be an instance of the P...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
rsa_pss_verify
Verifies an RSASSA-PSS signature. For the PSS padding the mask gen algorithm will be mgf1 using the same hash algorithm as the signature. The salt length with be the length of the hash algorithm, and the trailer field with be the standard 0xBC byte. :param certificate_or_public_key: A Certifica...
oscrypto/_osx/asymmetric.py
def rsa_pss_verify(certificate_or_public_key, signature, data, hash_algorithm): """ Verifies an RSASSA-PSS signature. For the PSS padding the mask gen algorithm will be mgf1 using the same hash algorithm as the signature. The salt length with be the length of the hash algorithm, and the trailer field wi...
def rsa_pss_verify(certificate_or_public_key, signature, data, hash_algorithm): """ Verifies an RSASSA-PSS signature. For the PSS padding the mask gen algorithm will be mgf1 using the same hash algorithm as the signature. The salt length with be the length of the hash algorithm, and the trailer field wi...
[ "Verifies", "an", "RSASSA", "-", "PSS", "signature", ".", "For", "the", "PSS", "padding", "the", "mask", "gen", "algorithm", "will", "be", "mgf1", "using", "the", "same", "hash", "algorithm", "as", "the", "signature", ".", "The", "salt", "length", "with", ...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/asymmetric.py#L1209-L1278
[ "def", "rsa_pss_verify", "(", "certificate_or_public_key", ",", "signature", ",", "data", ",", "hash_algorithm", ")", ":", "if", "not", "isinstance", "(", "certificate_or_public_key", ",", "(", "Certificate", ",", "PublicKey", ")", ")", ":", "raise", "TypeError", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_verify
Verifies an RSA, DSA or ECDSA signature :param certificate_or_public_key: A Certificate or PublicKey instance to verify the signature with :param signature: A byte string of the signature to verify :param data: A byte string of the data the signature is for :param hash_algori...
oscrypto/_osx/asymmetric.py
def _verify(certificate_or_public_key, signature, data, hash_algorithm): """ Verifies an RSA, DSA or ECDSA signature :param certificate_or_public_key: A Certificate or PublicKey instance to verify the signature with :param signature: A byte string of the signature to verify :param...
def _verify(certificate_or_public_key, signature, data, hash_algorithm): """ Verifies an RSA, DSA or ECDSA signature :param certificate_or_public_key: A Certificate or PublicKey instance to verify the signature with :param signature: A byte string of the signature to verify :param...
[ "Verifies", "an", "RSA", "DSA", "or", "ECDSA", "signature" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/asymmetric.py#L1339-L1516
[ "def", "_verify", "(", "certificate_or_public_key", ",", "signature", ",", "data", ",", "hash_algorithm", ")", ":", "if", "not", "isinstance", "(", "certificate_or_public_key", ",", "(", "Certificate", ",", "PublicKey", ")", ")", ":", "raise", "TypeError", "(", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
rsa_pss_sign
Generates an RSASSA-PSS signature. For the PSS padding the mask gen algorithm will be mgf1 using the same hash algorithm as the signature. The salt length with be the length of the hash algorithm, and the trailer field with be the standard 0xBC byte. :param private_key: The PrivateKey to genera...
oscrypto/_osx/asymmetric.py
def rsa_pss_sign(private_key, data, hash_algorithm): """ Generates an RSASSA-PSS signature. For the PSS padding the mask gen algorithm will be mgf1 using the same hash algorithm as the signature. The salt length with be the length of the hash algorithm, and the trailer field with be the standard 0xB...
def rsa_pss_sign(private_key, data, hash_algorithm): """ Generates an RSASSA-PSS signature. For the PSS padding the mask gen algorithm will be mgf1 using the same hash algorithm as the signature. The salt length with be the length of the hash algorithm, and the trailer field with be the standard 0xB...
[ "Generates", "an", "RSASSA", "-", "PSS", "signature", ".", "For", "the", "PSS", "padding", "the", "mask", "gen", "algorithm", "will", "be", "mgf1", "using", "the", "same", "hash", "algorithm", "as", "the", "signature", ".", "The", "salt", "length", "with",...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/asymmetric.py#L1553-L1621
[ "def", "rsa_pss_sign", "(", "private_key", ",", "data", ",", "hash_algorithm", ")", ":", "if", "not", "isinstance", "(", "private_key", ",", "PrivateKey", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n private_key must be an instance of ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_sign
Generates an RSA, DSA or ECDSA signature :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: A unicode string of "md5", "sha1", "sha224", "sha256", "sha384" or "sha512" :r...
oscrypto/_osx/asymmetric.py
def _sign(private_key, data, hash_algorithm): """ Generates an RSA, DSA or ECDSA signature :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: A unicode string of "md5", "sha1"...
def _sign(private_key, data, hash_algorithm): """ Generates an RSA, DSA or ECDSA signature :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: A unicode string of "md5", "sha1"...
[ "Generates", "an", "RSA", "DSA", "or", "ECDSA", "signature" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/asymmetric.py#L1682-L1840
[ "def", "_sign", "(", "private_key", ",", "data", ",", "hash_algorithm", ")", ":", "if", "not", "isinstance", "(", "private_key", ",", "PrivateKey", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n private_key must be an instance of Private...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
Certificate.public_key
:return: The PublicKey object for the public key this certificate contains
oscrypto/_osx/asymmetric.py
def public_key(self): """ :return: The PublicKey object for the public key this certificate contains """ if not self._public_key and self.sec_certificate_ref: sec_public_key_ref_pointer = new(Security, 'SecKeyRef *') res = Security.SecCertificateCopyP...
def public_key(self): """ :return: The PublicKey object for the public key this certificate contains """ if not self._public_key and self.sec_certificate_ref: sec_public_key_ref_pointer = new(Security, 'SecKeyRef *') res = Security.SecCertificateCopyP...
[ ":", "return", ":", "The", "PublicKey", "object", "for", "the", "public", "key", "this", "certificate", "contains" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/asymmetric.py#L196-L209
[ "def", "public_key", "(", "self", ")", ":", "if", "not", "self", ".", "_public_key", "and", "self", ".", "sec_certificate_ref", ":", "sec_public_key_ref_pointer", "=", "new", "(", "Security", ",", "'SecKeyRef *'", ")", "res", "=", "Security", ".", "SecCertific...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
backend
:return: A unicode string of the backend being used: "openssl", "osx", "win", "winlegacy"
oscrypto/__init__.py
def backend(): """ :return: A unicode string of the backend being used: "openssl", "osx", "win", "winlegacy" """ if _module_values['backend'] is not None: return _module_values['backend'] with _backend_lock: if _module_values['backend'] is not None: retu...
def backend(): """ :return: A unicode string of the backend being used: "openssl", "osx", "win", "winlegacy" """ if _module_values['backend'] is not None: return _module_values['backend'] with _backend_lock: if _module_values['backend'] is not None: retu...
[ ":", "return", ":", "A", "unicode", "string", "of", "the", "backend", "being", "used", ":", "openssl", "osx", "win", "winlegacy" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/__init__.py#L30-L55
[ "def", "backend", "(", ")", ":", "if", "_module_values", "[", "'backend'", "]", "is", "not", "None", ":", "return", "_module_values", "[", "'backend'", "]", "with", "_backend_lock", ":", "if", "_module_values", "[", "'backend'", "]", "is", "not", "None", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
use_openssl
Forces using OpenSSL dynamic libraries on OS X (.dylib) or Windows (.dll), or using a specific dynamic library on Linux/BSD (.so). This can also be used to configure oscrypto to use LibreSSL dynamic libraries. This method must be called before any oscrypto submodules are imported. :param libcrypt...
oscrypto/__init__.py
def use_openssl(libcrypto_path, libssl_path, trust_list_path=None): """ Forces using OpenSSL dynamic libraries on OS X (.dylib) or Windows (.dll), or using a specific dynamic library on Linux/BSD (.so). This can also be used to configure oscrypto to use LibreSSL dynamic libraries. This method ...
def use_openssl(libcrypto_path, libssl_path, trust_list_path=None): """ Forces using OpenSSL dynamic libraries on OS X (.dylib) or Windows (.dll), or using a specific dynamic library on Linux/BSD (.so). This can also be used to configure oscrypto to use LibreSSL dynamic libraries. This method ...
[ "Forces", "using", "OpenSSL", "dynamic", "libraries", "on", "OS", "X", "(", ".", "dylib", ")", "or", "Windows", "(", ".", "dll", ")", "or", "using", "a", "specific", "dynamic", "library", "on", "Linux", "/", "BSD", "(", ".", "so", ")", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/__init__.py#L81-L139
[ "def", "use_openssl", "(", "libcrypto_path", ",", "libssl_path", ",", "trust_list_path", "=", "None", ")", ":", "if", "not", "isinstance", "(", "libcrypto_path", ",", "str_cls", ")", ":", "raise", "ValueError", "(", "'libcrypto_path must be a unicode string, not %s'",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
use_winlegacy
Forces use of the legacy Windows CryptoAPI. This should only be used on Windows XP or for testing. It is less full-featured than the Cryptography Next Generation (CNG) API, and as a result the elliptic curve and PSS padding features are implemented in pure Python. This isn't ideal, but it a shim for end...
oscrypto/__init__.py
def use_winlegacy(): """ Forces use of the legacy Windows CryptoAPI. This should only be used on Windows XP or for testing. It is less full-featured than the Cryptography Next Generation (CNG) API, and as a result the elliptic curve and PSS padding features are implemented in pure Python. This isn't...
def use_winlegacy(): """ Forces use of the legacy Windows CryptoAPI. This should only be used on Windows XP or for testing. It is less full-featured than the Cryptography Next Generation (CNG) API, and as a result the elliptic curve and PSS padding features are implemented in pure Python. This isn't...
[ "Forces", "use", "of", "the", "legacy", "Windows", "CryptoAPI", ".", "This", "should", "only", "be", "used", "on", "Windows", "XP", "or", "for", "testing", ".", "It", "is", "less", "full", "-", "featured", "than", "the", "Cryptography", "Next", "Generation...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/__init__.py#L142-L167
[ "def", "use_winlegacy", "(", ")", ":", "if", "sys", ".", "platform", "!=", "'win32'", ":", "plat", "=", "platform", ".", "system", "(", ")", "or", "sys", ".", "platform", "if", "plat", "==", "'Darwin'", ":", "plat", "=", "'OS X'", "raise", "Environment...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
pkcs12_kdf
KDF from RFC7292 appendix b.2 - https://tools.ietf.org/html/rfc7292#page-19 :param hash_algorithm: The string name of the hash algorithm to use: "md5", "sha1", "sha224", "sha256", "sha384", "sha512" :param password: A byte string of the password to use an input to the KDF :param s...
oscrypto/_pkcs12.py
def pkcs12_kdf(hash_algorithm, password, salt, iterations, key_length, id_): """ KDF from RFC7292 appendix b.2 - https://tools.ietf.org/html/rfc7292#page-19 :param hash_algorithm: The string name of the hash algorithm to use: "md5", "sha1", "sha224", "sha256", "sha384", "sha512" :param...
def pkcs12_kdf(hash_algorithm, password, salt, iterations, key_length, id_): """ KDF from RFC7292 appendix b.2 - https://tools.ietf.org/html/rfc7292#page-19 :param hash_algorithm: The string name of the hash algorithm to use: "md5", "sha1", "sha224", "sha256", "sha384", "sha512" :param...
[ "KDF", "from", "RFC7292", "appendix", "b", ".", "2", "-", "https", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc7292#page", "-", "19" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_pkcs12.py#L26-L198
[ "def", "pkcs12_kdf", "(", "hash_algorithm", ",", "password", ",", "salt", ",", "iterations", ",", "key_length", ",", "id_", ")", ":", "if", "not", "isinstance", "(", "password", ",", "byte_cls", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
pbkdf2_iteration_calculator
Runs pbkdf2() twice to determine the approximate number of iterations to use to hit a desired time per run. Use this on a production machine to dynamically adjust the number of iterations as high as you can. :param hash_algorithm: The string name of the hash algorithm to use: "md5", "sha1", "sha224...
oscrypto/kdf.py
def pbkdf2_iteration_calculator(hash_algorithm, key_length, target_ms=100, quiet=False): """ Runs pbkdf2() twice to determine the approximate number of iterations to use to hit a desired time per run. Use this on a production machine to dynamically adjust the number of iterations as high as you can. ...
def pbkdf2_iteration_calculator(hash_algorithm, key_length, target_ms=100, quiet=False): """ Runs pbkdf2() twice to determine the approximate number of iterations to use to hit a desired time per run. Use this on a production machine to dynamically adjust the number of iterations as high as you can. ...
[ "Runs", "pbkdf2", "()", "twice", "to", "determine", "the", "approximate", "number", "of", "iterations", "to", "use", "to", "hit", "a", "desired", "time", "per", "run", ".", "Use", "this", "on", "a", "production", "machine", "to", "dynamically", "adjust", "...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/kdf.py#L57-L157
[ "def", "pbkdf2_iteration_calculator", "(", "hash_algorithm", ",", "key_length", ",", "target_ms", "=", "100", ",", "quiet", "=", "False", ")", ":", "if", "hash_algorithm", "not", "in", "set", "(", "[", "'sha1'", ",", "'sha224'", ",", "'sha256'", ",", "'sha38...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
pbkdf1
An implementation of PBKDF1 - should only be used for interop with legacy systems, not new architectures :param hash_algorithm: The string name of the hash algorithm to use: "md2", "md5", "sha1" :param password: A byte string of the password to use an input to the KDF :param salt: ...
oscrypto/kdf.py
def pbkdf1(hash_algorithm, password, salt, iterations, key_length): """ An implementation of PBKDF1 - should only be used for interop with legacy systems, not new architectures :param hash_algorithm: The string name of the hash algorithm to use: "md2", "md5", "sha1" :param password: ...
def pbkdf1(hash_algorithm, password, salt, iterations, key_length): """ An implementation of PBKDF1 - should only be used for interop with legacy systems, not new architectures :param hash_algorithm: The string name of the hash algorithm to use: "md2", "md5", "sha1" :param password: ...
[ "An", "implementation", "of", "PBKDF1", "-", "should", "only", "be", "used", "for", "interop", "with", "legacy", "systems", "not", "new", "architectures" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/kdf.py#L160-L261
[ "def", "pbkdf1", "(", "hash_algorithm", ",", "password", ",", "salt", ",", "iterations", ",", "key_length", ")", ":", "if", "not", "isinstance", "(", "password", ",", "byte_cls", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n pas...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
handle_error
Extracts the last Windows error message into a python unicode string :param result: A function result, 0 or None indicates failure :return: A unicode string error message
oscrypto/_win/_advapi32.py
def handle_error(result): """ Extracts the last Windows error message into a python unicode string :param result: A function result, 0 or None indicates failure :return: A unicode string error message """ if result: return code, error_string = get_error() if ...
def handle_error(result): """ Extracts the last Windows error message into a python unicode string :param result: A function result, 0 or None indicates failure :return: A unicode string error message """ if result: return code, error_string = get_error() if ...
[ "Extracts", "the", "last", "Windows", "error", "message", "into", "a", "python", "unicode", "string" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/_advapi32.py#L72-L94
[ "def", "handle_error", "(", "result", ")", ":", "if", "result", ":", "return", "code", ",", "error_string", "=", "get_error", "(", ")", "if", "code", "==", "Advapi32Const", ".", "NTE_BAD_SIGNATURE", ":", "raise", "SignatureError", "(", "'Signature is invalid'", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
aes_cbc_no_padding_encrypt
Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and no padding. This means the ciphertext must be an exact multiple of 16 bytes long. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The plaintext - a byte string :p...
oscrypto/_osx/symmetric.py
def aes_cbc_no_padding_encrypt(key, data, iv): """ Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and no padding. This means the ciphertext must be an exact multiple of 16 bytes long. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long ...
def aes_cbc_no_padding_encrypt(key, data, iv): """ Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and no padding. This means the ciphertext must be an exact multiple of 16 bytes long. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long ...
[ "Encrypts", "plaintext", "using", "AES", "in", "CBC", "mode", "with", "a", "128", "192", "or", "256", "bit", "key", "and", "no", "padding", ".", "This", "means", "the", "ciphertext", "must", "be", "an", "exact", "multiple", "of", "16", "bytes", "long", ...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/symmetric.py#L28-L79
[ "def", "aes_cbc_no_padding_encrypt", "(", "key", ",", "data", ",", "iv", ")", ":", "if", "len", "(", "key", ")", "not", "in", "[", "16", ",", "24", ",", "32", "]", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be either...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
aes_cbc_no_padding_decrypt
Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key and no padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector - a byte string 16-bytes long ...
oscrypto/_osx/symmetric.py
def aes_cbc_no_padding_decrypt(key, data, iv): """ Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key and no padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: T...
def aes_cbc_no_padding_decrypt(key, data, iv): """ Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key and no padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: T...
[ "Decrypts", "AES", "ciphertext", "in", "CBC", "mode", "using", "a", "128", "192", "or", "256", "bit", "key", "and", "no", "padding", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/symmetric.py#L82-L121
[ "def", "aes_cbc_no_padding_decrypt", "(", "key", ",", "data", ",", "iv", ")", ":", "if", "len", "(", "key", ")", "not", "in", "[", "16", ",", "24", ",", "32", "]", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be either...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
aes_cbc_pkcs7_encrypt
Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and PKCS#7 padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The plaintext - a byte string :param iv: The initialization vector - either a byte string 16-b...
oscrypto/_osx/symmetric.py
def aes_cbc_pkcs7_encrypt(key, data, iv): """ Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and PKCS#7 padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The plaintext - a byte string :param iv: ...
def aes_cbc_pkcs7_encrypt(key, data, iv): """ Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and PKCS#7 padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The plaintext - a byte string :param iv: ...
[ "Encrypts", "plaintext", "using", "AES", "in", "CBC", "mode", "with", "a", "128", "192", "or", "256", "bit", "key", "and", "PKCS#7", "padding", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/symmetric.py#L124-L166
[ "def", "aes_cbc_pkcs7_encrypt", "(", "key", ",", "data", ",", "iv", ")", ":", "if", "len", "(", "key", ")", "not", "in", "[", "16", ",", "24", ",", "32", "]", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be either 16, ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
aes_cbc_pkcs7_decrypt
Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector - a byte string 16-bytes long :raises: Va...
oscrypto/_osx/symmetric.py
def aes_cbc_pkcs7_decrypt(key, data, iv): """ Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector ...
def aes_cbc_pkcs7_decrypt(key, data, iv): """ Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector ...
[ "Decrypts", "AES", "ciphertext", "in", "CBC", "mode", "using", "a", "128", "192", "or", "256", "bit", "key" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/symmetric.py#L169-L208
[ "def", "aes_cbc_pkcs7_decrypt", "(", "key", ",", "data", ",", "iv", ")", ":", "if", "len", "(", "key", ")", "not", "in", "[", "16", ",", "24", ",", "32", "]", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be either 16, ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
rc4_encrypt
Encrypts plaintext using RC4 with a 40-128 bit key :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte string :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are...
oscrypto/_osx/symmetric.py
def rc4_encrypt(key, data): """ Encrypts plaintext using RC4 with a 40-128 bit key :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte string :raises: ValueError - when any of the parameters contain an invalid value Ty...
def rc4_encrypt(key, data): """ Encrypts plaintext using RC4 with a 40-128 bit key :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte string :raises: ValueError - when any of the parameters contain an invalid value Ty...
[ "Encrypts", "plaintext", "using", "RC4", "with", "a", "40", "-", "128", "bit", "key" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/symmetric.py#L211-L238
[ "def", "rc4_encrypt", "(", "key", ",", "data", ")", ":", "if", "len", "(", "key", ")", "<", "5", "or", "len", "(", "key", ")", ">", "16", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be 5 to 16 bytes (40 to 128 bits) long ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
rc4_decrypt
Decrypts RC4 ciphertext using a 40-128 bit key :param key: The encryption key - a byte string 5-16 bytes long :param data: The ciphertext - a byte string :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are of...
oscrypto/_osx/symmetric.py
def rc4_decrypt(key, data): """ Decrypts RC4 ciphertext using a 40-128 bit key :param key: The encryption key - a byte string 5-16 bytes long :param data: The ciphertext - a byte string :raises: ValueError - when any of the parameters contain an invalid value TypeE...
def rc4_decrypt(key, data): """ Decrypts RC4 ciphertext using a 40-128 bit key :param key: The encryption key - a byte string 5-16 bytes long :param data: The ciphertext - a byte string :raises: ValueError - when any of the parameters contain an invalid value TypeE...
[ "Decrypts", "RC4", "ciphertext", "using", "a", "40", "-", "128", "bit", "key" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/symmetric.py#L241-L268
[ "def", "rc4_decrypt", "(", "key", ",", "data", ")", ":", "if", "len", "(", "key", ")", "<", "5", "or", "len", "(", "key", ")", ">", "16", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be 5 to 16 bytes (40 to 128 bits) long ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
rc2_cbc_pkcs5_encrypt
Encrypts plaintext using RC2 with a 64 bit key :param key: The encryption key - a byte string 8 bytes long :param data: The plaintext - a byte string :param iv: The 8-byte initialization vector to use - a byte string - set as None to generate an appropriate one :raise...
oscrypto/_osx/symmetric.py
def rc2_cbc_pkcs5_encrypt(key, data, iv): """ Encrypts plaintext using RC2 with a 64 bit key :param key: The encryption key - a byte string 8 bytes long :param data: The plaintext - a byte string :param iv: The 8-byte initialization vector to use - a byte string - set as N...
def rc2_cbc_pkcs5_encrypt(key, data, iv): """ Encrypts plaintext using RC2 with a 64 bit key :param key: The encryption key - a byte string 8 bytes long :param data: The plaintext - a byte string :param iv: The 8-byte initialization vector to use - a byte string - set as N...
[ "Encrypts", "plaintext", "using", "RC2", "with", "a", "64", "bit", "key" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/symmetric.py#L271-L312
[ "def", "rc2_cbc_pkcs5_encrypt", "(", "key", ",", "data", ",", "iv", ")", ":", "if", "len", "(", "key", ")", "<", "5", "or", "len", "(", "key", ")", ">", "16", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be 5 to 16 byt...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
rc2_cbc_pkcs5_decrypt
Decrypts RC2 ciphertext using a 64 bit key :param key: The encryption key - a byte string 8 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector used for encryption - a byte string :raises: ValueError - when any of the parameters...
oscrypto/_osx/symmetric.py
def rc2_cbc_pkcs5_decrypt(key, data, iv): """ Decrypts RC2 ciphertext using a 64 bit key :param key: The encryption key - a byte string 8 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector used for encryption - a byte string :r...
def rc2_cbc_pkcs5_decrypt(key, data, iv): """ Decrypts RC2 ciphertext using a 64 bit key :param key: The encryption key - a byte string 8 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector used for encryption - a byte string :r...
[ "Decrypts", "RC2", "ciphertext", "using", "a", "64", "bit", "key" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/symmetric.py#L315-L353
[ "def", "rc2_cbc_pkcs5_decrypt", "(", "key", ",", "data", ",", "iv", ")", ":", "if", "len", "(", "key", ")", "<", "5", "or", "len", "(", "key", ")", ">", "16", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be 5 to 16 byt...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
tripledes_cbc_pkcs5_encrypt
Encrypts plaintext using 3DES in either 2 or 3 key mode :param key: The encryption key - a byte string 16 or 24 bytes long (2 or 3 key mode) :param data: The plaintext - a byte string :param iv: The 8-byte initialization vector to use - a byte string - set as None to gener...
oscrypto/_osx/symmetric.py
def tripledes_cbc_pkcs5_encrypt(key, data, iv): """ Encrypts plaintext using 3DES in either 2 or 3 key mode :param key: The encryption key - a byte string 16 or 24 bytes long (2 or 3 key mode) :param data: The plaintext - a byte string :param iv: The 8-byte initialization ...
def tripledes_cbc_pkcs5_encrypt(key, data, iv): """ Encrypts plaintext using 3DES in either 2 or 3 key mode :param key: The encryption key - a byte string 16 or 24 bytes long (2 or 3 key mode) :param data: The plaintext - a byte string :param iv: The 8-byte initialization ...
[ "Encrypts", "plaintext", "using", "3DES", "in", "either", "2", "or", "3", "key", "mode" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/symmetric.py#L356-L401
[ "def", "tripledes_cbc_pkcs5_encrypt", "(", "key", ",", "data", ",", "iv", ")", ":", "if", "len", "(", "key", ")", "!=", "16", "and", "len", "(", "key", ")", "!=", "24", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be 1...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
tripledes_cbc_pkcs5_decrypt
Decrypts 3DES ciphertext in either 2 or 3 key mode :param key: The encryption key - a byte string 16 or 24 bytes long (2 or 3 key mode) :param data: The ciphertext - a byte string :param iv: The initialization vector used for encryption - a byte string :raises: ValueE...
oscrypto/_osx/symmetric.py
def tripledes_cbc_pkcs5_decrypt(key, data, iv): """ Decrypts 3DES ciphertext in either 2 or 3 key mode :param key: The encryption key - a byte string 16 or 24 bytes long (2 or 3 key mode) :param data: The ciphertext - a byte string :param iv: The initialization vector used...
def tripledes_cbc_pkcs5_decrypt(key, data, iv): """ Decrypts 3DES ciphertext in either 2 or 3 key mode :param key: The encryption key - a byte string 16 or 24 bytes long (2 or 3 key mode) :param data: The ciphertext - a byte string :param iv: The initialization vector used...
[ "Decrypts", "3DES", "ciphertext", "in", "either", "2", "or", "3", "key", "mode" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/symmetric.py#L404-L446
[ "def", "tripledes_cbc_pkcs5_decrypt", "(", "key", ",", "data", ",", "iv", ")", ":", "if", "len", "(", "key", ")", "!=", "16", "and", "len", "(", "key", ")", "!=", "24", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be 1...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
des_cbc_pkcs5_encrypt
Encrypts plaintext using DES with a 56 bit key :param key: The encryption key - a byte string 8 bytes long (includes error correction bits) :param data: The plaintext - a byte string :param iv: The 8-byte initialization vector to use - a byte string - set as None to genera...
oscrypto/_osx/symmetric.py
def des_cbc_pkcs5_encrypt(key, data, iv): """ Encrypts plaintext using DES with a 56 bit key :param key: The encryption key - a byte string 8 bytes long (includes error correction bits) :param data: The plaintext - a byte string :param iv: The 8-byte initialization vector ...
def des_cbc_pkcs5_encrypt(key, data, iv): """ Encrypts plaintext using DES with a 56 bit key :param key: The encryption key - a byte string 8 bytes long (includes error correction bits) :param data: The plaintext - a byte string :param iv: The 8-byte initialization vector ...
[ "Encrypts", "plaintext", "using", "DES", "with", "a", "56", "bit", "key" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/symmetric.py#L449-L490
[ "def", "des_cbc_pkcs5_encrypt", "(", "key", ",", "data", ",", "iv", ")", ":", "if", "len", "(", "key", ")", "!=", "8", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be 8 bytes (56 bits + 8 parity bits) long - is %s\n '''",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
des_cbc_pkcs5_decrypt
Decrypts DES ciphertext using a 56 bit key :param key: The encryption key - a byte string 8 bytes long (includes error correction bits) :param data: The ciphertext - a byte string :param iv: The initialization vector used for encryption - a byte string :raises: ValueE...
oscrypto/_osx/symmetric.py
def des_cbc_pkcs5_decrypt(key, data, iv): """ Decrypts DES ciphertext using a 56 bit key :param key: The encryption key - a byte string 8 bytes long (includes error correction bits) :param data: The ciphertext - a byte string :param iv: The initialization vector used for e...
def des_cbc_pkcs5_decrypt(key, data, iv): """ Decrypts DES ciphertext using a 56 bit key :param key: The encryption key - a byte string 8 bytes long (includes error correction bits) :param data: The ciphertext - a byte string :param iv: The initialization vector used for e...
[ "Decrypts", "DES", "ciphertext", "using", "a", "56", "bit", "key" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/symmetric.py#L493-L531
[ "def", "des_cbc_pkcs5_decrypt", "(", "key", ",", "data", ",", "iv", ")", ":", "if", "len", "(", "key", ")", "!=", "8", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be 8 bytes (56 bits + 8 parity bits) long - is %s\n '''",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_encrypt
Encrypts plaintext :param cipher: A kSecAttrKeyType* value that specifies the cipher to use :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte string :param iv: The initialization vector - a byte string - unused for RC4 ...
oscrypto/_osx/symmetric.py
def _encrypt(cipher, key, data, iv, padding): """ Encrypts plaintext :param cipher: A kSecAttrKeyType* value that specifies the cipher to use :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte string :param iv: T...
def _encrypt(cipher, key, data, iv, padding): """ Encrypts plaintext :param cipher: A kSecAttrKeyType* value that specifies the cipher to use :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte string :param iv: T...
[ "Encrypts", "plaintext" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/symmetric.py#L534-L644
[ "def", "_encrypt", "(", "cipher", ",", "key", ",", "data", ",", "iv", ",", "padding", ")", ":", "if", "not", "isinstance", "(", "key", ",", "byte_cls", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n key must be a byte string, not...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
Service.version
Create a new version under this service.
fastly/models.py
def version(self): """ Create a new version under this service. """ ver = Version() ver.conn = self.conn ver.attrs = { # Parent params 'service_id': self.attrs['id'], } ver.save() return ver
def version(self): """ Create a new version under this service. """ ver = Version() ver.conn = self.conn ver.attrs = { # Parent params 'service_id': self.attrs['id'], } ver.save() return ver
[ "Create", "a", "new", "version", "under", "this", "service", "." ]
fastly/fastly-py
python
https://github.com/fastly/fastly-py/blob/f336551c368b3ae44d6b5690913f9e6799d1a83f/fastly/models.py#L85-L97
[ "def", "version", "(", "self", ")", ":", "ver", "=", "Version", "(", ")", "ver", ".", "conn", "=", "self", ".", "conn", "ver", ".", "attrs", "=", "{", "# Parent params", "'service_id'", ":", "self", ".", "attrs", "[", "'id'", "]", ",", "}", "ver", ...
f336551c368b3ae44d6b5690913f9e6799d1a83f
valid
Version.vcl
Create a new VCL under this version.
fastly/models.py
def vcl(self, name, content): """ Create a new VCL under this version. """ vcl = VCL() vcl.conn = self.conn vcl.attrs = { # Parent params 'service_id': self.attrs['service_id'], 'version': self.attrs['number'], # New instance params ...
def vcl(self, name, content): """ Create a new VCL under this version. """ vcl = VCL() vcl.conn = self.conn vcl.attrs = { # Parent params 'service_id': self.attrs['service_id'], 'version': self.attrs['number'], # New instance params ...
[ "Create", "a", "new", "VCL", "under", "this", "version", "." ]
fastly/fastly-py
python
https://github.com/fastly/fastly-py/blob/f336551c368b3ae44d6b5690913f9e6799d1a83f/fastly/models.py#L135-L152
[ "def", "vcl", "(", "self", ",", "name", ",", "content", ")", ":", "vcl", "=", "VCL", "(", ")", "vcl", ".", "conn", "=", "self", ".", "conn", "vcl", ".", "attrs", "=", "{", "# Parent params", "'service_id'", ":", "self", ".", "attrs", "[", "'service...
f336551c368b3ae44d6b5690913f9e6799d1a83f
valid
BaseColumn.to_dict
Converts the column to a dictionary representation accepted by the Citrination server. :return: Dictionary with basic options, plus any column type specific options held under the "options" key :rtype: dict
citrination_client/models/columns/base.py
def to_dict(self): """ Converts the column to a dictionary representation accepted by the Citrination server. :return: Dictionary with basic options, plus any column type specific options held under the "options" key :rtype: dict """ return { ...
def to_dict(self): """ Converts the column to a dictionary representation accepted by the Citrination server. :return: Dictionary with basic options, plus any column type specific options held under the "options" key :rtype: dict """ return { ...
[ "Converts", "the", "column", "to", "a", "dictionary", "representation", "accepted", "by", "the", "Citrination", "server", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/columns/base.py#L33-L49
[ "def", "to_dict", "(", "self", ")", ":", "return", "{", "\"type\"", ":", "self", ".", "type", ",", "\"name\"", ":", "self", ".", "name", ",", "\"group_by_key\"", ":", "self", ".", "group_by_key", ",", "\"role\"", ":", "self", ".", "role", ",", "\"units...
409984fc65ce101a620f069263f155303492465c
valid
DataViewBuilder.add_descriptor
Add a descriptor column. :param descriptor: A Descriptor instance (e.g., RealDescriptor, InorganicDescriptor, etc.) :param role: Specify a role (input, output, latentVariable, or ignore) :param group_by_key: Whether or not to group by this key during cross validation
citrination_client/views/data_view_builder.py
def add_descriptor(self, descriptor, role='ignore', group_by_key=False): """ Add a descriptor column. :param descriptor: A Descriptor instance (e.g., RealDescriptor, InorganicDescriptor, etc.) :param role: Specify a role (input, output, latentVariable, or ignore) :param group_by...
def add_descriptor(self, descriptor, role='ignore', group_by_key=False): """ Add a descriptor column. :param descriptor: A Descriptor instance (e.g., RealDescriptor, InorganicDescriptor, etc.) :param role: Specify a role (input, output, latentVariable, or ignore) :param group_by...
[ "Add", "a", "descriptor", "column", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/views/data_view_builder.py#L33-L51
[ "def", "add_descriptor", "(", "self", ",", "descriptor", ",", "role", "=", "'ignore'", ",", "group_by_key", "=", "False", ")", ":", "descriptor", ".", "validate", "(", ")", "if", "descriptor", ".", "key", "in", "self", ".", "configuration", "[", "\"roles\"...
409984fc65ce101a620f069263f155303492465c
valid
BaseClient._get
Execute a post request and return the result :param headers: :return:
citrination_client/base/base_client.py
def _get(self, route, headers=None, failure_message=None): """ Execute a post request and return the result :param headers: :return: """ headers = self._get_headers(headers) response_lambda = ( lambda: requests.get(self._get_qualified_route(route), hea...
def _get(self, route, headers=None, failure_message=None): """ Execute a post request and return the result :param headers: :return: """ headers = self._get_headers(headers) response_lambda = ( lambda: requests.get(self._get_qualified_route(route), hea...
[ "Execute", "a", "post", "request", "and", "return", "the", "result", ":", "param", "headers", ":", ":", "return", ":" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/base/base_client.py#L80-L91
[ "def", "_get", "(", "self", ",", "route", ",", "headers", "=", "None", ",", "failure_message", "=", "None", ")", ":", "headers", "=", "self", ".", "_get_headers", "(", "headers", ")", "response_lambda", "=", "(", "lambda", ":", "requests", ".", "get", ...
409984fc65ce101a620f069263f155303492465c
valid
BaseClient._post
Execute a post request and return the result :param data: :param headers: :return:
citrination_client/base/base_client.py
def _post(self, route, data, headers=None, failure_message=None): """ Execute a post request and return the result :param data: :param headers: :return: """ headers = self._get_headers(headers) response_lambda = ( lambda: requests.post( ...
def _post(self, route, data, headers=None, failure_message=None): """ Execute a post request and return the result :param data: :param headers: :return: """ headers = self._get_headers(headers) response_lambda = ( lambda: requests.post( ...
[ "Execute", "a", "post", "request", "and", "return", "the", "result", ":", "param", "data", ":", ":", "param", "headers", ":", ":", "return", ":" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/base/base_client.py#L96-L110
[ "def", "_post", "(", "self", ",", "route", ",", "data", ",", "headers", "=", "None", ",", "failure_message", "=", "None", ")", ":", "headers", "=", "self", ".", "_get_headers", "(", "headers", ")", "response_lambda", "=", "(", "lambda", ":", "requests", ...
409984fc65ce101a620f069263f155303492465c
valid
BaseClient._put
Execute a put request and return the result :param data: :param headers: :return:
citrination_client/base/base_client.py
def _put(self, route, data, headers=None, failure_message=None): """ Execute a put request and return the result :param data: :param headers: :return: """ headers = self._get_headers(headers) response_lambda = ( lambda: requests.put( ...
def _put(self, route, data, headers=None, failure_message=None): """ Execute a put request and return the result :param data: :param headers: :return: """ headers = self._get_headers(headers) response_lambda = ( lambda: requests.put( ...
[ "Execute", "a", "put", "request", "and", "return", "the", "result", ":", "param", "data", ":", ":", "param", "headers", ":", ":", "return", ":" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/base/base_client.py#L115-L129
[ "def", "_put", "(", "self", ",", "route", ",", "data", ",", "headers", "=", "None", ",", "failure_message", "=", "None", ")", ":", "headers", "=", "self", ".", "_get_headers", "(", "headers", ")", "response_lambda", "=", "(", "lambda", ":", "requests", ...
409984fc65ce101a620f069263f155303492465c
valid
BaseClient._patch
Execute a patch request and return the result
citrination_client/base/base_client.py
def _patch(self, route, data, headers=None, failure_message=None): """ Execute a patch request and return the result """ headers = self._get_headers(headers) response_lambda = ( lambda: requests.patch( self._get_qualified_route(route), headers=headers,...
def _patch(self, route, data, headers=None, failure_message=None): """ Execute a patch request and return the result """ headers = self._get_headers(headers) response_lambda = ( lambda: requests.patch( self._get_qualified_route(route), headers=headers,...
[ "Execute", "a", "patch", "request", "and", "return", "the", "result" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/base/base_client.py#L134-L145
[ "def", "_patch", "(", "self", ",", "route", ",", "data", ",", "headers", "=", "None", ",", "failure_message", "=", "None", ")", ":", "headers", "=", "self", ".", "_get_headers", "(", "headers", ")", "response_lambda", "=", "(", "lambda", ":", "requests",...
409984fc65ce101a620f069263f155303492465c
valid
BaseClient._delete
Execute a delete request and return the result :param headers: :return:
citrination_client/base/base_client.py
def _delete(self, route, headers=None, failure_message=None): """ Execute a delete request and return the result :param headers: :return: """ headers = self._get_headers(headers) response_lambda = (lambda: requests.delete( self._get_qualified_route(rou...
def _delete(self, route, headers=None, failure_message=None): """ Execute a delete request and return the result :param headers: :return: """ headers = self._get_headers(headers) response_lambda = (lambda: requests.delete( self._get_qualified_route(rou...
[ "Execute", "a", "delete", "request", "and", "return", "the", "result", ":", "param", "headers", ":", ":", "return", ":" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/base/base_client.py#L147-L158
[ "def", "_delete", "(", "self", ",", "route", ",", "headers", "=", "None", ",", "failure_message", "=", "None", ")", ":", "headers", "=", "self", ".", "_get_headers", "(", "headers", ")", "response_lambda", "=", "(", "lambda", ":", "requests", ".", "delet...
409984fc65ce101a620f069263f155303492465c
valid
SearchClient._validate_search_query
Checks to see that the query will not exceed the max query depth :param returning_query: The PIF system or Dataset query to execute. :type returning_query: :class:`PifSystemReturningQuery` or :class: `DatasetReturningQuery`
citrination_client/search/client.py
def _validate_search_query(self, returning_query): """ Checks to see that the query will not exceed the max query depth :param returning_query: The PIF system or Dataset query to execute. :type returning_query: :class:`PifSystemReturningQuery` or :class: `DatasetReturningQuery` ...
def _validate_search_query(self, returning_query): """ Checks to see that the query will not exceed the max query depth :param returning_query: The PIF system or Dataset query to execute. :type returning_query: :class:`PifSystemReturningQuery` or :class: `DatasetReturningQuery` ...
[ "Checks", "to", "see", "that", "the", "query", "will", "not", "exceed", "the", "max", "query", "depth" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/search/client.py#L35-L54
[ "def", "_validate_search_query", "(", "self", ",", "returning_query", ")", ":", "start_index", "=", "returning_query", ".", "from_index", "or", "0", "size", "=", "returning_query", ".", "size", "or", "0", "if", "start_index", "<", "0", ":", "raise", "Citrinati...
409984fc65ce101a620f069263f155303492465c
valid
SearchClient.pif_search
Run a PIF query against Citrination. :param pif_system_returning_query: The PIF system query to execute. :type pif_system_returning_query: :class:`PifSystemReturningQuery` :return: :class:`PifSearchResult` object with the results of the query. :rtype: :class:`PifSearchResult`
citrination_client/search/client.py
def pif_search(self, pif_system_returning_query): """ Run a PIF query against Citrination. :param pif_system_returning_query: The PIF system query to execute. :type pif_system_returning_query: :class:`PifSystemReturningQuery` :return: :class:`PifSearchResult` object with the res...
def pif_search(self, pif_system_returning_query): """ Run a PIF query against Citrination. :param pif_system_returning_query: The PIF system query to execute. :type pif_system_returning_query: :class:`PifSystemReturningQuery` :return: :class:`PifSearchResult` object with the res...
[ "Run", "a", "PIF", "query", "against", "Citrination", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/search/client.py#L56-L70
[ "def", "pif_search", "(", "self", ",", "pif_system_returning_query", ")", ":", "self", ".", "_validate_search_query", "(", "pif_system_returning_query", ")", "return", "self", ".", "_execute_search_query", "(", "pif_system_returning_query", ",", "PifSearchResult", ")" ]
409984fc65ce101a620f069263f155303492465c
valid
SearchClient.dataset_search
Run a dataset query against Citrination. :param dataset_returning_query: :class:`DatasetReturningQuery` to execute. :type dataset_returning_query: :class:`DatasetReturningQuery` :return: Dataset search result object with the results of the query. :rtype: :class:`DatasetSearchResult`
citrination_client/search/client.py
def dataset_search(self, dataset_returning_query): """ Run a dataset query against Citrination. :param dataset_returning_query: :class:`DatasetReturningQuery` to execute. :type dataset_returning_query: :class:`DatasetReturningQuery` :return: Dataset search result object with the...
def dataset_search(self, dataset_returning_query): """ Run a dataset query against Citrination. :param dataset_returning_query: :class:`DatasetReturningQuery` to execute. :type dataset_returning_query: :class:`DatasetReturningQuery` :return: Dataset search result object with the...
[ "Run", "a", "dataset", "query", "against", "Citrination", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/search/client.py#L72-L86
[ "def", "dataset_search", "(", "self", ",", "dataset_returning_query", ")", ":", "self", ".", "_validate_search_query", "(", "dataset_returning_query", ")", "return", "self", ".", "_execute_search_query", "(", "dataset_returning_query", ",", "DatasetSearchResult", ")" ]
409984fc65ce101a620f069263f155303492465c
valid
SearchClient._execute_search_query
Run a PIF query against Citrination. :param returning_query: :class:`BaseReturningQuery` to execute. :param result_class: The class of the result to return. :return: ``result_class`` object with the results of the query.
citrination_client/search/client.py
def _execute_search_query(self, returning_query, result_class): """ Run a PIF query against Citrination. :param returning_query: :class:`BaseReturningQuery` to execute. :param result_class: The class of the result to return. :return: ``result_class`` object with the results of t...
def _execute_search_query(self, returning_query, result_class): """ Run a PIF query against Citrination. :param returning_query: :class:`BaseReturningQuery` to execute. :param result_class: The class of the result to return. :return: ``result_class`` object with the results of t...
[ "Run", "a", "PIF", "query", "against", "Citrination", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/search/client.py#L88-L123
[ "def", "_execute_search_query", "(", "self", ",", "returning_query", ",", "result_class", ")", ":", "if", "returning_query", ".", "from_index", ":", "from_index", "=", "returning_query", ".", "from_index", "else", ":", "from_index", "=", "0", "if", "returning_quer...
409984fc65ce101a620f069263f155303492465c
valid
SearchClient.pif_multi_search
Run each in a list of PIF queries against Citrination. :param multi_query: :class:`MultiQuery` object to execute. :return: :class:`PifMultiSearchResult` object with the results of the query.
citrination_client/search/client.py
def pif_multi_search(self, multi_query): """ Run each in a list of PIF queries against Citrination. :param multi_query: :class:`MultiQuery` object to execute. :return: :class:`PifMultiSearchResult` object with the results of the query. """ failure_message = "Error while ...
def pif_multi_search(self, multi_query): """ Run each in a list of PIF queries against Citrination. :param multi_query: :class:`MultiQuery` object to execute. :return: :class:`PifMultiSearchResult` object with the results of the query. """ failure_message = "Error while ...
[ "Run", "each", "in", "a", "list", "of", "PIF", "queries", "against", "Citrination", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/search/client.py#L140-L152
[ "def", "pif_multi_search", "(", "self", ",", "multi_query", ")", ":", "failure_message", "=", "\"Error while making PIF multi search request\"", "response_dict", "=", "self", ".", "_get_success_json", "(", "self", ".", "_post", "(", "routes", ".", "pif_multi_search", ...
409984fc65ce101a620f069263f155303492465c
valid
SearchClient.generate_simple_chemical_query
This method generates a :class:`PifSystemReturningQuery` object using the supplied arguments. All arguments that accept lists have logical OR's on the queries that they generate. This means that, for example, simple_chemical_search(name=['A', 'B']) will match records that have name equal to 'A' ...
citrination_client/search/client.py
def generate_simple_chemical_query(self, name=None, chemical_formula=None, property_name=None, property_value=None, property_min=None, property_max=None, property_units=None, reference_doi=None, include_datasets=[], exclude_datasets=[], from_...
def generate_simple_chemical_query(self, name=None, chemical_formula=None, property_name=None, property_value=None, property_min=None, property_max=None, property_units=None, reference_doi=None, include_datasets=[], exclude_datasets=[], from_...
[ "This", "method", "generates", "a", ":", "class", ":", "PifSystemReturningQuery", "object", "using", "the", "supplied", "arguments", ".", "All", "arguments", "that", "accept", "lists", "have", "logical", "OR", "s", "on", "the", "queries", "that", "they", "gene...
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/search/client.py#L154-L246
[ "def", "generate_simple_chemical_query", "(", "self", ",", "name", "=", "None", ",", "chemical_formula", "=", "None", ",", "property_name", "=", "None", ",", "property_value", "=", "None", ",", "property_min", "=", "None", ",", "property_max", "=", "None", ","...
409984fc65ce101a620f069263f155303492465c
valid
check_for_rate_limiting
Takes an initial response, and a way to repeat the request that produced it and retries the request with an increasing sleep period between requests if rate limiting resposne codes are encountered. If more than 3 attempts are made, a RateLimitingException is raised :param response: A response from Citrination...
citrination_client/base/response_handling.py
def check_for_rate_limiting(response, response_lambda, timeout=1, attempts=0): """ Takes an initial response, and a way to repeat the request that produced it and retries the request with an increasing sleep period between requests if rate limiting resposne codes are encountered. If more than 3 attempts ar...
def check_for_rate_limiting(response, response_lambda, timeout=1, attempts=0): """ Takes an initial response, and a way to repeat the request that produced it and retries the request with an increasing sleep period between requests if rate limiting resposne codes are encountered. If more than 3 attempts ar...
[ "Takes", "an", "initial", "response", "and", "a", "way", "to", "repeat", "the", "request", "that", "produced", "it", "and", "retries", "the", "request", "with", "an", "increasing", "sleep", "period", "between", "requests", "if", "rate", "limiting", "resposne",...
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/base/response_handling.py#L4-L27
[ "def", "check_for_rate_limiting", "(", "response", ",", "response_lambda", ",", "timeout", "=", "1", ",", "attempts", "=", "0", ")", ":", "if", "attempts", ">=", "3", ":", "raise", "RateLimitingException", "(", ")", "if", "response", ".", "status_code", "=="...
409984fc65ce101a620f069263f155303492465c
valid
DataViewsClient.create
Creates a data view from the search template and ml template given :param configuration: Information to construct the data view from (eg descriptors, datasets etc) :param name: Name of the data view :param description: Description for the data view :return: The data view id
citrination_client/views/client.py
def create(self, configuration, name, description): """ Creates a data view from the search template and ml template given :param configuration: Information to construct the data view from (eg descriptors, datasets etc) :param name: Name of the data view :param description: Desc...
def create(self, configuration, name, description): """ Creates a data view from the search template and ml template given :param configuration: Information to construct the data view from (eg descriptors, datasets etc) :param name: Name of the data view :param description: Desc...
[ "Creates", "a", "data", "view", "from", "the", "search", "template", "and", "ml", "template", "given" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/views/client.py#L24-L49
[ "def", "create", "(", "self", ",", "configuration", ",", "name", ",", "description", ")", ":", "data", "=", "{", "\"configuration\"", ":", "configuration", ",", "\"name\"", ":", "name", ",", "\"description\"", ":", "description", "}", "failure_message", "=", ...
409984fc65ce101a620f069263f155303492465c
valid
DataViewsClient.update
Updates an existing data view from the search template and ml template given :param id: Identifier for the data view. This returned from the create method. :param configuration: Information to construct the data view from (eg descriptors, datasets etc) :param name: Name of the data view ...
citrination_client/views/client.py
def update(self, id, configuration, name, description): """ Updates an existing data view from the search template and ml template given :param id: Identifier for the data view. This returned from the create method. :param configuration: Information to construct the data view from (eg ...
def update(self, id, configuration, name, description): """ Updates an existing data view from the search template and ml template given :param id: Identifier for the data view. This returned from the create method. :param configuration: Information to construct the data view from (eg ...
[ "Updates", "an", "existing", "data", "view", "from", "the", "search", "template", "and", "ml", "template", "given" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/views/client.py#L51-L73
[ "def", "update", "(", "self", ",", "id", ",", "configuration", ",", "name", ",", "description", ")", ":", "data", "=", "{", "\"configuration\"", ":", "configuration", ",", "\"name\"", ":", "name", ",", "\"description\"", ":", "description", "}", "failure_mes...
409984fc65ce101a620f069263f155303492465c
valid
DataViewsClient.get
Gets basic information about a view :param data_view_id: Identifier of the data view :return: Metadata about the view as JSON
citrination_client/views/client.py
def get(self, data_view_id): """ Gets basic information about a view :param data_view_id: Identifier of the data view :return: Metadata about the view as JSON """ failure_message = "Dataview get failed" return self._get_success_json(self._get( 'v1/da...
def get(self, data_view_id): """ Gets basic information about a view :param data_view_id: Identifier of the data view :return: Metadata about the view as JSON """ failure_message = "Dataview get failed" return self._get_success_json(self._get( 'v1/da...
[ "Gets", "basic", "information", "about", "a", "view" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/views/client.py#L86-L96
[ "def", "get", "(", "self", ",", "data_view_id", ")", ":", "failure_message", "=", "\"Dataview get failed\"", "return", "self", ".", "_get_success_json", "(", "self", ".", "_get", "(", "'v1/data_views/'", "+", "data_view_id", ",", "None", ",", "failure_message", ...
409984fc65ce101a620f069263f155303492465c
valid
DataViewsClient.get_data_view_service_status
Retrieves the status for all of the services associated with a data view: - predict - experimental_design - data_reports - model_reports :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_...
citrination_client/views/client.py
def get_data_view_service_status(self, data_view_id): """ Retrieves the status for all of the services associated with a data view: - predict - experimental_design - data_reports - model_reports :param data_view_id: The ID number of the data view ...
def get_data_view_service_status(self, data_view_id): """ Retrieves the status for all of the services associated with a data view: - predict - experimental_design - data_reports - model_reports :param data_view_id: The ID number of the data view ...
[ "Retrieves", "the", "status", "for", "all", "of", "the", "services", "associated", "with", "a", "data", "view", ":", "-", "predict", "-", "experimental_design", "-", "data_reports", "-", "model_reports" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/views/client.py#L98-L123
[ "def", "get_data_view_service_status", "(", "self", ",", "data_view_id", ")", ":", "url", "=", "\"data_views/{}/status\"", ".", "format", "(", "data_view_id", ")", "response", "=", "self", ".", "_get", "(", "url", ")", ".", "json", "(", ")", "result", "=", ...
409984fc65ce101a620f069263f155303492465c
valid
DataViewsClient.create_ml_configuration_from_datasets
Creates an ml configuration from dataset_ids and extract_as_keys :param dataset_ids: Array of dataset identifiers to make search template from :return: An identifier used to request the status of the builder job (get_ml_configuration_status)
citrination_client/views/client.py
def create_ml_configuration_from_datasets(self, dataset_ids): """ Creates an ml configuration from dataset_ids and extract_as_keys :param dataset_ids: Array of dataset identifiers to make search template from :return: An identifier used to request the status of the builder job (get_ml_c...
def create_ml_configuration_from_datasets(self, dataset_ids): """ Creates an ml configuration from dataset_ids and extract_as_keys :param dataset_ids: Array of dataset identifiers to make search template from :return: An identifier used to request the status of the builder job (get_ml_c...
[ "Creates", "an", "ml", "configuration", "from", "dataset_ids", "and", "extract_as_keys" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/views/client.py#L125-L136
[ "def", "create_ml_configuration_from_datasets", "(", "self", ",", "dataset_ids", ")", ":", "available_columns", "=", "self", ".", "search_template_client", ".", "get_available_columns", "(", "dataset_ids", ")", "# Create a search template from dataset ids", "search_template", ...
409984fc65ce101a620f069263f155303492465c
valid
DataViewsClient.create_ml_configuration
This method will spawn a server job to create a default ML configuration based on a search template and the extract as keys. This function will submit the request to build, and wait for the configuration to finish before returning. :param search_template: A search template defining the query (p...
citrination_client/views/client.py
def create_ml_configuration(self, search_template, extract_as_keys, dataset_ids): """ This method will spawn a server job to create a default ML configuration based on a search template and the extract as keys. This function will submit the request to build, and wait for the configuratio...
def create_ml_configuration(self, search_template, extract_as_keys, dataset_ids): """ This method will spawn a server job to create a default ML configuration based on a search template and the extract as keys. This function will submit the request to build, and wait for the configuratio...
[ "This", "method", "will", "spawn", "a", "server", "job", "to", "create", "a", "default", "ML", "configuration", "based", "on", "a", "search", "template", "and", "the", "extract", "as", "keys", ".", "This", "function", "will", "submit", "the", "request", "t...
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/views/client.py#L138-L167
[ "def", "create_ml_configuration", "(", "self", ",", "search_template", ",", "extract_as_keys", ",", "dataset_ids", ")", ":", "data", "=", "{", "\"search_template\"", ":", "search_template", ",", "\"extract_as_keys\"", ":", "extract_as_keys", "}", "failure_message", "=...
409984fc65ce101a620f069263f155303492465c
valid
DataViewsClient.__convert_response_to_configuration
Utility function to turn the result object from the configuration builder endpoint into something that can be used directly as a configuration. :param result_blob: Nested dicts representing the possible descriptors :param dataset_ids: Array of dataset identifiers to make search template from ...
citrination_client/views/client.py
def __convert_response_to_configuration(self, result_blob, dataset_ids): """ Utility function to turn the result object from the configuration builder endpoint into something that can be used directly as a configuration. :param result_blob: Nested dicts representing the possible descrip...
def __convert_response_to_configuration(self, result_blob, dataset_ids): """ Utility function to turn the result object from the configuration builder endpoint into something that can be used directly as a configuration. :param result_blob: Nested dicts representing the possible descrip...
[ "Utility", "function", "to", "turn", "the", "result", "object", "from", "the", "configuration", "builder", "endpoint", "into", "something", "that", "can", "be", "used", "directly", "as", "a", "configuration", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/views/client.py#L169-L193
[ "def", "__convert_response_to_configuration", "(", "self", ",", "result_blob", ",", "dataset_ids", ")", ":", "builder", "=", "DataViewBuilder", "(", ")", "builder", ".", "dataset_ids", "(", "dataset_ids", ")", "for", "i", ",", "(", "k", ",", "v", ")", "in", ...
409984fc65ce101a620f069263f155303492465c
valid
DataViewsClient.__snake_case
Utility method to convert camelcase to snake :param descriptor: The dictionary to convert
citrination_client/views/client.py
def __snake_case(self, descriptor): """ Utility method to convert camelcase to snake :param descriptor: The dictionary to convert """ newdict = {} for i, (k, v) in enumerate(descriptor.items()): newkey = "" for j, c in enumerate(k): ...
def __snake_case(self, descriptor): """ Utility method to convert camelcase to snake :param descriptor: The dictionary to convert """ newdict = {} for i, (k, v) in enumerate(descriptor.items()): newkey = "" for j, c in enumerate(k): ...
[ "Utility", "method", "to", "convert", "camelcase", "to", "snake", ":", "param", "descriptor", ":", "The", "dictionary", "to", "convert" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/views/client.py#L195-L212
[ "def", "__snake_case", "(", "self", ",", "descriptor", ")", ":", "newdict", "=", "{", "}", "for", "i", ",", "(", "k", ",", "v", ")", "in", "enumerate", "(", "descriptor", ".", "items", "(", ")", ")", ":", "newkey", "=", "\"\"", "for", "j", ",", ...
409984fc65ce101a620f069263f155303492465c
valid
DataViewsClient.__get_ml_configuration_status
After invoking the create_ml_configuration async method, you can use this method to check on the status of the builder job. :param job_id: The identifier returned from create_ml_configuration :return: Job status
citrination_client/views/client.py
def __get_ml_configuration_status(self, job_id): """ After invoking the create_ml_configuration async method, you can use this method to check on the status of the builder job. :param job_id: The identifier returned from create_ml_configuration :return: Job status """ ...
def __get_ml_configuration_status(self, job_id): """ After invoking the create_ml_configuration async method, you can use this method to check on the status of the builder job. :param job_id: The identifier returned from create_ml_configuration :return: Job status """ ...
[ "After", "invoking", "the", "create_ml_configuration", "async", "method", "you", "can", "use", "this", "method", "to", "check", "on", "the", "status", "of", "the", "builder", "job", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/views/client.py#L214-L227
[ "def", "__get_ml_configuration_status", "(", "self", ",", "job_id", ")", ":", "failure_message", "=", "\"Get status on ml configuration failed\"", "response", "=", "self", ".", "_get_success_json", "(", "self", ".", "_get", "(", "'v1/descriptors/builders/simple/default/'", ...
409984fc65ce101a620f069263f155303492465c
valid
ModelsClient.tsne
Get the t-SNE projection, including responses and tags. :param data_view_id: The ID of the data view to retrieve TSNE from :type data_view_id: int :return: The TSNE analysis :rtype: :class:`Tsne`
citrination_client/models/client.py
def tsne(self, data_view_id): """ Get the t-SNE projection, including responses and tags. :param data_view_id: The ID of the data view to retrieve TSNE from :type data_view_id: int :return: The TSNE analysis :rtype: :class:`Tsne` """ analysis = self._data...
def tsne(self, data_view_id): """ Get the t-SNE projection, including responses and tags. :param data_view_id: The ID of the data view to retrieve TSNE from :type data_view_id: int :return: The TSNE analysis :rtype: :class:`Tsne` """ analysis = self._data...
[ "Get", "the", "t", "-", "SNE", "projection", "including", "responses", "and", "tags", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L28-L50
[ "def", "tsne", "(", "self", ",", "data_view_id", ")", ":", "analysis", "=", "self", ".", "_data_analysis", "(", "data_view_id", ")", "projections", "=", "analysis", "[", "'projections'", "]", "tsne", "=", "Tsne", "(", ")", "for", "k", ",", "v", "in", "...
409984fc65ce101a620f069263f155303492465c
valid
ModelsClient.predict
Predict endpoint. This simply wraps the async methods (submit and poll for status/results). :param data_view_id: The ID of the data view to use for prediction :type data_view_id: str :param candidates: A list of candidates to make predictions on :type candidates: list of dicts :...
citrination_client/models/client.py
def predict(self, data_view_id, candidates, method="scalar", use_prior=True): """ Predict endpoint. This simply wraps the async methods (submit and poll for status/results). :param data_view_id: The ID of the data view to use for prediction :type data_view_id: str :param candida...
def predict(self, data_view_id, candidates, method="scalar", use_prior=True): """ Predict endpoint. This simply wraps the async methods (submit and poll for status/results). :param data_view_id: The ID of the data view to use for prediction :type data_view_id: str :param candida...
[ "Predict", "endpoint", ".", "This", "simply", "wraps", "the", "async", "methods", "(", "submit", "and", "poll", "for", "status", "/", "results", ")", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L52-L87
[ "def", "predict", "(", "self", ",", "data_view_id", ",", "candidates", ",", "method", "=", "\"scalar\"", ",", "use_prior", "=", "True", ")", ":", "uid", "=", "self", ".", "submit_predict_request", "(", "data_view_id", ",", "candidates", ",", "method", ",", ...
409984fc65ce101a620f069263f155303492465c
valid
ModelsClient.retrain
Start a model retraining :param dataview_id: The ID of the views :return:
citrination_client/models/client.py
def retrain(self, dataview_id): """ Start a model retraining :param dataview_id: The ID of the views :return: """ url = 'data_views/{}/retrain'.format(dataview_id) response = self._post_json(url, data={}) if response.status_code != requests.codes.ok: ...
def retrain(self, dataview_id): """ Start a model retraining :param dataview_id: The ID of the views :return: """ url = 'data_views/{}/retrain'.format(dataview_id) response = self._post_json(url, data={}) if response.status_code != requests.codes.ok: ...
[ "Start", "a", "model", "retraining", ":", "param", "dataview_id", ":", "The", "ID", "of", "the", "views", ":", "return", ":" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L89-L99
[ "def", "retrain", "(", "self", ",", "dataview_id", ")", ":", "url", "=", "'data_views/{}/retrain'", ".", "format", "(", "dataview_id", ")", "response", "=", "self", ".", "_post_json", "(", "url", ",", "data", "=", "{", "}", ")", "if", "response", ".", ...
409984fc65ce101a620f069263f155303492465c
valid
ModelsClient._data_analysis
Data analysis endpoint. :param data_view_id: The model identifier (id number for data views) :type data_view_id: str :return: dictionary containing information about the data, e.g. dCorr and tsne
citrination_client/models/client.py
def _data_analysis(self, data_view_id): """ Data analysis endpoint. :param data_view_id: The model identifier (id number for data views) :type data_view_id: str :return: dictionary containing information about the data, e.g. dCorr and tsne """ failure_message = "...
def _data_analysis(self, data_view_id): """ Data analysis endpoint. :param data_view_id: The model identifier (id number for data views) :type data_view_id: str :return: dictionary containing information about the data, e.g. dCorr and tsne """ failure_message = "...
[ "Data", "analysis", "endpoint", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L117-L126
[ "def", "_data_analysis", "(", "self", ",", "data_view_id", ")", ":", "failure_message", "=", "\"Error while retrieving data analysis for data view {}\"", ".", "format", "(", "data_view_id", ")", "return", "self", ".", "_get_success_json", "(", "self", ".", "_get", "("...
409984fc65ce101a620f069263f155303492465c
valid
ModelsClient.submit_predict_request
Submits an async prediction request. :param data_view_id: The id returned from create :param candidates: Array of candidates :param prediction_source: 'scalar' or 'scalar_from_distribution' :param use_prior: True to use prior prediction, otherwise False :return: Predict request ...
citrination_client/models/client.py
def submit_predict_request(self, data_view_id, candidates, prediction_source='scalar', use_prior=True): """ Submits an async prediction request. :param data_view_id: The id returned from create :param candidates: Array of candidates :param prediction_source: 'scalar' or 'scalar_...
def submit_predict_request(self, data_view_id, candidates, prediction_source='scalar', use_prior=True): """ Submits an async prediction request. :param data_view_id: The id returned from create :param candidates: Array of candidates :param prediction_source: 'scalar' or 'scalar_...
[ "Submits", "an", "async", "prediction", "request", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L144-L168
[ "def", "submit_predict_request", "(", "self", ",", "data_view_id", ",", "candidates", ",", "prediction_source", "=", "'scalar'", ",", "use_prior", "=", "True", ")", ":", "data", "=", "{", "\"prediction_source\"", ":", "prediction_source", ",", "\"use_prior\"", ":"...
409984fc65ce101a620f069263f155303492465c
valid
ModelsClient.check_predict_status
Returns a string indicating the status of the prediction job :param view_id: The data view id returned from data view create :param predict_request_id: The id returned from predict :return: Status data, also includes results if state is finished
citrination_client/models/client.py
def check_predict_status(self, view_id, predict_request_id): """ Returns a string indicating the status of the prediction job :param view_id: The data view id returned from data view create :param predict_request_id: The id returned from predict :return: Status data, also includ...
def check_predict_status(self, view_id, predict_request_id): """ Returns a string indicating the status of the prediction job :param view_id: The data view id returned from data view create :param predict_request_id: The id returned from predict :return: Status data, also includ...
[ "Returns", "a", "string", "indicating", "the", "status", "of", "the", "prediction", "job" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L170-L188
[ "def", "check_predict_status", "(", "self", ",", "view_id", ",", "predict_request_id", ")", ":", "failure_message", "=", "\"Get status on predict failed\"", "bare_response", "=", "self", ".", "_get_success_json", "(", "self", ".", "_get", "(", "'v1/data_views/'", "+",...
409984fc65ce101a620f069263f155303492465c
valid
ModelsClient.submit_design_run
Submits a new experimental design run. :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_id: str :param num_candidates: The number of candidates to return :type num_candidates: int :param target: An :class:``Tar...
citrination_client/models/client.py
def submit_design_run(self, data_view_id, num_candidates, effort, target=None, constraints=[], sampler="Default"): """ Submits a new experimental design run. :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_id: str ...
def submit_design_run(self, data_view_id, num_candidates, effort, target=None, constraints=[], sampler="Default"): """ Submits a new experimental design run. :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_id: str ...
[ "Submits", "a", "new", "experimental", "design", "run", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L190-L231
[ "def", "submit_design_run", "(", "self", ",", "data_view_id", ",", "num_candidates", ",", "effort", ",", "target", "=", "None", ",", "constraints", "=", "[", "]", ",", "sampler", "=", "\"Default\"", ")", ":", "if", "effort", ">", "30", ":", "raise", "Cit...
409984fc65ce101a620f069263f155303492465c
valid
ModelsClient.get_design_run_status
Retrieves the status of an in progress or completed design run :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_id: str :param run_uuid: The UUID of the design run to retrieve status for :type run_uuid: str :re...
citrination_client/models/client.py
def get_design_run_status(self, data_view_id, run_uuid): """ Retrieves the status of an in progress or completed design run :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_id: str :param run_uuid: The UUID of ...
def get_design_run_status(self, data_view_id, run_uuid): """ Retrieves the status of an in progress or completed design run :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_id: str :param run_uuid: The UUID of ...
[ "Retrieves", "the", "status", "of", "an", "in", "progress", "or", "completed", "design", "run" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L233-L256
[ "def", "get_design_run_status", "(", "self", ",", "data_view_id", ",", "run_uuid", ")", ":", "url", "=", "routes", ".", "get_data_view_design_status", "(", "data_view_id", ",", "run_uuid", ")", "response", "=", "self", ".", "_get", "(", "url", ")", ".", "jso...
409984fc65ce101a620f069263f155303492465c
valid
ModelsClient.get_design_run_results
Retrieves the results of an existing designrun :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_id: str :param run_uuid: The UUID of the design run to retrieve results from :type run_uuid: str :return: A :class...
citrination_client/models/client.py
def get_design_run_results(self, data_view_id, run_uuid): """ Retrieves the results of an existing designrun :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_id: str :param run_uuid: The UUID of the design run ...
def get_design_run_results(self, data_view_id, run_uuid): """ Retrieves the results of an existing designrun :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_id: str :param run_uuid: The UUID of the design run ...
[ "Retrieves", "the", "results", "of", "an", "existing", "designrun" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L258-L279
[ "def", "get_design_run_results", "(", "self", ",", "data_view_id", ",", "run_uuid", ")", ":", "url", "=", "routes", ".", "get_data_view_design_results", "(", "data_view_id", ",", "run_uuid", ")", "response", "=", "self", ".", "_get", "(", "url", ")", ".", "j...
409984fc65ce101a620f069263f155303492465c
valid
ModelsClient.get_data_view
Retrieves a summary of information for a given data view - view id - name - description - columns :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_id: str
citrination_client/models/client.py
def get_data_view(self, data_view_id): """ Retrieves a summary of information for a given data view - view id - name - description - columns :param data_view_id: The ID number of the data view to which the run belongs, as a string ...
def get_data_view(self, data_view_id): """ Retrieves a summary of information for a given data view - view id - name - description - columns :param data_view_id: The ID number of the data view to which the run belongs, as a string ...
[ "Retrieves", "a", "summary", "of", "information", "for", "a", "given", "data", "view", "-", "view", "id", "-", "name", "-", "description", "-", "columns" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L281-L318
[ "def", "get_data_view", "(", "self", ",", "data_view_id", ")", ":", "url", "=", "routes", ".", "get_data_view", "(", "data_view_id", ")", "response", "=", "self", ".", "_get", "(", "url", ")", ".", "json", "(", ")", "result", "=", "response", "[", "\"d...
409984fc65ce101a620f069263f155303492465c
valid
ModelsClient.kill_design_run
Kills an in progress experimental design run :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_id: str :param run_uuid: The UUID of the design run to kill :type run_uuid: str :return: The UUID of the design run
citrination_client/models/client.py
def kill_design_run(self, data_view_id, run_uuid): """ Kills an in progress experimental design run :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_id: str :param run_uuid: The UUID of the design run to kill ...
def kill_design_run(self, data_view_id, run_uuid): """ Kills an in progress experimental design run :param data_view_id: The ID number of the data view to which the run belongs, as a string :type data_view_id: str :param run_uuid: The UUID of the design run to kill ...
[ "Kills", "an", "in", "progress", "experimental", "design", "run" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/models/client.py#L320-L335
[ "def", "kill_design_run", "(", "self", ",", "data_view_id", ",", "run_uuid", ")", ":", "url", "=", "routes", ".", "kill_data_view_design_run", "(", "data_view_id", ",", "run_uuid", ")", "response", "=", "self", ".", "_delete", "(", "url", ")", ".", "json", ...
409984fc65ce101a620f069263f155303492465c
valid
load_file_as_yaml
Given a filepath, loads the file as a dictionary from YAML :param path: The path to a YAML file
citrination_client/util/credentials.py
def load_file_as_yaml(path): """ Given a filepath, loads the file as a dictionary from YAML :param path: The path to a YAML file """ with open(path, "r") as f: raw_yaml = f.read() parsed_dict = yaml.load(raw_yaml) return parsed_dict
def load_file_as_yaml(path): """ Given a filepath, loads the file as a dictionary from YAML :param path: The path to a YAML file """ with open(path, "r") as f: raw_yaml = f.read() parsed_dict = yaml.load(raw_yaml) return parsed_dict
[ "Given", "a", "filepath", "loads", "the", "file", "as", "a", "dictionary", "from", "YAML" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/util/credentials.py#L20-L29
[ "def", "load_file_as_yaml", "(", "path", ")", ":", "with", "open", "(", "path", ",", "\"r\"", ")", "as", "f", ":", "raw_yaml", "=", "f", ".", "read", "(", ")", "parsed_dict", "=", "yaml", ".", "load", "(", "raw_yaml", ")", "return", "parsed_dict" ]
409984fc65ce101a620f069263f155303492465c
valid
get_credentials_from_file
Extracts credentials from the yaml formatted credential filepath passed in. Uses the default profile if the CITRINATION_PROFILE env var is not set, otherwise looks for a profile with that name in the credentials file. :param filepath: The path of the credentials file
citrination_client/util/credentials.py
def get_credentials_from_file(filepath): """ Extracts credentials from the yaml formatted credential filepath passed in. Uses the default profile if the CITRINATION_PROFILE env var is not set, otherwise looks for a profile with that name in the credentials file. :param filepath: The path of the cre...
def get_credentials_from_file(filepath): """ Extracts credentials from the yaml formatted credential filepath passed in. Uses the default profile if the CITRINATION_PROFILE env var is not set, otherwise looks for a profile with that name in the credentials file. :param filepath: The path of the cre...
[ "Extracts", "credentials", "from", "the", "yaml", "formatted", "credential", "filepath", "passed", "in", ".", "Uses", "the", "default", "profile", "if", "the", "CITRINATION_PROFILE", "env", "var", "is", "not", "set", "otherwise", "looks", "for", "a", "profile", ...
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/util/credentials.py#L31-L56
[ "def", "get_credentials_from_file", "(", "filepath", ")", ":", "try", ":", "creds", "=", "load_file_as_yaml", "(", "filepath", ")", "except", "Exception", ":", "creds", "=", "{", "}", "profile_name", "=", "os", ".", "environ", ".", "get", "(", "citr_env_vars...
409984fc65ce101a620f069263f155303492465c
valid
get_preferred_credentials
Given an API key, a site url and a credentials file path, runs through a prioritized list of credential sources to find credentials. Specifically, this method ranks credential priority as follows: 1. Those passed in as the first two parameters to this method 2. Those found in the environment as var...
citrination_client/util/credentials.py
def get_preferred_credentials(api_key, site, cred_file=DEFAULT_CITRINATION_CREDENTIALS_FILE): """ Given an API key, a site url and a credentials file path, runs through a prioritized list of credential sources to find credentials. Specifically, this method ranks credential priority as follows: 1. T...
def get_preferred_credentials(api_key, site, cred_file=DEFAULT_CITRINATION_CREDENTIALS_FILE): """ Given an API key, a site url and a credentials file path, runs through a prioritized list of credential sources to find credentials. Specifically, this method ranks credential priority as follows: 1. T...
[ "Given", "an", "API", "key", "a", "site", "url", "and", "a", "credentials", "file", "path", "runs", "through", "a", "prioritized", "list", "of", "credential", "sources", "to", "find", "credentials", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/util/credentials.py#L58-L86
[ "def", "get_preferred_credentials", "(", "api_key", ",", "site", ",", "cred_file", "=", "DEFAULT_CITRINATION_CREDENTIALS_FILE", ")", ":", "profile_api_key", ",", "profile_site", "=", "get_credentials_from_file", "(", "cred_file", ")", "if", "api_key", "is", "None", ":...
409984fc65ce101a620f069263f155303492465c
valid
DataClient.upload
Upload a file, specifying source and dest paths a file (acts as the scp command).asdfasdf :param source_path: The path to the file on the source host asdf :type source_path: str :param dest_path: The path to the file where the contents of the upload will be written (on the dest host) :t...
citrination_client/data/client.py
def upload(self, dataset_id, source_path, dest_path=None): """ Upload a file, specifying source and dest paths a file (acts as the scp command).asdfasdf :param source_path: The path to the file on the source host asdf :type source_path: str :param dest_path: The path to the file...
def upload(self, dataset_id, source_path, dest_path=None): """ Upload a file, specifying source and dest paths a file (acts as the scp command).asdfasdf :param source_path: The path to the file on the source host asdf :type source_path: str :param dest_path: The path to the file...
[ "Upload", "a", "file", "specifying", "source", "and", "dest", "paths", "a", "file", "(", "acts", "as", "the", "scp", "command", ")", ".", "asdfasdf" ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/data/client.py#L42-L97
[ "def", "upload", "(", "self", ",", "dataset_id", ",", "source_path", ",", "dest_path", "=", "None", ")", ":", "upload_result", "=", "UploadResult", "(", ")", "source_path", "=", "str", "(", "source_path", ")", "if", "not", "dest_path", ":", "dest_path", "=...
409984fc65ce101a620f069263f155303492465c
valid
DataClient.list_files
List matched filenames in a dataset on Citrination. :param dataset_id: The ID of the dataset to search for files. :type dataset_id: int :param glob: A pattern which will be matched against files in the dataset. :type glob: str :param is_dir: A boolean indicating whether or not t...
citrination_client/data/client.py
def list_files(self, dataset_id, glob=".", is_dir=False): """ List matched filenames in a dataset on Citrination. :param dataset_id: The ID of the dataset to search for files. :type dataset_id: int :param glob: A pattern which will be matched against files in the dataset. ...
def list_files(self, dataset_id, glob=".", is_dir=False): """ List matched filenames in a dataset on Citrination. :param dataset_id: The ID of the dataset to search for files. :type dataset_id: int :param glob: A pattern which will be matched against files in the dataset. ...
[ "List", "matched", "filenames", "in", "a", "dataset", "on", "Citrination", "." ]
CitrineInformatics/python-citrination-client
python
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/data/client.py#L99-L118
[ "def", "list_files", "(", "self", ",", "dataset_id", ",", "glob", "=", "\".\"", ",", "is_dir", "=", "False", ")", ":", "data", "=", "{", "\"list\"", ":", "{", "\"glob\"", ":", "glob", ",", "\"isDir\"", ":", "is_dir", "}", "}", "return", "self", ".", ...
409984fc65ce101a620f069263f155303492465c