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
test
SSHKey._unpack_by_int
Returns a tuple with (location of next data field, contents of requested data field).
sshpubkeys/keys.py
def _unpack_by_int(self, data, current_position): """Returns a tuple with (location of next data field, contents of requested data field).""" # Unpack length of data field try: requested_data_length = struct.unpack('>I', data[current_position:current_position + self.INT_LEN])[0] ...
def _unpack_by_int(self, data, current_position): """Returns a tuple with (location of next data field, contents of requested data field).""" # Unpack length of data field try: requested_data_length = struct.unpack('>I', data[current_position:current_position + self.INT_LEN])[0] ...
[ "Returns", "a", "tuple", "with", "(", "location", "of", "next", "data", "field", "contents", "of", "requested", "data", "field", ")", "." ]
ojarva/python-sshpubkeys
python
https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L168-L188
[ "def", "_unpack_by_int", "(", "self", ",", "data", ",", "current_position", ")", ":", "# Unpack length of data field", "try", ":", "requested_data_length", "=", "struct", ".", "unpack", "(", "'>I'", ",", "data", "[", "current_position", ":", "current_position", "+...
86dc1ab27ce82dcc091ce127416cc3ee219e9bec
test
SSHKey._parse_long
Calculate two's complement.
sshpubkeys/keys.py
def _parse_long(cls, data): """Calculate two's complement.""" if sys.version < '3': # this does not exist in python 3 - undefined-variable disabled to make pylint happier. ret = long(0) # pylint:disable=undefined-variable for byte in data: ret = (ret ...
def _parse_long(cls, data): """Calculate two's complement.""" if sys.version < '3': # this does not exist in python 3 - undefined-variable disabled to make pylint happier. ret = long(0) # pylint:disable=undefined-variable for byte in data: ret = (ret ...
[ "Calculate", "two", "s", "complement", "." ]
ojarva/python-sshpubkeys
python
https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L191-L202
[ "def", "_parse_long", "(", "cls", ",", "data", ")", ":", "if", "sys", ".", "version", "<", "'3'", ":", "# this does not exist in python 3 - undefined-variable disabled to make pylint happier.", "ret", "=", "long", "(", "0", ")", "# pylint:disable=undefined-variable", "f...
86dc1ab27ce82dcc091ce127416cc3ee219e9bec
test
SSHKey.decode_key
Decode base64 coded part of the key.
sshpubkeys/keys.py
def decode_key(cls, pubkey_content): """Decode base64 coded part of the key.""" try: decoded_key = base64.b64decode(pubkey_content.encode("ascii")) except (TypeError, binascii.Error): raise MalformedDataError("Unable to decode the key") return decoded_key
def decode_key(cls, pubkey_content): """Decode base64 coded part of the key.""" try: decoded_key = base64.b64decode(pubkey_content.encode("ascii")) except (TypeError, binascii.Error): raise MalformedDataError("Unable to decode the key") return decoded_key
[ "Decode", "base64", "coded", "part", "of", "the", "key", "." ]
ojarva/python-sshpubkeys
python
https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L239-L245
[ "def", "decode_key", "(", "cls", ",", "pubkey_content", ")", ":", "try", ":", "decoded_key", "=", "base64", ".", "b64decode", "(", "pubkey_content", ".", "encode", "(", "\"ascii\"", ")", ")", "except", "(", "TypeError", ",", "binascii", ".", "Error", ")", ...
86dc1ab27ce82dcc091ce127416cc3ee219e9bec
test
SSHKey.parse_options
Parses ssh options string.
sshpubkeys/keys.py
def parse_options(self, options): """Parses ssh options string.""" quote_open = False parsed_options = {} def parse_add_single_option(opt): """Parses and validates a single option, and adds it to parsed_options field.""" if "=" in opt: opt_name, o...
def parse_options(self, options): """Parses ssh options string.""" quote_open = False parsed_options = {} def parse_add_single_option(opt): """Parses and validates a single option, and adds it to parsed_options field.""" if "=" in opt: opt_name, o...
[ "Parses", "ssh", "options", "string", "." ]
ojarva/python-sshpubkeys
python
https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L251-L295
[ "def", "parse_options", "(", "self", ",", "options", ")", ":", "quote_open", "=", "False", "parsed_options", "=", "{", "}", "def", "parse_add_single_option", "(", "opt", ")", ":", "\"\"\"Parses and validates a single option, and adds it to parsed_options field.\"\"\"", "i...
86dc1ab27ce82dcc091ce127416cc3ee219e9bec
test
SSHKey._process_ssh_rsa
Parses ssh-rsa public keys.
sshpubkeys/keys.py
def _process_ssh_rsa(self, data): """Parses ssh-rsa public keys.""" current_position, raw_e = self._unpack_by_int(data, 0) current_position, raw_n = self._unpack_by_int(data, current_position) unpacked_e = self._parse_long(raw_e) unpacked_n = self._parse_long(raw_n) sel...
def _process_ssh_rsa(self, data): """Parses ssh-rsa public keys.""" current_position, raw_e = self._unpack_by_int(data, 0) current_position, raw_n = self._unpack_by_int(data, current_position) unpacked_e = self._parse_long(raw_e) unpacked_n = self._parse_long(raw_n) sel...
[ "Parses", "ssh", "-", "rsa", "public", "keys", "." ]
ojarva/python-sshpubkeys
python
https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L297-L322
[ "def", "_process_ssh_rsa", "(", "self", ",", "data", ")", ":", "current_position", ",", "raw_e", "=", "self", ".", "_unpack_by_int", "(", "data", ",", "0", ")", "current_position", ",", "raw_n", "=", "self", ".", "_unpack_by_int", "(", "data", ",", "curren...
86dc1ab27ce82dcc091ce127416cc3ee219e9bec
test
SSHKey._process_ssh_dss
Parses ssh-dsa public keys.
sshpubkeys/keys.py
def _process_ssh_dss(self, data): """Parses ssh-dsa public keys.""" data_fields = {} current_position = 0 for item in ("p", "q", "g", "y"): current_position, value = self._unpack_by_int(data, current_position) data_fields[item] = self._parse_long(value) q...
def _process_ssh_dss(self, data): """Parses ssh-dsa public keys.""" data_fields = {} current_position = 0 for item in ("p", "q", "g", "y"): current_position, value = self._unpack_by_int(data, current_position) data_fields[item] = self._parse_long(value) q...
[ "Parses", "ssh", "-", "dsa", "public", "keys", "." ]
ojarva/python-sshpubkeys
python
https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L324-L353
[ "def", "_process_ssh_dss", "(", "self", ",", "data", ")", ":", "data_fields", "=", "{", "}", "current_position", "=", "0", "for", "item", "in", "(", "\"p\"", ",", "\"q\"", ",", "\"g\"", ",", "\"y\"", ")", ":", "current_position", ",", "value", "=", "se...
86dc1ab27ce82dcc091ce127416cc3ee219e9bec
test
SSHKey._process_ecdsa_sha
Parses ecdsa-sha public keys.
sshpubkeys/keys.py
def _process_ecdsa_sha(self, data): """Parses ecdsa-sha public keys.""" current_position, curve_information = self._unpack_by_int(data, 0) if curve_information not in self.ECDSA_CURVE_DATA: raise NotImplementedError("Invalid curve type: %s" % curve_information) curve, hash_al...
def _process_ecdsa_sha(self, data): """Parses ecdsa-sha public keys.""" current_position, curve_information = self._unpack_by_int(data, 0) if curve_information not in self.ECDSA_CURVE_DATA: raise NotImplementedError("Invalid curve type: %s" % curve_information) curve, hash_al...
[ "Parses", "ecdsa", "-", "sha", "public", "keys", "." ]
ojarva/python-sshpubkeys
python
https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L355-L370
[ "def", "_process_ecdsa_sha", "(", "self", ",", "data", ")", ":", "current_position", ",", "curve_information", "=", "self", ".", "_unpack_by_int", "(", "data", ",", "0", ")", "if", "curve_information", "not", "in", "self", ".", "ECDSA_CURVE_DATA", ":", "raise"...
86dc1ab27ce82dcc091ce127416cc3ee219e9bec
test
SSHKey._process_ed25516
Parses ed25516 keys. There is no (apparent) way to validate ed25519 keys. This only checks data length (256 bits), but does not try to validate the key in any way.
sshpubkeys/keys.py
def _process_ed25516(self, data): """Parses ed25516 keys. There is no (apparent) way to validate ed25519 keys. This only checks data length (256 bits), but does not try to validate the key in any way.""" current_position, verifying_key = self._unpack_by_int(data, 0) ver...
def _process_ed25516(self, data): """Parses ed25516 keys. There is no (apparent) way to validate ed25519 keys. This only checks data length (256 bits), but does not try to validate the key in any way.""" current_position, verifying_key = self._unpack_by_int(data, 0) ver...
[ "Parses", "ed25516", "keys", "." ]
ojarva/python-sshpubkeys
python
https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L372-L389
[ "def", "_process_ed25516", "(", "self", ",", "data", ")", ":", "current_position", ",", "verifying_key", "=", "self", ".", "_unpack_by_int", "(", "data", ",", "0", ")", "verifying_key_length", "=", "len", "(", "verifying_key", ")", "*", "8", "verifying_key", ...
86dc1ab27ce82dcc091ce127416cc3ee219e9bec
test
SSHKey.parse
Validates SSH public key. Throws exception for invalid keys. Otherwise returns None. Populates key_type, bits and bits fields. For rsa keys, see field "rsa" for raw public key data. For dsa keys, see field "dsa". For ecdsa keys, see field "ecdsa".
sshpubkeys/keys.py
def parse(self, keydata=None): """Validates SSH public key. Throws exception for invalid keys. Otherwise returns None. Populates key_type, bits and bits fields. For rsa keys, see field "rsa" for raw public key data. For dsa keys, see field "dsa". For ecdsa keys, see fi...
def parse(self, keydata=None): """Validates SSH public key. Throws exception for invalid keys. Otherwise returns None. Populates key_type, bits and bits fields. For rsa keys, see field "rsa" for raw public key data. For dsa keys, see field "dsa". For ecdsa keys, see fi...
[ "Validates", "SSH", "public", "key", "." ]
ojarva/python-sshpubkeys
python
https://github.com/ojarva/python-sshpubkeys/blob/86dc1ab27ce82dcc091ce127416cc3ee219e9bec/sshpubkeys/keys.py#L403-L446
[ "def", "parse", "(", "self", ",", "keydata", "=", "None", ")", ":", "if", "keydata", "is", "None", ":", "if", "self", ".", "keydata", "is", "None", ":", "raise", "ValueError", "(", "\"Key data must be supplied either in constructor or to parse()\"", ")", "keydat...
86dc1ab27ce82dcc091ce127416cc3ee219e9bec
test
status_list
Creates a "friendly" error message from a GSS status code. This is used to create the :attr:`GSSCException.message` of a :class:`GSSCException`. :param maj_status: The major status reported by the C GSSAPI. :type maj_status: int :param min_status: The minor status reported by the C GSSAPI. :type mi...
gssapi/error.py
def status_list(maj_status, min_status, status_type=C.GSS_C_GSS_CODE, mech_type=C.GSS_C_NO_OID): """ Creates a "friendly" error message from a GSS status code. This is used to create the :attr:`GSSCException.message` of a :class:`GSSCException`. :param maj_status: The major status reported by the C GSS...
def status_list(maj_status, min_status, status_type=C.GSS_C_GSS_CODE, mech_type=C.GSS_C_NO_OID): """ Creates a "friendly" error message from a GSS status code. This is used to create the :attr:`GSSCException.message` of a :class:`GSSCException`. :param maj_status: The major status reported by the C GSS...
[ "Creates", "a", "friendly", "error", "message", "from", "a", "GSS", "status", "code", ".", "This", "is", "used", "to", "create", "the", ":", "attr", ":", "GSSCException", ".", "message", "of", "a", ":", "class", ":", "GSSCException", "." ]
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/error.py#L19-L84
[ "def", "status_list", "(", "maj_status", ",", "min_status", ",", "status_type", "=", "C", ".", "GSS_C_GSS_CODE", ",", "mech_type", "=", "C", ".", "GSS_C_NO_OID", ")", ":", "from", ".", "oids", "import", "OID", "statuses", "=", "[", "]", "message_context", ...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Name.canonicalize
Create a canonical mechanism name (MechName) from an arbitrary internal name. The canonical MechName would be set as the :attr:`~gssapi.ctx.AcceptContext.peer_name` property on an acceptor's :class:`~gssapi.ctx.AcceptContext` if an initiator performed a successful authentication to the acceptor ...
gssapi/names.py
def canonicalize(self, mech): """ Create a canonical mechanism name (MechName) from an arbitrary internal name. The canonical MechName would be set as the :attr:`~gssapi.ctx.AcceptContext.peer_name` property on an acceptor's :class:`~gssapi.ctx.AcceptContext` if an initiator performed a ...
def canonicalize(self, mech): """ Create a canonical mechanism name (MechName) from an arbitrary internal name. The canonical MechName would be set as the :attr:`~gssapi.ctx.AcceptContext.peer_name` property on an acceptor's :class:`~gssapi.ctx.AcceptContext` if an initiator performed a ...
[ "Create", "a", "canonical", "mechanism", "name", "(", "MechName", ")", "from", "an", "arbitrary", "internal", "name", ".", "The", "canonical", "MechName", "would", "be", "set", "as", "the", ":", "attr", ":", "~gssapi", ".", "ctx", ".", "AcceptContext", "."...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/names.py#L142-L170
[ "def", "canonicalize", "(", "self", ",", "mech", ")", ":", "if", "isinstance", "(", "mech", ",", "OID", ")", ":", "oid", "=", "mech", ".", "_oid", "else", ":", "raise", "TypeError", "(", "\"Expected an OID, got \"", "+", "str", "(", "type", "(", "mech"...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
MechName.export
Returns a representation of the Mechanism Name which is suitable for direct string comparison against other exported Mechanism Names. Its form is defined in the GSSAPI specification (RFC 2743). It can also be re-imported by constructing a :class:`Name` with the `name_type` param set to :const:`g...
gssapi/names.py
def export(self): """ Returns a representation of the Mechanism Name which is suitable for direct string comparison against other exported Mechanism Names. Its form is defined in the GSSAPI specification (RFC 2743). It can also be re-imported by constructing a :class:`Name` with ...
def export(self): """ Returns a representation of the Mechanism Name which is suitable for direct string comparison against other exported Mechanism Names. Its form is defined in the GSSAPI specification (RFC 2743). It can also be re-imported by constructing a :class:`Name` with ...
[ "Returns", "a", "representation", "of", "the", "Mechanism", "Name", "which", "is", "suitable", "for", "direct", "string", "comparison", "against", "other", "exported", "Mechanism", "Names", ".", "Its", "form", "is", "defined", "in", "the", "GSSAPI", "specificati...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/names.py#L198-L225
[ "def", "export", "(", "self", ")", ":", "minor_status", "=", "ffi", ".", "new", "(", "'OM_uint32[1]'", ")", "output_buffer", "=", "ffi", ".", "new", "(", "'gss_buffer_desc[1]'", ")", "retval", "=", "C", ".", "gss_export_name", "(", "minor_status", ",", "se...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.integrity_negotiated
After :meth:`step` has been called, this property will be set to True if integrity protection (signing) has been negotiated in this context, False otherwise. If this property is True, you can use :meth:`get_mic` to sign messages with a message integrity code (MIC), which the peer application can...
gssapi/ctx.py
def integrity_negotiated(self): """ After :meth:`step` has been called, this property will be set to True if integrity protection (signing) has been negotiated in this context, False otherwise. If this property is True, you can use :meth:`get_mic` to sign messages with a message ...
def integrity_negotiated(self): """ After :meth:`step` has been called, this property will be set to True if integrity protection (signing) has been negotiated in this context, False otherwise. If this property is True, you can use :meth:`get_mic` to sign messages with a message ...
[ "After", ":", "meth", ":", "step", "has", "been", "called", "this", "property", "will", "be", "set", "to", "True", "if", "integrity", "protection", "(", "signing", ")", "has", "been", "negotiated", "in", "this", "context", "False", "otherwise", ".", "If", ...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L73-L84
[ "def", "integrity_negotiated", "(", "self", ")", ":", "return", "(", "self", ".", "flags", "&", "C", ".", "GSS_C_INTEG_FLAG", ")", "and", "(", "self", ".", "established", "or", "(", "self", ".", "flags", "&", "C", ".", "GSS_C_PROT_READY_FLAG", ")", ")" ]
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.confidentiality_negotiated
After :meth:`step` has been called, this property will be set to True if confidentiality (encryption) has been negotiated in this context, False otherwise. If this property is True, you can use :meth:`wrap` with the `conf_req` param set to True to encrypt messages sent to the peer application.
gssapi/ctx.py
def confidentiality_negotiated(self): """ After :meth:`step` has been called, this property will be set to True if confidentiality (encryption) has been negotiated in this context, False otherwise. If this property is True, you can use :meth:`wrap` with the `conf_req` param set to True t...
def confidentiality_negotiated(self): """ After :meth:`step` has been called, this property will be set to True if confidentiality (encryption) has been negotiated in this context, False otherwise. If this property is True, you can use :meth:`wrap` with the `conf_req` param set to True t...
[ "After", ":", "meth", ":", "step", "has", "been", "called", "this", "property", "will", "be", "set", "to", "True", "if", "confidentiality", "(", "encryption", ")", "has", "been", "negotiated", "in", "this", "context", "False", "otherwise", ".", "If", "this...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L87-L98
[ "def", "confidentiality_negotiated", "(", "self", ")", ":", "return", "(", "self", ".", "flags", "&", "C", ".", "GSS_C_CONF_FLAG", ")", "and", "(", "self", ".", "established", "or", "(", "self", ".", "flags", "&", "C", ".", "GSS_C_PROT_READY_FLAG", ")", ...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.replay_detection_negotiated
After :meth:`step` has been called, this property will be set to True if the security context can use replay detection for messages protected by :meth:`get_mic` and :meth:`wrap`. False if replay detection cannot be used.
gssapi/ctx.py
def replay_detection_negotiated(self): """ After :meth:`step` has been called, this property will be set to True if the security context can use replay detection for messages protected by :meth:`get_mic` and :meth:`wrap`. False if replay detection cannot be used. """ retu...
def replay_detection_negotiated(self): """ After :meth:`step` has been called, this property will be set to True if the security context can use replay detection for messages protected by :meth:`get_mic` and :meth:`wrap`. False if replay detection cannot be used. """ retu...
[ "After", ":", "meth", ":", "step", "has", "been", "called", "this", "property", "will", "be", "set", "to", "True", "if", "the", "security", "context", "can", "use", "replay", "detection", "for", "messages", "protected", "by", ":", "meth", ":", "get_mic", ...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L101-L111
[ "def", "replay_detection_negotiated", "(", "self", ")", ":", "return", "(", "self", ".", "flags", "&", "C", ".", "GSS_C_REPLAY_FLAG", ")", "and", "(", "self", ".", "established", "or", "(", "self", ".", "flags", "&", "C", ".", "GSS_C_PROT_READY_FLAG", ")",...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.sequence_detection_negotiated
After :meth:`step` has been called, this property will be set to True if the security context can use out-of-sequence message detection for messages protected by :meth:`get_mic` and :meth:`wrap`. False if OOS detection cannot be used.
gssapi/ctx.py
def sequence_detection_negotiated(self): """ After :meth:`step` has been called, this property will be set to True if the security context can use out-of-sequence message detection for messages protected by :meth:`get_mic` and :meth:`wrap`. False if OOS detection cannot be used. ...
def sequence_detection_negotiated(self): """ After :meth:`step` has been called, this property will be set to True if the security context can use out-of-sequence message detection for messages protected by :meth:`get_mic` and :meth:`wrap`. False if OOS detection cannot be used. ...
[ "After", ":", "meth", ":", "step", "has", "been", "called", "this", "property", "will", "be", "set", "to", "True", "if", "the", "security", "context", "can", "use", "out", "-", "of", "-", "sequence", "message", "detection", "for", "messages", "protected", ...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L114-L124
[ "def", "sequence_detection_negotiated", "(", "self", ")", ":", "return", "(", "self", ".", "flags", "&", "C", ".", "GSS_C_SEQUENCE_FLAG", ")", "and", "(", "self", ".", "established", "or", "(", "self", ".", "flags", "&", "C", ".", "GSS_C_PROT_READY_FLAG", ...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.get_mic
Calculates a cryptographic message integrity code (MIC) over an application message, and returns that MIC in a token. This is in contrast to :meth:`wrap` which calculates a MIC over a message, optionally encrypts it and returns the original message and the MIC packed into a single token. The pee...
gssapi/ctx.py
def get_mic(self, message, qop_req=C.GSS_C_QOP_DEFAULT): """ Calculates a cryptographic message integrity code (MIC) over an application message, and returns that MIC in a token. This is in contrast to :meth:`wrap` which calculates a MIC over a message, optionally encrypts it and returns...
def get_mic(self, message, qop_req=C.GSS_C_QOP_DEFAULT): """ Calculates a cryptographic message integrity code (MIC) over an application message, and returns that MIC in a token. This is in contrast to :meth:`wrap` which calculates a MIC over a message, optionally encrypts it and returns...
[ "Calculates", "a", "cryptographic", "message", "integrity", "code", "(", "MIC", ")", "over", "an", "application", "message", "and", "returns", "that", "MIC", "in", "a", "token", ".", "This", "is", "in", "contrast", "to", ":", "meth", ":", "wrap", "which", ...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L153-L197
[ "def", "get_mic", "(", "self", ",", "message", ",", "qop_req", "=", "C", ".", "GSS_C_QOP_DEFAULT", ")", ":", "if", "not", "(", "self", ".", "flags", "&", "C", ".", "GSS_C_INTEG_FLAG", ")", ":", "raise", "GSSException", "(", "\"No integrity protection negotia...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.verify_mic
Takes a message integrity code (MIC) that has been generated by the peer application for a given message, and verifies it against a message, using this security context's cryptographic keys. The `supplementary` parameter determines how this method deals with replayed, unsequential, too-...
gssapi/ctx.py
def verify_mic(self, message, mic, supplementary=False): """ Takes a message integrity code (MIC) that has been generated by the peer application for a given message, and verifies it against a message, using this security context's cryptographic keys. The `supplementary` paramet...
def verify_mic(self, message, mic, supplementary=False): """ Takes a message integrity code (MIC) that has been generated by the peer application for a given message, and verifies it against a message, using this security context's cryptographic keys. The `supplementary` paramet...
[ "Takes", "a", "message", "integrity", "code", "(", "MIC", ")", "that", "has", "been", "generated", "by", "the", "peer", "application", "for", "a", "given", "message", "and", "verifies", "it", "against", "a", "message", "using", "this", "security", "context",...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L199-L271
[ "def", "verify_mic", "(", "self", ",", "message", ",", "mic", ",", "supplementary", "=", "False", ")", ":", "if", "not", "(", "self", ".", "flags", "&", "C", ".", "GSS_C_INTEG_FLAG", ")", ":", "raise", "GSSException", "(", "\"No integrity protection negotiat...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.wrap
Wraps a message with a message integrity code, and if `conf_req` is True, encrypts the message. The message can be decrypted and the MIC verified by the peer by passing the token returned from this method to :meth:`unwrap` on the peer's side. :param message: The message to wrap :type me...
gssapi/ctx.py
def wrap(self, message, conf_req=True, qop_req=C.GSS_C_QOP_DEFAULT): """ Wraps a message with a message integrity code, and if `conf_req` is True, encrypts the message. The message can be decrypted and the MIC verified by the peer by passing the token returned from this method to :meth:`...
def wrap(self, message, conf_req=True, qop_req=C.GSS_C_QOP_DEFAULT): """ Wraps a message with a message integrity code, and if `conf_req` is True, encrypts the message. The message can be decrypted and the MIC verified by the peer by passing the token returned from this method to :meth:`...
[ "Wraps", "a", "message", "with", "a", "message", "integrity", "code", "and", "if", "conf_req", "is", "True", "encrypts", "the", "message", ".", "The", "message", "can", "be", "decrypted", "and", "the", "MIC", "verified", "by", "the", "peer", "by", "passing...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L273-L329
[ "def", "wrap", "(", "self", ",", "message", ",", "conf_req", "=", "True", ",", "qop_req", "=", "C", ".", "GSS_C_QOP_DEFAULT", ")", ":", "if", "not", "(", "self", ".", "flags", "&", "C", ".", "GSS_C_INTEG_FLAG", ")", ":", "raise", "GSSException", "(", ...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.unwrap
Takes a token that has been generated by the peer application with :meth:`wrap`, verifies and optionally decrypts it, using this security context's cryptographic keys. The `supplementary` parameter determines how this method deals with replayed, unsequential, too-old or missing tokens, as follo...
gssapi/ctx.py
def unwrap(self, message, conf_req=True, qop_req=None, supplementary=False): """ Takes a token that has been generated by the peer application with :meth:`wrap`, verifies and optionally decrypts it, using this security context's cryptographic keys. The `supplementary` parameter determin...
def unwrap(self, message, conf_req=True, qop_req=None, supplementary=False): """ Takes a token that has been generated by the peer application with :meth:`wrap`, verifies and optionally decrypts it, using this security context's cryptographic keys. The `supplementary` parameter determin...
[ "Takes", "a", "token", "that", "has", "been", "generated", "by", "the", "peer", "application", "with", ":", "meth", ":", "wrap", "verifies", "and", "optionally", "decrypts", "it", "using", "this", "security", "context", "s", "cryptographic", "keys", "." ]
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L331-L416
[ "def", "unwrap", "(", "self", ",", "message", ",", "conf_req", "=", "True", ",", "qop_req", "=", "None", ",", "supplementary", "=", "False", ")", ":", "if", "not", "(", "self", ".", "flags", "&", "C", ".", "GSS_C_INTEG_FLAG", ")", ":", "raise", "GSSE...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.get_wrap_size_limit
Calculates the maximum size of message that can be fed to :meth:`wrap` so that the size of the resulting wrapped token (message plus wrapping overhead) is no more than a given maximum output size. :param output_size: The maximum output size (in bytes) of a wrapped token :type output_siz...
gssapi/ctx.py
def get_wrap_size_limit(self, output_size, conf_req=True, qop_req=C.GSS_C_QOP_DEFAULT): """ Calculates the maximum size of message that can be fed to :meth:`wrap` so that the size of the resulting wrapped token (message plus wrapping overhead) is no more than a given maximum output size....
def get_wrap_size_limit(self, output_size, conf_req=True, qop_req=C.GSS_C_QOP_DEFAULT): """ Calculates the maximum size of message that can be fed to :meth:`wrap` so that the size of the resulting wrapped token (message plus wrapping overhead) is no more than a given maximum output size....
[ "Calculates", "the", "maximum", "size", "of", "message", "that", "can", "be", "fed", "to", ":", "meth", ":", "wrap", "so", "that", "the", "size", "of", "the", "resulting", "wrapped", "token", "(", "message", "plus", "wrapping", "overhead", ")", "is", "no...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L418-L449
[ "def", "get_wrap_size_limit", "(", "self", ",", "output_size", ",", "conf_req", "=", "True", ",", "qop_req", "=", "C", ".", "GSS_C_QOP_DEFAULT", ")", ":", "minor_status", "=", "ffi", ".", "new", "(", "'OM_uint32[1]'", ")", "max_input_size", "=", "ffi", ".", ...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.process_context_token
Provides a way to pass an asynchronous token to the security context, outside of the normal context-establishment token passing flow. This method is not normally used, but some example uses are: * when the initiator's context is established successfully but the acceptor's context isn't ...
gssapi/ctx.py
def process_context_token(self, context_token): """ Provides a way to pass an asynchronous token to the security context, outside of the normal context-establishment token passing flow. This method is not normally used, but some example uses are: * when the initiator's context i...
def process_context_token(self, context_token): """ Provides a way to pass an asynchronous token to the security context, outside of the normal context-establishment token passing flow. This method is not normally used, but some example uses are: * when the initiator's context i...
[ "Provides", "a", "way", "to", "pass", "an", "asynchronous", "token", "to", "the", "security", "context", "outside", "of", "the", "normal", "context", "-", "establishment", "token", "passing", "flow", ".", "This", "method", "is", "not", "normally", "used", "b...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L451-L484
[ "def", "process_context_token", "(", "self", ",", "context_token", ")", ":", "minor_status", "=", "ffi", ".", "new", "(", "'OM_uint32[1]'", ")", "context_token_buffer", "=", "ffi", ".", "new", "(", "'gss_buffer_desc[1]'", ")", "context_token_buffer", "[", "0", "...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.export
This method deactivates the security context for the calling process and returns an interprocess token which, when passed to :meth:`imprt` in another process, will re-activate the context in the second process. Only a single instantiation of a given context may be active at any one time; attempt...
gssapi/ctx.py
def export(self): """ This method deactivates the security context for the calling process and returns an interprocess token which, when passed to :meth:`imprt` in another process, will re-activate the context in the second process. Only a single instantiation of a given context may be ...
def export(self): """ This method deactivates the security context for the calling process and returns an interprocess token which, when passed to :meth:`imprt` in another process, will re-activate the context in the second process. Only a single instantiation of a given context may be ...
[ "This", "method", "deactivates", "the", "security", "context", "for", "the", "calling", "process", "and", "returns", "an", "interprocess", "token", "which", "when", "passed", "to", ":", "meth", ":", "imprt", "in", "another", "process", "will", "re", "-", "ac...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L486-L523
[ "def", "export", "(", "self", ")", ":", "if", "not", "(", "self", ".", "flags", "&", "C", ".", "GSS_C_TRANS_FLAG", ")", ":", "raise", "GSSException", "(", "\"Context is not transferable.\"", ")", "if", "not", "self", ".", "_ctx", ":", "raise", "GSSExceptio...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.imprt
This is the corresponding method to :meth:`export`, used to import a saved context token from another process into this one and construct a :class:`Context` object from it. :param import_token: a token obtained from the :meth:`export` of another context :type import_token: bytes :return...
gssapi/ctx.py
def imprt(import_token): """ This is the corresponding method to :meth:`export`, used to import a saved context token from another process into this one and construct a :class:`Context` object from it. :param import_token: a token obtained from the :meth:`export` of another context ...
def imprt(import_token): """ This is the corresponding method to :meth:`export`, used to import a saved context token from another process into this one and construct a :class:`Context` object from it. :param import_token: a token obtained from the :meth:`export` of another context ...
[ "This", "is", "the", "corresponding", "method", "to", ":", "meth", ":", "export", "used", "to", "import", "a", "saved", "context", "token", "from", "another", "process", "into", "this", "one", "and", "construct", "a", ":", "class", ":", "Context", "object"...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L526-L593
[ "def", "imprt", "(", "import_token", ")", ":", "minor_status", "=", "ffi", ".", "new", "(", "'OM_uint32[1]'", ")", "import_token_buffer", "=", "ffi", ".", "new", "(", "'gss_buffer_desc[1]'", ")", "import_token_buffer", "[", "0", "]", ".", "length", "=", "len...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.lifetime
The lifetime of the context in seconds (only valid after :meth:`step` has been called). If the context does not have a time limit on its validity, this will be :const:`gssapi.C_INDEFINITE`
gssapi/ctx.py
def lifetime(self): """ The lifetime of the context in seconds (only valid after :meth:`step` has been called). If the context does not have a time limit on its validity, this will be :const:`gssapi.C_INDEFINITE` """ minor_status = ffi.new('OM_uint32[1]') lifetim...
def lifetime(self): """ The lifetime of the context in seconds (only valid after :meth:`step` has been called). If the context does not have a time limit on its validity, this will be :const:`gssapi.C_INDEFINITE` """ minor_status = ffi.new('OM_uint32[1]') lifetim...
[ "The", "lifetime", "of", "the", "context", "in", "seconds", "(", "only", "valid", "after", ":", "meth", ":", "step", "has", "been", "called", ")", ".", "If", "the", "context", "does", "not", "have", "a", "time", "limit", "on", "its", "validity", "this"...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L596-L622
[ "def", "lifetime", "(", "self", ")", ":", "minor_status", "=", "ffi", ".", "new", "(", "'OM_uint32[1]'", ")", "lifetime_rec", "=", "ffi", ".", "new", "(", "'OM_uint32[1]'", ")", "retval", "=", "C", ".", "gss_inquire_context", "(", "minor_status", ",", "sel...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Context.delete
Delete a security context. This method will delete the local data structures associated with the specified security context, and may return an output token, which when passed to :meth:`process_context_token` on the peer may instruct it to also delete its context. RFC 2744 recommends that GSSAPI...
gssapi/ctx.py
def delete(self): """ Delete a security context. This method will delete the local data structures associated with the specified security context, and may return an output token, which when passed to :meth:`process_context_token` on the peer may instruct it to also delete its context. ...
def delete(self): """ Delete a security context. This method will delete the local data structures associated with the specified security context, and may return an output token, which when passed to :meth:`process_context_token` on the peer may instruct it to also delete its context. ...
[ "Delete", "a", "security", "context", ".", "This", "method", "will", "delete", "the", "local", "data", "structures", "associated", "with", "the", "specified", "security", "context", "and", "may", "return", "an", "output", "token", "which", "when", "passed", "t...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L624-L662
[ "def", "delete", "(", "self", ")", ":", "if", "not", "self", ".", "_ctx", "[", "0", "]", ":", "raise", "GSSException", "(", "\"Can't delete invalid context\"", ")", "output_token_buffer", "=", "ffi", ".", "new", "(", "'gss_buffer_desc[1]'", ")", "minor_status"...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
InitContext.step
Performs a step to establish the context as an initiator. This method should be called in a loop and fed input tokens from the acceptor, and its output tokens should be sent to the acceptor, until this context's :attr:`established` attribute is True. :param input_token: The input token...
gssapi/ctx.py
def step(self, input_token=None): """Performs a step to establish the context as an initiator. This method should be called in a loop and fed input tokens from the acceptor, and its output tokens should be sent to the acceptor, until this context's :attr:`established` attribute is True....
def step(self, input_token=None): """Performs a step to establish the context as an initiator. This method should be called in a loop and fed input tokens from the acceptor, and its output tokens should be sent to the acceptor, until this context's :attr:`established` attribute is True....
[ "Performs", "a", "step", "to", "establish", "the", "context", "as", "an", "initiator", "." ]
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L725-L810
[ "def", "step", "(", "self", ",", "input_token", "=", "None", ")", ":", "minor_status", "=", "ffi", ".", "new", "(", "'OM_uint32[1]'", ")", "if", "input_token", ":", "input_token_buffer", "=", "ffi", ".", "new", "(", "'gss_buffer_desc[1]'", ")", "input_token_...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
AcceptContext.step
Performs a step to establish the context as an acceptor. This method should be called in a loop and fed input tokens from the initiator, and its output tokens should be sent to the initiator, until this context's :attr:`established` attribute is True. :param input_token: The input toke...
gssapi/ctx.py
def step(self, input_token): """Performs a step to establish the context as an acceptor. This method should be called in a loop and fed input tokens from the initiator, and its output tokens should be sent to the initiator, until this context's :attr:`established` attribute is True. ...
def step(self, input_token): """Performs a step to establish the context as an acceptor. This method should be called in a loop and fed input tokens from the initiator, and its output tokens should be sent to the initiator, until this context's :attr:`established` attribute is True. ...
[ "Performs", "a", "step", "to", "establish", "the", "context", "as", "an", "acceptor", "." ]
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/ctx.py#L865-L951
[ "def", "step", "(", "self", ",", "input_token", ")", ":", "minor_status", "=", "ffi", ".", "new", "(", "'OM_uint32[1]'", ")", "input_token_buffer", "=", "ffi", ".", "new", "(", "'gss_buffer_desc[1]'", ")", "input_token_buffer", "[", "0", "]", ".", "length", ...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Credential.mechs
The set of mechanisms supported by the credential. :type: :class:`~gssapi.oids.OIDSet`
gssapi/creds.py
def mechs(self): """ The set of mechanisms supported by the credential. :type: :class:`~gssapi.oids.OIDSet` """ if not self._mechs: self._mechs = self._inquire(False, False, False, True)[3] return self._mechs
def mechs(self): """ The set of mechanisms supported by the credential. :type: :class:`~gssapi.oids.OIDSet` """ if not self._mechs: self._mechs = self._inquire(False, False, False, True)[3] return self._mechs
[ "The", "set", "of", "mechanisms", "supported", "by", "the", "credential", "." ]
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/creds.py#L218-L226
[ "def", "mechs", "(", "self", ")", ":", "if", "not", "self", ".", "_mechs", ":", "self", ".", "_mechs", "=", "self", ".", "_inquire", "(", "False", ",", "False", ",", "False", ",", "True", ")", "[", "3", "]", "return", "self", ".", "_mechs" ]
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Credential.export
Serializes this credential into a byte string, which can be passed to :meth:`imprt` in another process in order to deserialize the byte string back into a credential. Exporting a credential does not destroy it. :returns: The serialized token representation of this credential. :rtype: by...
gssapi/creds.py
def export(self): """ Serializes this credential into a byte string, which can be passed to :meth:`imprt` in another process in order to deserialize the byte string back into a credential. Exporting a credential does not destroy it. :returns: The serialized token representation ...
def export(self): """ Serializes this credential into a byte string, which can be passed to :meth:`imprt` in another process in order to deserialize the byte string back into a credential. Exporting a credential does not destroy it. :returns: The serialized token representation ...
[ "Serializes", "this", "credential", "into", "a", "byte", "string", "which", "can", "be", "passed", "to", ":", "meth", ":", "imprt", "in", "another", "process", "in", "order", "to", "deserialize", "the", "byte", "string", "back", "into", "a", "credential", ...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/creds.py#L266-L293
[ "def", "export", "(", "self", ")", ":", "if", "not", "hasattr", "(", "C", ",", "'gss_export_cred'", ")", ":", "raise", "NotImplementedError", "(", "\"The GSSAPI implementation does not support gss_export_cred\"", ")", "minor_status", "=", "ffi", ".", "new", "(", "...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Credential.imprt
Deserializes a byte string token into a :class:`Credential` object. The token must have previously been exported by the same GSSAPI implementation as is being used to import it. :param token: A token previously obtained from the :meth:`export` of another :class:`Credential` object. ...
gssapi/creds.py
def imprt(cls, token): """ Deserializes a byte string token into a :class:`Credential` object. The token must have previously been exported by the same GSSAPI implementation as is being used to import it. :param token: A token previously obtained from the :meth:`export` of another ...
def imprt(cls, token): """ Deserializes a byte string token into a :class:`Credential` object. The token must have previously been exported by the same GSSAPI implementation as is being used to import it. :param token: A token previously obtained from the :meth:`export` of another ...
[ "Deserializes", "a", "byte", "string", "token", "into", "a", ":", "class", ":", "Credential", "object", ".", "The", "token", "must", "have", "previously", "been", "exported", "by", "the", "same", "GSSAPI", "implementation", "as", "is", "being", "used", "to",...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/creds.py#L296-L331
[ "def", "imprt", "(", "cls", ",", "token", ")", ":", "if", "not", "hasattr", "(", "C", ",", "'gss_import_cred'", ")", ":", "raise", "NotImplementedError", "(", "\"The GSSAPI implementation does not support gss_import_cred\"", ")", "minor_status", "=", "ffi", ".", "...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
Credential.store
Stores this credential into a 'credential store'. It can either store this credential in the default credential store, or into a specific credential store specified by a set of mechanism-specific key-value pairs. The former method of operation requires that the underlying GSSAPI implementation s...
gssapi/creds.py
def store(self, usage=None, mech=None, overwrite=False, default=False, cred_store=None): """ Stores this credential into a 'credential store'. It can either store this credential in the default credential store, or into a specific credential store specified by a set of mechanism-specific...
def store(self, usage=None, mech=None, overwrite=False, default=False, cred_store=None): """ Stores this credential into a 'credential store'. It can either store this credential in the default credential store, or into a specific credential store specified by a set of mechanism-specific...
[ "Stores", "this", "credential", "into", "a", "credential", "store", ".", "It", "can", "either", "store", "this", "credential", "in", "the", "default", "credential", "store", "or", "into", "a", "specific", "credential", "store", "specified", "by", "a", "set", ...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/creds.py#L333-L426
[ "def", "store", "(", "self", ",", "usage", "=", "None", ",", "mech", "=", "None", ",", "overwrite", "=", "False", ",", "default", "=", "False", ",", "cred_store", "=", "None", ")", ":", "if", "usage", "is", "None", ":", "usage", "=", "self", ".", ...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
get_all_mechs
Return an :class:`OIDSet` of all the mechanisms supported by the underlying GSSAPI implementation.
gssapi/oids.py
def get_all_mechs(): """ Return an :class:`OIDSet` of all the mechanisms supported by the underlying GSSAPI implementation. """ minor_status = ffi.new('OM_uint32[1]') mech_set = ffi.new('gss_OID_set[1]') try: retval = C.gss_indicate_mechs(minor_status, mech_set) if GSS_ERROR(...
def get_all_mechs(): """ Return an :class:`OIDSet` of all the mechanisms supported by the underlying GSSAPI implementation. """ minor_status = ffi.new('OM_uint32[1]') mech_set = ffi.new('gss_OID_set[1]') try: retval = C.gss_indicate_mechs(minor_status, mech_set) if GSS_ERROR(...
[ "Return", "an", ":", "class", ":", "OIDSet", "of", "all", "the", "mechanisms", "supported", "by", "the", "underlying", "GSSAPI", "implementation", "." ]
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/oids.py#L17-L31
[ "def", "get_all_mechs", "(", ")", ":", "minor_status", "=", "ffi", ".", "new", "(", "'OM_uint32[1]'", ")", "mech_set", "=", "ffi", ".", "new", "(", "'gss_OID_set[1]'", ")", "try", ":", "retval", "=", "C", ".", "gss_indicate_mechs", "(", "minor_status", ","...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
OID.mech_from_string
Takes a string form of a mechanism OID, in dot-separated: "1.2.840.113554.1.2.2" or numeric ASN.1: "{1 2 840 113554 1 2 2}" notation, and returns an :class:`OID` object representing the mechanism, which can be passed to other GSSAPI methods. :param input_string: a string representing the desire...
gssapi/oids.py
def mech_from_string(input_string): """ Takes a string form of a mechanism OID, in dot-separated: "1.2.840.113554.1.2.2" or numeric ASN.1: "{1 2 840 113554 1 2 2}" notation, and returns an :class:`OID` object representing the mechanism, which can be passed to other GSSAPI methods. ...
def mech_from_string(input_string): """ Takes a string form of a mechanism OID, in dot-separated: "1.2.840.113554.1.2.2" or numeric ASN.1: "{1 2 840 113554 1 2 2}" notation, and returns an :class:`OID` object representing the mechanism, which can be passed to other GSSAPI methods. ...
[ "Takes", "a", "string", "form", "of", "a", "mechanism", "OID", "in", "dot", "-", "separated", ":", "1", ".", "2", ".", "840", ".", "113554", ".", "1", ".", "2", ".", "2", "or", "numeric", "ASN", ".", "1", ":", "{", "1", "2", "840", "113554", ...
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/oids.py#L70-L91
[ "def", "mech_from_string", "(", "input_string", ")", ":", "if", "not", "re", ".", "match", "(", "r'^\\d+(\\.\\d+)*$'", ",", "input_string", ")", ":", "if", "re", ".", "match", "(", "r'^\\{\\d+( \\d+)*\\}$'", ",", "input_string", ")", ":", "input_string", "=", ...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
OIDSet.singleton_set
Factory function to create a new :class:`OIDSet` with a single member. :param single_oid: the OID to use as a member of the new set :type single_oid: :class:`OID` :returns: an OID set with the OID passed in as the only member :rtype: :class:`OIDSet`
gssapi/oids.py
def singleton_set(cls, single_oid): """ Factory function to create a new :class:`OIDSet` with a single member. :param single_oid: the OID to use as a member of the new set :type single_oid: :class:`OID` :returns: an OID set with the OID passed in as the only member :rtyp...
def singleton_set(cls, single_oid): """ Factory function to create a new :class:`OIDSet` with a single member. :param single_oid: the OID to use as a member of the new set :type single_oid: :class:`OID` :returns: an OID set with the OID passed in as the only member :rtyp...
[ "Factory", "function", "to", "create", "a", "new", ":", "class", ":", "OIDSet", "with", "a", "single", "member", "." ]
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/oids.py#L165-L190
[ "def", "singleton_set", "(", "cls", ",", "single_oid", ")", ":", "new_set", "=", "cls", "(", ")", "oid_ptr", "=", "None", "if", "isinstance", "(", "single_oid", ",", "OID", ")", ":", "oid_ptr", "=", "ffi", ".", "addressof", "(", "single_oid", ".", "_oi...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
MutableOIDSet.add
Adds another :class:`OID` to this set. :param new_oid: the OID to add. :type new_oid: :class:`OID`
gssapi/oids.py
def add(self, new_oid): """ Adds another :class:`OID` to this set. :param new_oid: the OID to add. :type new_oid: :class:`OID` """ if self._oid_set[0]: oid_ptr = None if isinstance(new_oid, OID): oid_ptr = ffi.addressof(new_oid._oi...
def add(self, new_oid): """ Adds another :class:`OID` to this set. :param new_oid: the OID to add. :type new_oid: :class:`OID` """ if self._oid_set[0]: oid_ptr = None if isinstance(new_oid, OID): oid_ptr = ffi.addressof(new_oid._oi...
[ "Adds", "another", ":", "class", ":", "OID", "to", "this", "set", "." ]
sigmaris/python-gssapi
python
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/oids.py#L224-L248
[ "def", "add", "(", "self", ",", "new_oid", ")", ":", "if", "self", ".", "_oid_set", "[", "0", "]", ":", "oid_ptr", "=", "None", "if", "isinstance", "(", "new_oid", ",", "OID", ")", ":", "oid_ptr", "=", "ffi", ".", "addressof", "(", "new_oid", ".", ...
a8ca577b3ccf9d9fa48f16f4954a1eddd5896236
test
main
Imports and runs setup function with given properties.
setup.py
def main(properties=properties, options=options, **custom_options): """Imports and runs setup function with given properties.""" return init(**dict(options, **custom_options))(**properties)
def main(properties=properties, options=options, **custom_options): """Imports and runs setup function with given properties.""" return init(**dict(options, **custom_options))(**properties)
[ "Imports", "and", "runs", "setup", "function", "with", "given", "properties", "." ]
salsita/flask-raml
python
https://github.com/salsita/flask-raml/blob/9876f19d49401fa32f7d852239aa295a78149ab2/setup.py#L82-L84
[ "def", "main", "(", "properties", "=", "properties", ",", "options", "=", "options", ",", "*", "*", "custom_options", ")", ":", "return", "init", "(", "*", "*", "dict", "(", "options", ",", "*", "*", "custom_options", ")", ")", "(", "*", "*", "proper...
9876f19d49401fa32f7d852239aa295a78149ab2
test
init
Imports and returns a setup function. If use_markdown_readme is set, then README.md is added to setuptools READMES list. If use_stdeb is set on a Debian based system, then module stdeb is imported. Stdeb supports building deb packages on Debian based systems. The package should only be install...
setup.py
def init( dist='dist', minver=None, maxver=None, use_markdown_readme=True, use_stdeb=False, use_distribute=False, ): """Imports and returns a setup function. If use_markdown_readme is set, then README.md is added to setuptools READMES list. If use_stdeb is set on a Debian b...
def init( dist='dist', minver=None, maxver=None, use_markdown_readme=True, use_stdeb=False, use_distribute=False, ): """Imports and returns a setup function. If use_markdown_readme is set, then README.md is added to setuptools READMES list. If use_stdeb is set on a Debian b...
[ "Imports", "and", "returns", "a", "setup", "function", "." ]
salsita/flask-raml
python
https://github.com/salsita/flask-raml/blob/9876f19d49401fa32f7d852239aa295a78149ab2/setup.py#L86-L141
[ "def", "init", "(", "dist", "=", "'dist'", ",", "minver", "=", "None", ",", "maxver", "=", "None", ",", "use_markdown_readme", "=", "True", ",", "use_stdeb", "=", "False", ",", "use_distribute", "=", "False", ",", ")", ":", "if", "not", "minver", "==",...
9876f19d49401fa32f7d852239aa295a78149ab2
test
main
kwargs: 'command_publish_address': in the form of `tcp://*:5555` or any other zeromq address format. IE `ipc://*:5555` 'command_subscribe_address': in the form of `tcp://*:5555` or any other zeromq address format. IE `ipc://*:5555` 'audio_publish_address': in the form of `tcp:/...
microphone/__main__.py
def main(context=None, *args, **kwargs): """ kwargs: 'command_publish_address': in the form of `tcp://*:5555` or any other zeromq address format. IE `ipc://*:5555` 'command_subscribe_address': in the form of `tcp://*:5555` or any other zeromq address format. IE `ipc://*:5555` ...
def main(context=None, *args, **kwargs): """ kwargs: 'command_publish_address': in the form of `tcp://*:5555` or any other zeromq address format. IE `ipc://*:5555` 'command_subscribe_address': in the form of `tcp://*:5555` or any other zeromq address format. IE `ipc://*:5555` ...
[ "kwargs", ":", "command_publish_address", ":", "in", "the", "form", "of", "tcp", ":", "//", "*", ":", "5555", "or", "any", "other", "zeromq", "address", "format", ".", "IE", "ipc", ":", "//", "*", ":", "5555" ]
benhoff/microphone
python
https://github.com/benhoff/microphone/blob/a89e339a9a4a17d19fd1a8cb99efee3402b65673/microphone/__main__.py#L12-L74
[ "def", "main", "(", "context", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Get configuration", "args", "=", "_get_command_line_args", "(", ")", "# Get settings filepath", "settings_filepath", "=", "args", ".", "get", "(", "'settings_pa...
a89e339a9a4a17d19fd1a8cb99efee3402b65673
test
_create_file
Returns a file handle which is used to record audio
examples/record_audio.py
def _create_file(): """ Returns a file handle which is used to record audio """ f = wave.open('audio.wav', mode='wb') f.setnchannels(2) p = pyaudio.PyAudio() f.setsampwidth(p.get_sample_size(pyaudio.paInt16)) f.setframerate(p.get_default_input_device_info()['defaultSampleRate']) try:...
def _create_file(): """ Returns a file handle which is used to record audio """ f = wave.open('audio.wav', mode='wb') f.setnchannels(2) p = pyaudio.PyAudio() f.setsampwidth(p.get_sample_size(pyaudio.paInt16)) f.setframerate(p.get_default_input_device_info()['defaultSampleRate']) try:...
[ "Returns", "a", "file", "handle", "which", "is", "used", "to", "record", "audio" ]
benhoff/microphone
python
https://github.com/benhoff/microphone/blob/a89e339a9a4a17d19fd1a8cb99efee3402b65673/examples/record_audio.py#L15-L27
[ "def", "_create_file", "(", ")", ":", "f", "=", "wave", ".", "open", "(", "'audio.wav'", ",", "mode", "=", "'wb'", ")", "f", ".", "setnchannels", "(", "2", ")", "p", "=", "pyaudio", ".", "PyAudio", "(", ")", "f", ".", "setsampwidth", "(", "p", "....
a89e339a9a4a17d19fd1a8cb99efee3402b65673
test
PyAudio.get_devices
if device_type == plugin.audioengine.DEVICE_TYPE_ALL: return devs else: return [device for device in devs if device_type in device.types]
microphone/pyaudio_.py
def get_devices(self, device_type='all'): num_devices = self._pyaudio.get_device_count() self._logger.debug('Found %d PyAudio devices', num_devices) for i in range(num_devices): info = self._pyaudio.get_device_info_by_index(i) name = info['name'] if name in se...
def get_devices(self, device_type='all'): num_devices = self._pyaudio.get_device_count() self._logger.debug('Found %d PyAudio devices', num_devices) for i in range(num_devices): info = self._pyaudio.get_device_info_by_index(i) name = info['name'] if name in se...
[ "if", "device_type", "==", "plugin", ".", "audioengine", ".", "DEVICE_TYPE_ALL", ":", "return", "devs", "else", ":", "return", "[", "device", "for", "device", "in", "devs", "if", "device_type", "in", "device", ".", "types", "]" ]
benhoff/microphone
python
https://github.com/benhoff/microphone/blob/a89e339a9a4a17d19fd1a8cb99efee3402b65673/microphone/pyaudio_.py#L70-L87
[ "def", "get_devices", "(", "self", ",", "device_type", "=", "'all'", ")", ":", "num_devices", "=", "self", ".", "_pyaudio", ".", "get_device_count", "(", ")", "self", ".", "_logger", ".", "debug", "(", "'Found %d PyAudio devices'", ",", "num_devices", ")", "...
a89e339a9a4a17d19fd1a8cb99efee3402b65673
test
PyAudioDevice.open_stream
self._logger.debug("%s stream opened on device '%s' (%d Hz, %d " + "channel, %d bit)", "output" if output else "input", self.slug, rate, channels, bits)
microphone/pyaudio_.py
def open_stream(self, bits, channels, rate=None, chunksize=1024, output=True): if rate is None: rate = int(self.info['defaultSampleRate']) # Check if format is supported is_supported_...
def open_stream(self, bits, channels, rate=None, chunksize=1024, output=True): if rate is None: rate = int(self.info['defaultSampleRate']) # Check if format is supported is_supported_...
[ "self", ".", "_logger", ".", "debug", "(", "%s", "stream", "opened", "on", "device", "%s", "(", "%d", "Hz", "%d", "+", "channel", "%d", "bit", ")", "output", "if", "output", "else", "input", "self", ".", "slug", "rate", "channels", "bits", ")" ]
benhoff/microphone
python
https://github.com/benhoff/microphone/blob/a89e339a9a4a17d19fd1a8cb99efee3402b65673/microphone/pyaudio_.py#L173-L221
[ "def", "open_stream", "(", "self", ",", "bits", ",", "channels", ",", "rate", "=", "None", ",", "chunksize", "=", "1024", ",", "output", "=", "True", ")", ":", "if", "rate", "is", "None", ":", "rate", "=", "int", "(", "self", ".", "info", "[", "'...
a89e339a9a4a17d19fd1a8cb99efee3402b65673
test
djfrontend_h5bp_css
Returns HTML5 Boilerplate CSS file. Included in HTML5 Boilerplate.
djfrontend/templatetags/djfrontend.py
def djfrontend_h5bp_css(version=None): """ Returns HTML5 Boilerplate CSS file. Included in HTML5 Boilerplate. """ if version is None: version = getattr(settings, 'DJFRONTEND_H5BP_CSS', DJFRONTEND_H5BP_CSS_DEFAULT) return format_html( '<link rel="stylesheet" href="{0}djfrontend/c...
def djfrontend_h5bp_css(version=None): """ Returns HTML5 Boilerplate CSS file. Included in HTML5 Boilerplate. """ if version is None: version = getattr(settings, 'DJFRONTEND_H5BP_CSS', DJFRONTEND_H5BP_CSS_DEFAULT) return format_html( '<link rel="stylesheet" href="{0}djfrontend/c...
[ "Returns", "HTML5", "Boilerplate", "CSS", "file", ".", "Included", "in", "HTML5", "Boilerplate", "." ]
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L32-L42
[ "def", "djfrontend_h5bp_css", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "version", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_H5BP_CSS'", ",", "DJFRONTEND_H5BP_CSS_DEFAULT", ")", "return", "format_html", "(", "'<link rel=\"...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_normalize
Returns Normalize CSS file. Included in HTML5 Boilerplate.
djfrontend/templatetags/djfrontend.py
def djfrontend_normalize(version=None): """ Returns Normalize CSS file. Included in HTML5 Boilerplate. """ if version is None: version = getattr(settings, 'DJFRONTEND_NORMALIZE', DJFRONTEND_NORMALIZE_DEFAULT) return format_html( '<link rel="stylesheet" href="{0}djfrontend/css/no...
def djfrontend_normalize(version=None): """ Returns Normalize CSS file. Included in HTML5 Boilerplate. """ if version is None: version = getattr(settings, 'DJFRONTEND_NORMALIZE', DJFRONTEND_NORMALIZE_DEFAULT) return format_html( '<link rel="stylesheet" href="{0}djfrontend/css/no...
[ "Returns", "Normalize", "CSS", "file", ".", "Included", "in", "HTML5", "Boilerplate", "." ]
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L46-L56
[ "def", "djfrontend_normalize", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "version", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_NORMALIZE'", ",", "DJFRONTEND_NORMALIZE_DEFAULT", ")", "return", "format_html", "(", "'<link rel...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_fontawesome
Returns Font Awesome CSS file. TEMPLATE_DEBUG returns full file, otherwise returns minified file.
djfrontend/templatetags/djfrontend.py
def djfrontend_fontawesome(version=None): """ Returns Font Awesome CSS file. TEMPLATE_DEBUG returns full file, otherwise returns minified file. """ if version is None: version = getattr(settings, 'DJFRONTEND_FONTAWESOME', DJFRONTEND_FONTAWESOME_DEFAULT) return format_html( '<lin...
def djfrontend_fontawesome(version=None): """ Returns Font Awesome CSS file. TEMPLATE_DEBUG returns full file, otherwise returns minified file. """ if version is None: version = getattr(settings, 'DJFRONTEND_FONTAWESOME', DJFRONTEND_FONTAWESOME_DEFAULT) return format_html( '<lin...
[ "Returns", "Font", "Awesome", "CSS", "file", ".", "TEMPLATE_DEBUG", "returns", "full", "file", "otherwise", "returns", "minified", "file", "." ]
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L60-L70
[ "def", "djfrontend_fontawesome", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "version", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_FONTAWESOME'", ",", "DJFRONTEND_FONTAWESOME_DEFAULT", ")", "return", "format_html", "(", "'<li...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_modernizr
Returns Modernizr JavaScript file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file. Included in HTML5 Boilerplate.
djfrontend/templatetags/djfrontend.py
def djfrontend_modernizr(version=None): """ Returns Modernizr JavaScript file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file. Included in HTML5 Boilerplate. """ if version is None: version = getattr(settings, 'DJFRONTEND_MODERNIZR', DJFRONT...
def djfrontend_modernizr(version=None): """ Returns Modernizr JavaScript file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file. Included in HTML5 Boilerplate. """ if version is None: version = getattr(settings, 'DJFRONTEND_MODERNIZR', DJFRONT...
[ "Returns", "Modernizr", "JavaScript", "file", "according", "to", "version", "number", ".", "TEMPLATE_DEBUG", "returns", "full", "file", "otherwise", "returns", "minified", "file", ".", "Included", "in", "HTML5", "Boilerplate", "." ]
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L74-L89
[ "def", "djfrontend_modernizr", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "version", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_MODERNIZR'", ",", "DJFRONTEND_MODERNIZR_DEFAULT", ")", "if", "getattr", "(", "settings", ",", ...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_jquery
Returns jQuery JavaScript file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file from Google CDN with local fallback. Included in HTML5 Boilerplate.
djfrontend/templatetags/djfrontend.py
def djfrontend_jquery(version=None): """ Returns jQuery JavaScript file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file from Google CDN with local fallback. Included in HTML5 Boilerplate. """ if version is None: version = getattr(settings, '...
def djfrontend_jquery(version=None): """ Returns jQuery JavaScript file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file from Google CDN with local fallback. Included in HTML5 Boilerplate. """ if version is None: version = getattr(settings, '...
[ "Returns", "jQuery", "JavaScript", "file", "according", "to", "version", "number", ".", "TEMPLATE_DEBUG", "returns", "full", "file", "otherwise", "returns", "minified", "file", "from", "Google", "CDN", "with", "local", "fallback", ".", "Included", "in", "HTML5", ...
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L93-L108
[ "def", "djfrontend_jquery", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "version", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_JQUERY'", ",", "DJFRONTEND_JQUERY_DEFAULT", ")", "if", "getattr", "(", "settings", ",", "'TEMPL...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_jqueryui
Returns the jQuery UI plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file from Google CDN with local fallback.
djfrontend/templatetags/djfrontend.py
def djfrontend_jqueryui(version=None): """ Returns the jQuery UI plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file from Google CDN with local fallback. """ if version is None: version = getattr(settings, 'DJFRONTEND_JQUERYUI', DJFRONTE...
def djfrontend_jqueryui(version=None): """ Returns the jQuery UI plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file from Google CDN with local fallback. """ if version is None: version = getattr(settings, 'DJFRONTEND_JQUERYUI', DJFRONTE...
[ "Returns", "the", "jQuery", "UI", "plugin", "file", "according", "to", "version", "number", ".", "TEMPLATE_DEBUG", "returns", "full", "file", "otherwise", "returns", "minified", "file", "from", "Google", "CDN", "with", "local", "fallback", "." ]
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L112-L128
[ "def", "djfrontend_jqueryui", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "version", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_JQUERYUI'", ",", "DJFRONTEND_JQUERYUI_DEFAULT", ")", "if", "getattr", "(", "settings", ",", "...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_jquery_datatables
Returns the jQuery DataTables plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file.
djfrontend/templatetags/djfrontend.py
def djfrontend_jquery_datatables(version=None): """ Returns the jQuery DataTables plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file. """ if version is None: if not getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES', False): v...
def djfrontend_jquery_datatables(version=None): """ Returns the jQuery DataTables plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file. """ if version is None: if not getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES', False): v...
[ "Returns", "the", "jQuery", "DataTables", "plugin", "file", "according", "to", "version", "number", ".", "TEMPLATE_DEBUG", "returns", "full", "file", "otherwise", "returns", "minified", "file", "." ]
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L132-L149
[ "def", "djfrontend_jquery_datatables", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "if", "not", "getattr", "(", "settings", ",", "'DJFRONTEND_JQUERY_DATATABLES'", ",", "False", ")", ":", "version", "=", "getattr", "(", "settings"...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_jquery_datatables_css
Returns the jQuery DataTables CSS file according to version number.
djfrontend/templatetags/djfrontend.py
def djfrontend_jquery_datatables_css(version=None): """ Returns the jQuery DataTables CSS file according to version number. """ if version is None: if not getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES_CSS', False): version = getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES_VERSION',...
def djfrontend_jquery_datatables_css(version=None): """ Returns the jQuery DataTables CSS file according to version number. """ if version is None: if not getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES_CSS', False): version = getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES_VERSION',...
[ "Returns", "the", "jQuery", "DataTables", "CSS", "file", "according", "to", "version", "number", "." ]
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L153-L166
[ "def", "djfrontend_jquery_datatables_css", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "if", "not", "getattr", "(", "settings", ",", "'DJFRONTEND_JQUERY_DATATABLES_CSS'", ",", "False", ")", ":", "version", "=", "getattr", "(", "s...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_jquery_datatables_themeroller
Returns the jQuery DataTables ThemeRoller CSS file according to version number.
djfrontend/templatetags/djfrontend.py
def djfrontend_jquery_datatables_themeroller(version=None): """ Returns the jQuery DataTables ThemeRoller CSS file according to version number. """ if version is None: if not getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES_THEMEROLLER', False): version = getattr(settings, 'DJFRONTEND...
def djfrontend_jquery_datatables_themeroller(version=None): """ Returns the jQuery DataTables ThemeRoller CSS file according to version number. """ if version is None: if not getattr(settings, 'DJFRONTEND_JQUERY_DATATABLES_THEMEROLLER', False): version = getattr(settings, 'DJFRONTEND...
[ "Returns", "the", "jQuery", "DataTables", "ThemeRoller", "CSS", "file", "according", "to", "version", "number", "." ]
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L170-L182
[ "def", "djfrontend_jquery_datatables_themeroller", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "if", "not", "getattr", "(", "settings", ",", "'DJFRONTEND_JQUERY_DATATABLES_THEMEROLLER'", ",", "False", ")", ":", "version", "=", "getat...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_jquery_formset
Returns the jQuery Dynamic Formset plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file.
djfrontend/templatetags/djfrontend.py
def djfrontend_jquery_formset(version=None): """ Returns the jQuery Dynamic Formset plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file. """ if version is None: version = getattr(settings, 'DJFRONTEND_JQUERY_FORMSET', DJFRONTEND_JQUERY_F...
def djfrontend_jquery_formset(version=None): """ Returns the jQuery Dynamic Formset plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file. """ if version is None: version = getattr(settings, 'DJFRONTEND_JQUERY_FORMSET', DJFRONTEND_JQUERY_F...
[ "Returns", "the", "jQuery", "Dynamic", "Formset", "plugin", "file", "according", "to", "version", "number", ".", "TEMPLATE_DEBUG", "returns", "full", "file", "otherwise", "returns", "minified", "file", "." ]
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L186-L200
[ "def", "djfrontend_jquery_formset", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "version", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_JQUERY_FORMSET'", ",", "DJFRONTEND_JQUERY_FORMSET_DEFAULT", ")", "if", "getattr", "(", "set...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_jquery_scrollto
Returns the jQuery ScrollTo plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file.
djfrontend/templatetags/djfrontend.py
def djfrontend_jquery_scrollto(version=None): """ Returns the jQuery ScrollTo plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file. """ if version is None: version = getattr(settings, 'DJFRONTEND_JQUERY_SCROLLTO', DJFRONTEND_JQUERY_SCROLL...
def djfrontend_jquery_scrollto(version=None): """ Returns the jQuery ScrollTo plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file. """ if version is None: version = getattr(settings, 'DJFRONTEND_JQUERY_SCROLLTO', DJFRONTEND_JQUERY_SCROLL...
[ "Returns", "the", "jQuery", "ScrollTo", "plugin", "file", "according", "to", "version", "number", ".", "TEMPLATE_DEBUG", "returns", "full", "file", "otherwise", "returns", "minified", "file", "." ]
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L204-L218
[ "def", "djfrontend_jquery_scrollto", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "version", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_JQUERY_SCROLLTO'", ",", "DJFRONTEND_JQUERY_SCROLLTO_DEFAULT", ")", "if", "getattr", "(", "...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_jquery_smoothscroll
Returns the jQuery Smooth Scroll plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file.
djfrontend/templatetags/djfrontend.py
def djfrontend_jquery_smoothscroll(version=None): """ Returns the jQuery Smooth Scroll plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file. """ if version is None: version = getattr(settings, 'DJFRONTEND_JQUERY_SMOOTHSCROLL', DJFRONTEND_...
def djfrontend_jquery_smoothscroll(version=None): """ Returns the jQuery Smooth Scroll plugin file according to version number. TEMPLATE_DEBUG returns full file, otherwise returns minified file. """ if version is None: version = getattr(settings, 'DJFRONTEND_JQUERY_SMOOTHSCROLL', DJFRONTEND_...
[ "Returns", "the", "jQuery", "Smooth", "Scroll", "plugin", "file", "according", "to", "version", "number", ".", "TEMPLATE_DEBUG", "returns", "full", "file", "otherwise", "returns", "minified", "file", "." ]
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L222-L236
[ "def", "djfrontend_jquery_smoothscroll", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "version", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_JQUERY_SMOOTHSCROLL'", ",", "DJFRONTEND_JQUERY_SMOOTHSCROLL_DEFAULT", ")", "if", "getattr"...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_twbs_css
Returns Twitter Bootstrap CSS file. TEMPLATE_DEBUG returns full file, otherwise returns minified file.
djfrontend/templatetags/djfrontend.py
def djfrontend_twbs_css(version=None): """ Returns Twitter Bootstrap CSS file. TEMPLATE_DEBUG returns full file, otherwise returns minified file. """ if version is None: if not getattr(settings, 'DJFRONTEND_TWBS_CSS', False): version = getattr(settings, 'DJFRONTEND_TWBS_VERSION',...
def djfrontend_twbs_css(version=None): """ Returns Twitter Bootstrap CSS file. TEMPLATE_DEBUG returns full file, otherwise returns minified file. """ if version is None: if not getattr(settings, 'DJFRONTEND_TWBS_CSS', False): version = getattr(settings, 'DJFRONTEND_TWBS_VERSION',...
[ "Returns", "Twitter", "Bootstrap", "CSS", "file", ".", "TEMPLATE_DEBUG", "returns", "full", "file", "otherwise", "returns", "minified", "file", "." ]
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L240-L253
[ "def", "djfrontend_twbs_css", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "if", "not", "getattr", "(", "settings", ",", "'DJFRONTEND_TWBS_CSS'", ",", "False", ")", ":", "version", "=", "getattr", "(", "settings", ",", "'DJFRO...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_twbs_js
Returns Twitter Bootstrap JavaScript file(s). all returns concatenated file; full file for TEMPLATE_DEBUG, minified otherwise. Other choice are: affix, alert, button, carousel, collapse, dropdown, modal, popover (adds tooltip if not included), ...
djfrontend/templatetags/djfrontend.py
def djfrontend_twbs_js(version=None, files=None): """ Returns Twitter Bootstrap JavaScript file(s). all returns concatenated file; full file for TEMPLATE_DEBUG, minified otherwise. Other choice are: affix, alert, button, carousel, collapse, dropdown, ...
def djfrontend_twbs_js(version=None, files=None): """ Returns Twitter Bootstrap JavaScript file(s). all returns concatenated file; full file for TEMPLATE_DEBUG, minified otherwise. Other choice are: affix, alert, button, carousel, collapse, dropdown, ...
[ "Returns", "Twitter", "Bootstrap", "JavaScript", "file", "(", "s", ")", ".", "all", "returns", "concatenated", "file", ";", "full", "file", "for", "TEMPLATE_DEBUG", "minified", "otherwise", "." ]
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L273-L319
[ "def", "djfrontend_twbs_js", "(", "version", "=", "None", ",", "files", "=", "None", ")", ":", "if", "version", "is", "None", ":", "if", "not", "getattr", "(", "settings", ",", "'DJFRONTEND_TWBS_JS_VERSION'", ",", "False", ")", ":", "version", "=", "getatt...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
djfrontend_ga
Returns Google Analytics asynchronous snippet. Use DJFRONTEND_GA_SETDOMAINNAME to set domain for multiple, or cross-domain tracking. Set DJFRONTEND_GA_SETALLOWLINKER to use _setAllowLinker method on target site for cross-domain tracking. Included in HTML5 Boilerplate.
djfrontend/templatetags/djfrontend.py
def djfrontend_ga(account=None): """ Returns Google Analytics asynchronous snippet. Use DJFRONTEND_GA_SETDOMAINNAME to set domain for multiple, or cross-domain tracking. Set DJFRONTEND_GA_SETALLOWLINKER to use _setAllowLinker method on target site for cross-domain tracking. Included in HTML5 Boilerp...
def djfrontend_ga(account=None): """ Returns Google Analytics asynchronous snippet. Use DJFRONTEND_GA_SETDOMAINNAME to set domain for multiple, or cross-domain tracking. Set DJFRONTEND_GA_SETALLOWLINKER to use _setAllowLinker method on target site for cross-domain tracking. Included in HTML5 Boilerp...
[ "Returns", "Google", "Analytics", "asynchronous", "snippet", ".", "Use", "DJFRONTEND_GA_SETDOMAINNAME", "to", "set", "domain", "for", "multiple", "or", "cross", "-", "domain", "tracking", ".", "Set", "DJFRONTEND_GA_SETALLOWLINKER", "to", "use", "_setAllowLinker", "met...
jonfaustman/django-frontend
python
https://github.com/jonfaustman/django-frontend/blob/897934d593fade0eb1998f8fadd18c91a89e5b9a/djfrontend/templatetags/djfrontend.py#L323-L350
[ "def", "djfrontend_ga", "(", "account", "=", "None", ")", ":", "if", "account", "is", "None", ":", "account", "=", "getattr", "(", "settings", ",", "'DJFRONTEND_GA'", ",", "False", ")", "if", "account", ":", "if", "getattr", "(", "settings", ",", "'TEMPL...
897934d593fade0eb1998f8fadd18c91a89e5b9a
test
CodeMirrorTextarea.render
u"""Render CodeMirrorTextarea
codemirror/widgets.py
def render(self, name, value, attrs=None): u"""Render CodeMirrorTextarea""" if self.js_var_format is not None: js_var_bit = 'var %s = ' % (self.js_var_format % name) else: js_var_bit = '' output = [super(CodeMirrorTextarea, self).render(name, value, attrs), ...
def render(self, name, value, attrs=None): u"""Render CodeMirrorTextarea""" if self.js_var_format is not None: js_var_bit = 'var %s = ' % (self.js_var_format % name) else: js_var_bit = '' output = [super(CodeMirrorTextarea, self).render(name, value, attrs), ...
[ "u", "Render", "CodeMirrorTextarea" ]
lambdalisue/django-codemirror-widget
python
https://github.com/lambdalisue/django-codemirror-widget/blob/e795ade2c0c18b462e729feafa616a3047998b4b/codemirror/widgets.py#L162-L171
[ "def", "render", "(", "self", ",", "name", ",", "value", ",", "attrs", "=", "None", ")", ":", "if", "self", ".", "js_var_format", "is", "not", "None", ":", "js_var_bit", "=", "'var %s = '", "%", "(", "self", ".", "js_var_format", "%", "name", ")", "e...
e795ade2c0c18b462e729feafa616a3047998b4b
test
iter_auth_hashes
Generate auth tokens tied to user and specified purpose. The hash expires at midnight on the minute of now + minutes_valid, such that when minutes_valid=1 you get *at least* 1 minute to use the token.
dddp/accounts/ddp.py
def iter_auth_hashes(user, purpose, minutes_valid): """ Generate auth tokens tied to user and specified purpose. The hash expires at midnight on the minute of now + minutes_valid, such that when minutes_valid=1 you get *at least* 1 minute to use the token. """ now = timezone.now().replace(micro...
def iter_auth_hashes(user, purpose, minutes_valid): """ Generate auth tokens tied to user and specified purpose. The hash expires at midnight on the minute of now + minutes_valid, such that when minutes_valid=1 you get *at least* 1 minute to use the token. """ now = timezone.now().replace(micro...
[ "Generate", "auth", "tokens", "tied", "to", "user", "and", "specified", "purpose", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L66-L83
[ "def", "iter_auth_hashes", "(", "user", ",", "purpose", ",", "minutes_valid", ")", ":", "now", "=", "timezone", ".", "now", "(", ")", ".", "replace", "(", "microsecond", "=", "0", ",", "second", "=", "0", ")", "for", "minute", "in", "range", "(", "mi...
1e1954b06fe140346acea43582515991685e4e01
test
calc_expiry_time
Return specific time an auth_hash will expire.
dddp/accounts/ddp.py
def calc_expiry_time(minutes_valid): """Return specific time an auth_hash will expire.""" return ( timezone.now() + datetime.timedelta(minutes=minutes_valid + 1) ).replace(second=0, microsecond=0)
def calc_expiry_time(minutes_valid): """Return specific time an auth_hash will expire.""" return ( timezone.now() + datetime.timedelta(minutes=minutes_valid + 1) ).replace(second=0, microsecond=0)
[ "Return", "specific", "time", "an", "auth_hash", "will", "expire", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L91-L95
[ "def", "calc_expiry_time", "(", "minutes_valid", ")", ":", "return", "(", "timezone", ".", "now", "(", ")", "+", "datetime", ".", "timedelta", "(", "minutes", "=", "minutes_valid", "+", "1", ")", ")", ".", "replace", "(", "second", "=", "0", ",", "micr...
1e1954b06fe140346acea43582515991685e4e01
test
get_user_token
Return login token info for given user.
dddp/accounts/ddp.py
def get_user_token(user, purpose, minutes_valid): """Return login token info for given user.""" token = ''.join( dumps([ user.get_username(), get_auth_hash(user, purpose), ]).encode('base64').split('\n') ) return { 'id': get_meteor_id(user), 'token...
def get_user_token(user, purpose, minutes_valid): """Return login token info for given user.""" token = ''.join( dumps([ user.get_username(), get_auth_hash(user, purpose), ]).encode('base64').split('\n') ) return { 'id': get_meteor_id(user), 'token...
[ "Return", "login", "token", "info", "for", "given", "user", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L98-L110
[ "def", "get_user_token", "(", "user", ",", "purpose", ",", "minutes_valid", ")", ":", "token", "=", "''", ".", "join", "(", "dumps", "(", "[", "user", ".", "get_username", "(", ")", ",", "get_auth_hash", "(", "user", ",", "purpose", ")", ",", "]", ")...
1e1954b06fe140346acea43582515991685e4e01
test
Users.serialize
Serialize user as per Meteor accounts serialization.
dddp/accounts/ddp.py
def serialize(self, obj, *args, **kwargs): """Serialize user as per Meteor accounts serialization.""" # use default serialization, then modify to suit our needs. data = super(Users, self).serialize(obj, *args, **kwargs) # everything that isn't handled explicitly ends up in `profile` ...
def serialize(self, obj, *args, **kwargs): """Serialize user as per Meteor accounts serialization.""" # use default serialization, then modify to suit our needs. data = super(Users, self).serialize(obj, *args, **kwargs) # everything that isn't handled explicitly ends up in `profile` ...
[ "Serialize", "user", "as", "per", "Meteor", "accounts", "serialization", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L125-L173
[ "def", "serialize", "(", "self", ",", "obj", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# use default serialization, then modify to suit our needs.", "data", "=", "super", "(", "Users", ",", "self", ")", ".", "serialize", "(", "obj", ",", "*", "...
1e1954b06fe140346acea43582515991685e4e01
test
Users.deserialize_profile
De-serialize user profile fields into concrete model fields.
dddp/accounts/ddp.py
def deserialize_profile(profile, key_prefix='', pop=False): """De-serialize user profile fields into concrete model fields.""" result = {} if pop: getter = profile.pop else: getter = profile.get def prefixed(name): """Return name prefixed by `...
def deserialize_profile(profile, key_prefix='', pop=False): """De-serialize user profile fields into concrete model fields.""" result = {} if pop: getter = profile.pop else: getter = profile.get def prefixed(name): """Return name prefixed by `...
[ "De", "-", "serialize", "user", "profile", "fields", "into", "concrete", "model", "fields", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L176-L194
[ "def", "deserialize_profile", "(", "profile", ",", "key_prefix", "=", "''", ",", "pop", "=", "False", ")", ":", "result", "=", "{", "}", "if", "pop", ":", "getter", "=", "profile", ".", "pop", "else", ":", "getter", "=", "profile", ".", "get", "def",...
1e1954b06fe140346acea43582515991685e4e01
test
Users.update
Update user data.
dddp/accounts/ddp.py
def update(self, selector, update, options=None): """Update user data.""" # we're ignoring the `options` argument at this time del options user = get_object( self.model, selector['_id'], pk=this.user_id, ) profile_update = self.deserialize_profile(...
def update(self, selector, update, options=None): """Update user data.""" # we're ignoring the `options` argument at this time del options user = get_object( self.model, selector['_id'], pk=this.user_id, ) profile_update = self.deserialize_profile(...
[ "Update", "user", "data", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L197-L213
[ "def", "update", "(", "self", ",", "selector", ",", "update", ",", "options", "=", "None", ")", ":", "# we're ignoring the `options` argument at this time", "del", "options", "user", "=", "get_object", "(", "self", ".", "model", ",", "selector", "[", "'_id'", ...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.user_factory
Retrieve the current user (or None) from the database.
dddp/accounts/ddp.py
def user_factory(self): """Retrieve the current user (or None) from the database.""" if this.user_id is None: return None return self.user_model.objects.get(pk=this.user_id)
def user_factory(self): """Retrieve the current user (or None) from the database.""" if this.user_id is None: return None return self.user_model.objects.get(pk=this.user_id)
[ "Retrieve", "the", "current", "user", "(", "or", "None", ")", "from", "the", "database", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L243-L247
[ "def", "user_factory", "(", "self", ")", ":", "if", "this", ".", "user_id", "is", "None", ":", "return", "None", "return", "self", ".", "user_model", ".", "objects", ".", "get", "(", "pk", "=", "this", ".", "user_id", ")" ]
1e1954b06fe140346acea43582515991685e4e01
test
Auth.update_subs
Update subs to send added/removed for collections with user_rel.
dddp/accounts/ddp.py
def update_subs(new_user_id): """Update subs to send added/removed for collections with user_rel.""" for sub in Subscription.objects.filter(connection=this.ws.connection): params = loads(sub.params_ejson) pub = API.get_pub_by_name(sub.publication) # calculate the que...
def update_subs(new_user_id): """Update subs to send added/removed for collections with user_rel.""" for sub in Subscription.objects.filter(connection=this.ws.connection): params = loads(sub.params_ejson) pub = API.get_pub_by_name(sub.publication) # calculate the que...
[ "Update", "subs", "to", "send", "added", "/", "removed", "for", "collections", "with", "user_rel", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L255-L301
[ "def", "update_subs", "(", "new_user_id", ")", ":", "for", "sub", "in", "Subscription", ".", "objects", ".", "filter", "(", "connection", "=", "this", ".", "ws", ".", "connection", ")", ":", "params", "=", "loads", "(", "sub", ".", "params_ejson", ")", ...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.auth_failed
Consistent fail so we don't provide attackers with valuable info.
dddp/accounts/ddp.py
def auth_failed(**credentials): """Consistent fail so we don't provide attackers with valuable info.""" if credentials: user_login_failed.send_robust( sender=__name__, credentials=auth._clean_credentials(credentials), ) raise MeteorError(40...
def auth_failed(**credentials): """Consistent fail so we don't provide attackers with valuable info.""" if credentials: user_login_failed.send_robust( sender=__name__, credentials=auth._clean_credentials(credentials), ) raise MeteorError(40...
[ "Consistent", "fail", "so", "we", "don", "t", "provide", "attackers", "with", "valuable", "info", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L304-L311
[ "def", "auth_failed", "(", "*", "*", "credentials", ")", ":", "if", "credentials", ":", "user_login_failed", ".", "send_robust", "(", "sender", "=", "__name__", ",", "credentials", "=", "auth", ".", "_clean_credentials", "(", "credentials", ")", ",", ")", "r...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.validated_user
Resolve and validate auth token, returns user object.
dddp/accounts/ddp.py
def validated_user(cls, token, purpose, minutes_valid): """Resolve and validate auth token, returns user object.""" try: username, auth_hash = loads(token.decode('base64')) except (ValueError, Error): cls.auth_failed(token=token) try: user = cls.user_m...
def validated_user(cls, token, purpose, minutes_valid): """Resolve and validate auth token, returns user object.""" try: username, auth_hash = loads(token.decode('base64')) except (ValueError, Error): cls.auth_failed(token=token) try: user = cls.user_m...
[ "Resolve", "and", "validate", "auth", "token", "returns", "user", "object", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L314-L330
[ "def", "validated_user", "(", "cls", ",", "token", ",", "purpose", ",", "minutes_valid", ")", ":", "try", ":", "username", ",", "auth_hash", "=", "loads", "(", "token", ".", "decode", "(", "'base64'", ")", ")", "except", "(", "ValueError", ",", "Error", ...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.check_secure
Check request, return False if using SSL or local connection.
dddp/accounts/ddp.py
def check_secure(): """Check request, return False if using SSL or local connection.""" if this.request.is_secure(): return True # using SSL elif this.request.META['REMOTE_ADDR'] in [ 'localhost', '127.0.0.1', ]: return True # loc...
def check_secure(): """Check request, return False if using SSL or local connection.""" if this.request.is_secure(): return True # using SSL elif this.request.META['REMOTE_ADDR'] in [ 'localhost', '127.0.0.1', ]: return True # loc...
[ "Check", "request", "return", "False", "if", "using", "SSL", "or", "local", "connection", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L333-L342
[ "def", "check_secure", "(", ")", ":", "if", "this", ".", "request", ".", "is_secure", "(", ")", ":", "return", "True", "# using SSL", "elif", "this", ".", "request", ".", "META", "[", "'REMOTE_ADDR'", "]", "in", "[", "'localhost'", ",", "'127.0.0.1'", ",...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.get_username
Retrieve username from user selector.
dddp/accounts/ddp.py
def get_username(self, user): """Retrieve username from user selector.""" if isinstance(user, basestring): return user elif isinstance(user, dict) and len(user) == 1: [(key, val)] = user.items() if key == 'username' or (key == self.user_model.USERNAME_FIELD): ...
def get_username(self, user): """Retrieve username from user selector.""" if isinstance(user, basestring): return user elif isinstance(user, dict) and len(user) == 1: [(key, val)] = user.items() if key == 'username' or (key == self.user_model.USERNAME_FIELD): ...
[ "Retrieve", "username", "from", "user", "selector", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L344-L371
[ "def", "get_username", "(", "self", ",", "user", ")", ":", "if", "isinstance", "(", "user", ",", "basestring", ")", ":", "return", "user", "elif", "isinstance", "(", "user", ",", "dict", ")", "and", "len", "(", "user", ")", "==", "1", ":", "[", "("...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.create_user
Register a new user account.
dddp/accounts/ddp.py
def create_user(self, params): """Register a new user account.""" receivers = create_user.send( sender=__name__, request=this.request, params=params, ) if len(receivers) == 0: raise NotImplementedError( 'Handler for `create_...
def create_user(self, params): """Register a new user account.""" receivers = create_user.send( sender=__name__, request=this.request, params=params, ) if len(receivers) == 0: raise NotImplementedError( 'Handler for `create_...
[ "Register", "a", "new", "user", "account", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L405-L424
[ "def", "create_user", "(", "self", ",", "params", ")", ":", "receivers", "=", "create_user", ".", "send", "(", "sender", "=", "__name__", ",", "request", "=", "this", ".", "request", ",", "params", "=", "params", ",", ")", "if", "len", "(", "receivers"...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.do_login
Login a user.
dddp/accounts/ddp.py
def do_login(self, user): """Login a user.""" this.user_id = user.pk this.user_ddp_id = get_meteor_id(user) # silent subscription (sans sub/nosub msg) to LoggedInUser pub this.user_sub_id = meteor_random_id() API.do_sub(this.user_sub_id, 'LoggedInUser', silent=True) ...
def do_login(self, user): """Login a user.""" this.user_id = user.pk this.user_ddp_id = get_meteor_id(user) # silent subscription (sans sub/nosub msg) to LoggedInUser pub this.user_sub_id = meteor_random_id() API.do_sub(this.user_sub_id, 'LoggedInUser', silent=True) ...
[ "Login", "a", "user", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L426-L436
[ "def", "do_login", "(", "self", ",", "user", ")", ":", "this", ".", "user_id", "=", "user", ".", "pk", "this", ".", "user_ddp_id", "=", "get_meteor_id", "(", "user", ")", "# silent subscription (sans sub/nosub msg) to LoggedInUser pub", "this", ".", "user_sub_id",...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.do_logout
Logout a user.
dddp/accounts/ddp.py
def do_logout(self): """Logout a user.""" # silent unsubscription (sans sub/nosub msg) from LoggedInUser pub API.do_unsub(this.user_sub_id, silent=True) del this.user_sub_id self.update_subs(None) user_logged_out.send( sender=self.user_model, request=this.requ...
def do_logout(self): """Logout a user.""" # silent unsubscription (sans sub/nosub msg) from LoggedInUser pub API.do_unsub(this.user_sub_id, silent=True) del this.user_sub_id self.update_subs(None) user_logged_out.send( sender=self.user_model, request=this.requ...
[ "Logout", "a", "user", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L438-L448
[ "def", "do_logout", "(", "self", ")", ":", "# silent unsubscription (sans sub/nosub msg) from LoggedInUser pub", "API", ".", "do_unsub", "(", "this", ".", "user_sub_id", ",", "silent", "=", "True", ")", "del", "this", ".", "user_sub_id", "self", ".", "update_subs", ...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.login
Login either with resume token or password.
dddp/accounts/ddp.py
def login(self, params): """Login either with resume token or password.""" if 'password' in params: return self.login_with_password(params) elif 'resume' in params: return self.login_with_resume_token(params) else: self.auth_failed(**params)
def login(self, params): """Login either with resume token or password.""" if 'password' in params: return self.login_with_password(params) elif 'resume' in params: return self.login_with_resume_token(params) else: self.auth_failed(**params)
[ "Login", "either", "with", "resume", "token", "or", "password", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L456-L463
[ "def", "login", "(", "self", ",", "params", ")", ":", "if", "'password'", "in", "params", ":", "return", "self", ".", "login_with_password", "(", "params", ")", "elif", "'resume'", "in", "params", ":", "return", "self", ".", "login_with_resume_token", "(", ...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.login_with_password
Authenticate using credentials supplied in params.
dddp/accounts/ddp.py
def login_with_password(self, params): """Authenticate using credentials supplied in params.""" # never allow insecure login self.check_secure() username = self.get_username(params['user']) password = self.get_password(params['password']) user = auth.authenticate(userna...
def login_with_password(self, params): """Authenticate using credentials supplied in params.""" # never allow insecure login self.check_secure() username = self.get_username(params['user']) password = self.get_password(params['password']) user = auth.authenticate(userna...
[ "Authenticate", "using", "credentials", "supplied", "in", "params", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L465-L486
[ "def", "login_with_password", "(", "self", ",", "params", ")", ":", "# never allow insecure login", "self", ".", "check_secure", "(", ")", "username", "=", "self", ".", "get_username", "(", "params", "[", "'user'", "]", ")", "password", "=", "self", ".", "ge...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.login_with_resume_token
Login with existing resume token. Either the token is valid and the user is logged in, or the token is invalid and a non-specific ValueError("Login failed.") exception is raised - don't be tempted to give clues to attackers as to why their logins are invalid!
dddp/accounts/ddp.py
def login_with_resume_token(self, params): """ Login with existing resume token. Either the token is valid and the user is logged in, or the token is invalid and a non-specific ValueError("Login failed.") exception is raised - don't be tempted to give clues to attackers as to wh...
def login_with_resume_token(self, params): """ Login with existing resume token. Either the token is valid and the user is logged in, or the token is invalid and a non-specific ValueError("Login failed.") exception is raised - don't be tempted to give clues to attackers as to wh...
[ "Login", "with", "existing", "resume", "token", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L488-L510
[ "def", "login_with_resume_token", "(", "self", ",", "params", ")", ":", "# never allow insecure login", "self", ".", "check_secure", "(", ")", "# pull the username and auth_hash from the token", "user", "=", "self", ".", "validated_user", "(", "params", "[", "'resume'",...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.change_password
Change password.
dddp/accounts/ddp.py
def change_password(self, old_password, new_password): """Change password.""" try: user = this.user except self.user_model.DoesNotExist: self.auth_failed() user = auth.authenticate( username=user.get_username(), password=self.get_password(o...
def change_password(self, old_password, new_password): """Change password.""" try: user = this.user except self.user_model.DoesNotExist: self.auth_failed() user = auth.authenticate( username=user.get_username(), password=self.get_password(o...
[ "Change", "password", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L513-L533
[ "def", "change_password", "(", "self", ",", "old_password", ",", "new_password", ")", ":", "try", ":", "user", "=", "this", ".", "user", "except", "self", ".", "user_model", ".", "DoesNotExist", ":", "self", ".", "auth_failed", "(", ")", "user", "=", "au...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.forgot_password
Request password reset email.
dddp/accounts/ddp.py
def forgot_password(self, params): """Request password reset email.""" username = self.get_username(params) try: user = self.user_model.objects.get(**{ self.user_model.USERNAME_FIELD: username, }) except self.user_model.DoesNotExist: se...
def forgot_password(self, params): """Request password reset email.""" username = self.get_username(params) try: user = self.user_model.objects.get(**{ self.user_model.USERNAME_FIELD: username, }) except self.user_model.DoesNotExist: se...
[ "Request", "password", "reset", "email", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L536-L558
[ "def", "forgot_password", "(", "self", ",", "params", ")", ":", "username", "=", "self", ".", "get_username", "(", "params", ")", "try", ":", "user", "=", "self", ".", "user_model", ".", "objects", ".", "get", "(", "*", "*", "{", "self", ".", "user_m...
1e1954b06fe140346acea43582515991685e4e01
test
Auth.reset_password
Reset password using a token received in email then logs user in.
dddp/accounts/ddp.py
def reset_password(self, token, new_password): """Reset password using a token received in email then logs user in.""" user = self.validated_user( token, purpose=HashPurpose.PASSWORD_RESET, minutes_valid=HASH_MINUTES_VALID[HashPurpose.PASSWORD_RESET], ) user.set_p...
def reset_password(self, token, new_password): """Reset password using a token received in email then logs user in.""" user = self.validated_user( token, purpose=HashPurpose.PASSWORD_RESET, minutes_valid=HASH_MINUTES_VALID[HashPurpose.PASSWORD_RESET], ) user.set_p...
[ "Reset", "password", "using", "a", "token", "received", "in", "email", "then", "logs", "user", "in", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L561-L570
[ "def", "reset_password", "(", "self", ",", "token", ",", "new_password", ")", ":", "user", "=", "self", ".", "validated_user", "(", "token", ",", "purpose", "=", "HashPurpose", ".", "PASSWORD_RESET", ",", "minutes_valid", "=", "HASH_MINUTES_VALID", "[", "HashP...
1e1954b06fe140346acea43582515991685e4e01
test
dict_merge
Recursive dict merge. Recursively merges dict's. not just simple lft['key'] = rgt['key'], if both lft and rgt have a key who's value is a dict then dict_merge is called on both values and the result stored in the returned dictionary.
dddp/views.py
def dict_merge(lft, rgt): """ Recursive dict merge. Recursively merges dict's. not just simple lft['key'] = rgt['key'], if both lft and rgt have a key who's value is a dict then dict_merge is called on both values and the result stored in the returned dictionary. """ if not isinstance(rgt, ...
def dict_merge(lft, rgt): """ Recursive dict merge. Recursively merges dict's. not just simple lft['key'] = rgt['key'], if both lft and rgt have a key who's value is a dict then dict_merge is called on both values and the result stored in the returned dictionary. """ if not isinstance(rgt, ...
[ "Recursive", "dict", "merge", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/views.py#L18-L34
[ "def", "dict_merge", "(", "lft", ",", "rgt", ")", ":", "if", "not", "isinstance", "(", "rgt", ",", "dict", ")", ":", "return", "rgt", "result", "=", "deepcopy", "(", "lft", ")", "for", "key", ",", "val", "in", "rgt", ".", "iteritems", "(", ")", "...
1e1954b06fe140346acea43582515991685e4e01
test
read
Read encoded contents from specified path or return default.
dddp/views.py
def read(path, default=None, encoding='utf8'): """Read encoded contents from specified path or return default.""" if not path: return default try: with io.open(path, mode='r', encoding=encoding) as contents: return contents.read() except IOError: if default is not Non...
def read(path, default=None, encoding='utf8'): """Read encoded contents from specified path or return default.""" if not path: return default try: with io.open(path, mode='r', encoding=encoding) as contents: return contents.read() except IOError: if default is not Non...
[ "Read", "encoded", "contents", "from", "specified", "path", "or", "return", "default", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/views.py#L37-L47
[ "def", "read", "(", "path", ",", "default", "=", "None", ",", "encoding", "=", "'utf8'", ")", ":", "if", "not", "path", ":", "return", "default", "try", ":", "with", "io", ".", "open", "(", "path", ",", "mode", "=", "'r'", ",", "encoding", "=", "...
1e1954b06fe140346acea43582515991685e4e01
test
MeteorView.get
Return HTML (or other related content) for Meteor.
dddp/views.py
def get(self, request, path): """Return HTML (or other related content) for Meteor.""" if path == 'meteor_runtime_config.js': config = { 'DDP_DEFAULT_CONNECTION_URL': request.build_absolute_uri('/'), 'PUBLIC_SETTINGS': self.meteor_settings.get('public', {}), ...
def get(self, request, path): """Return HTML (or other related content) for Meteor.""" if path == 'meteor_runtime_config.js': config = { 'DDP_DEFAULT_CONNECTION_URL': request.build_absolute_uri('/'), 'PUBLIC_SETTINGS': self.meteor_settings.get('public', {}), ...
[ "Return", "HTML", "(", "or", "other", "related", "content", ")", "for", "Meteor", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/views.py#L248-L280
[ "def", "get", "(", "self", ",", "request", ",", "path", ")", ":", "if", "path", "==", "'meteor_runtime_config.js'", ":", "config", "=", "{", "'DDP_DEFAULT_CONNECTION_URL'", ":", "request", ".", "build_absolute_uri", "(", "'/'", ")", ",", "'PUBLIC_SETTINGS'", "...
1e1954b06fe140346acea43582515991685e4e01
test
get_meteor_id
Return an Alea ID for the given object.
dddp/models.py
def get_meteor_id(obj_or_model, obj_pk=None): """Return an Alea ID for the given object.""" if obj_or_model is None: return None # Django model._meta is now public API -> pylint: disable=W0212 meta = obj_or_model._meta model = meta.model if model is ObjectMapping: # this doesn't ...
def get_meteor_id(obj_or_model, obj_pk=None): """Return an Alea ID for the given object.""" if obj_or_model is None: return None # Django model._meta is now public API -> pylint: disable=W0212 meta = obj_or_model._meta model = meta.model if model is ObjectMapping: # this doesn't ...
[ "Return", "an", "Alea", "ID", "for", "the", "given", "object", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/models.py#L20-L76
[ "def", "get_meteor_id", "(", "obj_or_model", ",", "obj_pk", "=", "None", ")", ":", "if", "obj_or_model", "is", "None", ":", "return", "None", "# Django model._meta is now public API -> pylint: disable=W0212", "meta", "=", "obj_or_model", ".", "_meta", "model", "=", ...
1e1954b06fe140346acea43582515991685e4e01
test
get_meteor_ids
Return Alea ID mapping for all given ids of specified model.
dddp/models.py
def get_meteor_ids(model, object_ids): """Return Alea ID mapping for all given ids of specified model.""" # Django model._meta is now public API -> pylint: disable=W0212 meta = model._meta result = collections.OrderedDict( (str(obj_pk), None) for obj_pk in object_ids ) if...
def get_meteor_ids(model, object_ids): """Return Alea ID mapping for all given ids of specified model.""" # Django model._meta is now public API -> pylint: disable=W0212 meta = model._meta result = collections.OrderedDict( (str(obj_pk), None) for obj_pk in object_ids ) if...
[ "Return", "Alea", "ID", "mapping", "for", "all", "given", "ids", "of", "specified", "model", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/models.py#L80-L115
[ "def", "get_meteor_ids", "(", "model", ",", "object_ids", ")", ":", "# Django model._meta is now public API -> pylint: disable=W0212", "meta", "=", "model", ".", "_meta", "result", "=", "collections", ".", "OrderedDict", "(", "(", "str", "(", "obj_pk", ")", ",", "...
1e1954b06fe140346acea43582515991685e4e01
test
get_object_id
Return an object ID for the given meteor_id.
dddp/models.py
def get_object_id(model, meteor_id): """Return an object ID for the given meteor_id.""" if meteor_id is None: return None # Django model._meta is now public API -> pylint: disable=W0212 meta = model._meta if model is ObjectMapping: # this doesn't make sense - raise TypeError ...
def get_object_id(model, meteor_id): """Return an object ID for the given meteor_id.""" if meteor_id is None: return None # Django model._meta is now public API -> pylint: disable=W0212 meta = model._meta if model is ObjectMapping: # this doesn't make sense - raise TypeError ...
[ "Return", "an", "object", "ID", "for", "the", "given", "meteor_id", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/models.py#L118-L152
[ "def", "get_object_id", "(", "model", ",", "meteor_id", ")", ":", "if", "meteor_id", "is", "None", ":", "return", "None", "# Django model._meta is now public API -> pylint: disable=W0212", "meta", "=", "model", ".", "_meta", "if", "model", "is", "ObjectMapping", ":"...
1e1954b06fe140346acea43582515991685e4e01
test
get_object_ids
Return all object IDs for the given meteor_ids.
dddp/models.py
def get_object_ids(model, meteor_ids): """Return all object IDs for the given meteor_ids.""" if model is ObjectMapping: # this doesn't make sense - raise TypeError raise TypeError("Can't map ObjectMapping instances through self.") # Django model._meta is now public API -> pylint: disable=W02...
def get_object_ids(model, meteor_ids): """Return all object IDs for the given meteor_ids.""" if model is ObjectMapping: # this doesn't make sense - raise TypeError raise TypeError("Can't map ObjectMapping instances through self.") # Django model._meta is now public API -> pylint: disable=W02...
[ "Return", "all", "object", "IDs", "for", "the", "given", "meteor_ids", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/models.py#L155-L185
[ "def", "get_object_ids", "(", "model", ",", "meteor_ids", ")", ":", "if", "model", "is", "ObjectMapping", ":", "# this doesn't make sense - raise TypeError", "raise", "TypeError", "(", "\"Can't map ObjectMapping instances through self.\"", ")", "# Django model._meta is now publ...
1e1954b06fe140346acea43582515991685e4e01
test
get_object
Return an object for the given meteor_id.
dddp/models.py
def get_object(model, meteor_id, *args, **kwargs): """Return an object for the given meteor_id.""" # Django model._meta is now public API -> pylint: disable=W0212 meta = model._meta if isinstance(meta.pk, AleaIdField): # meteor_id is the primary key return model.objects.filter(*args, **k...
def get_object(model, meteor_id, *args, **kwargs): """Return an object for the given meteor_id.""" # Django model._meta is now public API -> pylint: disable=W0212 meta = model._meta if isinstance(meta.pk, AleaIdField): # meteor_id is the primary key return model.objects.filter(*args, **k...
[ "Return", "an", "object", "for", "the", "given", "meteor_id", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/models.py#L188-L208
[ "def", "get_object", "(", "model", ",", "meteor_id", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Django model._meta is now public API -> pylint: disable=W0212", "meta", "=", "model", ".", "_meta", "if", "isinstance", "(", "meta", ".", "pk", ",", "A...
1e1954b06fe140346acea43582515991685e4e01
test
AleaIdField.get_pk_value_on_save
Generate ID if required.
dddp/models.py
def get_pk_value_on_save(self, instance): """Generate ID if required.""" value = super(AleaIdField, self).get_pk_value_on_save(instance) if not value: value = self.get_seeded_value(instance) return value
def get_pk_value_on_save(self, instance): """Generate ID if required.""" value = super(AleaIdField, self).get_pk_value_on_save(instance) if not value: value = self.get_seeded_value(instance) return value
[ "Generate", "ID", "if", "required", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/models.py#L235-L240
[ "def", "get_pk_value_on_save", "(", "self", ",", "instance", ")", ":", "value", "=", "super", "(", "AleaIdField", ",", "self", ")", ".", "get_pk_value_on_save", "(", "instance", ")", "if", "not", "value", ":", "value", "=", "self", ".", "get_seeded_value", ...
1e1954b06fe140346acea43582515991685e4e01
test
AleaIdField.pre_save
Generate ID if required.
dddp/models.py
def pre_save(self, model_instance, add): """Generate ID if required.""" value = super(AleaIdField, self).pre_save(model_instance, add) if (not value) and self.default in (meteor_random_id, NOT_PROVIDED): value = self.get_seeded_value(model_instance) setattr(model_instance...
def pre_save(self, model_instance, add): """Generate ID if required.""" value = super(AleaIdField, self).pre_save(model_instance, add) if (not value) and self.default in (meteor_random_id, NOT_PROVIDED): value = self.get_seeded_value(model_instance) setattr(model_instance...
[ "Generate", "ID", "if", "required", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/models.py#L242-L248
[ "def", "pre_save", "(", "self", ",", "model_instance", ",", "add", ")", ":", "value", "=", "super", "(", "AleaIdField", ",", "self", ")", ".", "pre_save", "(", "model_instance", ",", "add", ")", "if", "(", "not", "value", ")", "and", "self", ".", "de...
1e1954b06fe140346acea43582515991685e4e01
test
set_default_forwards
Set default value for AleaIdField.
dddp/migrations/__init__.py
def set_default_forwards(app_name, operation, apps, schema_editor): """Set default value for AleaIdField.""" model = apps.get_model(app_name, operation.model_name) for obj_pk in model.objects.values_list('pk', flat=True): model.objects.filter(pk=obj_pk).update(**{ operation.name: get_met...
def set_default_forwards(app_name, operation, apps, schema_editor): """Set default value for AleaIdField.""" model = apps.get_model(app_name, operation.model_name) for obj_pk in model.objects.values_list('pk', flat=True): model.objects.filter(pk=obj_pk).update(**{ operation.name: get_met...
[ "Set", "default", "value", "for", "AleaIdField", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/migrations/__init__.py#L43-L49
[ "def", "set_default_forwards", "(", "app_name", ",", "operation", ",", "apps", ",", "schema_editor", ")", ":", "model", "=", "apps", ".", "get_model", "(", "app_name", ",", "operation", ".", "model_name", ")", "for", "obj_pk", "in", "model", ".", "objects", ...
1e1954b06fe140346acea43582515991685e4e01
test
set_default_reverse
Unset default value for AleaIdField.
dddp/migrations/__init__.py
def set_default_reverse(app_name, operation, apps, schema_editor): """Unset default value for AleaIdField.""" model = apps.get_model(app_name, operation.model_name) for obj_pk in model.objects.values_list('pk', flat=True): get_meteor_id(model, obj_pk)
def set_default_reverse(app_name, operation, apps, schema_editor): """Unset default value for AleaIdField.""" model = apps.get_model(app_name, operation.model_name) for obj_pk in model.objects.values_list('pk', flat=True): get_meteor_id(model, obj_pk)
[ "Unset", "default", "value", "for", "AleaIdField", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/migrations/__init__.py#L52-L56
[ "def", "set_default_reverse", "(", "app_name", ",", "operation", ",", "apps", ",", "schema_editor", ")", ":", "model", "=", "apps", ".", "get_model", "(", "app_name", ",", "operation", ".", "model_name", ")", "for", "obj_pk", "in", "model", ".", "objects", ...
1e1954b06fe140346acea43582515991685e4e01
test
TruncateOperation.truncate
Truncate tables.
dddp/migrations/__init__.py
def truncate(self, app_label, schema_editor, models): """Truncate tables.""" for model_name in models: model = '%s_%s' % (app_label, model_name) schema_editor.execute( 'TRUNCATE TABLE %s RESTART IDENTITY CASCADE' % ( model.lower(), ...
def truncate(self, app_label, schema_editor, models): """Truncate tables.""" for model_name in models: model = '%s_%s' % (app_label, model_name) schema_editor.execute( 'TRUNCATE TABLE %s RESTART IDENTITY CASCADE' % ( model.lower(), ...
[ "Truncate", "tables", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/migrations/__init__.py#L16-L24
[ "def", "truncate", "(", "self", ",", "app_label", ",", "schema_editor", ",", "models", ")", ":", "for", "model_name", "in", "models", ":", "model", "=", "'%s_%s'", "%", "(", "app_label", ",", "model_name", ")", "schema_editor", ".", "execute", "(", "'TRUNC...
1e1954b06fe140346acea43582515991685e4e01
test
TruncateOperation.database_forwards
Use schema_editor to apply any forward changes.
dddp/migrations/__init__.py
def database_forwards(self, app_label, schema_editor, from_state, to_state): """Use schema_editor to apply any forward changes.""" self.truncate(app_label, schema_editor, self.truncate_forwards)
def database_forwards(self, app_label, schema_editor, from_state, to_state): """Use schema_editor to apply any forward changes.""" self.truncate(app_label, schema_editor, self.truncate_forwards)
[ "Use", "schema_editor", "to", "apply", "any", "forward", "changes", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/migrations/__init__.py#L30-L32
[ "def", "database_forwards", "(", "self", ",", "app_label", ",", "schema_editor", ",", "from_state", ",", "to_state", ")", ":", "self", ".", "truncate", "(", "app_label", ",", "schema_editor", ",", "self", ".", "truncate_forwards", ")" ]
1e1954b06fe140346acea43582515991685e4e01
test
TruncateOperation.database_backwards
Use schema_editor to apply any reverse changes.
dddp/migrations/__init__.py
def database_backwards(self, app_label, schema_editor, from_state, to_state): """Use schema_editor to apply any reverse changes.""" self.truncate(app_label, schema_editor, self.truncate_backwards)
def database_backwards(self, app_label, schema_editor, from_state, to_state): """Use schema_editor to apply any reverse changes.""" self.truncate(app_label, schema_editor, self.truncate_backwards)
[ "Use", "schema_editor", "to", "apply", "any", "reverse", "changes", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/migrations/__init__.py#L34-L36
[ "def", "database_backwards", "(", "self", ",", "app_label", ",", "schema_editor", ",", "from_state", ",", "to_state", ")", ":", "self", ".", "truncate", "(", "app_label", ",", "schema_editor", ",", "self", ".", "truncate_backwards", ")" ]
1e1954b06fe140346acea43582515991685e4e01
test
build_meteor.initialize_options
Set command option defaults.
setup.py
def initialize_options(self): """Set command option defaults.""" setuptools.command.build_py.build_py.initialize_options(self) self.meteor = 'meteor' self.meteor_debug = False self.build_lib = None self.package_dir = None self.meteor_builds = [] self.no_pr...
def initialize_options(self): """Set command option defaults.""" setuptools.command.build_py.build_py.initialize_options(self) self.meteor = 'meteor' self.meteor_debug = False self.build_lib = None self.package_dir = None self.meteor_builds = [] self.no_pr...
[ "Set", "command", "option", "defaults", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/setup.py#L48-L57
[ "def", "initialize_options", "(", "self", ")", ":", "setuptools", ".", "command", ".", "build_py", ".", "build_py", ".", "initialize_options", "(", "self", ")", "self", ".", "meteor", "=", "'meteor'", "self", ".", "meteor_debug", "=", "False", "self", ".", ...
1e1954b06fe140346acea43582515991685e4e01
test
build_meteor.finalize_options
Update command options.
setup.py
def finalize_options(self): """Update command options.""" # Get all the information we need to install pure Python modules # from the umbrella 'install' command -- build (source) directory, # install (target) directory, and whether to compile .py files. self.set_undefined_options...
def finalize_options(self): """Update command options.""" # Get all the information we need to install pure Python modules # from the umbrella 'install' command -- build (source) directory, # install (target) directory, and whether to compile .py files. self.set_undefined_options...
[ "Update", "command", "options", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/setup.py#L59-L72
[ "def", "finalize_options", "(", "self", ")", ":", "# Get all the information we need to install pure Python modules", "# from the umbrella 'install' command -- build (source) directory,", "# install (target) directory, and whether to compile .py files.", "self", ".", "set_undefined_options", ...
1e1954b06fe140346acea43582515991685e4e01
test
build_meteor.run
Peform build.
setup.py
def run(self): """Peform build.""" for (package, source, target, extra_args) in self.meteor_builds: src_dir = self.get_package_dir(package) # convert UNIX-style paths to directory names project_dir = self.path_to_dir(src_dir, source) target_dir = self.path...
def run(self): """Peform build.""" for (package, source, target, extra_args) in self.meteor_builds: src_dir = self.get_package_dir(package) # convert UNIX-style paths to directory names project_dir = self.path_to_dir(src_dir, source) target_dir = self.path...
[ "Peform", "build", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/setup.py#L89-L120
[ "def", "run", "(", "self", ")", ":", "for", "(", "package", ",", "source", ",", "target", ",", "extra_args", ")", "in", "self", ".", "meteor_builds", ":", "src_dir", "=", "self", ".", "get_package_dir", "(", "package", ")", "# convert UNIX-style paths to dir...
1e1954b06fe140346acea43582515991685e4e01
test
build_meteor.path_to_dir
Convert a UNIX-style path into platform specific directory spec.
setup.py
def path_to_dir(*path_args): """Convert a UNIX-style path into platform specific directory spec.""" return os.path.join( *list(path_args[:-1]) + path_args[-1].split(posixpath.sep) )
def path_to_dir(*path_args): """Convert a UNIX-style path into platform specific directory spec.""" return os.path.join( *list(path_args[:-1]) + path_args[-1].split(posixpath.sep) )
[ "Convert", "a", "UNIX", "-", "style", "path", "into", "platform", "specific", "directory", "spec", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/setup.py#L123-L127
[ "def", "path_to_dir", "(", "*", "path_args", ")", ":", "return", "os", ".", "path", ".", "join", "(", "*", "list", "(", "path_args", "[", ":", "-", "1", "]", ")", "+", "path_args", "[", "-", "1", "]", ".", "split", "(", "posixpath", ".", "sep", ...
1e1954b06fe140346acea43582515991685e4e01
test
Alea.seed
Seed internal state from supplied values.
dddp/alea.py
def seed(self, values): """Seed internal state from supplied values.""" if not values: # Meteor uses epoch seconds as the seed if no args supplied, we use # a much more secure seed by default to avoid hash collisions. seed_ids = [int, str, random, self, values, self._...
def seed(self, values): """Seed internal state from supplied values.""" if not values: # Meteor uses epoch seconds as the seed if no args supplied, we use # a much more secure seed by default to avoid hash collisions. seed_ids = [int, str, random, self, values, self._...
[ "Seed", "internal", "state", "from", "supplied", "values", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/alea.py#L110-L134
[ "def", "seed", "(", "self", ",", "values", ")", ":", "if", "not", "values", ":", "# Meteor uses epoch seconds as the seed if no args supplied, we use", "# a much more secure seed by default to avoid hash collisions.", "seed_ids", "=", "[", "int", ",", "str", ",", "random", ...
1e1954b06fe140346acea43582515991685e4e01
test
Alea.state
Return internal state, useful for testing.
dddp/alea.py
def state(self): """Return internal state, useful for testing.""" return {'c': self.c, 's0': self.s0, 's1': self.s1, 's2': self.s2}
def state(self): """Return internal state, useful for testing.""" return {'c': self.c, 's0': self.s0, 's1': self.s1, 's2': self.s2}
[ "Return", "internal", "state", "useful", "for", "testing", "." ]
jazzband/django-ddp
python
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/alea.py#L137-L139
[ "def", "state", "(", "self", ")", ":", "return", "{", "'c'", ":", "self", ".", "c", ",", "'s0'", ":", "self", ".", "s0", ",", "'s1'", ":", "self", ".", "s1", ",", "'s2'", ":", "self", ".", "s2", "}" ]
1e1954b06fe140346acea43582515991685e4e01