repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
stxnext/mappet
mappet/mappet.py
Mappet.update
def update(self, **kwargs): u"""Updating or creation of new simple nodes. Each dict key is used as a tagname and value as text. """ for key, value in kwargs.items(): helper = helpers.CAST_DICT.get(type(value), str) tag = self._get_aliases().get(key, key) ...
python
def update(self, **kwargs): u"""Updating or creation of new simple nodes. Each dict key is used as a tagname and value as text. """ for key, value in kwargs.items(): helper = helpers.CAST_DICT.get(type(value), str) tag = self._get_aliases().get(key, key) ...
[ "def", "update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "key", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "helper", "=", "helpers", ".", "CAST_DICT", ".", "get", "(", "type", "(", "value", ")", ",", "str", ")", "...
u"""Updating or creation of new simple nodes. Each dict key is used as a tagname and value as text.
[ "u", "Updating", "or", "creation", "of", "new", "simple", "nodes", "." ]
ac7468ac28ed82e45065b1e348cf865c8f73f0db
https://github.com/stxnext/mappet/blob/ac7468ac28ed82e45065b1e348cf865c8f73f0db/mappet/mappet.py#L438-L455
train
56,600
stxnext/mappet
mappet/mappet.py
Mappet.sget
def sget(self, path, default=NONE_NODE): u"""Enables access to nodes if one or more of them don't exist. Example: >>> m = Mappet('<root><tag attr1="attr text">text value</tag></root>') >>> m.sget('tag') text value >>> m.sget('tag.@attr1') 'attr text' >>> ...
python
def sget(self, path, default=NONE_NODE): u"""Enables access to nodes if one or more of them don't exist. Example: >>> m = Mappet('<root><tag attr1="attr text">text value</tag></root>') >>> m.sget('tag') text value >>> m.sget('tag.@attr1') 'attr text' >>> ...
[ "def", "sget", "(", "self", ",", "path", ",", "default", "=", "NONE_NODE", ")", ":", "attrs", "=", "str", "(", "path", ")", ".", "split", "(", "\".\"", ")", "text_or_attr", "=", "None", "last_attr", "=", "attrs", "[", "-", "1", "]", "# Case of gettin...
u"""Enables access to nodes if one or more of them don't exist. Example: >>> m = Mappet('<root><tag attr1="attr text">text value</tag></root>') >>> m.sget('tag') text value >>> m.sget('tag.@attr1') 'attr text' >>> m.sget('tag.#text') 'text value' ...
[ "u", "Enables", "access", "to", "nodes", "if", "one", "or", "more", "of", "them", "don", "t", "exist", "." ]
ac7468ac28ed82e45065b1e348cf865c8f73f0db
https://github.com/stxnext/mappet/blob/ac7468ac28ed82e45065b1e348cf865c8f73f0db/mappet/mappet.py#L457-L507
train
56,601
stxnext/mappet
mappet/mappet.py
Mappet.create
def create(self, tag, value): u"""Creates a node, if it doesn't exist yet. Unlike attribute access, this allows to pass a node's name with hyphens. Those hyphens will be normalized automatically. In case the required element already exists, raises an exception. Updating/overwri...
python
def create(self, tag, value): u"""Creates a node, if it doesn't exist yet. Unlike attribute access, this allows to pass a node's name with hyphens. Those hyphens will be normalized automatically. In case the required element already exists, raises an exception. Updating/overwri...
[ "def", "create", "(", "self", ",", "tag", ",", "value", ")", ":", "child_tags", "=", "{", "child", ".", "tag", "for", "child", "in", "self", ".", "_xml", "}", "if", "tag", "in", "child_tags", ":", "raise", "KeyError", "(", "'Node {} already exists in XML...
u"""Creates a node, if it doesn't exist yet. Unlike attribute access, this allows to pass a node's name with hyphens. Those hyphens will be normalized automatically. In case the required element already exists, raises an exception. Updating/overwriting should be done using `update``.
[ "u", "Creates", "a", "node", "if", "it", "doesn", "t", "exist", "yet", "." ]
ac7468ac28ed82e45065b1e348cf865c8f73f0db
https://github.com/stxnext/mappet/blob/ac7468ac28ed82e45065b1e348cf865c8f73f0db/mappet/mappet.py#L509-L523
train
56,602
stxnext/mappet
mappet/mappet.py
Mappet.set
def set(self, name, value): u"""Assigns a new XML structure to the node. A literal value, dict or list can be passed in. Works for all nested levels. Dictionary: >>> m = Mappet('<root/>') >>> m.head = {'a': 'A', 'b': {'#text': 'B', '@attr': 'val'}} >>> m.head.to_str() ...
python
def set(self, name, value): u"""Assigns a new XML structure to the node. A literal value, dict or list can be passed in. Works for all nested levels. Dictionary: >>> m = Mappet('<root/>') >>> m.head = {'a': 'A', 'b': {'#text': 'B', '@attr': 'val'}} >>> m.head.to_str() ...
[ "def", "set", "(", "self", ",", "name", ",", "value", ")", ":", "try", ":", "# Searches for a node to assign to.", "element", "=", "next", "(", "self", ".", "_xml", ".", "iterchildren", "(", "tag", "=", "name", ")", ")", "except", "StopIteration", ":", "...
u"""Assigns a new XML structure to the node. A literal value, dict or list can be passed in. Works for all nested levels. Dictionary: >>> m = Mappet('<root/>') >>> m.head = {'a': 'A', 'b': {'#text': 'B', '@attr': 'val'}} >>> m.head.to_str() '<head><a>A</a><b attr="val">...
[ "u", "Assigns", "a", "new", "XML", "structure", "to", "the", "node", "." ]
ac7468ac28ed82e45065b1e348cf865c8f73f0db
https://github.com/stxnext/mappet/blob/ac7468ac28ed82e45065b1e348cf865c8f73f0db/mappet/mappet.py#L525-L563
train
56,603
stxnext/mappet
mappet/mappet.py
Mappet.assign_dict
def assign_dict(self, node, xml_dict): """Assigns a Python dict to a ``lxml`` node. :param node: A node to assign the dict to. :param xml_dict: The dict with attributes/children to use. """ new_node = etree.Element(node.tag) # Replaces the previous node with the new one...
python
def assign_dict(self, node, xml_dict): """Assigns a Python dict to a ``lxml`` node. :param node: A node to assign the dict to. :param xml_dict: The dict with attributes/children to use. """ new_node = etree.Element(node.tag) # Replaces the previous node with the new one...
[ "def", "assign_dict", "(", "self", ",", "node", ",", "xml_dict", ")", ":", "new_node", "=", "etree", ".", "Element", "(", "node", ".", "tag", ")", "# Replaces the previous node with the new one", "self", ".", "_xml", ".", "replace", "(", "node", ",", "new_no...
Assigns a Python dict to a ``lxml`` node. :param node: A node to assign the dict to. :param xml_dict: The dict with attributes/children to use.
[ "Assigns", "a", "Python", "dict", "to", "a", "lxml", "node", "." ]
ac7468ac28ed82e45065b1e348cf865c8f73f0db
https://github.com/stxnext/mappet/blob/ac7468ac28ed82e45065b1e348cf865c8f73f0db/mappet/mappet.py#L565-L577
train
56,604
stxnext/mappet
mappet/mappet.py
Mappet.assign_literal
def assign_literal(element, value): u"""Assigns a literal. If a given node doesn't exist, it will be created. :param etree.Element element: element to which we assign. :param value: the value to assign """ # Searches for a conversion method specific to the type of value...
python
def assign_literal(element, value): u"""Assigns a literal. If a given node doesn't exist, it will be created. :param etree.Element element: element to which we assign. :param value: the value to assign """ # Searches for a conversion method specific to the type of value...
[ "def", "assign_literal", "(", "element", ",", "value", ")", ":", "# Searches for a conversion method specific to the type of value.", "helper", "=", "helpers", ".", "CAST_DICT", ".", "get", "(", "type", "(", "value", ")", ",", "str", ")", "# Removes all children and a...
u"""Assigns a literal. If a given node doesn't exist, it will be created. :param etree.Element element: element to which we assign. :param value: the value to assign
[ "u", "Assigns", "a", "literal", "." ]
ac7468ac28ed82e45065b1e348cf865c8f73f0db
https://github.com/stxnext/mappet/blob/ac7468ac28ed82e45065b1e348cf865c8f73f0db/mappet/mappet.py#L591-L604
train
56,605
stxnext/mappet
mappet/mappet.py
Mappet.to_dict
def to_dict(self, **kw): u"""Converts the lxml object to a dict. possible kwargs: without_comments: bool """ _, value = helpers.etree_to_dict(self._xml, **kw).popitem() return value
python
def to_dict(self, **kw): u"""Converts the lxml object to a dict. possible kwargs: without_comments: bool """ _, value = helpers.etree_to_dict(self._xml, **kw).popitem() return value
[ "def", "to_dict", "(", "self", ",", "*", "*", "kw", ")", ":", "_", ",", "value", "=", "helpers", ".", "etree_to_dict", "(", "self", ".", "_xml", ",", "*", "*", "kw", ")", ".", "popitem", "(", ")", "return", "value" ]
u"""Converts the lxml object to a dict. possible kwargs: without_comments: bool
[ "u", "Converts", "the", "lxml", "object", "to", "a", "dict", "." ]
ac7468ac28ed82e45065b1e348cf865c8f73f0db
https://github.com/stxnext/mappet/blob/ac7468ac28ed82e45065b1e348cf865c8f73f0db/mappet/mappet.py#L606-L613
train
56,606
stxnext/mappet
mappet/mappet.py
Mappet._get_aliases
def _get_aliases(self): u"""Creates a dict with aliases. The key is a normalized tagname, value the original tagname. """ if self._aliases is None: self._aliases = {} if self._xml is not None: for child in self._xml.iterchildren(): ...
python
def _get_aliases(self): u"""Creates a dict with aliases. The key is a normalized tagname, value the original tagname. """ if self._aliases is None: self._aliases = {} if self._xml is not None: for child in self._xml.iterchildren(): ...
[ "def", "_get_aliases", "(", "self", ")", ":", "if", "self", ".", "_aliases", "is", "None", ":", "self", ".", "_aliases", "=", "{", "}", "if", "self", ".", "_xml", "is", "not", "None", ":", "for", "child", "in", "self", ".", "_xml", ".", "iterchildr...
u"""Creates a dict with aliases. The key is a normalized tagname, value the original tagname.
[ "u", "Creates", "a", "dict", "with", "aliases", "." ]
ac7468ac28ed82e45065b1e348cf865c8f73f0db
https://github.com/stxnext/mappet/blob/ac7468ac28ed82e45065b1e348cf865c8f73f0db/mappet/mappet.py#L615-L627
train
56,607
stxnext/mappet
mappet/mappet.py
Mappet.xpath
def xpath( self, path, namespaces=None, regexp=False, smart_strings=True, single_use=False, ): u"""Executes XPath query on the ``lxml`` object and returns a correct object. :param str path: XPath string e.g., 'cars'/'car' ...
python
def xpath( self, path, namespaces=None, regexp=False, smart_strings=True, single_use=False, ): u"""Executes XPath query on the ``lxml`` object and returns a correct object. :param str path: XPath string e.g., 'cars'/'car' ...
[ "def", "xpath", "(", "self", ",", "path", ",", "namespaces", "=", "None", ",", "regexp", "=", "False", ",", "smart_strings", "=", "True", ",", "single_use", "=", "False", ",", ")", ":", "if", "(", "namespaces", "in", "[", "'exslt'", ",", "'re'", "]",...
u"""Executes XPath query on the ``lxml`` object and returns a correct object. :param str path: XPath string e.g., 'cars'/'car' :param str/dict namespaces: e.g., 'exslt', 're' or ``{'re': "http://exslt.org/regular-expressions"}`` :param bool regexp: if ``True`` and no namespaces is ...
[ "u", "Executes", "XPath", "query", "on", "the", "lxml", "object", "and", "returns", "a", "correct", "object", "." ]
ac7468ac28ed82e45065b1e348cf865c8f73f0db
https://github.com/stxnext/mappet/blob/ac7468ac28ed82e45065b1e348cf865c8f73f0db/mappet/mappet.py#L629-L677
train
56,608
stxnext/mappet
mappet/mappet.py
Mappet.xpath_evaluator
def xpath_evaluator(self, namespaces=None, regexp=False, smart_strings=True): u"""Creates an XPathEvaluator instance for an ElementTree or an Element. :returns: ``XPathEvaluator`` instance """ return etree.XPathEvaluator( self._xml, namespaces=namespaces, ...
python
def xpath_evaluator(self, namespaces=None, regexp=False, smart_strings=True): u"""Creates an XPathEvaluator instance for an ElementTree or an Element. :returns: ``XPathEvaluator`` instance """ return etree.XPathEvaluator( self._xml, namespaces=namespaces, ...
[ "def", "xpath_evaluator", "(", "self", ",", "namespaces", "=", "None", ",", "regexp", "=", "False", ",", "smart_strings", "=", "True", ")", ":", "return", "etree", ".", "XPathEvaluator", "(", "self", ".", "_xml", ",", "namespaces", "=", "namespaces", ",", ...
u"""Creates an XPathEvaluator instance for an ElementTree or an Element. :returns: ``XPathEvaluator`` instance
[ "u", "Creates", "an", "XPathEvaluator", "instance", "for", "an", "ElementTree", "or", "an", "Element", "." ]
ac7468ac28ed82e45065b1e348cf865c8f73f0db
https://github.com/stxnext/mappet/blob/ac7468ac28ed82e45065b1e348cf865c8f73f0db/mappet/mappet.py#L679-L689
train
56,609
mozilla/rna
rna/utils.py
get_last_modified_date
def get_last_modified_date(*args, **kwargs): """Returns the date of the last modified Note or Release. For use with Django's last_modified decorator. """ try: latest_note = Note.objects.latest() latest_release = Release.objects.latest() except ObjectDoesNotExist: return None...
python
def get_last_modified_date(*args, **kwargs): """Returns the date of the last modified Note or Release. For use with Django's last_modified decorator. """ try: latest_note = Note.objects.latest() latest_release = Release.objects.latest() except ObjectDoesNotExist: return None...
[ "def", "get_last_modified_date", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "latest_note", "=", "Note", ".", "objects", ".", "latest", "(", ")", "latest_release", "=", "Release", ".", "objects", ".", "latest", "(", ")", "except", ...
Returns the date of the last modified Note or Release. For use with Django's last_modified decorator.
[ "Returns", "the", "date", "of", "the", "last", "modified", "Note", "or", "Release", "." ]
c1d3931f577dc9c54997f876d36bc0b44dc225ea
https://github.com/mozilla/rna/blob/c1d3931f577dc9c54997f876d36bc0b44dc225ea/rna/utils.py#L9-L20
train
56,610
CodyKochmann/generators
setup.py
using_ios_stash
def using_ios_stash(): ''' returns true if sys path hints the install is running on ios ''' print('detected install path:') print(os.path.dirname(__file__)) module_names = set(sys.modules.keys()) return 'stash' in module_names or 'stash.system' in module_names
python
def using_ios_stash(): ''' returns true if sys path hints the install is running on ios ''' print('detected install path:') print(os.path.dirname(__file__)) module_names = set(sys.modules.keys()) return 'stash' in module_names or 'stash.system' in module_names
[ "def", "using_ios_stash", "(", ")", ":", "print", "(", "'detected install path:'", ")", "print", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "module_names", "=", "set", "(", "sys", ".", "modules", ".", "keys", "(", ")", ")", "ret...
returns true if sys path hints the install is running on ios
[ "returns", "true", "if", "sys", "path", "hints", "the", "install", "is", "running", "on", "ios" ]
e4ca4dd25d5023a94b0349c69d6224070cc2526f
https://github.com/CodyKochmann/generators/blob/e4ca4dd25d5023a94b0349c69d6224070cc2526f/setup.py#L8-L13
train
56,611
ten10solutions/Geist
geist/vision.py
get_partition_scores
def get_partition_scores(image, min_w=1, min_h=1): """Return list of best to worst binary splits along the x and y axis. """ h, w = image.shape[:2] if w == 0 or h == 0: return [] area = h * w cnz = numpy.count_nonzero total = cnz(image) if total == 0 or area == total: ...
python
def get_partition_scores(image, min_w=1, min_h=1): """Return list of best to worst binary splits along the x and y axis. """ h, w = image.shape[:2] if w == 0 or h == 0: return [] area = h * w cnz = numpy.count_nonzero total = cnz(image) if total == 0 or area == total: ...
[ "def", "get_partition_scores", "(", "image", ",", "min_w", "=", "1", ",", "min_h", "=", "1", ")", ":", "h", ",", "w", "=", "image", ".", "shape", "[", ":", "2", "]", "if", "w", "==", "0", "or", "h", "==", "0", ":", "return", "[", "]", "area",...
Return list of best to worst binary splits along the x and y axis.
[ "Return", "list", "of", "best", "to", "worst", "binary", "splits", "along", "the", "x", "and", "y", "axis", "." ]
a1ef16d8b4c3777735008b671a50acfde3ce7bf1
https://github.com/ten10solutions/Geist/blob/a1ef16d8b4c3777735008b671a50acfde3ce7bf1/geist/vision.py#L259-L285
train
56,612
kyzima-spb/pony-database-facade
pony_database_facade/__init__.py
DatabaseFacade.__init_defaults
def __init_defaults(self, config): """Initializes the default connection settings.""" provider = self.__provider if provider == 'sqlite': config.setdefault('dbname', ':memory:') config.setdefault('create_db', True) elif provider == 'mysql': config.s...
python
def __init_defaults(self, config): """Initializes the default connection settings.""" provider = self.__provider if provider == 'sqlite': config.setdefault('dbname', ':memory:') config.setdefault('create_db', True) elif provider == 'mysql': config.s...
[ "def", "__init_defaults", "(", "self", ",", "config", ")", ":", "provider", "=", "self", ".", "__provider", "if", "provider", "==", "'sqlite'", ":", "config", ".", "setdefault", "(", "'dbname'", ",", "':memory:'", ")", "config", ".", "setdefault", "(", "'c...
Initializes the default connection settings.
[ "Initializes", "the", "default", "connection", "settings", "." ]
a6e8ea87625ac21565e8fe3a280de8ca749d71d8
https://github.com/kyzima-spb/pony-database-facade/blob/a6e8ea87625ac21565e8fe3a280de8ca749d71d8/pony_database_facade/__init__.py#L32-L54
train
56,613
micha030201/aionationstates
aionationstates/world_.py
_World.newnations
async def newnations(self, root): """Most recently founded nations, from newest. Returns ------- an :class:`ApiQuery` of a list of :class:`Nation` """ return [aionationstates.Nation(n) for n in root.find('NEWNATIONS').text.split(',')]
python
async def newnations(self, root): """Most recently founded nations, from newest. Returns ------- an :class:`ApiQuery` of a list of :class:`Nation` """ return [aionationstates.Nation(n) for n in root.find('NEWNATIONS').text.split(',')]
[ "async", "def", "newnations", "(", "self", ",", "root", ")", ":", "return", "[", "aionationstates", ".", "Nation", "(", "n", ")", "for", "n", "in", "root", ".", "find", "(", "'NEWNATIONS'", ")", ".", "text", ".", "split", "(", "','", ")", "]" ]
Most recently founded nations, from newest. Returns ------- an :class:`ApiQuery` of a list of :class:`Nation`
[ "Most", "recently", "founded", "nations", "from", "newest", "." ]
dc86b86d994cbab830b69ab8023601c73e778b3a
https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/world_.py#L72-L80
train
56,614
micha030201/aionationstates
aionationstates/world_.py
_World.regions
async def regions(self, root): """List of all the regions, seemingly in order of creation. Returns ------- an :class:`ApiQuery` of a list of :class:`Region` """ return [aionationstates.Region(r) for r in root.find('REGIONS').text.split(',')]
python
async def regions(self, root): """List of all the regions, seemingly in order of creation. Returns ------- an :class:`ApiQuery` of a list of :class:`Region` """ return [aionationstates.Region(r) for r in root.find('REGIONS').text.split(',')]
[ "async", "def", "regions", "(", "self", ",", "root", ")", ":", "return", "[", "aionationstates", ".", "Region", "(", "r", ")", "for", "r", "in", "root", ".", "find", "(", "'REGIONS'", ")", ".", "text", ".", "split", "(", "','", ")", "]" ]
List of all the regions, seemingly in order of creation. Returns ------- an :class:`ApiQuery` of a list of :class:`Region`
[ "List", "of", "all", "the", "regions", "seemingly", "in", "order", "of", "creation", "." ]
dc86b86d994cbab830b69ab8023601c73e778b3a
https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/world_.py#L104-L112
train
56,615
micha030201/aionationstates
aionationstates/world_.py
_World.regionsbytag
def regionsbytag(self, *tags): """All regions with any of the named tags. Parameters ---------- *tags : str Regional tags. Can be preceded by a ``-`` to select regions without that tag. Returns ------- an :class:`ApiQuery` of a list of :...
python
def regionsbytag(self, *tags): """All regions with any of the named tags. Parameters ---------- *tags : str Regional tags. Can be preceded by a ``-`` to select regions without that tag. Returns ------- an :class:`ApiQuery` of a list of :...
[ "def", "regionsbytag", "(", "self", ",", "*", "tags", ")", ":", "if", "len", "(", "tags", ")", ">", "10", ":", "raise", "ValueError", "(", "'You can specify up to 10 tags'", ")", "if", "not", "tags", ":", "raise", "ValueError", "(", "'No tags specified'", ...
All regions with any of the named tags. Parameters ---------- *tags : str Regional tags. Can be preceded by a ``-`` to select regions without that tag. Returns ------- an :class:`ApiQuery` of a list of :class:`Region`
[ "All", "regions", "with", "any", "of", "the", "named", "tags", "." ]
dc86b86d994cbab830b69ab8023601c73e778b3a
https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/world_.py#L124-L150
train
56,616
micha030201/aionationstates
aionationstates/world_.py
_World.dispatch
def dispatch(self, id): """Dispatch by id. Parameters ---------- id : int Dispatch id. Returns ------- an :class:`ApiQuery` of :class:`Dispatch` Raises ------ :class:`NotFound` If a dispatch with the requested id ...
python
def dispatch(self, id): """Dispatch by id. Parameters ---------- id : int Dispatch id. Returns ------- an :class:`ApiQuery` of :class:`Dispatch` Raises ------ :class:`NotFound` If a dispatch with the requested id ...
[ "def", "dispatch", "(", "self", ",", "id", ")", ":", "@", "api_query", "(", "'dispatch'", ",", "dispatchid", "=", "str", "(", "id", ")", ")", "async", "def", "result", "(", "_", ",", "root", ")", ":", "elem", "=", "root", ".", "find", "(", "'DISP...
Dispatch by id. Parameters ---------- id : int Dispatch id. Returns ------- an :class:`ApiQuery` of :class:`Dispatch` Raises ------ :class:`NotFound` If a dispatch with the requested id doesn't exist.
[ "Dispatch", "by", "id", "." ]
dc86b86d994cbab830b69ab8023601c73e778b3a
https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/world_.py#L152-L175
train
56,617
micha030201/aionationstates
aionationstates/world_.py
_World.dispatchlist
def dispatchlist(self, *, author=None, category=None, subcategory=None, sort='new'): """Find dispatches by certain criteria. Parameters ---------- author : str Name of the nation authoring the dispatch. category : str Dispatch's prima...
python
def dispatchlist(self, *, author=None, category=None, subcategory=None, sort='new'): """Find dispatches by certain criteria. Parameters ---------- author : str Name of the nation authoring the dispatch. category : str Dispatch's prima...
[ "def", "dispatchlist", "(", "self", ",", "*", ",", "author", "=", "None", ",", "category", "=", "None", ",", "subcategory", "=", "None", ",", "sort", "=", "'new'", ")", ":", "params", "=", "{", "'sort'", ":", "sort", "}", "if", "author", ":", "para...
Find dispatches by certain criteria. Parameters ---------- author : str Name of the nation authoring the dispatch. category : str Dispatch's primary category. subcategory : str Dispatch's secondary category. sort : str Sort...
[ "Find", "dispatches", "by", "certain", "criteria", "." ]
dc86b86d994cbab830b69ab8023601c73e778b3a
https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/world_.py#L177-L220
train
56,618
micha030201/aionationstates
aionationstates/world_.py
_World.poll
def poll(self, id): """Poll with a given id. Parameters ---------- id : int Poll id. Returns ------- an :class:`ApiQuery` of :class:`Poll` Raises ------ :class:`NotFound` If a poll with the requested id doesn't ex...
python
def poll(self, id): """Poll with a given id. Parameters ---------- id : int Poll id. Returns ------- an :class:`ApiQuery` of :class:`Poll` Raises ------ :class:`NotFound` If a poll with the requested id doesn't ex...
[ "def", "poll", "(", "self", ",", "id", ")", ":", "@", "api_query", "(", "'poll'", ",", "pollid", "=", "str", "(", "id", ")", ")", "async", "def", "result", "(", "_", ",", "root", ")", ":", "elem", "=", "root", ".", "find", "(", "'POLL'", ")", ...
Poll with a given id. Parameters ---------- id : int Poll id. Returns ------- an :class:`ApiQuery` of :class:`Poll` Raises ------ :class:`NotFound` If a poll with the requested id doesn't exist.
[ "Poll", "with", "a", "given", "id", "." ]
dc86b86d994cbab830b69ab8023601c73e778b3a
https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/world_.py#L222-L245
train
56,619
micha030201/aionationstates
aionationstates/world_.py
_World.banner
def banner(self, *ids, _expand_macros=None): """Get data about banners by their ids. Macros in banners' names and descriptions are not expanded. Parameters ---------- *ids : str Banner ids. Returns ------- an :class:`ApiQuery` of a list of :c...
python
def banner(self, *ids, _expand_macros=None): """Get data about banners by their ids. Macros in banners' names and descriptions are not expanded. Parameters ---------- *ids : str Banner ids. Returns ------- an :class:`ApiQuery` of a list of :c...
[ "def", "banner", "(", "self", ",", "*", "ids", ",", "_expand_macros", "=", "None", ")", ":", "async", "def", "noop", "(", "s", ")", ":", "return", "s", "_expand_macros", "=", "_expand_macros", "or", "noop", "@", "api_query", "(", "'banner'", ",", "bann...
Get data about banners by their ids. Macros in banners' names and descriptions are not expanded. Parameters ---------- *ids : str Banner ids. Returns ------- an :class:`ApiQuery` of a list of :class:`Banner` Raises ------ :cl...
[ "Get", "data", "about", "banners", "by", "their", "ids", "." ]
dc86b86d994cbab830b69ab8023601c73e778b3a
https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/world_.py#L247-L278
train
56,620
micha030201/aionationstates
aionationstates/world_.py
_World.send_telegram
async def send_telegram(self, *, client_key, telegram_id, telegram_key, recepient): """A basic interface to the Telegrams API. Parameters ---------- client_key : str Telegrams API Client Key. telegram_id : int or str Telegram i...
python
async def send_telegram(self, *, client_key, telegram_id, telegram_key, recepient): """A basic interface to the Telegrams API. Parameters ---------- client_key : str Telegrams API Client Key. telegram_id : int or str Telegram i...
[ "async", "def", "send_telegram", "(", "self", ",", "*", ",", "client_key", ",", "telegram_id", ",", "telegram_key", ",", "recepient", ")", ":", "params", "=", "{", "'a'", ":", "'sendTG'", ",", "'client'", ":", "client_key", ",", "'tgid'", ":", "str", "("...
A basic interface to the Telegrams API. Parameters ---------- client_key : str Telegrams API Client Key. telegram_id : int or str Telegram id. telegram_key : str Telegram key. recepient : str Name of the nation you want to ...
[ "A", "basic", "interface", "to", "the", "Telegrams", "API", "." ]
dc86b86d994cbab830b69ab8023601c73e778b3a
https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/world_.py#L290-L316
train
56,621
micha030201/aionationstates
aionationstates/world_.py
_World.happenings
async def happenings(self, *, nations=None, regions=None, filters=None, beforeid=None, beforetime=None): """Iterate through happenings from newest to oldest. Parameters ---------- nations : iterable of str Nations happenings of which will be requeste...
python
async def happenings(self, *, nations=None, regions=None, filters=None, beforeid=None, beforetime=None): """Iterate through happenings from newest to oldest. Parameters ---------- nations : iterable of str Nations happenings of which will be requeste...
[ "async", "def", "happenings", "(", "self", ",", "*", ",", "nations", "=", "None", ",", "regions", "=", "None", ",", "filters", "=", "None", ",", "beforeid", "=", "None", ",", "beforetime", "=", "None", ")", ":", "while", "True", ":", "happening_bunch",...
Iterate through happenings from newest to oldest. Parameters ---------- nations : iterable of str Nations happenings of which will be requested. Cannot be specified at the same time with ``regions``. regions : iterable of str Regions happenings of wh...
[ "Iterate", "through", "happenings", "from", "newest", "to", "oldest", "." ]
dc86b86d994cbab830b69ab8023601c73e778b3a
https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/world_.py#L350-L387
train
56,622
ten10solutions/Geist
geist/match_position_finder_helpers.py
find_potential_match_regions
def find_potential_match_regions(template, transformed_array, method='correlation', raw_tolerance=0.666): """To prevent prohibitively slow calculation of normalisation coefficient at each point in image find potential match points, and normalise these only these. This function uses the definitions of ...
python
def find_potential_match_regions(template, transformed_array, method='correlation', raw_tolerance=0.666): """To prevent prohibitively slow calculation of normalisation coefficient at each point in image find potential match points, and normalise these only these. This function uses the definitions of ...
[ "def", "find_potential_match_regions", "(", "template", ",", "transformed_array", ",", "method", "=", "'correlation'", ",", "raw_tolerance", "=", "0.666", ")", ":", "if", "method", "==", "'correlation'", ":", "match_value", "=", "np", ".", "sum", "(", "template"...
To prevent prohibitively slow calculation of normalisation coefficient at each point in image find potential match points, and normalise these only these. This function uses the definitions of the matching functions to calculate the expected match value and finds positions in the transformed array ...
[ "To", "prevent", "prohibitively", "slow", "calculation", "of", "normalisation", "coefficient", "at", "each", "point", "in", "image", "find", "potential", "match", "points", "and", "normalise", "these", "only", "these", ".", "This", "function", "uses", "the", "de...
a1ef16d8b4c3777735008b671a50acfde3ce7bf1
https://github.com/ten10solutions/Geist/blob/a1ef16d8b4c3777735008b671a50acfde3ce7bf1/geist/match_position_finder_helpers.py#L4-L21
train
56,623
ten10solutions/Geist
geist/match_position_finder_helpers.py
normalise_correlation
def normalise_correlation(image_tile_dict, transformed_array, template, normed_tolerance=1): """Calculates the normalisation coefficients of potential match positions Then normalises the correlation at these positions, and returns them if they do indeed constitute a match """ template_norm = n...
python
def normalise_correlation(image_tile_dict, transformed_array, template, normed_tolerance=1): """Calculates the normalisation coefficients of potential match positions Then normalises the correlation at these positions, and returns them if they do indeed constitute a match """ template_norm = n...
[ "def", "normalise_correlation", "(", "image_tile_dict", ",", "transformed_array", ",", "template", ",", "normed_tolerance", "=", "1", ")", ":", "template_norm", "=", "np", ".", "linalg", ".", "norm", "(", "template", ")", "image_norms", "=", "{", "(", "x", "...
Calculates the normalisation coefficients of potential match positions Then normalises the correlation at these positions, and returns them if they do indeed constitute a match
[ "Calculates", "the", "normalisation", "coefficients", "of", "potential", "match", "positions", "Then", "normalises", "the", "correlation", "at", "these", "positions", "and", "returns", "them", "if", "they", "do", "indeed", "constitute", "a", "match" ]
a1ef16d8b4c3777735008b671a50acfde3ce7bf1
https://github.com/ten10solutions/Geist/blob/a1ef16d8b4c3777735008b671a50acfde3ce7bf1/geist/match_position_finder_helpers.py#L44-L57
train
56,624
ten10solutions/Geist
geist/match_position_finder_helpers.py
normalise_correlation_coefficient
def normalise_correlation_coefficient(image_tile_dict, transformed_array, template, normed_tolerance=1): """As above, but for when the correlation coefficient matching method is used """ template_mean = np.mean(template) template_minus_mean = template - template_mean template_norm = np.linalg.norm(t...
python
def normalise_correlation_coefficient(image_tile_dict, transformed_array, template, normed_tolerance=1): """As above, but for when the correlation coefficient matching method is used """ template_mean = np.mean(template) template_minus_mean = template - template_mean template_norm = np.linalg.norm(t...
[ "def", "normalise_correlation_coefficient", "(", "image_tile_dict", ",", "transformed_array", ",", "template", ",", "normed_tolerance", "=", "1", ")", ":", "template_mean", "=", "np", ".", "mean", "(", "template", ")", "template_minus_mean", "=", "template", "-", ...
As above, but for when the correlation coefficient matching method is used
[ "As", "above", "but", "for", "when", "the", "correlation", "coefficient", "matching", "method", "is", "used" ]
a1ef16d8b4c3777735008b671a50acfde3ce7bf1
https://github.com/ten10solutions/Geist/blob/a1ef16d8b4c3777735008b671a50acfde3ce7bf1/geist/match_position_finder_helpers.py#L61-L73
train
56,625
ten10solutions/Geist
geist/match_position_finder_helpers.py
calculate_squared_differences
def calculate_squared_differences(image_tile_dict, transformed_array, template, sq_diff_tolerance=0.1): """As above, but for when the squared differences matching method is used """ template_norm_squared = np.sum(template**2) image_norms_squared = {(x,y):np.sum(image_tile_dict[(x,y)]**2) for (x,y) in im...
python
def calculate_squared_differences(image_tile_dict, transformed_array, template, sq_diff_tolerance=0.1): """As above, but for when the squared differences matching method is used """ template_norm_squared = np.sum(template**2) image_norms_squared = {(x,y):np.sum(image_tile_dict[(x,y)]**2) for (x,y) in im...
[ "def", "calculate_squared_differences", "(", "image_tile_dict", ",", "transformed_array", ",", "template", ",", "sq_diff_tolerance", "=", "0.1", ")", ":", "template_norm_squared", "=", "np", ".", "sum", "(", "template", "**", "2", ")", "image_norms_squared", "=", ...
As above, but for when the squared differences matching method is used
[ "As", "above", "but", "for", "when", "the", "squared", "differences", "matching", "method", "is", "used" ]
a1ef16d8b4c3777735008b671a50acfde3ce7bf1
https://github.com/ten10solutions/Geist/blob/a1ef16d8b4c3777735008b671a50acfde3ce7bf1/geist/match_position_finder_helpers.py#L77-L89
train
56,626
micha030201/aionationstates
aionationstates/happenings.py
MessageLodgement.post
async def post(self): """Get the message lodged. Returns ------- an :class:`aionationstates.ApiQuery` of :class:`aionationstates.Post` """ post = (await self.region._get_messages( fromid=self._post_id, limit=1))[0] assert post.id == self._post_id ...
python
async def post(self): """Get the message lodged. Returns ------- an :class:`aionationstates.ApiQuery` of :class:`aionationstates.Post` """ post = (await self.region._get_messages( fromid=self._post_id, limit=1))[0] assert post.id == self._post_id ...
[ "async", "def", "post", "(", "self", ")", ":", "post", "=", "(", "await", "self", ".", "region", ".", "_get_messages", "(", "fromid", "=", "self", ".", "_post_id", ",", "limit", "=", "1", ")", ")", "[", "0", "]", "assert", "post", ".", "id", "=="...
Get the message lodged. Returns ------- an :class:`aionationstates.ApiQuery` of :class:`aionationstates.Post`
[ "Get", "the", "message", "lodged", "." ]
dc86b86d994cbab830b69ab8023601c73e778b3a
https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/happenings.py#L299-L309
train
56,627
micha030201/aionationstates
aionationstates/happenings.py
ResolutionVote.resolution
async def resolution(self): """Get the resolution voted on. Returns ------- awaitable of :class:`aionationstates.ResolutionAtVote` The resolution voted for. Raises ------ aionationstates.NotFound If the resolution has since been passed or...
python
async def resolution(self): """Get the resolution voted on. Returns ------- awaitable of :class:`aionationstates.ResolutionAtVote` The resolution voted for. Raises ------ aionationstates.NotFound If the resolution has since been passed or...
[ "async", "def", "resolution", "(", "self", ")", ":", "resolutions", "=", "await", "asyncio", ".", "gather", "(", "aionationstates", ".", "ga", ".", "resolution_at_vote", ",", "aionationstates", ".", "sc", ".", "resolution_at_vote", ",", ")", "for", "resolution...
Get the resolution voted on. Returns ------- awaitable of :class:`aionationstates.ResolutionAtVote` The resolution voted for. Raises ------ aionationstates.NotFound If the resolution has since been passed or defeated.
[ "Get", "the", "resolution", "voted", "on", "." ]
dc86b86d994cbab830b69ab8023601c73e778b3a
https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/happenings.py#L369-L390
train
56,628
micha030201/aionationstates
aionationstates/happenings.py
_ProposalHappening.proposal
async def proposal(self): """Get the proposal in question. Actually just the first proposal with the same name, but the chance of a collision is tiny. Returns ------- awaitable of :class:`aionationstates.Proposal` The proposal submitted. Raises ...
python
async def proposal(self): """Get the proposal in question. Actually just the first proposal with the same name, but the chance of a collision is tiny. Returns ------- awaitable of :class:`aionationstates.Proposal` The proposal submitted. Raises ...
[ "async", "def", "proposal", "(", "self", ")", ":", "proposals", "=", "await", "aionationstates", ".", "wa", ".", "proposals", "(", ")", "for", "proposal", "in", "proposals", ":", "if", "(", "proposal", ".", "name", "==", "self", ".", "proposal_name", ")"...
Get the proposal in question. Actually just the first proposal with the same name, but the chance of a collision is tiny. Returns ------- awaitable of :class:`aionationstates.Proposal` The proposal submitted. Raises ------ aionationstates.No...
[ "Get", "the", "proposal", "in", "question", "." ]
dc86b86d994cbab830b69ab8023601c73e778b3a
https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/happenings.py#L437-L457
train
56,629
sci-bots/dmf-device-ui
dmf_device_ui/canvas.py
Route.append
def append(self, electrode_id): ''' Append the specified electrode to the route. The route is not modified (i.e., electrode is not appended) if electrode is not connected to the last electrode in the existing route. Parameters ---------- electrode_id : str ...
python
def append(self, electrode_id): ''' Append the specified electrode to the route. The route is not modified (i.e., electrode is not appended) if electrode is not connected to the last electrode in the existing route. Parameters ---------- electrode_id : str ...
[ "def", "append", "(", "self", ",", "electrode_id", ")", ":", "do_append", "=", "False", "if", "not", "self", ".", "electrode_ids", ":", "do_append", "=", "True", "elif", "self", ".", "device", ".", "shape_indexes", ".", "shape", "[", "0", "]", ">", "0"...
Append the specified electrode to the route. The route is not modified (i.e., electrode is not appended) if electrode is not connected to the last electrode in the existing route. Parameters ---------- electrode_id : str Electrode identifier.
[ "Append", "the", "specified", "electrode", "to", "the", "route", "." ]
05b480683c9fa43f91ce5a58de2fa90cdf363fc8
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/canvas.py#L43-L76
train
56,630
sci-bots/dmf-device-ui
dmf_device_ui/canvas.py
DmfDeviceCanvas.insert_surface
def insert_surface(self, position, name, surface, alpha=1.): ''' Insert Cairo surface as new layer. Args ---- position (int) : Index position to insert layer at. name (str) : Name of layer. surface (cairo.Context) : Surface to render. al...
python
def insert_surface(self, position, name, surface, alpha=1.): ''' Insert Cairo surface as new layer. Args ---- position (int) : Index position to insert layer at. name (str) : Name of layer. surface (cairo.Context) : Surface to render. al...
[ "def", "insert_surface", "(", "self", ",", "position", ",", "name", ",", "surface", ",", "alpha", "=", "1.", ")", ":", "if", "name", "in", "self", ".", "df_surfaces", ".", "index", ":", "raise", "NameError", "(", "'Surface already exists with `name=\"{}\"`.'",...
Insert Cairo surface as new layer. Args ---- position (int) : Index position to insert layer at. name (str) : Name of layer. surface (cairo.Context) : Surface to render. alpha (float) : Alpha/transparency level in the range `[0, 1]`.
[ "Insert", "Cairo", "surface", "as", "new", "layer", "." ]
05b480683c9fa43f91ce5a58de2fa90cdf363fc8
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/canvas.py#L380-L406
train
56,631
sci-bots/dmf-device-ui
dmf_device_ui/canvas.py
DmfDeviceCanvas.append_surface
def append_surface(self, name, surface, alpha=1.): ''' Append Cairo surface as new layer on top of existing layers. Args ---- name (str) : Name of layer. surface (cairo.ImageSurface) : Surface to render. alpha (float) : Alpha/transparency level in th...
python
def append_surface(self, name, surface, alpha=1.): ''' Append Cairo surface as new layer on top of existing layers. Args ---- name (str) : Name of layer. surface (cairo.ImageSurface) : Surface to render. alpha (float) : Alpha/transparency level in th...
[ "def", "append_surface", "(", "self", ",", "name", ",", "surface", ",", "alpha", "=", "1.", ")", ":", "self", ".", "insert_surface", "(", "position", "=", "self", ".", "df_surfaces", ".", "index", ".", "shape", "[", "0", "]", ",", "name", "=", "name"...
Append Cairo surface as new layer on top of existing layers. Args ---- name (str) : Name of layer. surface (cairo.ImageSurface) : Surface to render. alpha (float) : Alpha/transparency level in the range `[0, 1]`.
[ "Append", "Cairo", "surface", "as", "new", "layer", "on", "top", "of", "existing", "layers", "." ]
05b480683c9fa43f91ce5a58de2fa90cdf363fc8
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/canvas.py#L408-L420
train
56,632
sci-bots/dmf-device-ui
dmf_device_ui/canvas.py
DmfDeviceCanvas.remove_surface
def remove_surface(self, name): ''' Remove layer from rendering stack and flatten remaining layers. Args ---- name (str) : Name of layer. ''' self.df_surfaces.drop(name, axis=0, inplace=True) # Order of layers may have changed after removing a layer...
python
def remove_surface(self, name): ''' Remove layer from rendering stack and flatten remaining layers. Args ---- name (str) : Name of layer. ''' self.df_surfaces.drop(name, axis=0, inplace=True) # Order of layers may have changed after removing a layer...
[ "def", "remove_surface", "(", "self", ",", "name", ")", ":", "self", ".", "df_surfaces", ".", "drop", "(", "name", ",", "axis", "=", "0", ",", "inplace", "=", "True", ")", "# Order of layers may have changed after removing a layer. Trigger", "# refresh of surfaces."...
Remove layer from rendering stack and flatten remaining layers. Args ---- name (str) : Name of layer.
[ "Remove", "layer", "from", "rendering", "stack", "and", "flatten", "remaining", "layers", "." ]
05b480683c9fa43f91ce5a58de2fa90cdf363fc8
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/canvas.py#L422-L435
train
56,633
sci-bots/dmf-device-ui
dmf_device_ui/canvas.py
DmfDeviceCanvas.clone_surface
def clone_surface(self, source_name, target_name, target_position=-1, alpha=1.): ''' Clone surface from existing layer to a new name, inserting new surface at specified position. By default, new surface is appended as the top surface layer. Args --...
python
def clone_surface(self, source_name, target_name, target_position=-1, alpha=1.): ''' Clone surface from existing layer to a new name, inserting new surface at specified position. By default, new surface is appended as the top surface layer. Args --...
[ "def", "clone_surface", "(", "self", ",", "source_name", ",", "target_name", ",", "target_position", "=", "-", "1", ",", "alpha", "=", "1.", ")", ":", "source_surface", "=", "self", ".", "df_surfaces", ".", "surface", ".", "ix", "[", "source_name", "]", ...
Clone surface from existing layer to a new name, inserting new surface at specified position. By default, new surface is appended as the top surface layer. Args ---- source_name (str) : Name of layer to clone. target_name (str) : Name of new layer.
[ "Clone", "surface", "from", "existing", "layer", "to", "a", "new", "name", "inserting", "new", "surface", "at", "specified", "position", "." ]
05b480683c9fa43f91ce5a58de2fa90cdf363fc8
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/canvas.py#L437-L462
train
56,634
sci-bots/dmf-device-ui
dmf_device_ui/canvas.py
DmfDeviceCanvas.render_electrode_shapes
def render_electrode_shapes(self, df_shapes=None, shape_scale=0.8, fill=(1, 1, 1)): ''' Render electrode state shapes. By default, draw each electrode shape filled white. See also :meth:`render_shapes()`. Parameters ---------- df...
python
def render_electrode_shapes(self, df_shapes=None, shape_scale=0.8, fill=(1, 1, 1)): ''' Render electrode state shapes. By default, draw each electrode shape filled white. See also :meth:`render_shapes()`. Parameters ---------- df...
[ "def", "render_electrode_shapes", "(", "self", ",", "df_shapes", "=", "None", ",", "shape_scale", "=", "0.8", ",", "fill", "=", "(", "1", ",", "1", ",", "1", ")", ")", ":", "surface", "=", "self", ".", "get_surface", "(", ")", "if", "df_shapes", "is"...
Render electrode state shapes. By default, draw each electrode shape filled white. See also :meth:`render_shapes()`. Parameters ---------- df_shapes = : pandas.DataFrame .. versionadded:: 0.12
[ "Render", "electrode", "state", "shapes", "." ]
05b480683c9fa43f91ce5a58de2fa90cdf363fc8
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/canvas.py#L602-L652
train
56,635
sci-bots/dmf-device-ui
dmf_device_ui/canvas.py
DmfDeviceCanvas.render_registration
def render_registration(self): ''' Render pinned points on video frame as red rectangle. ''' surface = self.get_surface() if self.canvas is None or self.df_canvas_corners.shape[0] == 0: return surface corners = self.df_canvas_corners.copy() corners['w...
python
def render_registration(self): ''' Render pinned points on video frame as red rectangle. ''' surface = self.get_surface() if self.canvas is None or self.df_canvas_corners.shape[0] == 0: return surface corners = self.df_canvas_corners.copy() corners['w...
[ "def", "render_registration", "(", "self", ")", ":", "surface", "=", "self", ".", "get_surface", "(", ")", "if", "self", ".", "canvas", "is", "None", "or", "self", ".", "df_canvas_corners", ".", "shape", "[", "0", "]", "==", "0", ":", "return", "surfac...
Render pinned points on video frame as red rectangle.
[ "Render", "pinned", "points", "on", "video", "frame", "as", "red", "rectangle", "." ]
05b480683c9fa43f91ce5a58de2fa90cdf363fc8
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/canvas.py#L786-L810
train
56,636
sci-bots/dmf-device-ui
dmf_device_ui/canvas.py
DmfDeviceCanvas.draw_route
def draw_route(self, df_route, cr, color=None, line_width=None): ''' Draw a line between electrodes listed in a route. Arguments --------- - `df_route`: * A `pandas.DataFrame` containing a column named `electrode_i`. * For each row, `electrode_i` corr...
python
def draw_route(self, df_route, cr, color=None, line_width=None): ''' Draw a line between electrodes listed in a route. Arguments --------- - `df_route`: * A `pandas.DataFrame` containing a column named `electrode_i`. * For each row, `electrode_i` corr...
[ "def", "draw_route", "(", "self", ",", "df_route", ",", "cr", ",", "color", "=", "None", ",", "line_width", "=", "None", ")", ":", "df_route_centers", "=", "(", "self", ".", "canvas", ".", "df_shape_centers", ".", "ix", "[", "df_route", ".", "electrode_i...
Draw a line between electrodes listed in a route. Arguments --------- - `df_route`: * A `pandas.DataFrame` containing a column named `electrode_i`. * For each row, `electrode_i` corresponds to the integer index of the corresponding electrode. ...
[ "Draw", "a", "line", "between", "electrodes", "listed", "in", "a", "route", "." ]
05b480683c9fa43f91ce5a58de2fa90cdf363fc8
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/canvas.py#L846-L899
train
56,637
sci-bots/dmf-device-ui
dmf_device_ui/canvas.py
DmfDeviceCanvas.on_widget__button_press_event
def on_widget__button_press_event(self, widget, event): ''' Called when any mouse button is pressed. .. versionchanged:: 0.11 Do not trigger `route-electrode-added` event if `ALT` key is pressed. ''' if self.mode == 'register_video' and event.button == 1...
python
def on_widget__button_press_event(self, widget, event): ''' Called when any mouse button is pressed. .. versionchanged:: 0.11 Do not trigger `route-electrode-added` event if `ALT` key is pressed. ''' if self.mode == 'register_video' and event.button == 1...
[ "def", "on_widget__button_press_event", "(", "self", ",", "widget", ",", "event", ")", ":", "if", "self", ".", "mode", "==", "'register_video'", "and", "event", ".", "button", "==", "1", ":", "self", ".", "start_event", "=", "event", ".", "copy", "(", ")...
Called when any mouse button is pressed. .. versionchanged:: 0.11 Do not trigger `route-electrode-added` event if `ALT` key is pressed.
[ "Called", "when", "any", "mouse", "button", "is", "pressed", "." ]
05b480683c9fa43f91ce5a58de2fa90cdf363fc8
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/canvas.py#L920-L944
train
56,638
sci-bots/dmf-device-ui
dmf_device_ui/canvas.py
DmfDeviceCanvas.on_widget__button_release_event
def on_widget__button_release_event(self, widget, event): ''' Called when any mouse button is released. .. versionchanged:: 0.11.3 Always reset pending route, regardless of whether a route was completed. This includes a) removing temporary routes from routes ...
python
def on_widget__button_release_event(self, widget, event): ''' Called when any mouse button is released. .. versionchanged:: 0.11.3 Always reset pending route, regardless of whether a route was completed. This includes a) removing temporary routes from routes ...
[ "def", "on_widget__button_release_event", "(", "self", ",", "widget", ",", "event", ")", ":", "event", "=", "event", ".", "copy", "(", ")", "if", "self", ".", "mode", "==", "'register_video'", "and", "(", "event", ".", "button", "==", "1", "and", "self",...
Called when any mouse button is released. .. versionchanged:: 0.11.3 Always reset pending route, regardless of whether a route was completed. This includes a) removing temporary routes from routes table, and b) resetting the state of the current route electrode ...
[ "Called", "when", "any", "mouse", "button", "is", "released", "." ]
05b480683c9fa43f91ce5a58de2fa90cdf363fc8
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/canvas.py#L946-L1002
train
56,639
sci-bots/dmf-device-ui
dmf_device_ui/canvas.py
DmfDeviceCanvas.on_widget__motion_notify_event
def on_widget__motion_notify_event(self, widget, event): ''' Called when mouse pointer is moved within drawing area. .. versionchanged:: 0.11 Do not trigger `route-electrode-added` event if `ALT` key is pressed. ''' if self.canvas is None: # ...
python
def on_widget__motion_notify_event(self, widget, event): ''' Called when mouse pointer is moved within drawing area. .. versionchanged:: 0.11 Do not trigger `route-electrode-added` event if `ALT` key is pressed. ''' if self.canvas is None: # ...
[ "def", "on_widget__motion_notify_event", "(", "self", ",", "widget", ",", "event", ")", ":", "if", "self", ".", "canvas", "is", "None", ":", "# Canvas has not been initialized. Nothing to do.", "return", "elif", "event", ".", "is_hint", ":", "pointer", "=", "even...
Called when mouse pointer is moved within drawing area. .. versionchanged:: 0.11 Do not trigger `route-electrode-added` event if `ALT` key is pressed.
[ "Called", "when", "mouse", "pointer", "is", "moved", "within", "drawing", "area", "." ]
05b480683c9fa43f91ce5a58de2fa90cdf363fc8
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/canvas.py#L1110-L1154
train
56,640
sci-bots/dmf-device-ui
dmf_device_ui/canvas.py
DmfDeviceCanvas.register_electrode_command
def register_electrode_command(self, command, title=None, group=None): ''' Register electrode command. Add electrode plugin command to context menu. ''' commands = self.electrode_commands.setdefault(group, OrderedDict()) if title is None: title = (command[:1]...
python
def register_electrode_command(self, command, title=None, group=None): ''' Register electrode command. Add electrode plugin command to context menu. ''' commands = self.electrode_commands.setdefault(group, OrderedDict()) if title is None: title = (command[:1]...
[ "def", "register_electrode_command", "(", "self", ",", "command", ",", "title", "=", "None", ",", "group", "=", "None", ")", ":", "commands", "=", "self", ".", "electrode_commands", ".", "setdefault", "(", "group", ",", "OrderedDict", "(", ")", ")", "if", ...
Register electrode command. Add electrode plugin command to context menu.
[ "Register", "electrode", "command", "." ]
05b480683c9fa43f91ce5a58de2fa90cdf363fc8
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/canvas.py#L1236-L1245
train
56,641
sci-bots/dmf-device-ui
dmf_device_ui/canvas.py
DmfDeviceCanvas.register_route_command
def register_route_command(self, command, title=None, group=None): ''' Register route command. Add route plugin command to context menu. ''' commands = self.route_commands.setdefault(group, OrderedDict()) if title is None: title = (command[:1].upper() + comma...
python
def register_route_command(self, command, title=None, group=None): ''' Register route command. Add route plugin command to context menu. ''' commands = self.route_commands.setdefault(group, OrderedDict()) if title is None: title = (command[:1].upper() + comma...
[ "def", "register_route_command", "(", "self", ",", "command", ",", "title", "=", "None", ",", "group", "=", "None", ")", ":", "commands", "=", "self", ".", "route_commands", ".", "setdefault", "(", "group", ",", "OrderedDict", "(", ")", ")", "if", "title...
Register route command. Add route plugin command to context menu.
[ "Register", "route", "command", "." ]
05b480683c9fa43f91ce5a58de2fa90cdf363fc8
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/canvas.py#L1249-L1258
train
56,642
Julian/Minion
minion/request.py
Responder.after
def after(self): """ Return a deferred that will fire after the request is finished. Returns: Deferred: a new deferred that will fire appropriately """ d = Deferred() self._after_deferreds.append(d) return d.chain
python
def after(self): """ Return a deferred that will fire after the request is finished. Returns: Deferred: a new deferred that will fire appropriately """ d = Deferred() self._after_deferreds.append(d) return d.chain
[ "def", "after", "(", "self", ")", ":", "d", "=", "Deferred", "(", ")", "self", ".", "_after_deferreds", ".", "append", "(", "d", ")", "return", "d", ".", "chain" ]
Return a deferred that will fire after the request is finished. Returns: Deferred: a new deferred that will fire appropriately
[ "Return", "a", "deferred", "that", "will", "fire", "after", "the", "request", "is", "finished", "." ]
518d06f9ffd38dcacc0de4d94e72d1f8452157a8
https://github.com/Julian/Minion/blob/518d06f9ffd38dcacc0de4d94e72d1f8452157a8/minion/request.py#L29-L41
train
56,643
Julian/Minion
minion/request.py
Manager.after_response
def after_response(self, request, fn, *args, **kwargs): """ Call the given callable after the given request has its response. Arguments: request: the request to piggyback fn (callable): a callable that takes at least two arguments, the...
python
def after_response(self, request, fn, *args, **kwargs): """ Call the given callable after the given request has its response. Arguments: request: the request to piggyback fn (callable): a callable that takes at least two arguments, the...
[ "def", "after_response", "(", "self", ",", "request", ",", "fn", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_requests", "[", "id", "(", "request", ")", "]", "[", "\"callbacks\"", "]", ".", "append", "(", "(", "fn", ",", "a...
Call the given callable after the given request has its response. Arguments: request: the request to piggyback fn (callable): a callable that takes at least two arguments, the request and the response (in that order), along with any ad...
[ "Call", "the", "given", "callable", "after", "the", "given", "request", "has", "its", "response", "." ]
518d06f9ffd38dcacc0de4d94e72d1f8452157a8
https://github.com/Julian/Minion/blob/518d06f9ffd38dcacc0de4d94e72d1f8452157a8/minion/request.py#L57-L76
train
56,644
Titan-C/slaveparticles
examples/memoires.py
plot_degbandshalffill
def plot_degbandshalffill(): """Plot of Quasiparticle weight for degenerate half-filled bands, showing the Mott transition""" ulim = [3.45, 5.15, 6.85, 8.55] bands = range(1, 5) for band, u_int in zip(bands, ulim): name = 'Z_half_'+str(band)+'band' dop = [0.5] data = ssplt...
python
def plot_degbandshalffill(): """Plot of Quasiparticle weight for degenerate half-filled bands, showing the Mott transition""" ulim = [3.45, 5.15, 6.85, 8.55] bands = range(1, 5) for band, u_int in zip(bands, ulim): name = 'Z_half_'+str(band)+'band' dop = [0.5] data = ssplt...
[ "def", "plot_degbandshalffill", "(", ")", ":", "ulim", "=", "[", "3.45", ",", "5.15", ",", "6.85", ",", "8.55", "]", "bands", "=", "range", "(", "1", ",", "5", ")", "for", "band", ",", "u_int", "in", "zip", "(", "bands", ",", "ulim", ")", ":", ...
Plot of Quasiparticle weight for degenerate half-filled bands, showing the Mott transition
[ "Plot", "of", "Quasiparticle", "weight", "for", "degenerate", "half", "-", "filled", "bands", "showing", "the", "Mott", "transition" ]
e4c2f5afb1a7b195517ef2f1b5cc758965036aab
https://github.com/Titan-C/slaveparticles/blob/e4c2f5afb1a7b195517ef2f1b5cc758965036aab/examples/memoires.py#L14-L25
train
56,645
Titan-C/slaveparticles
examples/memoires.py
plot_dop
def plot_dop(bands, int_max, dop, hund_cu, name): """Plot of Quasiparticle weight for N degenerate bands under selected doping shows transition only at half-fill the rest are metallic states""" data = ssplt.calc_z(bands, dop, np.arange(0, int_max, 0.1), hund_cu, name) ssplt.plot_curves_z(data,...
python
def plot_dop(bands, int_max, dop, hund_cu, name): """Plot of Quasiparticle weight for N degenerate bands under selected doping shows transition only at half-fill the rest are metallic states""" data = ssplt.calc_z(bands, dop, np.arange(0, int_max, 0.1), hund_cu, name) ssplt.plot_curves_z(data,...
[ "def", "plot_dop", "(", "bands", ",", "int_max", ",", "dop", ",", "hund_cu", ",", "name", ")", ":", "data", "=", "ssplt", ".", "calc_z", "(", "bands", ",", "dop", ",", "np", ".", "arange", "(", "0", ",", "int_max", ",", "0.1", ")", ",", "hund_cu"...
Plot of Quasiparticle weight for N degenerate bands under selected doping shows transition only at half-fill the rest are metallic states
[ "Plot", "of", "Quasiparticle", "weight", "for", "N", "degenerate", "bands", "under", "selected", "doping", "shows", "transition", "only", "at", "half", "-", "fill", "the", "rest", "are", "metallic", "states" ]
e4c2f5afb1a7b195517ef2f1b5cc758965036aab
https://github.com/Titan-C/slaveparticles/blob/e4c2f5afb1a7b195517ef2f1b5cc758965036aab/examples/memoires.py#L28-L33
train
56,646
Titan-C/slaveparticles
examples/memoires.py
plot_dop_phase
def plot_dop_phase(bands, int_max, hund_cu): """Phase plot of Quasiparticle weight for N degenerate bands under doping shows transition only at interger filling the rest are metallic states""" name = 'Z_dop_phase_'+str(bands)+'bands_U'+str(int_max)+'J'+str(hund_cu) dop = np.sort(np.hstack((np....
python
def plot_dop_phase(bands, int_max, hund_cu): """Phase plot of Quasiparticle weight for N degenerate bands under doping shows transition only at interger filling the rest are metallic states""" name = 'Z_dop_phase_'+str(bands)+'bands_U'+str(int_max)+'J'+str(hund_cu) dop = np.sort(np.hstack((np....
[ "def", "plot_dop_phase", "(", "bands", ",", "int_max", ",", "hund_cu", ")", ":", "name", "=", "'Z_dop_phase_'", "+", "str", "(", "bands", ")", "+", "'bands_U'", "+", "str", "(", "int_max", ")", "+", "'J'", "+", "str", "(", "hund_cu", ")", "dop", "=",...
Phase plot of Quasiparticle weight for N degenerate bands under doping shows transition only at interger filling the rest are metallic states
[ "Phase", "plot", "of", "Quasiparticle", "weight", "for", "N", "degenerate", "bands", "under", "doping", "shows", "transition", "only", "at", "interger", "filling", "the", "rest", "are", "metallic", "states" ]
e4c2f5afb1a7b195517ef2f1b5cc758965036aab
https://github.com/Titan-C/slaveparticles/blob/e4c2f5afb1a7b195517ef2f1b5cc758965036aab/examples/memoires.py#L36-L46
train
56,647
objectrocket/python-client
objectrocket/bases.py
Extensible._register_extensions
def _register_extensions(self, namespace): """Register any extensions under the given namespace.""" # Register any extension classes for this class. extmanager = ExtensionManager( 'extensions.classes.{}'.format(namespace), propagate_map_exceptions=True ) ...
python
def _register_extensions(self, namespace): """Register any extensions under the given namespace.""" # Register any extension classes for this class. extmanager = ExtensionManager( 'extensions.classes.{}'.format(namespace), propagate_map_exceptions=True ) ...
[ "def", "_register_extensions", "(", "self", ",", "namespace", ")", ":", "# Register any extension classes for this class.", "extmanager", "=", "ExtensionManager", "(", "'extensions.classes.{}'", ".", "format", "(", "namespace", ")", ",", "propagate_map_exceptions", "=", "...
Register any extensions under the given namespace.
[ "Register", "any", "extensions", "under", "the", "given", "namespace", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/objectrocket/bases.py#L294-L312
train
56,648
objectrocket/python-client
objectrocket/bases.py
InstanceAclsInterface.acls
def acls(self): """The instance bound ACLs operations layer.""" if self._acls is None: self._acls = InstanceAcls(instance=self) return self._acls
python
def acls(self): """The instance bound ACLs operations layer.""" if self._acls is None: self._acls = InstanceAcls(instance=self) return self._acls
[ "def", "acls", "(", "self", ")", ":", "if", "self", ".", "_acls", "is", "None", ":", "self", ".", "_acls", "=", "InstanceAcls", "(", "instance", "=", "self", ")", "return", "self", ".", "_acls" ]
The instance bound ACLs operations layer.
[ "The", "instance", "bound", "ACLs", "operations", "layer", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/objectrocket/bases.py#L324-L328
train
56,649
objectrocket/python-client
objectrocket/bases.py
InstanceAcls.all
def all(self): """Get all ACLs for this instance.""" return self._instance._client.acls.all(self._instance.name)
python
def all(self): """Get all ACLs for this instance.""" return self._instance._client.acls.all(self._instance.name)
[ "def", "all", "(", "self", ")", ":", "return", "self", ".", "_instance", ".", "_client", ".", "acls", ".", "all", "(", "self", ".", "_instance", ".", "name", ")" ]
Get all ACLs for this instance.
[ "Get", "all", "ACLs", "for", "this", "instance", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/objectrocket/bases.py#L337-L339
train
56,650
objectrocket/python-client
objectrocket/bases.py
InstanceAcls.create
def create(self, cidr_mask, description, **kwargs): """Create an ACL for this instance. See :py:meth:`Acls.create` for call signature. """ return self._instance._client.acls.create( self._instance.name, cidr_mask, description, **kwargs ...
python
def create(self, cidr_mask, description, **kwargs): """Create an ACL for this instance. See :py:meth:`Acls.create` for call signature. """ return self._instance._client.acls.create( self._instance.name, cidr_mask, description, **kwargs ...
[ "def", "create", "(", "self", ",", "cidr_mask", ",", "description", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_instance", ".", "_client", ".", "acls", ".", "create", "(", "self", ".", "_instance", ".", "name", ",", "cidr_mask", ",", ...
Create an ACL for this instance. See :py:meth:`Acls.create` for call signature.
[ "Create", "an", "ACL", "for", "this", "instance", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/objectrocket/bases.py#L341-L351
train
56,651
objectrocket/python-client
objectrocket/bases.py
InstanceAcls.get
def get(self, acl): """Get the ACL specified by ID belonging to this instance. See :py:meth:`Acls.get` for call signature. """ return self._instance._client.acls.get(self._instance.name, acl)
python
def get(self, acl): """Get the ACL specified by ID belonging to this instance. See :py:meth:`Acls.get` for call signature. """ return self._instance._client.acls.get(self._instance.name, acl)
[ "def", "get", "(", "self", ",", "acl", ")", ":", "return", "self", ".", "_instance", ".", "_client", ".", "acls", ".", "get", "(", "self", ".", "_instance", ".", "name", ",", "acl", ")" ]
Get the ACL specified by ID belonging to this instance. See :py:meth:`Acls.get` for call signature.
[ "Get", "the", "ACL", "specified", "by", "ID", "belonging", "to", "this", "instance", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/objectrocket/bases.py#L353-L358
train
56,652
mixer/beam-interactive-python
beam_interactive/proto/varint.py
_VarintEncoder
def _VarintEncoder(): """Return an encoder for a basic varint value.""" local_chr = chr def EncodeVarint(write, value): bits = value & 0x7f value >>= 7 while value: write(0x80|bits) bits = value & 0x7f value >>= 7 return write(bits) return EncodeVarint
python
def _VarintEncoder(): """Return an encoder for a basic varint value.""" local_chr = chr def EncodeVarint(write, value): bits = value & 0x7f value >>= 7 while value: write(0x80|bits) bits = value & 0x7f value >>= 7 return write(bits) return EncodeVarint
[ "def", "_VarintEncoder", "(", ")", ":", "local_chr", "=", "chr", "def", "EncodeVarint", "(", "write", ",", "value", ")", ":", "bits", "=", "value", "&", "0x7f", "value", ">>=", "7", "while", "value", ":", "write", "(", "0x80", "|", "bits", ")", "bits...
Return an encoder for a basic varint value.
[ "Return", "an", "encoder", "for", "a", "basic", "varint", "value", "." ]
e035bc45515dea9315b77648a24b5ae8685aa5cf
https://github.com/mixer/beam-interactive-python/blob/e035bc45515dea9315b77648a24b5ae8685aa5cf/beam_interactive/proto/varint.py#L123-L136
train
56,653
mixer/beam-interactive-python
beam_interactive/proto/varint.py
_SignedVarintEncoder
def _SignedVarintEncoder(): """Return an encoder for a basic signed varint value.""" local_chr = chr def EncodeSignedVarint(write, value): if value < 0: value += (1 << 64) bits = value & 0x7f value >>= 7 while value: write(0x80|bits) bits = value & 0x7f value >>= 7 ret...
python
def _SignedVarintEncoder(): """Return an encoder for a basic signed varint value.""" local_chr = chr def EncodeSignedVarint(write, value): if value < 0: value += (1 << 64) bits = value & 0x7f value >>= 7 while value: write(0x80|bits) bits = value & 0x7f value >>= 7 ret...
[ "def", "_SignedVarintEncoder", "(", ")", ":", "local_chr", "=", "chr", "def", "EncodeSignedVarint", "(", "write", ",", "value", ")", ":", "if", "value", "<", "0", ":", "value", "+=", "(", "1", "<<", "64", ")", "bits", "=", "value", "&", "0x7f", "valu...
Return an encoder for a basic signed varint value.
[ "Return", "an", "encoder", "for", "a", "basic", "signed", "varint", "value", "." ]
e035bc45515dea9315b77648a24b5ae8685aa5cf
https://github.com/mixer/beam-interactive-python/blob/e035bc45515dea9315b77648a24b5ae8685aa5cf/beam_interactive/proto/varint.py#L139-L154
train
56,654
Data-Mechanics/geoql
geoql/geoql.py
match
def match(value, query): """ Determine whether a value satisfies a query. """ if type(query) in [str, int, float, type(None)]: return value == query elif type(query) == dict and len(query.keys()) == 1: for op in query: if op == "$eq": return value == query[op] ...
python
def match(value, query): """ Determine whether a value satisfies a query. """ if type(query) in [str, int, float, type(None)]: return value == query elif type(query) == dict and len(query.keys()) == 1: for op in query: if op == "$eq": return value == query[op] ...
[ "def", "match", "(", "value", ",", "query", ")", ":", "if", "type", "(", "query", ")", "in", "[", "str", ",", "int", ",", "float", ",", "type", "(", "None", ")", "]", ":", "return", "value", "==", "query", "elif", "type", "(", "query", ")", "==...
Determine whether a value satisfies a query.
[ "Determine", "whether", "a", "value", "satisfies", "a", "query", "." ]
c6184e1734c76a259855d6282e919614839a767e
https://github.com/Data-Mechanics/geoql/blob/c6184e1734c76a259855d6282e919614839a767e/geoql/geoql.py#L31-L49
train
56,655
Data-Mechanics/geoql
geoql/geoql.py
features_tags_parse_str_to_dict
def features_tags_parse_str_to_dict(obj): """ Parse tag strings of all features in the collection into a Python dictionary, if possible. """ features = obj['features'] for i in tqdm(range(len(features))): tags = features[i]['properties'].get('tags') if tags is not None: ...
python
def features_tags_parse_str_to_dict(obj): """ Parse tag strings of all features in the collection into a Python dictionary, if possible. """ features = obj['features'] for i in tqdm(range(len(features))): tags = features[i]['properties'].get('tags') if tags is not None: ...
[ "def", "features_tags_parse_str_to_dict", "(", "obj", ")", ":", "features", "=", "obj", "[", "'features'", "]", "for", "i", "in", "tqdm", "(", "range", "(", "len", "(", "features", ")", ")", ")", ":", "tags", "=", "features", "[", "i", "]", "[", "'pr...
Parse tag strings of all features in the collection into a Python dictionary, if possible.
[ "Parse", "tag", "strings", "of", "all", "features", "in", "the", "collection", "into", "a", "Python", "dictionary", "if", "possible", "." ]
c6184e1734c76a259855d6282e919614839a767e
https://github.com/Data-Mechanics/geoql/blob/c6184e1734c76a259855d6282e919614839a767e/geoql/geoql.py#L63-L83
train
56,656
Data-Mechanics/geoql
geoql/geoql.py
features_keep_by_property
def features_keep_by_property(obj, query): """ Filter all features in a collection by retaining only those that satisfy the provided query. """ features_keep = [] for feature in tqdm(obj['features']): if all([match(feature['properties'].get(prop), qry) for (prop, qry) in query.items()]):...
python
def features_keep_by_property(obj, query): """ Filter all features in a collection by retaining only those that satisfy the provided query. """ features_keep = [] for feature in tqdm(obj['features']): if all([match(feature['properties'].get(prop), qry) for (prop, qry) in query.items()]):...
[ "def", "features_keep_by_property", "(", "obj", ",", "query", ")", ":", "features_keep", "=", "[", "]", "for", "feature", "in", "tqdm", "(", "obj", "[", "'features'", "]", ")", ":", "if", "all", "(", "[", "match", "(", "feature", "[", "'properties'", "...
Filter all features in a collection by retaining only those that satisfy the provided query.
[ "Filter", "all", "features", "in", "a", "collection", "by", "retaining", "only", "those", "that", "satisfy", "the", "provided", "query", "." ]
c6184e1734c76a259855d6282e919614839a767e
https://github.com/Data-Mechanics/geoql/blob/c6184e1734c76a259855d6282e919614839a767e/geoql/geoql.py#L85-L95
train
56,657
Data-Mechanics/geoql
geoql/geoql.py
features_keep_within_radius
def features_keep_within_radius(obj, center, radius, units): """ Filter all features in a collection by retaining only those that fall within the specified radius. """ features_keep = [] for feature in tqdm(obj['features']): if all([getattr(geopy.distance.vincenty((lat,lon), center), uni...
python
def features_keep_within_radius(obj, center, radius, units): """ Filter all features in a collection by retaining only those that fall within the specified radius. """ features_keep = [] for feature in tqdm(obj['features']): if all([getattr(geopy.distance.vincenty((lat,lon), center), uni...
[ "def", "features_keep_within_radius", "(", "obj", ",", "center", ",", "radius", ",", "units", ")", ":", "features_keep", "=", "[", "]", "for", "feature", "in", "tqdm", "(", "obj", "[", "'features'", "]", ")", ":", "if", "all", "(", "[", "getattr", "(",...
Filter all features in a collection by retaining only those that fall within the specified radius.
[ "Filter", "all", "features", "in", "a", "collection", "by", "retaining", "only", "those", "that", "fall", "within", "the", "specified", "radius", "." ]
c6184e1734c76a259855d6282e919614839a767e
https://github.com/Data-Mechanics/geoql/blob/c6184e1734c76a259855d6282e919614839a767e/geoql/geoql.py#L97-L107
train
56,658
Data-Mechanics/geoql
geoql/geoql.py
features_keep_using_features
def features_keep_using_features(obj, bounds): """ Filter all features in a collection by retaining only those that fall within the features in the second collection. """ # Build an R-tree index of bound features and their shapes. bounds_shapes = [ (feature, shapely.geometry.shape(featur...
python
def features_keep_using_features(obj, bounds): """ Filter all features in a collection by retaining only those that fall within the features in the second collection. """ # Build an R-tree index of bound features and their shapes. bounds_shapes = [ (feature, shapely.geometry.shape(featur...
[ "def", "features_keep_using_features", "(", "obj", ",", "bounds", ")", ":", "# Build an R-tree index of bound features and their shapes.", "bounds_shapes", "=", "[", "(", "feature", ",", "shapely", ".", "geometry", ".", "shape", "(", "feature", "[", "'geometry'", "]",...
Filter all features in a collection by retaining only those that fall within the features in the second collection.
[ "Filter", "all", "features", "in", "a", "collection", "by", "retaining", "only", "those", "that", "fall", "within", "the", "features", "in", "the", "second", "collection", "." ]
c6184e1734c76a259855d6282e919614839a767e
https://github.com/Data-Mechanics/geoql/blob/c6184e1734c76a259855d6282e919614839a767e/geoql/geoql.py#L109-L138
train
56,659
Data-Mechanics/geoql
geoql/geoql.py
features_node_edge_graph
def features_node_edge_graph(obj): """ Transform the features into a more graph-like structure by appropriately splitting LineString features into two-point "edges" that connect Point "nodes". """ points = {} features = obj['features'] for feature in tqdm(obj['features']): for (l...
python
def features_node_edge_graph(obj): """ Transform the features into a more graph-like structure by appropriately splitting LineString features into two-point "edges" that connect Point "nodes". """ points = {} features = obj['features'] for feature in tqdm(obj['features']): for (l...
[ "def", "features_node_edge_graph", "(", "obj", ")", ":", "points", "=", "{", "}", "features", "=", "obj", "[", "'features'", "]", "for", "feature", "in", "tqdm", "(", "obj", "[", "'features'", "]", ")", ":", "for", "(", "lon", ",", "lat", ")", "in", ...
Transform the features into a more graph-like structure by appropriately splitting LineString features into two-point "edges" that connect Point "nodes".
[ "Transform", "the", "features", "into", "a", "more", "graph", "-", "like", "structure", "by", "appropriately", "splitting", "LineString", "features", "into", "two", "-", "point", "edges", "that", "connect", "Point", "nodes", "." ]
c6184e1734c76a259855d6282e919614839a767e
https://github.com/Data-Mechanics/geoql/blob/c6184e1734c76a259855d6282e919614839a767e/geoql/geoql.py#L147-L179
train
56,660
trevisanj/a99
a99/litedb.py
get_table_info
def get_table_info(conn, tablename): """Returns TableInfo object""" r = conn.execute("pragma table_info('{}')".format(tablename)) ret = TableInfo(((row["name"], row) for row in r)) return ret
python
def get_table_info(conn, tablename): """Returns TableInfo object""" r = conn.execute("pragma table_info('{}')".format(tablename)) ret = TableInfo(((row["name"], row) for row in r)) return ret
[ "def", "get_table_info", "(", "conn", ",", "tablename", ")", ":", "r", "=", "conn", ".", "execute", "(", "\"pragma table_info('{}')\"", ".", "format", "(", "tablename", ")", ")", "ret", "=", "TableInfo", "(", "(", "(", "row", "[", "\"name\"", "]", ",", ...
Returns TableInfo object
[ "Returns", "TableInfo", "object" ]
193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539
https://github.com/trevisanj/a99/blob/193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539/a99/litedb.py#L116-L120
train
56,661
CodyKochmann/generators
generators/early_warning.py
early_warning
def early_warning(iterable, name='this generator'): ''' This function logs an early warning that the generator is empty. This is handy for times when you're manually playing with generators and would appreciate the console warning you ahead of time that your generator is now empty, instead of being sur...
python
def early_warning(iterable, name='this generator'): ''' This function logs an early warning that the generator is empty. This is handy for times when you're manually playing with generators and would appreciate the console warning you ahead of time that your generator is now empty, instead of being sur...
[ "def", "early_warning", "(", "iterable", ",", "name", "=", "'this generator'", ")", ":", "nxt", "=", "None", "prev", "=", "next", "(", "iterable", ")", "while", "1", ":", "try", ":", "nxt", "=", "next", "(", "iterable", ")", "except", ":", "warning", ...
This function logs an early warning that the generator is empty. This is handy for times when you're manually playing with generators and would appreciate the console warning you ahead of time that your generator is now empty, instead of being surprised with a StopIteration or GeneratorExit exception w...
[ "This", "function", "logs", "an", "early", "warning", "that", "the", "generator", "is", "empty", "." ]
e4ca4dd25d5023a94b0349c69d6224070cc2526f
https://github.com/CodyKochmann/generators/blob/e4ca4dd25d5023a94b0349c69d6224070cc2526f/generators/early_warning.py#L6-L25
train
56,662
wuher/devil
example/userdb/api/resources.py
User.post
def post(self, data, request, id): """ Create a new resource using POST """ if id: # can't post to individual user raise errors.MethodNotAllowed() user = self._dict_to_model(data) user.save() # according to REST, return 201 and Location header retu...
python
def post(self, data, request, id): """ Create a new resource using POST """ if id: # can't post to individual user raise errors.MethodNotAllowed() user = self._dict_to_model(data) user.save() # according to REST, return 201 and Location header retu...
[ "def", "post", "(", "self", ",", "data", ",", "request", ",", "id", ")", ":", "if", "id", ":", "# can't post to individual user", "raise", "errors", ".", "MethodNotAllowed", "(", ")", "user", "=", "self", ".", "_dict_to_model", "(", "data", ")", "user", ...
Create a new resource using POST
[ "Create", "a", "new", "resource", "using", "POST" ]
a8834d4f88d915a21754c6b96f99d0ad9123ad4d
https://github.com/wuher/devil/blob/a8834d4f88d915a21754c6b96f99d0ad9123ad4d/example/userdb/api/resources.py#L21-L30
train
56,663
wuher/devil
example/userdb/api/resources.py
User.get
def get(self, request, id): """ Get one user or all users """ if id: return self._get_one(id) else: return self._get_all()
python
def get(self, request, id): """ Get one user or all users """ if id: return self._get_one(id) else: return self._get_all()
[ "def", "get", "(", "self", ",", "request", ",", "id", ")", ":", "if", "id", ":", "return", "self", ".", "_get_one", "(", "id", ")", "else", ":", "return", "self", ".", "_get_all", "(", ")" ]
Get one user or all users
[ "Get", "one", "user", "or", "all", "users" ]
a8834d4f88d915a21754c6b96f99d0ad9123ad4d
https://github.com/wuher/devil/blob/a8834d4f88d915a21754c6b96f99d0ad9123ad4d/example/userdb/api/resources.py#L32-L37
train
56,664
wuher/devil
example/userdb/api/resources.py
User.put
def put(self, data, request, id): """ Update a single user. """ if not id: # can't update the whole container raise errors.MethodNotAllowed() userdata = self._dict_to_model(data) userdata.pk = id try: userdata.save(force_update=True) ex...
python
def put(self, data, request, id): """ Update a single user. """ if not id: # can't update the whole container raise errors.MethodNotAllowed() userdata = self._dict_to_model(data) userdata.pk = id try: userdata.save(force_update=True) ex...
[ "def", "put", "(", "self", ",", "data", ",", "request", ",", "id", ")", ":", "if", "not", "id", ":", "# can't update the whole container", "raise", "errors", ".", "MethodNotAllowed", "(", ")", "userdata", "=", "self", ".", "_dict_to_model", "(", "data", ")...
Update a single user.
[ "Update", "a", "single", "user", "." ]
a8834d4f88d915a21754c6b96f99d0ad9123ad4d
https://github.com/wuher/devil/blob/a8834d4f88d915a21754c6b96f99d0ad9123ad4d/example/userdb/api/resources.py#L39-L50
train
56,665
wuher/devil
example/userdb/api/resources.py
User.delete
def delete(self, request, id): """ Delete a single user. """ if not id: # can't delete the whole container raise errors.MethodNotAllowed() try: models.User.objects.get(pk=id).delete() except models.User.DoesNotExist: # we never had it, so i...
python
def delete(self, request, id): """ Delete a single user. """ if not id: # can't delete the whole container raise errors.MethodNotAllowed() try: models.User.objects.get(pk=id).delete() except models.User.DoesNotExist: # we never had it, so i...
[ "def", "delete", "(", "self", ",", "request", ",", "id", ")", ":", "if", "not", "id", ":", "# can't delete the whole container", "raise", "errors", ".", "MethodNotAllowed", "(", ")", "try", ":", "models", ".", "User", ".", "objects", ".", "get", "(", "pk...
Delete a single user.
[ "Delete", "a", "single", "user", "." ]
a8834d4f88d915a21754c6b96f99d0ad9123ad4d
https://github.com/wuher/devil/blob/a8834d4f88d915a21754c6b96f99d0ad9123ad4d/example/userdb/api/resources.py#L52-L61
train
56,666
wuher/devil
example/userdb/api/resources.py
User._get_one
def _get_one(self, id): """ Get one user from db and turn into dict """ try: return self._to_dict(models.User.objects.get(pk=id)) except models.User.DoesNotExist: raise errors.NotFound()
python
def _get_one(self, id): """ Get one user from db and turn into dict """ try: return self._to_dict(models.User.objects.get(pk=id)) except models.User.DoesNotExist: raise errors.NotFound()
[ "def", "_get_one", "(", "self", ",", "id", ")", ":", "try", ":", "return", "self", ".", "_to_dict", "(", "models", ".", "User", ".", "objects", ".", "get", "(", "pk", "=", "id", ")", ")", "except", "models", ".", "User", ".", "DoesNotExist", ":", ...
Get one user from db and turn into dict
[ "Get", "one", "user", "from", "db", "and", "turn", "into", "dict" ]
a8834d4f88d915a21754c6b96f99d0ad9123ad4d
https://github.com/wuher/devil/blob/a8834d4f88d915a21754c6b96f99d0ad9123ad4d/example/userdb/api/resources.py#L63-L68
train
56,667
wuher/devil
example/userdb/api/resources.py
User._get_all
def _get_all(self): """ Get all users from db and turn into list of dicts """ return [self._to_dict(row) for row in models.User.objects.all()]
python
def _get_all(self): """ Get all users from db and turn into list of dicts """ return [self._to_dict(row) for row in models.User.objects.all()]
[ "def", "_get_all", "(", "self", ")", ":", "return", "[", "self", ".", "_to_dict", "(", "row", ")", "for", "row", "in", "models", ".", "User", ".", "objects", ".", "all", "(", ")", "]" ]
Get all users from db and turn into list of dicts
[ "Get", "all", "users", "from", "db", "and", "turn", "into", "list", "of", "dicts" ]
a8834d4f88d915a21754c6b96f99d0ad9123ad4d
https://github.com/wuher/devil/blob/a8834d4f88d915a21754c6b96f99d0ad9123ad4d/example/userdb/api/resources.py#L70-L72
train
56,668
wuher/devil
example/userdb/api/resources.py
User._dict_to_model
def _dict_to_model(self, data): """ Create new user model instance based on the received data. Note that the created user is not saved into database. """ try: # we can do this because we have same fields # in the representation and in the model: user...
python
def _dict_to_model(self, data): """ Create new user model instance based on the received data. Note that the created user is not saved into database. """ try: # we can do this because we have same fields # in the representation and in the model: user...
[ "def", "_dict_to_model", "(", "self", ",", "data", ")", ":", "try", ":", "# we can do this because we have same fields", "# in the representation and in the model:", "user", "=", "models", ".", "User", "(", "*", "*", "data", ")", "except", "TypeError", ":", "# clien...
Create new user model instance based on the received data. Note that the created user is not saved into database.
[ "Create", "new", "user", "model", "instance", "based", "on", "the", "received", "data", "." ]
a8834d4f88d915a21754c6b96f99d0ad9123ad4d
https://github.com/wuher/devil/blob/a8834d4f88d915a21754c6b96f99d0ad9123ad4d/example/userdb/api/resources.py#L81-L95
train
56,669
nmohoric/nypl-digital-collections
nyplcollections/nyplcollections.py
NYPLsearch.captures
def captures(self, uuid, withTitles=False): """Return the captures for a given uuid optional value withTitles=yes""" picker = lambda x: x.get('capture', []) return self._get((uuid,), picker, withTitles='yes' if withTitles else 'no')
python
def captures(self, uuid, withTitles=False): """Return the captures for a given uuid optional value withTitles=yes""" picker = lambda x: x.get('capture', []) return self._get((uuid,), picker, withTitles='yes' if withTitles else 'no')
[ "def", "captures", "(", "self", ",", "uuid", ",", "withTitles", "=", "False", ")", ":", "picker", "=", "lambda", "x", ":", "x", ".", "get", "(", "'capture'", ",", "[", "]", ")", "return", "self", ".", "_get", "(", "(", "uuid", ",", ")", ",", "p...
Return the captures for a given uuid optional value withTitles=yes
[ "Return", "the", "captures", "for", "a", "given", "uuid", "optional", "value", "withTitles", "=", "yes" ]
f66cd0a11e7ea2b6c3c327d2693211e2c4609231
https://github.com/nmohoric/nypl-digital-collections/blob/f66cd0a11e7ea2b6c3c327d2693211e2c4609231/nyplcollections/nyplcollections.py#L14-L18
train
56,670
nmohoric/nypl-digital-collections
nyplcollections/nyplcollections.py
NYPLsearch.uuid
def uuid(self, type, val): """Return the item-uuid for a identifier""" picker = lambda x: x.get('uuid', x) return self._get((type, val), picker)
python
def uuid(self, type, val): """Return the item-uuid for a identifier""" picker = lambda x: x.get('uuid', x) return self._get((type, val), picker)
[ "def", "uuid", "(", "self", ",", "type", ",", "val", ")", ":", "picker", "=", "lambda", "x", ":", "x", ".", "get", "(", "'uuid'", ",", "x", ")", "return", "self", ".", "_get", "(", "(", "type", ",", "val", ")", ",", "picker", ")" ]
Return the item-uuid for a identifier
[ "Return", "the", "item", "-", "uuid", "for", "a", "identifier" ]
f66cd0a11e7ea2b6c3c327d2693211e2c4609231
https://github.com/nmohoric/nypl-digital-collections/blob/f66cd0a11e7ea2b6c3c327d2693211e2c4609231/nyplcollections/nyplcollections.py#L20-L23
train
56,671
nmohoric/nypl-digital-collections
nyplcollections/nyplcollections.py
NYPLsearch.mods
def mods(self, uuid): """Return a mods record for a given uuid""" picker = lambda x: x.get('mods', {}) return self._get(('mods', uuid), picker)
python
def mods(self, uuid): """Return a mods record for a given uuid""" picker = lambda x: x.get('mods', {}) return self._get(('mods', uuid), picker)
[ "def", "mods", "(", "self", ",", "uuid", ")", ":", "picker", "=", "lambda", "x", ":", "x", ".", "get", "(", "'mods'", ",", "{", "}", ")", "return", "self", ".", "_get", "(", "(", "'mods'", ",", "uuid", ")", ",", "picker", ")" ]
Return a mods record for a given uuid
[ "Return", "a", "mods", "record", "for", "a", "given", "uuid" ]
f66cd0a11e7ea2b6c3c327d2693211e2c4609231
https://github.com/nmohoric/nypl-digital-collections/blob/f66cd0a11e7ea2b6c3c327d2693211e2c4609231/nyplcollections/nyplcollections.py#L37-L40
train
56,672
inveniosoftware-attic/invenio-utils
invenio_utils/date.py
get_i18n_day_name
def get_i18n_day_name(day_nb, display='short', ln=None): """Get the string representation of a weekday, internationalized @param day_nb: number of weekday UNIX like. => 0=Sunday @param ln: language for output @return: the string representation of the day """ ln = default_ln(l...
python
def get_i18n_day_name(day_nb, display='short', ln=None): """Get the string representation of a weekday, internationalized @param day_nb: number of weekday UNIX like. => 0=Sunday @param ln: language for output @return: the string representation of the day """ ln = default_ln(l...
[ "def", "get_i18n_day_name", "(", "day_nb", ",", "display", "=", "'short'", ",", "ln", "=", "None", ")", ":", "ln", "=", "default_ln", "(", "ln", ")", "_", "=", "gettext_set_language", "(", "ln", ")", "if", "display", "==", "'short'", ":", "days", "=", ...
Get the string representation of a weekday, internationalized @param day_nb: number of weekday UNIX like. => 0=Sunday @param ln: language for output @return: the string representation of the day
[ "Get", "the", "string", "representation", "of", "a", "weekday", "internationalized" ]
9a1c6db4e3f1370901f329f510480dd8df188296
https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/date.py#L214-L241
train
56,673
inveniosoftware-attic/invenio-utils
invenio_utils/date.py
get_i18n_month_name
def get_i18n_month_name(month_nb, display='short', ln=None): """Get a non-numeric representation of a month, internationalized. @param month_nb: number of month, (1 based!) =>1=jan,..,12=dec @param ln: language for output @return: the string representation of month """ ln =...
python
def get_i18n_month_name(month_nb, display='short', ln=None): """Get a non-numeric representation of a month, internationalized. @param month_nb: number of month, (1 based!) =>1=jan,..,12=dec @param ln: language for output @return: the string representation of month """ ln =...
[ "def", "get_i18n_month_name", "(", "month_nb", ",", "display", "=", "'short'", ",", "ln", "=", "None", ")", ":", "ln", "=", "default_ln", "(", "ln", ")", "_", "=", "gettext_set_language", "(", "ln", ")", "if", "display", "==", "'short'", ":", "months", ...
Get a non-numeric representation of a month, internationalized. @param month_nb: number of month, (1 based!) =>1=jan,..,12=dec @param ln: language for output @return: the string representation of month
[ "Get", "a", "non", "-", "numeric", "representation", "of", "a", "month", "internationalized", "." ]
9a1c6db4e3f1370901f329f510480dd8df188296
https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/date.py#L244-L282
train
56,674
inveniosoftware-attic/invenio-utils
invenio_utils/date.py
create_month_selectbox
def create_month_selectbox(name, selected_month=0, ln=None): """Creates an HTML menu for month selection. Value of selected field is numeric. @param name: name of the control, your form will be sent with name=value... @param selected_month: preselect a month. use 0 for the Label 'Month' @param ln: ...
python
def create_month_selectbox(name, selected_month=0, ln=None): """Creates an HTML menu for month selection. Value of selected field is numeric. @param name: name of the control, your form will be sent with name=value... @param selected_month: preselect a month. use 0 for the Label 'Month' @param ln: ...
[ "def", "create_month_selectbox", "(", "name", ",", "selected_month", "=", "0", ",", "ln", "=", "None", ")", ":", "ln", "=", "default_ln", "(", "ln", ")", "out", "=", "\"<select name=\\\"%s\\\">\\n\"", "%", "name", "for", "i", "in", "range", "(", "0", ","...
Creates an HTML menu for month selection. Value of selected field is numeric. @param name: name of the control, your form will be sent with name=value... @param selected_month: preselect a month. use 0 for the Label 'Month' @param ln: language of the menu @return: html as string
[ "Creates", "an", "HTML", "menu", "for", "month", "selection", ".", "Value", "of", "selected", "field", "is", "numeric", "." ]
9a1c6db4e3f1370901f329f510480dd8df188296
https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/date.py#L308-L326
train
56,675
inveniosoftware-attic/invenio-utils
invenio_utils/date.py
parse_runtime_limit
def parse_runtime_limit(value, now=None): """Parsing CLI option for runtime limit, supplied as VALUE. Value could be something like: Sunday 23:00-05:00, the format being [Wee[kday]] [hh[:mm][-hh[:mm]]]. The function will return two valid time ranges. The first could be in the past, containing the p...
python
def parse_runtime_limit(value, now=None): """Parsing CLI option for runtime limit, supplied as VALUE. Value could be something like: Sunday 23:00-05:00, the format being [Wee[kday]] [hh[:mm][-hh[:mm]]]. The function will return two valid time ranges. The first could be in the past, containing the p...
[ "def", "parse_runtime_limit", "(", "value", ",", "now", "=", "None", ")", ":", "def", "extract_time", "(", "value", ")", ":", "value", "=", "_RE_RUNTIMELIMIT_HOUR", ".", "search", "(", "value", ")", ".", "groupdict", "(", ")", "return", "timedelta", "(", ...
Parsing CLI option for runtime limit, supplied as VALUE. Value could be something like: Sunday 23:00-05:00, the format being [Wee[kday]] [hh[:mm][-hh[:mm]]]. The function will return two valid time ranges. The first could be in the past, containing the present or in the future. The second is always in ...
[ "Parsing", "CLI", "option", "for", "runtime", "limit", "supplied", "as", "VALUE", "." ]
9a1c6db4e3f1370901f329f510480dd8df188296
https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/date.py#L376-L470
train
56,676
inveniosoftware-attic/invenio-utils
invenio_utils/date.py
guess_datetime
def guess_datetime(datetime_string): """Try to guess the datetime contained in a string of unknow format. @param datetime_string: the datetime representation. @type datetime_string: string @return: the guessed time. @rtype: L{time.struct_time} @raises ValueError: in case it's not possible to gu...
python
def guess_datetime(datetime_string): """Try to guess the datetime contained in a string of unknow format. @param datetime_string: the datetime representation. @type datetime_string: string @return: the guessed time. @rtype: L{time.struct_time} @raises ValueError: in case it's not possible to gu...
[ "def", "guess_datetime", "(", "datetime_string", ")", ":", "if", "CFG_HAS_EGENIX_DATETIME", ":", "try", ":", "return", "Parser", ".", "DateTimeFromString", "(", "datetime_string", ")", ".", "timetuple", "(", ")", "except", "ValueError", ":", "pass", "else", ":",...
Try to guess the datetime contained in a string of unknow format. @param datetime_string: the datetime representation. @type datetime_string: string @return: the guessed time. @rtype: L{time.struct_time} @raises ValueError: in case it's not possible to guess the time.
[ "Try", "to", "guess", "the", "datetime", "contained", "in", "a", "string", "of", "unknow", "format", "." ]
9a1c6db4e3f1370901f329f510480dd8df188296
https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/date.py#L473-L494
train
56,677
inveniosoftware-attic/invenio-utils
invenio_utils/date.py
get_dst
def get_dst(date_obj): """Determine if dst is locally enabled at this time""" dst = 0 if date_obj.year >= 1900: tmp_date = time.mktime(date_obj.timetuple()) # DST is 1 so reduce time with 1 hour. dst = time.localtime(tmp_date)[-1] return dst
python
def get_dst(date_obj): """Determine if dst is locally enabled at this time""" dst = 0 if date_obj.year >= 1900: tmp_date = time.mktime(date_obj.timetuple()) # DST is 1 so reduce time with 1 hour. dst = time.localtime(tmp_date)[-1] return dst
[ "def", "get_dst", "(", "date_obj", ")", ":", "dst", "=", "0", "if", "date_obj", ".", "year", ">=", "1900", ":", "tmp_date", "=", "time", ".", "mktime", "(", "date_obj", ".", "timetuple", "(", ")", ")", "# DST is 1 so reduce time with 1 hour.", "dst", "=", ...
Determine if dst is locally enabled at this time
[ "Determine", "if", "dst", "is", "locally", "enabled", "at", "this", "time" ]
9a1c6db4e3f1370901f329f510480dd8df188296
https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/date.py#L642-L649
train
56,678
inveniosoftware-attic/invenio-utils
invenio_utils/date.py
utc_to_localtime
def utc_to_localtime( date_str, fmt="%Y-%m-%d %H:%M:%S", input_fmt="%Y-%m-%dT%H:%M:%SZ"): """ Convert UTC to localtime Reference: - (1) http://www.openarchives.org/OAI/openarchivesprotocol.html#Dates - (2) http://www.w3.org/TR/NOTE-datetime This function works only wi...
python
def utc_to_localtime( date_str, fmt="%Y-%m-%d %H:%M:%S", input_fmt="%Y-%m-%dT%H:%M:%SZ"): """ Convert UTC to localtime Reference: - (1) http://www.openarchives.org/OAI/openarchivesprotocol.html#Dates - (2) http://www.w3.org/TR/NOTE-datetime This function works only wi...
[ "def", "utc_to_localtime", "(", "date_str", ",", "fmt", "=", "\"%Y-%m-%d %H:%M:%S\"", ",", "input_fmt", "=", "\"%Y-%m-%dT%H:%M:%SZ\"", ")", ":", "date_struct", "=", "datetime", ".", "strptime", "(", "date_str", ",", "input_fmt", ")", "date_struct", "+=", "timedelt...
Convert UTC to localtime Reference: - (1) http://www.openarchives.org/OAI/openarchivesprotocol.html#Dates - (2) http://www.w3.org/TR/NOTE-datetime This function works only with dates complying with the "Complete date plus hours, minutes and seconds" profile of ISO 8601 defined by (2), and li...
[ "Convert", "UTC", "to", "localtime" ]
9a1c6db4e3f1370901f329f510480dd8df188296
https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/date.py#L652-L672
train
56,679
blaix/tdubs
tdubs/doubles.py
Spy._handle_call
def _handle_call(self, actual_call, stubbed_call): """Extends Stub call handling behavior to be callable by default.""" self._actual_calls.append(actual_call) use_call = stubbed_call or actual_call return use_call.return_value
python
def _handle_call(self, actual_call, stubbed_call): """Extends Stub call handling behavior to be callable by default.""" self._actual_calls.append(actual_call) use_call = stubbed_call or actual_call return use_call.return_value
[ "def", "_handle_call", "(", "self", ",", "actual_call", ",", "stubbed_call", ")", ":", "self", ".", "_actual_calls", ".", "append", "(", "actual_call", ")", "use_call", "=", "stubbed_call", "or", "actual_call", "return", "use_call", ".", "return_value" ]
Extends Stub call handling behavior to be callable by default.
[ "Extends", "Stub", "call", "handling", "behavior", "to", "be", "callable", "by", "default", "." ]
5df4ee32bb973dbf52baa4f10640505394089b78
https://github.com/blaix/tdubs/blob/5df4ee32bb973dbf52baa4f10640505394089b78/tdubs/doubles.py#L135-L139
train
56,680
blaix/tdubs
tdubs/doubles.py
Call.formatted_args
def formatted_args(self): """Format call arguments as a string. This is used to make test failure messages more helpful by referring to calls using a string that matches how they were, or should have been called. >>> call = Call('arg1', 'arg2', kwarg='kwarg') >>> call.f...
python
def formatted_args(self): """Format call arguments as a string. This is used to make test failure messages more helpful by referring to calls using a string that matches how they were, or should have been called. >>> call = Call('arg1', 'arg2', kwarg='kwarg') >>> call.f...
[ "def", "formatted_args", "(", "self", ")", ":", "arg_reprs", "=", "list", "(", "map", "(", "repr", ",", "self", ".", "args", ")", ")", "kwarg_reprs", "=", "[", "'%s=%s'", "%", "(", "k", ",", "repr", "(", "v", ")", ")", "for", "k", ",", "v", "in...
Format call arguments as a string. This is used to make test failure messages more helpful by referring to calls using a string that matches how they were, or should have been called. >>> call = Call('arg1', 'arg2', kwarg='kwarg') >>> call.formatted_args "('arg1', 'arg2...
[ "Format", "call", "arguments", "as", "a", "string", "." ]
5df4ee32bb973dbf52baa4f10640505394089b78
https://github.com/blaix/tdubs/blob/5df4ee32bb973dbf52baa4f10640505394089b78/tdubs/doubles.py#L223-L237
train
56,681
evocell/rabifier
rabifier/core.py
Seed.check
def check(self): """ Check if data and third party tools are available :raises: RuntimeError """ #for path in self.path.values(): # if not os.path.exists(path): # raise RuntimeError("File '{}' is missing".format(path)) for tool in ('cd-hit', 'prank', ...
python
def check(self): """ Check if data and third party tools are available :raises: RuntimeError """ #for path in self.path.values(): # if not os.path.exists(path): # raise RuntimeError("File '{}' is missing".format(path)) for tool in ('cd-hit', 'prank', ...
[ "def", "check", "(", "self", ")", ":", "#for path in self.path.values():", "# if not os.path.exists(path):", "# raise RuntimeError(\"File '{}' is missing\".format(path))", "for", "tool", "in", "(", "'cd-hit'", ",", "'prank'", ",", "'hmmbuild'", ",", "'hmmpress'", ",...
Check if data and third party tools are available :raises: RuntimeError
[ "Check", "if", "data", "and", "third", "party", "tools", "are", "available" ]
a5be3d516517e555bde463b94f06aeed106d19b8
https://github.com/evocell/rabifier/blob/a5be3d516517e555bde463b94f06aeed106d19b8/rabifier/core.py#L98-L110
train
56,682
evocell/rabifier
rabifier/core.py
Seed.generate_non_rabs
def generate_non_rabs(self): """ Shrink the non-Rab DB size by reducing sequence redundancy. """ logging.info('Building non-Rab DB') run_cmd([self.pathfinder['cd-hit'], '-i', self.path['non_rab_db'], '-o', self.output['non_rab_db'], '-d', '100', '-c', str(config['param'...
python
def generate_non_rabs(self): """ Shrink the non-Rab DB size by reducing sequence redundancy. """ logging.info('Building non-Rab DB') run_cmd([self.pathfinder['cd-hit'], '-i', self.path['non_rab_db'], '-o', self.output['non_rab_db'], '-d', '100', '-c', str(config['param'...
[ "def", "generate_non_rabs", "(", "self", ")", ":", "logging", ".", "info", "(", "'Building non-Rab DB'", ")", "run_cmd", "(", "[", "self", ".", "pathfinder", "[", "'cd-hit'", "]", ",", "'-i'", ",", "self", ".", "path", "[", "'non_rab_db'", "]", ",", "'-o...
Shrink the non-Rab DB size by reducing sequence redundancy.
[ "Shrink", "the", "non", "-", "Rab", "DB", "size", "by", "reducing", "sequence", "redundancy", "." ]
a5be3d516517e555bde463b94f06aeed106d19b8
https://github.com/evocell/rabifier/blob/a5be3d516517e555bde463b94f06aeed106d19b8/rabifier/core.py#L433-L440
train
56,683
slickqa/python-client
slickqa/micromodels/packages/PySO8601/durations.py
parse_duration
def parse_duration(duration): """Attepmts to parse an ISO8601 formatted ``duration``. Returns a ``datetime.timedelta`` object. """ duration = str(duration).upper().strip() elements = ELEMENTS.copy() for pattern in (SIMPLE_DURATION, COMBINED_DURATION): if pattern.match(duration): ...
python
def parse_duration(duration): """Attepmts to parse an ISO8601 formatted ``duration``. Returns a ``datetime.timedelta`` object. """ duration = str(duration).upper().strip() elements = ELEMENTS.copy() for pattern in (SIMPLE_DURATION, COMBINED_DURATION): if pattern.match(duration): ...
[ "def", "parse_duration", "(", "duration", ")", ":", "duration", "=", "str", "(", "duration", ")", ".", "upper", "(", ")", ".", "strip", "(", ")", "elements", "=", "ELEMENTS", ".", "copy", "(", ")", "for", "pattern", "in", "(", "SIMPLE_DURATION", ",", ...
Attepmts to parse an ISO8601 formatted ``duration``. Returns a ``datetime.timedelta`` object.
[ "Attepmts", "to", "parse", "an", "ISO8601", "formatted", "duration", "." ]
1d36b4977cd4140d7d24917cab2b3f82b60739c2
https://github.com/slickqa/python-client/blob/1d36b4977cd4140d7d24917cab2b3f82b60739c2/slickqa/micromodels/packages/PySO8601/durations.py#L58-L83
train
56,684
hackedd/gw2api
gw2api/skins.py
skin_details
def skin_details(skin_id, lang="en"): """This resource returns details about a single skin. :param skin_id: The skin to query for. :param lang: The language to display the texts in. The response is an object with at least the following properties. Note that the availability of some properties depe...
python
def skin_details(skin_id, lang="en"): """This resource returns details about a single skin. :param skin_id: The skin to query for. :param lang: The language to display the texts in. The response is an object with at least the following properties. Note that the availability of some properties depe...
[ "def", "skin_details", "(", "skin_id", ",", "lang", "=", "\"en\"", ")", ":", "params", "=", "{", "\"skin_id\"", ":", "skin_id", ",", "\"lang\"", ":", "lang", "}", "cache_name", "=", "\"skin_details.%(skin_id)s.%(lang)s.json\"", "%", "params", "return", "get_cach...
This resource returns details about a single skin. :param skin_id: The skin to query for. :param lang: The language to display the texts in. The response is an object with at least the following properties. Note that the availability of some properties depends on the type of item the skin applies ...
[ "This", "resource", "returns", "details", "about", "a", "single", "skin", "." ]
5543a78e6e3ed0573b7e84c142c44004b4779eac
https://github.com/hackedd/gw2api/blob/5543a78e6e3ed0573b7e84c142c44004b4779eac/gw2api/skins.py#L16-L53
train
56,685
Aluriak/bubble-tools
bubbletools/converter.py
bubble_to_gexf
def bubble_to_gexf(bblfile:str, gexffile:str=None, oriented:bool=False): """Write in bblfile a graph equivalent to those depicted in bubble file""" tree = BubbleTree.from_bubble_file(bblfile, oriented=bool(oriented)) gexf_converter.tree_to_file(tree, gexffile) return gexffile
python
def bubble_to_gexf(bblfile:str, gexffile:str=None, oriented:bool=False): """Write in bblfile a graph equivalent to those depicted in bubble file""" tree = BubbleTree.from_bubble_file(bblfile, oriented=bool(oriented)) gexf_converter.tree_to_file(tree, gexffile) return gexffile
[ "def", "bubble_to_gexf", "(", "bblfile", ":", "str", ",", "gexffile", ":", "str", "=", "None", ",", "oriented", ":", "bool", "=", "False", ")", ":", "tree", "=", "BubbleTree", ".", "from_bubble_file", "(", "bblfile", ",", "oriented", "=", "bool", "(", ...
Write in bblfile a graph equivalent to those depicted in bubble file
[ "Write", "in", "bblfile", "a", "graph", "equivalent", "to", "those", "depicted", "in", "bubble", "file" ]
f014f4a1986abefc80dc418feaa05ed258c2221a
https://github.com/Aluriak/bubble-tools/blob/f014f4a1986abefc80dc418feaa05ed258c2221a/bubbletools/converter.py#L23-L27
train
56,686
Aluriak/bubble-tools
bubbletools/converter.py
bubble_to_js
def bubble_to_js(bblfile:str, jsdir:str=None, oriented:bool=False, **style): """Write in jsdir a graph equivalent to those depicted in bubble file""" js_converter.bubble_to_dir(bblfile, jsdir, oriented=bool(oriented), **style) return jsdir
python
def bubble_to_js(bblfile:str, jsdir:str=None, oriented:bool=False, **style): """Write in jsdir a graph equivalent to those depicted in bubble file""" js_converter.bubble_to_dir(bblfile, jsdir, oriented=bool(oriented), **style) return jsdir
[ "def", "bubble_to_js", "(", "bblfile", ":", "str", ",", "jsdir", ":", "str", "=", "None", ",", "oriented", ":", "bool", "=", "False", ",", "*", "*", "style", ")", ":", "js_converter", ".", "bubble_to_dir", "(", "bblfile", ",", "jsdir", ",", "oriented",...
Write in jsdir a graph equivalent to those depicted in bubble file
[ "Write", "in", "jsdir", "a", "graph", "equivalent", "to", "those", "depicted", "in", "bubble", "file" ]
f014f4a1986abefc80dc418feaa05ed258c2221a
https://github.com/Aluriak/bubble-tools/blob/f014f4a1986abefc80dc418feaa05ed258c2221a/bubbletools/converter.py#L30-L33
train
56,687
Aluriak/bubble-tools
bubbletools/converter.py
tree_to_graph
def tree_to_graph(bbltree:BubbleTree) -> Graph or Digraph: """Compute as a graphviz.Graph instance the given graph. If given BubbleTree instance is oriented, returned value is a graphviz.Digraph. See http://graphviz.readthedocs.io/en/latest/examples.html#cluster-py for graphviz API """ Gr...
python
def tree_to_graph(bbltree:BubbleTree) -> Graph or Digraph: """Compute as a graphviz.Graph instance the given graph. If given BubbleTree instance is oriented, returned value is a graphviz.Digraph. See http://graphviz.readthedocs.io/en/latest/examples.html#cluster-py for graphviz API """ Gr...
[ "def", "tree_to_graph", "(", "bbltree", ":", "BubbleTree", ")", "->", "Graph", "or", "Digraph", ":", "GraphObject", "=", "Digraph", "if", "bbltree", ".", "oriented", "else", "Graph", "def", "create", "(", "name", ":", "str", ")", ":", "\"\"\"Return a graphvi...
Compute as a graphviz.Graph instance the given graph. If given BubbleTree instance is oriented, returned value is a graphviz.Digraph. See http://graphviz.readthedocs.io/en/latest/examples.html#cluster-py for graphviz API
[ "Compute", "as", "a", "graphviz", ".", "Graph", "instance", "the", "given", "graph", "." ]
f014f4a1986abefc80dc418feaa05ed258c2221a
https://github.com/Aluriak/bubble-tools/blob/f014f4a1986abefc80dc418feaa05ed258c2221a/bubbletools/converter.py#L61-L120
train
56,688
trevisanj/a99
a99/parts.py
AttrsPart.to_dict
def to_dict(self): """Returns OrderedDict whose keys are self.attrs""" ret = OrderedDict() for attrname in self.attrs: ret[attrname] = self.__getattribute__(attrname) return ret
python
def to_dict(self): """Returns OrderedDict whose keys are self.attrs""" ret = OrderedDict() for attrname in self.attrs: ret[attrname] = self.__getattribute__(attrname) return ret
[ "def", "to_dict", "(", "self", ")", ":", "ret", "=", "OrderedDict", "(", ")", "for", "attrname", "in", "self", ".", "attrs", ":", "ret", "[", "attrname", "]", "=", "self", ".", "__getattribute__", "(", "attrname", ")", "return", "ret" ]
Returns OrderedDict whose keys are self.attrs
[ "Returns", "OrderedDict", "whose", "keys", "are", "self", ".", "attrs" ]
193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539
https://github.com/trevisanj/a99/blob/193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539/a99/parts.py#L108-L113
train
56,689
trevisanj/a99
a99/parts.py
AttrsPart.to_list
def to_list(self): """Returns list containing values of attributes listed in self.attrs""" ret = OrderedDict() for attrname in self.attrs: ret[attrname] = self.__getattribute__(attrname) return ret
python
def to_list(self): """Returns list containing values of attributes listed in self.attrs""" ret = OrderedDict() for attrname in self.attrs: ret[attrname] = self.__getattribute__(attrname) return ret
[ "def", "to_list", "(", "self", ")", ":", "ret", "=", "OrderedDict", "(", ")", "for", "attrname", "in", "self", ".", "attrs", ":", "ret", "[", "attrname", "]", "=", "self", ".", "__getattribute__", "(", "attrname", ")", "return", "ret" ]
Returns list containing values of attributes listed in self.attrs
[ "Returns", "list", "containing", "values", "of", "attributes", "listed", "in", "self", ".", "attrs" ]
193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539
https://github.com/trevisanj/a99/blob/193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539/a99/parts.py#L115-L121
train
56,690
CodyKochmann/generators
generators/uniq.py
uniq
def uniq(pipe): ''' this works like bash's uniq command where the generator only iterates if the next value is not the previous ''' pipe = iter(pipe) previous = next(pipe) yield previous for i in pipe: if i is not previous: previous = i yield i
python
def uniq(pipe): ''' this works like bash's uniq command where the generator only iterates if the next value is not the previous ''' pipe = iter(pipe) previous = next(pipe) yield previous for i in pipe: if i is not previous: previous = i yield i
[ "def", "uniq", "(", "pipe", ")", ":", "pipe", "=", "iter", "(", "pipe", ")", "previous", "=", "next", "(", "pipe", ")", "yield", "previous", "for", "i", "in", "pipe", ":", "if", "i", "is", "not", "previous", ":", "previous", "=", "i", "yield", "i...
this works like bash's uniq command where the generator only iterates if the next value is not the previous
[ "this", "works", "like", "bash", "s", "uniq", "command", "where", "the", "generator", "only", "iterates", "if", "the", "next", "value", "is", "not", "the", "previous" ]
e4ca4dd25d5023a94b0349c69d6224070cc2526f
https://github.com/CodyKochmann/generators/blob/e4ca4dd25d5023a94b0349c69d6224070cc2526f/generators/uniq.py#L7-L16
train
56,691
herrersystem/apize
apize/http_request.py
send_request
def send_request(url, method, data, args, params, headers, cookies, timeout, is_json, verify_cert): """ Forge and send HTTP request. """ ## Parse url args for p in args: url = url.replace(':' + p, str(args[p])) try: if data: if is_json: headers['Content-Type'] = 'application/json' data = json.du...
python
def send_request(url, method, data, args, params, headers, cookies, timeout, is_json, verify_cert): """ Forge and send HTTP request. """ ## Parse url args for p in args: url = url.replace(':' + p, str(args[p])) try: if data: if is_json: headers['Content-Type'] = 'application/json' data = json.du...
[ "def", "send_request", "(", "url", ",", "method", ",", "data", ",", "args", ",", "params", ",", "headers", ",", "cookies", ",", "timeout", ",", "is_json", ",", "verify_cert", ")", ":", "## Parse url args", "for", "p", "in", "args", ":", "url", "=", "ur...
Forge and send HTTP request.
[ "Forge", "and", "send", "HTTP", "request", "." ]
cf491660f0ee1c89a1e87a574eb8cd3c10257597
https://github.com/herrersystem/apize/blob/cf491660f0ee1c89a1e87a574eb8cd3c10257597/apize/http_request.py#L10-L68
train
56,692
volfpeter/graphscraper
src/graphscraper/base.py
Node.neighbors
def neighbors(self) -> List['Node']: """ The list of neighbors of the node. """ self._load_neighbors() return [edge.source if edge.source != self else edge.target for edge in self._neighbors.values()]
python
def neighbors(self) -> List['Node']: """ The list of neighbors of the node. """ self._load_neighbors() return [edge.source if edge.source != self else edge.target for edge in self._neighbors.values()]
[ "def", "neighbors", "(", "self", ")", "->", "List", "[", "'Node'", "]", ":", "self", ".", "_load_neighbors", "(", ")", "return", "[", "edge", ".", "source", "if", "edge", ".", "source", "!=", "self", "else", "edge", ".", "target", "for", "edge", "in"...
The list of neighbors of the node.
[ "The", "list", "of", "neighbors", "of", "the", "node", "." ]
11d407509956a282ee25190ed6491a162fc0fe7f
https://github.com/volfpeter/graphscraper/blob/11d407509956a282ee25190ed6491a162fc0fe7f/src/graphscraper/base.py#L87-L93
train
56,693
volfpeter/graphscraper
src/graphscraper/base.py
Node._load_neighbors
def _load_neighbors(self) -> None: """ Loads all neighbors of the node from the local database and from the external data source if needed. """ if not self.are_neighbors_cached: self._load_neighbors_from_external_source() db: GraphDatabaseInterface ...
python
def _load_neighbors(self) -> None: """ Loads all neighbors of the node from the local database and from the external data source if needed. """ if not self.are_neighbors_cached: self._load_neighbors_from_external_source() db: GraphDatabaseInterface ...
[ "def", "_load_neighbors", "(", "self", ")", "->", "None", ":", "if", "not", "self", ".", "are_neighbors_cached", ":", "self", ".", "_load_neighbors_from_external_source", "(", ")", "db", ":", "GraphDatabaseInterface", "=", "self", ".", "_graph", ".", "database",...
Loads all neighbors of the node from the local database and from the external data source if needed.
[ "Loads", "all", "neighbors", "of", "the", "node", "from", "the", "local", "database", "and", "from", "the", "external", "data", "source", "if", "needed", "." ]
11d407509956a282ee25190ed6491a162fc0fe7f
https://github.com/volfpeter/graphscraper/blob/11d407509956a282ee25190ed6491a162fc0fe7f/src/graphscraper/base.py#L127-L140
train
56,694
volfpeter/graphscraper
src/graphscraper/base.py
Node._load_neighbors_from_database
def _load_neighbors_from_database(self) -> None: """ Loads the neighbors of the node from the local database. """ self._are_neighbors_loaded = True graph: Graph = self._graph neighbors: List[DBNode] = graph.database.Node.find_by_name(self.name).neighbors ...
python
def _load_neighbors_from_database(self) -> None: """ Loads the neighbors of the node from the local database. """ self._are_neighbors_loaded = True graph: Graph = self._graph neighbors: List[DBNode] = graph.database.Node.find_by_name(self.name).neighbors ...
[ "def", "_load_neighbors_from_database", "(", "self", ")", "->", "None", ":", "self", ".", "_are_neighbors_loaded", "=", "True", "graph", ":", "Graph", "=", "self", ".", "_graph", "neighbors", ":", "List", "[", "DBNode", "]", "=", "graph", ".", "database", ...
Loads the neighbors of the node from the local database.
[ "Loads", "the", "neighbors", "of", "the", "node", "from", "the", "local", "database", "." ]
11d407509956a282ee25190ed6491a162fc0fe7f
https://github.com/volfpeter/graphscraper/blob/11d407509956a282ee25190ed6491a162fc0fe7f/src/graphscraper/base.py#L142-L155
train
56,695
volfpeter/graphscraper
src/graphscraper/base.py
Edge.key
def key(self) -> Tuple[int, int]: """ The unique identifier of the edge consisting of the indexes of its source and target nodes. """ return self._source.index, self._target.index
python
def key(self) -> Tuple[int, int]: """ The unique identifier of the edge consisting of the indexes of its source and target nodes. """ return self._source.index, self._target.index
[ "def", "key", "(", "self", ")", "->", "Tuple", "[", "int", ",", "int", "]", ":", "return", "self", ".", "_source", ".", "index", ",", "self", ".", "_target", ".", "index" ]
The unique identifier of the edge consisting of the indexes of its source and target nodes.
[ "The", "unique", "identifier", "of", "the", "edge", "consisting", "of", "the", "indexes", "of", "its", "source", "and", "target", "nodes", "." ]
11d407509956a282ee25190ed6491a162fc0fe7f
https://github.com/volfpeter/graphscraper/blob/11d407509956a282ee25190ed6491a162fc0fe7f/src/graphscraper/base.py#L207-L212
train
56,696
volfpeter/graphscraper
src/graphscraper/base.py
EdgeList.edge_list
def edge_list(self) -> List[Edge]: """ The ordered list of edges in the container. """ return [edge for edge in sorted(self._edges.values(), key=attrgetter("key"))]
python
def edge_list(self) -> List[Edge]: """ The ordered list of edges in the container. """ return [edge for edge in sorted(self._edges.values(), key=attrgetter("key"))]
[ "def", "edge_list", "(", "self", ")", "->", "List", "[", "Edge", "]", ":", "return", "[", "edge", "for", "edge", "in", "sorted", "(", "self", ".", "_edges", ".", "values", "(", ")", ",", "key", "=", "attrgetter", "(", "\"key\"", ")", ")", "]" ]
The ordered list of edges in the container.
[ "The", "ordered", "list", "of", "edges", "in", "the", "container", "." ]
11d407509956a282ee25190ed6491a162fc0fe7f
https://github.com/volfpeter/graphscraper/blob/11d407509956a282ee25190ed6491a162fc0fe7f/src/graphscraper/base.py#L489-L493
train
56,697
thespacedoctor/fundamentals
fundamentals/nose2_plugins/cprof.py
Profiler.beforeSummaryReport
def beforeSummaryReport(self, event): '''Output profiling results''' self.prof.disable() stats = pstats.Stats(self.prof, stream=event.stream).sort_stats( self.sort) event.stream.writeln(nose2.util.ln('Profiling results')) stats.print_stats() if self.pfile: ...
python
def beforeSummaryReport(self, event): '''Output profiling results''' self.prof.disable() stats = pstats.Stats(self.prof, stream=event.stream).sort_stats( self.sort) event.stream.writeln(nose2.util.ln('Profiling results')) stats.print_stats() if self.pfile: ...
[ "def", "beforeSummaryReport", "(", "self", ",", "event", ")", ":", "self", ".", "prof", ".", "disable", "(", ")", "stats", "=", "pstats", ".", "Stats", "(", "self", ".", "prof", ",", "stream", "=", "event", ".", "stream", ")", ".", "sort_stats", "(",...
Output profiling results
[ "Output", "profiling", "results" ]
1d2c007ac74442ec2eabde771cfcacdb9c1ab382
https://github.com/thespacedoctor/fundamentals/blob/1d2c007ac74442ec2eabde771cfcacdb9c1ab382/fundamentals/nose2_plugins/cprof.py#L37-L47
train
56,698
NickMonzillo/SmartCloud
SmartCloud/wordplay.py
separate
def separate(text): '''Takes text and separates it into a list of words''' alphabet = 'abcdefghijklmnopqrstuvwxyz' words = text.split() standardwords = [] for word in words: newstr = '' for char in word: if char in alphabet or char in alphabet.upper(): news...
python
def separate(text): '''Takes text and separates it into a list of words''' alphabet = 'abcdefghijklmnopqrstuvwxyz' words = text.split() standardwords = [] for word in words: newstr = '' for char in word: if char in alphabet or char in alphabet.upper(): news...
[ "def", "separate", "(", "text", ")", ":", "alphabet", "=", "'abcdefghijklmnopqrstuvwxyz'", "words", "=", "text", ".", "split", "(", ")", "standardwords", "=", "[", "]", "for", "word", "in", "words", ":", "newstr", "=", "''", "for", "char", "in", "word", ...
Takes text and separates it into a list of words
[ "Takes", "text", "and", "separates", "it", "into", "a", "list", "of", "words" ]
481d1ef428427b452a8a787999c1d4a8868a3824
https://github.com/NickMonzillo/SmartCloud/blob/481d1ef428427b452a8a787999c1d4a8868a3824/SmartCloud/wordplay.py#L1-L13
train
56,699