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 | sync_results | sync relevant results from self.client to our results attribute. | environment/lib/python2.7/site-packages/IPython/parallel/client/view.py | def sync_results(f, self, *args, **kwargs):
"""sync relevant results from self.client to our results attribute."""
ret = f(self, *args, **kwargs)
delta = self.outstanding.difference(self.client.outstanding)
completed = self.outstanding.intersection(delta)
self.outstanding = self.outstanding.differen... | def sync_results(f, self, *args, **kwargs):
"""sync relevant results from self.client to our results attribute."""
ret = f(self, *args, **kwargs)
delta = self.outstanding.difference(self.client.outstanding)
completed = self.outstanding.intersection(delta)
self.outstanding = self.outstanding.differen... | [
"sync",
"relevant",
"results",
"from",
"self",
".",
"client",
"to",
"our",
"results",
"attribute",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/view.py#L57-L63 | [
"def",
"sync_results",
"(",
"f",
",",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"f",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"delta",
"=",
"self",
".",
"outstanding",
".",
"difference",
"(",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | spin_after | call spin after the method. | environment/lib/python2.7/site-packages/IPython/parallel/client/view.py | def spin_after(f, self, *args, **kwargs):
"""call spin after the method."""
ret = f(self, *args, **kwargs)
self.spin()
return ret | def spin_after(f, self, *args, **kwargs):
"""call spin after the method."""
ret = f(self, *args, **kwargs)
self.spin()
return ret | [
"call",
"spin",
"after",
"the",
"method",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/view.py#L66-L70 | [
"def",
"spin_after",
"(",
"f",
",",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"f",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"spin",
"(",
")",
"return",
"ret"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | MongoDB.add_record | Add a new Task Record, by msg_id. | environment/lib/python2.7/site-packages/IPython/parallel/controller/mongodb.py | def add_record(self, msg_id, rec):
"""Add a new Task Record, by msg_id."""
# print rec
rec = self._binary_buffers(rec)
self._records.insert(rec) | def add_record(self, msg_id, rec):
"""Add a new Task Record, by msg_id."""
# print rec
rec = self._binary_buffers(rec)
self._records.insert(rec) | [
"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/mongodb.py#L63-L67 | [
"def",
"add_record",
"(",
"self",
",",
"msg_id",
",",
"rec",
")",
":",
"# print rec",
"rec",
"=",
"self",
".",
"_binary_buffers",
"(",
"rec",
")",
"self",
".",
"_records",
".",
"insert",
"(",
"rec",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | MongoDB.get_record | Get a specific Task Record, by msg_id. | environment/lib/python2.7/site-packages/IPython/parallel/controller/mongodb.py | def get_record(self, msg_id):
"""Get a specific Task Record, by msg_id."""
r = self._records.find_one({'msg_id': msg_id})
if not r:
# r will be '' if nothing is found
raise KeyError(msg_id)
return r | def get_record(self, msg_id):
"""Get a specific Task Record, by msg_id."""
r = self._records.find_one({'msg_id': msg_id})
if not r:
# r will be '' if nothing is found
raise KeyError(msg_id)
return r | [
"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/mongodb.py#L69-L75 | [
"def",
"get_record",
"(",
"self",
",",
"msg_id",
")",
":",
"r",
"=",
"self",
".",
"_records",
".",
"find_one",
"(",
"{",
"'msg_id'",
":",
"msg_id",
"}",
")",
"if",
"not",
"r",
":",
"# r will be '' if nothing is found",
"raise",
"KeyError",
"(",
"msg_id",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | MongoDB.update_record | Update the data in an existing record. | environment/lib/python2.7/site-packages/IPython/parallel/controller/mongodb.py | def update_record(self, msg_id, rec):
"""Update the data in an existing record."""
rec = self._binary_buffers(rec)
self._records.update({'msg_id':msg_id}, {'$set': rec}) | def update_record(self, msg_id, rec):
"""Update the data in an existing record."""
rec = self._binary_buffers(rec)
self._records.update({'msg_id':msg_id}, {'$set': rec}) | [
"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/mongodb.py#L77-L81 | [
"def",
"update_record",
"(",
"self",
",",
"msg_id",
",",
"rec",
")",
":",
"rec",
"=",
"self",
".",
"_binary_buffers",
"(",
"rec",
")",
"self",
".",
"_records",
".",
"update",
"(",
"{",
"'msg_id'",
":",
"msg_id",
"}",
",",
"{",
"'$set'",
":",
"rec",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | MongoDB.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 ... | environment/lib/python2.7/site-packages/IPython/parallel/controller/mongodb.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 str... | 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 str... | [
"Find",
"records",
"matching",
"a",
"query",
"dict",
"optionally",
"extracting",
"subset",
"of",
"keys",
".",
"Returns",
"list",
"of",
"matching",
"records",
".",
"Parameters",
"----------",
"check",
":",
"dict",
"mongodb",
"-",
"style",
"query",
"argument",
"... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/mongodb.py#L91-L110 | [
"def",
"find_records",
"(",
"self",
",",
"check",
",",
"keys",
"=",
"None",
")",
":",
"if",
"keys",
"and",
"'msg_id'",
"not",
"in",
"keys",
":",
"keys",
".",
"append",
"(",
"'msg_id'",
")",
"matches",
"=",
"list",
"(",
"self",
".",
"_records",
".",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | MongoDB.get_history | get all msg_ids, ordered by time submitted. | environment/lib/python2.7/site-packages/IPython/parallel/controller/mongodb.py | def get_history(self):
"""get all msg_ids, ordered by time submitted."""
cursor = self._records.find({},{'msg_id':1}).sort('submitted')
return [ rec['msg_id'] for rec in cursor ] | def get_history(self):
"""get all msg_ids, ordered by time submitted."""
cursor = self._records.find({},{'msg_id':1}).sort('submitted')
return [ rec['msg_id'] for rec in cursor ] | [
"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/mongodb.py#L112-L115 | [
"def",
"get_history",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"_records",
".",
"find",
"(",
"{",
"}",
",",
"{",
"'msg_id'",
":",
"1",
"}",
")",
".",
"sort",
"(",
"'submitted'",
")",
"return",
"[",
"rec",
"[",
"'msg_id'",
"]",
"for",
"r... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BlockingSubSocketChannel.get_msgs | Get all messages that are currently ready. | environment/lib/python2.7/site-packages/IPython/zmq/blockingkernelmanager.py | def get_msgs(self):
"""Get all messages that are currently ready."""
msgs = []
while True:
try:
msgs.append(self.get_msg(block=False))
except Empty:
break
return msgs | def get_msgs(self):
"""Get all messages that are currently ready."""
msgs = []
while True:
try:
msgs.append(self.get_msg(block=False))
except Empty:
break
return msgs | [
"Get",
"all",
"messages",
"that",
"are",
"currently",
"ready",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/blockingkernelmanager.py#L58-L66 | [
"def",
"get_msgs",
"(",
"self",
")",
":",
"msgs",
"=",
"[",
"]",
"while",
"True",
":",
"try",
":",
"msgs",
".",
"append",
"(",
"self",
".",
"get_msg",
"(",
"block",
"=",
"False",
")",
")",
"except",
"Empty",
":",
"break",
"return",
"msgs"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BlockingStdInSocketChannel.get_msg | Gets a message if there is one that is ready. | environment/lib/python2.7/site-packages/IPython/zmq/blockingkernelmanager.py | def get_msg(self, block=True, timeout=None):
"Gets a message if there is one that is ready."
return self._in_queue.get(block, timeout) | def get_msg(self, block=True, timeout=None):
"Gets a message if there is one that is ready."
return self._in_queue.get(block, timeout) | [
"Gets",
"a",
"message",
"if",
"there",
"is",
"one",
"that",
"is",
"ready",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/blockingkernelmanager.py#L116-L118 | [
"def",
"get_msg",
"(",
"self",
",",
"block",
"=",
"True",
",",
"timeout",
"=",
"None",
")",
":",
"return",
"self",
".",
"_in_queue",
".",
"get",
"(",
"block",
",",
"timeout",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | prop | `prop` is a sugar for `property`.
``` py
@prop
def value(self):
pass
# equals:
@property
def value(self):
return self._value
@value.setter
def value(self, val):
self._value = val
``` | jasily/lang/props.py | def prop(func=None, *,
field = _UNSET,
get: bool = True, set: bool = True, del_: bool = False,
default = _UNSET,
types: tuple = _UNSET):
'''
`prop` is a sugar for `property`.
``` py
@prop
def value(self):
pass
# equals:
@property
def value(s... | def prop(func=None, *,
field = _UNSET,
get: bool = True, set: bool = True, del_: bool = False,
default = _UNSET,
types: tuple = _UNSET):
'''
`prop` is a sugar for `property`.
``` py
@prop
def value(self):
pass
# equals:
@property
def value(s... | [
"prop",
"is",
"a",
"sugar",
"for",
"property",
"."
] | Jasily/jasily-python | python | https://github.com/Jasily/jasily-python/blob/1c821a120ebbbbc3c5761f5f1e8a73588059242a/jasily/lang/props.py#L11-L73 | [
"def",
"prop",
"(",
"func",
"=",
"None",
",",
"*",
",",
"field",
"=",
"_UNSET",
",",
"get",
":",
"bool",
"=",
"True",
",",
"set",
":",
"bool",
"=",
"True",
",",
"del_",
":",
"bool",
"=",
"False",
",",
"default",
"=",
"_UNSET",
",",
"types",
":"... | 1c821a120ebbbbc3c5761f5f1e8a73588059242a |
test | get_onlys | `get_onlys` is a sugar for multi-`property`.
``` py
name, age = get_onlys('_name', '_age')
# equals:
@property
def name(self):
return getattr(self, '_name')
@property
def age(self):
return getattr(self, '_age')
``` | jasily/lang/props.py | def get_onlys(*fields):
'''
`get_onlys` is a sugar for multi-`property`.
``` py
name, age = get_onlys('_name', '_age')
# equals:
@property
def name(self):
return getattr(self, '_name')
@property
def age(self):
return getattr(self, '_age')
```
'''
retur... | def get_onlys(*fields):
'''
`get_onlys` is a sugar for multi-`property`.
``` py
name, age = get_onlys('_name', '_age')
# equals:
@property
def name(self):
return getattr(self, '_name')
@property
def age(self):
return getattr(self, '_age')
```
'''
retur... | [
"get_onlys",
"is",
"a",
"sugar",
"for",
"multi",
"-",
"property",
"."
] | Jasily/jasily-python | python | https://github.com/Jasily/jasily-python/blob/1c821a120ebbbbc3c5761f5f1e8a73588059242a/jasily/lang/props.py#L91-L109 | [
"def",
"get_onlys",
"(",
"*",
"fields",
")",
":",
"return",
"tuple",
"(",
"property",
"(",
"lambda",
"self",
",",
"f",
"=",
"f",
":",
"getattr",
"(",
"self",
",",
"f",
")",
")",
"for",
"f",
"in",
"fields",
")"
] | 1c821a120ebbbbc3c5761f5f1e8a73588059242a |
test | parse | Parses a database URL. | dj_mongohq_url.py | def parse(url):
"""Parses a database URL."""
config = {}
if not isinstance(url, six.string_types):
url = ''
url = urlparse.urlparse(url)
# Remove query strings.
path = url.path[1:]
path = path.split('?', 2)[0]
# Update with environment configuration.
config.update({
... | def parse(url):
"""Parses a database URL."""
config = {}
if not isinstance(url, six.string_types):
url = ''
url = urlparse.urlparse(url)
# Remove query strings.
path = url.path[1:]
path = path.split('?', 2)[0]
# Update with environment configuration.
config.update({
... | [
"Parses",
"a",
"database",
"URL",
"."
] | ferrix/dj-mongohq-url | python | https://github.com/ferrix/dj-mongohq-url/blob/0901ca46cf7071881726310e666a5fe9aa0303ef/dj_mongohq_url.py#L36-L62 | [
"def",
"parse",
"(",
"url",
")",
":",
"config",
"=",
"{",
"}",
"if",
"not",
"isinstance",
"(",
"url",
",",
"six",
".",
"string_types",
")",
":",
"url",
"=",
"''",
"url",
"=",
"urlparse",
".",
"urlparse",
"(",
"url",
")",
"# Remove query strings.",
"p... | 0901ca46cf7071881726310e666a5fe9aa0303ef |
test | module_list | Return the list containing the names of the modules available in the given
folder. | environment/lib/python2.7/site-packages/IPython/core/completerlib.py | def module_list(path):
"""
Return the list containing the names of the modules available in the given
folder.
"""
# sys.path has the cwd as an empty string, but isdir/listdir need it as '.'
if path == '':
path = '.'
if os.path.isdir(path):
folder_list = os.listdir(path)
... | def module_list(path):
"""
Return the list containing the names of the modules available in the given
folder.
"""
# sys.path has the cwd as an empty string, but isdir/listdir need it as '.'
if path == '':
path = '.'
if os.path.isdir(path):
folder_list = os.listdir(path)
... | [
"Return",
"the",
"list",
"containing",
"the",
"names",
"of",
"the",
"modules",
"available",
"in",
"the",
"given",
"folder",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completerlib.py#L59-L96 | [
"def",
"module_list",
"(",
"path",
")",
":",
"# sys.path has the cwd as an empty string, but isdir/listdir need it as '.'",
"if",
"path",
"==",
"''",
":",
"path",
"=",
"'.'",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"folder_list",
"=",
"os",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | get_root_modules | Returns a list containing the names of all the modules available in the
folders of the pythonpath. | environment/lib/python2.7/site-packages/IPython/core/completerlib.py | def get_root_modules():
"""
Returns a list containing the names of all the modules available in the
folders of the pythonpath.
"""
ip = get_ipython()
if 'rootmodules' in ip.db:
return ip.db['rootmodules']
t = time()
store = False
modules = list(sys.builtin_module_names)
... | def get_root_modules():
"""
Returns a list containing the names of all the modules available in the
folders of the pythonpath.
"""
ip = get_ipython()
if 'rootmodules' in ip.db:
return ip.db['rootmodules']
t = time()
store = False
modules = list(sys.builtin_module_names)
... | [
"Returns",
"a",
"list",
"containing",
"the",
"names",
"of",
"all",
"the",
"modules",
"available",
"in",
"the",
"folders",
"of",
"the",
"pythonpath",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completerlib.py#L98-L130 | [
"def",
"get_root_modules",
"(",
")",
":",
"ip",
"=",
"get_ipython",
"(",
")",
"if",
"'rootmodules'",
"in",
"ip",
".",
"db",
":",
"return",
"ip",
".",
"db",
"[",
"'rootmodules'",
"]",
"t",
"=",
"time",
"(",
")",
"store",
"=",
"False",
"modules",
"=",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | quick_completer | Easily create a trivial completer for a command.
Takes either a list of completions, or all completions in string (that will
be split on whitespace).
Example::
[d:\ipython]|1> import ipy_completers
[d:\ipython]|2> ipy_completers.quick_completer('foo', ['bar','baz'])
[d:\ipython]|3... | environment/lib/python2.7/site-packages/IPython/core/completerlib.py | def quick_completer(cmd, completions):
""" Easily create a trivial completer for a command.
Takes either a list of completions, or all completions in string (that will
be split on whitespace).
Example::
[d:\ipython]|1> import ipy_completers
[d:\ipython]|2> ipy_completers.quick_complet... | def quick_completer(cmd, completions):
""" Easily create a trivial completer for a command.
Takes either a list of completions, or all completions in string (that will
be split on whitespace).
Example::
[d:\ipython]|1> import ipy_completers
[d:\ipython]|2> ipy_completers.quick_complet... | [
"Easily",
"create",
"a",
"trivial",
"completer",
"for",
"a",
"command",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completerlib.py#L169-L190 | [
"def",
"quick_completer",
"(",
"cmd",
",",
"completions",
")",
":",
"if",
"isinstance",
"(",
"completions",
",",
"basestring",
")",
":",
"completions",
"=",
"completions",
".",
"split",
"(",
")",
"def",
"do_complete",
"(",
"self",
",",
"event",
")",
":",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | module_completion | Returns a list containing the completion possibilities for an import line.
The line looks like this :
'import xml.d'
'from xml.dom import' | environment/lib/python2.7/site-packages/IPython/core/completerlib.py | def module_completion(line):
"""
Returns a list containing the completion possibilities for an import line.
The line looks like this :
'import xml.d'
'from xml.dom import'
"""
words = line.split(' ')
nwords = len(words)
# from whatever <tab> -> 'import '
if nwords == 3 and wor... | def module_completion(line):
"""
Returns a list containing the completion possibilities for an import line.
The line looks like this :
'import xml.d'
'from xml.dom import'
"""
words = line.split(' ')
nwords = len(words)
# from whatever <tab> -> 'import '
if nwords == 3 and wor... | [
"Returns",
"a",
"list",
"containing",
"the",
"completion",
"possibilities",
"for",
"an",
"import",
"line",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completerlib.py#L192-L221 | [
"def",
"module_completion",
"(",
"line",
")",
":",
"words",
"=",
"line",
".",
"split",
"(",
"' '",
")",
"nwords",
"=",
"len",
"(",
"words",
")",
"# from whatever <tab> -> 'import '",
"if",
"nwords",
"==",
"3",
"and",
"words",
"[",
"0",
"]",
"==",
"'from'... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | magic_run_completer | Complete files that end in .py or .ipy for the %run command. | environment/lib/python2.7/site-packages/IPython/core/completerlib.py | def magic_run_completer(self, event):
"""Complete files that end in .py or .ipy for the %run command.
"""
comps = arg_split(event.line, strict=False)
relpath = (len(comps) > 1 and comps[-1] or '').strip("'\"")
#print("\nev=", event) # dbg
#print("rp=", relpath) # dbg
#print('comps=', comp... | def magic_run_completer(self, event):
"""Complete files that end in .py or .ipy for the %run command.
"""
comps = arg_split(event.line, strict=False)
relpath = (len(comps) > 1 and comps[-1] or '').strip("'\"")
#print("\nev=", event) # dbg
#print("rp=", relpath) # dbg
#print('comps=', comp... | [
"Complete",
"files",
"that",
"end",
"in",
".",
"py",
"or",
".",
"ipy",
"for",
"the",
"%run",
"command",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completerlib.py#L243-L270 | [
"def",
"magic_run_completer",
"(",
"self",
",",
"event",
")",
":",
"comps",
"=",
"arg_split",
"(",
"event",
".",
"line",
",",
"strict",
"=",
"False",
")",
"relpath",
"=",
"(",
"len",
"(",
"comps",
")",
">",
"1",
"and",
"comps",
"[",
"-",
"1",
"]",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | cd_completer | Completer function for cd, which only returns directories. | environment/lib/python2.7/site-packages/IPython/core/completerlib.py | def cd_completer(self, event):
"""Completer function for cd, which only returns directories."""
ip = get_ipython()
relpath = event.symbol
#print(event) # dbg
if event.line.endswith('-b') or ' -b ' in event.line:
# return only bookmark completions
bkms = self.db.get('bookmarks', None... | def cd_completer(self, event):
"""Completer function for cd, which only returns directories."""
ip = get_ipython()
relpath = event.symbol
#print(event) # dbg
if event.line.endswith('-b') or ' -b ' in event.line:
# return only bookmark completions
bkms = self.db.get('bookmarks', None... | [
"Completer",
"function",
"for",
"cd",
"which",
"only",
"returns",
"directories",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completerlib.py#L273-L325 | [
"def",
"cd_completer",
"(",
"self",
",",
"event",
")",
":",
"ip",
"=",
"get_ipython",
"(",
")",
"relpath",
"=",
"event",
".",
"symbol",
"#print(event) # dbg",
"if",
"event",
".",
"line",
".",
"endswith",
"(",
"'-b'",
")",
"or",
"' -b '",
"in",
"event",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | JavascriptWidget.interact | This should call display(Javascript(jscode)). | environment/share/doc/ipython/examples/widgets/directview/widget.py | def interact(self):
"""This should call display(Javascript(jscode))."""
jscode = self.render()
display(Javascript(data=jscode,lib=self.jslibs)) | def interact(self):
"""This should call display(Javascript(jscode))."""
jscode = self.render()
display(Javascript(data=jscode,lib=self.jslibs)) | [
"This",
"should",
"call",
"display",
"(",
"Javascript",
"(",
"jscode",
"))",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/widgets/directview/widget.py#L48-L51 | [
"def",
"interact",
"(",
"self",
")",
":",
"jscode",
"=",
"self",
".",
"render",
"(",
")",
"display",
"(",
"Javascript",
"(",
"data",
"=",
"jscode",
",",
"lib",
"=",
"self",
".",
"jslibs",
")",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Xunit._quoteattr | Escape an XML attribute. Value can be unicode. | environment/lib/python2.7/site-packages/nose/plugins/xunit.py | def _quoteattr(self, attr):
"""Escape an XML attribute. Value can be unicode."""
attr = xml_safe(attr)
if isinstance(attr, unicode) and not UNICODE_STRINGS:
attr = attr.encode(self.encoding)
return saxutils.quoteattr(attr) | def _quoteattr(self, attr):
"""Escape an XML attribute. Value can be unicode."""
attr = xml_safe(attr)
if isinstance(attr, unicode) and not UNICODE_STRINGS:
attr = attr.encode(self.encoding)
return saxutils.quoteattr(attr) | [
"Escape",
"an",
"XML",
"attribute",
".",
"Value",
"can",
"be",
"unicode",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/xunit.py#L132-L137 | [
"def",
"_quoteattr",
"(",
"self",
",",
"attr",
")",
":",
"attr",
"=",
"xml_safe",
"(",
"attr",
")",
"if",
"isinstance",
"(",
"attr",
",",
"unicode",
")",
"and",
"not",
"UNICODE_STRINGS",
":",
"attr",
"=",
"attr",
".",
"encode",
"(",
"self",
".",
"enc... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Xunit.configure | Configures the xunit plugin. | environment/lib/python2.7/site-packages/nose/plugins/xunit.py | def configure(self, options, config):
"""Configures the xunit plugin."""
Plugin.configure(self, options, config)
self.config = config
if self.enabled:
self.stats = {'errors': 0,
'failures': 0,
'passes': 0,
... | def configure(self, options, config):
"""Configures the xunit plugin."""
Plugin.configure(self, options, config)
self.config = config
if self.enabled:
self.stats = {'errors': 0,
'failures': 0,
'passes': 0,
... | [
"Configures",
"the",
"xunit",
"plugin",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/xunit.py#L150-L162 | [
"def",
"configure",
"(",
"self",
",",
"options",
",",
"config",
")",
":",
"Plugin",
".",
"configure",
"(",
"self",
",",
"options",
",",
"config",
")",
"self",
".",
"config",
"=",
"config",
"if",
"self",
".",
"enabled",
":",
"self",
".",
"stats",
"=",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Xunit.report | Writes an Xunit-formatted XML file
The file includes a report of test errors and failures. | environment/lib/python2.7/site-packages/nose/plugins/xunit.py | def report(self, stream):
"""Writes an Xunit-formatted XML file
The file includes a report of test errors and failures.
"""
self.stats['encoding'] = self.encoding
self.stats['total'] = (self.stats['errors'] + self.stats['failures']
+ self.stats['p... | def report(self, stream):
"""Writes an Xunit-formatted XML file
The file includes a report of test errors and failures.
"""
self.stats['encoding'] = self.encoding
self.stats['total'] = (self.stats['errors'] + self.stats['failures']
+ self.stats['p... | [
"Writes",
"an",
"Xunit",
"-",
"formatted",
"XML",
"file"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/xunit.py#L164-L184 | [
"def",
"report",
"(",
"self",
",",
"stream",
")",
":",
"self",
".",
"stats",
"[",
"'encoding'",
"]",
"=",
"self",
".",
"encoding",
"self",
".",
"stats",
"[",
"'total'",
"]",
"=",
"(",
"self",
".",
"stats",
"[",
"'errors'",
"]",
"+",
"self",
".",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Xunit.addError | Add error output to Xunit report. | environment/lib/python2.7/site-packages/nose/plugins/xunit.py | def addError(self, test, err, capt=None):
"""Add error output to Xunit report.
"""
taken = self._timeTaken()
if issubclass(err[0], SkipTest):
type = 'skipped'
self.stats['skipped'] += 1
else:
type = 'error'
self.stats['errors'] += ... | def addError(self, test, err, capt=None):
"""Add error output to Xunit report.
"""
taken = self._timeTaken()
if issubclass(err[0], SkipTest):
type = 'skipped'
self.stats['skipped'] += 1
else:
type = 'error'
self.stats['errors'] += ... | [
"Add",
"error",
"output",
"to",
"Xunit",
"report",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/xunit.py#L190-L214 | [
"def",
"addError",
"(",
"self",
",",
"test",
",",
"err",
",",
"capt",
"=",
"None",
")",
":",
"taken",
"=",
"self",
".",
"_timeTaken",
"(",
")",
"if",
"issubclass",
"(",
"err",
"[",
"0",
"]",
",",
"SkipTest",
")",
":",
"type",
"=",
"'skipped'",
"s... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Xunit.addFailure | Add failure output to Xunit report. | environment/lib/python2.7/site-packages/nose/plugins/xunit.py | def addFailure(self, test, err, capt=None, tb_info=None):
"""Add failure output to Xunit report.
"""
taken = self._timeTaken()
tb = ''.join(traceback.format_exception(*err))
self.stats['failures'] += 1
id = test.id()
self.errorlist.append(
'<testcase c... | def addFailure(self, test, err, capt=None, tb_info=None):
"""Add failure output to Xunit report.
"""
taken = self._timeTaken()
tb = ''.join(traceback.format_exception(*err))
self.stats['failures'] += 1
id = test.id()
self.errorlist.append(
'<testcase c... | [
"Add",
"failure",
"output",
"to",
"Xunit",
"report",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/xunit.py#L216-L233 | [
"def",
"addFailure",
"(",
"self",
",",
"test",
",",
"err",
",",
"capt",
"=",
"None",
",",
"tb_info",
"=",
"None",
")",
":",
"taken",
"=",
"self",
".",
"_timeTaken",
"(",
")",
"tb",
"=",
"''",
".",
"join",
"(",
"traceback",
".",
"format_exception",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Xunit.addSuccess | Add success output to Xunit report. | environment/lib/python2.7/site-packages/nose/plugins/xunit.py | def addSuccess(self, test, capt=None):
"""Add success output to Xunit report.
"""
taken = self._timeTaken()
self.stats['passes'] += 1
id = test.id()
self.errorlist.append(
'<testcase classname=%(cls)s name=%(name)s '
'time="%(taken).3f" />' %
... | def addSuccess(self, test, capt=None):
"""Add success output to Xunit report.
"""
taken = self._timeTaken()
self.stats['passes'] += 1
id = test.id()
self.errorlist.append(
'<testcase classname=%(cls)s name=%(name)s '
'time="%(taken).3f" />' %
... | [
"Add",
"success",
"output",
"to",
"Xunit",
"report",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/xunit.py#L235-L247 | [
"def",
"addSuccess",
"(",
"self",
",",
"test",
",",
"capt",
"=",
"None",
")",
":",
"taken",
"=",
"self",
".",
"_timeTaken",
"(",
")",
"self",
".",
"stats",
"[",
"'passes'",
"]",
"+=",
"1",
"id",
"=",
"test",
".",
"id",
"(",
")",
"self",
".",
"e... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | twobin | Pick two at random, use the LRU of the two.
The content of loads is ignored.
Assumes LRU ordering of loads, with oldest first. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def twobin(loads):
"""Pick two at random, use the LRU of the two.
The content of loads is ignored.
Assumes LRU ordering of loads, with oldest first.
"""
n = len(loads)
a = randint(0,n-1)
b = randint(0,n-1)
return min(a,b) | def twobin(loads):
"""Pick two at random, use the LRU of the two.
The content of loads is ignored.
Assumes LRU ordering of loads, with oldest first.
"""
n = len(loads)
a = randint(0,n-1)
b = randint(0,n-1)
return min(a,b) | [
"Pick",
"two",
"at",
"random",
"use",
"the",
"LRU",
"of",
"the",
"two",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L78-L88 | [
"def",
"twobin",
"(",
"loads",
")",
":",
"n",
"=",
"len",
"(",
"loads",
")",
"a",
"=",
"randint",
"(",
"0",
",",
"n",
"-",
"1",
")",
"b",
"=",
"randint",
"(",
"0",
",",
"n",
"-",
"1",
")",
"return",
"min",
"(",
"a",
",",
"b",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | weighted | Pick two at random using inverse load as weight.
Return the less loaded of the two. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def weighted(loads):
"""Pick two at random using inverse load as weight.
Return the less loaded of the two.
"""
# weight 0 a million times more than 1:
weights = 1./(1e-6+numpy.array(loads))
sums = weights.cumsum()
t = sums[-1]
x = random()*t
y = random()*t
idx = 0
idy = 0
... | def weighted(loads):
"""Pick two at random using inverse load as weight.
Return the less loaded of the two.
"""
# weight 0 a million times more than 1:
weights = 1./(1e-6+numpy.array(loads))
sums = weights.cumsum()
t = sums[-1]
x = random()*t
y = random()*t
idx = 0
idy = 0
... | [
"Pick",
"two",
"at",
"random",
"using",
"inverse",
"load",
"as",
"weight",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L90-L110 | [
"def",
"weighted",
"(",
"loads",
")",
":",
"# weight 0 a million times more than 1:",
"weights",
"=",
"1.",
"/",
"(",
"1e-6",
"+",
"numpy",
".",
"array",
"(",
"loads",
")",
")",
"sums",
"=",
"weights",
".",
"cumsum",
"(",
")",
"t",
"=",
"sums",
"[",
"-... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler.dispatch_notification | dispatch register/unregister events. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def dispatch_notification(self, msg):
"""dispatch register/unregister events."""
try:
idents,msg = self.session.feed_identities(msg)
except ValueError:
self.log.warn("task::Invalid Message: %r",msg)
return
try:
msg = self.session.unserializ... | def dispatch_notification(self, msg):
"""dispatch register/unregister events."""
try:
idents,msg = self.session.feed_identities(msg)
except ValueError:
self.log.warn("task::Invalid Message: %r",msg)
return
try:
msg = self.session.unserializ... | [
"dispatch",
"register",
"/",
"unregister",
"events",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L246-L268 | [
"def",
"dispatch_notification",
"(",
"self",
",",
"msg",
")",
":",
"try",
":",
"idents",
",",
"msg",
"=",
"self",
".",
"session",
".",
"feed_identities",
"(",
"msg",
")",
"except",
"ValueError",
":",
"self",
".",
"log",
".",
"warn",
"(",
"\"task::Invalid... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler._register_engine | New engine with ident `uid` became available. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def _register_engine(self, uid):
"""New engine with ident `uid` became available."""
# head of the line:
self.targets.insert(0,uid)
self.loads.insert(0,0)
# initialize sets
self.completed[uid] = set()
self.failed[uid] = set()
self.pending[uid] = {}
... | def _register_engine(self, uid):
"""New engine with ident `uid` became available."""
# head of the line:
self.targets.insert(0,uid)
self.loads.insert(0,0)
# initialize sets
self.completed[uid] = set()
self.failed[uid] = set()
self.pending[uid] = {}
... | [
"New",
"engine",
"with",
"ident",
"uid",
"became",
"available",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L270-L282 | [
"def",
"_register_engine",
"(",
"self",
",",
"uid",
")",
":",
"# head of the line:",
"self",
".",
"targets",
".",
"insert",
"(",
"0",
",",
"uid",
")",
"self",
".",
"loads",
".",
"insert",
"(",
"0",
",",
"0",
")",
"# initialize sets",
"self",
".",
"comp... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler._unregister_engine | Existing engine with ident `uid` became unavailable. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def _unregister_engine(self, uid):
"""Existing engine with ident `uid` became unavailable."""
if len(self.targets) == 1:
# this was our only engine
pass
# handle any potentially finished tasks:
self.engine_stream.flush()
# don't pop destinations, because... | def _unregister_engine(self, uid):
"""Existing engine with ident `uid` became unavailable."""
if len(self.targets) == 1:
# this was our only engine
pass
# handle any potentially finished tasks:
self.engine_stream.flush()
# don't pop destinations, because... | [
"Existing",
"engine",
"with",
"ident",
"uid",
"became",
"unavailable",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L284-L309 | [
"def",
"_unregister_engine",
"(",
"self",
",",
"uid",
")",
":",
"if",
"len",
"(",
"self",
".",
"targets",
")",
"==",
"1",
":",
"# this was our only engine",
"pass",
"# handle any potentially finished tasks:",
"self",
".",
"engine_stream",
".",
"flush",
"(",
")",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler.handle_stranded_tasks | Deal with jobs resident in an engine that died. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def handle_stranded_tasks(self, engine):
"""Deal with jobs resident in an engine that died."""
lost = self.pending[engine]
for msg_id in lost.keys():
if msg_id not in self.pending[engine]:
# prevent double-handling of messages
continue
raw... | def handle_stranded_tasks(self, engine):
"""Deal with jobs resident in an engine that died."""
lost = self.pending[engine]
for msg_id in lost.keys():
if msg_id not in self.pending[engine]:
# prevent double-handling of messages
continue
raw... | [
"Deal",
"with",
"jobs",
"resident",
"in",
"an",
"engine",
"that",
"died",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L312-L343 | [
"def",
"handle_stranded_tasks",
"(",
"self",
",",
"engine",
")",
":",
"lost",
"=",
"self",
".",
"pending",
"[",
"engine",
"]",
"for",
"msg_id",
"in",
"lost",
".",
"keys",
"(",
")",
":",
"if",
"msg_id",
"not",
"in",
"self",
".",
"pending",
"[",
"engin... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler.dispatch_submission | Dispatch job submission to appropriate handlers. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def dispatch_submission(self, raw_msg):
"""Dispatch job submission to appropriate handlers."""
# ensure targets up to date:
self.notifier_stream.flush()
try:
idents, msg = self.session.feed_identities(raw_msg, copy=False)
msg = self.session.unserialize(msg, conten... | def dispatch_submission(self, raw_msg):
"""Dispatch job submission to appropriate handlers."""
# ensure targets up to date:
self.notifier_stream.flush()
try:
idents, msg = self.session.feed_identities(raw_msg, copy=False)
msg = self.session.unserialize(msg, conten... | [
"Dispatch",
"job",
"submission",
"to",
"appropriate",
"handlers",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L352-L440 | [
"def",
"dispatch_submission",
"(",
"self",
",",
"raw_msg",
")",
":",
"# ensure targets up to date:",
"self",
".",
"notifier_stream",
".",
"flush",
"(",
")",
"try",
":",
"idents",
",",
"msg",
"=",
"self",
".",
"session",
".",
"feed_identities",
"(",
"raw_msg",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler.audit_timeouts | Audit all waiting tasks for expired timeouts. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def audit_timeouts(self):
"""Audit all waiting tasks for expired timeouts."""
now = datetime.now()
for msg_id in self.depending.keys():
# must recheck, in case one failure cascaded to another:
if msg_id in self.depending:
job = self.depending[msg_id]
... | def audit_timeouts(self):
"""Audit all waiting tasks for expired timeouts."""
now = datetime.now()
for msg_id in self.depending.keys():
# must recheck, in case one failure cascaded to another:
if msg_id in self.depending:
job = self.depending[msg_id]
... | [
"Audit",
"all",
"waiting",
"tasks",
"for",
"expired",
"timeouts",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L442-L450 | [
"def",
"audit_timeouts",
"(",
"self",
")",
":",
"now",
"=",
"datetime",
".",
"now",
"(",
")",
"for",
"msg_id",
"in",
"self",
".",
"depending",
".",
"keys",
"(",
")",
":",
"# must recheck, in case one failure cascaded to another:",
"if",
"msg_id",
"in",
"self",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler.fail_unreachable | a task has become unreachable, send a reply with an ImpossibleDependency
error. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def fail_unreachable(self, msg_id, why=error.ImpossibleDependency):
"""a task has become unreachable, send a reply with an ImpossibleDependency
error."""
if msg_id not in self.depending:
self.log.error("msg %r already failed!", msg_id)
return
job = self.depending.... | def fail_unreachable(self, msg_id, why=error.ImpossibleDependency):
"""a task has become unreachable, send a reply with an ImpossibleDependency
error."""
if msg_id not in self.depending:
self.log.error("msg %r already failed!", msg_id)
return
job = self.depending.... | [
"a",
"task",
"has",
"become",
"unreachable",
"send",
"a",
"reply",
"with",
"an",
"ImpossibleDependency",
"error",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L452-L475 | [
"def",
"fail_unreachable",
"(",
"self",
",",
"msg_id",
",",
"why",
"=",
"error",
".",
"ImpossibleDependency",
")",
":",
"if",
"msg_id",
"not",
"in",
"self",
".",
"depending",
":",
"self",
".",
"log",
".",
"error",
"(",
"\"msg %r already failed!\"",
",",
"m... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler.maybe_run | check location dependencies, and run if they are met. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def maybe_run(self, job):
"""check location dependencies, and run if they are met."""
msg_id = job.msg_id
self.log.debug("Attempting to assign task %s", msg_id)
if not self.targets:
# no engines, definitely can't run
return False
if job.follow or ... | def maybe_run(self, job):
"""check location dependencies, and run if they are met."""
msg_id = job.msg_id
self.log.debug("Attempting to assign task %s", msg_id)
if not self.targets:
# no engines, definitely can't run
return False
if job.follow or ... | [
"check",
"location",
"dependencies",
"and",
"run",
"if",
"they",
"are",
"met",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L477-L531 | [
"def",
"maybe_run",
"(",
"self",
",",
"job",
")",
":",
"msg_id",
"=",
"job",
".",
"msg_id",
"self",
".",
"log",
".",
"debug",
"(",
"\"Attempting to assign task %s\"",
",",
"msg_id",
")",
"if",
"not",
"self",
".",
"targets",
":",
"# no engines, definitely can... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler.save_unmet | Save a message for later submission when its dependencies are met. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def save_unmet(self, job):
"""Save a message for later submission when its dependencies are met."""
msg_id = job.msg_id
self.depending[msg_id] = job
# track the ids in follow or after, but not those already finished
for dep_id in job.after.union(job.follow).difference(self.all_do... | def save_unmet(self, job):
"""Save a message for later submission when its dependencies are met."""
msg_id = job.msg_id
self.depending[msg_id] = job
# track the ids in follow or after, but not those already finished
for dep_id in job.after.union(job.follow).difference(self.all_do... | [
"Save",
"a",
"message",
"for",
"later",
"submission",
"when",
"its",
"dependencies",
"are",
"met",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L533-L541 | [
"def",
"save_unmet",
"(",
"self",
",",
"job",
")",
":",
"msg_id",
"=",
"job",
".",
"msg_id",
"self",
".",
"depending",
"[",
"msg_id",
"]",
"=",
"job",
"# track the ids in follow or after, but not those already finished",
"for",
"dep_id",
"in",
"job",
".",
"after... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler.submit_task | Submit a task to any of a subset of our targets. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def submit_task(self, job, indices=None):
"""Submit a task to any of a subset of our targets."""
if indices:
loads = [self.loads[i] for i in indices]
else:
loads = self.loads
idx = self.scheme(loads)
if indices:
idx = indices[idx]
targe... | def submit_task(self, job, indices=None):
"""Submit a task to any of a subset of our targets."""
if indices:
loads = [self.loads[i] for i in indices]
else:
loads = self.loads
idx = self.scheme(loads)
if indices:
idx = indices[idx]
targe... | [
"Submit",
"a",
"task",
"to",
"any",
"of",
"a",
"subset",
"of",
"our",
"targets",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L543-L563 | [
"def",
"submit_task",
"(",
"self",
",",
"job",
",",
"indices",
"=",
"None",
")",
":",
"if",
"indices",
":",
"loads",
"=",
"[",
"self",
".",
"loads",
"[",
"i",
"]",
"for",
"i",
"in",
"indices",
"]",
"else",
":",
"loads",
"=",
"self",
".",
"loads",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler.dispatch_result | dispatch method for result replies | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def dispatch_result(self, raw_msg):
"""dispatch method for result replies"""
try:
idents,msg = self.session.feed_identities(raw_msg, copy=False)
msg = self.session.unserialize(msg, content=False, copy=False)
engine = idents[0]
try:
idx = se... | def dispatch_result(self, raw_msg):
"""dispatch method for result replies"""
try:
idents,msg = self.session.feed_identities(raw_msg, copy=False)
msg = self.session.unserialize(msg, content=False, copy=False)
engine = idents[0]
try:
idx = se... | [
"dispatch",
"method",
"for",
"result",
"replies"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L572-L605 | [
"def",
"dispatch_result",
"(",
"self",
",",
"raw_msg",
")",
":",
"try",
":",
"idents",
",",
"msg",
"=",
"self",
".",
"session",
".",
"feed_identities",
"(",
"raw_msg",
",",
"copy",
"=",
"False",
")",
"msg",
"=",
"self",
".",
"session",
".",
"unserializ... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler.handle_result | handle a real task result, either success or failure | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def handle_result(self, idents, parent, raw_msg, success=True):
"""handle a real task result, either success or failure"""
# first, relay result to client
engine = idents[0]
client = idents[1]
# swap_ids for ROUTER-ROUTER mirror
raw_msg[:2] = [client,engine]
# pri... | def handle_result(self, idents, parent, raw_msg, success=True):
"""handle a real task result, either success or failure"""
# first, relay result to client
engine = idents[0]
client = idents[1]
# swap_ids for ROUTER-ROUTER mirror
raw_msg[:2] = [client,engine]
# pri... | [
"handle",
"a",
"real",
"task",
"result",
"either",
"success",
"or",
"failure"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L607-L628 | [
"def",
"handle_result",
"(",
"self",
",",
"idents",
",",
"parent",
",",
"raw_msg",
",",
"success",
"=",
"True",
")",
":",
"# first, relay result to client",
"engine",
"=",
"idents",
"[",
"0",
"]",
"client",
"=",
"idents",
"[",
"1",
"]",
"# swap_ids for ROUTE... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler.handle_unmet_dependency | handle an unmet dependency | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def handle_unmet_dependency(self, idents, parent):
"""handle an unmet dependency"""
engine = idents[0]
msg_id = parent['msg_id']
job = self.pending[engine].pop(msg_id)
job.blacklist.add(engine)
if job.blacklist == job.targets:
self.depending[msg_id] = job
... | def handle_unmet_dependency(self, idents, parent):
"""handle an unmet dependency"""
engine = idents[0]
msg_id = parent['msg_id']
job = self.pending[engine].pop(msg_id)
job.blacklist.add(engine)
if job.blacklist == job.targets:
self.depending[msg_id] = job
... | [
"handle",
"an",
"unmet",
"dependency"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L630-L654 | [
"def",
"handle_unmet_dependency",
"(",
"self",
",",
"idents",
",",
"parent",
")",
":",
"engine",
"=",
"idents",
"[",
"0",
"]",
"msg_id",
"=",
"parent",
"[",
"'msg_id'",
"]",
"job",
"=",
"self",
".",
"pending",
"[",
"engine",
"]",
".",
"pop",
"(",
"ms... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler.update_graph | dep_id just finished. Update our dependency
graph and submit any jobs that just became runable.
Called with dep_id=None to update entire graph for hwm, but without finishing
a task. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def update_graph(self, dep_id=None, success=True):
"""dep_id just finished. Update our dependency
graph and submit any jobs that just became runable.
Called with dep_id=None to update entire graph for hwm, but without finishing
a task.
"""
# print ("\n\n***********")
... | def update_graph(self, dep_id=None, success=True):
"""dep_id just finished. Update our dependency
graph and submit any jobs that just became runable.
Called with dep_id=None to update entire graph for hwm, but without finishing
a task.
"""
# print ("\n\n***********")
... | [
"dep_id",
"just",
"finished",
".",
"Update",
"our",
"dependency",
"graph",
"and",
"submit",
"any",
"jobs",
"that",
"just",
"became",
"runable",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L658-L695 | [
"def",
"update_graph",
"(",
"self",
",",
"dep_id",
"=",
"None",
",",
"success",
"=",
"True",
")",
":",
"# print (\"\\n\\n***********\")",
"# pprint (dep_id)",
"# pprint (self.graph)",
"# pprint (self.depending)",
"# pprint (self.all_completed)",
"# pprint (self.all_failed)",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TaskScheduler.add_job | Called after self.targets[idx] just got the job with header.
Override with subclasses. The default ordering is simple LRU.
The default loads are the number of outstanding jobs. | environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py | def add_job(self, idx):
"""Called after self.targets[idx] just got the job with header.
Override with subclasses. The default ordering is simple LRU.
The default loads are the number of outstanding jobs."""
self.loads[idx] += 1
for lis in (self.targets, self.loads):
... | def add_job(self, idx):
"""Called after self.targets[idx] just got the job with header.
Override with subclasses. The default ordering is simple LRU.
The default loads are the number of outstanding jobs."""
self.loads[idx] += 1
for lis in (self.targets, self.loads):
... | [
"Called",
"after",
"self",
".",
"targets",
"[",
"idx",
"]",
"just",
"got",
"the",
"job",
"with",
"header",
".",
"Override",
"with",
"subclasses",
".",
"The",
"default",
"ordering",
"is",
"simple",
"LRU",
".",
"The",
"default",
"loads",
"are",
"the",
"num... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L701-L707 | [
"def",
"add_job",
"(",
"self",
",",
"idx",
")",
":",
"self",
".",
"loads",
"[",
"idx",
"]",
"+=",
"1",
"for",
"lis",
"in",
"(",
"self",
".",
"targets",
",",
"self",
".",
"loads",
")",
":",
"lis",
".",
"append",
"(",
"lis",
".",
"pop",
"(",
"i... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Logger.logstart | Generate a new log-file with a default header.
Raises RuntimeError if the log has already been started | environment/lib/python2.7/site-packages/IPython/core/logger.py | def logstart(self, logfname=None, loghead=None, logmode=None,
log_output=False, timestamp=False, log_raw_input=False):
"""Generate a new log-file with a default header.
Raises RuntimeError if the log has already been started"""
if self.logfile is not None:
raise Ru... | def logstart(self, logfname=None, loghead=None, logmode=None,
log_output=False, timestamp=False, log_raw_input=False):
"""Generate a new log-file with a default header.
Raises RuntimeError if the log has already been started"""
if self.logfile is not None:
raise Ru... | [
"Generate",
"a",
"new",
"log",
"-",
"file",
"with",
"a",
"default",
"header",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/logger.py#L65-L128 | [
"def",
"logstart",
"(",
"self",
",",
"logfname",
"=",
"None",
",",
"loghead",
"=",
"None",
",",
"logmode",
"=",
"None",
",",
"log_output",
"=",
"False",
",",
"timestamp",
"=",
"False",
",",
"log_raw_input",
"=",
"False",
")",
":",
"if",
"self",
".",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Logger.switch_log | Switch logging on/off. val should be ONLY a boolean. | environment/lib/python2.7/site-packages/IPython/core/logger.py | def switch_log(self,val):
"""Switch logging on/off. val should be ONLY a boolean."""
if val not in [False,True,0,1]:
raise ValueError, \
'Call switch_log ONLY with a boolean argument, not with:',val
label = {0:'OFF',1:'ON',False:'OFF',True:'ON'}
if self.l... | def switch_log(self,val):
"""Switch logging on/off. val should be ONLY a boolean."""
if val not in [False,True,0,1]:
raise ValueError, \
'Call switch_log ONLY with a boolean argument, not with:',val
label = {0:'OFF',1:'ON',False:'OFF',True:'ON'}
if self.l... | [
"Switch",
"logging",
"on",
"/",
"off",
".",
"val",
"should",
"be",
"ONLY",
"a",
"boolean",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/logger.py#L130-L153 | [
"def",
"switch_log",
"(",
"self",
",",
"val",
")",
":",
"if",
"val",
"not",
"in",
"[",
"False",
",",
"True",
",",
"0",
",",
"1",
"]",
":",
"raise",
"ValueError",
",",
"'Call switch_log ONLY with a boolean argument, not with:'",
",",
"val",
"label",
"=",
"{... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Logger.logstate | Print a status message about the logger. | environment/lib/python2.7/site-packages/IPython/core/logger.py | def logstate(self):
"""Print a status message about the logger."""
if self.logfile is None:
print 'Logging has not been activated.'
else:
state = self.log_active and 'active' or 'temporarily suspended'
print 'Filename :',self.logfname
print '... | def logstate(self):
"""Print a status message about the logger."""
if self.logfile is None:
print 'Logging has not been activated.'
else:
state = self.log_active and 'active' or 'temporarily suspended'
print 'Filename :',self.logfname
print '... | [
"Print",
"a",
"status",
"message",
"about",
"the",
"logger",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/logger.py#L155-L166 | [
"def",
"logstate",
"(",
"self",
")",
":",
"if",
"self",
".",
"logfile",
"is",
"None",
":",
"print",
"'Logging has not been activated.'",
"else",
":",
"state",
"=",
"self",
".",
"log_active",
"and",
"'active'",
"or",
"'temporarily suspended'",
"print",
"'Filename... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Logger.log | Write the sources to a log.
Inputs:
- line_mod: possibly modified input, such as the transformations made
by input prefilters or input handlers of various kinds. This should
always be valid Python.
- line_ori: unmodified input line from the user. This is not
necessar... | environment/lib/python2.7/site-packages/IPython/core/logger.py | def log(self, line_mod, line_ori):
"""Write the sources to a log.
Inputs:
- line_mod: possibly modified input, such as the transformations made
by input prefilters or input handlers of various kinds. This should
always be valid Python.
- line_ori: unmodified input lin... | def log(self, line_mod, line_ori):
"""Write the sources to a log.
Inputs:
- line_mod: possibly modified input, such as the transformations made
by input prefilters or input handlers of various kinds. This should
always be valid Python.
- line_ori: unmodified input lin... | [
"Write",
"the",
"sources",
"to",
"a",
"log",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/logger.py#L168-L186 | [
"def",
"log",
"(",
"self",
",",
"line_mod",
",",
"line_ori",
")",
":",
"# Write the log line, but decide which one according to the",
"# log_raw_input flag, set when the log is started.",
"if",
"self",
".",
"log_raw_input",
":",
"self",
".",
"log_write",
"(",
"line_ori",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Logger.log_write | Write data to the log file, if active | environment/lib/python2.7/site-packages/IPython/core/logger.py | def log_write(self, data, kind='input'):
"""Write data to the log file, if active"""
#print 'data: %r' % data # dbg
if self.log_active and data:
write = self.logfile.write
if kind=='input':
if self.timestamp:
write(str_to_unicode(time.... | def log_write(self, data, kind='input'):
"""Write data to the log file, if active"""
#print 'data: %r' % data # dbg
if self.log_active and data:
write = self.logfile.write
if kind=='input':
if self.timestamp:
write(str_to_unicode(time.... | [
"Write",
"data",
"to",
"the",
"log",
"file",
"if",
"active"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/logger.py#L188-L203 | [
"def",
"log_write",
"(",
"self",
",",
"data",
",",
"kind",
"=",
"'input'",
")",
":",
"#print 'data: %r' % data # dbg",
"if",
"self",
".",
"log_active",
"and",
"data",
":",
"write",
"=",
"self",
".",
"logfile",
".",
"write",
"if",
"kind",
"==",
"'input'",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Logger.logstop | Fully stop logging and close log file.
In order to start logging again, a new logstart() call needs to be
made, possibly (though not necessarily) with a new filename, mode and
other options. | environment/lib/python2.7/site-packages/IPython/core/logger.py | def logstop(self):
"""Fully stop logging and close log file.
In order to start logging again, a new logstart() call needs to be
made, possibly (though not necessarily) with a new filename, mode and
other options."""
if self.logfile is not None:
self.logfile.close()
... | def logstop(self):
"""Fully stop logging and close log file.
In order to start logging again, a new logstart() call needs to be
made, possibly (though not necessarily) with a new filename, mode and
other options."""
if self.logfile is not None:
self.logfile.close()
... | [
"Fully",
"stop",
"logging",
"and",
"close",
"log",
"file",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/logger.py#L205-L217 | [
"def",
"logstop",
"(",
"self",
")",
":",
"if",
"self",
".",
"logfile",
"is",
"not",
"None",
":",
"self",
".",
"logfile",
".",
"close",
"(",
")",
"self",
".",
"logfile",
"=",
"None",
"else",
":",
"print",
"\"Logging hadn't been started.\"",
"self",
".",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | new_worksheet | Create a worksheet by name with with a list of cells. | environment/lib/python2.7/site-packages/IPython/nbformat/v2/nbbase.py | def new_worksheet(name=None, cells=None):
"""Create a worksheet by name with with a list of cells."""
ws = NotebookNode()
if name is not None:
ws.name = unicode(name)
if cells is None:
ws.cells = []
else:
ws.cells = list(cells)
return ws | def new_worksheet(name=None, cells=None):
"""Create a worksheet by name with with a list of cells."""
ws = NotebookNode()
if name is not None:
ws.name = unicode(name)
if cells is None:
ws.cells = []
else:
ws.cells = list(cells)
return ws | [
"Create",
"a",
"worksheet",
"by",
"name",
"with",
"with",
"a",
"list",
"of",
"cells",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/v2/nbbase.py#L122-L131 | [
"def",
"new_worksheet",
"(",
"name",
"=",
"None",
",",
"cells",
"=",
"None",
")",
":",
"ws",
"=",
"NotebookNode",
"(",
")",
"if",
"name",
"is",
"not",
"None",
":",
"ws",
".",
"name",
"=",
"unicode",
"(",
"name",
")",
"if",
"cells",
"is",
"None",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | new_notebook | Create a notebook by name, id and a list of worksheets. | environment/lib/python2.7/site-packages/IPython/nbformat/v2/nbbase.py | def new_notebook(metadata=None, worksheets=None):
"""Create a notebook by name, id and a list of worksheets."""
nb = NotebookNode()
nb.nbformat = 2
if worksheets is None:
nb.worksheets = []
else:
nb.worksheets = list(worksheets)
if metadata is None:
nb.metadata = new_meta... | def new_notebook(metadata=None, worksheets=None):
"""Create a notebook by name, id and a list of worksheets."""
nb = NotebookNode()
nb.nbformat = 2
if worksheets is None:
nb.worksheets = []
else:
nb.worksheets = list(worksheets)
if metadata is None:
nb.metadata = new_meta... | [
"Create",
"a",
"notebook",
"by",
"name",
"id",
"and",
"a",
"list",
"of",
"worksheets",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/v2/nbbase.py#L134-L146 | [
"def",
"new_notebook",
"(",
"metadata",
"=",
"None",
",",
"worksheets",
"=",
"None",
")",
":",
"nb",
"=",
"NotebookNode",
"(",
")",
"nb",
".",
"nbformat",
"=",
"2",
"if",
"worksheets",
"is",
"None",
":",
"nb",
".",
"worksheets",
"=",
"[",
"]",
"else"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | StrDispatch.add_s | Adds a target 'string' for dispatching | environment/lib/python2.7/site-packages/IPython/utils/strdispatch.py | def add_s(self, s, obj, priority= 0 ):
""" Adds a target 'string' for dispatching """
chain = self.strs.get(s, CommandChainDispatcher())
chain.add(obj,priority)
self.strs[s] = chain | def add_s(self, s, obj, priority= 0 ):
""" Adds a target 'string' for dispatching """
chain = self.strs.get(s, CommandChainDispatcher())
chain.add(obj,priority)
self.strs[s] = chain | [
"Adds",
"a",
"target",
"string",
"for",
"dispatching"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/strdispatch.py#L28-L33 | [
"def",
"add_s",
"(",
"self",
",",
"s",
",",
"obj",
",",
"priority",
"=",
"0",
")",
":",
"chain",
"=",
"self",
".",
"strs",
".",
"get",
"(",
"s",
",",
"CommandChainDispatcher",
"(",
")",
")",
"chain",
".",
"add",
"(",
"obj",
",",
"priority",
")",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | StrDispatch.add_re | Adds a target regexp for dispatching | environment/lib/python2.7/site-packages/IPython/utils/strdispatch.py | def add_re(self, regex, obj, priority= 0 ):
""" Adds a target regexp for dispatching """
chain = self.regexs.get(regex, CommandChainDispatcher())
chain.add(obj,priority)
self.regexs[regex] = chain | def add_re(self, regex, obj, priority= 0 ):
""" Adds a target regexp for dispatching """
chain = self.regexs.get(regex, CommandChainDispatcher())
chain.add(obj,priority)
self.regexs[regex] = chain | [
"Adds",
"a",
"target",
"regexp",
"for",
"dispatching"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/strdispatch.py#L35-L40 | [
"def",
"add_re",
"(",
"self",
",",
"regex",
",",
"obj",
",",
"priority",
"=",
"0",
")",
":",
"chain",
"=",
"self",
".",
"regexs",
".",
"get",
"(",
"regex",
",",
"CommandChainDispatcher",
"(",
")",
")",
"chain",
".",
"add",
"(",
"obj",
",",
"priorit... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | StrDispatch.dispatch | Get a seq of Commandchain objects that match key | environment/lib/python2.7/site-packages/IPython/utils/strdispatch.py | def dispatch(self, key):
""" Get a seq of Commandchain objects that match key """
if key in self.strs:
yield self.strs[key]
for r, obj in self.regexs.items():
if re.match(r, key):
yield obj
else:
#print "nomatch",key # dbg
... | def dispatch(self, key):
""" Get a seq of Commandchain objects that match key """
if key in self.strs:
yield self.strs[key]
for r, obj in self.regexs.items():
if re.match(r, key):
yield obj
else:
#print "nomatch",key # dbg
... | [
"Get",
"a",
"seq",
"of",
"Commandchain",
"objects",
"that",
"match",
"key"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/strdispatch.py#L42-L52 | [
"def",
"dispatch",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
".",
"strs",
":",
"yield",
"self",
".",
"strs",
"[",
"key",
"]",
"for",
"r",
",",
"obj",
"in",
"self",
".",
"regexs",
".",
"items",
"(",
")",
":",
"if",
"re",
".... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | StrDispatch.flat_matches | Yield all 'value' targets, without priority | environment/lib/python2.7/site-packages/IPython/utils/strdispatch.py | def flat_matches(self, key):
""" Yield all 'value' targets, without priority """
for val in self.dispatch(key):
for el in val:
yield el[1] # only value, no priority
return | def flat_matches(self, key):
""" Yield all 'value' targets, without priority """
for val in self.dispatch(key):
for el in val:
yield el[1] # only value, no priority
return | [
"Yield",
"all",
"value",
"targets",
"without",
"priority"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/strdispatch.py#L63-L68 | [
"def",
"flat_matches",
"(",
"self",
",",
"key",
")",
":",
"for",
"val",
"in",
"self",
".",
"dispatch",
"(",
"key",
")",
":",
"for",
"el",
"in",
"val",
":",
"yield",
"el",
"[",
"1",
"]",
"# only value, no priority",
"return"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager._notebook_dir_changed | do a bit of validation of the notebook dir | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def _notebook_dir_changed(self, name, old, new):
"""do a bit of validation of the notebook dir"""
if os.path.exists(new) and not os.path.isdir(new):
raise TraitError("notebook dir %r is not a directory" % new)
if not os.path.exists(new):
self.log.info("Creating notebook d... | def _notebook_dir_changed(self, name, old, new):
"""do a bit of validation of the notebook dir"""
if os.path.exists(new) and not os.path.isdir(new):
raise TraitError("notebook dir %r is not a directory" % new)
if not os.path.exists(new):
self.log.info("Creating notebook d... | [
"do",
"a",
"bit",
"of",
"validation",
"of",
"the",
"notebook",
"dir"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L40-L49 | [
"def",
"_notebook_dir_changed",
"(",
"self",
",",
"name",
",",
"old",
",",
"new",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"new",
")",
"and",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"new",
")",
":",
"raise",
"TraitError",
"(",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.list_notebooks | List all notebooks in the notebook dir.
This returns a list of dicts of the form::
dict(notebook_id=notebook,name=name) | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def list_notebooks(self):
"""List all notebooks in the notebook dir.
This returns a list of dicts of the form::
dict(notebook_id=notebook,name=name)
"""
names = glob.glob(os.path.join(self.notebook_dir,
'*' + self.filename_ext))
... | def list_notebooks(self):
"""List all notebooks in the notebook dir.
This returns a list of dicts of the form::
dict(notebook_id=notebook,name=name)
"""
names = glob.glob(os.path.join(self.notebook_dir,
'*' + self.filename_ext))
... | [
"List",
"all",
"notebooks",
"in",
"the",
"notebook",
"dir",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L69-L89 | [
"def",
"list_notebooks",
"(",
"self",
")",
":",
"names",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"notebook_dir",
",",
"'*'",
"+",
"self",
".",
"filename_ext",
")",
")",
"names",
"=",
"[",
"os",
".",
"path",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.new_notebook_id | Generate a new notebook_id for a name and store its mappings. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def new_notebook_id(self, name):
"""Generate a new notebook_id for a name and store its mappings."""
# TODO: the following will give stable urls for notebooks, but unless
# the notebooks are immediately redirected to their new urls when their
# filemname changes, nasty inconsistencies re... | def new_notebook_id(self, name):
"""Generate a new notebook_id for a name and store its mappings."""
# TODO: the following will give stable urls for notebooks, but unless
# the notebooks are immediately redirected to their new urls when their
# filemname changes, nasty inconsistencies re... | [
"Generate",
"a",
"new",
"notebook_id",
"for",
"a",
"name",
"and",
"store",
"its",
"mappings",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L91-L106 | [
"def",
"new_notebook_id",
"(",
"self",
",",
"name",
")",
":",
"# TODO: the following will give stable urls for notebooks, but unless",
"# the notebooks are immediately redirected to their new urls when their",
"# filemname changes, nasty inconsistencies result. So for now it's",
"# disabled a... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.delete_notebook_id | Delete a notebook's id only. This doesn't delete the actual notebook. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def delete_notebook_id(self, notebook_id):
"""Delete a notebook's id only. This doesn't delete the actual notebook."""
name = self.mapping[notebook_id]
del self.mapping[notebook_id]
del self.rev_mapping[name] | def delete_notebook_id(self, notebook_id):
"""Delete a notebook's id only. This doesn't delete the actual notebook."""
name = self.mapping[notebook_id]
del self.mapping[notebook_id]
del self.rev_mapping[name] | [
"Delete",
"a",
"notebook",
"s",
"id",
"only",
".",
"This",
"doesn",
"t",
"delete",
"the",
"actual",
"notebook",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L108-L112 | [
"def",
"delete_notebook_id",
"(",
"self",
",",
"notebook_id",
")",
":",
"name",
"=",
"self",
".",
"mapping",
"[",
"notebook_id",
"]",
"del",
"self",
".",
"mapping",
"[",
"notebook_id",
"]",
"del",
"self",
".",
"rev_mapping",
"[",
"name",
"]"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.notebook_exists | Does a notebook exist? | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def notebook_exists(self, notebook_id):
"""Does a notebook exist?"""
if notebook_id not in self.mapping:
return False
path = self.get_path_by_name(self.mapping[notebook_id])
return os.path.isfile(path) | def notebook_exists(self, notebook_id):
"""Does a notebook exist?"""
if notebook_id not in self.mapping:
return False
path = self.get_path_by_name(self.mapping[notebook_id])
return os.path.isfile(path) | [
"Does",
"a",
"notebook",
"exist?"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L114-L119 | [
"def",
"notebook_exists",
"(",
"self",
",",
"notebook_id",
")",
":",
"if",
"notebook_id",
"not",
"in",
"self",
".",
"mapping",
":",
"return",
"False",
"path",
"=",
"self",
".",
"get_path_by_name",
"(",
"self",
".",
"mapping",
"[",
"notebook_id",
"]",
")",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.find_path | Return a full path to a notebook given its notebook_id. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def find_path(self, notebook_id):
"""Return a full path to a notebook given its notebook_id."""
try:
name = self.mapping[notebook_id]
except KeyError:
raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
return self.get_path_by_name(name) | def find_path(self, notebook_id):
"""Return a full path to a notebook given its notebook_id."""
try:
name = self.mapping[notebook_id]
except KeyError:
raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
return self.get_path_by_name(name) | [
"Return",
"a",
"full",
"path",
"to",
"a",
"notebook",
"given",
"its",
"notebook_id",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L121-L127 | [
"def",
"find_path",
"(",
"self",
",",
"notebook_id",
")",
":",
"try",
":",
"name",
"=",
"self",
".",
"mapping",
"[",
"notebook_id",
"]",
"except",
"KeyError",
":",
"raise",
"web",
".",
"HTTPError",
"(",
"404",
",",
"u'Notebook does not exist: %s'",
"%",
"n... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.get_path_by_name | Return a full path to a notebook given its name. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def get_path_by_name(self, name):
"""Return a full path to a notebook given its name."""
filename = name + self.filename_ext
path = os.path.join(self.notebook_dir, filename)
return path | def get_path_by_name(self, name):
"""Return a full path to a notebook given its name."""
filename = name + self.filename_ext
path = os.path.join(self.notebook_dir, filename)
return path | [
"Return",
"a",
"full",
"path",
"to",
"a",
"notebook",
"given",
"its",
"name",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L129-L133 | [
"def",
"get_path_by_name",
"(",
"self",
",",
"name",
")",
":",
"filename",
"=",
"name",
"+",
"self",
".",
"filename_ext",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"notebook_dir",
",",
"filename",
")",
"return",
"path"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.get_notebook | Get the representation of a notebook in format by notebook_id. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def get_notebook(self, notebook_id, format=u'json'):
"""Get the representation of a notebook in format by notebook_id."""
format = unicode(format)
if format not in self.allowed_formats:
raise web.HTTPError(415, u'Invalid notebook format: %s' % format)
last_modified, nb = self... | def get_notebook(self, notebook_id, format=u'json'):
"""Get the representation of a notebook in format by notebook_id."""
format = unicode(format)
if format not in self.allowed_formats:
raise web.HTTPError(415, u'Invalid notebook format: %s' % format)
last_modified, nb = self... | [
"Get",
"the",
"representation",
"of",
"a",
"notebook",
"in",
"format",
"by",
"notebook_id",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L135-L148 | [
"def",
"get_notebook",
"(",
"self",
",",
"notebook_id",
",",
"format",
"=",
"u'json'",
")",
":",
"format",
"=",
"unicode",
"(",
"format",
")",
"if",
"format",
"not",
"in",
"self",
".",
"allowed_formats",
":",
"raise",
"web",
".",
"HTTPError",
"(",
"415",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.get_notebook_object | Get the NotebookNode representation of a notebook by notebook_id. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def get_notebook_object(self, notebook_id):
"""Get the NotebookNode representation of a notebook by notebook_id."""
path = self.find_path(notebook_id)
if not os.path.isfile(path):
raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
info = os.stat(path)
... | def get_notebook_object(self, notebook_id):
"""Get the NotebookNode representation of a notebook by notebook_id."""
path = self.find_path(notebook_id)
if not os.path.isfile(path):
raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
info = os.stat(path)
... | [
"Get",
"the",
"NotebookNode",
"representation",
"of",
"a",
"notebook",
"by",
"notebook_id",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L150-L166 | [
"def",
"get_notebook_object",
"(",
"self",
",",
"notebook_id",
")",
":",
"path",
"=",
"self",
".",
"find_path",
"(",
"notebook_id",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"raise",
"web",
".",
"HTTPError",
"(",
"404",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.save_new_notebook | Save a new notebook and return its notebook_id.
If a name is passed in, it overrides any values in the notebook data
and the value in the data is updated to use that value. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def save_new_notebook(self, data, name=None, format=u'json'):
"""Save a new notebook and return its notebook_id.
If a name is passed in, it overrides any values in the notebook data
and the value in the data is updated to use that value.
"""
if format not in self.allowed_formats... | def save_new_notebook(self, data, name=None, format=u'json'):
"""Save a new notebook and return its notebook_id.
If a name is passed in, it overrides any values in the notebook data
and the value in the data is updated to use that value.
"""
if format not in self.allowed_formats... | [
"Save",
"a",
"new",
"notebook",
"and",
"return",
"its",
"notebook_id",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L168-L191 | [
"def",
"save_new_notebook",
"(",
"self",
",",
"data",
",",
"name",
"=",
"None",
",",
"format",
"=",
"u'json'",
")",
":",
"if",
"format",
"not",
"in",
"self",
".",
"allowed_formats",
":",
"raise",
"web",
".",
"HTTPError",
"(",
"415",
",",
"u'Invalid noteb... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.save_notebook | Save an existing notebook by notebook_id. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def save_notebook(self, notebook_id, data, name=None, format=u'json'):
"""Save an existing notebook by notebook_id."""
if format not in self.allowed_formats:
raise web.HTTPError(415, u'Invalid notebook format: %s' % format)
try:
nb = current.reads(data.decode('utf-8'), f... | def save_notebook(self, notebook_id, data, name=None, format=u'json'):
"""Save an existing notebook by notebook_id."""
if format not in self.allowed_formats:
raise web.HTTPError(415, u'Invalid notebook format: %s' % format)
try:
nb = current.reads(data.decode('utf-8'), f... | [
"Save",
"an",
"existing",
"notebook",
"by",
"notebook_id",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L193-L205 | [
"def",
"save_notebook",
"(",
"self",
",",
"notebook_id",
",",
"data",
",",
"name",
"=",
"None",
",",
"format",
"=",
"u'json'",
")",
":",
"if",
"format",
"not",
"in",
"self",
".",
"allowed_formats",
":",
"raise",
"web",
".",
"HTTPError",
"(",
"415",
","... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.save_notebook_object | Save an existing notebook object by notebook_id. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def save_notebook_object(self, notebook_id, nb):
"""Save an existing notebook object by notebook_id."""
if notebook_id not in self.mapping:
raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
old_name = self.mapping[notebook_id]
try:
new_name = ... | def save_notebook_object(self, notebook_id, nb):
"""Save an existing notebook object by notebook_id."""
if notebook_id not in self.mapping:
raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
old_name = self.mapping[notebook_id]
try:
new_name = ... | [
"Save",
"an",
"existing",
"notebook",
"object",
"by",
"notebook_id",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L207-L241 | [
"def",
"save_notebook_object",
"(",
"self",
",",
"notebook_id",
",",
"nb",
")",
":",
"if",
"notebook_id",
"not",
"in",
"self",
".",
"mapping",
":",
"raise",
"web",
".",
"HTTPError",
"(",
"404",
",",
"u'Notebook does not exist: %s'",
"%",
"notebook_id",
")",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.delete_notebook | Delete notebook by notebook_id. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def delete_notebook(self, notebook_id):
"""Delete notebook by notebook_id."""
path = self.find_path(notebook_id)
if not os.path.isfile(path):
raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
os.unlink(path)
self.delete_notebook_id(notebook_id) | def delete_notebook(self, notebook_id):
"""Delete notebook by notebook_id."""
path = self.find_path(notebook_id)
if not os.path.isfile(path):
raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
os.unlink(path)
self.delete_notebook_id(notebook_id) | [
"Delete",
"notebook",
"by",
"notebook_id",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L243-L249 | [
"def",
"delete_notebook",
"(",
"self",
",",
"notebook_id",
")",
":",
"path",
"=",
"self",
".",
"find_path",
"(",
"notebook_id",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"raise",
"web",
".",
"HTTPError",
"(",
"404",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.increment_filename | Return a non-used filename of the form basename<int>.
This searches through the filenames (basename0, basename1, ...)
until is find one that is not already being used. It is used to
create Untitled and Copy names that are unique. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def increment_filename(self, basename):
"""Return a non-used filename of the form basename<int>.
This searches through the filenames (basename0, basename1, ...)
until is find one that is not already being used. It is used to
create Untitled and Copy names that are unique.
... | def increment_filename(self, basename):
"""Return a non-used filename of the form basename<int>.
This searches through the filenames (basename0, basename1, ...)
until is find one that is not already being used. It is used to
create Untitled and Copy names that are unique.
... | [
"Return",
"a",
"non",
"-",
"used",
"filename",
"of",
"the",
"form",
"basename<int",
">",
".",
"This",
"searches",
"through",
"the",
"filenames",
"(",
"basename0",
"basename1",
"...",
")",
"until",
"is",
"find",
"one",
"that",
"is",
"not",
"already",
"being... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L251-L266 | [
"def",
"increment_filename",
"(",
"self",
",",
"basename",
")",
":",
"i",
"=",
"0",
"while",
"True",
":",
"name",
"=",
"u'%s%i'",
"%",
"(",
"basename",
",",
"i",
")",
"path",
"=",
"self",
".",
"get_path_by_name",
"(",
"name",
")",
"if",
"not",
"os",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.new_notebook | Create a new notebook and return its notebook_id. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def new_notebook(self):
"""Create a new notebook and return its notebook_id."""
path, name = self.increment_filename('Untitled')
notebook_id = self.new_notebook_id(name)
metadata = current.new_metadata(name=name)
nb = current.new_notebook(metadata=metadata)
with open(path... | def new_notebook(self):
"""Create a new notebook and return its notebook_id."""
path, name = self.increment_filename('Untitled')
notebook_id = self.new_notebook_id(name)
metadata = current.new_metadata(name=name)
nb = current.new_notebook(metadata=metadata)
with open(path... | [
"Create",
"a",
"new",
"notebook",
"and",
"return",
"its",
"notebook_id",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L268-L276 | [
"def",
"new_notebook",
"(",
"self",
")",
":",
"path",
",",
"name",
"=",
"self",
".",
"increment_filename",
"(",
"'Untitled'",
")",
"notebook_id",
"=",
"self",
".",
"new_notebook_id",
"(",
"name",
")",
"metadata",
"=",
"current",
".",
"new_metadata",
"(",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookManager.copy_notebook | Copy an existing notebook and return its notebook_id. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py | def copy_notebook(self, notebook_id):
"""Copy an existing notebook and return its notebook_id."""
last_mod, nb = self.get_notebook_object(notebook_id)
name = nb.metadata.name + '-Copy'
path, name = self.increment_filename(name)
nb.metadata.name = name
notebook_id = self.n... | def copy_notebook(self, notebook_id):
"""Copy an existing notebook and return its notebook_id."""
last_mod, nb = self.get_notebook_object(notebook_id)
name = nb.metadata.name + '-Copy'
path, name = self.increment_filename(name)
nb.metadata.name = name
notebook_id = self.n... | [
"Copy",
"an",
"existing",
"notebook",
"and",
"return",
"its",
"notebook_id",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L278-L286 | [
"def",
"copy_notebook",
"(",
"self",
",",
"notebook_id",
")",
":",
"last_mod",
",",
"nb",
"=",
"self",
".",
"get_notebook_object",
"(",
"notebook_id",
")",
"name",
"=",
"nb",
".",
"metadata",
".",
"name",
"+",
"'-Copy'",
"path",
",",
"name",
"=",
"self",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | phys_tokens | Return all physical tokens, even line continuations.
tokenize.generate_tokens() doesn't return a token for the backslash that
continues lines. This wrapper provides those tokens so that we can
re-create a faithful representation of the original source.
Returns the same values as generate_tokens() | virtualEnvironment/lib/python2.7/site-packages/coverage/phystokens.py | def phys_tokens(toks):
"""Return all physical tokens, even line continuations.
tokenize.generate_tokens() doesn't return a token for the backslash that
continues lines. This wrapper provides those tokens so that we can
re-create a faithful representation of the original source.
Returns the same v... | def phys_tokens(toks):
"""Return all physical tokens, even line continuations.
tokenize.generate_tokens() doesn't return a token for the backslash that
continues lines. This wrapper provides those tokens so that we can
re-create a faithful representation of the original source.
Returns the same v... | [
"Return",
"all",
"physical",
"tokens",
"even",
"line",
"continuations",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/phystokens.py#L8-L61 | [
"def",
"phys_tokens",
"(",
"toks",
")",
":",
"last_line",
"=",
"None",
"last_lineno",
"=",
"-",
"1",
"last_ttype",
"=",
"None",
"for",
"ttype",
",",
"ttext",
",",
"(",
"slineno",
",",
"scol",
")",
",",
"(",
"elineno",
",",
"ecol",
")",
",",
"ltext",
... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | source_token_lines | Generate a series of lines, one for each line in `source`.
Each line is a list of pairs, each pair is a token::
[('key', 'def'), ('ws', ' '), ('nam', 'hello'), ('op', '('), ... ]
Each pair has a token class, and the token text.
If you concatenate all the token texts, and then join them with newl... | virtualEnvironment/lib/python2.7/site-packages/coverage/phystokens.py | def source_token_lines(source):
"""Generate a series of lines, one for each line in `source`.
Each line is a list of pairs, each pair is a token::
[('key', 'def'), ('ws', ' '), ('nam', 'hello'), ('op', '('), ... ]
Each pair has a token class, and the token text.
If you concatenate all the to... | def source_token_lines(source):
"""Generate a series of lines, one for each line in `source`.
Each line is a list of pairs, each pair is a token::
[('key', 'def'), ('ws', ' '), ('nam', 'hello'), ('op', '('), ... ]
Each pair has a token class, and the token text.
If you concatenate all the to... | [
"Generate",
"a",
"series",
"of",
"lines",
"one",
"for",
"each",
"line",
"in",
"source",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/phystokens.py#L64-L110 | [
"def",
"source_token_lines",
"(",
"source",
")",
":",
"ws_tokens",
"=",
"set",
"(",
"[",
"token",
".",
"INDENT",
",",
"token",
".",
"DEDENT",
",",
"token",
".",
"NEWLINE",
",",
"tokenize",
".",
"NL",
"]",
")",
"line",
"=",
"[",
"]",
"col",
"=",
"0"... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | source_encoding | Determine the encoding for `source` (a string), according to PEP 263.
Returns a string, the name of the encoding. | virtualEnvironment/lib/python2.7/site-packages/coverage/phystokens.py | def source_encoding(source):
"""Determine the encoding for `source` (a string), according to PEP 263.
Returns a string, the name of the encoding.
"""
# Note: this function should never be called on Python 3, since py3 has
# built-in tools to do this.
assert sys.version_info < (3, 0)
# Thi... | def source_encoding(source):
"""Determine the encoding for `source` (a string), according to PEP 263.
Returns a string, the name of the encoding.
"""
# Note: this function should never be called on Python 3, since py3 has
# built-in tools to do this.
assert sys.version_info < (3, 0)
# Thi... | [
"Determine",
"the",
"encoding",
"for",
"source",
"(",
"a",
"string",
")",
"according",
"to",
"PEP",
"263",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/phystokens.py#L112-L210 | [
"def",
"source_encoding",
"(",
"source",
")",
":",
"# Note: this function should never be called on Python 3, since py3 has",
"# built-in tools to do this.",
"assert",
"sys",
".",
"version_info",
"<",
"(",
"3",
",",
"0",
")",
"# This is mostly code adapted from Py3.2's tokenize m... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | load_default_config | Load the default config file from the default ipython_dir.
This is useful for embedded shells. | environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py | def load_default_config(ipython_dir=None):
"""Load the default config file from the default ipython_dir.
This is useful for embedded shells.
"""
if ipython_dir is None:
ipython_dir = get_ipython_dir()
profile_dir = os.path.join(ipython_dir, 'profile_default')
cl = PyFileConfigLoader(def... | def load_default_config(ipython_dir=None):
"""Load the default config file from the default ipython_dir.
This is useful for embedded shells.
"""
if ipython_dir is None:
ipython_dir = get_ipython_dir()
profile_dir = os.path.join(ipython_dir, 'profile_default')
cl = PyFileConfigLoader(def... | [
"Load",
"the",
"default",
"config",
"file",
"from",
"the",
"default",
"ipython_dir",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py#L368-L382 | [
"def",
"load_default_config",
"(",
"ipython_dir",
"=",
"None",
")",
":",
"if",
"ipython_dir",
"is",
"None",
":",
"ipython_dir",
"=",
"get_ipython_dir",
"(",
")",
"profile_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"ipython_dir",
",",
"'profile_default'",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | IPAppCrashHandler.make_report | Return a string containing a crash report. | environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py | def make_report(self,traceback):
"""Return a string containing a crash report."""
sec_sep = self.section_sep
# Start with parent report
report = [super(IPAppCrashHandler, self).make_report(traceback)]
# Add interactive-specific info we may have
rpt_add = report.append
... | def make_report(self,traceback):
"""Return a string containing a crash report."""
sec_sep = self.section_sep
# Start with parent report
report = [super(IPAppCrashHandler, self).make_report(traceback)]
# Add interactive-specific info we may have
rpt_add = report.append
... | [
"Return",
"a",
"string",
"containing",
"a",
"crash",
"report",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py#L102-L119 | [
"def",
"make_report",
"(",
"self",
",",
"traceback",
")",
":",
"sec_sep",
"=",
"self",
".",
"section_sep",
"# Start with parent report",
"report",
"=",
"[",
"super",
"(",
"IPAppCrashHandler",
",",
"self",
")",
".",
"make_report",
"(",
"traceback",
")",
"]",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TerminalIPythonApp._classes_default | This has to be in a method, for TerminalIPythonApp to be available. | environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py | def _classes_default(self):
"""This has to be in a method, for TerminalIPythonApp to be available."""
return [
InteractiveShellApp, # ShellApp comes before TerminalApp, because
self.__class__, # it will also affect subclasses (e.g. QtConsole)
TerminalInteractiveS... | def _classes_default(self):
"""This has to be in a method, for TerminalIPythonApp to be available."""
return [
InteractiveShellApp, # ShellApp comes before TerminalApp, because
self.__class__, # it will also affect subclasses (e.g. QtConsole)
TerminalInteractiveS... | [
"This",
"has",
"to",
"be",
"in",
"a",
"method",
"for",
"TerminalIPythonApp",
"to",
"be",
"available",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py#L212-L224 | [
"def",
"_classes_default",
"(",
"self",
")",
":",
"return",
"[",
"InteractiveShellApp",
",",
"# ShellApp comes before TerminalApp, because",
"self",
".",
"__class__",
",",
"# it will also affect subclasses (e.g. QtConsole)",
"TerminalInteractiveShell",
",",
"PromptManager",
","... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TerminalIPythonApp.parse_command_line | override to allow old '-pylab' flag with deprecation warning | environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py | def parse_command_line(self, argv=None):
"""override to allow old '-pylab' flag with deprecation warning"""
argv = sys.argv[1:] if argv is None else argv
if '-pylab' in argv:
# deprecated `-pylab` given,
# warn and transform into current syntax
argv = argv[:... | def parse_command_line(self, argv=None):
"""override to allow old '-pylab' flag with deprecation warning"""
argv = sys.argv[1:] if argv is None else argv
if '-pylab' in argv:
# deprecated `-pylab` given,
# warn and transform into current syntax
argv = argv[:... | [
"override",
"to",
"allow",
"old",
"-",
"pylab",
"flag",
"with",
"deprecation",
"warning"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py#L287-L308 | [
"def",
"parse_command_line",
"(",
"self",
",",
"argv",
"=",
"None",
")",
":",
"argv",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"if",
"argv",
"is",
"None",
"else",
"argv",
"if",
"'-pylab'",
"in",
"argv",
":",
"# deprecated `-pylab` given,",
"# warn an... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TerminalIPythonApp.initialize | Do actions after construct, but before starting the app. | environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py | def initialize(self, argv=None):
"""Do actions after construct, but before starting the app."""
super(TerminalIPythonApp, self).initialize(argv)
if self.subapp is not None:
# don't bother initializing further, starting subapp
return
if not self.ignore_old_config:
... | def initialize(self, argv=None):
"""Do actions after construct, but before starting the app."""
super(TerminalIPythonApp, self).initialize(argv)
if self.subapp is not None:
# don't bother initializing further, starting subapp
return
if not self.ignore_old_config:
... | [
"Do",
"actions",
"after",
"construct",
"but",
"before",
"starting",
"the",
"app",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py#L311-L330 | [
"def",
"initialize",
"(",
"self",
",",
"argv",
"=",
"None",
")",
":",
"super",
"(",
"TerminalIPythonApp",
",",
"self",
")",
".",
"initialize",
"(",
"argv",
")",
"if",
"self",
".",
"subapp",
"is",
"not",
"None",
":",
"# don't bother initializing further, star... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TerminalIPythonApp.init_shell | initialize the InteractiveShell instance | environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py | def init_shell(self):
"""initialize the InteractiveShell instance"""
# Create an InteractiveShell instance.
# shell.display_banner should always be False for the terminal
# based app, because we call shell.show_banner() by hand below
# so the banner shows *before* all extension l... | def init_shell(self):
"""initialize the InteractiveShell instance"""
# Create an InteractiveShell instance.
# shell.display_banner should always be False for the terminal
# based app, because we call shell.show_banner() by hand below
# so the banner shows *before* all extension l... | [
"initialize",
"the",
"InteractiveShell",
"instance"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py#L332-L341 | [
"def",
"init_shell",
"(",
"self",
")",
":",
"# Create an InteractiveShell instance.",
"# shell.display_banner should always be False for the terminal",
"# based app, because we call shell.show_banner() by hand below",
"# so the banner shows *before* all extension loading stuff.",
"self",
".",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TerminalIPythonApp.init_banner | optionally display the banner | environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py | def init_banner(self):
"""optionally display the banner"""
if self.display_banner and self.interact:
self.shell.show_banner()
# Make sure there is a space below the banner.
if self.log_level <= logging.INFO: print | def init_banner(self):
"""optionally display the banner"""
if self.display_banner and self.interact:
self.shell.show_banner()
# Make sure there is a space below the banner.
if self.log_level <= logging.INFO: print | [
"optionally",
"display",
"the",
"banner"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py#L343-L348 | [
"def",
"init_banner",
"(",
"self",
")",
":",
"if",
"self",
".",
"display_banner",
"and",
"self",
".",
"interact",
":",
"self",
".",
"shell",
".",
"show_banner",
"(",
")",
"# Make sure there is a space below the banner.",
"if",
"self",
".",
"log_level",
"<=",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TerminalIPythonApp._pylab_changed | Replace --pylab='inline' with --pylab='auto | environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py | def _pylab_changed(self, name, old, new):
"""Replace --pylab='inline' with --pylab='auto'"""
if new == 'inline':
warn.warn("'inline' not available as pylab backend, "
"using 'auto' instead.\n")
self.pylab = 'auto' | def _pylab_changed(self, name, old, new):
"""Replace --pylab='inline' with --pylab='auto'"""
if new == 'inline':
warn.warn("'inline' not available as pylab backend, "
"using 'auto' instead.\n")
self.pylab = 'auto' | [
"Replace",
"--",
"pylab",
"=",
"inline",
"with",
"--",
"pylab",
"=",
"auto"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py#L350-L355 | [
"def",
"_pylab_changed",
"(",
"self",
",",
"name",
",",
"old",
",",
"new",
")",
":",
"if",
"new",
"==",
"'inline'",
":",
"warn",
".",
"warn",
"(",
"\"'inline' not available as pylab backend, \"",
"\"using 'auto' instead.\\n\"",
")",
"self",
".",
"pylab",
"=",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | class_of | Returns a string containing the class name of an object with the
correct indefinite article ('a' or 'an') preceding it (e.g., 'an Image',
'a PlotValue'). | environment/lib/python2.7/site-packages/IPython/utils/traitlets.py | def class_of ( object ):
""" Returns a string containing the class name of an object with the
correct indefinite article ('a' or 'an') preceding it (e.g., 'an Image',
'a PlotValue').
"""
if isinstance( object, basestring ):
return add_article( object )
return add_article( object.__class... | def class_of ( object ):
""" Returns a string containing the class name of an object with the
correct indefinite article ('a' or 'an') preceding it (e.g., 'an Image',
'a PlotValue').
"""
if isinstance( object, basestring ):
return add_article( object )
return add_article( object.__class... | [
"Returns",
"a",
"string",
"containing",
"the",
"class",
"name",
"of",
"an",
"object",
"with",
"the",
"correct",
"indefinite",
"article",
"(",
"a",
"or",
"an",
")",
"preceding",
"it",
"(",
"e",
".",
"g",
".",
"an",
"Image",
"a",
"PlotValue",
")",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L87-L95 | [
"def",
"class_of",
"(",
"object",
")",
":",
"if",
"isinstance",
"(",
"object",
",",
"basestring",
")",
":",
"return",
"add_article",
"(",
"object",
")",
"return",
"add_article",
"(",
"object",
".",
"__class__",
".",
"__name__",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | repr_type | Return a string representation of a value and its type for readable
error messages. | environment/lib/python2.7/site-packages/IPython/utils/traitlets.py | def repr_type(obj):
""" Return a string representation of a value and its type for readable
error messages.
"""
the_type = type(obj)
if (not py3compat.PY3) and the_type is InstanceType:
# Old-style class.
the_type = obj.__class__
msg = '%r %r' % (obj, the_type)
return msg | def repr_type(obj):
""" Return a string representation of a value and its type for readable
error messages.
"""
the_type = type(obj)
if (not py3compat.PY3) and the_type is InstanceType:
# Old-style class.
the_type = obj.__class__
msg = '%r %r' % (obj, the_type)
return msg | [
"Return",
"a",
"string",
"representation",
"of",
"a",
"value",
"and",
"its",
"type",
"for",
"readable",
"error",
"messages",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L108-L117 | [
"def",
"repr_type",
"(",
"obj",
")",
":",
"the_type",
"=",
"type",
"(",
"obj",
")",
"if",
"(",
"not",
"py3compat",
".",
"PY3",
")",
"and",
"the_type",
"is",
"InstanceType",
":",
"# Old-style class.",
"the_type",
"=",
"obj",
".",
"__class__",
"msg",
"=",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | parse_notifier_name | Convert the name argument to a list of names.
Examples
--------
>>> parse_notifier_name('a')
['a']
>>> parse_notifier_name(['a','b'])
['a', 'b']
>>> parse_notifier_name(None)
['anytrait'] | environment/lib/python2.7/site-packages/IPython/utils/traitlets.py | def parse_notifier_name(name):
"""Convert the name argument to a list of names.
Examples
--------
>>> parse_notifier_name('a')
['a']
>>> parse_notifier_name(['a','b'])
['a', 'b']
>>> parse_notifier_name(None)
['anytrait']
"""
if isinstance(name, str):
return [name]
... | def parse_notifier_name(name):
"""Convert the name argument to a list of names.
Examples
--------
>>> parse_notifier_name('a')
['a']
>>> parse_notifier_name(['a','b'])
['a', 'b']
>>> parse_notifier_name(None)
['anytrait']
"""
if isinstance(name, str):
return [name]
... | [
"Convert",
"the",
"name",
"argument",
"to",
"a",
"list",
"of",
"names",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L120-L140 | [
"def",
"parse_notifier_name",
"(",
"name",
")",
":",
"if",
"isinstance",
"(",
"name",
",",
"str",
")",
":",
"return",
"[",
"name",
"]",
"elif",
"name",
"is",
"None",
":",
"return",
"[",
"'anytrait'",
"]",
"elif",
"isinstance",
"(",
"name",
",",
"(",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | TraitType.set_default_value | Set the default value on a per instance basis.
This method is called by :meth:`instance_init` to create and
validate the default value. The creation and validation of
default values must be delayed until the parent :class:`HasTraits`
class has been instantiated. | environment/lib/python2.7/site-packages/IPython/utils/traitlets.py | def set_default_value(self, obj):
"""Set the default value on a per instance basis.
This method is called by :meth:`instance_init` to create and
validate the default value. The creation and validation of
default values must be delayed until the parent :class:`HasTraits`
class h... | def set_default_value(self, obj):
"""Set the default value on a per instance basis.
This method is called by :meth:`instance_init` to create and
validate the default value. The creation and validation of
default values must be delayed until the parent :class:`HasTraits`
class h... | [
"Set",
"the",
"default",
"value",
"on",
"a",
"per",
"instance",
"basis",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L245-L267 | [
"def",
"set_default_value",
"(",
"self",
",",
"obj",
")",
":",
"# Check for a deferred initializer defined in the same class as the",
"# trait declaration or above.",
"mro",
"=",
"type",
"(",
"obj",
")",
".",
"mro",
"(",
")",
"meth_name",
"=",
"'_%s_default'",
"%",
"s... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | HasTraits.on_trait_change | Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits
subclass with the naming convention '_[traitname]_changed'. Thus,
to create static handler for the trait '... | environment/lib/python2.7/site-packages/IPython/utils/traitlets.py | def on_trait_change(self, handler, name=None, remove=False):
"""Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits
subclass with the naming convention '_[trai... | def on_trait_change(self, handler, name=None, remove=False):
"""Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits
subclass with the naming convention '_[trai... | [
"Setup",
"a",
"handler",
"to",
"be",
"called",
"when",
"a",
"trait",
"changes",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L486-L518 | [
"def",
"on_trait_change",
"(",
"self",
",",
"handler",
",",
"name",
"=",
"None",
",",
"remove",
"=",
"False",
")",
":",
"if",
"remove",
":",
"names",
"=",
"parse_notifier_name",
"(",
"name",
")",
"for",
"n",
"in",
"names",
":",
"self",
".",
"_remove_no... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | HasTraits.class_traits | Get a list of all the traits of this class.
This method is just like the :meth:`traits` method, but is unbound.
The TraitTypes returned don't know anything about the values
that the various HasTrait's instances are holding.
This follows the same algorithm as traits does and does not a... | environment/lib/python2.7/site-packages/IPython/utils/traitlets.py | def class_traits(cls, **metadata):
"""Get a list of all the traits of this class.
This method is just like the :meth:`traits` method, but is unbound.
The TraitTypes returned don't know anything about the values
that the various HasTrait's instances are holding.
This follows th... | def class_traits(cls, **metadata):
"""Get a list of all the traits of this class.
This method is just like the :meth:`traits` method, but is unbound.
The TraitTypes returned don't know anything about the values
that the various HasTrait's instances are holding.
This follows th... | [
"Get",
"a",
"list",
"of",
"all",
"the",
"traits",
"of",
"this",
"class",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L529-L560 | [
"def",
"class_traits",
"(",
"cls",
",",
"*",
"*",
"metadata",
")",
":",
"traits",
"=",
"dict",
"(",
"[",
"memb",
"for",
"memb",
"in",
"getmembers",
"(",
"cls",
")",
"if",
"isinstance",
"(",
"memb",
"[",
"1",
"]",
",",
"TraitType",
")",
"]",
")",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | HasTraits.trait_metadata | Get metadata values for trait by key. | environment/lib/python2.7/site-packages/IPython/utils/traitlets.py | def trait_metadata(self, traitname, key):
"""Get metadata values for trait by key."""
try:
trait = getattr(self.__class__, traitname)
except AttributeError:
raise TraitError("Class %s does not have a trait named %s" %
(self.__class__.__name... | def trait_metadata(self, traitname, key):
"""Get metadata values for trait by key."""
try:
trait = getattr(self.__class__, traitname)
except AttributeError:
raise TraitError("Class %s does not have a trait named %s" %
(self.__class__.__name... | [
"Get",
"metadata",
"values",
"for",
"trait",
"by",
"key",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L597-L605 | [
"def",
"trait_metadata",
"(",
"self",
",",
"traitname",
",",
"key",
")",
":",
"try",
":",
"trait",
"=",
"getattr",
"(",
"self",
".",
"__class__",
",",
"traitname",
")",
"except",
"AttributeError",
":",
"raise",
"TraitError",
"(",
"\"Class %s does not have a tr... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Type.validate | Validates that the value is a valid object instance. | environment/lib/python2.7/site-packages/IPython/utils/traitlets.py | def validate(self, obj, value):
"""Validates that the value is a valid object instance."""
try:
if issubclass(value, self.klass):
return value
except:
if (value is None) and (self._allow_none):
return value
self.error(obj, value) | def validate(self, obj, value):
"""Validates that the value is a valid object instance."""
try:
if issubclass(value, self.klass):
return value
except:
if (value is None) and (self._allow_none):
return value
self.error(obj, value) | [
"Validates",
"that",
"the",
"value",
"is",
"a",
"valid",
"object",
"instance",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L679-L688 | [
"def",
"validate",
"(",
"self",
",",
"obj",
",",
"value",
")",
":",
"try",
":",
"if",
"issubclass",
"(",
"value",
",",
"self",
".",
"klass",
")",
":",
"return",
"value",
"except",
":",
"if",
"(",
"value",
"is",
"None",
")",
"and",
"(",
"self",
".... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Type.info | Returns a description of the trait. | environment/lib/python2.7/site-packages/IPython/utils/traitlets.py | def info(self):
""" Returns a description of the trait."""
if isinstance(self.klass, basestring):
klass = self.klass
else:
klass = self.klass.__name__
result = 'a subclass of ' + klass
if self._allow_none:
return result + ' or None'
ret... | def info(self):
""" Returns a description of the trait."""
if isinstance(self.klass, basestring):
klass = self.klass
else:
klass = self.klass.__name__
result = 'a subclass of ' + klass
if self._allow_none:
return result + ' or None'
ret... | [
"Returns",
"a",
"description",
"of",
"the",
"trait",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L690-L699 | [
"def",
"info",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"klass",
",",
"basestring",
")",
":",
"klass",
"=",
"self",
".",
"klass",
"else",
":",
"klass",
"=",
"self",
".",
"klass",
".",
"__name__",
"result",
"=",
"'a subclass of '",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Instance.get_default_value | Instantiate a default value instance.
This is called when the containing HasTraits classes'
:meth:`__new__` method is called to ensure that a unique instance
is created for each HasTraits instance. | environment/lib/python2.7/site-packages/IPython/utils/traitlets.py | def get_default_value(self):
"""Instantiate a default value instance.
This is called when the containing HasTraits classes'
:meth:`__new__` method is called to ensure that a unique instance
is created for each HasTraits instance.
"""
dv = self.default_value
if i... | def get_default_value(self):
"""Instantiate a default value instance.
This is called when the containing HasTraits classes'
:meth:`__new__` method is called to ensure that a unique instance
is created for each HasTraits instance.
"""
dv = self.default_value
if i... | [
"Instantiate",
"a",
"default",
"value",
"instance",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L818-L829 | [
"def",
"get_default_value",
"(",
"self",
")",
":",
"dv",
"=",
"self",
".",
"default_value",
"if",
"isinstance",
"(",
"dv",
",",
"DefaultValueGenerator",
")",
":",
"return",
"dv",
".",
"generate",
"(",
"self",
".",
"klass",
")",
"else",
":",
"return",
"dv... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Enum.info | Returns a description of the trait. | environment/lib/python2.7/site-packages/IPython/utils/traitlets.py | def info(self):
""" Returns a description of the trait."""
result = 'any of ' + repr(self.values)
if self._allow_none:
return result + ' or None'
return result | def info(self):
""" Returns a description of the trait."""
result = 'any of ' + repr(self.values)
if self._allow_none:
return result + ' or None'
return result | [
"Returns",
"a",
"description",
"of",
"the",
"trait",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/traitlets.py#L1103-L1108 | [
"def",
"info",
"(",
"self",
")",
":",
"result",
"=",
"'any of '",
"+",
"repr",
"(",
"self",
".",
"values",
")",
"if",
"self",
".",
"_allow_none",
":",
"return",
"result",
"+",
"' or None'",
"return",
"result"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | _require | Helper for @require decorator. | environment/lib/python2.7/site-packages/IPython/parallel/controller/dependency.py | def _require(*names):
"""Helper for @require decorator."""
from IPython.parallel.error import UnmetDependency
user_ns = globals()
for name in names:
if name in user_ns:
continue
try:
exec 'import %s'%name in user_ns
except ImportError:
raise Un... | def _require(*names):
"""Helper for @require decorator."""
from IPython.parallel.error import UnmetDependency
user_ns = globals()
for name in names:
if name in user_ns:
continue
try:
exec 'import %s'%name in user_ns
except ImportError:
raise Un... | [
"Helper",
"for"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/dependency.py#L75-L86 | [
"def",
"_require",
"(",
"*",
"names",
")",
":",
"from",
"IPython",
".",
"parallel",
".",
"error",
"import",
"UnmetDependency",
"user_ns",
"=",
"globals",
"(",
")",
"for",
"name",
"in",
"names",
":",
"if",
"name",
"in",
"user_ns",
":",
"continue",
"try",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | require | Simple decorator for requiring names to be importable.
Examples
--------
In [1]: @require('numpy')
...: def norm(a):
...: import numpy
...: return numpy.linalg.norm(a,2) | environment/lib/python2.7/site-packages/IPython/parallel/controller/dependency.py | def require(*mods):
"""Simple decorator for requiring names to be importable.
Examples
--------
In [1]: @require('numpy')
...: def norm(a):
...: import numpy
...: return numpy.linalg.norm(a,2)
"""
names = []
for mod in mods:
if isinstance(mod, M... | def require(*mods):
"""Simple decorator for requiring names to be importable.
Examples
--------
In [1]: @require('numpy')
...: def norm(a):
...: import numpy
...: return numpy.linalg.norm(a,2)
"""
names = []
for mod in mods:
if isinstance(mod, M... | [
"Simple",
"decorator",
"for",
"requiring",
"names",
"to",
"be",
"importable",
".",
"Examples",
"--------",
"In",
"[",
"1",
"]",
":"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/dependency.py#L88-L109 | [
"def",
"require",
"(",
"*",
"mods",
")",
":",
"names",
"=",
"[",
"]",
"for",
"mod",
"in",
"mods",
":",
"if",
"isinstance",
"(",
"mod",
",",
"ModuleType",
")",
":",
"mod",
"=",
"mod",
".",
"__name__",
"if",
"isinstance",
"(",
"mod",
",",
"basestring... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Dependency.check | check whether our dependencies have been met. | environment/lib/python2.7/site-packages/IPython/parallel/controller/dependency.py | def check(self, completed, failed=None):
"""check whether our dependencies have been met."""
if len(self) == 0:
return True
against = set()
if self.success:
against = completed
if failed is not None and self.failure:
against = against.union(fai... | def check(self, completed, failed=None):
"""check whether our dependencies have been met."""
if len(self) == 0:
return True
against = set()
if self.success:
against = completed
if failed is not None and self.failure:
against = against.union(fai... | [
"check",
"whether",
"our",
"dependencies",
"have",
"been",
"met",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/dependency.py#L163-L175 | [
"def",
"check",
"(",
"self",
",",
"completed",
",",
"failed",
"=",
"None",
")",
":",
"if",
"len",
"(",
"self",
")",
"==",
"0",
":",
"return",
"True",
"against",
"=",
"set",
"(",
")",
"if",
"self",
".",
"success",
":",
"against",
"=",
"completed",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Dependency.unreachable | return whether this dependency has become impossible. | environment/lib/python2.7/site-packages/IPython/parallel/controller/dependency.py | def unreachable(self, completed, failed=None):
"""return whether this dependency has become impossible."""
if len(self) == 0:
return False
against = set()
if not self.success:
against = completed
if failed is not None and not self.failure:
agai... | def unreachable(self, completed, failed=None):
"""return whether this dependency has become impossible."""
if len(self) == 0:
return False
against = set()
if not self.success:
against = completed
if failed is not None and not self.failure:
agai... | [
"return",
"whether",
"this",
"dependency",
"has",
"become",
"impossible",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/dependency.py#L177-L189 | [
"def",
"unreachable",
"(",
"self",
",",
"completed",
",",
"failed",
"=",
"None",
")",
":",
"if",
"len",
"(",
"self",
")",
"==",
"0",
":",
"return",
"False",
"against",
"=",
"set",
"(",
")",
"if",
"not",
"self",
".",
"success",
":",
"against",
"=",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Dependency.as_dict | Represent this dependency as a dict. For json compatibility. | environment/lib/python2.7/site-packages/IPython/parallel/controller/dependency.py | def as_dict(self):
"""Represent this dependency as a dict. For json compatibility."""
return dict(
dependencies=list(self),
all=self.all,
success=self.success,
failure=self.failure
) | def as_dict(self):
"""Represent this dependency as a dict. For json compatibility."""
return dict(
dependencies=list(self),
all=self.all,
success=self.success,
failure=self.failure
) | [
"Represent",
"this",
"dependency",
"as",
"a",
"dict",
".",
"For",
"json",
"compatibility",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/dependency.py#L192-L199 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"dependencies",
"=",
"list",
"(",
"self",
")",
",",
"all",
"=",
"self",
".",
"all",
",",
"success",
"=",
"self",
".",
"success",
",",
"failure",
"=",
"self",
".",
"failure",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | BaseSolver.Ainv | Returns a Solver instance | problemo/solverwrap.py | def Ainv(self):
'Returns a Solver instance'
if not hasattr(self, '_Ainv'):
self._Ainv = self.Solver(self.A)
return self._Ainv | def Ainv(self):
'Returns a Solver instance'
if not hasattr(self, '_Ainv'):
self._Ainv = self.Solver(self.A)
return self._Ainv | [
"Returns",
"a",
"Solver",
"instance"
] | bsmithyman/problemo | python | https://github.com/bsmithyman/problemo/blob/711c54894e50200accd02c5e5b427194b628b3e9/problemo/solverwrap.py#L61-L66 | [
"def",
"Ainv",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_Ainv'",
")",
":",
"self",
".",
"_Ainv",
"=",
"self",
".",
"Solver",
"(",
"self",
".",
"A",
")",
"return",
"self",
".",
"_Ainv"
] | 711c54894e50200accd02c5e5b427194b628b3e9 |
test | MKLPardisoSolver.Ainv | Returns a Solver instance | problemo/solverwrap.py | def Ainv(self):
'Returns a Solver instance'
if getattr(self, '_Ainv', None) is None:
self._Ainv = self.Solver(self.A, 13)
self._Ainv.run_pardiso(12)
return self._Ainv | def Ainv(self):
'Returns a Solver instance'
if getattr(self, '_Ainv', None) is None:
self._Ainv = self.Solver(self.A, 13)
self._Ainv.run_pardiso(12)
return self._Ainv | [
"Returns",
"a",
"Solver",
"instance"
] | bsmithyman/problemo | python | https://github.com/bsmithyman/problemo/blob/711c54894e50200accd02c5e5b427194b628b3e9/problemo/solverwrap.py#L143-L149 | [
"def",
"Ainv",
"(",
"self",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"'_Ainv'",
",",
"None",
")",
"is",
"None",
":",
"self",
".",
"_Ainv",
"=",
"self",
".",
"Solver",
"(",
"self",
".",
"A",
",",
"13",
")",
"self",
".",
"_Ainv",
".",
"run_pa... | 711c54894e50200accd02c5e5b427194b628b3e9 |
test | bintree | construct {child:parent} dict representation of a binary tree
keys are the nodes in the tree, and values are the parent of each node.
The root node has parent `parent`, default: None.
>>> tree = bintree(range(7))
>>> tree
{0: None, 1: 0, 2: 1, 3: 1, 4: 0, 5: 4, 6: 4}
>>> print_bin... | environment/share/doc/ipython/examples/parallel/interengine/bintree.py | def bintree(ids, parent=None):
"""construct {child:parent} dict representation of a binary tree
keys are the nodes in the tree, and values are the parent of each node.
The root node has parent `parent`, default: None.
>>> tree = bintree(range(7))
>>> tree
{0: None, 1: 0, 2: 1, 3: ... | def bintree(ids, parent=None):
"""construct {child:parent} dict representation of a binary tree
keys are the nodes in the tree, and values are the parent of each node.
The root node has parent `parent`, default: None.
>>> tree = bintree(range(7))
>>> tree
{0: None, 1: 0, 2: 1, 3: ... | [
"construct",
"{",
"child",
":",
"parent",
"}",
"dict",
"representation",
"of",
"a",
"binary",
"tree",
"keys",
"are",
"the",
"nodes",
"in",
"the",
"tree",
"and",
"values",
"are",
"the",
"parent",
"of",
"each",
"node",
".",
"The",
"root",
"node",
"has",
... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/interengine/bintree.py#L24-L58 | [
"def",
"bintree",
"(",
"ids",
",",
"parent",
"=",
"None",
")",
":",
"parents",
"=",
"{",
"}",
"n",
"=",
"len",
"(",
"ids",
")",
"if",
"n",
"==",
"0",
":",
"return",
"parents",
"root",
"=",
"ids",
"[",
"0",
"]",
"parents",
"[",
"root",
"]",
"=... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.