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
edeposit/edeposit.amqp.ltp
src/edeposit/amqp/ltp/checksum_generator.py
generate_checksums
def generate_checksums(directory, blacklist=_BLACKLIST): """ Compute checksum for each file in `directory`, with exception of files specified in `blacklist`. Args: directory (str): Absolute or relative path to the directory. blacklist (list/set/tuple): List of blacklisted filenames. Onl...
python
def generate_checksums(directory, blacklist=_BLACKLIST): """ Compute checksum for each file in `directory`, with exception of files specified in `blacklist`. Args: directory (str): Absolute or relative path to the directory. blacklist (list/set/tuple): List of blacklisted filenames. Onl...
[ "def", "generate_checksums", "(", "directory", ",", "blacklist", "=", "_BLACKLIST", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "directory", ")", ":", "raise", "UserWarning", "(", "\"'%s' doesn't exists!\"", "%", "directory", ")", "hashes", ...
Compute checksum for each file in `directory`, with exception of files specified in `blacklist`. Args: directory (str): Absolute or relative path to the directory. blacklist (list/set/tuple): List of blacklisted filenames. Only filenames are checked, not paths! Returns: ...
[ "Compute", "checksum", "for", "each", "file", "in", "directory", "with", "exception", "of", "files", "specified", "in", "blacklist", "." ]
train
https://github.com/edeposit/edeposit.amqp.ltp/blob/df9ac7ec6cbdbeaaeed438ca66df75ea967b6d8e/src/edeposit/amqp/ltp/checksum_generator.py#L47-L86
edeposit/edeposit.amqp.ltp
src/edeposit/amqp/ltp/checksum_generator.py
generate_hashfile
def generate_hashfile(directory, blacklist=_BLACKLIST): """ Compute checksum for each file in `directory`, with exception of files specified in `blacklist`. Args: directory (str): Absolute or relative path to the directory. blacklist (list/set/tuple): List of blacklisted filenames. Only...
python
def generate_hashfile(directory, blacklist=_BLACKLIST): """ Compute checksum for each file in `directory`, with exception of files specified in `blacklist`. Args: directory (str): Absolute or relative path to the directory. blacklist (list/set/tuple): List of blacklisted filenames. Only...
[ "def", "generate_hashfile", "(", "directory", ",", "blacklist", "=", "_BLACKLIST", ")", ":", "checksums", "=", "generate_checksums", "(", "directory", ",", "blacklist", ")", "out", "=", "\"\"", "for", "fn", ",", "checksum", "in", "sorted", "(", "checksums", ...
Compute checksum for each file in `directory`, with exception of files specified in `blacklist`. Args: directory (str): Absolute or relative path to the directory. blacklist (list/set/tuple): List of blacklisted filenames. Only filenames are checked, not paths! Returns: ...
[ "Compute", "checksum", "for", "each", "file", "in", "directory", "with", "exception", "of", "files", "specified", "in", "blacklist", "." ]
train
https://github.com/edeposit/edeposit.amqp.ltp/blob/df9ac7ec6cbdbeaaeed438ca66df75ea967b6d8e/src/edeposit/amqp/ltp/checksum_generator.py#L89-L109
vingd/vingd-api-python
vingd/client.py
Vingd.request
def request(self, verb, subpath, data=''): """ Generic Vingd-backend authenticated request (currently HTTP Basic Auth over HTTPS, but OAuth1 in the future). :returns: Data ``dict``, or raises exception. """ if not self.api_key or not self.api_secret: ...
python
def request(self, verb, subpath, data=''): """ Generic Vingd-backend authenticated request (currently HTTP Basic Auth over HTTPS, but OAuth1 in the future). :returns: Data ``dict``, or raises exception. """ if not self.api_key or not self.api_secret: ...
[ "def", "request", "(", "self", ",", "verb", ",", "subpath", ",", "data", "=", "''", ")", ":", "if", "not", "self", ".", "api_key", "or", "not", "self", ".", "api_secret", ":", "raise", "Exception", "(", "\"Vingd authentication credentials undefined.\"", ")",...
Generic Vingd-backend authenticated request (currently HTTP Basic Auth over HTTPS, but OAuth1 in the future). :returns: Data ``dict``, or raises exception.
[ "Generic", "Vingd", "-", "backend", "authenticated", "request", "(", "currently", "HTTP", "Basic", "Auth", "over", "HTTPS", "but", "OAuth1", "in", "the", "future", ")", ".", ":", "returns", ":", "Data", "dict", "or", "raises", "exception", "." ]
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L57-L118
vingd/vingd-api-python
vingd/client.py
Vingd._extract_id_from_batch_response
def _extract_id_from_batch_response(r, name='id'): """Unholy, forward-compatible, mess for extraction of id/oid from a soon-to-be (deprecated) batch response.""" names = name + 's' if names in r: # soon-to-be deprecated batch reponse if 'errors' in r and r['errors...
python
def _extract_id_from_batch_response(r, name='id'): """Unholy, forward-compatible, mess for extraction of id/oid from a soon-to-be (deprecated) batch response.""" names = name + 's' if names in r: # soon-to-be deprecated batch reponse if 'errors' in r and r['errors...
[ "def", "_extract_id_from_batch_response", "(", "r", ",", "name", "=", "'id'", ")", ":", "names", "=", "name", "+", "'s'", "if", "names", "in", "r", ":", "# soon-to-be deprecated batch reponse", "if", "'errors'", "in", "r", "and", "r", "[", "'errors'", "]", ...
Unholy, forward-compatible, mess for extraction of id/oid from a soon-to-be (deprecated) batch response.
[ "Unholy", "forward", "-", "compatible", "mess", "for", "extraction", "of", "id", "/", "oid", "from", "a", "soon", "-", "to", "-", "be", "(", "deprecated", ")", "batch", "response", "." ]
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L121-L133
vingd/vingd-api-python
vingd/client.py
Vingd.kvpath
def kvpath(self, base, *pa, **kw): """Key-value query url builder (of the form: "base/v0/k1=v1/k2=v2"). """ def fmt(vtuple): typ, val = vtuple if not val is None: return safeformat("{:%s}"%typ, val) return None parts = [base] for v in p...
python
def kvpath(self, base, *pa, **kw): """Key-value query url builder (of the form: "base/v0/k1=v1/k2=v2"). """ def fmt(vtuple): typ, val = vtuple if not val is None: return safeformat("{:%s}"%typ, val) return None parts = [base] for v in p...
[ "def", "kvpath", "(", "self", ",", "base", ",", "*", "pa", ",", "*", "*", "kw", ")", ":", "def", "fmt", "(", "vtuple", ")", ":", "typ", ",", "val", "=", "vtuple", "if", "not", "val", "is", "None", ":", "return", "safeformat", "(", "\"{:%s}\"", ...
Key-value query url builder (of the form: "base/v0/k1=v1/k2=v2").
[ "Key", "-", "value", "query", "url", "builder", "(", "of", "the", "form", ":", "base", "/", "v0", "/", "k1", "=", "v1", "/", "k2", "=", "v2", ")", "." ]
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L135-L151
vingd/vingd-api-python
vingd/client.py
Vingd.create_object
def create_object(self, name, url): """ CREATES a single object in Vingd Object registry. :type name: ``string`` :param name: Object's name. :type url: ``string`` :param url: Callback URL (object's resource location - on your server). ...
python
def create_object(self, name, url): """ CREATES a single object in Vingd Object registry. :type name: ``string`` :param name: Object's name. :type url: ``string`` :param url: Callback URL (object's resource location - on your server). ...
[ "def", "create_object", "(", "self", ",", "name", ",", "url", ")", ":", "r", "=", "self", ".", "request", "(", "'post'", ",", "'registry/objects/'", ",", "json", ".", "dumps", "(", "{", "'description'", ":", "{", "'name'", ":", "name", ",", "'url'", ...
CREATES a single object in Vingd Object registry. :type name: ``string`` :param name: Object's name. :type url: ``string`` :param url: Callback URL (object's resource location - on your server). :rtype: `bigint` :returns: Object I...
[ "CREATES", "a", "single", "object", "in", "Vingd", "Object", "registry", ".", ":", "type", "name", ":", "string", ":", "param", "name", ":", "Object", "s", "name", ".", ":", "type", "url", ":", "string", ":", "param", "url", ":", "Callback", "URL", "...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L153-L177
vingd/vingd-api-python
vingd/client.py
Vingd.commit_purchase
def commit_purchase(self, purchaseid, transferid): """ DECLARES a purchase defined with ``purchaseid`` (bound to vingd transfer referenced by ``transferid``) as finished, with user being granted the access to the service or goods. If seller fails to commit the purchase, ...
python
def commit_purchase(self, purchaseid, transferid): """ DECLARES a purchase defined with ``purchaseid`` (bound to vingd transfer referenced by ``transferid``) as finished, with user being granted the access to the service or goods. If seller fails to commit the purchase, ...
[ "def", "commit_purchase", "(", "self", ",", "purchaseid", ",", "transferid", ")", ":", "return", "self", ".", "request", "(", "'put'", ",", "safeformat", "(", "'purchases/{:int}'", ",", "purchaseid", ")", ",", "json", ".", "dumps", "(", "{", "'transferid'", ...
DECLARES a purchase defined with ``purchaseid`` (bound to vingd transfer referenced by ``transferid``) as finished, with user being granted the access to the service or goods. If seller fails to commit the purchase, the user (buyer) shall be refunded full amount paid (reserved)....
[ "DECLARES", "a", "purchase", "defined", "with", "purchaseid", "(", "bound", "to", "vingd", "transfer", "referenced", "by", "transferid", ")", "as", "finished", "with", "user", "being", "granted", "the", "access", "to", "the", "service", "or", "goods", ".", "...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L236-L270
vingd/vingd-api-python
vingd/client.py
Vingd.create_order
def create_order(self, oid, price, context=None, expires=None): """ CREATES a single order for object ``oid``, with price set to ``price`` and validity until ``expires``. :type oid: ``bigint`` :param oid: Object ID. :type price: ``bigint`` :pa...
python
def create_order(self, oid, price, context=None, expires=None): """ CREATES a single order for object ``oid``, with price set to ``price`` and validity until ``expires``. :type oid: ``bigint`` :param oid: Object ID. :type price: ``bigint`` :pa...
[ "def", "create_order", "(", "self", ",", "oid", ",", "price", ",", "context", "=", "None", ",", "expires", "=", "None", ")", ":", "expires", "=", "absdatetime", "(", "expires", ",", "default", "=", "self", ".", "EXP_ORDER", ")", "orders", "=", "self", ...
CREATES a single order for object ``oid``, with price set to ``price`` and validity until ``expires``. :type oid: ``bigint`` :param oid: Object ID. :type price: ``bigint`` :param price: Vingd amount (in cents) the user/buyer shall be charged upon ...
[ "CREATES", "a", "single", "order", "for", "object", "oid", "with", "price", "set", "to", "price", "and", "validity", "until", "expires", ".", ":", "type", "oid", ":", "bigint", ":", "param", "oid", ":", "Object", "ID", ".", ":", "type", "price", ":", ...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L272-L340
vingd/vingd-api-python
vingd/client.py
Vingd.get_orders
def get_orders(self, oid=None, include_expired=False, orderid=None): """ FETCHES filtered orders. All arguments are optional. :type oid: ``bigint`` :param oid: Object ID. :type include_expired: ``boolean`` :param include_expired: Fetch als...
python
def get_orders(self, oid=None, include_expired=False, orderid=None): """ FETCHES filtered orders. All arguments are optional. :type oid: ``bigint`` :param oid: Object ID. :type include_expired: ``boolean`` :param include_expired: Fetch als...
[ "def", "get_orders", "(", "self", ",", "oid", "=", "None", ",", "include_expired", "=", "False", ",", "orderid", "=", "None", ")", ":", "return", "self", ".", "request", "(", "'get'", ",", "'%sorders/%s%s'", "%", "(", "safeformat", "(", "'objects/{:int}/'"...
FETCHES filtered orders. All arguments are optional. :type oid: ``bigint`` :param oid: Object ID. :type include_expired: ``boolean`` :param include_expired: Fetch also expired orders. :type orderid: ``bigint`` :param orderid: O...
[ "FETCHES", "filtered", "orders", ".", "All", "arguments", "are", "optional", ".", ":", "type", "oid", ":", "bigint", ":", "param", "oid", ":", "Object", "ID", ".", ":", "type", "include_expired", ":", "boolean", ":", "param", "include_expired", ":", "Fetch...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L342-L373
vingd/vingd-api-python
vingd/client.py
Vingd.update_object
def update_object(self, oid, name, url): """ UPDATES a single object in Vingd Object registry. :type oid: ``bigint`` :param oid: Object ID of the object being updated. :type name: ``string`` :param name: New object's name. :type ur...
python
def update_object(self, oid, name, url): """ UPDATES a single object in Vingd Object registry. :type oid: ``bigint`` :param oid: Object ID of the object being updated. :type name: ``string`` :param name: New object's name. :type ur...
[ "def", "update_object", "(", "self", ",", "oid", ",", "name", ",", "url", ")", ":", "r", "=", "self", ".", "request", "(", "'put'", ",", "safeformat", "(", "'registry/objects/{:int}/'", ",", "oid", ")", ",", "json", ".", "dumps", "(", "{", "'descriptio...
UPDATES a single object in Vingd Object registry. :type oid: ``bigint`` :param oid: Object ID of the object being updated. :type name: ``string`` :param name: New object's name. :type url: ``string`` :param url: New callback UR...
[ "UPDATES", "a", "single", "object", "in", "Vingd", "Object", "registry", ".", ":", "type", "oid", ":", "bigint", ":", "param", "oid", ":", "Object", "ID", "of", "the", "object", "being", "updated", ".", ":", "type", "name", ":", "string", ":", "param",...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L396-L427
vingd/vingd-api-python
vingd/client.py
Vingd.get_objects
def get_objects(self, oid=None, since=None, until=None, last=None, first=None): """ FETCHES a filtered collection of objects created by the authenticated user. :type oid: ``bigint`` :param oid: Object ID :type since: ``datetime``/`...
python
def get_objects(self, oid=None, since=None, until=None, last=None, first=None): """ FETCHES a filtered collection of objects created by the authenticated user. :type oid: ``bigint`` :param oid: Object ID :type since: ``datetime``/`...
[ "def", "get_objects", "(", "self", ",", "oid", "=", "None", ",", "since", "=", "None", ",", "until", "=", "None", ",", "last", "=", "None", ",", "first", "=", "None", ")", ":", "resource", "=", "self", ".", "kvpath", "(", "'registry/objects'", ",", ...
FETCHES a filtered collection of objects created by the authenticated user. :type oid: ``bigint`` :param oid: Object ID :type since: ``datetime``/``dict`` :param since: Object has to be newer than this timestamp (absolute ``datetime``, ...
[ "FETCHES", "a", "filtered", "collection", "of", "objects", "created", "by", "the", "authenticated", "user", ".", ":", "type", "oid", ":", "bigint", ":", "param", "oid", ":", "Object", "ID", ":", "type", "since", ":", "datetime", "/", "dict", ":", "param"...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L429-L473
vingd/vingd-api-python
vingd/client.py
Vingd.authorized_get_account_balance
def authorized_get_account_balance(self, huid): """ FETCHES the account balance for the user defined with `huid`. :rtype: ``bigint`` :returns: ``<amount_in_cents>`` :raises GeneralException: :resource: ``fort/accounts/<huid>`` :access: authorized...
python
def authorized_get_account_balance(self, huid): """ FETCHES the account balance for the user defined with `huid`. :rtype: ``bigint`` :returns: ``<amount_in_cents>`` :raises GeneralException: :resource: ``fort/accounts/<huid>`` :access: authorized...
[ "def", "authorized_get_account_balance", "(", "self", ",", "huid", ")", ":", "acc", "=", "self", ".", "request", "(", "'get'", ",", "safeformat", "(", "'fort/accounts/{:hex}'", ",", "huid", ")", ")", "return", "int", "(", "acc", "[", "'balance'", "]", ")" ...
FETCHES the account balance for the user defined with `huid`. :rtype: ``bigint`` :returns: ``<amount_in_cents>`` :raises GeneralException: :resource: ``fort/accounts/<huid>`` :access: authorized users; delegate permission required for the requester t...
[ "FETCHES", "the", "account", "balance", "for", "the", "user", "defined", "with", "huid", ".", ":", "rtype", ":", "bigint", ":", "returns", ":", "<amount_in_cents", ">", ":", "raises", "GeneralException", ":", ":", "resource", ":", "fort", "/", "accounts", ...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L528-L541
vingd/vingd-api-python
vingd/client.py
Vingd.authorized_purchase_object
def authorized_purchase_object(self, oid, price, huid): """Does delegated (pre-authorized) purchase of `oid` in the name of `huid`, at price `price` (vingd transferred from `huid` to consumer's acc). :raises GeneralException: :resource: ``objects/<oid>/purchases`` ...
python
def authorized_purchase_object(self, oid, price, huid): """Does delegated (pre-authorized) purchase of `oid` in the name of `huid`, at price `price` (vingd transferred from `huid` to consumer's acc). :raises GeneralException: :resource: ``objects/<oid>/purchases`` ...
[ "def", "authorized_purchase_object", "(", "self", ",", "oid", ",", "price", ",", "huid", ")", ":", "return", "self", ".", "request", "(", "'post'", ",", "safeformat", "(", "'objects/{:int}/purchases'", ",", "oid", ")", ",", "json", ".", "dumps", "(", "{", ...
Does delegated (pre-authorized) purchase of `oid` in the name of `huid`, at price `price` (vingd transferred from `huid` to consumer's acc). :raises GeneralException: :resource: ``objects/<oid>/purchases`` :access: authorized users with ACL flag ``purchase.objec...
[ "Does", "delegated", "(", "pre", "-", "authorized", ")", "purchase", "of", "oid", "in", "the", "name", "of", "huid", "at", "price", "price", "(", "vingd", "transferred", "from", "huid", "to", "consumer", "s", "acc", ")", ".", ":", "raises", "GeneralExcep...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L543-L562
vingd/vingd-api-python
vingd/client.py
Vingd.authorized_create_user
def authorized_create_user(self, identities=None, primary=None, permissions=None): """Creates Vingd user (profile & account), links it with the provided identities (to be verified later), and sets the delegate-user permissions (creator being the delegate). Returns Vingd user's `huid` (ha...
python
def authorized_create_user(self, identities=None, primary=None, permissions=None): """Creates Vingd user (profile & account), links it with the provided identities (to be verified later), and sets the delegate-user permissions (creator being the delegate). Returns Vingd user's `huid` (ha...
[ "def", "authorized_create_user", "(", "self", ",", "identities", "=", "None", ",", "primary", "=", "None", ",", "permissions", "=", "None", ")", ":", "return", "self", ".", "request", "(", "'post'", ",", "'id/users/'", ",", "json", ".", "dumps", "(", "{"...
Creates Vingd user (profile & account), links it with the provided identities (to be verified later), and sets the delegate-user permissions (creator being the delegate). Returns Vingd user's `huid` (hashed user id). Example:: vingd.authorized_create_user( ...
[ "Creates", "Vingd", "user", "(", "profile", "&", "account", ")", "links", "it", "with", "the", "provided", "identities", "(", "to", "be", "verified", "later", ")", "and", "sets", "the", "delegate", "-", "user", "permissions", "(", "creator", "being", "the"...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L564-L593
vingd/vingd-api-python
vingd/client.py
Vingd.reward_user
def reward_user(self, huid_to, amount, description=None): """ PERFORMS a single reward. User defined with `huid_to` is rewarded with `amount` cents, transfered from the account of the authenticated user. :type huid_to: ``alphanumeric(40)`` :param huid_to: Has...
python
def reward_user(self, huid_to, amount, description=None): """ PERFORMS a single reward. User defined with `huid_to` is rewarded with `amount` cents, transfered from the account of the authenticated user. :type huid_to: ``alphanumeric(40)`` :param huid_to: Has...
[ "def", "reward_user", "(", "self", ",", "huid_to", ",", "amount", ",", "description", "=", "None", ")", ":", "return", "self", ".", "request", "(", "'post'", ",", "'rewards'", ",", "json", ".", "dumps", "(", "{", "'huid_to'", ":", "huid_to", ",", "'amo...
PERFORMS a single reward. User defined with `huid_to` is rewarded with `amount` cents, transfered from the account of the authenticated user. :type huid_to: ``alphanumeric(40)`` :param huid_to: Hashed User ID, bound to account of the authenticated user (doing the...
[ "PERFORMS", "a", "single", "reward", ".", "User", "defined", "with", "huid_to", "is", "rewarded", "with", "amount", "cents", "transfered", "from", "the", "account", "of", "the", "authenticated", "user", ".", ":", "type", "huid_to", ":", "alphanumeric", "(", ...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L595-L625
vingd/vingd-api-python
vingd/client.py
Vingd.create_voucher
def create_voucher(self, amount, expires=None, message='', gid=None): """ CREATES a new preallocated voucher with ``amount`` vingd cents reserved until ``expires``. :type amount: ``bigint`` :param amount: Voucher amount in vingd cents. :type expires: ...
python
def create_voucher(self, amount, expires=None, message='', gid=None): """ CREATES a new preallocated voucher with ``amount`` vingd cents reserved until ``expires``. :type amount: ``bigint`` :param amount: Voucher amount in vingd cents. :type expires: ...
[ "def", "create_voucher", "(", "self", ",", "amount", ",", "expires", "=", "None", ",", "message", "=", "''", ",", "gid", "=", "None", ")", ":", "expires", "=", "absdatetime", "(", "expires", ",", "default", "=", "self", ".", "EXP_VOUCHER", ")", ".", ...
CREATES a new preallocated voucher with ``amount`` vingd cents reserved until ``expires``. :type amount: ``bigint`` :param amount: Voucher amount in vingd cents. :type expires: ``datetime``/``dict`` :param expires: Voucher expiry timestamp, absolu...
[ "CREATES", "a", "new", "preallocated", "voucher", "with", "amount", "vingd", "cents", "reserved", "until", "expires", ".", ":", "type", "amount", ":", "bigint", ":", "param", "amount", ":", "Voucher", "amount", "in", "vingd", "cents", ".", ":", "type", "ex...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L627-L691
vingd/vingd-api-python
vingd/client.py
Vingd.get_vouchers
def get_vouchers(self, vid_encoded=None, uid_from=None, uid_to=None, gid=None, valid_after=None, valid_before=None, last=None, first=None): """ FETCHES a filtered list of vouchers. :type vid_encoded: ``alphanumeric(64)`` ...
python
def get_vouchers(self, vid_encoded=None, uid_from=None, uid_to=None, gid=None, valid_after=None, valid_before=None, last=None, first=None): """ FETCHES a filtered list of vouchers. :type vid_encoded: ``alphanumeric(64)`` ...
[ "def", "get_vouchers", "(", "self", ",", "vid_encoded", "=", "None", ",", "uid_from", "=", "None", ",", "uid_to", "=", "None", ",", "gid", "=", "None", ",", "valid_after", "=", "None", ",", "valid_before", "=", "None", ",", "last", "=", "None", ",", ...
FETCHES a filtered list of vouchers. :type vid_encoded: ``alphanumeric(64)`` :param vid_encoded: Voucher ID, as a string with CRC. :type uid_from: ``bigint`` :param uid_from: Filter by source account UID. :type uid_to: ``bigint`` :param ui...
[ "FETCHES", "a", "filtered", "list", "of", "vouchers", ".", ":", "type", "vid_encoded", ":", "alphanumeric", "(", "64", ")", ":", "param", "vid_encoded", ":", "Voucher", "ID", "as", "a", "string", "with", "CRC", ".", ":", "type", "uid_from", ":", "bigint"...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L693-L761
vingd/vingd-api-python
vingd/client.py
Vingd.get_vouchers_history
def get_vouchers_history(self, vid_encoded=None, vid=None, action=None, uid_from=None, uid_to=None, gid=None, valid_after=None, valid_before=None, create_after=None, create_before=None, last=None, first=N...
python
def get_vouchers_history(self, vid_encoded=None, vid=None, action=None, uid_from=None, uid_to=None, gid=None, valid_after=None, valid_before=None, create_after=None, create_before=None, last=None, first=N...
[ "def", "get_vouchers_history", "(", "self", ",", "vid_encoded", "=", "None", ",", "vid", "=", "None", ",", "action", "=", "None", ",", "uid_from", "=", "None", ",", "uid_to", "=", "None", ",", "gid", "=", "None", ",", "valid_after", "=", "None", ",", ...
FETCHES a filtered list of vouchers log entries. :type vid_encoded: ``alphanumeric(64)`` :param vid_encoded: Voucher ID, as a string with CRC. :type vid: ``bigint`` :param vid: Voucher ID. :type action: ``string`` (add | use | revoke | expire) ...
[ "FETCHES", "a", "filtered", "list", "of", "vouchers", "log", "entries", ".", ":", "type", "vid_encoded", ":", "alphanumeric", "(", "64", ")", ":", "param", "vid_encoded", ":", "Voucher", "ID", "as", "a", "string", "with", "CRC", ".", ":", "type", "vid", ...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L763-L851
vingd/vingd-api-python
vingd/client.py
Vingd.revoke_vouchers
def revoke_vouchers(self, vid_encoded=None, uid_from=None, uid_to=None, gid=None, valid_after=None, valid_before=None, last=None, first=None): """ REVOKES/INVALIDATES a filtered list of vouchers. :type vid_encoded: ...
python
def revoke_vouchers(self, vid_encoded=None, uid_from=None, uid_to=None, gid=None, valid_after=None, valid_before=None, last=None, first=None): """ REVOKES/INVALIDATES a filtered list of vouchers. :type vid_encoded: ...
[ "def", "revoke_vouchers", "(", "self", ",", "vid_encoded", "=", "None", ",", "uid_from", "=", "None", ",", "uid_to", "=", "None", ",", "gid", "=", "None", ",", "valid_after", "=", "None", ",", "valid_before", "=", "None", ",", "last", "=", "None", ",",...
REVOKES/INVALIDATES a filtered list of vouchers. :type vid_encoded: ``alphanumeric(64)`` :param vid_encoded: Voucher ID, as a string with CRC. :type uid_from: ``bigint`` :param uid_from: Filter by source account UID. :type uid_to: ``bigint`` ...
[ "REVOKES", "/", "INVALIDATES", "a", "filtered", "list", "of", "vouchers", ".", ":", "type", "vid_encoded", ":", "alphanumeric", "(", "64", ")", ":", "param", "vid_encoded", ":", "Voucher", "ID", "as", "a", "string", "with", "CRC", ".", ":", "type", "uid_...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L853-L925
AN3223/fpbox
fpbox/funcs.py
partition
def partition(f, xs): """ Works similar to filter, except it returns a two-item tuple where the first item is the sequence of items that passed the filter and the second is a sequence of items that didn't pass the filter """ t = type(xs) true = filter(f, xs) false = [x for x in x...
python
def partition(f, xs): """ Works similar to filter, except it returns a two-item tuple where the first item is the sequence of items that passed the filter and the second is a sequence of items that didn't pass the filter """ t = type(xs) true = filter(f, xs) false = [x for x in x...
[ "def", "partition", "(", "f", ",", "xs", ")", ":", "t", "=", "type", "(", "xs", ")", "true", "=", "filter", "(", "f", ",", "xs", ")", "false", "=", "[", "x", "for", "x", "in", "xs", "if", "x", "not", "in", "true", "]", "return", "t", "(", ...
Works similar to filter, except it returns a two-item tuple where the first item is the sequence of items that passed the filter and the second is a sequence of items that didn't pass the filter
[ "Works", "similar", "to", "filter", "except", "it", "returns", "a", "two", "-", "item", "tuple", "where", "the", "first", "item", "is", "the", "sequence", "of", "items", "that", "passed", "the", "filter", "and", "the", "second", "is", "a", "sequence", "o...
train
https://github.com/AN3223/fpbox/blob/d3b88fa6d68b7673c58edf46c89a552a9aedd162/fpbox/funcs.py#L61-L70
AN3223/fpbox
fpbox/funcs.py
lazy_binmap
def lazy_binmap(f, xs): """ Maps a binary function over a sequence. The function is applied to each item and the item after it until the last item is reached. """ return (f(x, y) for x, y in zip(xs, xs[1:]))
python
def lazy_binmap(f, xs): """ Maps a binary function over a sequence. The function is applied to each item and the item after it until the last item is reached. """ return (f(x, y) for x, y in zip(xs, xs[1:]))
[ "def", "lazy_binmap", "(", "f", ",", "xs", ")", ":", "return", "(", "f", "(", "x", ",", "y", ")", "for", "x", ",", "y", "in", "zip", "(", "xs", ",", "xs", "[", "1", ":", "]", ")", ")" ]
Maps a binary function over a sequence. The function is applied to each item and the item after it until the last item is reached.
[ "Maps", "a", "binary", "function", "over", "a", "sequence", ".", "The", "function", "is", "applied", "to", "each", "item", "and", "the", "item", "after", "it", "until", "the", "last", "item", "is", "reached", "." ]
train
https://github.com/AN3223/fpbox/blob/d3b88fa6d68b7673c58edf46c89a552a9aedd162/fpbox/funcs.py#L73-L78
AN3223/fpbox
fpbox/funcs.py
lazy_reverse_binmap
def lazy_reverse_binmap(f, xs): """ Same as lazy_binmap, except the parameters are flipped for the binary function """ return (f(y, x) for x, y in zip(xs, xs[1:]))
python
def lazy_reverse_binmap(f, xs): """ Same as lazy_binmap, except the parameters are flipped for the binary function """ return (f(y, x) for x, y in zip(xs, xs[1:]))
[ "def", "lazy_reverse_binmap", "(", "f", ",", "xs", ")", ":", "return", "(", "f", "(", "y", ",", "x", ")", "for", "x", ",", "y", "in", "zip", "(", "xs", ",", "xs", "[", "1", ":", "]", ")", ")" ]
Same as lazy_binmap, except the parameters are flipped for the binary function
[ "Same", "as", "lazy_binmap", "except", "the", "parameters", "are", "flipped", "for", "the", "binary", "function" ]
train
https://github.com/AN3223/fpbox/blob/d3b88fa6d68b7673c58edf46c89a552a9aedd162/fpbox/funcs.py#L81-L85
AN3223/fpbox
fpbox/funcs.py
curry
def curry(f, args_supplied=()): """ Takes a function, and then returns a function that takes each argument for the original function through __call__. You probably shouldn't use this with builtins! Even if it seems to work with a builtin, it might not work properly in previous versions of Python. ...
python
def curry(f, args_supplied=()): """ Takes a function, and then returns a function that takes each argument for the original function through __call__. You probably shouldn't use this with builtins! Even if it seems to work with a builtin, it might not work properly in previous versions of Python. ...
[ "def", "curry", "(", "f", ",", "args_supplied", "=", "(", ")", ")", ":", "try", ":", "nargs_required", "=", "len", "(", "signature", "(", "f", ")", ".", "parameters", ")", "except", "ValueError", "as", "e", ":", "raise", "ValueError", "(", "str", "("...
Takes a function, and then returns a function that takes each argument for the original function through __call__. You probably shouldn't use this with builtins! Even if it seems to work with a builtin, it might not work properly in previous versions of Python.
[ "Takes", "a", "function", "and", "then", "returns", "a", "function", "that", "takes", "each", "argument", "for", "the", "original", "function", "through", "__call__", ".", "You", "probably", "shouldn", "t", "use", "this", "with", "builtins!", "Even", "if", "...
train
https://github.com/AN3223/fpbox/blob/d3b88fa6d68b7673c58edf46c89a552a9aedd162/fpbox/funcs.py#L109-L126
AN3223/fpbox
fpbox/funcs.py
collect
def collect(items, convert=(list, tuple), convert_to=tuple): """ Converts a nested list/tuple/generator into a tuple. If no nested list/tuple/generator is found (or if multiple are found) then "items" is returned unchanged to the caller. Useful for generic functions. :param items: Target sequ...
python
def collect(items, convert=(list, tuple), convert_to=tuple): """ Converts a nested list/tuple/generator into a tuple. If no nested list/tuple/generator is found (or if multiple are found) then "items" is returned unchanged to the caller. Useful for generic functions. :param items: Target sequ...
[ "def", "collect", "(", "items", ",", "convert", "=", "(", "list", ",", "tuple", ")", ",", "convert_to", "=", "tuple", ")", ":", "if", "len", "(", "items", ")", "==", "1", ":", "head_item", "=", "head", "(", "items", ")", "if", "True", "in", "(", ...
Converts a nested list/tuple/generator into a tuple. If no nested list/tuple/generator is found (or if multiple are found) then "items" is returned unchanged to the caller. Useful for generic functions. :param items: Target sequence :param convert: Tuple of types to convert into target type :...
[ "Converts", "a", "nested", "list", "/", "tuple", "/", "generator", "into", "a", "tuple", ".", "If", "no", "nested", "list", "/", "tuple", "/", "generator", "is", "found", "(", "or", "if", "multiple", "are", "found", ")", "then", "items", "is", "returne...
train
https://github.com/AN3223/fpbox/blob/d3b88fa6d68b7673c58edf46c89a552a9aedd162/fpbox/funcs.py#L129-L146
eugene-eeo/piggyback
piggyback/__init__.py
loader
def loader(path): """ Returns a loader object for a given path, with the correct finder class (``ModuleFinder`` for directories and ``FileFinder`` for single file modules). :param path: The path to the module(s). """ finder = ModuleFinder if _isdir(path) else FileFinder return Loade...
python
def loader(path): """ Returns a loader object for a given path, with the correct finder class (``ModuleFinder`` for directories and ``FileFinder`` for single file modules). :param path: The path to the module(s). """ finder = ModuleFinder if _isdir(path) else FileFinder return Loade...
[ "def", "loader", "(", "path", ")", ":", "finder", "=", "ModuleFinder", "if", "_isdir", "(", "path", ")", "else", "FileFinder", "return", "Loader", "(", "finder", "(", "path", ")", ")" ]
Returns a loader object for a given path, with the correct finder class (``ModuleFinder`` for directories and ``FileFinder`` for single file modules). :param path: The path to the module(s).
[ "Returns", "a", "loader", "object", "for", "a", "given", "path", "with", "the", "correct", "finder", "class", "(", "ModuleFinder", "for", "directories", "and", "FileFinder", "for", "single", "file", "modules", ")", "." ]
train
https://github.com/eugene-eeo/piggyback/blob/0e5efe40a37aa0373d860b8dabab1282bf074270/piggyback/__init__.py#L18-L28
shreyaspotnis/rampage
rampage/ramps.py
analog_linear2_ramp
def analog_linear2_ramp(ramp_data, start_time, end_time, value_final, time_subarray): """Use this when you want a discontinuous jump at the end of the linear ramp.""" value_initial = ramp_data["value"] value_final2 = ramp_data["value_final"] interp = (time_subarray - start_time)/(...
python
def analog_linear2_ramp(ramp_data, start_time, end_time, value_final, time_subarray): """Use this when you want a discontinuous jump at the end of the linear ramp.""" value_initial = ramp_data["value"] value_final2 = ramp_data["value_final"] interp = (time_subarray - start_time)/(...
[ "def", "analog_linear2_ramp", "(", "ramp_data", ",", "start_time", ",", "end_time", ",", "value_final", ",", "time_subarray", ")", ":", "value_initial", "=", "ramp_data", "[", "\"value\"", "]", "value_final2", "=", "ramp_data", "[", "\"value_final\"", "]", "interp...
Use this when you want a discontinuous jump at the end of the linear ramp.
[ "Use", "this", "when", "you", "want", "a", "discontinuous", "jump", "at", "the", "end", "of", "the", "linear", "ramp", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L477-L483
shreyaspotnis/rampage
rampage/ramps.py
KeyFrameList.bake
def bake(self): """Find absolute times for all keys. Absolute time is stored in the KeyFrame dictionary as the variable __abs_time__. """ self.unbake() for key in self.dct: self.get_absolute_time(key) self.is_baked = True
python
def bake(self): """Find absolute times for all keys. Absolute time is stored in the KeyFrame dictionary as the variable __abs_time__. """ self.unbake() for key in self.dct: self.get_absolute_time(key) self.is_baked = True
[ "def", "bake", "(", "self", ")", ":", "self", ".", "unbake", "(", ")", "for", "key", "in", "self", ".", "dct", ":", "self", ".", "get_absolute_time", "(", "key", ")", "self", ".", "is_baked", "=", "True" ]
Find absolute times for all keys. Absolute time is stored in the KeyFrame dictionary as the variable __abs_time__.
[ "Find", "absolute", "times", "for", "all", "keys", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L54-L63
shreyaspotnis/rampage
rampage/ramps.py
KeyFrameList.unbake
def unbake(self): """Remove absolute times for all keys.""" for key in self.dct: # pop __abs_time__ if it exists self.dct[key].pop('__abs_time__', None) self.is_baked = False
python
def unbake(self): """Remove absolute times for all keys.""" for key in self.dct: # pop __abs_time__ if it exists self.dct[key].pop('__abs_time__', None) self.is_baked = False
[ "def", "unbake", "(", "self", ")", ":", "for", "key", "in", "self", ".", "dct", ":", "# pop __abs_time__ if it exists", "self", ".", "dct", "[", "key", "]", ".", "pop", "(", "'__abs_time__'", ",", "None", ")", "self", ".", "is_baked", "=", "False" ]
Remove absolute times for all keys.
[ "Remove", "absolute", "times", "for", "all", "keys", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L65-L70
shreyaspotnis/rampage
rampage/ramps.py
KeyFrameList.get_absolute_time
def get_absolute_time(self, key): """Returns the absolute time position of the key. If absolute time positions are not calculated, then this function calculates it. """ keyframe = self.dct[key] try: # if absolute time is already calculated, return that ...
python
def get_absolute_time(self, key): """Returns the absolute time position of the key. If absolute time positions are not calculated, then this function calculates it. """ keyframe = self.dct[key] try: # if absolute time is already calculated, return that ...
[ "def", "get_absolute_time", "(", "self", ",", "key", ")", ":", "keyframe", "=", "self", ".", "dct", "[", "key", "]", "try", ":", "# if absolute time is already calculated, return that", "return", "keyframe", "[", "'__abs_time__'", "]", "except", "KeyError", ":", ...
Returns the absolute time position of the key. If absolute time positions are not calculated, then this function calculates it.
[ "Returns", "the", "absolute", "time", "position", "of", "the", "key", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L72-L90
shreyaspotnis/rampage
rampage/ramps.py
KeyFrameList.sorted_key_list
def sorted_key_list(self): """Returns list of keys sorted according to their absolute time.""" if not self.is_baked: self.bake() key_value_tuple = sorted(self.dct.items(), key=lambda x: x[1]['__abs_time__']) skl = [k[0] for k in key_value_tupl...
python
def sorted_key_list(self): """Returns list of keys sorted according to their absolute time.""" if not self.is_baked: self.bake() key_value_tuple = sorted(self.dct.items(), key=lambda x: x[1]['__abs_time__']) skl = [k[0] for k in key_value_tupl...
[ "def", "sorted_key_list", "(", "self", ")", ":", "if", "not", "self", ".", "is_baked", ":", "self", ".", "bake", "(", ")", "key_value_tuple", "=", "sorted", "(", "self", ".", "dct", ".", "items", "(", ")", ",", "key", "=", "lambda", "x", ":", "x", ...
Returns list of keys sorted according to their absolute time.
[ "Returns", "list", "of", "keys", "sorted", "according", "to", "their", "absolute", "time", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L92-L99
shreyaspotnis/rampage
rampage/ramps.py
KeyFrameList.set_time
def set_time(self, key_name, new_time): """Sets the time of key.""" self.unbake() kf = self.dct[key_name] kf['time'] = new_time self.bake()
python
def set_time(self, key_name, new_time): """Sets the time of key.""" self.unbake() kf = self.dct[key_name] kf['time'] = new_time self.bake()
[ "def", "set_time", "(", "self", ",", "key_name", ",", "new_time", ")", ":", "self", ".", "unbake", "(", ")", "kf", "=", "self", ".", "dct", "[", "key_name", "]", "kf", "[", "'time'", "]", "=", "new_time", "self", ".", "bake", "(", ")" ]
Sets the time of key.
[ "Sets", "the", "time", "of", "key", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L101-L106
shreyaspotnis/rampage
rampage/ramps.py
KeyFrameList.set_comment
def set_comment(self, key_name, new_comment): """Sets the comment of key.""" kf = self.dct[key_name] kf['comment'] = new_comment
python
def set_comment(self, key_name, new_comment): """Sets the comment of key.""" kf = self.dct[key_name] kf['comment'] = new_comment
[ "def", "set_comment", "(", "self", ",", "key_name", ",", "new_comment", ")", ":", "kf", "=", "self", ".", "dct", "[", "key_name", "]", "kf", "[", "'comment'", "]", "=", "new_comment" ]
Sets the comment of key.
[ "Sets", "the", "comment", "of", "key", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L108-L111
shreyaspotnis/rampage
rampage/ramps.py
KeyFrameList.set_parent
def set_parent(self, key_name, new_parent): """Sets the parent of the key.""" self.unbake() kf = self.dct[key_name] kf['parent'] = new_parent self.bake()
python
def set_parent(self, key_name, new_parent): """Sets the parent of the key.""" self.unbake() kf = self.dct[key_name] kf['parent'] = new_parent self.bake()
[ "def", "set_parent", "(", "self", ",", "key_name", ",", "new_parent", ")", ":", "self", ".", "unbake", "(", ")", "kf", "=", "self", ".", "dct", "[", "key_name", "]", "kf", "[", "'parent'", "]", "=", "new_parent", "self", ".", "bake", "(", ")" ]
Sets the parent of the key.
[ "Sets", "the", "parent", "of", "the", "key", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L113-L118
shreyaspotnis/rampage
rampage/ramps.py
KeyFrameList.is_ancestor
def is_ancestor(self, child_key_name, ancestor_key_name): """Returns True if ancestor lies in the ancestry tree of child.""" # all keys are descendents of None if ancestor_key_name is None: return True one_up_parent = self.dct[child_key_name]['parent'] if child_key_...
python
def is_ancestor(self, child_key_name, ancestor_key_name): """Returns True if ancestor lies in the ancestry tree of child.""" # all keys are descendents of None if ancestor_key_name is None: return True one_up_parent = self.dct[child_key_name]['parent'] if child_key_...
[ "def", "is_ancestor", "(", "self", ",", "child_key_name", ",", "ancestor_key_name", ")", ":", "# all keys are descendents of None", "if", "ancestor_key_name", "is", "None", ":", "return", "True", "one_up_parent", "=", "self", ".", "dct", "[", "child_key_name", "]", ...
Returns True if ancestor lies in the ancestry tree of child.
[ "Returns", "True", "if", "ancestor", "lies", "in", "the", "ancestry", "tree", "of", "child", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L149-L164
shreyaspotnis/rampage
rampage/ramps.py
KeyFrameList.add_hook
def add_hook(self, key_name, hook_name, hook_dict): """Add hook to the keyframe key_name.""" kf = self.dct[key_name] if 'hooks' not in kf: kf['hooks'] = {} kf['hooks'][str(hook_name)] = hook_dict
python
def add_hook(self, key_name, hook_name, hook_dict): """Add hook to the keyframe key_name.""" kf = self.dct[key_name] if 'hooks' not in kf: kf['hooks'] = {} kf['hooks'][str(hook_name)] = hook_dict
[ "def", "add_hook", "(", "self", ",", "key_name", ",", "hook_name", ",", "hook_dict", ")", ":", "kf", "=", "self", ".", "dct", "[", "key_name", "]", "if", "'hooks'", "not", "in", "kf", ":", "kf", "[", "'hooks'", "]", "=", "{", "}", "kf", "[", "'ho...
Add hook to the keyframe key_name.
[ "Add", "hook", "to", "the", "keyframe", "key_name", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L166-L171
shreyaspotnis/rampage
rampage/ramps.py
KeyFrameList.remove_hook
def remove_hook(self, key_name, hook_name): """Remove hook from the keyframe key_name.""" kf = self.dct[key_name] if 'hooks' in kf: if hook_name in kf['hooks']: return kf['hooks'].pop(hook_name)
python
def remove_hook(self, key_name, hook_name): """Remove hook from the keyframe key_name.""" kf = self.dct[key_name] if 'hooks' in kf: if hook_name in kf['hooks']: return kf['hooks'].pop(hook_name)
[ "def", "remove_hook", "(", "self", ",", "key_name", ",", "hook_name", ")", ":", "kf", "=", "self", ".", "dct", "[", "key_name", "]", "if", "'hooks'", "in", "kf", ":", "if", "hook_name", "in", "kf", "[", "'hooks'", "]", ":", "return", "kf", "[", "'h...
Remove hook from the keyframe key_name.
[ "Remove", "hook", "from", "the", "keyframe", "key_name", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L173-L178
shreyaspotnis/rampage
rampage/ramps.py
KeyFrameList.list_hooks
def list_hooks(self, key_name): """Return list of all hooks attached to key_name.""" kf = self.dct[key_name] if 'hooks' not in kf: return [] else: return kf['hooks'].iterkeys()
python
def list_hooks(self, key_name): """Return list of all hooks attached to key_name.""" kf = self.dct[key_name] if 'hooks' not in kf: return [] else: return kf['hooks'].iterkeys()
[ "def", "list_hooks", "(", "self", ",", "key_name", ")", ":", "kf", "=", "self", ".", "dct", "[", "key_name", "]", "if", "'hooks'", "not", "in", "kf", ":", "return", "[", "]", "else", ":", "return", "kf", "[", "'hooks'", "]", ".", "iterkeys", "(", ...
Return list of all hooks attached to key_name.
[ "Return", "list", "of", "all", "hooks", "attached", "to", "key_name", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L180-L186
shreyaspotnis/rampage
rampage/ramps.py
KeyFrameList.do_keyframes_overlap
def do_keyframes_overlap(self): """Checks for keyframs timing overlap. Returns the name of the first keyframs that overlapped.""" skl = self.sorted_key_list() for i in range(len(skl)-1): this_time = self.dct[skl[i]]['__abs_time__'] next_time = self.dct[skl[i+1]][...
python
def do_keyframes_overlap(self): """Checks for keyframs timing overlap. Returns the name of the first keyframs that overlapped.""" skl = self.sorted_key_list() for i in range(len(skl)-1): this_time = self.dct[skl[i]]['__abs_time__'] next_time = self.dct[skl[i+1]][...
[ "def", "do_keyframes_overlap", "(", "self", ")", ":", "skl", "=", "self", ".", "sorted_key_list", "(", ")", "for", "i", "in", "range", "(", "len", "(", "skl", ")", "-", "1", ")", ":", "this_time", "=", "self", ".", "dct", "[", "skl", "[", "i", "]...
Checks for keyframs timing overlap. Returns the name of the first keyframs that overlapped.
[ "Checks", "for", "keyframs", "timing", "overlap", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L199-L211
shreyaspotnis/rampage
rampage/ramps.py
Channel.del_unused_keyframes
def del_unused_keyframes(self): """Scans through list of keyframes in the channel and removes those which are not in self.key_frame_list.""" skl = self.key_frame_list.sorted_key_list() unused_keys = [k for k in self.dct['keys'] if k not in skl] for k in unu...
python
def del_unused_keyframes(self): """Scans through list of keyframes in the channel and removes those which are not in self.key_frame_list.""" skl = self.key_frame_list.sorted_key_list() unused_keys = [k for k in self.dct['keys'] if k not in skl] for k in unu...
[ "def", "del_unused_keyframes", "(", "self", ")", ":", "skl", "=", "self", ".", "key_frame_list", ".", "sorted_key_list", "(", ")", "unused_keys", "=", "[", "k", "for", "k", "in", "self", ".", "dct", "[", "'keys'", "]", "if", "k", "not", "in", "skl", ...
Scans through list of keyframes in the channel and removes those which are not in self.key_frame_list.
[ "Scans", "through", "list", "of", "keyframes", "in", "the", "channel", "and", "removes", "those", "which", "are", "not", "in", "self", ".", "key_frame_list", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L270-L277
shreyaspotnis/rampage
rampage/ramps.py
Channel.get_used_key_frames
def get_used_key_frames(self): """Returns a list of the keyframes used by this channel, sorted with time. Each element in the list is a tuple. The first element is the key_name and the second is the channel data at that keyframe.""" skl = self.key_frame_list.sorted_key_list() # ...
python
def get_used_key_frames(self): """Returns a list of the keyframes used by this channel, sorted with time. Each element in the list is a tuple. The first element is the key_name and the second is the channel data at that keyframe.""" skl = self.key_frame_list.sorted_key_list() # ...
[ "def", "get_used_key_frames", "(", "self", ")", ":", "skl", "=", "self", ".", "key_frame_list", ".", "sorted_key_list", "(", ")", "# each element in used_key_frames is a tuple (key_name, key_dict)", "used_key_frames", "=", "[", "]", "for", "kf", "in", "skl", ":", "i...
Returns a list of the keyframes used by this channel, sorted with time. Each element in the list is a tuple. The first element is the key_name and the second is the channel data at that keyframe.
[ "Returns", "a", "list", "of", "the", "keyframes", "used", "by", "this", "channel", "sorted", "with", "time", ".", "Each", "element", "in", "the", "list", "is", "a", "tuple", ".", "The", "first", "element", "is", "the", "key_name", "and", "the", "second",...
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L284-L295
shreyaspotnis/rampage
rampage/ramps.py
Channel.get_ramp_regions
def get_ramp_regions(self): """Returns a numpy array where each element corresponds to whether to ramp in that region or jump.""" skl = self.key_frame_list.sorted_key_list() ramp_or_jump = np.zeros(len(skl) - 1) used_key_frames = self.get_used_key_frame_list() for region_...
python
def get_ramp_regions(self): """Returns a numpy array where each element corresponds to whether to ramp in that region or jump.""" skl = self.key_frame_list.sorted_key_list() ramp_or_jump = np.zeros(len(skl) - 1) used_key_frames = self.get_used_key_frame_list() for region_...
[ "def", "get_ramp_regions", "(", "self", ")", ":", "skl", "=", "self", ".", "key_frame_list", ".", "sorted_key_list", "(", ")", "ramp_or_jump", "=", "np", ".", "zeros", "(", "len", "(", "skl", ")", "-", "1", ")", "used_key_frames", "=", "self", ".", "ge...
Returns a numpy array where each element corresponds to whether to ramp in that region or jump.
[ "Returns", "a", "numpy", "array", "where", "each", "element", "corresponds", "to", "whether", "to", "ramp", "in", "that", "region", "or", "jump", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L308-L329
shreyaspotnis/rampage
rampage/ramps.py
Channel.generate_ramp
def generate_ramp(self, time_div=4e-3): """Returns the generated ramp and a time array. This function assumes a uniform time division throughout. time_div - time resolution of the ramp. """ if self.dct['type'] == 'analog': is_analog = True else: ...
python
def generate_ramp(self, time_div=4e-3): """Returns the generated ramp and a time array. This function assumes a uniform time division throughout. time_div - time resolution of the ramp. """ if self.dct['type'] == 'analog': is_analog = True else: ...
[ "def", "generate_ramp", "(", "self", ",", "time_div", "=", "4e-3", ")", ":", "if", "self", ".", "dct", "[", "'type'", "]", "==", "'analog'", ":", "is_analog", "=", "True", "else", ":", "is_analog", "=", "False", "skl", "=", "self", ".", "key_frame_list...
Returns the generated ramp and a time array. This function assumes a uniform time division throughout. time_div - time resolution of the ramp.
[ "Returns", "the", "generated", "ramp", "and", "a", "time", "array", "." ]
train
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L390-L457
PonteIneptique/collatinus-python
pycollatinus/lemme.py
Lemme.ajIrreg
def ajIrreg(self, irr): """ Ajoute au lemme l'obet irr, représente une forme irrégulière. Lorsque les formes irrégulières sont trop nombreuses, lorsque plusieurs lemmes ont des formes analogues, vaut ajouter un modèle dans data/modeles.la. ...
python
def ajIrreg(self, irr): """ Ajoute au lemme l'obet irr, représente une forme irrégulière. Lorsque les formes irrégulières sont trop nombreuses, lorsque plusieurs lemmes ont des formes analogues, vaut ajouter un modèle dans data/modeles.la. ...
[ "def", "ajIrreg", "(", "self", ",", "irr", ")", ":", "self", ".", "_irregs", ".", "append", "(", "irr", ")", "# ajouter les numéros de morpho à la liste", "# des morphos irrégulières du lemme :", "if", "irr", ".", "exclusif", "(", ")", ":", "self", ".", "_morpho...
Ajoute au lemme l'obet irr, représente une forme irrégulière. Lorsque les formes irrégulières sont trop nombreuses, lorsque plusieurs lemmes ont des formes analogues, vaut ajouter un modèle dans data/modeles.la. :param irr: Irrégulier ...
[ "Ajoute", "au", "lemme", "l", "obet", "irr", "représente", "une", "forme", "irrégulière", ".", "Lorsque", "les", "formes", "irrégulières", "sont", "trop", "nombreuses", "lorsque", "plusieurs", "lemmes", "ont", "des", "formes", "analogues", "vaut", "ajouter", "un...
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/lemme.py#L127-L141
PonteIneptique/collatinus-python
pycollatinus/lemme.py
Lemme.ajRadical
def ajRadical(self, i, r=None): """ Ajoute le radical r de numéro i à la map des radicaux du lemme. :param i: Index de radical :type i: int :param r: Radical à ajouter :type r: Radical """ if r: self._radicaux[i].append(r)
python
def ajRadical(self, i, r=None): """ Ajoute le radical r de numéro i à la map des radicaux du lemme. :param i: Index de radical :type i: int :param r: Radical à ajouter :type r: Radical """ if r: self._radicaux[i].append(r)
[ "def", "ajRadical", "(", "self", ",", "i", ",", "r", "=", "None", ")", ":", "if", "r", ":", "self", ".", "_radicaux", "[", "i", "]", ".", "append", "(", "r", ")" ]
Ajoute le radical r de numéro i à la map des radicaux du lemme. :param i: Index de radical :type i: int :param r: Radical à ajouter :type r: Radical
[ "Ajoute", "le", "radical", "r", "de", "numéro", "i", "à", "la", "map", "des", "radicaux", "du", "lemme", "." ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/lemme.py#L143-L152
PonteIneptique/collatinus-python
pycollatinus/lemme.py
Lemme.genre
def genre(self): """ Cette routine convertit les indications morphologiques, données dans le fichier lemmes.la, pour exprimer le genre du mot dans la langue courante. :return: Genre :rtype: str """ _genre = "" if " m." in self._indMorph: _genre += "m" ...
python
def genre(self): """ Cette routine convertit les indications morphologiques, données dans le fichier lemmes.la, pour exprimer le genre du mot dans la langue courante. :return: Genre :rtype: str """ _genre = "" if " m." in self._indMorph: _genre += "m" ...
[ "def", "genre", "(", "self", ")", ":", "_genre", "=", "\"\"", "if", "\" m.\"", "in", "self", ".", "_indMorph", ":", "_genre", "+=", "\"m\"", "if", "\" f.\"", "in", "self", ".", "_indMorph", ":", "_genre", "+=", "\"f\"", "if", "\" n.\"", "in", "self", ...
Cette routine convertit les indications morphologiques, données dans le fichier lemmes.la, pour exprimer le genre du mot dans la langue courante. :return: Genre :rtype: str
[ "Cette", "routine", "convertit", "les", "indications", "morphologiques", "données", "dans", "le", "fichier", "lemmes", ".", "la", "pour", "exprimer", "le", "genre", "du", "mot", "dans", "la", "langue", "courante", "." ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/lemme.py#L177-L196
PonteIneptique/collatinus-python
pycollatinus/lemme.py
Lemme.irreg
def irreg(self, i): """ Renvoie la forme irrégulière de morpho i. excl devient True si elle est exclusive, sinon. :return: Forme irrégulière de morpho i, Exclusivité :rtype: tuple.<str, bool> """ excl = False for ir in self._irregs: if i in ir.morphos(): ...
python
def irreg(self, i): """ Renvoie la forme irrégulière de morpho i. excl devient True si elle est exclusive, sinon. :return: Forme irrégulière de morpho i, Exclusivité :rtype: tuple.<str, bool> """ excl = False for ir in self._irregs: if i in ir.morphos(): ...
[ "def", "irreg", "(", "self", ",", "i", ")", ":", "excl", "=", "False", "for", "ir", "in", "self", ".", "_irregs", ":", "if", "i", "in", "ir", ".", "morphos", "(", ")", ":", "return", "ir", ".", "grq", "(", ")", ",", "ir", ".", "exclusif", "re...
Renvoie la forme irrégulière de morpho i. excl devient True si elle est exclusive, sinon. :return: Forme irrégulière de morpho i, Exclusivité :rtype: tuple.<str, bool>
[ "Renvoie", "la", "forme", "irrégulière", "de", "morpho", "i", ".", "excl", "devient", "True", "si", "elle", "est", "exclusive", "sinon", "." ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/lemme.py#L227-L237
PonteIneptique/collatinus-python
pycollatinus/lemme.py
Lemme.pos
def pos(self): """ Renvoie un caractère représentant la catégorie (part of speech, orationis) du lemme. :return: Caractère représentant la catégorie (part of speech, orationis) du lemme. :rtype: str """ if not self._pos and self._renvoi: lr = self._lemmatiseur.lemme(...
python
def pos(self): """ Renvoie un caractère représentant la catégorie (part of speech, orationis) du lemme. :return: Caractère représentant la catégorie (part of speech, orationis) du lemme. :rtype: str """ if not self._pos and self._renvoi: lr = self._lemmatiseur.lemme(...
[ "def", "pos", "(", "self", ")", ":", "if", "not", "self", ".", "_pos", "and", "self", ".", "_renvoi", ":", "lr", "=", "self", ".", "_lemmatiseur", ".", "lemme", "(", "self", ".", "_renvoi", ")", "if", "lr", ":", "return", "lr", ".", "pos", "(", ...
Renvoie un caractère représentant la catégorie (part of speech, orationis) du lemme. :return: Caractère représentant la catégorie (part of speech, orationis) du lemme. :rtype: str
[ "Renvoie", "un", "caractère", "représentant", "la", "catégorie", "(", "part", "of", "speech", "orationis", ")", "du", "lemme", "." ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/lemme.py#L275-L285
PonteIneptique/collatinus-python
pycollatinus/lemme.py
Lemme.possible_forms
def possible_forms(self): """ Generate a list of possible forms for the current lemma :returns: List of possible forms for the current lemma :rtype: [str] """ forms = [] for morph in self.modele().morphos(): for desinence in self.modele().desinences(morph): ...
python
def possible_forms(self): """ Generate a list of possible forms for the current lemma :returns: List of possible forms for the current lemma :rtype: [str] """ forms = [] for morph in self.modele().morphos(): for desinence in self.modele().desinences(morph): ...
[ "def", "possible_forms", "(", "self", ")", ":", "forms", "=", "[", "]", "for", "morph", "in", "self", ".", "modele", "(", ")", ".", "morphos", "(", ")", ":", "for", "desinence", "in", "self", ".", "modele", "(", ")", ".", "desinences", "(", "morph"...
Generate a list of possible forms for the current lemma :returns: List of possible forms for the current lemma :rtype: [str]
[ "Generate", "a", "list", "of", "possible", "forms", "for", "the", "current", "lemma" ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/lemme.py#L338-L353
JonLiuFYI/pkdx
pkdx/pkdx/scrape_moves.py
get_moves
def get_moves(): """Visit Bulbapedia and pull names and descriptions from the table, 'list of moves.' Save as JSON.""" page = requests.get('http://bulbapedia.bulbagarden.net/wiki/List_of_moves') soup = bs4.BeautifulSoup(page.text) table = soup.table.table tablerows = [tr for tr in table.children if ...
python
def get_moves(): """Visit Bulbapedia and pull names and descriptions from the table, 'list of moves.' Save as JSON.""" page = requests.get('http://bulbapedia.bulbagarden.net/wiki/List_of_moves') soup = bs4.BeautifulSoup(page.text) table = soup.table.table tablerows = [tr for tr in table.children if ...
[ "def", "get_moves", "(", ")", ":", "page", "=", "requests", ".", "get", "(", "'http://bulbapedia.bulbagarden.net/wiki/List_of_moves'", ")", "soup", "=", "bs4", ".", "BeautifulSoup", "(", "page", ".", "text", ")", "table", "=", "soup", ".", "table", ".", "tab...
Visit Bulbapedia and pull names and descriptions from the table, 'list of moves.' Save as JSON.
[ "Visit", "Bulbapedia", "and", "pull", "names", "and", "descriptions", "from", "the", "table", "list", "of", "moves", ".", "Save", "as", "JSON", "." ]
train
https://github.com/JonLiuFYI/pkdx/blob/269e9814df074e0df25972fad04539a644d73a3c/pkdx/pkdx/scrape_moves.py#L12-L31
robertchase/ergaleia
ergaleia/load_from_path.py
load_from_path
def load_from_path(path, filetype=None, has_filetype=True): """ load file content from a file specified as dot-separated The file is located according to logic in normalize_path, and the contents are returned. (See Note 1) Parameters: (see normalize_path) path - dot-sep...
python
def load_from_path(path, filetype=None, has_filetype=True): """ load file content from a file specified as dot-separated The file is located according to logic in normalize_path, and the contents are returned. (See Note 1) Parameters: (see normalize_path) path - dot-sep...
[ "def", "load_from_path", "(", "path", ",", "filetype", "=", "None", ",", "has_filetype", "=", "True", ")", ":", "if", "not", "isinstance", "(", "path", ",", "str", ")", ":", "try", ":", "return", "path", ".", "read", "(", ")", "except", "AttributeError...
load file content from a file specified as dot-separated The file is located according to logic in normalize_path, and the contents are returned. (See Note 1) Parameters: (see normalize_path) path - dot-separated path filetype - optional filetype ...
[ "load", "file", "content", "from", "a", "file", "specified", "as", "dot", "-", "separated" ]
train
https://github.com/robertchase/ergaleia/blob/df8e9a4b18c563022a503faa27e822c9a5755490/ergaleia/load_from_path.py#L9-L36
robertchase/ergaleia
ergaleia/load_from_path.py
load_lines_from_path
def load_lines_from_path(path, filetype=None, has_filetype=True): """ load lines from a file specified as dot-separated The file is located according to logic in normalize_path, and a list of lines is returned. (See Note 1) Parameters: (see normalize_path) path - dot-se...
python
def load_lines_from_path(path, filetype=None, has_filetype=True): """ load lines from a file specified as dot-separated The file is located according to logic in normalize_path, and a list of lines is returned. (See Note 1) Parameters: (see normalize_path) path - dot-se...
[ "def", "load_lines_from_path", "(", "path", ",", "filetype", "=", "None", ",", "has_filetype", "=", "True", ")", ":", "if", "not", "isinstance", "(", "path", ",", "str", ")", ":", "try", ":", "return", "path", ".", "readlines", "(", ")", "except", "Att...
load lines from a file specified as dot-separated The file is located according to logic in normalize_path, and a list of lines is returned. (See Note 1) Parameters: (see normalize_path) path - dot-separated path filetype - optional filetype has_...
[ "load", "lines", "from", "a", "file", "specified", "as", "dot", "-", "separated" ]
train
https://github.com/robertchase/ergaleia/blob/df8e9a4b18c563022a503faa27e822c9a5755490/ergaleia/load_from_path.py#L39-L66
iamFIREcracker/aadbook
aadbook/contacts.py
Cache.save
def save(self): """Pickle the addressbook and a timestamp """ if self.contacts: # never write a empty addressbook cache = {'contacts': self.contacts, 'aadbook_cache': CACHE_FORMAT_VERSION} pickle.dump(cache, open(self._config.cache_filename, 'wb'))
python
def save(self): """Pickle the addressbook and a timestamp """ if self.contacts: # never write a empty addressbook cache = {'contacts': self.contacts, 'aadbook_cache': CACHE_FORMAT_VERSION} pickle.dump(cache, open(self._config.cache_filename, 'wb'))
[ "def", "save", "(", "self", ")", ":", "if", "self", ".", "contacts", ":", "# never write a empty addressbook", "cache", "=", "{", "'contacts'", ":", "self", ".", "contacts", ",", "'aadbook_cache'", ":", "CACHE_FORMAT_VERSION", "}", "pickle", ".", "dump", "(", ...
Pickle the addressbook and a timestamp
[ "Pickle", "the", "addressbook", "and", "a", "timestamp" ]
train
https://github.com/iamFIREcracker/aadbook/blob/d191e9d36a2309449ab91c1728eaf5901b7ef91c/aadbook/contacts.py#L52-L59
tmr232/rage
rage/value.py
parse_value
def parse_value(named_reg_value): """ Convert the value returned from EnumValue to a (name, value) tuple using the value classes. """ name, value, value_type = named_reg_value value_class = REG_VALUE_TYPE_MAP[value_type] return name, value_class(value)
python
def parse_value(named_reg_value): """ Convert the value returned from EnumValue to a (name, value) tuple using the value classes. """ name, value, value_type = named_reg_value value_class = REG_VALUE_TYPE_MAP[value_type] return name, value_class(value)
[ "def", "parse_value", "(", "named_reg_value", ")", ":", "name", ",", "value", ",", "value_type", "=", "named_reg_value", "value_class", "=", "REG_VALUE_TYPE_MAP", "[", "value_type", "]", "return", "name", ",", "value_class", "(", "value", ")" ]
Convert the value returned from EnumValue to a (name, value) tuple using the value classes.
[ "Convert", "the", "value", "returned", "from", "EnumValue", "to", "a", "(", "name", "value", ")", "tuple", "using", "the", "value", "classes", "." ]
train
https://github.com/tmr232/rage/blob/0973a43a6956e8bacd14245509b26608f6649edb/rage/value.py#L50-L56
zagfai/webtul
webtul/task.py
Task.get
def get(self, timeout=10): """get() -> {'id': 32-byte-md5, 'body': msg-body}""" req = self.req({'op': 'GET', 'timeout': timeout}) if req.status_code != 200: return None result = req.json() if result.get('status') != 'ok': return False return result
python
def get(self, timeout=10): """get() -> {'id': 32-byte-md5, 'body': msg-body}""" req = self.req({'op': 'GET', 'timeout': timeout}) if req.status_code != 200: return None result = req.json() if result.get('status') != 'ok': return False return result
[ "def", "get", "(", "self", ",", "timeout", "=", "10", ")", ":", "req", "=", "self", ".", "req", "(", "{", "'op'", ":", "'GET'", ",", "'timeout'", ":", "timeout", "}", ")", "if", "req", ".", "status_code", "!=", "200", ":", "return", "None", "resu...
get() -> {'id': 32-byte-md5, 'body': msg-body}
[ "get", "()", "-", ">", "{", "id", ":", "32", "-", "byte", "-", "md5", "body", ":", "msg", "-", "body", "}" ]
train
https://github.com/zagfai/webtul/blob/58c49928070b56ef54a45b4af20d800b269ad8ce/webtul/task.py#L192-L200
ArabellaTech/aa-intercom
aa_intercom/mixins.py
IntercomUserMixin.get_intercom_data
def get_intercom_data(self): """Specify the user data sent to Intercom API""" return { "user_id": self.intercom_id, "email": self.email, "name": self.get_full_name(), "last_request_at": self.last_login.strftime("%s") if self.last_login else "", ...
python
def get_intercom_data(self): """Specify the user data sent to Intercom API""" return { "user_id": self.intercom_id, "email": self.email, "name": self.get_full_name(), "last_request_at": self.last_login.strftime("%s") if self.last_login else "", ...
[ "def", "get_intercom_data", "(", "self", ")", ":", "return", "{", "\"user_id\"", ":", "self", ".", "intercom_id", ",", "\"email\"", ":", "self", ".", "email", ",", "\"name\"", ":", "self", ".", "get_full_name", "(", ")", ",", "\"last_request_at\"", ":", "s...
Specify the user data sent to Intercom API
[ "Specify", "the", "user", "data", "sent", "to", "Intercom", "API" ]
train
https://github.com/ArabellaTech/aa-intercom/blob/f7e2ab63967529660f9c2fe4f1d0bf3cec1502c2/aa_intercom/mixins.py#L17-L28
noobermin/lspreader
lspreader/lspreader.py
get_list
def get_list(file,fmt): '''makes a list out of the fmt from the LspOutput f using the format i for int f for float d for double s for string''' out=[] for i in fmt: if i == 'i': out.append(get_int(file)); elif i == 'f' or i == 'd': out.appe...
python
def get_list(file,fmt): '''makes a list out of the fmt from the LspOutput f using the format i for int f for float d for double s for string''' out=[] for i in fmt: if i == 'i': out.append(get_int(file)); elif i == 'f' or i == 'd': out.appe...
[ "def", "get_list", "(", "file", ",", "fmt", ")", ":", "out", "=", "[", "]", "for", "i", "in", "fmt", ":", "if", "i", "==", "'i'", ":", "out", ".", "append", "(", "get_int", "(", "file", ")", ")", "elif", "i", "==", "'f'", "or", "i", "==", "...
makes a list out of the fmt from the LspOutput f using the format i for int f for float d for double s for string
[ "makes", "a", "list", "out", "of", "the", "fmt", "from", "the", "LspOutput", "f", "using", "the", "format", "i", "for", "int", "f", "for", "float", "d", "for", "double", "s", "for", "string" ]
train
https://github.com/noobermin/lspreader/blob/903b9d6427513b07986ffacf76cbca54e18d8be6/lspreader/lspreader.py#L43-L59
noobermin/lspreader
lspreader/lspreader.py
get_header
def get_header(file,**kw): '''gets the header for the .p4 file, note that this Advanced the file position to the end of the header. Returns the size of the header, and the size of the header, if the header keyword is true. ''' if type(file) == str: #if called with a file...
python
def get_header(file,**kw): '''gets the header for the .p4 file, note that this Advanced the file position to the end of the header. Returns the size of the header, and the size of the header, if the header keyword is true. ''' if type(file) == str: #if called with a file...
[ "def", "get_header", "(", "file", ",", "*", "*", "kw", ")", ":", "if", "type", "(", "file", ")", "==", "str", ":", "#if called with a filename, recall with opened file.", "if", "test", "(", "kw", ",", "\"gzip\"", ")", "and", "kw", "[", "'gzip'", "]", "==...
gets the header for the .p4 file, note that this Advanced the file position to the end of the header. Returns the size of the header, and the size of the header, if the header keyword is true.
[ "gets", "the", "header", "for", "the", ".", "p4", "file", "note", "that", "this", "Advanced", "the", "file", "position", "to", "the", "end", "of", "the", "header", ".", "Returns", "the", "size", "of", "the", "header", "and", "the", "size", "of", "the",...
train
https://github.com/noobermin/lspreader/blob/903b9d6427513b07986ffacf76cbca54e18d8be6/lspreader/lspreader.py#L65-L152
noobermin/lspreader
lspreader/lspreader.py
flds_firstsort
def flds_firstsort(d): ''' Perform a lexsort and return the sort indices and shape as a tuple. ''' shape = [ len( np.unique(d[l]) ) for l in ['xs', 'ys', 'zs'] ]; si = np.lexsort((d['z'],d['y'],d['x'])); return si,shape;
python
def flds_firstsort(d): ''' Perform a lexsort and return the sort indices and shape as a tuple. ''' shape = [ len( np.unique(d[l]) ) for l in ['xs', 'ys', 'zs'] ]; si = np.lexsort((d['z'],d['y'],d['x'])); return si,shape;
[ "def", "flds_firstsort", "(", "d", ")", ":", "shape", "=", "[", "len", "(", "np", ".", "unique", "(", "d", "[", "l", "]", ")", ")", "for", "l", "in", "[", "'xs'", ",", "'ys'", ",", "'zs'", "]", "]", "si", "=", "np", ".", "lexsort", "(", "("...
Perform a lexsort and return the sort indices and shape as a tuple.
[ "Perform", "a", "lexsort", "and", "return", "the", "sort", "indices", "and", "shape", "as", "a", "tuple", "." ]
train
https://github.com/noobermin/lspreader/blob/903b9d6427513b07986ffacf76cbca54e18d8be6/lspreader/lspreader.py#L155-L162
noobermin/lspreader
lspreader/lspreader.py
flds_sort
def flds_sort(d,s): ''' Sort based on position. Sort with s as a tuple of the sort indices and shape from first sort. Parameters: ----------- d -- the flds/sclr data s -- (si, shape) sorting and shaping data from firstsort. ''' labels = [ key for key in d.keys() ...
python
def flds_sort(d,s): ''' Sort based on position. Sort with s as a tuple of the sort indices and shape from first sort. Parameters: ----------- d -- the flds/sclr data s -- (si, shape) sorting and shaping data from firstsort. ''' labels = [ key for key in d.keys() ...
[ "def", "flds_sort", "(", "d", ",", "s", ")", ":", "labels", "=", "[", "key", "for", "key", "in", "d", ".", "keys", "(", ")", "if", "key", "not", "in", "[", "'t'", ",", "'xs'", ",", "'ys'", ",", "'zs'", ",", "'fd'", ",", "'sd'", "]", "]", "s...
Sort based on position. Sort with s as a tuple of the sort indices and shape from first sort. Parameters: ----------- d -- the flds/sclr data s -- (si, shape) sorting and shaping data from firstsort.
[ "Sort", "based", "on", "position", ".", "Sort", "with", "s", "as", "a", "tuple", "of", "the", "sort", "indices", "and", "shape", "from", "first", "sort", "." ]
train
https://github.com/noobermin/lspreader/blob/903b9d6427513b07986ffacf76cbca54e18d8be6/lspreader/lspreader.py#L163-L180
noobermin/lspreader
lspreader/lspreader.py
read
def read(fname,**kw): ''' Reads an lsp output file and returns a raw dump of data, sectioned into quantities either as an dictionary or a typed numpy array. Parameters: ----------- fname -- filename of thing to read Keyword Arguments: ------------------ vprint -- Verbose p...
python
def read(fname,**kw): ''' Reads an lsp output file and returns a raw dump of data, sectioned into quantities either as an dictionary or a typed numpy array. Parameters: ----------- fname -- filename of thing to read Keyword Arguments: ------------------ vprint -- Verbose p...
[ "def", "read", "(", "fname", ",", "*", "*", "kw", ")", ":", "if", "test", "(", "kw", ",", "'gzip'", ")", "and", "kw", "[", "'gzip'", "]", "==", "'guess'", ":", "kw", "[", "'gzip'", "]", "=", "re", ".", "search", "(", "r'\\.gz$'", ",", "fname", ...
Reads an lsp output file and returns a raw dump of data, sectioned into quantities either as an dictionary or a typed numpy array. Parameters: ----------- fname -- filename of thing to read Keyword Arguments: ------------------ vprint -- Verbose printer. Used in scripts overri...
[ "Reads", "an", "lsp", "output", "file", "and", "returns", "a", "raw", "dump", "of", "data", "sectioned", "into", "quantities", "either", "as", "an", "dictionary", "or", "a", "typed", "numpy", "array", "." ]
train
https://github.com/noobermin/lspreader/blob/903b9d6427513b07986ffacf76cbca54e18d8be6/lspreader/lspreader.py#L319-L407
decryptus/httpdis
httpdis/httpdis.py
register
def register(handler, op, safe_init = None, at_start = None, name = None, at_stop = None, static = False, root = None, replacement = None, charset ...
python
def register(handler, op, safe_init = None, at_start = None, name = None, at_stop = None, static = False, root = None, replacement = None, charset ...
[ "def", "register", "(", "handler", ",", "op", ",", "safe_init", "=", "None", ",", "at_start", "=", "None", ",", "name", "=", "None", ",", "at_stop", "=", "None", ",", "static", "=", "False", ",", "root", "=", "None", ",", "replacement", "=", "None", ...
Register a command @handler: function to execute when the command is received @op: http method(s) @safe_init: called by the safe_init() function of this module @at_start: called once just before the server starts @at_stop: called once just before the server stops @name: name of the command (if n...
[ "Register", "a", "command", "@handler", ":", "function", "to", "execute", "when", "the", "command", "is", "received", "@op", ":", "http", "method", "(", "s", ")", "@safe_init", ":", "called", "by", "the", "safe_init", "()", "function", "of", "this", "modul...
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L1018-L1112
decryptus/httpdis
httpdis/httpdis.py
sigterm_handler
def sigterm_handler(signum, stack_frame): """ Just tell the server to exit. WARNING: There are race conditions, for example with TimeoutSocket.accept. We don't care: the user can just rekill the process after like 1 sec. if the first kill did not work. """ # pylint: disable-msg=W0613 gl...
python
def sigterm_handler(signum, stack_frame): """ Just tell the server to exit. WARNING: There are race conditions, for example with TimeoutSocket.accept. We don't care: the user can just rekill the process after like 1 sec. if the first kill did not work. """ # pylint: disable-msg=W0613 gl...
[ "def", "sigterm_handler", "(", "signum", ",", "stack_frame", ")", ":", "# pylint: disable-msg=W0613", "global", "_KILLED", "for", "name", ",", "cmd", "in", "_COMMANDS", ".", "iteritems", "(", ")", ":", "if", "cmd", ".", "at_stop", ":", "LOG", ".", "info", ...
Just tell the server to exit. WARNING: There are race conditions, for example with TimeoutSocket.accept. We don't care: the user can just rekill the process after like 1 sec. if the first kill did not work.
[ "Just", "tell", "the", "server", "to", "exit", "." ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L1114-L1134
decryptus/httpdis
httpdis/httpdis.py
run
def run(options, http_req_handler = HttpReqHandler): """ Start and execute the server """ # pylint: disable-msg=W0613 global _HTTP_SERVER for x in ('server_version', 'sys_version'): if _OPTIONS.get(x) is not None: setattr(http_req_handler, x, _OPTIONS[x]) _HTTP_SERVER =...
python
def run(options, http_req_handler = HttpReqHandler): """ Start and execute the server """ # pylint: disable-msg=W0613 global _HTTP_SERVER for x in ('server_version', 'sys_version'): if _OPTIONS.get(x) is not None: setattr(http_req_handler, x, _OPTIONS[x]) _HTTP_SERVER =...
[ "def", "run", "(", "options", ",", "http_req_handler", "=", "HttpReqHandler", ")", ":", "# pylint: disable-msg=W0613", "global", "_HTTP_SERVER", "for", "x", "in", "(", "'server_version'", ",", "'sys_version'", ")", ":", "if", "_OPTIONS", ".", "get", "(", "x", ...
Start and execute the server
[ "Start", "and", "execute", "the", "server" ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L1139-L1173
decryptus/httpdis
httpdis/httpdis.py
init
def init(options, use_sigterm_handler=True): """ Must be called just after registration, before anything else """ # pylint: disable-msg=W0613 global _AUTH, _OPTIONS if isinstance(options, dict): _OPTIONS = DEFAULT_OPTIONS.copy() _OPTIONS.update(options) else: for opt...
python
def init(options, use_sigterm_handler=True): """ Must be called just after registration, before anything else """ # pylint: disable-msg=W0613 global _AUTH, _OPTIONS if isinstance(options, dict): _OPTIONS = DEFAULT_OPTIONS.copy() _OPTIONS.update(options) else: for opt...
[ "def", "init", "(", "options", ",", "use_sigterm_handler", "=", "True", ")", ":", "# pylint: disable-msg=W0613", "global", "_AUTH", ",", "_OPTIONS", "if", "isinstance", "(", "options", ",", "dict", ")", ":", "_OPTIONS", "=", "DEFAULT_OPTIONS", ".", "copy", "("...
Must be called just after registration, before anything else
[ "Must", "be", "called", "just", "after", "registration", "before", "anything", "else" ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L1178-L1217
decryptus/httpdis
httpdis/httpdis.py
HttpReqError.report
def report(self, req_handler): "Send a response corresponding to this error to the client" if self.exc: req_handler.send_exception(self.code, self.exc, self.headers) return text = (self.text or BaseHTTPRequestHandler.responses[self.code][1] ...
python
def report(self, req_handler): "Send a response corresponding to this error to the client" if self.exc: req_handler.send_exception(self.code, self.exc, self.headers) return text = (self.text or BaseHTTPRequestHandler.responses[self.code][1] ...
[ "def", "report", "(", "self", ",", "req_handler", ")", ":", "if", "self", ".", "exc", ":", "req_handler", ".", "send_exception", "(", "self", ".", "code", ",", "self", ".", "exc", ",", "self", ".", "headers", ")", "return", "text", "=", "(", "self", ...
Send a response corresponding to this error to the client
[ "Send", "a", "response", "corresponding", "to", "this", "error", "to", "the", "client" ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L224-L234
decryptus/httpdis
httpdis/httpdis.py
HttpReqHandler.log_request
def log_request(self, code='-', size='-'): """ Called by send_response() TODO: a configuration option to log or not (maybe using logging filters?) TODO: discriminate by code and dispatch to various log levels """ LOG.info("%r %s %s", self.requestline, code, si...
python
def log_request(self, code='-', size='-'): """ Called by send_response() TODO: a configuration option to log or not (maybe using logging filters?) TODO: discriminate by code and dispatch to various log levels """ LOG.info("%r %s %s", self.requestline, code, si...
[ "def", "log_request", "(", "self", ",", "code", "=", "'-'", ",", "size", "=", "'-'", ")", ":", "LOG", ".", "info", "(", "\"%r %s %s\"", ",", "self", ".", "requestline", ",", "code", ",", "size", ")" ]
Called by send_response() TODO: a configuration option to log or not (maybe using logging filters?) TODO: discriminate by code and dispatch to various log levels
[ "Called", "by", "send_response", "()", "TODO", ":", "a", "configuration", "option", "to", "log", "or", "not", "(", "maybe", "using", "logging", "filters?", ")", "TODO", ":", "discriminate", "by", "code", "and", "dispatch", "to", "various", "log", "levels" ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L410-L417
decryptus/httpdis
httpdis/httpdis.py
HttpReqHandler.send_response
def send_response(self, code, message=None, size='-'): """ Send the response header and log the response code. Also send two standard headers with the server software version and the current date. """ # pylint: disable-msg=W0221 if self._to_log or LOG.isEnabledFo...
python
def send_response(self, code, message=None, size='-'): """ Send the response header and log the response code. Also send two standard headers with the server software version and the current date. """ # pylint: disable-msg=W0221 if self._to_log or LOG.isEnabledFo...
[ "def", "send_response", "(", "self", ",", "code", ",", "message", "=", "None", ",", "size", "=", "'-'", ")", ":", "# pylint: disable-msg=W0221", "if", "self", ".", "_to_log", "or", "LOG", ".", "isEnabledFor", "(", "logging", ".", "DEBUG", ")", ":", "self...
Send the response header and log the response code. Also send two standard headers with the server software version and the current date.
[ "Send", "the", "response", "header", "and", "log", "the", "response", "code", "." ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L419-L440
decryptus/httpdis
httpdis/httpdis.py
HttpReqHandler.send_error_explain
def send_error_explain(self, code, message=None, headers=None, content_type=None): "do not use directly" if headers is None: headers = {} if code in self.responses: if message is None: message = self.responses[code][0] explain = self.response...
python
def send_error_explain(self, code, message=None, headers=None, content_type=None): "do not use directly" if headers is None: headers = {} if code in self.responses: if message is None: message = self.responses[code][0] explain = self.response...
[ "def", "send_error_explain", "(", "self", ",", "code", ",", "message", "=", "None", ",", "headers", "=", "None", ",", "content_type", "=", "None", ")", ":", "if", "headers", "is", "None", ":", "headers", "=", "{", "}", "if", "code", "in", "self", "."...
do not use directly
[ "do", "not", "use", "directly" ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L489-L523
decryptus/httpdis
httpdis/httpdis.py
HttpReqHandler.send_error_msgtxt
def send_error_msgtxt(self, code, message, headers=None): "text will be in a <pre> bloc" if headers is None: headers = {} if isinstance(message, (list, tuple)): message = ''.join(message) elif isinstance(message, dict): message = repr(message) ...
python
def send_error_msgtxt(self, code, message, headers=None): "text will be in a <pre> bloc" if headers is None: headers = {} if isinstance(message, (list, tuple)): message = ''.join(message) elif isinstance(message, dict): message = repr(message) ...
[ "def", "send_error_msgtxt", "(", "self", ",", "code", ",", "message", ",", "headers", "=", "None", ")", ":", "if", "headers", "is", "None", ":", "headers", "=", "{", "}", "if", "isinstance", "(", "message", ",", "(", "list", ",", "tuple", ")", ")", ...
text will be in a <pre> bloc
[ "text", "will", "be", "in", "a", "<pre", ">", "bloc" ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L525-L538
decryptus/httpdis
httpdis/httpdis.py
HttpReqHandler.send_exception
def send_exception(self, code, exc_info=None, headers=None): "send an error response including a backtrace to the client" if headers is None: headers = {} if not exc_info: exc_info = sys.exc_info() self.send_error_msg(code, traceback....
python
def send_exception(self, code, exc_info=None, headers=None): "send an error response including a backtrace to the client" if headers is None: headers = {} if not exc_info: exc_info = sys.exc_info() self.send_error_msg(code, traceback....
[ "def", "send_exception", "(", "self", ",", "code", ",", "exc_info", "=", "None", ",", "headers", "=", "None", ")", ":", "if", "headers", "is", "None", ":", "headers", "=", "{", "}", "if", "not", "exc_info", ":", "exc_info", "=", "sys", ".", "exc_info...
send an error response including a backtrace to the client
[ "send", "an", "error", "response", "including", "a", "backtrace", "to", "the", "client" ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L540-L550
decryptus/httpdis
httpdis/httpdis.py
HttpReqHandler.send_error_json
def send_error_json(self, code, message, headers=None): "send an error to the client. text message is formatted in a json stream" if headers is None: headers = {} self.end_response(HttpResponseJson(code, {'code': code, ...
python
def send_error_json(self, code, message, headers=None): "send an error to the client. text message is formatted in a json stream" if headers is None: headers = {} self.end_response(HttpResponseJson(code, {'code': code, ...
[ "def", "send_error_json", "(", "self", ",", "code", ",", "message", ",", "headers", "=", "None", ")", ":", "if", "headers", "is", "None", ":", "headers", "=", "{", "}", "self", ".", "end_response", "(", "HttpResponseJson", "(", "code", ",", "{", "'code...
send an error to the client. text message is formatted in a json stream
[ "send", "an", "error", "to", "the", "client", ".", "text", "message", "is", "formatted", "in", "a", "json", "stream" ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L552-L560
decryptus/httpdis
httpdis/httpdis.py
HttpReqHandler._pathify
def _pathify(self): """ rfc2616 says in 5.1.2: "all HTTP/1.1 servers MUST accept the absoluteURI form in requests" so if we get one, transform it to abs_path. Raises HttpReqError if the request is malformed, else returns (path, query, fragment) """ try: ...
python
def _pathify(self): """ rfc2616 says in 5.1.2: "all HTTP/1.1 servers MUST accept the absoluteURI form in requests" so if we get one, transform it to abs_path. Raises HttpReqError if the request is malformed, else returns (path, query, fragment) """ try: ...
[ "def", "_pathify", "(", "self", ")", ":", "try", ":", "(", "path", ",", "query", ",", "self", ".", "_fragment", ")", "=", "urisup", ".", "uri_help_split", "(", "self", ".", "path", ")", "[", "2", ":", "]", "if", "not", "path", ":", "path", "=", ...
rfc2616 says in 5.1.2: "all HTTP/1.1 servers MUST accept the absoluteURI form in requests" so if we get one, transform it to abs_path. Raises HttpReqError if the request is malformed, else returns (path, query, fragment)
[ "rfc2616", "says", "in", "5", ".", "1", ".", "2", ":", "all", "HTTP", "/", "1", ".", "1", "servers", "MUST", "accept", "the", "absoluteURI", "form", "in", "requests", "so", "if", "we", "get", "one", "transform", "it", "to", "abs_path", ".", "Raises",...
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L706-L733
decryptus/httpdis
httpdis/httpdis.py
HttpReqHandler.data_from_query
def data_from_query(self, cmd): """ Callback for .execute_command() for DELETE/GET/HEAD requests """ res = None ckey = "%s /%s" % (self.command, cmd) if not isinstance(self._query_params, dict): self._query_params = {} if ckey in _NCMD: ...
python
def data_from_query(self, cmd): """ Callback for .execute_command() for DELETE/GET/HEAD requests """ res = None ckey = "%s /%s" % (self.command, cmd) if not isinstance(self._query_params, dict): self._query_params = {} if ckey in _NCMD: ...
[ "def", "data_from_query", "(", "self", ",", "cmd", ")", ":", "res", "=", "None", "ckey", "=", "\"%s /%s\"", "%", "(", "self", ".", "command", ",", "cmd", ")", "if", "not", "isinstance", "(", "self", ".", "_query_params", ",", "dict", ")", ":", "self"...
Callback for .execute_command() for DELETE/GET/HEAD requests
[ "Callback", "for", ".", "execute_command", "()", "for", "DELETE", "/", "GET", "/", "HEAD", "requests" ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L794-L840
decryptus/httpdis
httpdis/httpdis.py
HttpReqHandler.data_from_payload
def data_from_payload(self, cmd): """ Callback for .execute_command() for PATCH/POST/PUT requests """ multipart = False ckey = "%s /%s" % (self.command, cmd) if not isinstance(self._query_params, dict): self._query_params = {} if ckey in _NCMD: ...
python
def data_from_payload(self, cmd): """ Callback for .execute_command() for PATCH/POST/PUT requests """ multipart = False ckey = "%s /%s" % (self.command, cmd) if not isinstance(self._query_params, dict): self._query_params = {} if ckey in _NCMD: ...
[ "def", "data_from_payload", "(", "self", ",", "cmd", ")", ":", "multipart", "=", "False", "ckey", "=", "\"%s /%s\"", "%", "(", "self", ".", "command", ",", "cmd", ")", "if", "not", "isinstance", "(", "self", ".", "_query_params", ",", "dict", ")", ":",...
Callback for .execute_command() for PATCH/POST/PUT requests
[ "Callback", "for", ".", "execute_command", "()", "for", "PATCH", "/", "POST", "/", "PUT", "requests" ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L842-L934
decryptus/httpdis
httpdis/httpdis.py
HttpReqHandler.common_req
def common_req(self, execute, send_body=True): "Common code for GET and POST requests" self._SERVER = {'CLIENT_ADDR_HOST': self.client_address[0], 'CLIENT_ADDR_PORT': self.client_address[1]} self._to_log = True self._cmd ...
python
def common_req(self, execute, send_body=True): "Common code for GET and POST requests" self._SERVER = {'CLIENT_ADDR_HOST': self.client_address[0], 'CLIENT_ADDR_PORT': self.client_address[1]} self._to_log = True self._cmd ...
[ "def", "common_req", "(", "self", ",", "execute", ",", "send_body", "=", "True", ")", ":", "self", ".", "_SERVER", "=", "{", "'CLIENT_ADDR_HOST'", ":", "self", ".", "client_address", "[", "0", "]", ",", "'CLIENT_ADDR_PORT'", ":", "self", ".", "client_addre...
Common code for GET and POST requests
[ "Common", "code", "for", "GET", "and", "POST", "requests" ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L936-L982
decryptus/httpdis
httpdis/httpdis.py
HttpReqHandler.do_OPTIONS
def do_OPTIONS(self): "OPTIONS method" req = self.build_response(code = 204) req.add_header('Access-Control-Allow-Origin', "*") req.add_header('Access-Control-Allow-Methods', "OPTIONS, POST") req.add_header('Access-Control-Allow-Headers', "Origin, X-Requested-With, Content-Type, ...
python
def do_OPTIONS(self): "OPTIONS method" req = self.build_response(code = 204) req.add_header('Access-Control-Allow-Origin', "*") req.add_header('Access-Control-Allow-Methods', "OPTIONS, POST") req.add_header('Access-Control-Allow-Headers', "Origin, X-Requested-With, Content-Type, ...
[ "def", "do_OPTIONS", "(", "self", ")", ":", "req", "=", "self", ".", "build_response", "(", "code", "=", "204", ")", "req", ".", "add_header", "(", "'Access-Control-Allow-Origin'", ",", "\"*\"", ")", "req", ".", "add_header", "(", "'Access-Control-Allow-Method...
OPTIONS method
[ "OPTIONS", "method" ]
train
https://github.com/decryptus/httpdis/blob/5d198cdc5558f416634602689b3df2c8aeb34984/httpdis/httpdis.py#L996-L1003
skitazaki/python-clitool
clitool/cli.py
base_parser
def base_parser(): """ Create arguments parser with basic options and no help message. * -c, --config: load configuration file. * -v, --verbose: increase logging verbosity. `-v`, `-vv`, and `-vvv`. * -q, --quiet: quiet logging except critical level. * -o, --output: output file. (default=sys.stdout)...
python
def base_parser(): """ Create arguments parser with basic options and no help message. * -c, --config: load configuration file. * -v, --verbose: increase logging verbosity. `-v`, `-vv`, and `-vvv`. * -q, --quiet: quiet logging except critical level. * -o, --output: output file. (default=sys.stdout)...
[ "def", "base_parser", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "add_help", "=", "False", ")", "parser", ".", "add_argument", "(", "\"-c\"", ",", "\"--config\"", ",", "dest", "=", "\"config\"", ",", "type", "=", "argparse", ".",...
Create arguments parser with basic options and no help message. * -c, --config: load configuration file. * -v, --verbose: increase logging verbosity. `-v`, `-vv`, and `-vvv`. * -q, --quiet: quiet logging except critical level. * -o, --output: output file. (default=sys.stdout) * --basedir: base dire...
[ "Create", "arguments", "parser", "with", "basic", "options", "and", "no", "help", "message", "." ]
train
https://github.com/skitazaki/python-clitool/blob/4971f8d093d51c6fd0e6cc536bbb597f78b570ab/clitool/cli.py#L25-L82
skitazaki/python-clitool
clitool/cli.py
parse_arguments
def parse_arguments(**kwargs): """ Parse command line arguments after setting basic options. If successfully parsed, set logging verbosity. This function accepts variable keyword arguments. Their values are passed to :meth:`ArgumentParser.add_argument`. If special keyword `flags` is given, it'll be ...
python
def parse_arguments(**kwargs): """ Parse command line arguments after setting basic options. If successfully parsed, set logging verbosity. This function accepts variable keyword arguments. Their values are passed to :meth:`ArgumentParser.add_argument`. If special keyword `flags` is given, it'll be ...
[ "def", "parse_arguments", "(", "*", "*", "kwargs", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "parents", "=", "[", "base_parser", "(", ")", ",", "]", ")", "for", "name", "in", "kwargs", ":", "opts", "=", "kwargs", "[", "name", "...
Parse command line arguments after setting basic options. If successfully parsed, set logging verbosity. This function accepts variable keyword arguments. Their values are passed to :meth:`ArgumentParser.add_argument`. If special keyword `flags` is given, it'll be converted as flag option. Examples...
[ "Parse", "command", "line", "arguments", "after", "setting", "basic", "options", ".", "If", "successfully", "parsed", "set", "logging", "verbosity", ".", "This", "function", "accepts", "variable", "keyword", "arguments", ".", "Their", "values", "are", "passed", ...
train
https://github.com/skitazaki/python-clitool/blob/4971f8d093d51c6fd0e6cc536bbb597f78b570ab/clitool/cli.py#L85-L150
skitazaki/python-clitool
clitool/cli.py
cliconfig
def cliconfig(fp, env=None): """ Load configuration data. Given pointer is closed internally. If ``None`` is given, force to exit. More detailed information is available on underlying feature, :mod:`clitool.config`. :param fp: opened file pointer of configuration :type fp: FileType :pa...
python
def cliconfig(fp, env=None): """ Load configuration data. Given pointer is closed internally. If ``None`` is given, force to exit. More detailed information is available on underlying feature, :mod:`clitool.config`. :param fp: opened file pointer of configuration :type fp: FileType :pa...
[ "def", "cliconfig", "(", "fp", ",", "env", "=", "None", ")", ":", "if", "fp", "is", "None", ":", "raise", "SystemExit", "(", "'No configuration file is given.'", ")", "from", "clitool", ".", "config", "import", "ConfigLoader", "loader", "=", "ConfigLoader", ...
Load configuration data. Given pointer is closed internally. If ``None`` is given, force to exit. More detailed information is available on underlying feature, :mod:`clitool.config`. :param fp: opened file pointer of configuration :type fp: FileType :param env: environment to load :typ...
[ "Load", "configuration", "data", ".", "Given", "pointer", "is", "closed", "internally", ".", "If", "None", "is", "given", "force", "to", "exit", "." ]
train
https://github.com/skitazaki/python-clitool/blob/4971f8d093d51c6fd0e6cc536bbb597f78b570ab/clitool/cli.py#L172-L195
skitazaki/python-clitool
clitool/cli.py
clistream
def clistream(reporter, *args, **kwargs): """ Handle stream data on command line interface, and returns statistics of success, error, and total amount. More detailed information is available on underlying feature, :mod:`clitool.processor`. :param Handler: [DEPRECATED] Handler for file-like streams...
python
def clistream(reporter, *args, **kwargs): """ Handle stream data on command line interface, and returns statistics of success, error, and total amount. More detailed information is available on underlying feature, :mod:`clitool.processor`. :param Handler: [DEPRECATED] Handler for file-like streams...
[ "def", "clistream", "(", "reporter", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Follow the rule of `parse_arguments()`", "files", "=", "kwargs", ".", "get", "(", "'files'", ")", "encoding", "=", "kwargs", ".", "get", "(", "'input_encoding'", ","...
Handle stream data on command line interface, and returns statistics of success, error, and total amount. More detailed information is available on underlying feature, :mod:`clitool.processor`. :param Handler: [DEPRECATED] Handler for file-like streams. (default: :class:`clitool.processor....
[ "Handle", "stream", "data", "on", "command", "line", "interface", "and", "returns", "statistics", "of", "success", "error", "and", "total", "amount", "." ]
train
https://github.com/skitazaki/python-clitool/blob/4971f8d093d51c6fd0e6cc536bbb597f78b570ab/clitool/cli.py#L198-L232
jlesquembre/jlle
jlle/releaser/pypi.py
SetupConfig.no_input
def no_input(self): """Return whether the user wants to run in no-input mode. Enable this mode by adding a ``no-input`` option:: [zest.releaser] no-input = yes The default when this option has not been set is False. Standard config rules apply, so you can use ...
python
def no_input(self): """Return whether the user wants to run in no-input mode. Enable this mode by adding a ``no-input`` option:: [zest.releaser] no-input = yes The default when this option has not been set is False. Standard config rules apply, so you can use ...
[ "def", "no_input", "(", "self", ")", ":", "default", "=", "False", "if", "self", ".", "config", "is", "None", ":", "return", "default", "try", ":", "result", "=", "self", ".", "config", ".", "getboolean", "(", "'zest.releaser'", ",", "'no-input'", ")", ...
Return whether the user wants to run in no-input mode. Enable this mode by adding a ``no-input`` option:: [zest.releaser] no-input = yes The default when this option has not been set is False. Standard config rules apply, so you can use upper or lower or mixed...
[ "Return", "whether", "the", "user", "wants", "to", "run", "in", "no", "-", "input", "mode", "." ]
train
https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/pypi.py#L112-L133
jlesquembre/jlle
jlle/releaser/pypi.py
SetupConfig.python_file_with_version
def python_file_with_version(self): """Return Python filename with ``__version__`` marker, if configured. Enable this by adding a ``python-file-with-version`` option:: [zest.releaser] python-file-with-version = reinout/maurits.py Return None when nothing has been confi...
python
def python_file_with_version(self): """Return Python filename with ``__version__`` marker, if configured. Enable this by adding a ``python-file-with-version`` option:: [zest.releaser] python-file-with-version = reinout/maurits.py Return None when nothing has been confi...
[ "def", "python_file_with_version", "(", "self", ")", ":", "default", "=", "None", "if", "self", ".", "config", "is", "None", ":", "return", "default", "try", ":", "result", "=", "self", ".", "config", ".", "get", "(", "'zest.releaser'", ",", "'python-file-...
Return Python filename with ``__version__`` marker, if configured. Enable this by adding a ``python-file-with-version`` option:: [zest.releaser] python-file-with-version = reinout/maurits.py Return None when nothing has been configured.
[ "Return", "Python", "filename", "with", "__version__", "marker", "if", "configured", "." ]
train
https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/pypi.py#L135-L154
jlesquembre/jlle
jlle/releaser/pypi.py
PypiConfig._read_configfile
def _read_configfile(self): """Read the config file and store it (when valid)""" rc = self.config_filename if not os.path.isabs(rc): rc = os.path.join(os.path.expanduser('~'), self.config_filename) # If there is a setup.cfg in the package, parse it files = [f for f in...
python
def _read_configfile(self): """Read the config file and store it (when valid)""" rc = self.config_filename if not os.path.isabs(rc): rc = os.path.join(os.path.expanduser('~'), self.config_filename) # If there is a setup.cfg in the package, parse it files = [f for f in...
[ "def", "_read_configfile", "(", "self", ")", ":", "rc", "=", "self", ".", "config_filename", "if", "not", "os", ".", "path", ".", "isabs", "(", "rc", ")", ":", "rc", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "expanduser", ...
Read the config file and store it (when valid)
[ "Read", "the", "config", "file", "and", "store", "it", "(", "when", "valid", ")" ]
train
https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/pypi.py#L165-L180
jlesquembre/jlle
jlle/releaser/pypi.py
PypiConfig.distutils_servers
def distutils_servers(self): """Return a list of known distutils servers for collective.dist. If the config has an old pypi config, remove the default pypi server from the list. """ if not multiple_pypi_support(): return [] try: raw_index_servers ...
python
def distutils_servers(self): """Return a list of known distutils servers for collective.dist. If the config has an old pypi config, remove the default pypi server from the list. """ if not multiple_pypi_support(): return [] try: raw_index_servers ...
[ "def", "distutils_servers", "(", "self", ")", ":", "if", "not", "multiple_pypi_support", "(", ")", ":", "return", "[", "]", "try", ":", "raw_index_servers", "=", "self", ".", "config", ".", "get", "(", "'distutils'", ",", "'index-servers'", ")", "except", ...
Return a list of known distutils servers for collective.dist. If the config has an old pypi config, remove the default pypi server from the list.
[ "Return", "a", "list", "of", "known", "distutils", "servers", "for", "collective", ".", "dist", "." ]
train
https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/pypi.py#L211-L233
jlesquembre/jlle
jlle/releaser/pypi.py
PypiConfig.want_release
def want_release(self): """Does the user normally want to release this package. Some colleagues find it irritating to have to remember to answer the question "Check out the tag (for tweaks or pypi/distutils server upload)" with the non-default 'no' when in 99 percent of the case...
python
def want_release(self): """Does the user normally want to release this package. Some colleagues find it irritating to have to remember to answer the question "Check out the tag (for tweaks or pypi/distutils server upload)" with the non-default 'no' when in 99 percent of the case...
[ "def", "want_release", "(", "self", ")", ":", "default", "=", "True", "if", "self", ".", "config", "is", "None", ":", "return", "default", "try", ":", "result", "=", "self", ".", "config", ".", "getboolean", "(", "'zest.releaser'", ",", "'release'", ")",...
Does the user normally want to release this package. Some colleagues find it irritating to have to remember to answer the question "Check out the tag (for tweaks or pypi/distutils server upload)" with the non-default 'no' when in 99 percent of the cases they just make a release specific...
[ "Does", "the", "user", "normally", "want", "to", "release", "this", "package", "." ]
train
https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/pypi.py#L235-L267
olsoneric/pedemath
pedemath/matrix.py
transpose_mat44
def transpose_mat44(src_mat, transpose_mat=None): """Create a transpose of a matrix.""" if not transpose_mat: transpose_mat = Matrix44() for i in range(4): for j in range(4): transpose_mat.data[i][j] = src_mat.data[j][i] return transpose_mat
python
def transpose_mat44(src_mat, transpose_mat=None): """Create a transpose of a matrix.""" if not transpose_mat: transpose_mat = Matrix44() for i in range(4): for j in range(4): transpose_mat.data[i][j] = src_mat.data[j][i] return transpose_mat
[ "def", "transpose_mat44", "(", "src_mat", ",", "transpose_mat", "=", "None", ")", ":", "if", "not", "transpose_mat", ":", "transpose_mat", "=", "Matrix44", "(", ")", "for", "i", "in", "range", "(", "4", ")", ":", "for", "j", "in", "range", "(", "4", ...
Create a transpose of a matrix.
[ "Create", "a", "transpose", "of", "a", "matrix", "." ]
train
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/matrix.py#L42-L52
olsoneric/pedemath
pedemath/matrix.py
is_affine_mat44
def is_affine_mat44(mat): """Return True if only tranlsate, rotate, and uniform scale components.""" # Ensure scale is uniform if not (mat.data[0][0] == mat.data[1][1] == mat.data[2][2]): return False # Ensure row [3] is 0, 0, 0, 1 return (mat.data[0][3] == 0 and mat.data[1][3]...
python
def is_affine_mat44(mat): """Return True if only tranlsate, rotate, and uniform scale components.""" # Ensure scale is uniform if not (mat.data[0][0] == mat.data[1][1] == mat.data[2][2]): return False # Ensure row [3] is 0, 0, 0, 1 return (mat.data[0][3] == 0 and mat.data[1][3]...
[ "def", "is_affine_mat44", "(", "mat", ")", ":", "# Ensure scale is uniform", "if", "not", "(", "mat", ".", "data", "[", "0", "]", "[", "0", "]", "==", "mat", ".", "data", "[", "1", "]", "[", "1", "]", "==", "mat", ".", "data", "[", "2", "]", "[...
Return True if only tranlsate, rotate, and uniform scale components.
[ "Return", "True", "if", "only", "tranlsate", "rotate", "and", "uniform", "scale", "components", "." ]
train
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/matrix.py#L55-L66
olsoneric/pedemath
pedemath/matrix.py
invert_affine_mat44
def invert_affine_mat44(mat): """Assumes there is only rotate, translate, and uniform scale componenets to the matrix. """ inverted = Matrix44() # Transpose the 3x3 rotation component for i in range(3): for j in range(3): inverted.data[i][j] = mat.data[j][i] # Set tran...
python
def invert_affine_mat44(mat): """Assumes there is only rotate, translate, and uniform scale componenets to the matrix. """ inverted = Matrix44() # Transpose the 3x3 rotation component for i in range(3): for j in range(3): inverted.data[i][j] = mat.data[j][i] # Set tran...
[ "def", "invert_affine_mat44", "(", "mat", ")", ":", "inverted", "=", "Matrix44", "(", ")", "# Transpose the 3x3 rotation component", "for", "i", "in", "range", "(", "3", ")", ":", "for", "j", "in", "range", "(", "3", ")", ":", "inverted", ".", "data", "[...
Assumes there is only rotate, translate, and uniform scale componenets to the matrix.
[ "Assumes", "there", "is", "only", "rotate", "translate", "and", "uniform", "scale", "componenets", "to", "the", "matrix", "." ]
train
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/matrix.py#L69-L88
olsoneric/pedemath
pedemath/matrix.py
Matrix44.almost_equal
def almost_equal(self, mat2, places=7): """Return True if the values in mat2 equal the values in this matrix. """ if not hasattr(mat2, "data"): return False for i in range(4): if not (_float_almost_equal(self.data[i][0], ...
python
def almost_equal(self, mat2, places=7): """Return True if the values in mat2 equal the values in this matrix. """ if not hasattr(mat2, "data"): return False for i in range(4): if not (_float_almost_equal(self.data[i][0], ...
[ "def", "almost_equal", "(", "self", ",", "mat2", ",", "places", "=", "7", ")", ":", "if", "not", "hasattr", "(", "mat2", ",", "\"data\"", ")", ":", "return", "False", "for", "i", "in", "range", "(", "4", ")", ":", "if", "not", "(", "_float_almost_e...
Return True if the values in mat2 equal the values in this matrix.
[ "Return", "True", "if", "the", "values", "in", "mat2", "equal", "the", "values", "in", "this", "matrix", "." ]
train
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/matrix.py#L217-L236
olsoneric/pedemath
pedemath/matrix.py
Matrix44.rot_from_vectors
def rot_from_vectors(start_vec, end_vec): """Return the rotation matrix to rotate from one vector to another.""" dot = start_vec.dot(end_vec) # TODO: check if dot is a valid number angle = math.acos(dot) # TODO: check if angle is a valid number cross = start_vec.cross(en...
python
def rot_from_vectors(start_vec, end_vec): """Return the rotation matrix to rotate from one vector to another.""" dot = start_vec.dot(end_vec) # TODO: check if dot is a valid number angle = math.acos(dot) # TODO: check if angle is a valid number cross = start_vec.cross(en...
[ "def", "rot_from_vectors", "(", "start_vec", ",", "end_vec", ")", ":", "dot", "=", "start_vec", ".", "dot", "(", "end_vec", ")", "# TODO: check if dot is a valid number", "angle", "=", "math", ".", "acos", "(", "dot", ")", "# TODO: check if angle is a valid number",...
Return the rotation matrix to rotate from one vector to another.
[ "Return", "the", "rotation", "matrix", "to", "rotate", "from", "one", "vector", "to", "another", "." ]
train
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/matrix.py#L299-L311
olsoneric/pedemath
pedemath/matrix.py
Matrix44.get_trans
def get_trans(self, out_vec=None): """Return the translation portion of the matrix as a vector. If out_vec is provided, store in out_vec instead of creating a new Vec3. """ if out_vec: return out_vec.set(*self.data[3][:3]) return Vec3(*self.data[3][:3])
python
def get_trans(self, out_vec=None): """Return the translation portion of the matrix as a vector. If out_vec is provided, store in out_vec instead of creating a new Vec3. """ if out_vec: return out_vec.set(*self.data[3][:3]) return Vec3(*self.data[3][:3])
[ "def", "get_trans", "(", "self", ",", "out_vec", "=", "None", ")", ":", "if", "out_vec", ":", "return", "out_vec", ".", "set", "(", "*", "self", ".", "data", "[", "3", "]", "[", ":", "3", "]", ")", "return", "Vec3", "(", "*", "self", ".", "data...
Return the translation portion of the matrix as a vector. If out_vec is provided, store in out_vec instead of creating a new Vec3.
[ "Return", "the", "translation", "portion", "of", "the", "matrix", "as", "a", "vector", "." ]
train
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/matrix.py#L322-L331
olsoneric/pedemath
pedemath/matrix.py
Matrix44.set_trans
def set_trans(self, trans_vec): """Set the translation components of the matrix.""" # Column major, translation components in column 3. self.data[3][0] = trans_vec[0] self.data[3][1] = trans_vec[1] self.data[3][2] = trans_vec[2]
python
def set_trans(self, trans_vec): """Set the translation components of the matrix.""" # Column major, translation components in column 3. self.data[3][0] = trans_vec[0] self.data[3][1] = trans_vec[1] self.data[3][2] = trans_vec[2]
[ "def", "set_trans", "(", "self", ",", "trans_vec", ")", ":", "# Column major, translation components in column 3.", "self", ".", "data", "[", "3", "]", "[", "0", "]", "=", "trans_vec", "[", "0", "]", "self", ".", "data", "[", "3", "]", "[", "1", "]", ...
Set the translation components of the matrix.
[ "Set", "the", "translation", "components", "of", "the", "matrix", "." ]
train
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/matrix.py#L333-L339
kumar303/desub
desub/desub.py
Desub.is_running
def is_running(self): """ True if the subprocess is running. If it's a zombie then we call :func:`desub.Desub.stop` to kill it with fire and return False. """ pp = self.pid if pp: try: proc = psutil.Process(pp) # Possi...
python
def is_running(self): """ True if the subprocess is running. If it's a zombie then we call :func:`desub.Desub.stop` to kill it with fire and return False. """ pp = self.pid if pp: try: proc = psutil.Process(pp) # Possi...
[ "def", "is_running", "(", "self", ")", ":", "pp", "=", "self", ".", "pid", "if", "pp", ":", "try", ":", "proc", "=", "psutil", ".", "Process", "(", "pp", ")", "# Possible status:", "# \"STATUS_RUNNING\", \"STATUS_IDLE\",", "# \"STATUS_SLEEPING\", \"STATUS_DISK_SLE...
True if the subprocess is running. If it's a zombie then we call :func:`desub.Desub.stop` to kill it with fire and return False.
[ "True", "if", "the", "subprocess", "is", "running", "." ]
train
https://github.com/kumar303/desub/blob/2f495219b7d6d92e10a861d2a95cc10fe2a3483d/desub/desub.py#L117-L149
kumar303/desub
desub/desub.py
Desub.pid
def pid(self): """ The integer PID of the subprocess or None. """ pf = self.path('cmd.pid') if not os.path.exists(pf): return None with open(pf, 'r') as f: return int(f.read())
python
def pid(self): """ The integer PID of the subprocess or None. """ pf = self.path('cmd.pid') if not os.path.exists(pf): return None with open(pf, 'r') as f: return int(f.read())
[ "def", "pid", "(", "self", ")", ":", "pf", "=", "self", ".", "path", "(", "'cmd.pid'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "pf", ")", ":", "return", "None", "with", "open", "(", "pf", ",", "'r'", ")", "as", "f", ":", "ret...
The integer PID of the subprocess or None.
[ "The", "integer", "PID", "of", "the", "subprocess", "or", "None", "." ]
train
https://github.com/kumar303/desub/blob/2f495219b7d6d92e10a861d2a95cc10fe2a3483d/desub/desub.py#L162-L170
kumar303/desub
desub/desub.py
Desub.start
def start(self): """Start the subprocess.""" c_out, c_err = (open(self.path('cmd.stdout'), 'w'), open(self.path('cmd.stderr'), 'w')) kw = self.kw.copy() kw['stdout'] = c_out kw['stderr'] = c_err if not kw.get('cwd', None): kw['cwd'] = o...
python
def start(self): """Start the subprocess.""" c_out, c_err = (open(self.path('cmd.stdout'), 'w'), open(self.path('cmd.stderr'), 'w')) kw = self.kw.copy() kw['stdout'] = c_out kw['stderr'] = c_err if not kw.get('cwd', None): kw['cwd'] = o...
[ "def", "start", "(", "self", ")", ":", "c_out", ",", "c_err", "=", "(", "open", "(", "self", ".", "path", "(", "'cmd.stdout'", ")", ",", "'w'", ")", ",", "open", "(", "self", ".", "path", "(", "'cmd.stderr'", ")", ",", "'w'", ")", ")", "kw", "=...
Start the subprocess.
[ "Start", "the", "subprocess", "." ]
train
https://github.com/kumar303/desub/blob/2f495219b7d6d92e10a861d2a95cc10fe2a3483d/desub/desub.py#L172-L183
kumar303/desub
desub/desub.py
Desub.stop
def stop(self, timeout=15): """Stop the subprocess. Keyword Arguments **timeout** Time in seconds to wait for a process and its children to exit. """ pp = self.pid if pp: try: kill_process_nicely(pp, timeout=timeout) ...
python
def stop(self, timeout=15): """Stop the subprocess. Keyword Arguments **timeout** Time in seconds to wait for a process and its children to exit. """ pp = self.pid if pp: try: kill_process_nicely(pp, timeout=timeout) ...
[ "def", "stop", "(", "self", ",", "timeout", "=", "15", ")", ":", "pp", "=", "self", ".", "pid", "if", "pp", ":", "try", ":", "kill_process_nicely", "(", "pp", ",", "timeout", "=", "timeout", ")", "except", "psutil", ".", "NoSuchProcess", ":", "pass" ...
Stop the subprocess. Keyword Arguments **timeout** Time in seconds to wait for a process and its children to exit.
[ "Stop", "the", "subprocess", "." ]
train
https://github.com/kumar303/desub/blob/2f495219b7d6d92e10a861d2a95cc10fe2a3483d/desub/desub.py#L185-L199
inveniosoftware-attic/invenio-knowledge
invenio_knowledge/api.py
query_get_kb_by_type
def query_get_kb_by_type(kbtype): """Return a query to filter kb by type. :param kbtype: type to filter (e.g: taxonomy) :return: query to filter kb """ return models.KnwKB.query.filter_by( kbtype=models.KnwKB.KNWKB_TYPES[kbtype])
python
def query_get_kb_by_type(kbtype): """Return a query to filter kb by type. :param kbtype: type to filter (e.g: taxonomy) :return: query to filter kb """ return models.KnwKB.query.filter_by( kbtype=models.KnwKB.KNWKB_TYPES[kbtype])
[ "def", "query_get_kb_by_type", "(", "kbtype", ")", ":", "return", "models", ".", "KnwKB", ".", "query", ".", "filter_by", "(", "kbtype", "=", "models", ".", "KnwKB", ".", "KNWKB_TYPES", "[", "kbtype", "]", ")" ]
Return a query to filter kb by type. :param kbtype: type to filter (e.g: taxonomy) :return: query to filter kb
[ "Return", "a", "query", "to", "filter", "kb", "by", "type", "." ]
train
https://github.com/inveniosoftware-attic/invenio-knowledge/blob/b31722dc14243ca8f626f8b3bce9718d0119de55/invenio_knowledge/api.py#L100-L107
inveniosoftware-attic/invenio-knowledge
invenio_knowledge/api.py
query_kb_mappings
def query_kb_mappings(kbid, sortby="to", key="", value="", match_type="s"): """Return a list of all mappings from the given kb, ordered by key. If key given, give only those with left side (mapFrom) = key. If value given, give only those with right side (mapTo) = value. :param kb...
python
def query_kb_mappings(kbid, sortby="to", key="", value="", match_type="s"): """Return a list of all mappings from the given kb, ordered by key. If key given, give only those with left side (mapFrom) = key. If value given, give only those with right side (mapTo) = value. :param kb...
[ "def", "query_kb_mappings", "(", "kbid", ",", "sortby", "=", "\"to\"", ",", "key", "=", "\"\"", ",", "value", "=", "\"\"", ",", "match_type", "=", "\"s\"", ")", ":", "return", "models", ".", "KnwKBRVAL", ".", "query_kb_mappings", "(", "kbid", ",", "sortb...
Return a list of all mappings from the given kb, ordered by key. If key given, give only those with left side (mapFrom) = key. If value given, give only those with right side (mapTo) = value. :param kb_name: knowledge base name. if "", return all :param sortby: the sorting criteria ('from' or 'to') ...
[ "Return", "a", "list", "of", "all", "mappings", "from", "the", "given", "kb", "ordered", "by", "key", "." ]
train
https://github.com/inveniosoftware-attic/invenio-knowledge/blob/b31722dc14243ca8f626f8b3bce9718d0119de55/invenio_knowledge/api.py#L110-L124
inveniosoftware-attic/invenio-knowledge
invenio_knowledge/api.py
get_kb_mappings
def get_kb_mappings(kb_name="", key="", value="", match_type="s", sortby="to", limit=None): """Return a list of all mappings from the given kb, ordered by key. If key given, give only those with left side (mapFrom) = key. If value given, give only those with right side (mapTo) = value. ...
python
def get_kb_mappings(kb_name="", key="", value="", match_type="s", sortby="to", limit=None): """Return a list of all mappings from the given kb, ordered by key. If key given, give only those with left side (mapFrom) = key. If value given, give only those with right side (mapTo) = value. ...
[ "def", "get_kb_mappings", "(", "kb_name", "=", "\"\"", ",", "key", "=", "\"\"", ",", "value", "=", "\"\"", ",", "match_type", "=", "\"s\"", ",", "sortby", "=", "\"to\"", ",", "limit", "=", "None", ")", ":", "# query", "query", "=", "db", ".", "sessio...
Return a list of all mappings from the given kb, ordered by key. If key given, give only those with left side (mapFrom) = key. If value given, give only those with right side (mapTo) = value. :param kb_name: knowledge base name. if "", return all :param sortby: the sorting criteria ('from' or 'to') ...
[ "Return", "a", "list", "of", "all", "mappings", "from", "the", "given", "kb", "ordered", "by", "key", "." ]
train
https://github.com/inveniosoftware-attic/invenio-knowledge/blob/b31722dc14243ca8f626f8b3bce9718d0119de55/invenio_knowledge/api.py#L127-L167
inveniosoftware-attic/invenio-knowledge
invenio_knowledge/api.py
get_kb_mapping
def get_kb_mapping(kb_name="", key="", value="", match_type="e", default="", limit=None): """Get one unique mapping. If not found, return default. :param kb_name: the name of the kb :param key: include only lines matching this on left side in the results :param value: include only li...
python
def get_kb_mapping(kb_name="", key="", value="", match_type="e", default="", limit=None): """Get one unique mapping. If not found, return default. :param kb_name: the name of the kb :param key: include only lines matching this on left side in the results :param value: include only li...
[ "def", "get_kb_mapping", "(", "kb_name", "=", "\"\"", ",", "key", "=", "\"\"", ",", "value", "=", "\"\"", ",", "match_type", "=", "\"e\"", ",", "default", "=", "\"\"", ",", "limit", "=", "None", ")", ":", "mappings", "=", "get_kb_mappings", "(", "kb_na...
Get one unique mapping. If not found, return default. :param kb_name: the name of the kb :param key: include only lines matching this on left side in the results :param value: include only lines matching this on right side in the results :param match_type: s = substring match, e = exact match :para...
[ "Get", "one", "unique", "mapping", ".", "If", "not", "found", "return", "default", "." ]
train
https://github.com/inveniosoftware-attic/invenio-knowledge/blob/b31722dc14243ca8f626f8b3bce9718d0119de55/invenio_knowledge/api.py#L170-L187