partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | NotificationCenter.post_notification | Post notification to all registered observers.
The registered callback will be called as::
callback(ntype, sender, *args, **kwargs)
Parameters
----------
ntype : hashable
The notification type.
sender : hashable
The object sending the notifi... | environment/lib/python2.7/site-packages/IPython/utils/notification.py | def post_notification(self, ntype, sender, *args, **kwargs):
"""Post notification to all registered observers.
The registered callback will be called as::
callback(ntype, sender, *args, **kwargs)
Parameters
----------
ntype : hashable
The notification t... | def post_notification(self, ntype, sender, *args, **kwargs):
"""Post notification to all registered observers.
The registered callback will be called as::
callback(ntype, sender, *args, **kwargs)
Parameters
----------
ntype : hashable
The notification t... | [
"Post",
"notification",
"to",
"all",
"registered",
"observers",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/notification.py#L56-L93 | [
"def",
"post_notification",
"(",
"self",
",",
"ntype",
",",
"sender",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"ntype",
"==",
"None",
"or",
"sender",
"==",
"None",
")",
":",
"raise",
"NotificationError",
"(",
"\"Notification type a... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotificationCenter._observers_for_notification | Find all registered observers that should recieve notification | environment/lib/python2.7/site-packages/IPython/utils/notification.py | def _observers_for_notification(self, ntype, sender):
"""Find all registered observers that should recieve notification"""
keys = (
(ntype,sender),
(ntype, None),
(None, sender),
(None,None)
)
obs = set(... | def _observers_for_notification(self, ntype, sender):
"""Find all registered observers that should recieve notification"""
keys = (
(ntype,sender),
(ntype, None),
(None, sender),
(None,None)
)
obs = set(... | [
"Find",
"all",
"registered",
"observers",
"that",
"should",
"recieve",
"notification"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/notification.py#L95-L109 | [
"def",
"_observers_for_notification",
"(",
"self",
",",
"ntype",
",",
"sender",
")",
":",
"keys",
"=",
"(",
"(",
"ntype",
",",
"sender",
")",
",",
"(",
"ntype",
",",
"None",
")",
",",
"(",
"None",
",",
"sender",
")",
",",
"(",
"None",
",",
"None",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotificationCenter.add_observer | Add an observer callback to this notification center.
The given callback will be called upon posting of notifications of
the given type/sender and will receive any additional arguments passed
to post_notification.
Parameters
----------
callback : callable
Th... | environment/lib/python2.7/site-packages/IPython/utils/notification.py | def add_observer(self, callback, ntype, sender):
"""Add an observer callback to this notification center.
The given callback will be called upon posting of notifications of
the given type/sender and will receive any additional arguments passed
to post_notification.
Parameters
... | def add_observer(self, callback, ntype, sender):
"""Add an observer callback to this notification center.
The given callback will be called upon posting of notifications of
the given type/sender and will receive any additional arguments passed
to post_notification.
Parameters
... | [
"Add",
"an",
"observer",
"callback",
"to",
"this",
"notification",
"center",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/notification.py#L111-L133 | [
"def",
"add_observer",
"(",
"self",
",",
"callback",
",",
"ntype",
",",
"sender",
")",
":",
"assert",
"(",
"callback",
"!=",
"None",
")",
"self",
".",
"registered_types",
".",
"add",
"(",
"ntype",
")",
"self",
".",
"registered_senders",
".",
"add",
"(",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BackgroundJobManager.new | Add a new background job and start it in a separate thread.
There are two types of jobs which can be created:
1. Jobs based on expressions which can be passed to an eval() call.
The expression must be given as a string. For example:
job_manager.new('myfunc(x,y,z=1)'[,glob[,loc]])
... | environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py | def new(self, func_or_exp, *args, **kwargs):
"""Add a new background job and start it in a separate thread.
There are two types of jobs which can be created:
1. Jobs based on expressions which can be passed to an eval() call.
The expression must be given as a string. For example:
... | def new(self, func_or_exp, *args, **kwargs):
"""Add a new background job and start it in a separate thread.
There are two types of jobs which can be created:
1. Jobs based on expressions which can be passed to an eval() call.
The expression must be given as a string. For example:
... | [
"Add",
"a",
"new",
"background",
"job",
"and",
"start",
"it",
"in",
"a",
"separate",
"thread",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L104-L194 | [
"def",
"new",
"(",
"self",
",",
"func_or_exp",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"callable",
"(",
"func_or_exp",
")",
":",
"kw",
"=",
"kwargs",
".",
"get",
"(",
"'kw'",
",",
"{",
"}",
")",
"job",
"=",
"BackgroundJobFunc",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BackgroundJobManager._update_status | Update the status of the job lists.
This method moves finished jobs to one of two lists:
- self.completed: jobs which completed successfully
- self.dead: jobs which finished but died.
It also copies those jobs to corresponding _report lists. These lists
are used to report ... | environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py | def _update_status(self):
"""Update the status of the job lists.
This method moves finished jobs to one of two lists:
- self.completed: jobs which completed successfully
- self.dead: jobs which finished but died.
It also copies those jobs to corresponding _report lists. Th... | def _update_status(self):
"""Update the status of the job lists.
This method moves finished jobs to one of two lists:
- self.completed: jobs which completed successfully
- self.dead: jobs which finished but died.
It also copies those jobs to corresponding _report lists. Th... | [
"Update",
"the",
"status",
"of",
"the",
"job",
"lists",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L208-L239 | [
"def",
"_update_status",
"(",
"self",
")",
":",
"# Status codes",
"srun",
",",
"scomp",
",",
"sdead",
"=",
"self",
".",
"_s_running",
",",
"self",
".",
"_s_completed",
",",
"self",
".",
"_s_dead",
"# State lists, use the actual lists b/c the public names are propertie... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BackgroundJobManager._group_report | Report summary for a given job group.
Return True if the group had any elements. | environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py | def _group_report(self,group,name):
"""Report summary for a given job group.
Return True if the group had any elements."""
if group:
print '%s jobs:' % name
for job in group:
print '%s : %s' % (job.num,job)
print
return True | def _group_report(self,group,name):
"""Report summary for a given job group.
Return True if the group had any elements."""
if group:
print '%s jobs:' % name
for job in group:
print '%s : %s' % (job.num,job)
print
return True | [
"Report",
"summary",
"for",
"a",
"given",
"job",
"group",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L241-L251 | [
"def",
"_group_report",
"(",
"self",
",",
"group",
",",
"name",
")",
":",
"if",
"group",
":",
"print",
"'%s jobs:'",
"%",
"name",
"for",
"job",
"in",
"group",
":",
"print",
"'%s : %s'",
"%",
"(",
"job",
".",
"num",
",",
"job",
")",
"print",
"return",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BackgroundJobManager._group_flush | Flush a given job group
Return True if the group had any elements. | environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py | def _group_flush(self,group,name):
"""Flush a given job group
Return True if the group had any elements."""
njobs = len(group)
if njobs:
plural = {1:''}.setdefault(njobs,'s')
print 'Flushing %s %s job%s.' % (njobs,name,plural)
group[:] = []
... | def _group_flush(self,group,name):
"""Flush a given job group
Return True if the group had any elements."""
njobs = len(group)
if njobs:
plural = {1:''}.setdefault(njobs,'s')
print 'Flushing %s %s job%s.' % (njobs,name,plural)
group[:] = []
... | [
"Flush",
"a",
"given",
"job",
"group"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L253-L263 | [
"def",
"_group_flush",
"(",
"self",
",",
"group",
",",
"name",
")",
":",
"njobs",
"=",
"len",
"(",
"group",
")",
"if",
"njobs",
":",
"plural",
"=",
"{",
"1",
":",
"''",
"}",
".",
"setdefault",
"(",
"njobs",
",",
"'s'",
")",
"print",
"'Flushing %s %... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BackgroundJobManager._status_new | Print the status of newly finished jobs.
Return True if any new jobs are reported.
This call resets its own state every time, so it only reports jobs
which have finished since the last time it was called. | environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py | def _status_new(self):
"""Print the status of newly finished jobs.
Return True if any new jobs are reported.
This call resets its own state every time, so it only reports jobs
which have finished since the last time it was called."""
self._update_status()
new_comp = se... | def _status_new(self):
"""Print the status of newly finished jobs.
Return True if any new jobs are reported.
This call resets its own state every time, so it only reports jobs
which have finished since the last time it was called."""
self._update_status()
new_comp = se... | [
"Print",
"the",
"status",
"of",
"newly",
"finished",
"jobs",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L265-L279 | [
"def",
"_status_new",
"(",
"self",
")",
":",
"self",
".",
"_update_status",
"(",
")",
"new_comp",
"=",
"self",
".",
"_group_report",
"(",
"self",
".",
"_comp_report",
",",
"'Completed'",
")",
"new_dead",
"=",
"self",
".",
"_group_report",
"(",
"self",
".",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BackgroundJobManager.status | Print a status of all jobs currently being managed. | environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py | def status(self,verbose=0):
"""Print a status of all jobs currently being managed."""
self._update_status()
self._group_report(self.running,'Running')
self._group_report(self.completed,'Completed')
self._group_report(self.dead,'Dead')
# Also flush the report queues
... | def status(self,verbose=0):
"""Print a status of all jobs currently being managed."""
self._update_status()
self._group_report(self.running,'Running')
self._group_report(self.completed,'Completed')
self._group_report(self.dead,'Dead')
# Also flush the report queues
... | [
"Print",
"a",
"status",
"of",
"all",
"jobs",
"currently",
"being",
"managed",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L281-L290 | [
"def",
"status",
"(",
"self",
",",
"verbose",
"=",
"0",
")",
":",
"self",
".",
"_update_status",
"(",
")",
"self",
".",
"_group_report",
"(",
"self",
".",
"running",
",",
"'Running'",
")",
"self",
".",
"_group_report",
"(",
"self",
".",
"completed",
",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BackgroundJobManager.remove | Remove a finished (completed or dead) job. | environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py | def remove(self,num):
"""Remove a finished (completed or dead) job."""
try:
job = self.all[num]
except KeyError:
error('Job #%s not found' % num)
else:
stat_code = job.stat_code
if stat_code == self._s_running:
error('Job #... | def remove(self,num):
"""Remove a finished (completed or dead) job."""
try:
job = self.all[num]
except KeyError:
error('Job #%s not found' % num)
else:
stat_code = job.stat_code
if stat_code == self._s_running:
error('Job #... | [
"Remove",
"a",
"finished",
"(",
"completed",
"or",
"dead",
")",
"job",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L292-L307 | [
"def",
"remove",
"(",
"self",
",",
"num",
")",
":",
"try",
":",
"job",
"=",
"self",
".",
"all",
"[",
"num",
"]",
"except",
"KeyError",
":",
"error",
"(",
"'Job #%s not found'",
"%",
"num",
")",
"else",
":",
"stat_code",
"=",
"job",
".",
"stat_code",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BackgroundJobManager.flush | Flush all finished jobs (completed and dead) from lists.
Running jobs are never flushed.
It first calls _status_new(), to update info. If any jobs have
completed since the last _status_new() call, the flush operation
aborts. | environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py | def flush(self):
"""Flush all finished jobs (completed and dead) from lists.
Running jobs are never flushed.
It first calls _status_new(), to update info. If any jobs have
completed since the last _status_new() call, the flush operation
aborts."""
# Remove the finished... | def flush(self):
"""Flush all finished jobs (completed and dead) from lists.
Running jobs are never flushed.
It first calls _status_new(), to update info. If any jobs have
completed since the last _status_new() call, the flush operation
aborts."""
# Remove the finished... | [
"Flush",
"all",
"finished",
"jobs",
"(",
"completed",
"and",
"dead",
")",
"from",
"lists",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L309-L327 | [
"def",
"flush",
"(",
"self",
")",
":",
"# Remove the finished jobs from the master dict",
"alljobs",
"=",
"self",
".",
"all",
"for",
"job",
"in",
"self",
".",
"completed",
"+",
"self",
".",
"dead",
":",
"del",
"(",
"alljobs",
"[",
"job",
".",
"num",
"]",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BackgroundJobManager.result | result(N) -> return the result of job N. | environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py | def result(self,num):
"""result(N) -> return the result of job N."""
try:
return self.all[num].result
except KeyError:
error('Job #%s not found' % num) | def result(self,num):
"""result(N) -> return the result of job N."""
try:
return self.all[num].result
except KeyError:
error('Job #%s not found' % num) | [
"result",
"(",
"N",
")",
"-",
">",
"return",
"the",
"result",
"of",
"job",
"N",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L329-L334 | [
"def",
"result",
"(",
"self",
",",
"num",
")",
":",
"try",
":",
"return",
"self",
".",
"all",
"[",
"num",
"]",
".",
"result",
"except",
"KeyError",
":",
"error",
"(",
"'Job #%s not found'",
"%",
"num",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BackgroundJobBase._init | Common initialization for all BackgroundJob objects | environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py | def _init(self):
"""Common initialization for all BackgroundJob objects"""
for attr in ['call','strform']:
assert hasattr(self,attr), "Missing attribute <%s>" % attr
# The num tag can be set by an external job manager
self.num = None
self.stat... | def _init(self):
"""Common initialization for all BackgroundJob objects"""
for attr in ['call','strform']:
assert hasattr(self,attr), "Missing attribute <%s>" % attr
# The num tag can be set by an external job manager
self.num = None
self.stat... | [
"Common",
"initialization",
"for",
"all",
"BackgroundJob",
"objects"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py#L381-L410 | [
"def",
"_init",
"(",
"self",
")",
":",
"for",
"attr",
"in",
"[",
"'call'",
",",
"'strform'",
"]",
":",
"assert",
"hasattr",
"(",
"self",
",",
"attr",
")",
",",
"\"Missing attribute <%s>\"",
"%",
"attr",
"# The num tag can be set by an external job manager",
"sel... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ListVariable.insert | Inserts a value in the ``ListVariable`` at an appropriate index.
:param idx: The index before which to insert the new value.
:param value: The value to insert. | timid/environment.py | def insert(self, idx, value):
"""
Inserts a value in the ``ListVariable`` at an appropriate index.
:param idx: The index before which to insert the new value.
:param value: The value to insert.
"""
self._value.insert(idx, value)
self._rebuild() | def insert(self, idx, value):
"""
Inserts a value in the ``ListVariable`` at an appropriate index.
:param idx: The index before which to insert the new value.
:param value: The value to insert.
"""
self._value.insert(idx, value)
self._rebuild() | [
"Inserts",
"a",
"value",
"in",
"the",
"ListVariable",
"at",
"an",
"appropriate",
"index",
"."
] | rackerlabs/timid | python | https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/environment.py#L179-L188 | [
"def",
"insert",
"(",
"self",
",",
"idx",
",",
"value",
")",
":",
"self",
".",
"_value",
".",
"insert",
"(",
"idx",
",",
"value",
")",
"self",
".",
"_rebuild",
"(",
")"
] | b1c6aa159ab380a033740f4aa392cf0d125e0ac6 |
test | Environment.copy | Retrieve a copy of the Environment. Note that this is a shallow
copy. | timid/environment.py | def copy(self):
"""
Retrieve a copy of the Environment. Note that this is a shallow
copy.
"""
return self.__class__(self._data.copy(), self._sensitive.copy(),
self._cwd) | def copy(self):
"""
Retrieve a copy of the Environment. Note that this is a shallow
copy.
"""
return self.__class__(self._data.copy(), self._sensitive.copy(),
self._cwd) | [
"Retrieve",
"a",
"copy",
"of",
"the",
"Environment",
".",
"Note",
"that",
"this",
"is",
"a",
"shallow",
"copy",
"."
] | rackerlabs/timid | python | https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/environment.py#L365-L372 | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"_data",
".",
"copy",
"(",
")",
",",
"self",
".",
"_sensitive",
".",
"copy",
"(",
")",
",",
"self",
".",
"_cwd",
")"
] | b1c6aa159ab380a033740f4aa392cf0d125e0ac6 |
test | Environment._declare_special | Declare an environment variable as a special variable. This can
be used even if the environment variable is not present.
:param name: The name of the environment variable that should
be considered special.
:param sep: The separator to be used.
:param klass: The sub... | timid/environment.py | def _declare_special(self, name, sep, klass):
"""
Declare an environment variable as a special variable. This can
be used even if the environment variable is not present.
:param name: The name of the environment variable that should
be considered special.
:... | def _declare_special(self, name, sep, klass):
"""
Declare an environment variable as a special variable. This can
be used even if the environment variable is not present.
:param name: The name of the environment variable that should
be considered special.
:... | [
"Declare",
"an",
"environment",
"variable",
"as",
"a",
"special",
"variable",
".",
"This",
"can",
"be",
"used",
"even",
"if",
"the",
"environment",
"variable",
"is",
"not",
"present",
"."
] | rackerlabs/timid | python | https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/environment.py#L374-L397 | [
"def",
"_declare_special",
"(",
"self",
",",
"name",
",",
"sep",
",",
"klass",
")",
":",
"# First, has it already been declared?",
"if",
"name",
"in",
"self",
".",
"_special",
":",
"special",
"=",
"self",
".",
"_special",
"[",
"name",
"]",
"if",
"not",
"is... | b1c6aa159ab380a033740f4aa392cf0d125e0ac6 |
test | Environment.declare_list | Declare an environment variable as a list-like special variable.
This can be used even if the environment variable is not
present.
:param name: The name of the environment variable that should
be considered list-like.
:param sep: The separator to be used. Defaults ... | timid/environment.py | def declare_list(self, name, sep=os.pathsep):
"""
Declare an environment variable as a list-like special variable.
This can be used even if the environment variable is not
present.
:param name: The name of the environment variable that should
be considered l... | def declare_list(self, name, sep=os.pathsep):
"""
Declare an environment variable as a list-like special variable.
This can be used even if the environment variable is not
present.
:param name: The name of the environment variable that should
be considered l... | [
"Declare",
"an",
"environment",
"variable",
"as",
"a",
"list",
"-",
"like",
"special",
"variable",
".",
"This",
"can",
"be",
"used",
"even",
"if",
"the",
"environment",
"variable",
"is",
"not",
"present",
"."
] | rackerlabs/timid | python | https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/environment.py#L399-L411 | [
"def",
"declare_list",
"(",
"self",
",",
"name",
",",
"sep",
"=",
"os",
".",
"pathsep",
")",
":",
"self",
".",
"_declare_special",
"(",
"name",
",",
"sep",
",",
"ListVariable",
")"
] | b1c6aa159ab380a033740f4aa392cf0d125e0ac6 |
test | Environment.declare_set | Declare an environment variable as a set-like special variable.
This can be used even if the environment variable is not
present.
:param name: The name of the environment variable that should
be considered set-like.
:param sep: The separator to be used. Defaults to... | timid/environment.py | def declare_set(self, name, sep=os.pathsep):
"""
Declare an environment variable as a set-like special variable.
This can be used even if the environment variable is not
present.
:param name: The name of the environment variable that should
be considered set... | def declare_set(self, name, sep=os.pathsep):
"""
Declare an environment variable as a set-like special variable.
This can be used even if the environment variable is not
present.
:param name: The name of the environment variable that should
be considered set... | [
"Declare",
"an",
"environment",
"variable",
"as",
"a",
"set",
"-",
"like",
"special",
"variable",
".",
"This",
"can",
"be",
"used",
"even",
"if",
"the",
"environment",
"variable",
"is",
"not",
"present",
"."
] | rackerlabs/timid | python | https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/environment.py#L413-L425 | [
"def",
"declare_set",
"(",
"self",
",",
"name",
",",
"sep",
"=",
"os",
".",
"pathsep",
")",
":",
"self",
".",
"_declare_special",
"(",
"name",
",",
"sep",
",",
"SetVariable",
")"
] | b1c6aa159ab380a033740f4aa392cf0d125e0ac6 |
test | Environment.call | A thin wrapper around ``subprocess.Popen``. Takes the same
options as ``subprocess.Popen``, with the exception of the
``cwd``, and ``env`` parameters, which come from the
``Environment`` instance. Note that if the sole positional
argument is a string, it will be converted into a sequen... | timid/environment.py | def call(self, args, **kwargs):
"""
A thin wrapper around ``subprocess.Popen``. Takes the same
options as ``subprocess.Popen``, with the exception of the
``cwd``, and ``env`` parameters, which come from the
``Environment`` instance. Note that if the sole positional
argu... | def call(self, args, **kwargs):
"""
A thin wrapper around ``subprocess.Popen``. Takes the same
options as ``subprocess.Popen``, with the exception of the
``cwd``, and ``env`` parameters, which come from the
``Environment`` instance. Note that if the sole positional
argu... | [
"A",
"thin",
"wrapper",
"around",
"subprocess",
".",
"Popen",
".",
"Takes",
"the",
"same",
"options",
"as",
"subprocess",
".",
"Popen",
"with",
"the",
"exception",
"of",
"the",
"cwd",
"and",
"env",
"parameters",
"which",
"come",
"from",
"the",
"Environment",... | rackerlabs/timid | python | https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/environment.py#L427-L448 | [
"def",
"call",
"(",
"self",
",",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Convert string args into a sequence",
"if",
"isinstance",
"(",
"args",
",",
"six",
".",
"string_types",
")",
":",
"args",
"=",
"shlex",
".",
"split",
"(",
"args",
")",
"# Subs... | b1c6aa159ab380a033740f4aa392cf0d125e0ac6 |
test | Environment.cwd | Change the working directory that processes should be executed in.
:param value: The new path to change to. If relative, will be
interpreted relative to the current working
directory. | timid/environment.py | def cwd(self, value):
"""
Change the working directory that processes should be executed in.
:param value: The new path to change to. If relative, will be
interpreted relative to the current working
directory.
"""
self._cwd = utils.c... | def cwd(self, value):
"""
Change the working directory that processes should be executed in.
:param value: The new path to change to. If relative, will be
interpreted relative to the current working
directory.
"""
self._cwd = utils.c... | [
"Change",
"the",
"working",
"directory",
"that",
"processes",
"should",
"be",
"executed",
"in",
"."
] | rackerlabs/timid | python | https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/environment.py#L460-L469 | [
"def",
"cwd",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_cwd",
"=",
"utils",
".",
"canonicalize_path",
"(",
"self",
".",
"_cwd",
",",
"value",
")"
] | b1c6aa159ab380a033740f4aa392cf0d125e0ac6 |
test | TSPProblem.move | Swaps two cities in the route.
:type state: TSPState | pyrallelsa/examples/tsp/__init__.py | def move(self, state=None):
"""Swaps two cities in the route.
:type state: TSPState
"""
state = self.state if state is None else state
route = state
a = random.randint(self.locked_range, len(route) - 1)
b = random.randint(self.locked_range, len(route) - 1)
... | def move(self, state=None):
"""Swaps two cities in the route.
:type state: TSPState
"""
state = self.state if state is None else state
route = state
a = random.randint(self.locked_range, len(route) - 1)
b = random.randint(self.locked_range, len(route) - 1)
... | [
"Swaps",
"two",
"cities",
"in",
"the",
"route",
"."
] | mesos-magellan/pyrallelsa | python | https://github.com/mesos-magellan/pyrallelsa/blob/bbdeefd0c7ea4fd9a2e29624bf1b21e3da039cb1/pyrallelsa/examples/tsp/__init__.py#L84-L93 | [
"def",
"move",
"(",
"self",
",",
"state",
"=",
"None",
")",
":",
"state",
"=",
"self",
".",
"state",
"if",
"state",
"is",
"None",
"else",
"state",
"route",
"=",
"state",
"a",
"=",
"random",
".",
"randint",
"(",
"self",
".",
"locked_range",
",",
"le... | bbdeefd0c7ea4fd9a2e29624bf1b21e3da039cb1 |
test | TSPProblem.energy | Calculates the length of the route. | pyrallelsa/examples/tsp/__init__.py | def energy(self, state=None):
"""Calculates the length of the route."""
state = self.state if state is None else state
route = state
e = 0
if self.distance_matrix:
for i in range(len(route)):
e += self.distance_matrix["{},{}".format(route[i-1], route[i... | def energy(self, state=None):
"""Calculates the length of the route."""
state = self.state if state is None else state
route = state
e = 0
if self.distance_matrix:
for i in range(len(route)):
e += self.distance_matrix["{},{}".format(route[i-1], route[i... | [
"Calculates",
"the",
"length",
"of",
"the",
"route",
"."
] | mesos-magellan/pyrallelsa | python | https://github.com/mesos-magellan/pyrallelsa/blob/bbdeefd0c7ea4fd9a2e29624bf1b21e3da039cb1/pyrallelsa/examples/tsp/__init__.py#L95-L106 | [
"def",
"energy",
"(",
"self",
",",
"state",
"=",
"None",
")",
":",
"state",
"=",
"self",
".",
"state",
"if",
"state",
"is",
"None",
"else",
"state",
"route",
"=",
"state",
"e",
"=",
"0",
"if",
"self",
".",
"distance_matrix",
":",
"for",
"i",
"in",
... | bbdeefd0c7ea4fd9a2e29624bf1b21e3da039cb1 |
test | TSPProblem.divide | divide
:type problem_data: dict | pyrallelsa/examples/tsp/__init__.py | def divide(cls, divisions, problem_data):
"""divide
:type problem_data: dict
"""
tspp = TSPProblem(**problem_data)
def routes_for_subgroup(cs):
for city in cs:
if city == tspp.start_city:
continue
cities = tspp.cit... | def divide(cls, divisions, problem_data):
"""divide
:type problem_data: dict
"""
tspp = TSPProblem(**problem_data)
def routes_for_subgroup(cs):
for city in cs:
if city == tspp.start_city:
continue
cities = tspp.cit... | [
"divide"
] | mesos-magellan/pyrallelsa | python | https://github.com/mesos-magellan/pyrallelsa/blob/bbdeefd0c7ea4fd9a2e29624bf1b21e3da039cb1/pyrallelsa/examples/tsp/__init__.py#L109-L136 | [
"def",
"divide",
"(",
"cls",
",",
"divisions",
",",
"problem_data",
")",
":",
"tspp",
"=",
"TSPProblem",
"(",
"*",
"*",
"problem_data",
")",
"def",
"routes_for_subgroup",
"(",
"cs",
")",
":",
"for",
"city",
"in",
"cs",
":",
"if",
"city",
"==",
"tspp",
... | bbdeefd0c7ea4fd9a2e29624bf1b21e3da039cb1 |
test | SQLiteDB._defaults | create an empty record | environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py | def _defaults(self, keys=None):
"""create an empty record"""
d = {}
keys = self._keys if keys is None else keys
for key in keys:
d[key] = None
return d | def _defaults(self, keys=None):
"""create an empty record"""
d = {}
keys = self._keys if keys is None else keys
for key in keys:
d[key] = None
return d | [
"create",
"an",
"empty",
"record"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py#L181-L187 | [
"def",
"_defaults",
"(",
"self",
",",
"keys",
"=",
"None",
")",
":",
"d",
"=",
"{",
"}",
"keys",
"=",
"self",
".",
"_keys",
"if",
"keys",
"is",
"None",
"else",
"keys",
"for",
"key",
"in",
"keys",
":",
"d",
"[",
"key",
"]",
"=",
"None",
"return"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | SQLiteDB._check_table | Ensure that an incorrect table doesn't exist
If a bad (old) table does exist, return False | environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py | def _check_table(self):
"""Ensure that an incorrect table doesn't exist
If a bad (old) table does exist, return False
"""
cursor = self._db.execute("PRAGMA table_info(%s)"%self.table)
lines = cursor.fetchall()
if not lines:
# table does not exist
... | def _check_table(self):
"""Ensure that an incorrect table doesn't exist
If a bad (old) table does exist, return False
"""
cursor = self._db.execute("PRAGMA table_info(%s)"%self.table)
lines = cursor.fetchall()
if not lines:
# table does not exist
... | [
"Ensure",
"that",
"an",
"incorrect",
"table",
"doesn",
"t",
"exist"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py#L189-L214 | [
"def",
"_check_table",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"_db",
".",
"execute",
"(",
"\"PRAGMA table_info(%s)\"",
"%",
"self",
".",
"table",
")",
"lines",
"=",
"cursor",
".",
"fetchall",
"(",
")",
"if",
"not",
"lines",
":",
"# table does... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | SQLiteDB._init_db | Connect to the database and get new session number. | environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py | def _init_db(self):
"""Connect to the database and get new session number."""
# register adapters
sqlite3.register_adapter(dict, _adapt_dict)
sqlite3.register_converter('dict', _convert_dict)
sqlite3.register_adapter(list, _adapt_bufs)
sqlite3.register_converter('bufs', _... | def _init_db(self):
"""Connect to the database and get new session number."""
# register adapters
sqlite3.register_adapter(dict, _adapt_dict)
sqlite3.register_converter('dict', _convert_dict)
sqlite3.register_adapter(list, _adapt_bufs)
sqlite3.register_converter('bufs', _... | [
"Connect",
"to",
"the",
"database",
"and",
"get",
"new",
"session",
"number",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py#L216-L262 | [
"def",
"_init_db",
"(",
"self",
")",
":",
"# register adapters",
"sqlite3",
".",
"register_adapter",
"(",
"dict",
",",
"_adapt_dict",
")",
"sqlite3",
".",
"register_converter",
"(",
"'dict'",
",",
"_convert_dict",
")",
"sqlite3",
".",
"register_adapter",
"(",
"l... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | SQLiteDB._list_to_dict | Inverse of dict_to_list | environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py | def _list_to_dict(self, line, keys=None):
"""Inverse of dict_to_list"""
keys = self._keys if keys is None else keys
d = self._defaults(keys)
for key,value in zip(keys, line):
d[key] = value
return d | def _list_to_dict(self, line, keys=None):
"""Inverse of dict_to_list"""
keys = self._keys if keys is None else keys
d = self._defaults(keys)
for key,value in zip(keys, line):
d[key] = value
return d | [
"Inverse",
"of",
"dict_to_list"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py#L269-L276 | [
"def",
"_list_to_dict",
"(",
"self",
",",
"line",
",",
"keys",
"=",
"None",
")",
":",
"keys",
"=",
"self",
".",
"_keys",
"if",
"keys",
"is",
"None",
"else",
"keys",
"d",
"=",
"self",
".",
"_defaults",
"(",
"keys",
")",
"for",
"key",
",",
"value",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | SQLiteDB._render_expression | Turn a mongodb-style search dict into an SQL query. | environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py | def _render_expression(self, check):
"""Turn a mongodb-style search dict into an SQL query."""
expressions = []
args = []
skeys = set(check.keys())
skeys.difference_update(set(self._keys))
skeys.difference_update(set(['buffers', 'result_buffers']))
if skeys:
... | def _render_expression(self, check):
"""Turn a mongodb-style search dict into an SQL query."""
expressions = []
args = []
skeys = set(check.keys())
skeys.difference_update(set(self._keys))
skeys.difference_update(set(['buffers', 'result_buffers']))
if skeys:
... | [
"Turn",
"a",
"mongodb",
"-",
"style",
"search",
"dict",
"into",
"an",
"SQL",
"query",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py#L278-L321 | [
"def",
"_render_expression",
"(",
"self",
",",
"check",
")",
":",
"expressions",
"=",
"[",
"]",
"args",
"=",
"[",
"]",
"skeys",
"=",
"set",
"(",
"check",
".",
"keys",
"(",
")",
")",
"skeys",
".",
"difference_update",
"(",
"set",
"(",
"self",
".",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | SQLiteDB.add_record | Add a new Task Record, by msg_id. | environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py | def add_record(self, msg_id, rec):
"""Add a new Task Record, by msg_id."""
d = self._defaults()
d.update(rec)
d['msg_id'] = msg_id
line = self._dict_to_list(d)
tups = '(%s)'%(','.join(['?']*len(line)))
self._db.execute("INSERT INTO %s VALUES %s"%(self.table, tups)... | def add_record(self, msg_id, rec):
"""Add a new Task Record, by msg_id."""
d = self._defaults()
d.update(rec)
d['msg_id'] = msg_id
line = self._dict_to_list(d)
tups = '(%s)'%(','.join(['?']*len(line)))
self._db.execute("INSERT INTO %s VALUES %s"%(self.table, tups)... | [
"Add",
"a",
"new",
"Task",
"Record",
"by",
"msg_id",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py#L323-L330 | [
"def",
"add_record",
"(",
"self",
",",
"msg_id",
",",
"rec",
")",
":",
"d",
"=",
"self",
".",
"_defaults",
"(",
")",
"d",
".",
"update",
"(",
"rec",
")",
"d",
"[",
"'msg_id'",
"]",
"=",
"msg_id",
"line",
"=",
"self",
".",
"_dict_to_list",
"(",
"d... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | SQLiteDB.get_record | Get a specific Task Record, by msg_id. | environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py | def get_record(self, msg_id):
"""Get a specific Task Record, by msg_id."""
cursor = self._db.execute("""SELECT * FROM %s WHERE msg_id==?"""%self.table, (msg_id,))
line = cursor.fetchone()
if line is None:
raise KeyError("No such msg: %r"%msg_id)
return self._list_to_d... | def get_record(self, msg_id):
"""Get a specific Task Record, by msg_id."""
cursor = self._db.execute("""SELECT * FROM %s WHERE msg_id==?"""%self.table, (msg_id,))
line = cursor.fetchone()
if line is None:
raise KeyError("No such msg: %r"%msg_id)
return self._list_to_d... | [
"Get",
"a",
"specific",
"Task",
"Record",
"by",
"msg_id",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py#L333-L339 | [
"def",
"get_record",
"(",
"self",
",",
"msg_id",
")",
":",
"cursor",
"=",
"self",
".",
"_db",
".",
"execute",
"(",
"\"\"\"SELECT * FROM %s WHERE msg_id==?\"\"\"",
"%",
"self",
".",
"table",
",",
"(",
"msg_id",
",",
")",
")",
"line",
"=",
"cursor",
".",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | SQLiteDB.update_record | Update the data in an existing record. | environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py | def update_record(self, msg_id, rec):
"""Update the data in an existing record."""
query = "UPDATE %s SET "%self.table
sets = []
keys = sorted(rec.keys())
values = []
for key in keys:
sets.append('%s = ?'%key)
values.append(rec[key])
query ... | def update_record(self, msg_id, rec):
"""Update the data in an existing record."""
query = "UPDATE %s SET "%self.table
sets = []
keys = sorted(rec.keys())
values = []
for key in keys:
sets.append('%s = ?'%key)
values.append(rec[key])
query ... | [
"Update",
"the",
"data",
"in",
"an",
"existing",
"record",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py#L341-L353 | [
"def",
"update_record",
"(",
"self",
",",
"msg_id",
",",
"rec",
")",
":",
"query",
"=",
"\"UPDATE %s SET \"",
"%",
"self",
".",
"table",
"sets",
"=",
"[",
"]",
"keys",
"=",
"sorted",
"(",
"rec",
".",
"keys",
"(",
")",
")",
"values",
"=",
"[",
"]",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | SQLiteDB.drop_matching_records | Remove a record from the DB. | environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py | def drop_matching_records(self, check):
"""Remove a record from the DB."""
expr,args = self._render_expression(check)
query = "DELETE FROM %s WHERE %s"%(self.table, expr)
self._db.execute(query,args) | def drop_matching_records(self, check):
"""Remove a record from the DB."""
expr,args = self._render_expression(check)
query = "DELETE FROM %s WHERE %s"%(self.table, expr)
self._db.execute(query,args) | [
"Remove",
"a",
"record",
"from",
"the",
"DB",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py#L361-L365 | [
"def",
"drop_matching_records",
"(",
"self",
",",
"check",
")",
":",
"expr",
",",
"args",
"=",
"self",
".",
"_render_expression",
"(",
"check",
")",
"query",
"=",
"\"DELETE FROM %s WHERE %s\"",
"%",
"(",
"self",
".",
"table",
",",
"expr",
")",
"self",
".",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | SQLiteDB.find_records | Find records matching a query dict, optionally extracting subset of keys.
Returns list of matching records.
Parameters
----------
check: dict
mongodb-style query argument
keys: list of strs [optional]
if specified, the subset of keys to extract. msg_id... | environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py | def find_records(self, check, keys=None):
"""Find records matching a query dict, optionally extracting subset of keys.
Returns list of matching records.
Parameters
----------
check: dict
mongodb-style query argument
keys: list of strs [optional]
... | def find_records(self, check, keys=None):
"""Find records matching a query dict, optionally extracting subset of keys.
Returns list of matching records.
Parameters
----------
check: dict
mongodb-style query argument
keys: list of strs [optional]
... | [
"Find",
"records",
"matching",
"a",
"query",
"dict",
"optionally",
"extracting",
"subset",
"of",
"keys",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py#L368-L403 | [
"def",
"find_records",
"(",
"self",
",",
"check",
",",
"keys",
"=",
"None",
")",
":",
"if",
"keys",
":",
"bad_keys",
"=",
"[",
"key",
"for",
"key",
"in",
"keys",
"if",
"key",
"not",
"in",
"self",
".",
"_keys",
"]",
"if",
"bad_keys",
":",
"raise",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | SQLiteDB.get_history | get all msg_ids, ordered by time submitted. | environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py | def get_history(self):
"""get all msg_ids, ordered by time submitted."""
query = """SELECT msg_id FROM %s ORDER by submitted ASC"""%self.table
cursor = self._db.execute(query)
# will be a list of length 1 tuples
return [ tup[0] for tup in cursor.fetchall()] | def get_history(self):
"""get all msg_ids, ordered by time submitted."""
query = """SELECT msg_id FROM %s ORDER by submitted ASC"""%self.table
cursor = self._db.execute(query)
# will be a list of length 1 tuples
return [ tup[0] for tup in cursor.fetchall()] | [
"get",
"all",
"msg_ids",
"ordered",
"by",
"time",
"submitted",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/sqlitedb.py#L405-L410 | [
"def",
"get_history",
"(",
"self",
")",
":",
"query",
"=",
"\"\"\"SELECT msg_id FROM %s ORDER by submitted ASC\"\"\"",
"%",
"self",
".",
"table",
"cursor",
"=",
"self",
".",
"_db",
".",
"execute",
"(",
"query",
")",
"# will be a list of length 1 tuples",
"return",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | warn | Standard warning printer. Gives formatting consistency.
Output is sent to io.stderr (sys.stderr by default).
Options:
-level(2): allows finer control:
0 -> Do nothing, dummy function.
1 -> Print message.
2 -> Print 'WARNING:' + message. (Default level).
3 -> Print 'ERROR:' + messa... | environment/lib/python2.7/site-packages/IPython/utils/warn.py | def warn(msg,level=2,exit_val=1):
"""Standard warning printer. Gives formatting consistency.
Output is sent to io.stderr (sys.stderr by default).
Options:
-level(2): allows finer control:
0 -> Do nothing, dummy function.
1 -> Print message.
2 -> Print 'WARNING:' + message. (Default ... | def warn(msg,level=2,exit_val=1):
"""Standard warning printer. Gives formatting consistency.
Output is sent to io.stderr (sys.stderr by default).
Options:
-level(2): allows finer control:
0 -> Do nothing, dummy function.
1 -> Print message.
2 -> Print 'WARNING:' + message. (Default ... | [
"Standard",
"warning",
"printer",
".",
"Gives",
"formatting",
"consistency",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/warn.py#L25-L47 | [
"def",
"warn",
"(",
"msg",
",",
"level",
"=",
"2",
",",
"exit_val",
"=",
"1",
")",
":",
"if",
"level",
">",
"0",
":",
"header",
"=",
"[",
"''",
",",
"''",
",",
"'WARNING: '",
",",
"'ERROR: '",
",",
"'FATAL ERROR: '",
"]",
"io",
".",
"stderr",
"."... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Reader.parse | Read a config_file, check the validity with a JSON Schema as specs
and get default values from default_file if asked.
All parameters are optionnal.
If there is no config_file defined, read the venv base
dir and try to get config/app.yml.
If no specs, don't validate anything.
... | impulsare_config/reader.py | def parse(self, config_file=None, specs=None, default_file=None):
"""Read a config_file, check the validity with a JSON Schema as specs
and get default values from default_file if asked.
All parameters are optionnal.
If there is no config_file defined, read the venv base
dir an... | def parse(self, config_file=None, specs=None, default_file=None):
"""Read a config_file, check the validity with a JSON Schema as specs
and get default values from default_file if asked.
All parameters are optionnal.
If there is no config_file defined, read the venv base
dir an... | [
"Read",
"a",
"config_file",
"check",
"the",
"validity",
"with",
"a",
"JSON",
"Schema",
"as",
"specs",
"and",
"get",
"default",
"values",
"from",
"default_file",
"if",
"asked",
"."
] | impulsare/config | python | https://github.com/impulsare/config/blob/cc9a043d389c132ac42c987fe4740f84c74f53a2/impulsare_config/reader.py#L10-L36 | [
"def",
"parse",
"(",
"self",
",",
"config_file",
"=",
"None",
",",
"specs",
"=",
"None",
",",
"default_file",
"=",
"None",
")",
":",
"self",
".",
"_config_exists",
"(",
"config_file",
")",
"self",
".",
"_specs_exists",
"(",
"specs",
")",
"self",
".",
"... | cc9a043d389c132ac42c987fe4740f84c74f53a2 |
test | table | Output a simple table with several columns. | django_baseline/templatetags/helpers.py | def table(rows):
'''
Output a simple table with several columns.
'''
output = '<table>'
for row in rows:
output += '<tr>'
for column in row:
output += '<td>{s}</td>'.format(s=column)
output += '</tr>'
output += '</table>'
return output | def table(rows):
'''
Output a simple table with several columns.
'''
output = '<table>'
for row in rows:
output += '<tr>'
for column in row:
output += '<td>{s}</td>'.format(s=column)
output += '</tr>'
output += '</table>'
return output | [
"Output",
"a",
"simple",
"table",
"with",
"several",
"columns",
"."
] | theduke/django-baseline | python | https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L18-L33 | [
"def",
"table",
"(",
"rows",
")",
":",
"output",
"=",
"'<table>'",
"for",
"row",
"in",
"rows",
":",
"output",
"+=",
"'<tr>'",
"for",
"column",
"in",
"row",
":",
"output",
"+=",
"'<td>{s}</td>'",
".",
"format",
"(",
"s",
"=",
"column",
")",
"output",
... | 7be8b956e53c70b35f34e1783a8fe8f716955afb |
test | link | Output a link tag. | django_baseline/templatetags/helpers.py | def link(url, text='', classes='', target='', get="", **kwargs):
'''
Output a link tag.
'''
if not (url.startswith('http') or url.startswith('/')):
# Handle additional reverse args.
urlargs = {}
for arg, val in kwargs.items():
if arg[:4] == "url_":
u... | def link(url, text='', classes='', target='', get="", **kwargs):
'''
Output a link tag.
'''
if not (url.startswith('http') or url.startswith('/')):
# Handle additional reverse args.
urlargs = {}
for arg, val in kwargs.items():
if arg[:4] == "url_":
u... | [
"Output",
"a",
"link",
"tag",
"."
] | theduke/django-baseline | python | https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L36-L54 | [
"def",
"link",
"(",
"url",
",",
"text",
"=",
"''",
",",
"classes",
"=",
"''",
",",
"target",
"=",
"''",
",",
"get",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"(",
"url",
".",
"startswith",
"(",
"'http'",
")",
"or",
"url",
"... | 7be8b956e53c70b35f34e1783a8fe8f716955afb |
test | jsfile | Output a script tag to a js file. | django_baseline/templatetags/helpers.py | def jsfile(url):
'''
Output a script tag to a js file.
'''
if not url.startswith('http://') and not url[:1] == '/':
#add media_url for relative paths
url = settings.STATIC_URL + url
return '<script type="text/javascript" src="{src}"></script>'.format(
src=url) | def jsfile(url):
'''
Output a script tag to a js file.
'''
if not url.startswith('http://') and not url[:1] == '/':
#add media_url for relative paths
url = settings.STATIC_URL + url
return '<script type="text/javascript" src="{src}"></script>'.format(
src=url) | [
"Output",
"a",
"script",
"tag",
"to",
"a",
"js",
"file",
"."
] | theduke/django-baseline | python | https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L58-L68 | [
"def",
"jsfile",
"(",
"url",
")",
":",
"if",
"not",
"url",
".",
"startswith",
"(",
"'http://'",
")",
"and",
"not",
"url",
"[",
":",
"1",
"]",
"==",
"'/'",
":",
"#add media_url for relative paths",
"url",
"=",
"settings",
".",
"STATIC_URL",
"+",
"url",
... | 7be8b956e53c70b35f34e1783a8fe8f716955afb |
test | cssfile | Output a link tag to a css stylesheet. | django_baseline/templatetags/helpers.py | def cssfile(url):
'''
Output a link tag to a css stylesheet.
'''
if not url.startswith('http://') and not url[:1] == '/':
#add media_url for relative paths
url = settings.STATIC_URL + url
return '<link href="{src}" rel="stylesheet">'.format(src=url) | def cssfile(url):
'''
Output a link tag to a css stylesheet.
'''
if not url.startswith('http://') and not url[:1] == '/':
#add media_url for relative paths
url = settings.STATIC_URL + url
return '<link href="{src}" rel="stylesheet">'.format(src=url) | [
"Output",
"a",
"link",
"tag",
"to",
"a",
"css",
"stylesheet",
"."
] | theduke/django-baseline | python | https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L72-L81 | [
"def",
"cssfile",
"(",
"url",
")",
":",
"if",
"not",
"url",
".",
"startswith",
"(",
"'http://'",
")",
"and",
"not",
"url",
"[",
":",
"1",
"]",
"==",
"'/'",
":",
"#add media_url for relative paths",
"url",
"=",
"settings",
".",
"STATIC_URL",
"+",
"url",
... | 7be8b956e53c70b35f34e1783a8fe8f716955afb |
test | img | Image tag helper. | django_baseline/templatetags/helpers.py | def img(url, alt='', classes='', style=''):
'''
Image tag helper.
'''
if not url.startswith('http://') and not url[:1] == '/':
#add media_url for relative paths
url = settings.STATIC_URL + url
attr = {
'class': classes,
'alt': alt,
'style': style,
's... | def img(url, alt='', classes='', style=''):
'''
Image tag helper.
'''
if not url.startswith('http://') and not url[:1] == '/':
#add media_url for relative paths
url = settings.STATIC_URL + url
attr = {
'class': classes,
'alt': alt,
'style': style,
's... | [
"Image",
"tag",
"helper",
"."
] | theduke/django-baseline | python | https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L85-L101 | [
"def",
"img",
"(",
"url",
",",
"alt",
"=",
"''",
",",
"classes",
"=",
"''",
",",
"style",
"=",
"''",
")",
":",
"if",
"not",
"url",
".",
"startswith",
"(",
"'http://'",
")",
"and",
"not",
"url",
"[",
":",
"1",
"]",
"==",
"'/'",
":",
"#add media_... | 7be8b956e53c70b35f34e1783a8fe8f716955afb |
test | sub | Subtract the arg from the value. | django_baseline/templatetags/helpers.py | def sub(value, arg):
"""Subtract the arg from the value."""
try:
return valid_numeric(value) - valid_numeric(arg)
except (ValueError, TypeError):
try:
return value - arg
except Exception:
return '' | def sub(value, arg):
"""Subtract the arg from the value."""
try:
return valid_numeric(value) - valid_numeric(arg)
except (ValueError, TypeError):
try:
return value - arg
except Exception:
return '' | [
"Subtract",
"the",
"arg",
"from",
"the",
"value",
"."
] | theduke/django-baseline | python | https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L114-L122 | [
"def",
"sub",
"(",
"value",
",",
"arg",
")",
":",
"try",
":",
"return",
"valid_numeric",
"(",
"value",
")",
"-",
"valid_numeric",
"(",
"arg",
")",
"except",
"(",
"ValueError",
",",
"TypeError",
")",
":",
"try",
":",
"return",
"value",
"-",
"arg",
"ex... | 7be8b956e53c70b35f34e1783a8fe8f716955afb |
test | mul | Multiply the arg with the value. | django_baseline/templatetags/helpers.py | def mul(value, arg):
"""Multiply the arg with the value."""
try:
return valid_numeric(value) * valid_numeric(arg)
except (ValueError, TypeError):
try:
return value * arg
except Exception:
return '' | def mul(value, arg):
"""Multiply the arg with the value."""
try:
return valid_numeric(value) * valid_numeric(arg)
except (ValueError, TypeError):
try:
return value * arg
except Exception:
return '' | [
"Multiply",
"the",
"arg",
"with",
"the",
"value",
"."
] | theduke/django-baseline | python | https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L127-L135 | [
"def",
"mul",
"(",
"value",
",",
"arg",
")",
":",
"try",
":",
"return",
"valid_numeric",
"(",
"value",
")",
"*",
"valid_numeric",
"(",
"arg",
")",
"except",
"(",
"ValueError",
",",
"TypeError",
")",
":",
"try",
":",
"return",
"value",
"*",
"arg",
"ex... | 7be8b956e53c70b35f34e1783a8fe8f716955afb |
test | div | Divide the arg by the value. | django_baseline/templatetags/helpers.py | def div(value, arg):
"""Divide the arg by the value."""
try:
return valid_numeric(value) / valid_numeric(arg)
except (ValueError, TypeError):
try:
return value / arg
except Exception:
return '' | def div(value, arg):
"""Divide the arg by the value."""
try:
return valid_numeric(value) / valid_numeric(arg)
except (ValueError, TypeError):
try:
return value / arg
except Exception:
return '' | [
"Divide",
"the",
"arg",
"by",
"the",
"value",
"."
] | theduke/django-baseline | python | https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L140-L148 | [
"def",
"div",
"(",
"value",
",",
"arg",
")",
":",
"try",
":",
"return",
"valid_numeric",
"(",
"value",
")",
"/",
"valid_numeric",
"(",
"arg",
")",
"except",
"(",
"ValueError",
",",
"TypeError",
")",
":",
"try",
":",
"return",
"value",
"/",
"arg",
"ex... | 7be8b956e53c70b35f34e1783a8fe8f716955afb |
test | mod | Return the modulo value. | django_baseline/templatetags/helpers.py | def mod(value, arg):
"""Return the modulo value."""
try:
return valid_numeric(value) % valid_numeric(arg)
except (ValueError, TypeError):
try:
return value % arg
except Exception:
return '' | def mod(value, arg):
"""Return the modulo value."""
try:
return valid_numeric(value) % valid_numeric(arg)
except (ValueError, TypeError):
try:
return value % arg
except Exception:
return '' | [
"Return",
"the",
"modulo",
"value",
"."
] | theduke/django-baseline | python | https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L166-L174 | [
"def",
"mod",
"(",
"value",
",",
"arg",
")",
":",
"try",
":",
"return",
"valid_numeric",
"(",
"value",
")",
"%",
"valid_numeric",
"(",
"arg",
")",
"except",
"(",
"ValueError",
",",
"TypeError",
")",
":",
"try",
":",
"return",
"value",
"%",
"arg",
"ex... | 7be8b956e53c70b35f34e1783a8fe8f716955afb |
test | model_verbose | Return the verbose name of a model.
The obj argument can be either a Model instance, or a ModelForm instance.
This allows to retrieve the verbose name of the model of a ModelForm
easily, without adding extra context vars. | django_baseline/templatetags/helpers.py | def model_verbose(obj, capitalize=True):
"""
Return the verbose name of a model.
The obj argument can be either a Model instance, or a ModelForm instance.
This allows to retrieve the verbose name of the model of a ModelForm
easily, without adding extra context vars.
"""
if isinstance(obj, M... | def model_verbose(obj, capitalize=True):
"""
Return the verbose name of a model.
The obj argument can be either a Model instance, or a ModelForm instance.
This allows to retrieve the verbose name of the model of a ModelForm
easily, without adding extra context vars.
"""
if isinstance(obj, M... | [
"Return",
"the",
"verbose",
"name",
"of",
"a",
"model",
".",
"The",
"obj",
"argument",
"can",
"be",
"either",
"a",
"Model",
"instance",
"or",
"a",
"ModelForm",
"instance",
".",
"This",
"allows",
"to",
"retrieve",
"the",
"verbose",
"name",
"of",
"the",
"m... | theduke/django-baseline | python | https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/templatetags/helpers.py#L181-L196 | [
"def",
"model_verbose",
"(",
"obj",
",",
"capitalize",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"ModelForm",
")",
":",
"name",
"=",
"obj",
".",
"_meta",
".",
"model",
".",
"_meta",
".",
"verbose_name",
"elif",
"isinstance",
"(",
"obj... | 7be8b956e53c70b35f34e1783a8fe8f716955afb |
test | extendManager | Use as a class decorator to add extra methods to your model manager.
Example usage:
class Article(django.db.models.Model):
published = models.DateTimeField()
...
@extendManager
class objects(object):
def getPublished(self):
return self.filter(published__lte = django.utils.timezone.now()).order... | django_libretto/models.py | def extendManager(mixinClass):
'''
Use as a class decorator to add extra methods to your model manager.
Example usage:
class Article(django.db.models.Model):
published = models.DateTimeField()
...
@extendManager
class objects(object):
def getPublished(self):
return self.filter(published__lte... | def extendManager(mixinClass):
'''
Use as a class decorator to add extra methods to your model manager.
Example usage:
class Article(django.db.models.Model):
published = models.DateTimeField()
...
@extendManager
class objects(object):
def getPublished(self):
return self.filter(published__lte... | [
"Use",
"as",
"a",
"class",
"decorator",
"to",
"add",
"extra",
"methods",
"to",
"your",
"model",
"manager",
".",
"Example",
"usage",
":"
] | ze-phyr-us/django-libretto | python | https://github.com/ze-phyr-us/django-libretto/blob/b19d8aa21b9579ee91e81967a44d1c40f5588b17/django_libretto/models.py#L9-L34 | [
"def",
"extendManager",
"(",
"mixinClass",
")",
":",
"class",
"MixinManager",
"(",
"models",
".",
"Manager",
",",
"mixinClass",
")",
":",
"class",
"MixinQuerySet",
"(",
"models",
".",
"query",
".",
"QuerySet",
",",
"mixinClass",
")",
":",
"pass",
"def",
"g... | b19d8aa21b9579ee91e81967a44d1c40f5588b17 |
test | run | Main method where all logic is defined | myhelp/myhelp.py | def run():
"""Main method where all logic is defined"""
config_option_help="'show' - displays configured options, 'set [section] [name] [value]' - sets config under a section,'set [name] [value]' - sets configuration globally"
parser = OptionParser()
parser.add_option("-a", "--add", action="... | def run():
"""Main method where all logic is defined"""
config_option_help="'show' - displays configured options, 'set [section] [name] [value]' - sets config under a section,'set [name] [value]' - sets configuration globally"
parser = OptionParser()
parser.add_option("-a", "--add", action="... | [
"Main",
"method",
"where",
"all",
"logic",
"is",
"defined"
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/myhelp/myhelp.py#L26-L105 | [
"def",
"run",
"(",
")",
":",
"config_option_help",
"=",
"\"'show' - displays configured options, 'set [section] [name] [value]' - sets config under a section,'set [name] [value]' - sets configuration globally\"",
"parser",
"=",
"OptionParser",
"(",
")",
"parser",
".",
"add_option",
"... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | split_user_input | Split user input into initial whitespace, escape character, function part
and the rest. | environment/lib/python2.7/site-packages/IPython/core/splitinput.py | def split_user_input(line, pattern=None):
"""Split user input into initial whitespace, escape character, function part
and the rest.
"""
# We need to ensure that the rest of this routine deals only with unicode
encoding = get_stream_enc(sys.stdin, 'utf-8')
line = py3compat.cast_unicode(line, enc... | def split_user_input(line, pattern=None):
"""Split user input into initial whitespace, escape character, function part
and the rest.
"""
# We need to ensure that the rest of this routine deals only with unicode
encoding = get_stream_enc(sys.stdin, 'utf-8')
line = py3compat.cast_unicode(line, enc... | [
"Split",
"user",
"input",
"into",
"initial",
"whitespace",
"escape",
"character",
"function",
"part",
"and",
"the",
"rest",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/splitinput.py#L53-L78 | [
"def",
"split_user_input",
"(",
"line",
",",
"pattern",
"=",
"None",
")",
":",
"# We need to ensure that the rest of this routine deals only with unicode",
"encoding",
"=",
"get_stream_enc",
"(",
"sys",
".",
"stdin",
",",
"'utf-8'",
")",
"line",
"=",
"py3compat",
".",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | current | Return a class name (string) if the current URL matches the route name specified in ``className``.
If any URL keyword arguments are provided, they must be matched as well.
:param urlName: The route name that the current URL should match. Example: 'accounts:login'.
:param className: The string that is returned if th... | django_libretto/templatetags/navigation.py | def current(context, urlName, className = 'active', **kwargs):
'''
Return a class name (string) if the current URL matches the route name specified in ``className``.
If any URL keyword arguments are provided, they must be matched as well.
:param urlName: The route name that the current URL should match. Example: '... | def current(context, urlName, className = 'active', **kwargs):
'''
Return a class name (string) if the current URL matches the route name specified in ``className``.
If any URL keyword arguments are provided, they must be matched as well.
:param urlName: The route name that the current URL should match. Example: '... | [
"Return",
"a",
"class",
"name",
"(",
"string",
")",
"if",
"the",
"current",
"URL",
"matches",
"the",
"route",
"name",
"specified",
"in",
"className",
".",
"If",
"any",
"URL",
"keyword",
"arguments",
"are",
"provided",
"they",
"must",
"be",
"matched",
"as",... | ze-phyr-us/django-libretto | python | https://github.com/ze-phyr-us/django-libretto/blob/b19d8aa21b9579ee91e81967a44d1c40f5588b17/django_libretto/templatetags/navigation.py#L11-L22 | [
"def",
"current",
"(",
"context",
",",
"urlName",
",",
"className",
"=",
"'active'",
",",
"*",
"*",
"kwargs",
")",
":",
"matches",
"=",
"pathMatches",
"(",
"context",
"[",
"'request'",
"]",
".",
"path",
",",
"urlName",
",",
"*",
"*",
"kwargs",
")",
"... | b19d8aa21b9579ee91e81967a44d1c40f5588b17 |
test | pathMatches | :param path: str
:param urlName: str
:returns: bool. | django_libretto/templatetags/navigation.py | def pathMatches(path, urlName, **kwargs):
'''
:param path: str
:param urlName: str
:returns: bool.
'''
resolved = urlresolvers.resolve(path)
# Different URL name => the current URL cannot match.
resolvedName = '{r.namespace}:{r.url_name}'.format(r = resolved) if resolved.namespace else resolved.url_name
if ur... | def pathMatches(path, urlName, **kwargs):
'''
:param path: str
:param urlName: str
:returns: bool.
'''
resolved = urlresolvers.resolve(path)
# Different URL name => the current URL cannot match.
resolvedName = '{r.namespace}:{r.url_name}'.format(r = resolved) if resolved.namespace else resolved.url_name
if ur... | [
":",
"param",
"path",
":",
"str",
":",
"param",
"urlName",
":",
"str",
":",
"returns",
":",
"bool",
"."
] | ze-phyr-us/django-libretto | python | https://github.com/ze-phyr-us/django-libretto/blob/b19d8aa21b9579ee91e81967a44d1c40f5588b17/django_libretto/templatetags/navigation.py#L26-L45 | [
"def",
"pathMatches",
"(",
"path",
",",
"urlName",
",",
"*",
"*",
"kwargs",
")",
":",
"resolved",
"=",
"urlresolvers",
".",
"resolve",
"(",
"path",
")",
"# Different URL name => the current URL cannot match.",
"resolvedName",
"=",
"'{r.namespace}:{r.url_name}'",
".",
... | b19d8aa21b9579ee91e81967a44d1c40f5588b17 |
test | MultiProcess.options | Register command-line options. | environment/lib/python2.7/site-packages/nose/plugins/multiprocess.py | def options(self, parser, env):
"""
Register command-line options.
"""
parser.add_option("--processes", action="store",
default=env.get('NOSE_PROCESSES', 0),
dest="multiprocess_workers",
metavar="NUM",
... | def options(self, parser, env):
"""
Register command-line options.
"""
parser.add_option("--processes", action="store",
default=env.get('NOSE_PROCESSES', 0),
dest="multiprocess_workers",
metavar="NUM",
... | [
"Register",
"command",
"-",
"line",
"options",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/multiprocess.py#L187-L211 | [
"def",
"options",
"(",
"self",
",",
"parser",
",",
"env",
")",
":",
"parser",
".",
"add_option",
"(",
"\"--processes\"",
",",
"action",
"=",
"\"store\"",
",",
"default",
"=",
"env",
".",
"get",
"(",
"'NOSE_PROCESSES'",
",",
"0",
")",
",",
"dest",
"=",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | MultiProcess.configure | Configure plugin. | environment/lib/python2.7/site-packages/nose/plugins/multiprocess.py | def configure(self, options, config):
"""
Configure plugin.
"""
try:
self.status.pop('active')
except KeyError:
pass
if not hasattr(options, 'multiprocess_workers'):
self.enabled = False
return
# don't start inside o... | def configure(self, options, config):
"""
Configure plugin.
"""
try:
self.status.pop('active')
except KeyError:
pass
if not hasattr(options, 'multiprocess_workers'):
self.enabled = False
return
# don't start inside o... | [
"Configure",
"plugin",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/multiprocess.py#L213-L243 | [
"def",
"configure",
"(",
"self",
",",
"options",
",",
"config",
")",
":",
"try",
":",
"self",
".",
"status",
".",
"pop",
"(",
"'active'",
")",
"except",
"KeyError",
":",
"pass",
"if",
"not",
"hasattr",
"(",
"options",
",",
"'multiprocess_workers'",
")",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NoSharedFixtureContextSuite.run | Run tests in suite inside of suite fixtures. | environment/lib/python2.7/site-packages/nose/plugins/multiprocess.py | def run(self, result):
"""Run tests in suite inside of suite fixtures.
"""
# proxy the result for myself
log.debug("suite %s (%s) run called, tests: %s",
id(self), self, self._tests)
if self.resultProxy:
result, orig = self.resultProxy(result, self),... | def run(self, result):
"""Run tests in suite inside of suite fixtures.
"""
# proxy the result for myself
log.debug("suite %s (%s) run called, tests: %s",
id(self), self, self._tests)
if self.resultProxy:
result, orig = self.resultProxy(result, self),... | [
"Run",
"tests",
"in",
"suite",
"inside",
"of",
"suite",
"fixtures",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/multiprocess.py#L760-L819 | [
"def",
"run",
"(",
"self",
",",
"result",
")",
":",
"# proxy the result for myself",
"log",
".",
"debug",
"(",
"\"suite %s (%s) run called, tests: %s\"",
",",
"id",
"(",
"self",
")",
",",
"self",
",",
"self",
".",
"_tests",
")",
"if",
"self",
".",
"resultPro... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BuiltinTrap.add_builtin | Add a builtin and save the original. | environment/lib/python2.7/site-packages/IPython/core/builtin_trap.py | def add_builtin(self, key, value):
"""Add a builtin and save the original."""
bdict = __builtin__.__dict__
orig = bdict.get(key, BuiltinUndefined)
if value is HideBuiltin:
if orig is not BuiltinUndefined: #same as 'key in bdict'
self._orig_builtins[key] = orig... | def add_builtin(self, key, value):
"""Add a builtin and save the original."""
bdict = __builtin__.__dict__
orig = bdict.get(key, BuiltinUndefined)
if value is HideBuiltin:
if orig is not BuiltinUndefined: #same as 'key in bdict'
self._orig_builtins[key] = orig... | [
"Add",
"a",
"builtin",
"and",
"save",
"the",
"original",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/builtin_trap.py#L79-L89 | [
"def",
"add_builtin",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"bdict",
"=",
"__builtin__",
".",
"__dict__",
"orig",
"=",
"bdict",
".",
"get",
"(",
"key",
",",
"BuiltinUndefined",
")",
"if",
"value",
"is",
"HideBuiltin",
":",
"if",
"orig",
"is"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BuiltinTrap.remove_builtin | Remove an added builtin and re-set the original. | environment/lib/python2.7/site-packages/IPython/core/builtin_trap.py | def remove_builtin(self, key, orig):
"""Remove an added builtin and re-set the original."""
if orig is BuiltinUndefined:
del __builtin__.__dict__[key]
else:
__builtin__.__dict__[key] = orig | def remove_builtin(self, key, orig):
"""Remove an added builtin and re-set the original."""
if orig is BuiltinUndefined:
del __builtin__.__dict__[key]
else:
__builtin__.__dict__[key] = orig | [
"Remove",
"an",
"added",
"builtin",
"and",
"re",
"-",
"set",
"the",
"original",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/builtin_trap.py#L91-L96 | [
"def",
"remove_builtin",
"(",
"self",
",",
"key",
",",
"orig",
")",
":",
"if",
"orig",
"is",
"BuiltinUndefined",
":",
"del",
"__builtin__",
".",
"__dict__",
"[",
"key",
"]",
"else",
":",
"__builtin__",
".",
"__dict__",
"[",
"key",
"]",
"=",
"orig"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BuiltinTrap.activate | Store ipython references in the __builtin__ namespace. | environment/lib/python2.7/site-packages/IPython/core/builtin_trap.py | def activate(self):
"""Store ipython references in the __builtin__ namespace."""
add_builtin = self.add_builtin
for name, func in self.auto_builtins.iteritems():
add_builtin(name, func) | def activate(self):
"""Store ipython references in the __builtin__ namespace."""
add_builtin = self.add_builtin
for name, func in self.auto_builtins.iteritems():
add_builtin(name, func) | [
"Store",
"ipython",
"references",
"in",
"the",
"__builtin__",
"namespace",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/builtin_trap.py#L98-L103 | [
"def",
"activate",
"(",
"self",
")",
":",
"add_builtin",
"=",
"self",
".",
"add_builtin",
"for",
"name",
",",
"func",
"in",
"self",
".",
"auto_builtins",
".",
"iteritems",
"(",
")",
":",
"add_builtin",
"(",
"name",
",",
"func",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BuiltinTrap.deactivate | Remove any builtins which might have been added by add_builtins, or
restore overwritten ones to their previous values. | environment/lib/python2.7/site-packages/IPython/core/builtin_trap.py | def deactivate(self):
"""Remove any builtins which might have been added by add_builtins, or
restore overwritten ones to their previous values."""
remove_builtin = self.remove_builtin
for key, val in self._orig_builtins.iteritems():
remove_builtin(key, val)
self._orig... | def deactivate(self):
"""Remove any builtins which might have been added by add_builtins, or
restore overwritten ones to their previous values."""
remove_builtin = self.remove_builtin
for key, val in self._orig_builtins.iteritems():
remove_builtin(key, val)
self._orig... | [
"Remove",
"any",
"builtins",
"which",
"might",
"have",
"been",
"added",
"by",
"add_builtins",
"or",
"restore",
"overwritten",
"ones",
"to",
"their",
"previous",
"values",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/builtin_trap.py#L105-L112 | [
"def",
"deactivate",
"(",
"self",
")",
":",
"remove_builtin",
"=",
"self",
".",
"remove_builtin",
"for",
"key",
",",
"val",
"in",
"self",
".",
"_orig_builtins",
".",
"iteritems",
"(",
")",
":",
"remove_builtin",
"(",
"key",
",",
"val",
")",
"self",
".",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PackageFinder._find_url_name | Finds the true URL name of a package, when the given name isn't quite
correct.
This is usually used to implement case-insensitivity. | virtualEnvironment/lib/python2.7/site-packages/pip/index.py | def _find_url_name(self, index_url, url_name, req):
"""
Finds the true URL name of a package, when the given name isn't quite
correct.
This is usually used to implement case-insensitivity.
"""
if not index_url.url.endswith('/'):
# Vaguely part of the PyPI API.... | def _find_url_name(self, index_url, url_name, req):
"""
Finds the true URL name of a package, when the given name isn't quite
correct.
This is usually used to implement case-insensitivity.
"""
if not index_url.url.endswith('/'):
# Vaguely part of the PyPI API.... | [
"Finds",
"the",
"true",
"URL",
"name",
"of",
"a",
"package",
"when",
"the",
"given",
"name",
"isn",
"t",
"quite",
"correct",
".",
"This",
"is",
"usually",
"used",
"to",
"implement",
"case",
"-",
"insensitivity",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/pip/index.py#L528-L550 | [
"def",
"_find_url_name",
"(",
"self",
",",
"index_url",
",",
"url_name",
",",
"req",
")",
":",
"if",
"not",
"index_url",
".",
"url",
".",
"endswith",
"(",
"'/'",
")",
":",
"# Vaguely part of the PyPI API... weird but true.",
"# FIXME: bad to modify this?",
"index_ur... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | PackageFinder._link_package_versions | Return an iterable of triples (pkg_resources_version_key,
link, python_version) that can be extracted from the given
link.
Meant to be overridden by subclasses, not called by clients. | virtualEnvironment/lib/python2.7/site-packages/pip/index.py | def _link_package_versions(self, link, search_name):
"""
Return an iterable of triples (pkg_resources_version_key,
link, python_version) that can be extracted from the given
link.
Meant to be overridden by subclasses, not called by clients.
"""
platform = get_pla... | def _link_package_versions(self, link, search_name):
"""
Return an iterable of triples (pkg_resources_version_key,
link, python_version) that can be extracted from the given
link.
Meant to be overridden by subclasses, not called by clients.
"""
platform = get_pla... | [
"Return",
"an",
"iterable",
"of",
"triples",
"(",
"pkg_resources_version_key",
"link",
"python_version",
")",
"that",
"can",
"be",
"extracted",
"from",
"the",
"given",
"link",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/pip/index.py#L631-L765 | [
"def",
"_link_package_versions",
"(",
"self",
",",
"link",
",",
"search_name",
")",
":",
"platform",
"=",
"get_platform",
"(",
")",
"version",
"=",
"None",
"if",
"link",
".",
"egg_fragment",
":",
"egg_info",
"=",
"link",
".",
"egg_fragment",
"else",
":",
"... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | HTMLPage.explicit_rel_links | Yields all links with the given relations | virtualEnvironment/lib/python2.7/site-packages/pip/index.py | def explicit_rel_links(self, rels=('homepage', 'download')):
"""Yields all links with the given relations"""
rels = set(rels)
for anchor in self.parsed.findall(".//a"):
if anchor.get("rel") and anchor.get("href"):
found_rels = set(anchor.get("rel").split())
... | def explicit_rel_links(self, rels=('homepage', 'download')):
"""Yields all links with the given relations"""
rels = set(rels)
for anchor in self.parsed.findall(".//a"):
if anchor.get("rel") and anchor.get("href"):
found_rels = set(anchor.get("rel").split())
... | [
"Yields",
"all",
"links",
"with",
"the",
"given",
"relations"
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/pip/index.py#L993-L1007 | [
"def",
"explicit_rel_links",
"(",
"self",
",",
"rels",
"=",
"(",
"'homepage'",
",",
"'download'",
")",
")",
":",
"rels",
"=",
"set",
"(",
"rels",
")",
"for",
"anchor",
"in",
"self",
".",
"parsed",
".",
"findall",
"(",
"\".//a\"",
")",
":",
"if",
"anc... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | send_multi_alt_email | Send a message to one more email address(s).
With text content as primary and html content as alternative. | toolware/utils/email.py | def send_multi_alt_email(
subject, # single line with no line-breaks
text_content,
to_emails,
html_content=None,
from_email=DEFAULT_FROM_EMAIL,
fail_silently=True
):
"""
Send a message to one more email address(s).
With text content as primary and html content as alternative.
... | def send_multi_alt_email(
subject, # single line with no line-breaks
text_content,
to_emails,
html_content=None,
from_email=DEFAULT_FROM_EMAIL,
fail_silently=True
):
"""
Send a message to one more email address(s).
With text content as primary and html content as alternative.
... | [
"Send",
"a",
"message",
"to",
"one",
"more",
"email",
"address",
"(",
"s",
")",
".",
"With",
"text",
"content",
"as",
"primary",
"and",
"html",
"content",
"as",
"alternative",
"."
] | un33k/django-toolware | python | https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/email.py#L15-L34 | [
"def",
"send_multi_alt_email",
"(",
"subject",
",",
"# single line with no line-breaks",
"text_content",
",",
"to_emails",
",",
"html_content",
"=",
"None",
",",
"from_email",
"=",
"DEFAULT_FROM_EMAIL",
",",
"fail_silently",
"=",
"True",
")",
":",
"messenger",
"=",
... | 973f3e003dc38b812897dab88455bee37dcaf931 |
test | send_html_email | Send a message to one more email address(s).
With html content as primary. | toolware/utils/email.py | def send_html_email(
subject, # single line with no line-breaks
html_content,
to_emails,
from_email=DEFAULT_FROM_EMAIL,
fail_silently=True
):
"""
Send a message to one more email address(s).
With html content as primary.
"""
messenger = EmailMessage(subject, html_content, f... | def send_html_email(
subject, # single line with no line-breaks
html_content,
to_emails,
from_email=DEFAULT_FROM_EMAIL,
fail_silently=True
):
"""
Send a message to one more email address(s).
With html content as primary.
"""
messenger = EmailMessage(subject, html_content, f... | [
"Send",
"a",
"message",
"to",
"one",
"more",
"email",
"address",
"(",
"s",
")",
".",
"With",
"html",
"content",
"as",
"primary",
"."
] | un33k/django-toolware | python | https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/email.py#L37-L54 | [
"def",
"send_html_email",
"(",
"subject",
",",
"# single line with no line-breaks",
"html_content",
",",
"to_emails",
",",
"from_email",
"=",
"DEFAULT_FROM_EMAIL",
",",
"fail_silently",
"=",
"True",
")",
":",
"messenger",
"=",
"EmailMessage",
"(",
"subject",
",",
"h... | 973f3e003dc38b812897dab88455bee37dcaf931 |
test | trim_form | Returns a form that only contains a subset of the original fields (opcode: incude/exclude fields)
Exampel:
<fieldset>
<legend>Business Info</legend>
<ul>
{% trim_form orig_form fields biz_name,biz_city,biz_email,biz_phone as new_form %}
... | toolware/templatetags/forms.py | def trim_form(parser, token):
"""
Returns a form that only contains a subset of the original fields (opcode: incude/exclude fields)
Exampel:
<fieldset>
<legend>Business Info</legend>
<ul>
{% trim_form orig_form fields biz_name,biz_city,biz_... | def trim_form(parser, token):
"""
Returns a form that only contains a subset of the original fields (opcode: incude/exclude fields)
Exampel:
<fieldset>
<legend>Business Info</legend>
<ul>
{% trim_form orig_form fields biz_name,biz_city,biz_... | [
"Returns",
"a",
"form",
"that",
"only",
"contains",
"a",
"subset",
"of",
"the",
"original",
"fields",
"(",
"opcode",
":",
"incude",
"/",
"exclude",
"fields",
")",
"Exampel",
":",
"<fieldset",
">",
"<legend",
">",
"Business",
"Info<",
"/",
"legend",
">",
... | un33k/django-toolware | python | https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/templatetags/forms.py#L31-L56 | [
"def",
"trim_form",
"(",
"parser",
",",
"token",
")",
":",
"try",
":",
"trim_form",
",",
"orig_form",
",",
"opcode",
",",
"fields",
",",
"as_",
",",
"new_form",
"=",
"token",
".",
"split_contents",
"(",
")",
"except",
"ValueError",
":",
"raise",
"templat... | 973f3e003dc38b812897dab88455bee37dcaf931 |
test | unshell_list | Turn a command-line argument into a list. | virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py | def unshell_list(s):
"""Turn a command-line argument into a list."""
if not s:
return None
if sys.platform == 'win32':
# When running coverage as coverage.exe, some of the behavior
# of the shell is emulated: wildcards are expanded into a list of
# filenames. So you have to ... | def unshell_list(s):
"""Turn a command-line argument into a list."""
if not s:
return None
if sys.platform == 'win32':
# When running coverage as coverage.exe, some of the behavior
# of the shell is emulated: wildcards are expanded into a list of
# filenames. So you have to ... | [
"Turn",
"a",
"command",
"-",
"line",
"argument",
"into",
"a",
"list",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L617-L628 | [
"def",
"unshell_list",
"(",
"s",
")",
":",
"if",
"not",
"s",
":",
"return",
"None",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"# When running coverage as coverage.exe, some of the behavior",
"# of the shell is emulated: wildcards are expanded into a list of",
"# f... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | main | The main entry point to Coverage.
This is installed as the script entry point. | virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py | def main(argv=None):
"""The main entry point to Coverage.
This is installed as the script entry point.
"""
if argv is None:
argv = sys.argv[1:]
try:
start = time.clock()
status = CoverageScript().command_line(argv)
end = time.clock()
if 0:
print(... | def main(argv=None):
"""The main entry point to Coverage.
This is installed as the script entry point.
"""
if argv is None:
argv = sys.argv[1:]
try:
start = time.clock()
status = CoverageScript().command_line(argv)
end = time.clock()
if 0:
print(... | [
"The",
"main",
"entry",
"point",
"to",
"Coverage",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L711-L744 | [
"def",
"main",
"(",
"argv",
"=",
"None",
")",
":",
"if",
"argv",
"is",
"None",
":",
"argv",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"try",
":",
"start",
"=",
"time",
".",
"clock",
"(",
")",
"status",
"=",
"CoverageScript",
"(",
")",
".",
... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | CoverageOptionParser.parse_args | Call optparse.parse_args, but return a triple:
(ok, options, args) | virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py | def parse_args(self, args=None, options=None):
"""Call optparse.parse_args, but return a triple:
(ok, options, args)
"""
try:
options, args = \
super(CoverageOptionParser, self).parse_args(args, options)
except self.OptionParserError:
ret... | def parse_args(self, args=None, options=None):
"""Call optparse.parse_args, but return a triple:
(ok, options, args)
"""
try:
options, args = \
super(CoverageOptionParser, self).parse_args(args, options)
except self.OptionParserError:
ret... | [
"Call",
"optparse",
".",
"parse_args",
"but",
"return",
"a",
"triple",
":"
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L155-L166 | [
"def",
"parse_args",
"(",
"self",
",",
"args",
"=",
"None",
",",
"options",
"=",
"None",
")",
":",
"try",
":",
"options",
",",
"args",
"=",
"super",
"(",
"CoverageOptionParser",
",",
"self",
")",
".",
"parse_args",
"(",
"args",
",",
"options",
")",
"... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | ClassicOptionParser.add_action | Add a specialized option that is the action to execute. | virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py | def add_action(self, dash, dashdash, action_code):
"""Add a specialized option that is the action to execute."""
option = self.add_option(dash, dashdash, action='callback',
callback=self._append_action
)
option.action_code = action_code | def add_action(self, dash, dashdash, action_code):
"""Add a specialized option that is the action to execute."""
option = self.add_option(dash, dashdash, action='callback',
callback=self._append_action
)
option.action_code = action_code | [
"Add",
"a",
"specialized",
"option",
"that",
"is",
"the",
"action",
"to",
"execute",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L199-L204 | [
"def",
"add_action",
"(",
"self",
",",
"dash",
",",
"dashdash",
",",
"action_code",
")",
":",
"option",
"=",
"self",
".",
"add_option",
"(",
"dash",
",",
"dashdash",
",",
"action",
"=",
"'callback'",
",",
"callback",
"=",
"self",
".",
"_append_action",
"... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | ClassicOptionParser._append_action | Callback for an option that adds to the `actions` list. | virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py | def _append_action(self, option, opt_unused, value_unused, parser):
"""Callback for an option that adds to the `actions` list."""
parser.values.actions.append(option.action_code) | def _append_action(self, option, opt_unused, value_unused, parser):
"""Callback for an option that adds to the `actions` list."""
parser.values.actions.append(option.action_code) | [
"Callback",
"for",
"an",
"option",
"that",
"adds",
"to",
"the",
"actions",
"list",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L206-L208 | [
"def",
"_append_action",
"(",
"self",
",",
"option",
",",
"opt_unused",
",",
"value_unused",
",",
"parser",
")",
":",
"parser",
".",
"values",
".",
"actions",
".",
"append",
"(",
"option",
".",
"action_code",
")"
] | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | CoverageScript.command_line | The bulk of the command line interface to Coverage.
`argv` is the argument list to process.
Returns 0 if all is well, 1 if something went wrong. | virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py | def command_line(self, argv):
"""The bulk of the command line interface to Coverage.
`argv` is the argument list to process.
Returns 0 if all is well, 1 if something went wrong.
"""
# Collect the command-line options.
if not argv:
self.help_fn(topic='minimu... | def command_line(self, argv):
"""The bulk of the command line interface to Coverage.
`argv` is the argument list to process.
Returns 0 if all is well, 1 if something went wrong.
"""
# Collect the command-line options.
if not argv:
self.help_fn(topic='minimu... | [
"The",
"bulk",
"of",
"the",
"command",
"line",
"interface",
"to",
"Coverage",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L372-L472 | [
"def",
"command_line",
"(",
"self",
",",
"argv",
")",
":",
"# Collect the command-line options.",
"if",
"not",
"argv",
":",
"self",
".",
"help_fn",
"(",
"topic",
"=",
"'minimum_help'",
")",
"return",
"OK",
"# The command syntax we parse depends on the first argument. C... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | CoverageScript.help | Display an error message, or the named topic. | virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py | def help(self, error=None, topic=None, parser=None):
"""Display an error message, or the named topic."""
assert error or topic or parser
if error:
print(error)
print("Use 'coverage help' for help.")
elif parser:
print(parser.format_help().strip())
... | def help(self, error=None, topic=None, parser=None):
"""Display an error message, or the named topic."""
assert error or topic or parser
if error:
print(error)
print("Use 'coverage help' for help.")
elif parser:
print(parser.format_help().strip())
... | [
"Display",
"an",
"error",
"message",
"or",
"the",
"named",
"topic",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L474-L487 | [
"def",
"help",
"(",
"self",
",",
"error",
"=",
"None",
",",
"topic",
"=",
"None",
",",
"parser",
"=",
"None",
")",
":",
"assert",
"error",
"or",
"topic",
"or",
"parser",
"if",
"error",
":",
"print",
"(",
"error",
")",
"print",
"(",
"\"Use 'coverage h... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | CoverageScript.do_help | Deal with help requests.
Return True if it handled the request, False if not. | virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py | def do_help(self, options, args, parser):
"""Deal with help requests.
Return True if it handled the request, False if not.
"""
# Handle help.
if options.help:
if self.classic:
self.help_fn(topic='help')
else:
self.help_fn(... | def do_help(self, options, args, parser):
"""Deal with help requests.
Return True if it handled the request, False if not.
"""
# Handle help.
if options.help:
if self.classic:
self.help_fn(topic='help')
else:
self.help_fn(... | [
"Deal",
"with",
"help",
"requests",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L489-L520 | [
"def",
"do_help",
"(",
"self",
",",
"options",
",",
"args",
",",
"parser",
")",
":",
"# Handle help.",
"if",
"options",
".",
"help",
":",
"if",
"self",
".",
"classic",
":",
"self",
".",
"help_fn",
"(",
"topic",
"=",
"'help'",
")",
"else",
":",
"self"... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | CoverageScript.args_ok | Check for conflicts and problems in the options.
Returns True if everything is ok, or False if not. | virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py | def args_ok(self, options, args):
"""Check for conflicts and problems in the options.
Returns True if everything is ok, or False if not.
"""
for i in ['erase', 'execute']:
for j in ['annotate', 'html', 'report', 'combine']:
if (i in options.actions) and (j i... | def args_ok(self, options, args):
"""Check for conflicts and problems in the options.
Returns True if everything is ok, or False if not.
"""
for i in ['erase', 'execute']:
for j in ['annotate', 'html', 'report', 'combine']:
if (i in options.actions) and (j i... | [
"Check",
"for",
"conflicts",
"and",
"problems",
"in",
"the",
"options",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L522-L556 | [
"def",
"args_ok",
"(",
"self",
",",
"options",
",",
"args",
")",
":",
"for",
"i",
"in",
"[",
"'erase'",
",",
"'execute'",
"]",
":",
"for",
"j",
"in",
"[",
"'annotate'",
",",
"'html'",
",",
"'report'",
",",
"'combine'",
"]",
":",
"if",
"(",
"i",
"... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | CoverageScript.do_execute | Implementation of 'coverage run'. | virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py | def do_execute(self, options, args):
"""Implementation of 'coverage run'."""
# Set the first path element properly.
old_path0 = sys.path[0]
# Run the script.
self.coverage.start()
code_ran = True
try:
try:
if options.module:
... | def do_execute(self, options, args):
"""Implementation of 'coverage run'."""
# Set the first path element properly.
old_path0 = sys.path[0]
# Run the script.
self.coverage.start()
code_ran = True
try:
try:
if options.module:
... | [
"Implementation",
"of",
"coverage",
"run",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L558-L585 | [
"def",
"do_execute",
"(",
"self",
",",
"options",
",",
"args",
")",
":",
"# Set the first path element properly.",
"old_path0",
"=",
"sys",
".",
"path",
"[",
"0",
"]",
"# Run the script.",
"self",
".",
"coverage",
".",
"start",
"(",
")",
"code_ran",
"=",
"Tr... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | CoverageScript.do_debug | Implementation of 'coverage debug'. | virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py | def do_debug(self, args):
"""Implementation of 'coverage debug'."""
if not args:
self.help_fn("What information would you like: data, sys?")
return ERR
for info in args:
if info == 'sys':
print("-- sys ----------------------------------------"... | def do_debug(self, args):
"""Implementation of 'coverage debug'."""
if not args:
self.help_fn("What information would you like: data, sys?")
return ERR
for info in args:
if info == 'sys':
print("-- sys ----------------------------------------"... | [
"Implementation",
"of",
"coverage",
"debug",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/cmdline.py#L587-L614 | [
"def",
"do_debug",
"(",
"self",
",",
"args",
")",
":",
"if",
"not",
"args",
":",
"self",
".",
"help_fn",
"(",
"\"What information would you like: data, sys?\"",
")",
"return",
"ERR",
"for",
"info",
"in",
"args",
":",
"if",
"info",
"==",
"'sys'",
":",
"prin... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | serialize_object | Serialize an object into a list of sendable buffers.
Parameters
----------
obj : object
The object to be serialized
threshold : float
The threshold for not double-pickling the content.
Returns
-------
('pmd', [bufs]) :
where pmd is the pickled ... | environment/lib/python2.7/site-packages/IPython/zmq/serialize.py | def serialize_object(obj, threshold=64e-6):
"""Serialize an object into a list of sendable buffers.
Parameters
----------
obj : object
The object to be serialized
threshold : float
The threshold for not double-pickling the content.
Returns
-------
... | def serialize_object(obj, threshold=64e-6):
"""Serialize an object into a list of sendable buffers.
Parameters
----------
obj : object
The object to be serialized
threshold : float
The threshold for not double-pickling the content.
Returns
-------
... | [
"Serialize",
"an",
"object",
"into",
"a",
"list",
"of",
"sendable",
"buffers",
".",
"Parameters",
"----------",
"obj",
":",
"object",
"The",
"object",
"to",
"be",
"serialized",
"threshold",
":",
"float",
"The",
"threshold",
"for",
"not",
"double",
"-",
"pick... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/serialize.py#L45-L86 | [
"def",
"serialize_object",
"(",
"obj",
",",
"threshold",
"=",
"64e-6",
")",
":",
"databuffers",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"obj",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"clist",
"=",
"canSequence",
"(",
"obj",
")",
"slist",
"=",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | unserialize_object | reconstruct an object serialized by serialize_object from data buffers. | environment/lib/python2.7/site-packages/IPython/zmq/serialize.py | def unserialize_object(bufs):
"""reconstruct an object serialized by serialize_object from data buffers."""
bufs = list(bufs)
sobj = pickle.loads(bufs.pop(0))
if isinstance(sobj, (list, tuple)):
for s in sobj:
if s.data is None:
s.data = bufs.pop(0)
return unc... | def unserialize_object(bufs):
"""reconstruct an object serialized by serialize_object from data buffers."""
bufs = list(bufs)
sobj = pickle.loads(bufs.pop(0))
if isinstance(sobj, (list, tuple)):
for s in sobj:
if s.data is None:
s.data = bufs.pop(0)
return unc... | [
"reconstruct",
"an",
"object",
"serialized",
"by",
"serialize_object",
"from",
"data",
"buffers",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/serialize.py#L89-L109 | [
"def",
"unserialize_object",
"(",
"bufs",
")",
":",
"bufs",
"=",
"list",
"(",
"bufs",
")",
"sobj",
"=",
"pickle",
".",
"loads",
"(",
"bufs",
".",
"pop",
"(",
"0",
")",
")",
"if",
"isinstance",
"(",
"sobj",
",",
"(",
"list",
",",
"tuple",
")",
")"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | pack_apply_message | pack up a function, args, and kwargs to be sent over the wire
as a series of buffers. Any object whose data is larger than `threshold`
will not have their data copied (currently only numpy arrays support zero-copy) | environment/lib/python2.7/site-packages/IPython/zmq/serialize.py | def pack_apply_message(f, args, kwargs, threshold=64e-6):
"""pack up a function, args, and kwargs to be sent over the wire
as a series of buffers. Any object whose data is larger than `threshold`
will not have their data copied (currently only numpy arrays support zero-copy)"""
msg = [pickle.dumps(can(f... | def pack_apply_message(f, args, kwargs, threshold=64e-6):
"""pack up a function, args, and kwargs to be sent over the wire
as a series of buffers. Any object whose data is larger than `threshold`
will not have their data copied (currently only numpy arrays support zero-copy)"""
msg = [pickle.dumps(can(f... | [
"pack",
"up",
"a",
"function",
"args",
"and",
"kwargs",
"to",
"be",
"sent",
"over",
"the",
"wire",
"as",
"a",
"series",
"of",
"buffers",
".",
"Any",
"object",
"whose",
"data",
"is",
"larger",
"than",
"threshold",
"will",
"not",
"have",
"their",
"data",
... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/serialize.py#L111-L124 | [
"def",
"pack_apply_message",
"(",
"f",
",",
"args",
",",
"kwargs",
",",
"threshold",
"=",
"64e-6",
")",
":",
"msg",
"=",
"[",
"pickle",
".",
"dumps",
"(",
"can",
"(",
"f",
")",
",",
"-",
"1",
")",
"]",
"databuffers",
"=",
"[",
"]",
"# for large obj... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | unpack_apply_message | unpack f,args,kwargs from buffers packed by pack_apply_message()
Returns: original f,args,kwargs | environment/lib/python2.7/site-packages/IPython/zmq/serialize.py | def unpack_apply_message(bufs, g=None, copy=True):
"""unpack f,args,kwargs from buffers packed by pack_apply_message()
Returns: original f,args,kwargs"""
bufs = list(bufs) # allow us to pop
assert len(bufs) >= 3, "not enough buffers!"
if not copy:
for i in range(3):
bufs[i] = buf... | def unpack_apply_message(bufs, g=None, copy=True):
"""unpack f,args,kwargs from buffers packed by pack_apply_message()
Returns: original f,args,kwargs"""
bufs = list(bufs) # allow us to pop
assert len(bufs) >= 3, "not enough buffers!"
if not copy:
for i in range(3):
bufs[i] = buf... | [
"unpack",
"f",
"args",
"kwargs",
"from",
"buffers",
"packed",
"by",
"pack_apply_message",
"()",
"Returns",
":",
"original",
"f",
"args",
"kwargs"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/serialize.py#L126-L178 | [
"def",
"unpack_apply_message",
"(",
"bufs",
",",
"g",
"=",
"None",
",",
"copy",
"=",
"True",
")",
":",
"bufs",
"=",
"list",
"(",
"bufs",
")",
"# allow us to pop",
"assert",
"len",
"(",
"bufs",
")",
">=",
"3",
",",
"\"not enough buffers!\"",
"if",
"not",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | DisplayTrap.set | Set the hook. | environment/lib/python2.7/site-packages/IPython/core/display_trap.py | def set(self):
"""Set the hook."""
if sys.displayhook is not self.hook:
self.old_hook = sys.displayhook
sys.displayhook = self.hook | def set(self):
"""Set the hook."""
if sys.displayhook is not self.hook:
self.old_hook = sys.displayhook
sys.displayhook = self.hook | [
"Set",
"the",
"hook",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/display_trap.py#L61-L65 | [
"def",
"set",
"(",
"self",
")",
":",
"if",
"sys",
".",
"displayhook",
"is",
"not",
"self",
".",
"hook",
":",
"self",
".",
"old_hook",
"=",
"sys",
".",
"displayhook",
"sys",
".",
"displayhook",
"=",
"self",
".",
"hook"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | log_errors | decorator to log unhandled exceptions raised in a method.
For use wrapping on_recv callbacks, so that exceptions
do not cause the stream to be closed. | environment/lib/python2.7/site-packages/IPython/parallel/util.py | def log_errors(f, self, *args, **kwargs):
"""decorator to log unhandled exceptions raised in a method.
For use wrapping on_recv callbacks, so that exceptions
do not cause the stream to be closed.
"""
try:
return f(self, *args, **kwargs)
except Exception:
self.log.error("Unca... | def log_errors(f, self, *args, **kwargs):
"""decorator to log unhandled exceptions raised in a method.
For use wrapping on_recv callbacks, so that exceptions
do not cause the stream to be closed.
"""
try:
return f(self, *args, **kwargs)
except Exception:
self.log.error("Unca... | [
"decorator",
"to",
"log",
"unhandled",
"exceptions",
"raised",
"in",
"a",
"method",
".",
"For",
"use",
"wrapping",
"on_recv",
"callbacks",
"so",
"that",
"exceptions",
"do",
"not",
"cause",
"the",
"stream",
"to",
"be",
"closed",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/util.py#L115-L124 | [
"def",
"log_errors",
"(",
"f",
",",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"f",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except",
"Exception",
":",
"self",
".",
"log",
".",
"error... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | is_url | boolean check for whether a string is a zmq url | environment/lib/python2.7/site-packages/IPython/parallel/util.py | def is_url(url):
"""boolean check for whether a string is a zmq url"""
if '://' not in url:
return False
proto, addr = url.split('://', 1)
if proto.lower() not in ['tcp','pgm','epgm','ipc','inproc']:
return False
return True | def is_url(url):
"""boolean check for whether a string is a zmq url"""
if '://' not in url:
return False
proto, addr = url.split('://', 1)
if proto.lower() not in ['tcp','pgm','epgm','ipc','inproc']:
return False
return True | [
"boolean",
"check",
"for",
"whether",
"a",
"string",
"is",
"a",
"zmq",
"url"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/util.py#L127-L134 | [
"def",
"is_url",
"(",
"url",
")",
":",
"if",
"'://'",
"not",
"in",
"url",
":",
"return",
"False",
"proto",
",",
"addr",
"=",
"url",
".",
"split",
"(",
"'://'",
",",
"1",
")",
"if",
"proto",
".",
"lower",
"(",
")",
"not",
"in",
"[",
"'tcp'",
","... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | validate_url | validate a url for zeromq | environment/lib/python2.7/site-packages/IPython/parallel/util.py | def validate_url(url):
"""validate a url for zeromq"""
if not isinstance(url, basestring):
raise TypeError("url must be a string, not %r"%type(url))
url = url.lower()
proto_addr = url.split('://')
assert len(proto_addr) == 2, 'Invalid url: %r'%url
proto, addr = proto_addr
assert... | def validate_url(url):
"""validate a url for zeromq"""
if not isinstance(url, basestring):
raise TypeError("url must be a string, not %r"%type(url))
url = url.lower()
proto_addr = url.split('://')
assert len(proto_addr) == 2, 'Invalid url: %r'%url
proto, addr = proto_addr
assert... | [
"validate",
"a",
"url",
"for",
"zeromq"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/util.py#L136-L166 | [
"def",
"validate_url",
"(",
"url",
")",
":",
"if",
"not",
"isinstance",
"(",
"url",
",",
"basestring",
")",
":",
"raise",
"TypeError",
"(",
"\"url must be a string, not %r\"",
"%",
"type",
"(",
"url",
")",
")",
"url",
"=",
"url",
".",
"lower",
"(",
")",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | validate_url_container | validate a potentially nested collection of urls. | environment/lib/python2.7/site-packages/IPython/parallel/util.py | def validate_url_container(container):
"""validate a potentially nested collection of urls."""
if isinstance(container, basestring):
url = container
return validate_url(url)
elif isinstance(container, dict):
container = container.itervalues()
for element in container:
... | def validate_url_container(container):
"""validate a potentially nested collection of urls."""
if isinstance(container, basestring):
url = container
return validate_url(url)
elif isinstance(container, dict):
container = container.itervalues()
for element in container:
... | [
"validate",
"a",
"potentially",
"nested",
"collection",
"of",
"urls",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/util.py#L169-L178 | [
"def",
"validate_url_container",
"(",
"container",
")",
":",
"if",
"isinstance",
"(",
"container",
",",
"basestring",
")",
":",
"url",
"=",
"container",
"return",
"validate_url",
"(",
"url",
")",
"elif",
"isinstance",
"(",
"container",
",",
"dict",
")",
":",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | split_url | split a zmq url (tcp://ip:port) into ('tcp','ip','port'). | environment/lib/python2.7/site-packages/IPython/parallel/util.py | def split_url(url):
"""split a zmq url (tcp://ip:port) into ('tcp','ip','port')."""
proto_addr = url.split('://')
assert len(proto_addr) == 2, 'Invalid url: %r'%url
proto, addr = proto_addr
lis = addr.split(':')
assert len(lis) == 2, 'Invalid url: %r'%url
addr,s_port = lis
return proto,a... | def split_url(url):
"""split a zmq url (tcp://ip:port) into ('tcp','ip','port')."""
proto_addr = url.split('://')
assert len(proto_addr) == 2, 'Invalid url: %r'%url
proto, addr = proto_addr
lis = addr.split(':')
assert len(lis) == 2, 'Invalid url: %r'%url
addr,s_port = lis
return proto,a... | [
"split",
"a",
"zmq",
"url",
"(",
"tcp",
":",
"//",
"ip",
":",
"port",
")",
"into",
"(",
"tcp",
"ip",
"port",
")",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/util.py#L181-L189 | [
"def",
"split_url",
"(",
"url",
")",
":",
"proto_addr",
"=",
"url",
".",
"split",
"(",
"'://'",
")",
"assert",
"len",
"(",
"proto_addr",
")",
"==",
"2",
",",
"'Invalid url: %r'",
"%",
"url",
"proto",
",",
"addr",
"=",
"proto_addr",
"lis",
"=",
"addr",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | disambiguate_ip_address | turn multi-ip interfaces '0.0.0.0' and '*' into connectable
ones, based on the location (default interpretation of location is localhost). | environment/lib/python2.7/site-packages/IPython/parallel/util.py | def disambiguate_ip_address(ip, location=None):
"""turn multi-ip interfaces '0.0.0.0' and '*' into connectable
ones, based on the location (default interpretation of location is localhost)."""
if ip in ('0.0.0.0', '*'):
try:
external_ips = socket.gethostbyname_ex(socket.gethostname())[2]... | def disambiguate_ip_address(ip, location=None):
"""turn multi-ip interfaces '0.0.0.0' and '*' into connectable
ones, based on the location (default interpretation of location is localhost)."""
if ip in ('0.0.0.0', '*'):
try:
external_ips = socket.gethostbyname_ex(socket.gethostname())[2]... | [
"turn",
"multi",
"-",
"ip",
"interfaces",
"0",
".",
"0",
".",
"0",
".",
"0",
"and",
"*",
"into",
"connectable",
"ones",
"based",
"on",
"the",
"location",
"(",
"default",
"interpretation",
"of",
"location",
"is",
"localhost",
")",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/util.py#L191-L205 | [
"def",
"disambiguate_ip_address",
"(",
"ip",
",",
"location",
"=",
"None",
")",
":",
"if",
"ip",
"in",
"(",
"'0.0.0.0'",
",",
"'*'",
")",
":",
"try",
":",
"external_ips",
"=",
"socket",
".",
"gethostbyname_ex",
"(",
"socket",
".",
"gethostname",
"(",
")"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | disambiguate_url | turn multi-ip interfaces '0.0.0.0' and '*' into connectable
ones, based on the location (default interpretation is localhost).
This is for zeromq urls, such as tcp://*:10101. | environment/lib/python2.7/site-packages/IPython/parallel/util.py | def disambiguate_url(url, location=None):
"""turn multi-ip interfaces '0.0.0.0' and '*' into connectable
ones, based on the location (default interpretation is localhost).
This is for zeromq urls, such as tcp://*:10101."""
try:
proto,ip,port = split_url(url)
except AssertionError:
... | def disambiguate_url(url, location=None):
"""turn multi-ip interfaces '0.0.0.0' and '*' into connectable
ones, based on the location (default interpretation is localhost).
This is for zeromq urls, such as tcp://*:10101."""
try:
proto,ip,port = split_url(url)
except AssertionError:
... | [
"turn",
"multi",
"-",
"ip",
"interfaces",
"0",
".",
"0",
".",
"0",
".",
"0",
"and",
"*",
"into",
"connectable",
"ones",
"based",
"on",
"the",
"location",
"(",
"default",
"interpretation",
"is",
"localhost",
")",
".",
"This",
"is",
"for",
"zeromq",
"url... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/util.py#L207-L220 | [
"def",
"disambiguate_url",
"(",
"url",
",",
"location",
"=",
"None",
")",
":",
"try",
":",
"proto",
",",
"ip",
",",
"port",
"=",
"split_url",
"(",
"url",
")",
"except",
"AssertionError",
":",
"# probably not tcp url; could be ipc, etc.",
"return",
"url",
"ip",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | _pull | helper method for implementing `client.pull` via `client.apply` | environment/lib/python2.7/site-packages/IPython/parallel/util.py | def _pull(keys):
"""helper method for implementing `client.pull` via `client.apply`"""
user_ns = globals()
if isinstance(keys, (list,tuple, set)):
for key in keys:
if not user_ns.has_key(key):
raise NameError("name '%s' is not defined"%key)
return map(user_ns.get,... | def _pull(keys):
"""helper method for implementing `client.pull` via `client.apply`"""
user_ns = globals()
if isinstance(keys, (list,tuple, set)):
for key in keys:
if not user_ns.has_key(key):
raise NameError("name '%s' is not defined"%key)
return map(user_ns.get,... | [
"helper",
"method",
"for",
"implementing",
"client",
".",
"pull",
"via",
"client",
".",
"apply"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/util.py#L241-L252 | [
"def",
"_pull",
"(",
"keys",
")",
":",
"user_ns",
"=",
"globals",
"(",
")",
"if",
"isinstance",
"(",
"keys",
",",
"(",
"list",
",",
"tuple",
",",
"set",
")",
")",
":",
"for",
"key",
"in",
"keys",
":",
"if",
"not",
"user_ns",
".",
"has_key",
"(",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | select_random_ports | Selects and return n random ports that are available. | environment/lib/python2.7/site-packages/IPython/parallel/util.py | def select_random_ports(n):
"""Selects and return n random ports that are available."""
ports = []
for i in xrange(n):
sock = socket.socket()
sock.bind(('', 0))
while sock.getsockname()[1] in _random_ports:
sock.close()
sock = socket.socket()
sock.... | def select_random_ports(n):
"""Selects and return n random ports that are available."""
ports = []
for i in xrange(n):
sock = socket.socket()
sock.bind(('', 0))
while sock.getsockname()[1] in _random_ports:
sock.close()
sock = socket.socket()
sock.... | [
"Selects",
"and",
"return",
"n",
"random",
"ports",
"that",
"are",
"available",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/util.py#L265-L281 | [
"def",
"select_random_ports",
"(",
"n",
")",
":",
"ports",
"=",
"[",
"]",
"for",
"i",
"in",
"xrange",
"(",
"n",
")",
":",
"sock",
"=",
"socket",
".",
"socket",
"(",
")",
"sock",
".",
"bind",
"(",
"(",
"''",
",",
"0",
")",
")",
"while",
"sock",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | signal_children | Relay interupt/term signals to children, for more solid process cleanup. | environment/lib/python2.7/site-packages/IPython/parallel/util.py | def signal_children(children):
"""Relay interupt/term signals to children, for more solid process cleanup."""
def terminate_children(sig, frame):
log = Application.instance().log
log.critical("Got signal %i, terminating children..."%sig)
for child in children:
child.terminate... | def signal_children(children):
"""Relay interupt/term signals to children, for more solid process cleanup."""
def terminate_children(sig, frame):
log = Application.instance().log
log.critical("Got signal %i, terminating children..."%sig)
for child in children:
child.terminate... | [
"Relay",
"interupt",
"/",
"term",
"signals",
"to",
"children",
"for",
"more",
"solid",
"process",
"cleanup",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/util.py#L283-L294 | [
"def",
"signal_children",
"(",
"children",
")",
":",
"def",
"terminate_children",
"(",
"sig",
",",
"frame",
")",
":",
"log",
"=",
"Application",
".",
"instance",
"(",
")",
".",
"log",
"log",
".",
"critical",
"(",
"\"Got signal %i, terminating children...\"",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | remote | Turn a function into a remote function.
This method can be used for map:
In [1]: @remote(view,block=True)
...: def func(a):
...: pass | environment/lib/python2.7/site-packages/IPython/parallel/client/remotefunction.py | def remote(view, block=None, **flags):
"""Turn a function into a remote function.
This method can be used for map:
In [1]: @remote(view,block=True)
...: def func(a):
...: pass
"""
def remote_function(f):
return RemoteFunction(view, f, block=block, **flags)
return remo... | def remote(view, block=None, **flags):
"""Turn a function into a remote function.
This method can be used for map:
In [1]: @remote(view,block=True)
...: def func(a):
...: pass
"""
def remote_function(f):
return RemoteFunction(view, f, block=block, **flags)
return remo... | [
"Turn",
"a",
"function",
"into",
"a",
"remote",
"function",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/remotefunction.py#L34-L46 | [
"def",
"remote",
"(",
"view",
",",
"block",
"=",
"None",
",",
"*",
"*",
"flags",
")",
":",
"def",
"remote_function",
"(",
"f",
")",
":",
"return",
"RemoteFunction",
"(",
"view",
",",
"f",
",",
"block",
"=",
"block",
",",
"*",
"*",
"flags",
")",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | parallel | Turn a function into a parallel remote function.
This method can be used for map:
In [1]: @parallel(view, block=True)
...: def func(a):
...: pass | environment/lib/python2.7/site-packages/IPython/parallel/client/remotefunction.py | def parallel(view, dist='b', block=None, ordered=True, **flags):
"""Turn a function into a parallel remote function.
This method can be used for map:
In [1]: @parallel(view, block=True)
...: def func(a):
...: pass
"""
def parallel_function(f):
return ParallelFunction(view... | def parallel(view, dist='b', block=None, ordered=True, **flags):
"""Turn a function into a parallel remote function.
This method can be used for map:
In [1]: @parallel(view, block=True)
...: def func(a):
...: pass
"""
def parallel_function(f):
return ParallelFunction(view... | [
"Turn",
"a",
"function",
"into",
"a",
"parallel",
"remote",
"function",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/remotefunction.py#L49-L61 | [
"def",
"parallel",
"(",
"view",
",",
"dist",
"=",
"'b'",
",",
"block",
"=",
"None",
",",
"ordered",
"=",
"True",
",",
"*",
"*",
"flags",
")",
":",
"def",
"parallel_function",
"(",
"f",
")",
":",
"return",
"ParallelFunction",
"(",
"view",
",",
"f",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ParallelFunction.map | call a function on each element of a sequence remotely.
This should behave very much like the builtin map, but return an AsyncMapResult
if self.block is False. | environment/lib/python2.7/site-packages/IPython/parallel/client/remotefunction.py | def map(self, *sequences):
"""call a function on each element of a sequence remotely.
This should behave very much like the builtin map, but return an AsyncMapResult
if self.block is False.
"""
# set _map as a flag for use inside self.__call__
self._map = True
try... | def map(self, *sequences):
"""call a function on each element of a sequence remotely.
This should behave very much like the builtin map, but return an AsyncMapResult
if self.block is False.
"""
# set _map as a flag for use inside self.__call__
self._map = True
try... | [
"call",
"a",
"function",
"on",
"each",
"element",
"of",
"a",
"sequence",
"remotely",
".",
"This",
"should",
"behave",
"very",
"much",
"like",
"the",
"builtin",
"map",
"but",
"return",
"an",
"AsyncMapResult",
"if",
"self",
".",
"block",
"is",
"False",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/remotefunction.py#L231-L242 | [
"def",
"map",
"(",
"self",
",",
"*",
"sequences",
")",
":",
"# set _map as a flag for use inside self.__call__",
"self",
".",
"_map",
"=",
"True",
"try",
":",
"ret",
"=",
"self",
".",
"__call__",
"(",
"*",
"sequences",
")",
"finally",
":",
"del",
"self",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ReadlineNoRecord.get_readline_tail | Get the last n items in readline history. | environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py | def get_readline_tail(self, n=10):
"""Get the last n items in readline history."""
end = self.shell.readline.get_current_history_length() + 1
start = max(end-n, 1)
ghi = self.shell.readline.get_history_item
return [ghi(x) for x in range(start, end)] | def get_readline_tail(self, n=10):
"""Get the last n items in readline history."""
end = self.shell.readline.get_current_history_length() + 1
start = max(end-n, 1)
ghi = self.shell.readline.get_history_item
return [ghi(x) for x in range(start, end)] | [
"Get",
"the",
"last",
"n",
"items",
"in",
"readline",
"history",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L179-L184 | [
"def",
"get_readline_tail",
"(",
"self",
",",
"n",
"=",
"10",
")",
":",
"end",
"=",
"self",
".",
"shell",
".",
"readline",
".",
"get_current_history_length",
"(",
")",
"+",
"1",
"start",
"=",
"max",
"(",
"end",
"-",
"n",
",",
"1",
")",
"ghi",
"=",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | InteractiveShell.set_autoindent | Set the autoindent flag, checking for readline support.
If called with no arguments, it acts as a toggle. | environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py | def set_autoindent(self,value=None):
"""Set the autoindent flag, checking for readline support.
If called with no arguments, it acts as a toggle."""
if value != 0 and not self.has_readline:
if os.name == 'posix':
warn("The auto-indent feature requires the readline l... | def set_autoindent(self,value=None):
"""Set the autoindent flag, checking for readline support.
If called with no arguments, it acts as a toggle."""
if value != 0 and not self.has_readline:
if os.name == 'posix':
warn("The auto-indent feature requires the readline l... | [
"Set",
"the",
"autoindent",
"flag",
"checking",
"for",
"readline",
"support",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L498-L511 | [
"def",
"set_autoindent",
"(",
"self",
",",
"value",
"=",
"None",
")",
":",
"if",
"value",
"!=",
"0",
"and",
"not",
"self",
".",
"has_readline",
":",
"if",
"os",
".",
"name",
"==",
"'posix'",
":",
"warn",
"(",
"\"The auto-indent feature requires the readline ... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | InteractiveShell.init_logstart | Initialize logging in case it was requested at the command line. | environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py | def init_logstart(self):
"""Initialize logging in case it was requested at the command line.
"""
if self.logappend:
self.magic('logstart %s append' % self.logappend)
elif self.logfile:
self.magic('logstart %s' % self.logfile)
elif self.logstart:
... | def init_logstart(self):
"""Initialize logging in case it was requested at the command line.
"""
if self.logappend:
self.magic('logstart %s append' % self.logappend)
elif self.logfile:
self.magic('logstart %s' % self.logfile)
elif self.logstart:
... | [
"Initialize",
"logging",
"in",
"case",
"it",
"was",
"requested",
"at",
"the",
"command",
"line",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L588-L596 | [
"def",
"init_logstart",
"(",
"self",
")",
":",
"if",
"self",
".",
"logappend",
":",
"self",
".",
"magic",
"(",
"'logstart %s append'",
"%",
"self",
".",
"logappend",
")",
"elif",
"self",
".",
"logfile",
":",
"self",
".",
"magic",
"(",
"'logstart %s'",
"%... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | InteractiveShell.init_virtualenv | Add a virtualenv to sys.path so the user can import modules from it.
This isn't perfect: it doesn't use the Python interpreter with which the
virtualenv was built, and it ignores the --no-site-packages option. A
warning will appear suggesting the user installs IPython in the
virtualenv, ... | environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py | def init_virtualenv(self):
"""Add a virtualenv to sys.path so the user can import modules from it.
This isn't perfect: it doesn't use the Python interpreter with which the
virtualenv was built, and it ignores the --no-site-packages option. A
warning will appear suggesting the user instal... | def init_virtualenv(self):
"""Add a virtualenv to sys.path so the user can import modules from it.
This isn't perfect: it doesn't use the Python interpreter with which the
virtualenv was built, and it ignores the --no-site-packages option. A
warning will appear suggesting the user instal... | [
"Add",
"a",
"virtualenv",
"to",
"sys",
".",
"path",
"so",
"the",
"user",
"can",
"import",
"modules",
"from",
"it",
".",
"This",
"isn",
"t",
"perfect",
":",
"it",
"doesn",
"t",
"use",
"the",
"Python",
"interpreter",
"with",
"which",
"the",
"virtualenv",
... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L670-L699 | [
"def",
"init_virtualenv",
"(",
"self",
")",
":",
"if",
"'VIRTUAL_ENV'",
"not",
"in",
"os",
".",
"environ",
":",
"# Not in a virtualenv",
"return",
"if",
"sys",
".",
"executable",
".",
"startswith",
"(",
"os",
".",
"environ",
"[",
"'VIRTUAL_ENV'",
"]",
")",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | InteractiveShell.save_sys_module_state | Save the state of hooks in the sys module.
This has to be called after self.user_module is created. | environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py | def save_sys_module_state(self):
"""Save the state of hooks in the sys module.
This has to be called after self.user_module is created.
"""
self._orig_sys_module_state = {}
self._orig_sys_module_state['stdin'] = sys.stdin
self._orig_sys_module_state['stdout'] = sys.stdou... | def save_sys_module_state(self):
"""Save the state of hooks in the sys module.
This has to be called after self.user_module is created.
"""
self._orig_sys_module_state = {}
self._orig_sys_module_state['stdin'] = sys.stdin
self._orig_sys_module_state['stdout'] = sys.stdou... | [
"Save",
"the",
"state",
"of",
"hooks",
"in",
"the",
"sys",
"module",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L705-L716 | [
"def",
"save_sys_module_state",
"(",
"self",
")",
":",
"self",
".",
"_orig_sys_module_state",
"=",
"{",
"}",
"self",
".",
"_orig_sys_module_state",
"[",
"'stdin'",
"]",
"=",
"sys",
".",
"stdin",
"self",
".",
"_orig_sys_module_state",
"[",
"'stdout'",
"]",
"=",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | InteractiveShell.restore_sys_module_state | Restore the state of the sys module. | environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py | def restore_sys_module_state(self):
"""Restore the state of the sys module."""
try:
for k, v in self._orig_sys_module_state.iteritems():
setattr(sys, k, v)
except AttributeError:
pass
# Reset what what done in self.init_sys_modules
if self.... | def restore_sys_module_state(self):
"""Restore the state of the sys module."""
try:
for k, v in self._orig_sys_module_state.iteritems():
setattr(sys, k, v)
except AttributeError:
pass
# Reset what what done in self.init_sys_modules
if self.... | [
"Restore",
"the",
"state",
"of",
"the",
"sys",
"module",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L718-L727 | [
"def",
"restore_sys_module_state",
"(",
"self",
")",
":",
"try",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"_orig_sys_module_state",
".",
"iteritems",
"(",
")",
":",
"setattr",
"(",
"sys",
",",
"k",
",",
"v",
")",
"except",
"AttributeError",
":",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | InteractiveShell.set_hook | set_hook(name,hook) -> sets an internal IPython hook.
IPython exposes some of its internal API as user-modifiable hooks. By
adding your function to one of these hooks, you can modify IPython's
behavior to call at runtime your own routines. | environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py | def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
"""set_hook(name,hook) -> sets an internal IPython hook.
IPython exposes some of its internal API as user-modifiable hooks. By
adding your function to one of these hooks, you can modify IPython's
behavior to ca... | def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
"""set_hook(name,hook) -> sets an internal IPython hook.
IPython exposes some of its internal API as user-modifiable hooks. By
adding your function to one of these hooks, you can modify IPython's
behavior to ca... | [
"set_hook",
"(",
"name",
"hook",
")",
"-",
">",
"sets",
"an",
"internal",
"IPython",
"hook",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L746-L784 | [
"def",
"set_hook",
"(",
"self",
",",
"name",
",",
"hook",
",",
"priority",
"=",
"50",
",",
"str_key",
"=",
"None",
",",
"re_key",
"=",
"None",
")",
":",
"# At some point in the future, this should validate the hook before it",
"# accepts it. Probably at least check tha... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.