labNo
float64
1
10
taskNo
float64
0
4
questioner
stringclasses
2 values
question
stringlengths
9
201
code
stringlengths
18
30.3k
startLine
float64
0
192
endLine
float64
0
196
questionType
stringclasses
4 values
answer
stringlengths
2
905
src
stringclasses
3 values
code_processed
stringlengths
12
28.3k
id
stringlengths
2
5
raw_code
stringlengths
20
30.3k
raw_comment
stringlengths
10
242
comment
stringlengths
9
207
q_code
stringlengths
66
30.3k
null
null
null
What does this function do?
def echo_class(klass, write=sys.stdout.write): for (_, method) in inspect.getmembers(klass, inspect.ismethod): echo_instancemethod(klass, method, write) for (_, fn) in inspect.getmembers(klass, inspect.isfunction): if is_static_method(fn, klass): setattr(klass, name(fn), staticmethod(echo(fn, write))) else: ...
null
null
null
Echo calls to class methods and static functions
pcsd
def echo class klass write=sys stdout write for method in inspect getmembers klass inspect ismethod echo instancemethod klass method write for fn in inspect getmembers klass inspect isfunction if is static method fn klass setattr klass name fn staticmethod echo fn write else echo instancemethod klass fn write
324
def echo_class(klass, write=sys.stdout.write): for (_, method) in inspect.getmembers(klass, inspect.ismethod): echo_instancemethod(klass, method, write) for (_, fn) in inspect.getmembers(klass, inspect.isfunction): if is_static_method(fn, klass): setattr(klass, name(fn), staticmethod(echo(fn, write))) else: ...
Echo calls to class methods and static functions
echo calls to class methods and static functions
Question: What does this function do? Code: def echo_class(klass, write=sys.stdout.write): for (_, method) in inspect.getmembers(klass, inspect.ismethod): echo_instancemethod(klass, method, write) for (_, fn) in inspect.getmembers(klass, inspect.isfunction): if is_static_method(fn, klass): setattr(klass, na...
null
null
null
What does this function do?
def _do_search(conf): connargs = {} for name in ['server', 'port', 'tls', 'binddn', 'bindpw', 'anonymous']: connargs[name] = _config(name, conf) if (connargs['binddn'] and connargs['bindpw']): connargs['anonymous'] = False try: _filter = conf['filter'] except KeyError: raise SaltInvocationError('missing fi...
null
null
null
Builds connection and search arguments, performs the LDAP search and formats the results as a dictionary appropriate for pillar use.
pcsd
def do search conf connargs = {} for name in ['server' 'port' 'tls' 'binddn' 'bindpw' 'anonymous'] connargs[name] = config name conf if connargs['binddn'] and connargs['bindpw'] connargs['anonymous'] = False try filter = conf['filter'] except Key Error raise Salt Invocation Error 'missing filter' dn = config 'dn' conf ...
326
def _do_search(conf): connargs = {} for name in ['server', 'port', 'tls', 'binddn', 'bindpw', 'anonymous']: connargs[name] = _config(name, conf) if (connargs['binddn'] and connargs['bindpw']): connargs['anonymous'] = False try: _filter = conf['filter'] except KeyError: raise SaltInvocationError('missing fi...
Builds connection and search arguments, performs the LDAP search and formats the results as a dictionary appropriate for pillar use.
builds connection and search arguments , performs the ldap search and formats the results as a dictionary appropriate for pillar use .
Question: What does this function do? Code: def _do_search(conf): connargs = {} for name in ['server', 'port', 'tls', 'binddn', 'bindpw', 'anonymous']: connargs[name] = _config(name, conf) if (connargs['binddn'] and connargs['bindpw']): connargs['anonymous'] = False try: _filter = conf['filter'] except Ke...
null
null
null
What does this function do?
def FlagOverrider(**flag_kwargs): def Decorator(f): 'Allow a function to safely change flags, restoring them on return.' def Decorated(*args, **kwargs): global FLAGS old_flags = copy.copy(FLAGS) for (k, v) in flag_kwargs.items(): setattr(FLAGS, k, v) try: return f(*args, **kwargs) finally: ...
null
null
null
A Helpful decorator which can switch the flag values temporarily.
pcsd
def Flag Overrider **flag kwargs def Decorator f 'Allow a function to safely change flags restoring them on return ' def Decorated *args **kwargs global FLAGS old flags = copy copy FLAGS for k v in flag kwargs items setattr FLAGS k v try return f *args **kwargs finally FLAGS = old flags return Decorated return Decorato...
335
def FlagOverrider(**flag_kwargs): def Decorator(f): 'Allow a function to safely change flags, restoring them on return.' def Decorated(*args, **kwargs): global FLAGS old_flags = copy.copy(FLAGS) for (k, v) in flag_kwargs.items(): setattr(FLAGS, k, v) try: return f(*args, **kwargs) finally: ...
A Helpful decorator which can switch the flag values temporarily.
a helpful decorator which can switch the flag values temporarily .
Question: What does this function do? Code: def FlagOverrider(**flag_kwargs): def Decorator(f): 'Allow a function to safely change flags, restoring them on return.' def Decorated(*args, **kwargs): global FLAGS old_flags = copy.copy(FLAGS) for (k, v) in flag_kwargs.items(): setattr(FLAGS, k, v) t...
null
null
null
What does this function do?
@dispatch(Expr, object) def pre_compute(leaf, data, scope=None, **kwargs): return data
null
null
null
Transform data prior to calling ``compute``
pcsd
@dispatch Expr object def pre compute leaf data scope=None **kwargs return data
340
@dispatch(Expr, object) def pre_compute(leaf, data, scope=None, **kwargs): return data
Transform data prior to calling ``compute``
transform data prior to calling compute
Question: What does this function do? Code: @dispatch(Expr, object) def pre_compute(leaf, data, scope=None, **kwargs): return data
null
null
null
What does this function do?
def register(): return 'authz'
null
null
null
The mandatory cobbler module registration hook.
pcsd
def register return 'authz'
346
def register(): return 'authz'
The mandatory cobbler module registration hook.
the mandatory cobbler module registration hook .
Question: What does this function do? Code: def register(): return 'authz'
null
null
null
What does this function do?
def plugin_cache_dir(): return os.path.join(tempfile.gettempdir(), 'UltiSnips_test_vim_plugins')
null
null
null
The directory that we check out our bundles to.
pcsd
def plugin cache dir return os path join tempfile gettempdir 'Ulti Snips test vim plugins'
366
def plugin_cache_dir(): return os.path.join(tempfile.gettempdir(), 'UltiSnips_test_vim_plugins')
The directory that we check out our bundles to.
the directory that we check out our bundles to .
Question: What does this function do? Code: def plugin_cache_dir(): return os.path.join(tempfile.gettempdir(), 'UltiSnips_test_vim_plugins')
null
null
null
What does this function do?
def es_delete_cmd(index, noinput=False, log=log): try: indexes = [name for (name, count) in get_indexes()] except ES_EXCEPTIONS: log.error('Your elasticsearch process is not running or ES_URLS is set wrong in your settings_local.py file.') return if (index not in indexes): log.error('Index "%s" is not a vali...
null
null
null
Deletes an index
pcsd
def es delete cmd index noinput=False log=log try indexes = [name for name count in get indexes ] except ES EXCEPTIONS log error 'Your elasticsearch process is not running or ES URLS is set wrong in your settings local py file ' return if index not in indexes log error 'Index "%s" is not a valid index ' index return if...
373
def es_delete_cmd(index, noinput=False, log=log): try: indexes = [name for (name, count) in get_indexes()] except ES_EXCEPTIONS: log.error('Your elasticsearch process is not running or ES_URLS is set wrong in your settings_local.py file.') return if (index not in indexes): log.error('Index "%s" is not a vali...
Deletes an index
deletes an index
Question: What does this function do? Code: def es_delete_cmd(index, noinput=False, log=log): try: indexes = [name for (name, count) in get_indexes()] except ES_EXCEPTIONS: log.error('Your elasticsearch process is not running or ES_URLS is set wrong in your settings_local.py file.') return if (index not in ...
null
null
null
What does this function do?
@builtin(u'Swap the case of text', swapcase, apply_func_to_match_groups) def replace_swapcase(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs): return apply_func_to_match_groups(match, swapcase)
null
null
null
Swap the case of the matched text. If the regular expression contains groups, only the text in the groups will be changed, otherwise the entire text is changed.
pcsd
@builtin u'Swap the case of text' swapcase apply func to match groups def replace swapcase match number file name metadata dictionaries data functions *args **kwargs return apply func to match groups match swapcase
375
@builtin(u'Swap the case of text', swapcase, apply_func_to_match_groups) def replace_swapcase(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs): return apply_func_to_match_groups(match, swapcase)
Swap the case of the matched text. If the regular expression contains groups, only the text in the groups will be changed, otherwise the entire text is changed.
swap the case of the matched text .
Question: What does this function do? Code: @builtin(u'Swap the case of text', swapcase, apply_func_to_match_groups) def replace_swapcase(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs): return apply_func_to_match_groups(match, swapcase)
null
null
null
What does this function do?
def p_statement_assign(t): names[t[1]] = t[3]
null
null
null
statement : NAME EQUALS expression
pcsd
def p statement assign t names[t[1]] = t[3]
382
def p_statement_assign(t): names[t[1]] = t[3]
statement : NAME EQUALS expression
statement : name equals expression
Question: What does this function do? Code: def p_statement_assign(t): names[t[1]] = t[3]
null
null
null
What does this function do?
def standard_b64encode(s): return b64encode(s)
null
null
null
Encode a string using the standard Base64 alphabet. s is the string to encode. The encoded string is returned.
pcsd
def standard b64encode s return b64encode s
383
def standard_b64encode(s): return b64encode(s)
Encode a string using the standard Base64 alphabet. s is the string to encode. The encoded string is returned.
encode a string using the standard base64 alphabet .
Question: What does this function do? Code: def standard_b64encode(s): return b64encode(s)
null
null
null
What does this function do?
def get_permission_cache(user, key): from django.core.cache import cache return cache.get(get_cache_key(user, key), version=get_cache_permission_version())
null
null
null
Helper for reading values from cache
pcsd
def get permission cache user key from django core cache import cache return cache get get cache key user key version=get cache permission version
390
def get_permission_cache(user, key): from django.core.cache import cache return cache.get(get_cache_key(user, key), version=get_cache_permission_version())
Helper for reading values from cache
helper for reading values from cache
Question: What does this function do? Code: def get_permission_cache(user, key): from django.core.cache import cache return cache.get(get_cache_key(user, key), version=get_cache_permission_version())
null
null
null
What does this function do?
def _is_task_visible(context, task): if context.is_admin: return True if (task['owner'] is None): return True if (context.owner is not None): if (context.owner == task['owner']): return True return False
null
null
null
Return True if the task is visible in this context.
pcsd
def is task visible context task if context is admin return True if task['owner'] is None return True if context owner is not None if context owner == task['owner'] return True return False
393
def _is_task_visible(context, task): if context.is_admin: return True if (task['owner'] is None): return True if (context.owner is not None): if (context.owner == task['owner']): return True return False
Return True if the task is visible in this context.
return true if the task is visible in this context .
Question: What does this function do? Code: def _is_task_visible(context, task): if context.is_admin: return True if (task['owner'] is None): return True if (context.owner is not None): if (context.owner == task['owner']): return True return False
null
null
null
What does this function do?
@addon_view @non_atomic_requests def usage_series(request, addon, group, start, end, format): date_range = check_series_params_or_404(group, start, end, format) check_stats_permission(request, addon) series = get_series((ThemeUserCount if (addon.type == amo.ADDON_PERSONA) else UpdateCount), addon=addon.id, date__ran...
null
null
null
Generate ADU counts grouped by ``group`` in ``format``.
pcsd
@addon view @non atomic requests def usage series request addon group start end format date range = check series params or 404 group start end format check stats permission request addon series = get series Theme User Count if addon type == amo ADDON PERSONA else Update Count addon=addon id date range=date range if for...
394
@addon_view @non_atomic_requests def usage_series(request, addon, group, start, end, format): date_range = check_series_params_or_404(group, start, end, format) check_stats_permission(request, addon) series = get_series((ThemeUserCount if (addon.type == amo.ADDON_PERSONA) else UpdateCount), addon=addon.id, date__ran...
Generate ADU counts grouped by ``group`` in ``format``.
generate adu counts grouped by group in format .
Question: What does this function do? Code: @addon_view @non_atomic_requests def usage_series(request, addon, group, start, end, format): date_range = check_series_params_or_404(group, start, end, format) check_stats_permission(request, addon) series = get_series((ThemeUserCount if (addon.type == amo.ADDON_PERSON...
null
null
null
What does this function do?
def volume_up(hass): hass.services.call(DOMAIN, SERVICE_VOLUME_UP)
null
null
null
Press the keyboard button for volume up.
pcsd
def volume up hass hass services call DOMAIN SERVICE VOLUME UP
410
def volume_up(hass): hass.services.call(DOMAIN, SERVICE_VOLUME_UP)
Press the keyboard button for volume up.
press the keyboard button for volume up .
Question: What does this function do? Code: def volume_up(hass): hass.services.call(DOMAIN, SERVICE_VOLUME_UP)
null
null
null
What does this function do?
def _plot_gat_time(gat, train_time, ax, color, label): if np.all((np.unique([len(t) for t in gat.test_times_['times']]) == 1)): scores = gat.scores_ elif (train_time == 'diagonal'): scores = np.zeros(len(gat.scores_)) for (train_idx, train_time) in enumerate(gat.train_times_['times']): for test_times in gat....
null
null
null
Plot a unique score 1d array.
pcsd
def plot gat time gat train time ax color label if np all np unique [len t for t in gat test times ['times']] == 1 scores = gat scores elif train time == 'diagonal' scores = np zeros len gat scores for train idx train time in enumerate gat train times ['times'] for test times in gat test times ['times'] lag = test time...
412
def _plot_gat_time(gat, train_time, ax, color, label): if np.all((np.unique([len(t) for t in gat.test_times_['times']]) == 1)): scores = gat.scores_ elif (train_time == 'diagonal'): scores = np.zeros(len(gat.scores_)) for (train_idx, train_time) in enumerate(gat.train_times_['times']): for test_times in gat....
Plot a unique score 1d array.
plot a unique score 1d array .
Question: What does this function do? Code: def _plot_gat_time(gat, train_time, ax, color, label): if np.all((np.unique([len(t) for t in gat.test_times_['times']]) == 1)): scores = gat.scores_ elif (train_time == 'diagonal'): scores = np.zeros(len(gat.scores_)) for (train_idx, train_time) in enumerate(gat.tr...
null
null
null
What does this function do?
def CreateDefaultGUI(appClass=None): if (appClass is None): import intpyapp appClass = intpyapp.InteractivePythonApp appClass().InitInstance()
null
null
null
Creates a default GUI environment
pcsd
def Create Default GUI app Class=None if app Class is None import intpyapp app Class = intpyapp Interactive Python App app Class Init Instance
413
def CreateDefaultGUI(appClass=None): if (appClass is None): import intpyapp appClass = intpyapp.InteractivePythonApp appClass().InitInstance()
Creates a default GUI environment
creates a default gui environment
Question: What does this function do? Code: def CreateDefaultGUI(appClass=None): if (appClass is None): import intpyapp appClass = intpyapp.InteractivePythonApp appClass().InitInstance()
null
null
null
What does this function do?
def removeEndpoints(pixelTable, layerExtrusionWidth, paths, removedEndpoints, aroundWidth): for removedEndpointIndex in xrange((len(removedEndpoints) - 1), (-1), (-1)): removedEndpoint = removedEndpoints[removedEndpointIndex] removedEndpointPoint = removedEndpoint.point if isPointAddedAroundClosest(pixelTable, l...
null
null
null
Remove endpoints which are added to the path.
pcsd
def remove Endpoints pixel Table layer Extrusion Width paths removed Endpoints around Width for removed Endpoint Index in xrange len removed Endpoints - 1 -1 -1 removed Endpoint = removed Endpoints[removed Endpoint Index] removed Endpoint Point = removed Endpoint point if is Point Added Around Closest pixel Table layer...
414
def removeEndpoints(pixelTable, layerExtrusionWidth, paths, removedEndpoints, aroundWidth): for removedEndpointIndex in xrange((len(removedEndpoints) - 1), (-1), (-1)): removedEndpoint = removedEndpoints[removedEndpointIndex] removedEndpointPoint = removedEndpoint.point if isPointAddedAroundClosest(pixelTable, l...
Remove endpoints which are added to the path.
remove endpoints which are added to the path .
Question: What does this function do? Code: def removeEndpoints(pixelTable, layerExtrusionWidth, paths, removedEndpoints, aroundWidth): for removedEndpointIndex in xrange((len(removedEndpoints) - 1), (-1), (-1)): removedEndpoint = removedEndpoints[removedEndpointIndex] removedEndpointPoint = removedEndpoint.poi...
null
null
null
What does this function do?
def get_can_enable_ldap(): if has_module(u'ldap'): return (True, None) else: return (False, _(u'LDAP authentication requires the python-ldap library, which is not installed.'))
null
null
null
Check whether LDAP authentication can be enabled.
pcsd
def get can enable ldap if has module u'ldap' return True None else return False u'LDAP authentication requires the python-ldap library which is not installed '
429
def get_can_enable_ldap(): if has_module(u'ldap'): return (True, None) else: return (False, _(u'LDAP authentication requires the python-ldap library, which is not installed.'))
Check whether LDAP authentication can be enabled.
check whether ldap authentication can be enabled .
Question: What does this function do? Code: def get_can_enable_ldap(): if has_module(u'ldap'): return (True, None) else: return (False, _(u'LDAP authentication requires the python-ldap library, which is not installed.'))
null
null
null
What does this function do?
def insert_hyphens(node, hyphenator): textattrs = (u'text', u'tail') if isinstance(node, lxml.etree._Entity): textattrs = (u'tail',) for attr in textattrs: text = getattr(node, attr) if (not text): continue new_data = u' '.join([hyphenator.inserted(w, hyphen=u'\xad') for w in text.split(u' ')]) if text[...
null
null
null
Insert hyphens into a node.
pcsd
def insert hyphens node hyphenator textattrs = u'text' u'tail' if isinstance node lxml etree Entity textattrs = u'tail' for attr in textattrs text = getattr node attr if not text continue new data = u' ' join [hyphenator inserted w hyphen=u'\xad' for w in text split u' ' ] if text[0] isspace new data = u' ' + new data ...
431
def insert_hyphens(node, hyphenator): textattrs = (u'text', u'tail') if isinstance(node, lxml.etree._Entity): textattrs = (u'tail',) for attr in textattrs: text = getattr(node, attr) if (not text): continue new_data = u' '.join([hyphenator.inserted(w, hyphen=u'\xad') for w in text.split(u' ')]) if text[...
Insert hyphens into a node.
insert hyphens into a node .
Question: What does this function do? Code: def insert_hyphens(node, hyphenator): textattrs = (u'text', u'tail') if isinstance(node, lxml.etree._Entity): textattrs = (u'tail',) for attr in textattrs: text = getattr(node, attr) if (not text): continue new_data = u' '.join([hyphenator.inserted(w, hyphen=...
null
null
null
What does this function do?
@register.filter def display_url(url): url = force_bytes(url, errors='replace') return urllib.unquote(url).decode('utf-8', errors='replace')
null
null
null
Display a URL like the browser URL bar would. Note: returns a Unicode object, not a valid URL.
pcsd
@register filter def display url url url = force bytes url errors='replace' return urllib unquote url decode 'utf-8' errors='replace'
434
@register.filter def display_url(url): url = force_bytes(url, errors='replace') return urllib.unquote(url).decode('utf-8', errors='replace')
Display a URL like the browser URL bar would. Note: returns a Unicode object, not a valid URL.
display a url like the browser url bar would .
Question: What does this function do? Code: @register.filter def display_url(url): url = force_bytes(url, errors='replace') return urllib.unquote(url).decode('utf-8', errors='replace')
null
null
null
What does this function do?
def get_file_json(path): with open(path, u'r') as f: return json.load(f)
null
null
null
Read a file and return parsed JSON object.
pcsd
def get file json path with open path u'r' as f return json load f
438
def get_file_json(path): with open(path, u'r') as f: return json.load(f)
Read a file and return parsed JSON object.
read a file and return parsed json object .
Question: What does this function do? Code: def get_file_json(path): with open(path, u'r') as f: return json.load(f)
null
null
null
What does this function do?
def in6_ismlladdr(str): return in6_isincluded(str, 'ff02::', 16)
null
null
null
Returns True if address belongs to link-local multicast address space (ff02::/16)
pcsd
def in6 ismlladdr str return in6 isincluded str 'ff02 ' 16
446
def in6_ismlladdr(str): return in6_isincluded(str, 'ff02::', 16)
Returns True if address belongs to link-local multicast address space (ff02::/16)
returns true if address belongs to link - local multicast address space
Question: What does this function do? Code: def in6_ismlladdr(str): return in6_isincluded(str, 'ff02::', 16)
null
null
null
What does this function do?
def get_single(name, url, module, required, getter=u'__version__'): mod = get_version_module(module, name, url) version_getter = getattr(mod, getter) if hasattr(version_getter, u'__call__'): current = version_getter() else: current = version_getter return (name, url, current, required)
null
null
null
Returns version information for single module
pcsd
def get single name url module required getter=u' version ' mod = get version module module name url version getter = getattr mod getter if hasattr version getter u' call ' current = version getter else current = version getter return name url current required
458
def get_single(name, url, module, required, getter=u'__version__'): mod = get_version_module(module, name, url) version_getter = getattr(mod, getter) if hasattr(version_getter, u'__call__'): current = version_getter() else: current = version_getter return (name, url, current, required)
Returns version information for single module
returns version information for single module
Question: What does this function do? Code: def get_single(name, url, module, required, getter=u'__version__'): mod = get_version_module(module, name, url) version_getter = getattr(mod, getter) if hasattr(version_getter, u'__call__'): current = version_getter() else: current = version_getter return (name, u...
null
null
null
What does this function do?
def make_dist(name, version, **kwargs): summary = kwargs.pop(u'summary', u'Placeholder for summary') md = Metadata(**kwargs) md.name = name md.version = version md.summary = (summary or u'Plaeholder for summary') return Distribution(md)
null
null
null
A convenience method for making a dist given just a name and version.
pcsd
def make dist name version **kwargs summary = kwargs pop u'summary' u'Placeholder for summary' md = Metadata **kwargs md name = name md version = version md summary = summary or u'Plaeholder for summary' return Distribution md
470
def make_dist(name, version, **kwargs): summary = kwargs.pop(u'summary', u'Placeholder for summary') md = Metadata(**kwargs) md.name = name md.version = version md.summary = (summary or u'Plaeholder for summary') return Distribution(md)
A convenience method for making a dist given just a name and version.
a convenience method for making a dist given just a name and version .
Question: What does this function do? Code: def make_dist(name, version, **kwargs): summary = kwargs.pop(u'summary', u'Placeholder for summary') md = Metadata(**kwargs) md.name = name md.version = version md.summary = (summary or u'Plaeholder for summary') return Distribution(md)
null
null
null
What does this function do?
def Element(tag, *args, **kw): if ('{' not in tag): tag = ('{%s}%s' % (atom_ns, tag)) return atom_parser.makeelement(tag, *args, **kw)
null
null
null
Create an Atom element. Adds the Atom namespace if no namespace is given.
pcsd
def Element tag *args **kw if '{' not in tag tag = '{%s}%s' % atom ns tag return atom parser makeelement tag *args **kw
476
def Element(tag, *args, **kw): if ('{' not in tag): tag = ('{%s}%s' % (atom_ns, tag)) return atom_parser.makeelement(tag, *args, **kw)
Create an Atom element. Adds the Atom namespace if no namespace is given.
create an atom element .
Question: What does this function do? Code: def Element(tag, *args, **kw): if ('{' not in tag): tag = ('{%s}%s' % (atom_ns, tag)) return atom_parser.makeelement(tag, *args, **kw)
null
null
null
What does this function do?
def getEvaluatedExpressionValueBySplitLine(words, xmlElement): evaluators = [] for (wordIndex, word) in enumerate(words): nextWord = '' nextWordIndex = (wordIndex + 1) if (nextWordIndex < len(words)): nextWord = words[nextWordIndex] evaluator = getEvaluator(evaluators, nextWord, word, xmlElement) if (eva...
null
null
null
Evaluate the expression value.
pcsd
def get Evaluated Expression Value By Split Line words xml Element evaluators = [] for word Index word in enumerate words next Word = '' next Word Index = word Index + 1 if next Word Index < len words next Word = words[next Word Index] evaluator = get Evaluator evaluators next Word word xml Element if evaluator != None...
483
def getEvaluatedExpressionValueBySplitLine(words, xmlElement): evaluators = [] for (wordIndex, word) in enumerate(words): nextWord = '' nextWordIndex = (wordIndex + 1) if (nextWordIndex < len(words)): nextWord = words[nextWordIndex] evaluator = getEvaluator(evaluators, nextWord, word, xmlElement) if (eva...
Evaluate the expression value.
evaluate the expression value .
Question: What does this function do? Code: def getEvaluatedExpressionValueBySplitLine(words, xmlElement): evaluators = [] for (wordIndex, word) in enumerate(words): nextWord = '' nextWordIndex = (wordIndex + 1) if (nextWordIndex < len(words)): nextWord = words[nextWordIndex] evaluator = getEvaluator(ev...
null
null
null
What does this function do?
@slow_test def test_cluster_permutation_t_test(): (condition1_1d, condition2_1d, condition1_2d, condition2_2d) = _get_conditions() stat_funs = [ttest_1samp_no_p, partial(ttest_1samp_no_p, sigma=0.1)] for stat_fun in stat_funs: for condition1 in (condition1_1d, condition1_2d): (T_obs, clusters, cluster_p_values,...
null
null
null
Test cluster level permutations T-test.
pcsd
@slow test def test cluster permutation t test condition1 1d condition2 1d condition1 2d condition2 2d = get conditions stat funs = [ttest 1samp no p partial ttest 1samp no p sigma=0 1 ] for stat fun in stat funs for condition1 in condition1 1d condition1 2d T obs clusters cluster p values hist = permutation cluster 1s...
491
@slow_test def test_cluster_permutation_t_test(): (condition1_1d, condition2_1d, condition1_2d, condition2_2d) = _get_conditions() stat_funs = [ttest_1samp_no_p, partial(ttest_1samp_no_p, sigma=0.1)] for stat_fun in stat_funs: for condition1 in (condition1_1d, condition1_2d): (T_obs, clusters, cluster_p_values,...
Test cluster level permutations T-test.
test cluster level permutations t - test .
Question: What does this function do? Code: @slow_test def test_cluster_permutation_t_test(): (condition1_1d, condition2_1d, condition1_2d, condition2_2d) = _get_conditions() stat_funs = [ttest_1samp_no_p, partial(ttest_1samp_no_p, sigma=0.1)] for stat_fun in stat_funs: for condition1 in (condition1_1d, conditi...
null
null
null
What does this function do?
def count_values(expr, sort=True): result = by(expr, count=expr.count()) if sort: result = result.sort('count', ascending=False) return result
null
null
null
Count occurrences of elements in this column Sort by counts by default Add ``sort=False`` keyword to avoid this behavior.
pcsd
def count values expr sort=True result = by expr count=expr count if sort result = result sort 'count' ascending=False return result
495
def count_values(expr, sort=True): result = by(expr, count=expr.count()) if sort: result = result.sort('count', ascending=False) return result
Count occurrences of elements in this column Sort by counts by default Add ``sort=False`` keyword to avoid this behavior.
count occurrences of elements in this column
Question: What does this function do? Code: def count_values(expr, sort=True): result = by(expr, count=expr.count()) if sort: result = result.sort('count', ascending=False) return result
null
null
null
What does this function do?
def gen_password(): alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' password = '' for _ in range(20): next_index = random.randrange(len(alphabet)) password += alphabet[next_index] hashed_pwd = gen_hash('salt', password, 'sha512') return (password, hashed_pwd)
null
null
null
generate a password and hash it
pcsd
def gen password alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' password = '' for in range 20 next index = random randrange len alphabet password += alphabet[next index] hashed pwd = gen hash 'salt' password 'sha512' return password hashed pwd
503
def gen_password(): alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' password = '' for _ in range(20): next_index = random.randrange(len(alphabet)) password += alphabet[next_index] hashed_pwd = gen_hash('salt', password, 'sha512') return (password, hashed_pwd)
generate a password and hash it
generate a password and hash it
Question: What does this function do? Code: def gen_password(): alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' password = '' for _ in range(20): next_index = random.randrange(len(alphabet)) password += alphabet[next_index] hashed_pwd = gen_hash('salt', password, 'sha512') return...
null
null
null
What does this function do?
def get_command(args): zone = get_zone(args.project_id, args.name) if (not zone): print 'Zone not found.' else: print 'Zone: {}, {}, {}'.format(zone.name, zone.dns_name, zone.description)
null
null
null
Gets a zone by name.
pcsd
def get command args zone = get zone args project id args name if not zone print 'Zone not found ' else print 'Zone {} {} {}' format zone name zone dns name zone description
504
def get_command(args): zone = get_zone(args.project_id, args.name) if (not zone): print 'Zone not found.' else: print 'Zone: {}, {}, {}'.format(zone.name, zone.dns_name, zone.description)
Gets a zone by name.
gets a zone by name .
Question: What does this function do? Code: def get_command(args): zone = get_zone(args.project_id, args.name) if (not zone): print 'Zone not found.' else: print 'Zone: {}, {}, {}'.format(zone.name, zone.dns_name, zone.description)
null
null
null
What does this function do?
def serve_file(load, fnd): if ('env' in load): salt.utils.warn_until('Oxygen', "Parameter 'env' has been detected in the argument list. This parameter is no longer used and has been replaced by 'saltenv' as of Salt 2016.11.0. This warning will be removed in Salt Oxygen.") load.pop('env') ret = {'data': '', 'des...
null
null
null
Return a chunk from a file based on the data received
pcsd
def serve file load fnd if 'env' in load salt utils warn until 'Oxygen' "Parameter 'env' has been detected in the argument list This parameter is no longer used and has been replaced by 'saltenv' as of Salt 2016 11 0 This warning will be removed in Salt Oxygen " load pop 'env' ret = {'data' '' 'dest' ''} if 'path' not ...
511
def serve_file(load, fnd): if ('env' in load): salt.utils.warn_until('Oxygen', "Parameter 'env' has been detected in the argument list. This parameter is no longer used and has been replaced by 'saltenv' as of Salt 2016.11.0. This warning will be removed in Salt Oxygen.") load.pop('env') ret = {'data': '', 'des...
Return a chunk from a file based on the data received
return a chunk from a file based on the data received
Question: What does this function do? Code: def serve_file(load, fnd): if ('env' in load): salt.utils.warn_until('Oxygen', "Parameter 'env' has been detected in the argument list. This parameter is no longer used and has been replaced by 'saltenv' as of Salt 2016.11.0. This warning will be removed in Salt Oxyge...
null
null
null
What does this function do?
def api_handle_error_with_json(handler): def api_handle_error_with_json_wrapper_fn(request, *args, **kwargs): try: return handler(request, *args, **kwargs) except PermissionDenied: raise except Http404: raise except Exception as e: logger.error('Error in JSON view: {}'.format(request.path)) trac...
null
null
null
All API requests should return JSON objects, even when unexpected errors occur. This decorator makes sure that all uncaught errors are not returned as HTML to the user, but instead JSON errors.
pcsd
def api handle error with json handler def api handle error with json wrapper fn request *args **kwargs try return handler request *args **kwargs except Permission Denied raise except Http404 raise except Exception as e logger error 'Error in JSON view {}' format request path traceback print exc return Json Response Me...
523
def api_handle_error_with_json(handler): def api_handle_error_with_json_wrapper_fn(request, *args, **kwargs): try: return handler(request, *args, **kwargs) except PermissionDenied: raise except Http404: raise except Exception as e: logger.error('Error in JSON view: {}'.format(request.path)) trac...
All API requests should return JSON objects, even when unexpected errors occur. This decorator makes sure that all uncaught errors are not returned as HTML to the user, but instead JSON errors.
all api requests should return json objects , even when unexpected errors occur .
Question: What does this function do? Code: def api_handle_error_with_json(handler): def api_handle_error_with_json_wrapper_fn(request, *args, **kwargs): try: return handler(request, *args, **kwargs) except PermissionDenied: raise except Http404: raise except Exception as e: logger.error('Error ...
null
null
null
What does this function do?
def get_definition_with_regex(source, token, start_line=(-1)): if (not token): return None if DEBUG_EDITOR: t0 = time.time() patterns = ['^c?import.*\\W{0}{1}', 'from.*\\W{0}\\W.*c?import ', 'from .* c?import.*\\W{0}{1}', 'class\\s*{0}{1}', 'c?p?def[^=]*\\W{0}{1}', 'cdef.*\\[.*\\].*\\W{0}{1}', 'enamldef.*\\W{0}{...
null
null
null
Find the definition of an object within a source closest to a given line
pcsd
def get definition with regex source token start line= -1 if not token return None if DEBUG EDITOR t0 = time time patterns = ['^c?import *\\W{0}{1}' 'from *\\W{0}\\W *c?import ' 'from * c?import *\\W{0}{1}' 'class\\s*{0}{1}' 'c?p?def[^=]*\\W{0}{1}' 'cdef *\\[ *\\] *\\W{0}{1}' 'enamldef *\\W{0}{1}' 'attr *\\W{0}{1}' 'ev...
531
def get_definition_with_regex(source, token, start_line=(-1)): if (not token): return None if DEBUG_EDITOR: t0 = time.time() patterns = ['^c?import.*\\W{0}{1}', 'from.*\\W{0}\\W.*c?import ', 'from .* c?import.*\\W{0}{1}', 'class\\s*{0}{1}', 'c?p?def[^=]*\\W{0}{1}', 'cdef.*\\[.*\\].*\\W{0}{1}', 'enamldef.*\\W{0}{...
Find the definition of an object within a source closest to a given line
find the definition of an object within a source closest to a given line
Question: What does this function do? Code: def get_definition_with_regex(source, token, start_line=(-1)): if (not token): return None if DEBUG_EDITOR: t0 = time.time() patterns = ['^c?import.*\\W{0}{1}', 'from.*\\W{0}\\W.*c?import ', 'from .* c?import.*\\W{0}{1}', 'class\\s*{0}{1}', 'c?p?def[^=]*\\W{0}{1}', ...
null
null
null
What does this function do?
def getregentry(): return _registry('latex')
null
null
null
Encodings module API.
pcsd
def getregentry return registry 'latex'
534
def getregentry(): return _registry('latex')
Encodings module API.
encodings module api .
Question: What does this function do? Code: def getregentry(): return _registry('latex')
null
null
null
What does this function do?
def check_version(name, url, version, expected): if (expected is None): return False if (LooseVersion(version) < LooseVersion(expected)): print(u'*** {0} <{1}> is too old! ***'.format(name, url)) print(u'Installed version {0}, required {1}'.format(version, expected)) return True return False
null
null
null
Check for single module version.
pcsd
def check version name url version expected if expected is None return False if Loose Version version < Loose Version expected print u'*** {0} <{1}> is too old! ***' format name url print u'Installed version {0} required {1}' format version expected return True return False
540
def check_version(name, url, version, expected): if (expected is None): return False if (LooseVersion(version) < LooseVersion(expected)): print(u'*** {0} <{1}> is too old! ***'.format(name, url)) print(u'Installed version {0}, required {1}'.format(version, expected)) return True return False
Check for single module version.
check for single module version .
Question: What does this function do? Code: def check_version(name, url, version, expected): if (expected is None): return False if (LooseVersion(version) < LooseVersion(expected)): print(u'*** {0} <{1}> is too old! ***'.format(name, url)) print(u'Installed version {0}, required {1}'.format(version, expected...
null
null
null
What does this function do?
def slug_is_numerical(slug): try: float(slug) except ValueError: return False return True
null
null
null
Returns whether the slug can be interpreted as a number.
pcsd
def slug is numerical slug try float slug except Value Error return False return True
544
def slug_is_numerical(slug): try: float(slug) except ValueError: return False return True
Returns whether the slug can be interpreted as a number.
returns whether the slug can be interpreted as a number .
Question: What does this function do? Code: def slug_is_numerical(slug): try: float(slug) except ValueError: return False return True
null
null
null
What does this function do?
def set_(key, value, profile=None): comps = key.split('?') path = comps[0] key = comps[1] return salt.utils.vault.write_(path, key, value, profile=profile)
null
null
null
Set a key/value pair in the vault service
pcsd
def set key value profile=None comps = key split '?' path = comps[0] key = comps[1] return salt utils vault write path key value profile=profile
546
def set_(key, value, profile=None): comps = key.split('?') path = comps[0] key = comps[1] return salt.utils.vault.write_(path, key, value, profile=profile)
Set a key/value pair in the vault service
set a key / value pair in the vault service
Question: What does this function do? Code: def set_(key, value, profile=None): comps = key.split('?') path = comps[0] key = comps[1] return salt.utils.vault.write_(path, key, value, profile=profile)
null
null
null
What does this function do?
def create_security_group(call=None, kwargs=None): global netconn if (not netconn): netconn = get_conn(NetworkManagementClient) if (kwargs is None): kwargs = {} if (kwargs.get('location') is None): kwargs['location'] = get_location() if (kwargs.get('resource_group') is None): kwargs['resource_group'] = con...
null
null
null
Create a security group
pcsd
def create security group call=None kwargs=None global netconn if not netconn netconn = get conn Network Management Client if kwargs is None kwargs = {} if kwargs get 'location' is None kwargs['location'] = get location if kwargs get 'resource group' is None kwargs['resource group'] = config get cloud config value 'res...
551
def create_security_group(call=None, kwargs=None): global netconn if (not netconn): netconn = get_conn(NetworkManagementClient) if (kwargs is None): kwargs = {} if (kwargs.get('location') is None): kwargs['location'] = get_location() if (kwargs.get('resource_group') is None): kwargs['resource_group'] = con...
Create a security group
create a security group
Question: What does this function do? Code: def create_security_group(call=None, kwargs=None): global netconn if (not netconn): netconn = get_conn(NetworkManagementClient) if (kwargs is None): kwargs = {} if (kwargs.get('location') is None): kwargs['location'] = get_location() if (kwargs.get('resource_gro...
null
null
null
What does this function do?
def _get_foreign_keys(t_images, t_image_members, t_image_properties, dialect): foreign_keys = [] if t_image_members.foreign_keys: img_members_fk_name = list(t_image_members.foreign_keys)[0].name if (dialect == 'mysql'): fk1 = migrate.ForeignKeyConstraint([t_image_members.c.image_id], [t_images.c.id], name=img_...
null
null
null
Retrieve and return foreign keys for members/properties tables.
pcsd
def get foreign keys t images t image members t image properties dialect foreign keys = [] if t image members foreign keys img members fk name = list t image members foreign keys [0] name if dialect == 'mysql' fk1 = migrate Foreign Key Constraint [t image members c image id] [t images c id] name=img members fk name els...
558
def _get_foreign_keys(t_images, t_image_members, t_image_properties, dialect): foreign_keys = [] if t_image_members.foreign_keys: img_members_fk_name = list(t_image_members.foreign_keys)[0].name if (dialect == 'mysql'): fk1 = migrate.ForeignKeyConstraint([t_image_members.c.image_id], [t_images.c.id], name=img_...
Retrieve and return foreign keys for members/properties tables.
retrieve and return foreign keys for members / properties tables .
Question: What does this function do? Code: def _get_foreign_keys(t_images, t_image_members, t_image_properties, dialect): foreign_keys = [] if t_image_members.foreign_keys: img_members_fk_name = list(t_image_members.foreign_keys)[0].name if (dialect == 'mysql'): fk1 = migrate.ForeignKeyConstraint([t_image_...
null
null
null
What does this function do?
def configure_registry_client(): global _CLIENT_KWARGS, _CLIENT_HOST, _CLIENT_PORT try: (host, port) = (CONF.registry_host, CONF.registry_port) except cfg.ConfigFileValueError: msg = _('Configuration option was not valid') LOG.error(msg) raise exception.BadRegistryConnectionConfiguration(msg) except IndexEr...
null
null
null
Sets up a registry client for use in registry lookups
pcsd
def configure registry client global CLIENT KWARGS CLIENT HOST CLIENT PORT try host port = CONF registry host CONF registry port except cfg Config File Value Error msg = 'Configuration option was not valid' LOG error msg raise exception Bad Registry Connection Configuration msg except Index Error msg = 'Could not find ...
563
def configure_registry_client(): global _CLIENT_KWARGS, _CLIENT_HOST, _CLIENT_PORT try: (host, port) = (CONF.registry_host, CONF.registry_port) except cfg.ConfigFileValueError: msg = _('Configuration option was not valid') LOG.error(msg) raise exception.BadRegistryConnectionConfiguration(msg) except IndexEr...
Sets up a registry client for use in registry lookups
sets up a registry client for use in registry lookups
Question: What does this function do? Code: def configure_registry_client(): global _CLIENT_KWARGS, _CLIENT_HOST, _CLIENT_PORT try: (host, port) = (CONF.registry_host, CONF.registry_port) except cfg.ConfigFileValueError: msg = _('Configuration option was not valid') LOG.error(msg) raise exception.BadRegis...
null
null
null
What does this function do?
def device(portnumber): enum = comm.CommPortIdentifier.getPortIdentifiers() ports = [] while enum.hasMoreElements(): el = enum.nextElement() if (el.getPortType() == comm.CommPortIdentifier.PORT_SERIAL): ports.append(el) return ports[portnumber].getName()
null
null
null
Turn a port number into a device name
pcsd
def device portnumber enum = comm Comm Port Identifier get Port Identifiers ports = [] while enum has More Elements el = enum next Element if el get Port Type == comm Comm Port Identifier PORT SERIAL ports append el return ports[portnumber] get Name
567
def device(portnumber): enum = comm.CommPortIdentifier.getPortIdentifiers() ports = [] while enum.hasMoreElements(): el = enum.nextElement() if (el.getPortType() == comm.CommPortIdentifier.PORT_SERIAL): ports.append(el) return ports[portnumber].getName()
Turn a port number into a device name
turn a port number into a device name
Question: What does this function do? Code: def device(portnumber): enum = comm.CommPortIdentifier.getPortIdentifiers() ports = [] while enum.hasMoreElements(): el = enum.nextElement() if (el.getPortType() == comm.CommPortIdentifier.PORT_SERIAL): ports.append(el) return ports[portnumber].getName()
null
null
null
What does this function do?
def assert_in(obj, in_=None, out_=None): if (in_ is not None): for name in in_: assert (name in obj) if (out_ is not None): for name in out_: assert (name not in obj)
null
null
null
Checks that all names in `in_` as in `obj`, but no name in `out_` is.
pcsd
def assert in obj in =None out =None if in is not None for name in in assert name in obj if out is not None for name in out assert name not in obj
569
def assert_in(obj, in_=None, out_=None): if (in_ is not None): for name in in_: assert (name in obj) if (out_ is not None): for name in out_: assert (name not in obj)
Checks that all names in `in_` as in `obj`, but no name in `out_` is.
checks that all names in in _ as in obj , but no name in out _ is .
Question: What does this function do? Code: def assert_in(obj, in_=None, out_=None): if (in_ is not None): for name in in_: assert (name in obj) if (out_ is not None): for name in out_: assert (name not in obj)
null
null
null
What does this function do?
def lod_sort_by_key(_list, indexkey): _list.sort((lambda a, b: (a[indexkey] < b[indexkey]))) return _list
null
null
null
Sorts a list of dictionaries by a given key in the dictionaries note: this is a destructive operation
pcsd
def lod sort by key list indexkey list sort lambda a b a[indexkey] < b[indexkey] return list
570
def lod_sort_by_key(_list, indexkey): _list.sort((lambda a, b: (a[indexkey] < b[indexkey]))) return _list
Sorts a list of dictionaries by a given key in the dictionaries note: this is a destructive operation
sorts a list of dictionaries by a given key in the dictionaries note : this is a destructive operation
Question: What does this function do? Code: def lod_sort_by_key(_list, indexkey): _list.sort((lambda a, b: (a[indexkey] < b[indexkey]))) return _list
null
null
null
What does this function do?
def set_default_encoding_file(file): global default_encoding_file default_encoding_file = file
null
null
null
Set file used to get codec information.
pcsd
def set default encoding file file global default encoding file default encoding file = file
571
def set_default_encoding_file(file): global default_encoding_file default_encoding_file = file
Set file used to get codec information.
set file used to get codec information .
Question: What does this function do? Code: def set_default_encoding_file(file): global default_encoding_file default_encoding_file = file
null
null
null
What does this function do?
def addFacesByConvex(faces, indexedLoop): if (len(indexedLoop) < 3): return indexBegin = indexedLoop[0].index for indexedPointIndex in xrange(1, (len(indexedLoop) - 1)): indexCenter = indexedLoop[indexedPointIndex].index indexEnd = indexedLoop[((indexedPointIndex + 1) % len(indexedLoop))].index if ((indexBeg...
null
null
null
Add faces from a convex polygon.
pcsd
def add Faces By Convex faces indexed Loop if len indexed Loop < 3 return index Begin = indexed Loop[0] index for indexed Point Index in xrange 1 len indexed Loop - 1 index Center = indexed Loop[indexed Point Index] index index End = indexed Loop[ indexed Point Index + 1 % len indexed Loop ] index if index Begin != ind...
572
def addFacesByConvex(faces, indexedLoop): if (len(indexedLoop) < 3): return indexBegin = indexedLoop[0].index for indexedPointIndex in xrange(1, (len(indexedLoop) - 1)): indexCenter = indexedLoop[indexedPointIndex].index indexEnd = indexedLoop[((indexedPointIndex + 1) % len(indexedLoop))].index if ((indexBeg...
Add faces from a convex polygon.
add faces from a convex polygon .
Question: What does this function do? Code: def addFacesByConvex(faces, indexedLoop): if (len(indexedLoop) < 3): return indexBegin = indexedLoop[0].index for indexedPointIndex in xrange(1, (len(indexedLoop) - 1)): indexCenter = indexedLoop[indexedPointIndex].index indexEnd = indexedLoop[((indexedPointIndex ...
null
null
null
What does this function do?
def get_effective_user(requesting_user, target_username): if (target_username == requesting_user.username): return requesting_user elif (target_username == ''): return AnonymousUser() elif can_view_courses_for_username(requesting_user, target_username): return User.objects.get(username=target_username) else: ...
null
null
null
Get the user we want to view information on behalf of.
pcsd
def get effective user requesting user target username if target username == requesting user username return requesting user elif target username == '' return Anonymous User elif can view courses for username requesting user target username return User objects get username=target username else raise Permission Denied
577
def get_effective_user(requesting_user, target_username): if (target_username == requesting_user.username): return requesting_user elif (target_username == ''): return AnonymousUser() elif can_view_courses_for_username(requesting_user, target_username): return User.objects.get(username=target_username) else: ...
Get the user we want to view information on behalf of.
get the user we want to view information on behalf of .
Question: What does this function do? Code: def get_effective_user(requesting_user, target_username): if (target_username == requesting_user.username): return requesting_user elif (target_username == ''): return AnonymousUser() elif can_view_courses_for_username(requesting_user, target_username): return Use...
null
null
null
What does this function do?
@box(types.Set) def box_set(typ, val, c): inst = setobj.SetInstance(c.context, c.builder, typ, val) obj = inst.parent res = cgutils.alloca_once_value(c.builder, obj) with c.builder.if_else(cgutils.is_not_null(c.builder, obj)) as (has_parent, otherwise): with has_parent: c.pyapi.incref(obj) with otherwise: ...
null
null
null
Convert native set *val* to a set object.
pcsd
@box types Set def box set typ val c inst = setobj Set Instance c context c builder typ val obj = inst parent res = cgutils alloca once value c builder obj with c builder if else cgutils is not null c builder obj as has parent otherwise with has parent c pyapi incref obj with otherwise payload = inst payload ok listobj...
583
@box(types.Set) def box_set(typ, val, c): inst = setobj.SetInstance(c.context, c.builder, typ, val) obj = inst.parent res = cgutils.alloca_once_value(c.builder, obj) with c.builder.if_else(cgutils.is_not_null(c.builder, obj)) as (has_parent, otherwise): with has_parent: c.pyapi.incref(obj) with otherwise: ...
Convert native set *val* to a set object.
convert native set * val * to a set object .
Question: What does this function do? Code: @box(types.Set) def box_set(typ, val, c): inst = setobj.SetInstance(c.context, c.builder, typ, val) obj = inst.parent res = cgutils.alloca_once_value(c.builder, obj) with c.builder.if_else(cgutils.is_not_null(c.builder, obj)) as (has_parent, otherwise): with has_pare...
null
null
null
What does this function do?
def getNewRepository(): return InterpretRepository()
null
null
null
Get new repository.
pcsd
def get New Repository return Interpret Repository
584
def getNewRepository(): return InterpretRepository()
Get new repository.
get new repository .
Question: What does this function do? Code: def getNewRepository(): return InterpretRepository()
null
null
null
What does this function do?
def image_meta(system_metadata): image_meta = {} for (md_key, md_value) in system_metadata.iteritems(): if md_key.startswith('image_'): image_meta[md_key[6:]] = md_value return image_meta
null
null
null
Format image metadata for use in notifications from the instance system metadata.
pcsd
def image meta system metadata image meta = {} for md key md value in system metadata iteritems if md key startswith 'image ' image meta[md key[6 ]] = md value return image meta
622
def image_meta(system_metadata): image_meta = {} for (md_key, md_value) in system_metadata.iteritems(): if md_key.startswith('image_'): image_meta[md_key[6:]] = md_value return image_meta
Format image metadata for use in notifications from the instance system metadata.
format image metadata for use in notifications from the instance system metadata .
Question: What does this function do? Code: def image_meta(system_metadata): image_meta = {} for (md_key, md_value) in system_metadata.iteritems(): if md_key.startswith('image_'): image_meta[md_key[6:]] = md_value return image_meta
null
null
null
What does this function do?
def optimal_mode(data): if data.isdigit(): return MODE_NUMBER if RE_ALPHA_NUM.match(data): return MODE_ALPHA_NUM return MODE_8BIT_BYTE
null
null
null
Calculate the optimal mode for this chunk of data.
pcsd
def optimal mode data if data isdigit return MODE NUMBER if RE ALPHA NUM match data return MODE ALPHA NUM return MODE 8BIT BYTE
626
def optimal_mode(data): if data.isdigit(): return MODE_NUMBER if RE_ALPHA_NUM.match(data): return MODE_ALPHA_NUM return MODE_8BIT_BYTE
Calculate the optimal mode for this chunk of data.
calculate the optimal mode for this chunk of data .
Question: What does this function do? Code: def optimal_mode(data): if data.isdigit(): return MODE_NUMBER if RE_ALPHA_NUM.match(data): return MODE_ALPHA_NUM return MODE_8BIT_BYTE
null
null
null
What does this function do?
def __virtual__(): if (HAS_HEAT and HAS_OSLO): return 'heat' return (False, 'The heat execution module cannot be loaded: the heatclient and oslo_serialization python library is not available.')
null
null
null
Only load this module if heat is installed on this minion.
pcsd
def virtual if HAS HEAT and HAS OSLO return 'heat' return False 'The heat execution module cannot be loaded the heatclient and oslo serialization python library is not available '
628
def __virtual__(): if (HAS_HEAT and HAS_OSLO): return 'heat' return (False, 'The heat execution module cannot be loaded: the heatclient and oslo_serialization python library is not available.')
Only load this module if heat is installed on this minion.
only load this module if heat is installed on this minion .
Question: What does this function do? Code: def __virtual__(): if (HAS_HEAT and HAS_OSLO): return 'heat' return (False, 'The heat execution module cannot be loaded: the heatclient and oslo_serialization python library is not available.')
null
null
null
What does this function do?
def setup_logger(logger, stream, filename=None, fmt=None): if (len(logger.handlers) < 1): console = logging.StreamHandler(stream) console.setLevel(logging.DEBUG) console.setFormatter(logging.Formatter(fmt)) logger.addHandler(console) logger.setLevel(logging.DEBUG) if filename: outfile = logging.FileHand...
null
null
null
Sets up a logger (if no handlers exist) for console output, and file \'tee\' output if desired.
pcsd
def setup logger logger stream filename=None fmt=None if len logger handlers < 1 console = logging Stream Handler stream console set Level logging DEBUG console set Formatter logging Formatter fmt logger add Handler console logger set Level logging DEBUG if filename outfile = logging File Handler filename outfile set L...
630
def setup_logger(logger, stream, filename=None, fmt=None): if (len(logger.handlers) < 1): console = logging.StreamHandler(stream) console.setLevel(logging.DEBUG) console.setFormatter(logging.Formatter(fmt)) logger.addHandler(console) logger.setLevel(logging.DEBUG) if filename: outfile = logging.FileHand...
Sets up a logger (if no handlers exist) for console output, and file \'tee\' output if desired.
sets up a logger for console output , and file tee output if desired .
Question: What does this function do? Code: def setup_logger(logger, stream, filename=None, fmt=None): if (len(logger.handlers) < 1): console = logging.StreamHandler(stream) console.setLevel(logging.DEBUG) console.setFormatter(logging.Formatter(fmt)) logger.addHandler(console) logger.setLevel(logging.DEBU...
null
null
null
What does this function do?
def _absolute_path(path, relative_to=None): if (path and os.path.isabs(path)): return path if (path and (relative_to is not None)): _abspath = os.path.join(relative_to, path) if os.path.isfile(_abspath): log.debug("Relative path '{0}' converted to existing absolute path '{1}'".format(path, _abspath)) retu...
null
null
null
Return an absolute path. In case ``relative_to`` is passed and ``path`` is not an absolute path, we try to prepend ``relative_to`` to ``path``and if that path exists, return that one
pcsd
def absolute path path relative to=None if path and os path isabs path return path if path and relative to is not None abspath = os path join relative to path if os path isfile abspath log debug "Relative path '{0}' converted to existing absolute path '{1}'" format path abspath return abspath return path
632
def _absolute_path(path, relative_to=None): if (path and os.path.isabs(path)): return path if (path and (relative_to is not None)): _abspath = os.path.join(relative_to, path) if os.path.isfile(_abspath): log.debug("Relative path '{0}' converted to existing absolute path '{1}'".format(path, _abspath)) retu...
Return an absolute path. In case ``relative_to`` is passed and ``path`` is not an absolute path, we try to prepend ``relative_to`` to ``path``and if that path exists, return that one
return an absolute path .
Question: What does this function do? Code: def _absolute_path(path, relative_to=None): if (path and os.path.isabs(path)): return path if (path and (relative_to is not None)): _abspath = os.path.join(relative_to, path) if os.path.isfile(_abspath): log.debug("Relative path '{0}' converted to existing absol...
null
null
null
What does this function do?
def parse_environ_block(data): ret = {} pos = 0 WINDOWS_ = WINDOWS while True: next_pos = data.find('\x00', pos) if (next_pos <= pos): break equal_pos = data.find('=', pos, next_pos) if (equal_pos > pos): key = data[pos:equal_pos] value = data[(equal_pos + 1):next_pos] if WINDOWS_: key = key...
null
null
null
Parse a C environ block of environment variables into a dictionary.
pcsd
def parse environ block data ret = {} pos = 0 WINDOWS = WINDOWS while True next pos = data find '\x00' pos if next pos <= pos break equal pos = data find '=' pos next pos if equal pos > pos key = data[pos equal pos] value = data[ equal pos + 1 next pos] if WINDOWS key = key upper ret[key] = value pos = next pos + 1 ret...
636
def parse_environ_block(data): ret = {} pos = 0 WINDOWS_ = WINDOWS while True: next_pos = data.find('\x00', pos) if (next_pos <= pos): break equal_pos = data.find('=', pos, next_pos) if (equal_pos > pos): key = data[pos:equal_pos] value = data[(equal_pos + 1):next_pos] if WINDOWS_: key = key...
Parse a C environ block of environment variables into a dictionary.
parse a c environ block of environment variables into a dictionary .
Question: What does this function do? Code: def parse_environ_block(data): ret = {} pos = 0 WINDOWS_ = WINDOWS while True: next_pos = data.find('\x00', pos) if (next_pos <= pos): break equal_pos = data.find('=', pos, next_pos) if (equal_pos > pos): key = data[pos:equal_pos] value = data[(equal_p...
null
null
null
What does this function do?
def stats(phenny, input): commands = {} users = {} channels = {} ignore = set(['f_note', 'startup', 'message', 'noteuri']) for ((name, user), count) in phenny.stats.items(): if (name in ignore): continue if (not user): continue if (not user.startswith('#')): try: users[user] += count except K...
null
null
null
Show information on command usage patterns.
pcsd
def stats phenny input commands = {} users = {} channels = {} ignore = set ['f note' 'startup' 'message' 'noteuri'] for name user count in phenny stats items if name in ignore continue if not user continue if not user startswith '#' try users[user] += count except Key Error users[user] = count else try commands[name] +...
639
def stats(phenny, input): commands = {} users = {} channels = {} ignore = set(['f_note', 'startup', 'message', 'noteuri']) for ((name, user), count) in phenny.stats.items(): if (name in ignore): continue if (not user): continue if (not user.startswith('#')): try: users[user] += count except K...
Show information on command usage patterns.
show information on command usage patterns .
Question: What does this function do? Code: def stats(phenny, input): commands = {} users = {} channels = {} ignore = set(['f_note', 'startup', 'message', 'noteuri']) for ((name, user), count) in phenny.stats.items(): if (name in ignore): continue if (not user): continue if (not user.startswith('#')...
null
null
null
What does this function do?
def check_valid_naming(pattern=None, multi=None): if (pattern is None): pattern = sickbeard.NAMING_PATTERN logger.log(((u'Checking whether the pattern ' + pattern) + ' is valid for a single episode'), logger.DEBUG) valid = validate_name(pattern, None) if (multi is not None): logger.log(((u'Checking whether the ...
null
null
null
Checks if the name is can be parsed back to its original form for both single and multi episodes. Returns true if the naming is valid, false if not.
pcsd
def check valid naming pattern=None multi=None if pattern is None pattern = sickbeard NAMING PATTERN logger log u'Checking whether the pattern ' + pattern + ' is valid for a single episode' logger DEBUG valid = validate name pattern None if multi is not None logger log u'Checking whether the pattern ' + pattern + ' is ...
640
def check_valid_naming(pattern=None, multi=None): if (pattern is None): pattern = sickbeard.NAMING_PATTERN logger.log(((u'Checking whether the pattern ' + pattern) + ' is valid for a single episode'), logger.DEBUG) valid = validate_name(pattern, None) if (multi is not None): logger.log(((u'Checking whether the ...
Checks if the name is can be parsed back to its original form for both single and multi episodes. Returns true if the naming is valid, false if not.
checks if the name is can be parsed back to its original form for both single and multi episodes .
Question: What does this function do? Code: def check_valid_naming(pattern=None, multi=None): if (pattern is None): pattern = sickbeard.NAMING_PATTERN logger.log(((u'Checking whether the pattern ' + pattern) + ' is valid for a single episode'), logger.DEBUG) valid = validate_name(pattern, None) if (multi is no...
null
null
null
What does this function do?
def get_form(model, converter, base_class=form.BaseForm, only=None, exclude=None, field_args=None, allow_pk=False, extra_fields=None): result = model_form(model, base_class=base_class, only=only, exclude=exclude, field_args=field_args, allow_pk=allow_pk, converter=converter) if extra_fields: for (name, field) in it...
null
null
null
Create form from peewee model and contribute extra fields, if necessary
pcsd
def get form model converter base class=form Base Form only=None exclude=None field args=None allow pk=False extra fields=None result = model form model base class=base class only=only exclude=exclude field args=field args allow pk=allow pk converter=converter if extra fields for name field in iteritems extra fields se...
653
def get_form(model, converter, base_class=form.BaseForm, only=None, exclude=None, field_args=None, allow_pk=False, extra_fields=None): result = model_form(model, base_class=base_class, only=only, exclude=exclude, field_args=field_args, allow_pk=allow_pk, converter=converter) if extra_fields: for (name, field) in it...
Create form from peewee model and contribute extra fields, if necessary
create form from peewee model and contribute extra fields , if necessary
Question: What does this function do? Code: def get_form(model, converter, base_class=form.BaseForm, only=None, exclude=None, field_args=None, allow_pk=False, extra_fields=None): result = model_form(model, base_class=base_class, only=only, exclude=exclude, field_args=field_args, allow_pk=allow_pk, converter=convert...
null
null
null
What does this function do?
def _calculate_course_xblocks_data(course_key): with modulestore().bulk_operations(course_key): course = modulestore().get_course(course_key, depth=None) blocks_info_dict = {} blocks_stack = [course] while blocks_stack: current_block = blocks_stack.pop() children = (current_block.get_children() if curren...
null
null
null
Fetch data for all the blocks in the course. This data consists of the display_name and path of the block.
pcsd
def calculate course xblocks data course key with modulestore bulk operations course key course = modulestore get course course key depth=None blocks info dict = {} blocks stack = [course] while blocks stack current block = blocks stack pop children = current block get children if current block has children else [] usa...
654
def _calculate_course_xblocks_data(course_key): with modulestore().bulk_operations(course_key): course = modulestore().get_course(course_key, depth=None) blocks_info_dict = {} blocks_stack = [course] while blocks_stack: current_block = blocks_stack.pop() children = (current_block.get_children() if curren...
Fetch data for all the blocks in the course. This data consists of the display_name and path of the block.
fetch data for all the blocks in the course .
Question: What does this function do? Code: def _calculate_course_xblocks_data(course_key): with modulestore().bulk_operations(course_key): course = modulestore().get_course(course_key, depth=None) blocks_info_dict = {} blocks_stack = [course] while blocks_stack: current_block = blocks_stack.pop() chi...
null
null
null
What does this function do?
def appendimages(im1, im2): rows1 = im1.shape[0] rows2 = im2.shape[0] if (rows1 < rows2): im1 = concatenate((im1, zeros(((rows2 - rows1), im1.shape[1]))), axis=0) elif (rows1 > rows2): im2 = concatenate((im2, zeros(((rows1 - rows2), im2.shape[1]))), axis=0) return concatenate((im1, im2), axis=1)
null
null
null
Return a new image that appends the two images side-by-side.
pcsd
def appendimages im1 im2 rows1 = im1 shape[0] rows2 = im2 shape[0] if rows1 < rows2 im1 = concatenate im1 zeros rows2 - rows1 im1 shape[1] axis=0 elif rows1 > rows2 im2 = concatenate im2 zeros rows1 - rows2 im2 shape[1] axis=0 return concatenate im1 im2 axis=1
655
def appendimages(im1, im2): rows1 = im1.shape[0] rows2 = im2.shape[0] if (rows1 < rows2): im1 = concatenate((im1, zeros(((rows2 - rows1), im1.shape[1]))), axis=0) elif (rows1 > rows2): im2 = concatenate((im2, zeros(((rows1 - rows2), im2.shape[1]))), axis=0) return concatenate((im1, im2), axis=1)
Return a new image that appends the two images side-by-side.
return a new image that appends the two images side - by - side .
Question: What does this function do? Code: def appendimages(im1, im2): rows1 = im1.shape[0] rows2 = im2.shape[0] if (rows1 < rows2): im1 = concatenate((im1, zeros(((rows2 - rows1), im1.shape[1]))), axis=0) elif (rows1 > rows2): im2 = concatenate((im2, zeros(((rows1 - rows2), im2.shape[1]))), axis=0) return...
null
null
null
What does this function do?
def conv_ch_add_coupling(input_, dim, name, use_batch_norm=True, train=True, weight_norm=True, reverse=False, residual_blocks=5, bottleneck=False, change_bottom=True, skip=True): with tf.variable_scope(name) as scope: if (reverse or (not train)): scope.reuse_variables() if change_bottom: (input_, canvas) = t...
null
null
null
Additive coupling with channel-wise splitting.
pcsd
def conv ch add coupling input dim name use batch norm=True train=True weight norm=True reverse=False residual blocks=5 bottleneck=False change bottom=True skip=True with tf variable scope name as scope if reverse or not train scope reuse variables if change bottom input canvas = tf split input 2 3 else canvas input = ...
660
def conv_ch_add_coupling(input_, dim, name, use_batch_norm=True, train=True, weight_norm=True, reverse=False, residual_blocks=5, bottleneck=False, change_bottom=True, skip=True): with tf.variable_scope(name) as scope: if (reverse or (not train)): scope.reuse_variables() if change_bottom: (input_, canvas) = t...
Additive coupling with channel-wise splitting.
additive coupling with channel - wise splitting .
Question: What does this function do? Code: def conv_ch_add_coupling(input_, dim, name, use_batch_norm=True, train=True, weight_norm=True, reverse=False, residual_blocks=5, bottleneck=False, change_bottom=True, skip=True): with tf.variable_scope(name) as scope: if (reverse or (not train)): scope.reuse_variable...
null
null
null
What does this function do?
def sinh(x): np = import_module('numpy') if isinstance(x, (int, float)): return interval(np.sinh(x), np.sinh(x)) elif isinstance(x, interval): return interval(np.sinh(x.start), np.sinh(x.end), is_valid=x.is_valid) else: raise NotImplementedError
null
null
null
Evaluates the hyperbolic sine of an interval
pcsd
def sinh x np = import module 'numpy' if isinstance x int float return interval np sinh x np sinh x elif isinstance x interval return interval np sinh x start np sinh x end is valid=x is valid else raise Not Implemented Error
665
def sinh(x): np = import_module('numpy') if isinstance(x, (int, float)): return interval(np.sinh(x), np.sinh(x)) elif isinstance(x, interval): return interval(np.sinh(x.start), np.sinh(x.end), is_valid=x.is_valid) else: raise NotImplementedError
Evaluates the hyperbolic sine of an interval
evaluates the hyperbolic sine of an interval
Question: What does this function do? Code: def sinh(x): np = import_module('numpy') if isinstance(x, (int, float)): return interval(np.sinh(x), np.sinh(x)) elif isinstance(x, interval): return interval(np.sinh(x.start), np.sinh(x.end), is_valid=x.is_valid) else: raise NotImplementedError
null
null
null
What does this function do?
def main(): parser = optparse.OptionParser(usage='usage: %prog [options] <package path> [exclude paths, ...]\n\nNote: By default this script will not overwrite already created files.') parser.add_option('-n', '--doc-header', action='store', dest='header', help='Documentation Header (default=Project)', default='Projec...
null
null
null
Parse and check the command line arguments.
pcsd
def main parser = optparse Option Parser usage='usage %prog [options] <package path> [exclude paths ] Note By default this script will not overwrite already created files ' parser add option '-n' '--doc-header' action='store' dest='header' help='Documentation Header default=Project ' default='Project' parser add option...
666
def main(): parser = optparse.OptionParser(usage='usage: %prog [options] <package path> [exclude paths, ...]\n\nNote: By default this script will not overwrite already created files.') parser.add_option('-n', '--doc-header', action='store', dest='header', help='Documentation Header (default=Project)', default='Projec...
Parse and check the command line arguments.
parse and check the command line arguments .
Question: What does this function do? Code: def main(): parser = optparse.OptionParser(usage='usage: %prog [options] <package path> [exclude paths, ...]\n\nNote: By default this script will not overwrite already created files.') parser.add_option('-n', '--doc-header', action='store', dest='header', help='Documenta...
null
null
null
What does this function do?
def escape_rfc3986(s): if ((sys.version_info < (3, 0)) and isinstance(s, unicode)): s = s.encode(u'utf-8') return compat_urllib_parse.quote(s, "%/;:@&=+$,!~*'()?#[]")
null
null
null
Escape non-ASCII characters as suggested by RFC 3986
pcsd
def escape rfc3986 s if sys version info < 3 0 and isinstance s unicode s = s encode u'utf-8' return compat urllib parse quote s "%/ @&=+$ !~*' ?#[]"
667
def escape_rfc3986(s): if ((sys.version_info < (3, 0)) and isinstance(s, unicode)): s = s.encode(u'utf-8') return compat_urllib_parse.quote(s, "%/;:@&=+$,!~*'()?#[]")
Escape non-ASCII characters as suggested by RFC 3986
escape non - ascii characters as suggested by rfc 3986
Question: What does this function do? Code: def escape_rfc3986(s): if ((sys.version_info < (3, 0)) and isinstance(s, unicode)): s = s.encode(u'utf-8') return compat_urllib_parse.quote(s, "%/;:@&=+$,!~*'()?#[]")
null
null
null
What does this function do?
def validipport(port): try: assert (0 <= int(port) <= 65535) except (AssertionError, ValueError): return False return True
null
null
null
returns True if `port` is a valid IPv4 port
pcsd
def validipport port try assert 0 <= int port <= 65535 except Assertion Error Value Error return False return True
671
def validipport(port): try: assert (0 <= int(port) <= 65535) except (AssertionError, ValueError): return False return True
returns True if `port` is a valid IPv4 port
returns true if port is a valid ipv4 port
Question: What does this function do? Code: def validipport(port): try: assert (0 <= int(port) <= 65535) except (AssertionError, ValueError): return False return True
null
null
null
What does this function do?
def _remove_dups(L): seen_before = set([]) L2 = [] for i in L: if (i not in seen_before): seen_before.add(i) L2.append(i) return L2
null
null
null
Removes duplicates AND preserves the original order of the elements. The set class is not guaranteed to do this.
pcsd
def remove dups L seen before = set [] L2 = [] for i in L if i not in seen before seen before add i L2 append i return L2
676
def _remove_dups(L): seen_before = set([]) L2 = [] for i in L: if (i not in seen_before): seen_before.add(i) L2.append(i) return L2
Removes duplicates AND preserves the original order of the elements. The set class is not guaranteed to do this.
removes duplicates and preserves the original order of the elements .
Question: What does this function do? Code: def _remove_dups(L): seen_before = set([]) L2 = [] for i in L: if (i not in seen_before): seen_before.add(i) L2.append(i) return L2
null
null
null
What does this function do?
def get_complete_paths(config, page): input_path = os.path.join(config[u'docs_dir'], page.input_path) output_path = os.path.join(config[u'site_dir'], page.output_path) return (input_path, output_path)
null
null
null
Return the complete input/output paths for the supplied page.
pcsd
def get complete paths config page input path = os path join config[u'docs dir'] page input path output path = os path join config[u'site dir'] page output path return input path output path
694
def get_complete_paths(config, page): input_path = os.path.join(config[u'docs_dir'], page.input_path) output_path = os.path.join(config[u'site_dir'], page.output_path) return (input_path, output_path)
Return the complete input/output paths for the supplied page.
return the complete input / output paths for the supplied page .
Question: What does this function do? Code: def get_complete_paths(config, page): input_path = os.path.join(config[u'docs_dir'], page.input_path) output_path = os.path.join(config[u'site_dir'], page.output_path) return (input_path, output_path)
null
null
null
What does this function do?
def user(email): return User.objects.get(email=email)
null
null
null
look up a user by email
pcsd
def user email return User objects get email=email
701
def user(email): return User.objects.get(email=email)
look up a user by email
look up a user by email
Question: What does this function do? Code: def user(email): return User.objects.get(email=email)
null
null
null
What does this function do?
def ping(server, port): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((server, port)) return True except socket.error: return False finally: s.close()
null
null
null
Check if a server accepts connections on a specific TCP port
pcsd
def ping server port s = socket socket socket AF INET socket SOCK STREAM try s connect server port return True except socket error return False finally s close
703
def ping(server, port): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((server, port)) return True except socket.error: return False finally: s.close()
Check if a server accepts connections on a specific TCP port
check if a server accepts connections on a specific tcp port
Question: What does this function do? Code: def ping(server, port): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((server, port)) return True except socket.error: return False finally: s.close()
null
null
null
What does this function do?
@require_context def group_type_get(context, id, inactive=False, expected_fields=None): return _group_type_get(context, id, session=None, inactive=inactive, expected_fields=expected_fields)
null
null
null
Return a dict describing specific group_type.
pcsd
@require context def group type get context id inactive=False expected fields=None return group type get context id session=None inactive=inactive expected fields=expected fields
704
@require_context def group_type_get(context, id, inactive=False, expected_fields=None): return _group_type_get(context, id, session=None, inactive=inactive, expected_fields=expected_fields)
Return a dict describing specific group_type.
return a dict describing specific group _ type .
Question: What does this function do? Code: @require_context def group_type_get(context, id, inactive=False, expected_fields=None): return _group_type_get(context, id, session=None, inactive=inactive, expected_fields=expected_fields)
null
null
null
What does this function do?
def init(): if (not directory.get_plugins()): NeutronManager.get_instance()
null
null
null
Call to load the plugins (core+services) machinery.
pcsd
def init if not directory get plugins Neutron Manager get instance
705
def init(): if (not directory.get_plugins()): NeutronManager.get_instance()
Call to load the plugins (core+services) machinery.
call to load the plugins machinery .
Question: What does this function do? Code: def init(): if (not directory.get_plugins()): NeutronManager.get_instance()
null
null
null
What does this function do?
def _show_legend(ax): leg = ax.legend(loc=1, shadow=True, fancybox=True, labelspacing=0.2, borderpad=0.15) ltext = leg.get_texts() llines = leg.get_lines() frame = leg.get_frame() from matplotlib.artist import setp setp(ltext, fontsize='small') setp(llines, linewidth=1)
null
null
null
Utility function to show legend.
pcsd
def show legend ax leg = ax legend loc=1 shadow=True fancybox=True labelspacing=0 2 borderpad=0 15 ltext = leg get texts llines = leg get lines frame = leg get frame from matplotlib artist import setp setp ltext fontsize='small' setp llines linewidth=1
714
def _show_legend(ax): leg = ax.legend(loc=1, shadow=True, fancybox=True, labelspacing=0.2, borderpad=0.15) ltext = leg.get_texts() llines = leg.get_lines() frame = leg.get_frame() from matplotlib.artist import setp setp(ltext, fontsize='small') setp(llines, linewidth=1)
Utility function to show legend.
utility function to show legend .
Question: What does this function do? Code: def _show_legend(ax): leg = ax.legend(loc=1, shadow=True, fancybox=True, labelspacing=0.2, borderpad=0.15) ltext = leg.get_texts() llines = leg.get_lines() frame = leg.get_frame() from matplotlib.artist import setp setp(ltext, fontsize='small') setp(llines, linewidt...
null
null
null
What does this function do?
def n_to_one(arr): return where((arr == 1))[0][0]
null
null
null
Returns the reverse of a 1-in-n binary encoding.
pcsd
def n to one arr return where arr == 1 [0][0]
715
def n_to_one(arr): return where((arr == 1))[0][0]
Returns the reverse of a 1-in-n binary encoding.
returns the reverse of a 1 - in - n binary encoding .
Question: What does this function do? Code: def n_to_one(arr): return where((arr == 1))[0][0]
null
null
null
What does this function do?
def command(encoder, musicSource, musicDest, albumPath, xldProfile): startMusicTime = time.time() cmd = [] if xldProfile: xldDestDir = os.path.split(musicDest)[0] cmd = [encoder] cmd.extend([musicSource]) cmd.extend(['--profile']) cmd.extend([xldProfile]) cmd.extend(['-o']) cmd.extend([xldDestDir]) el...
null
null
null
Encode a given music file with a certain encoder. Returns True on success, or False otherwise.
pcsd
def command encoder music Source music Dest album Path xld Profile start Music Time = time time cmd = [] if xld Profile xld Dest Dir = os path split music Dest [0] cmd = [encoder] cmd extend [music Source] cmd extend ['--profile'] cmd extend [xld Profile] cmd extend ['-o'] cmd extend [xld Dest Dir] elif headphones CONF...
718
def command(encoder, musicSource, musicDest, albumPath, xldProfile): startMusicTime = time.time() cmd = [] if xldProfile: xldDestDir = os.path.split(musicDest)[0] cmd = [encoder] cmd.extend([musicSource]) cmd.extend(['--profile']) cmd.extend([xldProfile]) cmd.extend(['-o']) cmd.extend([xldDestDir]) el...
Encode a given music file with a certain encoder. Returns True on success, or False otherwise.
encode a given music file with a certain encoder .
Question: What does this function do? Code: def command(encoder, musicSource, musicDest, albumPath, xldProfile): startMusicTime = time.time() cmd = [] if xldProfile: xldDestDir = os.path.split(musicDest)[0] cmd = [encoder] cmd.extend([musicSource]) cmd.extend(['--profile']) cmd.extend([xldProfile]) cm...
null
null
null
What does this function do?
@contextfunction def documents_document_list(context, documents, skip_group=False): request = context['request'] response_format = 'html' if ('response_format' in context): response_format = context['response_format'] return Markup(render_to_string('documents/tags/document_list', {'documents': documents, 'skip_gr...
null
null
null
Print a list of documents
pcsd
@contextfunction def documents document list context documents skip group=False request = context['request'] response format = 'html' if 'response format' in context response format = context['response format'] return Markup render to string 'documents/tags/document list' {'documents' documents 'skip group' skip group}...
721
@contextfunction def documents_document_list(context, documents, skip_group=False): request = context['request'] response_format = 'html' if ('response_format' in context): response_format = context['response_format'] return Markup(render_to_string('documents/tags/document_list', {'documents': documents, 'skip_gr...
Print a list of documents
print a list of documents
Question: What does this function do? Code: @contextfunction def documents_document_list(context, documents, skip_group=False): request = context['request'] response_format = 'html' if ('response_format' in context): response_format = context['response_format'] return Markup(render_to_string('documents/tags/do...
null
null
null
What does this function do?
def url2pathname(url): import string, urllib.parse url = url.replace(':', '|') if (not ('|' in url)): if (url[:4] == '////'): url = url[2:] components = url.split('/') return urllib.parse.unquote('\\'.join(components)) comp = url.split('|') if ((len(comp) != 2) or (comp[0][(-1)] not in string.ascii_letter...
null
null
null
OS-specific conversion from a relative URL of the \'file\' scheme to a file system path; not recommended for general use.
pcsd
def url2pathname url import string urllib parse url = url replace ' ' '|' if not '|' in url if url[ 4] == '////' url = url[2 ] components = url split '/' return urllib parse unquote '\\' join components comp = url split '|' if len comp != 2 or comp[0][ -1 ] not in string ascii letters error = 'Bad URL ' + url raise OS ...
724
def url2pathname(url): import string, urllib.parse url = url.replace(':', '|') if (not ('|' in url)): if (url[:4] == '////'): url = url[2:] components = url.split('/') return urllib.parse.unquote('\\'.join(components)) comp = url.split('|') if ((len(comp) != 2) or (comp[0][(-1)] not in string.ascii_letter...
OS-specific conversion from a relative URL of the \'file\' scheme to a file system path; not recommended for general use.
os - specific conversion from a relative url of the file scheme to a file system path ; not recommended for general use .
Question: What does this function do? Code: def url2pathname(url): import string, urllib.parse url = url.replace(':', '|') if (not ('|' in url)): if (url[:4] == '////'): url = url[2:] components = url.split('/') return urllib.parse.unquote('\\'.join(components)) comp = url.split('|') if ((len(comp) != ...
null
null
null
What does this function do?
def list_remote_pythons(host): result = host.run('ls /usr/bin/python[0-9]*') return result.stdout.splitlines()
null
null
null
List out installed pythons on host.
pcsd
def list remote pythons host result = host run 'ls /usr/bin/python[0-9]*' return result stdout splitlines
730
def list_remote_pythons(host): result = host.run('ls /usr/bin/python[0-9]*') return result.stdout.splitlines()
List out installed pythons on host.
list out installed pythons on host .
Question: What does this function do? Code: def list_remote_pythons(host): result = host.run('ls /usr/bin/python[0-9]*') return result.stdout.splitlines()
null
null
null
What does this function do?
@utils.no_4byte_params def metadef_namespace_update(context, namespace_id, namespace_dict, session=None): session = (session or get_session()) return metadef_namespace_api.update(context, namespace_id, namespace_dict, session)
null
null
null
Update a namespace or raise if it does not exist or not visible
pcsd
@utils no 4byte params def metadef namespace update context namespace id namespace dict session=None session = session or get session return metadef namespace api update context namespace id namespace dict session
742
@utils.no_4byte_params def metadef_namespace_update(context, namespace_id, namespace_dict, session=None): session = (session or get_session()) return metadef_namespace_api.update(context, namespace_id, namespace_dict, session)
Update a namespace or raise if it does not exist or not visible
update a namespace or raise if it does not exist or not visible
Question: What does this function do? Code: @utils.no_4byte_params def metadef_namespace_update(context, namespace_id, namespace_dict, session=None): session = (session or get_session()) return metadef_namespace_api.update(context, namespace_id, namespace_dict, session)
null
null
null
What does this function do?
def getNewRepository(): return SkeinforgeRepository()
null
null
null
Get new repository.
pcsd
def get New Repository return Skeinforge Repository
747
def getNewRepository(): return SkeinforgeRepository()
Get new repository.
get new repository .
Question: What does this function do? Code: def getNewRepository(): return SkeinforgeRepository()
null
null
null
What does this function do?
def flag_file(path, flag, create=False): path = os.path.join(path, JOB_ADMIN) path = os.path.join(path, flag) if create: try: f = open(path, 'w') f.write('ok\n') f.close() return True except IOError: return False else: return os.path.exists(path)
null
null
null
Create verify flag file or return True if it already exists
pcsd
def flag file path flag create=False path = os path join path JOB ADMIN path = os path join path flag if create try f = open path 'w' f write 'ok ' f close return True except IO Error return False else return os path exists path
760
def flag_file(path, flag, create=False): path = os.path.join(path, JOB_ADMIN) path = os.path.join(path, flag) if create: try: f = open(path, 'w') f.write('ok\n') f.close() return True except IOError: return False else: return os.path.exists(path)
Create verify flag file or return True if it already exists
create verify flag file or return true if it already exists
Question: What does this function do? Code: def flag_file(path, flag, create=False): path = os.path.join(path, JOB_ADMIN) path = os.path.join(path, flag) if create: try: f = open(path, 'w') f.write('ok\n') f.close() return True except IOError: return False else: return os.path.exists(path)
null
null
null
What does this function do?
def _generate_group_title(group): return group.name.replace('_', ' ').title()
null
null
null
Return a title for the given Group factory stub object.
pcsd
def generate group title group return group name replace ' ' ' ' title
765
def _generate_group_title(group): return group.name.replace('_', ' ').title()
Return a title for the given Group factory stub object.
return a title for the given group factory stub object .
Question: What does this function do? Code: def _generate_group_title(group): return group.name.replace('_', ' ').title()
null
null
null
What does this function do?
def get_tracks_from_json(jsons): items = jsons.get('items') if (not items): util.dbg('got unexpected data or no search results') return () qs = {'part': 'contentDetails,statistics,snippet', 'id': ','.join([get_track_id_from_json(i) for i in items])} wdata = pafy.call_gdata('videos', qs) items_vidinfo = wdata.g...
null
null
null
Get search results from API response
pcsd
def get tracks from json jsons items = jsons get 'items' if not items util dbg 'got unexpected data or no search results' return qs = {'part' 'content Details statistics snippet' 'id' ' ' join [get track id from json i for i in items] } wdata = pafy call gdata 'videos' qs items vidinfo = wdata get 'items' [] for search...
771
def get_tracks_from_json(jsons): items = jsons.get('items') if (not items): util.dbg('got unexpected data or no search results') return () qs = {'part': 'contentDetails,statistics,snippet', 'id': ','.join([get_track_id_from_json(i) for i in items])} wdata = pafy.call_gdata('videos', qs) items_vidinfo = wdata.g...
Get search results from API response
get search results from api response
Question: What does this function do? Code: def get_tracks_from_json(jsons): items = jsons.get('items') if (not items): util.dbg('got unexpected data or no search results') return () qs = {'part': 'contentDetails,statistics,snippet', 'id': ','.join([get_track_id_from_json(i) for i in items])} wdata = pafy.ca...
null
null
null
What does this function do?
def find_tag_definition(block, offset): (block, boundary) = next_tag_boundary(block, offset, forward=False) if ((not boundary) or (not boundary.is_start)): return (None, False) tag_start = boundary closing = tag_start.closing tag = tag_start.name if tag_start.prefix: tag = ((tag_start.prefix + u':') + tag) r...
null
null
null
Return the <tag | > definition, if any that (block, offset) is inside.
pcsd
def find tag definition block offset block boundary = next tag boundary block offset forward=False if not boundary or not boundary is start return None False tag start = boundary closing = tag start closing tag = tag start name if tag start prefix tag = tag start prefix + u' ' + tag return tag closing
783
def find_tag_definition(block, offset): (block, boundary) = next_tag_boundary(block, offset, forward=False) if ((not boundary) or (not boundary.is_start)): return (None, False) tag_start = boundary closing = tag_start.closing tag = tag_start.name if tag_start.prefix: tag = ((tag_start.prefix + u':') + tag) r...
Return the <tag | > definition, if any that (block, offset) is inside.
return the definition , if any that is inside .
Question: What does this function do? Code: def find_tag_definition(block, offset): (block, boundary) = next_tag_boundary(block, offset, forward=False) if ((not boundary) or (not boundary.is_start)): return (None, False) tag_start = boundary closing = tag_start.closing tag = tag_start.name if tag_start.prefi...
null
null
null
What does this function do?
def printResult(address, hostname): if address: sys.stdout.write((address + '\n')) else: sys.stderr.write(('ERROR: No IP addresses found for name %r\n' % (hostname,)))
null
null
null
Print the IP address or an error message if an IP address was not found.
pcsd
def print Result address hostname if address sys stdout write address + ' ' else sys stderr write 'ERROR No IP addresses found for name %r ' % hostname
789
def printResult(address, hostname): if address: sys.stdout.write((address + '\n')) else: sys.stderr.write(('ERROR: No IP addresses found for name %r\n' % (hostname,)))
Print the IP address or an error message if an IP address was not found.
print the ip address or an error message if an ip address was not found .
Question: What does this function do? Code: def printResult(address, hostname): if address: sys.stdout.write((address + '\n')) else: sys.stderr.write(('ERROR: No IP addresses found for name %r\n' % (hostname,)))
null
null
null
What does this function do?
def extract_labels(filename, num_images): print('Extracting', filename) with gzip.open(filename) as bytestream: bytestream.read(8) buf = bytestream.read((1 * num_images)) labels = np.frombuffer(buf, dtype=np.uint8).astype(np.int64) return labels
null
null
null
Extract the labels into a vector of int64 label IDs.
pcsd
def extract labels filename num images print 'Extracting' filename with gzip open filename as bytestream bytestream read 8 buf = bytestream read 1 * num images labels = np frombuffer buf dtype=np uint8 astype np int64 return labels
792
def extract_labels(filename, num_images): print('Extracting', filename) with gzip.open(filename) as bytestream: bytestream.read(8) buf = bytestream.read((1 * num_images)) labels = np.frombuffer(buf, dtype=np.uint8).astype(np.int64) return labels
Extract the labels into a vector of int64 label IDs.
extract the labels into a vector of int64 label ids .
Question: What does this function do? Code: def extract_labels(filename, num_images): print('Extracting', filename) with gzip.open(filename) as bytestream: bytestream.read(8) buf = bytestream.read((1 * num_images)) labels = np.frombuffer(buf, dtype=np.uint8).astype(np.int64) return labels
null
null
null
What does this function do?
def get_lexer_by_name(_alias, **options): for (module_name, name, aliases, _, _) in LEXERS.itervalues(): if (_alias in aliases): if (name not in _lexer_cache): _load_lexers(module_name) return _lexer_cache[name](**options) for cls in find_plugin_lexers(): if (_alias in cls.aliases): return cls(**opti...
null
null
null
Get a lexer by an alias.
pcsd
def get lexer by name alias **options for module name name aliases in LEXERS itervalues if alias in aliases if name not in lexer cache load lexers module name return lexer cache[name] **options for cls in find plugin lexers if alias in cls aliases return cls **options raise Class Not Found 'no lexer for alias %r found'...
796
def get_lexer_by_name(_alias, **options): for (module_name, name, aliases, _, _) in LEXERS.itervalues(): if (_alias in aliases): if (name not in _lexer_cache): _load_lexers(module_name) return _lexer_cache[name](**options) for cls in find_plugin_lexers(): if (_alias in cls.aliases): return cls(**opti...
Get a lexer by an alias.
get a lexer by an alias .
Question: What does this function do? Code: def get_lexer_by_name(_alias, **options): for (module_name, name, aliases, _, _) in LEXERS.itervalues(): if (_alias in aliases): if (name not in _lexer_cache): _load_lexers(module_name) return _lexer_cache[name](**options) for cls in find_plugin_lexers(): i...
null
null
null
What does this function do?
@with_setup(prepare_stdout) def test_output_snippets_with_groups_within_single_quotes_colorful(): runner = Runner(feature_name('single-quoted-snippet'), verbosity=3, no_color=False) runner.run() assert_stdout_lines(u"\n\x1b[1;37mFeature: single-quoted snippet proposal \x1b[1;30m# tests/funct...
null
null
null
Testing that the proposed snippet is clever enough to identify groups within single quotes. colorful
pcsd
@with setup prepare stdout def test output snippets with groups within single quotes colorful runner = Runner feature name 'single-quoted-snippet' verbosity=3 no color=False runner run assert stdout lines u" \x1b[1 37m Feature single-quoted snippet proposal \x1b[1 30m# tests/functional/output features/single-quoted-sni...
797
@with_setup(prepare_stdout) def test_output_snippets_with_groups_within_single_quotes_colorful(): runner = Runner(feature_name('single-quoted-snippet'), verbosity=3, no_color=False) runner.run() assert_stdout_lines(u"\n\x1b[1;37mFeature: single-quoted snippet proposal \x1b[1;30m# tests/funct...
Testing that the proposed snippet is clever enough to identify groups within single quotes. colorful
testing that the proposed snippet is clever enough to identify groups within single quotes .
Question: What does this function do? Code: @with_setup(prepare_stdout) def test_output_snippets_with_groups_within_single_quotes_colorful(): runner = Runner(feature_name('single-quoted-snippet'), verbosity=3, no_color=False) runner.run() assert_stdout_lines(u"\n\x1b[1;37mFeature: single-quoted snippet proposal ...
null
null
null
What does this function do?
def get_module(app, modname, verbose, failfast): module_name = (u'%s.%s' % (app, modname)) try: module = import_module(module_name) except ImportError as e: if failfast: raise e elif verbose: print((u'Could not load %r from %r: %s' % (modname, app, e))) return None if verbose: print((u'Loaded %r fro...
null
null
null
Internal function to load a module from a single app.
pcsd
def get module app modname verbose failfast module name = u'%s %s' % app modname try module = import module module name except Import Error as e if failfast raise e elif verbose print u'Could not load %r from %r %s' % modname app e return None if verbose print u'Loaded %r from %r' % modname app return module
810
def get_module(app, modname, verbose, failfast): module_name = (u'%s.%s' % (app, modname)) try: module = import_module(module_name) except ImportError as e: if failfast: raise e elif verbose: print((u'Could not load %r from %r: %s' % (modname, app, e))) return None if verbose: print((u'Loaded %r fro...
Internal function to load a module from a single app.
internal function to load a module from a single app .
Question: What does this function do? Code: def get_module(app, modname, verbose, failfast): module_name = (u'%s.%s' % (app, modname)) try: module = import_module(module_name) except ImportError as e: if failfast: raise e elif verbose: print((u'Could not load %r from %r: %s' % (modname, app, e))) re...
null
null
null
What does this function do?
def nesting_exception_view(request): client = Client() client.get('/get_view/') raise Exception('exception message')
null
null
null
A view that uses a nested client to call another view and then raises an exception.
pcsd
def nesting exception view request client = Client client get '/get view/' raise Exception 'exception message'
817
def nesting_exception_view(request): client = Client() client.get('/get_view/') raise Exception('exception message')
A view that uses a nested client to call another view and then raises an exception.
a view that uses a nested client to call another view and then raises an exception .
Question: What does this function do? Code: def nesting_exception_view(request): client = Client() client.get('/get_view/') raise Exception('exception message')
null
null
null
What does this function do?
def placeholder(shape=None, ndim=None, dtype=None, sparse=False, name=None): if (dtype is None): dtype = floatx() if ((shape is None) and (ndim is None)): raise ValueError('Specify either a shape or ndim value.') if (shape is not None): ndim = len(shape) else: shape = tuple([None for _ in range(ndim)]) bro...
null
null
null
Instantiate an input data placeholder variable.
pcsd
def placeholder shape=None ndim=None dtype=None sparse=False name=None if dtype is None dtype = floatx if shape is None and ndim is None raise Value Error 'Specify either a shape or ndim value ' if shape is not None ndim = len shape else shape = tuple [None for in range ndim ] broadcast = False * ndim if sparse assert ...
823
def placeholder(shape=None, ndim=None, dtype=None, sparse=False, name=None): if (dtype is None): dtype = floatx() if ((shape is None) and (ndim is None)): raise ValueError('Specify either a shape or ndim value.') if (shape is not None): ndim = len(shape) else: shape = tuple([None for _ in range(ndim)]) bro...
Instantiate an input data placeholder variable.
instantiate an input data placeholder variable .
Question: What does this function do? Code: def placeholder(shape=None, ndim=None, dtype=None, sparse=False, name=None): if (dtype is None): dtype = floatx() if ((shape is None) and (ndim is None)): raise ValueError('Specify either a shape or ndim value.') if (shape is not None): ndim = len(shape) else: ...
null
null
null
What does this function do?
def equatePolarDotAzimuth(point, returnValue): equateCylindricalDotAzimuth(point, returnValue)
null
null
null
Get equation for polar azimuth.
pcsd
def equate Polar Dot Azimuth point return Value equate Cylindrical Dot Azimuth point return Value
824
def equatePolarDotAzimuth(point, returnValue): equateCylindricalDotAzimuth(point, returnValue)
Get equation for polar azimuth.
get equation for polar azimuth .
Question: What does this function do? Code: def equatePolarDotAzimuth(point, returnValue): equateCylindricalDotAzimuth(point, returnValue)
null
null
null
What does this function do?
def _run_code(code, run_globals, init_globals=None, mod_name=None, mod_fname=None, mod_loader=None, pkg_name=None): if (init_globals is not None): run_globals.update(init_globals) run_globals.update(__name__=mod_name, __file__=mod_fname, __loader__=mod_loader, __package__=pkg_name) exec code in run_globals return...
null
null
null
Helper to run code in nominated namespace
pcsd
def run code code run globals init globals=None mod name=None mod fname=None mod loader=None pkg name=None if init globals is not None run globals update init globals run globals update name =mod name file =mod fname loader =mod loader package =pkg name exec code in run globals return run globals
830
def _run_code(code, run_globals, init_globals=None, mod_name=None, mod_fname=None, mod_loader=None, pkg_name=None): if (init_globals is not None): run_globals.update(init_globals) run_globals.update(__name__=mod_name, __file__=mod_fname, __loader__=mod_loader, __package__=pkg_name) exec code in run_globals return...
Helper to run code in nominated namespace
helper to run code in nominated namespace
Question: What does this function do? Code: def _run_code(code, run_globals, init_globals=None, mod_name=None, mod_fname=None, mod_loader=None, pkg_name=None): if (init_globals is not None): run_globals.update(init_globals) run_globals.update(__name__=mod_name, __file__=mod_fname, __loader__=mod_loader, __packag...
null
null
null
What does this function do?
@pytest.fixture(scope=u'class', params=[u'internal', u'guessit'], ids=[u'internal', u'guessit'], autouse=True) def config(request): newconfig = Template(request.cls.config).render({u'parser': request.param}) assert (request.cls.config != newconfig), u'config parameterization did nothing?' return newconfig
null
null
null
Override and parametrize default config fixture for all series tests.
pcsd
@pytest fixture scope=u'class' params=[u'internal' u'guessit'] ids=[u'internal' u'guessit'] autouse=True def config request newconfig = Template request cls config render {u'parser' request param} assert request cls config != newconfig u'config parameterization did nothing?' return newconfig
836
@pytest.fixture(scope=u'class', params=[u'internal', u'guessit'], ids=[u'internal', u'guessit'], autouse=True) def config(request): newconfig = Template(request.cls.config).render({u'parser': request.param}) assert (request.cls.config != newconfig), u'config parameterization did nothing?' return newconfig
Override and parametrize default config fixture for all series tests.
override and parametrize default config fixture for all series tests .
Question: What does this function do? Code: @pytest.fixture(scope=u'class', params=[u'internal', u'guessit'], ids=[u'internal', u'guessit'], autouse=True) def config(request): newconfig = Template(request.cls.config).render({u'parser': request.param}) assert (request.cls.config != newconfig), u'config parameteriza...
null
null
null
What does this function do?
def build_server_url(*args, **kwargs): return urljoin(get_server_url(**kwargs), *args)
null
null
null
Build an absolute URL containing the full URL to the server. All additional arguments passed will be appended as paths to the URL.
pcsd
def build server url *args **kwargs return urljoin get server url **kwargs *args
841
def build_server_url(*args, **kwargs): return urljoin(get_server_url(**kwargs), *args)
Build an absolute URL containing the full URL to the server. All additional arguments passed will be appended as paths to the URL.
build an absolute url containing the full url to the server .
Question: What does this function do? Code: def build_server_url(*args, **kwargs): return urljoin(get_server_url(**kwargs), *args)
null
null
null
What does this function do?
def expand_to_match(items): cfg2newlines = {} for (configuration, lines) in items: cfg2newlines[configuration] = [] maxguard = (2 ** 30) while True: minimalsourceline = maxguard for (configuration, lines) in items: if lines: minimalsourceline = min(minimalsourceline, lines[0].sourceline) if (minimals...
null
null
null
Insert empty lines so that all sources has matching line numbers for the same code
pcsd
def expand to match items cfg2newlines = {} for configuration lines in items cfg2newlines[configuration] = [] maxguard = 2 ** 30 while True minimalsourceline = maxguard for configuration lines in items if lines minimalsourceline = min minimalsourceline lines[0] sourceline if minimalsourceline == maxguard break for conf...
842
def expand_to_match(items): cfg2newlines = {} for (configuration, lines) in items: cfg2newlines[configuration] = [] maxguard = (2 ** 30) while True: minimalsourceline = maxguard for (configuration, lines) in items: if lines: minimalsourceline = min(minimalsourceline, lines[0].sourceline) if (minimals...
Insert empty lines so that all sources has matching line numbers for the same code
insert empty lines so that all sources has matching line numbers for the same code
Question: What does this function do? Code: def expand_to_match(items): cfg2newlines = {} for (configuration, lines) in items: cfg2newlines[configuration] = [] maxguard = (2 ** 30) while True: minimalsourceline = maxguard for (configuration, lines) in items: if lines: minimalsourceline = min(minimal...
null
null
null
What does this function do?
def _parse_pool_options(options): max_pool_size = options.get('maxpoolsize', common.MAX_POOL_SIZE) min_pool_size = options.get('minpoolsize', common.MIN_POOL_SIZE) max_idle_time_ms = options.get('maxidletimems', common.MAX_IDLE_TIME_MS) if ((max_pool_size is not None) and (min_pool_size > max_pool_size)): raise V...
null
null
null
Parse connection pool options.
pcsd
def parse pool options options max pool size = options get 'maxpoolsize' common MAX POOL SIZE min pool size = options get 'minpoolsize' common MIN POOL SIZE max idle time ms = options get 'maxidletimems' common MAX IDLE TIME MS if max pool size is not None and min pool size > max pool size raise Value Error 'min Pool S...
844
def _parse_pool_options(options): max_pool_size = options.get('maxpoolsize', common.MAX_POOL_SIZE) min_pool_size = options.get('minpoolsize', common.MIN_POOL_SIZE) max_idle_time_ms = options.get('maxidletimems', common.MAX_IDLE_TIME_MS) if ((max_pool_size is not None) and (min_pool_size > max_pool_size)): raise V...
Parse connection pool options.
parse connection pool options .
Question: What does this function do? Code: def _parse_pool_options(options): max_pool_size = options.get('maxpoolsize', common.MAX_POOL_SIZE) min_pool_size = options.get('minpoolsize', common.MIN_POOL_SIZE) max_idle_time_ms = options.get('maxidletimems', common.MAX_IDLE_TIME_MS) if ((max_pool_size is not None) ...
null
null
null
What does this function do?
def getNewDerivation(elementNode, prefix, sideLength): return RoundDerivation(elementNode, prefix, sideLength)
null
null
null
Get new derivation.
pcsd
def get New Derivation element Node prefix side Length return Round Derivation element Node prefix side Length
867
def getNewDerivation(elementNode, prefix, sideLength): return RoundDerivation(elementNode, prefix, sideLength)
Get new derivation.
get new derivation .
Question: What does this function do? Code: def getNewDerivation(elementNode, prefix, sideLength): return RoundDerivation(elementNode, prefix, sideLength)
null
null
null
What does this function do?
def addSegmentToPixelTable(beginComplex, endComplex, pixelDictionary, shortenDistanceBegin, shortenDistanceEnd, width): if (abs((beginComplex - endComplex)) <= 0.0): return beginComplex /= width endComplex /= width if (shortenDistanceBegin > 0.0): endMinusBeginComplex = (endComplex - beginComplex) endMinusBeg...
null
null
null
Add line segment to the pixel table.
pcsd
def add Segment To Pixel Table begin Complex end Complex pixel Dictionary shorten Distance Begin shorten Distance End width if abs begin Complex - end Complex <= 0 0 return begin Complex /= width end Complex /= width if shorten Distance Begin > 0 0 end Minus Begin Complex = end Complex - begin Complex end Minus Begin C...
872
def addSegmentToPixelTable(beginComplex, endComplex, pixelDictionary, shortenDistanceBegin, shortenDistanceEnd, width): if (abs((beginComplex - endComplex)) <= 0.0): return beginComplex /= width endComplex /= width if (shortenDistanceBegin > 0.0): endMinusBeginComplex = (endComplex - beginComplex) endMinusBeg...
Add line segment to the pixel table.
add line segment to the pixel table .
Question: What does this function do? Code: def addSegmentToPixelTable(beginComplex, endComplex, pixelDictionary, shortenDistanceBegin, shortenDistanceEnd, width): if (abs((beginComplex - endComplex)) <= 0.0): return beginComplex /= width endComplex /= width if (shortenDistanceBegin > 0.0): endMinusBeginComp...
null
null
null
What does this function do?
def p_constant_expression_opt_2(t): pass
null
null
null
constant_expression_opt : constant_expression
pcsd
def p constant expression opt 2 t pass
878
def p_constant_expression_opt_2(t): pass
constant_expression_opt : constant_expression
constant _ expression _ opt : constant _ expression
Question: What does this function do? Code: def p_constant_expression_opt_2(t): pass
null
null
null
What does this function do?
def valuestodict(key): dict = {} size = _winreg.QueryInfoKey(key)[1] for i in range(size): data = _winreg.EnumValue(key, i) dict[data[0]] = data[1] return dict
null
null
null
Convert a registry key\'s values to a dictionary.
pcsd
def valuestodict key dict = {} size = winreg Query Info Key key [1] for i in range size data = winreg Enum Value key i dict[data[0]] = data[1] return dict
885
def valuestodict(key): dict = {} size = _winreg.QueryInfoKey(key)[1] for i in range(size): data = _winreg.EnumValue(key, i) dict[data[0]] = data[1] return dict
Convert a registry key\'s values to a dictionary.
convert a registry keys values to a dictionary .
Question: What does this function do? Code: def valuestodict(key): dict = {} size = _winreg.QueryInfoKey(key)[1] for i in range(size): data = _winreg.EnumValue(key, i) dict[data[0]] = data[1] return dict
null
null
null
What does this function do?
def wrap_traceback(traceback): if (email().format == 'html'): try: from pygments import highlight from pygments.lexers import PythonTracebackLexer from pygments.formatters import HtmlFormatter with_pygments = True except ImportError: with_pygments = False if with_pygments: formatter = HtmlForma...
null
null
null
For internal use only (until further notice)
pcsd
def wrap traceback traceback if email format == 'html' try from pygments import highlight from pygments lexers import Python Traceback Lexer from pygments formatters import Html Formatter with pygments = True except Import Error with pygments = False if with pygments formatter = Html Formatter noclasses=True wrapped = ...
894
def wrap_traceback(traceback): if (email().format == 'html'): try: from pygments import highlight from pygments.lexers import PythonTracebackLexer from pygments.formatters import HtmlFormatter with_pygments = True except ImportError: with_pygments = False if with_pygments: formatter = HtmlForma...
For internal use only (until further notice)
for internal use only
Question: What does this function do? Code: def wrap_traceback(traceback): if (email().format == 'html'): try: from pygments import highlight from pygments.lexers import PythonTracebackLexer from pygments.formatters import HtmlFormatter with_pygments = True except ImportError: with_pygments = Fal...