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 | popkey | Return dct[key] and delete dct[key].
If default is given, return it if dct[key] doesn't exist, otherwise raise
KeyError. | environment/lib/python2.7/site-packages/IPython/utils/attic.py | def popkey(dct,key,default=NotGiven):
"""Return dct[key] and delete dct[key].
If default is given, return it if dct[key] doesn't exist, otherwise raise
KeyError. """
try:
val = dct[key]
except KeyError:
if default is NotGiven:
raise
else:
return def... | def popkey(dct,key,default=NotGiven):
"""Return dct[key] and delete dct[key].
If default is given, return it if dct[key] doesn't exist, otherwise raise
KeyError. """
try:
val = dct[key]
except KeyError:
if default is NotGiven:
raise
else:
return def... | [
"Return",
"dct",
"[",
"key",
"]",
"and",
"delete",
"dct",
"[",
"key",
"]",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/attic.py#L140-L155 | [
"def",
"popkey",
"(",
"dct",
",",
"key",
",",
"default",
"=",
"NotGiven",
")",
":",
"try",
":",
"val",
"=",
"dct",
"[",
"key",
"]",
"except",
"KeyError",
":",
"if",
"default",
"is",
"NotGiven",
":",
"raise",
"else",
":",
"return",
"default",
"else",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | show | Show all figures as SVG/PNG payloads sent to the IPython clients.
Parameters
----------
close : bool, optional
If true, a ``plt.close('all')`` call is automatically issued after
sending all the figures. If this is set, the figures will entirely
removed from the internal list of figures. | environment/lib/python2.7/site-packages/IPython/zmq/pylab/backend_inline.py | def show(close=None):
"""Show all figures as SVG/PNG payloads sent to the IPython clients.
Parameters
----------
close : bool, optional
If true, a ``plt.close('all')`` call is automatically issued after
sending all the figures. If this is set, the figures will entirely
removed from th... | def show(close=None):
"""Show all figures as SVG/PNG payloads sent to the IPython clients.
Parameters
----------
close : bool, optional
If true, a ``plt.close('all')`` call is automatically issued after
sending all the figures. If this is set, the figures will entirely
removed from th... | [
"Show",
"all",
"figures",
"as",
"SVG",
"/",
"PNG",
"payloads",
"sent",
"to",
"the",
"IPython",
"clients",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/pylab/backend_inline.py#L88-L106 | [
"def",
"show",
"(",
"close",
"=",
"None",
")",
":",
"if",
"close",
"is",
"None",
":",
"close",
"=",
"InlineBackend",
".",
"instance",
"(",
")",
".",
"close_figures",
"try",
":",
"for",
"figure_manager",
"in",
"Gcf",
".",
"get_all_fig_managers",
"(",
")",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | draw_if_interactive | Is called after every pylab drawing command | environment/lib/python2.7/site-packages/IPython/zmq/pylab/backend_inline.py | def draw_if_interactive():
"""
Is called after every pylab drawing command
"""
# signal that the current active figure should be sent at the end of
# execution. Also sets the _draw_called flag, signaling that there will be
# something to send. At the end of the code execution, a separate call ... | def draw_if_interactive():
"""
Is called after every pylab drawing command
"""
# signal that the current active figure should be sent at the end of
# execution. Also sets the _draw_called flag, signaling that there will be
# something to send. At the end of the code execution, a separate call ... | [
"Is",
"called",
"after",
"every",
"pylab",
"drawing",
"command"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/pylab/backend_inline.py#L116-L156 | [
"def",
"draw_if_interactive",
"(",
")",
":",
"# signal that the current active figure should be sent at the end of",
"# execution. Also sets the _draw_called flag, signaling that there will be",
"# something to send. At the end of the code execution, a separate call to",
"# flush_figures() will ac... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | flush_figures | Send all figures that changed
This is meant to be called automatically and will call show() if, during
prior code execution, there had been any calls to draw_if_interactive.
This function is meant to be used as a post_execute callback in IPython,
so user-caused errors are handled with showtracebac... | environment/lib/python2.7/site-packages/IPython/zmq/pylab/backend_inline.py | def flush_figures():
"""Send all figures that changed
This is meant to be called automatically and will call show() if, during
prior code execution, there had been any calls to draw_if_interactive.
This function is meant to be used as a post_execute callback in IPython,
so user-caused errors a... | def flush_figures():
"""Send all figures that changed
This is meant to be called automatically and will call show() if, during
prior code execution, there had been any calls to draw_if_interactive.
This function is meant to be used as a post_execute callback in IPython,
so user-caused errors a... | [
"Send",
"all",
"figures",
"that",
"changed"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/pylab/backend_inline.py#L159-L204 | [
"def",
"flush_figures",
"(",
")",
":",
"if",
"not",
"show",
".",
"_draw_called",
":",
"return",
"if",
"InlineBackend",
".",
"instance",
"(",
")",
".",
"close_figures",
":",
"# ignore the tracking, just draw and close all figures",
"try",
":",
"return",
"show",
"("... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | send_figure | Draw the given figure and send it as a PNG payload. | environment/lib/python2.7/site-packages/IPython/zmq/pylab/backend_inline.py | def send_figure(fig):
"""Draw the given figure and send it as a PNG payload.
"""
fmt = InlineBackend.instance().figure_format
data = print_figure(fig, fmt)
# print_figure will return None if there's nothing to draw:
if data is None:
return
mimetypes = { 'png' : 'image/png', 'svg' : '... | def send_figure(fig):
"""Draw the given figure and send it as a PNG payload.
"""
fmt = InlineBackend.instance().figure_format
data = print_figure(fig, fmt)
# print_figure will return None if there's nothing to draw:
if data is None:
return
mimetypes = { 'png' : 'image/png', 'svg' : '... | [
"Draw",
"the",
"given",
"figure",
"and",
"send",
"it",
"as",
"a",
"PNG",
"payload",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/pylab/backend_inline.py#L207-L223 | [
"def",
"send_figure",
"(",
"fig",
")",
":",
"fmt",
"=",
"InlineBackend",
".",
"instance",
"(",
")",
".",
"figure_format",
"data",
"=",
"print_figure",
"(",
"fig",
",",
"fmt",
")",
"# print_figure will return None if there's nothing to draw:",
"if",
"data",
"is",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ExtensionManager.load_extension | Load an IPython extension by its module name.
If :func:`load_ipython_extension` returns anything, this function
will return that object. | environment/lib/python2.7/site-packages/IPython/core/extensions.py | def load_extension(self, module_str):
"""Load an IPython extension by its module name.
If :func:`load_ipython_extension` returns anything, this function
will return that object.
"""
from IPython.utils.syspathcontext import prepended_to_syspath
if module_str not in sys.m... | def load_extension(self, module_str):
"""Load an IPython extension by its module name.
If :func:`load_ipython_extension` returns anything, this function
will return that object.
"""
from IPython.utils.syspathcontext import prepended_to_syspath
if module_str not in sys.m... | [
"Load",
"an",
"IPython",
"extension",
"by",
"its",
"module",
"name",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/extensions.py#L80-L92 | [
"def",
"load_extension",
"(",
"self",
",",
"module_str",
")",
":",
"from",
"IPython",
".",
"utils",
".",
"syspathcontext",
"import",
"prepended_to_syspath",
"if",
"module_str",
"not",
"in",
"sys",
".",
"modules",
":",
"with",
"prepended_to_syspath",
"(",
"self",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ExtensionManager.unload_extension | Unload an IPython extension by its module name.
This function looks up the extension's name in ``sys.modules`` and
simply calls ``mod.unload_ipython_extension(self)``. | environment/lib/python2.7/site-packages/IPython/core/extensions.py | def unload_extension(self, module_str):
"""Unload an IPython extension by its module name.
This function looks up the extension's name in ``sys.modules`` and
simply calls ``mod.unload_ipython_extension(self)``.
"""
if module_str in sys.modules:
mod = sys.modules[modu... | def unload_extension(self, module_str):
"""Unload an IPython extension by its module name.
This function looks up the extension's name in ``sys.modules`` and
simply calls ``mod.unload_ipython_extension(self)``.
"""
if module_str in sys.modules:
mod = sys.modules[modu... | [
"Unload",
"an",
"IPython",
"extension",
"by",
"its",
"module",
"name",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/extensions.py#L94-L102 | [
"def",
"unload_extension",
"(",
"self",
",",
"module_str",
")",
":",
"if",
"module_str",
"in",
"sys",
".",
"modules",
":",
"mod",
"=",
"sys",
".",
"modules",
"[",
"module_str",
"]",
"self",
".",
"_call_unload_ipython_extension",
"(",
"mod",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ExtensionManager.install_extension | Download and install an IPython extension.
If filename is given, the file will be so named (inside the extension
directory). Otherwise, the name from the URL will be used. The file must
have a .py or .zip extension; otherwise, a ValueError will be raised.
Returns the f... | environment/lib/python2.7/site-packages/IPython/core/extensions.py | def install_extension(self, url, filename=None):
"""Download and install an IPython extension.
If filename is given, the file will be so named (inside the extension
directory). Otherwise, the name from the URL will be used. The file must
have a .py or .zip extension; otherwise,... | def install_extension(self, url, filename=None):
"""Download and install an IPython extension.
If filename is given, the file will be so named (inside the extension
directory). Otherwise, the name from the URL will be used. The file must
have a .py or .zip extension; otherwise,... | [
"Download",
"and",
"install",
"an",
"IPython",
"extension",
".",
"If",
"filename",
"is",
"given",
"the",
"file",
"will",
"be",
"so",
"named",
"(",
"inside",
"the",
"extension",
"directory",
")",
".",
"Otherwise",
"the",
"name",
"from",
"the",
"URL",
"will"... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/extensions.py#L130-L157 | [
"def",
"install_extension",
"(",
"self",
",",
"url",
",",
"filename",
"=",
"None",
")",
":",
"# Ensure the extension directory exists",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"self",
".",
"ipython_extension_dir",
")",
":",
"os",
".",
"makedirs",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | externals_finder | Find any 'svn:externals' directories | environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/command/sdist.py | def externals_finder(dirname, filename):
"""Find any 'svn:externals' directories"""
found = False
f = open(filename,'rt')
for line in iter(f.readline, ''): # can't use direct iter!
parts = line.split()
if len(parts)==2:
kind,length = parts
data = f.read(int(len... | def externals_finder(dirname, filename):
"""Find any 'svn:externals' directories"""
found = False
f = open(filename,'rt')
for line in iter(f.readline, ''): # can't use direct iter!
parts = line.split()
if len(parts)==2:
kind,length = parts
data = f.read(int(len... | [
"Find",
"any",
"svn",
":",
"externals",
"directories"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/command/sdist.py#L62-L83 | [
"def",
"externals_finder",
"(",
"dirname",
",",
"filename",
")",
":",
"found",
"=",
"False",
"f",
"=",
"open",
"(",
"filename",
",",
"'rt'",
")",
"for",
"line",
"in",
"iter",
"(",
"f",
".",
"readline",
",",
"''",
")",
":",
"# can't use direct iter!",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | random_ports | Generate a list of n random ports near the given port.
The first 5 ports will be sequential, and the remaining n-5 will be
randomly selected in the range [port-2*n, port+2*n]. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.py | def random_ports(port, n):
"""Generate a list of n random ports near the given port.
The first 5 ports will be sequential, and the remaining n-5 will be
randomly selected in the range [port-2*n, port+2*n].
"""
for i in range(min(5, n)):
yield port + i
for i in range(n-5):
yield ... | def random_ports(port, n):
"""Generate a list of n random ports near the given port.
The first 5 ports will be sequential, and the remaining n-5 will be
randomly selected in the range [port-2*n, port+2*n].
"""
for i in range(min(5, n)):
yield port + i
for i in range(n-5):
yield ... | [
"Generate",
"a",
"list",
"of",
"n",
"random",
"ports",
"near",
"the",
"given",
"port",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.py#L102-L111 | [
"def",
"random_ports",
"(",
"port",
",",
"n",
")",
":",
"for",
"i",
"in",
"range",
"(",
"min",
"(",
"5",
",",
"n",
")",
")",
":",
"yield",
"port",
"+",
"i",
"for",
"i",
"in",
"range",
"(",
"n",
"-",
"5",
")",
":",
"yield",
"port",
"+",
"ran... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookApp.init_webapp | initialize tornado webapp and httpserver | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.py | def init_webapp(self):
"""initialize tornado webapp and httpserver"""
self.web_app = NotebookWebApplication(
self, self.kernel_manager, self.notebook_manager,
self.cluster_manager, self.log,
self.base_project_url, self.webapp_settings
)
if self.certfi... | def init_webapp(self):
"""initialize tornado webapp and httpserver"""
self.web_app = NotebookWebApplication(
self, self.kernel_manager, self.notebook_manager,
self.cluster_manager, self.log,
self.base_project_url, self.webapp_settings
)
if self.certfi... | [
"initialize",
"tornado",
"webapp",
"and",
"httpserver"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.py#L427-L462 | [
"def",
"init_webapp",
"(",
"self",
")",
":",
"self",
".",
"web_app",
"=",
"NotebookWebApplication",
"(",
"self",
",",
"self",
".",
"kernel_manager",
",",
"self",
".",
"notebook_manager",
",",
"self",
".",
"cluster_manager",
",",
"self",
".",
"log",
",",
"s... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookApp._handle_sigint | SIGINT handler spawns confirmation dialog | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.py | def _handle_sigint(self, sig, frame):
"""SIGINT handler spawns confirmation dialog"""
# register more forceful signal handler for ^C^C case
signal.signal(signal.SIGINT, self._signal_stop)
# request confirmation dialog in bg thread, to avoid
# blocking the App
thread = thr... | def _handle_sigint(self, sig, frame):
"""SIGINT handler spawns confirmation dialog"""
# register more forceful signal handler for ^C^C case
signal.signal(signal.SIGINT, self._signal_stop)
# request confirmation dialog in bg thread, to avoid
# blocking the App
thread = thr... | [
"SIGINT",
"handler",
"spawns",
"confirmation",
"dialog"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.py#L481-L489 | [
"def",
"_handle_sigint",
"(",
"self",
",",
"sig",
",",
"frame",
")",
":",
"# register more forceful signal handler for ^C^C case",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGINT",
",",
"self",
".",
"_signal_stop",
")",
"# request confirmation dialog in bg thread, ... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookApp._confirm_exit | confirm shutdown on ^C
A second ^C, or answering 'y' within 5s will cause shutdown,
otherwise original SIGINT handler will be restored.
This doesn't work on Windows. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.py | def _confirm_exit(self):
"""confirm shutdown on ^C
A second ^C, or answering 'y' within 5s will cause shutdown,
otherwise original SIGINT handler will be restored.
This doesn't work on Windows.
"""
# FIXME: remove this delay when pyzmq dependency is >= 2... | def _confirm_exit(self):
"""confirm shutdown on ^C
A second ^C, or answering 'y' within 5s will cause shutdown,
otherwise original SIGINT handler will be restored.
This doesn't work on Windows.
"""
# FIXME: remove this delay when pyzmq dependency is >= 2... | [
"confirm",
"shutdown",
"on",
"^C",
"A",
"second",
"^C",
"or",
"answering",
"y",
"within",
"5s",
"will",
"cause",
"shutdown",
"otherwise",
"original",
"SIGINT",
"handler",
"will",
"be",
"restored",
".",
"This",
"doesn",
"t",
"work",
"on",
"Windows",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.py#L495-L521 | [
"def",
"_confirm_exit",
"(",
"self",
")",
":",
"# FIXME: remove this delay when pyzmq dependency is >= 2.1.11",
"time",
".",
"sleep",
"(",
"0.1",
")",
"sys",
".",
"stdout",
".",
"write",
"(",
"\"Shutdown Notebook Server (y/[n])? \"",
")",
"sys",
".",
"stdout",
".",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookApp.cleanup_kernels | shutdown all kernels
The kernels will shutdown themselves when this process no longer exists,
but explicit shutdown allows the KernelManagers to cleanup the connection files. | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.py | def cleanup_kernels(self):
"""shutdown all kernels
The kernels will shutdown themselves when this process no longer exists,
but explicit shutdown allows the KernelManagers to cleanup the connection files.
"""
self.log.info('Shutting down kernels')
km = self.kerne... | def cleanup_kernels(self):
"""shutdown all kernels
The kernels will shutdown themselves when this process no longer exists,
but explicit shutdown allows the KernelManagers to cleanup the connection files.
"""
self.log.info('Shutting down kernels')
km = self.kerne... | [
"shutdown",
"all",
"kernels",
"The",
"kernels",
"will",
"shutdown",
"themselves",
"when",
"this",
"process",
"no",
"longer",
"exists",
"but",
"explicit",
"shutdown",
"allows",
"the",
"KernelManagers",
"to",
"cleanup",
"the",
"connection",
"files",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.py#L535-L545 | [
"def",
"cleanup_kernels",
"(",
"self",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"'Shutting down kernels'",
")",
"km",
"=",
"self",
".",
"kernel_manager",
"# copy list, since shutdown_kernel deletes keys",
"for",
"kid",
"in",
"list",
"(",
"km",
".",
"kerne... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | price_options | Price European and Asian options using a Monte Carlo method.
Parameters
----------
S : float
The initial price of the stock.
K : float
The strike price of the option.
sigma : float
The volatility of the stock.
r : float
The risk free interest rate.
days : int... | environment/share/doc/ipython/examples/parallel/options/mckernel.py | def price_options(S=100.0, K=100.0, sigma=0.25, r=0.05, days=260, paths=10000):
"""
Price European and Asian options using a Monte Carlo method.
Parameters
----------
S : float
The initial price of the stock.
K : float
The strike price of the option.
sigma : float
Th... | def price_options(S=100.0, K=100.0, sigma=0.25, r=0.05, days=260, paths=10000):
"""
Price European and Asian options using a Monte Carlo method.
Parameters
----------
S : float
The initial price of the stock.
K : float
The strike price of the option.
sigma : float
Th... | [
"Price",
"European",
"and",
"Asian",
"options",
"using",
"a",
"Monte",
"Carlo",
"method",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/options/mckernel.py#L1-L43 | [
"def",
"price_options",
"(",
"S",
"=",
"100.0",
",",
"K",
"=",
"100.0",
",",
"sigma",
"=",
"0.25",
",",
"r",
"=",
"0.05",
",",
"days",
"=",
"260",
",",
"paths",
"=",
"10000",
")",
":",
"import",
"numpy",
"as",
"np",
"from",
"math",
"import",
"exp... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | multiple_replace | Replace in 'text' all occurences of any key in the given
dictionary by its corresponding value. Returns the new string. | environment/lib/python2.7/site-packages/IPython/core/prompts.py | def multiple_replace(dict, text):
""" Replace in 'text' all occurences of any key in the given
dictionary by its corresponding value. Returns the new string."""
# Function by Xavier Defrang, originally found at:
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81330
# Create a regular ex... | def multiple_replace(dict, text):
""" Replace in 'text' all occurences of any key in the given
dictionary by its corresponding value. Returns the new string."""
# Function by Xavier Defrang, originally found at:
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81330
# Create a regular ex... | [
"Replace",
"in",
"text",
"all",
"occurences",
"of",
"any",
"key",
"in",
"the",
"given",
"dictionary",
"by",
"its",
"corresponding",
"value",
".",
"Returns",
"the",
"new",
"string",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prompts.py#L106-L116 | [
"def",
"multiple_replace",
"(",
"dict",
",",
"text",
")",
":",
"# Function by Xavier Defrang, originally found at:",
"# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81330",
"# Create a regular expression from the dictionary keys",
"regex",
"=",
"re",
".",
"compile",
"(",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | cwd_filt | Return the last depth elements of the current working directory.
$HOME is always replaced with '~'.
If depth==0, the full path is returned. | environment/lib/python2.7/site-packages/IPython/core/prompts.py | def cwd_filt(depth):
"""Return the last depth elements of the current working directory.
$HOME is always replaced with '~'.
If depth==0, the full path is returned."""
cwd = os.getcwdu().replace(HOME,"~")
out = os.sep.join(cwd.split(os.sep)[-depth:])
return out or os.sep | def cwd_filt(depth):
"""Return the last depth elements of the current working directory.
$HOME is always replaced with '~'.
If depth==0, the full path is returned."""
cwd = os.getcwdu().replace(HOME,"~")
out = os.sep.join(cwd.split(os.sep)[-depth:])
return out or os.sep | [
"Return",
"the",
"last",
"depth",
"elements",
"of",
"the",
"current",
"working",
"directory",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prompts.py#L209-L217 | [
"def",
"cwd_filt",
"(",
"depth",
")",
":",
"cwd",
"=",
"os",
".",
"getcwdu",
"(",
")",
".",
"replace",
"(",
"HOME",
",",
"\"~\"",
")",
"out",
"=",
"os",
".",
"sep",
".",
"join",
"(",
"cwd",
".",
"split",
"(",
"os",
".",
"sep",
")",
"[",
"-",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | cwd_filt2 | Return the last depth elements of the current working directory.
$HOME is always replaced with '~'.
If depth==0, the full path is returned. | environment/lib/python2.7/site-packages/IPython/core/prompts.py | def cwd_filt2(depth):
"""Return the last depth elements of the current working directory.
$HOME is always replaced with '~'.
If depth==0, the full path is returned."""
full_cwd = os.getcwdu()
cwd = full_cwd.replace(HOME,"~").split(os.sep)
if '~' in cwd and len(cwd) == depth+1:
depth +=... | def cwd_filt2(depth):
"""Return the last depth elements of the current working directory.
$HOME is always replaced with '~'.
If depth==0, the full path is returned."""
full_cwd = os.getcwdu()
cwd = full_cwd.replace(HOME,"~").split(os.sep)
if '~' in cwd and len(cwd) == depth+1:
depth +=... | [
"Return",
"the",
"last",
"depth",
"elements",
"of",
"the",
"current",
"working",
"directory",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prompts.py#L219-L234 | [
"def",
"cwd_filt2",
"(",
"depth",
")",
":",
"full_cwd",
"=",
"os",
".",
"getcwdu",
"(",
")",
"cwd",
"=",
"full_cwd",
".",
"replace",
"(",
"HOME",
",",
"\"~\"",
")",
".",
"split",
"(",
"os",
".",
"sep",
")",
"if",
"'~'",
"in",
"cwd",
"and",
"len",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PromptManager.update_prompt | This is called when a prompt template is updated. It processes
abbreviations used in the prompt template (like \#) and calculates how
many invisible characters (ANSI colour escapes) the resulting prompt
contains.
It is also called for each prompt on changing the colour scheme. I... | environment/lib/python2.7/site-packages/IPython/core/prompts.py | def update_prompt(self, name, new_template=None):
"""This is called when a prompt template is updated. It processes
abbreviations used in the prompt template (like \#) and calculates how
many invisible characters (ANSI colour escapes) the resulting prompt
contains.
It is... | def update_prompt(self, name, new_template=None):
"""This is called when a prompt template is updated. It processes
abbreviations used in the prompt template (like \#) and calculates how
many invisible characters (ANSI colour escapes) the resulting prompt
contains.
It is... | [
"This",
"is",
"called",
"when",
"a",
"prompt",
"template",
"is",
"updated",
".",
"It",
"processes",
"abbreviations",
"used",
"in",
"the",
"prompt",
"template",
"(",
"like",
"\\",
"#",
")",
"and",
"calculates",
"how",
"many",
"invisible",
"characters",
"(",
... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prompts.py#L337-L352 | [
"def",
"update_prompt",
"(",
"self",
",",
"name",
",",
"new_template",
"=",
"None",
")",
":",
"if",
"new_template",
"is",
"not",
"None",
":",
"self",
".",
"templates",
"[",
"name",
"]",
"=",
"multiple_replace",
"(",
"prompt_abbreviations",
",",
"new_template... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PromptManager._render | Render but don't justify, or update the width or txtwidth attributes. | environment/lib/python2.7/site-packages/IPython/core/prompts.py | def _render(self, name, color=True, **kwargs):
"""Render but don't justify, or update the width or txtwidth attributes.
"""
if name == 'rewrite':
return self._render_rewrite(color=color)
if color:
scheme = self.color_scheme_table.active_colors
... | def _render(self, name, color=True, **kwargs):
"""Render but don't justify, or update the width or txtwidth attributes.
"""
if name == 'rewrite':
return self._render_rewrite(color=color)
if color:
scheme = self.color_scheme_table.active_colors
... | [
"Render",
"but",
"don",
"t",
"justify",
"or",
"update",
"the",
"width",
"or",
"txtwidth",
"attributes",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prompts.py#L358-L393 | [
"def",
"_render",
"(",
"self",
",",
"name",
",",
"color",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"name",
"==",
"'rewrite'",
":",
"return",
"self",
".",
"_render_rewrite",
"(",
"color",
"=",
"color",
")",
"if",
"color",
":",
"scheme",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PromptManager._render_rewrite | Render the ---> rewrite prompt. | environment/lib/python2.7/site-packages/IPython/core/prompts.py | def _render_rewrite(self, color=True):
"""Render the ---> rewrite prompt."""
if color:
scheme = self.color_scheme_table.active_colors
# We need a non-input version of these escapes
color_prompt = scheme.in_prompt.replace("\001","").replace("\002","")
color... | def _render_rewrite(self, color=True):
"""Render the ---> rewrite prompt."""
if color:
scheme = self.color_scheme_table.active_colors
# We need a non-input version of these escapes
color_prompt = scheme.in_prompt.replace("\001","").replace("\002","")
color... | [
"Render",
"the",
"---",
">",
"rewrite",
"prompt",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prompts.py#L395-L405 | [
"def",
"_render_rewrite",
"(",
"self",
",",
"color",
"=",
"True",
")",
":",
"if",
"color",
":",
"scheme",
"=",
"self",
".",
"color_scheme_table",
".",
"active_colors",
"# We need a non-input version of these escapes",
"color_prompt",
"=",
"scheme",
".",
"in_prompt",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PromptManager.render | Render the selected prompt.
Parameters
----------
name : str
Which prompt to render. One of 'in', 'in2', 'out', 'rewrite'
color : bool
If True (default), include ANSI escape sequences for a coloured prompt.
just : bool
If True, justify the p... | environment/lib/python2.7/site-packages/IPython/core/prompts.py | def render(self, name, color=True, just=None, **kwargs):
"""
Render the selected prompt.
Parameters
----------
name : str
Which prompt to render. One of 'in', 'in2', 'out', 'rewrite'
color : bool
If True (default), include ANSI escape sequence... | def render(self, name, color=True, just=None, **kwargs):
"""
Render the selected prompt.
Parameters
----------
name : str
Which prompt to render. One of 'in', 'in2', 'out', 'rewrite'
color : bool
If True (default), include ANSI escape sequence... | [
"Render",
"the",
"selected",
"prompt",
".",
"Parameters",
"----------",
"name",
":",
"str",
"Which",
"prompt",
"to",
"render",
".",
"One",
"of",
"in",
"in2",
"out",
"rewrite",
"color",
":",
"bool",
"If",
"True",
"(",
"default",
")",
"include",
"ANSI",
"e... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prompts.py#L407-L439 | [
"def",
"render",
"(",
"self",
",",
"name",
",",
"color",
"=",
"True",
",",
"just",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"res",
"=",
"self",
".",
"_render",
"(",
"name",
",",
"color",
"=",
"color",
",",
"*",
"*",
"kwargs",
")",
"# Han... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | write_connection_file | Generates a JSON config file, including the selection of random ports.
Parameters
----------
fname : unicode
The path to the file to write
shell_port : int, optional
The port to use for ROUTER channel.
iopub_port : int, optional
The port to use for the SUB channel.
... | environment/lib/python2.7/site-packages/IPython/zmq/entry_point.py | def write_connection_file(fname=None, shell_port=0, iopub_port=0, stdin_port=0, hb_port=0,
ip=LOCALHOST, key=b''):
"""Generates a JSON config file, including the selection of random ports.
Parameters
----------
fname : unicode
The path to the file to write
she... | def write_connection_file(fname=None, shell_port=0, iopub_port=0, stdin_port=0, hb_port=0,
ip=LOCALHOST, key=b''):
"""Generates a JSON config file, including the selection of random ports.
Parameters
----------
fname : unicode
The path to the file to write
she... | [
"Generates",
"a",
"JSON",
"config",
"file",
"including",
"the",
"selection",
"of",
"random",
"ports",
".",
"Parameters",
"----------"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/entry_point.py#L23-L88 | [
"def",
"write_connection_file",
"(",
"fname",
"=",
"None",
",",
"shell_port",
"=",
"0",
",",
"iopub_port",
"=",
"0",
",",
"stdin_port",
"=",
"0",
",",
"hb_port",
"=",
"0",
",",
"ip",
"=",
"LOCALHOST",
",",
"key",
"=",
"b''",
")",
":",
"# default to tem... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | base_launch_kernel | Launches a localhost kernel, binding to the specified ports.
Parameters
----------
code : str,
A string of Python code that imports and executes a kernel entry point.
stdin, stdout, stderr : optional (default None)
Standards streams, as defined in subprocess.Popen.
fname : unicode... | environment/lib/python2.7/site-packages/IPython/zmq/entry_point.py | def base_launch_kernel(code, fname, stdin=None, stdout=None, stderr=None,
executable=None, independent=False, extra_arguments=[],
cwd=None):
""" Launches a localhost kernel, binding to the specified ports.
Parameters
----------
code : str,
A strin... | def base_launch_kernel(code, fname, stdin=None, stdout=None, stderr=None,
executable=None, independent=False, extra_arguments=[],
cwd=None):
""" Launches a localhost kernel, binding to the specified ports.
Parameters
----------
code : str,
A strin... | [
"Launches",
"a",
"localhost",
"kernel",
"binding",
"to",
"the",
"specified",
"ports",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/entry_point.py#L91-L216 | [
"def",
"base_launch_kernel",
"(",
"code",
",",
"fname",
",",
"stdin",
"=",
"None",
",",
"stdout",
"=",
"None",
",",
"stderr",
"=",
"None",
",",
"executable",
"=",
"None",
",",
"independent",
"=",
"False",
",",
"extra_arguments",
"=",
"[",
"]",
",",
"cw... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | create_zipfile | This is the actual zest.releaser entry point
Relevant items in the context dict:
name
Name of the project being released
tagdir
Directory where the tag checkout is placed (*if* a tag
checkout has been made)
version
Version we're releasing
workingdir
Origi... | qgispluginreleaser/entry_point.py | def create_zipfile(context):
"""This is the actual zest.releaser entry point
Relevant items in the context dict:
name
Name of the project being released
tagdir
Directory where the tag checkout is placed (*if* a tag
checkout has been made)
version
Version we're rel... | def create_zipfile(context):
"""This is the actual zest.releaser entry point
Relevant items in the context dict:
name
Name of the project being released
tagdir
Directory where the tag checkout is placed (*if* a tag
checkout has been made)
version
Version we're rel... | [
"This",
"is",
"the",
"actual",
"zest",
".",
"releaser",
"entry",
"point"
] | nens/qgispluginreleaser | python | https://github.com/nens/qgispluginreleaser/blob/4826dd33e9152cc4f9c4be3b89e5b10b1a881d7e/qgispluginreleaser/entry_point.py#L17-L45 | [
"def",
"create_zipfile",
"(",
"context",
")",
":",
"if",
"not",
"prerequisites_ok",
"(",
")",
":",
"return",
"# Create a zipfile.",
"subprocess",
".",
"call",
"(",
"[",
"'make'",
",",
"'zip'",
"]",
")",
"for",
"zipfile",
"in",
"glob",
".",
"glob",
"(",
"... | 4826dd33e9152cc4f9c4be3b89e5b10b1a881d7e |
test | fix_version | Fix the version in metadata.txt
Relevant context dict item for both prerelease and postrelease:
``new_version``. | qgispluginreleaser/entry_point.py | def fix_version(context):
"""Fix the version in metadata.txt
Relevant context dict item for both prerelease and postrelease:
``new_version``.
"""
if not prerequisites_ok():
return
lines = codecs.open('metadata.txt', 'rU', 'utf-8').readlines()
for index, line in enumerate(lines):
... | def fix_version(context):
"""Fix the version in metadata.txt
Relevant context dict item for both prerelease and postrelease:
``new_version``.
"""
if not prerequisites_ok():
return
lines = codecs.open('metadata.txt', 'rU', 'utf-8').readlines()
for index, line in enumerate(lines):
... | [
"Fix",
"the",
"version",
"in",
"metadata",
".",
"txt"
] | nens/qgispluginreleaser | python | https://github.com/nens/qgispluginreleaser/blob/4826dd33e9152cc4f9c4be3b89e5b10b1a881d7e/qgispluginreleaser/entry_point.py#L48-L63 | [
"def",
"fix_version",
"(",
"context",
")",
":",
"if",
"not",
"prerequisites_ok",
"(",
")",
":",
"return",
"lines",
"=",
"codecs",
".",
"open",
"(",
"'metadata.txt'",
",",
"'rU'",
",",
"'utf-8'",
")",
".",
"readlines",
"(",
")",
"for",
"index",
",",
"li... | 4826dd33e9152cc4f9c4be3b89e5b10b1a881d7e |
test | mappable | return whether an object is mappable or not. | environment/lib/python2.7/site-packages/IPython/parallel/client/map.py | def mappable(obj):
"""return whether an object is mappable or not."""
if isinstance(obj, (tuple,list)):
return True
for m in arrayModules:
if isinstance(obj,m['type']):
return True
return False | def mappable(obj):
"""return whether an object is mappable or not."""
if isinstance(obj, (tuple,list)):
return True
for m in arrayModules:
if isinstance(obj,m['type']):
return True
return False | [
"return",
"whether",
"an",
"object",
"is",
"mappable",
"or",
"not",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/map.py#L159-L166 | [
"def",
"mappable",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"return",
"True",
"for",
"m",
"in",
"arrayModules",
":",
"if",
"isinstance",
"(",
"obj",
",",
"m",
"[",
"'type'",
"]",
")",
":... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Map.getPartition | Returns the pth partition of q partitions of seq. | environment/lib/python2.7/site-packages/IPython/parallel/client/map.py | def getPartition(self, seq, p, q):
"""Returns the pth partition of q partitions of seq."""
# Test for error conditions here
if p<0 or p>=q:
print "No partition exists."
return
remainder = len(seq)%q
basesize = len(seq)//q
hi = []
... | def getPartition(self, seq, p, q):
"""Returns the pth partition of q partitions of seq."""
# Test for error conditions here
if p<0 or p>=q:
print "No partition exists."
return
remainder = len(seq)%q
basesize = len(seq)//q
hi = []
... | [
"Returns",
"the",
"pth",
"partition",
"of",
"q",
"partitions",
"of",
"seq",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/map.py#L62-L89 | [
"def",
"getPartition",
"(",
"self",
",",
"seq",
",",
"p",
",",
"q",
")",
":",
"# Test for error conditions here",
"if",
"p",
"<",
"0",
"or",
"p",
">=",
"q",
":",
"print",
"\"No partition exists.\"",
"return",
"remainder",
"=",
"len",
"(",
"seq",
")",
"%"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | pexpect_monkeypatch | Patch pexpect to prevent unhandled exceptions at VM teardown.
Calling this function will monkeypatch the pexpect.spawn class and modify
its __del__ method to make it more robust in the face of failures that can
occur if it is called when the Python VM is shutting down.
Since Python may fire __del__ me... | environment/lib/python2.7/site-packages/IPython/lib/irunner.py | def pexpect_monkeypatch():
"""Patch pexpect to prevent unhandled exceptions at VM teardown.
Calling this function will monkeypatch the pexpect.spawn class and modify
its __del__ method to make it more robust in the face of failures that can
occur if it is called when the Python VM is shutting down.
... | def pexpect_monkeypatch():
"""Patch pexpect to prevent unhandled exceptions at VM teardown.
Calling this function will monkeypatch the pexpect.spawn class and modify
its __del__ method to make it more robust in the face of failures that can
occur if it is called when the Python VM is shutting down.
... | [
"Patch",
"pexpect",
"to",
"prevent",
"unhandled",
"exceptions",
"at",
"VM",
"teardown",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/irunner.py#L50-L81 | [
"def",
"pexpect_monkeypatch",
"(",
")",
":",
"if",
"pexpect",
".",
"__version__",
"[",
":",
"3",
"]",
">=",
"'2.2'",
":",
"# No need to patch, fix is already the upstream version.",
"return",
"def",
"__del__",
"(",
"self",
")",
":",
"\"\"\"This makes sure that no syst... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | main | Run as a command-line script. | environment/lib/python2.7/site-packages/IPython/lib/irunner.py | def main():
"""Run as a command-line script."""
parser = optparse.OptionParser(usage=MAIN_USAGE)
newopt = parser.add_option
newopt('--ipython',action='store_const',dest='mode',const='ipython',
help='IPython interactive runner (default).')
newopt('--python',action='store_const',dest='mode... | def main():
"""Run as a command-line script."""
parser = optparse.OptionParser(usage=MAIN_USAGE)
newopt = parser.add_option
newopt('--ipython',action='store_const',dest='mode',const='ipython',
help='IPython interactive runner (default).')
newopt('--python',action='store_const',dest='mode... | [
"Run",
"as",
"a",
"command",
"-",
"line",
"script",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/irunner.py#L412-L439 | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
"usage",
"=",
"MAIN_USAGE",
")",
"newopt",
"=",
"parser",
".",
"add_option",
"newopt",
"(",
"'--ipython'",
",",
"action",
"=",
"'store_const'",
",",
"dest",
"=",
"'mode'",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | InteractiveRunner.run_file | Run the given file interactively.
Inputs:
-fname: name of the file to execute.
See the run_source docstring for the meaning of the optional
arguments. | environment/lib/python2.7/site-packages/IPython/lib/irunner.py | def run_file(self,fname,interact=False,get_output=False):
"""Run the given file interactively.
Inputs:
-fname: name of the file to execute.
See the run_source docstring for the meaning of the optional
arguments."""
fobj = open(fname,'r')
try:
out... | def run_file(self,fname,interact=False,get_output=False):
"""Run the given file interactively.
Inputs:
-fname: name of the file to execute.
See the run_source docstring for the meaning of the optional
arguments."""
fobj = open(fname,'r')
try:
out... | [
"Run",
"the",
"given",
"file",
"interactively",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/irunner.py#L153-L169 | [
"def",
"run_file",
"(",
"self",
",",
"fname",
",",
"interact",
"=",
"False",
",",
"get_output",
"=",
"False",
")",
":",
"fobj",
"=",
"open",
"(",
"fname",
",",
"'r'",
")",
"try",
":",
"out",
"=",
"self",
".",
"run_source",
"(",
"fobj",
",",
"intera... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | InteractiveRunner.run_source | Run the given source code interactively.
Inputs:
- source: a string of code to be executed, or an open file object we
can iterate over.
Optional inputs:
- interact(False): if true, start to interact with the running
program at the end of the script. Otherwise... | environment/lib/python2.7/site-packages/IPython/lib/irunner.py | def run_source(self,source,interact=False,get_output=False):
"""Run the given source code interactively.
Inputs:
- source: a string of code to be executed, or an open file object we
can iterate over.
Optional inputs:
- interact(False): if true, start to interact... | def run_source(self,source,interact=False,get_output=False):
"""Run the given source code interactively.
Inputs:
- source: a string of code to be executed, or an open file object we
can iterate over.
Optional inputs:
- interact(False): if true, start to interact... | [
"Run",
"the",
"given",
"source",
"code",
"interactively",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/irunner.py#L171-L273 | [
"def",
"run_source",
"(",
"self",
",",
"source",
",",
"interact",
"=",
"False",
",",
"get_output",
"=",
"False",
")",
":",
"# if the source is a string, chop it up in lines so we can iterate",
"# over it just as if it were an open file.",
"if",
"isinstance",
"(",
"source",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | InteractiveRunner.main | Run as a command-line script. | environment/lib/python2.7/site-packages/IPython/lib/irunner.py | def main(self,argv=None):
"""Run as a command-line script."""
parser = optparse.OptionParser(usage=USAGE % self.__class__.__name__)
newopt = parser.add_option
newopt('-i','--interact',action='store_true',default=False,
help='Interact with the program after the script is r... | def main(self,argv=None):
"""Run as a command-line script."""
parser = optparse.OptionParser(usage=USAGE % self.__class__.__name__)
newopt = parser.add_option
newopt('-i','--interact',action='store_true',default=False,
help='Interact with the program after the script is r... | [
"Run",
"as",
"a",
"command",
"-",
"line",
"script",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/irunner.py#L275-L289 | [
"def",
"main",
"(",
"self",
",",
"argv",
"=",
"None",
")",
":",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
"usage",
"=",
"USAGE",
"%",
"self",
".",
"__class__",
".",
"__name__",
")",
"newopt",
"=",
"parser",
".",
"add_option",
"newopt",
"(",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | XmlReporter.report | Generate a Cobertura-compatible XML report for `morfs`.
`morfs` is a list of modules or filenames.
`outfile` is a file object to write the XML to. | virtualEnvironment/lib/python2.7/site-packages/coverage/xmlreport.py | def report(self, morfs, outfile=None):
"""Generate a Cobertura-compatible XML report for `morfs`.
`morfs` is a list of modules or filenames.
`outfile` is a file object to write the XML to.
"""
# Initial setup.
outfile = outfile or sys.stdout
# Create the DOM t... | def report(self, morfs, outfile=None):
"""Generate a Cobertura-compatible XML report for `morfs`.
`morfs` is a list of modules or filenames.
`outfile` is a file object to write the XML to.
"""
# Initial setup.
outfile = outfile or sys.stdout
# Create the DOM t... | [
"Generate",
"a",
"Cobertura",
"-",
"compatible",
"XML",
"report",
"for",
"morfs",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/xmlreport.py#L25-L93 | [
"def",
"report",
"(",
"self",
",",
"morfs",
",",
"outfile",
"=",
"None",
")",
":",
"# Initial setup.",
"outfile",
"=",
"outfile",
"or",
"sys",
".",
"stdout",
"# Create the DOM that will store the data.",
"impl",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | XmlReporter.xml_file | Add to the XML report for a single file. | virtualEnvironment/lib/python2.7/site-packages/coverage/xmlreport.py | def xml_file(self, cu, analysis):
"""Add to the XML report for a single file."""
# Create the 'lines' and 'package' XML elements, which
# are populated later. Note that a package == a directory.
package_name = rpartition(cu.name, ".")[0]
className = cu.name
package = s... | def xml_file(self, cu, analysis):
"""Add to the XML report for a single file."""
# Create the 'lines' and 'package' XML elements, which
# are populated later. Note that a package == a directory.
package_name = rpartition(cu.name, ".")[0]
className = cu.name
package = s... | [
"Add",
"to",
"the",
"XML",
"report",
"for",
"a",
"single",
"file",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/xmlreport.py#L95-L155 | [
"def",
"xml_file",
"(",
"self",
",",
"cu",
",",
"analysis",
")",
":",
"# Create the 'lines' and 'package' XML elements, which",
"# are populated later. Note that a package == a directory.",
"package_name",
"=",
"rpartition",
"(",
"cu",
".",
"name",
",",
"\".\"",
")",
"["... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | phistogram | Compute the histogram of a remote array a.
Parameters
----------
view
IPython DirectView instance
a : str
String name of the remote array
bins : int
Number of histogram bins
rng : (float, float)
Tuple of min, max of the range t... | environment/share/doc/ipython/examples/parallel/phistogram.py | def phistogram(view, a, bins=10, rng=None, normed=False):
"""Compute the histogram of a remote array a.
Parameters
----------
view
IPython DirectView instance
a : str
String name of the remote array
bins : int
Number of histogram bins
... | def phistogram(view, a, bins=10, rng=None, normed=False):
"""Compute the histogram of a remote array a.
Parameters
----------
view
IPython DirectView instance
a : str
String name of the remote array
bins : int
Number of histogram bins
... | [
"Compute",
"the",
"histogram",
"of",
"a",
"remote",
"array",
"a",
".",
"Parameters",
"----------",
"view",
"IPython",
"DirectView",
"instance",
"a",
":",
"str",
"String",
"name",
"of",
"the",
"remote",
"array",
"bins",
":",
"int",
"Number",
"of",
"histogram"... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/phistogram.py#L5-L36 | [
"def",
"phistogram",
"(",
"view",
",",
"a",
",",
"bins",
"=",
"10",
",",
"rng",
"=",
"None",
",",
"normed",
"=",
"False",
")",
":",
"nengines",
"=",
"len",
"(",
"view",
".",
"targets",
")",
"# view.push(dict(bins=bins, rng=rng))",
"with",
"view",
".",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | fetch_pi_file | This will download a segment of pi from super-computing.org
if the file is not already present. | environment/share/doc/ipython/examples/parallel/pi/pidigits.py | def fetch_pi_file(filename):
"""This will download a segment of pi from super-computing.org
if the file is not already present.
"""
import os, urllib
ftpdir="ftp://pi.super-computing.org/.2/pi200m/"
if os.path.exists(filename):
# we already have it
return
else:
# down... | def fetch_pi_file(filename):
"""This will download a segment of pi from super-computing.org
if the file is not already present.
"""
import os, urllib
ftpdir="ftp://pi.super-computing.org/.2/pi200m/"
if os.path.exists(filename):
# we already have it
return
else:
# down... | [
"This",
"will",
"download",
"a",
"segment",
"of",
"pi",
"from",
"super",
"-",
"computing",
".",
"org",
"if",
"the",
"file",
"is",
"not",
"already",
"present",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/pi/pidigits.py#L26-L37 | [
"def",
"fetch_pi_file",
"(",
"filename",
")",
":",
"import",
"os",
",",
"urllib",
"ftpdir",
"=",
"\"ftp://pi.super-computing.org/.2/pi200m/\"",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"# we already have it",
"return",
"else",
":",
"# d... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | reduce_freqs | Add up a list of freq counts to get the total counts. | environment/share/doc/ipython/examples/parallel/pi/pidigits.py | def reduce_freqs(freqlist):
"""
Add up a list of freq counts to get the total counts.
"""
allfreqs = np.zeros_like(freqlist[0])
for f in freqlist:
allfreqs += f
return allfreqs | def reduce_freqs(freqlist):
"""
Add up a list of freq counts to get the total counts.
"""
allfreqs = np.zeros_like(freqlist[0])
for f in freqlist:
allfreqs += f
return allfreqs | [
"Add",
"up",
"a",
"list",
"of",
"freq",
"counts",
"to",
"get",
"the",
"total",
"counts",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/pi/pidigits.py#L55-L62 | [
"def",
"reduce_freqs",
"(",
"freqlist",
")",
":",
"allfreqs",
"=",
"np",
".",
"zeros_like",
"(",
"freqlist",
"[",
"0",
"]",
")",
"for",
"f",
"in",
"freqlist",
":",
"allfreqs",
"+=",
"f",
"return",
"allfreqs"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | compute_n_digit_freqs | Read digits of pi from a file and compute the n digit frequencies. | environment/share/doc/ipython/examples/parallel/pi/pidigits.py | def compute_n_digit_freqs(filename, n):
"""
Read digits of pi from a file and compute the n digit frequencies.
"""
d = txt_file_to_digits(filename)
freqs = n_digit_freqs(d, n)
return freqs | def compute_n_digit_freqs(filename, n):
"""
Read digits of pi from a file and compute the n digit frequencies.
"""
d = txt_file_to_digits(filename)
freqs = n_digit_freqs(d, n)
return freqs | [
"Read",
"digits",
"of",
"pi",
"from",
"a",
"file",
"and",
"compute",
"the",
"n",
"digit",
"frequencies",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/pi/pidigits.py#L64-L70 | [
"def",
"compute_n_digit_freqs",
"(",
"filename",
",",
"n",
")",
":",
"d",
"=",
"txt_file_to_digits",
"(",
"filename",
")",
"freqs",
"=",
"n_digit_freqs",
"(",
"d",
",",
"n",
")",
"return",
"freqs"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | txt_file_to_digits | Yield the digits of pi read from a .txt file. | environment/share/doc/ipython/examples/parallel/pi/pidigits.py | def txt_file_to_digits(filename, the_type=str):
"""
Yield the digits of pi read from a .txt file.
"""
with open(filename, 'r') as f:
for line in f.readlines():
for c in line:
if c != '\n' and c!= ' ':
yield the_type(c) | def txt_file_to_digits(filename, the_type=str):
"""
Yield the digits of pi read from a .txt file.
"""
with open(filename, 'r') as f:
for line in f.readlines():
for c in line:
if c != '\n' and c!= ' ':
yield the_type(c) | [
"Yield",
"the",
"digits",
"of",
"pi",
"read",
"from",
"a",
".",
"txt",
"file",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/pi/pidigits.py#L74-L82 | [
"def",
"txt_file_to_digits",
"(",
"filename",
",",
"the_type",
"=",
"str",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
".",
"readlines",
"(",
")",
":",
"for",
"c",
"in",
"line",
":",
"if",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | one_digit_freqs | Consume digits of pi and compute 1 digit freq. counts. | environment/share/doc/ipython/examples/parallel/pi/pidigits.py | def one_digit_freqs(digits, normalize=False):
"""
Consume digits of pi and compute 1 digit freq. counts.
"""
freqs = np.zeros(10, dtype='i4')
for d in digits:
freqs[int(d)] += 1
if normalize:
freqs = freqs/freqs.sum()
return freqs | def one_digit_freqs(digits, normalize=False):
"""
Consume digits of pi and compute 1 digit freq. counts.
"""
freqs = np.zeros(10, dtype='i4')
for d in digits:
freqs[int(d)] += 1
if normalize:
freqs = freqs/freqs.sum()
return freqs | [
"Consume",
"digits",
"of",
"pi",
"and",
"compute",
"1",
"digit",
"freq",
".",
"counts",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/pi/pidigits.py#L86-L95 | [
"def",
"one_digit_freqs",
"(",
"digits",
",",
"normalize",
"=",
"False",
")",
":",
"freqs",
"=",
"np",
".",
"zeros",
"(",
"10",
",",
"dtype",
"=",
"'i4'",
")",
"for",
"d",
"in",
"digits",
":",
"freqs",
"[",
"int",
"(",
"d",
")",
"]",
"+=",
"1",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | two_digit_freqs | Consume digits of pi and compute 2 digits freq. counts. | environment/share/doc/ipython/examples/parallel/pi/pidigits.py | def two_digit_freqs(digits, normalize=False):
"""
Consume digits of pi and compute 2 digits freq. counts.
"""
freqs = np.zeros(100, dtype='i4')
last = digits.next()
this = digits.next()
for d in digits:
index = int(last + this)
freqs[index] += 1
last = this
th... | def two_digit_freqs(digits, normalize=False):
"""
Consume digits of pi and compute 2 digits freq. counts.
"""
freqs = np.zeros(100, dtype='i4')
last = digits.next()
this = digits.next()
for d in digits:
index = int(last + this)
freqs[index] += 1
last = this
th... | [
"Consume",
"digits",
"of",
"pi",
"and",
"compute",
"2",
"digits",
"freq",
".",
"counts",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/pi/pidigits.py#L97-L111 | [
"def",
"two_digit_freqs",
"(",
"digits",
",",
"normalize",
"=",
"False",
")",
":",
"freqs",
"=",
"np",
".",
"zeros",
"(",
"100",
",",
"dtype",
"=",
"'i4'",
")",
"last",
"=",
"digits",
".",
"next",
"(",
")",
"this",
"=",
"digits",
".",
"next",
"(",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | n_digit_freqs | Consume digits of pi and compute n digits freq. counts.
This should only be used for 1-6 digits. | environment/share/doc/ipython/examples/parallel/pi/pidigits.py | def n_digit_freqs(digits, n, normalize=False):
"""
Consume digits of pi and compute n digits freq. counts.
This should only be used for 1-6 digits.
"""
freqs = np.zeros(pow(10,n), dtype='i4')
current = np.zeros(n, dtype=int)
for i in range(n):
current[i] = digits.next()
for d in... | def n_digit_freqs(digits, n, normalize=False):
"""
Consume digits of pi and compute n digits freq. counts.
This should only be used for 1-6 digits.
"""
freqs = np.zeros(pow(10,n), dtype='i4')
current = np.zeros(n, dtype=int)
for i in range(n):
current[i] = digits.next()
for d in... | [
"Consume",
"digits",
"of",
"pi",
"and",
"compute",
"n",
"digits",
"freq",
".",
"counts",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/pi/pidigits.py#L113-L130 | [
"def",
"n_digit_freqs",
"(",
"digits",
",",
"n",
",",
"normalize",
"=",
"False",
")",
":",
"freqs",
"=",
"np",
".",
"zeros",
"(",
"pow",
"(",
"10",
",",
"n",
")",
",",
"dtype",
"=",
"'i4'",
")",
"current",
"=",
"np",
".",
"zeros",
"(",
"n",
","... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | plot_two_digit_freqs | Plot two digits frequency counts using matplotlib. | environment/share/doc/ipython/examples/parallel/pi/pidigits.py | def plot_two_digit_freqs(f2):
"""
Plot two digits frequency counts using matplotlib.
"""
f2_copy = f2.copy()
f2_copy.shape = (10,10)
ax = plt.matshow(f2_copy)
plt.colorbar()
for i in range(10):
for j in range(10):
plt.text(i-0.2, j+0.2, str(j)+str(i))
plt.ylabel('... | def plot_two_digit_freqs(f2):
"""
Plot two digits frequency counts using matplotlib.
"""
f2_copy = f2.copy()
f2_copy.shape = (10,10)
ax = plt.matshow(f2_copy)
plt.colorbar()
for i in range(10):
for j in range(10):
plt.text(i-0.2, j+0.2, str(j)+str(i))
plt.ylabel('... | [
"Plot",
"two",
"digits",
"frequency",
"counts",
"using",
"matplotlib",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/pi/pidigits.py#L134-L147 | [
"def",
"plot_two_digit_freqs",
"(",
"f2",
")",
":",
"f2_copy",
"=",
"f2",
".",
"copy",
"(",
")",
"f2_copy",
".",
"shape",
"=",
"(",
"10",
",",
"10",
")",
"ax",
"=",
"plt",
".",
"matshow",
"(",
"f2_copy",
")",
"plt",
".",
"colorbar",
"(",
")",
"fo... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | plot_one_digit_freqs | Plot one digit frequency counts using matplotlib. | environment/share/doc/ipython/examples/parallel/pi/pidigits.py | def plot_one_digit_freqs(f1):
"""
Plot one digit frequency counts using matplotlib.
"""
ax = plt.plot(f1,'bo-')
plt.title('Single digit counts in pi')
plt.xlabel('Digit')
plt.ylabel('Count')
return ax | def plot_one_digit_freqs(f1):
"""
Plot one digit frequency counts using matplotlib.
"""
ax = plt.plot(f1,'bo-')
plt.title('Single digit counts in pi')
plt.xlabel('Digit')
plt.ylabel('Count')
return ax | [
"Plot",
"one",
"digit",
"frequency",
"counts",
"using",
"matplotlib",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/pi/pidigits.py#L149-L157 | [
"def",
"plot_one_digit_freqs",
"(",
"f1",
")",
":",
"ax",
"=",
"plt",
".",
"plot",
"(",
"f1",
",",
"'bo-'",
")",
"plt",
".",
"title",
"(",
"'Single digit counts in pi'",
")",
"plt",
".",
"xlabel",
"(",
"'Digit'",
")",
"plt",
".",
"ylabel",
"(",
"'Count... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | FragmentRequestGraph.__extend_uri | Extend a prefixed uri with the help of a specific dictionary of prefixes
:param short: Prefixed uri to be extended
:return: | sdh/curator/client/__init__.py | def __extend_uri(self, short):
"""
Extend a prefixed uri with the help of a specific dictionary of prefixes
:param short: Prefixed uri to be extended
:return:
"""
if short == 'a':
return RDF.type
for prefix in sorted(self.__prefixes, key=lambda x: len(... | def __extend_uri(self, short):
"""
Extend a prefixed uri with the help of a specific dictionary of prefixes
:param short: Prefixed uri to be extended
:return:
"""
if short == 'a':
return RDF.type
for prefix in sorted(self.__prefixes, key=lambda x: len(... | [
"Extend",
"a",
"prefixed",
"uri",
"with",
"the",
"help",
"of",
"a",
"specific",
"dictionary",
"of",
"prefixes",
":",
"param",
"short",
":",
"Prefixed",
"uri",
"to",
"be",
"extended",
":",
"return",
":"
] | SmartDeveloperHub/sdh-curator-py | python | https://github.com/SmartDeveloperHub/sdh-curator-py/blob/f2fd14751cbf49918b2a4e34ec4518c8bc62083c/sdh/curator/client/__init__.py#L189-L200 | [
"def",
"__extend_uri",
"(",
"self",
",",
"short",
")",
":",
"if",
"short",
"==",
"'a'",
":",
"return",
"RDF",
".",
"type",
"for",
"prefix",
"in",
"sorted",
"(",
"self",
".",
"__prefixes",
",",
"key",
"=",
"lambda",
"x",
":",
"len",
"(",
"x",
")",
... | f2fd14751cbf49918b2a4e34ec4518c8bc62083c |
test | get_object_or_none | Try to retrieve a model, and return None if
it is not found.
Useful if you do not want to bother with the try/except block. | django_baseline/models.py | def get_object_or_none(qs, *args, **kwargs):
"""
Try to retrieve a model, and return None if
it is not found.
Useful if you do not want to bother with the try/except block.
"""
try:
return qs.get(*args, **kwargs)
except models.ObjectDoesNotExist:
return None | def get_object_or_none(qs, *args, **kwargs):
"""
Try to retrieve a model, and return None if
it is not found.
Useful if you do not want to bother with the try/except block.
"""
try:
return qs.get(*args, **kwargs)
except models.ObjectDoesNotExist:
return None | [
"Try",
"to",
"retrieve",
"a",
"model",
"and",
"return",
"None",
"if",
"it",
"is",
"not",
"found",
".",
"Useful",
"if",
"you",
"do",
"not",
"want",
"to",
"bother",
"with",
"the",
"try",
"/",
"except",
"block",
"."
] | theduke/django-baseline | python | https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/models.py#L8-L18 | [
"def",
"get_object_or_none",
"(",
"qs",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"qs",
".",
"get",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except",
"models",
".",
"ObjectDoesNotExist",
":",
"return",
"None"
... | 7be8b956e53c70b35f34e1783a8fe8f716955afb |
test | extract_vars | Extract a set of variables by name from another frame.
:Parameters:
- `*names`: strings
One or more variable names which will be extracted from the caller's
frame.
:Keywords:
- `depth`: integer (0)
How many frames in the stack to walk when looking for your variables.
Exam... | environment/lib/python2.7/site-packages/IPython/utils/frame.py | def extract_vars(*names,**kw):
"""Extract a set of variables by name from another frame.
:Parameters:
- `*names`: strings
One or more variable names which will be extracted from the caller's
frame.
:Keywords:
- `depth`: integer (0)
How many frames in the stack to walk when ... | def extract_vars(*names,**kw):
"""Extract a set of variables by name from another frame.
:Parameters:
- `*names`: strings
One or more variable names which will be extracted from the caller's
frame.
:Keywords:
- `depth`: integer (0)
How many frames in the stack to walk when ... | [
"Extract",
"a",
"set",
"of",
"variables",
"by",
"name",
"from",
"another",
"frame",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/frame.py#L25-L52 | [
"def",
"extract_vars",
"(",
"*",
"names",
",",
"*",
"*",
"kw",
")",
":",
"depth",
"=",
"kw",
".",
"get",
"(",
"'depth'",
",",
"0",
")",
"callerNS",
"=",
"sys",
".",
"_getframe",
"(",
"depth",
"+",
"1",
")",
".",
"f_locals",
"return",
"dict",
"(",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | extract_vars_above | Extract a set of variables by name from another frame.
Similar to extractVars(), but with a specified depth of 1, so that names
are exctracted exactly from above the caller.
This is simply a convenience function so that the very common case (for us)
of skipping exactly 1 frame doesn't have to construc... | environment/lib/python2.7/site-packages/IPython/utils/frame.py | def extract_vars_above(*names):
"""Extract a set of variables by name from another frame.
Similar to extractVars(), but with a specified depth of 1, so that names
are exctracted exactly from above the caller.
This is simply a convenience function so that the very common case (for us)
of skipping e... | def extract_vars_above(*names):
"""Extract a set of variables by name from another frame.
Similar to extractVars(), but with a specified depth of 1, so that names
are exctracted exactly from above the caller.
This is simply a convenience function so that the very common case (for us)
of skipping e... | [
"Extract",
"a",
"set",
"of",
"variables",
"by",
"name",
"from",
"another",
"frame",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/frame.py#L55-L66 | [
"def",
"extract_vars_above",
"(",
"*",
"names",
")",
":",
"callerNS",
"=",
"sys",
".",
"_getframe",
"(",
"2",
")",
".",
"f_locals",
"return",
"dict",
"(",
"(",
"k",
",",
"callerNS",
"[",
"k",
"]",
")",
"for",
"k",
"in",
"names",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | debugx | Print the value of an expression from the caller's frame.
Takes an expression, evaluates it in the caller's frame and prints both
the given expression and the resulting value (as well as a debug mark
indicating the name of the calling function. The input must be of a form
suitable for eval().
An ... | environment/lib/python2.7/site-packages/IPython/utils/frame.py | def debugx(expr,pre_msg=''):
"""Print the value of an expression from the caller's frame.
Takes an expression, evaluates it in the caller's frame and prints both
the given expression and the resulting value (as well as a debug mark
indicating the name of the calling function. The input must be of a fo... | def debugx(expr,pre_msg=''):
"""Print the value of an expression from the caller's frame.
Takes an expression, evaluates it in the caller's frame and prints both
the given expression and the resulting value (as well as a debug mark
indicating the name of the calling function. The input must be of a fo... | [
"Print",
"the",
"value",
"of",
"an",
"expression",
"from",
"the",
"caller",
"s",
"frame",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/frame.py#L69-L82 | [
"def",
"debugx",
"(",
"expr",
",",
"pre_msg",
"=",
"''",
")",
":",
"cf",
"=",
"sys",
".",
"_getframe",
"(",
"1",
")",
"print",
"'[DBG:%s] %s%s -> %r'",
"%",
"(",
"cf",
".",
"f_code",
".",
"co_name",
",",
"pre_msg",
",",
"expr",
",",
"eval",
"(",
"e... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | extract_module_locals | Returns (module, locals) of the funciton `depth` frames away from the caller | environment/lib/python2.7/site-packages/IPython/utils/frame.py | def extract_module_locals(depth=0):
"""Returns (module, locals) of the funciton `depth` frames away from the caller"""
f = sys._getframe(depth + 1)
global_ns = f.f_globals
module = sys.modules[global_ns['__name__']]
return (module, f.f_locals) | def extract_module_locals(depth=0):
"""Returns (module, locals) of the funciton `depth` frames away from the caller"""
f = sys._getframe(depth + 1)
global_ns = f.f_globals
module = sys.modules[global_ns['__name__']]
return (module, f.f_locals) | [
"Returns",
"(",
"module",
"locals",
")",
"of",
"the",
"funciton",
"depth",
"frames",
"away",
"from",
"the",
"caller"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/frame.py#L88-L93 | [
"def",
"extract_module_locals",
"(",
"depth",
"=",
"0",
")",
":",
"f",
"=",
"sys",
".",
"_getframe",
"(",
"depth",
"+",
"1",
")",
"global_ns",
"=",
"f",
".",
"f_globals",
"module",
"=",
"sys",
".",
"modules",
"[",
"global_ns",
"[",
"'__name__'",
"]",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | reverse | User-friendly reverse. Pass arguments and keyword arguments to Django's `reverse`
as `args` and `kwargs` arguments, respectively.
The special optional keyword argument `query` is a dictionary of query (or GET) parameters
that can be appended to the `reverse`d URL.
Example:
reverse('products:category', category... | django_libretto/url.py | def reverse(view, *args, **kwargs):
'''
User-friendly reverse. Pass arguments and keyword arguments to Django's `reverse`
as `args` and `kwargs` arguments, respectively.
The special optional keyword argument `query` is a dictionary of query (or GET) parameters
that can be appended to the `reverse`d URL.
Example... | def reverse(view, *args, **kwargs):
'''
User-friendly reverse. Pass arguments and keyword arguments to Django's `reverse`
as `args` and `kwargs` arguments, respectively.
The special optional keyword argument `query` is a dictionary of query (or GET) parameters
that can be appended to the `reverse`d URL.
Example... | [
"User",
"-",
"friendly",
"reverse",
".",
"Pass",
"arguments",
"and",
"keyword",
"arguments",
"to",
"Django",
"s",
"reverse",
"as",
"args",
"and",
"kwargs",
"arguments",
"respectively",
"."
] | ze-phyr-us/django-libretto | python | https://github.com/ze-phyr-us/django-libretto/blob/b19d8aa21b9579ee91e81967a44d1c40f5588b17/django_libretto/url.py#L6-L31 | [
"def",
"reverse",
"(",
"view",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'query'",
"in",
"kwargs",
":",
"query",
"=",
"kwargs",
".",
"pop",
"(",
"'query'",
")",
"else",
":",
"query",
"=",
"None",
"base",
"=",
"urlresolvers",
".",
... | b19d8aa21b9579ee91e81967a44d1c40f5588b17 |
test | is_private | prefix, base -> true iff name prefix + "." + base is "private".
Prefix may be an empty string, and base does not contain a period.
Prefix is ignored (although functions you write conforming to this
protocol may make use of it).
Return true iff base begins with an (at least one) underscore, but
does... | environment/lib/python2.7/site-packages/nose/ext/dtcompat.py | def is_private(prefix, base):
"""prefix, base -> true iff name prefix + "." + base is "private".
Prefix may be an empty string, and base does not contain a period.
Prefix is ignored (although functions you write conforming to this
protocol may make use of it).
Return true iff base begins with an (a... | def is_private(prefix, base):
"""prefix, base -> true iff name prefix + "." + base is "private".
Prefix may be an empty string, and base does not contain a period.
Prefix is ignored (although functions you write conforming to this
protocol may make use of it).
Return true iff base begins with an (a... | [
"prefix",
"base",
"-",
">",
"true",
"iff",
"name",
"prefix",
"+",
".",
"+",
"base",
"is",
"private",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/ext/dtcompat.py#L184-L196 | [
"def",
"is_private",
"(",
"prefix",
",",
"base",
")",
":",
"warnings",
".",
"warn",
"(",
"\"is_private is deprecated; it wasn't useful; \"",
"\"examine DocTestFinder.find() lists instead\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"return",
"base",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | _extract_future_flags | Return the compiler-flags associated with the future features that
have been imported into the given namespace (globs). | environment/lib/python2.7/site-packages/nose/ext/dtcompat.py | def _extract_future_flags(globs):
"""
Return the compiler-flags associated with the future features that
have been imported into the given namespace (globs).
"""
flags = 0
for fname in __future__.all_feature_names:
feature = globs.get(fname, None)
if feature is getattr(__future__... | def _extract_future_flags(globs):
"""
Return the compiler-flags associated with the future features that
have been imported into the given namespace (globs).
"""
flags = 0
for fname in __future__.all_feature_names:
feature = globs.get(fname, None)
if feature is getattr(__future__... | [
"Return",
"the",
"compiler",
"-",
"flags",
"associated",
"with",
"the",
"future",
"features",
"that",
"have",
"been",
"imported",
"into",
"the",
"given",
"namespace",
"(",
"globs",
")",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/ext/dtcompat.py#L198-L208 | [
"def",
"_extract_future_flags",
"(",
"globs",
")",
":",
"flags",
"=",
"0",
"for",
"fname",
"in",
"__future__",
".",
"all_feature_names",
":",
"feature",
"=",
"globs",
".",
"get",
"(",
"fname",
",",
"None",
")",
"if",
"feature",
"is",
"getattr",
"(",
"__f... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | _normalize_module | Return the module specified by `module`. In particular:
- If `module` is a module, then return module.
- If `module` is a string, then import and return the
module with that name.
- If `module` is None, then return the calling module.
The calling module is assumed to be the module of
... | environment/lib/python2.7/site-packages/nose/ext/dtcompat.py | def _normalize_module(module, depth=2):
"""
Return the module specified by `module`. In particular:
- If `module` is a module, then return module.
- If `module` is a string, then import and return the
module with that name.
- If `module` is None, then return the calling module.
... | def _normalize_module(module, depth=2):
"""
Return the module specified by `module`. In particular:
- If `module` is a module, then return module.
- If `module` is a string, then import and return the
module with that name.
- If `module` is None, then return the calling module.
... | [
"Return",
"the",
"module",
"specified",
"by",
"module",
".",
"In",
"particular",
":",
"-",
"If",
"module",
"is",
"a",
"module",
"then",
"return",
"module",
".",
"-",
"If",
"module",
"is",
"a",
"string",
"then",
"import",
"and",
"return",
"the",
"module",... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/ext/dtcompat.py#L210-L227 | [
"def",
"_normalize_module",
"(",
"module",
",",
"depth",
"=",
"2",
")",
":",
"if",
"inspect",
".",
"ismodule",
"(",
"module",
")",
":",
"return",
"module",
"elif",
"isinstance",
"(",
"module",
",",
"(",
"str",
",",
"unicode",
")",
")",
":",
"return",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | _exception_traceback | Return a string containing a traceback message for the given
exc_info tuple (as returned by sys.exc_info()). | environment/lib/python2.7/site-packages/nose/ext/dtcompat.py | def _exception_traceback(exc_info):
"""
Return a string containing a traceback message for the given
exc_info tuple (as returned by sys.exc_info()).
"""
# Get a traceback message.
excout = StringIO()
exc_type, exc_val, exc_tb = exc_info
traceback.print_exception(exc_type, exc_val, exc_tb... | def _exception_traceback(exc_info):
"""
Return a string containing a traceback message for the given
exc_info tuple (as returned by sys.exc_info()).
"""
# Get a traceback message.
excout = StringIO()
exc_type, exc_val, exc_tb = exc_info
traceback.print_exception(exc_type, exc_val, exc_tb... | [
"Return",
"a",
"string",
"containing",
"a",
"traceback",
"message",
"for",
"the",
"given",
"exc_info",
"tuple",
"(",
"as",
"returned",
"by",
"sys",
".",
"exc_info",
"()",
")",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/ext/dtcompat.py#L237-L246 | [
"def",
"_exception_traceback",
"(",
"exc_info",
")",
":",
"# Get a traceback message.",
"excout",
"=",
"StringIO",
"(",
")",
"exc_type",
",",
"exc_val",
",",
"exc_tb",
"=",
"exc_info",
"traceback",
".",
"print_exception",
"(",
"exc_type",
",",
"exc_val",
",",
"e... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | run_docstring_examples | Test examples in the given object's docstring (`f`), using `globs`
as globals. Optional argument `name` is used in failure messages.
If the optional argument `verbose` is true, then generate output
even if there are no failures.
`compileflags` gives the set of flags that should be used by the
Pyth... | environment/lib/python2.7/site-packages/nose/ext/dtcompat.py | def run_docstring_examples(f, globs, verbose=False, name="NoName",
compileflags=None, optionflags=0):
"""
Test examples in the given object's docstring (`f`), using `globs`
as globals. Optional argument `name` is used in failure messages.
If the optional argument `verbose` is... | def run_docstring_examples(f, globs, verbose=False, name="NoName",
compileflags=None, optionflags=0):
"""
Test examples in the given object's docstring (`f`), using `globs`
as globals. Optional argument `name` is used in failure messages.
If the optional argument `verbose` is... | [
"Test",
"examples",
"in",
"the",
"given",
"object",
"s",
"docstring",
"(",
"f",
")",
"using",
"globs",
"as",
"globals",
".",
"Optional",
"argument",
"name",
"is",
"used",
"in",
"failure",
"messages",
".",
"If",
"the",
"optional",
"argument",
"verbose",
"is... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/ext/dtcompat.py#L1823-L1844 | [
"def",
"run_docstring_examples",
"(",
"f",
",",
"globs",
",",
"verbose",
"=",
"False",
",",
"name",
"=",
"\"NoName\"",
",",
"compileflags",
"=",
"None",
",",
"optionflags",
"=",
"0",
")",
":",
"# Find, parse, and run all tests in the given module.",
"finder",
"=",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | DocFileSuite | A unittest suite for one or more doctest files.
The path to each doctest file is given as a string; the
interpretation of that string depends on the keyword argument
"module_relative".
A number of options may be provided as keyword arguments:
module_relative
If "module_relative" is True, th... | environment/lib/python2.7/site-packages/nose/ext/dtcompat.py | def DocFileSuite(*paths, **kw):
"""A unittest suite for one or more doctest files.
The path to each doctest file is given as a string; the
interpretation of that string depends on the keyword argument
"module_relative".
A number of options may be provided as keyword arguments:
module_relative... | def DocFileSuite(*paths, **kw):
"""A unittest suite for one or more doctest files.
The path to each doctest file is given as a string; the
interpretation of that string depends on the keyword argument
"module_relative".
A number of options may be provided as keyword arguments:
module_relative... | [
"A",
"unittest",
"suite",
"for",
"one",
"or",
"more",
"doctest",
"files",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/ext/dtcompat.py#L2112-L2176 | [
"def",
"DocFileSuite",
"(",
"*",
"paths",
",",
"*",
"*",
"kw",
")",
":",
"suite",
"=",
"unittest",
".",
"TestSuite",
"(",
")",
"# We do this here so that _normalize_module is called at the right",
"# level. If it were called in DocFileTest, then this function",
"# would be t... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | debug_src | Debug a single doctest docstring, in argument `src` | environment/lib/python2.7/site-packages/nose/ext/dtcompat.py | def debug_src(src, pm=False, globs=None):
"""Debug a single doctest docstring, in argument `src`'"""
testsrc = script_from_examples(src)
debug_script(testsrc, pm, globs) | def debug_src(src, pm=False, globs=None):
"""Debug a single doctest docstring, in argument `src`'"""
testsrc = script_from_examples(src)
debug_script(testsrc, pm, globs) | [
"Debug",
"a",
"single",
"doctest",
"docstring",
"in",
"argument",
"src"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/ext/dtcompat.py#L2223-L2226 | [
"def",
"debug_src",
"(",
"src",
",",
"pm",
"=",
"False",
",",
"globs",
"=",
"None",
")",
":",
"testsrc",
"=",
"script_from_examples",
"(",
"src",
")",
"debug_script",
"(",
"testsrc",
",",
"pm",
",",
"globs",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | debug_script | Debug a test script. `src` is the script, as a string. | environment/lib/python2.7/site-packages/nose/ext/dtcompat.py | def debug_script(src, pm=False, globs=None):
"Debug a test script. `src` is the script, as a string."
import pdb
# Note that tempfile.NameTemporaryFile() cannot be used. As the
# docs say, a file so created cannot be opened by name a second time
# on modern Windows boxes, and execfile() needs to ... | def debug_script(src, pm=False, globs=None):
"Debug a test script. `src` is the script, as a string."
import pdb
# Note that tempfile.NameTemporaryFile() cannot be used. As the
# docs say, a file so created cannot be opened by name a second time
# on modern Windows boxes, and execfile() needs to ... | [
"Debug",
"a",
"test",
"script",
".",
"src",
"is",
"the",
"script",
"as",
"a",
"string",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/ext/dtcompat.py#L2228-L2258 | [
"def",
"debug_script",
"(",
"src",
",",
"pm",
"=",
"False",
",",
"globs",
"=",
"None",
")",
":",
"import",
"pdb",
"# Note that tempfile.NameTemporaryFile() cannot be used. As the",
"# docs say, a file so created cannot be opened by name a second time",
"# on modern Windows boxes... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | debug | Debug a single doctest docstring.
Provide the module (or dotted name of the module) containing the
test to be debugged and the name (within the module) of the object
with the docstring with tests to be debugged. | environment/lib/python2.7/site-packages/nose/ext/dtcompat.py | def debug(module, name, pm=False):
"""Debug a single doctest docstring.
Provide the module (or dotted name of the module) containing the
test to be debugged and the name (within the module) of the object
with the docstring with tests to be debugged.
"""
module = _normalize_module(module)
te... | def debug(module, name, pm=False):
"""Debug a single doctest docstring.
Provide the module (or dotted name of the module) containing the
test to be debugged and the name (within the module) of the object
with the docstring with tests to be debugged.
"""
module = _normalize_module(module)
te... | [
"Debug",
"a",
"single",
"doctest",
"docstring",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/ext/dtcompat.py#L2260-L2269 | [
"def",
"debug",
"(",
"module",
",",
"name",
",",
"pm",
"=",
"False",
")",
":",
"module",
"=",
"_normalize_module",
"(",
"module",
")",
"testsrc",
"=",
"testsource",
"(",
"module",
",",
"name",
")",
"debug_script",
"(",
"testsrc",
",",
"pm",
",",
"modul... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | OutputChecker.check_output | Return True iff the actual output from an example (`got`)
matches the expected output (`want`). These strings are
always considered to match if they are identical; but
depending on what option flags the test runner is using,
several non-exact match types are also possible. See the
... | environment/lib/python2.7/site-packages/nose/ext/dtcompat.py | def check_output(self, want, got, optionflags):
"""
Return True iff the actual output from an example (`got`)
matches the expected output (`want`). These strings are
always considered to match if they are identical; but
depending on what option flags the test runner is using,
... | def check_output(self, want, got, optionflags):
"""
Return True iff the actual output from an example (`got`)
matches the expected output (`want`). These strings are
always considered to match if they are identical; but
depending on what option flags the test runner is using,
... | [
"Return",
"True",
"iff",
"the",
"actual",
"output",
"from",
"an",
"example",
"(",
"got",
")",
"matches",
"the",
"expected",
"output",
"(",
"want",
")",
".",
"These",
"strings",
"are",
"always",
"considered",
"to",
"match",
"if",
"they",
"are",
"identical",... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/ext/dtcompat.py#L1403-L1454 | [
"def",
"check_output",
"(",
"self",
",",
"want",
",",
"got",
",",
"optionflags",
")",
":",
"# Handle the common case first, for efficiency:",
"# if they're string-identical, always return true.",
"if",
"got",
"==",
"want",
":",
"return",
"True",
"# The values True and False... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | OutputChecker.output_difference | Return a string describing the differences between the
expected output for a given example (`example`) and the actual
output (`got`). `optionflags` is the set of option flags used
to compare `want` and `got`. | environment/lib/python2.7/site-packages/nose/ext/dtcompat.py | def output_difference(self, example, got, optionflags):
"""
Return a string describing the differences between the
expected output for a given example (`example`) and the actual
output (`got`). `optionflags` is the set of option flags used
to compare `want` and `got`.
""... | def output_difference(self, example, got, optionflags):
"""
Return a string describing the differences between the
expected output for a given example (`example`) and the actual
output (`got`). `optionflags` is the set of option flags used
to compare `want` and `got`.
""... | [
"Return",
"a",
"string",
"describing",
"the",
"differences",
"between",
"the",
"expected",
"output",
"for",
"a",
"given",
"example",
"(",
"example",
")",
"and",
"the",
"actual",
"output",
"(",
"got",
")",
".",
"optionflags",
"is",
"the",
"set",
"of",
"opti... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/ext/dtcompat.py#L1480-L1526 | [
"def",
"output_difference",
"(",
"self",
",",
"example",
",",
"got",
",",
"optionflags",
")",
":",
"want",
"=",
"example",
".",
"want",
"# If <BLANKLINE>s are being used, then replace blank lines",
"# with <BLANKLINE> in the actual output string.",
"if",
"not",
"(",
"opti... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PickleShareDB.hset | hashed set | environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py | def hset(self, hashroot, key, value):
""" hashed set """
hroot = self.root / hashroot
if not hroot.isdir():
hroot.makedirs()
hfile = hroot / gethashfile(key)
d = self.get(hfile, {})
d.update( {key : value})
self[hfile] = d | def hset(self, hashroot, key, value):
""" hashed set """
hroot = self.root / hashroot
if not hroot.isdir():
hroot.makedirs()
hfile = hroot / gethashfile(key)
d = self.get(hfile, {})
d.update( {key : value})
self[hfile] = d | [
"hashed",
"set"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py#L92-L100 | [
"def",
"hset",
"(",
"self",
",",
"hashroot",
",",
"key",
",",
"value",
")",
":",
"hroot",
"=",
"self",
".",
"root",
"/",
"hashroot",
"if",
"not",
"hroot",
".",
"isdir",
"(",
")",
":",
"hroot",
".",
"makedirs",
"(",
")",
"hfile",
"=",
"hroot",
"/"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PickleShareDB.hdict | Get all data contained in hashed category 'hashroot' as dict | environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py | def hdict(self, hashroot):
""" Get all data contained in hashed category 'hashroot' as dict """
hfiles = self.keys(hashroot + "/*")
hfiles.sort()
last = len(hfiles) and hfiles[-1] or ''
if last.endswith('xx'):
# print "using xx"
hfiles = [last] + hfiles[:-... | def hdict(self, hashroot):
""" Get all data contained in hashed category 'hashroot' as dict """
hfiles = self.keys(hashroot + "/*")
hfiles.sort()
last = len(hfiles) and hfiles[-1] or ''
if last.endswith('xx'):
# print "using xx"
hfiles = [last] + hfiles[:-... | [
"Get",
"all",
"data",
"contained",
"in",
"hashed",
"category",
"hashroot",
"as",
"dict"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py#L123-L144 | [
"def",
"hdict",
"(",
"self",
",",
"hashroot",
")",
":",
"hfiles",
"=",
"self",
".",
"keys",
"(",
"hashroot",
"+",
"\"/*\"",
")",
"hfiles",
".",
"sort",
"(",
")",
"last",
"=",
"len",
"(",
"hfiles",
")",
"and",
"hfiles",
"[",
"-",
"1",
"]",
"or",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PickleShareDB.hcompress | Compress category 'hashroot', so hset is fast again
hget will fail if fast_only is True for compressed items (that were
hset before hcompress). | environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py | def hcompress(self, hashroot):
""" Compress category 'hashroot', so hset is fast again
hget will fail if fast_only is True for compressed items (that were
hset before hcompress).
"""
hfiles = self.keys(hashroot + "/*")
all = {}
for f in hfiles:
# pri... | def hcompress(self, hashroot):
""" Compress category 'hashroot', so hset is fast again
hget will fail if fast_only is True for compressed items (that were
hset before hcompress).
"""
hfiles = self.keys(hashroot + "/*")
all = {}
for f in hfiles:
# pri... | [
"Compress",
"category",
"hashroot",
"so",
"hset",
"is",
"fast",
"again"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py#L146-L165 | [
"def",
"hcompress",
"(",
"self",
",",
"hashroot",
")",
":",
"hfiles",
"=",
"self",
".",
"keys",
"(",
"hashroot",
"+",
"\"/*\"",
")",
"all",
"=",
"{",
"}",
"for",
"f",
"in",
"hfiles",
":",
"# print \"using\",f",
"all",
".",
"update",
"(",
"self",
"[",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PickleShareDB.keys | All keys in DB, or all keys matching a glob | environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py | def keys(self, globpat = None):
""" All keys in DB, or all keys matching a glob"""
if globpat is None:
files = self.root.walkfiles()
else:
files = [Path(p) for p in glob.glob(self.root/globpat)]
return [self._normalized(p) for p in files if p.isfile()] | def keys(self, globpat = None):
""" All keys in DB, or all keys matching a glob"""
if globpat is None:
files = self.root.walkfiles()
else:
files = [Path(p) for p in glob.glob(self.root/globpat)]
return [self._normalized(p) for p in files if p.isfile()] | [
"All",
"keys",
"in",
"DB",
"or",
"all",
"keys",
"matching",
"a",
"glob"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py#L184-L191 | [
"def",
"keys",
"(",
"self",
",",
"globpat",
"=",
"None",
")",
":",
"if",
"globpat",
"is",
"None",
":",
"files",
"=",
"self",
".",
"root",
".",
"walkfiles",
"(",
")",
"else",
":",
"files",
"=",
"[",
"Path",
"(",
"p",
")",
"for",
"p",
"in",
"glob... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | CompletionPlain.eventFilter | Reimplemented to handle keyboard input and to auto-hide when the
text edit loses focus. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_plain.py | def eventFilter(self, obj, event):
""" Reimplemented to handle keyboard input and to auto-hide when the
text edit loses focus.
"""
if obj == self._text_edit:
etype = event.type()
if etype in( QtCore.QEvent.KeyPress, QtCore.QEvent.FocusOut ):
s... | def eventFilter(self, obj, event):
""" Reimplemented to handle keyboard input and to auto-hide when the
text edit loses focus.
"""
if obj == self._text_edit:
etype = event.type()
if etype in( QtCore.QEvent.KeyPress, QtCore.QEvent.FocusOut ):
s... | [
"Reimplemented",
"to",
"handle",
"keyboard",
"input",
"and",
"to",
"auto",
"-",
"hide",
"when",
"the",
"text",
"edit",
"loses",
"focus",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_plain.py#L34-L44 | [
"def",
"eventFilter",
"(",
"self",
",",
"obj",
",",
"event",
")",
":",
"if",
"obj",
"==",
"self",
".",
"_text_edit",
":",
"etype",
"=",
"event",
".",
"type",
"(",
")",
"if",
"etype",
"in",
"(",
"QtCore",
".",
"QEvent",
".",
"KeyPress",
",",
"QtCore... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | CompletionPlain.show_items | Shows the completion widget with 'items' at the position specified
by 'cursor'. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_plain.py | def show_items(self, cursor, items):
""" Shows the completion widget with 'items' at the position specified
by 'cursor'.
"""
if not items :
return
self.cancel_completion()
strng = text.columnize(items)
self._console_widget._fill_temporary_buffer(cu... | def show_items(self, cursor, items):
""" Shows the completion widget with 'items' at the position specified
by 'cursor'.
"""
if not items :
return
self.cancel_completion()
strng = text.columnize(items)
self._console_widget._fill_temporary_buffer(cu... | [
"Shows",
"the",
"completion",
"widget",
"with",
"items",
"at",
"the",
"position",
"specified",
"by",
"cursor",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_plain.py#L54-L62 | [
"def",
"show_items",
"(",
"self",
",",
"cursor",
",",
"items",
")",
":",
"if",
"not",
"items",
":",
"return",
"self",
".",
"cancel_completion",
"(",
")",
"strng",
"=",
"text",
".",
"columnize",
"(",
"items",
")",
"self",
".",
"_console_widget",
".",
"_... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | FilterSet.allow | returns whether this record should be printed | environment/lib/python2.7/site-packages/nose/plugins/logcapture.py | def allow(self, record):
"""returns whether this record should be printed"""
if not self:
# nothing to filter
return True
return self._allow(record) and not self._deny(record) | def allow(self, record):
"""returns whether this record should be printed"""
if not self:
# nothing to filter
return True
return self._allow(record) and not self._deny(record) | [
"returns",
"whether",
"this",
"record",
"should",
"be",
"printed"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/logcapture.py#L47-L52 | [
"def",
"allow",
"(",
"self",
",",
"record",
")",
":",
"if",
"not",
"self",
":",
"# nothing to filter",
"return",
"True",
"return",
"self",
".",
"_allow",
"(",
"record",
")",
"and",
"not",
"self",
".",
"_deny",
"(",
"record",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | FilterSet._any_match | return the bool of whether `record` starts with
any item in `matchers` | environment/lib/python2.7/site-packages/nose/plugins/logcapture.py | def _any_match(matchers, record):
"""return the bool of whether `record` starts with
any item in `matchers`"""
def record_matches_key(key):
return record == key or record.startswith(key + '.')
return anyp(bool, map(record_matches_key, matchers)) | def _any_match(matchers, record):
"""return the bool of whether `record` starts with
any item in `matchers`"""
def record_matches_key(key):
return record == key or record.startswith(key + '.')
return anyp(bool, map(record_matches_key, matchers)) | [
"return",
"the",
"bool",
"of",
"whether",
"record",
"starts",
"with",
"any",
"item",
"in",
"matchers"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/logcapture.py#L55-L60 | [
"def",
"_any_match",
"(",
"matchers",
",",
"record",
")",
":",
"def",
"record_matches_key",
"(",
"key",
")",
":",
"return",
"record",
"==",
"key",
"or",
"record",
".",
"startswith",
"(",
"key",
"+",
"'.'",
")",
"return",
"anyp",
"(",
"bool",
",",
"map"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | LogCapture.options | Register commandline options. | environment/lib/python2.7/site-packages/nose/plugins/logcapture.py | def options(self, parser, env):
"""Register commandline options.
"""
parser.add_option(
"--nologcapture", action="store_false",
default=not env.get(self.env_opt), dest="logcapture",
help="Disable logging capture plugin. "
"Logging configurtion... | def options(self, parser, env):
"""Register commandline options.
"""
parser.add_option(
"--nologcapture", action="store_false",
default=not env.get(self.env_opt), dest="logcapture",
help="Disable logging capture plugin. "
"Logging configurtion... | [
"Register",
"commandline",
"options",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/logcapture.py#L111-L155 | [
"def",
"options",
"(",
"self",
",",
"parser",
",",
"env",
")",
":",
"parser",
".",
"add_option",
"(",
"\"--nologcapture\"",
",",
"action",
"=",
"\"store_false\"",
",",
"default",
"=",
"not",
"env",
".",
"get",
"(",
"self",
".",
"env_opt",
")",
",",
"de... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | LogCapture.configure | Configure plugin. | environment/lib/python2.7/site-packages/nose/plugins/logcapture.py | def configure(self, options, conf):
"""Configure plugin.
"""
self.conf = conf
# Disable if explicitly disabled, or if logging is
# configured via logging config file
if not options.logcapture or conf.loggingConfig:
self.enabled = False
self.logformat =... | def configure(self, options, conf):
"""Configure plugin.
"""
self.conf = conf
# Disable if explicitly disabled, or if logging is
# configured via logging config file
if not options.logcapture or conf.loggingConfig:
self.enabled = False
self.logformat =... | [
"Configure",
"plugin",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/logcapture.py#L157-L170 | [
"def",
"configure",
"(",
"self",
",",
"options",
",",
"conf",
")",
":",
"self",
".",
"conf",
"=",
"conf",
"# Disable if explicitly disabled, or if logging is",
"# configured via logging config file",
"if",
"not",
"options",
".",
"logcapture",
"or",
"conf",
".",
"log... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | LogCapture.formatError | Add captured log messages to error output. | environment/lib/python2.7/site-packages/nose/plugins/logcapture.py | def formatError(self, test, err):
"""Add captured log messages to error output.
"""
# logic flow copied from Capture.formatError
test.capturedLogging = records = self.formatLogRecords()
if not records:
return err
ec, ev, tb = err
return (ec, self.addCa... | def formatError(self, test, err):
"""Add captured log messages to error output.
"""
# logic flow copied from Capture.formatError
test.capturedLogging = records = self.formatLogRecords()
if not records:
return err
ec, ev, tb = err
return (ec, self.addCa... | [
"Add",
"captured",
"log",
"messages",
"to",
"error",
"output",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/logcapture.py#L225-L233 | [
"def",
"formatError",
"(",
"self",
",",
"test",
",",
"err",
")",
":",
"# logic flow copied from Capture.formatError",
"test",
".",
"capturedLogging",
"=",
"records",
"=",
"self",
".",
"formatLogRecords",
"(",
")",
"if",
"not",
"records",
":",
"return",
"err",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | embed | Call this to embed IPython at the current point in your program.
The first invocation of this will create an :class:`InteractiveShellEmbed`
instance and then call it. Consecutive calls just call the already
created instance.
Here is a simple example::
from IPython import embed
a = 10... | environment/lib/python2.7/site-packages/IPython/frontend/terminal/embed.py | def embed(**kwargs):
"""Call this to embed IPython at the current point in your program.
The first invocation of this will create an :class:`InteractiveShellEmbed`
instance and then call it. Consecutive calls just call the already
created instance.
Here is a simple example::
from IPython... | def embed(**kwargs):
"""Call this to embed IPython at the current point in your program.
The first invocation of this will create an :class:`InteractiveShellEmbed`
instance and then call it. Consecutive calls just call the already
created instance.
Here is a simple example::
from IPython... | [
"Call",
"this",
"to",
"embed",
"IPython",
"at",
"the",
"current",
"point",
"in",
"your",
"program",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/embed.py#L254-L283 | [
"def",
"embed",
"(",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"kwargs",
".",
"get",
"(",
"'config'",
")",
"header",
"=",
"kwargs",
".",
"pop",
"(",
"'header'",
",",
"u''",
")",
"if",
"config",
"is",
"None",
":",
"config",
"=",
"load_default_confi... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | InteractiveShellEmbed.mainloop | Embeds IPython into a running python program.
Input:
- header: An optional header message can be specified.
- local_ns, module: working local namespace (a dict) and module (a
module or similar object). If given as None, they are automatically
taken from the scope where... | environment/lib/python2.7/site-packages/IPython/frontend/terminal/embed.py | def mainloop(self, local_ns=None, module=None, stack_depth=0,
display_banner=None, global_ns=None):
"""Embeds IPython into a running python program.
Input:
- header: An optional header message can be specified.
- local_ns, module: working local namespace (a dict) ... | def mainloop(self, local_ns=None, module=None, stack_depth=0,
display_banner=None, global_ns=None):
"""Embeds IPython into a running python program.
Input:
- header: An optional header message can be specified.
- local_ns, module: working local namespace (a dict) ... | [
"Embeds",
"IPython",
"into",
"a",
"running",
"python",
"program",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/terminal/embed.py#L164-L249 | [
"def",
"mainloop",
"(",
"self",
",",
"local_ns",
"=",
"None",
",",
"module",
"=",
"None",
",",
"stack_depth",
"=",
"0",
",",
"display_banner",
"=",
"None",
",",
"global_ns",
"=",
"None",
")",
":",
"if",
"(",
"global_ns",
"is",
"not",
"None",
")",
"an... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | dir2 | dir2(obj) -> list of strings
Extended version of the Python builtin dir(), which does a few extra
checks, and supports common objects with unusual internals that confuse
dir(), such as Traits and PyCrust.
This version is guaranteed to return only a list of true strings, whereas
dir() returns anyth... | environment/lib/python2.7/site-packages/IPython/utils/dir2.py | def dir2(obj):
"""dir2(obj) -> list of strings
Extended version of the Python builtin dir(), which does a few extra
checks, and supports common objects with unusual internals that confuse
dir(), such as Traits and PyCrust.
This version is guaranteed to return only a list of true strings, whereas
... | def dir2(obj):
"""dir2(obj) -> list of strings
Extended version of the Python builtin dir(), which does a few extra
checks, and supports common objects with unusual internals that confuse
dir(), such as Traits and PyCrust.
This version is guaranteed to return only a list of true strings, whereas
... | [
"dir2",
"(",
"obj",
")",
"-",
">",
"list",
"of",
"strings"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/dir2.py#L34-L73 | [
"def",
"dir2",
"(",
"obj",
")",
":",
"# Start building the attribute list via dir(), and then complete it",
"# with a few extra special-purpose calls.",
"words",
"=",
"set",
"(",
"dir",
"(",
"obj",
")",
")",
"if",
"hasattr",
"(",
"obj",
",",
"'__class__'",
")",
":",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | _get_all_po_filenames | Get all po filenames from locale folder and return list of them.
Assumes a directory structure:
<locale_root>/<lang>/<po_files_path>/<filename>. | c3po/converters/po_csv.py | def _get_all_po_filenames(locale_root, lang, po_files_path):
"""
Get all po filenames from locale folder and return list of them.
Assumes a directory structure:
<locale_root>/<lang>/<po_files_path>/<filename>.
"""
all_files = os.listdir(os.path.join(locale_root, lang, po_files_path))
return ... | def _get_all_po_filenames(locale_root, lang, po_files_path):
"""
Get all po filenames from locale folder and return list of them.
Assumes a directory structure:
<locale_root>/<lang>/<po_files_path>/<filename>.
"""
all_files = os.listdir(os.path.join(locale_root, lang, po_files_path))
return ... | [
"Get",
"all",
"po",
"filenames",
"from",
"locale",
"folder",
"and",
"return",
"list",
"of",
"them",
".",
"Assumes",
"a",
"directory",
"structure",
":",
"<locale_root",
">",
"/",
"<lang",
">",
"/",
"<po_files_path",
">",
"/",
"<filename",
">",
"."
] | VorskiImagineering/C3PO | python | https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_csv.py#L22-L29 | [
"def",
"_get_all_po_filenames",
"(",
"locale_root",
",",
"lang",
",",
"po_files_path",
")",
":",
"all_files",
"=",
"os",
".",
"listdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"locale_root",
",",
"lang",
",",
"po_files_path",
")",
")",
"return",
"filter... | e3e35835e5ac24158848afed4f905ca44ac3ae00 |
test | _get_new_csv_writers | Prepare new csv writers, write title rows and return them. | c3po/converters/po_csv.py | def _get_new_csv_writers(trans_title, meta_title,
trans_csv_path, meta_csv_path):
"""
Prepare new csv writers, write title rows and return them.
"""
trans_writer = UnicodeWriter(trans_csv_path)
trans_writer.writerow(trans_title)
meta_writer = UnicodeWriter(meta_csv_path... | def _get_new_csv_writers(trans_title, meta_title,
trans_csv_path, meta_csv_path):
"""
Prepare new csv writers, write title rows and return them.
"""
trans_writer = UnicodeWriter(trans_csv_path)
trans_writer.writerow(trans_title)
meta_writer = UnicodeWriter(meta_csv_path... | [
"Prepare",
"new",
"csv",
"writers",
"write",
"title",
"rows",
"and",
"return",
"them",
"."
] | VorskiImagineering/C3PO | python | https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_csv.py#L32-L43 | [
"def",
"_get_new_csv_writers",
"(",
"trans_title",
",",
"meta_title",
",",
"trans_csv_path",
",",
"meta_csv_path",
")",
":",
"trans_writer",
"=",
"UnicodeWriter",
"(",
"trans_csv_path",
")",
"trans_writer",
".",
"writerow",
"(",
"trans_title",
")",
"meta_writer",
"=... | e3e35835e5ac24158848afed4f905ca44ac3ae00 |
test | _prepare_locale_dirs | Prepare locale dirs for writing po files.
Create new directories if they doesn't exist. | c3po/converters/po_csv.py | def _prepare_locale_dirs(languages, locale_root):
"""
Prepare locale dirs for writing po files.
Create new directories if they doesn't exist.
"""
trans_languages = []
for i, t in enumerate(languages):
lang = t.split(':')[0]
trans_languages.append(lang)
lang_path = os.path... | def _prepare_locale_dirs(languages, locale_root):
"""
Prepare locale dirs for writing po files.
Create new directories if they doesn't exist.
"""
trans_languages = []
for i, t in enumerate(languages):
lang = t.split(':')[0]
trans_languages.append(lang)
lang_path = os.path... | [
"Prepare",
"locale",
"dirs",
"for",
"writing",
"po",
"files",
".",
"Create",
"new",
"directories",
"if",
"they",
"doesn",
"t",
"exist",
"."
] | VorskiImagineering/C3PO | python | https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_csv.py#L46-L58 | [
"def",
"_prepare_locale_dirs",
"(",
"languages",
",",
"locale_root",
")",
":",
"trans_languages",
"=",
"[",
"]",
"for",
"i",
",",
"t",
"in",
"enumerate",
"(",
"languages",
")",
":",
"lang",
"=",
"t",
".",
"split",
"(",
"':'",
")",
"[",
"0",
"]",
"tra... | e3e35835e5ac24158848afed4f905ca44ac3ae00 |
test | _prepare_polib_files | Prepare polib file object for writing/reading from them.
Create directories and write header if needed. For each language,
ensure there's a translation file named "filename" in the correct place.
Assumes (and creates) a directory structure:
<locale_root>/<lang>/<po_files_path>/<filename>. | c3po/converters/po_csv.py | def _prepare_polib_files(files_dict, filename, languages,
locale_root, po_files_path, header):
"""
Prepare polib file object for writing/reading from them.
Create directories and write header if needed. For each language,
ensure there's a translation file named "filename" in the... | def _prepare_polib_files(files_dict, filename, languages,
locale_root, po_files_path, header):
"""
Prepare polib file object for writing/reading from them.
Create directories and write header if needed. For each language,
ensure there's a translation file named "filename" in the... | [
"Prepare",
"polib",
"file",
"object",
"for",
"writing",
"/",
"reading",
"from",
"them",
".",
"Create",
"directories",
"and",
"write",
"header",
"if",
"needed",
".",
"For",
"each",
"language",
"ensure",
"there",
"s",
"a",
"translation",
"file",
"named",
"file... | VorskiImagineering/C3PO | python | https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_csv.py#L61-L80 | [
"def",
"_prepare_polib_files",
"(",
"files_dict",
",",
"filename",
",",
"languages",
",",
"locale_root",
",",
"po_files_path",
",",
"header",
")",
":",
"files_dict",
"[",
"filename",
"]",
"=",
"{",
"}",
"for",
"lang",
"in",
"languages",
":",
"file_path",
"="... | e3e35835e5ac24158848afed4f905ca44ac3ae00 |
test | _write_entries | Write msgstr for every language with all needed metadata and comment.
Metadata are parser from string into dict, so read them only from gdocs. | c3po/converters/po_csv.py | def _write_entries(po_files, languages, msgid, msgstrs, metadata, comment):
"""
Write msgstr for every language with all needed metadata and comment.
Metadata are parser from string into dict, so read them only from gdocs.
"""
start = re.compile(r'^[\s]+')
end = re.compile(r'[\s]+$')
for i, ... | def _write_entries(po_files, languages, msgid, msgstrs, metadata, comment):
"""
Write msgstr for every language with all needed metadata and comment.
Metadata are parser from string into dict, so read them only from gdocs.
"""
start = re.compile(r'^[\s]+')
end = re.compile(r'[\s]+$')
for i, ... | [
"Write",
"msgstr",
"for",
"every",
"language",
"with",
"all",
"needed",
"metadata",
"and",
"comment",
".",
"Metadata",
"are",
"parser",
"from",
"string",
"into",
"dict",
"so",
"read",
"them",
"only",
"from",
"gdocs",
"."
] | VorskiImagineering/C3PO | python | https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_csv.py#L83-L103 | [
"def",
"_write_entries",
"(",
"po_files",
",",
"languages",
",",
"msgid",
",",
"msgstrs",
",",
"metadata",
",",
"comment",
")",
":",
"start",
"=",
"re",
".",
"compile",
"(",
"r'^[\\s]+'",
")",
"end",
"=",
"re",
".",
"compile",
"(",
"r'[\\s]+$'",
")",
"... | e3e35835e5ac24158848afed4f905ca44ac3ae00 |
test | _write_header | Write header into po file for specific lang.
Metadata are read from settings file. | c3po/converters/po_csv.py | def _write_header(po_path, lang, header):
"""
Write header into po file for specific lang.
Metadata are read from settings file.
"""
po_file = open(po_path, 'w')
po_file.write(header + '\n')
po_file.write(
'msgid ""' +
'\nmsgstr ""' +
'\n"MIME-Version: ' + settings.ME... | def _write_header(po_path, lang, header):
"""
Write header into po file for specific lang.
Metadata are read from settings file.
"""
po_file = open(po_path, 'w')
po_file.write(header + '\n')
po_file.write(
'msgid ""' +
'\nmsgstr ""' +
'\n"MIME-Version: ' + settings.ME... | [
"Write",
"header",
"into",
"po",
"file",
"for",
"specific",
"lang",
".",
"Metadata",
"are",
"read",
"from",
"settings",
"file",
"."
] | VorskiImagineering/C3PO | python | https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_csv.py#L106-L121 | [
"def",
"_write_header",
"(",
"po_path",
",",
"lang",
",",
"header",
")",
":",
"po_file",
"=",
"open",
"(",
"po_path",
",",
"'w'",
")",
"po_file",
".",
"write",
"(",
"header",
"+",
"'\\n'",
")",
"po_file",
".",
"write",
"(",
"'msgid \"\"'",
"+",
"'\\nms... | e3e35835e5ac24158848afed4f905ca44ac3ae00 |
test | _write_new_messages | Write new msgids which appeared in po files with empty msgstrs values
and metadata. Look for all new msgids which are diffed with msgids list
provided as an argument. | c3po/converters/po_csv.py | def _write_new_messages(po_file_path, trans_writer, meta_writer,
msgids, msgstrs, languages):
"""
Write new msgids which appeared in po files with empty msgstrs values
and metadata. Look for all new msgids which are diffed with msgids list
provided as an argument.
"""
po_... | def _write_new_messages(po_file_path, trans_writer, meta_writer,
msgids, msgstrs, languages):
"""
Write new msgids which appeared in po files with empty msgstrs values
and metadata. Look for all new msgids which are diffed with msgids list
provided as an argument.
"""
po_... | [
"Write",
"new",
"msgids",
"which",
"appeared",
"in",
"po",
"files",
"with",
"empty",
"msgstrs",
"values",
"and",
"metadata",
".",
"Look",
"for",
"all",
"new",
"msgids",
"which",
"are",
"diffed",
"with",
"msgids",
"list",
"provided",
"as",
"an",
"argument",
... | VorskiImagineering/C3PO | python | https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_csv.py#L124-L150 | [
"def",
"_write_new_messages",
"(",
"po_file_path",
",",
"trans_writer",
",",
"meta_writer",
",",
"msgids",
",",
"msgstrs",
",",
"languages",
")",
":",
"po_filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"po_file_path",
")",
"po_file",
"=",
"polib",
... | e3e35835e5ac24158848afed4f905ca44ac3ae00 |
test | _get_new_msgstrs | Write new msgids which appeared in po files with empty msgstrs values
and metadata. Look for all new msgids which are diffed with msgids list
provided as an argument. | c3po/converters/po_csv.py | def _get_new_msgstrs(po_file_path, msgids):
"""
Write new msgids which appeared in po files with empty msgstrs values
and metadata. Look for all new msgids which are diffed with msgids list
provided as an argument.
"""
po_file = polib.pofile(po_file_path)
msgstrs = {}
for entry in po_f... | def _get_new_msgstrs(po_file_path, msgids):
"""
Write new msgids which appeared in po files with empty msgstrs values
and metadata. Look for all new msgids which are diffed with msgids list
provided as an argument.
"""
po_file = polib.pofile(po_file_path)
msgstrs = {}
for entry in po_f... | [
"Write",
"new",
"msgids",
"which",
"appeared",
"in",
"po",
"files",
"with",
"empty",
"msgstrs",
"values",
"and",
"metadata",
".",
"Look",
"for",
"all",
"new",
"msgids",
"which",
"are",
"diffed",
"with",
"msgids",
"list",
"provided",
"as",
"an",
"argument",
... | VorskiImagineering/C3PO | python | https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_csv.py#L153-L167 | [
"def",
"_get_new_msgstrs",
"(",
"po_file_path",
",",
"msgids",
")",
":",
"po_file",
"=",
"polib",
".",
"pofile",
"(",
"po_file_path",
")",
"msgstrs",
"=",
"{",
"}",
"for",
"entry",
"in",
"po_file",
":",
"if",
"entry",
".",
"msgid",
"not",
"in",
"msgids",... | e3e35835e5ac24158848afed4f905ca44ac3ae00 |
test | po_to_csv_merge | Converts po file to csv GDocs spreadsheet readable format.
Merges them if some msgid aren't in the spreadsheet.
:param languages: list of language codes
:param locale_root: path to locale root folder containing directories
with languages
:param po_files_path: path from lang direc... | c3po/converters/po_csv.py | def po_to_csv_merge(languages, locale_root, po_files_path,
local_trans_csv, local_meta_csv,
gdocs_trans_csv, gdocs_meta_csv):
"""
Converts po file to csv GDocs spreadsheet readable format.
Merges them if some msgid aren't in the spreadsheet.
:param languages: list... | def po_to_csv_merge(languages, locale_root, po_files_path,
local_trans_csv, local_meta_csv,
gdocs_trans_csv, gdocs_meta_csv):
"""
Converts po file to csv GDocs spreadsheet readable format.
Merges them if some msgid aren't in the spreadsheet.
:param languages: list... | [
"Converts",
"po",
"file",
"to",
"csv",
"GDocs",
"spreadsheet",
"readable",
"format",
".",
"Merges",
"them",
"if",
"some",
"msgid",
"aren",
"t",
"in",
"the",
"spreadsheet",
".",
":",
"param",
"languages",
":",
"list",
"of",
"language",
"codes",
":",
"param"... | VorskiImagineering/C3PO | python | https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_csv.py#L170-L231 | [
"def",
"po_to_csv_merge",
"(",
"languages",
",",
"locale_root",
",",
"po_files_path",
",",
"local_trans_csv",
",",
"local_meta_csv",
",",
"gdocs_trans_csv",
",",
"gdocs_meta_csv",
")",
":",
"msgids",
"=",
"[",
"]",
"trans_reader",
"=",
"UnicodeReader",
"(",
"gdocs... | e3e35835e5ac24158848afed4f905ca44ac3ae00 |
test | csv_to_po | Converts GDocs spreadsheet generated csv file into po file.
:param trans_csv_path: path to temporary file with translations
:param meta_csv_path: path to temporary file with meta information
:param locale_root: path to locale root folder containing directories
with languages
:par... | c3po/converters/po_csv.py | def csv_to_po(trans_csv_path, meta_csv_path, locale_root,
po_files_path, header=None):
"""
Converts GDocs spreadsheet generated csv file into po file.
:param trans_csv_path: path to temporary file with translations
:param meta_csv_path: path to temporary file with meta information
:par... | def csv_to_po(trans_csv_path, meta_csv_path, locale_root,
po_files_path, header=None):
"""
Converts GDocs spreadsheet generated csv file into po file.
:param trans_csv_path: path to temporary file with translations
:param meta_csv_path: path to temporary file with meta information
:par... | [
"Converts",
"GDocs",
"spreadsheet",
"generated",
"csv",
"file",
"into",
"po",
"file",
".",
":",
"param",
"trans_csv_path",
":",
"path",
"to",
"temporary",
"file",
"with",
"translations",
":",
"param",
"meta_csv_path",
":",
"path",
"to",
"temporary",
"file",
"w... | VorskiImagineering/C3PO | python | https://github.com/VorskiImagineering/C3PO/blob/e3e35835e5ac24158848afed4f905ca44ac3ae00/c3po/converters/po_csv.py#L234-L281 | [
"def",
"csv_to_po",
"(",
"trans_csv_path",
",",
"meta_csv_path",
",",
"locale_root",
",",
"po_files_path",
",",
"header",
"=",
"None",
")",
":",
"pattern",
"=",
"\"^\\w+.*po$\"",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"loca... | e3e35835e5ac24158848afed4f905ca44ac3ae00 |
test | Notifo.subscribe_user | method to subscribe a user to a service | notifo/notifo.py | def subscribe_user(self, user):
""" method to subscribe a user to a service
"""
url = self.root_url + "subscribe_user"
values = {}
values["username"] = user
return self._query(url, values) | def subscribe_user(self, user):
""" method to subscribe a user to a service
"""
url = self.root_url + "subscribe_user"
values = {}
values["username"] = user
return self._query(url, values) | [
"method",
"to",
"subscribe",
"a",
"user",
"to",
"a",
"service"
] | mrtazz/notifo.py | python | https://github.com/mrtazz/notifo.py/blob/26079db3b40c26661155af20a9f16a0eca06dbde/notifo/notifo.py#L25-L31 | [
"def",
"subscribe_user",
"(",
"self",
",",
"user",
")",
":",
"url",
"=",
"self",
".",
"root_url",
"+",
"\"subscribe_user\"",
"values",
"=",
"{",
"}",
"values",
"[",
"\"username\"",
"]",
"=",
"user",
"return",
"self",
".",
"_query",
"(",
"url",
",",
"va... | 26079db3b40c26661155af20a9f16a0eca06dbde |
test | Notifo.send_notification | method to send a message to a user
Parameters:
to -> recipient
msg -> message to send
label -> application description
title -> name of the notification event
uri -> callback uri | notifo/notifo.py | def send_notification(self, to=None, msg=None, label=None,
title=None, uri=None):
""" method to send a message to a user
Parameters:
to -> recipient
msg -> message to send
label -> application description
titl... | def send_notification(self, to=None, msg=None, label=None,
title=None, uri=None):
""" method to send a message to a user
Parameters:
to -> recipient
msg -> message to send
label -> application description
titl... | [
"method",
"to",
"send",
"a",
"message",
"to",
"a",
"user"
] | mrtazz/notifo.py | python | https://github.com/mrtazz/notifo.py/blob/26079db3b40c26661155af20a9f16a0eca06dbde/notifo/notifo.py#L33-L56 | [
"def",
"send_notification",
"(",
"self",
",",
"to",
"=",
"None",
",",
"msg",
"=",
"None",
",",
"label",
"=",
"None",
",",
"title",
"=",
"None",
",",
"uri",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"root_url",
"+",
"\"send_notification\"",
"val... | 26079db3b40c26661155af20a9f16a0eca06dbde |
test | Notifo.send_message | method to send a message to a user
Parameters:
to -> recipient
msg -> message to send | notifo/notifo.py | def send_message(self, to=None, msg=None):
""" method to send a message to a user
Parameters:
to -> recipient
msg -> message to send
"""
url = self.root_url + "send_message"
values = {}
if to is not None:
values["to"] = to
... | def send_message(self, to=None, msg=None):
""" method to send a message to a user
Parameters:
to -> recipient
msg -> message to send
"""
url = self.root_url + "send_message"
values = {}
if to is not None:
values["to"] = to
... | [
"method",
"to",
"send",
"a",
"message",
"to",
"a",
"user"
] | mrtazz/notifo.py | python | https://github.com/mrtazz/notifo.py/blob/26079db3b40c26661155af20a9f16a0eca06dbde/notifo/notifo.py#L58-L71 | [
"def",
"send_message",
"(",
"self",
",",
"to",
"=",
"None",
",",
"msg",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"root_url",
"+",
"\"send_message\"",
"values",
"=",
"{",
"}",
"if",
"to",
"is",
"not",
"None",
":",
"values",
"[",
"\"to\"",
"]"... | 26079db3b40c26661155af20a9f16a0eca06dbde |
test | Notifo._query | query method to do HTTP POST/GET
Parameters:
url -> the url to POST/GET
data -> header_data as a dict (only for POST)
Returns:
Parsed JSON data as dict
or
None on error | notifo/notifo.py | def _query(self, url, data = None):
""" query method to do HTTP POST/GET
Parameters:
url -> the url to POST/GET
data -> header_data as a dict (only for POST)
Returns:
Parsed JSON data as dict
or
None on err... | def _query(self, url, data = None):
""" query method to do HTTP POST/GET
Parameters:
url -> the url to POST/GET
data -> header_data as a dict (only for POST)
Returns:
Parsed JSON data as dict
or
None on err... | [
"query",
"method",
"to",
"do",
"HTTP",
"POST",
"/",
"GET"
] | mrtazz/notifo.py | python | https://github.com/mrtazz/notifo.py/blob/26079db3b40c26661155af20a9f16a0eca06dbde/notifo/notifo.py#L74-L102 | [
"def",
"_query",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
")",
":",
"auth",
"=",
"encodestring",
"(",
"'%s:%s'",
"%",
"(",
"self",
".",
"user",
",",
"self",
".",
"secret",
")",
")",
".",
"replace",
"(",
"'\\n'",
",",
"''",
")",
"if",
... | 26079db3b40c26661155af20a9f16a0eca06dbde |
test | init_parser | function to init option parser | bin/notifo_cli.py | def init_parser():
""" function to init option parser """
usage = "usage: %prog -u user -s secret -n name [-l label] \
[-t title] [-c callback] [TEXT]"
parser = OptionParser(usage, version="%prog " + notifo.__version__)
parser.add_option("-u", "--user", action="store", dest="user",
... | def init_parser():
""" function to init option parser """
usage = "usage: %prog -u user -s secret -n name [-l label] \
[-t title] [-c callback] [TEXT]"
parser = OptionParser(usage, version="%prog " + notifo.__version__)
parser.add_option("-u", "--user", action="store", dest="user",
... | [
"function",
"to",
"init",
"option",
"parser"
] | mrtazz/notifo.py | python | https://github.com/mrtazz/notifo.py/blob/26079db3b40c26661155af20a9f16a0eca06dbde/bin/notifo_cli.py#L10-L32 | [
"def",
"init_parser",
"(",
")",
":",
"usage",
"=",
"\"usage: %prog -u user -s secret -n name [-l label] \\\n[-t title] [-c callback] [TEXT]\"",
"parser",
"=",
"OptionParser",
"(",
"usage",
",",
"version",
"=",
"\"%prog \"",
"+",
"notifo",
".",
"__version__",
")",
"parser"... | 26079db3b40c26661155af20a9f16a0eca06dbde |
test | main | main function | bin/notifo_cli.py | def main():
""" main function """
# get options and arguments
(parser, options, args) = init_parser()
# initialize result variable
result = None
# check for values which are always needed
if not options.user:
parser.error("No user given.")
if not options.secret:
parser.... | def main():
""" main function """
# get options and arguments
(parser, options, args) = init_parser()
# initialize result variable
result = None
# check for values which are always needed
if not options.user:
parser.error("No user given.")
if not options.secret:
parser.... | [
"main",
"function"
] | mrtazz/notifo.py | python | https://github.com/mrtazz/notifo.py/blob/26079db3b40c26661155af20a9f16a0eca06dbde/bin/notifo_cli.py#L34-L74 | [
"def",
"main",
"(",
")",
":",
"# get options and arguments",
"(",
"parser",
",",
"options",
",",
"args",
")",
"=",
"init_parser",
"(",
")",
"# initialize result variable",
"result",
"=",
"None",
"# check for values which are always needed",
"if",
"not",
"options",
"... | 26079db3b40c26661155af20a9f16a0eca06dbde |
test | rsplit1 | The same as s.rsplit(sep, 1), but works in 2.3 | virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py | def rsplit1(s, sep):
"""The same as s.rsplit(sep, 1), but works in 2.3"""
parts = s.split(sep)
return sep.join(parts[:-1]), parts[-1] | def rsplit1(s, sep):
"""The same as s.rsplit(sep, 1), but works in 2.3"""
parts = s.split(sep)
return sep.join(parts[:-1]), parts[-1] | [
"The",
"same",
"as",
"s",
".",
"rsplit",
"(",
"sep",
"1",
")",
"but",
"works",
"in",
"2",
".",
"3"
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py#L17-L20 | [
"def",
"rsplit1",
"(",
"s",
",",
"sep",
")",
":",
"parts",
"=",
"s",
".",
"split",
"(",
"sep",
")",
"return",
"sep",
".",
"join",
"(",
"parts",
"[",
":",
"-",
"1",
"]",
")",
",",
"parts",
"[",
"-",
"1",
"]"
] | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | run_python_module | Run a python module, as though with ``python -m name args...``.
`modulename` is the name of the module, possibly a dot-separated name.
`args` is the argument array to present as sys.argv, including the first
element naming the module being executed. | virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py | def run_python_module(modulename, args):
"""Run a python module, as though with ``python -m name args...``.
`modulename` is the name of the module, possibly a dot-separated name.
`args` is the argument array to present as sys.argv, including the first
element naming the module being executed.
"""
... | def run_python_module(modulename, args):
"""Run a python module, as though with ``python -m name args...``.
`modulename` is the name of the module, possibly a dot-separated name.
`args` is the argument array to present as sys.argv, including the first
element naming the module being executed.
"""
... | [
"Run",
"a",
"python",
"module",
"as",
"though",
"with",
"python",
"-",
"m",
"name",
"args",
"...",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py#L23-L70 | [
"def",
"run_python_module",
"(",
"modulename",
",",
"args",
")",
":",
"openfile",
"=",
"None",
"glo",
",",
"loc",
"=",
"globals",
"(",
")",
",",
"locals",
"(",
")",
"try",
":",
"try",
":",
"# Search for the module - inside its parent package, if any - using",
"#... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | run_python_file | Run a python file as if it were the main program on the command line.
`filename` is the path to the file to execute, it need not be a .py file.
`args` is the argument array to present as sys.argv, including the first
element naming the file being executed. `package` is the name of the
enclosing packag... | virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py | def run_python_file(filename, args, package=None):
"""Run a python file as if it were the main program on the command line.
`filename` is the path to the file to execute, it need not be a .py file.
`args` is the argument array to present as sys.argv, including the first
element naming the file being ex... | def run_python_file(filename, args, package=None):
"""Run a python file as if it were the main program on the command line.
`filename` is the path to the file to execute, it need not be a .py file.
`args` is the argument array to present as sys.argv, including the first
element naming the file being ex... | [
"Run",
"a",
"python",
"file",
"as",
"if",
"it",
"were",
"the",
"main",
"program",
"on",
"the",
"command",
"line",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py#L73-L122 | [
"def",
"run_python_file",
"(",
"filename",
",",
"args",
",",
"package",
"=",
"None",
")",
":",
"# Create a module to serve as __main__",
"old_main_mod",
"=",
"sys",
".",
"modules",
"[",
"'__main__'",
"]",
"main_mod",
"=",
"imp",
".",
"new_module",
"(",
"'__main_... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | make_code_from_py | Get source from `filename` and make a code object of it. | virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py | def make_code_from_py(filename):
"""Get source from `filename` and make a code object of it."""
# Open the source file.
try:
source_file = open_source(filename)
except IOError:
raise NoSource("No file to run: %r" % filename)
try:
source = source_file.read()
finally:
... | def make_code_from_py(filename):
"""Get source from `filename` and make a code object of it."""
# Open the source file.
try:
source_file = open_source(filename)
except IOError:
raise NoSource("No file to run: %r" % filename)
try:
source = source_file.read()
finally:
... | [
"Get",
"source",
"from",
"filename",
"and",
"make",
"a",
"code",
"object",
"of",
"it",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py#L124-L143 | [
"def",
"make_code_from_py",
"(",
"filename",
")",
":",
"# Open the source file.",
"try",
":",
"source_file",
"=",
"open_source",
"(",
"filename",
")",
"except",
"IOError",
":",
"raise",
"NoSource",
"(",
"\"No file to run: %r\"",
"%",
"filename",
")",
"try",
":",
... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | make_code_from_pyc | Get a code object from a .pyc file. | virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py | def make_code_from_pyc(filename):
"""Get a code object from a .pyc file."""
try:
fpyc = open(filename, "rb")
except IOError:
raise NoCode("No file to run: %r" % filename)
try:
# First four bytes are a version-specific magic number. It has to
# match or we won't run the ... | def make_code_from_pyc(filename):
"""Get a code object from a .pyc file."""
try:
fpyc = open(filename, "rb")
except IOError:
raise NoCode("No file to run: %r" % filename)
try:
# First four bytes are a version-specific magic number. It has to
# match or we won't run the ... | [
"Get",
"a",
"code",
"object",
"from",
"a",
".",
"pyc",
"file",
"."
] | tnkteja/myhelp | python | https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/execfile.py#L146-L171 | [
"def",
"make_code_from_pyc",
"(",
"filename",
")",
":",
"try",
":",
"fpyc",
"=",
"open",
"(",
"filename",
",",
"\"rb\"",
")",
"except",
"IOError",
":",
"raise",
"NoCode",
"(",
"\"No file to run: %r\"",
"%",
"filename",
")",
"try",
":",
"# First four bytes are ... | fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb |
test | html_tableify | returnr a string for an html table | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py | def html_tableify(item_matrix, select=None, header=None , footer=None) :
""" returnr a string for an html table"""
if not item_matrix :
return ''
html_cols = []
tds = lambda text : u'<td>'+text+u' </td>'
trs = lambda text : u'<tr>'+text+u'</tr>'
tds_items = [map(tds, row) for row in ite... | def html_tableify(item_matrix, select=None, header=None , footer=None) :
""" returnr a string for an html table"""
if not item_matrix :
return ''
html_cols = []
tds = lambda text : u'<td>'+text+u' </td>'
trs = lambda text : u'<tr>'+text+u'</tr>'
tds_items = [map(tds, row) for row in ite... | [
"returnr",
"a",
"string",
"for",
"an",
"html",
"table"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py#L19-L46 | [
"def",
"html_tableify",
"(",
"item_matrix",
",",
"select",
"=",
"None",
",",
"header",
"=",
"None",
",",
"footer",
"=",
"None",
")",
":",
"if",
"not",
"item_matrix",
":",
"return",
"''",
"html_cols",
"=",
"[",
"]",
"tds",
"=",
"lambda",
"text",
":",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | SlidingInterval.current | set current cursor position | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py | def current(self, value):
"""set current cursor position"""
current = min(max(self._min, value), self._max)
self._current = current
if current > self._stop :
self._stop = current
self._start = current-self._width
elif current < self._start :
... | def current(self, value):
"""set current cursor position"""
current = min(max(self._min, value), self._max)
self._current = current
if current > self._stop :
self._stop = current
self._start = current-self._width
elif current < self._start :
... | [
"set",
"current",
"cursor",
"position"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py#L78-L95 | [
"def",
"current",
"(",
"self",
",",
"value",
")",
":",
"current",
"=",
"min",
"(",
"max",
"(",
"self",
".",
"_min",
",",
"value",
")",
",",
"self",
".",
"_max",
")",
"self",
".",
"_current",
"=",
"current",
"if",
"current",
">",
"self",
".",
"_st... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.