repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
thautwarm/Redy
Redy/Tools/_native_hash.py
hash_from_stream
def hash_from_stream(n, hash_stream): """ >>> from Redy.Tools.Hash import hash_from_stream >>> s = iter((1, 2, 3)) >>> assert hash_from_stream(3, iter(s)) == hash((1, 2, 3)) """ x = to_int64(0x345678) multiplied = to_int64(1000003) for i in range(n - 1, -1, -1): h = next(hash_st...
python
def hash_from_stream(n, hash_stream): """ >>> from Redy.Tools.Hash import hash_from_stream >>> s = iter((1, 2, 3)) >>> assert hash_from_stream(3, iter(s)) == hash((1, 2, 3)) """ x = to_int64(0x345678) multiplied = to_int64(1000003) for i in range(n - 1, -1, -1): h = next(hash_st...
[ "def", "hash_from_stream", "(", "n", ",", "hash_stream", ")", ":", "x", "=", "to_int64", "(", "0x345678", ")", "multiplied", "=", "to_int64", "(", "1000003", ")", "for", "i", "in", "range", "(", "n", "-", "1", ",", "-", "1", ",", "-", "1", ")", "...
>>> from Redy.Tools.Hash import hash_from_stream >>> s = iter((1, 2, 3)) >>> assert hash_from_stream(3, iter(s)) == hash((1, 2, 3))
[ ">>>", "from", "Redy", ".", "Tools", ".", "Hash", "import", "hash_from_stream", ">>>", "s", "=", "iter", "((", "1", "2", "3", "))", ">>>", "assert", "hash_from_stream", "(", "3", "iter", "(", "s", "))", "==", "hash", "((", "1", "2", "3", "))" ]
8beee5c5f752edfd2754bb1e6b5f4acb016a7770
https://github.com/thautwarm/Redy/blob/8beee5c5f752edfd2754bb1e6b5f4acb016a7770/Redy/Tools/_native_hash.py#L48-L67
train
Return the hash of the n - th element of the stream.
basecrm/basecrm-python
basecrm/services.py
AssociatedContactsService.list
def list(self, deal_id, **params): """ Retrieve deal's associated contacts Returns all deal associated contacts :calls: ``get /deals/{deal_id}/associated_contacts`` :param int deal_id: Unique identifier of a Deal. :param dict params: (optional) Search options. :...
python
def list(self, deal_id, **params): """ Retrieve deal's associated contacts Returns all deal associated contacts :calls: ``get /deals/{deal_id}/associated_contacts`` :param int deal_id: Unique identifier of a Deal. :param dict params: (optional) Search options. :...
[ "def", "list", "(", "self", ",", "deal_id", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "associated_contacts", "=", "self", ".", "http_client", ".", "get", "(", "\"/deals/{deal_id}/associated_contacts\"", ".", "format", "(", "deal_id", "=", "dea...
Retrieve deal's associated contacts Returns all deal associated contacts :calls: ``get /deals/{deal_id}/associated_contacts`` :param int deal_id: Unique identifier of a Deal. :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-sty...
[ "Retrieve", "deal", "s", "associated", "contacts" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L65-L79
train
Retrieve deal s associated contacts
basecrm/basecrm-python
basecrm/services.py
AssociatedContactsService.create
def create(self, deal_id, *args, **kwargs): """ Create an associated contact Creates a deal's associated contact and its role If the specified deal or contact does not exist, the request will return an error :calls: ``post /deals/{deal_id}/associated_contacts`` :param i...
python
def create(self, deal_id, *args, **kwargs): """ Create an associated contact Creates a deal's associated contact and its role If the specified deal or contact does not exist, the request will return an error :calls: ``post /deals/{deal_id}/associated_contacts`` :param i...
[ "def", "create", "(", "self", ",", "deal_id", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "args", "and", "not", "kwargs", ":", "raise", "Exception", "(", "'attributes for AssociatedContact are missing'", ")", "attributes", "=", "args", ...
Create an associated contact Creates a deal's associated contact and its role If the specified deal or contact does not exist, the request will return an error :calls: ``post /deals/{deal_id}/associated_contacts`` :param int deal_id: Unique identifier of a Deal. :param tuple *a...
[ "Create", "an", "associated", "contact" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L81-L103
train
Creates an associated contact and role associated contact.
basecrm/basecrm-python
basecrm/services.py
AssociatedContactsService.destroy
def destroy(self, deal_id, contact_id) : """ Remove an associated contact Remove a deal's associated contact If a deal with the supplied unique identifier does not exist, it returns an error This operation cannot be undone :calls: ``delete /deals/{deal_id}/associated_co...
python
def destroy(self, deal_id, contact_id) : """ Remove an associated contact Remove a deal's associated contact If a deal with the supplied unique identifier does not exist, it returns an error This operation cannot be undone :calls: ``delete /deals/{deal_id}/associated_co...
[ "def", "destroy", "(", "self", ",", "deal_id", ",", "contact_id", ")", ":", "status_code", ",", "_", ",", "_", "=", "self", ".", "http_client", ".", "delete", "(", "\"/deals/{deal_id}/associated_contacts/{contact_id}\"", ".", "format", "(", "deal_id", "=", "de...
Remove an associated contact Remove a deal's associated contact If a deal with the supplied unique identifier does not exist, it returns an error This operation cannot be undone :calls: ``delete /deals/{deal_id}/associated_contacts/{contact_id}`` :param int deal_id: Unique iden...
[ "Remove", "an", "associated", "contact" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L105-L121
train
Removes an associated contact_id from the associated_contacts.
basecrm/basecrm-python
basecrm/services.py
ContactsService.list
def list(self, **params): """ Retrieve all contacts Returns all contacts available to the user according to the parameters provided :calls: ``get /contacts`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access...
python
def list(self, **params): """ Retrieve all contacts Returns all contacts available to the user according to the parameters provided :calls: ``get /contacts`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "contacts", "=", "self", ".", "http_client", ".", "get", "(", "\"/contacts\"", ",", "params", "=", "params", ")", "return", "contacts" ]
Retrieve all contacts Returns all contacts available to the user according to the parameters provided :calls: ``get /contacts`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Contacts. ...
[ "Retrieve", "all", "contacts" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L148-L161
train
Retrieve all contacts available to the user according to the parameters provided.
basecrm/basecrm-python
basecrm/services.py
ContactsService.retrieve
def retrieve(self, id) : """ Retrieve a single contact Returns a single contact available to the user, according to the unique contact ID provided If the specified contact does not exist, the request will return an error :calls: ``get /contacts/{id}`` :param int id: Uni...
python
def retrieve(self, id) : """ Retrieve a single contact Returns a single contact available to the user, according to the unique contact ID provided If the specified contact does not exist, the request will return an error :calls: ``get /contacts/{id}`` :param int id: Uni...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "contact", "=", "self", ".", "http_client", ".", "get", "(", "\"/contacts/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "contact" ]
Retrieve a single contact Returns a single contact available to the user, according to the unique contact ID provided If the specified contact does not exist, the request will return an error :calls: ``get /contacts/{id}`` :param int id: Unique identifier of a Contact. :return:...
[ "Retrieve", "a", "single", "contact" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L186-L200
train
Retrieve a single contact from the API
basecrm/basecrm-python
basecrm/services.py
DealsService.list
def list(self, **params): """ Retrieve all deals Returns all deals available to the user according to the parameters provided :calls: ``get /deals`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which r...
python
def list(self, **params): """ Retrieve all deals Returns all deals available to the user according to the parameters provided :calls: ``get /deals`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which r...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "deals", "=", "self", ".", "http_client", ".", "get", "(", "\"/deals\"", ",", "params", "=", "params", ")", "for", "deal", "in", "deals", ":", "deal", "[", "'value...
Retrieve all deals Returns all deals available to the user according to the parameters provided :calls: ``get /deals`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Deals. :rtype: ...
[ "Retrieve", "all", "deals" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L270-L286
train
Retrieve all deals available to the user according to the parameters provided.
basecrm/basecrm-python
basecrm/services.py
DealsService.create
def create(self, *args, **kwargs): """ Create a deal Create a new deal :calls: ``post /deals`` :param tuple *args: (optional) Single object representing Deal resource. :param dict **kwargs: (optional) Deal attributes. :return: Dictionary that support attriubte-s...
python
def create(self, *args, **kwargs): """ Create a deal Create a new deal :calls: ``post /deals`` :param tuple *args: (optional) Single object representing Deal resource. :param dict **kwargs: (optional) Deal attributes. :return: Dictionary that support attriubte-s...
[ "def", "create", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "args", "and", "not", "kwargs", ":", "raise", "Exception", "(", "'attributes for Deal are missing'", ")", "attributes", "=", "args", "[", "0", "]", "if", "a...
Create a deal Create a new deal :calls: ``post /deals`` :param tuple *args: (optional) Single object representing Deal resource. :param dict **kwargs: (optional) Deal attributes. :return: Dictionary that support attriubte-style access and represents newely created Deal resource...
[ "Create", "a", "deal" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L288-L311
train
Creates a new deal with the given attributes.
basecrm/basecrm-python
basecrm/services.py
DealsService.retrieve
def retrieve(self, id) : """ Retrieve a single deal Returns a single deal available to the user, according to the unique deal ID provided If the specified deal does not exist, the request will return an error :calls: ``get /deals/{id}`` :param int id: Unique identifier ...
python
def retrieve(self, id) : """ Retrieve a single deal Returns a single deal available to the user, according to the unique deal ID provided If the specified deal does not exist, the request will return an error :calls: ``get /deals/{id}`` :param int id: Unique identifier ...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "deal", "=", "self", ".", "http_client", ".", "get", "(", "\"/deals/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "deal", "[", "\"value\"", "]", "=", "Coercion", "...
Retrieve a single deal Returns a single deal available to the user, according to the unique deal ID provided If the specified deal does not exist, the request will return an error :calls: ``get /deals/{id}`` :param int id: Unique identifier of a Deal. :return: Dictionary that s...
[ "Retrieve", "a", "single", "deal" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L313-L328
train
Retrieve a single deal from the API.
basecrm/basecrm-python
basecrm/services.py
DealsService.update
def update(self, id, *args, **kwargs): """ Update a deal Updates deal information If the specified deal does not exist, the request will return an error <figure class="notice"> In order to modify tags used on a record, you need to supply the entire set `tags` are...
python
def update(self, id, *args, **kwargs): """ Update a deal Updates deal information If the specified deal does not exist, the request will return an error <figure class="notice"> In order to modify tags used on a record, you need to supply the entire set `tags` are...
[ "def", "update", "(", "self", ",", "id", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "args", "and", "not", "kwargs", ":", "raise", "Exception", "(", "'attributes for Deal are missing'", ")", "attributes", "=", "args", "[", "0", "]...
Update a deal Updates deal information If the specified deal does not exist, the request will return an error <figure class="notice"> In order to modify tags used on a record, you need to supply the entire set `tags` are replaced every time they are used in a request </f...
[ "Update", "a", "deal" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L330-L359
train
Updates a deal s information with the attributes provided.
basecrm/basecrm-python
basecrm/services.py
DealSourcesService.list
def list(self, **params): """ Retrieve all sources Returns all deal sources available to the user according to the parameters provided :calls: ``get /deal_sources`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style...
python
def list(self, **params): """ Retrieve all sources Returns all deal sources available to the user according to the parameters provided :calls: ``get /deal_sources`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "deal_sources", "=", "self", ".", "http_client", ".", "get", "(", "\"/deal_sources\"", ",", "params", "=", "params", ")", "return", "deal_sources" ]
Retrieve all sources Returns all deal sources available to the user according to the parameters provided :calls: ``get /deal_sources`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of DealSou...
[ "Retrieve", "all", "sources" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L403-L416
train
Retrieve all sources Returns all sources
basecrm/basecrm-python
basecrm/services.py
DealSourcesService.retrieve
def retrieve(self, id) : """ Retrieve a single source Returns a single source available to the user by the provided id If a source with the supplied unique identifier does not exist it returns an error :calls: ``get /deal_sources/{id}`` :param int id: Unique identifier ...
python
def retrieve(self, id) : """ Retrieve a single source Returns a single source available to the user by the provided id If a source with the supplied unique identifier does not exist it returns an error :calls: ``get /deal_sources/{id}`` :param int id: Unique identifier ...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "deal_source", "=", "self", ".", "http_client", ".", "get", "(", "\"/deal_sources/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "deal_source" ]
Retrieve a single source Returns a single source available to the user by the provided id If a source with the supplied unique identifier does not exist it returns an error :calls: ``get /deal_sources/{id}`` :param int id: Unique identifier of a DealSource. :return: Dictionary ...
[ "Retrieve", "a", "single", "source" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L443-L457
train
Retrieve a single source by the unique identifier
basecrm/basecrm-python
basecrm/services.py
DealSourcesService.update
def update(self, id, *args, **kwargs): """ Update a source Updates source information If the specified source does not exist, the request will return an error <figure class="notice"> If you want to update a source, you **must** make sure source's name is unique <...
python
def update(self, id, *args, **kwargs): """ Update a source Updates source information If the specified source does not exist, the request will return an error <figure class="notice"> If you want to update a source, you **must** make sure source's name is unique <...
[ "def", "update", "(", "self", ",", "id", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "args", "and", "not", "kwargs", ":", "raise", "Exception", "(", "'attributes for DealSource are missing'", ")", "attributes", "=", "args", "[", "0"...
Update a source Updates source information If the specified source does not exist, the request will return an error <figure class="notice"> If you want to update a source, you **must** make sure source's name is unique </figure> :calls: ``put /deal_sources/{id}`` ...
[ "Update", "a", "source" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L459-L484
train
Updates a source s attributes and returns a dict containing the updated attributes.
basecrm/basecrm-python
basecrm/services.py
DealSourcesService.destroy
def destroy(self, id) : """ Delete a source Delete an existing source If the specified source does not exist, the request will return an error This operation cannot be undone :calls: ``delete /deal_sources/{id}`` :param int id: Unique identifier of a DealSource....
python
def destroy(self, id) : """ Delete a source Delete an existing source If the specified source does not exist, the request will return an error This operation cannot be undone :calls: ``delete /deal_sources/{id}`` :param int id: Unique identifier of a DealSource....
[ "def", "destroy", "(", "self", ",", "id", ")", ":", "status_code", ",", "_", ",", "_", "=", "self", ".", "http_client", ".", "delete", "(", "\"/deal_sources/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "status_code", "==", "204" ]
Delete a source Delete an existing source If the specified source does not exist, the request will return an error This operation cannot be undone :calls: ``delete /deal_sources/{id}`` :param int id: Unique identifier of a DealSource. :return: True if the operation succ...
[ "Delete", "a", "source" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L486-L501
train
Delete a source and all associated data sets.
basecrm/basecrm-python
basecrm/services.py
DealUnqualifiedReasonsService.list
def list(self, **params): """ Retrieve all deal unqualified reasons Returns all deal unqualified reasons available to the user according to the parameters provided :calls: ``get /deal_unqualified_reasons`` :param dict params: (optional) Search options. :return: List of ...
python
def list(self, **params): """ Retrieve all deal unqualified reasons Returns all deal unqualified reasons available to the user according to the parameters provided :calls: ``get /deal_unqualified_reasons`` :param dict params: (optional) Search options. :return: List of ...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "deal_unqualified_reasons", "=", "self", ".", "http_client", ".", "get", "(", "\"/deal_unqualified_reasons\"", ",", "params", "=", "params", ")", "return", "deal_unqualified_r...
Retrieve all deal unqualified reasons Returns all deal unqualified reasons available to the user according to the parameters provided :calls: ``get /deal_unqualified_reasons`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style acce...
[ "Retrieve", "all", "deal", "unqualified", "reasons" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L528-L541
train
Returns all deal unqualified reasons available to the user according to the parameters provided.
basecrm/basecrm-python
basecrm/services.py
DealUnqualifiedReasonsService.retrieve
def retrieve(self, id) : """ Retrieve a single deal unqualified reason Returns a single deal unqualified reason available to the user by the provided id If a loss reason with the supplied unique identifier does not exist, it returns an error :calls: ``get /deal_unqualified_reas...
python
def retrieve(self, id) : """ Retrieve a single deal unqualified reason Returns a single deal unqualified reason available to the user by the provided id If a loss reason with the supplied unique identifier does not exist, it returns an error :calls: ``get /deal_unqualified_reas...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "deal_unqualified_reason", "=", "self", ".", "http_client", ".", "get", "(", "\"/deal_unqualified_reasons/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "deal_unqua...
Retrieve a single deal unqualified reason Returns a single deal unqualified reason available to the user by the provided id If a loss reason with the supplied unique identifier does not exist, it returns an error :calls: ``get /deal_unqualified_reasons/{id}`` :param int id: Unique iden...
[ "Retrieve", "a", "single", "deal", "unqualified", "reason" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L568-L582
train
Retrieve a single deal unqualified reason from the API.
basecrm/basecrm-python
basecrm/services.py
LeadsService.list
def list(self, **params): """ Retrieve all leads Returns all leads available to the user, according to the parameters provided :calls: ``get /leads`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which ...
python
def list(self, **params): """ Retrieve all leads Returns all leads available to the user, according to the parameters provided :calls: ``get /leads`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which ...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "leads", "=", "self", ".", "http_client", ".", "get", "(", "\"/leads\"", ",", "params", "=", "params", ")", "return", "leads" ]
Retrieve all leads Returns all leads available to the user, according to the parameters provided :calls: ``get /leads`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Leads. :rtype:...
[ "Retrieve", "all", "leads" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L653-L666
train
Retrieve all leads available to the user according to the parameters provided.
basecrm/basecrm-python
basecrm/services.py
LeadsService.retrieve
def retrieve(self, id) : """ Retrieve a single lead Returns a single lead available to the user, according to the unique lead ID provided If the specified lead does not exist, this query returns an error :calls: ``get /leads/{id}`` :param int id: Unique identifier of a ...
python
def retrieve(self, id) : """ Retrieve a single lead Returns a single lead available to the user, according to the unique lead ID provided If the specified lead does not exist, this query returns an error :calls: ``get /leads/{id}`` :param int id: Unique identifier of a ...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "lead", "=", "self", ".", "http_client", ".", "get", "(", "\"/leads/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "lead" ]
Retrieve a single lead Returns a single lead available to the user, according to the unique lead ID provided If the specified lead does not exist, this query returns an error :calls: ``get /leads/{id}`` :param int id: Unique identifier of a Lead. :return: Dictionary that suppor...
[ "Retrieve", "a", "single", "lead" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L691-L705
train
Retrieve a single lead by its unique identifier
basecrm/basecrm-python
basecrm/services.py
LeadSourcesService.list
def list(self, **params): """ Retrieve all sources Returns all lead sources available to the user according to the parameters provided :calls: ``get /lead_sources`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style...
python
def list(self, **params): """ Retrieve all sources Returns all lead sources available to the user according to the parameters provided :calls: ``get /lead_sources`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "lead_sources", "=", "self", ".", "http_client", ".", "get", "(", "\"/lead_sources\"", ",", "params", "=", "params", ")", "return", "lead_sources" ]
Retrieve all sources Returns all lead sources available to the user according to the parameters provided :calls: ``get /lead_sources`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of LeadSou...
[ "Retrieve", "all", "sources" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L777-L790
train
Retrieve all sources Returns all lead sources available to the user according to the parameters provided
basecrm/basecrm-python
basecrm/services.py
LeadSourcesService.retrieve
def retrieve(self, id) : """ Retrieve a single source Returns a single source available to the user by the provided id If a source with the supplied unique identifier does not exist it returns an error :calls: ``get /lead_sources/{id}`` :param int id: Unique identifier ...
python
def retrieve(self, id) : """ Retrieve a single source Returns a single source available to the user by the provided id If a source with the supplied unique identifier does not exist it returns an error :calls: ``get /lead_sources/{id}`` :param int id: Unique identifier ...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "lead_source", "=", "self", ".", "http_client", ".", "get", "(", "\"/lead_sources/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "lead_source" ]
Retrieve a single source Returns a single source available to the user by the provided id If a source with the supplied unique identifier does not exist it returns an error :calls: ``get /lead_sources/{id}`` :param int id: Unique identifier of a LeadSource. :return: Dictionary ...
[ "Retrieve", "a", "single", "source" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L817-L831
train
Retrieve a single source by the provided unique identifier
basecrm/basecrm-python
basecrm/services.py
LeadUnqualifiedReasonsService.list
def list(self, **params): """ Retrieve all lead unqualified reasons Returns all lead unqualified reasons available to the user according to the parameters provided :calls: ``get /lead_unqualified_reasons`` :param dict params: (optional) Search options. :return: List of ...
python
def list(self, **params): """ Retrieve all lead unqualified reasons Returns all lead unqualified reasons available to the user according to the parameters provided :calls: ``get /lead_unqualified_reasons`` :param dict params: (optional) Search options. :return: List of ...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "lead_unqualified_reasons", "=", "self", ".", "http_client", ".", "get", "(", "\"/lead_unqualified_reasons\"", ",", "params", "=", "params", ")", "return", "lead_unqualified_r...
Retrieve all lead unqualified reasons Returns all lead unqualified reasons available to the user according to the parameters provided :calls: ``get /lead_unqualified_reasons`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style acce...
[ "Retrieve", "all", "lead", "unqualified", "reasons" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L898-L911
train
Returns all lead unqualified reasons available to the user according to the parameters provided.
basecrm/basecrm-python
basecrm/services.py
LineItemsService.list
def list(self, order_id, **params): """ Retrieve order's line items Returns all line items associated to order :calls: ``get /orders/{order_id}/line_items`` :param int order_id: Unique identifier of a Order. :param dict params: (optional) Search options. :return...
python
def list(self, order_id, **params): """ Retrieve order's line items Returns all line items associated to order :calls: ``get /orders/{order_id}/line_items`` :param int order_id: Unique identifier of a Order. :param dict params: (optional) Search options. :return...
[ "def", "list", "(", "self", ",", "order_id", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "line_items", "=", "self", ".", "http_client", ".", "get", "(", "\"/orders/{order_id}/line_items\"", ".", "format", "(", "order_id", "=", "order_id", ")",...
Retrieve order's line items Returns all line items associated to order :calls: ``get /orders/{order_id}/line_items`` :param int order_id: Unique identifier of a Order. :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style acce...
[ "Retrieve", "order", "s", "line", "items" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L938-L952
train
Retrieve order s line items associated to order_id
basecrm/basecrm-python
basecrm/services.py
LineItemsService.retrieve
def retrieve(self, order_id, id) : """ Retrieve a single line item Returns a single line item of an order, according to the unique line item ID provided :calls: ``get /orders/{order_id}/line_items/{id}`` :param int order_id: Unique identifier of a Order. :param int id: ...
python
def retrieve(self, order_id, id) : """ Retrieve a single line item Returns a single line item of an order, according to the unique line item ID provided :calls: ``get /orders/{order_id}/line_items/{id}`` :param int order_id: Unique identifier of a Order. :param int id: ...
[ "def", "retrieve", "(", "self", ",", "order_id", ",", "id", ")", ":", "_", ",", "_", ",", "line_item", "=", "self", ".", "http_client", ".", "get", "(", "\"/orders/{order_id}/line_items/{id}\"", ".", "format", "(", "order_id", "=", "order_id", ",", "id", ...
Retrieve a single line item Returns a single line item of an order, according to the unique line item ID provided :calls: ``get /orders/{order_id}/line_items/{id}`` :param int order_id: Unique identifier of a Order. :param int id: Unique identifier of a LineItem. :return: Dicti...
[ "Retrieve", "a", "single", "line", "item" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L979-L993
train
Retrieve a single line item from an order according to the unique line item ID provided
basecrm/basecrm-python
basecrm/services.py
LossReasonsService.list
def list(self, **params): """ Retrieve all reasons Returns all deal loss reasons available to the user according to the parameters provided :calls: ``get /loss_reasons`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-...
python
def list(self, **params): """ Retrieve all reasons Returns all deal loss reasons available to the user according to the parameters provided :calls: ``get /loss_reasons`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "loss_reasons", "=", "self", ".", "http_client", ".", "get", "(", "\"/loss_reasons\"", ",", "params", "=", "params", ")", "return", "loss_reasons" ]
Retrieve all reasons Returns all deal loss reasons available to the user according to the parameters provided :calls: ``get /loss_reasons`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Lo...
[ "Retrieve", "all", "reasons" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1037-L1050
train
Retrieve all reasons Returns all reasons
basecrm/basecrm-python
basecrm/services.py
LossReasonsService.retrieve
def retrieve(self, id) : """ Retrieve a single reason Returns a single loss reason available to the user by the provided id If a loss reason with the supplied unique identifier does not exist, it returns an error :calls: ``get /loss_reasons/{id}`` :param int id: Unique ...
python
def retrieve(self, id) : """ Retrieve a single reason Returns a single loss reason available to the user by the provided id If a loss reason with the supplied unique identifier does not exist, it returns an error :calls: ``get /loss_reasons/{id}`` :param int id: Unique ...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "loss_reason", "=", "self", ".", "http_client", ".", "get", "(", "\"/loss_reasons/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "loss_reason" ]
Retrieve a single reason Returns a single loss reason available to the user by the provided id If a loss reason with the supplied unique identifier does not exist, it returns an error :calls: ``get /loss_reasons/{id}`` :param int id: Unique identifier of a LossReason. :return: ...
[ "Retrieve", "a", "single", "reason" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1077-L1091
train
Retrieve a single loss reason by the provided unique identifier
basecrm/basecrm-python
basecrm/services.py
NotesService.list
def list(self, **params): """ Retrieve all notes Returns all notes available to the user, according to the parameters provided :calls: ``get /notes`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which ...
python
def list(self, **params): """ Retrieve all notes Returns all notes available to the user, according to the parameters provided :calls: ``get /notes`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which ...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "notes", "=", "self", ".", "http_client", ".", "get", "(", "\"/notes\"", ",", "params", "=", "params", ")", "return", "notes" ]
Retrieve all notes Returns all notes available to the user, according to the parameters provided :calls: ``get /notes`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Notes. :rtype:...
[ "Retrieve", "all", "notes" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1162-L1175
train
Retrieve all notes available to the user according to the parameters provided.
basecrm/basecrm-python
basecrm/services.py
NotesService.retrieve
def retrieve(self, id) : """ Retrieve a single note Returns a single note available to the user, according to the unique note ID provided If the note ID does not exist, this request will return an error :calls: ``get /notes/{id}`` :param int id: Unique identifier of a N...
python
def retrieve(self, id) : """ Retrieve a single note Returns a single note available to the user, according to the unique note ID provided If the note ID does not exist, this request will return an error :calls: ``get /notes/{id}`` :param int id: Unique identifier of a N...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "note", "=", "self", ".", "http_client", ".", "get", "(", "\"/notes/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "note" ]
Retrieve a single note Returns a single note available to the user, according to the unique note ID provided If the note ID does not exist, this request will return an error :calls: ``get /notes/{id}`` :param int id: Unique identifier of a Note. :return: Dictionary that support...
[ "Retrieve", "a", "single", "note" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1202-L1216
train
Retrieve a single note by its unique identifier
basecrm/basecrm-python
basecrm/services.py
OrdersService.list
def list(self, **params): """ Retrieve all orders Returns all orders available to the user according to the parameters provided :calls: ``get /orders`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, whic...
python
def list(self, **params): """ Retrieve all orders Returns all orders available to the user according to the parameters provided :calls: ``get /orders`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, whic...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "orders", "=", "self", ".", "http_client", ".", "get", "(", "\"/orders\"", ",", "params", "=", "params", ")", "return", "orders" ]
Retrieve all orders Returns all orders available to the user according to the parameters provided :calls: ``get /orders`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Orders. :rty...
[ "Retrieve", "all", "orders" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1284-L1297
train
Retrieve all orders available to the user according to the parameters provided.
basecrm/basecrm-python
basecrm/services.py
OrdersService.create
def create(self, *args, **kwargs): """ Create an order Create a new order for a deal User needs to have access to the deal to create an order Each deal can have at most one order and error is returned when attempting to create more :calls: ``post /orders`` :para...
python
def create(self, *args, **kwargs): """ Create an order Create a new order for a deal User needs to have access to the deal to create an order Each deal can have at most one order and error is returned when attempting to create more :calls: ``post /orders`` :para...
[ "def", "create", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "args", "and", "not", "kwargs", ":", "raise", "Exception", "(", "'attributes for Order are missing'", ")", "attributes", "=", "args", "[", "0", "]", "if", "...
Create an order Create a new order for a deal User needs to have access to the deal to create an order Each deal can have at most one order and error is returned when attempting to create more :calls: ``post /orders`` :param tuple *args: (optional) Single object representing Or...
[ "Create", "an", "order" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1299-L1321
train
Create an order for a deal
basecrm/basecrm-python
basecrm/services.py
OrdersService.retrieve
def retrieve(self, id) : """ Retrieve a single order Returns a single order available to the user, according to the unique order ID provided If the specified order does not exist, the request will return an error :calls: ``get /orders/{id}`` :param int id: Unique identi...
python
def retrieve(self, id) : """ Retrieve a single order Returns a single order available to the user, according to the unique order ID provided If the specified order does not exist, the request will return an error :calls: ``get /orders/{id}`` :param int id: Unique identi...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "order", "=", "self", ".", "http_client", ".", "get", "(", "\"/orders/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "order" ]
Retrieve a single order Returns a single order available to the user, according to the unique order ID provided If the specified order does not exist, the request will return an error :calls: ``get /orders/{id}`` :param int id: Unique identifier of a Order. :return: Dictionary ...
[ "Retrieve", "a", "single", "order" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1323-L1337
train
Retrieve a single order by its unique identifier
basecrm/basecrm-python
basecrm/services.py
PipelinesService.list
def list(self, **params): """ Retrieve all pipelines Returns all pipelines available to the user, according to the parameters provided :calls: ``get /pipelines`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style ac...
python
def list(self, **params): """ Retrieve all pipelines Returns all pipelines available to the user, according to the parameters provided :calls: ``get /pipelines`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style ac...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "pipelines", "=", "self", ".", "http_client", ".", "get", "(", "\"/pipelines\"", ",", "params", "=", "params", ")", "return", "pipelines" ]
Retrieve all pipelines Returns all pipelines available to the user, according to the parameters provided :calls: ``get /pipelines`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Pipelines....
[ "Retrieve", "all", "pipelines" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1401-L1414
train
Retrieve all pipelines available to the user according to the parameters provided.
basecrm/basecrm-python
basecrm/services.py
ProductsService.list
def list(self, **params): """ Retrieve all products Returns all products available to the user according to the parameters provided :calls: ``get /products`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access...
python
def list(self, **params): """ Retrieve all products Returns all products available to the user according to the parameters provided :calls: ``get /products`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "products", "=", "self", ".", "http_client", ".", "get", "(", "\"/products\"", ",", "params", "=", "params", ")", "return", "products" ]
Retrieve all products Returns all products available to the user according to the parameters provided :calls: ``get /products`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Products. ...
[ "Retrieve", "all", "products" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1441-L1454
train
Retrieve all products available to the user according to the parameters provided.
basecrm/basecrm-python
basecrm/services.py
ProductsService.retrieve
def retrieve(self, id) : """ Retrieve a single product Returns a single product, according to the unique product ID provided If the specified product does not exist, the request will return an error :calls: ``get /products/{id}`` :param int id: Unique identifier of a Pr...
python
def retrieve(self, id) : """ Retrieve a single product Returns a single product, according to the unique product ID provided If the specified product does not exist, the request will return an error :calls: ``get /products/{id}`` :param int id: Unique identifier of a Pr...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "product", "=", "self", ".", "http_client", ".", "get", "(", "\"/products/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "product" ]
Retrieve a single product Returns a single product, according to the unique product ID provided If the specified product does not exist, the request will return an error :calls: ``get /products/{id}`` :param int id: Unique identifier of a Product. :return: Dictionary that suppo...
[ "Retrieve", "a", "single", "product" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1478-L1492
train
Retrieve a single product by its unique identifier
basecrm/basecrm-python
basecrm/services.py
SourcesService.list
def list(self, **params): """ Retrieve all sources Returns all deal sources available to the user according to the parameters provided :calls: ``get /sources`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style acce...
python
def list(self, **params): """ Retrieve all sources Returns all deal sources available to the user according to the parameters provided :calls: ``get /sources`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style acce...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "sources", "=", "self", ".", "http_client", ".", "get", "(", "\"/sources\"", ",", "params", "=", "params", ")", "return", "sources" ]
Retrieve all sources Returns all deal sources available to the user according to the parameters provided :calls: ``get /sources`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Sources. ...
[ "Retrieve", "all", "sources" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1565-L1578
train
Retrieve all sources available to the user according to the parameters provided.
basecrm/basecrm-python
basecrm/services.py
SourcesService.retrieve
def retrieve(self, id) : """ Retrieve a single source Returns a single source available to the user by the provided id If a source with the supplied unique identifier does not exist it returns an error :calls: ``get /sources/{id}`` :param int id: Unique identifier of a ...
python
def retrieve(self, id) : """ Retrieve a single source Returns a single source available to the user by the provided id If a source with the supplied unique identifier does not exist it returns an error :calls: ``get /sources/{id}`` :param int id: Unique identifier of a ...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "source", "=", "self", ".", "http_client", ".", "get", "(", "\"/sources/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "source" ]
Retrieve a single source Returns a single source available to the user by the provided id If a source with the supplied unique identifier does not exist it returns an error :calls: ``get /sources/{id}`` :param int id: Unique identifier of a Source. :return: Dictionary that supp...
[ "Retrieve", "a", "single", "source" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1605-L1619
train
Retrieve a single source by the provided unique identifier
basecrm/basecrm-python
basecrm/services.py
StagesService.list
def list(self, **params): """ Retrieve all stages Returns all stages available to the user, according to the parameters provided :calls: ``get /stages`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, whi...
python
def list(self, **params): """ Retrieve all stages Returns all stages available to the user, according to the parameters provided :calls: ``get /stages`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, whi...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "stages", "=", "self", ".", "http_client", ".", "get", "(", "\"/stages\"", ",", "params", "=", "params", ")", "return", "stages" ]
Retrieve all stages Returns all stages available to the user, according to the parameters provided :calls: ``get /stages`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Stages. :rt...
[ "Retrieve", "all", "stages" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1686-L1699
train
Retrieve all stages available to the user according to the parameters provided.
basecrm/basecrm-python
basecrm/services.py
TagsService.list
def list(self, **params): """ Retrieve all tags Returns all tags available to the user, according to the parameters provided :calls: ``get /tags`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which rep...
python
def list(self, **params): """ Retrieve all tags Returns all tags available to the user, according to the parameters provided :calls: ``get /tags`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which rep...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "tags", "=", "self", ".", "http_client", ".", "get", "(", "\"/tags\"", ",", "params", "=", "params", ")", "return", "tags" ]
Retrieve all tags Returns all tags available to the user, according to the parameters provided :calls: ``get /tags`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Tags. :rtype: lis...
[ "Retrieve", "all", "tags" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1726-L1739
train
Retrieve all tags available to the user according to the parameters provided.
basecrm/basecrm-python
basecrm/services.py
TagsService.retrieve
def retrieve(self, id) : """ Retrieve a single tag Returns a single tag available to the user according to the unique ID provided If the specified tag does not exist, this query will return an error :calls: ``get /tags/{id}`` :param int id: Unique identifier of a Tag. ...
python
def retrieve(self, id) : """ Retrieve a single tag Returns a single tag available to the user according to the unique ID provided If the specified tag does not exist, this query will return an error :calls: ``get /tags/{id}`` :param int id: Unique identifier of a Tag. ...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "tag", "=", "self", ".", "http_client", ".", "get", "(", "\"/tags/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "tag" ]
Retrieve a single tag Returns a single tag available to the user according to the unique ID provided If the specified tag does not exist, this query will return an error :calls: ``get /tags/{id}`` :param int id: Unique identifier of a Tag. :return: Dictionary that support attri...
[ "Retrieve", "a", "single", "tag" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1764-L1778
train
Retrieve a single tag from the API.
basecrm/basecrm-python
basecrm/services.py
TasksService.list
def list(self, **params): """ Retrieve all tasks Returns all tasks available to the user, according to the parameters provided If you ask for tasks without any parameter provided Base API will return you both **floating** and **related** tasks Although you can narrow the search ...
python
def list(self, **params): """ Retrieve all tasks Returns all tasks available to the user, according to the parameters provided If you ask for tasks without any parameter provided Base API will return you both **floating** and **related** tasks Although you can narrow the search ...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "tasks", "=", "self", ".", "http_client", ".", "get", "(", "\"/tasks\"", ",", "params", "=", "params", ")", "return", "tasks" ]
Retrieve all tasks Returns all tasks available to the user, according to the parameters provided If you ask for tasks without any parameter provided Base API will return you both **floating** and **related** tasks Although you can narrow the search set to either of them via query parameters ...
[ "Retrieve", "all", "tasks" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1848-L1863
train
Retrieve all tasks available to the user according to the parameters provided
basecrm/basecrm-python
basecrm/services.py
TasksService.retrieve
def retrieve(self, id) : """ Retrieve a single task Returns a single task available to the user according to the unique task ID provided If the specified task does not exist, this query will return an error :calls: ``get /tasks/{id}`` :param int id: Unique identifier of...
python
def retrieve(self, id) : """ Retrieve a single task Returns a single task available to the user according to the unique task ID provided If the specified task does not exist, this query will return an error :calls: ``get /tasks/{id}`` :param int id: Unique identifier of...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "task", "=", "self", ".", "http_client", ".", "get", "(", "\"/tasks/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "task" ]
Retrieve a single task Returns a single task available to the user according to the unique task ID provided If the specified task does not exist, this query will return an error :calls: ``get /tasks/{id}`` :param int id: Unique identifier of a Task. :return: Dictionary that sup...
[ "Retrieve", "a", "single", "task" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1891-L1905
train
Retrieve a single task from the user s account.
basecrm/basecrm-python
basecrm/services.py
TextMessagesService.list
def list(self, **params): """ Retrieve text messages Returns Text Messages, according to the parameters provided :calls: ``get /text_messages`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which repres...
python
def list(self, **params): """ Retrieve text messages Returns Text Messages, according to the parameters provided :calls: ``get /text_messages`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which repres...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "text_messages", "=", "self", ".", "http_client", ".", "get", "(", "\"/text_messages\"", ",", "params", "=", "params", ")", "return", "text_messages" ]
Retrieve text messages Returns Text Messages, according to the parameters provided :calls: ``get /text_messages`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of TextMessages. :rtype...
[ "Retrieve", "text", "messages" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1969-L1982
train
Retrieve text messages by the key provided by the user.
basecrm/basecrm-python
basecrm/services.py
TextMessagesService.retrieve
def retrieve(self, id) : """ Retrieve a single text message Returns a single text message according to the unique ID provided If the specified user does not exist, this query returns an error :calls: ``get /text_messages/{id}`` :param int id: Unique identifier of a Tex...
python
def retrieve(self, id) : """ Retrieve a single text message Returns a single text message according to the unique ID provided If the specified user does not exist, this query returns an error :calls: ``get /text_messages/{id}`` :param int id: Unique identifier of a Tex...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "text_message", "=", "self", ".", "http_client", ".", "get", "(", "\"/text_messages/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "text_message" ]
Retrieve a single text message Returns a single text message according to the unique ID provided If the specified user does not exist, this query returns an error :calls: ``get /text_messages/{id}`` :param int id: Unique identifier of a TextMessage. :return: Dictionary that su...
[ "Retrieve", "a", "single", "text", "message" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1984-L1998
train
Retrieve a single text message according to the unique ID provided
basecrm/basecrm-python
basecrm/services.py
UsersService.list
def list(self, **params): """ Retrieve all users Returns all users, according to the parameters provided :calls: ``get /users`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection o...
python
def list(self, **params): """ Retrieve all users Returns all users, according to the parameters provided :calls: ``get /users`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection o...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "users", "=", "self", ".", "http_client", ".", "get", "(", "\"/users\"", ",", "params", "=", "params", ")", "return", "users" ]
Retrieve all users Returns all users, according to the parameters provided :calls: ``get /users`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Users. :rtype: list
[ "Retrieve", "all", "users" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L2021-L2034
train
Retrieve all users by the given parameters
basecrm/basecrm-python
basecrm/services.py
UsersService.retrieve
def retrieve(self, id) : """ Retrieve a single user Returns a single user according to the unique user ID provided If the specified user does not exist, this query returns an error :calls: ``get /users/{id}`` :param int id: Unique identifier of a User. :return: ...
python
def retrieve(self, id) : """ Retrieve a single user Returns a single user according to the unique user ID provided If the specified user does not exist, this query returns an error :calls: ``get /users/{id}`` :param int id: Unique identifier of a User. :return: ...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "user", "=", "self", ".", "http_client", ".", "get", "(", "\"/users/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "user" ]
Retrieve a single user Returns a single user according to the unique user ID provided If the specified user does not exist, this query returns an error :calls: ``get /users/{id}`` :param int id: Unique identifier of a User. :return: Dictionary that support attriubte-style acces...
[ "Retrieve", "a", "single", "user" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L2036-L2050
train
Retrieve a single user according to the unique user ID provided
basecrm/basecrm-python
basecrm/services.py
VisitsService.list
def list(self, **params): """ Retrieve visits Returns Visits, according to the parameters provided :calls: ``get /visits`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Vis...
python
def list(self, **params): """ Retrieve visits Returns Visits, according to the parameters provided :calls: ``get /visits`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Vis...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "visits", "=", "self", ".", "http_client", ".", "get", "(", "\"/visits\"", ",", "params", "=", "params", ")", "return", "visits" ]
Retrieve visits Returns Visits, according to the parameters provided :calls: ``get /visits`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Visits. :rtype: list
[ "Retrieve", "visits" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L2086-L2099
train
Retrieve visits by the given parameters
basecrm/basecrm-python
basecrm/services.py
VisitOutcomesService.list
def list(self, **params): """ Retrieve visit outcomes Returns Visit Outcomes, according to the parameters provided :calls: ``get /visit_outcomes`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which rep...
python
def list(self, **params): """ Retrieve visit outcomes Returns Visit Outcomes, according to the parameters provided :calls: ``get /visit_outcomes`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which rep...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "_", ",", "_", ",", "visit_outcomes", "=", "self", ".", "http_client", ".", "get", "(", "\"/visit_outcomes\"", ",", "params", "=", "params", ")", "return", "visit_outcomes" ]
Retrieve visit outcomes Returns Visit Outcomes, according to the parameters provided :calls: ``get /visit_outcomes`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of VisitOutcomes. :r...
[ "Retrieve", "visit", "outcomes" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L2122-L2135
train
Retrieve visit outcomes according to the parameters provided
jalmeroth/pymusiccast
pymusiccast/helpers.py
request
def request(url, *args, **kwargs): """Do the HTTP Request and return data""" method = kwargs.get('method', 'GET') timeout = kwargs.pop('timeout', 10) # hass default timeout req = requests.request(method, url, *args, timeout=timeout, **kwargs) data = req.json() _LOGGER.debug(json.dumps(data)) ...
python
def request(url, *args, **kwargs): """Do the HTTP Request and return data""" method = kwargs.get('method', 'GET') timeout = kwargs.pop('timeout', 10) # hass default timeout req = requests.request(method, url, *args, timeout=timeout, **kwargs) data = req.json() _LOGGER.debug(json.dumps(data)) ...
[ "def", "request", "(", "url", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "method", "=", "kwargs", ".", "get", "(", "'method'", ",", "'GET'", ")", "timeout", "=", "kwargs", ".", "pop", "(", "'timeout'", ",", "10", ")", "# hass default timeou...
Do the HTTP Request and return data
[ "Do", "the", "HTTP", "Request", "and", "return", "data" ]
616379ae22d6b518c61042d58be6d18a46242168
https://github.com/jalmeroth/pymusiccast/blob/616379ae22d6b518c61042d58be6d18a46242168/pymusiccast/helpers.py#L10-L17
train
Do the HTTP Request and return data
jalmeroth/pymusiccast
pymusiccast/helpers.py
message_worker
def message_worker(device): """Loop through messages and pass them on to right device""" _LOGGER.debug("Starting Worker Thread.") msg_q = device.messages while True: if not msg_q.empty(): message = msg_q.get() data = {} try: data = json.load...
python
def message_worker(device): """Loop through messages and pass them on to right device""" _LOGGER.debug("Starting Worker Thread.") msg_q = device.messages while True: if not msg_q.empty(): message = msg_q.get() data = {} try: data = json.load...
[ "def", "message_worker", "(", "device", ")", ":", "_LOGGER", ".", "debug", "(", "\"Starting Worker Thread.\"", ")", "msg_q", "=", "device", ".", "messages", "while", "True", ":", "if", "not", "msg_q", ".", "empty", "(", ")", ":", "message", "=", "msg_q", ...
Loop through messages and pass them on to right device
[ "Loop", "through", "messages", "and", "pass", "them", "on", "to", "right", "device" ]
616379ae22d6b518c61042d58be6d18a46242168
https://github.com/jalmeroth/pymusiccast/blob/616379ae22d6b518c61042d58be6d18a46242168/pymusiccast/helpers.py#L20-L44
train
Loop through messages and pass them on to right device.
jalmeroth/pymusiccast
pymusiccast/helpers.py
socket_worker
def socket_worker(sock, msg_q): """Socket Loop that fills message queue""" _LOGGER.debug("Starting Socket Thread.") while True: try: data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes except OSError as err: _LOGGER.error(err) else: _LO...
python
def socket_worker(sock, msg_q): """Socket Loop that fills message queue""" _LOGGER.debug("Starting Socket Thread.") while True: try: data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes except OSError as err: _LOGGER.error(err) else: _LO...
[ "def", "socket_worker", "(", "sock", ",", "msg_q", ")", ":", "_LOGGER", ".", "debug", "(", "\"Starting Socket Thread.\"", ")", "while", "True", ":", "try", ":", "data", ",", "addr", "=", "sock", ".", "recvfrom", "(", "1024", ")", "# buffer size is 1024 bytes...
Socket Loop that fills message queue
[ "Socket", "Loop", "that", "fills", "message", "queue" ]
616379ae22d6b518c61042d58be6d18a46242168
https://github.com/jalmeroth/pymusiccast/blob/616379ae22d6b518c61042d58be6d18a46242168/pymusiccast/helpers.py#L47-L58
train
Main worker function.
inveniosoftware-contrib/json-merger
json_merger/graph_builder.py
toposort
def toposort(graph, pick_first='head'): """Toplogically sorts a list match graph. Tries to perform a topological sort using as tiebreaker the pick_first argument. If the graph contains cycles, raise ValueError. """ in_deg = {} for node, next_nodes in six.iteritems(graph): for next_node ...
python
def toposort(graph, pick_first='head'): """Toplogically sorts a list match graph. Tries to perform a topological sort using as tiebreaker the pick_first argument. If the graph contains cycles, raise ValueError. """ in_deg = {} for node, next_nodes in six.iteritems(graph): for next_node ...
[ "def", "toposort", "(", "graph", ",", "pick_first", "=", "'head'", ")", ":", "in_deg", "=", "{", "}", "for", "node", ",", "next_nodes", "in", "six", ".", "iteritems", "(", "graph", ")", ":", "for", "next_node", "in", "[", "next_nodes", ".", "head_node"...
Toplogically sorts a list match graph. Tries to perform a topological sort using as tiebreaker the pick_first argument. If the graph contains cycles, raise ValueError.
[ "Toplogically", "sorts", "a", "list", "match", "graph", "." ]
adc6d372da018427e1db7b92424d3471e01a4118
https://github.com/inveniosoftware-contrib/json-merger/blob/adc6d372da018427e1db7b92424d3471e01a4118/json_merger/graph_builder.py#L231-L266
train
Toplogically sorts a list of nodes in a graph using a tiebreaker.
inveniosoftware-contrib/json-merger
json_merger/graph_builder.py
sort_cyclic_graph_best_effort
def sort_cyclic_graph_best_effort(graph, pick_first='head'): """Fallback for cases in which the graph has cycles.""" ordered = [] visited = set() # Go first on the pick_first chain then go back again on the others # that were not visited. Given the way the graph is built both chains # will alway...
python
def sort_cyclic_graph_best_effort(graph, pick_first='head'): """Fallback for cases in which the graph has cycles.""" ordered = [] visited = set() # Go first on the pick_first chain then go back again on the others # that were not visited. Given the way the graph is built both chains # will alway...
[ "def", "sort_cyclic_graph_best_effort", "(", "graph", ",", "pick_first", "=", "'head'", ")", ":", "ordered", "=", "[", "]", "visited", "=", "set", "(", ")", "# Go first on the pick_first chain then go back again on the others", "# that were not visited. Given the way the grap...
Fallback for cases in which the graph has cycles.
[ "Fallback", "for", "cases", "in", "which", "the", "graph", "has", "cycles", "." ]
adc6d372da018427e1db7b92424d3471e01a4118
https://github.com/inveniosoftware-contrib/json-merger/blob/adc6d372da018427e1db7b92424d3471e01a4118/json_merger/graph_builder.py#L269-L293
train
Fallback for cases in which the graph has cycles.
ellethee/argparseinator
examples/httprequest.py
get
def get(url): """Retrieve an url.""" writeln("Getting data from url", url) response = requests.get(url) if response.status_code == 200: writeln(response.text) else: writeln(str(response.status_code), response.reason)
python
def get(url): """Retrieve an url.""" writeln("Getting data from url", url) response = requests.get(url) if response.status_code == 200: writeln(response.text) else: writeln(str(response.status_code), response.reason)
[ "def", "get", "(", "url", ")", ":", "writeln", "(", "\"Getting data from url\"", ",", "url", ")", "response", "=", "requests", ".", "get", "(", "url", ")", "if", "response", ".", "status_code", "==", "200", ":", "writeln", "(", "response", ".", "text", ...
Retrieve an url.
[ "Retrieve", "an", "url", "." ]
05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/examples/httprequest.py#L11-L18
train
Retrieve an url.
ellethee/argparseinator
examples/httprequest.py
post
def post(url, var): """Post data to an url.""" data = {b[0]: b[1] for b in [a.split("=") for a in var]} writeln("Sending data to url", url) response = requests.post(url, data=data) if response.status_code == 200: writeln(response.text) else: writeln(str(response.status_code), res...
python
def post(url, var): """Post data to an url.""" data = {b[0]: b[1] for b in [a.split("=") for a in var]} writeln("Sending data to url", url) response = requests.post(url, data=data) if response.status_code == 200: writeln(response.text) else: writeln(str(response.status_code), res...
[ "def", "post", "(", "url", ",", "var", ")", ":", "data", "=", "{", "b", "[", "0", "]", ":", "b", "[", "1", "]", "for", "b", "in", "[", "a", ".", "split", "(", "\"=\"", ")", "for", "a", "in", "var", "]", "}", "writeln", "(", "\"Sending data ...
Post data to an url.
[ "Post", "data", "to", "an", "url", "." ]
05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/examples/httprequest.py#L23-L31
train
Post data to an url.
eleme/meepo
meepo/utils.py
cast_bytes
def cast_bytes(s, encoding='utf8', errors='strict'): """cast str or bytes to bytes""" if isinstance(s, bytes): return s elif isinstance(s, str): return s.encode(encoding, errors) else: raise TypeError("Expected unicode or bytes, got %r" % s)
python
def cast_bytes(s, encoding='utf8', errors='strict'): """cast str or bytes to bytes""" if isinstance(s, bytes): return s elif isinstance(s, str): return s.encode(encoding, errors) else: raise TypeError("Expected unicode or bytes, got %r" % s)
[ "def", "cast_bytes", "(", "s", ",", "encoding", "=", "'utf8'", ",", "errors", "=", "'strict'", ")", ":", "if", "isinstance", "(", "s", ",", "bytes", ")", ":", "return", "s", "elif", "isinstance", "(", "s", ",", "str", ")", ":", "return", "s", ".", ...
cast str or bytes to bytes
[ "cast", "str", "or", "bytes", "to", "bytes" ]
8212f0fe9b1d44be0c5de72d221a31c1d24bfe7a
https://github.com/eleme/meepo/blob/8212f0fe9b1d44be0c5de72d221a31c1d24bfe7a/meepo/utils.py#L46-L53
train
cast str or bytes to bytes
eleme/meepo
meepo/utils.py
cast_str
def cast_str(s, encoding='utf8', errors='strict'): """cast bytes or str to str""" if isinstance(s, bytes): return s.decode(encoding, errors) elif isinstance(s, str): return s else: raise TypeError("Expected unicode or bytes, got %r" % s)
python
def cast_str(s, encoding='utf8', errors='strict'): """cast bytes or str to str""" if isinstance(s, bytes): return s.decode(encoding, errors) elif isinstance(s, str): return s else: raise TypeError("Expected unicode or bytes, got %r" % s)
[ "def", "cast_str", "(", "s", ",", "encoding", "=", "'utf8'", ",", "errors", "=", "'strict'", ")", ":", "if", "isinstance", "(", "s", ",", "bytes", ")", ":", "return", "s", ".", "decode", "(", "encoding", ",", "errors", ")", "elif", "isinstance", "(",...
cast bytes or str to str
[ "cast", "bytes", "or", "str", "to", "str" ]
8212f0fe9b1d44be0c5de72d221a31c1d24bfe7a
https://github.com/eleme/meepo/blob/8212f0fe9b1d44be0c5de72d221a31c1d24bfe7a/meepo/utils.py#L57-L64
train
cast bytes or str to str
eleme/meepo
meepo/utils.py
cast_datetime
def cast_datetime(ts, fmt=None): """cast timestamp to datetime or date str""" dt = datetime.datetime.fromtimestamp(ts) if fmt: return dt.strftime(fmt) return dt
python
def cast_datetime(ts, fmt=None): """cast timestamp to datetime or date str""" dt = datetime.datetime.fromtimestamp(ts) if fmt: return dt.strftime(fmt) return dt
[ "def", "cast_datetime", "(", "ts", ",", "fmt", "=", "None", ")", ":", "dt", "=", "datetime", ".", "datetime", ".", "fromtimestamp", "(", "ts", ")", "if", "fmt", ":", "return", "dt", ".", "strftime", "(", "fmt", ")", "return", "dt" ]
cast timestamp to datetime or date str
[ "cast", "timestamp", "to", "datetime", "or", "date", "str" ]
8212f0fe9b1d44be0c5de72d221a31c1d24bfe7a
https://github.com/eleme/meepo/blob/8212f0fe9b1d44be0c5de72d221a31c1d24bfe7a/meepo/utils.py#L68-L73
train
cast timestamp to datetime or date str
Shinichi-Nakagawa/pitchpx
pitchpx/game/players.py
Players.read_xml
def read_xml(cls, url, markup, game): """ read xml object :param url: contents url :param markup: markup provider :param game: MLBAM Game object :return: pitchpx.game.players.Players object """ return Players._read_objects(MlbamUtil.find_xml("".join([url, ...
python
def read_xml(cls, url, markup, game): """ read xml object :param url: contents url :param markup: markup provider :param game: MLBAM Game object :return: pitchpx.game.players.Players object """ return Players._read_objects(MlbamUtil.find_xml("".join([url, ...
[ "def", "read_xml", "(", "cls", ",", "url", ",", "markup", ",", "game", ")", ":", "return", "Players", ".", "_read_objects", "(", "MlbamUtil", ".", "find_xml", "(", "\"\"", ".", "join", "(", "[", "url", ",", "cls", ".", "FILENAME", "]", ")", ",", "m...
read xml object :param url: contents url :param markup: markup provider :param game: MLBAM Game object :return: pitchpx.game.players.Players object
[ "read", "xml", "object", ":", "param", "url", ":", "contents", "url", ":", "param", "markup", ":", "markup", "provider", ":", "param", "game", ":", "MLBAM", "Game", "object", ":", "return", ":", "pitchpx", ".", "game", ".", "players", ".", "Players", "...
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/players.py#L264-L272
train
read xml object containing all objects
Shinichi-Nakagawa/pitchpx
pitchpx/game/players.py
Players._read_objects
def _read_objects(cls, soup, game): """ read objects :param soup: Beautifulsoup object :param game: MLBAM Game object :return: pitchpx.game.players.Players object """ players = Players() players.game = Players.Game() # game data players.gam...
python
def _read_objects(cls, soup, game): """ read objects :param soup: Beautifulsoup object :param game: MLBAM Game object :return: pitchpx.game.players.Players object """ players = Players() players.game = Players.Game() # game data players.gam...
[ "def", "_read_objects", "(", "cls", ",", "soup", ",", "game", ")", ":", "players", "=", "Players", "(", ")", "players", ".", "game", "=", "Players", ".", "Game", "(", ")", "# game data", "players", ".", "game", ".", "venue", "=", "soup", ".", "game",...
read objects :param soup: Beautifulsoup object :param game: MLBAM Game object :return: pitchpx.game.players.Players object
[ "read", "objects", ":", "param", "soup", ":", "Beautifulsoup", "object", ":", "param", "game", ":", "MLBAM", "Game", "object", ":", "return", ":", "pitchpx", ".", "game", ".", "players", ".", "Players", "object" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/players.py#L275-L309
train
read objects from the object soup and game
Shinichi-Nakagawa/pitchpx
pitchpx/game/players.py
Players._get_team
def _get_team(cls, soup): """ get team data :param soup: Beautifulsoup object :return: pitchpx.game.players.Players.Team object """ team = cls.Team() team.team_type = soup['type'] team.id = soup['id'] team.name = soup['name'] return team
python
def _get_team(cls, soup): """ get team data :param soup: Beautifulsoup object :return: pitchpx.game.players.Players.Team object """ team = cls.Team() team.team_type = soup['type'] team.id = soup['id'] team.name = soup['name'] return team
[ "def", "_get_team", "(", "cls", ",", "soup", ")", ":", "team", "=", "cls", ".", "Team", "(", ")", "team", ".", "team_type", "=", "soup", "[", "'type'", "]", "team", ".", "id", "=", "soup", "[", "'id'", "]", "team", ".", "name", "=", "soup", "["...
get team data :param soup: Beautifulsoup object :return: pitchpx.game.players.Players.Team object
[ "get", "team", "data", ":", "param", "soup", ":", "Beautifulsoup", "object", ":", "return", ":", "pitchpx", ".", "game", ".", "players", ".", "Players", ".", "Team", "object" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/players.py#L312-L322
train
get team data from soup
Shinichi-Nakagawa/pitchpx
pitchpx/game/players.py
Players.isdigit
def isdigit(cls, value): """ ditit check for stats :param value: stats value :return: True or False """ if str(value).replace('.','').replace('-','').isdigit(): return True return False
python
def isdigit(cls, value): """ ditit check for stats :param value: stats value :return: True or False """ if str(value).replace('.','').replace('-','').isdigit(): return True return False
[ "def", "isdigit", "(", "cls", ",", "value", ")", ":", "if", "str", "(", "value", ")", ".", "replace", "(", "'.'", ",", "''", ")", ".", "replace", "(", "'-'", ",", "''", ")", ".", "isdigit", "(", ")", ":", "return", "True", "return", "False" ]
ditit check for stats :param value: stats value :return: True or False
[ "ditit", "check", "for", "stats", ":", "param", "value", ":", "stats", "value", ":", "return", ":", "True", "or", "False" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/players.py#L325-L333
train
check for stats ditit check for stats
thautwarm/Redy
Redy/Magic/Classic.py
singleton_init_by
def singleton_init_by(init_fn=None): """ >>> from Redy.Magic.Classic import singleton >>> @singleton >>> class S: >>> pass >>> assert isinstance(S, S) """ if not init_fn: def wrap_init(origin_init): return origin_init else: def wrap_init(origin_init):...
python
def singleton_init_by(init_fn=None): """ >>> from Redy.Magic.Classic import singleton >>> @singleton >>> class S: >>> pass >>> assert isinstance(S, S) """ if not init_fn: def wrap_init(origin_init): return origin_init else: def wrap_init(origin_init):...
[ "def", "singleton_init_by", "(", "init_fn", "=", "None", ")", ":", "if", "not", "init_fn", ":", "def", "wrap_init", "(", "origin_init", ")", ":", "return", "origin_init", "else", ":", "def", "wrap_init", "(", "origin_init", ")", ":", "def", "__init__", "("...
>>> from Redy.Magic.Classic import singleton >>> @singleton >>> class S: >>> pass >>> assert isinstance(S, S)
[ ">>>", "from", "Redy", ".", "Magic", ".", "Classic", "import", "singleton", ">>>" ]
8beee5c5f752edfd2754bb1e6b5f4acb016a7770
https://github.com/thautwarm/Redy/blob/8beee5c5f752edfd2754bb1e6b5f4acb016a7770/Redy/Magic/Classic.py#L18-L51
train
Decorator to create a singleton object.
thautwarm/Redy
Redy/Magic/Classic.py
const_return
def const_return(func): """ >>> from Redy.Magic.Classic import const_return >>> @const_return >>> def f(x): >>> return x >>> r1 = f(1) >>> assert r1 is 1 and r1 is f(2) """ result = _undef def ret_call(*args, **kwargs): nonlocal result if result is _undef: ...
python
def const_return(func): """ >>> from Redy.Magic.Classic import const_return >>> @const_return >>> def f(x): >>> return x >>> r1 = f(1) >>> assert r1 is 1 and r1 is f(2) """ result = _undef def ret_call(*args, **kwargs): nonlocal result if result is _undef: ...
[ "def", "const_return", "(", "func", ")", ":", "result", "=", "_undef", "def", "ret_call", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "nonlocal", "result", "if", "result", "is", "_undef", ":", "result", "=", "func", "(", "*", "args", ",", ...
>>> from Redy.Magic.Classic import const_return >>> @const_return >>> def f(x): >>> return x >>> r1 = f(1) >>> assert r1 is 1 and r1 is f(2)
[ ">>>", "from", "Redy", ".", "Magic", ".", "Classic", "import", "const_return", ">>>" ]
8beee5c5f752edfd2754bb1e6b5f4acb016a7770
https://github.com/thautwarm/Redy/blob/8beee5c5f752edfd2754bb1e6b5f4acb016a7770/Redy/Magic/Classic.py#L57-L74
train
A function that returns a value that can be used to create a new object.
thautwarm/Redy
Redy/Magic/Classic.py
execute
def execute(func: types.FunctionType): """ >>> from Redy.Magic.Classic import execute >>> x = 1 >>> @execute >>> def f(x = x) -> int: >>> return x + 1 >>> assert f is 2 """ spec = getfullargspec(func) default = spec.defaults arg_cursor = 0 def get_item(name): ...
python
def execute(func: types.FunctionType): """ >>> from Redy.Magic.Classic import execute >>> x = 1 >>> @execute >>> def f(x = x) -> int: >>> return x + 1 >>> assert f is 2 """ spec = getfullargspec(func) default = spec.defaults arg_cursor = 0 def get_item(name): ...
[ "def", "execute", "(", "func", ":", "types", ".", "FunctionType", ")", ":", "spec", "=", "getfullargspec", "(", "func", ")", "default", "=", "spec", ".", "defaults", "arg_cursor", "=", "0", "def", "get_item", "(", "name", ")", ":", "nonlocal", "arg_curso...
>>> from Redy.Magic.Classic import execute >>> x = 1 >>> @execute >>> def f(x = x) -> int: >>> return x + 1 >>> assert f is 2
[ ">>>", "from", "Redy", ".", "Magic", ".", "Classic", "import", "execute", ">>>", "x", "=", "1", ">>>" ]
8beee5c5f752edfd2754bb1e6b5f4acb016a7770
https://github.com/thautwarm/Redy/blob/8beee5c5f752edfd2754bb1e6b5f4acb016a7770/Redy/Magic/Classic.py#L77-L102
train
Execute a function that returns a new object.
thautwarm/Redy
Redy/Magic/Classic.py
cast
def cast(cast_fn): """ >>> from Redy.Magic.Classic import cast >>> @cast(list) >>> def f(x): >>> for each in x: >>> if each % 2: >>> continue >>> yield each """ def inner(func): def call(*args, **kwargs): return cast_fn(func(*a...
python
def cast(cast_fn): """ >>> from Redy.Magic.Classic import cast >>> @cast(list) >>> def f(x): >>> for each in x: >>> if each % 2: >>> continue >>> yield each """ def inner(func): def call(*args, **kwargs): return cast_fn(func(*a...
[ "def", "cast", "(", "cast_fn", ")", ":", "def", "inner", "(", "func", ")", ":", "def", "call", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "cast_fn", "(", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")", "functool...
>>> from Redy.Magic.Classic import cast >>> @cast(list) >>> def f(x): >>> for each in x: >>> if each % 2: >>> continue >>> yield each
[ ">>>", "from", "Redy", ".", "Magic", ".", "Classic", "import", "cast", ">>>" ]
8beee5c5f752edfd2754bb1e6b5f4acb016a7770
https://github.com/thautwarm/Redy/blob/8beee5c5f752edfd2754bb1e6b5f4acb016a7770/Redy/Magic/Classic.py#L105-L123
train
A decorator that casts a list of objects to a new object.
thautwarm/Redy
Redy/Magic/Classic.py
record
def record(cls_def): """ Namedtuple which could inherit from other types. >>> from Redy.Magic.Classic import record >>> class Interface: pass >>> @record >>> class S(Interface): >>> name: str >>> addr: str >>> sex : int >>> s = S("sam", "I/O", 1) """ annotati...
python
def record(cls_def): """ Namedtuple which could inherit from other types. >>> from Redy.Magic.Classic import record >>> class Interface: pass >>> @record >>> class S(Interface): >>> name: str >>> addr: str >>> sex : int >>> s = S("sam", "I/O", 1) """ annotati...
[ "def", "record", "(", "cls_def", ")", ":", "annotations", "=", "getattr", "(", "cls_def", ",", "'__annotations__'", ",", "{", "}", ")", "typ", ":", "type", "=", "namedtuple", "(", "cls_def", ".", "__name__", ",", "list", "(", "annotations", ".", "keys", ...
Namedtuple which could inherit from other types. >>> from Redy.Magic.Classic import record >>> class Interface: pass >>> @record >>> class S(Interface): >>> name: str >>> addr: str >>> sex : int >>> s = S("sam", "I/O", 1)
[ "Namedtuple", "which", "could", "inherit", "from", "other", "types", ".", ">>>", "from", "Redy", ".", "Magic", ".", "Classic", "import", "record", ">>>", "class", "Interface", ":", "pass", ">>>", "@record", ">>>", "class", "S", "(", "Interface", ")", ":", ...
8beee5c5f752edfd2754bb1e6b5f4acb016a7770
https://github.com/thautwarm/Redy/blob/8beee5c5f752edfd2754bb1e6b5f4acb016a7770/Redy/Magic/Classic.py#L126-L141
train
Record the class definition.
thautwarm/Redy
Redy/Magic/Classic.py
template
def template(spec_fn): """ >>> from Redy.Magic.Classic import template >>> import operator >>> class Point: >>> def __init__(self, p): >>> assert isinstance(p, tuple) and len(p) is 2 >>> self.x, self.y = p >>> def some_metrics(p: Point): >>> return p.x + 2 * p...
python
def template(spec_fn): """ >>> from Redy.Magic.Classic import template >>> import operator >>> class Point: >>> def __init__(self, p): >>> assert isinstance(p, tuple) and len(p) is 2 >>> self.x, self.y = p >>> def some_metrics(p: Point): >>> return p.x + 2 * p...
[ "def", "template", "(", "spec_fn", ")", ":", "def", "specify", "(", "*", "spec_args", ",", "*", "*", "spec_kwds", ")", ":", "def", "call", "(", "_", ")", ":", "def", "inner", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "return", "spec_fn",...
>>> from Redy.Magic.Classic import template >>> import operator >>> class Point: >>> def __init__(self, p): >>> assert isinstance(p, tuple) and len(p) is 2 >>> self.x, self.y = p >>> def some_metrics(p: Point): >>> return p.x + 2 * p.y >>> @template >>> def c...
[ ">>>", "from", "Redy", ".", "Magic", ".", "Classic", "import", "template", ">>>", "import", "operator", ">>>", "class", "Point", ":", ">>>", "def", "__init__", "(", "self", "p", ")", ":", ">>>", "assert", "isinstance", "(", "p", "tuple", ")", "and", "l...
8beee5c5f752edfd2754bb1e6b5f4acb016a7770
https://github.com/thautwarm/Redy/blob/8beee5c5f752edfd2754bb1e6b5f4acb016a7770/Redy/Magic/Classic.py#L190-L247
train
A simple template factory that returns a new object that can be used to create a new node.
thautwarm/Redy
Redy/Async/Delegate.py
Delegate.insert
def insert(self, action: Action, where: 'Union[int, Delegate.Where]'): """ add a new action with specific priority >>> delegate: Delegate >>> delegate.insert(lambda task, product, ctx: print(product), where=Delegate.Where.after(lambda action: action.__name__ == 'myfunc')) the co...
python
def insert(self, action: Action, where: 'Union[int, Delegate.Where]'): """ add a new action with specific priority >>> delegate: Delegate >>> delegate.insert(lambda task, product, ctx: print(product), where=Delegate.Where.after(lambda action: action.__name__ == 'myfunc')) the co...
[ "def", "insert", "(", "self", ",", "action", ":", "Action", ",", "where", ":", "'Union[int, Delegate.Where]'", ")", ":", "if", "isinstance", "(", "where", ",", "int", ")", ":", "self", ".", "actions", ".", "insert", "(", "where", ",", "action", ")", "r...
add a new action with specific priority >>> delegate: Delegate >>> delegate.insert(lambda task, product, ctx: print(product), where=Delegate.Where.after(lambda action: action.__name__ == 'myfunc')) the codes above inserts an action after the specific action whose name is 'myfunc'.
[ "add", "a", "new", "action", "with", "specific", "priority" ]
8beee5c5f752edfd2754bb1e6b5f4acb016a7770
https://github.com/thautwarm/Redy/blob/8beee5c5f752edfd2754bb1e6b5f4acb016a7770/Redy/Async/Delegate.py#L55-L68
train
add a new action with specific priority
inveniosoftware-contrib/json-merger
json_merger/dict_merger.py
patch_to_conflict_set
def patch_to_conflict_set(patch): """Translates a dictdiffer conflict into a json_merger one.""" patch_type, patched_key, value = patch if isinstance(patched_key, list): key_path = tuple(patched_key) else: key_path = tuple(k for k in patched_key.split('.') if k) conflicts = set() ...
python
def patch_to_conflict_set(patch): """Translates a dictdiffer conflict into a json_merger one.""" patch_type, patched_key, value = patch if isinstance(patched_key, list): key_path = tuple(patched_key) else: key_path = tuple(k for k in patched_key.split('.') if k) conflicts = set() ...
[ "def", "patch_to_conflict_set", "(", "patch", ")", ":", "patch_type", ",", "patched_key", ",", "value", "=", "patch", "if", "isinstance", "(", "patched_key", ",", "list", ")", ":", "key_path", "=", "tuple", "(", "patched_key", ")", "else", ":", "key_path", ...
Translates a dictdiffer conflict into a json_merger one.
[ "Translates", "a", "dictdiffer", "conflict", "into", "a", "json_merger", "one", "." ]
adc6d372da018427e1db7b92424d3471e01a4118
https://github.com/inveniosoftware-contrib/json-merger/blob/adc6d372da018427e1db7b92424d3471e01a4118/json_merger/dict_merger.py#L54-L76
train
Translates a dictdiffer conflict into a json_merger one.
inveniosoftware-contrib/json-merger
json_merger/dict_merger.py
SkipListsMerger.merge
def merge(self): """Perform merge of head and update starting from root.""" if isinstance(self.head, dict) and isinstance(self.update, dict): if not isinstance(self.root, dict): self.root = {} self._merge_dicts() else: self._merge_base_values()...
python
def merge(self): """Perform merge of head and update starting from root.""" if isinstance(self.head, dict) and isinstance(self.update, dict): if not isinstance(self.root, dict): self.root = {} self._merge_dicts() else: self._merge_base_values()...
[ "def", "merge", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "head", ",", "dict", ")", "and", "isinstance", "(", "self", ".", "update", ",", "dict", ")", ":", "if", "not", "isinstance", "(", "self", ".", "root", ",", "dict", ")", ...
Perform merge of head and update starting from root.
[ "Perform", "merge", "of", "head", "and", "update", "starting", "from", "root", "." ]
adc6d372da018427e1db7b92424d3471e01a4118
https://github.com/inveniosoftware-contrib/json-merger/blob/adc6d372da018427e1db7b92424d3471e01a4118/json_merger/dict_merger.py#L236-L246
train
Perform merge of head and update starting from root.
Shinichi-Nakagawa/pitchpx
pitchpx/game/inning.py
Pitch.is_pa_terminal
def is_pa_terminal(cls, ball_tally, strike_tally, pitch_res, event_cd): """ Is PA terminal :param ball_tally: Ball telly :param strike_tally: Strike telly :param pitch_res: pitching result(Retrosheet format) :param event_cd: Event code :return: FLG(T or F) ...
python
def is_pa_terminal(cls, ball_tally, strike_tally, pitch_res, event_cd): """ Is PA terminal :param ball_tally: Ball telly :param strike_tally: Strike telly :param pitch_res: pitching result(Retrosheet format) :param event_cd: Event code :return: FLG(T or F) ...
[ "def", "is_pa_terminal", "(", "cls", ",", "ball_tally", ",", "strike_tally", ",", "pitch_res", ",", "event_cd", ")", ":", "if", "RetroSheet", ".", "is_pa_terminal", "(", "ball_tally", ",", "strike_tally", ",", "pitch_res", ",", "event_cd", ")", ":", "return", ...
Is PA terminal :param ball_tally: Ball telly :param strike_tally: Strike telly :param pitch_res: pitching result(Retrosheet format) :param event_cd: Event code :return: FLG(T or F)
[ "Is", "PA", "terminal", ":", "param", "ball_tally", ":", "Ball", "telly", ":", "param", "strike_tally", ":", "Strike", "telly", ":", "param", "pitch_res", ":", "pitching", "result", "(", "Retrosheet", "format", ")", ":", "param", "event_cd", ":", "Event", ...
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/inning.py#L16-L27
train
Return whether or not the current event is a PA terminal.
Shinichi-Nakagawa/pitchpx
pitchpx/game/inning.py
Pitch.row
def row(cls, pitch, pa, pitch_list, ball_tally, strike_tally): """ Pitching Result Pitch f/x fields: https://fastballs.wordpress.com/category/pitchfx-glossary/ :param pitch: pitch object(type:Beautifulsoup) :param pa: At bat data for pa(dict) :param pitch_list: Pitching ...
python
def row(cls, pitch, pa, pitch_list, ball_tally, strike_tally): """ Pitching Result Pitch f/x fields: https://fastballs.wordpress.com/category/pitchfx-glossary/ :param pitch: pitch object(type:Beautifulsoup) :param pa: At bat data for pa(dict) :param pitch_list: Pitching ...
[ "def", "row", "(", "cls", ",", "pitch", ",", "pa", ",", "pitch_list", ",", "ball_tally", ",", "strike_tally", ")", ":", "pitch_res", "=", "MlbamUtil", ".", "get_attribute_stats", "(", "pitch", ",", "'type'", ",", "str", ",", "MlbamConst", ".", "UNKNOWN_FUL...
Pitching Result Pitch f/x fields: https://fastballs.wordpress.com/category/pitchfx-glossary/ :param pitch: pitch object(type:Beautifulsoup) :param pa: At bat data for pa(dict) :param pitch_list: Pitching :param ball_tally: Ball telly :param strike_tally: Strike telly ...
[ "Pitching", "Result", "Pitch", "f", "/", "x", "fields", ":", "https", ":", "//", "fastballs", ".", "wordpress", ".", "com", "/", "category", "/", "pitchfx", "-", "glossary", "/", ":", "param", "pitch", ":", "pitch", "object", "(", "type", ":", "Beautif...
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/inning.py#L30-L199
train
Return a dictionary of all the information for a given pitch and pa.
Shinichi-Nakagawa/pitchpx
pitchpx/game/inning.py
AtBat._get_bases
def _get_bases(cls, ab): """ Start Bases & End Bases :param ab: at bat object(type:Beautifulsoup) :param attribute_name: attribute name :return: start base, end base """ start_bases, end_bases = [], [] for base in ('1B', '2B', '3B'): if ab.find...
python
def _get_bases(cls, ab): """ Start Bases & End Bases :param ab: at bat object(type:Beautifulsoup) :param attribute_name: attribute name :return: start base, end base """ start_bases, end_bases = [], [] for base in ('1B', '2B', '3B'): if ab.find...
[ "def", "_get_bases", "(", "cls", ",", "ab", ")", ":", "start_bases", ",", "end_bases", "=", "[", "]", ",", "[", "]", "for", "base", "in", "(", "'1B'", ",", "'2B'", ",", "'3B'", ")", ":", "if", "ab", ".", "find", "(", "'runner'", ",", "start", "...
Start Bases & End Bases :param ab: at bat object(type:Beautifulsoup) :param attribute_name: attribute name :return: start base, end base
[ "Start", "Bases", "&", "End", "Bases", ":", "param", "ab", ":", "at", "bat", "object", "(", "type", ":", "Beautifulsoup", ")", ":", "param", "attribute_name", ":", "attribute", "name", ":", "return", ":", "start", "base", "end", "base" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/inning.py#L207-L224
train
Get start and end bases from start and end base names.
Shinichi-Nakagawa/pitchpx
pitchpx/game/inning.py
AtBat.pa
def pa(cls, ab, game, rosters, inning_number, inning_id, out_ct, hit_location): """ plate appearance data :param ab: at bat object(type:Beautifulsoup) :param game: MLBAM Game object :param rosters: Game Rosters :param inning_number: Inning Number :param inning_id:...
python
def pa(cls, ab, game, rosters, inning_number, inning_id, out_ct, hit_location): """ plate appearance data :param ab: at bat object(type:Beautifulsoup) :param game: MLBAM Game object :param rosters: Game Rosters :param inning_number: Inning Number :param inning_id:...
[ "def", "pa", "(", "cls", ",", "ab", ",", "game", ",", "rosters", ",", "inning_number", ",", "inning_id", ",", "out_ct", ",", "hit_location", ")", ":", "ab_des", "=", "MlbamUtil", ".", "get_attribute_stats", "(", "ab", ",", "'des'", ",", "str", ",", "Ml...
plate appearance data :param ab: at bat object(type:Beautifulsoup) :param game: MLBAM Game object :param rosters: Game Rosters :param inning_number: Inning Number :param inning_id: Inning Id(0:home 1:away) :param pitch_list: Pitching :param out_ct: out count ...
[ "plate", "appearance", "data", ":", "param", "ab", ":", "at", "bat", "object", "(", "type", ":", "Beautifulsoup", ")", ":", "param", "game", ":", "MLBAM", "Game", "object", ":", "param", "rosters", ":", "Game", "Rosters", ":", "param", "inning_number", "...
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/inning.py#L227-L348
train
Return dictionary of all the properties of a specific plate appearance.
Shinichi-Nakagawa/pitchpx
pitchpx/game/inning.py
AtBat.result
def result(cls, ab, pa, pitch_list): """ At Bat Result :param ab: at bat object(type:Beautifulsoup) :param pa: atbat data for plate appearance :param pitch_list: Pitching data :return: pa result value(dict) """ atbat = OrderedDict() atbat['ball_ct'...
python
def result(cls, ab, pa, pitch_list): """ At Bat Result :param ab: at bat object(type:Beautifulsoup) :param pa: atbat data for plate appearance :param pitch_list: Pitching data :return: pa result value(dict) """ atbat = OrderedDict() atbat['ball_ct'...
[ "def", "result", "(", "cls", ",", "ab", ",", "pa", ",", "pitch_list", ")", ":", "atbat", "=", "OrderedDict", "(", ")", "atbat", "[", "'ball_ct'", "]", "=", "MlbamUtil", ".", "get_attribute_stats", "(", "ab", ",", "'b'", ",", "int", ",", "None", ")", ...
At Bat Result :param ab: at bat object(type:Beautifulsoup) :param pa: atbat data for plate appearance :param pitch_list: Pitching data :return: pa result value(dict)
[ "At", "Bat", "Result", ":", "param", "ab", ":", "at", "bat", "object", "(", "type", ":", "Beautifulsoup", ")", ":", "param", "pa", ":", "atbat", "data", "for", "plate", "appearance", ":", "param", "pitch_list", ":", "Pitching", "data", ":", "return", "...
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/inning.py#L351-L365
train
Return the result of a plate appearance at a given time.
Shinichi-Nakagawa/pitchpx
pitchpx/game/inning.py
InningAction.action
def action(cls, action, game, rosters, inning_number, inning_id): """ action data :param action: action object(type:Beautifulsoup) :param game: MLBAM Game object :param rosters: Game Rosters :param inning_number: Inning Number :param inning_id: Inning Id(0:home 1:...
python
def action(cls, action, game, rosters, inning_number, inning_id): """ action data :param action: action object(type:Beautifulsoup) :param game: MLBAM Game object :param rosters: Game Rosters :param inning_number: Inning Number :param inning_id: Inning Id(0:home 1:...
[ "def", "action", "(", "cls", ",", "action", ",", "game", ",", "rosters", ",", "inning_number", ",", "inning_id", ")", ":", "player_mlbid", "=", "MlbamUtil", ".", "get_attribute_stats", "(", "action", ",", "'player'", ",", "str", ",", "MlbamConst", ".", "UN...
action data :param action: action object(type:Beautifulsoup) :param game: MLBAM Game object :param rosters: Game Rosters :param inning_number: Inning Number :param inning_id: Inning Id(0:home 1:away) :return: { 'retro_game_id': Retrosheet Game id '...
[ "action", "data", ":", "param", "action", ":", "action", "object", "(", "type", ":", "Beautifulsoup", ")", ":", "param", "game", ":", "MLBAM", "Game", "object", ":", "param", "rosters", ":", "Game", "Rosters", ":", "param", "inning_number", ":", "Inning", ...
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/inning.py#L373-L462
train
Return a dictionary of the data for an action.
Shinichi-Nakagawa/pitchpx
pitchpx/game/inning.py
Inning.read_xml
def read_xml(cls, url, markup, game, players): """ read xml object :param url: contents url :param markup: markup provider :param game: MLBAM Game object :param players: MLBAM Players object :return: pitchpx.game.game.Game object """ innings = Inni...
python
def read_xml(cls, url, markup, game, players): """ read xml object :param url: contents url :param markup: markup provider :param game: MLBAM Game object :param players: MLBAM Players object :return: pitchpx.game.game.Game object """ innings = Inni...
[ "def", "read_xml", "(", "cls", ",", "url", ",", "markup", ",", "game", ",", "players", ")", ":", "innings", "=", "Inning", "(", "game", ",", "players", ")", "base_url", "=", "\"\"", ".", "join", "(", "[", "url", ",", "cls", ".", "DIRECTORY", "]", ...
read xml object :param url: contents url :param markup: markup provider :param game: MLBAM Game object :param players: MLBAM Players object :return: pitchpx.game.game.Game object
[ "read", "xml", "object", ":", "param", "url", ":", "contents", "url", ":", "param", "markup", ":", "markup", "provider", ":", "param", "game", ":", "MLBAM", "Game", "object", ":", "param", "players", ":", "MLBAM", "Players", "object", ":", "return", ":",...
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/inning.py#L491-L517
train
read xml object
Shinichi-Nakagawa/pitchpx
pitchpx/game/inning.py
Inning._inning_actions
def _inning_actions(self, soup, inning_number, inning_id): """ Inning Actions. :param soup: Beautifulsoup object :param inning_number: Inning Number :param inning_id: Inning Id(0:home, 1:away) """ # at bat(batter box data) & pitching data for act in soup.f...
python
def _inning_actions(self, soup, inning_number, inning_id): """ Inning Actions. :param soup: Beautifulsoup object :param inning_number: Inning Number :param inning_id: Inning Id(0:home, 1:away) """ # at bat(batter box data) & pitching data for act in soup.f...
[ "def", "_inning_actions", "(", "self", ",", "soup", ",", "inning_number", ",", "inning_id", ")", ":", "# at bat(batter box data) & pitching data", "for", "act", "in", "soup", ".", "find_all", "(", "'action'", ")", ":", "self", ".", "actions", ".", "append", "(...
Inning Actions. :param soup: Beautifulsoup object :param inning_number: Inning Number :param inning_id: Inning Id(0:home, 1:away)
[ "Inning", "Actions", ".", ":", "param", "soup", ":", "Beautifulsoup", "object", ":", "param", "inning_number", ":", "Inning", "Number", ":", "param", "inning_id", ":", "Inning", "Id", "(", "0", ":", "home", "1", ":", "away", ")" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/inning.py#L540-L549
train
Parse the inning actions.
Shinichi-Nakagawa/pitchpx
pitchpx/game/inning.py
Inning._inning_events
def _inning_events(self, soup, inning_number, inning_id, hit_location): """ Inning Events. :param soup: Beautifulsoup object :param inning_number: Inning Number :param inning_id: Inning Id(0:home, 1:away) :param hit_location: Hitlocation data(dict) """ # a...
python
def _inning_events(self, soup, inning_number, inning_id, hit_location): """ Inning Events. :param soup: Beautifulsoup object :param inning_number: Inning Number :param inning_id: Inning Id(0:home, 1:away) :param hit_location: Hitlocation data(dict) """ # a...
[ "def", "_inning_events", "(", "self", ",", "soup", ",", "inning_number", ",", "inning_id", ",", "hit_location", ")", ":", "# at bat(batter box data) & pitching data", "out_ct", "=", "0", "for", "ab", "in", "soup", ".", "find_all", "(", "'atbat'", ")", ":", "# ...
Inning Events. :param soup: Beautifulsoup object :param inning_number: Inning Number :param inning_id: Inning Id(0:home, 1:away) :param hit_location: Hitlocation data(dict)
[ "Inning", "Events", ".", ":", "param", "soup", ":", "Beautifulsoup", "object", ":", "param", "inning_number", ":", "Inning", "Number", ":", "param", "inning_id", ":", "Inning", "Id", "(", "0", ":", "home", "1", ":", "away", ")", ":", "param", "hit_locati...
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/inning.py#L551-L572
train
Inning Events.
Shinichi-Nakagawa/pitchpx
pitchpx/game/inning.py
Inning._get_pitch
def _get_pitch(self, soup, pa): """ get pitch data :param soup: Beautifulsoup object :param pa: atbat data for plate appearance :return: pitches result(list) """ pitches = [] ball_tally, strike_tally = 0, 0 for pitch in soup.find_all('pitch'): ...
python
def _get_pitch(self, soup, pa): """ get pitch data :param soup: Beautifulsoup object :param pa: atbat data for plate appearance :return: pitches result(list) """ pitches = [] ball_tally, strike_tally = 0, 0 for pitch in soup.find_all('pitch'): ...
[ "def", "_get_pitch", "(", "self", ",", "soup", ",", "pa", ")", ":", "pitches", "=", "[", "]", "ball_tally", ",", "strike_tally", "=", "0", ",", "0", "for", "pitch", "in", "soup", ".", "find_all", "(", "'pitch'", ")", ":", "# pitching result", "pitch", ...
get pitch data :param soup: Beautifulsoup object :param pa: atbat data for plate appearance :return: pitches result(list)
[ "get", "pitch", "data", ":", "param", "soup", ":", "Beautifulsoup", "object", ":", "param", "pa", ":", "atbat", "data", "for", "plate", "appearance", ":", "return", ":", "pitches", "result", "(", "list", ")" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/inning.py#L574-L589
train
get pitch data for a given plate appearance
robinandeer/puzzle
puzzle/plugins/gemini/mixins/case.py
CaseMixin._add_individual
def _add_individual(self, ind_obj): """Add a individual to the adapter Args: ind_obj (puzzle.models.Individual) """ logger.debug("Adding individual {0} to plugin".format(ind_obj.ind_id)) self.individual_objs.append(ind_obj)
python
def _add_individual(self, ind_obj): """Add a individual to the adapter Args: ind_obj (puzzle.models.Individual) """ logger.debug("Adding individual {0} to plugin".format(ind_obj.ind_id)) self.individual_objs.append(ind_obj)
[ "def", "_add_individual", "(", "self", ",", "ind_obj", ")", ":", "logger", ".", "debug", "(", "\"Adding individual {0} to plugin\"", ".", "format", "(", "ind_obj", ".", "ind_id", ")", ")", "self", ".", "individual_objs", ".", "append", "(", "ind_obj", ")" ]
Add a individual to the adapter Args: ind_obj (puzzle.models.Individual)
[ "Add", "a", "individual", "to", "the", "adapter", "Args", ":", "ind_obj", "(", "puzzle", ".", "models", ".", "Individual", ")" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/gemini/mixins/case.py#L15-L22
train
Add an individual to the adapter
robinandeer/puzzle
puzzle/plugins/gemini/mixins/case.py
CaseMixin.add_case
def add_case(self, case_obj): """Add a case obj with individuals to adapter Args: case_obj (puzzle.models.Case) """ for ind_obj in case_obj.individuals: self._add_individual(ind_obj) logger.debug("Adding case {0} to plugin...
python
def add_case(self, case_obj): """Add a case obj with individuals to adapter Args: case_obj (puzzle.models.Case) """ for ind_obj in case_obj.individuals: self._add_individual(ind_obj) logger.debug("Adding case {0} to plugin...
[ "def", "add_case", "(", "self", ",", "case_obj", ")", ":", "for", "ind_obj", "in", "case_obj", ".", "individuals", ":", "self", ".", "_add_individual", "(", "ind_obj", ")", "logger", ".", "debug", "(", "\"Adding case {0} to plugin\"", ".", "format", "(", "ca...
Add a case obj with individuals to adapter Args: case_obj (puzzle.models.Case)
[ "Add", "a", "case", "obj", "with", "individuals", "to", "adapter", "Args", ":", "case_obj", "(", "puzzle", ".", "models", ".", "Case", ")" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/gemini/mixins/case.py#L24-L34
train
Adds a case to the adapter
robinandeer/puzzle
puzzle/plugins/gemini/mixins/case.py
CaseMixin.case
def case(self, case_id=None): """Return a Case object If no case_id is given return one case Args: case_id (str): A case id Returns: case(Case): A Case object """ cases = self.cases() if case_id: for case ...
python
def case(self, case_id=None): """Return a Case object If no case_id is given return one case Args: case_id (str): A case id Returns: case(Case): A Case object """ cases = self.cases() if case_id: for case ...
[ "def", "case", "(", "self", ",", "case_id", "=", "None", ")", ":", "cases", "=", "self", ".", "cases", "(", ")", "if", "case_id", ":", "for", "case", "in", "cases", ":", "if", "case", ".", "case_id", "==", "case_id", ":", "return", "case", "else", ...
Return a Case object If no case_id is given return one case Args: case_id (str): A case id Returns: case(Case): A Case object
[ "Return", "a", "Case", "object" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/gemini/mixins/case.py#L48-L68
train
Return a Case object for the given case_id. If no case_id is given return one case.
robinandeer/puzzle
puzzle/plugins/gemini/mixins/case.py
CaseMixin.individual
def individual(self, ind_id=None): """Return a individual object Args: ind_id (str): A individual id Returns: individual (puzzle.models.individual) """ for ind_obj in self.individuals: if ind_obj.ind_id == ...
python
def individual(self, ind_id=None): """Return a individual object Args: ind_id (str): A individual id Returns: individual (puzzle.models.individual) """ for ind_obj in self.individuals: if ind_obj.ind_id == ...
[ "def", "individual", "(", "self", ",", "ind_id", "=", "None", ")", ":", "for", "ind_obj", "in", "self", ".", "individuals", ":", "if", "ind_obj", ".", "ind_id", "==", "ind_id", ":", "return", "ind_obj", "return", "None" ]
Return a individual object Args: ind_id (str): A individual id Returns: individual (puzzle.models.individual)
[ "Return", "a", "individual", "object", "Args", ":", "ind_id", "(", "str", ")", ":", "A", "individual", "id", "Returns", ":", "individual", "(", "puzzle", ".", "models", ".", "individual", ")" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/gemini/mixins/case.py#L70-L82
train
Return a individual object
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
chebyshev
def chebyshev(point1, point2): """Computes distance between 2D points using chebyshev metric :param point1: 1st point :type point1: list :param point2: 2nd point :type point2: list :returns: Distance between point1 and point2 :rtype: float """ return max(abs(point1[0] - point2[0]),...
python
def chebyshev(point1, point2): """Computes distance between 2D points using chebyshev metric :param point1: 1st point :type point1: list :param point2: 2nd point :type point2: list :returns: Distance between point1 and point2 :rtype: float """ return max(abs(point1[0] - point2[0]),...
[ "def", "chebyshev", "(", "point1", ",", "point2", ")", ":", "return", "max", "(", "abs", "(", "point1", "[", "0", "]", "-", "point2", "[", "0", "]", ")", ",", "abs", "(", "point1", "[", "1", "]", "-", "point2", "[", "1", "]", ")", ")" ]
Computes distance between 2D points using chebyshev metric :param point1: 1st point :type point1: list :param point2: 2nd point :type point2: list :returns: Distance between point1 and point2 :rtype: float
[ "Computes", "distance", "between", "2D", "points", "using", "chebyshev", "metric" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L26-L37
train
Computes distance between two points using chebyshev metric
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
hilbertrot
def hilbertrot(n, x, y, rx, ry): """Rotates and flips a quadrant appropriately for the Hilbert scan generator. See https://en.wikipedia.org/wiki/Hilbert_curve. """ if ry == 0: if rx == 1: x = n - 1 - x y = n - 1 - y return y, x return x, y
python
def hilbertrot(n, x, y, rx, ry): """Rotates and flips a quadrant appropriately for the Hilbert scan generator. See https://en.wikipedia.org/wiki/Hilbert_curve. """ if ry == 0: if rx == 1: x = n - 1 - x y = n - 1 - y return y, x return x, y
[ "def", "hilbertrot", "(", "n", ",", "x", ",", "y", ",", "rx", ",", "ry", ")", ":", "if", "ry", "==", "0", ":", "if", "rx", "==", "1", ":", "x", "=", "n", "-", "1", "-", "x", "y", "=", "n", "-", "1", "-", "y", "return", "y", ",", "x", ...
Rotates and flips a quadrant appropriately for the Hilbert scan generator. See https://en.wikipedia.org/wiki/Hilbert_curve.
[ "Rotates", "and", "flips", "a", "quadrant", "appropriately", "for", "the", "Hilbert", "scan", "generator", ".", "See", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Hilbert_curve", "." ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L52-L61
train
Rotates and flips a quadrant appropriately for the Hilbert scan generator.
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
circlescan
def circlescan(x0, y0, r1, r2): """Scan pixels in a circle pattern around a center point :param x0: Center x-coordinate :type x0: float :param y0: Center y-coordinate :type y0: float :param r1: Initial radius :type r1: float :param r2: Final radius :type r2: float :returns: Coor...
python
def circlescan(x0, y0, r1, r2): """Scan pixels in a circle pattern around a center point :param x0: Center x-coordinate :type x0: float :param y0: Center y-coordinate :type y0: float :param r1: Initial radius :type r1: float :param r2: Final radius :type r2: float :returns: Coor...
[ "def", "circlescan", "(", "x0", ",", "y0", ",", "r1", ",", "r2", ")", ":", "# Validate inputs", "if", "r1", "<", "0", ":", "raise", "ValueError", "(", "\"Initial radius must be non-negative\"", ")", "if", "r2", "<", "0", ":", "raise", "ValueError", "(", ...
Scan pixels in a circle pattern around a center point :param x0: Center x-coordinate :type x0: float :param y0: Center y-coordinate :type y0: float :param r1: Initial radius :type r1: float :param r2: Final radius :type r2: float :returns: Coordinate generator :rtype: function
[ "Scan", "pixels", "in", "a", "circle", "pattern", "around", "a", "center", "point" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L392-L466
train
Scan pixels in a circle pattern around a center point x0 y0 and r1 and r2.
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
gridscan
def gridscan(xi, yi, xf, yf, stepx=1, stepy=1): """Scan pixels in a grid pattern along the x-coordinate then y-coordinate :param xi: Initial x-coordinate :type xi: int :param yi: Initial y-coordinate :type yi: int :param xf: Final x-coordinate :type xf: int :param yf: Final y-coordinate...
python
def gridscan(xi, yi, xf, yf, stepx=1, stepy=1): """Scan pixels in a grid pattern along the x-coordinate then y-coordinate :param xi: Initial x-coordinate :type xi: int :param yi: Initial y-coordinate :type yi: int :param xf: Final x-coordinate :type xf: int :param yf: Final y-coordinate...
[ "def", "gridscan", "(", "xi", ",", "yi", ",", "xf", ",", "yf", ",", "stepx", "=", "1", ",", "stepy", "=", "1", ")", ":", "if", "stepx", "<=", "0", ":", "raise", "ValueError", "(", "\"X-step must be positive\"", ")", "if", "stepy", "<=", "0", ":", ...
Scan pixels in a grid pattern along the x-coordinate then y-coordinate :param xi: Initial x-coordinate :type xi: int :param yi: Initial y-coordinate :type yi: int :param xf: Final x-coordinate :type xf: int :param yf: Final y-coordinate :type yf: int :param stepx: Step size in x-coo...
[ "Scan", "pixels", "in", "a", "grid", "pattern", "along", "the", "x", "-", "coordinate", "then", "y", "-", "coordinate" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L468-L496
train
Scan pixels in a grid pattern along the x - coordinate then y - coordinate
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
hilbertscan
def hilbertscan(size, distance): """Scan pixels in a Hilbert curve pattern in the first quadrant. Modified algorithm from https://en.wikipedia.org/wiki/Hilbert_curve. :param size: Size of enclosing square :type size: int :param distance: Distance along curve (Must be smaller than size**2 - 1) ...
python
def hilbertscan(size, distance): """Scan pixels in a Hilbert curve pattern in the first quadrant. Modified algorithm from https://en.wikipedia.org/wiki/Hilbert_curve. :param size: Size of enclosing square :type size: int :param distance: Distance along curve (Must be smaller than size**2 - 1) ...
[ "def", "hilbertscan", "(", "size", ",", "distance", ")", ":", "size", "=", "2", "*", "(", "1", "<<", "(", "size", "-", "1", ")", ".", "bit_length", "(", ")", ")", "if", "(", "distance", ">", "size", "**", "2", "-", "1", ")", ":", "raise", "St...
Scan pixels in a Hilbert curve pattern in the first quadrant. Modified algorithm from https://en.wikipedia.org/wiki/Hilbert_curve. :param size: Size of enclosing square :type size: int :param distance: Distance along curve (Must be smaller than size**2 - 1) :type distance: int :returns: Coordi...
[ "Scan", "pixels", "in", "a", "Hilbert", "curve", "pattern", "in", "the", "first", "quadrant", ".", "Modified", "algorithm", "from", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Hilbert_curve", "." ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L498-L526
train
Scan pixels in a Hilbert curve pattern in the first quadrant.
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
ringscan
def ringscan(x0, y0, r1, r2, metric=chebyshev): """Scan pixels in a ring pattern around a center point clockwise :param x0: Center x-coordinate :type x0: int :param y0: Center y-coordinate :type y0: int :param r1: Initial radius :type r1: int :param r2: Final radius :type r2: int ...
python
def ringscan(x0, y0, r1, r2, metric=chebyshev): """Scan pixels in a ring pattern around a center point clockwise :param x0: Center x-coordinate :type x0: int :param y0: Center y-coordinate :type y0: int :param r1: Initial radius :type r1: int :param r2: Final radius :type r2: int ...
[ "def", "ringscan", "(", "x0", ",", "y0", ",", "r1", ",", "r2", ",", "metric", "=", "chebyshev", ")", ":", "# Validate inputs", "if", "r1", "<", "0", ":", "raise", "ValueError", "(", "\"Initial radius must be non-negative\"", ")", "if", "r2", "<", "0", ":...
Scan pixels in a ring pattern around a center point clockwise :param x0: Center x-coordinate :type x0: int :param y0: Center y-coordinate :type y0: int :param r1: Initial radius :type r1: int :param r2: Final radius :type r2: int :param metric: Distance metric :type metric: func...
[ "Scan", "pixels", "in", "a", "ring", "pattern", "around", "a", "center", "point", "clockwise" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L528-L604
train
Scan pixels in a ring pattern around a center point clockwise and yield a set of coordinates.
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
snakescan
def snakescan(xi, yi, xf, yf): """Scan pixels in a snake pattern along the x-coordinate then y-coordinate :param xi: Initial x-coordinate :type xi: int :param yi: Initial y-coordinate :type yi: int :param xf: Final x-coordinate :type xf: int :param yf: Final y-coordinate :type yf: i...
python
def snakescan(xi, yi, xf, yf): """Scan pixels in a snake pattern along the x-coordinate then y-coordinate :param xi: Initial x-coordinate :type xi: int :param yi: Initial y-coordinate :type yi: int :param xf: Final x-coordinate :type xf: int :param yf: Final y-coordinate :type yf: i...
[ "def", "snakescan", "(", "xi", ",", "yi", ",", "xf", ",", "yf", ")", ":", "# Determine direction to move", "dx", "=", "1", "if", "xf", ">=", "xi", "else", "-", "1", "dy", "=", "1", "if", "yf", ">=", "yi", "else", "-", "1", "# Scan pixels first along ...
Scan pixels in a snake pattern along the x-coordinate then y-coordinate :param xi: Initial x-coordinate :type xi: int :param yi: Initial y-coordinate :type yi: int :param xf: Final x-coordinate :type xf: int :param yf: Final y-coordinate :type yf: int :returns: Coordinate generator ...
[ "Scan", "pixels", "in", "a", "snake", "pattern", "along", "the", "x", "-", "coordinate", "then", "y", "-", "coordinate" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L606-L635
train
Scan the pixels in a snake pattern along the x - coordinate then y - coordinate.
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
walkscan
def walkscan(x0, y0, xn=0.25, xp=0.25, yn=0.25, yp=0.25): """Scan pixels in a random walk pattern with given step probabilities. The random walk will continue indefinitely unless a skip transformation is used with the 'stop' parameter set or a clip transformation is used with the 'abort' parameter set t...
python
def walkscan(x0, y0, xn=0.25, xp=0.25, yn=0.25, yp=0.25): """Scan pixels in a random walk pattern with given step probabilities. The random walk will continue indefinitely unless a skip transformation is used with the 'stop' parameter set or a clip transformation is used with the 'abort' parameter set t...
[ "def", "walkscan", "(", "x0", ",", "y0", ",", "xn", "=", "0.25", ",", "xp", "=", "0.25", ",", "yn", "=", "0.25", ",", "yp", "=", "0.25", ")", ":", "# Validate inputs", "if", "xn", "<", "0", ":", "raise", "ValueError", "(", "\"Negative x probabilty mu...
Scan pixels in a random walk pattern with given step probabilities. The random walk will continue indefinitely unless a skip transformation is used with the 'stop' parameter set or a clip transformation is used with the 'abort' parameter set to True. The probabilities are normalized to sum to 1. :param...
[ "Scan", "pixels", "in", "a", "random", "walk", "pattern", "with", "given", "step", "probabilities", ".", "The", "random", "walk", "will", "continue", "indefinitely", "unless", "a", "skip", "transformation", "is", "used", "with", "the", "stop", "parameter", "se...
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L637-L691
train
Scan pixels in a random walk pattern with given step probabilities.
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
clip.next
def next(self): """Next point in iteration """ while True: x, y = next(self.scan) if self.predicate is not None and not self.predicate(x,y): if self.abort: raise StopIteration("Boundary crossed!") elif (x < self.minx or x > self...
python
def next(self): """Next point in iteration """ while True: x, y = next(self.scan) if self.predicate is not None and not self.predicate(x,y): if self.abort: raise StopIteration("Boundary crossed!") elif (x < self.minx or x > self...
[ "def", "next", "(", "self", ")", ":", "while", "True", ":", "x", ",", "y", "=", "next", "(", "self", ".", "scan", ")", "if", "self", ".", "predicate", "is", "not", "None", "and", "not", "self", ".", "predicate", "(", "x", ",", "y", ")", ":", ...
Next point in iteration
[ "Next", "point", "in", "iteration" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L108-L121
train
Return the next point in iteration .
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
reflection.next
def next(self): """Next point in iteration """ x, y = next(self.scan) xr = -x if self.rx else x yr = -y if self.ry else y return xr, yr
python
def next(self): """Next point in iteration """ x, y = next(self.scan) xr = -x if self.rx else x yr = -y if self.ry else y return xr, yr
[ "def", "next", "(", "self", ")", ":", "x", ",", "y", "=", "next", "(", "self", ".", "scan", ")", "xr", "=", "-", "x", "if", "self", ".", "rx", "else", "x", "yr", "=", "-", "y", "if", "self", ".", "ry", "else", "y", "return", "xr", ",", "y...
Next point in iteration
[ "Next", "point", "in", "iteration" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L142-L148
train
Next point in iteration
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
reservoir.next
def next(self): """Next point in iteration """ if self.count < len(self.reservoir): self.count += 1 return self.reservoir[self.count-1] raise StopIteration("Reservoir exhausted")
python
def next(self): """Next point in iteration """ if self.count < len(self.reservoir): self.count += 1 return self.reservoir[self.count-1] raise StopIteration("Reservoir exhausted")
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "count", "<", "len", "(", "self", ".", "reservoir", ")", ":", "self", ".", "count", "+=", "1", "return", "self", ".", "reservoir", "[", "self", ".", "count", "-", "1", "]", "raise", "StopIt...
Next point in iteration
[ "Next", "point", "in", "iteration" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L186-L193
train
Returns the next entry in the reservoir.
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
rotation.next
def next(self): """Next point in iteration """ x, y = next(self.scan) ca, sa = math.cos(self.angle), math.sin(self.angle) xr = ca * x - sa * y yr = sa * x + ca * y return xr, yr
python
def next(self): """Next point in iteration """ x, y = next(self.scan) ca, sa = math.cos(self.angle), math.sin(self.angle) xr = ca * x - sa * y yr = sa * x + ca * y return xr, yr
[ "def", "next", "(", "self", ")", ":", "x", ",", "y", "=", "next", "(", "self", ".", "scan", ")", "ca", ",", "sa", "=", "math", ".", "cos", "(", "self", ".", "angle", ")", ",", "math", ".", "sin", "(", "self", ".", "angle", ")", "xr", "=", ...
Next point in iteration
[ "Next", "point", "in", "iteration" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L214-L221
train
Next point in iteration
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
sample.next
def next(self): """Next point in iteration """ if self.probability == 1: x, y = next(self.scan) else: while True: x, y = next(self.scan) if random.random() <= self.probability: break return x, y
python
def next(self): """Next point in iteration """ if self.probability == 1: x, y = next(self.scan) else: while True: x, y = next(self.scan) if random.random() <= self.probability: break return x, y
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "probability", "==", "1", ":", "x", ",", "y", "=", "next", "(", "self", ".", "scan", ")", "else", ":", "while", "True", ":", "x", ",", "y", "=", "next", "(", "self", ".", "scan", ")", ...
Next point in iteration
[ "Next", "point", "in", "iteration" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L241-L250
train
Next point in iteration
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
scale.next
def next(self): """Next point in iteration """ x, y = next(self.scan) xr = self.sx * x yr = self.sy * y return xr, yr
python
def next(self): """Next point in iteration """ x, y = next(self.scan) xr = self.sx * x yr = self.sy * y return xr, yr
[ "def", "next", "(", "self", ")", ":", "x", ",", "y", "=", "next", "(", "self", ".", "scan", ")", "xr", "=", "self", ".", "sx", "*", "x", "yr", "=", "self", ".", "sy", "*", "y", "return", "xr", ",", "yr" ]
Next point in iteration
[ "Next", "point", "in", "iteration" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L274-L280
train
Return x y coordinates of the next iteration of the set of entries.
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
skip.next
def next(self): """Next point in iteration """ while True: x, y = next(self.scan) self.index += 1 if (self.index < self.start): continue if (self.index > self.stop): raise StopIteration("skip stopping") if ((self.index-self.start) % sel...
python
def next(self): """Next point in iteration """ while True: x, y = next(self.scan) self.index += 1 if (self.index < self.start): continue if (self.index > self.stop): raise StopIteration("skip stopping") if ((self.index-self.start) % sel...
[ "def", "next", "(", "self", ")", ":", "while", "True", ":", "x", ",", "y", "=", "next", "(", "self", ".", "scan", ")", "self", ".", "index", "+=", "1", "if", "(", "self", ".", "index", "<", "self", ".", "start", ")", ":", "continue", "if", "(...
Next point in iteration
[ "Next", "point", "in", "iteration" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L309-L318
train
Return next point in iteration
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
snap.next
def next(self): """Next point in iteration """ x, y = next(self.scan) xs = int(round(x)) ys = int(round(y)) return xs, ys
python
def next(self): """Next point in iteration """ x, y = next(self.scan) xs = int(round(x)) ys = int(round(y)) return xs, ys
[ "def", "next", "(", "self", ")", ":", "x", ",", "y", "=", "next", "(", "self", ".", "scan", ")", "xs", "=", "int", "(", "round", "(", "x", ")", ")", "ys", "=", "int", "(", "round", "(", "y", ")", ")", "return", "xs", ",", "ys" ]
Next point in iteration
[ "Next", "point", "in", "iteration" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L333-L339
train
Next point in iteration
dpmcmlxxvi/pixelscan
pixelscan/pixelscan.py
translation.next
def next(self): """Next point in iteration """ x, y = next(self.scan) xr = x + self.tx yr = y + self.ty return xr, yr
python
def next(self): """Next point in iteration """ x, y = next(self.scan) xr = x + self.tx yr = y + self.ty return xr, yr
[ "def", "next", "(", "self", ")", ":", "x", ",", "y", "=", "next", "(", "self", ".", "scan", ")", "xr", "=", "x", "+", "self", ".", "tx", "yr", "=", "y", "+", "self", ".", "ty", "return", "xr", ",", "yr" ]
Next point in iteration
[ "Next", "point", "in", "iteration" ]
d641207b13a8fc5bf7ac9964b982971652bb0a7e
https://github.com/dpmcmlxxvi/pixelscan/blob/d641207b13a8fc5bf7ac9964b982971652bb0a7e/pixelscan/pixelscan.py#L380-L386
train
Next point in iteration