repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
sharibarboza/py_zap
py_zap/utils.py
to_json
def to_json(data): """Return data as a JSON string.""" return json.dumps(data, default=lambda x: x.__dict__, sort_keys=True, indent=4)
python
def to_json(data): """Return data as a JSON string.""" return json.dumps(data, default=lambda x: x.__dict__, sort_keys=True, indent=4)
[ "def", "to_json", "(", "data", ")", ":", "return", "json", ".", "dumps", "(", "data", ",", "default", "=", "lambda", "x", ":", "x", ".", "__dict__", ",", "sort_keys", "=", "True", ",", "indent", "=", "4", ")" ]
Return data as a JSON string.
[ "Return", "data", "as", "a", "JSON", "string", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/utils.py#L30-L32
train
56,200
sharibarboza/py_zap
py_zap/utils.py
convert_string
def convert_string(string, chars=None): """Remove certain characters from a string.""" if chars is None: chars = [',', '.', '-', '/', ':', ' '] for ch in chars: if ch in string: string = string.replace(ch, ' ') return string
python
def convert_string(string, chars=None): """Remove certain characters from a string.""" if chars is None: chars = [',', '.', '-', '/', ':', ' '] for ch in chars: if ch in string: string = string.replace(ch, ' ') return string
[ "def", "convert_string", "(", "string", ",", "chars", "=", "None", ")", ":", "if", "chars", "is", "None", ":", "chars", "=", "[", "','", ",", "'.'", ",", "'-'", ",", "'/'", ",", "':'", ",", "' '", "]", "for", "ch", "in", "chars", ":", "if", "c...
Remove certain characters from a string.
[ "Remove", "certain", "characters", "from", "a", "string", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/utils.py#L34-L42
train
56,201
sharibarboza/py_zap
py_zap/utils.py
convert_time
def convert_time(time): """Convert a time string into 24-hour time.""" split_time = time.split() try: # Get rid of period in a.m./p.m. am_pm = split_time[1].replace('.', '') time_str = '{0} {1}'.format(split_time[0], am_pm) except IndexError: return time try: ...
python
def convert_time(time): """Convert a time string into 24-hour time.""" split_time = time.split() try: # Get rid of period in a.m./p.m. am_pm = split_time[1].replace('.', '') time_str = '{0} {1}'.format(split_time[0], am_pm) except IndexError: return time try: ...
[ "def", "convert_time", "(", "time", ")", ":", "split_time", "=", "time", ".", "split", "(", ")", "try", ":", "# Get rid of period in a.m./p.m.", "am_pm", "=", "split_time", "[", "1", "]", ".", "replace", "(", "'.'", ",", "''", ")", "time_str", "=", "'{0}...
Convert a time string into 24-hour time.
[ "Convert", "a", "time", "string", "into", "24", "-", "hour", "time", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/utils.py#L51-L65
train
56,202
sharibarboza/py_zap
py_zap/utils.py
convert_month
def convert_month(date, shorten=True, cable=True): """Replace month by shortening or lengthening it. :param shorten: Set to True to shorten month name. :param cable: Set to True if category is Cable. """ month = date.split()[0].lower() if 'sept' in month: shorten = False if cable else T...
python
def convert_month(date, shorten=True, cable=True): """Replace month by shortening or lengthening it. :param shorten: Set to True to shorten month name. :param cable: Set to True if category is Cable. """ month = date.split()[0].lower() if 'sept' in month: shorten = False if cable else T...
[ "def", "convert_month", "(", "date", ",", "shorten", "=", "True", ",", "cable", "=", "True", ")", ":", "month", "=", "date", ".", "split", "(", ")", "[", "0", "]", ".", "lower", "(", ")", "if", "'sept'", "in", "month", ":", "shorten", "=", "False...
Replace month by shortening or lengthening it. :param shorten: Set to True to shorten month name. :param cable: Set to True if category is Cable.
[ "Replace", "month", "by", "shortening", "or", "lengthening", "it", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/utils.py#L71-L89
train
56,203
sharibarboza/py_zap
py_zap/utils.py
convert_date
def convert_date(date): """Convert string to datetime object.""" date = convert_month(date, shorten=False) clean_string = convert_string(date) return datetime.strptime(clean_string, DATE_FMT.replace('-',''))
python
def convert_date(date): """Convert string to datetime object.""" date = convert_month(date, shorten=False) clean_string = convert_string(date) return datetime.strptime(clean_string, DATE_FMT.replace('-',''))
[ "def", "convert_date", "(", "date", ")", ":", "date", "=", "convert_month", "(", "date", ",", "shorten", "=", "False", ")", "clean_string", "=", "convert_string", "(", "date", ")", "return", "datetime", ".", "strptime", "(", "clean_string", ",", "DATE_FMT", ...
Convert string to datetime object.
[ "Convert", "string", "to", "datetime", "object", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/utils.py#L91-L95
train
56,204
sharibarboza/py_zap
py_zap/utils.py
date_in_range
def date_in_range(date1, date2, range): """Check if two date objects are within a specific range""" date_obj1 = convert_date(date1) date_obj2 = convert_date(date2) return (date_obj2 - date_obj1).days <= range
python
def date_in_range(date1, date2, range): """Check if two date objects are within a specific range""" date_obj1 = convert_date(date1) date_obj2 = convert_date(date2) return (date_obj2 - date_obj1).days <= range
[ "def", "date_in_range", "(", "date1", ",", "date2", ",", "range", ")", ":", "date_obj1", "=", "convert_date", "(", "date1", ")", "date_obj2", "=", "convert_date", "(", "date2", ")", "return", "(", "date_obj2", "-", "date_obj1", ")", ".", "days", "<=", "r...
Check if two date objects are within a specific range
[ "Check", "if", "two", "date", "objects", "are", "within", "a", "specific", "range" ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/utils.py#L101-L105
train
56,205
sharibarboza/py_zap
py_zap/utils.py
inc_date
def inc_date(date_obj, num, date_fmt): """Increment the date by a certain number and return date object. as the specific string format. """ return (date_obj + timedelta(days=num)).strftime(date_fmt)
python
def inc_date(date_obj, num, date_fmt): """Increment the date by a certain number and return date object. as the specific string format. """ return (date_obj + timedelta(days=num)).strftime(date_fmt)
[ "def", "inc_date", "(", "date_obj", ",", "num", ",", "date_fmt", ")", ":", "return", "(", "date_obj", "+", "timedelta", "(", "days", "=", "num", ")", ")", ".", "strftime", "(", "date_fmt", ")" ]
Increment the date by a certain number and return date object. as the specific string format.
[ "Increment", "the", "date", "by", "a", "certain", "number", "and", "return", "date", "object", ".", "as", "the", "specific", "string", "format", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/utils.py#L107-L111
train
56,206
sharibarboza/py_zap
py_zap/utils.py
get_soup
def get_soup(url): """Request the page and return the soup.""" html = requests.get(url, stream=True, headers=HEADERS) if html.status_code != 404: return BeautifulSoup(html.content, 'html.parser') else: return None
python
def get_soup(url): """Request the page and return the soup.""" html = requests.get(url, stream=True, headers=HEADERS) if html.status_code != 404: return BeautifulSoup(html.content, 'html.parser') else: return None
[ "def", "get_soup", "(", "url", ")", ":", "html", "=", "requests", ".", "get", "(", "url", ",", "stream", "=", "True", ",", "headers", "=", "HEADERS", ")", "if", "html", ".", "status_code", "!=", "404", ":", "return", "BeautifulSoup", "(", "html", "."...
Request the page and return the soup.
[ "Request", "the", "page", "and", "return", "the", "soup", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/utils.py#L127-L133
train
56,207
sharibarboza/py_zap
py_zap/utils.py
match_list
def match_list(query_list, string): """Return True if all words in a word list are in the string. :param query_list: list of words to match :param string: the word or words to be matched against """ # Get rid of 'the' word to ease string matching match = False index = 0 string = ' '.joi...
python
def match_list(query_list, string): """Return True if all words in a word list are in the string. :param query_list: list of words to match :param string: the word or words to be matched against """ # Get rid of 'the' word to ease string matching match = False index = 0 string = ' '.joi...
[ "def", "match_list", "(", "query_list", ",", "string", ")", ":", "# Get rid of 'the' word to ease string matching", "match", "=", "False", "index", "=", "0", "string", "=", "' '", ".", "join", "(", "filter_stopwords", "(", "string", ")", ")", "if", "not", "isi...
Return True if all words in a word list are in the string. :param query_list: list of words to match :param string: the word or words to be matched against
[ "Return", "True", "if", "all", "words", "in", "a", "word", "list", "are", "in", "the", "string", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/utils.py#L135-L158
train
56,208
sharibarboza/py_zap
py_zap/utils.py
filter_stopwords
def filter_stopwords(phrase): """Filter out stop words and return as a list of words""" if not isinstance(phrase, list): phrase = phrase.split() stopwords = ['the', 'a', 'in', 'to'] return [word.lower() for word in phrase if word.lower() not in stopwords]
python
def filter_stopwords(phrase): """Filter out stop words and return as a list of words""" if not isinstance(phrase, list): phrase = phrase.split() stopwords = ['the', 'a', 'in', 'to'] return [word.lower() for word in phrase if word.lower() not in stopwords]
[ "def", "filter_stopwords", "(", "phrase", ")", ":", "if", "not", "isinstance", "(", "phrase", ",", "list", ")", ":", "phrase", "=", "phrase", ".", "split", "(", ")", "stopwords", "=", "[", "'the'", ",", "'a'", ",", "'in'", ",", "'to'", "]", "return",...
Filter out stop words and return as a list of words
[ "Filter", "out", "stop", "words", "and", "return", "as", "a", "list", "of", "words" ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/utils.py#L160-L166
train
56,209
sharibarboza/py_zap
py_zap/utils.py
safe_unicode
def safe_unicode(string): """If Python 2, replace non-ascii characters and return encoded string.""" if not PY3: uni = string.replace(u'\u2019', "'") return uni.encode('utf-8') return string
python
def safe_unicode(string): """If Python 2, replace non-ascii characters and return encoded string.""" if not PY3: uni = string.replace(u'\u2019', "'") return uni.encode('utf-8') return string
[ "def", "safe_unicode", "(", "string", ")", ":", "if", "not", "PY3", ":", "uni", "=", "string", ".", "replace", "(", "u'\\u2019'", ",", "\"'\"", ")", "return", "uni", ".", "encode", "(", "'utf-8'", ")", "return", "string" ]
If Python 2, replace non-ascii characters and return encoded string.
[ "If", "Python", "2", "replace", "non", "-", "ascii", "characters", "and", "return", "encoded", "string", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/utils.py#L174-L180
train
56,210
sharibarboza/py_zap
py_zap/utils.py
get_strings
def get_strings(soup, tag): """Get all the string children from an html tag.""" tags = soup.find_all(tag) strings = [s.string for s in tags if s.string] return strings
python
def get_strings(soup, tag): """Get all the string children from an html tag.""" tags = soup.find_all(tag) strings = [s.string for s in tags if s.string] return strings
[ "def", "get_strings", "(", "soup", ",", "tag", ")", ":", "tags", "=", "soup", ".", "find_all", "(", "tag", ")", "strings", "=", "[", "s", ".", "string", "for", "s", "in", "tags", "if", "s", ".", "string", "]", "return", "strings" ]
Get all the string children from an html tag.
[ "Get", "all", "the", "string", "children", "from", "an", "html", "tag", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/utils.py#L182-L186
train
56,211
e7dal/bubble3
bubble3/commands/cmd_init.py
cli
def cli(ctx, given_name, demo): """Initializes a bubble.""" path = None if path is None: path = ctx.home bubble_file_name = path + '/.bubble' config_file = path + '/config/config.yaml' if os.path.exists(bubble_file_name) and os.path.isfile(bubble_file_name): ctx....
python
def cli(ctx, given_name, demo): """Initializes a bubble.""" path = None if path is None: path = ctx.home bubble_file_name = path + '/.bubble' config_file = path + '/config/config.yaml' if os.path.exists(bubble_file_name) and os.path.isfile(bubble_file_name): ctx....
[ "def", "cli", "(", "ctx", ",", "given_name", ",", "demo", ")", ":", "path", "=", "None", "if", "path", "is", "None", ":", "path", "=", "ctx", ".", "home", "bubble_file_name", "=", "path", "+", "'/.bubble'", "config_file", "=", "path", "+", "'/config/co...
Initializes a bubble.
[ "Initializes", "a", "bubble", "." ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/commands/cmd_init.py#L28-L92
train
56,212
Equitable/trump
trump/templating/munging_helpers.py
mixin_pab._bld_op
def _bld_op(self, op, num, **kwargs): """implements pandas an operator""" kwargs['other'] = num setattr(self, op, {'mtype': pab, 'kwargs': kwargs})
python
def _bld_op(self, op, num, **kwargs): """implements pandas an operator""" kwargs['other'] = num setattr(self, op, {'mtype': pab, 'kwargs': kwargs})
[ "def", "_bld_op", "(", "self", ",", "op", ",", "num", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'other'", "]", "=", "num", "setattr", "(", "self", ",", "op", ",", "{", "'mtype'", ":", "pab", ",", "'kwargs'", ":", "kwargs", "}", ")" ]
implements pandas an operator
[ "implements", "pandas", "an", "operator" ]
a2802692bc642fa32096374159eea7ceca2947b4
https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/trump/templating/munging_helpers.py#L29-L32
train
56,213
Equitable/trump
trump/templating/munging_helpers.py
mixin_pab._bld_pab_generic
def _bld_pab_generic(self, funcname, **kwargs): """ implements a generic version of an attribute based pandas function """ margs = {'mtype': pab, 'kwargs': kwargs} setattr(self, funcname, margs)
python
def _bld_pab_generic(self, funcname, **kwargs): """ implements a generic version of an attribute based pandas function """ margs = {'mtype': pab, 'kwargs': kwargs} setattr(self, funcname, margs)
[ "def", "_bld_pab_generic", "(", "self", ",", "funcname", ",", "*", "*", "kwargs", ")", ":", "margs", "=", "{", "'mtype'", ":", "pab", ",", "'kwargs'", ":", "kwargs", "}", "setattr", "(", "self", ",", "funcname", ",", "margs", ")" ]
implements a generic version of an attribute based pandas function
[ "implements", "a", "generic", "version", "of", "an", "attribute", "based", "pandas", "function" ]
a2802692bc642fa32096374159eea7ceca2947b4
https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/trump/templating/munging_helpers.py#L42-L47
train
56,214
Equitable/trump
trump/templating/munging_helpers.py
mixin_pnab._bld_pnab_generic
def _bld_pnab_generic(self, funcname, **kwargs): """ implement's a generic version of a non-attribute based pandas function """ margs = {'mtype': pnab, 'kwargs': kwargs} setattr(self, funcname, margs)
python
def _bld_pnab_generic(self, funcname, **kwargs): """ implement's a generic version of a non-attribute based pandas function """ margs = {'mtype': pnab, 'kwargs': kwargs} setattr(self, funcname, margs)
[ "def", "_bld_pnab_generic", "(", "self", ",", "funcname", ",", "*", "*", "kwargs", ")", ":", "margs", "=", "{", "'mtype'", ":", "pnab", ",", "'kwargs'", ":", "kwargs", "}", "setattr", "(", "self", ",", "funcname", ",", "margs", ")" ]
implement's a generic version of a non-attribute based pandas function
[ "implement", "s", "a", "generic", "version", "of", "a", "non", "-", "attribute", "based", "pandas", "function" ]
a2802692bc642fa32096374159eea7ceca2947b4
https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/trump/templating/munging_helpers.py#L58-L63
train
56,215
codenerix/django-codenerix-invoicing
codenerix_invoicing/views_sales.py
ShoppingCartManagement.get
def get(self, request, *args, **kwargs): """ List all products in the shopping cart """ cart = ShoppingCartProxy(request) return JsonResponse(cart.get_products(onlypublic=request.GET.get('onlypublic', True)))
python
def get(self, request, *args, **kwargs): """ List all products in the shopping cart """ cart = ShoppingCartProxy(request) return JsonResponse(cart.get_products(onlypublic=request.GET.get('onlypublic', True)))
[ "def", "get", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "cart", "=", "ShoppingCartProxy", "(", "request", ")", "return", "JsonResponse", "(", "cart", ".", "get_products", "(", "onlypublic", "=", "request", ".", "...
List all products in the shopping cart
[ "List", "all", "products", "in", "the", "shopping", "cart" ]
7db5c62f335f9215a8b308603848625208b48698
https://github.com/codenerix/django-codenerix-invoicing/blob/7db5c62f335f9215a8b308603848625208b48698/codenerix_invoicing/views_sales.py#L1842-L1847
train
56,216
codenerix/django-codenerix-invoicing
codenerix_invoicing/views_sales.py
ShoppingCartManagement.post
def post(self, request, *args, **kwargs): """ Adds new product to the current shopping cart """ POST = json.loads(request.body.decode('utf-8')) if 'product_pk' in POST and 'quantity' in POST: cart = ShoppingCartProxy(request) cart.add( pro...
python
def post(self, request, *args, **kwargs): """ Adds new product to the current shopping cart """ POST = json.loads(request.body.decode('utf-8')) if 'product_pk' in POST and 'quantity' in POST: cart = ShoppingCartProxy(request) cart.add( pro...
[ "def", "post", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "POST", "=", "json", ".", "loads", "(", "request", ".", "body", ".", "decode", "(", "'utf-8'", ")", ")", "if", "'product_pk'", "in", "POST", "and", "...
Adds new product to the current shopping cart
[ "Adds", "new", "product", "to", "the", "current", "shopping", "cart" ]
7db5c62f335f9215a8b308603848625208b48698
https://github.com/codenerix/django-codenerix-invoicing/blob/7db5c62f335f9215a8b308603848625208b48698/codenerix_invoicing/views_sales.py#L1849-L1863
train
56,217
todstoychev/signal-dispatcher
signal_dispatcher/signal_dispatcher.py
SignalDispatcher.register_signal
def register_signal(alias: str, signal: pyqtSignal): """ Used to register signal at the dispatcher. Note that you can not use alias that already exists. :param alias: Alias of the signal. String. :param signal: Signal itself. Usually pyqtSignal instance. :return: """ ...
python
def register_signal(alias: str, signal: pyqtSignal): """ Used to register signal at the dispatcher. Note that you can not use alias that already exists. :param alias: Alias of the signal. String. :param signal: Signal itself. Usually pyqtSignal instance. :return: """ ...
[ "def", "register_signal", "(", "alias", ":", "str", ",", "signal", ":", "pyqtSignal", ")", ":", "if", "SignalDispatcher", ".", "signal_alias_exists", "(", "alias", ")", ":", "raise", "SignalDispatcherError", "(", "'Alias \"'", "+", "alias", "+", "'\" for signal ...
Used to register signal at the dispatcher. Note that you can not use alias that already exists. :param alias: Alias of the signal. String. :param signal: Signal itself. Usually pyqtSignal instance. :return:
[ "Used", "to", "register", "signal", "at", "the", "dispatcher", ".", "Note", "that", "you", "can", "not", "use", "alias", "that", "already", "exists", "." ]
77131d119045973d65434abbcd6accdfa9cc327a
https://github.com/todstoychev/signal-dispatcher/blob/77131d119045973d65434abbcd6accdfa9cc327a/signal_dispatcher/signal_dispatcher.py#L12-L23
train
56,218
todstoychev/signal-dispatcher
signal_dispatcher/signal_dispatcher.py
SignalDispatcher.register_handler
def register_handler(alias: str, handler: callable): """ Used to register handler at the dispatcher. :param alias: Signal alias to match handler to. :param handler: Handler. Some callable. :return: """ if SignalDispatcher.handlers.get(alias) is None: ...
python
def register_handler(alias: str, handler: callable): """ Used to register handler at the dispatcher. :param alias: Signal alias to match handler to. :param handler: Handler. Some callable. :return: """ if SignalDispatcher.handlers.get(alias) is None: ...
[ "def", "register_handler", "(", "alias", ":", "str", ",", "handler", ":", "callable", ")", ":", "if", "SignalDispatcher", ".", "handlers", ".", "get", "(", "alias", ")", "is", "None", ":", "SignalDispatcher", ".", "handlers", "[", "alias", "]", "=", "[",...
Used to register handler at the dispatcher. :param alias: Signal alias to match handler to. :param handler: Handler. Some callable. :return:
[ "Used", "to", "register", "handler", "at", "the", "dispatcher", "." ]
77131d119045973d65434abbcd6accdfa9cc327a
https://github.com/todstoychev/signal-dispatcher/blob/77131d119045973d65434abbcd6accdfa9cc327a/signal_dispatcher/signal_dispatcher.py#L26-L37
train
56,219
todstoychev/signal-dispatcher
signal_dispatcher/signal_dispatcher.py
SignalDispatcher.dispatch
def dispatch(): """ This methods runs the wheel. It is used to connect signal with their handlers, based on the aliases. :return: """ aliases = SignalDispatcher.signals.keys() for alias in aliases: handlers = SignalDispatcher.handlers.get(alias) ...
python
def dispatch(): """ This methods runs the wheel. It is used to connect signal with their handlers, based on the aliases. :return: """ aliases = SignalDispatcher.signals.keys() for alias in aliases: handlers = SignalDispatcher.handlers.get(alias) ...
[ "def", "dispatch", "(", ")", ":", "aliases", "=", "SignalDispatcher", ".", "signals", ".", "keys", "(", ")", "for", "alias", "in", "aliases", ":", "handlers", "=", "SignalDispatcher", ".", "handlers", ".", "get", "(", "alias", ")", "signal", "=", "Signal...
This methods runs the wheel. It is used to connect signal with their handlers, based on the aliases. :return:
[ "This", "methods", "runs", "the", "wheel", ".", "It", "is", "used", "to", "connect", "signal", "with", "their", "handlers", "based", "on", "the", "aliases", "." ]
77131d119045973d65434abbcd6accdfa9cc327a
https://github.com/todstoychev/signal-dispatcher/blob/77131d119045973d65434abbcd6accdfa9cc327a/signal_dispatcher/signal_dispatcher.py#L40-L56
train
56,220
paltman-archive/nashvegas
nashvegas/management/commands/upgradedb.py
Command._get_rev
def _get_rev(self, fpath): """ Get an SCM version number. Try svn and git. """ rev = None try: cmd = ["git", "log", "-n1", "--pretty=format:\"%h\"", fpath] rev = Popen(cmd, stdout=PIPE, stderr=PIPE).communicate()[0] except: pas...
python
def _get_rev(self, fpath): """ Get an SCM version number. Try svn and git. """ rev = None try: cmd = ["git", "log", "-n1", "--pretty=format:\"%h\"", fpath] rev = Popen(cmd, stdout=PIPE, stderr=PIPE).communicate()[0] except: pas...
[ "def", "_get_rev", "(", "self", ",", "fpath", ")", ":", "rev", "=", "None", "try", ":", "cmd", "=", "[", "\"git\"", ",", "\"log\"", ",", "\"-n1\"", ",", "\"--pretty=format:\\\"%h\\\"\"", ",", "fpath", "]", "rev", "=", "Popen", "(", "cmd", ",", "stdout"...
Get an SCM version number. Try svn and git.
[ "Get", "an", "SCM", "version", "number", ".", "Try", "svn", "and", "git", "." ]
14e904a3f5b87e878cd053b554e76e85943d1c11
https://github.com/paltman-archive/nashvegas/blob/14e904a3f5b87e878cd053b554e76e85943d1c11/nashvegas/management/commands/upgradedb.py#L90-L115
train
56,221
paltman-archive/nashvegas
nashvegas/management/commands/upgradedb.py
Command.execute_migrations
def execute_migrations(self, show_traceback=True): """ Executes all pending migrations across all capable databases """ all_migrations = get_pending_migrations(self.path, self.databases) if not len(all_migrations): sys.stdout.write("There are no migra...
python
def execute_migrations(self, show_traceback=True): """ Executes all pending migrations across all capable databases """ all_migrations = get_pending_migrations(self.path, self.databases) if not len(all_migrations): sys.stdout.write("There are no migra...
[ "def", "execute_migrations", "(", "self", ",", "show_traceback", "=", "True", ")", ":", "all_migrations", "=", "get_pending_migrations", "(", "self", ".", "path", ",", "self", ".", "databases", ")", "if", "not", "len", "(", "all_migrations", ")", ":", "sys",...
Executes all pending migrations across all capable databases
[ "Executes", "all", "pending", "migrations", "across", "all", "capable", "databases" ]
14e904a3f5b87e878cd053b554e76e85943d1c11
https://github.com/paltman-archive/nashvegas/blob/14e904a3f5b87e878cd053b554e76e85943d1c11/nashvegas/management/commands/upgradedb.py#L270-L317
train
56,222
paltman-archive/nashvegas
nashvegas/management/commands/upgradedb.py
Command.handle
def handle(self, *args, **options): """ Upgrades the database. Executes SQL scripts that haven't already been applied to the database. """ self.do_list = options.get("do_list") self.do_execute = options.get("do_execute") self.do_create = options.g...
python
def handle(self, *args, **options): """ Upgrades the database. Executes SQL scripts that haven't already been applied to the database. """ self.do_list = options.get("do_list") self.do_execute = options.get("do_execute") self.do_create = options.g...
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "self", ".", "do_list", "=", "options", ".", "get", "(", "\"do_list\"", ")", "self", ".", "do_execute", "=", "options", ".", "get", "(", "\"do_execute\"", ")", "self"...
Upgrades the database. Executes SQL scripts that haven't already been applied to the database.
[ "Upgrades", "the", "database", ".", "Executes", "SQL", "scripts", "that", "haven", "t", "already", "been", "applied", "to", "the", "database", "." ]
14e904a3f5b87e878cd053b554e76e85943d1c11
https://github.com/paltman-archive/nashvegas/blob/14e904a3f5b87e878cd053b554e76e85943d1c11/nashvegas/management/commands/upgradedb.py#L377-L427
train
56,223
Equitable/trump
docs/diagrams/tsadisplay/render.py
plantuml
def plantuml(desc): """Generate plantuml class diagram :param desc: result of sadisplay.describe function Return plantuml class diagram string """ classes, relations, inherits = desc result = [ '@startuml', 'skinparam defaultFontName Courier', ] for cls in classes: ...
python
def plantuml(desc): """Generate plantuml class diagram :param desc: result of sadisplay.describe function Return plantuml class diagram string """ classes, relations, inherits = desc result = [ '@startuml', 'skinparam defaultFontName Courier', ] for cls in classes: ...
[ "def", "plantuml", "(", "desc", ")", ":", "classes", ",", "relations", ",", "inherits", "=", "desc", "result", "=", "[", "'@startuml'", ",", "'skinparam defaultFontName Courier'", ",", "]", "for", "cls", "in", "classes", ":", "# issue #11 - tabular output of class...
Generate plantuml class diagram :param desc: result of sadisplay.describe function Return plantuml class diagram string
[ "Generate", "plantuml", "class", "diagram" ]
a2802692bc642fa32096374159eea7ceca2947b4
https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/docs/diagrams/tsadisplay/render.py#L15-L61
train
56,224
pauleveritt/kaybee
kaybee/plugins/references/base_reference.py
is_reference_target
def is_reference_target(resource, rtype, label): """ Return true if the resource has this rtype with this label """ prop = resource.props.references.get(rtype, False) if prop: return label in prop
python
def is_reference_target(resource, rtype, label): """ Return true if the resource has this rtype with this label """ prop = resource.props.references.get(rtype, False) if prop: return label in prop
[ "def", "is_reference_target", "(", "resource", ",", "rtype", ",", "label", ")", ":", "prop", "=", "resource", ".", "props", ".", "references", ".", "get", "(", "rtype", ",", "False", ")", "if", "prop", ":", "return", "label", "in", "prop" ]
Return true if the resource has this rtype with this label
[ "Return", "true", "if", "the", "resource", "has", "this", "rtype", "with", "this", "label" ]
a00a718aaaa23b2d12db30dfacb6b2b6ec84459c
https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/references/base_reference.py#L7-L12
train
56,225
pauleveritt/kaybee
kaybee/plugins/references/base_reference.py
BaseReference.get_sources
def get_sources(self, resources): """ Filter resources based on which have this reference """ rtype = self.rtype # E.g. category label = self.props.label # E.g. category1 result = [ resource for resource in resources.values() if is_reference_target(...
python
def get_sources(self, resources): """ Filter resources based on which have this reference """ rtype = self.rtype # E.g. category label = self.props.label # E.g. category1 result = [ resource for resource in resources.values() if is_reference_target(...
[ "def", "get_sources", "(", "self", ",", "resources", ")", ":", "rtype", "=", "self", ".", "rtype", "# E.g. category", "label", "=", "self", ".", "props", ".", "label", "# E.g. category1", "result", "=", "[", "resource", "for", "resource", "in", "resources", ...
Filter resources based on which have this reference
[ "Filter", "resources", "based", "on", "which", "have", "this", "reference" ]
a00a718aaaa23b2d12db30dfacb6b2b6ec84459c
https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/references/base_reference.py#L23-L33
train
56,226
pauleveritt/kaybee
kaybee/__init__.py
setup
def setup(app: Sphinx): """ Initialize Kaybee as a Sphinx extension """ # Scan for directives, first in the system, second in the docs project importscan.scan(plugins) dectate.commit(kb) app.add_config_value('kaybee_settings', KaybeeSettings(), 'html') bridge = 'kaybee.plugins.postrenderer.con...
python
def setup(app: Sphinx): """ Initialize Kaybee as a Sphinx extension """ # Scan for directives, first in the system, second in the docs project importscan.scan(plugins) dectate.commit(kb) app.add_config_value('kaybee_settings', KaybeeSettings(), 'html') bridge = 'kaybee.plugins.postrenderer.con...
[ "def", "setup", "(", "app", ":", "Sphinx", ")", ":", "# Scan for directives, first in the system, second in the docs project", "importscan", ".", "scan", "(", "plugins", ")", "dectate", ".", "commit", "(", "kb", ")", "app", ".", "add_config_value", "(", "'kaybee_set...
Initialize Kaybee as a Sphinx extension
[ "Initialize", "Kaybee", "as", "a", "Sphinx", "extension" ]
a00a718aaaa23b2d12db30dfacb6b2b6ec84459c
https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/__init__.py#L20-L101
train
56,227
bitesofcode/projex
projex/plugin.py
PluginProxy.loadInstance
def loadInstance(self): """ Loads the plugin from the proxy information that was created from the registry file. """ if self._loaded: return self._loaded = True module_path = self.modulePath() package = projex.packageFromPath(module_path) ...
python
def loadInstance(self): """ Loads the plugin from the proxy information that was created from the registry file. """ if self._loaded: return self._loaded = True module_path = self.modulePath() package = projex.packageFromPath(module_path) ...
[ "def", "loadInstance", "(", "self", ")", ":", "if", "self", ".", "_loaded", ":", "return", "self", ".", "_loaded", "=", "True", "module_path", "=", "self", ".", "modulePath", "(", ")", "package", "=", "projex", ".", "packageFromPath", "(", "module_path", ...
Loads the plugin from the proxy information that was created from the registry file.
[ "Loads", "the", "plugin", "from", "the", "proxy", "information", "that", "was", "created", "from", "the", "registry", "file", "." ]
d31743ec456a41428709968ab11a2cf6c6c76247
https://github.com/bitesofcode/projex/blob/d31743ec456a41428709968ab11a2cf6c6c76247/projex/plugin.py#L593-L627
train
56,228
pauleveritt/kaybee
kaybee/plugins/articles/jsoncatalog.py
clean_resource_json
def clean_resource_json(resource_json): """ The catalog wants to be smaller, let's drop some stuff """ for a in ('parent_docname', 'parent', 'template', 'repr', 'series'): if a in resource_json: del resource_json[a] props = resource_json['props'] for prop in ( 'acquired...
python
def clean_resource_json(resource_json): """ The catalog wants to be smaller, let's drop some stuff """ for a in ('parent_docname', 'parent', 'template', 'repr', 'series'): if a in resource_json: del resource_json[a] props = resource_json['props'] for prop in ( 'acquired...
[ "def", "clean_resource_json", "(", "resource_json", ")", ":", "for", "a", "in", "(", "'parent_docname'", ",", "'parent'", ",", "'template'", ",", "'repr'", ",", "'series'", ")", ":", "if", "a", "in", "resource_json", ":", "del", "resource_json", "[", "a", ...
The catalog wants to be smaller, let's drop some stuff
[ "The", "catalog", "wants", "to", "be", "smaller", "let", "s", "drop", "some", "stuff" ]
a00a718aaaa23b2d12db30dfacb6b2b6ec84459c
https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/articles/jsoncatalog.py#L18-L32
train
56,229
MacHu-GWU/crawlib-project
crawlib/downloader/requests_downloader.py
RequestsDownloader.get
def get(self, url, params=None, cache_cb=None, **kwargs): """ Make http get request. :param url: :param params: :param cache_cb: (optional) a function that taking requests.Response as input, and returns a bool flag, ind...
python
def get(self, url, params=None, cache_cb=None, **kwargs): """ Make http get request. :param url: :param params: :param cache_cb: (optional) a function that taking requests.Response as input, and returns a bool flag, ind...
[ "def", "get", "(", "self", ",", "url", ",", "params", "=", "None", ",", "cache_cb", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "use_random_user_agent", ":", "headers", "=", "kwargs", ".", "get", "(", "\"headers\"", ",", "dict"...
Make http get request. :param url: :param params: :param cache_cb: (optional) a function that taking requests.Response as input, and returns a bool flag, indicate whether should update the cache. :param cache_expire: (optional). :param kwargs: optional arguments.
[ "Make", "http", "get", "request", "." ]
241516f2a7a0a32c692f7af35a1f44064e8ce1ab
https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/downloader/requests_downloader.py#L103-L138
train
56,230
MacHu-GWU/crawlib-project
crawlib/downloader/requests_downloader.py
RequestsDownloader.download
def download(self, url, dst, params=None, cache_cb=None, overwrite=False, stream=False, minimal_size=-1, maximum_size=1024 ** 6, **kwargs): """ Downloa...
python
def download(self, url, dst, params=None, cache_cb=None, overwrite=False, stream=False, minimal_size=-1, maximum_size=1024 ** 6, **kwargs): """ Downloa...
[ "def", "download", "(", "self", ",", "url", ",", "dst", ",", "params", "=", "None", ",", "cache_cb", "=", "None", ",", "overwrite", "=", "False", ",", "stream", "=", "False", ",", "minimal_size", "=", "-", "1", ",", "maximum_size", "=", "1024", "**",...
Download binary content to destination. :param url: binary content url :param dst: path to the 'save_as' file :param cache_cb: (optional) a function that taking requests.Response as input, and returns a bool flag, indicate whether should update the cache. :param overwrite: b...
[ "Download", "binary", "content", "to", "destination", "." ]
241516f2a7a0a32c692f7af35a1f44064e8ce1ab
https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/downloader/requests_downloader.py#L176-L233
train
56,231
nicferrier/md
src/mdlib/cmdln.py
option
def option(*args, **kwargs): """Decorator to add an option to the optparser argument of a Cmdln subcommand To add a toplevel option, apply the decorator on the class itself. (see p4.py for an example) Example: @cmdln.option("-E", dest="environment_path") class MyShell(cmdln.Cmd...
python
def option(*args, **kwargs): """Decorator to add an option to the optparser argument of a Cmdln subcommand To add a toplevel option, apply the decorator on the class itself. (see p4.py for an example) Example: @cmdln.option("-E", dest="environment_path") class MyShell(cmdln.Cmd...
[ "def", "option", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "decorate_sub_command", "(", "method", ")", ":", "\"\"\"create and add sub-command options\"\"\"", "if", "not", "hasattr", "(", "method", ",", "\"optparser\"", ")", ":", "method", "."...
Decorator to add an option to the optparser argument of a Cmdln subcommand To add a toplevel option, apply the decorator on the class itself. (see p4.py for an example) Example: @cmdln.option("-E", dest="environment_path") class MyShell(cmdln.Cmdln): @cmdln.option("-f",...
[ "Decorator", "to", "add", "an", "option", "to", "the", "optparser", "argument", "of", "a", "Cmdln", "subcommand" ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/cmdln.py#L1056-L1090
train
56,232
nicferrier/md
src/mdlib/cmdln.py
_inherit_attr
def _inherit_attr(klass, attr, default, cp): """Inherit the attribute from the base class Copy `attr` from base class (otherwise use `default`). Copying is done using the passed `cp` function. The motivation behind writing this function is to allow inheritance among Cmdln classes where base classe...
python
def _inherit_attr(klass, attr, default, cp): """Inherit the attribute from the base class Copy `attr` from base class (otherwise use `default`). Copying is done using the passed `cp` function. The motivation behind writing this function is to allow inheritance among Cmdln classes where base classe...
[ "def", "_inherit_attr", "(", "klass", ",", "attr", ",", "default", ",", "cp", ")", ":", "if", "attr", "not", "in", "klass", ".", "__dict__", ":", "if", "hasattr", "(", "klass", ",", "attr", ")", ":", "value", "=", "cp", "(", "getattr", "(", "klass"...
Inherit the attribute from the base class Copy `attr` from base class (otherwise use `default`). Copying is done using the passed `cp` function. The motivation behind writing this function is to allow inheritance among Cmdln classes where base classes set 'common' options using the `@cmdln.option`...
[ "Inherit", "the", "attribute", "from", "the", "base", "class" ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/cmdln.py#L1314-L1330
train
56,233
nicferrier/md
src/mdlib/cmdln.py
_forgiving_issubclass
def _forgiving_issubclass(derived_class, base_class): """Forgiving version of ``issubclass`` Does not throw any exception when arguments are not of class type """ return (type(derived_class) is ClassType and \ type(base_class) is ClassType and \ issubclass(derived_class, base_cl...
python
def _forgiving_issubclass(derived_class, base_class): """Forgiving version of ``issubclass`` Does not throw any exception when arguments are not of class type """ return (type(derived_class) is ClassType and \ type(base_class) is ClassType and \ issubclass(derived_class, base_cl...
[ "def", "_forgiving_issubclass", "(", "derived_class", ",", "base_class", ")", ":", "return", "(", "type", "(", "derived_class", ")", "is", "ClassType", "and", "type", "(", "base_class", ")", "is", "ClassType", "and", "issubclass", "(", "derived_class", ",", "b...
Forgiving version of ``issubclass`` Does not throw any exception when arguments are not of class type
[ "Forgiving", "version", "of", "issubclass" ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/cmdln.py#L1332-L1339
train
56,234
hollenstein/maspy
maspy/calib.py
timecalMs1DataMedian
def timecalMs1DataMedian(msrunContainer, specfile, calibrationData, minDataPoints=50, deviationKey='relDev'): """Generates a calibration value for each MS1 scan by calculating the median deviation :param msrunContainer: intance of :class:`maspy.core.MsrunContainer` :param specf...
python
def timecalMs1DataMedian(msrunContainer, specfile, calibrationData, minDataPoints=50, deviationKey='relDev'): """Generates a calibration value for each MS1 scan by calculating the median deviation :param msrunContainer: intance of :class:`maspy.core.MsrunContainer` :param specf...
[ "def", "timecalMs1DataMedian", "(", "msrunContainer", ",", "specfile", ",", "calibrationData", ",", "minDataPoints", "=", "50", ",", "deviationKey", "=", "'relDev'", ")", ":", "corrData", "=", "dict", "(", ")", "_posDict", "=", "dict", "(", ")", "pos", "=", ...
Generates a calibration value for each MS1 scan by calculating the median deviation :param msrunContainer: intance of :class:`maspy.core.MsrunContainer` :param specfile: filename of an ms-run file, used to generate an calibration value for each MS1 spectrum item. :param calibrationData: a dicti...
[ "Generates", "a", "calibration", "value", "for", "each", "MS1", "scan", "by", "calculating", "the", "median", "deviation" ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/calib.py#L182-L254
train
56,235
pauleveritt/kaybee
kaybee/plugins/genericpage/action.py
GenericpageAction.get_genericpage
def get_genericpage(cls, kb_app): """ Return the one class if configured, otherwise default """ # Presumes the registry has been committed q = dectate.Query('genericpage') klasses = sorted(q(kb_app), key=lambda args: args[0].order) if not klasses: # The site doesn't ...
python
def get_genericpage(cls, kb_app): """ Return the one class if configured, otherwise default """ # Presumes the registry has been committed q = dectate.Query('genericpage') klasses = sorted(q(kb_app), key=lambda args: args[0].order) if not klasses: # The site doesn't ...
[ "def", "get_genericpage", "(", "cls", ",", "kb_app", ")", ":", "# Presumes the registry has been committed", "q", "=", "dectate", ".", "Query", "(", "'genericpage'", ")", "klasses", "=", "sorted", "(", "q", "(", "kb_app", ")", ",", "key", "=", "lambda", "arg...
Return the one class if configured, otherwise default
[ "Return", "the", "one", "class", "if", "configured", "otherwise", "default" ]
a00a718aaaa23b2d12db30dfacb6b2b6ec84459c
https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/genericpage/action.py#L29-L39
train
56,236
e7dal/bubble3
bubble3/commands/cmd_manual.py
cli
def cli(ctx): """Shows the man page packed inside the bubble tool this is mainly too overcome limitations on installing manual pages in a distribution agnostic and simple way and the way bubble has been developed, in virtual python environments, installing a man page into a system location makes no sen...
python
def cli(ctx): """Shows the man page packed inside the bubble tool this is mainly too overcome limitations on installing manual pages in a distribution agnostic and simple way and the way bubble has been developed, in virtual python environments, installing a man page into a system location makes no sen...
[ "def", "cli", "(", "ctx", ")", ":", "manfile", "=", "bubble_lib_dir", "+", "os", ".", "sep", "+", "'extras'", "+", "os", ".", "sep", "+", "'Bubble.1.gz'", "mancmd", "=", "[", "\"/usr/bin/man\"", ",", "manfile", "]", "try", ":", "return", "subprocess", ...
Shows the man page packed inside the bubble tool this is mainly too overcome limitations on installing manual pages in a distribution agnostic and simple way and the way bubble has been developed, in virtual python environments, installing a man page into a system location makes no sense, the system ma...
[ "Shows", "the", "man", "page", "packed", "inside", "the", "bubble", "tool" ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/commands/cmd_manual.py#L11-L28
train
56,237
jplusplus/statscraper
statscraper/scrapers/SCBScraper.py
SCB._fetch_dimensions
def _fetch_dimensions(self, dataset): """ We override this method just to set the correct datatype and dialect for regions. """ for dimension in super(SCB, self)._fetch_dimensions(dataset): if dimension.id == "Region": yield Dimension(dimension...
python
def _fetch_dimensions(self, dataset): """ We override this method just to set the correct datatype and dialect for regions. """ for dimension in super(SCB, self)._fetch_dimensions(dataset): if dimension.id == "Region": yield Dimension(dimension...
[ "def", "_fetch_dimensions", "(", "self", ",", "dataset", ")", ":", "for", "dimension", "in", "super", "(", "SCB", ",", "self", ")", ".", "_fetch_dimensions", "(", "dataset", ")", ":", "if", "dimension", ".", "id", "==", "\"Region\"", ":", "yield", "Dimen...
We override this method just to set the correct datatype and dialect for regions.
[ "We", "override", "this", "method", "just", "to", "set", "the", "correct", "datatype", "and", "dialect", "for", "regions", "." ]
932ec048b23d15b3dbdaf829facc55fd78ec0109
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/SCBScraper.py#L12-L24
train
56,238
suzaku/cachelper
cachelper/remote.py
HelperMixin.call
def call(self, func, key, timeout=None): '''Wraps a function call with cache. Args: func (function): the function to call. key (str): the cache key for this call. timeout (int): the cache timeout for the key (the unit of this parameter depe...
python
def call(self, func, key, timeout=None): '''Wraps a function call with cache. Args: func (function): the function to call. key (str): the cache key for this call. timeout (int): the cache timeout for the key (the unit of this parameter depe...
[ "def", "call", "(", "self", ",", "func", ",", "key", ",", "timeout", "=", "None", ")", ":", "result", "=", "self", ".", "get", "(", "key", ")", "if", "result", "==", "NONE_RESULT", ":", "return", "None", "if", "result", "is", "None", ":", "result",...
Wraps a function call with cache. Args: func (function): the function to call. key (str): the cache key for this call. timeout (int): the cache timeout for the key (the unit of this parameter depends on the cache class yo...
[ "Wraps", "a", "function", "call", "with", "cache", "." ]
7da36614f9a23abb97c4d4c871dd45e07080dfb5
https://github.com/suzaku/cachelper/blob/7da36614f9a23abb97c4d4c871dd45e07080dfb5/cachelper/remote.py#L21-L46
train
56,239
suzaku/cachelper
cachelper/remote.py
HelperMixin.map
def map(self, key_pattern, func, all_args, timeout=None): '''Cache return value of multiple calls. Args: key_pattern (str): the key pattern to use for generating keys for caches of the decorated function. func (function): the function to call. ...
python
def map(self, key_pattern, func, all_args, timeout=None): '''Cache return value of multiple calls. Args: key_pattern (str): the key pattern to use for generating keys for caches of the decorated function. func (function): the function to call. ...
[ "def", "map", "(", "self", ",", "key_pattern", ",", "func", ",", "all_args", ",", "timeout", "=", "None", ")", ":", "results", "=", "[", "]", "keys", "=", "[", "make_key", "(", "key_pattern", ",", "func", ",", "args", ",", "{", "}", ")", "for", "...
Cache return value of multiple calls. Args: key_pattern (str): the key pattern to use for generating keys for caches of the decorated function. func (function): the function to call. all_args (list): a list of args to be used to make calls to ...
[ "Cache", "return", "value", "of", "multiple", "calls", "." ]
7da36614f9a23abb97c4d4c871dd45e07080dfb5
https://github.com/suzaku/cachelper/blob/7da36614f9a23abb97c4d4c871dd45e07080dfb5/cachelper/remote.py#L48-L86
train
56,240
adamrothman/ftl
ftl/connection.py
HTTP2Connection._window_open
async def _window_open(self, stream_id: int): """Wait until the identified stream's flow control window is open. """ stream = self._get_stream(stream_id) return await stream.window_open.wait()
python
async def _window_open(self, stream_id: int): """Wait until the identified stream's flow control window is open. """ stream = self._get_stream(stream_id) return await stream.window_open.wait()
[ "async", "def", "_window_open", "(", "self", ",", "stream_id", ":", "int", ")", ":", "stream", "=", "self", ".", "_get_stream", "(", "stream_id", ")", "return", "await", "stream", ".", "window_open", ".", "wait", "(", ")" ]
Wait until the identified stream's flow control window is open.
[ "Wait", "until", "the", "identified", "stream", "s", "flow", "control", "window", "is", "open", "." ]
a88f3df1ecbdfba45035b65f833b8ffffc49b399
https://github.com/adamrothman/ftl/blob/a88f3df1ecbdfba45035b65f833b8ffffc49b399/ftl/connection.py#L260-L264
train
56,241
adamrothman/ftl
ftl/connection.py
HTTP2Connection.send_data
async def send_data( self, stream_id: int, data: bytes, end_stream: bool = False, ): """Send data, respecting the receiver's flow control instructions. If the provided data is larger than the connection's maximum outbound frame size, it will be broken into sev...
python
async def send_data( self, stream_id: int, data: bytes, end_stream: bool = False, ): """Send data, respecting the receiver's flow control instructions. If the provided data is larger than the connection's maximum outbound frame size, it will be broken into sev...
[ "async", "def", "send_data", "(", "self", ",", "stream_id", ":", "int", ",", "data", ":", "bytes", ",", "end_stream", ":", "bool", "=", "False", ",", ")", ":", "if", "self", ".", "closed", ":", "raise", "ConnectionClosedError", "stream", "=", "self", "...
Send data, respecting the receiver's flow control instructions. If the provided data is larger than the connection's maximum outbound frame size, it will be broken into several frames as appropriate.
[ "Send", "data", "respecting", "the", "receiver", "s", "flow", "control", "instructions", ".", "If", "the", "provided", "data", "is", "larger", "than", "the", "connection", "s", "maximum", "outbound", "frame", "size", "it", "will", "be", "broken", "into", "se...
a88f3df1ecbdfba45035b65f833b8ffffc49b399
https://github.com/adamrothman/ftl/blob/a88f3df1ecbdfba45035b65f833b8ffffc49b399/ftl/connection.py#L268-L312
train
56,242
adamrothman/ftl
ftl/connection.py
HTTP2Connection.read_data
async def read_data(self, stream_id: int) -> bytes: """Read data from the specified stream until it is closed by the remote peer. If the stream is never ended, this never returns. """ frames = [f async for f in self.stream_frames(stream_id)] return b''.join(frames)
python
async def read_data(self, stream_id: int) -> bytes: """Read data from the specified stream until it is closed by the remote peer. If the stream is never ended, this never returns. """ frames = [f async for f in self.stream_frames(stream_id)] return b''.join(frames)
[ "async", "def", "read_data", "(", "self", ",", "stream_id", ":", "int", ")", "->", "bytes", ":", "frames", "=", "[", "f", "async", "for", "f", "in", "self", ".", "stream_frames", "(", "stream_id", ")", "]", "return", "b''", ".", "join", "(", "frames"...
Read data from the specified stream until it is closed by the remote peer. If the stream is never ended, this never returns.
[ "Read", "data", "from", "the", "specified", "stream", "until", "it", "is", "closed", "by", "the", "remote", "peer", ".", "If", "the", "stream", "is", "never", "ended", "this", "never", "returns", "." ]
a88f3df1ecbdfba45035b65f833b8ffffc49b399
https://github.com/adamrothman/ftl/blob/a88f3df1ecbdfba45035b65f833b8ffffc49b399/ftl/connection.py#L316-L321
train
56,243
adamrothman/ftl
ftl/connection.py
HTTP2Connection.read_frame
async def read_frame(self, stream_id: int) -> bytes: """Read a single frame of data from the specified stream, waiting until frames are available if none are present in the local buffer. If the stream is closed and all buffered frames have been consumed, raises a StreamConsumedError. ...
python
async def read_frame(self, stream_id: int) -> bytes: """Read a single frame of data from the specified stream, waiting until frames are available if none are present in the local buffer. If the stream is closed and all buffered frames have been consumed, raises a StreamConsumedError. ...
[ "async", "def", "read_frame", "(", "self", ",", "stream_id", ":", "int", ")", "->", "bytes", ":", "stream", "=", "self", ".", "_get_stream", "(", "stream_id", ")", "frame", "=", "await", "stream", ".", "read_frame", "(", ")", "if", "frame", ".", "flow_...
Read a single frame of data from the specified stream, waiting until frames are available if none are present in the local buffer. If the stream is closed and all buffered frames have been consumed, raises a StreamConsumedError.
[ "Read", "a", "single", "frame", "of", "data", "from", "the", "specified", "stream", "waiting", "until", "frames", "are", "available", "if", "none", "are", "present", "in", "the", "local", "buffer", ".", "If", "the", "stream", "is", "closed", "and", "all", ...
a88f3df1ecbdfba45035b65f833b8ffffc49b399
https://github.com/adamrothman/ftl/blob/a88f3df1ecbdfba45035b65f833b8ffffc49b399/ftl/connection.py#L323-L333
train
56,244
adamrothman/ftl
ftl/connection.py
HTTP2ClientConnection.get_pushed_stream_ids
async def get_pushed_stream_ids(self, parent_stream_id: int) -> List[int]: """Return a list of all streams pushed by the remote peer that are children of the specified stream. If no streams have been pushed when this method is called, waits until at least one stream has been pushed. """ ...
python
async def get_pushed_stream_ids(self, parent_stream_id: int) -> List[int]: """Return a list of all streams pushed by the remote peer that are children of the specified stream. If no streams have been pushed when this method is called, waits until at least one stream has been pushed. """ ...
[ "async", "def", "get_pushed_stream_ids", "(", "self", ",", "parent_stream_id", ":", "int", ")", "->", "List", "[", "int", "]", ":", "if", "parent_stream_id", "not", "in", "self", ".", "_streams", ":", "logger", ".", "error", "(", "f'Parent stream {parent_strea...
Return a list of all streams pushed by the remote peer that are children of the specified stream. If no streams have been pushed when this method is called, waits until at least one stream has been pushed.
[ "Return", "a", "list", "of", "all", "streams", "pushed", "by", "the", "remote", "peer", "that", "are", "children", "of", "the", "specified", "stream", ".", "If", "no", "streams", "have", "been", "pushed", "when", "this", "method", "is", "called", "waits", ...
a88f3df1ecbdfba45035b65f833b8ffffc49b399
https://github.com/adamrothman/ftl/blob/a88f3df1ecbdfba45035b65f833b8ffffc49b399/ftl/connection.py#L456-L477
train
56,245
hollenstein/maspy
maspy/reader.py
convertMzml
def convertMzml(mzmlPath, outputDirectory=None): """Imports an mzml file and converts it to a MsrunContainer file :param mzmlPath: path of the mzml file :param outputDirectory: directory where the MsrunContainer file should be written if it is not specified, the output directory is set to the mzml file...
python
def convertMzml(mzmlPath, outputDirectory=None): """Imports an mzml file and converts it to a MsrunContainer file :param mzmlPath: path of the mzml file :param outputDirectory: directory where the MsrunContainer file should be written if it is not specified, the output directory is set to the mzml file...
[ "def", "convertMzml", "(", "mzmlPath", ",", "outputDirectory", "=", "None", ")", ":", "outputDirectory", "=", "outputDirectory", "if", "outputDirectory", "is", "not", "None", "else", "os", ".", "path", ".", "dirname", "(", "mzmlPath", ")", "msrunContainer", "=...
Imports an mzml file and converts it to a MsrunContainer file :param mzmlPath: path of the mzml file :param outputDirectory: directory where the MsrunContainer file should be written if it is not specified, the output directory is set to the mzml files directory.
[ "Imports", "an", "mzml", "file", "and", "converts", "it", "to", "a", "MsrunContainer", "file" ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/reader.py#L265-L275
train
56,246
hollenstein/maspy
maspy/reader.py
prepareSiiImport
def prepareSiiImport(siiContainer, specfile, path, qcAttr, qcLargerBetter, qcCutoff, rankAttr, rankLargerBetter): """Prepares the ``siiContainer`` for the import of peptide spectrum matching results. Adds entries to ``siiContainer.container`` and to ``siiContainer.info``. :param si...
python
def prepareSiiImport(siiContainer, specfile, path, qcAttr, qcLargerBetter, qcCutoff, rankAttr, rankLargerBetter): """Prepares the ``siiContainer`` for the import of peptide spectrum matching results. Adds entries to ``siiContainer.container`` and to ``siiContainer.info``. :param si...
[ "def", "prepareSiiImport", "(", "siiContainer", ",", "specfile", ",", "path", ",", "qcAttr", ",", "qcLargerBetter", ",", "qcCutoff", ",", "rankAttr", ",", "rankLargerBetter", ")", ":", "if", "specfile", "not", "in", "siiContainer", ".", "info", ":", "siiContai...
Prepares the ``siiContainer`` for the import of peptide spectrum matching results. Adds entries to ``siiContainer.container`` and to ``siiContainer.info``. :param siiContainer: instance of :class:`maspy.core.SiiContainer` :param specfile: unambiguous identifier of a ms-run file. Is also used as ...
[ "Prepares", "the", "siiContainer", "for", "the", "import", "of", "peptide", "spectrum", "matching", "results", ".", "Adds", "entries", "to", "siiContainer", ".", "container", "and", "to", "siiContainer", ".", "info", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/reader.py#L281-L317
train
56,247
hollenstein/maspy
maspy/reader.py
importPeptideFeatures
def importPeptideFeatures(fiContainer, filelocation, specfile): """ Import peptide features from a featureXml file, as generated for example by the OpenMS node featureFinderCentroided, or a features.tsv file by the Dinosaur command line tool. :param fiContainer: imported features are added to this inst...
python
def importPeptideFeatures(fiContainer, filelocation, specfile): """ Import peptide features from a featureXml file, as generated for example by the OpenMS node featureFinderCentroided, or a features.tsv file by the Dinosaur command line tool. :param fiContainer: imported features are added to this inst...
[ "def", "importPeptideFeatures", "(", "fiContainer", ",", "filelocation", ",", "specfile", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "filelocation", ")", ":", "warnings", ".", "warn", "(", "'The specified file does not exist %s'", "%", "(", ...
Import peptide features from a featureXml file, as generated for example by the OpenMS node featureFinderCentroided, or a features.tsv file by the Dinosaur command line tool. :param fiContainer: imported features are added to this instance of :class:`FeatureContainer <maspy.core.FeatureContainer>`....
[ "Import", "peptide", "features", "from", "a", "featureXml", "file", "as", "generated", "for", "example", "by", "the", "OpenMS", "node", "featureFinderCentroided", "or", "a", "features", ".", "tsv", "file", "by", "the", "Dinosaur", "command", "line", "tool", "....
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/reader.py#L622-L701
train
56,248
hollenstein/maspy
maspy/reader.py
_importDinosaurTsv
def _importDinosaurTsv(filelocation): """Reads a Dinosaur tsv file. :returns: {featureKey1: {attribute1:value1, attribute2:value2, ...}, ...} See also :func:`importPeptideFeatures` """ with io.open(filelocation, 'r', encoding='utf-8') as openFile: #NOTE: this is pretty similar to importing...
python
def _importDinosaurTsv(filelocation): """Reads a Dinosaur tsv file. :returns: {featureKey1: {attribute1:value1, attribute2:value2, ...}, ...} See also :func:`importPeptideFeatures` """ with io.open(filelocation, 'r', encoding='utf-8') as openFile: #NOTE: this is pretty similar to importing...
[ "def", "_importDinosaurTsv", "(", "filelocation", ")", ":", "with", "io", ".", "open", "(", "filelocation", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "openFile", ":", "#NOTE: this is pretty similar to importing percolator results, maybe unify in a common fun...
Reads a Dinosaur tsv file. :returns: {featureKey1: {attribute1:value1, attribute2:value2, ...}, ...} See also :func:`importPeptideFeatures`
[ "Reads", "a", "Dinosaur", "tsv", "file", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/reader.py#L778-L802
train
56,249
pauleveritt/kaybee
kaybee/utils/rst.py
rst_to_html
def rst_to_html(input_string: str) -> str: """ Given a string of RST, use docutils to generate html """ overrides = dict(input_encoding='unicode', doctitle_xform=True, initial_header_level=1) parts = publish_parts( writer_name='html', source=input_string, settin...
python
def rst_to_html(input_string: str) -> str: """ Given a string of RST, use docutils to generate html """ overrides = dict(input_encoding='unicode', doctitle_xform=True, initial_header_level=1) parts = publish_parts( writer_name='html', source=input_string, settin...
[ "def", "rst_to_html", "(", "input_string", ":", "str", ")", "->", "str", ":", "overrides", "=", "dict", "(", "input_encoding", "=", "'unicode'", ",", "doctitle_xform", "=", "True", ",", "initial_header_level", "=", "1", ")", "parts", "=", "publish_parts", "(...
Given a string of RST, use docutils to generate html
[ "Given", "a", "string", "of", "RST", "use", "docutils", "to", "generate", "html" ]
a00a718aaaa23b2d12db30dfacb6b2b6ec84459c
https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/utils/rst.py#L23-L33
train
56,250
pauleveritt/kaybee
kaybee/utils/rst.py
get_rst_title
def get_rst_title(rst_doc: Node) -> Optional[Any]: """ Given some RST, extract what docutils thinks is the title """ for title in rst_doc.traverse(nodes.title): return title.astext() return None
python
def get_rst_title(rst_doc: Node) -> Optional[Any]: """ Given some RST, extract what docutils thinks is the title """ for title in rst_doc.traverse(nodes.title): return title.astext() return None
[ "def", "get_rst_title", "(", "rst_doc", ":", "Node", ")", "->", "Optional", "[", "Any", "]", ":", "for", "title", "in", "rst_doc", ".", "traverse", "(", "nodes", ".", "title", ")", ":", "return", "title", ".", "astext", "(", ")", "return", "None" ]
Given some RST, extract what docutils thinks is the title
[ "Given", "some", "RST", "extract", "what", "docutils", "thinks", "is", "the", "title" ]
a00a718aaaa23b2d12db30dfacb6b2b6ec84459c
https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/utils/rst.py#L36-L42
train
56,251
pauleveritt/kaybee
kaybee/utils/rst.py
get_rst_excerpt
def get_rst_excerpt(rst_doc: document, paragraphs: int = 1) -> str: """ Given rst, parse and return a portion """ texts = [] for count, p in enumerate(rst_doc.traverse(paragraph)): texts.append(p.astext()) if count + 1 == paragraphs: break return ' '.join(texts)
python
def get_rst_excerpt(rst_doc: document, paragraphs: int = 1) -> str: """ Given rst, parse and return a portion """ texts = [] for count, p in enumerate(rst_doc.traverse(paragraph)): texts.append(p.astext()) if count + 1 == paragraphs: break return ' '.join(texts)
[ "def", "get_rst_excerpt", "(", "rst_doc", ":", "document", ",", "paragraphs", ":", "int", "=", "1", ")", "->", "str", ":", "texts", "=", "[", "]", "for", "count", ",", "p", "in", "enumerate", "(", "rst_doc", ".", "traverse", "(", "paragraph", ")", ")...
Given rst, parse and return a portion
[ "Given", "rst", "parse", "and", "return", "a", "portion" ]
a00a718aaaa23b2d12db30dfacb6b2b6ec84459c
https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/utils/rst.py#L45-L53
train
56,252
Hypex/hyppy
hyppy/hapi.py
requires_password_auth
def requires_password_auth(fn): """Decorator for HAPI methods that requires the instance to be authenticated with a password""" def wrapper(self, *args, **kwargs): self.auth_context = HAPI.auth_context_password return fn(self, *args, **kwargs) return wrapper
python
def requires_password_auth(fn): """Decorator for HAPI methods that requires the instance to be authenticated with a password""" def wrapper(self, *args, **kwargs): self.auth_context = HAPI.auth_context_password return fn(self, *args, **kwargs) return wrapper
[ "def", "requires_password_auth", "(", "fn", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "auth_context", "=", "HAPI", ".", "auth_context_password", "return", "fn", "(", "self", ",", "*", "ar...
Decorator for HAPI methods that requires the instance to be authenticated with a password
[ "Decorator", "for", "HAPI", "methods", "that", "requires", "the", "instance", "to", "be", "authenticated", "with", "a", "password" ]
a425619c2a102b0e598fd6cac8aa0f6b766f542d
https://github.com/Hypex/hyppy/blob/a425619c2a102b0e598fd6cac8aa0f6b766f542d/hyppy/hapi.py#L9-L14
train
56,253
Hypex/hyppy
hyppy/hapi.py
requires_api_auth
def requires_api_auth(fn): """Decorator for HAPI methods that requires the instance to be authenticated with a HAPI token""" def wrapper(self, *args, **kwargs): self.auth_context = HAPI.auth_context_hapi return fn(self, *args, **kwargs) return wrapper
python
def requires_api_auth(fn): """Decorator for HAPI methods that requires the instance to be authenticated with a HAPI token""" def wrapper(self, *args, **kwargs): self.auth_context = HAPI.auth_context_hapi return fn(self, *args, **kwargs) return wrapper
[ "def", "requires_api_auth", "(", "fn", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "auth_context", "=", "HAPI", ".", "auth_context_hapi", "return", "fn", "(", "self", ",", "*", "args", ",...
Decorator for HAPI methods that requires the instance to be authenticated with a HAPI token
[ "Decorator", "for", "HAPI", "methods", "that", "requires", "the", "instance", "to", "be", "authenticated", "with", "a", "HAPI", "token" ]
a425619c2a102b0e598fd6cac8aa0f6b766f542d
https://github.com/Hypex/hyppy/blob/a425619c2a102b0e598fd6cac8aa0f6b766f542d/hyppy/hapi.py#L17-L22
train
56,254
Hypex/hyppy
hyppy/hapi.py
HAPIResponse.parse
def parse(response): """Parse a postdata-style response format from the API into usable data""" """Split a a=1b=2c=3 string into a dictionary of pairs""" tokens = {r[0]: r[1] for r in [r.split('=') for r in response.split("&")]} # The odd dummy parameter is of no use to us if '...
python
def parse(response): """Parse a postdata-style response format from the API into usable data""" """Split a a=1b=2c=3 string into a dictionary of pairs""" tokens = {r[0]: r[1] for r in [r.split('=') for r in response.split("&")]} # The odd dummy parameter is of no use to us if '...
[ "def", "parse", "(", "response", ")", ":", "\"\"\"Split a a=1b=2c=3 string into a dictionary of pairs\"\"\"", "tokens", "=", "{", "r", "[", "0", "]", ":", "r", "[", "1", "]", "for", "r", "in", "[", "r", ".", "split", "(", "'='", ")", "for", "r", "in", ...
Parse a postdata-style response format from the API into usable data
[ "Parse", "a", "postdata", "-", "style", "response", "format", "from", "the", "API", "into", "usable", "data" ]
a425619c2a102b0e598fd6cac8aa0f6b766f542d
https://github.com/Hypex/hyppy/blob/a425619c2a102b0e598fd6cac8aa0f6b766f542d/hyppy/hapi.py#L204-L234
train
56,255
diamondman/proteusisc
proteusisc/jtagScanChain.py
JTAGScanChain.init_chain
def init_chain(self): """Autodetect the devices attached to the Controller, and initialize a JTAGDevice for each. This is a required call before device specific Primitives can be used. """ if not self._hasinit: self._hasinit = True self._devices = [] ...
python
def init_chain(self): """Autodetect the devices attached to the Controller, and initialize a JTAGDevice for each. This is a required call before device specific Primitives can be used. """ if not self._hasinit: self._hasinit = True self._devices = [] ...
[ "def", "init_chain", "(", "self", ")", ":", "if", "not", "self", ".", "_hasinit", ":", "self", ".", "_hasinit", "=", "True", "self", ".", "_devices", "=", "[", "]", "self", ".", "jtag_enable", "(", ")", "while", "True", ":", "# pylint: disable=no-member"...
Autodetect the devices attached to the Controller, and initialize a JTAGDevice for each. This is a required call before device specific Primitives can be used.
[ "Autodetect", "the", "devices", "attached", "to", "the", "Controller", "and", "initialize", "a", "JTAGDevice", "for", "each", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/jtagScanChain.py#L162-L191
train
56,256
davgeo/clear
clear/clear.py
ClearManager._UserUpdateConfigValue
def _UserUpdateConfigValue(self, configKey, strDescriptor, isDir = True, dbConfigValue = None): """ Allow user to set or update config values in the database table. This is always called if no valid entry exists in the table already. Parameters ---------- configKey : string Name of co...
python
def _UserUpdateConfigValue(self, configKey, strDescriptor, isDir = True, dbConfigValue = None): """ Allow user to set or update config values in the database table. This is always called if no valid entry exists in the table already. Parameters ---------- configKey : string Name of co...
[ "def", "_UserUpdateConfigValue", "(", "self", ",", "configKey", ",", "strDescriptor", ",", "isDir", "=", "True", ",", "dbConfigValue", "=", "None", ")", ":", "newConfigValue", "=", "None", "if", "dbConfigValue", "is", "None", ":", "prompt", "=", "\"Enter new {...
Allow user to set or update config values in the database table. This is always called if no valid entry exists in the table already. Parameters ---------- configKey : string Name of config field. strDescriptor : string Description of config field. isDir : boolean [optio...
[ "Allow", "user", "to", "set", "or", "update", "config", "values", "in", "the", "database", "table", ".", "This", "is", "always", "called", "if", "no", "valid", "entry", "exists", "in", "the", "table", "already", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L122-L172
train
56,257
davgeo/clear
clear/clear.py
ClearManager._GetConfigValue
def _GetConfigValue(self, configKey, strDescriptor, isDir = True): """ Get configuration value from database table. If no value found user will be prompted to enter one. Parameters ---------- configKey : string Name of config field. strDescriptor : string Description of...
python
def _GetConfigValue(self, configKey, strDescriptor, isDir = True): """ Get configuration value from database table. If no value found user will be prompted to enter one. Parameters ---------- configKey : string Name of config field. strDescriptor : string Description of...
[ "def", "_GetConfigValue", "(", "self", ",", "configKey", ",", "strDescriptor", ",", "isDir", "=", "True", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"CLEAR\"", ",", "\"Loading {0} from database:\"", ".", "format", "(", "strDescriptor", ")", ")", ...
Get configuration value from database table. If no value found user will be prompted to enter one. Parameters ---------- configKey : string Name of config field. strDescriptor : string Description of config field. isDir : boolean [optional : default = True] Set t...
[ "Get", "configuration", "value", "from", "database", "table", ".", "If", "no", "value", "found", "user", "will", "be", "prompted", "to", "enter", "one", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L177-L216
train
56,258
davgeo/clear
clear/clear.py
ClearManager._UserUpdateSupportedFormats
def _UserUpdateSupportedFormats(self, origFormatList = []): """ Add supported formats to database table. Always called if the database table is empty. User can build a list of entries to add to the database table (one entry at a time). Once finished they select the finish option and all entries...
python
def _UserUpdateSupportedFormats(self, origFormatList = []): """ Add supported formats to database table. Always called if the database table is empty. User can build a list of entries to add to the database table (one entry at a time). Once finished they select the finish option and all entries...
[ "def", "_UserUpdateSupportedFormats", "(", "self", ",", "origFormatList", "=", "[", "]", ")", ":", "formatList", "=", "list", "(", "origFormatList", ")", "inputDone", "=", "None", "while", "inputDone", "is", "None", ":", "prompt", "=", "\"Enter new format (e.g. ...
Add supported formats to database table. Always called if the database table is empty. User can build a list of entries to add to the database table (one entry at a time). Once finished they select the finish option and all entries will be added to the table. They can reset the list at any time bef...
[ "Add", "supported", "formats", "to", "database", "table", ".", "Always", "called", "if", "the", "database", "table", "is", "empty", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L221-L271
train
56,259
davgeo/clear
clear/clear.py
ClearManager._GetSupportedFormats
def _GetSupportedFormats(self): """ Get supported format values from database table. If no values found user will be prompted to enter values for this table. Returns ---------- string List of supported formats from database table. """ goodlogging.Log.Info("CLEAR", "Loading sup...
python
def _GetSupportedFormats(self): """ Get supported format values from database table. If no values found user will be prompted to enter values for this table. Returns ---------- string List of supported formats from database table. """ goodlogging.Log.Info("CLEAR", "Loading sup...
[ "def", "_GetSupportedFormats", "(", "self", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"CLEAR\"", ",", "\"Loading supported formats from database:\"", ")", "goodlogging", ".", "Log", ".", "IncreaseIndent", "(", ")", "formatList", "=", "self", ".", ...
Get supported format values from database table. If no values found user will be prompted to enter values for this table. Returns ---------- string List of supported formats from database table.
[ "Get", "supported", "format", "values", "from", "database", "table", ".", "If", "no", "values", "found", "user", "will", "be", "prompted", "to", "enter", "values", "for", "this", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L276-L298
train
56,260
davgeo/clear
clear/clear.py
ClearManager._UserUpdateIgnoredDirs
def _UserUpdateIgnoredDirs(self, origIgnoredDirs = []): """ Add ignored directories to database table. Always called if the database table is empty. User can build a list of entries to add to the database table (one entry at a time). Once finished they select the finish option and all entries w...
python
def _UserUpdateIgnoredDirs(self, origIgnoredDirs = []): """ Add ignored directories to database table. Always called if the database table is empty. User can build a list of entries to add to the database table (one entry at a time). Once finished they select the finish option and all entries w...
[ "def", "_UserUpdateIgnoredDirs", "(", "self", ",", "origIgnoredDirs", "=", "[", "]", ")", ":", "ignoredDirs", "=", "list", "(", "origIgnoredDirs", ")", "inputDone", "=", "None", "while", "inputDone", "is", "None", ":", "prompt", "=", "\"Enter new directory to ig...
Add ignored directories to database table. Always called if the database table is empty. User can build a list of entries to add to the database table (one entry at a time). Once finished they select the finish option and all entries will be added to the table. They can reset the list at any time b...
[ "Add", "ignored", "directories", "to", "database", "table", ".", "Always", "called", "if", "the", "database", "table", "is", "empty", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L303-L351
train
56,261
davgeo/clear
clear/clear.py
ClearManager._GetIgnoredDirs
def _GetIgnoredDirs(self): """ Get ignored directories values from database table. If no values found user will be prompted to enter values for this table. Returns ---------- string List of ignored directories from database table. """ goodlogging.Log.Info("CLEAR", "Loading ign...
python
def _GetIgnoredDirs(self): """ Get ignored directories values from database table. If no values found user will be prompted to enter values for this table. Returns ---------- string List of ignored directories from database table. """ goodlogging.Log.Info("CLEAR", "Loading ign...
[ "def", "_GetIgnoredDirs", "(", "self", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"CLEAR\"", ",", "\"Loading ignored directories from database:\"", ")", "goodlogging", ".", "Log", ".", "IncreaseIndent", "(", ")", "ignoredDirs", "=", "self", ".", "_...
Get ignored directories values from database table. If no values found user will be prompted to enter values for this table. Returns ---------- string List of ignored directories from database table.
[ "Get", "ignored", "directories", "values", "from", "database", "table", ".", "If", "no", "values", "found", "user", "will", "be", "prompted", "to", "enter", "values", "for", "this", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L356-L381
train
56,262
davgeo/clear
clear/clear.py
ClearManager._GetDatabaseConfig
def _GetDatabaseConfig(self): """ Get all configuration from database. This includes values from the Config table as well as populating lists for supported formats and ignored directories from their respective database tables. """ goodlogging.Log.Seperator() goodlogging.Log.Info("CLEAR"...
python
def _GetDatabaseConfig(self): """ Get all configuration from database. This includes values from the Config table as well as populating lists for supported formats and ignored directories from their respective database tables. """ goodlogging.Log.Seperator() goodlogging.Log.Info("CLEAR"...
[ "def", "_GetDatabaseConfig", "(", "self", ")", ":", "goodlogging", ".", "Log", ".", "Seperator", "(", ")", "goodlogging", ".", "Log", ".", "Info", "(", "\"CLEAR\"", ",", "\"Getting configuration variables...\"", ")", "goodlogging", ".", "Log", ".", "IncreaseInde...
Get all configuration from database. This includes values from the Config table as well as populating lists for supported formats and ignored directories from their respective database tables.
[ "Get", "all", "configuration", "from", "database", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L386-L422
train
56,263
davgeo/clear
clear/clear.py
ClearManager._GetSupportedFilesInDir
def _GetSupportedFilesInDir(self, fileDir, fileList, supportedFormatList, ignoreDirList): """ Recursively get all supported files given a root search directory. Supported file extensions are given as a list, as are any directories which should be ignored. The result will be appended to the given f...
python
def _GetSupportedFilesInDir(self, fileDir, fileList, supportedFormatList, ignoreDirList): """ Recursively get all supported files given a root search directory. Supported file extensions are given as a list, as are any directories which should be ignored. The result will be appended to the given f...
[ "def", "_GetSupportedFilesInDir", "(", "self", ",", "fileDir", ",", "fileList", ",", "supportedFormatList", ",", "ignoreDirList", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"CLEAR\"", ",", "\"Parsing file directory: {0}\"", ".", "format", "(", "fileD...
Recursively get all supported files given a root search directory. Supported file extensions are given as a list, as are any directories which should be ignored. The result will be appended to the given file list argument. Parameters ---------- fileDir : string Path to root of direc...
[ "Recursively", "get", "all", "supported", "files", "given", "a", "root", "search", "directory", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L507-L545
train
56,264
davgeo/clear
clear/clear.py
ClearManager.Run
def Run(self): """ Main entry point for ClearManager class. Does the following steps: - Parse script arguments. - Optionally print or update database tables. - Get all configuration settings from database. - Optionally parse directory for file extraction. - Recursively parse source dir...
python
def Run(self): """ Main entry point for ClearManager class. Does the following steps: - Parse script arguments. - Optionally print or update database tables. - Get all configuration settings from database. - Optionally parse directory for file extraction. - Recursively parse source dir...
[ "def", "Run", "(", "self", ")", ":", "self", ".", "_GetArgs", "(", ")", "goodlogging", ".", "Log", ".", "Info", "(", "\"CLEAR\"", ",", "\"Using database: {0}\"", ".", "format", "(", "self", ".", "_databasePath", ")", ")", "self", ".", "_db", "=", "data...
Main entry point for ClearManager class. Does the following steps: - Parse script arguments. - Optionally print or update database tables. - Get all configuration settings from database. - Optionally parse directory for file extraction. - Recursively parse source directory for files matching ...
[ "Main", "entry", "point", "for", "ClearManager", "class", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L550-L607
train
56,265
diamondman/proteusisc
proteusisc/command_queue.py
CommandQueue.flush
def flush(self): """Force the queue of Primitives to compile, execute on the Controller, and fulfill promises with the data returned.""" self.stages = [] self.stagenames = [] if not self.queue: return if self.print_statistics:#pragma: no cover print("LEN...
python
def flush(self): """Force the queue of Primitives to compile, execute on the Controller, and fulfill promises with the data returned.""" self.stages = [] self.stagenames = [] if not self.queue: return if self.print_statistics:#pragma: no cover print("LEN...
[ "def", "flush", "(", "self", ")", ":", "self", ".", "stages", "=", "[", "]", "self", ".", "stagenames", "=", "[", "]", "if", "not", "self", ".", "queue", ":", "return", "if", "self", ".", "print_statistics", ":", "#pragma: no cover", "print", "(", "\...
Force the queue of Primitives to compile, execute on the Controller, and fulfill promises with the data returned.
[ "Force", "the", "queue", "of", "Primitives", "to", "compile", "execute", "on", "the", "Controller", "and", "fulfill", "promises", "with", "the", "data", "returned", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/command_queue.py#L356-L389
train
56,266
rosshamish/catanlog
spec/steps/thens.py
step_impl
def step_impl(context): """Compares text as written to the log output""" expected_lines = context.text.split('\n') assert len(expected_lines) == len(context.output) for expected, actual in zip(expected_lines, context.output): print('--\n\texpected: {}\n\tactual: {}'.format(expected, actual)) ...
python
def step_impl(context): """Compares text as written to the log output""" expected_lines = context.text.split('\n') assert len(expected_lines) == len(context.output) for expected, actual in zip(expected_lines, context.output): print('--\n\texpected: {}\n\tactual: {}'.format(expected, actual)) ...
[ "def", "step_impl", "(", "context", ")", ":", "expected_lines", "=", "context", ".", "text", ".", "split", "(", "'\\n'", ")", "assert", "len", "(", "expected_lines", ")", "==", "len", "(", "context", ".", "output", ")", "for", "expected", ",", "actual", ...
Compares text as written to the log output
[ "Compares", "text", "as", "written", "to", "the", "log", "output" ]
6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0
https://github.com/rosshamish/catanlog/blob/6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0/spec/steps/thens.py#L13-L19
train
56,267
davgeo/clear
clear/epguides.py
EPGuidesLookup._ParseShowList
def _ParseShowList(self, checkOnly=False): """ Read self._allShowList as csv file and make list of titles and IDs. Parameters ---------- checkOnly : boolean [optional : default = False] If checkOnly is True this will only check to ensure the column headers can be extracted cor...
python
def _ParseShowList(self, checkOnly=False): """ Read self._allShowList as csv file and make list of titles and IDs. Parameters ---------- checkOnly : boolean [optional : default = False] If checkOnly is True this will only check to ensure the column headers can be extracted cor...
[ "def", "_ParseShowList", "(", "self", ",", "checkOnly", "=", "False", ")", ":", "showTitleList", "=", "[", "]", "showIDList", "=", "[", "]", "csvReader", "=", "csv", ".", "reader", "(", "self", ".", "_allShowList", ".", "splitlines", "(", ")", ")", "fo...
Read self._allShowList as csv file and make list of titles and IDs. Parameters ---------- checkOnly : boolean [optional : default = False] If checkOnly is True this will only check to ensure the column headers can be extracted correctly.
[ "Read", "self", ".", "_allShowList", "as", "csv", "file", "and", "make", "list", "of", "titles", "and", "IDs", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L86-L119
train
56,268
davgeo/clear
clear/epguides.py
EPGuidesLookup._GetAllShowList
def _GetAllShowList(self): """ Populates self._allShowList with the epguides all show info. On the first lookup for a day the information will be loaded from the epguides url. This will be saved to local file _epguides_YYYYMMDD.csv and any old files will be removed. Subsequent accesses for the same...
python
def _GetAllShowList(self): """ Populates self._allShowList with the epguides all show info. On the first lookup for a day the information will be loaded from the epguides url. This will be saved to local file _epguides_YYYYMMDD.csv and any old files will be removed. Subsequent accesses for the same...
[ "def", "_GetAllShowList", "(", "self", ")", ":", "today", "=", "datetime", ".", "date", ".", "today", "(", ")", ".", "strftime", "(", "\"%Y%m%d\"", ")", "saveFile", "=", "'_epguides_'", "+", "today", "+", "'.csv'", "saveFilePath", "=", "os", ".", "path",...
Populates self._allShowList with the epguides all show info. On the first lookup for a day the information will be loaded from the epguides url. This will be saved to local file _epguides_YYYYMMDD.csv and any old files will be removed. Subsequent accesses for the same day will read this file.
[ "Populates", "self", ".", "_allShowList", "with", "the", "epguides", "all", "show", "info", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L124-L156
train
56,269
davgeo/clear
clear/epguides.py
EPGuidesLookup._GetShowID
def _GetShowID(self, showName): """ Get epguides show id for a given show name. Attempts to match the given show name against a show title in self._showTitleList and, if found, returns the corresponding index in self._showIDList. Parameters ---------- showName : string Show n...
python
def _GetShowID(self, showName): """ Get epguides show id for a given show name. Attempts to match the given show name against a show title in self._showTitleList and, if found, returns the corresponding index in self._showIDList. Parameters ---------- showName : string Show n...
[ "def", "_GetShowID", "(", "self", ",", "showName", ")", ":", "self", ".", "_GetTitleList", "(", ")", "self", ".", "_GetIDList", "(", ")", "for", "index", ",", "showTitle", "in", "enumerate", "(", "self", ".", "_showTitleList", ")", ":", "if", "showName",...
Get epguides show id for a given show name. Attempts to match the given show name against a show title in self._showTitleList and, if found, returns the corresponding index in self._showIDList. Parameters ---------- showName : string Show name to get show ID for. Returns ---...
[ "Get", "epguides", "show", "id", "for", "a", "given", "show", "name", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L187-L211
train
56,270
davgeo/clear
clear/epguides.py
EPGuidesLookup._ExtractDataFromShowHtml
def _ExtractDataFromShowHtml(self, html): """ Extracts csv show data from epguides html source. Parameters ---------- html : string Block of html text Returns ---------- string Show data extracted from html text in csv format. """ htmlLines = html.splitline...
python
def _ExtractDataFromShowHtml(self, html): """ Extracts csv show data from epguides html source. Parameters ---------- html : string Block of html text Returns ---------- string Show data extracted from html text in csv format. """ htmlLines = html.splitline...
[ "def", "_ExtractDataFromShowHtml", "(", "self", ",", "html", ")", ":", "htmlLines", "=", "html", ".", "splitlines", "(", ")", "for", "count", ",", "line", "in", "enumerate", "(", "htmlLines", ")", ":", "if", "line", ".", "strip", "(", ")", "==", "r'<pr...
Extracts csv show data from epguides html source. Parameters ---------- html : string Block of html text Returns ---------- string Show data extracted from html text in csv format.
[ "Extracts", "csv", "show", "data", "from", "epguides", "html", "source", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L219-L245
train
56,271
davgeo/clear
clear/epguides.py
EPGuidesLookup._GetEpisodeName
def _GetEpisodeName(self, showID, season, episode): """ Get episode name from epguides show info. Parameters ---------- showID : string Identifier matching show in epguides. season : int Season number. epiosde : int Epiosde number. Returns ----------...
python
def _GetEpisodeName(self, showID, season, episode): """ Get episode name from epguides show info. Parameters ---------- showID : string Identifier matching show in epguides. season : int Season number. epiosde : int Epiosde number. Returns ----------...
[ "def", "_GetEpisodeName", "(", "self", ",", "showID", ",", "season", ",", "episode", ")", ":", "# Load data for showID from dictionary", "showInfo", "=", "csv", ".", "reader", "(", "self", ".", "_showInfoDict", "[", "showID", "]", ".", "splitlines", "(", ")", ...
Get episode name from epguides show info. Parameters ---------- showID : string Identifier matching show in epguides. season : int Season number. epiosde : int Epiosde number. Returns ---------- int or None If an episode name is found this is r...
[ "Get", "episode", "name", "from", "epguides", "show", "info", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L250-L295
train
56,272
davgeo/clear
clear/epguides.py
EPGuidesLookup.ShowNameLookUp
def ShowNameLookUp(self, string): """ Attempts to find the best match for the given string in the list of epguides show titles. If this list has not previous been generated it will be generated first. Parameters ---------- string : string String to find show name match against. ...
python
def ShowNameLookUp(self, string): """ Attempts to find the best match for the given string in the list of epguides show titles. If this list has not previous been generated it will be generated first. Parameters ---------- string : string String to find show name match against. ...
[ "def", "ShowNameLookUp", "(", "self", ",", "string", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"EPGUIDES\"", ",", "\"Looking up show name match for string '{0}' in guide\"", ".", "format", "(", "string", ")", ",", "verbosity", "=", "self", ".", "l...
Attempts to find the best match for the given string in the list of epguides show titles. If this list has not previous been generated it will be generated first. Parameters ---------- string : string String to find show name match against. Returns ---------- string ...
[ "Attempts", "to", "find", "the", "best", "match", "for", "the", "given", "string", "in", "the", "list", "of", "epguides", "show", "titles", ".", "If", "this", "list", "has", "not", "previous", "been", "generated", "it", "will", "be", "generated", "first", ...
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L301-L320
train
56,273
davgeo/clear
clear/epguides.py
EPGuidesLookup.EpisodeNameLookUp
def EpisodeNameLookUp(self, showName, season, episode): """ Get the episode name correspondng to the given show name, season number and episode number. Parameters ---------- showName : string Name of TV show. This must match an entry in the epguides title list (this can be ach...
python
def EpisodeNameLookUp(self, showName, season, episode): """ Get the episode name correspondng to the given show name, season number and episode number. Parameters ---------- showName : string Name of TV show. This must match an entry in the epguides title list (this can be ach...
[ "def", "EpisodeNameLookUp", "(", "self", ",", "showName", ",", "season", ",", "episode", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"EPGUIDE\"", ",", "\"Looking up episode name for {0} S{1}E{2}\"", ".", "format", "(", "showName", ",", "season", ","...
Get the episode name correspondng to the given show name, season number and episode number. Parameters ---------- showName : string Name of TV show. This must match an entry in the epguides title list (this can be achieved by calling ShowNameLookUp first). season : int ...
[ "Get", "the", "episode", "name", "correspondng", "to", "the", "given", "show", "name", "season", "number", "and", "episode", "number", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L325-L364
train
56,274
ScottDuckworth/python-anyvcs
anyvcs/hg.py
HgRepo.private_path
def private_path(self): """Get the path to a directory which can be used to store arbitrary data This directory should not conflict with any of the repository internals. The directory should be created if it does not already exist. """ path = os.path.join(self.path, '.hg', '.pr...
python
def private_path(self): """Get the path to a directory which can be used to store arbitrary data This directory should not conflict with any of the repository internals. The directory should be created if it does not already exist. """ path = os.path.join(self.path, '.hg', '.pr...
[ "def", "private_path", "(", "self", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "'.hg'", ",", "'.private'", ")", "try", ":", "os", ".", "mkdir", "(", "path", ")", "except", "OSError", "as", "e", ":", "if"...
Get the path to a directory which can be used to store arbitrary data This directory should not conflict with any of the repository internals. The directory should be created if it does not already exist.
[ "Get", "the", "path", "to", "a", "directory", "which", "can", "be", "used", "to", "store", "arbitrary", "data" ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/hg.py#L86-L99
train
56,275
ScottDuckworth/python-anyvcs
anyvcs/hg.py
HgRepo.bookmarks
def bookmarks(self): """Get list of bookmarks""" cmd = [HG, 'bookmarks'] output = self._command(cmd).decode(self.encoding, 'replace') if output.startswith('no bookmarks set'): return [] results = [] for line in output.splitlines(): m = bookmarks_rx...
python
def bookmarks(self): """Get list of bookmarks""" cmd = [HG, 'bookmarks'] output = self._command(cmd).decode(self.encoding, 'replace') if output.startswith('no bookmarks set'): return [] results = [] for line in output.splitlines(): m = bookmarks_rx...
[ "def", "bookmarks", "(", "self", ")", ":", "cmd", "=", "[", "HG", ",", "'bookmarks'", "]", "output", "=", "self", ".", "_command", "(", "cmd", ")", ".", "decode", "(", "self", ".", "encoding", ",", "'replace'", ")", "if", "output", ".", "startswith",...
Get list of bookmarks
[ "Get", "list", "of", "bookmarks" ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/hg.py#L330-L341
train
56,276
kevinconway/confpy
confpy/loaders/base.py
ConfigurationFile.content
def content(self): """Get the file contents. This property is cached. The file is only read once. """ if not self._content: self._content = self._read() return self._content
python
def content(self): """Get the file contents. This property is cached. The file is only read once. """ if not self._content: self._content = self._read() return self._content
[ "def", "content", "(", "self", ")", ":", "if", "not", "self", ".", "_content", ":", "self", ".", "_content", "=", "self", ".", "_read", "(", ")", "return", "self", ".", "_content" ]
Get the file contents. This property is cached. The file is only read once.
[ "Get", "the", "file", "contents", "." ]
1ee8afcab46ac6915a5ff4184180434ac7b84a60
https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/loaders/base.py#L35-L44
train
56,277
kevinconway/confpy
confpy/loaders/base.py
ConfigurationFile.config
def config(self): """Get a Configuration object from the file contents.""" conf = config.Configuration() for namespace in self.namespaces: if not hasattr(conf, namespace): if not self._strict: continue raise exc.NamespaceNotRegi...
python
def config(self): """Get a Configuration object from the file contents.""" conf = config.Configuration() for namespace in self.namespaces: if not hasattr(conf, namespace): if not self._strict: continue raise exc.NamespaceNotRegi...
[ "def", "config", "(", "self", ")", ":", "conf", "=", "config", ".", "Configuration", "(", ")", "for", "namespace", "in", "self", ".", "namespaces", ":", "if", "not", "hasattr", "(", "conf", ",", "namespace", ")", ":", "if", "not", "self", ".", "_stri...
Get a Configuration object from the file contents.
[ "Get", "a", "Configuration", "object", "from", "the", "file", "contents", "." ]
1ee8afcab46ac6915a5ff4184180434ac7b84a60
https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/loaders/base.py#L47-L78
train
56,278
kevinconway/confpy
confpy/loaders/base.py
ConfigurationFile._read
def _read(self): """Open the file and return its contents.""" with open(self.path, 'r') as file_handle: content = file_handle.read() # Py27 INI config parser chokes if the content provided is not unicode. # All other versions seems to work appropriately. Forcing the value t...
python
def _read(self): """Open the file and return its contents.""" with open(self.path, 'r') as file_handle: content = file_handle.read() # Py27 INI config parser chokes if the content provided is not unicode. # All other versions seems to work appropriately. Forcing the value t...
[ "def", "_read", "(", "self", ")", ":", "with", "open", "(", "self", ".", "path", ",", "'r'", ")", "as", "file_handle", ":", "content", "=", "file_handle", ".", "read", "(", ")", "# Py27 INI config parser chokes if the content provided is not unicode.", "# All othe...
Open the file and return its contents.
[ "Open", "the", "file", "and", "return", "its", "contents", "." ]
1ee8afcab46ac6915a5ff4184180434ac7b84a60
https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/loaders/base.py#L89-L98
train
56,279
botstory/botstory
botstory/chat.py
Chat.ask
async def ask(self, body, quick_replies=None, options=None, user=None): """ simple ask with predefined quick replies :param body: :param quick_replies: (optional) in form of {'title': <message>, 'payload': <any json>} :param options: :param user: :return:...
python
async def ask(self, body, quick_replies=None, options=None, user=None): """ simple ask with predefined quick replies :param body: :param quick_replies: (optional) in form of {'title': <message>, 'payload': <any json>} :param options: :param user: :return:...
[ "async", "def", "ask", "(", "self", ",", "body", ",", "quick_replies", "=", "None", ",", "options", "=", "None", ",", "user", "=", "None", ")", ":", "await", "self", ".", "send_text_message_to_all_interfaces", "(", "recipient", "=", "user", ",", "text", ...
simple ask with predefined quick replies :param body: :param quick_replies: (optional) in form of {'title': <message>, 'payload': <any json>} :param options: :param user: :return:
[ "simple", "ask", "with", "predefined", "quick", "replies" ]
9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3
https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/chat.py#L13-L30
train
56,280
botstory/botstory
botstory/chat.py
Chat.say
async def say(self, body, user, options): """ say something to user :param body: :param user: :return: """ return await self.send_text_message_to_all_interfaces( recipient=user, text=body, options=options)
python
async def say(self, body, user, options): """ say something to user :param body: :param user: :return: """ return await self.send_text_message_to_all_interfaces( recipient=user, text=body, options=options)
[ "async", "def", "say", "(", "self", ",", "body", ",", "user", ",", "options", ")", ":", "return", "await", "self", ".", "send_text_message_to_all_interfaces", "(", "recipient", "=", "user", ",", "text", "=", "body", ",", "options", "=", "options", ")" ]
say something to user :param body: :param user: :return:
[ "say", "something", "to", "user" ]
9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3
https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/chat.py#L54-L63
train
56,281
sporsh/carnifex
carnifex/endpoint.py
InductorEndpoint.connect
def connect(self, protocolFactory): """Starts a process and connect a protocol to it. """ deferred = self._startProcess() deferred.addCallback(self._connectRelay, protocolFactory) deferred.addCallback(self._startRelay) return deferred
python
def connect(self, protocolFactory): """Starts a process and connect a protocol to it. """ deferred = self._startProcess() deferred.addCallback(self._connectRelay, protocolFactory) deferred.addCallback(self._startRelay) return deferred
[ "def", "connect", "(", "self", ",", "protocolFactory", ")", ":", "deferred", "=", "self", ".", "_startProcess", "(", ")", "deferred", ".", "addCallback", "(", "self", ".", "_connectRelay", ",", "protocolFactory", ")", "deferred", ".", "addCallback", "(", "se...
Starts a process and connect a protocol to it.
[ "Starts", "a", "process", "and", "connect", "a", "protocol", "to", "it", "." ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/endpoint.py#L22-L28
train
56,282
sporsh/carnifex
carnifex/endpoint.py
InductorEndpoint._startProcess
def _startProcess(self): """Use the inductor to start the process we want to relay data from. """ connectedDeferred = defer.Deferred() processProtocol = RelayProcessProtocol(connectedDeferred) self.inductor.execute(processProtocol, *self.inductorArgs) return connectedDefe...
python
def _startProcess(self): """Use the inductor to start the process we want to relay data from. """ connectedDeferred = defer.Deferred() processProtocol = RelayProcessProtocol(connectedDeferred) self.inductor.execute(processProtocol, *self.inductorArgs) return connectedDefe...
[ "def", "_startProcess", "(", "self", ")", ":", "connectedDeferred", "=", "defer", ".", "Deferred", "(", ")", "processProtocol", "=", "RelayProcessProtocol", "(", "connectedDeferred", ")", "self", ".", "inductor", ".", "execute", "(", "processProtocol", ",", "*",...
Use the inductor to start the process we want to relay data from.
[ "Use", "the", "inductor", "to", "start", "the", "process", "we", "want", "to", "relay", "data", "from", "." ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/endpoint.py#L30-L36
train
56,283
sporsh/carnifex
carnifex/endpoint.py
InductorEndpoint._connectRelay
def _connectRelay(self, process, protocolFactory): """Set up and connect the protocol we want to relay to the process. This method is automatically called when the process is started, and we are ready to relay through it. """ try: wf = _WrappingFactory(protocolFactory...
python
def _connectRelay(self, process, protocolFactory): """Set up and connect the protocol we want to relay to the process. This method is automatically called when the process is started, and we are ready to relay through it. """ try: wf = _WrappingFactory(protocolFactory...
[ "def", "_connectRelay", "(", "self", ",", "process", ",", "protocolFactory", ")", ":", "try", ":", "wf", "=", "_WrappingFactory", "(", "protocolFactory", ")", "connector", "=", "RelayConnector", "(", "process", ",", "wf", ",", "self", ".", "timeout", ",", ...
Set up and connect the protocol we want to relay to the process. This method is automatically called when the process is started, and we are ready to relay through it.
[ "Set", "up", "and", "connect", "the", "protocol", "we", "want", "to", "relay", "to", "the", "process", ".", "This", "method", "is", "automatically", "called", "when", "the", "process", "is", "started", "and", "we", "are", "ready", "to", "relay", "through",...
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/endpoint.py#L38-L51
train
56,284
sporsh/carnifex
carnifex/endpoint.py
InductorEndpoint._startRelay
def _startRelay(self, client): """Start relaying data between the process and the protocol. This method is called when the protocol is connected. """ process = client.transport.connector.process # Relay any buffered data that was received from the process before # we got ...
python
def _startRelay(self, client): """Start relaying data between the process and the protocol. This method is called when the protocol is connected. """ process = client.transport.connector.process # Relay any buffered data that was received from the process before # we got ...
[ "def", "_startRelay", "(", "self", ",", "client", ")", ":", "process", "=", "client", ".", "transport", ".", "connector", ".", "process", "# Relay any buffered data that was received from the process before", "# we got connected and started relaying.", "for", "_", ",", "d...
Start relaying data between the process and the protocol. This method is called when the protocol is connected.
[ "Start", "relaying", "data", "between", "the", "process", "and", "the", "protocol", ".", "This", "method", "is", "called", "when", "the", "protocol", "is", "connected", "." ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/endpoint.py#L53-L74
train
56,285
sporsh/carnifex
carnifex/endpoint.py
RelayTransport.connectRelay
def connectRelay(self): """Builds the target protocol and connects it to the relay transport. """ self.protocol = self.connector.buildProtocol(None) self.connected = True self.protocol.makeConnection(self)
python
def connectRelay(self): """Builds the target protocol and connects it to the relay transport. """ self.protocol = self.connector.buildProtocol(None) self.connected = True self.protocol.makeConnection(self)
[ "def", "connectRelay", "(", "self", ")", ":", "self", ".", "protocol", "=", "self", ".", "connector", ".", "buildProtocol", "(", "None", ")", "self", ".", "connected", "=", "True", "self", ".", "protocol", ".", "makeConnection", "(", "self", ")" ]
Builds the target protocol and connects it to the relay transport.
[ "Builds", "the", "target", "protocol", "and", "connects", "it", "to", "the", "relay", "transport", "." ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/endpoint.py#L87-L92
train
56,286
sporsh/carnifex
carnifex/endpoint.py
RelayProcessProtocol.childDataReceived
def childDataReceived(self, childFD, data): """Relay data received on any file descriptor to the process """ protocol = getattr(self, 'protocol', None) if protocol: protocol.dataReceived(data) else: self.data.append((childFD, data))
python
def childDataReceived(self, childFD, data): """Relay data received on any file descriptor to the process """ protocol = getattr(self, 'protocol', None) if protocol: protocol.dataReceived(data) else: self.data.append((childFD, data))
[ "def", "childDataReceived", "(", "self", ",", "childFD", ",", "data", ")", ":", "protocol", "=", "getattr", "(", "self", ",", "'protocol'", ",", "None", ")", "if", "protocol", ":", "protocol", ".", "dataReceived", "(", "data", ")", "else", ":", "self", ...
Relay data received on any file descriptor to the process
[ "Relay", "data", "received", "on", "any", "file", "descriptor", "to", "the", "process" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/endpoint.py#L149-L156
train
56,287
scailer/django-social-publisher
social_publisher/core.py
PublisherCore.publish
def publish(self, user, provider, obj, comment, **kwargs): ''' user - django User or UserSocialAuth instance provider - name of publisher provider obj - sharing object comment - string ''' social_user = self._get_social_user(user, provider) ...
python
def publish(self, user, provider, obj, comment, **kwargs): ''' user - django User or UserSocialAuth instance provider - name of publisher provider obj - sharing object comment - string ''' social_user = self._get_social_user(user, provider) ...
[ "def", "publish", "(", "self", ",", "user", ",", "provider", ",", "obj", ",", "comment", ",", "*", "*", "kwargs", ")", ":", "social_user", "=", "self", ".", "_get_social_user", "(", "user", ",", "provider", ")", "backend", "=", "self", ".", "get_backen...
user - django User or UserSocialAuth instance provider - name of publisher provider obj - sharing object comment - string
[ "user", "-", "django", "User", "or", "UserSocialAuth", "instance", "provider", "-", "name", "of", "publisher", "provider", "obj", "-", "sharing", "object", "comment", "-", "string" ]
7fc0ea28fc9e4ecf0e95617fc2d1f89a90fca087
https://github.com/scailer/django-social-publisher/blob/7fc0ea28fc9e4ecf0e95617fc2d1f89a90fca087/social_publisher/core.py#L61-L70
train
56,288
scailer/django-social-publisher
social_publisher/core.py
PublisherCore.check
def check(self, user, provider, permission, **kwargs): ''' user - django User or UserSocialAuth instance provider - name of publisher provider permission - if backend maintains check permissions vk - binary mask in int format ...
python
def check(self, user, provider, permission, **kwargs): ''' user - django User or UserSocialAuth instance provider - name of publisher provider permission - if backend maintains check permissions vk - binary mask in int format ...
[ "def", "check", "(", "self", ",", "user", ",", "provider", ",", "permission", ",", "*", "*", "kwargs", ")", ":", "try", ":", "social_user", "=", "self", ".", "_get_social_user", "(", "user", ",", "provider", ")", "if", "not", "social_user", ":", "retur...
user - django User or UserSocialAuth instance provider - name of publisher provider permission - if backend maintains check permissions vk - binary mask in int format facebook - scope string
[ "user", "-", "django", "User", "or", "UserSocialAuth", "instance", "provider", "-", "name", "of", "publisher", "provider", "permission", "-", "if", "backend", "maintains", "check", "permissions", "vk", "-", "binary", "mask", "in", "int", "format", "facebook", ...
7fc0ea28fc9e4ecf0e95617fc2d1f89a90fca087
https://github.com/scailer/django-social-publisher/blob/7fc0ea28fc9e4ecf0e95617fc2d1f89a90fca087/social_publisher/core.py#L72-L89
train
56,289
pvizeli/ha-alpr
haalpr.py
HAAlpr.recognize_byte
def recognize_byte(self, image, timeout=10): """Process a byte image buffer.""" result = [] alpr = subprocess.Popen( self._cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL ) # send image try: ...
python
def recognize_byte(self, image, timeout=10): """Process a byte image buffer.""" result = [] alpr = subprocess.Popen( self._cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL ) # send image try: ...
[ "def", "recognize_byte", "(", "self", ",", "image", ",", "timeout", "=", "10", ")", ":", "result", "=", "[", "]", "alpr", "=", "subprocess", ".", "Popen", "(", "self", ".", "_cmd", ",", "stdin", "=", "subprocess", ".", "PIPE", ",", "stdout", "=", "...
Process a byte image buffer.
[ "Process", "a", "byte", "image", "buffer", "." ]
93777c20f3caba3ee832c45ec022b08a2ee7efd6
https://github.com/pvizeli/ha-alpr/blob/93777c20f3caba3ee832c45ec022b08a2ee7efd6/haalpr.py#L29-L75
train
56,290
MacHu-GWU/crawlib-project
crawlib/pipeline/rds/query_builder.py
finished
def finished(finished_status, update_interval, table, status_column, edit_at_column): """ Create text sql statement query for sqlalchemy that getting all finished task. :param finished_status: int, status code that greater or equal than this will ...
python
def finished(finished_status, update_interval, table, status_column, edit_at_column): """ Create text sql statement query for sqlalchemy that getting all finished task. :param finished_status: int, status code that greater or equal than this will ...
[ "def", "finished", "(", "finished_status", ",", "update_interval", ",", "table", ",", "status_column", ",", "edit_at_column", ")", ":", "sql", "=", "select", "(", "[", "table", "]", ")", ".", "where", "(", "and_", "(", "*", "[", "status_column", ">=", "f...
Create text sql statement query for sqlalchemy that getting all finished task. :param finished_status: int, status code that greater or equal than this will be considered as finished. :param update_interval: int, the record will be updated every x seconds. :return: sqlalchemy text sql statement. ...
[ "Create", "text", "sql", "statement", "query", "for", "sqlalchemy", "that", "getting", "all", "finished", "task", "." ]
241516f2a7a0a32c692f7af35a1f44064e8ce1ab
https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/pipeline/rds/query_builder.py#L14-L38
train
56,291
MacHu-GWU/crawlib-project
crawlib/pipeline/rds/query_builder.py
unfinished
def unfinished(finished_status, update_interval, table, status_column, edit_at_column): """ Create text sql statement query for sqlalchemy that getting all unfinished task. :param finished_status: int, status code that less than this will ...
python
def unfinished(finished_status, update_interval, table, status_column, edit_at_column): """ Create text sql statement query for sqlalchemy that getting all unfinished task. :param finished_status: int, status code that less than this will ...
[ "def", "unfinished", "(", "finished_status", ",", "update_interval", ",", "table", ",", "status_column", ",", "edit_at_column", ")", ":", "sql", "=", "select", "(", "[", "table", "]", ")", ".", "where", "(", "or_", "(", "*", "[", "status_column", "<", "f...
Create text sql statement query for sqlalchemy that getting all unfinished task. :param finished_status: int, status code that less than this will be considered as unfinished. :param update_interval: int, the record will be updated every x seconds. :return: sqlalchemy text sql statement. **中...
[ "Create", "text", "sql", "statement", "query", "for", "sqlalchemy", "that", "getting", "all", "unfinished", "task", "." ]
241516f2a7a0a32c692f7af35a1f44064e8ce1ab
https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/pipeline/rds/query_builder.py#L51-L76
train
56,292
scivision/sciencedates
sciencedates/findnearest.py
find_nearest
def find_nearest(x, x0) -> Tuple[int, Any]: """ This find_nearest function does NOT assume sorted input inputs: x: array (float, int, datetime, h5py.Dataset) within which to search for x0 x0: singleton or array of values to search for in x outputs: idx: index of flattened x nearest to x0 ...
python
def find_nearest(x, x0) -> Tuple[int, Any]: """ This find_nearest function does NOT assume sorted input inputs: x: array (float, int, datetime, h5py.Dataset) within which to search for x0 x0: singleton or array of values to search for in x outputs: idx: index of flattened x nearest to x0 ...
[ "def", "find_nearest", "(", "x", ",", "x0", ")", "->", "Tuple", "[", "int", ",", "Any", "]", ":", "x", "=", "np", ".", "asanyarray", "(", "x", ")", "# for indexing upon return", "x0", "=", "np", ".", "atleast_1d", "(", "x0", ")", "# %%", "if", "x",...
This find_nearest function does NOT assume sorted input inputs: x: array (float, int, datetime, h5py.Dataset) within which to search for x0 x0: singleton or array of values to search for in x outputs: idx: index of flattened x nearest to x0 (i.e. works with higher than 1-D arrays also) xidx: ...
[ "This", "find_nearest", "function", "does", "NOT", "assume", "sorted", "input" ]
a713389e027b42d26875cf227450a5d7c6696000
https://github.com/scivision/sciencedates/blob/a713389e027b42d26875cf227450a5d7c6696000/sciencedates/findnearest.py#L6-L42
train
56,293
e7dal/bubble3
behave4cmd0/command_util.py
ensure_context_attribute_exists
def ensure_context_attribute_exists(context, name, default_value=None): """ Ensure a behave resource exists as attribute in the behave context. If this is not the case, the attribute is created by using the default_value. """ if not hasattr(context, name): setattr(context, name, default_valu...
python
def ensure_context_attribute_exists(context, name, default_value=None): """ Ensure a behave resource exists as attribute in the behave context. If this is not the case, the attribute is created by using the default_value. """ if not hasattr(context, name): setattr(context, name, default_valu...
[ "def", "ensure_context_attribute_exists", "(", "context", ",", "name", ",", "default_value", "=", "None", ")", ":", "if", "not", "hasattr", "(", "context", ",", "name", ")", ":", "setattr", "(", "context", ",", "name", ",", "default_value", ")" ]
Ensure a behave resource exists as attribute in the behave context. If this is not the case, the attribute is created by using the default_value.
[ "Ensure", "a", "behave", "resource", "exists", "as", "attribute", "in", "the", "behave", "context", ".", "If", "this", "is", "not", "the", "case", "the", "attribute", "is", "created", "by", "using", "the", "default_value", "." ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/command_util.py#L51-L57
train
56,294
e7dal/bubble3
behave4cmd0/command_util.py
ensure_workdir_exists
def ensure_workdir_exists(context): """ Ensures that the work directory exists. In addition, the location of the workdir is stored as attribute in the context object. """ ensure_context_attribute_exists(context, "workdir", None) if not context.workdir: context.workdir = os.path.abspa...
python
def ensure_workdir_exists(context): """ Ensures that the work directory exists. In addition, the location of the workdir is stored as attribute in the context object. """ ensure_context_attribute_exists(context, "workdir", None) if not context.workdir: context.workdir = os.path.abspa...
[ "def", "ensure_workdir_exists", "(", "context", ")", ":", "ensure_context_attribute_exists", "(", "context", ",", "\"workdir\"", ",", "None", ")", "if", "not", "context", ".", "workdir", ":", "context", ".", "workdir", "=", "os", ".", "path", ".", "abspath", ...
Ensures that the work directory exists. In addition, the location of the workdir is stored as attribute in the context object.
[ "Ensures", "that", "the", "work", "directory", "exists", ".", "In", "addition", "the", "location", "of", "the", "workdir", "is", "stored", "as", "attribute", "in", "the", "context", "object", "." ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/command_util.py#L59-L68
train
56,295
Cadasta/django-tutelary
tutelary/wildtree.py
del_by_idx
def del_by_idx(tree, idxs): """ Delete a key entry based on numerical indexes into subtree lists. """ if len(idxs) == 0: tree['item'] = None tree['subtrees'] = [] else: hidx, tidxs = idxs[0], idxs[1:] del_by_idx(tree['subtrees'][hidx][1], tidxs) if len(tree['s...
python
def del_by_idx(tree, idxs): """ Delete a key entry based on numerical indexes into subtree lists. """ if len(idxs) == 0: tree['item'] = None tree['subtrees'] = [] else: hidx, tidxs = idxs[0], idxs[1:] del_by_idx(tree['subtrees'][hidx][1], tidxs) if len(tree['s...
[ "def", "del_by_idx", "(", "tree", ",", "idxs", ")", ":", "if", "len", "(", "idxs", ")", "==", "0", ":", "tree", "[", "'item'", "]", "=", "None", "tree", "[", "'subtrees'", "]", "=", "[", "]", "else", ":", "hidx", ",", "tidxs", "=", "idxs", "[",...
Delete a key entry based on numerical indexes into subtree lists.
[ "Delete", "a", "key", "entry", "based", "on", "numerical", "indexes", "into", "subtree", "lists", "." ]
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/wildtree.py#L145-L156
train
56,296
Cadasta/django-tutelary
tutelary/wildtree.py
find_in_tree
def find_in_tree(tree, key, perfect=False): """ Helper to perform find in dictionary tree. """ if len(key) == 0: if tree['item'] is not None: return tree['item'], () else: for i in range(len(tree['subtrees'])): if not perfect and tree['subtrees'][i...
python
def find_in_tree(tree, key, perfect=False): """ Helper to perform find in dictionary tree. """ if len(key) == 0: if tree['item'] is not None: return tree['item'], () else: for i in range(len(tree['subtrees'])): if not perfect and tree['subtrees'][i...
[ "def", "find_in_tree", "(", "tree", ",", "key", ",", "perfect", "=", "False", ")", ":", "if", "len", "(", "key", ")", "==", "0", ":", "if", "tree", "[", "'item'", "]", "is", "not", "None", ":", "return", "tree", "[", "'item'", "]", ",", "(", ")...
Helper to perform find in dictionary tree.
[ "Helper", "to", "perform", "find", "in", "dictionary", "tree", "." ]
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/wildtree.py#L159-L184
train
56,297
Cadasta/django-tutelary
tutelary/wildtree.py
WildTree.find
def find(self, key, perfect=False): """ Find a key path in the tree, matching wildcards. Return value for key, along with index path through subtree lists to the result. Throw ``KeyError`` if the key path doesn't exist in the tree. """ return find_in_tree(self.root, ke...
python
def find(self, key, perfect=False): """ Find a key path in the tree, matching wildcards. Return value for key, along with index path through subtree lists to the result. Throw ``KeyError`` if the key path doesn't exist in the tree. """ return find_in_tree(self.root, ke...
[ "def", "find", "(", "self", ",", "key", ",", "perfect", "=", "False", ")", ":", "return", "find_in_tree", "(", "self", ".", "root", ",", "key", ",", "perfect", ")" ]
Find a key path in the tree, matching wildcards. Return value for key, along with index path through subtree lists to the result. Throw ``KeyError`` if the key path doesn't exist in the tree.
[ "Find", "a", "key", "path", "in", "the", "tree", "matching", "wildcards", ".", "Return", "value", "for", "key", "along", "with", "index", "path", "through", "subtree", "lists", "to", "the", "result", ".", "Throw", "KeyError", "if", "the", "key", "path", ...
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/wildtree.py#L121-L128
train
56,298
Cadasta/django-tutelary
tutelary/wildtree.py
WildTree._purge_unreachable
def _purge_unreachable(self, key): """ Purge unreachable dominated key paths before inserting a new key path. """ dels = [] for p in self: if dominates(key, p): dels.append(p) for k in dels: _, idxs = find_in_tree(self.root...
python
def _purge_unreachable(self, key): """ Purge unreachable dominated key paths before inserting a new key path. """ dels = [] for p in self: if dominates(key, p): dels.append(p) for k in dels: _, idxs = find_in_tree(self.root...
[ "def", "_purge_unreachable", "(", "self", ",", "key", ")", ":", "dels", "=", "[", "]", "for", "p", "in", "self", ":", "if", "dominates", "(", "key", ",", "p", ")", ":", "dels", ".", "append", "(", "p", ")", "for", "k", "in", "dels", ":", "_", ...
Purge unreachable dominated key paths before inserting a new key path.
[ "Purge", "unreachable", "dominated", "key", "paths", "before", "inserting", "a", "new", "key", "path", "." ]
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/wildtree.py#L130-L142
train
56,299