repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
amzn/ion-python
amazon/ion/simple_types.py
_IonNature.from_value
def from_value(cls, ion_type, value, annotations=()): """Constructs a value as a copy with an associated Ion type and annotations. Args: ion_type (IonType): The associated Ion type. value (Any): The value to construct from, generally of type ``cls``. annotations (Seq...
python
def from_value(cls, ion_type, value, annotations=()): """Constructs a value as a copy with an associated Ion type and annotations. Args: ion_type (IonType): The associated Ion type. value (Any): The value to construct from, generally of type ``cls``. annotations (Seq...
[ "def", "from_value", "(", "cls", ",", "ion_type", ",", "value", ",", "annotations", "=", "(", ")", ")", ":", "if", "value", "is", "None", ":", "value", "=", "IonPyNull", "(", ")", "else", ":", "args", ",", "kwargs", "=", "cls", ".", "_to_constructor_...
Constructs a value as a copy with an associated Ion type and annotations. Args: ion_type (IonType): The associated Ion type. value (Any): The value to construct from, generally of type ``cls``. annotations (Sequence[unicode]): The sequence Unicode strings decorating this va...
[ "Constructs", "a", "value", "as", "a", "copy", "with", "an", "associated", "Ion", "type", "and", "annotations", "." ]
train
https://github.com/amzn/ion-python/blob/0b21fa3ba7755f55f745e4aa970d86343b82449d/amazon/ion/simple_types.py#L93-L109
amzn/ion-python
amazon/ion/simple_types.py
_IonNature.to_event
def to_event(self, event_type, field_name=None, depth=None): """Constructs an IonEvent from this _IonNature value. Args: event_type (IonEventType): The type of the resulting event. field_name (Optional[text]): The field name associated with this value, if any. depth ...
python
def to_event(self, event_type, field_name=None, depth=None): """Constructs an IonEvent from this _IonNature value. Args: event_type (IonEventType): The type of the resulting event. field_name (Optional[text]): The field name associated with this value, if any. depth ...
[ "def", "to_event", "(", "self", ",", "event_type", ",", "field_name", "=", "None", ",", "depth", "=", "None", ")", ":", "if", "self", ".", "ion_event", "is", "None", ":", "value", "=", "self", "if", "isinstance", "(", "self", ",", "IonPyNull", ")", "...
Constructs an IonEvent from this _IonNature value. Args: event_type (IonEventType): The type of the resulting event. field_name (Optional[text]): The field name associated with this value, if any. depth (Optional[int]): The depth of this value. Returns: ...
[ "Constructs", "an", "IonEvent", "from", "this", "_IonNature", "value", "." ]
train
https://github.com/amzn/ion-python/blob/0b21fa3ba7755f55f745e4aa970d86343b82449d/amazon/ion/simple_types.py#L111-L128
XML-Security/signxml
signxml/util/__init__.py
bytes_to_long
def bytes_to_long(s): """bytes_to_long(string) : long Convert a byte string to a long integer. This is (essentially) the inverse of long_to_bytes(). """ if isinstance(s, int): # On Python 2, indexing into a bytearray returns a byte string; on Python 3, an int. return s acc = 0 ...
python
def bytes_to_long(s): """bytes_to_long(string) : long Convert a byte string to a long integer. This is (essentially) the inverse of long_to_bytes(). """ if isinstance(s, int): # On Python 2, indexing into a bytearray returns a byte string; on Python 3, an int. return s acc = 0 ...
[ "def", "bytes_to_long", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "int", ")", ":", "# On Python 2, indexing into a bytearray returns a byte string; on Python 3, an int.", "return", "s", "acc", "=", "0", "if", "USING_PYTHON2", ":", "acc", "=", "long", ...
bytes_to_long(string) : long Convert a byte string to a long integer. This is (essentially) the inverse of long_to_bytes().
[ "bytes_to_long", "(", "string", ")", ":", "long", "Convert", "a", "byte", "string", "to", "a", "long", "integer", "." ]
train
https://github.com/XML-Security/signxml/blob/16503242617e9b25e5c2c9ced5ef18a06ffde146/signxml/util/__init__.py#L41-L61
XML-Security/signxml
signxml/util/__init__.py
long_to_bytes
def long_to_bytes(n, blocksize=0): """long_to_bytes(n:long, blocksize:int) : string Convert a long integer to a byte string. If optional blocksize is given and greater than zero, pad the front of the byte string with binary zeros so that the length is a multiple of blocksize. """ # after mu...
python
def long_to_bytes(n, blocksize=0): """long_to_bytes(n:long, blocksize:int) : string Convert a long integer to a byte string. If optional blocksize is given and greater than zero, pad the front of the byte string with binary zeros so that the length is a multiple of blocksize. """ # after mu...
[ "def", "long_to_bytes", "(", "n", ",", "blocksize", "=", "0", ")", ":", "# after much testing, this algorithm was deemed to be the fastest", "s", "=", "b''", "if", "USING_PYTHON2", ":", "n", "=", "long", "(", "n", ")", "# noqa", "pack", "=", "struct", ".", "pa...
long_to_bytes(n:long, blocksize:int) : string Convert a long integer to a byte string. If optional blocksize is given and greater than zero, pad the front of the byte string with binary zeros so that the length is a multiple of blocksize.
[ "long_to_bytes", "(", "n", ":", "long", "blocksize", ":", "int", ")", ":", "string", "Convert", "a", "long", "integer", "to", "a", "byte", "string", "." ]
train
https://github.com/XML-Security/signxml/blob/16503242617e9b25e5c2c9ced5ef18a06ffde146/signxml/util/__init__.py#L64-L93
XML-Security/signxml
signxml/util/__init__.py
raw_p_sha1
def raw_p_sha1(secret, seed, sizes=()): """ Derive one or more keys from secret and seed. (See specs part 6, 6.7.5 and RFC 2246 - TLS v1.0) Lengths of keys will match sizes argument Source: https://github.com/FreeOpcUa/python-opcua key_sizes = (signature_key_size, symmetric_key_size, 16) (s...
python
def raw_p_sha1(secret, seed, sizes=()): """ Derive one or more keys from secret and seed. (See specs part 6, 6.7.5 and RFC 2246 - TLS v1.0) Lengths of keys will match sizes argument Source: https://github.com/FreeOpcUa/python-opcua key_sizes = (signature_key_size, symmetric_key_size, 16) (s...
[ "def", "raw_p_sha1", "(", "secret", ",", "seed", ",", "sizes", "=", "(", ")", ")", ":", "full_size", "=", "0", "for", "size", "in", "sizes", ":", "full_size", "+=", "size", "result", "=", "b''", "accum", "=", "seed", "while", "len", "(", "result", ...
Derive one or more keys from secret and seed. (See specs part 6, 6.7.5 and RFC 2246 - TLS v1.0) Lengths of keys will match sizes argument Source: https://github.com/FreeOpcUa/python-opcua key_sizes = (signature_key_size, symmetric_key_size, 16) (sigkey, key, init_vec) = p_sha1(nonce2, nonce1, key_s...
[ "Derive", "one", "or", "more", "keys", "from", "secret", "and", "seed", ".", "(", "See", "specs", "part", "6", "6", ".", "7", ".", "5", "and", "RFC", "2246", "-", "TLS", "v1", ".", "0", ")", "Lengths", "of", "keys", "will", "match", "sizes", "arg...
train
https://github.com/XML-Security/signxml/blob/16503242617e9b25e5c2c9ced5ef18a06ffde146/signxml/util/__init__.py#L162-L186
XML-Security/signxml
signxml/util/__init__.py
verify_x509_cert_chain
def verify_x509_cert_chain(cert_chain, ca_pem_file=None, ca_path=None): """ Look at certs in the cert chain and add them to the store one by one. Return the cert at the end of the chain. That is the cert to be used by the caller for verifying. From https://www.w3.org/TR/xmldsig-core2/#sec-X509Data: ...
python
def verify_x509_cert_chain(cert_chain, ca_pem_file=None, ca_path=None): """ Look at certs in the cert chain and add them to the store one by one. Return the cert at the end of the chain. That is the cert to be used by the caller for verifying. From https://www.w3.org/TR/xmldsig-core2/#sec-X509Data: ...
[ "def", "verify_x509_cert_chain", "(", "cert_chain", ",", "ca_pem_file", "=", "None", ",", "ca_path", "=", "None", ")", ":", "from", "OpenSSL", "import", "SSL", "context", "=", "SSL", ".", "Context", "(", "SSL", ".", "TLSv1_METHOD", ")", "if", "ca_pem_file", ...
Look at certs in the cert chain and add them to the store one by one. Return the cert at the end of the chain. That is the cert to be used by the caller for verifying. From https://www.w3.org/TR/xmldsig-core2/#sec-X509Data: "All certificates appearing in an X509Data element must relate to the validation key...
[ "Look", "at", "certs", "in", "the", "cert", "chain", "and", "add", "them", "to", "the", "store", "one", "by", "one", ".", "Return", "the", "cert", "at", "the", "end", "of", "the", "chain", ".", "That", "is", "the", "cert", "to", "be", "used", "by",...
train
https://github.com/XML-Security/signxml/blob/16503242617e9b25e5c2c9ced5ef18a06ffde146/signxml/util/__init__.py#L209-L242
XML-Security/signxml
signxml/__init__.py
_remove_sig
def _remove_sig(signature, idempotent=False): """ Remove the signature node from its parent, keeping any tail element. This is needed for eneveloped signatures. :param signature: Signature to remove from payload :type signature: XML ElementTree Element :param idempotent: If True, don't ...
python
def _remove_sig(signature, idempotent=False): """ Remove the signature node from its parent, keeping any tail element. This is needed for eneveloped signatures. :param signature: Signature to remove from payload :type signature: XML ElementTree Element :param idempotent: If True, don't ...
[ "def", "_remove_sig", "(", "signature", ",", "idempotent", "=", "False", ")", ":", "try", ":", "signaturep", "=", "next", "(", "signature", ".", "iterancestors", "(", ")", ")", "except", "StopIteration", ":", "if", "idempotent", ":", "return", "raise", "Va...
Remove the signature node from its parent, keeping any tail element. This is needed for eneveloped signatures. :param signature: Signature to remove from payload :type signature: XML ElementTree Element :param idempotent: If True, don't raise an error if signature is already detached from paren...
[ "Remove", "the", "signature", "node", "from", "its", "parent", "keeping", "any", "tail", "element", ".", "This", "is", "needed", "for", "eneveloped", "signatures", "." ]
train
https://github.com/XML-Security/signxml/blob/16503242617e9b25e5c2c9ced5ef18a06ffde146/signxml/__init__.py#L39-L69
XML-Security/signxml
signxml/__init__.py
XMLSigner.sign
def sign(self, data, key=None, passphrase=None, cert=None, reference_uri=None, key_name=None, key_info=None, id_attribute=None): """ Sign the data and return the root element of the resulting XML tree. :param data: Data to sign :type data: String, file-like object, or XML E...
python
def sign(self, data, key=None, passphrase=None, cert=None, reference_uri=None, key_name=None, key_info=None, id_attribute=None): """ Sign the data and return the root element of the resulting XML tree. :param data: Data to sign :type data: String, file-like object, or XML E...
[ "def", "sign", "(", "self", ",", "data", ",", "key", "=", "None", ",", "passphrase", "=", "None", ",", "cert", "=", "None", ",", "reference_uri", "=", "None", ",", "key_name", "=", "None", ",", "key_info", "=", "None", ",", "id_attribute", "=", "None...
Sign the data and return the root element of the resulting XML tree. :param data: Data to sign :type data: String, file-like object, or XML ElementTree Element API compatible object :param key: Key to be used for signing. When signing with a certificate or RSA/DSA/ECDSA key, this ca...
[ "Sign", "the", "data", "and", "return", "the", "root", "element", "of", "the", "resulting", "XML", "tree", "." ]
train
https://github.com/XML-Security/signxml/blob/16503242617e9b25e5c2c9ced5ef18a06ffde146/signxml/__init__.py#L283-L409
XML-Security/signxml
signxml/__init__.py
XMLVerifier.verify
def verify(self, data, require_x509=True, x509_cert=None, cert_subject_name=None, ca_pem_file=None, ca_path=None, hmac_key=None, validate_schema=True, parser=None, uri_resolver=None, id_attribute=None, expect_references=1): """ Verify the XML signature supplied in the data ...
python
def verify(self, data, require_x509=True, x509_cert=None, cert_subject_name=None, ca_pem_file=None, ca_path=None, hmac_key=None, validate_schema=True, parser=None, uri_resolver=None, id_attribute=None, expect_references=1): """ Verify the XML signature supplied in the data ...
[ "def", "verify", "(", "self", ",", "data", ",", "require_x509", "=", "True", ",", "x509_cert", "=", "None", ",", "cert_subject_name", "=", "None", ",", "ca_pem_file", "=", "None", ",", "ca_path", "=", "None", ",", "hmac_key", "=", "None", ",", "validate_...
Verify the XML signature supplied in the data and return the XML node signed by the signature, or raise an exception if the signature is not valid. By default, this requires the signature to be generated using a valid X.509 certificate. To enable other means of signature validation, set the **require_x5...
[ "Verify", "the", "XML", "signature", "supplied", "in", "the", "data", "and", "return", "the", "XML", "node", "signed", "by", "the", "signature", "or", "raise", "an", "exception", "if", "the", "signature", "is", "not", "valid", ".", "By", "default", "this",...
train
https://github.com/XML-Security/signxml/blob/16503242617e9b25e5c2c9ced5ef18a06ffde146/signxml/__init__.py#L596-L779
cenkalti/github-flask
flask_github.py
GitHub.authorize
def authorize(self, scope=None, redirect_uri=None, state=None): """ Redirect to GitHub and request access to a user's data. :param scope: List of `Scopes`_ for which to request access, formatted as a string or comma delimited list of scopes as a strin...
python
def authorize(self, scope=None, redirect_uri=None, state=None): """ Redirect to GitHub and request access to a user's data. :param scope: List of `Scopes`_ for which to request access, formatted as a string or comma delimited list of scopes as a strin...
[ "def", "authorize", "(", "self", ",", "scope", "=", "None", ",", "redirect_uri", "=", "None", ",", "state", "=", "None", ")", ":", "_logger", ".", "debug", "(", "\"Called authorize()\"", ")", "params", "=", "{", "'client_id'", ":", "self", ".", "client_i...
Redirect to GitHub and request access to a user's data. :param scope: List of `Scopes`_ for which to request access, formatted as a string or comma delimited list of scopes as a string. Defaults to ``None``, resulting in granting read-only acces...
[ "Redirect", "to", "GitHub", "and", "request", "access", "to", "a", "user", "s", "data", "." ]
train
https://github.com/cenkalti/github-flask/blob/9f58d61b7d328cef857edbb5c64a5d3f716367cb/flask_github.py#L104-L168
cenkalti/github-flask
flask_github.py
GitHub.authorized_handler
def authorized_handler(self, f): """ Decorator for the route that is used as the callback for authorizing with GitHub. This callback URL can be set in the settings for the app or passed in during authorization. """ @wraps(f) def decorated(*args, **kwargs): ...
python
def authorized_handler(self, f): """ Decorator for the route that is used as the callback for authorizing with GitHub. This callback URL can be set in the settings for the app or passed in during authorization. """ @wraps(f) def decorated(*args, **kwargs): ...
[ "def", "authorized_handler", "(", "self", ",", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "decorated", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'code'", "in", "request", ".", "args", ":", "data", "=", "self", ".", "_han...
Decorator for the route that is used as the callback for authorizing with GitHub. This callback URL can be set in the settings for the app or passed in during authorization.
[ "Decorator", "for", "the", "route", "that", "is", "used", "as", "the", "callback", "for", "authorizing", "with", "GitHub", ".", "This", "callback", "URL", "can", "be", "set", "in", "the", "settings", "for", "the", "app", "or", "passed", "in", "during", "...
train
https://github.com/cenkalti/github-flask/blob/9f58d61b7d328cef857edbb5c64a5d3f716367cb/flask_github.py#L170-L184
cenkalti/github-flask
flask_github.py
GitHub._handle_response
def _handle_response(self): """ Handles response after the redirect to GitHub. This response determines if the user has allowed the this application access. If we were then we send a POST request for the access_key used to authenticate requests to GitHub. """ _lo...
python
def _handle_response(self): """ Handles response after the redirect to GitHub. This response determines if the user has allowed the this application access. If we were then we send a POST request for the access_key used to authenticate requests to GitHub. """ _lo...
[ "def", "_handle_response", "(", "self", ")", ":", "_logger", ".", "debug", "(", "\"Handling response from GitHub\"", ")", "params", "=", "{", "'code'", ":", "request", ".", "args", ".", "get", "(", "'code'", ")", ",", "'client_id'", ":", "self", ".", "clie...
Handles response after the redirect to GitHub. This response determines if the user has allowed the this application access. If we were then we send a POST request for the access_key used to authenticate requests to GitHub.
[ "Handles", "response", "after", "the", "redirect", "to", "GitHub", ".", "This", "response", "determines", "if", "the", "user", "has", "allowed", "the", "this", "application", "access", ".", "If", "we", "were", "then", "we", "send", "a", "POST", "request", ...
train
https://github.com/cenkalti/github-flask/blob/9f58d61b7d328cef857edbb5c64a5d3f716367cb/flask_github.py#L186-L212
cenkalti/github-flask
flask_github.py
GitHub.raw_request
def raw_request(self, method, resource, access_token=None, **kwargs): """ Makes a HTTP request and returns the raw :class:`~requests.Response` object. """ headers = self._pop_headers(kwargs) headers['Authorization'] = self._get_authorization_header(access_token) ...
python
def raw_request(self, method, resource, access_token=None, **kwargs): """ Makes a HTTP request and returns the raw :class:`~requests.Response` object. """ headers = self._pop_headers(kwargs) headers['Authorization'] = self._get_authorization_header(access_token) ...
[ "def", "raw_request", "(", "self", ",", "method", ",", "resource", ",", "access_token", "=", "None", ",", "*", "*", "kwargs", ")", ":", "headers", "=", "self", ".", "_pop_headers", "(", "kwargs", ")", "headers", "[", "'Authorization'", "]", "=", "self", ...
Makes a HTTP request and returns the raw :class:`~requests.Response` object.
[ "Makes", "a", "HTTP", "request", "and", "returns", "the", "raw", ":", "class", ":", "~requests", ".", "Response", "object", "." ]
train
https://github.com/cenkalti/github-flask/blob/9f58d61b7d328cef857edbb5c64a5d3f716367cb/flask_github.py#L217-L226
cenkalti/github-flask
flask_github.py
GitHub.request
def request(self, method, resource, all_pages=False, **kwargs): """ Makes a request to the given endpoint. Keyword arguments are passed to the :meth:`~requests.request` method. If the content type of the response is JSON, it will be decoded automatically and a dictionary will be ...
python
def request(self, method, resource, all_pages=False, **kwargs): """ Makes a request to the given endpoint. Keyword arguments are passed to the :meth:`~requests.request` method. If the content type of the response is JSON, it will be decoded automatically and a dictionary will be ...
[ "def", "request", "(", "self", ",", "method", ",", "resource", ",", "all_pages", "=", "False", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "raw_request", "(", "method", ",", "resource", ",", "*", "*", "kwargs", ")", "if", "not", ...
Makes a request to the given endpoint. Keyword arguments are passed to the :meth:`~requests.request` method. If the content type of the response is JSON, it will be decoded automatically and a dictionary will be returned. Otherwise the :class:`~requests.Response` object is returned.
[ "Makes", "a", "request", "to", "the", "given", "endpoint", ".", "Keyword", "arguments", "are", "passed", "to", "the", ":", "meth", ":", "~requests", ".", "request", "method", ".", "If", "the", "content", "type", "of", "the", "response", "is", "JSON", "it...
train
https://github.com/cenkalti/github-flask/blob/9f58d61b7d328cef857edbb5c64a5d3f716367cb/flask_github.py#L250-L281
cenkalti/github-flask
flask_github.py
GitHub.get
def get(self, resource, params=None, **kwargs): """Shortcut for ``request('GET', resource)``.""" return self.request('GET', resource, params=params, **kwargs)
python
def get(self, resource, params=None, **kwargs): """Shortcut for ``request('GET', resource)``.""" return self.request('GET', resource, params=params, **kwargs)
[ "def", "get", "(", "self", ",", "resource", ",", "params", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "request", "(", "'GET'", ",", "resource", ",", "params", "=", "params", ",", "*", "*", "kwargs", ")" ]
Shortcut for ``request('GET', resource)``.
[ "Shortcut", "for", "request", "(", "GET", "resource", ")", "." ]
train
https://github.com/cenkalti/github-flask/blob/9f58d61b7d328cef857edbb5c64a5d3f716367cb/flask_github.py#L283-L285
cenkalti/github-flask
flask_github.py
GitHub.post
def post(self, resource, data=None, **kwargs): """Shortcut for ``request('POST', resource)``. Use this to make POST request since it will also encode ``data`` to 'application/json' format.""" headers = dict(kwargs.pop('headers', {})) headers.setdefault('Content-Type', 'applicatio...
python
def post(self, resource, data=None, **kwargs): """Shortcut for ``request('POST', resource)``. Use this to make POST request since it will also encode ``data`` to 'application/json' format.""" headers = dict(kwargs.pop('headers', {})) headers.setdefault('Content-Type', 'applicatio...
[ "def", "post", "(", "self", ",", "resource", ",", "data", "=", "None", ",", "*", "*", "kwargs", ")", ":", "headers", "=", "dict", "(", "kwargs", ".", "pop", "(", "'headers'", ",", "{", "}", ")", ")", "headers", ".", "setdefault", "(", "'Content-Typ...
Shortcut for ``request('POST', resource)``. Use this to make POST request since it will also encode ``data`` to 'application/json' format.
[ "Shortcut", "for", "request", "(", "POST", "resource", ")", ".", "Use", "this", "to", "make", "POST", "request", "since", "it", "will", "also", "encode", "data", "to", "application", "/", "json", "format", "." ]
train
https://github.com/cenkalti/github-flask/blob/9f58d61b7d328cef857edbb5c64a5d3f716367cb/flask_github.py#L287-L295
ethereum/pyrlp
rlp/lazy.py
decode_lazy
def decode_lazy(rlp, sedes=None, **sedes_kwargs): """Decode an RLP encoded object in a lazy fashion. If the encoded object is a bytestring, this function acts similar to :func:`rlp.decode`. If it is a list however, a :class:`LazyList` is returned instead. This object will decode the string lazily, avoi...
python
def decode_lazy(rlp, sedes=None, **sedes_kwargs): """Decode an RLP encoded object in a lazy fashion. If the encoded object is a bytestring, this function acts similar to :func:`rlp.decode`. If it is a list however, a :class:`LazyList` is returned instead. This object will decode the string lazily, avoi...
[ "def", "decode_lazy", "(", "rlp", ",", "sedes", "=", "None", ",", "*", "*", "sedes_kwargs", ")", ":", "item", ",", "end", "=", "consume_item_lazy", "(", "rlp", ",", "0", ")", "if", "end", "!=", "len", "(", "rlp", ")", ":", "raise", "DecodingError", ...
Decode an RLP encoded object in a lazy fashion. If the encoded object is a bytestring, this function acts similar to :func:`rlp.decode`. If it is a list however, a :class:`LazyList` is returned instead. This object will decode the string lazily, avoiding both horizontal and vertical traversing as much ...
[ "Decode", "an", "RLP", "encoded", "object", "in", "a", "lazy", "fashion", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/lazy.py#L8-L41
ethereum/pyrlp
rlp/lazy.py
consume_item_lazy
def consume_item_lazy(rlp, start): """Read an item from an RLP string lazily. If the length prefix announces a string, the string is read; if it announces a list, a :class:`LazyList` is created. :param rlp: the rlp string to read from :param start: the position at which to start reading :retur...
python
def consume_item_lazy(rlp, start): """Read an item from an RLP string lazily. If the length prefix announces a string, the string is read; if it announces a list, a :class:`LazyList` is created. :param rlp: the rlp string to read from :param start: the position at which to start reading :retur...
[ "def", "consume_item_lazy", "(", "rlp", ",", "start", ")", ":", "p", ",", "t", ",", "l", ",", "s", "=", "consume_length_prefix", "(", "rlp", ",", "start", ")", "if", "t", "is", "bytes", ":", "item", ",", "_", ",", "end", "=", "consume_payload", "("...
Read an item from an RLP string lazily. If the length prefix announces a string, the string is read; if it announces a list, a :class:`LazyList` is created. :param rlp: the rlp string to read from :param start: the position at which to start reading :returns: a tuple ``(item, end)`` where ``item``...
[ "Read", "an", "item", "from", "an", "RLP", "string", "lazily", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/lazy.py#L44-L62
ethereum/pyrlp
rlp/lazy.py
peek
def peek(rlp, index, sedes=None): """Get a specific element from an rlp encoded nested list. This function uses :func:`rlp.decode_lazy` and, thus, decodes only the necessary parts of the string. Usage example:: >>> import rlp >>> rlpdata = rlp.encode([1, 2, [3, [4, 5]]]) >>> r...
python
def peek(rlp, index, sedes=None): """Get a specific element from an rlp encoded nested list. This function uses :func:`rlp.decode_lazy` and, thus, decodes only the necessary parts of the string. Usage example:: >>> import rlp >>> rlpdata = rlp.encode([1, 2, [3, [4, 5]]]) >>> r...
[ "def", "peek", "(", "rlp", ",", "index", ",", "sedes", "=", "None", ")", ":", "ll", "=", "decode_lazy", "(", "rlp", ")", "if", "not", "isinstance", "(", "index", ",", "Iterable", ")", ":", "index", "=", "[", "index", "]", "for", "i", "in", "index...
Get a specific element from an rlp encoded nested list. This function uses :func:`rlp.decode_lazy` and, thus, decodes only the necessary parts of the string. Usage example:: >>> import rlp >>> rlpdata = rlp.encode([1, 2, [3, [4, 5]]]) >>> rlp.peek(rlpdata, 0, rlp.sedes.big_endian_...
[ "Get", "a", "specific", "element", "from", "an", "rlp", "encoded", "nested", "list", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/lazy.py#L138-L171
ethereum/pyrlp
rlp/sedes/text.py
Text.fixed_length
def fixed_length(cls, l, allow_empty=False): """Create a sedes for text data with exactly `l` encoded characters.""" return cls(l, l, allow_empty=allow_empty)
python
def fixed_length(cls, l, allow_empty=False): """Create a sedes for text data with exactly `l` encoded characters.""" return cls(l, l, allow_empty=allow_empty)
[ "def", "fixed_length", "(", "cls", ",", "l", ",", "allow_empty", "=", "False", ")", ":", "return", "cls", "(", "l", ",", "l", ",", "allow_empty", "=", "allow_empty", ")" ]
Create a sedes for text data with exactly `l` encoded characters.
[ "Create", "a", "sedes", "for", "text", "data", "with", "exactly", "l", "encoded", "characters", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/sedes/text.py#L24-L26
ethereum/pyrlp
rlp/sedes/serializable.py
_eq
def _eq(left, right): """ Equality comparison that allows for equality between tuple and list types with equivalent elements. """ if isinstance(left, (tuple, list)) and isinstance(right, (tuple, list)): return len(left) == len(right) and all(_eq(*pair) for pair in zip(left, right)) else:...
python
def _eq(left, right): """ Equality comparison that allows for equality between tuple and list types with equivalent elements. """ if isinstance(left, (tuple, list)) and isinstance(right, (tuple, list)): return len(left) == len(right) and all(_eq(*pair) for pair in zip(left, right)) else:...
[ "def", "_eq", "(", "left", ",", "right", ")", ":", "if", "isinstance", "(", "left", ",", "(", "tuple", ",", "list", ")", ")", "and", "isinstance", "(", "right", ",", "(", "tuple", ",", "list", ")", ")", ":", "return", "len", "(", "left", ")", "...
Equality comparison that allows for equality between tuple and list types with equivalent elements.
[ "Equality", "comparison", "that", "allows", "for", "equality", "between", "tuple", "and", "list", "types", "with", "equivalent", "elements", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/sedes/serializable.py#L82-L90
ethereum/pyrlp
rlp/sedes/lists.py
is_sequence
def is_sequence(obj): """Check if `obj` is a sequence, but not a string or bytes.""" return isinstance(obj, Sequence) and not ( isinstance(obj, str) or BinaryClass.is_valid_type(obj))
python
def is_sequence(obj): """Check if `obj` is a sequence, but not a string or bytes.""" return isinstance(obj, Sequence) and not ( isinstance(obj, str) or BinaryClass.is_valid_type(obj))
[ "def", "is_sequence", "(", "obj", ")", ":", "return", "isinstance", "(", "obj", ",", "Sequence", ")", "and", "not", "(", "isinstance", "(", "obj", ",", "str", ")", "or", "BinaryClass", ".", "is_valid_type", "(", "obj", ")", ")" ]
Check if `obj` is a sequence, but not a string or bytes.
[ "Check", "if", "obj", "is", "a", "sequence", "but", "not", "a", "string", "or", "bytes", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/sedes/lists.py#L32-L35
ethereum/pyrlp
rlp/codec.py
encode
def encode(obj, sedes=None, infer_serializer=True, cache=True): """Encode a Python object in RLP format. By default, the object is serialized in a suitable way first (using :func:`rlp.infer_sedes`) and then encoded. Serialization can be explicitly suppressed by setting `infer_serializer` to ``False`` a...
python
def encode(obj, sedes=None, infer_serializer=True, cache=True): """Encode a Python object in RLP format. By default, the object is serialized in a suitable way first (using :func:`rlp.infer_sedes`) and then encoded. Serialization can be explicitly suppressed by setting `infer_serializer` to ``False`` a...
[ "def", "encode", "(", "obj", ",", "sedes", "=", "None", ",", "infer_serializer", "=", "True", ",", "cache", "=", "True", ")", ":", "if", "isinstance", "(", "obj", ",", "Serializable", ")", ":", "cached_rlp", "=", "obj", ".", "_cached_rlp", "if", "sedes...
Encode a Python object in RLP format. By default, the object is serialized in a suitable way first (using :func:`rlp.infer_sedes`) and then encoded. Serialization can be explicitly suppressed by setting `infer_serializer` to ``False`` and not passing an alternative as `sedes`. If `obj` has an attr...
[ "Encode", "a", "Python", "object", "in", "RLP", "format", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/codec.py#L20-L70
ethereum/pyrlp
rlp/codec.py
encode_raw
def encode_raw(item): """RLP encode (a nested sequence of) :class:`Atomic`s.""" if isinstance(item, Atomic): if len(item) == 1 and item[0] < 128: return item payload = item prefix_offset = 128 # string elif not isinstance(item, str) and isinstance(item, collections.Seque...
python
def encode_raw(item): """RLP encode (a nested sequence of) :class:`Atomic`s.""" if isinstance(item, Atomic): if len(item) == 1 and item[0] < 128: return item payload = item prefix_offset = 128 # string elif not isinstance(item, str) and isinstance(item, collections.Seque...
[ "def", "encode_raw", "(", "item", ")", ":", "if", "isinstance", "(", "item", ",", "Atomic", ")", ":", "if", "len", "(", "item", ")", "==", "1", "and", "item", "[", "0", "]", "<", "128", ":", "return", "item", "payload", "=", "item", "prefix_offset"...
RLP encode (a nested sequence of) :class:`Atomic`s.
[ "RLP", "encode", "(", "a", "nested", "sequence", "of", ")", ":", "class", ":", "Atomic", "s", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/codec.py#L73-L92
ethereum/pyrlp
rlp/codec.py
length_prefix
def length_prefix(length, offset): """Construct the prefix to lists or strings denoting their length. :param length: the length of the item in bytes :param offset: ``0x80`` when encoding raw bytes, ``0xc0`` when encoding a list """ if length < 56: return ALL_BYTES[offset ...
python
def length_prefix(length, offset): """Construct the prefix to lists or strings denoting their length. :param length: the length of the item in bytes :param offset: ``0x80`` when encoding raw bytes, ``0xc0`` when encoding a list """ if length < 56: return ALL_BYTES[offset ...
[ "def", "length_prefix", "(", "length", ",", "offset", ")", ":", "if", "length", "<", "56", ":", "return", "ALL_BYTES", "[", "offset", "+", "length", "]", "elif", "length", "<", "LONG_LENGTH", ":", "length_string", "=", "int_to_big_endian", "(", "length", "...
Construct the prefix to lists or strings denoting their length. :param length: the length of the item in bytes :param offset: ``0x80`` when encoding raw bytes, ``0xc0`` when encoding a list
[ "Construct", "the", "prefix", "to", "lists", "or", "strings", "denoting", "their", "length", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/codec.py#L98-L111
ethereum/pyrlp
rlp/codec.py
consume_length_prefix
def consume_length_prefix(rlp, start): """Read a length prefix from an RLP string. :param rlp: the rlp byte string to read from :param start: the position at which to start reading :returns: a tuple ``(prefix, type, length, end)``, where ``type`` is either ``str`` or ``list`` depending on...
python
def consume_length_prefix(rlp, start): """Read a length prefix from an RLP string. :param rlp: the rlp byte string to read from :param start: the position at which to start reading :returns: a tuple ``(prefix, type, length, end)``, where ``type`` is either ``str`` or ``list`` depending on...
[ "def", "consume_length_prefix", "(", "rlp", ",", "start", ")", ":", "b0", "=", "rlp", "[", "start", "]", "if", "b0", "<", "128", ":", "# single byte", "return", "(", "b''", ",", "bytes", ",", "1", ",", "start", ")", "elif", "b0", "<", "SHORT_STRING",...
Read a length prefix from an RLP string. :param rlp: the rlp byte string to read from :param start: the position at which to start reading :returns: a tuple ``(prefix, type, length, end)``, where ``type`` is either ``str`` or ``list`` depending on the type of the following payload, ...
[ "Read", "a", "length", "prefix", "from", "an", "RLP", "string", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/codec.py#L117-L153
ethereum/pyrlp
rlp/codec.py
consume_payload
def consume_payload(rlp, prefix, start, type_, length): """Read the payload of an item from an RLP string. :param rlp: the rlp string to read from :param type_: the type of the payload (``bytes`` or ``list``) :param start: the position at which to start reading :param length: the length of the payl...
python
def consume_payload(rlp, prefix, start, type_, length): """Read the payload of an item from an RLP string. :param rlp: the rlp string to read from :param type_: the type of the payload (``bytes`` or ``list``) :param start: the position at which to start reading :param length: the length of the payl...
[ "def", "consume_payload", "(", "rlp", ",", "prefix", ",", "start", ",", "type_", ",", "length", ")", ":", "if", "type_", "is", "bytes", ":", "item", "=", "rlp", "[", "start", ":", "start", "+", "length", "]", "return", "(", "item", ",", "[", "prefi...
Read the payload of an item from an RLP string. :param rlp: the rlp string to read from :param type_: the type of the payload (``bytes`` or ``list``) :param start: the position at which to start reading :param length: the length of the payload in bytes :returns: a tuple ``(item, per_item_rlp, end)`...
[ "Read", "the", "payload", "of", "an", "item", "from", "an", "RLP", "string", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/codec.py#L156-L192
ethereum/pyrlp
rlp/codec.py
consume_item
def consume_item(rlp, start): """Read an item from an RLP string. :param rlp: the rlp string to read from :param start: the position at which to start reading :returns: a tuple ``(item, per_item_rlp, end)``, where ``item`` is the read item, per_item_rlp is a list containing the RLP ...
python
def consume_item(rlp, start): """Read an item from an RLP string. :param rlp: the rlp string to read from :param start: the position at which to start reading :returns: a tuple ``(item, per_item_rlp, end)``, where ``item`` is the read item, per_item_rlp is a list containing the RLP ...
[ "def", "consume_item", "(", "rlp", ",", "start", ")", ":", "p", ",", "t", ",", "l", ",", "s", "=", "consume_length_prefix", "(", "rlp", ",", "start", ")", "return", "consume_payload", "(", "rlp", ",", "p", ",", "s", ",", "t", ",", "l", ")" ]
Read an item from an RLP string. :param rlp: the rlp string to read from :param start: the position at which to start reading :returns: a tuple ``(item, per_item_rlp, end)``, where ``item`` is the read item, per_item_rlp is a list containing the RLP encoding of each item and ``e...
[ "Read", "an", "item", "from", "an", "RLP", "string", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/codec.py#L195-L206
ethereum/pyrlp
rlp/codec.py
decode
def decode(rlp, sedes=None, strict=True, recursive_cache=False, **kwargs): """Decode an RLP encoded object. If the deserialized result `obj` has an attribute :attr:`_cached_rlp` (e.g. if `sedes` is a subclass of :class:`rlp.Serializable`) it will be set to `rlp`, which will improve performance on subse...
python
def decode(rlp, sedes=None, strict=True, recursive_cache=False, **kwargs): """Decode an RLP encoded object. If the deserialized result `obj` has an attribute :attr:`_cached_rlp` (e.g. if `sedes` is a subclass of :class:`rlp.Serializable`) it will be set to `rlp`, which will improve performance on subse...
[ "def", "decode", "(", "rlp", ",", "sedes", "=", "None", ",", "strict", "=", "True", ",", "recursive_cache", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "not", "is_bytes", "(", "rlp", ")", ":", "raise", "DecodingError", "(", "'Can only decode...
Decode an RLP encoded object. If the deserialized result `obj` has an attribute :attr:`_cached_rlp` (e.g. if `sedes` is a subclass of :class:`rlp.Serializable`) it will be set to `rlp`, which will improve performance on subsequent :func:`rlp.encode` calls. Bear in mind however that `obj` needs to make sure...
[ "Decode", "an", "RLP", "encoded", "object", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/codec.py#L209-L242
ethereum/pyrlp
rlp/codec.py
infer_sedes
def infer_sedes(obj): """Try to find a sedes objects suitable for a given Python object. The sedes objects considered are `obj`'s class, `big_endian_int` and `binary`. If `obj` is a sequence, a :class:`rlp.sedes.List` will be constructed recursively. :param obj: the python object for which to find...
python
def infer_sedes(obj): """Try to find a sedes objects suitable for a given Python object. The sedes objects considered are `obj`'s class, `big_endian_int` and `binary`. If `obj` is a sequence, a :class:`rlp.sedes.List` will be constructed recursively. :param obj: the python object for which to find...
[ "def", "infer_sedes", "(", "obj", ")", ":", "if", "is_sedes", "(", "obj", ".", "__class__", ")", ":", "return", "obj", ".", "__class__", "elif", "not", "isinstance", "(", "obj", ",", "bool", ")", "and", "isinstance", "(", "obj", ",", "int", ")", "and...
Try to find a sedes objects suitable for a given Python object. The sedes objects considered are `obj`'s class, `big_endian_int` and `binary`. If `obj` is a sequence, a :class:`rlp.sedes.List` will be constructed recursively. :param obj: the python object for which to find a sedes object :raises: ...
[ "Try", "to", "find", "a", "sedes", "objects", "suitable", "for", "a", "given", "Python", "object", "." ]
train
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/codec.py#L261-L284
graphite-project/carbonate
carbonate/config.py
Config.destinations
def destinations(self, cluster='main'): """Return a list of destinations for a cluster.""" if not self.config.has_section(cluster): raise SystemExit("Cluster '%s' not defined in %s" % (cluster, self.config_file)) destinations = self.config.get(cluster, 'd...
python
def destinations(self, cluster='main'): """Return a list of destinations for a cluster.""" if not self.config.has_section(cluster): raise SystemExit("Cluster '%s' not defined in %s" % (cluster, self.config_file)) destinations = self.config.get(cluster, 'd...
[ "def", "destinations", "(", "self", ",", "cluster", "=", "'main'", ")", ":", "if", "not", "self", ".", "config", ".", "has_section", "(", "cluster", ")", ":", "raise", "SystemExit", "(", "\"Cluster '%s' not defined in %s\"", "%", "(", "cluster", ",", "self",...
Return a list of destinations for a cluster.
[ "Return", "a", "list", "of", "destinations", "for", "a", "cluster", "." ]
train
https://github.com/graphite-project/carbonate/blob/b876a85b321fbd7c18a6721bed2e7807b79b4929/carbonate/config.py#L21-L27
graphite-project/carbonate
carbonate/config.py
Config.replication_factor
def replication_factor(self, cluster='main'): """Return the replication factor for a cluster as an integer.""" if not self.config.has_section(cluster): raise SystemExit("Cluster '%s' not defined in %s" % (cluster, self.config_file)) return int(self.config...
python
def replication_factor(self, cluster='main'): """Return the replication factor for a cluster as an integer.""" if not self.config.has_section(cluster): raise SystemExit("Cluster '%s' not defined in %s" % (cluster, self.config_file)) return int(self.config...
[ "def", "replication_factor", "(", "self", ",", "cluster", "=", "'main'", ")", ":", "if", "not", "self", ".", "config", ".", "has_section", "(", "cluster", ")", ":", "raise", "SystemExit", "(", "\"Cluster '%s' not defined in %s\"", "%", "(", "cluster", ",", "...
Return the replication factor for a cluster as an integer.
[ "Return", "the", "replication", "factor", "for", "a", "cluster", "as", "an", "integer", "." ]
train
https://github.com/graphite-project/carbonate/blob/b876a85b321fbd7c18a6721bed2e7807b79b4929/carbonate/config.py#L29-L34
graphite-project/carbonate
carbonate/config.py
Config.ssh_user
def ssh_user(self, cluster='main'): """Return the ssh user for a cluster or current user if undefined.""" if not self.config.has_section(cluster): raise SystemExit("Cluster '%s' not defined in %s" % (cluster, self.config_file)) try: return sel...
python
def ssh_user(self, cluster='main'): """Return the ssh user for a cluster or current user if undefined.""" if not self.config.has_section(cluster): raise SystemExit("Cluster '%s' not defined in %s" % (cluster, self.config_file)) try: return sel...
[ "def", "ssh_user", "(", "self", ",", "cluster", "=", "'main'", ")", ":", "if", "not", "self", ".", "config", ".", "has_section", "(", "cluster", ")", ":", "raise", "SystemExit", "(", "\"Cluster '%s' not defined in %s\"", "%", "(", "cluster", ",", "self", "...
Return the ssh user for a cluster or current user if undefined.
[ "Return", "the", "ssh", "user", "for", "a", "cluster", "or", "current", "user", "if", "undefined", "." ]
train
https://github.com/graphite-project/carbonate/blob/b876a85b321fbd7c18a6721bed2e7807b79b4929/carbonate/config.py#L36-L44
graphite-project/carbonate
carbonate/config.py
Config.whisper_lock_writes
def whisper_lock_writes(self, cluster='main'): """Lock whisper files during carbon-sync.""" if not self.config.has_section(cluster): raise SystemExit("Cluster '%s' not defined in %s" % (cluster, self.config_file)) try: return bool(self.config....
python
def whisper_lock_writes(self, cluster='main'): """Lock whisper files during carbon-sync.""" if not self.config.has_section(cluster): raise SystemExit("Cluster '%s' not defined in %s" % (cluster, self.config_file)) try: return bool(self.config....
[ "def", "whisper_lock_writes", "(", "self", ",", "cluster", "=", "'main'", ")", ":", "if", "not", "self", ".", "config", ".", "has_section", "(", "cluster", ")", ":", "raise", "SystemExit", "(", "\"Cluster '%s' not defined in %s\"", "%", "(", "cluster", ",", ...
Lock whisper files during carbon-sync.
[ "Lock", "whisper", "files", "during", "carbon", "-", "sync", "." ]
train
https://github.com/graphite-project/carbonate/blob/b876a85b321fbd7c18a6721bed2e7807b79b4929/carbonate/config.py#L46-L54
graphite-project/carbonate
carbonate/config.py
Config.hashing_type
def hashing_type(self, cluster='main'): """Hashing type of cluster.""" if not self.config.has_section(cluster): raise SystemExit("Cluster '%s' not defined in %s" % (cluster, self.config_file)) hashing_type = 'carbon_ch' try: return sel...
python
def hashing_type(self, cluster='main'): """Hashing type of cluster.""" if not self.config.has_section(cluster): raise SystemExit("Cluster '%s' not defined in %s" % (cluster, self.config_file)) hashing_type = 'carbon_ch' try: return sel...
[ "def", "hashing_type", "(", "self", ",", "cluster", "=", "'main'", ")", ":", "if", "not", "self", ".", "config", ".", "has_section", "(", "cluster", ")", ":", "raise", "SystemExit", "(", "\"Cluster '%s' not defined in %s\"", "%", "(", "cluster", ",", "self",...
Hashing type of cluster.
[ "Hashing", "type", "of", "cluster", "." ]
train
https://github.com/graphite-project/carbonate/blob/b876a85b321fbd7c18a6721bed2e7807b79b4929/carbonate/config.py#L56-L65
graphite-project/carbonate
carbonate/fill.py
fill_archives
def fill_archives(src, dst, startFrom, endAt=0, overwrite=False, lock_writes=False): """ Fills gaps in dst using data from src. src is the path as a string dst is the path as a string startFrom is the latest timestamp (archives are read backward) endAt is the earliest timestam...
python
def fill_archives(src, dst, startFrom, endAt=0, overwrite=False, lock_writes=False): """ Fills gaps in dst using data from src. src is the path as a string dst is the path as a string startFrom is the latest timestamp (archives are read backward) endAt is the earliest timestam...
[ "def", "fill_archives", "(", "src", ",", "dst", ",", "startFrom", ",", "endAt", "=", "0", ",", "overwrite", "=", "False", ",", "lock_writes", "=", "False", ")", ":", "if", "lock_writes", "is", "False", ":", "whisper", ".", "LOCK", "=", "False", "elif",...
Fills gaps in dst using data from src. src is the path as a string dst is the path as a string startFrom is the latest timestamp (archives are read backward) endAt is the earliest timestamp (archives are read backward). if absent, we take the earliest timestamp in the archive overwrite wi...
[ "Fills", "gaps", "in", "dst", "using", "data", "from", "src", "." ]
train
https://github.com/graphite-project/carbonate/blob/b876a85b321fbd7c18a6721bed2e7807b79b4929/carbonate/fill.py#L88-L133
graphite-project/carbonate
carbonate/stale.py
data
def data(path, hours, offset=0): """ Does the metric at ``path`` have any whisper data newer than ``hours``? If ``offset`` is not None, view the ``hours`` prior to ``offset`` hours ago, instead of from right now. """ now = time.time() end = now - _to_sec(offset) # Will default to now s...
python
def data(path, hours, offset=0): """ Does the metric at ``path`` have any whisper data newer than ``hours``? If ``offset`` is not None, view the ``hours`` prior to ``offset`` hours ago, instead of from right now. """ now = time.time() end = now - _to_sec(offset) # Will default to now s...
[ "def", "data", "(", "path", ",", "hours", ",", "offset", "=", "0", ")", ":", "now", "=", "time", ".", "time", "(", ")", "end", "=", "now", "-", "_to_sec", "(", "offset", ")", "# Will default to now", "start", "=", "end", "-", "_to_sec", "(", "hours...
Does the metric at ``path`` have any whisper data newer than ``hours``? If ``offset`` is not None, view the ``hours`` prior to ``offset`` hours ago, instead of from right now.
[ "Does", "the", "metric", "at", "path", "have", "any", "whisper", "data", "newer", "than", "hours", "?" ]
train
https://github.com/graphite-project/carbonate/blob/b876a85b321fbd7c18a6721bed2e7807b79b4929/carbonate/stale.py#L11-L22
graphite-project/carbonate
carbonate/stale.py
stat
def stat(path, hours, offset=None): """ Has the metric file at ``path`` been modified since ``hours`` ago? .. note:: ``offset`` is only for compatibility with ``data()`` and is ignored. """ return os.stat(path).st_mtime < (time.time() - _to_sec(hours))
python
def stat(path, hours, offset=None): """ Has the metric file at ``path`` been modified since ``hours`` ago? .. note:: ``offset`` is only for compatibility with ``data()`` and is ignored. """ return os.stat(path).st_mtime < (time.time() - _to_sec(hours))
[ "def", "stat", "(", "path", ",", "hours", ",", "offset", "=", "None", ")", ":", "return", "os", ".", "stat", "(", "path", ")", ".", "st_mtime", "<", "(", "time", ".", "time", "(", ")", "-", "_to_sec", "(", "hours", ")", ")" ]
Has the metric file at ``path`` been modified since ``hours`` ago? .. note:: ``offset`` is only for compatibility with ``data()`` and is ignored.
[ "Has", "the", "metric", "file", "at", "path", "been", "modified", "since", "hours", "ago?" ]
train
https://github.com/graphite-project/carbonate/blob/b876a85b321fbd7c18a6721bed2e7807b79b4929/carbonate/stale.py#L25-L32
holgern/pyedflib
util/refguide_check.py
short_path
def short_path(path, cwd=None): """ Return relative or absolute path name, whichever is shortest. """ if not isinstance(path, str): return path if cwd is None: cwd = os.getcwd() abspath = os.path.abspath(path) relpath = os.path.relpath(path, cwd) if len(abspath) <= len(re...
python
def short_path(path, cwd=None): """ Return relative or absolute path name, whichever is shortest. """ if not isinstance(path, str): return path if cwd is None: cwd = os.getcwd() abspath = os.path.abspath(path) relpath = os.path.relpath(path, cwd) if len(abspath) <= len(re...
[ "def", "short_path", "(", "path", ",", "cwd", "=", "None", ")", ":", "if", "not", "isinstance", "(", "path", ",", "str", ")", ":", "return", "path", "if", "cwd", "is", "None", ":", "cwd", "=", "os", ".", "getcwd", "(", ")", "abspath", "=", "os", ...
Return relative or absolute path name, whichever is shortest.
[ "Return", "relative", "or", "absolute", "path", "name", "whichever", "is", "shortest", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/util/refguide_check.py#L74-L86
holgern/pyedflib
util/refguide_check.py
get_all_dict
def get_all_dict(module): """Return a copy of the __all__ dict with irrelevant items removed.""" if hasattr(module, "__all__"): all_dict = copy.deepcopy(module.__all__) else: all_dict = copy.deepcopy(dir(module)) all_dict = [name for name in all_dict if not name.s...
python
def get_all_dict(module): """Return a copy of the __all__ dict with irrelevant items removed.""" if hasattr(module, "__all__"): all_dict = copy.deepcopy(module.__all__) else: all_dict = copy.deepcopy(dir(module)) all_dict = [name for name in all_dict if not name.s...
[ "def", "get_all_dict", "(", "module", ")", ":", "if", "hasattr", "(", "module", ",", "\"__all__\"", ")", ":", "all_dict", "=", "copy", ".", "deepcopy", "(", "module", ".", "__all__", ")", "else", ":", "all_dict", "=", "copy", ".", "deepcopy", "(", "dir...
Return a copy of the __all__ dict with irrelevant items removed.
[ "Return", "a", "copy", "of", "the", "__all__", "dict", "with", "irrelevant", "items", "removed", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/util/refguide_check.py#L127-L157
holgern/pyedflib
util/refguide_check.py
compare
def compare(all_dict, others, names, module_name): """Return sets of objects only in __all__, refguide, or completely missing.""" only_all = set() for name in all_dict: if name not in names: only_all.add(name) only_ref = set() missing = set() for name in names: if na...
python
def compare(all_dict, others, names, module_name): """Return sets of objects only in __all__, refguide, or completely missing.""" only_all = set() for name in all_dict: if name not in names: only_all.add(name) only_ref = set() missing = set() for name in names: if na...
[ "def", "compare", "(", "all_dict", ",", "others", ",", "names", ",", "module_name", ")", ":", "only_all", "=", "set", "(", ")", "for", "name", "in", "all_dict", ":", "if", "name", "not", "in", "names", ":", "only_all", ".", "add", "(", "name", ")", ...
Return sets of objects only in __all__, refguide, or completely missing.
[ "Return", "sets", "of", "objects", "only", "in", "__all__", "refguide", "or", "completely", "missing", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/util/refguide_check.py#L160-L179
holgern/pyedflib
util/refguide_check.py
check_rest
def check_rest(module, names, dots=True): """ Check reStructuredText formatting of docstrings Returns: [(name, success_flag, output), ...] """ try: skip_types = (dict, str, unicode, float, int) except NameError: # python 3 skip_types = (dict, str, float, int) resul...
python
def check_rest(module, names, dots=True): """ Check reStructuredText formatting of docstrings Returns: [(name, success_flag, output), ...] """ try: skip_types = (dict, str, unicode, float, int) except NameError: # python 3 skip_types = (dict, str, float, int) resul...
[ "def", "check_rest", "(", "module", ",", "names", ",", "dots", "=", "True", ")", ":", "try", ":", "skip_types", "=", "(", "dict", ",", "str", ",", "unicode", ",", "float", ",", "int", ")", "except", "NameError", ":", "# python 3", "skip_types", "=", ...
Check reStructuredText formatting of docstrings Returns: [(name, success_flag, output), ...]
[ "Check", "reStructuredText", "formatting", "of", "docstrings" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/util/refguide_check.py#L310-L372
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.update_header
def update_header(self): """ Updates header to edffile struct """ set_technician(self.handle, du(self.technician)) set_recording_additional(self.handle, du(self.recording_additional)) set_patientname(self.handle, du(self.patient_name)) set_patientcode(self.handle,...
python
def update_header(self): """ Updates header to edffile struct """ set_technician(self.handle, du(self.technician)) set_recording_additional(self.handle, du(self.recording_additional)) set_patientname(self.handle, du(self.patient_name)) set_patientcode(self.handle,...
[ "def", "update_header", "(", "self", ")", ":", "set_technician", "(", "self", ".", "handle", ",", "du", "(", "self", ".", "technician", ")", ")", "set_recording_additional", "(", "self", ".", "handle", ",", "du", "(", "self", ".", "recording_additional", "...
Updates header to edffile struct
[ "Updates", "header", "to", "edffile", "struct" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L137-L175
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.setHeader
def setHeader(self, fileHeader): """ Sets the file header """ self.technician = fileHeader["technician"] self.recording_additional = fileHeader["recording_additional"] self.patient_name = fileHeader["patientname"] self.patient_additional = fileHeader["patient_addi...
python
def setHeader(self, fileHeader): """ Sets the file header """ self.technician = fileHeader["technician"] self.recording_additional = fileHeader["recording_additional"] self.patient_name = fileHeader["patientname"] self.patient_additional = fileHeader["patient_addi...
[ "def", "setHeader", "(", "self", ",", "fileHeader", ")", ":", "self", ".", "technician", "=", "fileHeader", "[", "\"technician\"", "]", "self", ".", "recording_additional", "=", "fileHeader", "[", "\"recording_additional\"", "]", "self", ".", "patient_name", "="...
Sets the file header
[ "Sets", "the", "file", "header" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L177-L191
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.setSignalHeader
def setSignalHeader(self, edfsignal, channel_info): """ Sets the parameter for signal edfsignal. channel_info should be a dict with these values: 'label' : channel label (string, <= 16 characters, must be unique) 'dimension' : physical dimension (e.g., mV) (stri...
python
def setSignalHeader(self, edfsignal, channel_info): """ Sets the parameter for signal edfsignal. channel_info should be a dict with these values: 'label' : channel label (string, <= 16 characters, must be unique) 'dimension' : physical dimension (e.g., mV) (stri...
[ "def", "setSignalHeader", "(", "self", ",", "edfsignal", ",", "channel_info", ")", ":", "if", "edfsignal", "<", "0", "or", "edfsignal", ">", "self", ".", "n_channels", ":", "raise", "ChannelDoesNotExist", "(", "edfsignal", ")", "self", ".", "channels", "[", ...
Sets the parameter for signal edfsignal. channel_info should be a dict with these values: 'label' : channel label (string, <= 16 characters, must be unique) 'dimension' : physical dimension (e.g., mV) (string, <= 8 characters) 'sample_rate' : sample frequency in her...
[ "Sets", "the", "parameter", "for", "signal", "edfsignal", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L193-L211
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.setSignalHeaders
def setSignalHeaders(self, signalHeaders): """ Sets the parameter for all signals Parameters ---------- signalHeaders : array_like containing dict with 'label' : str channel label (string, <= 16 characters, must be unique) ...
python
def setSignalHeaders(self, signalHeaders): """ Sets the parameter for all signals Parameters ---------- signalHeaders : array_like containing dict with 'label' : str channel label (string, <= 16 characters, must be unique) ...
[ "def", "setSignalHeaders", "(", "self", ",", "signalHeaders", ")", ":", "for", "edfsignal", "in", "np", ".", "arange", "(", "self", ".", "n_channels", ")", ":", "self", ".", "channels", "[", "edfsignal", "]", "=", "signalHeaders", "[", "edfsignal", "]", ...
Sets the parameter for all signals Parameters ---------- signalHeaders : array_like containing dict with 'label' : str channel label (string, <= 16 characters, must be unique) 'dimension' : str physi...
[ "Sets", "the", "parameter", "for", "all", "signals" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L213-L238
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.set_number_of_annotation_signals
def set_number_of_annotation_signals(self, number_of_annotations): """ Sets the number of annotation signals. The default value is 1 This function is optional and can be called only after opening a file in writemode and before the first sample write action Normally you don't need...
python
def set_number_of_annotation_signals(self, number_of_annotations): """ Sets the number of annotation signals. The default value is 1 This function is optional and can be called only after opening a file in writemode and before the first sample write action Normally you don't need...
[ "def", "set_number_of_annotation_signals", "(", "self", ",", "number_of_annotations", ")", ":", "number_of_annotations", "=", "max", "(", "(", "min", "(", "(", "int", "(", "number_of_annotations", ")", ",", "64", ")", ")", ",", "1", ")", ")", "self", ".", ...
Sets the number of annotation signals. The default value is 1 This function is optional and can be called only after opening a file in writemode and before the first sample write action Normally you don't need to change the default value. Only when the number of annotations you want to w...
[ "Sets", "the", "number", "of", "annotation", "signals", ".", "The", "default", "value", "is", "1", "This", "function", "is", "optional", "and", "can", "be", "called", "only", "after", "opening", "a", "file", "in", "writemode", "and", "before", "the", "firs...
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L364-L381
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.setStartdatetime
def setStartdatetime(self, recording_start_time): """ Sets the recording start Time Parameters ---------- recording_start_time: datetime object Sets the recording start Time """ if isinstance(recording_start_time,datetime): self.recording_...
python
def setStartdatetime(self, recording_start_time): """ Sets the recording start Time Parameters ---------- recording_start_time: datetime object Sets the recording start Time """ if isinstance(recording_start_time,datetime): self.recording_...
[ "def", "setStartdatetime", "(", "self", ",", "recording_start_time", ")", ":", "if", "isinstance", "(", "recording_start_time", ",", "datetime", ")", ":", "self", ".", "recording_start_time", "=", "recording_start_time", "else", ":", "self", ".", "recording_start_ti...
Sets the recording start Time Parameters ---------- recording_start_time: datetime object Sets the recording start Time
[ "Sets", "the", "recording", "start", "Time" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L383-L396
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.setSamplefrequency
def setSamplefrequency(self, edfsignal, samplefrequency): """ Sets the samplefrequency of signal edfsignal. Notes ----- This function is required for every signal and can be called only after opening a file in writemode and before the first sample write action. """ ...
python
def setSamplefrequency(self, edfsignal, samplefrequency): """ Sets the samplefrequency of signal edfsignal. Notes ----- This function is required for every signal and can be called only after opening a file in writemode and before the first sample write action. """ ...
[ "def", "setSamplefrequency", "(", "self", ",", "edfsignal", ",", "samplefrequency", ")", ":", "if", "edfsignal", "<", "0", "or", "edfsignal", ">", "self", ".", "n_channels", ":", "raise", "ChannelDoesNotExist", "(", "edfsignal", ")", "self", ".", "channels", ...
Sets the samplefrequency of signal edfsignal. Notes ----- This function is required for every signal and can be called only after opening a file in writemode and before the first sample write action.
[ "Sets", "the", "samplefrequency", "of", "signal", "edfsignal", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L421-L432
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.setPhysicalMaximum
def setPhysicalMaximum(self, edfsignal, physical_maximum): """ Sets the physical_maximum of signal edfsignal. Parameters ---------- edfsignal: int signal number physical_maximum: float Sets the physical maximum Notes ----- ...
python
def setPhysicalMaximum(self, edfsignal, physical_maximum): """ Sets the physical_maximum of signal edfsignal. Parameters ---------- edfsignal: int signal number physical_maximum: float Sets the physical maximum Notes ----- ...
[ "def", "setPhysicalMaximum", "(", "self", ",", "edfsignal", ",", "physical_maximum", ")", ":", "if", "edfsignal", "<", "0", "or", "edfsignal", ">", "self", ".", "n_channels", ":", "raise", "ChannelDoesNotExist", "(", "edfsignal", ")", "self", ".", "channels", ...
Sets the physical_maximum of signal edfsignal. Parameters ---------- edfsignal: int signal number physical_maximum: float Sets the physical maximum Notes ----- This function is required for every signal and can be called only after openin...
[ "Sets", "the", "physical_maximum", "of", "signal", "edfsignal", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L434-L452
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.setPhysicalMinimum
def setPhysicalMinimum(self, edfsignal, physical_minimum): """ Sets the physical_minimum of signal edfsignal. Parameters ---------- edfsignal: int signal number physical_minimum: float Sets the physical minimum Notes ----- ...
python
def setPhysicalMinimum(self, edfsignal, physical_minimum): """ Sets the physical_minimum of signal edfsignal. Parameters ---------- edfsignal: int signal number physical_minimum: float Sets the physical minimum Notes ----- ...
[ "def", "setPhysicalMinimum", "(", "self", ",", "edfsignal", ",", "physical_minimum", ")", ":", "if", "(", "edfsignal", "<", "0", "or", "edfsignal", ">", "self", ".", "n_channels", ")", ":", "raise", "ChannelDoesNotExist", "(", "edfsignal", ")", "self", ".", ...
Sets the physical_minimum of signal edfsignal. Parameters ---------- edfsignal: int signal number physical_minimum: float Sets the physical minimum Notes ----- This function is required for every signal and can be called only after openin...
[ "Sets", "the", "physical_minimum", "of", "signal", "edfsignal", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L454-L472
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.setDigitalMaximum
def setDigitalMaximum(self, edfsignal, digital_maximum): """ Sets the samplefrequency of signal edfsignal. Usually, the value 32767 is used for EDF+ and 8388607 for BDF+. Parameters ---------- edfsignal : int signal number digital_maximum : int ...
python
def setDigitalMaximum(self, edfsignal, digital_maximum): """ Sets the samplefrequency of signal edfsignal. Usually, the value 32767 is used for EDF+ and 8388607 for BDF+. Parameters ---------- edfsignal : int signal number digital_maximum : int ...
[ "def", "setDigitalMaximum", "(", "self", ",", "edfsignal", ",", "digital_maximum", ")", ":", "if", "(", "edfsignal", "<", "0", "or", "edfsignal", ">", "self", ".", "n_channels", ")", ":", "raise", "ChannelDoesNotExist", "(", "edfsignal", ")", "self", ".", ...
Sets the samplefrequency of signal edfsignal. Usually, the value 32767 is used for EDF+ and 8388607 for BDF+. Parameters ---------- edfsignal : int signal number digital_maximum : int Sets the maximum digital value Notes ----- Thi...
[ "Sets", "the", "samplefrequency", "of", "signal", "edfsignal", ".", "Usually", "the", "value", "32767", "is", "used", "for", "EDF", "+", "and", "8388607", "for", "BDF", "+", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L474-L493
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.setDigitalMinimum
def setDigitalMinimum(self, edfsignal, digital_minimum): """ Sets the minimum digital value of signal edfsignal. Usually, the value -32768 is used for EDF+ and -8388608 for BDF+. Usually this will be (-(digital_maximum + 1)). Parameters ---------- edfsignal : int ...
python
def setDigitalMinimum(self, edfsignal, digital_minimum): """ Sets the minimum digital value of signal edfsignal. Usually, the value -32768 is used for EDF+ and -8388608 for BDF+. Usually this will be (-(digital_maximum + 1)). Parameters ---------- edfsignal : int ...
[ "def", "setDigitalMinimum", "(", "self", ",", "edfsignal", ",", "digital_minimum", ")", ":", "if", "(", "edfsignal", "<", "0", "or", "edfsignal", ">", "self", ".", "n_channels", ")", ":", "raise", "ChannelDoesNotExist", "(", "edfsignal", ")", "self", ".", ...
Sets the minimum digital value of signal edfsignal. Usually, the value -32768 is used for EDF+ and -8388608 for BDF+. Usually this will be (-(digital_maximum + 1)). Parameters ---------- edfsignal : int signal number digital_minimum : int Sets the minimum...
[ "Sets", "the", "minimum", "digital", "value", "of", "signal", "edfsignal", ".", "Usually", "the", "value", "-", "32768", "is", "used", "for", "EDF", "+", "and", "-", "8388608", "for", "BDF", "+", ".", "Usually", "this", "will", "be", "(", "-", "(", "...
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L495-L514
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.setLabel
def setLabel(self, edfsignal, label): """ Sets the label (name) of signal edfsignal ("FP1", "SaO2", etc.). Parameters ---------- edfsignal : int signal number on which the label should be changed label : str signal label Notes ---...
python
def setLabel(self, edfsignal, label): """ Sets the label (name) of signal edfsignal ("FP1", "SaO2", etc.). Parameters ---------- edfsignal : int signal number on which the label should be changed label : str signal label Notes ---...
[ "def", "setLabel", "(", "self", ",", "edfsignal", ",", "label", ")", ":", "if", "(", "edfsignal", "<", "0", "or", "edfsignal", ">", "self", ".", "n_channels", ")", ":", "raise", "ChannelDoesNotExist", "(", "edfsignal", ")", "self", ".", "channels", "[", ...
Sets the label (name) of signal edfsignal ("FP1", "SaO2", etc.). Parameters ---------- edfsignal : int signal number on which the label should be changed label : str signal label Notes ----- This function is recommended for every signal a...
[ "Sets", "the", "label", "(", "name", ")", "of", "signal", "edfsignal", "(", "FP1", "SaO2", "etc", ".", ")", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L516-L534
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.setPhysicalDimension
def setPhysicalDimension(self, edfsignal, physical_dimension): """ Sets the physical dimension of signal edfsignal ("uV", "BPM", "mA", "Degr.", etc.) :param edfsignal: int :param physical_dimension: str Notes ----- This function is recommended for every signal a...
python
def setPhysicalDimension(self, edfsignal, physical_dimension): """ Sets the physical dimension of signal edfsignal ("uV", "BPM", "mA", "Degr.", etc.) :param edfsignal: int :param physical_dimension: str Notes ----- This function is recommended for every signal a...
[ "def", "setPhysicalDimension", "(", "self", ",", "edfsignal", ",", "physical_dimension", ")", ":", "if", "edfsignal", "<", "0", "or", "edfsignal", ">", "self", ".", "n_channels", ":", "raise", "ChannelDoesNotExist", "(", "edfsignal", ")", "self", ".", "channel...
Sets the physical dimension of signal edfsignal ("uV", "BPM", "mA", "Degr.", etc.) :param edfsignal: int :param physical_dimension: str Notes ----- This function is recommended for every signal and can be called only after opening a file in writemode and before the first sample...
[ "Sets", "the", "physical", "dimension", "of", "signal", "edfsignal", "(", "uV", "BPM", "mA", "Degr", ".", "etc", ".", ")" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L536-L550
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.setTransducer
def setTransducer(self, edfsignal, transducer): """ Sets the transducer of signal edfsignal :param edfsignal: int :param transducer: str Notes ----- This function is optional for every signal and can be called only after opening a file in writemode and before th...
python
def setTransducer(self, edfsignal, transducer): """ Sets the transducer of signal edfsignal :param edfsignal: int :param transducer: str Notes ----- This function is optional for every signal and can be called only after opening a file in writemode and before th...
[ "def", "setTransducer", "(", "self", ",", "edfsignal", ",", "transducer", ")", ":", "if", "(", "edfsignal", "<", "0", "or", "edfsignal", ">", "self", ".", "n_channels", ")", ":", "raise", "ChannelDoesNotExist", "(", "edfsignal", ")", "self", ".", "channels...
Sets the transducer of signal edfsignal :param edfsignal: int :param transducer: str Notes ----- This function is optional for every signal and can be called only after opening a file in writemode and before the first sample write action.
[ "Sets", "the", "transducer", "of", "signal", "edfsignal" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L552-L566
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.setPrefilter
def setPrefilter(self, edfsignal, prefilter): """ Sets the prefilter of signal edfsignal ("HP:0.1Hz", "LP:75Hz N:50Hz", etc.) :param edfsignal: int :param prefilter: str Notes ----- This function is optional for every signal and can be called only after opening ...
python
def setPrefilter(self, edfsignal, prefilter): """ Sets the prefilter of signal edfsignal ("HP:0.1Hz", "LP:75Hz N:50Hz", etc.) :param edfsignal: int :param prefilter: str Notes ----- This function is optional for every signal and can be called only after opening ...
[ "def", "setPrefilter", "(", "self", ",", "edfsignal", ",", "prefilter", ")", ":", "if", "edfsignal", "<", "0", "or", "edfsignal", ">", "self", ".", "n_channels", ":", "raise", "ChannelDoesNotExist", "(", "edfsignal", ")", "self", ".", "channels", "[", "edf...
Sets the prefilter of signal edfsignal ("HP:0.1Hz", "LP:75Hz N:50Hz", etc.) :param edfsignal: int :param prefilter: str Notes ----- This function is optional for every signal and can be called only after opening a file in writemode and before the first sample write action.
[ "Sets", "the", "prefilter", "of", "signal", "edfsignal", "(", "HP", ":", "0", ".", "1Hz", "LP", ":", "75Hz", "N", ":", "50Hz", "etc", ".", ")" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L568-L582
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.writeSamples
def writeSamples(self, data_list, digital = False): """ Writes physical samples (uV, mA, Ohm) from data belonging to all signals The physical samples will be converted to digital samples using the values of physical maximum, physical minimum, digital maximum and digital minimum. ...
python
def writeSamples(self, data_list, digital = False): """ Writes physical samples (uV, mA, Ohm) from data belonging to all signals The physical samples will be converted to digital samples using the values of physical maximum, physical minimum, digital maximum and digital minimum. ...
[ "def", "writeSamples", "(", "self", ",", "data_list", ",", "digital", "=", "False", ")", ":", "if", "(", "len", "(", "data_list", ")", "!=", "len", "(", "self", ".", "channels", ")", ")", ":", "raise", "WrongInputSize", "(", "len", "(", "data_list", ...
Writes physical samples (uV, mA, Ohm) from data belonging to all signals The physical samples will be converted to digital samples using the values of physical maximum, physical minimum, digital maximum and digital minimum. if the samplefrequency of all signals are equal, then the data could be ...
[ "Writes", "physical", "samples", "(", "uV", "mA", "Ohm", ")", "from", "data", "belonging", "to", "all", "signals", "The", "physical", "samples", "will", "be", "converted", "to", "digital", "samples", "using", "the", "values", "of", "physical", "maximum", "ph...
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L639-L711
holgern/pyedflib
pyedflib/edfwriter.py
EdfWriter.writeAnnotation
def writeAnnotation(self, onset_in_seconds, duration_in_seconds, description, str_format='utf-8'): """ Writes an annotation/event to the file """ if str_format == 'utf-8': if duration_in_seconds >= 0: return write_annotation_utf8(self.handle, np.round(onset_in...
python
def writeAnnotation(self, onset_in_seconds, duration_in_seconds, description, str_format='utf-8'): """ Writes an annotation/event to the file """ if str_format == 'utf-8': if duration_in_seconds >= 0: return write_annotation_utf8(self.handle, np.round(onset_in...
[ "def", "writeAnnotation", "(", "self", ",", "onset_in_seconds", ",", "duration_in_seconds", ",", "description", ",", "str_format", "=", "'utf-8'", ")", ":", "if", "str_format", "==", "'utf-8'", ":", "if", "duration_in_seconds", ">=", "0", ":", "return", "write_a...
Writes an annotation/event to the file
[ "Writes", "an", "annotation", "/", "event", "to", "the", "file" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L714-L727
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.readAnnotations
def readAnnotations(self): """ Annotations from a edf-file Parameters ---------- None """ annot = self.read_annotation() annot = np.array(annot) if (annot.shape[0] == 0): return np.array([]), np.array([]), np.array([]) ann_time...
python
def readAnnotations(self): """ Annotations from a edf-file Parameters ---------- None """ annot = self.read_annotation() annot = np.array(annot) if (annot.shape[0] == 0): return np.array([]), np.array([]), np.array([]) ann_time...
[ "def", "readAnnotations", "(", "self", ")", ":", "annot", "=", "self", ".", "read_annotation", "(", ")", "annot", "=", "np", ".", "array", "(", "annot", ")", "if", "(", "annot", ".", "shape", "[", "0", "]", "==", "0", ")", ":", "return", "np", "....
Annotations from a edf-file Parameters ---------- None
[ "Annotations", "from", "a", "edf", "-", "file" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L44-L64
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getHeader
def getHeader(self): """ Returns the file header as dict Parameters ---------- None """ return {"technician": self.getTechnician(), "recording_additional": self.getRecordingAdditional(), "patientname": self.getPatientName(), "patient_additional": ...
python
def getHeader(self): """ Returns the file header as dict Parameters ---------- None """ return {"technician": self.getTechnician(), "recording_additional": self.getRecordingAdditional(), "patientname": self.getPatientName(), "patient_additional": ...
[ "def", "getHeader", "(", "self", ")", ":", "return", "{", "\"technician\"", ":", "self", ".", "getTechnician", "(", ")", ",", "\"recording_additional\"", ":", "self", ".", "getRecordingAdditional", "(", ")", ",", "\"patientname\"", ":", "self", ".", "getPatien...
Returns the file header as dict Parameters ---------- None
[ "Returns", "the", "file", "header", "as", "dict" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L92-L104
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getSignalHeader
def getSignalHeader(self, chn): """ Returns the header of one signal as dicts Parameters ---------- None """ return {'label': self.getLabel(chn), 'dimension': self.getPhysicalDimension(chn), 'sample_rate': self.g...
python
def getSignalHeader(self, chn): """ Returns the header of one signal as dicts Parameters ---------- None """ return {'label': self.getLabel(chn), 'dimension': self.getPhysicalDimension(chn), 'sample_rate': self.g...
[ "def", "getSignalHeader", "(", "self", ",", "chn", ")", ":", "return", "{", "'label'", ":", "self", ".", "getLabel", "(", "chn", ")", ",", "'dimension'", ":", "self", ".", "getPhysicalDimension", "(", "chn", ")", ",", "'sample_rate'", ":", "self", ".", ...
Returns the header of one signal as dicts Parameters ---------- None
[ "Returns", "the", "header", "of", "one", "signal", "as", "dicts" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L106-L122
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getSignalHeaders
def getSignalHeaders(self): """ Returns the header of all signals as array of dicts Parameters ---------- None """ signalHeader = [] for chn in np.arange(self.signals_in_file): signalHeader.append(self.getSignalHeader(chn)) return sig...
python
def getSignalHeaders(self): """ Returns the header of all signals as array of dicts Parameters ---------- None """ signalHeader = [] for chn in np.arange(self.signals_in_file): signalHeader.append(self.getSignalHeader(chn)) return sig...
[ "def", "getSignalHeaders", "(", "self", ")", ":", "signalHeader", "=", "[", "]", "for", "chn", "in", "np", ".", "arange", "(", "self", ".", "signals_in_file", ")", ":", "signalHeader", ".", "append", "(", "self", ".", "getSignalHeader", "(", "chn", ")", ...
Returns the header of all signals as array of dicts Parameters ---------- None
[ "Returns", "the", "header", "of", "all", "signals", "as", "array", "of", "dicts" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L124-L135
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getStartdatetime
def getStartdatetime(self): """ Returns the date and starttime as datetime object Parameters ---------- None Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getStartdatetime() datetime.datetime(2...
python
def getStartdatetime(self): """ Returns the date and starttime as datetime object Parameters ---------- None Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getStartdatetime() datetime.datetime(2...
[ "def", "getStartdatetime", "(", "self", ")", ":", "return", "datetime", "(", "self", ".", "startdate_year", ",", "self", ".", "startdate_month", ",", "self", ".", "startdate_day", ",", "self", ".", "starttime_hour", ",", "self", ".", "starttime_minute", ",", ...
Returns the date and starttime as datetime object Parameters ---------- None Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getStartdatetime() datetime.datetime(2011, 4, 4, 12, 57, 2) >>> f._close() ...
[ "Returns", "the", "date", "and", "starttime", "as", "datetime", "object" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L317-L336
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getBirthdate
def getBirthdate(self, string=True): """ Returns the birthdate as string object Parameters ---------- None Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getBirthdate()=='30 jun 1969' True ...
python
def getBirthdate(self, string=True): """ Returns the birthdate as string object Parameters ---------- None Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getBirthdate()=='30 jun 1969' True ...
[ "def", "getBirthdate", "(", "self", ",", "string", "=", "True", ")", ":", "if", "string", ":", "return", "self", ".", "_convert_string", "(", "self", ".", "birthdate", ".", "rstrip", "(", ")", ")", "else", ":", "return", "datetime", ".", "strptime", "(...
Returns the birthdate as string object Parameters ---------- None Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getBirthdate()=='30 jun 1969' True >>> f._close() >>> del f
[ "Returns", "the", "birthdate", "as", "string", "object" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L338-L360
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getSampleFrequencies
def getSampleFrequencies(self): """ Returns samplefrequencies of all signals. Parameters ---------- None Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> all(f.getSampleFrequencies()==200.0) True ...
python
def getSampleFrequencies(self): """ Returns samplefrequencies of all signals. Parameters ---------- None Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> all(f.getSampleFrequencies()==200.0) True ...
[ "def", "getSampleFrequencies", "(", "self", ")", ":", "return", "np", ".", "array", "(", "[", "round", "(", "self", ".", "samplefrequency", "(", "chn", ")", ")", "for", "chn", "in", "np", ".", "arange", "(", "self", ".", "signals_in_file", ")", "]", ...
Returns samplefrequencies of all signals. Parameters ---------- None Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> all(f.getSampleFrequencies()==200.0) True >>> f._close() >>> del f
[ "Returns", "samplefrequencies", "of", "all", "signals", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L362-L381
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getSampleFrequency
def getSampleFrequency(self,chn): """ Returns the samplefrequency of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getSample...
python
def getSampleFrequency(self,chn): """ Returns the samplefrequency of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getSample...
[ "def", "getSampleFrequency", "(", "self", ",", "chn", ")", ":", "if", "0", "<=", "chn", "<", "self", ".", "signals_in_file", ":", "return", "round", "(", "self", ".", "samplefrequency", "(", "chn", ")", ")", "else", ":", "return", "0" ]
Returns the samplefrequency of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getSampleFrequency(0)==200.0 True >>> f._close(...
[ "Returns", "the", "samplefrequency", "of", "signal", "edfsignal", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L383-L405
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getSignalLabels
def getSignalLabels(self): """ Returns all labels (name) ("FP1", "SaO2", etc.). Parameters ---------- None Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getSignalLabels()==['squarewave', 'ramp', 'pulse...
python
def getSignalLabels(self): """ Returns all labels (name) ("FP1", "SaO2", etc.). Parameters ---------- None Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getSignalLabels()==['squarewave', 'ramp', 'pulse...
[ "def", "getSignalLabels", "(", "self", ")", ":", "return", "[", "self", ".", "_convert_string", "(", "self", ".", "signal_label", "(", "chn", ")", ".", "strip", "(", ")", ")", "for", "chn", "in", "np", ".", "arange", "(", "self", ".", "signals_in_file"...
Returns all labels (name) ("FP1", "SaO2", etc.). Parameters ---------- None Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getSignalLabels()==['squarewave', 'ramp', 'pulse', 'noise', 'sine 1 Hz', 'sine 8 Hz', 'sine 8.1...
[ "Returns", "all", "labels", "(", "name", ")", "(", "FP1", "SaO2", "etc", ".", ")", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L407-L426
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getLabel
def getLabel(self,chn): """ Returns the label (name) of signal chn ("FP1", "SaO2", etc.). Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getLab...
python
def getLabel(self,chn): """ Returns the label (name) of signal chn ("FP1", "SaO2", etc.). Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getLab...
[ "def", "getLabel", "(", "self", ",", "chn", ")", ":", "if", "0", "<=", "chn", "<", "self", ".", "signals_in_file", ":", "return", "self", ".", "_convert_string", "(", "self", ".", "signal_label", "(", "chn", ")", ".", "rstrip", "(", ")", ")", "else",...
Returns the label (name) of signal chn ("FP1", "SaO2", etc.). Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getLabel(0)=='squarewave' True >>>...
[ "Returns", "the", "label", "(", "name", ")", "of", "signal", "chn", "(", "FP1", "SaO2", "etc", ".", ")", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L428-L450
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getPrefilter
def getPrefilter(self,chn): """ Returns the prefilter of signal chn ("HP:0.1Hz", "LP:75Hz N:50Hz", etc.) Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() ...
python
def getPrefilter(self,chn): """ Returns the prefilter of signal chn ("HP:0.1Hz", "LP:75Hz N:50Hz", etc.) Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() ...
[ "def", "getPrefilter", "(", "self", ",", "chn", ")", ":", "if", "0", "<=", "chn", "<", "self", ".", "signals_in_file", ":", "return", "self", ".", "_convert_string", "(", "self", ".", "prefilter", "(", "chn", ")", ".", "rstrip", "(", ")", ")", "else"...
Returns the prefilter of signal chn ("HP:0.1Hz", "LP:75Hz N:50Hz", etc.) Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getPrefilter(0)=='' True ...
[ "Returns", "the", "prefilter", "of", "signal", "chn", "(", "HP", ":", "0", ".", "1Hz", "LP", ":", "75Hz", "N", ":", "50Hz", "etc", ".", ")" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L452-L474
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getPhysicalMaximum
def getPhysicalMaximum(self,chn=None): """ Returns the maximum physical value of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>>...
python
def getPhysicalMaximum(self,chn=None): """ Returns the maximum physical value of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>>...
[ "def", "getPhysicalMaximum", "(", "self", ",", "chn", "=", "None", ")", ":", "if", "chn", "is", "not", "None", ":", "if", "0", "<=", "chn", "<", "self", ".", "signals_in_file", ":", "return", "self", ".", "physical_max", "(", "chn", ")", "else", ":",...
Returns the maximum physical value of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getPhysicalMaximum(0)==1000.0 True >>> f...
[ "Returns", "the", "maximum", "physical", "value", "of", "signal", "edfsignal", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L476-L504
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getPhysicalMinimum
def getPhysicalMinimum(self,chn=None): """ Returns the minimum physical value of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>>...
python
def getPhysicalMinimum(self,chn=None): """ Returns the minimum physical value of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>>...
[ "def", "getPhysicalMinimum", "(", "self", ",", "chn", "=", "None", ")", ":", "if", "chn", "is", "not", "None", ":", "if", "0", "<=", "chn", "<", "self", ".", "signals_in_file", ":", "return", "self", ".", "physical_min", "(", "chn", ")", "else", ":",...
Returns the minimum physical value of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getPhysicalMinimum(0)==-1000.0 True >>> ...
[ "Returns", "the", "minimum", "physical", "value", "of", "signal", "edfsignal", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L506-L534
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getDigitalMaximum
def getDigitalMaximum(self, chn=None): """ Returns the maximum digital value of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> ...
python
def getDigitalMaximum(self, chn=None): """ Returns the maximum digital value of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> ...
[ "def", "getDigitalMaximum", "(", "self", ",", "chn", "=", "None", ")", ":", "if", "chn", "is", "not", "None", ":", "if", "0", "<=", "chn", "<", "self", ".", "signals_in_file", ":", "return", "self", ".", "digital_max", "(", "chn", ")", "else", ":", ...
Returns the maximum digital value of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getDigitalMaximum(0) 32767 >>> f._close()...
[ "Returns", "the", "maximum", "digital", "value", "of", "signal", "edfsignal", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L536-L564
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getDigitalMinimum
def getDigitalMinimum(self, chn=None): """ Returns the minimum digital value of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> ...
python
def getDigitalMinimum(self, chn=None): """ Returns the minimum digital value of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> ...
[ "def", "getDigitalMinimum", "(", "self", ",", "chn", "=", "None", ")", ":", "if", "chn", "is", "not", "None", ":", "if", "0", "<=", "chn", "<", "self", ".", "signals_in_file", ":", "return", "self", ".", "digital_min", "(", "chn", ")", "else", ":", ...
Returns the minimum digital value of signal edfsignal. Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getDigitalMinimum(0) -32768 >>> f._close(...
[ "Returns", "the", "minimum", "digital", "value", "of", "signal", "edfsignal", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L566-L594
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getTransducer
def getTransducer(self, chn): """ Returns the transducer of signal chn ("AgAgCl cup electrodes", etc.). Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() ...
python
def getTransducer(self, chn): """ Returns the transducer of signal chn ("AgAgCl cup electrodes", etc.). Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() ...
[ "def", "getTransducer", "(", "self", ",", "chn", ")", ":", "if", "0", "<=", "chn", "<", "self", ".", "signals_in_file", ":", "return", "self", ".", "_convert_string", "(", "self", ".", "transducer", "(", "chn", ")", ".", "rstrip", "(", ")", ")", "els...
Returns the transducer of signal chn ("AgAgCl cup electrodes", etc.). Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getTransducer(0)=='' True ...
[ "Returns", "the", "transducer", "of", "signal", "chn", "(", "AgAgCl", "cup", "electrodes", "etc", ".", ")", "." ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L596-L618
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.getPhysicalDimension
def getPhysicalDimension(self, chn): """ Returns the physical dimension of signal edfsignal ("uV", "BPM", "mA", "Degr.", etc.) Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data....
python
def getPhysicalDimension(self, chn): """ Returns the physical dimension of signal edfsignal ("uV", "BPM", "mA", "Degr.", etc.) Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data....
[ "def", "getPhysicalDimension", "(", "self", ",", "chn", ")", ":", "if", "0", "<=", "chn", "<", "self", ".", "signals_in_file", ":", "return", "self", ".", "_convert_string", "(", "self", ".", "physical_dimension", "(", "chn", ")", ".", "rstrip", "(", ")"...
Returns the physical dimension of signal edfsignal ("uV", "BPM", "mA", "Degr.", etc.) Parameters ---------- chn : int channel number Examples -------- >>> import pyedflib >>> f = pyedflib.data.test_generator() >>> f.getPhysicalDimension(0)=='...
[ "Returns", "the", "physical", "dimension", "of", "signal", "edfsignal", "(", "uV", "BPM", "mA", "Degr", ".", "etc", ".", ")" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L620-L642
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.readSignal
def readSignal(self, chn, start=0, n=None): """ Returns the physical data of signal chn. When start and n is set, a subset is returned Parameters ---------- chn : int channel number start : int start pointer (default is 0) n : int ...
python
def readSignal(self, chn, start=0, n=None): """ Returns the physical data of signal chn. When start and n is set, a subset is returned Parameters ---------- chn : int channel number start : int start pointer (default is 0) n : int ...
[ "def", "readSignal", "(", "self", ",", "chn", ",", "start", "=", "0", ",", "n", "=", "None", ")", ":", "if", "start", "<", "0", ":", "return", "np", ".", "array", "(", "[", "]", ")", "if", "n", "is", "not", "None", "and", "n", "<", "0", ":"...
Returns the physical data of signal chn. When start and n is set, a subset is returned Parameters ---------- chn : int channel number start : int start pointer (default is 0) n : int length of data to read (default is None, by which the comple...
[ "Returns", "the", "physical", "data", "of", "signal", "chn", ".", "When", "start", "and", "n", "is", "set", "a", "subset", "is", "returned" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L644-L685
holgern/pyedflib
pyedflib/edfreader.py
EdfReader.file_info_long
def file_info_long(self): """ Returns information about the opened EDF/BDF file """ self.file_info() for ii in np.arange(self.signals_in_file): print("label:", self.getSignalLabels()[ii], "fs:", self.getSampleFrequencies()[ii], "nsamples", ...
python
def file_info_long(self): """ Returns information about the opened EDF/BDF file """ self.file_info() for ii in np.arange(self.signals_in_file): print("label:", self.getSignalLabels()[ii], "fs:", self.getSampleFrequencies()[ii], "nsamples", ...
[ "def", "file_info_long", "(", "self", ")", ":", "self", ".", "file_info", "(", ")", "for", "ii", "in", "np", ".", "arange", "(", "self", ".", "signals_in_file", ")", ":", "print", "(", "\"label:\"", ",", "self", ".", "getSignalLabels", "(", ")", "[", ...
Returns information about the opened EDF/BDF file
[ "Returns", "information", "about", "the", "opened", "EDF", "/", "BDF", "file" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfreader.py#L691-L699
holgern/pyedflib
demo/stacklineplot.py
stackplot
def stackplot(marray, seconds=None, start_time=None, ylabels=None): """ will plot a stack of traces one above the other assuming marray.shape = numRows, numSamples """ tarray = np.transpose(marray) stackplot_t(tarray, seconds=seconds, start_time=start_time, ylabels=ylabels) plt.show()
python
def stackplot(marray, seconds=None, start_time=None, ylabels=None): """ will plot a stack of traces one above the other assuming marray.shape = numRows, numSamples """ tarray = np.transpose(marray) stackplot_t(tarray, seconds=seconds, start_time=start_time, ylabels=ylabels) plt.show()
[ "def", "stackplot", "(", "marray", ",", "seconds", "=", "None", ",", "start_time", "=", "None", ",", "ylabels", "=", "None", ")", ":", "tarray", "=", "np", ".", "transpose", "(", "marray", ")", "stackplot_t", "(", "tarray", ",", "seconds", "=", "second...
will plot a stack of traces one above the other assuming marray.shape = numRows, numSamples
[ "will", "plot", "a", "stack", "of", "traces", "one", "above", "the", "other", "assuming", "marray", ".", "shape", "=", "numRows", "numSamples" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/demo/stacklineplot.py#L10-L17
holgern/pyedflib
demo/stacklineplot.py
stackplot_t
def stackplot_t(tarray, seconds=None, start_time=None, ylabels=None): """ will plot a stack of traces one above the other assuming tarray.shape = numSamples, numRows """ data = tarray numSamples, numRows = tarray.shape # data = np.random.randn(numSamples,numRows) # test data # data.shape = numS...
python
def stackplot_t(tarray, seconds=None, start_time=None, ylabels=None): """ will plot a stack of traces one above the other assuming tarray.shape = numSamples, numRows """ data = tarray numSamples, numRows = tarray.shape # data = np.random.randn(numSamples,numRows) # test data # data.shape = numS...
[ "def", "stackplot_t", "(", "tarray", ",", "seconds", "=", "None", ",", "start_time", "=", "None", ",", "ylabels", "=", "None", ")", ":", "data", "=", "tarray", "numSamples", ",", "numRows", "=", "tarray", ".", "shape", "# data = np.random.randn(numSamples,numR...
will plot a stack of traces one above the other assuming tarray.shape = numSamples, numRows
[ "will", "plot", "a", "stack", "of", "traces", "one", "above", "the", "other", "assuming", "tarray", ".", "shape", "=", "numSamples", "numRows" ]
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/demo/stacklineplot.py#L20-L76
ansibleplaybookbundle/ansible-playbook-bundle
src/apb/cli.py
subcmd_list_parser
def subcmd_list_parser(subcmd): """ list subcommand """ subcmd.add_argument( '--broker', action='store', dest='broker', help=u'Route to the Ansible Service Broker' ) subcmd.add_argument( '--secure', action='store_true', dest='verify', help=...
python
def subcmd_list_parser(subcmd): """ list subcommand """ subcmd.add_argument( '--broker', action='store', dest='broker', help=u'Route to the Ansible Service Broker' ) subcmd.add_argument( '--secure', action='store_true', dest='verify', help=...
[ "def", "subcmd_list_parser", "(", "subcmd", ")", ":", "subcmd", ".", "add_argument", "(", "'--broker'", ",", "action", "=", "'store'", ",", "dest", "=", "'broker'", ",", "help", "=", "u'Route to the Ansible Service Broker'", ")", "subcmd", ".", "add_argument", "...
list subcommand
[ "list", "subcommand" ]
train
https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/blob/585694be9b417f1a88354cbfe286bfd68c2c9494/src/apb/cli.py#L30-L85
ansibleplaybookbundle/ansible-playbook-bundle
src/apb/cli.py
subcmd_build_parser
def subcmd_build_parser(subcmd): """ build subcommand """ subcmd.add_argument( '--tag', action='store', dest='tag', help=u'Tag of APB to build (ie. mysql-apb or docker.io/username/mysql-apb)' ) subcmd.add_argument( '--dockerfile', '-f', action='st...
python
def subcmd_build_parser(subcmd): """ build subcommand """ subcmd.add_argument( '--tag', action='store', dest='tag', help=u'Tag of APB to build (ie. mysql-apb or docker.io/username/mysql-apb)' ) subcmd.add_argument( '--dockerfile', '-f', action='st...
[ "def", "subcmd_build_parser", "(", "subcmd", ")", ":", "subcmd", ".", "add_argument", "(", "'--tag'", ",", "action", "=", "'store'", ",", "dest", "=", "'tag'", ",", "help", "=", "u'Tag of APB to build (ie. mysql-apb or docker.io/username/mysql-apb)'", ")", "subcmd", ...
build subcommand
[ "build", "subcommand" ]
train
https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/blob/585694be9b417f1a88354cbfe286bfd68c2c9494/src/apb/cli.py#L88-L105
ansibleplaybookbundle/ansible-playbook-bundle
src/apb/cli.py
subcmd_init_parser
def subcmd_init_parser(subcmd): """ init subcommand """ subcmd.add_argument( 'tag', action='store', help=u'Tag (org/name) or name of APB to initialize' ) subcmd.add_argument( '--force', action='store_true', dest='force', help=u'Force re-init on cu...
python
def subcmd_init_parser(subcmd): """ init subcommand """ subcmd.add_argument( 'tag', action='store', help=u'Tag (org/name) or name of APB to initialize' ) subcmd.add_argument( '--force', action='store_true', dest='force', help=u'Force re-init on cu...
[ "def", "subcmd_init_parser", "(", "subcmd", ")", ":", "subcmd", ".", "add_argument", "(", "'tag'", ",", "action", "=", "'store'", ",", "help", "=", "u'Tag (org/name) or name of APB to initialize'", ")", "subcmd", ".", "add_argument", "(", "'--force'", ",", "action...
init subcommand
[ "init", "subcommand" ]
train
https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/blob/585694be9b417f1a88354cbfe286bfd68c2c9494/src/apb/cli.py#L108-L165
ansibleplaybookbundle/ansible-playbook-bundle
src/apb/cli.py
subcmd_prepare_parser
def subcmd_prepare_parser(subcmd): """ prepare subcommand """ subcmd.add_argument( '--provider', action='store', dest='provider', help=u'Targeted cluster type', choices=['openshift', 'kubernetes'], default='openshift' ) subcmd.add_argument( '--doc...
python
def subcmd_prepare_parser(subcmd): """ prepare subcommand """ subcmd.add_argument( '--provider', action='store', dest='provider', help=u'Targeted cluster type', choices=['openshift', 'kubernetes'], default='openshift' ) subcmd.add_argument( '--doc...
[ "def", "subcmd_prepare_parser", "(", "subcmd", ")", ":", "subcmd", ".", "add_argument", "(", "'--provider'", ",", "action", "=", "'store'", ",", "dest", "=", "'provider'", ",", "help", "=", "u'Targeted cluster type'", ",", "choices", "=", "[", "'openshift'", "...
prepare subcommand
[ "prepare", "subcommand" ]
train
https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/blob/585694be9b417f1a88354cbfe286bfd68c2c9494/src/apb/cli.py#L168-L187
ansibleplaybookbundle/ansible-playbook-bundle
src/apb/cli.py
subcmd_push_parser
def subcmd_push_parser(subcmd): """ push subcommand """ subcmd.add_argument( '--broker', action='store', dest='broker', help=u'Route to the Ansible Service Broker' ) subcmd.add_argument( '--registry-service-name', action='store', dest='reg_svc_name...
python
def subcmd_push_parser(subcmd): """ push subcommand """ subcmd.add_argument( '--broker', action='store', dest='broker', help=u'Route to the Ansible Service Broker' ) subcmd.add_argument( '--registry-service-name', action='store', dest='reg_svc_name...
[ "def", "subcmd_push_parser", "(", "subcmd", ")", ":", "subcmd", ".", "add_argument", "(", "'--broker'", ",", "action", "=", "'store'", ",", "dest", "=", "'broker'", ",", "help", "=", "u'Route to the Ansible Service Broker'", ")", "subcmd", ".", "add_argument", "...
push subcommand
[ "push", "subcommand" ]
train
https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/blob/585694be9b417f1a88354cbfe286bfd68c2c9494/src/apb/cli.py#L190-L284
ansibleplaybookbundle/ansible-playbook-bundle
src/apb/cli.py
subcmd_remove_parser
def subcmd_remove_parser(subcmd): """ remove subcommand """ subcmd.add_argument( '--broker', action='store', dest='broker', help=u'Route to the Ansible Service Broker' ) subcmd.add_argument( '--local', '-l', action='store_true', dest='local', ...
python
def subcmd_remove_parser(subcmd): """ remove subcommand """ subcmd.add_argument( '--broker', action='store', dest='broker', help=u'Route to the Ansible Service Broker' ) subcmd.add_argument( '--local', '-l', action='store_true', dest='local', ...
[ "def", "subcmd_remove_parser", "(", "subcmd", ")", ":", "subcmd", ".", "add_argument", "(", "'--broker'", ",", "action", "=", "'store'", ",", "dest", "=", "'broker'", ",", "help", "=", "u'Route to the Ansible Service Broker'", ")", "subcmd", ".", "add_argument", ...
remove subcommand
[ "remove", "subcommand" ]
train
https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/blob/585694be9b417f1a88354cbfe286bfd68c2c9494/src/apb/cli.py#L287-L359
ansibleplaybookbundle/ansible-playbook-bundle
src/apb/cli.py
subcmd_bootstrap_parser
def subcmd_bootstrap_parser(subcmd): """ bootstrap subcommand """ subcmd.add_argument( '--broker', action='store', dest='broker', help=u'Route to the Ansible Service Broker' ) subcmd.add_argument( '--secure', action='store_true', dest='verify', ...
python
def subcmd_bootstrap_parser(subcmd): """ bootstrap subcommand """ subcmd.add_argument( '--broker', action='store', dest='broker', help=u'Route to the Ansible Service Broker' ) subcmd.add_argument( '--secure', action='store_true', dest='verify', ...
[ "def", "subcmd_bootstrap_parser", "(", "subcmd", ")", ":", "subcmd", ".", "add_argument", "(", "'--broker'", ",", "action", "=", "'store'", ",", "dest", "=", "'broker'", ",", "help", "=", "u'Route to the Ansible Service Broker'", ")", "subcmd", ".", "add_argument"...
bootstrap subcommand
[ "bootstrap", "subcommand" ]
train
https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/blob/585694be9b417f1a88354cbfe286bfd68c2c9494/src/apb/cli.py#L362-L414
ansibleplaybookbundle/ansible-playbook-bundle
src/apb/cli.py
subcmd_run_parser
def subcmd_run_parser(subcmd): """ provision subcommand """ subcmd.add_argument( '--project', action='store', dest='project', required=True, help=u'Project where the APB should be run' ) subcmd.add_argument( '--action', action='store', dest...
python
def subcmd_run_parser(subcmd): """ provision subcommand """ subcmd.add_argument( '--project', action='store', dest='project', required=True, help=u'Project where the APB should be run' ) subcmd.add_argument( '--action', action='store', dest...
[ "def", "subcmd_run_parser", "(", "subcmd", ")", ":", "subcmd", ".", "add_argument", "(", "'--project'", ",", "action", "=", "'store'", ",", "dest", "=", "'project'", ",", "required", "=", "True", ",", "help", "=", "u'Project where the APB should be run'", ")", ...
provision subcommand
[ "provision", "subcommand" ]
train
https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/blob/585694be9b417f1a88354cbfe286bfd68c2c9494/src/apb/cli.py#L461-L513
ansibleplaybookbundle/ansible-playbook-bundle
src/apb/cli.py
subcmd_relist_parser
def subcmd_relist_parser(subcmd): """ relist subcommand """ subcmd.add_argument( '--broker-name', action='store', dest='broker_name', help=u'Name of the ServiceBroker k8s resource', default=u'ansible-service-broker' ) subcmd.add_argument( '--secure', ...
python
def subcmd_relist_parser(subcmd): """ relist subcommand """ subcmd.add_argument( '--broker-name', action='store', dest='broker_name', help=u'Name of the ServiceBroker k8s resource', default=u'ansible-service-broker' ) subcmd.add_argument( '--secure', ...
[ "def", "subcmd_relist_parser", "(", "subcmd", ")", ":", "subcmd", ".", "add_argument", "(", "'--broker-name'", ",", "action", "=", "'store'", ",", "dest", "=", "'broker_name'", ",", "help", "=", "u'Name of the ServiceBroker k8s resource'", ",", "default", "=", "u'...
relist subcommand
[ "relist", "subcommand" ]
train
https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/blob/585694be9b417f1a88354cbfe286bfd68c2c9494/src/apb/cli.py#L524-L563
ansibleplaybookbundle/ansible-playbook-bundle
src/apb/cli.py
main
def main(): """ main """ # BZ 1581651 - Override the ArgumentParser to disable argument abbreviations. parser = OverrideArgumentParser( description=u'APB tooling for ' u'assisting in building and packaging APBs.' ) parser.add_argument( '--debug', action='store_true',...
python
def main(): """ main """ # BZ 1581651 - Override the ArgumentParser to disable argument abbreviations. parser = OverrideArgumentParser( description=u'APB tooling for ' u'assisting in building and packaging APBs.' ) parser.add_argument( '--debug', action='store_true',...
[ "def", "main", "(", ")", ":", "# BZ 1581651 - Override the ArgumentParser to disable argument abbreviations.", "parser", "=", "OverrideArgumentParser", "(", "description", "=", "u'APB tooling for '", "u'assisting in building and packaging APBs.'", ")", "parser", ".", "add_argument"...
main
[ "main" ]
train
https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/blob/585694be9b417f1a88354cbfe286bfd68c2c9494/src/apb/cli.py#L686-L745
jrialland/python-astar
src/astar/__init__.py
find_path
def find_path(start, goal, neighbors_fnct, reversePath=False, heuristic_cost_estimate_fnct=lambda a, b: Infinite, distance_between_fnct=lambda a, b: 1.0, is_goal_reached_fnct=lambda a, b: a == b): """A non-class version of the path finding algorithm""" class FindPath(AStar): def heuristic_cost_estimate...
python
def find_path(start, goal, neighbors_fnct, reversePath=False, heuristic_cost_estimate_fnct=lambda a, b: Infinite, distance_between_fnct=lambda a, b: 1.0, is_goal_reached_fnct=lambda a, b: a == b): """A non-class version of the path finding algorithm""" class FindPath(AStar): def heuristic_cost_estimate...
[ "def", "find_path", "(", "start", ",", "goal", ",", "neighbors_fnct", ",", "reversePath", "=", "False", ",", "heuristic_cost_estimate_fnct", "=", "lambda", "a", ",", "b", ":", "Infinite", ",", "distance_between_fnct", "=", "lambda", "a", ",", "b", ":", "1.0"...
A non-class version of the path finding algorithm
[ "A", "non", "-", "class", "version", "of", "the", "path", "finding", "algorithm" ]
train
https://github.com/jrialland/python-astar/blob/7a3f5b33bedd03bd09792fe0d5b6fe28d50f9514/src/astar/__init__.py#L109-L124
frictionlessdata/goodtables-py
goodtables/registry.py
preset
def preset(name): """https://github.com/frictionlessdata/goodtables-py#custom-presets """ def decorator(func): registry.register_preset(func, name) return func return decorator
python
def preset(name): """https://github.com/frictionlessdata/goodtables-py#custom-presets """ def decorator(func): registry.register_preset(func, name) return func return decorator
[ "def", "preset", "(", "name", ")", ":", "def", "decorator", "(", "func", ")", ":", "registry", ".", "register_preset", "(", "func", ",", "name", ")", "return", "func", "return", "decorator" ]
https://github.com/frictionlessdata/goodtables-py#custom-presets
[ "https", ":", "//", "github", ".", "com", "/", "frictionlessdata", "/", "goodtables", "-", "py#custom", "-", "presets" ]
train
https://github.com/frictionlessdata/goodtables-py/blob/3e7d6891d2f4e342dfafbe0e951e204ccc252a44/goodtables/registry.py#L17-L23
frictionlessdata/goodtables-py
goodtables/registry.py
check
def check(name, type=None, context=None, position=None): """https://github.com/frictionlessdata/goodtables-py#custom-checks """ def decorator(func): registry.register_check(func, name, type, context, position) return func return decorator
python
def check(name, type=None, context=None, position=None): """https://github.com/frictionlessdata/goodtables-py#custom-checks """ def decorator(func): registry.register_check(func, name, type, context, position) return func return decorator
[ "def", "check", "(", "name", ",", "type", "=", "None", ",", "context", "=", "None", ",", "position", "=", "None", ")", ":", "def", "decorator", "(", "func", ")", ":", "registry", ".", "register_check", "(", "func", ",", "name", ",", "type", ",", "c...
https://github.com/frictionlessdata/goodtables-py#custom-checks
[ "https", ":", "//", "github", ".", "com", "/", "frictionlessdata", "/", "goodtables", "-", "py#custom", "-", "checks" ]
train
https://github.com/frictionlessdata/goodtables-py/blob/3e7d6891d2f4e342dfafbe0e951e204ccc252a44/goodtables/registry.py#L26-L32
frictionlessdata/goodtables-py
goodtables/validate.py
validate
def validate(source, **options): """Validates a source file and returns a report. Args: source (Union[str, Dict, List[Dict], IO]): The source to be validated. It can be a local file path, URL, dict, list of dicts, or a file-like object. If it's a list of dicts and the `preset` i...
python
def validate(source, **options): """Validates a source file and returns a report. Args: source (Union[str, Dict, List[Dict], IO]): The source to be validated. It can be a local file path, URL, dict, list of dicts, or a file-like object. If it's a list of dicts and the `preset` i...
[ "def", "validate", "(", "source", ",", "*", "*", "options", ")", ":", "source", ",", "options", ",", "inspector_settings", "=", "_parse_arguments", "(", "source", ",", "*", "*", "options", ")", "# Validate", "inspector", "=", "Inspector", "(", "*", "*", ...
Validates a source file and returns a report. Args: source (Union[str, Dict, List[Dict], IO]): The source to be validated. It can be a local file path, URL, dict, list of dicts, or a file-like object. If it's a list of dicts and the `preset` is "nested", each of the dict...
[ "Validates", "a", "source", "file", "and", "returns", "a", "report", "." ]
train
https://github.com/frictionlessdata/goodtables-py/blob/3e7d6891d2f4e342dfafbe0e951e204ccc252a44/goodtables/validate.py#L13-L87
frictionlessdata/goodtables-py
goodtables/validate.py
init_datapackage
def init_datapackage(resource_paths): """Create tabular data package with resources. It will also infer the tabular resources' schemas. Args: resource_paths (List[str]): Paths to the data package resources. Returns: datapackage.Package: The data package. """ dp = datapackage.P...
python
def init_datapackage(resource_paths): """Create tabular data package with resources. It will also infer the tabular resources' schemas. Args: resource_paths (List[str]): Paths to the data package resources. Returns: datapackage.Package: The data package. """ dp = datapackage.P...
[ "def", "init_datapackage", "(", "resource_paths", ")", ":", "dp", "=", "datapackage", ".", "Package", "(", "{", "'name'", ":", "'change-me'", ",", "'schema'", ":", "'tabular-data-package'", ",", "}", ")", "for", "path", "in", "resource_paths", ":", "dp", "."...
Create tabular data package with resources. It will also infer the tabular resources' schemas. Args: resource_paths (List[str]): Paths to the data package resources. Returns: datapackage.Package: The data package.
[ "Create", "tabular", "data", "package", "with", "resources", "." ]
train
https://github.com/frictionlessdata/goodtables-py/blob/3e7d6891d2f4e342dfafbe0e951e204ccc252a44/goodtables/validate.py#L90-L109
frictionlessdata/goodtables-py
goodtables/cli.py
init
def init(paths, output, **kwargs): """Init data package from list of files. It will also infer tabular data's schemas from their contents. """ dp = goodtables.init_datapackage(paths) click.secho( json_module.dumps(dp.descriptor, indent=4), file=output ) exit(dp.valid)
python
def init(paths, output, **kwargs): """Init data package from list of files. It will also infer tabular data's schemas from their contents. """ dp = goodtables.init_datapackage(paths) click.secho( json_module.dumps(dp.descriptor, indent=4), file=output ) exit(dp.valid)
[ "def", "init", "(", "paths", ",", "output", ",", "*", "*", "kwargs", ")", ":", "dp", "=", "goodtables", ".", "init_datapackage", "(", "paths", ")", "click", ".", "secho", "(", "json_module", ".", "dumps", "(", "dp", ".", "descriptor", ",", "indent", ...
Init data package from list of files. It will also infer tabular data's schemas from their contents.
[ "Init", "data", "package", "from", "list", "of", "files", "." ]
train
https://github.com/frictionlessdata/goodtables-py/blob/3e7d6891d2f4e342dfafbe0e951e204ccc252a44/goodtables/cli.py#L121-L133
frictionlessdata/goodtables-py
goodtables/inspector.py
_clean_empty
def _clean_empty(d): """Remove None values from a dict.""" if not isinstance(d, (dict, list)): return d if isinstance(d, list): return [v for v in (_clean_empty(v) for v in d) if v is not None] return { k: v for k, v in ((k, _clean_empty(v)) for k, v in d.items()) ...
python
def _clean_empty(d): """Remove None values from a dict.""" if not isinstance(d, (dict, list)): return d if isinstance(d, list): return [v for v in (_clean_empty(v) for v in d) if v is not None] return { k: v for k, v in ((k, _clean_empty(v)) for k, v in d.items()) ...
[ "def", "_clean_empty", "(", "d", ")", ":", "if", "not", "isinstance", "(", "d", ",", "(", "dict", ",", "list", ")", ")", ":", "return", "d", "if", "isinstance", "(", "d", ",", "list", ")", ":", "return", "[", "v", "for", "v", "in", "(", "_clean...
Remove None values from a dict.
[ "Remove", "None", "values", "from", "a", "dict", "." ]
train
https://github.com/frictionlessdata/goodtables-py/blob/3e7d6891d2f4e342dfafbe0e951e204ccc252a44/goodtables/inspector.py#L330-L340
frictionlessdata/goodtables-py
goodtables/inspector.py
Inspector.inspect
def inspect(self, source, preset=None, **options): """https://github.com/frictionlessdata/goodtables-py#inspector """ # Start timer start = datetime.datetime.now() # Prepare preset preset = self.__get_source_preset(source, preset) if preset == 'nested': ...
python
def inspect(self, source, preset=None, **options): """https://github.com/frictionlessdata/goodtables-py#inspector """ # Start timer start = datetime.datetime.now() # Prepare preset preset = self.__get_source_preset(source, preset) if preset == 'nested': ...
[ "def", "inspect", "(", "self", ",", "source", ",", "preset", "=", "None", ",", "*", "*", "options", ")", ":", "# Start timer", "start", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "# Prepare preset", "preset", "=", "self", ".", "__get_source_...
https://github.com/frictionlessdata/goodtables-py#inspector
[ "https", ":", "//", "github", ".", "com", "/", "frictionlessdata", "/", "goodtables", "-", "py#inspector" ]
train
https://github.com/frictionlessdata/goodtables-py/blob/3e7d6891d2f4e342dfafbe0e951e204ccc252a44/goodtables/inspector.py#L51-L104
frictionlessdata/goodtables-py
goodtables/cells.py
create_cells
def create_cells(headers, schema_fields, values=None, row_number=None): """Create list of cells from headers, fields and values. Args: headers (List[str]): The headers values. schema_fields (List[tableschema.field.Field]): The tableschema fields. values (List[Any], optional)...
python
def create_cells(headers, schema_fields, values=None, row_number=None): """Create list of cells from headers, fields and values. Args: headers (List[str]): The headers values. schema_fields (List[tableschema.field.Field]): The tableschema fields. values (List[Any], optional)...
[ "def", "create_cells", "(", "headers", ",", "schema_fields", ",", "values", "=", "None", ",", "row_number", "=", "None", ")", ":", "fillvalue", "=", "'_fillvalue'", "is_header_row", "=", "(", "values", "is", "None", ")", "cells", "=", "[", "]", "iterator",...
Create list of cells from headers, fields and values. Args: headers (List[str]): The headers values. schema_fields (List[tableschema.field.Field]): The tableschema fields. values (List[Any], optional): The cells values. If not specified, the created cells will have t...
[ "Create", "list", "of", "cells", "from", "headers", "fields", "and", "values", "." ]
train
https://github.com/frictionlessdata/goodtables-py/blob/3e7d6891d2f4e342dfafbe0e951e204ccc252a44/goodtables/cells.py#L4-L44
unixfreak0037/officeparser
officeparser.py
CompoundBinaryFile.__impl_read_chain
def __impl_read_chain(self, start, read_sector_f, read_fat_f): """Returns the entire contents of a chain starting at the given sector.""" sector = start check = [ sector ] # keep a list of sectors we've already read buffer = StringIO() while sector != ENDOFCHAIN: buff...
python
def __impl_read_chain(self, start, read_sector_f, read_fat_f): """Returns the entire contents of a chain starting at the given sector.""" sector = start check = [ sector ] # keep a list of sectors we've already read buffer = StringIO() while sector != ENDOFCHAIN: buff...
[ "def", "__impl_read_chain", "(", "self", ",", "start", ",", "read_sector_f", ",", "read_fat_f", ")", ":", "sector", "=", "start", "check", "=", "[", "sector", "]", "# keep a list of sectors we've already read", "buffer", "=", "StringIO", "(", ")", "while", "sect...
Returns the entire contents of a chain starting at the given sector.
[ "Returns", "the", "entire", "contents", "of", "a", "chain", "starting", "at", "the", "given", "sector", "." ]
train
https://github.com/unixfreak0037/officeparser/blob/42c2d40372fe271f2039ca1adc145d2aef8c9545/officeparser.py#L247-L261