repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
sbusard/wagoner
wagoner/table.py
Table.check
def check(self): """ Check that this table is complete, that is, every character of this table can be followed by a new character. :return: True if the table is complete, False otherwise. """ for character, followers in self.items(): for follower in followers...
python
def check(self): """ Check that this table is complete, that is, every character of this table can be followed by a new character. :return: True if the table is complete, False otherwise. """ for character, followers in self.items(): for follower in followers...
[ "def", "check", "(", "self", ")", ":", "for", "character", ",", "followers", "in", "self", ".", "items", "(", ")", ":", "for", "follower", "in", "followers", ":", "if", "follower", "not", "in", "self", ":", "return", "False", "return", "True" ]
Check that this table is complete, that is, every character of this table can be followed by a new character. :return: True if the table is complete, False otherwise.
[ "Check", "that", "this", "table", "is", "complete", "that", "is", "every", "character", "of", "this", "table", "can", "be", "followed", "by", "a", "new", "character", "." ]
train
https://github.com/sbusard/wagoner/blob/7f83d66bbd0e009e4d4232ffdf319bd5a2a5683b/wagoner/table.py#L81-L92
sbusard/wagoner
wagoner/table.py
Table.weighted_choices
def weighted_choices(self, word, exclude=None, flatten=False): """ Return the weighted choices for word from this table. :param word: the word (as a string); :param exclude: if not None, a set of characters to exclude from the weighted choices; :p...
python
def weighted_choices(self, word, exclude=None, flatten=False): """ Return the weighted choices for word from this table. :param word: the word (as a string); :param exclude: if not None, a set of characters to exclude from the weighted choices; :p...
[ "def", "weighted_choices", "(", "self", ",", "word", ",", "exclude", "=", "None", ",", "flatten", "=", "False", ")", ":", "exclude", "=", "exclude", "if", "exclude", "is", "not", "None", "else", "set", "(", ")", "weighted_choices", "=", "defaultdict", "(...
Return the weighted choices for word from this table. :param word: the word (as a string); :param exclude: if not None, a set of characters to exclude from the weighted choices; :param flatten: whether or not consider this table as flattened; :return: the...
[ "Return", "the", "weighted", "choices", "for", "word", "from", "this", "table", ".", ":", "param", "word", ":", "the", "word", "(", "as", "a", "string", ")", ";", ":", "param", "exclude", ":", "if", "not", "None", "a", "set", "of", "characters", "to"...
train
https://github.com/sbusard/wagoner/blob/7f83d66bbd0e009e4d4232ffdf319bd5a2a5683b/wagoner/table.py#L94-L127
sbusard/wagoner
wagoner/table.py
Table.random_word
def random_word(self, length, prefix=0, start=False, end=False, flatten=False): """ Generate a random word of length from this table. :param length: the length of the generated word; >= 1; :param prefix: if greater than 0, the maximum length of the prefix to ...
python
def random_word(self, length, prefix=0, start=False, end=False, flatten=False): """ Generate a random word of length from this table. :param length: the length of the generated word; >= 1; :param prefix: if greater than 0, the maximum length of the prefix to ...
[ "def", "random_word", "(", "self", ",", "length", ",", "prefix", "=", "0", ",", "start", "=", "False", ",", "end", "=", "False", ",", "flatten", "=", "False", ")", ":", "if", "start", ":", "word", "=", "\">\"", "length", "+=", "1", "return", "self"...
Generate a random word of length from this table. :param length: the length of the generated word; >= 1; :param prefix: if greater than 0, the maximum length of the prefix to consider to choose the next character; :param start: if True, the generated word starts as a word...
[ "Generate", "a", "random", "word", "of", "length", "from", "this", "table", "." ]
train
https://github.com/sbusard/wagoner/blob/7f83d66bbd0e009e4d4232ffdf319bd5a2a5683b/wagoner/table.py#L129-L157
sbusard/wagoner
wagoner/table.py
Table._extend_word
def _extend_word(self, word, length, prefix=0, end=False, flatten=False): """ Extend the given word with a random suffix up to length. :param length: the length of the extended word; >= len(word); :param prefix: if greater than 0, the maximum length of the prefix to ...
python
def _extend_word(self, word, length, prefix=0, end=False, flatten=False): """ Extend the given word with a random suffix up to length. :param length: the length of the extended word; >= len(word); :param prefix: if greater than 0, the maximum length of the prefix to ...
[ "def", "_extend_word", "(", "self", ",", "word", ",", "length", ",", "prefix", "=", "0", ",", "end", "=", "False", ",", "flatten", "=", "False", ")", ":", "if", "len", "(", "word", ")", "==", "length", ":", "if", "end", "and", "\"<\"", "not", "in...
Extend the given word with a random suffix up to length. :param length: the length of the extended word; >= len(word); :param prefix: if greater than 0, the maximum length of the prefix to consider to choose the next character; :param end: if True, the generated word ends...
[ "Extend", "the", "given", "word", "with", "a", "random", "suffix", "up", "to", "length", "." ]
train
https://github.com/sbusard/wagoner/blob/7f83d66bbd0e009e4d4232ffdf319bd5a2a5683b/wagoner/table.py#L159-L196
exekias/droplet
droplet/util.py
import_module
def import_module(module_path): """ Try to import and return the given module, if it exists, None if it doesn't exist :raises ImportError: When imported module contains errors """ if six.PY2: try: return importlib.import_module(module_path) except ImportError: ...
python
def import_module(module_path): """ Try to import and return the given module, if it exists, None if it doesn't exist :raises ImportError: When imported module contains errors """ if six.PY2: try: return importlib.import_module(module_path) except ImportError: ...
[ "def", "import_module", "(", "module_path", ")", ":", "if", "six", ".", "PY2", ":", "try", ":", "return", "importlib", ".", "import_module", "(", "module_path", ")", "except", "ImportError", ":", "tb", "=", "sys", ".", "exc_info", "(", ")", "[", "2", "...
Try to import and return the given module, if it exists, None if it doesn't exist :raises ImportError: When imported module contains errors
[ "Try", "to", "import", "and", "return", "the", "given", "module", "if", "it", "exists", "None", "if", "it", "doesn", "t", "exist" ]
train
https://github.com/exekias/droplet/blob/aeac573a2c1c4b774e99d5414a1c79b1bb734941/droplet/util.py#L28-L46
exekias/droplet
droplet/util.py
make_password
def make_password(length, chars=string.letters + string.digits + '#$%&!'): """ Generate and return a random password :param length: Desired length :param chars: Character set to use """ return get_random_string(length, chars)
python
def make_password(length, chars=string.letters + string.digits + '#$%&!'): """ Generate and return a random password :param length: Desired length :param chars: Character set to use """ return get_random_string(length, chars)
[ "def", "make_password", "(", "length", ",", "chars", "=", "string", ".", "letters", "+", "string", ".", "digits", "+", "'#$%&!'", ")", ":", "return", "get_random_string", "(", "length", ",", "chars", ")" ]
Generate and return a random password :param length: Desired length :param chars: Character set to use
[ "Generate", "and", "return", "a", "random", "password" ]
train
https://github.com/exekias/droplet/blob/aeac573a2c1c4b774e99d5414a1c79b1bb734941/droplet/util.py#L49-L56
tdeck/rodong
rodong.py
RodongSinmun.__load_section
def __load_section(self, section_key): """ Reads the set of article links for a section if they are not cached. """ if self._sections[section_key] is not None: return articles = [] for page in count(1): if page > 50: raise Exception('Last page...
python
def __load_section(self, section_key): """ Reads the set of article links for a section if they are not cached. """ if self._sections[section_key] is not None: return articles = [] for page in count(1): if page > 50: raise Exception('Last page...
[ "def", "__load_section", "(", "self", ",", "section_key", ")", ":", "if", "self", ".", "_sections", "[", "section_key", "]", "is", "not", "None", ":", "return", "articles", "=", "[", "]", "for", "page", "in", "count", "(", "1", ")", ":", "if", "page"...
Reads the set of article links for a section if they are not cached.
[ "Reads", "the", "set", "of", "article", "links", "for", "a", "section", "if", "they", "are", "not", "cached", "." ]
train
https://github.com/tdeck/rodong/blob/6247148e585ee323925cefb2494e9833e138e293/rodong.py#L36-L80
tdeck/rodong
rodong.py
Article.__load
def __load(self): """ Loads text and photos if they are not cached. """ if self._text is not None: return body = self._session.get(self.url).content root = html.fromstring(body) self._text = "\n".join(( p_tag.text_content() for p_tag in root.findall('...
python
def __load(self): """ Loads text and photos if they are not cached. """ if self._text is not None: return body = self._session.get(self.url).content root = html.fromstring(body) self._text = "\n".join(( p_tag.text_content() for p_tag in root.findall('...
[ "def", "__load", "(", "self", ")", ":", "if", "self", ".", "_text", "is", "not", "None", ":", "return", "body", "=", "self", ".", "_session", ".", "get", "(", "self", ".", "url", ")", ".", "content", "root", "=", "html", ".", "fromstring", "(", "...
Loads text and photos if they are not cached.
[ "Loads", "text", "and", "photos", "if", "they", "are", "not", "cached", "." ]
train
https://github.com/tdeck/rodong/blob/6247148e585ee323925cefb2494e9833e138e293/rodong.py#L100-L113
mgagne/wafflehaus.iweb
wafflehaus/iweb/glance/image_filter/visible.py
filter_factory
def filter_factory(global_conf, **local_conf): """Returns a WSGI filter app for use with paste.deploy.""" conf = global_conf.copy() conf.update(local_conf) def visible(app): return VisibleFilter(app, conf) return visible
python
def filter_factory(global_conf, **local_conf): """Returns a WSGI filter app for use with paste.deploy.""" conf = global_conf.copy() conf.update(local_conf) def visible(app): return VisibleFilter(app, conf) return visible
[ "def", "filter_factory", "(", "global_conf", ",", "*", "*", "local_conf", ")", ":", "conf", "=", "global_conf", ".", "copy", "(", ")", "conf", ".", "update", "(", "local_conf", ")", "def", "visible", "(", "app", ")", ":", "return", "VisibleFilter", "(", ...
Returns a WSGI filter app for use with paste.deploy.
[ "Returns", "a", "WSGI", "filter", "app", "for", "use", "with", "paste", ".", "deploy", "." ]
train
https://github.com/mgagne/wafflehaus.iweb/blob/8ac625582c1180391fe022d1db19f70a2dfb376a/wafflehaus/iweb/glance/image_filter/visible.py#L94-L101
mgagne/wafflehaus.iweb
wafflehaus/iweb/glance/image_filter/visible.py
VisibleFilter._is_whitelisted
def _is_whitelisted(self, req): """Return True if role is whitelisted or roles cannot be determined.""" if not self.roles_whitelist: return False if not hasattr(req, 'context'): self.log.info("No context found.") return False if not hasattr(req.cont...
python
def _is_whitelisted(self, req): """Return True if role is whitelisted or roles cannot be determined.""" if not self.roles_whitelist: return False if not hasattr(req, 'context'): self.log.info("No context found.") return False if not hasattr(req.cont...
[ "def", "_is_whitelisted", "(", "self", ",", "req", ")", ":", "if", "not", "self", ".", "roles_whitelist", ":", "return", "False", "if", "not", "hasattr", "(", "req", ",", "'context'", ")", ":", "self", ".", "log", ".", "info", "(", "\"No context found.\"...
Return True if role is whitelisted or roles cannot be determined.
[ "Return", "True", "if", "role", "is", "whitelisted", "or", "roles", "cannot", "be", "determined", "." ]
train
https://github.com/mgagne/wafflehaus.iweb/blob/8ac625582c1180391fe022d1db19f70a2dfb376a/wafflehaus/iweb/glance/image_filter/visible.py#L55-L77
tBaxter/django-fretboard
fretboard/views/crud.py
add_topic
def add_topic(request, forum_slug=None): """ Adds a topic to a given forum """ forum = Forum.objects.get(slug=forum_slug) form = AddTopicForm(request.POST or None, request.FILES or None, initial={'forum': forum}) current_time = time.time() user = request.user if form.is_valid(): ...
python
def add_topic(request, forum_slug=None): """ Adds a topic to a given forum """ forum = Forum.objects.get(slug=forum_slug) form = AddTopicForm(request.POST or None, request.FILES or None, initial={'forum': forum}) current_time = time.time() user = request.user if form.is_valid(): ...
[ "def", "add_topic", "(", "request", ",", "forum_slug", "=", "None", ")", ":", "forum", "=", "Forum", ".", "objects", ".", "get", "(", "slug", "=", "forum_slug", ")", "form", "=", "AddTopicForm", "(", "request", ".", "POST", "or", "None", ",", "request"...
Adds a topic to a given forum
[ "Adds", "a", "topic", "to", "a", "given", "forum" ]
train
https://github.com/tBaxter/django-fretboard/blob/3c3f9557089821283f315a07f3e5a57a2725ab3b/fretboard/views/crud.py#L19-L56
tBaxter/django-fretboard
fretboard/views/crud.py
add_post
def add_post(request, t_slug, t_id, p_id = False): # topic slug, topic id, post id """ Creates a new post and attaches it to a topic """ topic = get_object_or_404(Topic, id=t_id) topic_url = '{0}page{1}/'.format(topic.get_short_url(), topic.page_count) user = request.user current_t...
python
def add_post(request, t_slug, t_id, p_id = False): # topic slug, topic id, post id """ Creates a new post and attaches it to a topic """ topic = get_object_or_404(Topic, id=t_id) topic_url = '{0}page{1}/'.format(topic.get_short_url(), topic.page_count) user = request.user current_t...
[ "def", "add_post", "(", "request", ",", "t_slug", ",", "t_id", ",", "p_id", "=", "False", ")", ":", "# topic slug, topic id, post id", "topic", "=", "get_object_or_404", "(", "Topic", ",", "id", "=", "t_id", ")", "topic_url", "=", "'{0}page{1}/'", ".", "form...
Creates a new post and attaches it to a topic
[ "Creates", "a", "new", "post", "and", "attaches", "it", "to", "a", "topic" ]
train
https://github.com/tBaxter/django-fretboard/blob/3c3f9557089821283f315a07f3e5a57a2725ab3b/fretboard/views/crud.py#L60-L104
tBaxter/django-fretboard
fretboard/views/crud.py
edit_post
def edit_post(request, post_id): """ Allows user to edit an existing post. This needs to be rewritten. Badly. """ post = get_object_or_404(Post, id=post_id) user = request.user topic = post.topic # oughta build a get_absolute_url method for this, maybe. post_url = '{0}page{1}/#...
python
def edit_post(request, post_id): """ Allows user to edit an existing post. This needs to be rewritten. Badly. """ post = get_object_or_404(Post, id=post_id) user = request.user topic = post.topic # oughta build a get_absolute_url method for this, maybe. post_url = '{0}page{1}/#...
[ "def", "edit_post", "(", "request", ",", "post_id", ")", ":", "post", "=", "get_object_or_404", "(", "Post", ",", "id", "=", "post_id", ")", "user", "=", "request", ".", "user", "topic", "=", "post", ".", "topic", "# oughta build a get_absolute_url method for ...
Allows user to edit an existing post. This needs to be rewritten. Badly.
[ "Allows", "user", "to", "edit", "an", "existing", "post", ".", "This", "needs", "to", "be", "rewritten", ".", "Badly", "." ]
train
https://github.com/tBaxter/django-fretboard/blob/3c3f9557089821283f315a07f3e5a57a2725ab3b/fretboard/views/crud.py#L108-L150
tBaxter/django-fretboard
fretboard/views/crud.py
delete_post
def delete_post(request, post_id, topic_id): """ Deletes a post, if the user has correct permissions. Also updates topic.post_count """ try: topic = Topic.objects.get(id=topic_id) post = Post.objects.get(id=post_id) except: messages.error(request, 'Sorry, but this post ca...
python
def delete_post(request, post_id, topic_id): """ Deletes a post, if the user has correct permissions. Also updates topic.post_count """ try: topic = Topic.objects.get(id=topic_id) post = Post.objects.get(id=post_id) except: messages.error(request, 'Sorry, but this post ca...
[ "def", "delete_post", "(", "request", ",", "post_id", ",", "topic_id", ")", ":", "try", ":", "topic", "=", "Topic", ".", "objects", ".", "get", "(", "id", "=", "topic_id", ")", "post", "=", "Post", ".", "objects", ".", "get", "(", "id", "=", "post_...
Deletes a post, if the user has correct permissions. Also updates topic.post_count
[ "Deletes", "a", "post", "if", "the", "user", "has", "correct", "permissions", ".", "Also", "updates", "topic", ".", "post_count" ]
train
https://github.com/tBaxter/django-fretboard/blob/3c3f9557089821283f315a07f3e5a57a2725ab3b/fretboard/views/crud.py#L153-L178
elkan1788/ppytools
ppytools/ip2location2.py
IP2Location.memorySearch
def memorySearch(self, ip): """ " memory search method " param: ip """ if not ip.isdigit(): ip = self.ip2Long(ip) if self.__dbBinStr == '': self.__dbBinStr = self.__f.read() #read all the contents in file self.__sPtr = self.getLong(self.__dbBi...
python
def memorySearch(self, ip): """ " memory search method " param: ip """ if not ip.isdigit(): ip = self.ip2Long(ip) if self.__dbBinStr == '': self.__dbBinStr = self.__f.read() #read all the contents in file self.__sPtr = self.getLong(self.__dbBi...
[ "def", "memorySearch", "(", "self", ",", "ip", ")", ":", "if", "not", "ip", ".", "isdigit", "(", ")", ":", "ip", "=", "self", ".", "ip2Long", "(", "ip", ")", "if", "self", ".", "__dbBinStr", "==", "''", ":", "self", ".", "__dbBinStr", "=", "self"...
" memory search method " param: ip
[ "memory", "search", "method", "param", ":", "ip" ]
train
https://github.com/elkan1788/ppytools/blob/117aeed9f669ae46e0dd6cb11c5687a5f797816c/ppytools/ip2location2.py#L30-L66
elkan1788/ppytools
ppytools/ip2location2.py
IP2Location.binarySearch
def binarySearch(self, ip): """ " binary search method " param: ip """ if not ip.isdigit(): ip = self.ip2Long(ip) if self.__indexLen < 1: self.__f.seek(0) b = self.__f.read(8) self.__sPtr = self.getLong(b, 0) endPtr = ...
python
def binarySearch(self, ip): """ " binary search method " param: ip """ if not ip.isdigit(): ip = self.ip2Long(ip) if self.__indexLen < 1: self.__f.seek(0) b = self.__f.read(8) self.__sPtr = self.getLong(b, 0) endPtr = ...
[ "def", "binarySearch", "(", "self", ",", "ip", ")", ":", "if", "not", "ip", ".", "isdigit", "(", ")", ":", "ip", "=", "self", ".", "ip2Long", "(", "ip", ")", "if", "self", ".", "__indexLen", "<", "1", ":", "self", ".", "__f", ".", "seek", "(", ...
" binary search method " param: ip
[ "binary", "search", "method", "param", ":", "ip" ]
train
https://github.com/elkan1788/ppytools/blob/117aeed9f669ae46e0dd6cb11c5687a5f797816c/ppytools/ip2location2.py#L68-L109
elkan1788/ppytools
ppytools/ip2location2.py
IP2Location.btreeSearch
def btreeSearch(self, ip): """ " b-tree search method " param: ip """ if not ip.isdigit(): ip = self.ip2Long(ip) if len(self.__headerSip) < 1: #pass the super block self.__f.seek(8) #read the header block b = self.__f.read(...
python
def btreeSearch(self, ip): """ " b-tree search method " param: ip """ if not ip.isdigit(): ip = self.ip2Long(ip) if len(self.__headerSip) < 1: #pass the super block self.__f.seek(8) #read the header block b = self.__f.read(...
[ "def", "btreeSearch", "(", "self", ",", "ip", ")", ":", "if", "not", "ip", ".", "isdigit", "(", ")", ":", "ip", "=", "self", ".", "ip2Long", "(", "ip", ")", "if", "len", "(", "self", ".", "__headerSip", ")", "<", "1", ":", "#pass the super block", ...
" b-tree search method " param: ip
[ "b", "-", "tree", "search", "method", "param", ":", "ip" ]
train
https://github.com/elkan1788/ppytools/blob/117aeed9f669ae46e0dd6cb11c5687a5f797816c/ppytools/ip2location2.py#L111-L194
elkan1788/ppytools
ppytools/ip2location2.py
IP2Location.initDatabase
def initDatabase(self, db_file): """ " initialize the database for search " param: dbFile """ try: self.__f = io.open(db_file, "rb") except IOError, e: print "[Error]: ", e sys.exit()
python
def initDatabase(self, db_file): """ " initialize the database for search " param: dbFile """ try: self.__f = io.open(db_file, "rb") except IOError, e: print "[Error]: ", e sys.exit()
[ "def", "initDatabase", "(", "self", ",", "db_file", ")", ":", "try", ":", "self", ".", "__f", "=", "io", ".", "open", "(", "db_file", ",", "\"rb\"", ")", "except", "IOError", ",", "e", ":", "print", "\"[Error]: \"", ",", "e", "sys", ".", "exit", "(...
" initialize the database for search " param: dbFile
[ "initialize", "the", "database", "for", "search", "param", ":", "dbFile" ]
train
https://github.com/elkan1788/ppytools/blob/117aeed9f669ae46e0dd6cb11c5687a5f797816c/ppytools/ip2location2.py#L196-L205
elkan1788/ppytools
ppytools/ip2location2.py
IP2Location.returnData
def returnData(self, dsptr): """ " get ip data from db file by data start ptr " param: dsptr """ dataPtr = dsptr & 0x00FFFFFFL dataLen = (dsptr >> 24) & 0xFF self.__f.seek(dataPtr) data = self.__f.read(dataLen) result = data[4:].split('|') ...
python
def returnData(self, dsptr): """ " get ip data from db file by data start ptr " param: dsptr """ dataPtr = dsptr & 0x00FFFFFFL dataLen = (dsptr >> 24) & 0xFF self.__f.seek(dataPtr) data = self.__f.read(dataLen) result = data[4:].split('|') ...
[ "def", "returnData", "(", "self", ",", "dsptr", ")", ":", "dataPtr", "=", "dsptr", "&", "0x00FFFFFFL", "dataLen", "=", "(", "dsptr", ">>", "24", ")", "&", "0xFF", "self", ".", "__f", ".", "seek", "(", "dataPtr", ")", "data", "=", "self", ".", "__f"...
" get ip data from db file by data start ptr " param: dsptr
[ "get", "ip", "data", "from", "db", "file", "by", "data", "start", "ptr", "param", ":", "dsptr" ]
train
https://github.com/elkan1788/ppytools/blob/117aeed9f669ae46e0dd6cb11c5687a5f797816c/ppytools/ip2location2.py#L207-L221
20c/twentyc.tools
twentyc/tools/syslogfix.py
UTFFixedSysLogHandler.emit
def emit(self, record): """ Emit a record. The record is formatted, and then sent to the syslog server. If exception information is present, it is NOT sent to the server. """ msg = self.format(record) + '\000' """ We need to convert record level to lowercase, maybe this will change in the future. ...
python
def emit(self, record): """ Emit a record. The record is formatted, and then sent to the syslog server. If exception information is present, it is NOT sent to the server. """ msg = self.format(record) + '\000' """ We need to convert record level to lowercase, maybe this will change in the future. ...
[ "def", "emit", "(", "self", ",", "record", ")", ":", "msg", "=", "self", ".", "format", "(", "record", ")", "+", "'\\000'", "\"\"\"\n\t\tWe need to convert record level to lowercase, maybe this will\n\t\tchange in the future.\n\t\t\"\"\"", "prio", "=", "'<%d>'", "%", "s...
Emit a record. The record is formatted, and then sent to the syslog server. If exception information is present, it is NOT sent to the server.
[ "Emit", "a", "record", ".", "The", "record", "is", "formatted", "and", "then", "sent", "to", "the", "syslog", "server", ".", "If", "exception", "information", "is", "present", "it", "is", "NOT", "sent", "to", "the", "server", "." ]
train
https://github.com/20c/twentyc.tools/blob/f8f681e64f58d449bfc32646ba8bcc57db90a233/twentyc/tools/syslogfix.py#L21-L55
ulf1/oxyba
oxyba/jackknife_loop.py
jackknife_loop
def jackknife_loop(func, data, d=1, combolimit=int(1e6)): """Generic Jackknife Subsampling procedure func : function A function pointer to a python function that - accept an <Observations x Features> matrix as input variable, and - returns an array/list or scalar value as ...
python
def jackknife_loop(func, data, d=1, combolimit=int(1e6)): """Generic Jackknife Subsampling procedure func : function A function pointer to a python function that - accept an <Observations x Features> matrix as input variable, and - returns an array/list or scalar value as ...
[ "def", "jackknife_loop", "(", "func", ",", "data", ",", "d", "=", "1", ",", "combolimit", "=", "int", "(", "1e6", ")", ")", ":", "# load modules", "import", "scipy", ".", "special", "import", "warnings", "import", "itertools", "import", "numpy", "as", "n...
Generic Jackknife Subsampling procedure func : function A function pointer to a python function that - accept an <Observations x Features> matrix as input variable, and - returns an array/list or scalar value as estimate, metric, model parameter, jackknif...
[ "Generic", "Jackknife", "Subsampling", "procedure" ]
train
https://github.com/ulf1/oxyba/blob/b3043116050de275124365cb11e7df91fb40169d/oxyba/jackknife_loop.py#L2-L106
edeposit/edeposit.amqp.antivirus
src/edeposit/amqp/antivirus/__init__.py
reactToAMQPMessage
def reactToAMQPMessage(message, send_back): """ React to given (AMQP) message. `message` is expected to be :py:func:`collections.namedtuple` structure from :mod:`.structures` filled with all necessary data. Args: message (object): One of the request objects defined in ...
python
def reactToAMQPMessage(message, send_back): """ React to given (AMQP) message. `message` is expected to be :py:func:`collections.namedtuple` structure from :mod:`.structures` filled with all necessary data. Args: message (object): One of the request objects defined in ...
[ "def", "reactToAMQPMessage", "(", "message", ",", "send_back", ")", ":", "if", "_instanceof", "(", "message", ",", "structures", ".", "ScanFile", ")", ":", "result", "=", "antivirus", ".", "save_and_scan", "(", "message", ".", "filename", ",", "message", "."...
React to given (AMQP) message. `message` is expected to be :py:func:`collections.namedtuple` structure from :mod:`.structures` filled with all necessary data. Args: message (object): One of the request objects defined in :mod:`.structures`. send_back (fn reference)...
[ "React", "to", "given", "(", "AMQP", ")", "message", ".", "message", "is", "expected", "to", "be", ":", "py", ":", "func", ":", "collections", ".", "namedtuple", "structure", "from", ":", "mod", ":", ".", "structures", "filled", "with", "all", "necessary...
train
https://github.com/edeposit/edeposit.amqp.antivirus/blob/011b38bbe920819fab99a5891b1e70732321a598/src/edeposit/amqp/antivirus/__init__.py#L24-L58
jmgilman/Neolib
neolib/shop/ShopWizard.py
ShopWizard.search
def search(usr, item, area = "shop", scope = "exact", min = "0", max = "99999"): """ Searches the shop wizard for the given item, returns result Uses the given parameters to send a search request with the Shop Wizard. Automatically parses the search results into individual items and app...
python
def search(usr, item, area = "shop", scope = "exact", min = "0", max = "99999"): """ Searches the shop wizard for the given item, returns result Uses the given parameters to send a search request with the Shop Wizard. Automatically parses the search results into individual items and app...
[ "def", "search", "(", "usr", ",", "item", ",", "area", "=", "\"shop\"", ",", "scope", "=", "\"exact\"", ",", "min", "=", "\"0\"", ",", "max", "=", "\"99999\"", ")", ":", "if", "not", "usr", ":", "raise", "invalidUser", "if", "not", "item", ":", "ra...
Searches the shop wizard for the given item, returns result Uses the given parameters to send a search request with the Shop Wizard. Automatically parses the search results into individual items and appends them to and returns a ShopWizardResult. Parameters: ...
[ "Searches", "the", "shop", "wizard", "for", "the", "given", "item", "returns", "result", "Uses", "the", "given", "parameters", "to", "send", "a", "search", "request", "with", "the", "Shop", "Wizard", ".", "Automatically", "parses", "the", "search", "results", ...
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/shop/ShopWizard.py#L56-L130
jmgilman/Neolib
neolib/shop/ShopWizard.py
ShopWizard.price
def price(usr, item, searches = 2, method = "AVERAGE", deduct = 0): """ Searches the shop wizard for given item and determines price with given method Searches the shop wizard x times (x being number given in searches) for the given item and collects the lowest price from each result. U...
python
def price(usr, item, searches = 2, method = "AVERAGE", deduct = 0): """ Searches the shop wizard for given item and determines price with given method Searches the shop wizard x times (x being number given in searches) for the given item and collects the lowest price from each result. U...
[ "def", "price", "(", "usr", ",", "item", ",", "searches", "=", "2", ",", "method", "=", "\"AVERAGE\"", ",", "deduct", "=", "0", ")", ":", "if", "not", "method", "in", "ShopWizard", ".", "methods", ":", "raise", "invalidMethod", "(", ")", "if", "isins...
Searches the shop wizard for given item and determines price with given method Searches the shop wizard x times (x being number given in searches) for the given item and collects the lowest price from each result. Uses the given pricing method to determine and return the price of the it...
[ "Searches", "the", "shop", "wizard", "for", "given", "item", "and", "determines", "price", "with", "given", "method", "Searches", "the", "shop", "wizard", "x", "times", "(", "x", "being", "number", "given", "in", "searches", ")", "for", "the", "given", "it...
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/shop/ShopWizard.py#L133-L186
lehins/python-wepay
wepay/calls/credit_card.py
CreditCard.__create
def __create(self, client_id, cc_number, cvv, expiration_month, expiration_year, user_name, email, address, **kwargs): """Call documentation: `/credit_card/create <https://www.wepay.com/developer/reference/credit_card#create>`_, plus extra keyword parameter: :ke...
python
def __create(self, client_id, cc_number, cvv, expiration_month, expiration_year, user_name, email, address, **kwargs): """Call documentation: `/credit_card/create <https://www.wepay.com/developer/reference/credit_card#create>`_, plus extra keyword parameter: :ke...
[ "def", "__create", "(", "self", ",", "client_id", ",", "cc_number", ",", "cvv", ",", "expiration_month", ",", "expiration_year", ",", "user_name", ",", "email", ",", "address", ",", "*", "*", "kwargs", ")", ":", "params", "=", "{", "'client_id'", ":", "c...
Call documentation: `/credit_card/create <https://www.wepay.com/developer/reference/credit_card#create>`_, plus extra keyword parameter: :keyword bool batch_mode: turn on/off the batch_mode, see :class:`wepay.api.WePay` :keyword str batch_reference_id: `reference_id...
[ "Call", "documentation", ":", "/", "credit_card", "/", "create", "<https", ":", "//", "www", ".", "wepay", ".", "com", "/", "developer", "/", "reference", "/", "credit_card#create", ">", "_", "plus", "extra", "keyword", "parameter", ":", ":", "keyword", "b...
train
https://github.com/lehins/python-wepay/blob/414d25a1a8d0ecb22a3ddd1f16c60b805bb52a1f/wepay/calls/credit_card.py#L32-L58
lehins/python-wepay
wepay/calls/credit_card.py
CreditCard.__authorize
def __authorize(self, client_id, client_secret, credit_card_id, **kwargs): """Call documentation: `/credit_card/authorize <https://www.wepay.com/developer/reference/credit_card#authorize>`_, plus extra keyword parameter: :keyword bool batch_mode: turn on/off the batch_mode, see ...
python
def __authorize(self, client_id, client_secret, credit_card_id, **kwargs): """Call documentation: `/credit_card/authorize <https://www.wepay.com/developer/reference/credit_card#authorize>`_, plus extra keyword parameter: :keyword bool batch_mode: turn on/off the batch_mode, see ...
[ "def", "__authorize", "(", "self", ",", "client_id", ",", "client_secret", ",", "credit_card_id", ",", "*", "*", "kwargs", ")", ":", "params", "=", "{", "'client_id'", ":", "client_id", ",", "'client_secret'", ":", "client_secret", ",", "'credit_card_id'", ":"...
Call documentation: `/credit_card/authorize <https://www.wepay.com/developer/reference/credit_card#authorize>`_, plus extra keyword parameter: :keyword bool batch_mode: turn on/off the batch_mode, see :class:`wepay.api.WePay` :keyword str batch_reference_id: `refere...
[ "Call", "documentation", ":", "/", "credit_card", "/", "authorize", "<https", ":", "//", "www", ".", "wepay", ".", "com", "/", "developer", "/", "reference", "/", "credit_card#authorize", ">", "_", "plus", "extra", "keyword", "parameter", ":", ":", "keyword"...
train
https://github.com/lehins/python-wepay/blob/414d25a1a8d0ecb22a3ddd1f16c60b805bb52a1f/wepay/calls/credit_card.py#L67-L87
lehins/python-wepay
wepay/calls/credit_card.py
CreditCard.__find
def __find(self, client_id, client_secret, **kwargs): """Call documentation: `/credit_card/find <https://www.wepay.com/developer/reference/credit_card#find>`_, plus extra keyword parameter: :keyword bool batch_mode: turn on/off the batch_mode, see :class:`wepay.api.W...
python
def __find(self, client_id, client_secret, **kwargs): """Call documentation: `/credit_card/find <https://www.wepay.com/developer/reference/credit_card#find>`_, plus extra keyword parameter: :keyword bool batch_mode: turn on/off the batch_mode, see :class:`wepay.api.W...
[ "def", "__find", "(", "self", ",", "client_id", ",", "client_secret", ",", "*", "*", "kwargs", ")", ":", "params", "=", "{", "'client_id'", ":", "client_id", ",", "'client_secret'", ":", "client_secret", "}", "return", "self", ".", "make_call", "(", "self"...
Call documentation: `/credit_card/find <https://www.wepay.com/developer/reference/credit_card#find>`_, plus extra keyword parameter: :keyword bool batch_mode: turn on/off the batch_mode, see :class:`wepay.api.WePay` :keyword str batch_reference_id: `reference_id` pa...
[ "Call", "documentation", ":", "/", "credit_card", "/", "find", "<https", ":", "//", "www", ".", "wepay", ".", "com", "/", "developer", "/", "reference", "/", "credit_card#find", ">", "_", "plus", "extra", "keyword", "parameter", ":", ":", "keyword", "bool"...
train
https://github.com/lehins/python-wepay/blob/414d25a1a8d0ecb22a3ddd1f16c60b805bb52a1f/wepay/calls/credit_card.py#L92-L111
lehins/python-wepay
wepay/calls/credit_card.py
CreditCard.__delete
def __delete(self, client_id, client_secret, credit_card_id, **kwargs): """Call documentation: `/credit_card/delete <https://www.wepay.com/developer/reference/credit_card#delete>`_, plus extra keyword parameter: :keyword bool batch_mode: turn on/off the batch_mode, see ...
python
def __delete(self, client_id, client_secret, credit_card_id, **kwargs): """Call documentation: `/credit_card/delete <https://www.wepay.com/developer/reference/credit_card#delete>`_, plus extra keyword parameter: :keyword bool batch_mode: turn on/off the batch_mode, see ...
[ "def", "__delete", "(", "self", ",", "client_id", ",", "client_secret", ",", "credit_card_id", ",", "*", "*", "kwargs", ")", ":", "params", "=", "{", "'client_id'", ":", "client_id", ",", "'client_secret'", ":", "client_secret", ",", "'credit_card_id'", ":", ...
Call documentation: `/credit_card/delete <https://www.wepay.com/developer/reference/credit_card#delete>`_, plus extra keyword parameter: :keyword bool batch_mode: turn on/off the batch_mode, see :class:`wepay.api.WePay` :keyword str batch_reference_id: `reference_id...
[ "Call", "documentation", ":", "/", "credit_card", "/", "delete", "<https", ":", "//", "www", ".", "wepay", ".", "com", "/", "developer", "/", "reference", "/", "credit_card#delete", ">", "_", "plus", "extra", "keyword", "parameter", ":", ":", "keyword", "b...
train
https://github.com/lehins/python-wepay/blob/414d25a1a8d0ecb22a3ddd1f16c60b805bb52a1f/wepay/calls/credit_card.py#L119-L139
lehins/python-wepay
wepay/calls/credit_card.py
CreditCard.__transfer
def __transfer(self, client_id, client_secret, cc_number, expiration_month, expiration_year, user_name, email, address, **kwargs): """Call documentation: `/credit_card/transfer <https://www.wepay.com/developer/reference/credit_card#transfer>`_, plus extra keyword parameter: ...
python
def __transfer(self, client_id, client_secret, cc_number, expiration_month, expiration_year, user_name, email, address, **kwargs): """Call documentation: `/credit_card/transfer <https://www.wepay.com/developer/reference/credit_card#transfer>`_, plus extra keyword parameter: ...
[ "def", "__transfer", "(", "self", ",", "client_id", ",", "client_secret", ",", "cc_number", ",", "expiration_month", ",", "expiration_year", ",", "user_name", ",", "email", ",", "address", ",", "*", "*", "kwargs", ")", ":", "params", "=", "{", "'client_id'",...
Call documentation: `/credit_card/transfer <https://www.wepay.com/developer/reference/credit_card#transfer>`_, plus extra keyword parameter: :keyword bool batch_mode: turn on/off the batch_mode, see :class:`wepay.api.WePay` :keyword str batch_reference_id: `referenc...
[ "Call", "documentation", ":", "/", "credit_card", "/", "transfer", "<https", ":", "//", "www", ".", "wepay", ".", "com", "/", "developer", "/", "reference", "/", "credit_card#transfer", ">", "_", "plus", "extra", "keyword", "parameter", ":", ":", "keyword", ...
train
https://github.com/lehins/python-wepay/blob/414d25a1a8d0ecb22a3ddd1f16c60b805bb52a1f/wepay/calls/credit_card.py#L144-L170
mkouhei/tonicdnscli
src/tonicdnscli/processing.py
create_zone
def create_zone(server, token, domain, identifier, dtype, master=None): """Create zone records. Arguments: server: TonicDNS API server token: TonicDNS API authentication token domain: Specify domain name identifier: Template ID dtype: MASTER|SLAVE|NATI...
python
def create_zone(server, token, domain, identifier, dtype, master=None): """Create zone records. Arguments: server: TonicDNS API server token: TonicDNS API authentication token domain: Specify domain name identifier: Template ID dtype: MASTER|SLAVE|NATI...
[ "def", "create_zone", "(", "server", ",", "token", ",", "domain", ",", "identifier", ",", "dtype", ",", "master", "=", "None", ")", ":", "method", "=", "'PUT'", "uri", "=", "'https://'", "+", "server", "+", "'/zone'", "obj", "=", "JSONConverter", "(", ...
Create zone records. Arguments: server: TonicDNS API server token: TonicDNS API authentication token domain: Specify domain name identifier: Template ID dtype: MASTER|SLAVE|NATIVE (default: MASTER) master: master server ip address when dtype is...
[ "Create", "zone", "records", "." ]
train
https://github.com/mkouhei/tonicdnscli/blob/df2d6fb2104ae4d49fa89d1bba2f3ccd2fed388c/src/tonicdnscli/processing.py#L29-L50
mkouhei/tonicdnscli
src/tonicdnscli/processing.py
create_records
def create_records(server, token, domain, data): """Create records of specific domain. Arguments: server: TonicDNS API server token: TonicDNS API authentication token domain: Specify domain name data: Create records ContentType: application/json x-authentication-tok...
python
def create_records(server, token, domain, data): """Create records of specific domain. Arguments: server: TonicDNS API server token: TonicDNS API authentication token domain: Specify domain name data: Create records ContentType: application/json x-authentication-tok...
[ "def", "create_records", "(", "server", ",", "token", ",", "domain", ",", "data", ")", ":", "method", "=", "'PUT'", "uri", "=", "'https://'", "+", "server", "+", "'/zone/'", "+", "domain", "for", "i", "in", "data", ":", "connect", ".", "tonicdns_client",...
Create records of specific domain. Arguments: server: TonicDNS API server token: TonicDNS API authentication token domain: Specify domain name data: Create records ContentType: application/json x-authentication-token: token
[ "Create", "records", "of", "specific", "domain", "." ]
train
https://github.com/mkouhei/tonicdnscli/blob/df2d6fb2104ae4d49fa89d1bba2f3ccd2fed388c/src/tonicdnscli/processing.py#L53-L69
mkouhei/tonicdnscli
src/tonicdnscli/processing.py
delete_records
def delete_records(server, token, data): """Delete records of specific domain. Arguments: server: TonicDNS API server token: TonicDNS API authentication token data: Delete records ContentType: application/json x-authentication-token: token """ method = 'DELETE' ...
python
def delete_records(server, token, data): """Delete records of specific domain. Arguments: server: TonicDNS API server token: TonicDNS API authentication token data: Delete records ContentType: application/json x-authentication-token: token """ method = 'DELETE' ...
[ "def", "delete_records", "(", "server", ",", "token", ",", "data", ")", ":", "method", "=", "'DELETE'", "uri", "=", "'https://'", "+", "server", "+", "'/zone'", "for", "i", "in", "data", ":", "connect", ".", "tonicdns_client", "(", "uri", ",", "method", ...
Delete records of specific domain. Arguments: server: TonicDNS API server token: TonicDNS API authentication token data: Delete records ContentType: application/json x-authentication-token: token
[ "Delete", "records", "of", "specific", "domain", "." ]
train
https://github.com/mkouhei/tonicdnscli/blob/df2d6fb2104ae4d49fa89d1bba2f3ccd2fed388c/src/tonicdnscli/processing.py#L72-L87
mkouhei/tonicdnscli
src/tonicdnscli/processing.py
get_zone
def get_zone(server, token, domain, keyword='', raw_flag=False): """Retrieve zone records. Argument: server: TonicDNS API server token: TonicDNS API authentication token domain: Specify domain name keyword: Search keyword x-authentication-token: token """ metho...
python
def get_zone(server, token, domain, keyword='', raw_flag=False): """Retrieve zone records. Argument: server: TonicDNS API server token: TonicDNS API authentication token domain: Specify domain name keyword: Search keyword x-authentication-token: token """ metho...
[ "def", "get_zone", "(", "server", ",", "token", ",", "domain", ",", "keyword", "=", "''", ",", "raw_flag", "=", "False", ")", ":", "method", "=", "'GET'", "uri", "=", "'https://'", "+", "server", "+", "'/zone/'", "+", "domain", "data", "=", "connect", ...
Retrieve zone records. Argument: server: TonicDNS API server token: TonicDNS API authentication token domain: Specify domain name keyword: Search keyword x-authentication-token: token
[ "Retrieve", "zone", "records", "." ]
train
https://github.com/mkouhei/tonicdnscli/blob/df2d6fb2104ae4d49fa89d1bba2f3ccd2fed388c/src/tonicdnscli/processing.py#L90-L106
mkouhei/tonicdnscli
src/tonicdnscli/processing.py
delete_zone
def delete_zone(server, token, domain): """Delete specific zone. Argument: server: TonicDNS API server token: TonicDNS API authentication token domain: Specify domain name x-authentication-token: token """ method = 'DELETE' uri = 'https://' + server + '/zone/' + domai...
python
def delete_zone(server, token, domain): """Delete specific zone. Argument: server: TonicDNS API server token: TonicDNS API authentication token domain: Specify domain name x-authentication-token: token """ method = 'DELETE' uri = 'https://' + server + '/zone/' + domai...
[ "def", "delete_zone", "(", "server", ",", "token", ",", "domain", ")", ":", "method", "=", "'DELETE'", "uri", "=", "'https://'", "+", "server", "+", "'/zone/'", "+", "domain", "connect", ".", "tonicdns_client", "(", "uri", ",", "method", ",", "token", ",...
Delete specific zone. Argument: server: TonicDNS API server token: TonicDNS API authentication token domain: Specify domain name x-authentication-token: token
[ "Delete", "specific", "zone", "." ]
train
https://github.com/mkouhei/tonicdnscli/blob/df2d6fb2104ae4d49fa89d1bba2f3ccd2fed388c/src/tonicdnscli/processing.py#L124-L137
mkouhei/tonicdnscli
src/tonicdnscli/processing.py
create_template
def create_template(server, token, identifier, template): """Create template. Argument: server: TonicDNS API server token: TonicDNS API authentication token identifier: Template identifier template: Create template datas ContentType: application/json x-authe...
python
def create_template(server, token, identifier, template): """Create template. Argument: server: TonicDNS API server token: TonicDNS API authentication token identifier: Template identifier template: Create template datas ContentType: application/json x-authe...
[ "def", "create_template", "(", "server", ",", "token", ",", "identifier", ",", "template", ")", ":", "method", "=", "'PUT'", "uri", "=", "'https://'", "+", "server", "+", "'/template/'", "+", "identifier", "connect", ".", "tonicdns_client", "(", "uri", ",", ...
Create template. Argument: server: TonicDNS API server token: TonicDNS API authentication token identifier: Template identifier template: Create template datas ContentType: application/json x-authentication-token: token
[ "Create", "template", "." ]
train
https://github.com/mkouhei/tonicdnscli/blob/df2d6fb2104ae4d49fa89d1bba2f3ccd2fed388c/src/tonicdnscli/processing.py#L140-L155
mkouhei/tonicdnscli
src/tonicdnscli/processing.py
delete_template
def delete_template(server, token, template): """Delete template. Argument: server: TonicDNS API server token: TonicDNS API authentication token template: Delete template datas x-authentication-token: token """ method = 'DELETE' uri = 'https://' + server + '...
python
def delete_template(server, token, template): """Delete template. Argument: server: TonicDNS API server token: TonicDNS API authentication token template: Delete template datas x-authentication-token: token """ method = 'DELETE' uri = 'https://' + server + '...
[ "def", "delete_template", "(", "server", ",", "token", ",", "template", ")", ":", "method", "=", "'DELETE'", "uri", "=", "'https://'", "+", "server", "+", "'/template/'", "+", "template", "connect", ".", "tonicdns_client", "(", "uri", ",", "method", ",", "...
Delete template. Argument: server: TonicDNS API server token: TonicDNS API authentication token template: Delete template datas x-authentication-token: token
[ "Delete", "template", "." ]
train
https://github.com/mkouhei/tonicdnscli/blob/df2d6fb2104ae4d49fa89d1bba2f3ccd2fed388c/src/tonicdnscli/processing.py#L158-L171
mkouhei/tonicdnscli
src/tonicdnscli/processing.py
get_all_templates
def get_all_templates(server, token): """Retrieve all templates. Argument: server: TonicDNS API server token: TonicDNS API authentication token x-authentication-token: token """ method = 'GET' uri = 'https://' + server + '/template' connect.tonicdns_client(uri, method...
python
def get_all_templates(server, token): """Retrieve all templates. Argument: server: TonicDNS API server token: TonicDNS API authentication token x-authentication-token: token """ method = 'GET' uri = 'https://' + server + '/template' connect.tonicdns_client(uri, method...
[ "def", "get_all_templates", "(", "server", ",", "token", ")", ":", "method", "=", "'GET'", "uri", "=", "'https://'", "+", "server", "+", "'/template'", "connect", ".", "tonicdns_client", "(", "uri", ",", "method", ",", "token", ",", "data", "=", "False", ...
Retrieve all templates. Argument: server: TonicDNS API server token: TonicDNS API authentication token x-authentication-token: token
[ "Retrieve", "all", "templates", "." ]
train
https://github.com/mkouhei/tonicdnscli/blob/df2d6fb2104ae4d49fa89d1bba2f3ccd2fed388c/src/tonicdnscli/processing.py#L190-L202
mkouhei/tonicdnscli
src/tonicdnscli/processing.py
update_soa_serial
def update_soa_serial(server, token, soa_content): """Update SOA serial Argument: server: TonicDNS API server token: TonicDNS API authentication token soa_content: SOA record data x-authentication-token: token Get SOA record `cur_soa` is current SOA record. ...
python
def update_soa_serial(server, token, soa_content): """Update SOA serial Argument: server: TonicDNS API server token: TonicDNS API authentication token soa_content: SOA record data x-authentication-token: token Get SOA record `cur_soa` is current SOA record. ...
[ "def", "update_soa_serial", "(", "server", ",", "token", ",", "soa_content", ")", ":", "method", "=", "'GET'", "uri", "=", "'https://'", "+", "server", "+", "'/zone/'", "+", "soa_content", ".", "get", "(", "'domain'", ")", "cur_soa", ",", "new_soa", "=", ...
Update SOA serial Argument: server: TonicDNS API server token: TonicDNS API authentication token soa_content: SOA record data x-authentication-token: token Get SOA record `cur_soa` is current SOA record. `new_soa` is incremental serial SOA record.
[ "Update", "SOA", "serial" ]
train
https://github.com/mkouhei/tonicdnscli/blob/df2d6fb2104ae4d49fa89d1bba2f3ccd2fed388c/src/tonicdnscli/processing.py#L205-L241
shaypal5/utilitime
utilitime/time/time.py
decompose_seconds_in_day
def decompose_seconds_in_day(seconds): """Decomposes seconds in day into hour, minute and second components. Arguments --------- seconds : int A time of day by the number of seconds passed since midnight. Returns ------- hour : int The hour component of the given time of da...
python
def decompose_seconds_in_day(seconds): """Decomposes seconds in day into hour, minute and second components. Arguments --------- seconds : int A time of day by the number of seconds passed since midnight. Returns ------- hour : int The hour component of the given time of da...
[ "def", "decompose_seconds_in_day", "(", "seconds", ")", ":", "if", "seconds", ">", "SECONDS_IN_DAY", ":", "seconds", "=", "seconds", "-", "SECONDS_IN_DAY", "if", "seconds", "<", "0", ":", "raise", "ValueError", "(", "\"seconds param must be non-negative!\"", ")", ...
Decomposes seconds in day into hour, minute and second components. Arguments --------- seconds : int A time of day by the number of seconds passed since midnight. Returns ------- hour : int The hour component of the given time of day. minut : int The minute componen...
[ "Decomposes", "seconds", "in", "day", "into", "hour", "minute", "and", "second", "components", "." ]
train
https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/time/time.py#L10-L35
shaypal5/utilitime
utilitime/time/time.py
seconds_in_day_to_time
def seconds_in_day_to_time(seconds): """Decomposes atime of day into hour, minute and seconds components. Arguments --------- seconds : int A time of day by the number of seconds passed since midnight. Returns ------- datetime.time The corresponding time of day as a datetim...
python
def seconds_in_day_to_time(seconds): """Decomposes atime of day into hour, minute and seconds components. Arguments --------- seconds : int A time of day by the number of seconds passed since midnight. Returns ------- datetime.time The corresponding time of day as a datetim...
[ "def", "seconds_in_day_to_time", "(", "seconds", ")", ":", "try", ":", "return", "time", "(", "*", "decompose_seconds_in_day", "(", "seconds", ")", ")", "except", "ValueError", ":", "print", "(", "\"Seconds = {}\"", ".", "format", "(", "seconds", ")", ")", "...
Decomposes atime of day into hour, minute and seconds components. Arguments --------- seconds : int A time of day by the number of seconds passed since midnight. Returns ------- datetime.time The corresponding time of day as a datetime.time object. Example ------- ...
[ "Decomposes", "atime", "of", "day", "into", "hour", "minute", "and", "seconds", "components", "." ]
train
https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/time/time.py#L38-L61
tjomasc/snekbol
snekbol/identified.py
Identified._as_rdf_xml
def _as_rdf_xml(self, ns): """ Return identity details for the element as XML nodes """ self.rdf_identity = self._get_identity(ns) elements = [] elements.append(ET.Element(NS('sbol', 'persistentIdentity'), attrib={NS('rdf', 'resource'): ...
python
def _as_rdf_xml(self, ns): """ Return identity details for the element as XML nodes """ self.rdf_identity = self._get_identity(ns) elements = [] elements.append(ET.Element(NS('sbol', 'persistentIdentity'), attrib={NS('rdf', 'resource'): ...
[ "def", "_as_rdf_xml", "(", "self", ",", "ns", ")", ":", "self", ".", "rdf_identity", "=", "self", ".", "_get_identity", "(", "ns", ")", "elements", "=", "[", "]", "elements", ".", "append", "(", "ET", ".", "Element", "(", "NS", "(", "'sbol'", ",", ...
Return identity details for the element as XML nodes
[ "Return", "identity", "details", "for", "the", "element", "as", "XML", "nodes" ]
train
https://github.com/tjomasc/snekbol/blob/0b491aa96e0b1bd09e6c80cfb43807dd8a876c83/snekbol/identified.py#L68-L98
steder/pundler
pundler/core.py
get_requirement_files
def get_requirement_files(args=None): """ Get the "best" requirements file we can find """ if args and args.input_filename: return [args.input_filename] paths = [] for regex in settings.REQUIREMENTS_SOURCE_GLOBS: paths.extend(glob.glob(regex)) return paths
python
def get_requirement_files(args=None): """ Get the "best" requirements file we can find """ if args and args.input_filename: return [args.input_filename] paths = [] for regex in settings.REQUIREMENTS_SOURCE_GLOBS: paths.extend(glob.glob(regex)) return paths
[ "def", "get_requirement_files", "(", "args", "=", "None", ")", ":", "if", "args", "and", "args", ".", "input_filename", ":", "return", "[", "args", ".", "input_filename", "]", "paths", "=", "[", "]", "for", "regex", "in", "settings", ".", "REQUIREMENTS_SOU...
Get the "best" requirements file we can find
[ "Get", "the", "best", "requirements", "file", "we", "can", "find" ]
train
https://github.com/steder/pundler/blob/68d730b08e46d5f7b8781017c9bba87c7378509d/pundler/core.py#L34-L44
dariosky/wfcli
wfcli/wfapi.py
WebFactionAPI.list_domains
def list_domains(self): """ Return all domains. Domain is a key, so group by them """ self.connect() results = self.server.list_domains(self.session_id) return {i['domain']: i['subdomains'] for i in results}
python
def list_domains(self): """ Return all domains. Domain is a key, so group by them """ self.connect() results = self.server.list_domains(self.session_id) return {i['domain']: i['subdomains'] for i in results}
[ "def", "list_domains", "(", "self", ")", ":", "self", ".", "connect", "(", ")", "results", "=", "self", ".", "server", ".", "list_domains", "(", "self", ".", "session_id", ")", "return", "{", "i", "[", "'domain'", "]", ":", "i", "[", "'subdomains'", ...
Return all domains. Domain is a key, so group by them
[ "Return", "all", "domains", ".", "Domain", "is", "a", "key", "so", "group", "by", "them" ]
train
https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/wfapi.py#L67-L71
dariosky/wfcli
wfcli/wfapi.py
WebFactionAPI.list_websites
def list_websites(self): """ Return all websites, name is not a key """ self.connect() results = self.server.list_websites(self.session_id) return results
python
def list_websites(self): """ Return all websites, name is not a key """ self.connect() results = self.server.list_websites(self.session_id) return results
[ "def", "list_websites", "(", "self", ")", ":", "self", ".", "connect", "(", ")", "results", "=", "self", ".", "server", ".", "list_websites", "(", "self", ".", "session_id", ")", "return", "results" ]
Return all websites, name is not a key
[ "Return", "all", "websites", "name", "is", "not", "a", "key" ]
train
https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/wfapi.py#L73-L78
dariosky/wfcli
wfcli/wfapi.py
WebFactionAPI.website_exists
def website_exists(self, website, websites=None): """ Look for websites matching the one passed """ if websites is None: websites = self.list_websites() if isinstance(website, str): website = {"name": website} ignored_fields = ('id',) # changes in these fields ar...
python
def website_exists(self, website, websites=None): """ Look for websites matching the one passed """ if websites is None: websites = self.list_websites() if isinstance(website, str): website = {"name": website} ignored_fields = ('id',) # changes in these fields ar...
[ "def", "website_exists", "(", "self", ",", "website", ",", "websites", "=", "None", ")", ":", "if", "websites", "is", "None", ":", "websites", "=", "self", ".", "list_websites", "(", ")", "if", "isinstance", "(", "website", ",", "str", ")", ":", "websi...
Look for websites matching the one passed
[ "Look", "for", "websites", "matching", "the", "one", "passed" ]
train
https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/wfapi.py#L136-L155
Adman/pynameday
pynameday/core.py
NamedayMixin.get_nameday
def get_nameday(self, month=None, day=None): """Return name(s) as a string based on given date and month. If no arguments given, use current date""" if month is None: month = datetime.now().month if day is None: day = datetime.now().day return self.NAMEDAY...
python
def get_nameday(self, month=None, day=None): """Return name(s) as a string based on given date and month. If no arguments given, use current date""" if month is None: month = datetime.now().month if day is None: day = datetime.now().day return self.NAMEDAY...
[ "def", "get_nameday", "(", "self", ",", "month", "=", "None", ",", "day", "=", "None", ")", ":", "if", "month", "is", "None", ":", "month", "=", "datetime", ".", "now", "(", ")", ".", "month", "if", "day", "is", "None", ":", "day", "=", "datetime...
Return name(s) as a string based on given date and month. If no arguments given, use current date
[ "Return", "name", "(", "s", ")", "as", "a", "string", "based", "on", "given", "date", "and", "month", ".", "If", "no", "arguments", "given", "use", "current", "date" ]
train
https://github.com/Adman/pynameday/blob/a3153db3e26531dec54510705aac4ae077cf9316/pynameday/core.py#L7-L14
Adman/pynameday
pynameday/core.py
NamedayMixin.get_month_namedays
def get_month_namedays(self, month=None): """Return names as a tuple based on given month. If no month given, use current one""" if month is None: month = datetime.now().month return self.NAMEDAYS[month-1]
python
def get_month_namedays(self, month=None): """Return names as a tuple based on given month. If no month given, use current one""" if month is None: month = datetime.now().month return self.NAMEDAYS[month-1]
[ "def", "get_month_namedays", "(", "self", ",", "month", "=", "None", ")", ":", "if", "month", "is", "None", ":", "month", "=", "datetime", ".", "now", "(", ")", ".", "month", "return", "self", ".", "NAMEDAYS", "[", "month", "-", "1", "]" ]
Return names as a tuple based on given month. If no month given, use current one
[ "Return", "names", "as", "a", "tuple", "based", "on", "given", "month", ".", "If", "no", "month", "given", "use", "current", "one" ]
train
https://github.com/Adman/pynameday/blob/a3153db3e26531dec54510705aac4ae077cf9316/pynameday/core.py#L16-L21
emencia/emencia-django-forum
forum/mixins.py
ModeratorCheckMixin.check_moderator_permissions
def check_moderator_permissions(self, request): """ Check if user have global or per object permission (on category instance and on thread instance), finally return a 403 response if no permissions has been finded. If a permission has been finded, return False, then th...
python
def check_moderator_permissions(self, request): """ Check if user have global or per object permission (on category instance and on thread instance), finally return a 403 response if no permissions has been finded. If a permission has been finded, return False, then th...
[ "def", "check_moderator_permissions", "(", "self", ",", "request", ")", ":", "has_perms", "=", "self", ".", "has_moderator_permissions", "(", "request", ")", "# Return a forbidden response if no permission has been finded", "if", "not", "has_perms", ":", "raise", "Permiss...
Check if user have global or per object permission (on category instance and on thread instance), finally return a 403 response if no permissions has been finded. If a permission has been finded, return False, then the dispatcher should so return the "normal" response from th...
[ "Check", "if", "user", "have", "global", "or", "per", "object", "permission", "(", "on", "category", "instance", "and", "on", "thread", "instance", ")", "finally", "return", "a", "403", "response", "if", "no", "permissions", "has", "been", "finded", ".", "...
train
https://github.com/emencia/emencia-django-forum/blob/cda74ed7e5822675c340ee5ec71548d981bccd3b/forum/mixins.py#L18-L33
emencia/emencia-django-forum
forum/mixins.py
ModeratorCheckMixin.has_moderator_permissions
def has_moderator_permissions(self, request): """ Find if user have global or per object permission firstly on category instance, if not then on thread instance """ return any(request.user.has_perm(perm) for perm in self.permission_required)
python
def has_moderator_permissions(self, request): """ Find if user have global or per object permission firstly on category instance, if not then on thread instance """ return any(request.user.has_perm(perm) for perm in self.permission_required)
[ "def", "has_moderator_permissions", "(", "self", ",", "request", ")", ":", "return", "any", "(", "request", ".", "user", ".", "has_perm", "(", "perm", ")", "for", "perm", "in", "self", ".", "permission_required", ")" ]
Find if user have global or per object permission firstly on category instance, if not then on thread instance
[ "Find", "if", "user", "have", "global", "or", "per", "object", "permission", "firstly", "on", "category", "instance", "if", "not", "then", "on", "thread", "instance" ]
train
https://github.com/emencia/emencia-django-forum/blob/cda74ed7e5822675c340ee5ec71548d981bccd3b/forum/mixins.py#L35-L40
rochacbruno/shiftpy
shiftpy/env.py
getvar
def getvar(key, default=None, template='OPENSHIFT_{key}'): """ Get OPENSHIFT envvar """ return os.environ.get(template.format(key=key), default)
python
def getvar(key, default=None, template='OPENSHIFT_{key}'): """ Get OPENSHIFT envvar """ return os.environ.get(template.format(key=key), default)
[ "def", "getvar", "(", "key", ",", "default", "=", "None", ",", "template", "=", "'OPENSHIFT_{key}'", ")", ":", "return", "os", ".", "environ", ".", "get", "(", "template", ".", "format", "(", "key", "=", "key", ")", ",", "default", ")" ]
Get OPENSHIFT envvar
[ "Get", "OPENSHIFT", "envvar" ]
train
https://github.com/rochacbruno/shiftpy/blob/6bffccf511f24b7e53dcfee9807e0e3388aa823a/shiftpy/env.py#L6-L10
markomanninen/abnum
remarkuple/table.py
table
def table(*args, **kw): """ Table function presents the idea of extending tags for simpler generation of some html element groups. Table has several group of tags in well defined structure. Caption header should be right after table and before thead for example. Colgroup, tfoot, tbody, tr, td and th...
python
def table(*args, **kw): """ Table function presents the idea of extending tags for simpler generation of some html element groups. Table has several group of tags in well defined structure. Caption header should be right after table and before thead for example. Colgroup, tfoot, tbody, tr, td and th...
[ "def", "table", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "class", "table", "(", "type", "(", "helper", ".", "table", "(", ")", ")", ")", ":", "\"\"\" Extend base table tag class \"\"\"", "def", "__init__", "(", "self", ",", "*", "args", ",", ...
Table function presents the idea of extending tags for simpler generation of some html element groups. Table has several group of tags in well defined structure. Caption header should be right after table and before thead for example. Colgroup, tfoot, tbody, tr, td and th elements has certain order which ar...
[ "Table", "function", "presents", "the", "idea", "of", "extending", "tags", "for", "simpler", "generation", "of", "some", "html", "element", "groups", ".", "Table", "has", "several", "group", "of", "tags", "in", "well", "defined", "structure", ".", "Caption", ...
train
https://github.com/markomanninen/abnum/blob/9bfc8f06f34d9a51aab038638f87e2bb5f9f4c99/remarkuple/table.py#L7-L86
treycucco/bidon
bidon/json_patch.py
add
def add(parent, idx, value): """Add a value to a dict.""" if isinstance(parent, dict): if idx in parent: raise JSONPatchError("Item already exists") parent[idx] = value elif isinstance(parent, list): if idx == "" or idx == "~": parent.append(value) else: parent.insert(int(idx), v...
python
def add(parent, idx, value): """Add a value to a dict.""" if isinstance(parent, dict): if idx in parent: raise JSONPatchError("Item already exists") parent[idx] = value elif isinstance(parent, list): if idx == "" or idx == "~": parent.append(value) else: parent.insert(int(idx), v...
[ "def", "add", "(", "parent", ",", "idx", ",", "value", ")", ":", "if", "isinstance", "(", "parent", ",", "dict", ")", ":", "if", "idx", "in", "parent", ":", "raise", "JSONPatchError", "(", "\"Item already exists\"", ")", "parent", "[", "idx", "]", "=",...
Add a value to a dict.
[ "Add", "a", "value", "to", "a", "dict", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L62-L74
treycucco/bidon
bidon/json_patch.py
remove
def remove(parent, idx): """Remove a value from a dict.""" if isinstance(parent, dict): del parent[idx] elif isinstance(parent, list): del parent[int(idx)] else: raise JSONPathError("Invalid path for operation")
python
def remove(parent, idx): """Remove a value from a dict.""" if isinstance(parent, dict): del parent[idx] elif isinstance(parent, list): del parent[int(idx)] else: raise JSONPathError("Invalid path for operation")
[ "def", "remove", "(", "parent", ",", "idx", ")", ":", "if", "isinstance", "(", "parent", ",", "dict", ")", ":", "del", "parent", "[", "idx", "]", "elif", "isinstance", "(", "parent", ",", "list", ")", ":", "del", "parent", "[", "int", "(", "idx", ...
Remove a value from a dict.
[ "Remove", "a", "value", "from", "a", "dict", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L77-L84
treycucco/bidon
bidon/json_patch.py
replace
def replace(parent, idx, value, check_value=_NO_VAL): """Replace a value in a dict.""" if isinstance(parent, dict): if idx not in parent: raise JSONPatchError("Item does not exist") elif isinstance(parent, list): idx = int(idx) if idx < 0 or idx >= len(parent): raise JSONPatchError("List i...
python
def replace(parent, idx, value, check_value=_NO_VAL): """Replace a value in a dict.""" if isinstance(parent, dict): if idx not in parent: raise JSONPatchError("Item does not exist") elif isinstance(parent, list): idx = int(idx) if idx < 0 or idx >= len(parent): raise JSONPatchError("List i...
[ "def", "replace", "(", "parent", ",", "idx", ",", "value", ",", "check_value", "=", "_NO_VAL", ")", ":", "if", "isinstance", "(", "parent", ",", "dict", ")", ":", "if", "idx", "not", "in", "parent", ":", "raise", "JSONPatchError", "(", "\"Item does not e...
Replace a value in a dict.
[ "Replace", "a", "value", "in", "a", "dict", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L87-L99
treycucco/bidon
bidon/json_patch.py
merge
def merge(parent, idx, value): """Merge a value.""" target = get_child(parent, idx) for key, val in value.items(): target[key] = val
python
def merge(parent, idx, value): """Merge a value.""" target = get_child(parent, idx) for key, val in value.items(): target[key] = val
[ "def", "merge", "(", "parent", ",", "idx", ",", "value", ")", ":", "target", "=", "get_child", "(", "parent", ",", "idx", ")", "for", "key", ",", "val", "in", "value", ".", "items", "(", ")", ":", "target", "[", "key", "]", "=", "val" ]
Merge a value.
[ "Merge", "a", "value", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L102-L106
treycucco/bidon
bidon/json_patch.py
copy
def copy(src_parent, src_idx, dest_parent, dest_idx): """Copy an item.""" if isinstance(dest_parent, list): dest_idx = int(dest_idx) dest_parent[dest_idx] = get_child(src_parent, src_idx)
python
def copy(src_parent, src_idx, dest_parent, dest_idx): """Copy an item.""" if isinstance(dest_parent, list): dest_idx = int(dest_idx) dest_parent[dest_idx] = get_child(src_parent, src_idx)
[ "def", "copy", "(", "src_parent", ",", "src_idx", ",", "dest_parent", ",", "dest_idx", ")", ":", "if", "isinstance", "(", "dest_parent", ",", "list", ")", ":", "dest_idx", "=", "int", "(", "dest_idx", ")", "dest_parent", "[", "dest_idx", "]", "=", "get_c...
Copy an item.
[ "Copy", "an", "item", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L109-L113
treycucco/bidon
bidon/json_patch.py
move
def move(src_parent, src_idx, dest_parent, dest_idx): """Move an item.""" copy(src_parent, src_idx, dest_parent, dest_idx) remove(src_parent, src_idx)
python
def move(src_parent, src_idx, dest_parent, dest_idx): """Move an item.""" copy(src_parent, src_idx, dest_parent, dest_idx) remove(src_parent, src_idx)
[ "def", "move", "(", "src_parent", ",", "src_idx", ",", "dest_parent", ",", "dest_idx", ")", ":", "copy", "(", "src_parent", ",", "src_idx", ",", "dest_parent", ",", "dest_idx", ")", "remove", "(", "src_parent", ",", "src_idx", ")" ]
Move an item.
[ "Move", "an", "item", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L116-L119
treycucco/bidon
bidon/json_patch.py
set_remove
def set_remove(parent, idx, value): """Remove an item from a list.""" lst = get_child(parent, idx) if value in lst: lst.remove(value)
python
def set_remove(parent, idx, value): """Remove an item from a list.""" lst = get_child(parent, idx) if value in lst: lst.remove(value)
[ "def", "set_remove", "(", "parent", ",", "idx", ",", "value", ")", ":", "lst", "=", "get_child", "(", "parent", ",", "idx", ")", "if", "value", "in", "lst", ":", "lst", ".", "remove", "(", "value", ")" ]
Remove an item from a list.
[ "Remove", "an", "item", "from", "a", "list", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L134-L138
treycucco/bidon
bidon/json_patch.py
set_add
def set_add(parent, idx, value): """Add an item to a list if it doesn't exist.""" lst = get_child(parent, idx) if value not in lst: lst.append(value)
python
def set_add(parent, idx, value): """Add an item to a list if it doesn't exist.""" lst = get_child(parent, idx) if value not in lst: lst.append(value)
[ "def", "set_add", "(", "parent", ",", "idx", ",", "value", ")", ":", "lst", "=", "get_child", "(", "parent", ",", "idx", ")", "if", "value", "not", "in", "lst", ":", "lst", ".", "append", "(", "value", ")" ]
Add an item to a list if it doesn't exist.
[ "Add", "an", "item", "to", "a", "list", "if", "it", "doesn", "t", "exist", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L141-L145
treycucco/bidon
bidon/json_patch.py
get_children
def get_children(parent, idx): """Gets the child at parent[idx], or all the children if idx == "*".""" if isinstance(parent, dict): if idx in parent: yield parent[idx] else: raise JSONPathError("Invalid path at {0}".format(idx)) elif isinstance(parent, list): if idx == "*": yield fr...
python
def get_children(parent, idx): """Gets the child at parent[idx], or all the children if idx == "*".""" if isinstance(parent, dict): if idx in parent: yield parent[idx] else: raise JSONPathError("Invalid path at {0}".format(idx)) elif isinstance(parent, list): if idx == "*": yield fr...
[ "def", "get_children", "(", "parent", ",", "idx", ")", ":", "if", "isinstance", "(", "parent", ",", "dict", ")", ":", "if", "idx", "in", "parent", ":", "yield", "parent", "[", "idx", "]", "else", ":", "raise", "JSONPathError", "(", "\"Invalid path at {0}...
Gets the child at parent[idx], or all the children if idx == "*".
[ "Gets", "the", "child", "at", "parent", "[", "idx", "]", "or", "all", "the", "children", "if", "idx", "==", "*", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L148-L168
treycucco/bidon
bidon/json_patch.py
parse_path
def parse_path(path): """Parse a rfc 6901 path.""" if not path: raise ValueError("Invalid path") if isinstance(path, str): if path == "/": raise ValueError("Invalid path") if path[0] != "/": raise ValueError("Invalid path") return path.split(_PATH_SEP)[1:] elif isinstance(path, (tup...
python
def parse_path(path): """Parse a rfc 6901 path.""" if not path: raise ValueError("Invalid path") if isinstance(path, str): if path == "/": raise ValueError("Invalid path") if path[0] != "/": raise ValueError("Invalid path") return path.split(_PATH_SEP)[1:] elif isinstance(path, (tup...
[ "def", "parse_path", "(", "path", ")", ":", "if", "not", "path", ":", "raise", "ValueError", "(", "\"Invalid path\"", ")", "if", "isinstance", "(", "path", ",", "str", ")", ":", "if", "path", "==", "\"/\"", ":", "raise", "ValueError", "(", "\"Invalid pat...
Parse a rfc 6901 path.
[ "Parse", "a", "rfc", "6901", "path", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L176-L190
treycucco/bidon
bidon/json_patch.py
resolve_path
def resolve_path(root, path): """Resolve a rfc 6901 path, returning the parent and the last path part.""" path = parse_path(path) parent = root for part in path[:-1]: parent = get_child(parent, rfc_6901_replace(part)) return (parent, rfc_6901_replace(path[-1]))
python
def resolve_path(root, path): """Resolve a rfc 6901 path, returning the parent and the last path part.""" path = parse_path(path) parent = root for part in path[:-1]: parent = get_child(parent, rfc_6901_replace(part)) return (parent, rfc_6901_replace(path[-1]))
[ "def", "resolve_path", "(", "root", ",", "path", ")", ":", "path", "=", "parse_path", "(", "path", ")", "parent", "=", "root", "for", "part", "in", "path", "[", ":", "-", "1", "]", ":", "parent", "=", "get_child", "(", "parent", ",", "rfc_6901_replac...
Resolve a rfc 6901 path, returning the parent and the last path part.
[ "Resolve", "a", "rfc", "6901", "path", "returning", "the", "parent", "and", "the", "last", "path", "part", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L193-L202
treycucco/bidon
bidon/json_patch.py
find_all
def find_all(root, path): """Get all children that satisfy the path.""" path = parse_path(path) if len(path) == 1: yield from get_children(root, path[0]) else: for child in get_children(root, path[0]): yield from find_all(child, path[1:])
python
def find_all(root, path): """Get all children that satisfy the path.""" path = parse_path(path) if len(path) == 1: yield from get_children(root, path[0]) else: for child in get_children(root, path[0]): yield from find_all(child, path[1:])
[ "def", "find_all", "(", "root", ",", "path", ")", ":", "path", "=", "parse_path", "(", "path", ")", "if", "len", "(", "path", ")", "==", "1", ":", "yield", "from", "get_children", "(", "root", ",", "path", "[", "0", "]", ")", "else", ":", "for", ...
Get all children that satisfy the path.
[ "Get", "all", "children", "that", "satisfy", "the", "path", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L210-L218
treycucco/bidon
bidon/json_patch.py
apply_patch
def apply_patch(document, patch): """Apply a Patch object to a document.""" # pylint: disable=too-many-return-statements op = patch.op parent, idx = resolve_path(document, patch.path) if op == "add": return add(parent, idx, patch.value) elif op == "remove": return remove(parent, idx) elif op == "r...
python
def apply_patch(document, patch): """Apply a Patch object to a document.""" # pylint: disable=too-many-return-statements op = patch.op parent, idx = resolve_path(document, patch.path) if op == "add": return add(parent, idx, patch.value) elif op == "remove": return remove(parent, idx) elif op == "r...
[ "def", "apply_patch", "(", "document", ",", "patch", ")", ":", "# pylint: disable=too-many-return-statements", "op", "=", "patch", ".", "op", "parent", ",", "idx", "=", "resolve_path", "(", "document", ",", "patch", ".", "path", ")", "if", "op", "==", "\"add...
Apply a Patch object to a document.
[ "Apply", "a", "Patch", "object", "to", "a", "document", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L226-L252
treycucco/bidon
bidon/json_patch.py
apply_patches
def apply_patches(document, patches): """Serially apply all patches to a document.""" for i, patch in enumerate(patches): try: result = apply_patch(document, patch) if patch.op == "test" and result is False: raise JSONPatchError("Test patch {0} failed. Cancelling entire set.".format(i + 1)) ...
python
def apply_patches(document, patches): """Serially apply all patches to a document.""" for i, patch in enumerate(patches): try: result = apply_patch(document, patch) if patch.op == "test" and result is False: raise JSONPatchError("Test patch {0} failed. Cancelling entire set.".format(i + 1)) ...
[ "def", "apply_patches", "(", "document", ",", "patches", ")", ":", "for", "i", ",", "patch", "in", "enumerate", "(", "patches", ")", ":", "try", ":", "result", "=", "apply_patch", "(", "document", ",", "patch", ")", "if", "patch", ".", "op", "==", "\...
Serially apply all patches to a document.
[ "Serially", "apply", "all", "patches", "to", "a", "document", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/json_patch.py#L255-L263
xtrementl/focus
focus/plugin/modules/timer.py
Timer.execute
def execute(self, env, args): """ Displays task time left in minutes. `env` Runtime ``Environment`` instance. `args` Arguments object from arg parser. """ msg = u'Time Left: {0}m' if not args.short else '{0}' mins = max(0, sel...
python
def execute(self, env, args): """ Displays task time left in minutes. `env` Runtime ``Environment`` instance. `args` Arguments object from arg parser. """ msg = u'Time Left: {0}m' if not args.short else '{0}' mins = max(0, sel...
[ "def", "execute", "(", "self", ",", "env", ",", "args", ")", ":", "msg", "=", "u'Time Left: {0}m'", "if", "not", "args", ".", "short", "else", "'{0}'", "mins", "=", "max", "(", "0", ",", "self", ".", "total_duration", "-", "env", ".", "task", ".", ...
Displays task time left in minutes. `env` Runtime ``Environment`` instance. `args` Arguments object from arg parser.
[ "Displays", "task", "time", "left", "in", "minutes", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/timer.py#L42-L53
xtrementl/focus
focus/plugin/modules/timer.py
Timer.parse_option
def parse_option(self, option, block_name, *values): """ Parse duration option for timer. """ try: if len(values) != 1: raise TypeError self.total_duration = int(values[0]) if self.total_duration <= 0: raise ValueError ...
python
def parse_option(self, option, block_name, *values): """ Parse duration option for timer. """ try: if len(values) != 1: raise TypeError self.total_duration = int(values[0]) if self.total_duration <= 0: raise ValueError ...
[ "def", "parse_option", "(", "self", ",", "option", ",", "block_name", ",", "*", "values", ")", ":", "try", ":", "if", "len", "(", "values", ")", "!=", "1", ":", "raise", "TypeError", "self", ".", "total_duration", "=", "int", "(", "values", "[", "0",...
Parse duration option for timer.
[ "Parse", "duration", "option", "for", "timer", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/timer.py#L55-L69
samirelanduk/quickplots
quickplots/series.py
Series.color
def color(self, color=None): """Returns or sets (if a value is provided) the series' colour. :param str color: If given, the series' colour will be set to this. :rtype: ``str``""" if color is None: return self._color else: if not isinstance(color, str): ...
python
def color(self, color=None): """Returns or sets (if a value is provided) the series' colour. :param str color: If given, the series' colour will be set to this. :rtype: ``str``""" if color is None: return self._color else: if not isinstance(color, str): ...
[ "def", "color", "(", "self", ",", "color", "=", "None", ")", ":", "if", "color", "is", "None", ":", "return", "self", ".", "_color", "else", ":", "if", "not", "isinstance", "(", "color", ",", "str", ")", ":", "raise", "TypeError", "(", "\"color must ...
Returns or sets (if a value is provided) the series' colour. :param str color: If given, the series' colour will be set to this. :rtype: ``str``
[ "Returns", "or", "sets", "(", "if", "a", "value", "is", "provided", ")", "the", "series", "colour", "." ]
train
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/series.py#L89-L100
samirelanduk/quickplots
quickplots/series.py
Series.name
def name(self, name=None): """Returns or sets (if a value is provided) the series' name. :param str name: If given, the series' name will be set to this. :rtype: str""" if name is None: return self._name else: if not isinstance(name, str) and name is not...
python
def name(self, name=None): """Returns or sets (if a value is provided) the series' name. :param str name: If given, the series' name will be set to this. :rtype: str""" if name is None: return self._name else: if not isinstance(name, str) and name is not...
[ "def", "name", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "return", "self", ".", "_name", "else", ":", "if", "not", "isinstance", "(", "name", ",", "str", ")", "and", "name", "is", "not", "None", ":", "raise...
Returns or sets (if a value is provided) the series' name. :param str name: If given, the series' name will be set to this. :rtype: str
[ "Returns", "or", "sets", "(", "if", "a", "value", "is", "provided", ")", "the", "series", "name", "." ]
train
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/series.py#L103-L114
samirelanduk/quickplots
quickplots/series.py
Series.add_data_point
def add_data_point(self, x, y): """Adds a data point to the series. :param x: The numerical x value to be added. :param y: The numerical y value to be added.""" if not is_numeric(x): raise TypeError("x value must be numeric, not '%s'" % str(x)) if not is_numeric(y):...
python
def add_data_point(self, x, y): """Adds a data point to the series. :param x: The numerical x value to be added. :param y: The numerical y value to be added.""" if not is_numeric(x): raise TypeError("x value must be numeric, not '%s'" % str(x)) if not is_numeric(y):...
[ "def", "add_data_point", "(", "self", ",", "x", ",", "y", ")", ":", "if", "not", "is_numeric", "(", "x", ")", ":", "raise", "TypeError", "(", "\"x value must be numeric, not '%s'\"", "%", "str", "(", "x", ")", ")", "if", "not", "is_numeric", "(", "y", ...
Adds a data point to the series. :param x: The numerical x value to be added. :param y: The numerical y value to be added.
[ "Adds", "a", "data", "point", "to", "the", "series", "." ]
train
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/series.py#L148-L161
samirelanduk/quickplots
quickplots/series.py
Series.remove_data_point
def remove_data_point(self, x, y): """Removes the given data point from the series. :param x: The numerical x value of the data point to be removed. :param y: The numerical y value of the data point to be removed. :raises ValueError: if you try to remove the last data point from\ ...
python
def remove_data_point(self, x, y): """Removes the given data point from the series. :param x: The numerical x value of the data point to be removed. :param y: The numerical y value of the data point to be removed. :raises ValueError: if you try to remove the last data point from\ ...
[ "def", "remove_data_point", "(", "self", ",", "x", ",", "y", ")", ":", "if", "len", "(", "self", ".", "_data", ")", "==", "1", ":", "raise", "ValueError", "(", "\"You cannot remove a Series' last data point\"", ")", "self", ".", "_data", ".", "remove", "("...
Removes the given data point from the series. :param x: The numerical x value of the data point to be removed. :param y: The numerical y value of the data point to be removed. :raises ValueError: if you try to remove the last data point from\ a series.
[ "Removes", "the", "given", "data", "point", "from", "the", "series", "." ]
train
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/series.py#L164-L174
samirelanduk/quickplots
quickplots/series.py
Series.canvas_points
def canvas_points(self): """Calculates the coordinates that the data should use to paint itself to its associated :py:class:`.AxisChart`. This is used internally to create the chart. :rtype: ``tuple``""" if self.chart(): x_axis_min = self.chart().x_lower_limit() ...
python
def canvas_points(self): """Calculates the coordinates that the data should use to paint itself to its associated :py:class:`.AxisChart`. This is used internally to create the chart. :rtype: ``tuple``""" if self.chart(): x_axis_min = self.chart().x_lower_limit() ...
[ "def", "canvas_points", "(", "self", ")", ":", "if", "self", ".", "chart", "(", ")", ":", "x_axis_min", "=", "self", ".", "chart", "(", ")", ".", "x_lower_limit", "(", ")", "y_axis_min", "=", "self", ".", "chart", "(", ")", ".", "y_lower_limit", "(",...
Calculates the coordinates that the data should use to paint itself to its associated :py:class:`.AxisChart`. This is used internally to create the chart. :rtype: ``tuple``
[ "Calculates", "the", "coordinates", "that", "the", "data", "should", "use", "to", "paint", "itself", "to", "its", "associated", ":", "py", ":", "class", ":", ".", "AxisChart", ".", "This", "is", "used", "internally", "to", "create", "the", "chart", "." ]
train
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/series.py#L177-L208
samirelanduk/quickplots
quickplots/series.py
LineSeries.linestyle
def linestyle(self, linestyle=None): """Returns or sets (if a value is provided) the series' linestyle. See\ `OmniCanvas docs <https://omnicanvas.readthedocs.io/en/latest/api/graph\ ics.html#omnicanvas.graphics.ShapeGraphic.line_style>`_ for acceptable values. :param str linesty...
python
def linestyle(self, linestyle=None): """Returns or sets (if a value is provided) the series' linestyle. See\ `OmniCanvas docs <https://omnicanvas.readthedocs.io/en/latest/api/graph\ ics.html#omnicanvas.graphics.ShapeGraphic.line_style>`_ for acceptable values. :param str linesty...
[ "def", "linestyle", "(", "self", ",", "linestyle", "=", "None", ")", ":", "if", "linestyle", "is", "None", ":", "return", "self", ".", "_linestyle", "else", ":", "if", "not", "isinstance", "(", "linestyle", ",", "str", ")", ":", "raise", "TypeError", "...
Returns or sets (if a value is provided) the series' linestyle. See\ `OmniCanvas docs <https://omnicanvas.readthedocs.io/en/latest/api/graph\ ics.html#omnicanvas.graphics.ShapeGraphic.line_style>`_ for acceptable values. :param str linestyle: If given, the series' linestyle will be set ...
[ "Returns", "or", "sets", "(", "if", "a", "value", "is", "provided", ")", "the", "series", "linestyle", ".", "See", "\\", "OmniCanvas", "docs", "<https", ":", "//", "omnicanvas", ".", "readthedocs", ".", "io", "/", "en", "/", "latest", "/", "api", "/", ...
train
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/series.py#L239-L256
samirelanduk/quickplots
quickplots/series.py
LineSeries.linewidth
def linewidth(self, linewidth=None): """Returns or sets (if a value is provided) the width of the series' line. :param Number linewidth: If given, the series' linewidth will be set to\ this. :rtype: ``Number``""" if linewidth is None: return self._linewidth ...
python
def linewidth(self, linewidth=None): """Returns or sets (if a value is provided) the width of the series' line. :param Number linewidth: If given, the series' linewidth will be set to\ this. :rtype: ``Number``""" if linewidth is None: return self._linewidth ...
[ "def", "linewidth", "(", "self", ",", "linewidth", "=", "None", ")", ":", "if", "linewidth", "is", "None", ":", "return", "self", ".", "_linewidth", "else", ":", "if", "not", "is_numeric", "(", "linewidth", ")", ":", "raise", "TypeError", "(", "\"linewid...
Returns or sets (if a value is provided) the width of the series' line. :param Number linewidth: If given, the series' linewidth will be set to\ this. :rtype: ``Number``
[ "Returns", "or", "sets", "(", "if", "a", "value", "is", "provided", ")", "the", "width", "of", "the", "series", "line", "." ]
train
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/series.py#L259-L274
samirelanduk/quickplots
quickplots/series.py
LineSeries.write_to_canvas
def write_to_canvas(self, canvas, name): """Writes the series to an OmniCanvas canvas. :param Canvas canvas: The canvas to write to. :param str name: The name to give the line graphic on the canvas.""" points = self.canvas_points() args = [] for point in points: ...
python
def write_to_canvas(self, canvas, name): """Writes the series to an OmniCanvas canvas. :param Canvas canvas: The canvas to write to. :param str name: The name to give the line graphic on the canvas.""" points = self.canvas_points() args = [] for point in points: ...
[ "def", "write_to_canvas", "(", "self", ",", "canvas", ",", "name", ")", ":", "points", "=", "self", ".", "canvas_points", "(", ")", "args", "=", "[", "]", "for", "point", "in", "points", ":", "args", "+=", "list", "(", "point", ")", "canvas", ".", ...
Writes the series to an OmniCanvas canvas. :param Canvas canvas: The canvas to write to. :param str name: The name to give the line graphic on the canvas.
[ "Writes", "the", "series", "to", "an", "OmniCanvas", "canvas", "." ]
train
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/series.py#L277-L290
samirelanduk/quickplots
quickplots/series.py
ScatterSeries.size
def size(self, size=None): """Returns or sets (if a value is provided) the diameter of the series' data points. :param Number size: If given, the series' size will be set to\ this. :rtype: ``Number``""" if size is None: return self._size else: ...
python
def size(self, size=None): """Returns or sets (if a value is provided) the diameter of the series' data points. :param Number size: If given, the series' size will be set to\ this. :rtype: ``Number``""" if size is None: return self._size else: ...
[ "def", "size", "(", "self", ",", "size", "=", "None", ")", ":", "if", "size", "is", "None", ":", "return", "self", ".", "_size", "else", ":", "if", "not", "is_numeric", "(", "size", ")", ":", "raise", "TypeError", "(", "\"size must be number, not '%s'\""...
Returns or sets (if a value is provided) the diameter of the series' data points. :param Number size: If given, the series' size will be set to\ this. :rtype: ``Number``
[ "Returns", "or", "sets", "(", "if", "a", "value", "is", "provided", ")", "the", "diameter", "of", "the", "series", "data", "points", "." ]
train
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/series.py#L317-L332
samirelanduk/quickplots
quickplots/series.py
ScatterSeries.write_to_canvas
def write_to_canvas(self, canvas, name): """Writes the series to an OmniCanvas canvas. :param Canvas canvas: The canvas to write to. :param str name: The name to give the line graphic on the canvas.""" points = self.canvas_points() for point in points: canvas.add_ov...
python
def write_to_canvas(self, canvas, name): """Writes the series to an OmniCanvas canvas. :param Canvas canvas: The canvas to write to. :param str name: The name to give the line graphic on the canvas.""" points = self.canvas_points() for point in points: canvas.add_ov...
[ "def", "write_to_canvas", "(", "self", ",", "canvas", ",", "name", ")", ":", "points", "=", "self", ".", "canvas_points", "(", ")", "for", "point", "in", "points", ":", "canvas", ".", "add_oval", "(", "point", "[", "0", "]", "-", "(", "self", ".", ...
Writes the series to an OmniCanvas canvas. :param Canvas canvas: The canvas to write to. :param str name: The name to give the line graphic on the canvas.
[ "Writes", "the", "series", "to", "an", "OmniCanvas", "canvas", "." ]
train
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/series.py#L353-L365
hmartiniano/faz
faz/main.py
faz
def faz(input_file, variables=None): """ FAZ entry point. """ logging.debug("input file:\n {0}\n".format(input_file)) tasks = parse_input_file(input_file, variables=variables) print("Found {0} tasks.".format(len(tasks))) graph = DependencyGraph(tasks) graph.show_tasks() graph.execute...
python
def faz(input_file, variables=None): """ FAZ entry point. """ logging.debug("input file:\n {0}\n".format(input_file)) tasks = parse_input_file(input_file, variables=variables) print("Found {0} tasks.".format(len(tasks))) graph = DependencyGraph(tasks) graph.show_tasks() graph.execute...
[ "def", "faz", "(", "input_file", ",", "variables", "=", "None", ")", ":", "logging", ".", "debug", "(", "\"input file:\\n {0}\\n\"", ".", "format", "(", "input_file", ")", ")", "tasks", "=", "parse_input_file", "(", "input_file", ",", "variables", "=", "vari...
FAZ entry point.
[ "FAZ", "entry", "point", "." ]
train
https://github.com/hmartiniano/faz/blob/36a58c45e8c0718d38cb3c533542c8743e7e7a65/faz/main.py#L34-L43
blubberdiblub/eztemplate
setup.py
get_version
def get_version(): """Build version number from git repository tag.""" try: f = open('eztemplate/version.py', 'r') except IOError as e: if e.errno != errno.ENOENT: raise m = None else: m = re.match('^\s*__version__\s*=\s*(?P<version>.*)$', f.read(), re.M) ...
python
def get_version(): """Build version number from git repository tag.""" try: f = open('eztemplate/version.py', 'r') except IOError as e: if e.errno != errno.ENOENT: raise m = None else: m = re.match('^\s*__version__\s*=\s*(?P<version>.*)$', f.read(), re.M) ...
[ "def", "get_version", "(", ")", ":", "try", ":", "f", "=", "open", "(", "'eztemplate/version.py'", ",", "'r'", ")", "except", "IOError", "as", "e", ":", "if", "e", ".", "errno", "!=", "errno", ".", "ENOENT", ":", "raise", "m", "=", "None", "else", ...
Build version number from git repository tag.
[ "Build", "version", "number", "from", "git", "repository", "tag", "." ]
train
https://github.com/blubberdiblub/eztemplate/blob/ab5b2b4987c045116d130fd83e216704b8edfb5d/setup.py#L15-L68
blubberdiblub/eztemplate
setup.py
get_long_description
def get_long_description(): """Provide README.md converted to reStructuredText format.""" try: with open('README.md', 'r') as f: description = f.read() except OSError as e: if e.errno != errno.ENOENT: raise return None try: process = subprocess.Po...
python
def get_long_description(): """Provide README.md converted to reStructuredText format.""" try: with open('README.md', 'r') as f: description = f.read() except OSError as e: if e.errno != errno.ENOENT: raise return None try: process = subprocess.Po...
[ "def", "get_long_description", "(", ")", ":", "try", ":", "with", "open", "(", "'README.md'", ",", "'r'", ")", "as", "f", ":", "description", "=", "f", ".", "read", "(", ")", "except", "OSError", "as", "e", ":", "if", "e", ".", "errno", "!=", "errn...
Provide README.md converted to reStructuredText format.
[ "Provide", "README", ".", "md", "converted", "to", "reStructuredText", "format", "." ]
train
https://github.com/blubberdiblub/eztemplate/blob/ab5b2b4987c045116d130fd83e216704b8edfb5d/setup.py#L71-L103
anti1869/sunhead
src/sunhead/workers/http/ext/runtime.py
RuntimeStatsView.get
async def get(self): """Printing runtime statistics in JSON""" context_data = self.get_context_data() context_data.update(getattr(self.request.app, "stats", {})) response = self.json_response(context_data) return response
python
async def get(self): """Printing runtime statistics in JSON""" context_data = self.get_context_data() context_data.update(getattr(self.request.app, "stats", {})) response = self.json_response(context_data) return response
[ "async", "def", "get", "(", "self", ")", ":", "context_data", "=", "self", ".", "get_context_data", "(", ")", "context_data", ".", "update", "(", "getattr", "(", "self", ".", "request", ".", "app", ",", "\"stats\"", ",", "{", "}", ")", ")", "response",...
Printing runtime statistics in JSON
[ "Printing", "runtime", "statistics", "in", "JSON" ]
train
https://github.com/anti1869/sunhead/blob/5117ec797a38eb82d955241d20547d125efe80f3/src/sunhead/workers/http/ext/runtime.py#L56-L63
KnowledgeLinks/rdfframework
rdfframework/connections/fedoracommons.py
FedoraCommons.check_status
def check_status(self): """ tests both the ext_url and local_url to see if the database is running returns: True if a connection can be made False if the connection cannot me made """ log = logging.getLogger("%s.%s" % (self.log_name, ...
python
def check_status(self): """ tests both the ext_url and local_url to see if the database is running returns: True if a connection can be made False if the connection cannot me made """ log = logging.getLogger("%s.%s" % (self.log_name, ...
[ "def", "check_status", "(", "self", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "\"%s.%s\"", "%", "(", "self", ".", "log_name", ",", "inspect", ".", "stack", "(", ")", "[", "0", "]", "[", "3", "]", ")", ")", "log", ".", "setLevel", "(...
tests both the ext_url and local_url to see if the database is running returns: True if a connection can be made False if the connection cannot me made
[ "tests", "both", "the", "ext_url", "and", "local_url", "to", "see", "if", "the", "database", "is", "running" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/connections/fedoracommons.py#L70-L100
sci-bots/mpm
mpm/bin/api.py
parse_args
def parse_args(args=None): '''Parses arguments, returns ``(options, args)``.''' if args is None: args = sys.argv parser = ArgumentParser(description='Actions related to available ' 'MicroDrop Conda package plugin(s).', parents=[PLUGIN_PARSER])...
python
def parse_args(args=None): '''Parses arguments, returns ``(options, args)``.''' if args is None: args = sys.argv parser = ArgumentParser(description='Actions related to available ' 'MicroDrop Conda package plugin(s).', parents=[PLUGIN_PARSER])...
[ "def", "parse_args", "(", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "sys", ".", "argv", "parser", "=", "ArgumentParser", "(", "description", "=", "'Actions related to available '", "'MicroDrop Conda package plugin(s).'", ",", "...
Parses arguments, returns ``(options, args)``.
[ "Parses", "arguments", "returns", "(", "options", "args", ")", "." ]
train
https://github.com/sci-bots/mpm/blob/a69651cda4b37ee6b17df4fe0809249e7f4dc536/mpm/bin/api.py#L30-L39
sci-bots/mpm
mpm/bin/api.py
_dump_list
def _dump_list(list_data, jsonify, stream=sys.stdout): ''' Dump list to output stream, optionally encoded as JSON. Parameters ---------- list_data : list jsonify : bool stream : file-like ''' if not jsonify and list_data: print >> stream, '\n'.join(list_data) else: ...
python
def _dump_list(list_data, jsonify, stream=sys.stdout): ''' Dump list to output stream, optionally encoded as JSON. Parameters ---------- list_data : list jsonify : bool stream : file-like ''' if not jsonify and list_data: print >> stream, '\n'.join(list_data) else: ...
[ "def", "_dump_list", "(", "list_data", ",", "jsonify", ",", "stream", "=", "sys", ".", "stdout", ")", ":", "if", "not", "jsonify", "and", "list_data", ":", "print", ">>", "stream", ",", "'\\n'", ".", "join", "(", "list_data", ")", "else", ":", "print",...
Dump list to output stream, optionally encoded as JSON. Parameters ---------- list_data : list jsonify : bool stream : file-like
[ "Dump", "list", "to", "output", "stream", "optionally", "encoded", "as", "JSON", "." ]
train
https://github.com/sci-bots/mpm/blob/a69651cda4b37ee6b17df4fe0809249e7f4dc536/mpm/bin/api.py#L43-L56
b3j0f/annotation
b3j0f/annotation/async.py
Asynchronous._threaded
def _threaded(self, *args, **kwargs): """Call the target and put the result in the Queue.""" for target in self.targets: result = target(*args, **kwargs) self.queue.put(result)
python
def _threaded(self, *args, **kwargs): """Call the target and put the result in the Queue.""" for target in self.targets: result = target(*args, **kwargs) self.queue.put(result)
[ "def", "_threaded", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "target", "in", "self", ".", "targets", ":", "result", "=", "target", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "queue", ".", "put", ...
Call the target and put the result in the Queue.
[ "Call", "the", "target", "and", "put", "the", "result", "in", "the", "Queue", "." ]
train
https://github.com/b3j0f/annotation/blob/738035a974e4092696d9dc1bbd149faa21c8c51f/b3j0f/annotation/async.py#L97-L102
b3j0f/annotation
b3j0f/annotation/async.py
Asynchronous.start
def start(self, *args, **kwargs): """Start execution of the function.""" self.queue = Queue() thread = Thread(target=self._threaded, args=args, kwargs=kwargs) thread.start() return Asynchronous.Result(self.queue, thread)
python
def start(self, *args, **kwargs): """Start execution of the function.""" self.queue = Queue() thread = Thread(target=self._threaded, args=args, kwargs=kwargs) thread.start() return Asynchronous.Result(self.queue, thread)
[ "def", "start", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "queue", "=", "Queue", "(", ")", "thread", "=", "Thread", "(", "target", "=", "self", ".", "_threaded", ",", "args", "=", "args", ",", "kwargs", "=", ...
Start execution of the function.
[ "Start", "execution", "of", "the", "function", "." ]
train
https://github.com/b3j0f/annotation/blob/738035a974e4092696d9dc1bbd149faa21c8c51f/b3j0f/annotation/async.py#L111-L118
b3j0f/annotation
b3j0f/annotation/async.py
Observable.notify_observers
def notify_observers(self, joinpoint, post=False): """Notify observers with parameter calls and information about pre/post call. """ _observers = tuple(self.observers) for observer in _observers: observer.notify(joinpoint=joinpoint, post=post)
python
def notify_observers(self, joinpoint, post=False): """Notify observers with parameter calls and information about pre/post call. """ _observers = tuple(self.observers) for observer in _observers: observer.notify(joinpoint=joinpoint, post=post)
[ "def", "notify_observers", "(", "self", ",", "joinpoint", ",", "post", "=", "False", ")", ":", "_observers", "=", "tuple", "(", "self", ".", "observers", ")", "for", "observer", "in", "_observers", ":", "observer", ".", "notify", "(", "joinpoint", "=", "...
Notify observers with parameter calls and information about pre/post call.
[ "Notify", "observers", "with", "parameter", "calls", "and", "information", "about", "pre", "/", "post", "call", "." ]
train
https://github.com/b3j0f/annotation/blob/738035a974e4092696d9dc1bbd149faa21c8c51f/b3j0f/annotation/async.py#L279-L287
Bekt/flask-pusher
flask_pusher.py
Pusher.init_app
def init_app(self, app, **options): """Configures the application.""" sd = options.setdefault conf = app.config sd('app_id', conf.get('PUSHER_APP_ID')) sd('key', conf.get('PUSHER_KEY')) sd('secret', conf.get('PUSHER_SECRET')) sd('ssl', conf.get('PUSHER_SSL', True...
python
def init_app(self, app, **options): """Configures the application.""" sd = options.setdefault conf = app.config sd('app_id', conf.get('PUSHER_APP_ID')) sd('key', conf.get('PUSHER_KEY')) sd('secret', conf.get('PUSHER_SECRET')) sd('ssl', conf.get('PUSHER_SSL', True...
[ "def", "init_app", "(", "self", ",", "app", ",", "*", "*", "options", ")", ":", "sd", "=", "options", ".", "setdefault", "conf", "=", "app", ".", "config", "sd", "(", "'app_id'", ",", "conf", ".", "get", "(", "'PUSHER_APP_ID'", ")", ")", "sd", "(",...
Configures the application.
[ "Configures", "the", "application", "." ]
train
https://github.com/Bekt/flask-pusher/blob/7ee077687fb01011b19a5cae65ccb35512d4e0c5/flask_pusher.py#L11-L35
minhhoit/yacms
yacms/blog/management/commands/import_tumblr.py
title_from_content
def title_from_content(content): """ Try and extract the first sentence from a block of test to use as a title. """ for end in (". ", "?", "!", "<br />", "\n", "</p>"): if end in content: content = content.split(end)[0] + end break return strip_tags(content)
python
def title_from_content(content): """ Try and extract the first sentence from a block of test to use as a title. """ for end in (". ", "?", "!", "<br />", "\n", "</p>"): if end in content: content = content.split(end)[0] + end break return strip_tags(content)
[ "def", "title_from_content", "(", "content", ")", ":", "for", "end", "in", "(", "\". \"", ",", "\"?\"", ",", "\"!\"", ",", "\"<br />\"", ",", "\"\\n\"", ",", "\"</p>\"", ")", ":", "if", "end", "in", "content", ":", "content", "=", "content", ".", "spli...
Try and extract the first sentence from a block of test to use as a title.
[ "Try", "and", "extract", "the", "first", "sentence", "from", "a", "block", "of", "test", "to", "use", "as", "a", "title", "." ]
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/blog/management/commands/import_tumblr.py#L25-L33
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/action_plugins/pause.py
ActionModule.run
def run(self, conn, tmp, module_name, module_args, inject): ''' run the pause actionmodule ''' hosts = ', '.join(self.runner.host_set) args = parse_kv(template(self.runner.basedir, module_args, inject)) # Are 'minutes' or 'seconds' keys that exist in 'args'? if 'minutes' in args...
python
def run(self, conn, tmp, module_name, module_args, inject): ''' run the pause actionmodule ''' hosts = ', '.join(self.runner.host_set) args = parse_kv(template(self.runner.basedir, module_args, inject)) # Are 'minutes' or 'seconds' keys that exist in 'args'? if 'minutes' in args...
[ "def", "run", "(", "self", ",", "conn", ",", "tmp", ",", "module_name", ",", "module_args", ",", "inject", ")", ":", "hosts", "=", "', '", ".", "join", "(", "self", ".", "runner", ".", "host_set", ")", "args", "=", "parse_kv", "(", "template", "(", ...
run the pause actionmodule
[ "run", "the", "pause", "actionmodule" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/action_plugins/pause.py#L49-L109
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/action_plugins/pause.py
ActionModule._start
def _start(self): ''' mark the time of execution for duration calculations later ''' self.start = time.time() self.result['start'] = str(datetime.datetime.now()) if not self.pause_type == 'prompt': print "(^C-c = continue early, ^C-a = abort)"
python
def _start(self): ''' mark the time of execution for duration calculations later ''' self.start = time.time() self.result['start'] = str(datetime.datetime.now()) if not self.pause_type == 'prompt': print "(^C-c = continue early, ^C-a = abort)"
[ "def", "_start", "(", "self", ")", ":", "self", ".", "start", "=", "time", ".", "time", "(", ")", "self", ".", "result", "[", "'start'", "]", "=", "str", "(", "datetime", ".", "datetime", ".", "now", "(", ")", ")", "if", "not", "self", ".", "pa...
mark the time of execution for duration calculations later
[ "mark", "the", "time", "of", "execution", "for", "duration", "calculations", "later" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/action_plugins/pause.py#L111-L116
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/action_plugins/pause.py
ActionModule._stop
def _stop(self): ''' calculate the duration we actually paused for and then finish building the task result string ''' duration = time.time() - self.start self.result['stop'] = str(datetime.datetime.now()) self.result['delta'] = int(duration) if self.duration_unit == 'mi...
python
def _stop(self): ''' calculate the duration we actually paused for and then finish building the task result string ''' duration = time.time() - self.start self.result['stop'] = str(datetime.datetime.now()) self.result['delta'] = int(duration) if self.duration_unit == 'mi...
[ "def", "_stop", "(", "self", ")", ":", "duration", "=", "time", ".", "time", "(", ")", "-", "self", ".", "start", "self", ".", "result", "[", "'stop'", "]", "=", "str", "(", "datetime", ".", "datetime", ".", "now", "(", ")", ")", "self", ".", "...
calculate the duration we actually paused for and then finish building the task result string
[ "calculate", "the", "duration", "we", "actually", "paused", "for", "and", "then", "finish", "building", "the", "task", "result", "string" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/action_plugins/pause.py#L118-L130
totokaka/pySpaceGDN
pyspacegdn/response.py
Response.add
def add(self, data, status_code, status_reason): """ Add data to this response. This method should be used to add data to the response. The data should be all the data returned in one page from SpaceGDN. If this method is called before, data will be appended to the existing dat...
python
def add(self, data, status_code, status_reason): """ Add data to this response. This method should be used to add data to the response. The data should be all the data returned in one page from SpaceGDN. If this method is called before, data will be appended to the existing dat...
[ "def", "add", "(", "self", ",", "data", ",", "status_code", ",", "status_reason", ")", ":", "self", ".", "status_code", "=", "status_code", "self", ".", "status_reason", "=", "status_reason", "self", ".", "success", "=", "status_code", "==", "200", "if", "...
Add data to this response. This method should be used to add data to the response. The data should be all the data returned in one page from SpaceGDN. If this method is called before, data will be appended to the existing data with `+=`, this means dicts, for instance will not work wit...
[ "Add", "data", "to", "this", "response", "." ]
train
https://github.com/totokaka/pySpaceGDN/blob/55c8be8d751e24873e0a7f7e99d2b715442ec878/pyspacegdn/response.py#L50-L78
drewsonne/aws-autodiscovery-templater
awsautodiscoverytemplater/__init__.py
parse_cli_args_into
def parse_cli_args_into(): """ Creates the cli argparser for application specifics and AWS credentials. :return: A dict of values from the cli arguments :rtype: TemplaterCommand """ cli_arg_parser = argparse.ArgumentParser(parents=[ AWSArgumentParser(default_role_session_name='aws-autodi...
python
def parse_cli_args_into(): """ Creates the cli argparser for application specifics and AWS credentials. :return: A dict of values from the cli arguments :rtype: TemplaterCommand """ cli_arg_parser = argparse.ArgumentParser(parents=[ AWSArgumentParser(default_role_session_name='aws-autodi...
[ "def", "parse_cli_args_into", "(", ")", ":", "cli_arg_parser", "=", "argparse", ".", "ArgumentParser", "(", "parents", "=", "[", "AWSArgumentParser", "(", "default_role_session_name", "=", "'aws-autodiscovery-templater'", ")", "]", ")", "main_parser", "=", "cli_arg_pa...
Creates the cli argparser for application specifics and AWS credentials. :return: A dict of values from the cli arguments :rtype: TemplaterCommand
[ "Creates", "the", "cli", "argparser", "for", "application", "specifics", "and", "AWS", "credentials", ".", ":", "return", ":", "A", "dict", "of", "values", "from", "the", "cli", "arguments", ":", "rtype", ":", "TemplaterCommand" ]
train
https://github.com/drewsonne/aws-autodiscovery-templater/blob/9ef2edd6a373aeb5d343b841550c210966efe079/awsautodiscoverytemplater/__init__.py#L8-L45
dnmellen/pycolorterm
pycolorterm/pycolorterm.py
print_pretty
def print_pretty(text, **kwargs): ''' Prints using pycolorterm formatting :param text: Text with formatting :type text: string :param kwargs: Keyword args that will be passed to the print function :type kwargs: dict Example:: print_pretty('Hello {BG_RED}WORLD{END}') ''' t...
python
def print_pretty(text, **kwargs): ''' Prints using pycolorterm formatting :param text: Text with formatting :type text: string :param kwargs: Keyword args that will be passed to the print function :type kwargs: dict Example:: print_pretty('Hello {BG_RED}WORLD{END}') ''' t...
[ "def", "print_pretty", "(", "text", ",", "*", "*", "kwargs", ")", ":", "text", "=", "_prepare", "(", "text", ")", "print", "(", "'{}{}'", ".", "format", "(", "text", ".", "format", "(", "*", "*", "styles", ")", ".", "replace", "(", "styles", "[", ...
Prints using pycolorterm formatting :param text: Text with formatting :type text: string :param kwargs: Keyword args that will be passed to the print function :type kwargs: dict Example:: print_pretty('Hello {BG_RED}WORLD{END}')
[ "Prints", "using", "pycolorterm", "formatting" ]
train
https://github.com/dnmellen/pycolorterm/blob/f650eb8dbdce1a283e7b1403be1071b57c4849c6/pycolorterm/pycolorterm.py#L71-L86
baguette-io/baguette-utils
sel/request.py
Request.all
def all(self, endpoint, *args, **kwargs): """Retrieve all the data of a paginated endpoint, using GET. :returns: The endpoint unpaginated data :rtype: dict """ # 1. Initialize the pagination parameters. kwargs.setdefault('params', {})['offset'] = 0 kwargs.setdefau...
python
def all(self, endpoint, *args, **kwargs): """Retrieve all the data of a paginated endpoint, using GET. :returns: The endpoint unpaginated data :rtype: dict """ # 1. Initialize the pagination parameters. kwargs.setdefault('params', {})['offset'] = 0 kwargs.setdefau...
[ "def", "all", "(", "self", ",", "endpoint", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# 1. Initialize the pagination parameters.", "kwargs", ".", "setdefault", "(", "'params'", ",", "{", "}", ")", "[", "'offset'", "]", "=", "0", "kwargs", "."...
Retrieve all the data of a paginated endpoint, using GET. :returns: The endpoint unpaginated data :rtype: dict
[ "Retrieve", "all", "the", "data", "of", "a", "paginated", "endpoint", "using", "GET", ".", ":", "returns", ":", "The", "endpoint", "unpaginated", "data", ":", "rtype", ":", "dict" ]
train
https://github.com/baguette-io/baguette-utils/blob/bf6b82811167f9268b5a1bbbdece411158f96d1e/sel/request.py#L74-L99
MacHu-GWU/windtalker-project
windtalker/symmetric.py
SymmetricCipher.any_text_to_fernet_key
def any_text_to_fernet_key(self, text): """ Convert any text to a fernet key for encryption. """ md5 = fingerprint.fingerprint.of_text(text) fernet_key = base64.b64encode(md5.encode("utf-8")) return fernet_key
python
def any_text_to_fernet_key(self, text): """ Convert any text to a fernet key for encryption. """ md5 = fingerprint.fingerprint.of_text(text) fernet_key = base64.b64encode(md5.encode("utf-8")) return fernet_key
[ "def", "any_text_to_fernet_key", "(", "self", ",", "text", ")", ":", "md5", "=", "fingerprint", ".", "fingerprint", ".", "of_text", "(", "text", ")", "fernet_key", "=", "base64", ".", "b64encode", "(", "md5", ".", "encode", "(", "\"utf-8\"", ")", ")", "r...
Convert any text to a fernet key for encryption.
[ "Convert", "any", "text", "to", "a", "fernet", "key", "for", "encryption", "." ]
train
https://github.com/MacHu-GWU/windtalker-project/blob/1dcff7c3692d5883cf1b55d1ea745723cfc6c3ce/windtalker/symmetric.py#L56-L62
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/autoparser/path_patterns.py
_neighbour_to_path_call
def _neighbour_to_path_call(neig_type, neighbour, element): """ Get :class:`PathCall` from `neighbour` and `element`. Args: neigh_type (str): `left` for left neighbour, `right` for .. This is used to determine :attr:`PathCall.call_type` of returne...
python
def _neighbour_to_path_call(neig_type, neighbour, element): """ Get :class:`PathCall` from `neighbour` and `element`. Args: neigh_type (str): `left` for left neighbour, `right` for .. This is used to determine :attr:`PathCall.call_type` of returne...
[ "def", "_neighbour_to_path_call", "(", "neig_type", ",", "neighbour", ",", "element", ")", ":", "params", "=", "[", "None", ",", "None", ",", "neighbour", ".", "getContent", "(", ")", ".", "strip", "(", ")", "]", "if", "neighbour", ".", "isTag", "(", "...
Get :class:`PathCall` from `neighbour` and `element`. Args: neigh_type (str): `left` for left neighbour, `right` for .. This is used to determine :attr:`PathCall.call_type` of returned object. neighbour (obj): Reference to `neighbour` object. ...
[ "Get", ":", "class", ":", "PathCall", "from", "neighbour", "and", "element", "." ]
train
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/autoparser/path_patterns.py#L76-L104
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/autoparser/path_patterns.py
neighbours_pattern
def neighbours_pattern(element): """ Look for negihbours of the `element`, return proper :class:`PathCall`. Args: element (obj): HTMLElement instance of the object you are looking for. Returns: list: List of :class:`PathCall` instances. """ # check if there are any neighbours ...
python
def neighbours_pattern(element): """ Look for negihbours of the `element`, return proper :class:`PathCall`. Args: element (obj): HTMLElement instance of the object you are looking for. Returns: list: List of :class:`PathCall` instances. """ # check if there are any neighbours ...
[ "def", "neighbours_pattern", "(", "element", ")", ":", "# check if there are any neighbours", "if", "not", "element", ".", "parent", ":", "return", "[", "]", "parent", "=", "element", ".", "parent", "# filter only visible tags/neighbours", "neighbours", "=", "filter",...
Look for negihbours of the `element`, return proper :class:`PathCall`. Args: element (obj): HTMLElement instance of the object you are looking for. Returns: list: List of :class:`PathCall` instances.
[ "Look", "for", "negihbours", "of", "the", "element", "return", "proper", ":", "class", ":", "PathCall", "." ]
train
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/autoparser/path_patterns.py#L107-L155
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/autoparser/path_patterns.py
predecesors_pattern
def predecesors_pattern(element, root): """ Look for `element` by its predecesors. Args: element (obj): HTMLElement instance of the object you are looking for. root (obj): Root of the `DOM`. Returns: list: ``[PathCall()]`` - list with one :class:`PathCall` object (to \ ...
python
def predecesors_pattern(element, root): """ Look for `element` by its predecesors. Args: element (obj): HTMLElement instance of the object you are looking for. root (obj): Root of the `DOM`. Returns: list: ``[PathCall()]`` - list with one :class:`PathCall` object (to \ ...
[ "def", "predecesors_pattern", "(", "element", ",", "root", ")", ":", "def", "is_root_container", "(", "el", ")", ":", "return", "el", ".", "parent", ".", "parent", ".", "getTagName", "(", ")", "==", "\"\"", "if", "not", "element", ".", "parent", "or", ...
Look for `element` by its predecesors. Args: element (obj): HTMLElement instance of the object you are looking for. root (obj): Root of the `DOM`. Returns: list: ``[PathCall()]`` - list with one :class:`PathCall` object (to \ allow use with ``.extend(predecesors_pattern()...
[ "Look", "for", "element", "by", "its", "predecesors", "." ]
train
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/autoparser/path_patterns.py#L158-L193