repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
secure-systems-lab/securesystemslib
securesystemslib/interface.py
import_ed25519_publickey_from_file
def import_ed25519_publickey_from_file(filepath): """ <Purpose> Load the ED25519 public key object (conformant to 'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return 'filepath' in securesystemslib.formats.ED25519KEY_SCHEMA format. If the key object in 'filepath' contains a private ...
python
def import_ed25519_publickey_from_file(filepath): """ <Purpose> Load the ED25519 public key object (conformant to 'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return 'filepath' in securesystemslib.formats.ED25519KEY_SCHEMA format. If the key object in 'filepath' contains a private ...
[ "def", "import_ed25519_publickey_from_file", "(", "filepath", ")", ":", "# Does 'filepath' have the correct format?", "# Ensure the arguments have the appropriate number of objects and object", "# types, and that all dict keys are properly named.", "# Raise 'securesystemslib.exceptions.FormatError...
<Purpose> Load the ED25519 public key object (conformant to 'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return 'filepath' in securesystemslib.formats.ED25519KEY_SCHEMA format. If the key object in 'filepath' contains a private key, it is discarded. <Arguments> filepath: <...
[ "<Purpose", ">", "Load", "the", "ED25519", "public", "key", "object", "(", "conformant", "to", "securesystemslib", ".", "formats", ".", "KEY_SCHEMA", ")", "stored", "in", "filepath", ".", "Return", "filepath", "in", "securesystemslib", ".", "formats", ".", "ED...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/interface.py#L527-L572
train
secure-systems-lab/securesystemslib
securesystemslib/interface.py
import_ed25519_privatekey_from_file
def import_ed25519_privatekey_from_file(filepath, password=None, prompt=False): """ <Purpose> Import the encrypted ed25519 key file in 'filepath', decrypt it, and return the key object in 'securesystemslib.formats.ED25519KEY_SCHEMA' format. The private key (may also contain the public part) is encrypte...
python
def import_ed25519_privatekey_from_file(filepath, password=None, prompt=False): """ <Purpose> Import the encrypted ed25519 key file in 'filepath', decrypt it, and return the key object in 'securesystemslib.formats.ED25519KEY_SCHEMA' format. The private key (may also contain the public part) is encrypte...
[ "def", "import_ed25519_privatekey_from_file", "(", "filepath", ",", "password", "=", "None", ",", "prompt", "=", "False", ")", ":", "# Does 'filepath' have the correct format?", "# Ensure the arguments have the appropriate number of objects and object", "# types, and that all dict ke...
<Purpose> Import the encrypted ed25519 key file in 'filepath', decrypt it, and return the key object in 'securesystemslib.formats.ED25519KEY_SCHEMA' format. The private key (may also contain the public part) is encrypted with AES 256 and CTR the mode of operation. The password is strengthened with ...
[ "<Purpose", ">", "Import", "the", "encrypted", "ed25519", "key", "file", "in", "filepath", "decrypt", "it", "and", "return", "the", "key", "object", "in", "securesystemslib", ".", "formats", ".", "ED25519KEY_SCHEMA", "format", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/interface.py#L578-L658
train
secure-systems-lab/securesystemslib
securesystemslib/interface.py
generate_and_write_ecdsa_keypair
def generate_and_write_ecdsa_keypair(filepath=None, password=None): """ <Purpose> Generate an ECDSA keypair, where the encrypted key (using 'password' as the passphrase) is saved to <'filepath'>. The public key portion of the generated ECDSA key is saved to <'filepath'>.pub. If the filepath is not ...
python
def generate_and_write_ecdsa_keypair(filepath=None, password=None): """ <Purpose> Generate an ECDSA keypair, where the encrypted key (using 'password' as the passphrase) is saved to <'filepath'>. The public key portion of the generated ECDSA key is saved to <'filepath'>.pub. If the filepath is not ...
[ "def", "generate_and_write_ecdsa_keypair", "(", "filepath", "=", "None", ",", "password", "=", "None", ")", ":", "# Generate a new ECDSA key object. The 'cryptography' library is currently", "# supported and performs the actual cryptographic operations.", "ecdsa_key", "=", "securesy...
<Purpose> Generate an ECDSA keypair, where the encrypted key (using 'password' as the passphrase) is saved to <'filepath'>. The public key portion of the generated ECDSA key is saved to <'filepath'>.pub. If the filepath is not given, the KEYID is used as the filename and the keypair saved to the c...
[ "<Purpose", ">", "Generate", "an", "ECDSA", "keypair", "where", "the", "encrypted", "key", "(", "using", "password", "as", "the", "passphrase", ")", "is", "saved", "to", "<", "filepath", ">", ".", "The", "public", "key", "portion", "of", "the", "generated"...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/interface.py#L664-L767
train
secure-systems-lab/securesystemslib
securesystemslib/interface.py
import_ecdsa_publickey_from_file
def import_ecdsa_publickey_from_file(filepath): """ <Purpose> Load the ECDSA public key object (conformant to 'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return 'filepath' in securesystemslib.formats.ECDSAKEY_SCHEMA format. If the key object in 'filepath' contains a private key, i...
python
def import_ecdsa_publickey_from_file(filepath): """ <Purpose> Load the ECDSA public key object (conformant to 'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return 'filepath' in securesystemslib.formats.ECDSAKEY_SCHEMA format. If the key object in 'filepath' contains a private key, i...
[ "def", "import_ecdsa_publickey_from_file", "(", "filepath", ")", ":", "# Does 'filepath' have the correct format?", "# Ensure the arguments have the appropriate number of objects and object", "# types, and that all dict keys are properly named.", "# Raise 'securesystemslib.exceptions.FormatError' ...
<Purpose> Load the ECDSA public key object (conformant to 'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return 'filepath' in securesystemslib.formats.ECDSAKEY_SCHEMA format. If the key object in 'filepath' contains a private key, it is discarded. <Arguments> filepath: <file...
[ "<Purpose", ">", "Load", "the", "ECDSA", "public", "key", "object", "(", "conformant", "to", "securesystemslib", ".", "formats", ".", "KEY_SCHEMA", ")", "stored", "in", "filepath", ".", "Return", "filepath", "in", "securesystemslib", ".", "formats", ".", "ECDS...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/interface.py#L772-L817
train
secure-systems-lab/securesystemslib
securesystemslib/interface.py
import_ecdsa_privatekey_from_file
def import_ecdsa_privatekey_from_file(filepath, password=None): """ <Purpose> Import the encrypted ECDSA key file in 'filepath', decrypt it, and return the key object in 'securesystemslib.formats.ECDSAKEY_SCHEMA' format. The 'cryptography' library is currently supported and performs the actual cryp...
python
def import_ecdsa_privatekey_from_file(filepath, password=None): """ <Purpose> Import the encrypted ECDSA key file in 'filepath', decrypt it, and return the key object in 'securesystemslib.formats.ECDSAKEY_SCHEMA' format. The 'cryptography' library is currently supported and performs the actual cryp...
[ "def", "import_ecdsa_privatekey_from_file", "(", "filepath", ",", "password", "=", "None", ")", ":", "# Does 'filepath' have the correct format?", "# Ensure the arguments have the appropriate number of objects and object", "# types, and that all dict keys are properly named.", "# Raise 'se...
<Purpose> Import the encrypted ECDSA key file in 'filepath', decrypt it, and return the key object in 'securesystemslib.formats.ECDSAKEY_SCHEMA' format. The 'cryptography' library is currently supported and performs the actual cryptographic routine. <Arguments> filepath: <filepath> file, a...
[ "<Purpose", ">", "Import", "the", "encrypted", "ECDSA", "key", "file", "in", "filepath", "decrypt", "it", "and", "return", "the", "key", "object", "in", "securesystemslib", ".", "formats", ".", "ECDSAKEY_SCHEMA", "format", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/interface.py#L823-L900
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.wait_until_element_has_focus
def wait_until_element_has_focus(self, locator, timeout=None): """Waits until the element identified by `locator` has focus. You might rather want to use `Element Focus Should Be Set` | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | timeout | maximum time to wa...
python
def wait_until_element_has_focus(self, locator, timeout=None): """Waits until the element identified by `locator` has focus. You might rather want to use `Element Focus Should Be Set` | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | timeout | maximum time to wa...
[ "def", "wait_until_element_has_focus", "(", "self", ",", "locator", ",", "timeout", "=", "None", ")", ":", "self", ".", "_info", "(", "\"Waiting for focus on '%s'\"", "%", "(", "locator", ")", ")", "self", ".", "_wait_until_no_error", "(", "timeout", ",", "sel...
Waits until the element identified by `locator` has focus. You might rather want to use `Element Focus Should Be Set` | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | timeout | maximum time to wait before the function throws an element not found error (default=No...
[ "Waits", "until", "the", "element", "identified", "by", "locator", "has", "focus", ".", "You", "might", "rather", "want", "to", "use", "Element", "Focus", "Should", "Be", "Set" ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L18-L27
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.wait_until_element_does_not_have_focus
def wait_until_element_does_not_have_focus(self, locator, timeout=None): """Waits until the element identified by `locator` doesn't have focus. You might rather want to use `Element Focus Should Not Be Set` | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | timeo...
python
def wait_until_element_does_not_have_focus(self, locator, timeout=None): """Waits until the element identified by `locator` doesn't have focus. You might rather want to use `Element Focus Should Not Be Set` | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | timeo...
[ "def", "wait_until_element_does_not_have_focus", "(", "self", ",", "locator", ",", "timeout", "=", "None", ")", ":", "self", ".", "_info", "(", "\"Waiting until '%s' does not have focus\"", "%", "(", "locator", ")", ")", "self", ".", "_wait_until_no_error", "(", "...
Waits until the element identified by `locator` doesn't have focus. You might rather want to use `Element Focus Should Not Be Set` | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | timeout | maximum time to wait before the function throws an element not found erro...
[ "Waits", "until", "the", "element", "identified", "by", "locator", "doesn", "t", "have", "focus", ".", "You", "might", "rather", "want", "to", "use", "Element", "Focus", "Should", "Not", "Be", "Set" ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L35-L44
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.wait_until_element_value_is
def wait_until_element_value_is(self, locator, expected, strip=False, timeout=None): """Waits until the element identified by `locator` value is exactly the expected value. You might want to use `Element Value Should Be` instead. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator...
python
def wait_until_element_value_is(self, locator, expected, strip=False, timeout=None): """Waits until the element identified by `locator` value is exactly the expected value. You might want to use `Element Value Should Be` instead. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator...
[ "def", "wait_until_element_value_is", "(", "self", ",", "locator", ",", "expected", ",", "strip", "=", "False", ",", "timeout", "=", "None", ")", ":", "self", ".", "_info", "(", "\"Waiting for '%s' value to be '%s'\"", "%", "(", "locator", ",", "expected", ")"...
Waits until the element identified by `locator` value is exactly the expected value. You might want to use `Element Value Should Be` instead. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | My Name Is Slim Shady | | strip | boolean,...
[ "Waits", "until", "the", "element", "identified", "by", "locator", "value", "is", "exactly", "the", "expected", "value", ".", "You", "might", "want", "to", "use", "Element", "Value", "Should", "Be", "instead", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L52-L63
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.wait_until_element_value_contains
def wait_until_element_value_contains(self, locator, expected, timeout=None): """Waits until the element identified by `locator` contains the expected value. You might want to use `Element Value Should Contain` instead. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_i...
python
def wait_until_element_value_contains(self, locator, expected, timeout=None): """Waits until the element identified by `locator` contains the expected value. You might want to use `Element Value Should Contain` instead. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_i...
[ "def", "wait_until_element_value_contains", "(", "self", ",", "locator", ",", "expected", ",", "timeout", "=", "None", ")", ":", "self", ".", "_info", "(", "\"Waiting for '%s' value to contain '%s'\"", "%", "(", "locator", ",", "expected", ")", ")", "self", ".",...
Waits until the element identified by `locator` contains the expected value. You might want to use `Element Value Should Contain` instead. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | Slim Shady | | timeout | maximum time to wait...
[ "Waits", "until", "the", "element", "identified", "by", "locator", "contains", "the", "expected", "value", ".", "You", "might", "want", "to", "use", "Element", "Value", "Should", "Contain", "instead", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L71-L81
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.set_element_focus
def set_element_focus(self, locator): """Sets focus on the element identified by `locator`. Should be used with elements meant to have focus only, such as text fields. This keywords also waits for the focus to be active by calling the `Wait Until Element Has Focus` keyword. | *Argument* | *Description* | *Ex...
python
def set_element_focus(self, locator): """Sets focus on the element identified by `locator`. Should be used with elements meant to have focus only, such as text fields. This keywords also waits for the focus to be active by calling the `Wait Until Element Has Focus` keyword. | *Argument* | *Description* | *Ex...
[ "def", "set_element_focus", "(", "self", ",", "locator", ")", ":", "self", ".", "_info", "(", "\"Setting focus on element '%s'\"", "%", "(", "locator", ")", ")", "element", "=", "self", ".", "_element_find", "(", "locator", ",", "True", ",", "True", ")", "...
Sets focus on the element identified by `locator`. Should be used with elements meant to have focus only, such as text fields. This keywords also waits for the focus to be active by calling the `Wait Until Element Has Focus` keyword. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element l...
[ "Sets", "focus", "on", "the", "element", "identified", "by", "locator", ".", "Should", "be", "used", "with", "elements", "meant", "to", "have", "focus", "only", "such", "as", "text", "fields", ".", "This", "keywords", "also", "waits", "for", "the", "focus"...
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L89-L103
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.clear_input_field
def clear_input_field(self, locator, method=0): """Clears the text field identified by `locator` The element.clear() method doesn't seem to work properly on all browsers, so this keyword was created to offer alternatives. The `method` argument defines the method it should use in order to clear the target fi...
python
def clear_input_field(self, locator, method=0): """Clears the text field identified by `locator` The element.clear() method doesn't seem to work properly on all browsers, so this keyword was created to offer alternatives. The `method` argument defines the method it should use in order to clear the target fi...
[ "def", "clear_input_field", "(", "self", ",", "locator", ",", "method", "=", "0", ")", ":", "element", "=", "self", ".", "_element_find", "(", "locator", ",", "True", ",", "True", ")", "if", "(", "int", "(", "method", ")", "==", "0", ")", ":", "sel...
Clears the text field identified by `locator` The element.clear() method doesn't seem to work properly on all browsers, so this keyword was created to offer alternatives. The `method` argument defines the method it should use in order to clear the target field. 0 = Uses the selenium method by doing element...
[ "Clears", "the", "text", "field", "identified", "by", "locator" ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L111-L152
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.element_text_color_should_be
def element_text_color_should_be(self, locator, expected): """Verifies the element identified by `locator` has the expected text color (it verifies the CSS attribute color). Color should be in RGBA format. Example of rgba format: rgba(RED, GREEN, BLUE, ALPHA) | *Argument* | *Description* | *Example* | | l...
python
def element_text_color_should_be(self, locator, expected): """Verifies the element identified by `locator` has the expected text color (it verifies the CSS attribute color). Color should be in RGBA format. Example of rgba format: rgba(RED, GREEN, BLUE, ALPHA) | *Argument* | *Description* | *Example* | | l...
[ "def", "element_text_color_should_be", "(", "self", ",", "locator", ",", "expected", ")", ":", "self", ".", "_info", "(", "\"Verifying element '%s' has text color '%s'\"", "%", "(", "locator", ",", "expected", ")", ")", "self", ".", "_check_element_css_value", "(", ...
Verifies the element identified by `locator` has the expected text color (it verifies the CSS attribute color). Color should be in RGBA format. Example of rgba format: rgba(RED, GREEN, BLUE, ALPHA) | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | ...
[ "Verifies", "the", "element", "identified", "by", "locator", "has", "the", "expected", "text", "color", "(", "it", "verifies", "the", "CSS", "attribute", "color", ")", ".", "Color", "should", "be", "in", "RGBA", "format", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L160-L172
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.element_background_color_should_be
def element_background_color_should_be(self, locator, expected): """Verifies the element identified by `locator` has the expected background color (it verifies the CSS attribute background-color). Color should be in RGBA format. Example of rgba format: rgba(RED, GREEN, BLUE, ALPHA) | *Argument* | *Descripti...
python
def element_background_color_should_be(self, locator, expected): """Verifies the element identified by `locator` has the expected background color (it verifies the CSS attribute background-color). Color should be in RGBA format. Example of rgba format: rgba(RED, GREEN, BLUE, ALPHA) | *Argument* | *Descripti...
[ "def", "element_background_color_should_be", "(", "self", ",", "locator", ",", "expected", ")", ":", "self", ".", "_info", "(", "\"Verifying element '%s' has background color '%s'\"", "%", "(", "locator", ",", "expected", ")", ")", "self", ".", "_check_element_css_val...
Verifies the element identified by `locator` has the expected background color (it verifies the CSS attribute background-color). Color should be in RGBA format. Example of rgba format: rgba(RED, GREEN, BLUE, ALPHA) | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id ...
[ "Verifies", "the", "element", "identified", "by", "locator", "has", "the", "expected", "background", "color", "(", "it", "verifies", "the", "CSS", "attribute", "background", "-", "color", ")", ".", "Color", "should", "be", "in", "RGBA", "format", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L180-L192
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.element_width_should_be
def element_width_should_be(self, locator, expected): """Verifies the element identified by `locator` has the expected width. Expected width should be in pixels. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected width | 800 |""" self._info...
python
def element_width_should_be(self, locator, expected): """Verifies the element identified by `locator` has the expected width. Expected width should be in pixels. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected width | 800 |""" self._info...
[ "def", "element_width_should_be", "(", "self", ",", "locator", ",", "expected", ")", ":", "self", ".", "_info", "(", "\"Verifying element '%s' width is '%s'\"", "%", "(", "locator", ",", "expected", ")", ")", "self", ".", "_check_element_size", "(", "locator", "...
Verifies the element identified by `locator` has the expected width. Expected width should be in pixels. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected width | 800 |
[ "Verifies", "the", "element", "identified", "by", "locator", "has", "the", "expected", "width", ".", "Expected", "width", "should", "be", "in", "pixels", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L200-L209
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.element_height_should_be
def element_height_should_be(self, locator, expected): """Verifies the element identified by `locator` has the expected height. Expected height should be in pixels. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected height | 600 |""" self._...
python
def element_height_should_be(self, locator, expected): """Verifies the element identified by `locator` has the expected height. Expected height should be in pixels. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected height | 600 |""" self._...
[ "def", "element_height_should_be", "(", "self", ",", "locator", ",", "expected", ")", ":", "self", ".", "_info", "(", "\"Verifying element '%s' height is '%s'\"", "%", "(", "locator", ",", "expected", ")", ")", "self", ".", "_check_element_size", "(", "locator", ...
Verifies the element identified by `locator` has the expected height. Expected height should be in pixels. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected height | 600 |
[ "Verifies", "the", "element", "identified", "by", "locator", "has", "the", "expected", "height", ".", "Expected", "height", "should", "be", "in", "pixels", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L217-L226
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.element_value_should_be
def element_value_should_be(self, locator, expected, strip=False): """Verifies the element identified by `locator` has the expected value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | My Name Is Slim Shady | | strip | Boolean, de...
python
def element_value_should_be(self, locator, expected, strip=False): """Verifies the element identified by `locator` has the expected value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | My Name Is Slim Shady | | strip | Boolean, de...
[ "def", "element_value_should_be", "(", "self", ",", "locator", ",", "expected", ",", "strip", "=", "False", ")", ":", "self", ".", "_info", "(", "\"Verifying element '%s' value is '%s'\"", "%", "(", "locator", ",", "expected", ")", ")", "element", "=", "self",...
Verifies the element identified by `locator` has the expected value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | My Name Is Slim Shady | | strip | Boolean, determines whether it should strip the field's value before comparison or ...
[ "Verifies", "the", "element", "identified", "by", "locator", "has", "the", "expected", "value", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L234-L254
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.element_value_should_not_be
def element_value_should_not_be(self, locator, value, strip=False): """Verifies the element identified by `locator` is not the specified value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | value | value it should not be | My Name Is Slim Shady | | strip | B...
python
def element_value_should_not_be(self, locator, value, strip=False): """Verifies the element identified by `locator` is not the specified value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | value | value it should not be | My Name Is Slim Shady | | strip | B...
[ "def", "element_value_should_not_be", "(", "self", ",", "locator", ",", "value", ",", "strip", "=", "False", ")", ":", "self", ".", "_info", "(", "\"Verifying element '%s' value is not '%s'\"", "%", "(", "locator", ",", "value", ")", ")", "element", "=", "self...
Verifies the element identified by `locator` is not the specified value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | value | value it should not be | My Name Is Slim Shady | | strip | Boolean, determines whether it should strip the field's value before compa...
[ "Verifies", "the", "element", "identified", "by", "locator", "is", "not", "the", "specified", "value", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L262-L279
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.element_value_should_contain
def element_value_should_contain(self, locator, expected): """Verifies the element identified by `locator` contains the expected value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | Slim Shady |""" self._info("Verifying element '...
python
def element_value_should_contain(self, locator, expected): """Verifies the element identified by `locator` contains the expected value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | Slim Shady |""" self._info("Verifying element '...
[ "def", "element_value_should_contain", "(", "self", ",", "locator", ",", "expected", ")", ":", "self", ".", "_info", "(", "\"Verifying element '%s' value contains '%s'\"", "%", "(", "locator", ",", "expected", ")", ")", "element", "=", "self", ".", "_element_find"...
Verifies the element identified by `locator` contains the expected value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | Slim Shady |
[ "Verifies", "the", "element", "identified", "by", "locator", "contains", "the", "expected", "value", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L287-L303
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.element_value_should_not_contain
def element_value_should_not_contain(self, locator, value): """Verifies the element identified by `locator` does not contain the specified value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | value | value it should not contain | Slim Shady |""" self._info(...
python
def element_value_should_not_contain(self, locator, value): """Verifies the element identified by `locator` does not contain the specified value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | value | value it should not contain | Slim Shady |""" self._info(...
[ "def", "element_value_should_not_contain", "(", "self", ",", "locator", ",", "value", ")", ":", "self", ".", "_info", "(", "\"Verifying element '%s' value does not contain '%s'\"", "%", "(", "locator", ",", "value", ")", ")", "element", "=", "self", ".", "_element...
Verifies the element identified by `locator` does not contain the specified value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | value | value it should not contain | Slim Shady |
[ "Verifies", "the", "element", "identified", "by", "locator", "does", "not", "contain", "the", "specified", "value", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L311-L324
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.element_focus_should_be_set
def element_focus_should_be_set(self, locator): """Verifies the element identified by `locator` has focus. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id |""" self._info("Verifying element '%s' focus is set" % locator) self._check_element_focus(True, locator)
python
def element_focus_should_be_set(self, locator): """Verifies the element identified by `locator` has focus. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id |""" self._info("Verifying element '%s' focus is set" % locator) self._check_element_focus(True, locator)
[ "def", "element_focus_should_be_set", "(", "self", ",", "locator", ")", ":", "self", ".", "_info", "(", "\"Verifying element '%s' focus is set\"", "%", "locator", ")", "self", ".", "_check_element_focus", "(", "True", ",", "locator", ")" ]
Verifies the element identified by `locator` has focus. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id |
[ "Verifies", "the", "element", "identified", "by", "locator", "has", "focus", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L332-L339
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.element_focus_should_not_be_set
def element_focus_should_not_be_set(self, locator): """Verifies the element identified by `locator` does not have focus. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id |""" self._info("Verifying element '%s' focus is not set" % locator) self._check_element_focus...
python
def element_focus_should_not_be_set(self, locator): """Verifies the element identified by `locator` does not have focus. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id |""" self._info("Verifying element '%s' focus is not set" % locator) self._check_element_focus...
[ "def", "element_focus_should_not_be_set", "(", "self", ",", "locator", ")", ":", "self", ".", "_info", "(", "\"Verifying element '%s' focus is not set\"", "%", "locator", ")", "self", ".", "_check_element_focus", "(", "False", ",", "locator", ")" ]
Verifies the element identified by `locator` does not have focus. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id |
[ "Verifies", "the", "element", "identified", "by", "locator", "does", "not", "have", "focus", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L347-L354
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.element_css_attribute_should_be
def element_css_attribute_should_be(self, locator, prop, expected): """Verifies the element identified by `locator` has the expected value for the targeted `prop`. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | prop | targeted css attribute | background-color...
python
def element_css_attribute_should_be(self, locator, prop, expected): """Verifies the element identified by `locator` has the expected value for the targeted `prop`. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | prop | targeted css attribute | background-color...
[ "def", "element_css_attribute_should_be", "(", "self", ",", "locator", ",", "prop", ",", "expected", ")", ":", "self", ".", "_info", "(", "\"Verifying element '%s' has css attribute '%s' with a value of '%s'\"", "%", "(", "locator", ",", "prop", ",", "expected", ")", ...
Verifies the element identified by `locator` has the expected value for the targeted `prop`. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | prop | targeted css attribute | background-color | | expected | expected value | rgba(0, 128, 0, 1) |
[ "Verifies", "the", "element", "identified", "by", "locator", "has", "the", "expected", "value", "for", "the", "targeted", "prop", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L362-L372
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.wait_until_page_contains_elements
def wait_until_page_contains_elements(self, timeout, *locators): """This is a copy of `Wait Until Page Contains Element` but it allows multiple arguments in order to wait for more than one element. | *Argument* | *Description* | *Example* | | timeout | maximum time to wait, if set to ${None} it will use Sele...
python
def wait_until_page_contains_elements(self, timeout, *locators): """This is a copy of `Wait Until Page Contains Element` but it allows multiple arguments in order to wait for more than one element. | *Argument* | *Description* | *Example* | | timeout | maximum time to wait, if set to ${None} it will use Sele...
[ "def", "wait_until_page_contains_elements", "(", "self", ",", "timeout", ",", "*", "locators", ")", ":", "self", ".", "_wait_until_no_error", "(", "timeout", ",", "self", ".", "_wait_for_elements", ",", "locators", ")" ]
This is a copy of `Wait Until Page Contains Element` but it allows multiple arguments in order to wait for more than one element. | *Argument* | *Description* | *Example* | | timeout | maximum time to wait, if set to ${None} it will use Selenium's default timeout | 5s | | *locators | Selenium 2 element locat...
[ "This", "is", "a", "copy", "of", "Wait", "Until", "Page", "Contains", "Element", "but", "it", "allows", "multiple", "arguments", "in", "order", "to", "wait", "for", "more", "than", "one", "element", ".", "|", "*", "Argument", "*", "|", "*", "Description"...
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L380-L388
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.wait_until_page_contains_one_of_these_elements
def wait_until_page_contains_one_of_these_elements(self, timeout, *locators): """Waits until at least one of the specified elements is found. | *Argument* | *Description* | *Example* | | timeout | maximum time to wait, if set to ${None} it will use Selenium's default timeout | 5s | | *locators | Selenium 2 e...
python
def wait_until_page_contains_one_of_these_elements(self, timeout, *locators): """Waits until at least one of the specified elements is found. | *Argument* | *Description* | *Example* | | timeout | maximum time to wait, if set to ${None} it will use Selenium's default timeout | 5s | | *locators | Selenium 2 e...
[ "def", "wait_until_page_contains_one_of_these_elements", "(", "self", ",", "timeout", ",", "*", "locators", ")", ":", "self", ".", "_wait_until_no_error", "(", "timeout", ",", "self", ".", "_wait_for_at_least_one_element", ",", "locators", ")" ]
Waits until at least one of the specified elements is found. | *Argument* | *Description* | *Example* | | timeout | maximum time to wait, if set to ${None} it will use Selenium's default timeout | 5s | | *locators | Selenium 2 element locator(s) | id=MyId |
[ "Waits", "until", "at", "least", "one", "of", "the", "specified", "elements", "is", "found", ".", "|", "*", "Argument", "*", "|", "*", "Description", "*", "|", "*", "Example", "*", "|", "|", "timeout", "|", "maximum", "time", "to", "wait", "if", "set...
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L396-L403
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.wait_until_page_does_not_contain_these_elements
def wait_until_page_does_not_contain_these_elements(self, timeout, *locators): """Waits until all of the specified elements are not found on the page. | *Argument* | *Description* | *Example* | | timeout | maximum time to wait, if set to ${None} it will use Selenium's default timeout | 5s | | *locators | Selen...
python
def wait_until_page_does_not_contain_these_elements(self, timeout, *locators): """Waits until all of the specified elements are not found on the page. | *Argument* | *Description* | *Example* | | timeout | maximum time to wait, if set to ${None} it will use Selenium's default timeout | 5s | | *locators | Selen...
[ "def", "wait_until_page_does_not_contain_these_elements", "(", "self", ",", "timeout", ",", "*", "locators", ")", ":", "self", ".", "_wait_until_no_error", "(", "timeout", ",", "self", ".", "_wait_for_elements_to_go_away", ",", "locators", ")" ]
Waits until all of the specified elements are not found on the page. | *Argument* | *Description* | *Example* | | timeout | maximum time to wait, if set to ${None} it will use Selenium's default timeout | 5s | | *locators | Selenium 2 element locator(s) | id=MyId |
[ "Waits", "until", "all", "of", "the", "specified", "elements", "are", "not", "found", "on", "the", "page", "." ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L411-L418
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.tap_key
def tap_key(self, key, complementKey=None) : """Presses the specified `key`. The `complementKey` defines the key to hold when pressing the specified `key`. For example, you could use ${VK_TAB} as `key` and use ${VK_SHIFT} as `complementKey' in order to press Shift + Tab (back tab) | =Argument= | =Description= ...
python
def tap_key(self, key, complementKey=None) : """Presses the specified `key`. The `complementKey` defines the key to hold when pressing the specified `key`. For example, you could use ${VK_TAB} as `key` and use ${VK_SHIFT} as `complementKey' in order to press Shift + Tab (back tab) | =Argument= | =Description= ...
[ "def", "tap_key", "(", "self", ",", "key", ",", "complementKey", "=", "None", ")", ":", "driver", "=", "self", ".", "_current_browser", "(", ")", "if", "(", "complementKey", "is", "not", "None", ")", ":", "ActionChains", "(", "driver", ")", ".", "key_d...
Presses the specified `key`. The `complementKey` defines the key to hold when pressing the specified `key`. For example, you could use ${VK_TAB} as `key` and use ${VK_SHIFT} as `complementKey' in order to press Shift + Tab (back tab) | =Argument= | =Description= | =Example= | | key | the key to press | ${VK_F4...
[ "Presses", "the", "specified", "key", ".", "The", "complementKey", "defines", "the", "key", "to", "hold", "when", "pressing", "the", "specified", "key", ".", "For", "example", "you", "could", "use", "$", "{", "VK_TAB", "}", "as", "key", "and", "use", "$"...
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L426-L441
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
_keywords.wait_until_element_is_clickable
def wait_until_element_is_clickable(self, locator, timeout=None): """Clicks the element specified by `locator` until the operation succeeds. This should be used with buttons that are generated in real-time and that don't have their click handling available immediately. This keyword avoids unclickable element exce...
python
def wait_until_element_is_clickable(self, locator, timeout=None): """Clicks the element specified by `locator` until the operation succeeds. This should be used with buttons that are generated in real-time and that don't have their click handling available immediately. This keyword avoids unclickable element exce...
[ "def", "wait_until_element_is_clickable", "(", "self", ",", "locator", ",", "timeout", "=", "None", ")", ":", "self", ".", "_wait_until_no_error", "(", "timeout", ",", "self", ".", "_wait_for_click_to_succeed", ",", "locator", ")" ]
Clicks the element specified by `locator` until the operation succeeds. This should be used with buttons that are generated in real-time and that don't have their click handling available immediately. This keyword avoids unclickable element exceptions. | =Argument= | =Description= | =Example= | | locator | Sel...
[ "Clicks", "the", "element", "specified", "by", "locator", "until", "the", "operation", "succeeds", ".", "This", "should", "be", "used", "with", "buttons", "that", "are", "generated", "in", "real", "-", "time", "and", "that", "don", "t", "have", "their", "c...
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L449-L458
train
boolangery/py-lua-parser
luaparser/utils/visitor.py
_visitor_impl
def _visitor_impl(self, arg): """Actual visitor method implementation.""" if (_qualname(type(self)), type(arg)) in _methods: method = _methods[(_qualname(type(self)), type(arg))] return method(self, arg) else: # if no visitor method found for this arg type, # search in parent...
python
def _visitor_impl(self, arg): """Actual visitor method implementation.""" if (_qualname(type(self)), type(arg)) in _methods: method = _methods[(_qualname(type(self)), type(arg))] return method(self, arg) else: # if no visitor method found for this arg type, # search in parent...
[ "def", "_visitor_impl", "(", "self", ",", "arg", ")", ":", "if", "(", "_qualname", "(", "type", "(", "self", ")", ")", ",", "type", "(", "arg", ")", ")", "in", "_methods", ":", "method", "=", "_methods", "[", "(", "_qualname", "(", "type", "(", "...
Actual visitor method implementation.
[ "Actual", "visitor", "method", "implementation", "." ]
578f2bf75f6f84c4b52c2affba56a4ec569d7ce7
https://github.com/boolangery/py-lua-parser/blob/578f2bf75f6f84c4b52c2affba56a4ec569d7ce7/luaparser/utils/visitor.py#L25-L40
train
boolangery/py-lua-parser
luaparser/utils/visitor.py
visitor
def visitor(arg_type): """Decorator that creates a visitor method.""" def decorator(fn): declaring_class = _declaring_class(fn) _methods[(declaring_class, arg_type)] = fn # Replace all decorated methods with _visitor_impl return _visitor_impl return decorator
python
def visitor(arg_type): """Decorator that creates a visitor method.""" def decorator(fn): declaring_class = _declaring_class(fn) _methods[(declaring_class, arg_type)] = fn # Replace all decorated methods with _visitor_impl return _visitor_impl return decorator
[ "def", "visitor", "(", "arg_type", ")", ":", "def", "decorator", "(", "fn", ")", ":", "declaring_class", "=", "_declaring_class", "(", "fn", ")", "_methods", "[", "(", "declaring_class", ",", "arg_type", ")", "]", "=", "fn", "# Replace all decorated methods wi...
Decorator that creates a visitor method.
[ "Decorator", "that", "creates", "a", "visitor", "method", "." ]
578f2bf75f6f84c4b52c2affba56a4ec569d7ce7
https://github.com/boolangery/py-lua-parser/blob/578f2bf75f6f84c4b52c2affba56a4ec569d7ce7/luaparser/utils/visitor.py#L44-L54
train
noirbizarre/django-absolute
absolute/templatetags/absolute.py
absolute
def absolute(parser, token): ''' Returns a full absolute URL based on the request host. This template tag takes exactly the same paramters as url template tag. ''' node = url(parser, token) return AbsoluteUrlNode( view_name=node.view_name, args=node.args, kwargs=node.kwa...
python
def absolute(parser, token): ''' Returns a full absolute URL based on the request host. This template tag takes exactly the same paramters as url template tag. ''' node = url(parser, token) return AbsoluteUrlNode( view_name=node.view_name, args=node.args, kwargs=node.kwa...
[ "def", "absolute", "(", "parser", ",", "token", ")", ":", "node", "=", "url", "(", "parser", ",", "token", ")", "return", "AbsoluteUrlNode", "(", "view_name", "=", "node", ".", "view_name", ",", "args", "=", "node", ".", "args", ",", "kwargs", "=", "...
Returns a full absolute URL based on the request host. This template tag takes exactly the same paramters as url template tag.
[ "Returns", "a", "full", "absolute", "URL", "based", "on", "the", "request", "host", "." ]
0358fd39c641afdb589f448c0dae72d816c4e5f2
https://github.com/noirbizarre/django-absolute/blob/0358fd39c641afdb589f448c0dae72d816c4e5f2/absolute/templatetags/absolute.py#L24-L36
train
noirbizarre/django-absolute
absolute/templatetags/absolute.py
site
def site(parser, token): ''' Returns a full absolute URL based on the current site. This template tag takes exactly the same paramters as url template tag. ''' node = url(parser, token) return SiteUrlNode( view_name=node.view_name, args=node.args, kwargs=node.kwargs, ...
python
def site(parser, token): ''' Returns a full absolute URL based on the current site. This template tag takes exactly the same paramters as url template tag. ''' node = url(parser, token) return SiteUrlNode( view_name=node.view_name, args=node.args, kwargs=node.kwargs, ...
[ "def", "site", "(", "parser", ",", "token", ")", ":", "node", "=", "url", "(", "parser", ",", "token", ")", "return", "SiteUrlNode", "(", "view_name", "=", "node", ".", "view_name", ",", "args", "=", "node", ".", "args", ",", "kwargs", "=", "node", ...
Returns a full absolute URL based on the current site. This template tag takes exactly the same paramters as url template tag.
[ "Returns", "a", "full", "absolute", "URL", "based", "on", "the", "current", "site", "." ]
0358fd39c641afdb589f448c0dae72d816c4e5f2
https://github.com/noirbizarre/django-absolute/blob/0358fd39c641afdb589f448c0dae72d816c4e5f2/absolute/templatetags/absolute.py#L59-L71
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/patches/__init__.py
_patches._wait_until_exp
def _wait_until_exp(self, timeout, error, function, *args): """This replaces the method from Selenium2Library to fix the major logic error in it""" error = error.replace('<TIMEOUT>', self._format_timeout(timeout)) def wait_func(): return None if function(*args) else error self._wait_until_no_error_ex...
python
def _wait_until_exp(self, timeout, error, function, *args): """This replaces the method from Selenium2Library to fix the major logic error in it""" error = error.replace('<TIMEOUT>', self._format_timeout(timeout)) def wait_func(): return None if function(*args) else error self._wait_until_no_error_ex...
[ "def", "_wait_until_exp", "(", "self", ",", "timeout", ",", "error", ",", "function", ",", "*", "args", ")", ":", "error", "=", "error", ".", "replace", "(", "'<TIMEOUT>'", ",", "self", ".", "_format_timeout", "(", "timeout", ")", ")", "def", "wait_func"...
This replaces the method from Selenium2Library to fix the major logic error in it
[ "This", "replaces", "the", "method", "from", "Selenium2Library", "to", "fix", "the", "major", "logic", "error", "in", "it" ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/patches/__init__.py#L13-L21
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/patches/__init__.py
_patches._wait_until_no_error_exp
def _wait_until_no_error_exp(self, timeout, wait_func, *args): """This replaces the method from Selenium2Library to fix the major logic error in it""" timeout = robot.utils.timestr_to_secs(timeout) if timeout is not None else self._timeout_in_secs maxtime = time.time() + timeout while True: try: ...
python
def _wait_until_no_error_exp(self, timeout, wait_func, *args): """This replaces the method from Selenium2Library to fix the major logic error in it""" timeout = robot.utils.timestr_to_secs(timeout) if timeout is not None else self._timeout_in_secs maxtime = time.time() + timeout while True: try: ...
[ "def", "_wait_until_no_error_exp", "(", "self", ",", "timeout", ",", "wait_func", ",", "*", "args", ")", ":", "timeout", "=", "robot", ".", "utils", ".", "timestr_to_secs", "(", "timeout", ")", "if", "timeout", "is", "not", "None", "else", "self", ".", "...
This replaces the method from Selenium2Library to fix the major logic error in it
[ "This", "replaces", "the", "method", "from", "Selenium2Library", "to", "fix", "the", "major", "logic", "error", "in", "it" ]
5ca3fa776063c6046dff317cb2575e4772d7541f
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/patches/__init__.py#L23-L44
train
noirbizarre/django-absolute
setup.py
rst
def rst(filename): ''' Load rst file and sanitize it for PyPI. Remove unsupported github tags: - code-block directive ''' content = open(filename).read() return re.sub(r'\.\.\s? code-block::\s*(\w|\+)+', '::', content)
python
def rst(filename): ''' Load rst file and sanitize it for PyPI. Remove unsupported github tags: - code-block directive ''' content = open(filename).read() return re.sub(r'\.\.\s? code-block::\s*(\w|\+)+', '::', content)
[ "def", "rst", "(", "filename", ")", ":", "content", "=", "open", "(", "filename", ")", ".", "read", "(", ")", "return", "re", ".", "sub", "(", "r'\\.\\.\\s? code-block::\\s*(\\w|\\+)+'", ",", "'::'", ",", "content", ")" ]
Load rst file and sanitize it for PyPI. Remove unsupported github tags: - code-block directive
[ "Load", "rst", "file", "and", "sanitize", "it", "for", "PyPI", ".", "Remove", "unsupported", "github", "tags", ":", "-", "code", "-", "block", "directive" ]
0358fd39c641afdb589f448c0dae72d816c4e5f2
https://github.com/noirbizarre/django-absolute/blob/0358fd39c641afdb589f448c0dae72d816c4e5f2/setup.py#L7-L14
train
indranilsinharoy/pyzos
pyzos/zosutils.py
get_callable_method_dict
def get_callable_method_dict(obj): """Returns a dictionary of callable methods of object `obj`. @param obj: ZOS API Python COM object @return: a dictionary of callable methods Notes: the function only returns the callable attributes that are listed by dir() function. Properties are not r...
python
def get_callable_method_dict(obj): """Returns a dictionary of callable methods of object `obj`. @param obj: ZOS API Python COM object @return: a dictionary of callable methods Notes: the function only returns the callable attributes that are listed by dir() function. Properties are not r...
[ "def", "get_callable_method_dict", "(", "obj", ")", ":", "methodDict", "=", "{", "}", "for", "methodStr", "in", "dir", "(", "obj", ")", ":", "method", "=", "getattr", "(", "obj", ",", "methodStr", ",", "'none'", ")", "if", "callable", "(", "method", ")...
Returns a dictionary of callable methods of object `obj`. @param obj: ZOS API Python COM object @return: a dictionary of callable methods Notes: the function only returns the callable attributes that are listed by dir() function. Properties are not returned.
[ "Returns", "a", "dictionary", "of", "callable", "methods", "of", "object", "obj", "." ]
da6bf3296b0154ccee44ad9a4286055ae031ecc7
https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zosutils.py#L14-L29
train
indranilsinharoy/pyzos
pyzos/zosutils.py
replicate_methods
def replicate_methods(srcObj, dstObj): """Replicate callable methods from a `srcObj` to `dstObj` (generally a wrapper object). @param srcObj: source object @param dstObj: destination object of the same type. @return : none Implementer notes: 1. Once the methods are mapped from the `s...
python
def replicate_methods(srcObj, dstObj): """Replicate callable methods from a `srcObj` to `dstObj` (generally a wrapper object). @param srcObj: source object @param dstObj: destination object of the same type. @return : none Implementer notes: 1. Once the methods are mapped from the `s...
[ "def", "replicate_methods", "(", "srcObj", ",", "dstObj", ")", ":", "# prevent methods that we intend to specialize from being mapped. The specialized ", "# (overridden) methods are methods with the same name as the corresponding method in ", "# the source ZOS API COM object written for each ZOS...
Replicate callable methods from a `srcObj` to `dstObj` (generally a wrapper object). @param srcObj: source object @param dstObj: destination object of the same type. @return : none Implementer notes: 1. Once the methods are mapped from the `srcObj` to the `dstObj`, the method calls will ...
[ "Replicate", "callable", "methods", "from", "a", "srcObj", "to", "dstObj", "(", "generally", "a", "wrapper", "object", ")", "." ]
da6bf3296b0154ccee44ad9a4286055ae031ecc7
https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zosutils.py#L31-L64
train
indranilsinharoy/pyzos
pyzos/zosutils.py
get_properties
def get_properties(zos_obj): """Returns a lists of properties bound to the object `zos_obj` @param zos_obj: ZOS API Python COM object @return prop_get: list of properties that are only getters @return prop_set: list of properties that are both getters and setters """ prop_get = set(zos_obj._pro...
python
def get_properties(zos_obj): """Returns a lists of properties bound to the object `zos_obj` @param zos_obj: ZOS API Python COM object @return prop_get: list of properties that are only getters @return prop_set: list of properties that are both getters and setters """ prop_get = set(zos_obj._pro...
[ "def", "get_properties", "(", "zos_obj", ")", ":", "prop_get", "=", "set", "(", "zos_obj", ".", "_prop_map_get_", ".", "keys", "(", ")", ")", "prop_set", "=", "set", "(", "zos_obj", ".", "_prop_map_put_", ".", "keys", "(", ")", ")", "if", "prop_set", "...
Returns a lists of properties bound to the object `zos_obj` @param zos_obj: ZOS API Python COM object @return prop_get: list of properties that are only getters @return prop_set: list of properties that are both getters and setters
[ "Returns", "a", "lists", "of", "properties", "bound", "to", "the", "object", "zos_obj" ]
da6bf3296b0154ccee44ad9a4286055ae031ecc7
https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zosutils.py#L66-L80
train
indranilsinharoy/pyzos
pyzos/zosutils.py
managed_wrapper_class_factory
def managed_wrapper_class_factory(zos_obj): """Creates and returns a wrapper class of a ZOS object, exposing the ZOS objects methods and propertis, and patching custom specialized attributes @param zos_obj: ZOS API Python COM object """ cls_name = repr(zos_obj).split()[0].split('.')[-1] disp...
python
def managed_wrapper_class_factory(zos_obj): """Creates and returns a wrapper class of a ZOS object, exposing the ZOS objects methods and propertis, and patching custom specialized attributes @param zos_obj: ZOS API Python COM object """ cls_name = repr(zos_obj).split()[0].split('.')[-1] disp...
[ "def", "managed_wrapper_class_factory", "(", "zos_obj", ")", ":", "cls_name", "=", "repr", "(", "zos_obj", ")", ".", "split", "(", ")", "[", "0", "]", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "dispatch_attr", "=", "'_'", "+", "cls_name", "....
Creates and returns a wrapper class of a ZOS object, exposing the ZOS objects methods and propertis, and patching custom specialized attributes @param zos_obj: ZOS API Python COM object
[ "Creates", "and", "returns", "a", "wrapper", "class", "of", "a", "ZOS", "object", "exposing", "the", "ZOS", "objects", "methods", "and", "propertis", "and", "patching", "custom", "specialized", "attributes" ]
da6bf3296b0154ccee44ad9a4286055ae031ecc7
https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zosutils.py#L115-L192
train
indranilsinharoy/pyzos
pyzos/zosutils.py
wrapped_zos_object
def wrapped_zos_object(zos_obj): """Helper function to wrap ZOS API COM objects. @param zos_obj : ZOS API Python COM object @return: instance of the wrapped ZOS API class. If the input object is not a ZOS-API COM object or if it is already wrapped, then the object is returned without ...
python
def wrapped_zos_object(zos_obj): """Helper function to wrap ZOS API COM objects. @param zos_obj : ZOS API Python COM object @return: instance of the wrapped ZOS API class. If the input object is not a ZOS-API COM object or if it is already wrapped, then the object is returned without ...
[ "def", "wrapped_zos_object", "(", "zos_obj", ")", ":", "if", "hasattr", "(", "zos_obj", ",", "'_wrapped'", ")", "or", "(", "'CLSID'", "not", "in", "dir", "(", "zos_obj", ")", ")", ":", "return", "zos_obj", "else", ":", "Class", "=", "managed_wrapper_class_...
Helper function to wrap ZOS API COM objects. @param zos_obj : ZOS API Python COM object @return: instance of the wrapped ZOS API class. If the input object is not a ZOS-API COM object or if it is already wrapped, then the object is returned without wrapping. Notes: The funct...
[ "Helper", "function", "to", "wrap", "ZOS", "API", "COM", "objects", "." ]
da6bf3296b0154ccee44ad9a4286055ae031ecc7
https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zosutils.py#L194-L210
train
secure-systems-lab/securesystemslib
securesystemslib/ecdsa_keys.py
generate_public_and_private
def generate_public_and_private(scheme='ecdsa-sha2-nistp256'): """ <Purpose> Generate a pair of ECDSA public and private keys with one of the supported, external cryptography libraries. The public and private keys returned conform to 'securesystemslib.formats.PEMECDSA_SCHEMA' and 'securesystemslib....
python
def generate_public_and_private(scheme='ecdsa-sha2-nistp256'): """ <Purpose> Generate a pair of ECDSA public and private keys with one of the supported, external cryptography libraries. The public and private keys returned conform to 'securesystemslib.formats.PEMECDSA_SCHEMA' and 'securesystemslib....
[ "def", "generate_public_and_private", "(", "scheme", "=", "'ecdsa-sha2-nistp256'", ")", ":", "# Does 'scheme' have the correct format?", "# Verify that 'scheme' is of the correct type, and that it's one of the", "# supported ECDSA . It must conform to", "# 'securesystemslib.formats.ECDSA_SCHE...
<Purpose> Generate a pair of ECDSA public and private keys with one of the supported, external cryptography libraries. The public and private keys returned conform to 'securesystemslib.formats.PEMECDSA_SCHEMA' and 'securesystemslib.formats.PEMECDSA_SCHEMA', respectively. The public ECDSA public ke...
[ "<Purpose", ">", "Generate", "a", "pair", "of", "ECDSA", "public", "and", "private", "keys", "with", "one", "of", "the", "supported", "external", "cryptography", "libraries", ".", "The", "public", "and", "private", "keys", "returned", "conform", "to", "secures...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/ecdsa_keys.py#L67-L155
train
secure-systems-lab/securesystemslib
securesystemslib/ecdsa_keys.py
create_signature
def create_signature(public_key, private_key, data, scheme='ecdsa-sha2-nistp256'): """ <Purpose> Return a (signature, scheme) tuple. >>> requested_scheme = 'ecdsa-sha2-nistp256' >>> public, private = generate_public_and_private(requested_scheme) >>> data = b'The quick brown fox jumps over the lazy ...
python
def create_signature(public_key, private_key, data, scheme='ecdsa-sha2-nistp256'): """ <Purpose> Return a (signature, scheme) tuple. >>> requested_scheme = 'ecdsa-sha2-nistp256' >>> public, private = generate_public_and_private(requested_scheme) >>> data = b'The quick brown fox jumps over the lazy ...
[ "def", "create_signature", "(", "public_key", ",", "private_key", ",", "data", ",", "scheme", "=", "'ecdsa-sha2-nistp256'", ")", ":", "# Do 'public_key' and 'private_key' have the correct format?", "# This check will ensure that the arguments conform to", "# 'securesystemslib.formats...
<Purpose> Return a (signature, scheme) tuple. >>> requested_scheme = 'ecdsa-sha2-nistp256' >>> public, private = generate_public_and_private(requested_scheme) >>> data = b'The quick brown fox jumps over the lazy dog' >>> signature, scheme = create_signature(public, private, data, requested_scheme) ...
[ "<Purpose", ">", "Return", "a", "(", "signature", "scheme", ")", "tuple", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/ecdsa_keys.py#L161-L240
train
secure-systems-lab/securesystemslib
securesystemslib/ecdsa_keys.py
verify_signature
def verify_signature(public_key, scheme, signature, data): """ <Purpose> Verify that 'signature' was produced by the private key associated with 'public_key'. >>> scheme = 'ecdsa-sha2-nistp256' >>> public, private = generate_public_and_private(scheme) >>> data = b'The quick brown fox jumps over...
python
def verify_signature(public_key, scheme, signature, data): """ <Purpose> Verify that 'signature' was produced by the private key associated with 'public_key'. >>> scheme = 'ecdsa-sha2-nistp256' >>> public, private = generate_public_and_private(scheme) >>> data = b'The quick brown fox jumps over...
[ "def", "verify_signature", "(", "public_key", ",", "scheme", ",", "signature", ",", "data", ")", ":", "# Are the arguments properly formatted?", "# If not, raise 'securesystemslib.exceptions.FormatError'.", "securesystemslib", ".", "formats", ".", "PEMECDSA_SCHEMA", ".", "che...
<Purpose> Verify that 'signature' was produced by the private key associated with 'public_key'. >>> scheme = 'ecdsa-sha2-nistp256' >>> public, private = generate_public_and_private(scheme) >>> data = b'The quick brown fox jumps over the lazy dog' >>> signature, scheme = create_signature(public,...
[ "<Purpose", ">", "Verify", "that", "signature", "was", "produced", "by", "the", "private", "key", "associated", "with", "public_key", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/ecdsa_keys.py#L246-L315
train
secure-systems-lab/securesystemslib
securesystemslib/ecdsa_keys.py
create_ecdsa_public_and_private_from_pem
def create_ecdsa_public_and_private_from_pem(pem, password=None): """ <Purpose> Create public and private ECDSA keys from a private 'pem'. The public and private keys are strings in PEM format: public: '-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----', private: '-----BEGIN EC PRIVATE KEY--...
python
def create_ecdsa_public_and_private_from_pem(pem, password=None): """ <Purpose> Create public and private ECDSA keys from a private 'pem'. The public and private keys are strings in PEM format: public: '-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----', private: '-----BEGIN EC PRIVATE KEY--...
[ "def", "create_ecdsa_public_and_private_from_pem", "(", "pem", ",", "password", "=", "None", ")", ":", "# Does 'pem' have the correct format?", "# This check will ensure 'pem' conforms to", "# 'securesystemslib.formats.ECDSARSA_SCHEMA'.", "securesystemslib", ".", "formats", ".", "P...
<Purpose> Create public and private ECDSA keys from a private 'pem'. The public and private keys are strings in PEM format: public: '-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----', private: '-----BEGIN EC PRIVATE KEY----- ... -----END EC PRIVATE KEY-----'}} >>> junk, private = generate_...
[ "<Purpose", ">", "Create", "public", "and", "private", "ECDSA", "keys", "from", "a", "private", "pem", ".", "The", "public", "and", "private", "keys", "are", "strings", "in", "PEM", "format", ":" ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/ecdsa_keys.py#L321-L405
train
secure-systems-lab/securesystemslib
securesystemslib/ecdsa_keys.py
create_ecdsa_encrypted_pem
def create_ecdsa_encrypted_pem(private_pem, passphrase): """ <Purpose> Return a string in PEM format, where the private part of the ECDSA key is encrypted. The private part of the ECDSA key is encrypted as done by pyca/cryptography: "Encrypt using the best available encryption for a given key's back...
python
def create_ecdsa_encrypted_pem(private_pem, passphrase): """ <Purpose> Return a string in PEM format, where the private part of the ECDSA key is encrypted. The private part of the ECDSA key is encrypted as done by pyca/cryptography: "Encrypt using the best available encryption for a given key's back...
[ "def", "create_ecdsa_encrypted_pem", "(", "private_pem", ",", "passphrase", ")", ":", "# Does 'private_key' have the correct format?", "# Raise 'securesystemslib.exceptions.FormatError' if the check fails.", "securesystemslib", ".", "formats", ".", "PEMRSA_SCHEMA", ".", "check_match"...
<Purpose> Return a string in PEM format, where the private part of the ECDSA key is encrypted. The private part of the ECDSA key is encrypted as done by pyca/cryptography: "Encrypt using the best available encryption for a given key's backend. This is a curated encryption choice and the algorithm may ...
[ "<Purpose", ">", "Return", "a", "string", "in", "PEM", "format", "where", "the", "private", "part", "of", "the", "ECDSA", "key", "is", "encrypted", ".", "The", "private", "part", "of", "the", "ECDSA", "key", "is", "encrypted", "as", "done", "by", "pyca",...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/ecdsa_keys.py#L411-L467
train
HEPData/hepdata-converter
hepdata_converter/parsers/oldhepdata_parser.py
OldHEPData.reset
def reset(self): """Clean any processing data, and prepare object for reuse """ self.current_table = None self.tables = [] self.data = [{}] self.additional_data = {} self.lines = [] self.set_state('document') self.current_file = None self.s...
python
def reset(self): """Clean any processing data, and prepare object for reuse """ self.current_table = None self.tables = [] self.data = [{}] self.additional_data = {} self.lines = [] self.set_state('document') self.current_file = None self.s...
[ "def", "reset", "(", "self", ")", ":", "self", ".", "current_table", "=", "None", "self", ".", "tables", "=", "[", "]", "self", ".", "data", "=", "[", "{", "}", "]", "self", ".", "additional_data", "=", "{", "}", "self", ".", "lines", "=", "[", ...
Clean any processing data, and prepare object for reuse
[ "Clean", "any", "processing", "data", "and", "prepare", "object", "for", "reuse" ]
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/parsers/oldhepdata_parser.py#L34-L44
train
HEPData/hepdata-converter
hepdata_converter/parsers/oldhepdata_parser.py
OldHEPData._parse_line
def _parse_line(self, file): """Parse single line (or more if particular keyword actually demands it) :param file: :type file: file """ line = self._strip_comments(file.readline()) # check if the file ended if not line: return False # line w...
python
def _parse_line(self, file): """Parse single line (or more if particular keyword actually demands it) :param file: :type file: file """ line = self._strip_comments(file.readline()) # check if the file ended if not line: return False # line w...
[ "def", "_parse_line", "(", "self", ",", "file", ")", ":", "line", "=", "self", ".", "_strip_comments", "(", "file", ".", "readline", "(", ")", ")", "# check if the file ended", "if", "not", "line", ":", "return", "False", "# line was empty or it was a comment, c...
Parse single line (or more if particular keyword actually demands it) :param file: :type file: file
[ "Parse", "single", "line", "(", "or", "more", "if", "particular", "keyword", "actually", "demands", "it", ")" ]
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/parsers/oldhepdata_parser.py#L136-L165
train
HEPData/hepdata-converter
hepdata_converter/parsers/oldhepdata_parser.py
OldHEPData._set_table
def _set_table(self, data): """Set current parsing state to 'table', create new table object and add it to tables collection """ self.set_state('table') self.current_table = HEPTable(index=len(self.tables) + 1) self.tables.append(self.current_table) self.data.appe...
python
def _set_table(self, data): """Set current parsing state to 'table', create new table object and add it to tables collection """ self.set_state('table') self.current_table = HEPTable(index=len(self.tables) + 1) self.tables.append(self.current_table) self.data.appe...
[ "def", "_set_table", "(", "self", ",", "data", ")", ":", "self", ".", "set_state", "(", "'table'", ")", "self", ".", "current_table", "=", "HEPTable", "(", "index", "=", "len", "(", "self", ".", "tables", ")", "+", "1", ")", "self", ".", "tables", ...
Set current parsing state to 'table', create new table object and add it to tables collection
[ "Set", "current", "parsing", "state", "to", "table", "create", "new", "table", "object", "and", "add", "it", "to", "tables", "collection" ]
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/parsers/oldhepdata_parser.py#L183-L190
train
HEPData/hepdata-converter
hepdata_converter/parsers/oldhepdata_parser.py
OldHEPData._parse_table_data
def _parse_table_data(self, data): """Parse dataset data of the original HEPData format :param data: header of the table to be parsed :raise ValueError: """ header = data.split(':') self.current_table.data_header = header for i, h in enumerate(header): ...
python
def _parse_table_data(self, data): """Parse dataset data of the original HEPData format :param data: header of the table to be parsed :raise ValueError: """ header = data.split(':') self.current_table.data_header = header for i, h in enumerate(header): ...
[ "def", "_parse_table_data", "(", "self", ",", "data", ")", ":", "header", "=", "data", ".", "split", "(", "':'", ")", "self", ".", "current_table", ".", "data_header", "=", "header", "for", "i", ",", "h", "in", "enumerate", "(", "header", ")", ":", "...
Parse dataset data of the original HEPData format :param data: header of the table to be parsed :raise ValueError:
[ "Parse", "dataset", "data", "of", "the", "original", "HEPData", "format" ]
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/parsers/oldhepdata_parser.py#L204-L406
train
HEPData/hepdata-converter
hepdata_converter/parsers/oldhepdata_parser.py
OldHEPData._reformat_matrix
def _reformat_matrix(self): """Transform a square matrix into a format with two independent variables and one dependent variable. """ nxax = len(self.current_table.data['independent_variables']) nyax = len(self.current_table.data['dependent_variables']) npts = len(self.current_ta...
python
def _reformat_matrix(self): """Transform a square matrix into a format with two independent variables and one dependent variable. """ nxax = len(self.current_table.data['independent_variables']) nyax = len(self.current_table.data['dependent_variables']) npts = len(self.current_ta...
[ "def", "_reformat_matrix", "(", "self", ")", ":", "nxax", "=", "len", "(", "self", ".", "current_table", ".", "data", "[", "'independent_variables'", "]", ")", "nyax", "=", "len", "(", "self", ".", "current_table", ".", "data", "[", "'dependent_variables'", ...
Transform a square matrix into a format with two independent variables and one dependent variable.
[ "Transform", "a", "square", "matrix", "into", "a", "format", "with", "two", "independent", "variables", "and", "one", "dependent", "variable", "." ]
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/parsers/oldhepdata_parser.py#L408-L454
train
HEPData/hepdata-converter
hepdata_converter/parsers/oldhepdata_parser.py
OldHEPData._parse_qual
def _parse_qual(self, data): """Parse qual attribute of the old HEPData format example qual: *qual: RE : P P --> Z0 Z0 X :param data: data to be parsed :type data: str """ list = [] headers = data.split(':') name = headers[0].strip() nam...
python
def _parse_qual(self, data): """Parse qual attribute of the old HEPData format example qual: *qual: RE : P P --> Z0 Z0 X :param data: data to be parsed :type data: str """ list = [] headers = data.split(':') name = headers[0].strip() nam...
[ "def", "_parse_qual", "(", "self", ",", "data", ")", ":", "list", "=", "[", "]", "headers", "=", "data", ".", "split", "(", "':'", ")", "name", "=", "headers", "[", "0", "]", ".", "strip", "(", ")", "name", "=", "re", ".", "split", "(", "' IN '...
Parse qual attribute of the old HEPData format example qual: *qual: RE : P P --> Z0 Z0 X :param data: data to be parsed :type data: str
[ "Parse", "qual", "attribute", "of", "the", "old", "HEPData", "format" ]
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/parsers/oldhepdata_parser.py#L510-L550
train
HEPData/hepdata-converter
hepdata_converter/parsers/oldhepdata_parser.py
OldHEPData._parse_header
def _parse_header(self, data): """Parse header (xheader or yheader) :param data: data to be parsed :type data: str :return: list with header's data :rtype: list """ return_list = [] headers = data.split(':') for header in headers: he...
python
def _parse_header(self, data): """Parse header (xheader or yheader) :param data: data to be parsed :type data: str :return: list with header's data :rtype: list """ return_list = [] headers = data.split(':') for header in headers: he...
[ "def", "_parse_header", "(", "self", ",", "data", ")", ":", "return_list", "=", "[", "]", "headers", "=", "data", ".", "split", "(", "':'", ")", "for", "header", "in", "headers", ":", "header", "=", "re", ".", "split", "(", "' IN '", ",", "header", ...
Parse header (xheader or yheader) :param data: data to be parsed :type data: str :return: list with header's data :rtype: list
[ "Parse", "header", "(", "xheader", "or", "yheader", ")" ]
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/parsers/oldhepdata_parser.py#L552-L571
train
HEPData/hepdata-converter
hepdata_converter/parsers/oldhepdata_parser.py
OldHEPData._strip_comments
def _strip_comments(line): """Processes line stripping any comments from it :param line: line to be processed :type line: str :return: line with removed comments :rtype: str """ if line == '': return line r = re.search('(?P<line>[^#]*)(#(?P<co...
python
def _strip_comments(line): """Processes line stripping any comments from it :param line: line to be processed :type line: str :return: line with removed comments :rtype: str """ if line == '': return line r = re.search('(?P<line>[^#]*)(#(?P<co...
[ "def", "_strip_comments", "(", "line", ")", ":", "if", "line", "==", "''", ":", "return", "line", "r", "=", "re", ".", "search", "(", "'(?P<line>[^#]*)(#(?P<comment>.*))?'", ",", "line", ")", "if", "r", ":", "line", "=", "r", ".", "group", "(", "'line'...
Processes line stripping any comments from it :param line: line to be processed :type line: str :return: line with removed comments :rtype: str
[ "Processes", "line", "stripping", "any", "comments", "from", "it" ]
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/parsers/oldhepdata_parser.py#L590-L606
train
HEPData/hepdata-converter
hepdata_converter/parsers/oldhepdata_parser.py
OldHEPData._read_multiline
def _read_multiline(self, init_data): """Reads multiline symbols (ususally comments) :param init_data: initial data (parsed from the line containing keyword) :return: parsed value of the multiline symbol :rtype: str """ result = init_data first = True wh...
python
def _read_multiline(self, init_data): """Reads multiline symbols (ususally comments) :param init_data: initial data (parsed from the line containing keyword) :return: parsed value of the multiline symbol :rtype: str """ result = init_data first = True wh...
[ "def", "_read_multiline", "(", "self", ",", "init_data", ")", ":", "result", "=", "init_data", "first", "=", "True", "while", "True", ":", "last_index", "=", "self", ".", "current_file", ".", "tell", "(", ")", "line_raw", "=", "self", ".", "current_file", ...
Reads multiline symbols (ususally comments) :param init_data: initial data (parsed from the line containing keyword) :return: parsed value of the multiline symbol :rtype: str
[ "Reads", "multiline", "symbols", "(", "ususally", "comments", ")" ]
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/parsers/oldhepdata_parser.py#L608-L648
train
HEPData/hepdata-converter
hepdata_converter/parsers/oldhepdata_parser.py
OldHEPData._bind_set_table_metadata
def _bind_set_table_metadata(self, key, multiline=False): """Returns parsing function which will parse data as text, and add it to the table metatadata dictionary with the provided key :param key: dictionary key under which parsed data will be added to table.metadata :type key: str ...
python
def _bind_set_table_metadata(self, key, multiline=False): """Returns parsing function which will parse data as text, and add it to the table metatadata dictionary with the provided key :param key: dictionary key under which parsed data will be added to table.metadata :type key: str ...
[ "def", "_bind_set_table_metadata", "(", "self", ",", "key", ",", "multiline", "=", "False", ")", ":", "def", "set_table_metadata", "(", "self", ",", "data", ")", ":", "if", "multiline", ":", "data", "=", "self", ".", "_read_multiline", "(", "data", ")", ...
Returns parsing function which will parse data as text, and add it to the table metatadata dictionary with the provided key :param key: dictionary key under which parsed data will be added to table.metadata :type key: str :param multiline: if True this attribute will be treated as multi...
[ "Returns", "parsing", "function", "which", "will", "parse", "data", "as", "text", "and", "add", "it", "to", "the", "table", "metatadata", "dictionary", "with", "the", "provided", "key" ]
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/parsers/oldhepdata_parser.py#L653-L672
train
HEPData/hepdata-converter
hepdata_converter/parsers/oldhepdata_parser.py
OldHEPData._bind_parse_additional_data
def _bind_parse_additional_data(self, key, multiline=False): """Returns parsing function which will parse data as text, and add it to the table additional data dictionary with the provided key :param key: dictionary key under which parsed data will be added to table.metadata :type key: ...
python
def _bind_parse_additional_data(self, key, multiline=False): """Returns parsing function which will parse data as text, and add it to the table additional data dictionary with the provided key :param key: dictionary key under which parsed data will be added to table.metadata :type key: ...
[ "def", "_bind_parse_additional_data", "(", "self", ",", "key", ",", "multiline", "=", "False", ")", ":", "def", "_set_additional_data_bound", "(", "self", ",", "data", ")", ":", "\"\"\"Concrete method for setting additional data\n :param self:\n :type se...
Returns parsing function which will parse data as text, and add it to the table additional data dictionary with the provided key :param key: dictionary key under which parsed data will be added to table.metadata :type key: str :param multiline: if True this attribute will be treated as ...
[ "Returns", "parsing", "function", "which", "will", "parse", "data", "as", "text", "and", "add", "it", "to", "the", "table", "additional", "data", "dictionary", "with", "the", "provided", "key" ]
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/parsers/oldhepdata_parser.py#L689-L715
train
HEPData/hepdata-converter
hepdata_converter/writers/utils.py
error_value_processor
def error_value_processor(value, error): """ If an error is a percentage, we convert to a float, then calculate the percentage of the supplied value. :param value: base value, e.g. 10 :param error: e.g. 20.0% :return: the absolute error, e.g. 12 for the above case. """ if isinstance(err...
python
def error_value_processor(value, error): """ If an error is a percentage, we convert to a float, then calculate the percentage of the supplied value. :param value: base value, e.g. 10 :param error: e.g. 20.0% :return: the absolute error, e.g. 12 for the above case. """ if isinstance(err...
[ "def", "error_value_processor", "(", "value", ",", "error", ")", ":", "if", "isinstance", "(", "error", ",", "(", "str", ",", "unicode", ")", ")", ":", "try", ":", "if", "\"%\"", "in", "error", ":", "error_float", "=", "float", "(", "error", ".", "re...
If an error is a percentage, we convert to a float, then calculate the percentage of the supplied value. :param value: base value, e.g. 10 :param error: e.g. 20.0% :return: the absolute error, e.g. 12 for the above case.
[ "If", "an", "error", "is", "a", "percentage", "we", "convert", "to", "a", "float", "then", "calculate", "the", "percentage", "of", "the", "supplied", "value", "." ]
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/writers/utils.py#L2-L24
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
get_file_details
def get_file_details(filepath, hash_algorithms=['sha256']): """ <Purpose> To get file's length and hash information. The hash is computed using the sha256 algorithm. This function is used in the signerlib.py and updater.py modules. <Arguments> filepath: Absolute file path of a file. ...
python
def get_file_details(filepath, hash_algorithms=['sha256']): """ <Purpose> To get file's length and hash information. The hash is computed using the sha256 algorithm. This function is used in the signerlib.py and updater.py modules. <Arguments> filepath: Absolute file path of a file. ...
[ "def", "get_file_details", "(", "filepath", ",", "hash_algorithms", "=", "[", "'sha256'", "]", ")", ":", "# Making sure that the format of 'filepath' is a path string.", "# 'securesystemslib.exceptions.FormatError' is raised on incorrect format.", "securesystemslib", ".", "formats", ...
<Purpose> To get file's length and hash information. The hash is computed using the sha256 algorithm. This function is used in the signerlib.py and updater.py modules. <Arguments> filepath: Absolute file path of a file. hash_algorithms: <Exceptions> securesystemslib.exceptions.For...
[ "<Purpose", ">", "To", "get", "file", "s", "length", "and", "hash", "information", ".", "The", "hash", "is", "computed", "using", "the", "sha256", "algorithm", ".", "This", "function", "is", "used", "in", "the", "signerlib", ".", "py", "and", "updater", ...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L349-L399
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
ensure_parent_dir
def ensure_parent_dir(filename): """ <Purpose> To ensure existence of the parent directory of 'filename'. If the parent directory of 'name' does not exist, create it. Example: If 'filename' is '/a/b/c/d.txt', and only the directory '/a/b/' exists, then directory '/a/b/c/d/' will be created. <Ar...
python
def ensure_parent_dir(filename): """ <Purpose> To ensure existence of the parent directory of 'filename'. If the parent directory of 'name' does not exist, create it. Example: If 'filename' is '/a/b/c/d.txt', and only the directory '/a/b/' exists, then directory '/a/b/c/d/' will be created. <Ar...
[ "def", "ensure_parent_dir", "(", "filename", ")", ":", "# Ensure 'filename' corresponds to 'PATH_SCHEMA'.", "# Raise 'securesystemslib.exceptions.FormatError' on a mismatch.", "securesystemslib", ".", "formats", ".", "PATH_SCHEMA", ".", "check_match", "(", "filename", ")", "# Spl...
<Purpose> To ensure existence of the parent directory of 'filename'. If the parent directory of 'name' does not exist, create it. Example: If 'filename' is '/a/b/c/d.txt', and only the directory '/a/b/' exists, then directory '/a/b/c/d/' will be created. <Arguments> filename: A path strin...
[ "<Purpose", ">", "To", "ensure", "existence", "of", "the", "parent", "directory", "of", "filename", ".", "If", "the", "parent", "directory", "of", "name", "does", "not", "exist", "create", "it", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L402-L436
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
file_in_confined_directories
def file_in_confined_directories(filepath, confined_directories): """ <Purpose> Check if the directory containing 'filepath' is in the list/tuple of 'confined_directories'. <Arguments> filepath: A string representing the path of a file. The following example path strings are viewed as fi...
python
def file_in_confined_directories(filepath, confined_directories): """ <Purpose> Check if the directory containing 'filepath' is in the list/tuple of 'confined_directories'. <Arguments> filepath: A string representing the path of a file. The following example path strings are viewed as fi...
[ "def", "file_in_confined_directories", "(", "filepath", ",", "confined_directories", ")", ":", "# Do the arguments have the correct format?", "# Raise 'securesystemslib.exceptions.FormatError' if there is a mismatch.", "securesystemslib", ".", "formats", ".", "RELPATH_SCHEMA", ".", "...
<Purpose> Check if the directory containing 'filepath' is in the list/tuple of 'confined_directories'. <Arguments> filepath: A string representing the path of a file. The following example path strings are viewed as files and not directories: 'a/b/c', 'a/b/c.txt'. confined_directories: ...
[ "<Purpose", ">", "Check", "if", "the", "directory", "containing", "filepath", "is", "in", "the", "list", "/", "tuple", "of", "confined_directories", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L439-L485
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
find_delegated_role
def find_delegated_role(roles, delegated_role): """ <Purpose> Find the index, if any, of a role with a given name in a list of roles. <Arguments> roles: The list of roles, each of which must have a 'name' attribute. delegated_role: The name of the role to be found in the list of roles. ...
python
def find_delegated_role(roles, delegated_role): """ <Purpose> Find the index, if any, of a role with a given name in a list of roles. <Arguments> roles: The list of roles, each of which must have a 'name' attribute. delegated_role: The name of the role to be found in the list of roles. ...
[ "def", "find_delegated_role", "(", "roles", ",", "delegated_role", ")", ":", "# Do the arguments have the correct format?", "# Ensure the arguments have the appropriate number of objects and object", "# types, and that all dict keys are properly named. Raise", "# 'securesystemslib.exceptions....
<Purpose> Find the index, if any, of a role with a given name in a list of roles. <Arguments> roles: The list of roles, each of which must have a 'name' attribute. delegated_role: The name of the role to be found in the list of roles. <Exceptions> securesystemslib.exceptions.Repositor...
[ "<Purpose", ">", "Find", "the", "index", "if", "any", "of", "a", "role", "with", "a", "given", "name", "in", "a", "list", "of", "roles", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L488-L549
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
ensure_all_targets_allowed
def ensure_all_targets_allowed(rolename, list_of_targets, parent_delegations): """ <Purpose> Ensure that the list of targets specified by 'rolename' are allowed; this is determined by inspecting the 'delegations' field of the parent role of 'rolename'. If a target specified by 'rolename' is not found i...
python
def ensure_all_targets_allowed(rolename, list_of_targets, parent_delegations): """ <Purpose> Ensure that the list of targets specified by 'rolename' are allowed; this is determined by inspecting the 'delegations' field of the parent role of 'rolename'. If a target specified by 'rolename' is not found i...
[ "def", "ensure_all_targets_allowed", "(", "rolename", ",", "list_of_targets", ",", "parent_delegations", ")", ":", "# Do the arguments have the correct format?", "# Ensure the arguments have the appropriate number of objects and object", "# types, and that all dict keys are properly named. ...
<Purpose> Ensure that the list of targets specified by 'rolename' are allowed; this is determined by inspecting the 'delegations' field of the parent role of 'rolename'. If a target specified by 'rolename' is not found in the delegations field of 'metadata_object_of_parent', raise an exception. The ...
[ "<Purpose", ">", "Ensure", "that", "the", "list", "of", "targets", "specified", "by", "rolename", "are", "allowed", ";", "this", "is", "determined", "by", "inspecting", "the", "delegations", "field", "of", "the", "parent", "role", "of", "rolename", ".", "If"...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L552-L684
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
paths_are_consistent_with_hash_prefixes
def paths_are_consistent_with_hash_prefixes(paths, path_hash_prefixes): """ <Purpose> Determine whether a list of paths are consistent with their alleged path hash prefixes. By default, the SHA256 hash function is used. <Arguments> paths: A list of paths for which their hashes will be checked. ...
python
def paths_are_consistent_with_hash_prefixes(paths, path_hash_prefixes): """ <Purpose> Determine whether a list of paths are consistent with their alleged path hash prefixes. By default, the SHA256 hash function is used. <Arguments> paths: A list of paths for which their hashes will be checked. ...
[ "def", "paths_are_consistent_with_hash_prefixes", "(", "paths", ",", "path_hash_prefixes", ")", ":", "# Do the arguments have the correct format?", "# Ensure the arguments have the appropriate number of objects and object", "# types, and that all dict keys are properly named. Raise", "# 'secu...
<Purpose> Determine whether a list of paths are consistent with their alleged path hash prefixes. By default, the SHA256 hash function is used. <Arguments> paths: A list of paths for which their hashes will be checked. path_hash_prefixes: The list of path hash prefixes with which to chec...
[ "<Purpose", ">", "Determine", "whether", "a", "list", "of", "paths", "are", "consistent", "with", "their", "alleged", "path", "hash", "prefixes", ".", "By", "default", "the", "SHA256", "hash", "function", "is", "used", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L687-L740
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
get_target_hash
def get_target_hash(target_filepath): """ <Purpose> Compute the hash of 'target_filepath'. This is useful in conjunction with the "path_hash_prefixes" attribute in a delegated targets role, which tells us which paths it is implicitly responsible for. The repository may optionally organize targets i...
python
def get_target_hash(target_filepath): """ <Purpose> Compute the hash of 'target_filepath'. This is useful in conjunction with the "path_hash_prefixes" attribute in a delegated targets role, which tells us which paths it is implicitly responsible for. The repository may optionally organize targets i...
[ "def", "get_target_hash", "(", "target_filepath", ")", ":", "# Does 'target_filepath' have the correct format?", "# Ensure the arguments have the appropriate number of objects and object", "# types, and that all dict keys are properly named.", "# Raise 'securesystemslib.exceptions.FormatError' if ...
<Purpose> Compute the hash of 'target_filepath'. This is useful in conjunction with the "path_hash_prefixes" attribute in a delegated targets role, which tells us which paths it is implicitly responsible for. The repository may optionally organize targets into hashed bins to ease target delegations...
[ "<Purpose", ">", "Compute", "the", "hash", "of", "target_filepath", ".", "This", "is", "useful", "in", "conjunction", "with", "the", "path_hash_prefixes", "attribute", "in", "a", "delegated", "targets", "role", "which", "tells", "us", "which", "paths", "it", "...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L743-L783
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
import_json
def import_json(): """ <Purpose> Tries to import json module. We used to fall back to the simplejson module, but we have dropped support for that module. We are keeping this interface intact for backwards compatibility. <Arguments> None. <Exceptions> ImportError: on failure to import the j...
python
def import_json(): """ <Purpose> Tries to import json module. We used to fall back to the simplejson module, but we have dropped support for that module. We are keeping this interface intact for backwards compatibility. <Arguments> None. <Exceptions> ImportError: on failure to import the j...
[ "def", "import_json", "(", ")", ":", "global", "_json_module", "if", "_json_module", "is", "not", "None", ":", "return", "_json_module", "else", ":", "try", ":", "module", "=", "__import__", "(", "'json'", ")", "# The 'json' module is available in Python > 2.6, and ...
<Purpose> Tries to import json module. We used to fall back to the simplejson module, but we have dropped support for that module. We are keeping this interface intact for backwards compatibility. <Arguments> None. <Exceptions> ImportError: on failure to import the json module. <Side Effect...
[ "<Purpose", ">", "Tries", "to", "import", "json", "module", ".", "We", "used", "to", "fall", "back", "to", "the", "simplejson", "module", "but", "we", "have", "dropped", "support", "for", "that", "module", ".", "We", "are", "keeping", "this", "interface", ...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L788-L824
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
load_json_string
def load_json_string(data): """ <Purpose> Deserialize 'data' (JSON string) to a Python object. <Arguments> data: A JSON string. <Exceptions> securesystemslib.exceptions.Error, if 'data' cannot be deserialized to a Python object. <Side Effects> None. <Returns> Deserialized o...
python
def load_json_string(data): """ <Purpose> Deserialize 'data' (JSON string) to a Python object. <Arguments> data: A JSON string. <Exceptions> securesystemslib.exceptions.Error, if 'data' cannot be deserialized to a Python object. <Side Effects> None. <Returns> Deserialized o...
[ "def", "load_json_string", "(", "data", ")", ":", "deserialized_object", "=", "None", "try", ":", "deserialized_object", "=", "json", ".", "loads", "(", "data", ")", "except", "TypeError", ":", "message", "=", "'Invalid JSON string: '", "+", "repr", "(", "data...
<Purpose> Deserialize 'data' (JSON string) to a Python object. <Arguments> data: A JSON string. <Exceptions> securesystemslib.exceptions.Error, if 'data' cannot be deserialized to a Python object. <Side Effects> None. <Returns> Deserialized object. For example, a dictionary.
[ "<Purpose", ">", "Deserialize", "data", "(", "JSON", "string", ")", "to", "a", "Python", "object", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L829-L863
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
load_json_file
def load_json_file(filepath): """ <Purpose> Deserialize a JSON object from a file containing the object. <Arguments> filepath: Absolute path of JSON file. <Exceptions> securesystemslib.exceptions.FormatError: If 'filepath' is improperly formatted. securesystemslib.exceptions.Error: ...
python
def load_json_file(filepath): """ <Purpose> Deserialize a JSON object from a file containing the object. <Arguments> filepath: Absolute path of JSON file. <Exceptions> securesystemslib.exceptions.FormatError: If 'filepath' is improperly formatted. securesystemslib.exceptions.Error: ...
[ "def", "load_json_file", "(", "filepath", ")", ":", "# Making sure that the format of 'filepath' is a path string.", "# securesystemslib.exceptions.FormatError is raised on incorrect format.", "securesystemslib", ".", "formats", ".", "PATH_SCHEMA", ".", "check_match", "(", "filepath"...
<Purpose> Deserialize a JSON object from a file containing the object. <Arguments> filepath: Absolute path of JSON file. <Exceptions> securesystemslib.exceptions.FormatError: If 'filepath' is improperly formatted. securesystemslib.exceptions.Error: If 'filepath' cannot be deserialized t...
[ "<Purpose", ">", "Deserialize", "a", "JSON", "object", "from", "a", "file", "containing", "the", "object", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L866-L918
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
digests_are_equal
def digests_are_equal(digest1, digest2): """ <Purpose> While protecting against timing attacks, compare the hexadecimal arguments and determine if they are equal. <Arguments> digest1: The first hexadecimal string value to compare. digest2: The second hexadecimal string value to compa...
python
def digests_are_equal(digest1, digest2): """ <Purpose> While protecting against timing attacks, compare the hexadecimal arguments and determine if they are equal. <Arguments> digest1: The first hexadecimal string value to compare. digest2: The second hexadecimal string value to compa...
[ "def", "digests_are_equal", "(", "digest1", ",", "digest2", ")", ":", "# Ensure the arguments have the appropriate number of objects and object", "# types, and that all dict keys are properly named.", "# Raise 'securesystemslib.exceptions.FormatError' if there is a mismatch.", "securesystemsli...
<Purpose> While protecting against timing attacks, compare the hexadecimal arguments and determine if they are equal. <Arguments> digest1: The first hexadecimal string value to compare. digest2: The second hexadecimal string value to compare. <Exceptions> securesystemslib.exceptio...
[ "<Purpose", ">", "While", "protecting", "against", "timing", "attacks", "compare", "the", "hexadecimal", "arguments", "and", "determine", "if", "they", "are", "equal", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L921-L960
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
TempFile._default_temporary_directory
def _default_temporary_directory(self, prefix): """__init__ helper.""" try: self.temporary_file = tempfile.NamedTemporaryFile(prefix=prefix) except OSError as err: # pragma: no cover logger.critical('Cannot create a system temporary directory: '+repr(err)) raise securesystemslib.exception...
python
def _default_temporary_directory(self, prefix): """__init__ helper.""" try: self.temporary_file = tempfile.NamedTemporaryFile(prefix=prefix) except OSError as err: # pragma: no cover logger.critical('Cannot create a system temporary directory: '+repr(err)) raise securesystemslib.exception...
[ "def", "_default_temporary_directory", "(", "self", ",", "prefix", ")", ":", "try", ":", "self", ".", "temporary_file", "=", "tempfile", ".", "NamedTemporaryFile", "(", "prefix", "=", "prefix", ")", "except", "OSError", "as", "err", ":", "# pragma: no cover", ...
__init__ helper.
[ "__init__", "helper", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L64-L71
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
TempFile.read
def read(self, size=None): """ <Purpose> Read specified number of bytes. If size is not specified then the whole file is read and the file pointer is placed at the beginning of the file. <Arguments> size: Number of bytes to be read. <Exceptions> securesystemslib.except...
python
def read(self, size=None): """ <Purpose> Read specified number of bytes. If size is not specified then the whole file is read and the file pointer is placed at the beginning of the file. <Arguments> size: Number of bytes to be read. <Exceptions> securesystemslib.except...
[ "def", "read", "(", "self", ",", "size", "=", "None", ")", ":", "if", "size", "is", "None", ":", "self", ".", "temporary_file", ".", "seek", "(", "0", ")", "data", "=", "self", ".", "temporary_file", ".", "read", "(", ")", "self", ".", "temporary_f...
<Purpose> Read specified number of bytes. If size is not specified then the whole file is read and the file pointer is placed at the beginning of the file. <Arguments> size: Number of bytes to be read. <Exceptions> securesystemslib.exceptions.FormatError: if 'size' is invalid....
[ "<Purpose", ">", "Read", "specified", "number", "of", "bytes", ".", "If", "size", "is", "not", "specified", "then", "the", "whole", "file", "is", "read", "and", "the", "file", "pointer", "is", "placed", "at", "the", "beginning", "of", "the", "file", "." ...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L147-L175
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
TempFile.write
def write(self, data, auto_flush=True): """ <Purpose> Writes a data string to the file. <Arguments> data: A string containing some data. auto_flush: Boolean argument, if set to 'True', all data will be flushed from internal buffer. <Exceptions> None. ...
python
def write(self, data, auto_flush=True): """ <Purpose> Writes a data string to the file. <Arguments> data: A string containing some data. auto_flush: Boolean argument, if set to 'True', all data will be flushed from internal buffer. <Exceptions> None. ...
[ "def", "write", "(", "self", ",", "data", ",", "auto_flush", "=", "True", ")", ":", "self", ".", "temporary_file", ".", "write", "(", "data", ")", "if", "auto_flush", ":", "self", ".", "flush", "(", ")" ]
<Purpose> Writes a data string to the file. <Arguments> data: A string containing some data. auto_flush: Boolean argument, if set to 'True', all data will be flushed from internal buffer. <Exceptions> None. <Return> None.
[ "<Purpose", ">", "Writes", "a", "data", "string", "to", "the", "file", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L178-L200
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
TempFile.move
def move(self, destination_path): """ <Purpose> Copies 'self.temporary_file' to a non-temp file at 'destination_path' and closes 'self.temporary_file' so that it is removed. <Arguments> destination_path: Path to store the file in. <Exceptions> None. <Return> ...
python
def move(self, destination_path): """ <Purpose> Copies 'self.temporary_file' to a non-temp file at 'destination_path' and closes 'self.temporary_file' so that it is removed. <Arguments> destination_path: Path to store the file in. <Exceptions> None. <Return> ...
[ "def", "move", "(", "self", ",", "destination_path", ")", ":", "self", ".", "flush", "(", ")", "self", ".", "seek", "(", "0", ")", "destination_file", "=", "open", "(", "destination_path", ",", "'wb'", ")", "shutil", ".", "copyfileobj", "(", "self", "....
<Purpose> Copies 'self.temporary_file' to a non-temp file at 'destination_path' and closes 'self.temporary_file' so that it is removed. <Arguments> destination_path: Path to store the file in. <Exceptions> None. <Return> None.
[ "<Purpose", ">", "Copies", "self", ".", "temporary_file", "to", "a", "non", "-", "temp", "file", "at", "destination_path", "and", "closes", "self", ".", "temporary_file", "so", "that", "it", "is", "removed", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L203-L231
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
TempFile.decompress_temp_file_object
def decompress_temp_file_object(self, compression): """ <Purpose> To decompress a compressed temp file object. Decompression is performed on a temp file object that is compressed, this occurs after downloading a compressed file. For instance if a compressed version of some meta file in...
python
def decompress_temp_file_object(self, compression): """ <Purpose> To decompress a compressed temp file object. Decompression is performed on a temp file object that is compressed, this occurs after downloading a compressed file. For instance if a compressed version of some meta file in...
[ "def", "decompress_temp_file_object", "(", "self", ",", "compression", ")", ":", "# Does 'compression' have the correct format?", "# Raise 'securesystemslib.exceptions.FormatError' if there is a mismatch.", "securesystemslib", ".", "formats", ".", "NAME_SCHEMA", ".", "check_match", ...
<Purpose> To decompress a compressed temp file object. Decompression is performed on a temp file object that is compressed, this occurs after downloading a compressed file. For instance if a compressed version of some meta file in the repository is downloaded, the temp file containing the ...
[ "<Purpose", ">", "To", "decompress", "a", "compressed", "temp", "file", "object", ".", "Decompression", "is", "performed", "on", "a", "temp", "file", "object", "that", "is", "compressed", "this", "occurs", "after", "downloading", "a", "compressed", "file", "."...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L256-L317
train
secure-systems-lab/securesystemslib
securesystemslib/util.py
TempFile.close_temp_file
def close_temp_file(self): """ <Purpose> Closes the temporary file object. 'close_temp_file' mimics usual file.close(), however temporary file destroys itself when 'close_temp_file' is called. Further if compression is set, second temporary file instance 'self._orig_file' is also closed ...
python
def close_temp_file(self): """ <Purpose> Closes the temporary file object. 'close_temp_file' mimics usual file.close(), however temporary file destroys itself when 'close_temp_file' is called. Further if compression is set, second temporary file instance 'self._orig_file' is also closed ...
[ "def", "close_temp_file", "(", "self", ")", ":", "self", ".", "temporary_file", ".", "close", "(", ")", "# If compression has been set, we need to explicitly close the original", "# file object.", "if", "self", ".", "_orig_file", "is", "not", "None", ":", "self", ".",...
<Purpose> Closes the temporary file object. 'close_temp_file' mimics usual file.close(), however temporary file destroys itself when 'close_temp_file' is called. Further if compression is set, second temporary file instance 'self._orig_file' is also closed so that no open temporary files a...
[ "<Purpose", ">", "Closes", "the", "temporary", "file", "object", ".", "close_temp_file", "mimics", "usual", "file", ".", "close", "()", "however", "temporary", "file", "destroys", "itself", "when", "close_temp_file", "is", "called", ".", "Further", "if", "compre...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/util.py#L320-L346
train
secure-systems-lab/securesystemslib
securesystemslib/schema.py
Schema.matches
def matches(self, object): """ <Purpose> Return True if 'object' matches this schema, False if it doesn't. If the caller wishes to signal an error on a failed match, check_match() should be called, which will raise a 'exceptions.FormatError' exception. """ try: self.check_match(...
python
def matches(self, object): """ <Purpose> Return True if 'object' matches this schema, False if it doesn't. If the caller wishes to signal an error on a failed match, check_match() should be called, which will raise a 'exceptions.FormatError' exception. """ try: self.check_match(...
[ "def", "matches", "(", "self", ",", "object", ")", ":", "try", ":", "self", ".", "check_match", "(", "object", ")", "except", "securesystemslib", ".", "exceptions", ".", "FormatError", ":", "return", "False", "else", ":", "return", "True" ]
<Purpose> Return True if 'object' matches this schema, False if it doesn't. If the caller wishes to signal an error on a failed match, check_match() should be called, which will raise a 'exceptions.FormatError' exception.
[ "<Purpose", ">", "Return", "True", "if", "object", "matches", "this", "schema", "False", "if", "it", "doesn", "t", ".", "If", "the", "caller", "wishes", "to", "signal", "an", "error", "on", "a", "failed", "match", "check_match", "()", "should", "be", "ca...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/schema.py#L70-L83
train
vektorlab/slacksocket
slacksocket/client.py
SlackSocket.get_event
def get_event(self, *etypes, timeout=None): """ Return a single event object or block until an event is received and return it. - etypes(str): If defined, Slack event type(s) not matching the filter will be ignored. See https://api.slack.com/events for a listing of...
python
def get_event(self, *etypes, timeout=None): """ Return a single event object or block until an event is received and return it. - etypes(str): If defined, Slack event type(s) not matching the filter will be ignored. See https://api.slack.com/events for a listing of...
[ "def", "get_event", "(", "self", ",", "*", "etypes", ",", "timeout", "=", "None", ")", ":", "self", ".", "_validate_etypes", "(", "*", "etypes", ")", "start", "=", "time", ".", "time", "(", ")", "e", "=", "self", ".", "_eventq", ".", "get", "(", ...
Return a single event object or block until an event is received and return it. - etypes(str): If defined, Slack event type(s) not matching the filter will be ignored. See https://api.slack.com/events for a listing of valid event types. - timeout(int): Max time, in second...
[ "Return", "a", "single", "event", "object", "or", "block", "until", "an", "event", "is", "received", "and", "return", "it", ".", "-", "etypes", "(", "str", ")", ":", "If", "defined", "Slack", "event", "type", "(", "s", ")", "not", "matching", "the", ...
8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f
https://github.com/vektorlab/slacksocket/blob/8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f/slacksocket/client.py#L85-L109
train
vektorlab/slacksocket
slacksocket/client.py
SlackSocket.events
def events(self, *etypes, idle_timeout=None): """ returns a blocking generator yielding Slack event objects params: - etypes(str): If defined, Slack event type(s) not matching the filter will be ignored. See https://api.slack.com/events for a listing of valid event...
python
def events(self, *etypes, idle_timeout=None): """ returns a blocking generator yielding Slack event objects params: - etypes(str): If defined, Slack event type(s) not matching the filter will be ignored. See https://api.slack.com/events for a listing of valid event...
[ "def", "events", "(", "self", ",", "*", "etypes", ",", "idle_timeout", "=", "None", ")", ":", "while", "self", ".", "_state", "!=", "STATE_STOPPED", ":", "try", ":", "yield", "self", ".", "get_event", "(", "*", "etypes", ",", "timeout", "=", "idle_time...
returns a blocking generator yielding Slack event objects params: - etypes(str): If defined, Slack event type(s) not matching the filter will be ignored. See https://api.slack.com/events for a listing of valid event types. - idle_timeout(int): optional maximum amount of t...
[ "returns", "a", "blocking", "generator", "yielding", "Slack", "event", "objects", "params", ":", "-", "etypes", "(", "str", ")", ":", "If", "defined", "Slack", "event", "type", "(", "s", ")", "not", "matching", "the", "filter", "will", "be", "ignored", "...
8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f
https://github.com/vektorlab/slacksocket/blob/8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f/slacksocket/client.py#L111-L127
train
vektorlab/slacksocket
slacksocket/client.py
SlackSocket.send_msg
def send_msg(self, text, channel, confirm=True): """ Send a message to a channel or group via Slack RTM socket, returning the resulting message object params: - text(str): Message text to send - channel(Channel): Target channel - confirm(bool): If True, wait f...
python
def send_msg(self, text, channel, confirm=True): """ Send a message to a channel or group via Slack RTM socket, returning the resulting message object params: - text(str): Message text to send - channel(Channel): Target channel - confirm(bool): If True, wait f...
[ "def", "send_msg", "(", "self", ",", "text", ",", "channel", ",", "confirm", "=", "True", ")", ":", "self", ".", "_send_id", "+=", "1", "msg", "=", "SlackMsg", "(", "self", ".", "_send_id", ",", "channel", ".", "id", ",", "text", ")", "self", ".", ...
Send a message to a channel or group via Slack RTM socket, returning the resulting message object params: - text(str): Message text to send - channel(Channel): Target channel - confirm(bool): If True, wait for a reply-to confirmation before returning.
[ "Send", "a", "message", "to", "a", "channel", "or", "group", "via", "Slack", "RTM", "socket", "returning", "the", "resulting", "message", "object" ]
8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f
https://github.com/vektorlab/slacksocket/blob/8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f/slacksocket/client.py#L129-L153
train
vektorlab/slacksocket
slacksocket/client.py
SlackSocket._process_event
def _process_event(self, event): """ Extend event object with User and Channel objects """ if event.get('user'): event.user = self.lookup_user(event.get('user')) if event.get('channel'): event.channel = self.lookup_channel(event.get('channel')) if self.user.id i...
python
def _process_event(self, event): """ Extend event object with User and Channel objects """ if event.get('user'): event.user = self.lookup_user(event.get('user')) if event.get('channel'): event.channel = self.lookup_channel(event.get('channel')) if self.user.id i...
[ "def", "_process_event", "(", "self", ",", "event", ")", ":", "if", "event", ".", "get", "(", "'user'", ")", ":", "event", ".", "user", "=", "self", ".", "lookup_user", "(", "event", ".", "get", "(", "'user'", ")", ")", "if", "event", ".", "get", ...
Extend event object with User and Channel objects
[ "Extend", "event", "object", "with", "User", "and", "Channel", "objects" ]
8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f
https://github.com/vektorlab/slacksocket/blob/8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f/slacksocket/client.py#L179-L192
train
HEPData/hepdata-converter
hepdata_converter/__init__.py
convert
def convert(input, output=None, options={}): """Converts a supported ``input_format`` (*oldhepdata*, *yaml*) to a supported ``output_format`` (*csv*, *root*, *yaml*, *yoda*). :param input: location of input file for *oldhepdata* format or input directory for *yaml* format :param output: location of out...
python
def convert(input, output=None, options={}): """Converts a supported ``input_format`` (*oldhepdata*, *yaml*) to a supported ``output_format`` (*csv*, *root*, *yaml*, *yoda*). :param input: location of input file for *oldhepdata* format or input directory for *yaml* format :param output: location of out...
[ "def", "convert", "(", "input", ",", "output", "=", "None", ",", "options", "=", "{", "}", ")", ":", "if", "'input_format'", "not", "in", "options", "and", "'output_format'", "not", "in", "options", ":", "raise", "ValueError", "(", "\"no input_format and out...
Converts a supported ``input_format`` (*oldhepdata*, *yaml*) to a supported ``output_format`` (*csv*, *root*, *yaml*, *yoda*). :param input: location of input file for *oldhepdata* format or input directory for *yaml* format :param output: location of output directory to which converted files will be writt...
[ "Converts", "a", "supported", "input_format", "(", "*", "oldhepdata", "*", "*", "yaml", "*", ")", "to", "a", "supported", "output_format", "(", "*", "csv", "*", "*", "root", "*", "*", "yaml", "*", "*", "yoda", "*", ")", "." ]
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/__init__.py#L9-L43
train
HEPData/hepdata-converter
hepdata_converter/writers/csv_writer.py
CSV._write_packed_data
def _write_packed_data(self, data_out, table): """This is kind of legacy function - this functionality may be useful for some people, so even though now the default of writing CSV is writing unpacked data (divided by independent variable) this method is still available and accessible if ```pack`...
python
def _write_packed_data(self, data_out, table): """This is kind of legacy function - this functionality may be useful for some people, so even though now the default of writing CSV is writing unpacked data (divided by independent variable) this method is still available and accessible if ```pack`...
[ "def", "_write_packed_data", "(", "self", ",", "data_out", ",", "table", ")", ":", "headers", "=", "[", "]", "data", "=", "[", "]", "qualifiers_marks", "=", "[", "]", "qualifiers", "=", "{", "}", "self", ".", "_extract_independent_variables", "(", "table",...
This is kind of legacy function - this functionality may be useful for some people, so even though now the default of writing CSV is writing unpacked data (divided by independent variable) this method is still available and accessible if ```pack``` flag is specified in Writer's options :param o...
[ "This", "is", "kind", "of", "legacy", "function", "-", "this", "functionality", "may", "be", "useful", "for", "some", "people", "so", "even", "though", "now", "the", "default", "of", "writing", "CSV", "is", "writing", "unpacked", "data", "(", "divided", "b...
354271448980efba86f2f3d27b99d818e75fd90d
https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/writers/csv_writer.py#L82-L102
train
secure-systems-lab/securesystemslib
securesystemslib/hash.py
digest
def digest(algorithm=DEFAULT_HASH_ALGORITHM, hash_library=DEFAULT_HASH_LIBRARY): """ <Purpose> Provide the caller with the ability to create digest objects without having to worry about crypto library availability or which library to use. The caller also has the option of specifying which hash algorith...
python
def digest(algorithm=DEFAULT_HASH_ALGORITHM, hash_library=DEFAULT_HASH_LIBRARY): """ <Purpose> Provide the caller with the ability to create digest objects without having to worry about crypto library availability or which library to use. The caller also has the option of specifying which hash algorith...
[ "def", "digest", "(", "algorithm", "=", "DEFAULT_HASH_ALGORITHM", ",", "hash_library", "=", "DEFAULT_HASH_LIBRARY", ")", ":", "# Are the arguments properly formatted? If not, raise", "# 'securesystemslib.exceptions.FormatError'.", "securesystemslib", ".", "formats", ".", "NAME_S...
<Purpose> Provide the caller with the ability to create digest objects without having to worry about crypto library availability or which library to use. The caller also has the option of specifying which hash algorithm and/or library to use. # Creation of a digest object using defaults or by spec...
[ "<Purpose", ">", "Provide", "the", "caller", "with", "the", "ability", "to", "create", "digest", "objects", "without", "having", "to", "worry", "about", "crypto", "library", "availability", "or", "which", "library", "to", "use", ".", "The", "caller", "also", ...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/hash.py#L50-L122
train
secure-systems-lab/securesystemslib
securesystemslib/hash.py
digest_fileobject
def digest_fileobject(file_object, algorithm=DEFAULT_HASH_ALGORITHM, hash_library=DEFAULT_HASH_LIBRARY, normalize_line_endings=False): """ <Purpose> Generate a digest object given a file object. The new digest object is updated with the contents of 'file_object' prior to returning the object to the...
python
def digest_fileobject(file_object, algorithm=DEFAULT_HASH_ALGORITHM, hash_library=DEFAULT_HASH_LIBRARY, normalize_line_endings=False): """ <Purpose> Generate a digest object given a file object. The new digest object is updated with the contents of 'file_object' prior to returning the object to the...
[ "def", "digest_fileobject", "(", "file_object", ",", "algorithm", "=", "DEFAULT_HASH_ALGORITHM", ",", "hash_library", "=", "DEFAULT_HASH_LIBRARY", ",", "normalize_line_endings", "=", "False", ")", ":", "# Are the arguments properly formatted? If not, raise", "# 'securesystemsl...
<Purpose> Generate a digest object given a file object. The new digest object is updated with the contents of 'file_object' prior to returning the object to the caller. <Arguments> file_object: File object whose contents will be used as the data to update the hash of a digest object to b...
[ "<Purpose", ">", "Generate", "a", "digest", "object", "given", "a", "file", "object", ".", "The", "new", "digest", "object", "is", "updated", "with", "the", "contents", "of", "file_object", "prior", "to", "returning", "the", "object", "to", "the", "caller", ...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/hash.py#L128-L217
train
secure-systems-lab/securesystemslib
securesystemslib/hash.py
digest_filename
def digest_filename(filename, algorithm=DEFAULT_HASH_ALGORITHM, hash_library=DEFAULT_HASH_LIBRARY, normalize_line_endings=False): """ <Purpose> Generate a digest object, update its hash using a file object specified by filename, and then return it to the caller. <Arguments> filename: The fi...
python
def digest_filename(filename, algorithm=DEFAULT_HASH_ALGORITHM, hash_library=DEFAULT_HASH_LIBRARY, normalize_line_endings=False): """ <Purpose> Generate a digest object, update its hash using a file object specified by filename, and then return it to the caller. <Arguments> filename: The fi...
[ "def", "digest_filename", "(", "filename", ",", "algorithm", "=", "DEFAULT_HASH_ALGORITHM", ",", "hash_library", "=", "DEFAULT_HASH_LIBRARY", ",", "normalize_line_endings", "=", "False", ")", ":", "# Are the arguments properly formatted? If not, raise", "# 'securesystemslib.ex...
<Purpose> Generate a digest object, update its hash using a file object specified by filename, and then return it to the caller. <Arguments> filename: The filename belonging to the file object to be used. algorithm: The hash algorithm (e.g., 'md5', 'sha1', 'sha256'). hash_library: ...
[ "<Purpose", ">", "Generate", "a", "digest", "object", "update", "its", "hash", "using", "a", "file", "object", "specified", "by", "filename", "and", "then", "return", "it", "to", "the", "caller", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/hash.py#L223-L276
train
boolangery/py-lua-parser
luaparser/ast.py
get_token_stream
def get_token_stream(source: str) -> CommonTokenStream: """ Get the antlr token stream. """ lexer = LuaLexer(InputStream(source)) stream = CommonTokenStream(lexer) return stream
python
def get_token_stream(source: str) -> CommonTokenStream: """ Get the antlr token stream. """ lexer = LuaLexer(InputStream(source)) stream = CommonTokenStream(lexer) return stream
[ "def", "get_token_stream", "(", "source", ":", "str", ")", "->", "CommonTokenStream", ":", "lexer", "=", "LuaLexer", "(", "InputStream", "(", "source", ")", ")", "stream", "=", "CommonTokenStream", "(", "lexer", ")", "return", "stream" ]
Get the antlr token stream.
[ "Get", "the", "antlr", "token", "stream", "." ]
578f2bf75f6f84c4b52c2affba56a4ec569d7ce7
https://github.com/boolangery/py-lua-parser/blob/578f2bf75f6f84c4b52c2affba56a4ec569d7ce7/luaparser/ast.py#L18-L23
train
PokeDevs/pokedex.py
pokedex/pokedex.py
Pokedex.get_evolution_stone
def get_evolution_stone(self, slug): """ Returns a Evolution Stone object containing the details about the evolution stone. """ endpoint = '/evolution-stone/' + slug return self.make_request(self.BASE_URL + endpoint)
python
def get_evolution_stone(self, slug): """ Returns a Evolution Stone object containing the details about the evolution stone. """ endpoint = '/evolution-stone/' + slug return self.make_request(self.BASE_URL + endpoint)
[ "def", "get_evolution_stone", "(", "self", ",", "slug", ")", ":", "endpoint", "=", "'/evolution-stone/'", "+", "slug", "return", "self", ".", "make_request", "(", "self", ".", "BASE_URL", "+", "endpoint", ")" ]
Returns a Evolution Stone object containing the details about the evolution stone.
[ "Returns", "a", "Evolution", "Stone", "object", "containing", "the", "details", "about", "the", "evolution", "stone", "." ]
dc1280f34176b0ecea633a87ab9e7eed02c1d32b
https://github.com/PokeDevs/pokedex.py/blob/dc1280f34176b0ecea633a87ab9e7eed02c1d32b/pokedex/pokedex.py#L66-L72
train
PokeDevs/pokedex.py
pokedex/pokedex.py
Pokedex.get_league
def get_league(self, slug): """ Returns a Pokemon League object containing the details about the league. """ endpoint = '/league/' + slug return self.make_request(self.BASE_URL + endpoint)
python
def get_league(self, slug): """ Returns a Pokemon League object containing the details about the league. """ endpoint = '/league/' + slug return self.make_request(self.BASE_URL + endpoint)
[ "def", "get_league", "(", "self", ",", "slug", ")", ":", "endpoint", "=", "'/league/'", "+", "slug", "return", "self", ".", "make_request", "(", "self", ".", "BASE_URL", "+", "endpoint", ")" ]
Returns a Pokemon League object containing the details about the league.
[ "Returns", "a", "Pokemon", "League", "object", "containing", "the", "details", "about", "the", "league", "." ]
dc1280f34176b0ecea633a87ab9e7eed02c1d32b
https://github.com/PokeDevs/pokedex.py/blob/dc1280f34176b0ecea633a87ab9e7eed02c1d32b/pokedex/pokedex.py#L82-L88
train
PokeDevs/pokedex.py
pokedex/pokedex.py
Pokedex.get_pokemon_by_name
def get_pokemon_by_name(self, name): """ Returns an array of Pokemon objects containing all the forms of the Pokemon specified the name of the Pokemon. """ endpoint = '/pokemon/' + str(name) return self.make_request(self.BASE_URL + endpoint)
python
def get_pokemon_by_name(self, name): """ Returns an array of Pokemon objects containing all the forms of the Pokemon specified the name of the Pokemon. """ endpoint = '/pokemon/' + str(name) return self.make_request(self.BASE_URL + endpoint)
[ "def", "get_pokemon_by_name", "(", "self", ",", "name", ")", ":", "endpoint", "=", "'/pokemon/'", "+", "str", "(", "name", ")", "return", "self", ".", "make_request", "(", "self", ".", "BASE_URL", "+", "endpoint", ")" ]
Returns an array of Pokemon objects containing all the forms of the Pokemon specified the name of the Pokemon.
[ "Returns", "an", "array", "of", "Pokemon", "objects", "containing", "all", "the", "forms", "of", "the", "Pokemon", "specified", "the", "name", "of", "the", "Pokemon", "." ]
dc1280f34176b0ecea633a87ab9e7eed02c1d32b
https://github.com/PokeDevs/pokedex.py/blob/dc1280f34176b0ecea633a87ab9e7eed02c1d32b/pokedex/pokedex.py#L91-L97
train
PokeDevs/pokedex.py
pokedex/pokedex.py
Pokedex.get_pokemon_by_number
def get_pokemon_by_number(self, number): """ Returns an array of Pokemon objects containing all the forms of the Pokemon specified the Pokedex number. """ endpoint = '/pokemon/' + str(number) return self.make_request(self.BASE_URL + endpoint)
python
def get_pokemon_by_number(self, number): """ Returns an array of Pokemon objects containing all the forms of the Pokemon specified the Pokedex number. """ endpoint = '/pokemon/' + str(number) return self.make_request(self.BASE_URL + endpoint)
[ "def", "get_pokemon_by_number", "(", "self", ",", "number", ")", ":", "endpoint", "=", "'/pokemon/'", "+", "str", "(", "number", ")", "return", "self", ".", "make_request", "(", "self", ".", "BASE_URL", "+", "endpoint", ")" ]
Returns an array of Pokemon objects containing all the forms of the Pokemon specified the Pokedex number.
[ "Returns", "an", "array", "of", "Pokemon", "objects", "containing", "all", "the", "forms", "of", "the", "Pokemon", "specified", "the", "Pokedex", "number", "." ]
dc1280f34176b0ecea633a87ab9e7eed02c1d32b
https://github.com/PokeDevs/pokedex.py/blob/dc1280f34176b0ecea633a87ab9e7eed02c1d32b/pokedex/pokedex.py#L99-L105
train
secure-systems-lab/securesystemslib
securesystemslib/pyca_crypto_keys.py
generate_rsa_public_and_private
def generate_rsa_public_and_private(bits=_DEFAULT_RSA_KEY_BITS): """ <Purpose> Generate public and private RSA keys with modulus length 'bits'. The public and private keys returned conform to 'securesystemslib.formats.PEMRSA_SCHEMA' and have the form: '-----BEGIN RSA PUBLIC KEY----- ...' or ...
python
def generate_rsa_public_and_private(bits=_DEFAULT_RSA_KEY_BITS): """ <Purpose> Generate public and private RSA keys with modulus length 'bits'. The public and private keys returned conform to 'securesystemslib.formats.PEMRSA_SCHEMA' and have the form: '-----BEGIN RSA PUBLIC KEY----- ...' or ...
[ "def", "generate_rsa_public_and_private", "(", "bits", "=", "_DEFAULT_RSA_KEY_BITS", ")", ":", "# Does 'bits' have the correct format?", "# This check will ensure 'bits' conforms to", "# 'securesystemslib.formats.RSAKEYBITS_SCHEMA'. 'bits' must be an integer", "# object, with a minimum value ...
<Purpose> Generate public and private RSA keys with modulus length 'bits'. The public and private keys returned conform to 'securesystemslib.formats.PEMRSA_SCHEMA' and have the form: '-----BEGIN RSA PUBLIC KEY----- ...' or '-----BEGIN RSA PRIVATE KEY----- ...' The public and private key...
[ "<Purpose", ">", "Generate", "public", "and", "private", "RSA", "keys", "with", "modulus", "length", "bits", ".", "The", "public", "and", "private", "keys", "returned", "conform", "to", "securesystemslib", ".", "formats", ".", "PEMRSA_SCHEMA", "and", "have", "...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/pyca_crypto_keys.py#L160-L229
train
secure-systems-lab/securesystemslib
securesystemslib/pyca_crypto_keys.py
create_rsa_signature
def create_rsa_signature(private_key, data, scheme='rsassa-pss-sha256'): """ <Purpose> Generate a 'scheme' signature. The signature, and the signature scheme used, is returned as a (signature, scheme) tuple. The signing process will use 'private_key' to generate the signature of 'data'. RFC34...
python
def create_rsa_signature(private_key, data, scheme='rsassa-pss-sha256'): """ <Purpose> Generate a 'scheme' signature. The signature, and the signature scheme used, is returned as a (signature, scheme) tuple. The signing process will use 'private_key' to generate the signature of 'data'. RFC34...
[ "def", "create_rsa_signature", "(", "private_key", ",", "data", ",", "scheme", "=", "'rsassa-pss-sha256'", ")", ":", "# Does the arguments have the correct format?", "# If not, raise 'securesystemslib.exceptions.FormatError' if any of the", "# checks fail.", "securesystemslib", ".", ...
<Purpose> Generate a 'scheme' signature. The signature, and the signature scheme used, is returned as a (signature, scheme) tuple. The signing process will use 'private_key' to generate the signature of 'data'. RFC3447 - RSASSA-PSS http://www.ietf.org/rfc/rfc3447.txt >>> public, private ...
[ "<Purpose", ">", "Generate", "a", "scheme", "signature", ".", "The", "signature", "and", "the", "signature", "scheme", "used", "is", "returned", "as", "a", "(", "signature", "scheme", ")", "tuple", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/pyca_crypto_keys.py#L235-L354
train
secure-systems-lab/securesystemslib
securesystemslib/pyca_crypto_keys.py
verify_rsa_signature
def verify_rsa_signature(signature, signature_scheme, public_key, data): """ <Purpose> Determine whether the corresponding private key of 'public_key' produced 'signature'. verify_signature() will use the public key, signature scheme, and 'data' to complete the verification. >>> public, private = ...
python
def verify_rsa_signature(signature, signature_scheme, public_key, data): """ <Purpose> Determine whether the corresponding private key of 'public_key' produced 'signature'. verify_signature() will use the public key, signature scheme, and 'data' to complete the verification. >>> public, private = ...
[ "def", "verify_rsa_signature", "(", "signature", ",", "signature_scheme", ",", "public_key", ",", "data", ")", ":", "# Does 'public_key' have the correct format?", "# This check will ensure 'public_key' conforms to", "# 'securesystemslib.formats.PEMRSA_SCHEMA'. Raise", "# 'securesyste...
<Purpose> Determine whether the corresponding private key of 'public_key' produced 'signature'. verify_signature() will use the public key, signature scheme, and 'data' to complete the verification. >>> public, private = generate_rsa_public_and_private(2048) >>> data = b'The quick brown fox jumps ...
[ "<Purpose", ">", "Determine", "whether", "the", "corresponding", "private", "key", "of", "public_key", "produced", "signature", ".", "verify_signature", "()", "will", "use", "the", "public", "key", "signature", "scheme", "and", "data", "to", "complete", "the", "...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/pyca_crypto_keys.py#L360-L452
train
secure-systems-lab/securesystemslib
securesystemslib/pyca_crypto_keys.py
create_rsa_encrypted_pem
def create_rsa_encrypted_pem(private_key, passphrase): """ <Purpose> Return a string in PEM format (TraditionalOpenSSL), where the private part of the RSA key is encrypted using the best available encryption for a given key's backend. This is a curated (by cryptography.io) encryption choice and the ...
python
def create_rsa_encrypted_pem(private_key, passphrase): """ <Purpose> Return a string in PEM format (TraditionalOpenSSL), where the private part of the RSA key is encrypted using the best available encryption for a given key's backend. This is a curated (by cryptography.io) encryption choice and the ...
[ "def", "create_rsa_encrypted_pem", "(", "private_key", ",", "passphrase", ")", ":", "# This check will ensure 'private_key' has the appropriate number", "# of objects and object types, and that all dict keys are properly named.", "# Raise 'securesystemslib.exceptions.FormatError' if the check fa...
<Purpose> Return a string in PEM format (TraditionalOpenSSL), where the private part of the RSA key is encrypted using the best available encryption for a given key's backend. This is a curated (by cryptography.io) encryption choice and the algorithm may change over time. c.f. cryptography.io/en/la...
[ "<Purpose", ">", "Return", "a", "string", "in", "PEM", "format", "(", "TraditionalOpenSSL", ")", "where", "the", "private", "part", "of", "the", "RSA", "key", "is", "encrypted", "using", "the", "best", "available", "encryption", "for", "a", "given", "key", ...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/pyca_crypto_keys.py#L455-L522
train
secure-systems-lab/securesystemslib
securesystemslib/pyca_crypto_keys.py
create_rsa_public_and_private_from_pem
def create_rsa_public_and_private_from_pem(pem, passphrase=None): """ <Purpose> Generate public and private RSA keys from an optionally encrypted PEM. The public and private keys returned conform to 'securesystemslib.formats.PEMRSA_SCHEMA' and have the form: '-----BEGIN RSA PUBLIC KEY----- ... ---...
python
def create_rsa_public_and_private_from_pem(pem, passphrase=None): """ <Purpose> Generate public and private RSA keys from an optionally encrypted PEM. The public and private keys returned conform to 'securesystemslib.formats.PEMRSA_SCHEMA' and have the form: '-----BEGIN RSA PUBLIC KEY----- ... ---...
[ "def", "create_rsa_public_and_private_from_pem", "(", "pem", ",", "passphrase", "=", "None", ")", ":", "# Does 'encryped_pem' have the correct format?", "# This check will ensure 'pem' has the appropriate number", "# of objects and object types, and that all dict keys are properly named.", ...
<Purpose> Generate public and private RSA keys from an optionally encrypted PEM. The public and private keys returned conform to 'securesystemslib.formats.PEMRSA_SCHEMA' and have the form: '-----BEGIN RSA PUBLIC KEY----- ... -----END RSA PUBLIC KEY-----' and '-----BEGIN RSA PRIVATE KEY----- ...
[ "<Purpose", ">", "Generate", "public", "and", "private", "RSA", "keys", "from", "an", "optionally", "encrypted", "PEM", ".", "The", "public", "and", "private", "keys", "returned", "conform", "to", "securesystemslib", ".", "formats", ".", "PEMRSA_SCHEMA", "and", ...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/pyca_crypto_keys.py#L528-L643
train
secure-systems-lab/securesystemslib
securesystemslib/pyca_crypto_keys.py
encrypt_key
def encrypt_key(key_object, password): """ <Purpose> Return a string containing 'key_object' in encrypted form. Encrypted strings may be safely saved to a file. The corresponding decrypt_key() function can be applied to the encrypted string to restore the original key object. 'key_object' is a TUF...
python
def encrypt_key(key_object, password): """ <Purpose> Return a string containing 'key_object' in encrypted form. Encrypted strings may be safely saved to a file. The corresponding decrypt_key() function can be applied to the encrypted string to restore the original key object. 'key_object' is a TUF...
[ "def", "encrypt_key", "(", "key_object", ",", "password", ")", ":", "# Do the arguments have the correct format?", "# Ensure the arguments have the appropriate number of objects and object", "# types, and that all dict keys are properly named.", "# Raise 'securesystemslib.exceptions.FormatErro...
<Purpose> Return a string containing 'key_object' in encrypted form. Encrypted strings may be safely saved to a file. The corresponding decrypt_key() function can be applied to the encrypted string to restore the original key object. 'key_object' is a TUF key (e.g., RSAKEY_SCHEMA, ED25519KEY_SCHEM...
[ "<Purpose", ">", "Return", "a", "string", "containing", "key_object", "in", "encrypted", "form", ".", "Encrypted", "strings", "may", "be", "safely", "saved", "to", "a", "file", ".", "The", "corresponding", "decrypt_key", "()", "function", "can", "be", "applied...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/pyca_crypto_keys.py#L649-L739
train
secure-systems-lab/securesystemslib
securesystemslib/pyca_crypto_keys.py
decrypt_key
def decrypt_key(encrypted_key, password): """ <Purpose> Return a string containing 'encrypted_key' in non-encrypted form. The decrypt_key() function can be applied to the encrypted string to restore the original key object, a TUF key (e.g., RSAKEY_SCHEMA, ED25519KEY_SCHEMA). This function calls the ...
python
def decrypt_key(encrypted_key, password): """ <Purpose> Return a string containing 'encrypted_key' in non-encrypted form. The decrypt_key() function can be applied to the encrypted string to restore the original key object, a TUF key (e.g., RSAKEY_SCHEMA, ED25519KEY_SCHEMA). This function calls the ...
[ "def", "decrypt_key", "(", "encrypted_key", ",", "password", ")", ":", "# Do the arguments have the correct format?", "# Ensure the arguments have the appropriate number of objects and object", "# types, and that all dict keys are properly named.", "# Raise 'securesystemslib.exceptions.FormatE...
<Purpose> Return a string containing 'encrypted_key' in non-encrypted form. The decrypt_key() function can be applied to the encrypted string to restore the original key object, a TUF key (e.g., RSAKEY_SCHEMA, ED25519KEY_SCHEMA). This function calls the appropriate cryptography module (i.e., pyca_cr...
[ "<Purpose", ">", "Return", "a", "string", "containing", "encrypted_key", "in", "non", "-", "encrypted", "form", ".", "The", "decrypt_key", "()", "function", "can", "be", "applied", "to", "the", "encrypted", "string", "to", "restore", "the", "original", "key", ...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/pyca_crypto_keys.py#L745-L827
train
secure-systems-lab/securesystemslib
securesystemslib/pyca_crypto_keys.py
_generate_derived_key
def _generate_derived_key(password, salt=None, iterations=None): """ Generate a derived key by feeding 'password' to the Password-Based Key Derivation Function (PBKDF2). pyca/cryptography's PBKDF2 implementation is used in this module. 'salt' may be specified so that a previous derived key may be regenerate...
python
def _generate_derived_key(password, salt=None, iterations=None): """ Generate a derived key by feeding 'password' to the Password-Based Key Derivation Function (PBKDF2). pyca/cryptography's PBKDF2 implementation is used in this module. 'salt' may be specified so that a previous derived key may be regenerate...
[ "def", "_generate_derived_key", "(", "password", ",", "salt", "=", "None", ",", "iterations", "=", "None", ")", ":", "# Use pyca/cryptography's default backend (e.g., openSSL, CommonCrypto, etc.)", "# The default backend is not fixed and can be changed by pyca/cryptography", "# over ...
Generate a derived key by feeding 'password' to the Password-Based Key Derivation Function (PBKDF2). pyca/cryptography's PBKDF2 implementation is used in this module. 'salt' may be specified so that a previous derived key may be regenerated, otherwise '_SALT_SIZE' is used by default. 'iterations' is the numb...
[ "Generate", "a", "derived", "key", "by", "feeding", "password", "to", "the", "Password", "-", "Based", "Key", "Derivation", "Function", "(", "PBKDF2", ")", ".", "pyca", "/", "cryptography", "s", "PBKDF2", "implementation", "is", "used", "in", "this", "module...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/pyca_crypto_keys.py#L833-L864
train
secure-systems-lab/securesystemslib
securesystemslib/pyca_crypto_keys.py
_encrypt
def _encrypt(key_data, derived_key_information): """ Encrypt 'key_data' using the Advanced Encryption Standard (AES-256) algorithm. 'derived_key_information' should contain a key strengthened by PBKDF2. The key size is 256 bits and AES's mode of operation is set to CTR (CounTeR Mode). The HMAC of the ciphert...
python
def _encrypt(key_data, derived_key_information): """ Encrypt 'key_data' using the Advanced Encryption Standard (AES-256) algorithm. 'derived_key_information' should contain a key strengthened by PBKDF2. The key size is 256 bits and AES's mode of operation is set to CTR (CounTeR Mode). The HMAC of the ciphert...
[ "def", "_encrypt", "(", "key_data", ",", "derived_key_information", ")", ":", "# Generate a random Initialization Vector (IV). Follow the provably secure", "# encrypt-then-MAC approach, which affords the ability to verify ciphertext", "# without needing to decrypt it and preventing an attacker ...
Encrypt 'key_data' using the Advanced Encryption Standard (AES-256) algorithm. 'derived_key_information' should contain a key strengthened by PBKDF2. The key size is 256 bits and AES's mode of operation is set to CTR (CounTeR Mode). The HMAC of the ciphertext is generated to ensure the ciphertext has not been ...
[ "Encrypt", "key_data", "using", "the", "Advanced", "Encryption", "Standard", "(", "AES", "-", "256", ")", "algorithm", ".", "derived_key_information", "should", "contain", "a", "key", "strengthened", "by", "PBKDF2", ".", "The", "key", "size", "is", "256", "bit...
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/pyca_crypto_keys.py#L870-L939
train
secure-systems-lab/securesystemslib
securesystemslib/pyca_crypto_keys.py
_decrypt
def _decrypt(file_contents, password): """ The corresponding decryption routine for _encrypt(). 'securesystemslib.exceptions.CryptoError' raised if the decryption fails. """ # Extract the salt, iterations, hmac, initialization vector, and ciphertext # from 'file_contents'. These five values are delimited...
python
def _decrypt(file_contents, password): """ The corresponding decryption routine for _encrypt(). 'securesystemslib.exceptions.CryptoError' raised if the decryption fails. """ # Extract the salt, iterations, hmac, initialization vector, and ciphertext # from 'file_contents'. These five values are delimited...
[ "def", "_decrypt", "(", "file_contents", ",", "password", ")", ":", "# Extract the salt, iterations, hmac, initialization vector, and ciphertext", "# from 'file_contents'. These five values are delimited by", "# '_ENCRYPTION_DELIMITER'. This delimiter is arbitrarily chosen and should", "# no...
The corresponding decryption routine for _encrypt(). 'securesystemslib.exceptions.CryptoError' raised if the decryption fails.
[ "The", "corresponding", "decryption", "routine", "for", "_encrypt", "()", "." ]
beb3109d5bb462e5a60eed88fb40ed1167bd354e
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/pyca_crypto_keys.py#L945-L999
train
Tristramg/mumoro
virtualenv.py
create_environment
def create_environment(home_dir, site_packages=True, clear=False, unzip_setuptools=False, use_distribute=False): """ Creates a new environment in ``home_dir``. If ``site_packages`` is true (the default) then the global ``site-packages/`` directory will be on the path. If ``c...
python
def create_environment(home_dir, site_packages=True, clear=False, unzip_setuptools=False, use_distribute=False): """ Creates a new environment in ``home_dir``. If ``site_packages`` is true (the default) then the global ``site-packages/`` directory will be on the path. If ``c...
[ "def", "create_environment", "(", "home_dir", ",", "site_packages", "=", "True", ",", "clear", "=", "False", ",", "unzip_setuptools", "=", "False", ",", "use_distribute", "=", "False", ")", ":", "home_dir", ",", "lib_dir", ",", "inc_dir", ",", "bin_dir", "="...
Creates a new environment in ``home_dir``. If ``site_packages`` is true (the default) then the global ``site-packages/`` directory will be on the path. If ``clear`` is true (default False) then the environment will first be cleared.
[ "Creates", "a", "new", "environment", "in", "home_dir", "." ]
e37d6ddb72fd23fb485c80fd8a5cda520ca08187
https://github.com/Tristramg/mumoro/blob/e37d6ddb72fd23fb485c80fd8a5cda520ca08187/virtualenv.py#L594-L620
train
Tristramg/mumoro
virtualenv.py
path_locations
def path_locations(home_dir): """Return the path locations for the environment (where libraries are, where scripts go, etc)""" # XXX: We'd use distutils.sysconfig.get_python_inc/lib but its # prefix arg is broken: http://bugs.python.org/issue3386 if sys.platform == 'win32': # Windows has lot...
python
def path_locations(home_dir): """Return the path locations for the environment (where libraries are, where scripts go, etc)""" # XXX: We'd use distutils.sysconfig.get_python_inc/lib but its # prefix arg is broken: http://bugs.python.org/issue3386 if sys.platform == 'win32': # Windows has lot...
[ "def", "path_locations", "(", "home_dir", ")", ":", "# XXX: We'd use distutils.sysconfig.get_python_inc/lib but its", "# prefix arg is broken: http://bugs.python.org/issue3386", "if", "sys", ".", "platform", "==", "'win32'", ":", "# Windows has lots of problems with executables with sp...
Return the path locations for the environment (where libraries are, where scripts go, etc)
[ "Return", "the", "path", "locations", "for", "the", "environment", "(", "where", "libraries", "are", "where", "scripts", "go", "etc", ")" ]
e37d6ddb72fd23fb485c80fd8a5cda520ca08187
https://github.com/Tristramg/mumoro/blob/e37d6ddb72fd23fb485c80fd8a5cda520ca08187/virtualenv.py#L622-L652
train