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 | Process.get_cpu_percent | Return a float representing the current process CPU
utilization as a percentage.
When interval is > 0.0 compares process times to system CPU
times elapsed before and after the interval (blocking).
When interval is 0.0 or None compares process times to system CPU
times elapsed s... | environment/lib/python2.7/site-packages/psutil/__init__.py | def get_cpu_percent(self, interval=0.1):
"""Return a float representing the current process CPU
utilization as a percentage.
When interval is > 0.0 compares process times to system CPU
times elapsed before and after the interval (blocking).
When interval is 0.0 or None compares... | def get_cpu_percent(self, interval=0.1):
"""Return a float representing the current process CPU
utilization as a percentage.
When interval is > 0.0 compares process times to system CPU
times elapsed before and after the interval (blocking).
When interval is 0.0 or None compares... | [
"Return",
"a",
"float",
"representing",
"the",
"current",
"process",
"CPU",
"utilization",
"as",
"a",
"percentage",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L470-L520 | [
"def",
"get_cpu_percent",
"(",
"self",
",",
"interval",
"=",
"0.1",
")",
":",
"blocking",
"=",
"interval",
"is",
"not",
"None",
"and",
"interval",
">",
"0.0",
"if",
"blocking",
":",
"st1",
"=",
"sum",
"(",
"cpu_times",
"(",
")",
")",
"pt1",
"=",
"sel... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Process.get_memory_percent | Compare physical system memory to process resident memory and
calculate process memory utilization as a percentage. | environment/lib/python2.7/site-packages/psutil/__init__.py | def get_memory_percent(self):
"""Compare physical system memory to process resident memory and
calculate process memory utilization as a percentage.
"""
rss = self._platform_impl.get_memory_info()[0]
try:
return (rss / float(TOTAL_PHYMEM)) * 100
except ZeroDiv... | def get_memory_percent(self):
"""Compare physical system memory to process resident memory and
calculate process memory utilization as a percentage.
"""
rss = self._platform_impl.get_memory_info()[0]
try:
return (rss / float(TOTAL_PHYMEM)) * 100
except ZeroDiv... | [
"Compare",
"physical",
"system",
"memory",
"to",
"process",
"resident",
"memory",
"and",
"calculate",
"process",
"memory",
"utilization",
"as",
"a",
"percentage",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L546-L554 | [
"def",
"get_memory_percent",
"(",
"self",
")",
":",
"rss",
"=",
"self",
".",
"_platform_impl",
".",
"get_memory_info",
"(",
")",
"[",
"0",
"]",
"try",
":",
"return",
"(",
"rss",
"/",
"float",
"(",
"TOTAL_PHYMEM",
")",
")",
"*",
"100",
"except",
"ZeroDi... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Process.get_memory_maps | Return process's mapped memory regions as a list of nameduples
whose fields are variable depending on the platform.
If 'grouped' is True the mapped regions with the same 'path'
are grouped together and the different memory fields are summed.
If 'grouped' is False every mapped region is... | environment/lib/python2.7/site-packages/psutil/__init__.py | def get_memory_maps(self, grouped=True):
"""Return process's mapped memory regions as a list of nameduples
whose fields are variable depending on the platform.
If 'grouped' is True the mapped regions with the same 'path'
are grouped together and the different memory fields are summed.
... | def get_memory_maps(self, grouped=True):
"""Return process's mapped memory regions as a list of nameduples
whose fields are variable depending on the platform.
If 'grouped' is True the mapped regions with the same 'path'
are grouped together and the different memory fields are summed.
... | [
"Return",
"process",
"s",
"mapped",
"memory",
"regions",
"as",
"a",
"list",
"of",
"nameduples",
"whose",
"fields",
"are",
"variable",
"depending",
"on",
"the",
"platform",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L556-L581 | [
"def",
"get_memory_maps",
"(",
"self",
",",
"grouped",
"=",
"True",
")",
":",
"it",
"=",
"self",
".",
"_platform_impl",
".",
"get_memory_maps",
"(",
")",
"if",
"grouped",
":",
"d",
"=",
"{",
"}",
"for",
"tupl",
"in",
"it",
":",
"path",
"=",
"tupl",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Process.is_running | Return whether this process is running. | environment/lib/python2.7/site-packages/psutil/__init__.py | def is_running(self):
"""Return whether this process is running."""
if self._gone:
return False
try:
# Checking if pid is alive is not enough as the pid might
# have been reused by another process.
# pid + creation time, on the other hand, is suppo... | def is_running(self):
"""Return whether this process is running."""
if self._gone:
return False
try:
# Checking if pid is alive is not enough as the pid might
# have been reused by another process.
# pid + creation time, on the other hand, is suppo... | [
"Return",
"whether",
"this",
"process",
"is",
"running",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L609-L622 | [
"def",
"is_running",
"(",
"self",
")",
":",
"if",
"self",
".",
"_gone",
":",
"return",
"False",
"try",
":",
"# Checking if pid is alive is not enough as the pid might",
"# have been reused by another process.",
"# pid + creation time, on the other hand, is supposed to",
"# identi... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Process.send_signal | Send a signal to process (see signal module constants).
On Windows only SIGTERM is valid and is treated as an alias
for kill(). | environment/lib/python2.7/site-packages/psutil/__init__.py | def send_signal(self, sig):
"""Send a signal to process (see signal module constants).
On Windows only SIGTERM is valid and is treated as an alias
for kill().
"""
# safety measure in case the current process has been killed in
# meantime and the kernel reused its PID
... | def send_signal(self, sig):
"""Send a signal to process (see signal module constants).
On Windows only SIGTERM is valid and is treated as an alias
for kill().
"""
# safety measure in case the current process has been killed in
# meantime and the kernel reused its PID
... | [
"Send",
"a",
"signal",
"to",
"process",
"(",
"see",
"signal",
"module",
"constants",
")",
".",
"On",
"Windows",
"only",
"SIGTERM",
"is",
"valid",
"and",
"is",
"treated",
"as",
"an",
"alias",
"for",
"kill",
"()",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L624-L649 | [
"def",
"send_signal",
"(",
"self",
",",
"sig",
")",
":",
"# safety measure in case the current process has been killed in",
"# meantime and the kernel reused its PID",
"if",
"not",
"self",
".",
"is_running",
"(",
")",
":",
"name",
"=",
"self",
".",
"_platform_impl",
"."... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Process.suspend | Suspend process execution. | environment/lib/python2.7/site-packages/psutil/__init__.py | def suspend(self):
"""Suspend process execution."""
# safety measure in case the current process has been killed in
# meantime and the kernel reused its PID
if not self.is_running():
name = self._platform_impl._process_name
raise NoSuchProcess(self.pid, name)
... | def suspend(self):
"""Suspend process execution."""
# safety measure in case the current process has been killed in
# meantime and the kernel reused its PID
if not self.is_running():
name = self._platform_impl._process_name
raise NoSuchProcess(self.pid, name)
... | [
"Suspend",
"process",
"execution",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L651-L663 | [
"def",
"suspend",
"(",
"self",
")",
":",
"# safety measure in case the current process has been killed in",
"# meantime and the kernel reused its PID",
"if",
"not",
"self",
".",
"is_running",
"(",
")",
":",
"name",
"=",
"self",
".",
"_platform_impl",
".",
"_process_name",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Process.resume | Resume process execution. | environment/lib/python2.7/site-packages/psutil/__init__.py | def resume(self):
"""Resume process execution."""
# safety measure in case the current process has been killed in
# meantime and the kernel reused its PID
if not self.is_running():
name = self._platform_impl._process_name
raise NoSuchProcess(self.pid, name)
... | def resume(self):
"""Resume process execution."""
# safety measure in case the current process has been killed in
# meantime and the kernel reused its PID
if not self.is_running():
name = self._platform_impl._process_name
raise NoSuchProcess(self.pid, name)
... | [
"Resume",
"process",
"execution",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L665-L677 | [
"def",
"resume",
"(",
"self",
")",
":",
"# safety measure in case the current process has been killed in",
"# meantime and the kernel reused its PID",
"if",
"not",
"self",
".",
"is_running",
"(",
")",
":",
"name",
"=",
"self",
".",
"_platform_impl",
".",
"_process_name",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Process.kill | Kill the current process. | environment/lib/python2.7/site-packages/psutil/__init__.py | def kill(self):
"""Kill the current process."""
# safety measure in case the current process has been killed in
# meantime and the kernel reused its PID
if not self.is_running():
name = self._platform_impl._process_name
raise NoSuchProcess(self.pid, name)
... | def kill(self):
"""Kill the current process."""
# safety measure in case the current process has been killed in
# meantime and the kernel reused its PID
if not self.is_running():
name = self._platform_impl._process_name
raise NoSuchProcess(self.pid, name)
... | [
"Kill",
"the",
"current",
"process",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L685-L695 | [
"def",
"kill",
"(",
"self",
")",
":",
"# safety measure in case the current process has been killed in",
"# meantime and the kernel reused its PID",
"if",
"not",
"self",
".",
"is_running",
"(",
")",
":",
"name",
"=",
"self",
".",
"_platform_impl",
".",
"_process_name",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Process.wait | Wait for process to terminate and, if process is a children
of the current one also return its exit code, else None. | environment/lib/python2.7/site-packages/psutil/__init__.py | def wait(self, timeout=None):
"""Wait for process to terminate and, if process is a children
of the current one also return its exit code, else None.
"""
if timeout is not None and not timeout >= 0:
raise ValueError("timeout must be a positive integer")
return self._p... | def wait(self, timeout=None):
"""Wait for process to terminate and, if process is a children
of the current one also return its exit code, else None.
"""
if timeout is not None and not timeout >= 0:
raise ValueError("timeout must be a positive integer")
return self._p... | [
"Wait",
"for",
"process",
"to",
"terminate",
"and",
"if",
"process",
"is",
"a",
"children",
"of",
"the",
"current",
"one",
"also",
"return",
"its",
"exit",
"code",
"else",
"None",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L697-L703 | [
"def",
"wait",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"timeout",
"is",
"not",
"None",
"and",
"not",
"timeout",
">=",
"0",
":",
"raise",
"ValueError",
"(",
"\"timeout must be a positive integer\"",
")",
"return",
"self",
".",
"_platform_imp... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | Process.nice | Get or set process niceness (priority).
Deprecated, use get_nice() instead. | environment/lib/python2.7/site-packages/psutil/__init__.py | def nice(self):
"""Get or set process niceness (priority).
Deprecated, use get_nice() instead.
"""
msg = "this property is deprecated; use Process.get_nice() method instead"
warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
return self.get_nice() | def nice(self):
"""Get or set process niceness (priority).
Deprecated, use get_nice() instead.
"""
msg = "this property is deprecated; use Process.get_nice() method instead"
warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
return self.get_nice() | [
"Get",
"or",
"set",
"process",
"niceness",
"(",
"priority",
")",
".",
"Deprecated",
"use",
"get_nice",
"()",
"instead",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L708-L714 | [
"def",
"nice",
"(",
"self",
")",
":",
"msg",
"=",
"\"this property is deprecated; use Process.get_nice() method instead\"",
"warnings",
".",
"warn",
"(",
"msg",
",",
"category",
"=",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"return",
"self",
".",
"g... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | GTKEmbed._wire_kernel | Initializes the kernel inside GTK.
This is meant to run only once at startup, so it does its job and
returns False to ensure it doesn't get run again by GTK. | environment/lib/python2.7/site-packages/IPython/zmq/gui/gtkembed.py | def _wire_kernel(self):
"""Initializes the kernel inside GTK.
This is meant to run only once at startup, so it does its job and
returns False to ensure it doesn't get run again by GTK.
"""
self.gtk_main, self.gtk_main_quit = self._hijack_gtk()
gobject.timeout_add... | def _wire_kernel(self):
"""Initializes the kernel inside GTK.
This is meant to run only once at startup, so it does its job and
returns False to ensure it doesn't get run again by GTK.
"""
self.gtk_main, self.gtk_main_quit = self._hijack_gtk()
gobject.timeout_add... | [
"Initializes",
"the",
"kernel",
"inside",
"GTK",
".",
"This",
"is",
"meant",
"to",
"run",
"only",
"once",
"at",
"startup",
"so",
"it",
"does",
"its",
"job",
"and",
"returns",
"False",
"to",
"ensure",
"it",
"doesn",
"t",
"get",
"run",
"again",
"by",
"GT... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/gui/gtkembed.py#L40-L49 | [
"def",
"_wire_kernel",
"(",
"self",
")",
":",
"self",
".",
"gtk_main",
",",
"self",
".",
"gtk_main_quit",
"=",
"self",
".",
"_hijack_gtk",
"(",
")",
"gobject",
".",
"timeout_add",
"(",
"int",
"(",
"1000",
"*",
"self",
".",
"kernel",
".",
"_poll_interval"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | GTKEmbed._hijack_gtk | Hijack a few key functions in GTK for IPython integration.
Modifies pyGTK's main and main_quit with a dummy so user code does not
block IPython. This allows us to use %run to run arbitrary pygtk
scripts from a long-lived IPython session, and when they attempt to
start or stop
... | environment/lib/python2.7/site-packages/IPython/zmq/gui/gtkembed.py | def _hijack_gtk(self):
"""Hijack a few key functions in GTK for IPython integration.
Modifies pyGTK's main and main_quit with a dummy so user code does not
block IPython. This allows us to use %run to run arbitrary pygtk
scripts from a long-lived IPython session, and when they attempt ... | def _hijack_gtk(self):
"""Hijack a few key functions in GTK for IPython integration.
Modifies pyGTK's main and main_quit with a dummy so user code does not
block IPython. This allows us to use %run to run arbitrary pygtk
scripts from a long-lived IPython session, and when they attempt ... | [
"Hijack",
"a",
"few",
"key",
"functions",
"in",
"GTK",
"for",
"IPython",
"integration",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/gui/gtkembed.py#L67-L86 | [
"def",
"_hijack_gtk",
"(",
"self",
")",
":",
"def",
"dummy",
"(",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"pass",
"# save and trap main and main_quit from gtk",
"orig_main",
",",
"gtk",
".",
"main",
"=",
"gtk",
".",
"main",
",",
"dummy",
"orig_main_qui... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | is_shadowed | Is the given identifier defined in one of the namespaces which shadow
the alias and magic namespaces? Note that an identifier is different
than ifun, because it can not contain a '.' character. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def is_shadowed(identifier, ip):
"""Is the given identifier defined in one of the namespaces which shadow
the alias and magic namespaces? Note that an identifier is different
than ifun, because it can not contain a '.' character."""
# This is much safer than calling ofind, which can change state
re... | def is_shadowed(identifier, ip):
"""Is the given identifier defined in one of the namespaces which shadow
the alias and magic namespaces? Note that an identifier is different
than ifun, because it can not contain a '.' character."""
# This is much safer than calling ofind, which can change state
re... | [
"Is",
"the",
"given",
"identifier",
"defined",
"in",
"one",
"of",
"the",
"namespaces",
"which",
"shadow",
"the",
"alias",
"and",
"magic",
"namespaces?",
"Note",
"that",
"an",
"identifier",
"is",
"different",
"than",
"ifun",
"because",
"it",
"can",
"not",
"co... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L85-L92 | [
"def",
"is_shadowed",
"(",
"identifier",
",",
"ip",
")",
":",
"# This is much safer than calling ofind, which can change state",
"return",
"(",
"identifier",
"in",
"ip",
".",
"user_ns",
"or",
"identifier",
"in",
"ip",
".",
"user_global_ns",
"or",
"identifier",
"in",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.init_transformers | Create the default transformers. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def init_transformers(self):
"""Create the default transformers."""
self._transformers = []
for transformer_cls in _default_transformers:
transformer_cls(
shell=self.shell, prefilter_manager=self, config=self.config
) | def init_transformers(self):
"""Create the default transformers."""
self._transformers = []
for transformer_cls in _default_transformers:
transformer_cls(
shell=self.shell, prefilter_manager=self, config=self.config
) | [
"Create",
"the",
"default",
"transformers",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L153-L159 | [
"def",
"init_transformers",
"(",
"self",
")",
":",
"self",
".",
"_transformers",
"=",
"[",
"]",
"for",
"transformer_cls",
"in",
"_default_transformers",
":",
"transformer_cls",
"(",
"shell",
"=",
"self",
".",
"shell",
",",
"prefilter_manager",
"=",
"self",
","... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.register_transformer | Register a transformer instance. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def register_transformer(self, transformer):
"""Register a transformer instance."""
if transformer not in self._transformers:
self._transformers.append(transformer)
self.sort_transformers() | def register_transformer(self, transformer):
"""Register a transformer instance."""
if transformer not in self._transformers:
self._transformers.append(transformer)
self.sort_transformers() | [
"Register",
"a",
"transformer",
"instance",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L174-L178 | [
"def",
"register_transformer",
"(",
"self",
",",
"transformer",
")",
":",
"if",
"transformer",
"not",
"in",
"self",
".",
"_transformers",
":",
"self",
".",
"_transformers",
".",
"append",
"(",
"transformer",
")",
"self",
".",
"sort_transformers",
"(",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.unregister_transformer | Unregister a transformer instance. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def unregister_transformer(self, transformer):
"""Unregister a transformer instance."""
if transformer in self._transformers:
self._transformers.remove(transformer) | def unregister_transformer(self, transformer):
"""Unregister a transformer instance."""
if transformer in self._transformers:
self._transformers.remove(transformer) | [
"Unregister",
"a",
"transformer",
"instance",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L180-L183 | [
"def",
"unregister_transformer",
"(",
"self",
",",
"transformer",
")",
":",
"if",
"transformer",
"in",
"self",
".",
"_transformers",
":",
"self",
".",
"_transformers",
".",
"remove",
"(",
"transformer",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.init_checkers | Create the default checkers. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def init_checkers(self):
"""Create the default checkers."""
self._checkers = []
for checker in _default_checkers:
checker(
shell=self.shell, prefilter_manager=self, config=self.config
) | def init_checkers(self):
"""Create the default checkers."""
self._checkers = []
for checker in _default_checkers:
checker(
shell=self.shell, prefilter_manager=self, config=self.config
) | [
"Create",
"the",
"default",
"checkers",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L189-L195 | [
"def",
"init_checkers",
"(",
"self",
")",
":",
"self",
".",
"_checkers",
"=",
"[",
"]",
"for",
"checker",
"in",
"_default_checkers",
":",
"checker",
"(",
"shell",
"=",
"self",
".",
"shell",
",",
"prefilter_manager",
"=",
"self",
",",
"config",
"=",
"self... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.register_checker | Register a checker instance. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def register_checker(self, checker):
"""Register a checker instance."""
if checker not in self._checkers:
self._checkers.append(checker)
self.sort_checkers() | def register_checker(self, checker):
"""Register a checker instance."""
if checker not in self._checkers:
self._checkers.append(checker)
self.sort_checkers() | [
"Register",
"a",
"checker",
"instance",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L210-L214 | [
"def",
"register_checker",
"(",
"self",
",",
"checker",
")",
":",
"if",
"checker",
"not",
"in",
"self",
".",
"_checkers",
":",
"self",
".",
"_checkers",
".",
"append",
"(",
"checker",
")",
"self",
".",
"sort_checkers",
"(",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.unregister_checker | Unregister a checker instance. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def unregister_checker(self, checker):
"""Unregister a checker instance."""
if checker in self._checkers:
self._checkers.remove(checker) | def unregister_checker(self, checker):
"""Unregister a checker instance."""
if checker in self._checkers:
self._checkers.remove(checker) | [
"Unregister",
"a",
"checker",
"instance",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L216-L219 | [
"def",
"unregister_checker",
"(",
"self",
",",
"checker",
")",
":",
"if",
"checker",
"in",
"self",
".",
"_checkers",
":",
"self",
".",
"_checkers",
".",
"remove",
"(",
"checker",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.init_handlers | Create the default handlers. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def init_handlers(self):
"""Create the default handlers."""
self._handlers = {}
self._esc_handlers = {}
for handler in _default_handlers:
handler(
shell=self.shell, prefilter_manager=self, config=self.config
) | def init_handlers(self):
"""Create the default handlers."""
self._handlers = {}
self._esc_handlers = {}
for handler in _default_handlers:
handler(
shell=self.shell, prefilter_manager=self, config=self.config
) | [
"Create",
"the",
"default",
"handlers",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L225-L232 | [
"def",
"init_handlers",
"(",
"self",
")",
":",
"self",
".",
"_handlers",
"=",
"{",
"}",
"self",
".",
"_esc_handlers",
"=",
"{",
"}",
"for",
"handler",
"in",
"_default_handlers",
":",
"handler",
"(",
"shell",
"=",
"self",
".",
"shell",
",",
"prefilter_man... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.register_handler | Register a handler instance by name with esc_strings. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def register_handler(self, name, handler, esc_strings):
"""Register a handler instance by name with esc_strings."""
self._handlers[name] = handler
for esc_str in esc_strings:
self._esc_handlers[esc_str] = handler | def register_handler(self, name, handler, esc_strings):
"""Register a handler instance by name with esc_strings."""
self._handlers[name] = handler
for esc_str in esc_strings:
self._esc_handlers[esc_str] = handler | [
"Register",
"a",
"handler",
"instance",
"by",
"name",
"with",
"esc_strings",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L239-L243 | [
"def",
"register_handler",
"(",
"self",
",",
"name",
",",
"handler",
",",
"esc_strings",
")",
":",
"self",
".",
"_handlers",
"[",
"name",
"]",
"=",
"handler",
"for",
"esc_str",
"in",
"esc_strings",
":",
"self",
".",
"_esc_handlers",
"[",
"esc_str",
"]",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.unregister_handler | Unregister a handler instance by name with esc_strings. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def unregister_handler(self, name, handler, esc_strings):
"""Unregister a handler instance by name with esc_strings."""
try:
del self._handlers[name]
except KeyError:
pass
for esc_str in esc_strings:
h = self._esc_handlers.get(esc_str)
if h... | def unregister_handler(self, name, handler, esc_strings):
"""Unregister a handler instance by name with esc_strings."""
try:
del self._handlers[name]
except KeyError:
pass
for esc_str in esc_strings:
h = self._esc_handlers.get(esc_str)
if h... | [
"Unregister",
"a",
"handler",
"instance",
"by",
"name",
"with",
"esc_strings",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L245-L254 | [
"def",
"unregister_handler",
"(",
"self",
",",
"name",
",",
"handler",
",",
"esc_strings",
")",
":",
"try",
":",
"del",
"self",
".",
"_handlers",
"[",
"name",
"]",
"except",
"KeyError",
":",
"pass",
"for",
"esc_str",
"in",
"esc_strings",
":",
"h",
"=",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.prefilter_line_info | Prefilter a line that has been converted to a LineInfo object.
This implements the checker/handler part of the prefilter pipe. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def prefilter_line_info(self, line_info):
"""Prefilter a line that has been converted to a LineInfo object.
This implements the checker/handler part of the prefilter pipe.
"""
# print "prefilter_line_info: ", line_info
handler = self.find_handler(line_info)
return handle... | def prefilter_line_info(self, line_info):
"""Prefilter a line that has been converted to a LineInfo object.
This implements the checker/handler part of the prefilter pipe.
"""
# print "prefilter_line_info: ", line_info
handler = self.find_handler(line_info)
return handle... | [
"Prefilter",
"a",
"line",
"that",
"has",
"been",
"converted",
"to",
"a",
"LineInfo",
"object",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L268-L275 | [
"def",
"prefilter_line_info",
"(",
"self",
",",
"line_info",
")",
":",
"# print \"prefilter_line_info: \", line_info",
"handler",
"=",
"self",
".",
"find_handler",
"(",
"line_info",
")",
"return",
"handler",
".",
"handle",
"(",
"line_info",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.find_handler | Find a handler for the line_info by trying checkers. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def find_handler(self, line_info):
"""Find a handler for the line_info by trying checkers."""
for checker in self.checkers:
if checker.enabled:
handler = checker.check(line_info)
if handler:
return handler
return self.get_handler_by... | def find_handler(self, line_info):
"""Find a handler for the line_info by trying checkers."""
for checker in self.checkers:
if checker.enabled:
handler = checker.check(line_info)
if handler:
return handler
return self.get_handler_by... | [
"Find",
"a",
"handler",
"for",
"the",
"line_info",
"by",
"trying",
"checkers",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L277-L284 | [
"def",
"find_handler",
"(",
"self",
",",
"line_info",
")",
":",
"for",
"checker",
"in",
"self",
".",
"checkers",
":",
"if",
"checker",
".",
"enabled",
":",
"handler",
"=",
"checker",
".",
"check",
"(",
"line_info",
")",
"if",
"handler",
":",
"return",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.transform_line | Calls the enabled transformers in order of increasing priority. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def transform_line(self, line, continue_prompt):
"""Calls the enabled transformers in order of increasing priority."""
for transformer in self.transformers:
if transformer.enabled:
line = transformer.transform(line, continue_prompt)
return line | def transform_line(self, line, continue_prompt):
"""Calls the enabled transformers in order of increasing priority."""
for transformer in self.transformers:
if transformer.enabled:
line = transformer.transform(line, continue_prompt)
return line | [
"Calls",
"the",
"enabled",
"transformers",
"in",
"order",
"of",
"increasing",
"priority",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L286-L291 | [
"def",
"transform_line",
"(",
"self",
",",
"line",
",",
"continue_prompt",
")",
":",
"for",
"transformer",
"in",
"self",
".",
"transformers",
":",
"if",
"transformer",
".",
"enabled",
":",
"line",
"=",
"transformer",
".",
"transform",
"(",
"line",
",",
"co... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.prefilter_line | Prefilter a single input line as text.
This method prefilters a single line of text by calling the
transformers and then the checkers/handlers. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def prefilter_line(self, line, continue_prompt=False):
"""Prefilter a single input line as text.
This method prefilters a single line of text by calling the
transformers and then the checkers/handlers.
"""
# print "prefilter_line: ", line, continue_prompt
# All handlers... | def prefilter_line(self, line, continue_prompt=False):
"""Prefilter a single input line as text.
This method prefilters a single line of text by calling the
transformers and then the checkers/handlers.
"""
# print "prefilter_line: ", line, continue_prompt
# All handlers... | [
"Prefilter",
"a",
"single",
"input",
"line",
"as",
"text",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L293-L337 | [
"def",
"prefilter_line",
"(",
"self",
",",
"line",
",",
"continue_prompt",
"=",
"False",
")",
":",
"# print \"prefilter_line: \", line, continue_prompt",
"# All handlers *must* return a value, even if it's blank ('').",
"# save the line away in case we crash, so the post-mortem handler c... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterManager.prefilter_lines | Prefilter multiple input lines of text.
This is the main entry point for prefiltering multiple lines of
input. This simply calls :meth:`prefilter_line` for each line of
input.
This covers cases where there are multiple lines in the user entry,
which is the case when the user g... | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def prefilter_lines(self, lines, continue_prompt=False):
"""Prefilter multiple input lines of text.
This is the main entry point for prefiltering multiple lines of
input. This simply calls :meth:`prefilter_line` for each line of
input.
This covers cases where there are multipl... | def prefilter_lines(self, lines, continue_prompt=False):
"""Prefilter multiple input lines of text.
This is the main entry point for prefiltering multiple lines of
input. This simply calls :meth:`prefilter_line` for each line of
input.
This covers cases where there are multipl... | [
"Prefilter",
"multiple",
"input",
"lines",
"of",
"text",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L339-L362 | [
"def",
"prefilter_lines",
"(",
"self",
",",
"lines",
",",
"continue_prompt",
"=",
"False",
")",
":",
"llines",
"=",
"lines",
".",
"rstrip",
"(",
"'\\n'",
")",
".",
"split",
"(",
"'\\n'",
")",
"# We can get multiple lines in one shot, where multiline input 'blends'",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | IPyAutocallChecker.check | Instances of IPyAutocall in user_ns get autocalled immediately | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def check(self, line_info):
"Instances of IPyAutocall in user_ns get autocalled immediately"
obj = self.shell.user_ns.get(line_info.ifun, None)
if isinstance(obj, IPyAutocall):
obj.set_ip(self.shell)
return self.prefilter_manager.get_handler_by_name('auto')
else:
... | def check(self, line_info):
"Instances of IPyAutocall in user_ns get autocalled immediately"
obj = self.shell.user_ns.get(line_info.ifun, None)
if isinstance(obj, IPyAutocall):
obj.set_ip(self.shell)
return self.prefilter_manager.get_handler_by_name('auto')
else:
... | [
"Instances",
"of",
"IPyAutocall",
"in",
"user_ns",
"get",
"autocalled",
"immediately"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L539-L546 | [
"def",
"check",
"(",
"self",
",",
"line_info",
")",
":",
"obj",
"=",
"self",
".",
"shell",
".",
"user_ns",
".",
"get",
"(",
"line_info",
".",
"ifun",
",",
"None",
")",
"if",
"isinstance",
"(",
"obj",
",",
"IPyAutocall",
")",
":",
"obj",
".",
"set_i... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | MultiLineMagicChecker.check | Allow ! and !! in multi-line statements if multi_line_specials is on | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def check(self, line_info):
"Allow ! and !! in multi-line statements if multi_line_specials is on"
# Note that this one of the only places we check the first character of
# ifun and *not* the pre_char. Also note that the below test matches
# both ! and !!.
if line_info.continue_... | def check(self, line_info):
"Allow ! and !! in multi-line statements if multi_line_specials is on"
# Note that this one of the only places we check the first character of
# ifun and *not* the pre_char. Also note that the below test matches
# both ! and !!.
if line_info.continue_... | [
"Allow",
"!",
"and",
"!!",
"in",
"multi",
"-",
"line",
"statements",
"if",
"multi_line_specials",
"is",
"on"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L553-L563 | [
"def",
"check",
"(",
"self",
",",
"line_info",
")",
":",
"# Note that this one of the only places we check the first character of",
"# ifun and *not* the pre_char. Also note that the below test matches",
"# both ! and !!.",
"if",
"line_info",
".",
"continue_prompt",
"and",
"self",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | EscCharsChecker.check | Check for escape character and return either a handler to handle it,
or None if there is no escape char. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def check(self, line_info):
"""Check for escape character and return either a handler to handle it,
or None if there is no escape char."""
if line_info.line[-1] == ESC_HELP \
and line_info.esc != ESC_SHELL \
and line_info.esc != ESC_SH_CAP:
# the ? can b... | def check(self, line_info):
"""Check for escape character and return either a handler to handle it,
or None if there is no escape char."""
if line_info.line[-1] == ESC_HELP \
and line_info.esc != ESC_SHELL \
and line_info.esc != ESC_SH_CAP:
# the ? can b... | [
"Check",
"for",
"escape",
"character",
"and",
"return",
"either",
"a",
"handler",
"to",
"handle",
"it",
"or",
"None",
"if",
"there",
"is",
"no",
"escape",
"char",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L570-L583 | [
"def",
"check",
"(",
"self",
",",
"line_info",
")",
":",
"if",
"line_info",
".",
"line",
"[",
"-",
"1",
"]",
"==",
"ESC_HELP",
"and",
"line_info",
".",
"esc",
"!=",
"ESC_SHELL",
"and",
"line_info",
".",
"esc",
"!=",
"ESC_SH_CAP",
":",
"# the ? can be at ... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AutoMagicChecker.check | If the ifun is magic, and automagic is on, run it. Note: normal,
non-auto magic would already have been triggered via '%' in
check_esc_chars. This just checks for automagic. Also, before
triggering the magic handler, make sure that there is nothing in the
user namespace which could sha... | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def check(self, line_info):
"""If the ifun is magic, and automagic is on, run it. Note: normal,
non-auto magic would already have been triggered via '%' in
check_esc_chars. This just checks for automagic. Also, before
triggering the magic handler, make sure that there is nothing in the... | def check(self, line_info):
"""If the ifun is magic, and automagic is on, run it. Note: normal,
non-auto magic would already have been triggered via '%' in
check_esc_chars. This just checks for automagic. Also, before
triggering the magic handler, make sure that there is nothing in the... | [
"If",
"the",
"ifun",
"is",
"magic",
"and",
"automagic",
"is",
"on",
"run",
"it",
".",
"Note",
":",
"normal",
"non",
"-",
"auto",
"magic",
"would",
"already",
"have",
"been",
"triggered",
"via",
"%",
"in",
"check_esc_chars",
".",
"This",
"just",
"checks",... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L608-L625 | [
"def",
"check",
"(",
"self",
",",
"line_info",
")",
":",
"if",
"not",
"self",
".",
"shell",
".",
"automagic",
"or",
"not",
"self",
".",
"shell",
".",
"find_magic",
"(",
"line_info",
".",
"ifun",
")",
":",
"return",
"None",
"# We have a likely magic method.... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AliasChecker.check | Check if the initital identifier on the line is an alias. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def check(self, line_info):
"Check if the initital identifier on the line is an alias."
# Note: aliases can not contain '.'
head = line_info.ifun.split('.',1)[0]
if line_info.ifun not in self.shell.alias_manager \
or head not in self.shell.alias_manager \
or... | def check(self, line_info):
"Check if the initital identifier on the line is an alias."
# Note: aliases can not contain '.'
head = line_info.ifun.split('.',1)[0]
if line_info.ifun not in self.shell.alias_manager \
or head not in self.shell.alias_manager \
or... | [
"Check",
"if",
"the",
"initital",
"identifier",
"on",
"the",
"line",
"is",
"an",
"alias",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L632-L641 | [
"def",
"check",
"(",
"self",
",",
"line_info",
")",
":",
"# Note: aliases can not contain '.'",
"head",
"=",
"line_info",
".",
"ifun",
".",
"split",
"(",
"'.'",
",",
"1",
")",
"[",
"0",
"]",
"if",
"line_info",
".",
"ifun",
"not",
"in",
"self",
".",
"sh... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PythonOpsChecker.check | If the 'rest' of the line begins with a function call or pretty much
any python operator, we should simply execute the line (regardless of
whether or not there's a possible autocall expansion). This avoids
spurious (and very confusing) geattr() accesses. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def check(self, line_info):
"""If the 'rest' of the line begins with a function call or pretty much
any python operator, we should simply execute the line (regardless of
whether or not there's a possible autocall expansion). This avoids
spurious (and very confusing) geattr() accesses.""... | def check(self, line_info):
"""If the 'rest' of the line begins with a function call or pretty much
any python operator, we should simply execute the line (regardless of
whether or not there's a possible autocall expansion). This avoids
spurious (and very confusing) geattr() accesses.""... | [
"If",
"the",
"rest",
"of",
"the",
"line",
"begins",
"with",
"a",
"function",
"call",
"or",
"pretty",
"much",
"any",
"python",
"operator",
"we",
"should",
"simply",
"execute",
"the",
"line",
"(",
"regardless",
"of",
"whether",
"or",
"not",
"there",
"s",
"... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L648-L656 | [
"def",
"check",
"(",
"self",
",",
"line_info",
")",
":",
"if",
"line_info",
".",
"the_rest",
"and",
"line_info",
".",
"the_rest",
"[",
"0",
"]",
"in",
"'!=()<>,+*/%^&|'",
":",
"return",
"self",
".",
"prefilter_manager",
".",
"get_handler_by_name",
"(",
"'nor... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AutocallChecker.check | Check if the initial word/function is callable and autocall is on. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def check(self, line_info):
"Check if the initial word/function is callable and autocall is on."
if not self.shell.autocall:
return None
oinfo = line_info.ofind(self.shell) # This can mutate state via getattr
if not oinfo['found']:
return None
if callabl... | def check(self, line_info):
"Check if the initial word/function is callable and autocall is on."
if not self.shell.autocall:
return None
oinfo = line_info.ofind(self.shell) # This can mutate state via getattr
if not oinfo['found']:
return None
if callabl... | [
"Check",
"if",
"the",
"initial",
"word",
"/",
"function",
"is",
"callable",
"and",
"autocall",
"is",
"on",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L668-L682 | [
"def",
"check",
"(",
"self",
",",
"line_info",
")",
":",
"if",
"not",
"self",
".",
"shell",
".",
"autocall",
":",
"return",
"None",
"oinfo",
"=",
"line_info",
".",
"ofind",
"(",
"self",
".",
"shell",
")",
"# This can mutate state via getattr",
"if",
"not",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | PrefilterHandler.handle | Handle normal input lines. Use as a template for handlers. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def handle(self, line_info):
# print "normal: ", line_info
"""Handle normal input lines. Use as a template for handlers."""
# With autoindent on, we need some way to exit the input loop, and I
# don't want to force the user to have to backspace all the way to
# clear the line. ... | def handle(self, line_info):
# print "normal: ", line_info
"""Handle normal input lines. Use as a template for handlers."""
# With autoindent on, we need some way to exit the input loop, and I
# don't want to force the user to have to backspace all the way to
# clear the line. ... | [
"Handle",
"normal",
"input",
"lines",
".",
"Use",
"as",
"a",
"template",
"for",
"handlers",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L707-L725 | [
"def",
"handle",
"(",
"self",
",",
"line_info",
")",
":",
"# print \"normal: \", line_info",
"# With autoindent on, we need some way to exit the input loop, and I",
"# don't want to force the user to have to backspace all the way to",
"# clear the line. The rule will be in this case, that eit... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AliasHandler.handle | Handle alias input lines. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def handle(self, line_info):
"""Handle alias input lines. """
transformed = self.shell.alias_manager.expand_aliases(line_info.ifun,line_info.the_rest)
# pre is needed, because it carries the leading whitespace. Otherwise
# aliases won't work in indented sections.
line_out = '%sg... | def handle(self, line_info):
"""Handle alias input lines. """
transformed = self.shell.alias_manager.expand_aliases(line_info.ifun,line_info.the_rest)
# pre is needed, because it carries the leading whitespace. Otherwise
# aliases won't work in indented sections.
line_out = '%sg... | [
"Handle",
"alias",
"input",
"lines",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L735-L742 | [
"def",
"handle",
"(",
"self",
",",
"line_info",
")",
":",
"transformed",
"=",
"self",
".",
"shell",
".",
"alias_manager",
".",
"expand_aliases",
"(",
"line_info",
".",
"ifun",
",",
"line_info",
".",
"the_rest",
")",
"# pre is needed, because it carries the leading... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ShellEscapeHandler.handle | Execute the line in a shell, empty return value | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def handle(self, line_info):
"""Execute the line in a shell, empty return value"""
magic_handler = self.prefilter_manager.get_handler_by_name('magic')
line = line_info.line
if line.lstrip().startswith(ESC_SH_CAP):
# rewrite LineInfo's line, ifun and the_rest to properly hold... | def handle(self, line_info):
"""Execute the line in a shell, empty return value"""
magic_handler = self.prefilter_manager.get_handler_by_name('magic')
line = line_info.line
if line.lstrip().startswith(ESC_SH_CAP):
# rewrite LineInfo's line, ifun and the_rest to properly hold... | [
"Execute",
"the",
"line",
"in",
"a",
"shell",
"empty",
"return",
"value"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L750-L769 | [
"def",
"handle",
"(",
"self",
",",
"line_info",
")",
":",
"magic_handler",
"=",
"self",
".",
"prefilter_manager",
".",
"get_handler_by_name",
"(",
"'magic'",
")",
"line",
"=",
"line_info",
".",
"line",
"if",
"line",
".",
"lstrip",
"(",
")",
".",
"startswit... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | MagicHandler.handle | Execute magic functions. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def handle(self, line_info):
"""Execute magic functions."""
ifun = line_info.ifun
the_rest = line_info.the_rest
cmd = '%sget_ipython().magic(%r)' % (line_info.pre_whitespace,
(ifun + " " + the_rest))
return cmd | def handle(self, line_info):
"""Execute magic functions."""
ifun = line_info.ifun
the_rest = line_info.the_rest
cmd = '%sget_ipython().magic(%r)' % (line_info.pre_whitespace,
(ifun + " " + the_rest))
return cmd | [
"Execute",
"magic",
"functions",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L787-L793 | [
"def",
"handle",
"(",
"self",
",",
"line_info",
")",
":",
"ifun",
"=",
"line_info",
".",
"ifun",
"the_rest",
"=",
"line_info",
".",
"the_rest",
"cmd",
"=",
"'%sget_ipython().magic(%r)'",
"%",
"(",
"line_info",
".",
"pre_whitespace",
",",
"(",
"ifun",
"+",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AutoHandler.handle | Handle lines which can be auto-executed, quoting if requested. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def handle(self, line_info):
"""Handle lines which can be auto-executed, quoting if requested."""
line = line_info.line
ifun = line_info.ifun
the_rest = line_info.the_rest
pre = line_info.pre
esc = line_info.esc
continue_prompt = line_info.continue_p... | def handle(self, line_info):
"""Handle lines which can be auto-executed, quoting if requested."""
line = line_info.line
ifun = line_info.ifun
the_rest = line_info.the_rest
pre = line_info.pre
esc = line_info.esc
continue_prompt = line_info.continue_p... | [
"Handle",
"lines",
"which",
"can",
"be",
"auto",
"-",
"executed",
"quoting",
"if",
"requested",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L801-L865 | [
"def",
"handle",
"(",
"self",
",",
"line_info",
")",
":",
"line",
"=",
"line_info",
".",
"line",
"ifun",
"=",
"line_info",
".",
"ifun",
"the_rest",
"=",
"line_info",
".",
"the_rest",
"pre",
"=",
"line_info",
".",
"pre",
"esc",
"=",
"line_info",
".",
"e... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | HelpHandler.handle | Try to get some help for the object.
obj? or ?obj -> basic information.
obj?? or ??obj -> more details. | environment/lib/python2.7/site-packages/IPython/core/prefilter.py | def handle(self, line_info):
"""Try to get some help for the object.
obj? or ?obj -> basic information.
obj?? or ??obj -> more details.
"""
normal_handler = self.prefilter_manager.get_handler_by_name('normal')
line = line_info.line
# We need to make sure that w... | def handle(self, line_info):
"""Try to get some help for the object.
obj? or ?obj -> basic information.
obj?? or ??obj -> more details.
"""
normal_handler = self.prefilter_manager.get_handler_by_name('normal')
line = line_info.line
# We need to make sure that w... | [
"Try",
"to",
"get",
"some",
"help",
"for",
"the",
"object",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L873-L903 | [
"def",
"handle",
"(",
"self",
",",
"line_info",
")",
":",
"normal_handler",
"=",
"self",
".",
"prefilter_manager",
".",
"get_handler_by_name",
"(",
"'normal'",
")",
"line",
"=",
"line_info",
".",
"line",
"# We need to make sure that we don't process lines which would be... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | CallTipWidget.eventFilter | Reimplemented to hide on certain key presses and on text edit focus
changes. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py | def eventFilter(self, obj, event):
""" Reimplemented to hide on certain key presses and on text edit focus
changes.
"""
if obj == self._text_edit:
etype = event.type()
if etype == QtCore.QEvent.KeyPress:
key = event.key()
if ke... | def eventFilter(self, obj, event):
""" Reimplemented to hide on certain key presses and on text edit focus
changes.
"""
if obj == self._text_edit:
etype = event.type()
if etype == QtCore.QEvent.KeyPress:
key = event.key()
if ke... | [
"Reimplemented",
"to",
"hide",
"on",
"certain",
"key",
"presses",
"and",
"on",
"text",
"edit",
"focus",
"changes",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py#L41-L65 | [
"def",
"eventFilter",
"(",
"self",
",",
"obj",
",",
"event",
")",
":",
"if",
"obj",
"==",
"self",
".",
"_text_edit",
":",
"etype",
"=",
"event",
".",
"type",
"(",
")",
"if",
"etype",
"==",
"QtCore",
".",
"QEvent",
".",
"KeyPress",
":",
"key",
"=",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | CallTipWidget.enterEvent | Reimplemented to cancel the hide timer. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py | def enterEvent(self, event):
""" Reimplemented to cancel the hide timer.
"""
super(CallTipWidget, self).enterEvent(event)
self._hide_timer.stop() | def enterEvent(self, event):
""" Reimplemented to cancel the hide timer.
"""
super(CallTipWidget, self).enterEvent(event)
self._hide_timer.stop() | [
"Reimplemented",
"to",
"cancel",
"the",
"hide",
"timer",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py#L78-L82 | [
"def",
"enterEvent",
"(",
"self",
",",
"event",
")",
":",
"super",
"(",
"CallTipWidget",
",",
"self",
")",
".",
"enterEvent",
"(",
"event",
")",
"self",
".",
"_hide_timer",
".",
"stop",
"(",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | CallTipWidget.paintEvent | Reimplemented to paint the background panel. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py | def paintEvent(self, event):
""" Reimplemented to paint the background panel.
"""
painter = QtGui.QStylePainter(self)
option = QtGui.QStyleOptionFrame()
option.initFrom(self)
painter.drawPrimitive(QtGui.QStyle.PE_PanelTipLabel, option)
painter.end()
super... | def paintEvent(self, event):
""" Reimplemented to paint the background panel.
"""
painter = QtGui.QStylePainter(self)
option = QtGui.QStyleOptionFrame()
option.initFrom(self)
painter.drawPrimitive(QtGui.QStyle.PE_PanelTipLabel, option)
painter.end()
super... | [
"Reimplemented",
"to",
"paint",
"the",
"background",
"panel",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py#L98-L107 | [
"def",
"paintEvent",
"(",
"self",
",",
"event",
")",
":",
"painter",
"=",
"QtGui",
".",
"QStylePainter",
"(",
"self",
")",
"option",
"=",
"QtGui",
".",
"QStyleOptionFrame",
"(",
")",
"option",
".",
"initFrom",
"(",
"self",
")",
"painter",
".",
"drawPrimi... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | CallTipWidget.show_call_info | Attempts to show the specified call line and docstring at the
current cursor location. The docstring is possibly truncated for
length. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py | def show_call_info(self, call_line=None, doc=None, maxlines=20):
""" Attempts to show the specified call line and docstring at the
current cursor location. The docstring is possibly truncated for
length.
"""
if doc:
match = re.match("(?:[^\n]*\n){%i}" % maxlin... | def show_call_info(self, call_line=None, doc=None, maxlines=20):
""" Attempts to show the specified call line and docstring at the
current cursor location. The docstring is possibly truncated for
length.
"""
if doc:
match = re.match("(?:[^\n]*\n){%i}" % maxlin... | [
"Attempts",
"to",
"show",
"the",
"specified",
"call",
"line",
"and",
"docstring",
"at",
"the",
"current",
"cursor",
"location",
".",
"The",
"docstring",
"is",
"possibly",
"truncated",
"for",
"length",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py#L126-L140 | [
"def",
"show_call_info",
"(",
"self",
",",
"call_line",
"=",
"None",
",",
"doc",
"=",
"None",
",",
"maxlines",
"=",
"20",
")",
":",
"if",
"doc",
":",
"match",
"=",
"re",
".",
"match",
"(",
"\"(?:[^\\n]*\\n){%i}\"",
"%",
"maxlines",
",",
"doc",
")",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | CallTipWidget.show_tip | Attempts to show the specified tip at the current cursor location. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py | def show_tip(self, tip):
""" Attempts to show the specified tip at the current cursor location.
"""
# Attempt to find the cursor position at which to show the call tip.
text_edit = self._text_edit
document = text_edit.document()
cursor = text_edit.textCursor()
sea... | def show_tip(self, tip):
""" Attempts to show the specified tip at the current cursor location.
"""
# Attempt to find the cursor position at which to show the call tip.
text_edit = self._text_edit
document = text_edit.document()
cursor = text_edit.textCursor()
sea... | [
"Attempts",
"to",
"show",
"the",
"specified",
"tip",
"at",
"the",
"current",
"cursor",
"location",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py#L142-L205 | [
"def",
"show_tip",
"(",
"self",
",",
"tip",
")",
":",
"# Attempt to find the cursor position at which to show the call tip.",
"text_edit",
"=",
"self",
".",
"_text_edit",
"document",
"=",
"text_edit",
".",
"document",
"(",
")",
"cursor",
"=",
"text_edit",
".",
"text... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | CallTipWidget._find_parenthesis | If 'forward' is True (resp. False), proceed forwards
(resp. backwards) through the line that contains 'position' until an
unmatched closing (resp. opening) parenthesis is found. Returns a
tuple containing the position of this parenthesis (or -1 if it is
not found) and the... | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py | def _find_parenthesis(self, position, forward=True):
""" If 'forward' is True (resp. False), proceed forwards
(resp. backwards) through the line that contains 'position' until an
unmatched closing (resp. opening) parenthesis is found. Returns a
tuple containing the position o... | def _find_parenthesis(self, position, forward=True):
""" If 'forward' is True (resp. False), proceed forwards
(resp. backwards) through the line that contains 'position' until an
unmatched closing (resp. opening) parenthesis is found. Returns a
tuple containing the position o... | [
"If",
"forward",
"is",
"True",
"(",
"resp",
".",
"False",
")",
"proceed",
"forwards",
"(",
"resp",
".",
"backwards",
")",
"through",
"the",
"line",
"that",
"contains",
"position",
"until",
"an",
"unmatched",
"closing",
"(",
"resp",
".",
"opening",
")",
"... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py#L211-L238 | [
"def",
"_find_parenthesis",
"(",
"self",
",",
"position",
",",
"forward",
"=",
"True",
")",
":",
"commas",
"=",
"depth",
"=",
"0",
"document",
"=",
"self",
".",
"_text_edit",
".",
"document",
"(",
")",
"char",
"=",
"document",
".",
"characterAt",
"(",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | CallTipWidget._leave_event_hide | Hides the tooltip after some time has passed (assuming the cursor is
not over the tooltip). | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py | def _leave_event_hide(self):
""" Hides the tooltip after some time has passed (assuming the cursor is
not over the tooltip).
"""
if (not self._hide_timer.isActive() and
# If Enter events always came after Leave events, we wouldn't need
# this check. But on Mac... | def _leave_event_hide(self):
""" Hides the tooltip after some time has passed (assuming the cursor is
not over the tooltip).
"""
if (not self._hide_timer.isActive() and
# If Enter events always came after Leave events, we wouldn't need
# this check. But on Mac... | [
"Hides",
"the",
"tooltip",
"after",
"some",
"time",
"has",
"passed",
"(",
"assuming",
"the",
"cursor",
"is",
"not",
"over",
"the",
"tooltip",
")",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py#L240-L249 | [
"def",
"_leave_event_hide",
"(",
"self",
")",
":",
"if",
"(",
"not",
"self",
".",
"_hide_timer",
".",
"isActive",
"(",
")",
"and",
"# If Enter events always came after Leave events, we wouldn't need",
"# this check. But on Mac OS, it sometimes happens the other way",
"# around ... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | CallTipWidget._cursor_position_changed | Updates the tip based on user cursor movement. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py | def _cursor_position_changed(self):
""" Updates the tip based on user cursor movement.
"""
cursor = self._text_edit.textCursor()
if cursor.position() <= self._start_position:
self.hide()
else:
position, commas = self._find_parenthesis(self._start_position ... | def _cursor_position_changed(self):
""" Updates the tip based on user cursor movement.
"""
cursor = self._text_edit.textCursor()
if cursor.position() <= self._start_position:
self.hide()
else:
position, commas = self._find_parenthesis(self._start_position ... | [
"Updates",
"the",
"tip",
"based",
"on",
"user",
"cursor",
"movement",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py#L253-L262 | [
"def",
"_cursor_position_changed",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"_text_edit",
".",
"textCursor",
"(",
")",
"if",
"cursor",
".",
"position",
"(",
")",
"<=",
"self",
".",
"_start_position",
":",
"self",
".",
"hide",
"(",
")",
"else",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | proxied_attribute | Create a property that proxies attribute ``proxied_attr`` through
the local attribute ``local_attr``. | environment/lib/python2.7/site-packages/nose/proxy.py | def proxied_attribute(local_attr, proxied_attr, doc):
"""Create a property that proxies attribute ``proxied_attr`` through
the local attribute ``local_attr``.
"""
def fget(self):
return getattr(getattr(self, local_attr), proxied_attr)
def fset(self, value):
setattr(getattr(self, loca... | def proxied_attribute(local_attr, proxied_attr, doc):
"""Create a property that proxies attribute ``proxied_attr`` through
the local attribute ``local_attr``.
"""
def fget(self):
return getattr(getattr(self, local_attr), proxied_attr)
def fset(self, value):
setattr(getattr(self, loca... | [
"Create",
"a",
"property",
"that",
"proxies",
"attribute",
"proxied_attr",
"through",
"the",
"local",
"attribute",
"local_attr",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/proxy.py#L25-L35 | [
"def",
"proxied_attribute",
"(",
"local_attr",
",",
"proxied_attr",
",",
"doc",
")",
":",
"def",
"fget",
"(",
"self",
")",
":",
"return",
"getattr",
"(",
"getattr",
"(",
"self",
",",
"local_attr",
")",
",",
"proxied_attr",
")",
"def",
"fset",
"(",
"self"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | canonicalize_path | Canonicalizes a path relative to a given working directory. That
is, the path, if not absolute, is interpreted relative to the
working directory, then converted to absolute form.
:param cwd: The working directory.
:param path: The path to canonicalize.
:returns: The absolute path. | timid/utils.py | def canonicalize_path(cwd, path):
"""
Canonicalizes a path relative to a given working directory. That
is, the path, if not absolute, is interpreted relative to the
working directory, then converted to absolute form.
:param cwd: The working directory.
:param path: The path to canonicalize.
... | def canonicalize_path(cwd, path):
"""
Canonicalizes a path relative to a given working directory. That
is, the path, if not absolute, is interpreted relative to the
working directory, then converted to absolute form.
:param cwd: The working directory.
:param path: The path to canonicalize.
... | [
"Canonicalizes",
"a",
"path",
"relative",
"to",
"a",
"given",
"working",
"directory",
".",
"That",
"is",
"the",
"path",
"if",
"not",
"absolute",
"is",
"interpreted",
"relative",
"to",
"the",
"working",
"directory",
"then",
"converted",
"to",
"absolute",
"form"... | rackerlabs/timid | python | https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/utils.py#L28-L43 | [
"def",
"canonicalize_path",
"(",
"cwd",
",",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cwd",
",",
"path",
")",
"return",
"os",
".",
"path",
".",
"ab... | b1c6aa159ab380a033740f4aa392cf0d125e0ac6 |
test | schema_validate | Schema validation helper. Performs JSONSchema validation. If a
schema validation error is encountered, an exception of the
designated class is raised with the validation error message
appropriately simplified and passed as the sole positional
argument.
:param instance: The object to schema valida... | timid/utils.py | def schema_validate(instance, schema, exc_class, *prefix, **kwargs):
"""
Schema validation helper. Performs JSONSchema validation. If a
schema validation error is encountered, an exception of the
designated class is raised with the validation error message
appropriately simplified and passed as th... | def schema_validate(instance, schema, exc_class, *prefix, **kwargs):
"""
Schema validation helper. Performs JSONSchema validation. If a
schema validation error is encountered, an exception of the
designated class is raised with the validation error message
appropriately simplified and passed as th... | [
"Schema",
"validation",
"helper",
".",
"Performs",
"JSONSchema",
"validation",
".",
"If",
"a",
"schema",
"validation",
"error",
"is",
"encountered",
"an",
"exception",
"of",
"the",
"designated",
"class",
"is",
"raised",
"with",
"the",
"validation",
"error",
"mes... | rackerlabs/timid | python | https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/utils.py#L285-L316 | [
"def",
"schema_validate",
"(",
"instance",
",",
"schema",
",",
"exc_class",
",",
"*",
"prefix",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"# Do the validation",
"jsonschema",
".",
"validate",
"(",
"instance",
",",
"schema",
")",
"except",
"jsonschema",
... | b1c6aa159ab380a033740f4aa392cf0d125e0ac6 |
test | iter_prio_dict | Iterate over a priority dictionary. A priority dictionary is a
dictionary keyed by integer priority, with the values being lists
of objects. This generator will iterate over the dictionary in
priority order (from lowest integer value to highest integer
value), yielding each object in the lists in turn... | timid/utils.py | def iter_prio_dict(prio_dict):
"""
Iterate over a priority dictionary. A priority dictionary is a
dictionary keyed by integer priority, with the values being lists
of objects. This generator will iterate over the dictionary in
priority order (from lowest integer value to highest integer
value)... | def iter_prio_dict(prio_dict):
"""
Iterate over a priority dictionary. A priority dictionary is a
dictionary keyed by integer priority, with the values being lists
of objects. This generator will iterate over the dictionary in
priority order (from lowest integer value to highest integer
value)... | [
"Iterate",
"over",
"a",
"priority",
"dictionary",
".",
"A",
"priority",
"dictionary",
"is",
"a",
"dictionary",
"keyed",
"by",
"integer",
"priority",
"with",
"the",
"values",
"being",
"lists",
"of",
"objects",
".",
"This",
"generator",
"will",
"iterate",
"over"... | rackerlabs/timid | python | https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/utils.py#L319-L336 | [
"def",
"iter_prio_dict",
"(",
"prio_dict",
")",
":",
"for",
"_prio",
",",
"objs",
"in",
"sorted",
"(",
"prio_dict",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"0",
"]",
")",
":",
"for",
"obj",
"in",
"objs",
":",
"yield... | b1c6aa159ab380a033740f4aa392cf0d125e0ac6 |
test | SensitiveDict.masked | Retrieve a read-only subordinate mapping. All values are
stringified, and sensitive values are masked. The subordinate
mapping implements the context manager protocol for
convenience. | timid/utils.py | def masked(self):
"""
Retrieve a read-only subordinate mapping. All values are
stringified, and sensitive values are masked. The subordinate
mapping implements the context manager protocol for
convenience.
"""
if self._masked is None:
self._masked =... | def masked(self):
"""
Retrieve a read-only subordinate mapping. All values are
stringified, and sensitive values are masked. The subordinate
mapping implements the context manager protocol for
convenience.
"""
if self._masked is None:
self._masked =... | [
"Retrieve",
"a",
"read",
"-",
"only",
"subordinate",
"mapping",
".",
"All",
"values",
"are",
"stringified",
"and",
"sensitive",
"values",
"are",
"masked",
".",
"The",
"subordinate",
"mapping",
"implements",
"the",
"context",
"manager",
"protocol",
"for",
"conven... | rackerlabs/timid | python | https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/utils.py#L157-L168 | [
"def",
"masked",
"(",
"self",
")",
":",
"if",
"self",
".",
"_masked",
"is",
"None",
":",
"self",
".",
"_masked",
"=",
"MaskedDict",
"(",
"self",
")",
"return",
"self",
".",
"_masked"
] | b1c6aa159ab380a033740f4aa392cf0d125e0ac6 |
test | read | Build a file path from *paths* and return the contents. | setup.py | def read(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as file_handler:
return file_handler.read() | def read(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as file_handler:
return file_handler.read() | [
"Build",
"a",
"file",
"path",
"from",
"*",
"paths",
"*",
"and",
"return",
"the",
"contents",
"."
] | bkosciow/python_iot-1 | python | https://github.com/bkosciow/python_iot-1/blob/32880760e0d218a686ebdb0b6ee3ce07e5cbf018/setup.py#L9-L12 | [
"def",
"read",
"(",
"*",
"paths",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"*",
"paths",
")",
",",
"'r'",
")",
"as",
"file_handler",
":",
"return",
"file_handler",
".",
"read",
"(",
")"
] | 32880760e0d218a686ebdb0b6ee3ce07e5cbf018 |
test | virtualenv_no_global | Return True if in a venv and no system site packages. | environment/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/locations.py | def virtualenv_no_global():
"""
Return True if in a venv and no system site packages.
"""
#this mirrors the logic in virtualenv.py for locating the no-global-site-packages.txt file
site_mod_dir = os.path.dirname(os.path.abspath(site.__file__))
no_global_file = os.path.join(site_mod_dir, 'no-glob... | def virtualenv_no_global():
"""
Return True if in a venv and no system site packages.
"""
#this mirrors the logic in virtualenv.py for locating the no-global-site-packages.txt file
site_mod_dir = os.path.dirname(os.path.abspath(site.__file__))
no_global_file = os.path.join(site_mod_dir, 'no-glob... | [
"Return",
"True",
"if",
"in",
"a",
"venv",
"and",
"no",
"system",
"site",
"packages",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/locations.py#L18-L26 | [
"def",
"virtualenv_no_global",
"(",
")",
":",
"#this mirrors the logic in virtualenv.py for locating the no-global-site-packages.txt file",
"site_mod_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"site",
".",
"__file__",
")",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | pwordfreq | Parallel word frequency counter.
view - An IPython DirectView
fnames - The filenames containing the split data. | environment/share/doc/ipython/examples/parallel/davinci/pwordfreq.py | def pwordfreq(view, fnames):
"""Parallel word frequency counter.
view - An IPython DirectView
fnames - The filenames containing the split data.
"""
assert len(fnames) == len(view.targets)
view.scatter('fname', fnames, flatten=True)
ar = view.apply(wordfreq, Reference('fname'))
freqs... | def pwordfreq(view, fnames):
"""Parallel word frequency counter.
view - An IPython DirectView
fnames - The filenames containing the split data.
"""
assert len(fnames) == len(view.targets)
view.scatter('fname', fnames, flatten=True)
ar = view.apply(wordfreq, Reference('fname'))
freqs... | [
"Parallel",
"word",
"frequency",
"counter",
".",
"view",
"-",
"An",
"IPython",
"DirectView",
"fnames",
"-",
"The",
"filenames",
"containing",
"the",
"split",
"data",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/davinci/pwordfreq.py#L20-L37 | [
"def",
"pwordfreq",
"(",
"view",
",",
"fnames",
")",
":",
"assert",
"len",
"(",
"fnames",
")",
"==",
"len",
"(",
"view",
".",
"targets",
")",
"view",
".",
"scatter",
"(",
"'fname'",
",",
"fnames",
",",
"flatten",
"=",
"True",
")",
"ar",
"=",
"view"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | view_decorator | Convert a function based decorator into a class based decorator usable
on class based Views.
Can't subclass the `View` as it breaks inheritance (super in particular),
so we monkey-patch instead.
Based on http://stackoverflow.com/a/8429311 | django_libretto/decorators.py | def view_decorator(function_decorator):
"""Convert a function based decorator into a class based decorator usable
on class based Views.
Can't subclass the `View` as it breaks inheritance (super in particular),
so we monkey-patch instead.
Based on http://stackoverflow.com/a/8429311
"""
def simple_decorator(Vie... | def view_decorator(function_decorator):
"""Convert a function based decorator into a class based decorator usable
on class based Views.
Can't subclass the `View` as it breaks inheritance (super in particular),
so we monkey-patch instead.
Based on http://stackoverflow.com/a/8429311
"""
def simple_decorator(Vie... | [
"Convert",
"a",
"function",
"based",
"decorator",
"into",
"a",
"class",
"based",
"decorator",
"usable",
"on",
"class",
"based",
"Views",
"."
] | ze-phyr-us/django-libretto | python | https://github.com/ze-phyr-us/django-libretto/blob/b19d8aa21b9579ee91e81967a44d1c40f5588b17/django_libretto/decorators.py#L5-L19 | [
"def",
"view_decorator",
"(",
"function_decorator",
")",
":",
"def",
"simple_decorator",
"(",
"View",
")",
":",
"View",
".",
"dispatch",
"=",
"method_decorator",
"(",
"function_decorator",
")",
"(",
"View",
".",
"dispatch",
")",
"return",
"View",
"return",
"si... | b19d8aa21b9579ee91e81967a44d1c40f5588b17 |
test | default_aliases | Return list of shell aliases to auto-define. | environment/lib/python2.7/site-packages/IPython/core/alias.py | def default_aliases():
"""Return list of shell aliases to auto-define.
"""
# Note: the aliases defined here should be safe to use on a kernel
# regardless of what frontend it is attached to. Frontends that use a
# kernel in-process can define additional aliases that will only work in
# their ca... | def default_aliases():
"""Return list of shell aliases to auto-define.
"""
# Note: the aliases defined here should be safe to use on a kernel
# regardless of what frontend it is attached to. Frontends that use a
# kernel in-process can define additional aliases that will only work in
# their ca... | [
"Return",
"list",
"of",
"shell",
"aliases",
"to",
"auto",
"-",
"define",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/alias.py#L43-L98 | [
"def",
"default_aliases",
"(",
")",
":",
"# Note: the aliases defined here should be safe to use on a kernel",
"# regardless of what frontend it is attached to. Frontends that use a",
"# kernel in-process can define additional aliases that will only work in",
"# their case. For example, things lik... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AliasManager.soft_define_alias | Define an alias, but don't raise on an AliasError. | environment/lib/python2.7/site-packages/IPython/core/alias.py | def soft_define_alias(self, name, cmd):
"""Define an alias, but don't raise on an AliasError."""
try:
self.define_alias(name, cmd)
except AliasError, e:
error("Invalid alias: %s" % e) | def soft_define_alias(self, name, cmd):
"""Define an alias, but don't raise on an AliasError."""
try:
self.define_alias(name, cmd)
except AliasError, e:
error("Invalid alias: %s" % e) | [
"Define",
"an",
"alias",
"but",
"don",
"t",
"raise",
"on",
"an",
"AliasError",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/alias.py#L150-L155 | [
"def",
"soft_define_alias",
"(",
"self",
",",
"name",
",",
"cmd",
")",
":",
"try",
":",
"self",
".",
"define_alias",
"(",
"name",
",",
"cmd",
")",
"except",
"AliasError",
",",
"e",
":",
"error",
"(",
"\"Invalid alias: %s\"",
"%",
"e",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AliasManager.define_alias | Define a new alias after validating it.
This will raise an :exc:`AliasError` if there are validation
problems. | environment/lib/python2.7/site-packages/IPython/core/alias.py | def define_alias(self, name, cmd):
"""Define a new alias after validating it.
This will raise an :exc:`AliasError` if there are validation
problems.
"""
nargs = self.validate_alias(name, cmd)
self.alias_table[name] = (nargs, cmd) | def define_alias(self, name, cmd):
"""Define a new alias after validating it.
This will raise an :exc:`AliasError` if there are validation
problems.
"""
nargs = self.validate_alias(name, cmd)
self.alias_table[name] = (nargs, cmd) | [
"Define",
"a",
"new",
"alias",
"after",
"validating",
"it",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/alias.py#L157-L164 | [
"def",
"define_alias",
"(",
"self",
",",
"name",
",",
"cmd",
")",
":",
"nargs",
"=",
"self",
".",
"validate_alias",
"(",
"name",
",",
"cmd",
")",
"self",
".",
"alias_table",
"[",
"name",
"]",
"=",
"(",
"nargs",
",",
"cmd",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AliasManager.validate_alias | Validate an alias and return the its number of arguments. | environment/lib/python2.7/site-packages/IPython/core/alias.py | def validate_alias(self, name, cmd):
"""Validate an alias and return the its number of arguments."""
if name in self.no_alias:
raise InvalidAliasError("The name %s can't be aliased "
"because it is a keyword or builtin." % name)
if not (isinstance(... | def validate_alias(self, name, cmd):
"""Validate an alias and return the its number of arguments."""
if name in self.no_alias:
raise InvalidAliasError("The name %s can't be aliased "
"because it is a keyword or builtin." % name)
if not (isinstance(... | [
"Validate",
"an",
"alias",
"and",
"return",
"the",
"its",
"number",
"of",
"arguments",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/alias.py#L170-L182 | [
"def",
"validate_alias",
"(",
"self",
",",
"name",
",",
"cmd",
")",
":",
"if",
"name",
"in",
"self",
".",
"no_alias",
":",
"raise",
"InvalidAliasError",
"(",
"\"The name %s can't be aliased \"",
"\"because it is a keyword or builtin.\"",
"%",
"name",
")",
"if",
"n... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AliasManager.call_alias | Call an alias given its name and the rest of the line. | environment/lib/python2.7/site-packages/IPython/core/alias.py | def call_alias(self, alias, rest=''):
"""Call an alias given its name and the rest of the line."""
cmd = self.transform_alias(alias, rest)
try:
self.shell.system(cmd)
except:
self.shell.showtraceback() | def call_alias(self, alias, rest=''):
"""Call an alias given its name and the rest of the line."""
cmd = self.transform_alias(alias, rest)
try:
self.shell.system(cmd)
except:
self.shell.showtraceback() | [
"Call",
"an",
"alias",
"given",
"its",
"name",
"and",
"the",
"rest",
"of",
"the",
"line",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/alias.py#L184-L190 | [
"def",
"call_alias",
"(",
"self",
",",
"alias",
",",
"rest",
"=",
"''",
")",
":",
"cmd",
"=",
"self",
".",
"transform_alias",
"(",
"alias",
",",
"rest",
")",
"try",
":",
"self",
".",
"shell",
".",
"system",
"(",
"cmd",
")",
"except",
":",
"self",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AliasManager.transform_alias | Transform alias to system command string. | environment/lib/python2.7/site-packages/IPython/core/alias.py | def transform_alias(self, alias,rest=''):
"""Transform alias to system command string."""
nargs, cmd = self.alias_table[alias]
if ' ' in cmd and os.path.isfile(cmd):
cmd = '"%s"' % cmd
# Expand the %l special to be the user's input line
if cmd.find('%l') >= 0:
... | def transform_alias(self, alias,rest=''):
"""Transform alias to system command string."""
nargs, cmd = self.alias_table[alias]
if ' ' in cmd and os.path.isfile(cmd):
cmd = '"%s"' % cmd
# Expand the %l special to be the user's input line
if cmd.find('%l') >= 0:
... | [
"Transform",
"alias",
"to",
"system",
"command",
"string",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/alias.py#L192-L213 | [
"def",
"transform_alias",
"(",
"self",
",",
"alias",
",",
"rest",
"=",
"''",
")",
":",
"nargs",
",",
"cmd",
"=",
"self",
".",
"alias_table",
"[",
"alias",
"]",
"if",
"' '",
"in",
"cmd",
"and",
"os",
".",
"path",
".",
"isfile",
"(",
"cmd",
")",
":... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AliasManager.expand_alias | Expand an alias in the command line
Returns the provided command line, possibly with the first word
(command) translated according to alias expansion rules.
[ipython]|16> _ip.expand_aliases("np myfile.txt")
<16> 'q:/opt/np/notepad++.exe myfile.txt' | environment/lib/python2.7/site-packages/IPython/core/alias.py | def expand_alias(self, line):
""" Expand an alias in the command line
Returns the provided command line, possibly with the first word
(command) translated according to alias expansion rules.
[ipython]|16> _ip.expand_aliases("np myfile.txt")
<16> 'q:/opt/np/notepad++.ex... | def expand_alias(self, line):
""" Expand an alias in the command line
Returns the provided command line, possibly with the first word
(command) translated according to alias expansion rules.
[ipython]|16> _ip.expand_aliases("np myfile.txt")
<16> 'q:/opt/np/notepad++.ex... | [
"Expand",
"an",
"alias",
"in",
"the",
"command",
"line"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/alias.py#L215-L227 | [
"def",
"expand_alias",
"(",
"self",
",",
"line",
")",
":",
"pre",
",",
"_",
",",
"fn",
",",
"rest",
"=",
"split_user_input",
"(",
"line",
")",
"res",
"=",
"pre",
"+",
"self",
".",
"expand_aliases",
"(",
"fn",
",",
"rest",
")",
"return",
"res"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AliasManager.expand_aliases | Expand multiple levels of aliases:
if:
alias foo bar /tmp
alias baz foo
then:
baz huhhahhei -> bar /tmp huhhahhei | environment/lib/python2.7/site-packages/IPython/core/alias.py | def expand_aliases(self, fn, rest):
"""Expand multiple levels of aliases:
if:
alias foo bar /tmp
alias baz foo
then:
baz huhhahhei -> bar /tmp huhhahhei
"""
line = fn + " " + rest
done = set()
while 1:
pre,_,fn,rest = split... | def expand_aliases(self, fn, rest):
"""Expand multiple levels of aliases:
if:
alias foo bar /tmp
alias baz foo
then:
baz huhhahhei -> bar /tmp huhhahhei
"""
line = fn + " " + rest
done = set()
while 1:
pre,_,fn,rest = split... | [
"Expand",
"multiple",
"levels",
"of",
"aliases",
":"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/alias.py#L229-L263 | [
"def",
"expand_aliases",
"(",
"self",
",",
"fn",
",",
"rest",
")",
":",
"line",
"=",
"fn",
"+",
"\" \"",
"+",
"rest",
"done",
"=",
"set",
"(",
")",
"while",
"1",
":",
"pre",
",",
"_",
",",
"fn",
",",
"rest",
"=",
"split_user_input",
"(",
"line",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | shquote | Quote an argument for later parsing by shlex.split() | environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/command/alias.py | def shquote(arg):
"""Quote an argument for later parsing by shlex.split()"""
for c in '"', "'", "\\", "#":
if c in arg: return repr(arg)
if arg.split()<>[arg]:
return repr(arg)
return arg | def shquote(arg):
"""Quote an argument for later parsing by shlex.split()"""
for c in '"', "'", "\\", "#":
if c in arg: return repr(arg)
if arg.split()<>[arg]:
return repr(arg)
return arg | [
"Quote",
"an",
"argument",
"for",
"later",
"parsing",
"by",
"shlex",
".",
"split",
"()"
] | 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/alias.py#L8-L14 | [
"def",
"shquote",
"(",
"arg",
")",
":",
"for",
"c",
"in",
"'\"'",
",",
"\"'\"",
",",
"\"\\\\\"",
",",
"\"#\"",
":",
"if",
"c",
"in",
"arg",
":",
"return",
"repr",
"(",
"arg",
")",
"if",
"arg",
".",
"split",
"(",
")",
"<>",
"[",
"arg",
"]",
":... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | autohelp_directive | produces rst from nose help | environment/lib/python2.7/site-packages/nose/sphinx/pluginopts.py | def autohelp_directive(dirname, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
"""produces rst from nose help"""
config = Config(parserClass=OptBucket,
plugins=BuiltinPluginManager())
parser = config.getParser(TestProgram.us... | def autohelp_directive(dirname, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
"""produces rst from nose help"""
config = Config(parserClass=OptBucket,
plugins=BuiltinPluginManager())
parser = config.getParser(TestProgram.us... | [
"produces",
"rst",
"from",
"nose",
"help"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/sphinx/pluginopts.py#L113-L141 | [
"def",
"autohelp_directive",
"(",
"dirname",
",",
"arguments",
",",
"options",
",",
"content",
",",
"lineno",
",",
"content_offset",
",",
"block_text",
",",
"state",
",",
"state_machine",
")",
":",
"config",
"=",
"Config",
"(",
"parserClass",
"=",
"OptBucket",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AnsiCodeProcessor.reset_sgr | Reset graphics attributs to their default values. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py | def reset_sgr(self):
""" Reset graphics attributs to their default values.
"""
self.intensity = 0
self.italic = False
self.bold = False
self.underline = False
self.foreground_color = None
self.background_color = None | def reset_sgr(self):
""" Reset graphics attributs to their default values.
"""
self.intensity = 0
self.italic = False
self.bold = False
self.underline = False
self.foreground_color = None
self.background_color = None | [
"Reset",
"graphics",
"attributs",
"to",
"their",
"default",
"values",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py#L76-L84 | [
"def",
"reset_sgr",
"(",
"self",
")",
":",
"self",
".",
"intensity",
"=",
"0",
"self",
".",
"italic",
"=",
"False",
"self",
".",
"bold",
"=",
"False",
"self",
".",
"underline",
"=",
"False",
"self",
".",
"foreground_color",
"=",
"None",
"self",
".",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AnsiCodeProcessor.split_string | Yields substrings for which the same escape code applies. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py | def split_string(self, string):
""" Yields substrings for which the same escape code applies.
"""
self.actions = []
start = 0
# strings ending with \r are assumed to be ending in \r\n since
# \n is appended to output strings automatically. Accounting
# for that,... | def split_string(self, string):
""" Yields substrings for which the same escape code applies.
"""
self.actions = []
start = 0
# strings ending with \r are assumed to be ending in \r\n since
# \n is appended to output strings automatically. Accounting
# for that,... | [
"Yields",
"substrings",
"for",
"which",
"the",
"same",
"escape",
"code",
"applies",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py#L86-L147 | [
"def",
"split_string",
"(",
"self",
",",
"string",
")",
":",
"self",
".",
"actions",
"=",
"[",
"]",
"start",
"=",
"0",
"# strings ending with \\r are assumed to be ending in \\r\\n since",
"# \\n is appended to output strings automatically. Accounting",
"# for that, here.",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AnsiCodeProcessor.set_csi_code | Set attributes based on CSI (Control Sequence Introducer) code.
Parameters
----------
command : str
The code identifier, i.e. the final character in the sequence.
params : sequence of integers, optional
The parameter codes for the command. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py | def set_csi_code(self, command, params=[]):
""" Set attributes based on CSI (Control Sequence Introducer) code.
Parameters
----------
command : str
The code identifier, i.e. the final character in the sequence.
params : sequence of integers, optional
The... | def set_csi_code(self, command, params=[]):
""" Set attributes based on CSI (Control Sequence Introducer) code.
Parameters
----------
command : str
The code identifier, i.e. the final character in the sequence.
params : sequence of integers, optional
The... | [
"Set",
"attributes",
"based",
"on",
"CSI",
"(",
"Control",
"Sequence",
"Introducer",
")",
"code",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py#L149-L183 | [
"def",
"set_csi_code",
"(",
"self",
",",
"command",
",",
"params",
"=",
"[",
"]",
")",
":",
"if",
"command",
"==",
"'m'",
":",
"# SGR - Select Graphic Rendition",
"if",
"params",
":",
"self",
".",
"set_sgr_code",
"(",
"params",
")",
"else",
":",
"self",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AnsiCodeProcessor.set_osc_code | Set attributes based on OSC (Operating System Command) parameters.
Parameters
----------
params : sequence of str
The parameters for the command. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py | def set_osc_code(self, params):
""" Set attributes based on OSC (Operating System Command) parameters.
Parameters
----------
params : sequence of str
The parameters for the command.
"""
try:
command = int(params.pop(0))
except (IndexError,... | def set_osc_code(self, params):
""" Set attributes based on OSC (Operating System Command) parameters.
Parameters
----------
params : sequence of str
The parameters for the command.
"""
try:
command = int(params.pop(0))
except (IndexError,... | [
"Set",
"attributes",
"based",
"on",
"OSC",
"(",
"Operating",
"System",
"Command",
")",
"parameters",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py#L185-L205 | [
"def",
"set_osc_code",
"(",
"self",
",",
"params",
")",
":",
"try",
":",
"command",
"=",
"int",
"(",
"params",
".",
"pop",
"(",
"0",
")",
")",
"except",
"(",
"IndexError",
",",
"ValueError",
")",
":",
"return",
"if",
"command",
"==",
"4",
":",
"# x... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | AnsiCodeProcessor.set_sgr_code | Set attributes based on SGR (Select Graphic Rendition) codes.
Parameters
----------
params : sequence of ints
A list of SGR codes for one or more SGR commands. Usually this
sequence will have one element per command, although certain
xterm-specific commands r... | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py | def set_sgr_code(self, params):
""" Set attributes based on SGR (Select Graphic Rendition) codes.
Parameters
----------
params : sequence of ints
A list of SGR codes for one or more SGR commands. Usually this
sequence will have one element per command, although c... | def set_sgr_code(self, params):
""" Set attributes based on SGR (Select Graphic Rendition) codes.
Parameters
----------
params : sequence of ints
A list of SGR codes for one or more SGR commands. Usually this
sequence will have one element per command, although c... | [
"Set",
"attributes",
"based",
"on",
"SGR",
"(",
"Select",
"Graphic",
"Rendition",
")",
"codes",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py#L207-L260 | [
"def",
"set_sgr_code",
"(",
"self",
",",
"params",
")",
":",
"# Always consume the first parameter.",
"if",
"not",
"params",
":",
"return",
"code",
"=",
"params",
".",
"pop",
"(",
"0",
")",
"if",
"code",
"==",
"0",
":",
"self",
".",
"reset_sgr",
"(",
")"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | QtAnsiCodeProcessor.get_color | Returns a QColor for a given color code, or None if one cannot be
constructed. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py | def get_color(self, color, intensity=0):
""" Returns a QColor for a given color code, or None if one cannot be
constructed.
"""
if color is None:
return None
# Adjust for intensity, if possible.
if color < 8 and intensity > 0:
color += 8
... | def get_color(self, color, intensity=0):
""" Returns a QColor for a given color code, or None if one cannot be
constructed.
"""
if color is None:
return None
# Adjust for intensity, if possible.
if color < 8 and intensity > 0:
color += 8
... | [
"Returns",
"a",
"QColor",
"for",
"a",
"given",
"color",
"code",
"or",
"None",
"if",
"one",
"cannot",
"be",
"constructed",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py#L309-L331 | [
"def",
"get_color",
"(",
"self",
",",
"color",
",",
"intensity",
"=",
"0",
")",
":",
"if",
"color",
"is",
"None",
":",
"return",
"None",
"# Adjust for intensity, if possible.",
"if",
"color",
"<",
"8",
"and",
"intensity",
">",
"0",
":",
"color",
"+=",
"8... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | QtAnsiCodeProcessor.get_format | Returns a QTextCharFormat that encodes the current style attributes. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py | def get_format(self):
""" Returns a QTextCharFormat that encodes the current style attributes.
"""
format = QtGui.QTextCharFormat()
# Set foreground color
qcolor = self.get_color(self.foreground_color, self.intensity)
if qcolor is not None:
format.setForegrou... | def get_format(self):
""" Returns a QTextCharFormat that encodes the current style attributes.
"""
format = QtGui.QTextCharFormat()
# Set foreground color
qcolor = self.get_color(self.foreground_color, self.intensity)
if qcolor is not None:
format.setForegrou... | [
"Returns",
"a",
"QTextCharFormat",
"that",
"encodes",
"the",
"current",
"style",
"attributes",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py#L333-L356 | [
"def",
"get_format",
"(",
"self",
")",
":",
"format",
"=",
"QtGui",
".",
"QTextCharFormat",
"(",
")",
"# Set foreground color",
"qcolor",
"=",
"self",
".",
"get_color",
"(",
"self",
".",
"foreground_color",
",",
"self",
".",
"intensity",
")",
"if",
"qcolor",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | QtAnsiCodeProcessor.set_background_color | Given a background color (a QColor), attempt to set a color map
that will be aesthetically pleasing. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py | def set_background_color(self, color):
""" Given a background color (a QColor), attempt to set a color map
that will be aesthetically pleasing.
"""
# Set a new default color map.
self.default_color_map = self.darkbg_color_map.copy()
if color.value() >= 127:
... | def set_background_color(self, color):
""" Given a background color (a QColor), attempt to set a color map
that will be aesthetically pleasing.
"""
# Set a new default color map.
self.default_color_map = self.darkbg_color_map.copy()
if color.value() >= 127:
... | [
"Given",
"a",
"background",
"color",
"(",
"a",
"QColor",
")",
"attempt",
"to",
"set",
"a",
"color",
"map",
"that",
"will",
"be",
"aesthetically",
"pleasing",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ansi_code_processor.py#L358-L375 | [
"def",
"set_background_color",
"(",
"self",
",",
"color",
")",
":",
"# Set a new default color map.",
"self",
".",
"default_color_map",
"=",
"self",
".",
"darkbg_color_map",
".",
"copy",
"(",
")",
"if",
"color",
".",
"value",
"(",
")",
">=",
"127",
":",
"# C... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | generate | Generate a one-time jwt with an age in seconds | onetimejwt/__init__.py | def generate(secret, age, **payload):
"""Generate a one-time jwt with an age in seconds"""
jti = str(uuid.uuid1()) # random id
if not payload:
payload = {}
payload['exp'] = int(time.time() + age)
payload['jti'] = jti
return jwt.encode(payload, decode_secret(secret)) | def generate(secret, age, **payload):
"""Generate a one-time jwt with an age in seconds"""
jti = str(uuid.uuid1()) # random id
if not payload:
payload = {}
payload['exp'] = int(time.time() + age)
payload['jti'] = jti
return jwt.encode(payload, decode_secret(secret)) | [
"Generate",
"a",
"one",
"-",
"time",
"jwt",
"with",
"an",
"age",
"in",
"seconds"
] | srevenant/onetimejwt | python | https://github.com/srevenant/onetimejwt/blob/f3ed561253eb4a8e1522c64f59bf64d275e9d315/onetimejwt/__init__.py#L80-L87 | [
"def",
"generate",
"(",
"secret",
",",
"age",
",",
"*",
"*",
"payload",
")",
":",
"jti",
"=",
"str",
"(",
"uuid",
".",
"uuid1",
"(",
")",
")",
"# random id",
"if",
"not",
"payload",
":",
"payload",
"=",
"{",
"}",
"payload",
"[",
"'exp'",
"]",
"="... | f3ed561253eb4a8e1522c64f59bf64d275e9d315 |
test | mutex | use a thread lock on current method, if self.lock is defined | onetimejwt/__init__.py | def mutex(func):
"""use a thread lock on current method, if self.lock is defined"""
def wrapper(*args, **kwargs):
"""Decorator Wrapper"""
lock = args[0].lock
lock.acquire(True)
try:
return func(*args, **kwargs)
except:
raise
finally:
... | def mutex(func):
"""use a thread lock on current method, if self.lock is defined"""
def wrapper(*args, **kwargs):
"""Decorator Wrapper"""
lock = args[0].lock
lock.acquire(True)
try:
return func(*args, **kwargs)
except:
raise
finally:
... | [
"use",
"a",
"thread",
"lock",
"on",
"current",
"method",
"if",
"self",
".",
"lock",
"is",
"defined"
] | srevenant/onetimejwt | python | https://github.com/srevenant/onetimejwt/blob/f3ed561253eb4a8e1522c64f59bf64d275e9d315/onetimejwt/__init__.py#L89-L102 | [
"def",
"mutex",
"(",
"func",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\"\"Decorator Wrapper\"\"\"",
"lock",
"=",
"args",
"[",
"0",
"]",
".",
"lock",
"lock",
".",
"acquire",
"(",
"True",
")",
"try",
":",
"r... | f3ed561253eb4a8e1522c64f59bf64d275e9d315 |
test | Manager._clean | Run by housekeeper thread | onetimejwt/__init__.py | def _clean(self):
"""Run by housekeeper thread"""
now = time.time()
for jwt in self.jwts.keys():
if (now - self.jwts[jwt]) > (self.age * 2):
del self.jwts[jwt] | def _clean(self):
"""Run by housekeeper thread"""
now = time.time()
for jwt in self.jwts.keys():
if (now - self.jwts[jwt]) > (self.age * 2):
del self.jwts[jwt] | [
"Run",
"by",
"housekeeper",
"thread"
] | srevenant/onetimejwt | python | https://github.com/srevenant/onetimejwt/blob/f3ed561253eb4a8e1522c64f59bf64d275e9d315/onetimejwt/__init__.py#L125-L130 | [
"def",
"_clean",
"(",
"self",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"for",
"jwt",
"in",
"self",
".",
"jwts",
".",
"keys",
"(",
")",
":",
"if",
"(",
"now",
"-",
"self",
".",
"jwts",
"[",
"jwt",
"]",
")",
">",
"(",
"self",
".",... | f3ed561253eb4a8e1522c64f59bf64d275e9d315 |
test | Manager.already_used | has this jwt been used? | onetimejwt/__init__.py | def already_used(self, tok):
"""has this jwt been used?"""
if tok in self.jwts:
return True
self.jwts[tok] = time.time()
return False | def already_used(self, tok):
"""has this jwt been used?"""
if tok in self.jwts:
return True
self.jwts[tok] = time.time()
return False | [
"has",
"this",
"jwt",
"been",
"used?"
] | srevenant/onetimejwt | python | https://github.com/srevenant/onetimejwt/blob/f3ed561253eb4a8e1522c64f59bf64d275e9d315/onetimejwt/__init__.py#L133-L138 | [
"def",
"already_used",
"(",
"self",
",",
"tok",
")",
":",
"if",
"tok",
"in",
"self",
".",
"jwts",
":",
"return",
"True",
"self",
".",
"jwts",
"[",
"tok",
"]",
"=",
"time",
".",
"time",
"(",
")",
"return",
"False"
] | f3ed561253eb4a8e1522c64f59bf64d275e9d315 |
test | Manager.valid | is this token valid? | onetimejwt/__init__.py | def valid(self, token):
"""is this token valid?"""
now = time.time()
if 'Bearer ' in token:
token = token[7:]
data = None
for secret in self.secrets:
try:
data = jwt.decode(token, secret)
break
except jwt.Decod... | def valid(self, token):
"""is this token valid?"""
now = time.time()
if 'Bearer ' in token:
token = token[7:]
data = None
for secret in self.secrets:
try:
data = jwt.decode(token, secret)
break
except jwt.Decod... | [
"is",
"this",
"token",
"valid?"
] | srevenant/onetimejwt | python | https://github.com/srevenant/onetimejwt/blob/f3ed561253eb4a8e1522c64f59bf64d275e9d315/onetimejwt/__init__.py#L140-L174 | [
"def",
"valid",
"(",
"self",
",",
"token",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"if",
"'Bearer '",
"in",
"token",
":",
"token",
"=",
"token",
"[",
"7",
":",
"]",
"data",
"=",
"None",
"for",
"secret",
"in",
"self",
".",
"secrets",
... | f3ed561253eb4a8e1522c64f59bf64d275e9d315 |
test | split_lines | split likely multiline text into lists of strings
For file output more friendly to line-based VCS. ``rejoin_lines(nb)`` will
reverse the effects of ``split_lines(nb)``.
Used when writing JSON files. | environment/lib/python2.7/site-packages/IPython/nbformat/v2/rwbase.py | def split_lines(nb):
"""split likely multiline text into lists of strings
For file output more friendly to line-based VCS. ``rejoin_lines(nb)`` will
reverse the effects of ``split_lines(nb)``.
Used when writing JSON files.
"""
for ws in nb.worksheets:
for cell in ws.cells:
... | def split_lines(nb):
"""split likely multiline text into lists of strings
For file output more friendly to line-based VCS. ``rejoin_lines(nb)`` will
reverse the effects of ``split_lines(nb)``.
Used when writing JSON files.
"""
for ws in nb.worksheets:
for cell in ws.cells:
... | [
"split",
"likely",
"multiline",
"text",
"into",
"lists",
"of",
"strings",
"For",
"file",
"output",
"more",
"friendly",
"to",
"line",
"-",
"based",
"VCS",
".",
"rejoin_lines",
"(",
"nb",
")",
"will",
"reverse",
"the",
"effects",
"of",
"split_lines",
"(",
"n... | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/v2/rwbase.py#L75-L98 | [
"def",
"split_lines",
"(",
"nb",
")",
":",
"for",
"ws",
"in",
"nb",
".",
"worksheets",
":",
"for",
"cell",
"in",
"ws",
".",
"cells",
":",
"if",
"cell",
".",
"cell_type",
"==",
"'code'",
":",
"if",
"'input'",
"in",
"cell",
"and",
"isinstance",
"(",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | NotebookWriter.write | Write a notebook to a file like object | environment/lib/python2.7/site-packages/IPython/nbformat/v2/rwbase.py | def write(self, nb, fp, **kwargs):
"""Write a notebook to a file like object"""
return fp.write(self.writes(nb,**kwargs)) | def write(self, nb, fp, **kwargs):
"""Write a notebook to a file like object"""
return fp.write(self.writes(nb,**kwargs)) | [
"Write",
"a",
"notebook",
"to",
"a",
"file",
"like",
"object"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/v2/rwbase.py#L160-L162 | [
"def",
"write",
"(",
"self",
",",
"nb",
",",
"fp",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"fp",
".",
"write",
"(",
"self",
".",
"writes",
"(",
"nb",
",",
"*",
"*",
"kwargs",
")",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | semaphore | use `Semaphore` to keep func access thread-safety.
example:
``` py
@semaphore(3)
def func(): pass
``` | jasily/threads/decorators.py | def semaphore(count: int, bounded: bool=False):
'''
use `Semaphore` to keep func access thread-safety.
example:
``` py
@semaphore(3)
def func(): pass
```
'''
lock_type = threading.BoundedSemaphore if bounded else threading.Semaphore
lock_obj = lock_type(value=count)
retur... | def semaphore(count: int, bounded: bool=False):
'''
use `Semaphore` to keep func access thread-safety.
example:
``` py
@semaphore(3)
def func(): pass
```
'''
lock_type = threading.BoundedSemaphore if bounded else threading.Semaphore
lock_obj = lock_type(value=count)
retur... | [
"use",
"Semaphore",
"to",
"keep",
"func",
"access",
"thread",
"-",
"safety",
"."
] | Jasily/jasily-python | python | https://github.com/Jasily/jasily-python/blob/1c821a120ebbbbc3c5761f5f1e8a73588059242a/jasily/threads/decorators.py#L45-L60 | [
"def",
"semaphore",
"(",
"count",
":",
"int",
",",
"bounded",
":",
"bool",
"=",
"False",
")",
":",
"lock_type",
"=",
"threading",
".",
"BoundedSemaphore",
"if",
"bounded",
"else",
"threading",
".",
"Semaphore",
"lock_obj",
"=",
"lock_type",
"(",
"value",
"... | 1c821a120ebbbbc3c5761f5f1e8a73588059242a |
test | inputhook_glut | Run the pyglet event loop by processing pending events only.
This keeps processing pending events until stdin is ready. After
processing all pending events, a call to time.sleep is inserted. This is
needed, otherwise, CPU usage is at 100%. This sleep time should be tuned
though for best performance. | environment/lib/python2.7/site-packages/IPython/lib/inputhookglut.py | def inputhook_glut():
"""Run the pyglet event loop by processing pending events only.
This keeps processing pending events until stdin is ready. After
processing all pending events, a call to time.sleep is inserted. This is
needed, otherwise, CPU usage is at 100%. This sleep time should be tuned
... | def inputhook_glut():
"""Run the pyglet event loop by processing pending events only.
This keeps processing pending events until stdin is ready. After
processing all pending events, a call to time.sleep is inserted. This is
needed, otherwise, CPU usage is at 100%. This sleep time should be tuned
... | [
"Run",
"the",
"pyglet",
"event",
"loop",
"by",
"processing",
"pending",
"events",
"only",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhookglut.py#L126-L176 | [
"def",
"inputhook_glut",
"(",
")",
":",
"# We need to protect against a user pressing Control-C when IPython is",
"# idle and this is running. We trap KeyboardInterrupt and pass.",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGINT",
",",
"glut_int_handler",
")",
"try",
":",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | commonprefix | Get common prefix for completions
Return the longest common prefix of a list of strings, but with special
treatment of escape characters that might precede commands in IPython,
such as %magic functions. Used in tab completion.
For a more general function, see os.path.commonprefix | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def commonprefix(items):
"""Get common prefix for completions
Return the longest common prefix of a list of strings, but with special
treatment of escape characters that might precede commands in IPython,
such as %magic functions. Used in tab completion.
For a more general function, see os.path.co... | def commonprefix(items):
"""Get common prefix for completions
Return the longest common prefix of a list of strings, but with special
treatment of escape characters that might precede commands in IPython,
such as %magic functions. Used in tab completion.
For a more general function, see os.path.co... | [
"Get",
"common",
"prefix",
"for",
"completions"
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L38-L58 | [
"def",
"commonprefix",
"(",
"items",
")",
":",
"# the last item will always have the least leading % symbol",
"# min / max are first/last in alphabetical order",
"first_match",
"=",
"ESCAPE_RE",
".",
"match",
"(",
"min",
"(",
"items",
")",
")",
"last_match",
"=",
"ESCAPE_RE... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget.eventFilter | Reimplemented to ensure a console-like behavior in the underlying
text widgets. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def eventFilter(self, obj, event):
""" Reimplemented to ensure a console-like behavior in the underlying
text widgets.
"""
etype = event.type()
if etype == QtCore.QEvent.KeyPress:
# Re-map keys for all filtered widgets.
key = event.key()
i... | def eventFilter(self, obj, event):
""" Reimplemented to ensure a console-like behavior in the underlying
text widgets.
"""
etype = event.type()
if etype == QtCore.QEvent.KeyPress:
# Re-map keys for all filtered widgets.
key = event.key()
i... | [
"Reimplemented",
"to",
"ensure",
"a",
"console",
"-",
"like",
"behavior",
"in",
"the",
"underlying",
"text",
"widgets",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L347-L435 | [
"def",
"eventFilter",
"(",
"self",
",",
"obj",
",",
"event",
")",
":",
"etype",
"=",
"event",
".",
"type",
"(",
")",
"if",
"etype",
"==",
"QtCore",
".",
"QEvent",
".",
"KeyPress",
":",
"# Re-map keys for all filtered widgets.",
"key",
"=",
"event",
".",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget.sizeHint | Reimplemented to suggest a size that is 80 characters wide and
25 lines high. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def sizeHint(self):
""" Reimplemented to suggest a size that is 80 characters wide and
25 lines high.
"""
font_metrics = QtGui.QFontMetrics(self.font)
margin = (self._control.frameWidth() +
self._control.document().documentMargin()) * 2
style = self.... | def sizeHint(self):
""" Reimplemented to suggest a size that is 80 characters wide and
25 lines high.
"""
font_metrics = QtGui.QFontMetrics(self.font)
margin = (self._control.frameWidth() +
self._control.document().documentMargin()) * 2
style = self.... | [
"Reimplemented",
"to",
"suggest",
"a",
"size",
"that",
"is",
"80",
"characters",
"wide",
"and",
"25",
"lines",
"high",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L441-L465 | [
"def",
"sizeHint",
"(",
"self",
")",
":",
"font_metrics",
"=",
"QtGui",
".",
"QFontMetrics",
"(",
"self",
".",
"font",
")",
"margin",
"=",
"(",
"self",
".",
"_control",
".",
"frameWidth",
"(",
")",
"+",
"self",
".",
"_control",
".",
"document",
"(",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget.can_cut | Returns whether text can be cut to the clipboard. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def can_cut(self):
""" Returns whether text can be cut to the clipboard.
"""
cursor = self._control.textCursor()
return (cursor.hasSelection() and
self._in_buffer(cursor.anchor()) and
self._in_buffer(cursor.position())) | def can_cut(self):
""" Returns whether text can be cut to the clipboard.
"""
cursor = self._control.textCursor()
return (cursor.hasSelection() and
self._in_buffer(cursor.anchor()) and
self._in_buffer(cursor.position())) | [
"Returns",
"whether",
"text",
"can",
"be",
"cut",
"to",
"the",
"clipboard",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L476-L482 | [
"def",
"can_cut",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"_control",
".",
"textCursor",
"(",
")",
"return",
"(",
"cursor",
".",
"hasSelection",
"(",
")",
"and",
"self",
".",
"_in_buffer",
"(",
"cursor",
".",
"anchor",
"(",
")",
")",
"and"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget.can_paste | Returns whether text can be pasted from the clipboard. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def can_paste(self):
""" Returns whether text can be pasted from the clipboard.
"""
if self._control.textInteractionFlags() & QtCore.Qt.TextEditable:
return bool(QtGui.QApplication.clipboard().text())
return False | def can_paste(self):
""" Returns whether text can be pasted from the clipboard.
"""
if self._control.textInteractionFlags() & QtCore.Qt.TextEditable:
return bool(QtGui.QApplication.clipboard().text())
return False | [
"Returns",
"whether",
"text",
"can",
"be",
"pasted",
"from",
"the",
"clipboard",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L484-L489 | [
"def",
"can_paste",
"(",
"self",
")",
":",
"if",
"self",
".",
"_control",
".",
"textInteractionFlags",
"(",
")",
"&",
"QtCore",
".",
"Qt",
".",
"TextEditable",
":",
"return",
"bool",
"(",
"QtGui",
".",
"QApplication",
".",
"clipboard",
"(",
")",
".",
"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget.clear | Clear the console.
Parameters:
-----------
keep_input : bool, optional (default True)
If set, restores the old input buffer if a new prompt is written. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def clear(self, keep_input=True):
""" Clear the console.
Parameters:
-----------
keep_input : bool, optional (default True)
If set, restores the old input buffer if a new prompt is written.
"""
if self._executing:
self._control.clear()
els... | def clear(self, keep_input=True):
""" Clear the console.
Parameters:
-----------
keep_input : bool, optional (default True)
If set, restores the old input buffer if a new prompt is written.
"""
if self._executing:
self._control.clear()
els... | [
"Clear",
"the",
"console",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L491-L507 | [
"def",
"clear",
"(",
"self",
",",
"keep_input",
"=",
"True",
")",
":",
"if",
"self",
".",
"_executing",
":",
"self",
".",
"_control",
".",
"clear",
"(",
")",
"else",
":",
"if",
"keep_input",
":",
"input_buffer",
"=",
"self",
".",
"input_buffer",
"self"... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget.cut | Copy the currently selected text to the clipboard and delete it
if it's inside the input buffer. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def cut(self):
""" Copy the currently selected text to the clipboard and delete it
if it's inside the input buffer.
"""
self.copy()
if self.can_cut():
self._control.textCursor().removeSelectedText() | def cut(self):
""" Copy the currently selected text to the clipboard and delete it
if it's inside the input buffer.
"""
self.copy()
if self.can_cut():
self._control.textCursor().removeSelectedText() | [
"Copy",
"the",
"currently",
"selected",
"text",
"to",
"the",
"clipboard",
"and",
"delete",
"it",
"if",
"it",
"s",
"inside",
"the",
"input",
"buffer",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L514-L520 | [
"def",
"cut",
"(",
"self",
")",
":",
"self",
".",
"copy",
"(",
")",
"if",
"self",
".",
"can_cut",
"(",
")",
":",
"self",
".",
"_control",
".",
"textCursor",
"(",
")",
".",
"removeSelectedText",
"(",
")"
] | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget.execute | Executes source or the input buffer, possibly prompting for more
input.
Parameters:
-----------
source : str, optional
The source to execute. If not specified, the input buffer will be
used. If specified and 'hidden' is False, the input buffer will be
... | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def execute(self, source=None, hidden=False, interactive=False):
""" Executes source or the input buffer, possibly prompting for more
input.
Parameters:
-----------
source : str, optional
The source to execute. If not specified, the input buffer will be
... | def execute(self, source=None, hidden=False, interactive=False):
""" Executes source or the input buffer, possibly prompting for more
input.
Parameters:
-----------
source : str, optional
The source to execute. If not specified, the input buffer will be
... | [
"Executes",
"source",
"or",
"the",
"input",
"buffer",
"possibly",
"prompting",
"for",
"more",
"input",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L522-L611 | [
"def",
"execute",
"(",
"self",
",",
"source",
"=",
"None",
",",
"hidden",
"=",
"False",
",",
"interactive",
"=",
"False",
")",
":",
"# WARNING: The order in which things happen here is very particular, in",
"# large part because our syntax highlighting is fragile. If you change... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget._get_input_buffer | The text that the user has entered entered at the current prompt.
If the console is currently executing, the text that is executing will
always be returned. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def _get_input_buffer(self, force=False):
""" The text that the user has entered entered at the current prompt.
If the console is currently executing, the text that is executing will
always be returned.
"""
# If we're executing, the input buffer may not even exist anymore due to... | def _get_input_buffer(self, force=False):
""" The text that the user has entered entered at the current prompt.
If the console is currently executing, the text that is executing will
always be returned.
"""
# If we're executing, the input buffer may not even exist anymore due to... | [
"The",
"text",
"that",
"the",
"user",
"has",
"entered",
"entered",
"at",
"the",
"current",
"prompt",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L618-L634 | [
"def",
"_get_input_buffer",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"# If we're executing, the input buffer may not even exist anymore due to",
"# the limit imposed by 'buffer_size'. Therefore, we store it.",
"if",
"self",
".",
"_executing",
"and",
"not",
"force",
":... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget._set_input_buffer | Sets the text in the input buffer.
If the console is currently executing, this call has no *immediate*
effect. When the execution is finished, the input buffer will be updated
appropriately. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def _set_input_buffer(self, string):
""" Sets the text in the input buffer.
If the console is currently executing, this call has no *immediate*
effect. When the execution is finished, the input buffer will be updated
appropriately.
"""
# If we're executing, store the tex... | def _set_input_buffer(self, string):
""" Sets the text in the input buffer.
If the console is currently executing, this call has no *immediate*
effect. When the execution is finished, the input buffer will be updated
appropriately.
"""
# If we're executing, store the tex... | [
"Sets",
"the",
"text",
"in",
"the",
"input",
"buffer",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L636-L657 | [
"def",
"_set_input_buffer",
"(",
"self",
",",
"string",
")",
":",
"# If we're executing, store the text for later.",
"if",
"self",
".",
"_executing",
":",
"self",
".",
"_input_buffer_pending",
"=",
"string",
"return",
"# Remove old text.",
"cursor",
"=",
"self",
".",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget._set_font | Sets the base font for the ConsoleWidget to the specified QFont. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def _set_font(self, font):
""" Sets the base font for the ConsoleWidget to the specified QFont.
"""
font_metrics = QtGui.QFontMetrics(font)
self._control.setTabStopWidth(self.tab_width * font_metrics.width(' '))
self._completion_widget.setFont(font)
self._control.documen... | def _set_font(self, font):
""" Sets the base font for the ConsoleWidget to the specified QFont.
"""
font_metrics = QtGui.QFontMetrics(font)
self._control.setTabStopWidth(self.tab_width * font_metrics.width(' '))
self._completion_widget.setFont(font)
self._control.documen... | [
"Sets",
"the",
"base",
"font",
"for",
"the",
"ConsoleWidget",
"to",
"the",
"specified",
"QFont",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L666-L677 | [
"def",
"_set_font",
"(",
"self",
",",
"font",
")",
":",
"font_metrics",
"=",
"QtGui",
".",
"QFontMetrics",
"(",
"font",
")",
"self",
".",
"_control",
".",
"setTabStopWidth",
"(",
"self",
".",
"tab_width",
"*",
"font_metrics",
".",
"width",
"(",
"' '",
")... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget.paste | Paste the contents of the clipboard into the input region.
Parameters:
-----------
mode : QClipboard::Mode, optional [default QClipboard::Clipboard]
Controls which part of the system clipboard is used. This can be
used to access the selection clipboard in X11 and the Fi... | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def paste(self, mode=QtGui.QClipboard.Clipboard):
""" Paste the contents of the clipboard into the input region.
Parameters:
-----------
mode : QClipboard::Mode, optional [default QClipboard::Clipboard]
Controls which part of the system clipboard is used. This can be
... | def paste(self, mode=QtGui.QClipboard.Clipboard):
""" Paste the contents of the clipboard into the input region.
Parameters:
-----------
mode : QClipboard::Mode, optional [default QClipboard::Clipboard]
Controls which part of the system clipboard is used. This can be
... | [
"Paste",
"the",
"contents",
"of",
"the",
"clipboard",
"into",
"the",
"input",
"region",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L681-L700 | [
"def",
"paste",
"(",
"self",
",",
"mode",
"=",
"QtGui",
".",
"QClipboard",
".",
"Clipboard",
")",
":",
"if",
"self",
".",
"_control",
".",
"textInteractionFlags",
"(",
")",
"&",
"QtCore",
".",
"Qt",
".",
"TextEditable",
":",
"# Make sure the paste is safe.",... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget.print_ | Print the contents of the ConsoleWidget to the specified QPrinter. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def print_(self, printer = None):
""" Print the contents of the ConsoleWidget to the specified QPrinter.
"""
if (not printer):
printer = QtGui.QPrinter()
if(QtGui.QPrintDialog(printer).exec_() != QtGui.QDialog.Accepted):
return
self._control.print_... | def print_(self, printer = None):
""" Print the contents of the ConsoleWidget to the specified QPrinter.
"""
if (not printer):
printer = QtGui.QPrinter()
if(QtGui.QPrintDialog(printer).exec_() != QtGui.QDialog.Accepted):
return
self._control.print_... | [
"Print",
"the",
"contents",
"of",
"the",
"ConsoleWidget",
"to",
"the",
"specified",
"QPrinter",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L702-L709 | [
"def",
"print_",
"(",
"self",
",",
"printer",
"=",
"None",
")",
":",
"if",
"(",
"not",
"printer",
")",
":",
"printer",
"=",
"QtGui",
".",
"QPrinter",
"(",
")",
"if",
"(",
"QtGui",
".",
"QPrintDialog",
"(",
"printer",
")",
".",
"exec_",
"(",
")",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget.prompt_to_top | Moves the prompt to the top of the viewport. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def prompt_to_top(self):
""" Moves the prompt to the top of the viewport.
"""
if not self._executing:
prompt_cursor = self._get_prompt_cursor()
if self._get_cursor().blockNumber() < prompt_cursor.blockNumber():
self._set_cursor(prompt_cursor)
s... | def prompt_to_top(self):
""" Moves the prompt to the top of the viewport.
"""
if not self._executing:
prompt_cursor = self._get_prompt_cursor()
if self._get_cursor().blockNumber() < prompt_cursor.blockNumber():
self._set_cursor(prompt_cursor)
s... | [
"Moves",
"the",
"prompt",
"to",
"the",
"top",
"of",
"the",
"viewport",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L711-L718 | [
"def",
"prompt_to_top",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_executing",
":",
"prompt_cursor",
"=",
"self",
".",
"_get_prompt_cursor",
"(",
")",
"if",
"self",
".",
"_get_cursor",
"(",
")",
".",
"blockNumber",
"(",
")",
"<",
"prompt_cursor",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget.reset_font | Sets the font to the default fixed-width font for this platform. | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def reset_font(self):
""" Sets the font to the default fixed-width font for this platform.
"""
if sys.platform == 'win32':
# Consolas ships with Vista/Win7, fallback to Courier if needed
fallback = 'Courier'
elif sys.platform == 'darwin':
# OSX always ... | def reset_font(self):
""" Sets the font to the default fixed-width font for this platform.
"""
if sys.platform == 'win32':
# Consolas ships with Vista/Win7, fallback to Courier if needed
fallback = 'Courier'
elif sys.platform == 'darwin':
# OSX always ... | [
"Sets",
"the",
"font",
"to",
"the",
"default",
"fixed",
"-",
"width",
"font",
"for",
"this",
"platform",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L726-L744 | [
"def",
"reset_font",
"(",
"self",
")",
":",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"# Consolas ships with Vista/Win7, fallback to Courier if needed",
"fallback",
"=",
"'Courier'",
"elif",
"sys",
".",
"platform",
"==",
"'darwin'",
":",
"# OSX always has Mo... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
test | ConsoleWidget.change_font_size | Change the font size by the specified amount (in points). | environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py | def change_font_size(self, delta):
"""Change the font size by the specified amount (in points).
"""
font = self.font
size = max(font.pointSize() + delta, 1) # minimum 1 point
font.setPointSize(size)
self._set_font(font) | def change_font_size(self, delta):
"""Change the font size by the specified amount (in points).
"""
font = self.font
size = max(font.pointSize() + delta, 1) # minimum 1 point
font.setPointSize(size)
self._set_font(font) | [
"Change",
"the",
"font",
"size",
"by",
"the",
"specified",
"amount",
"(",
"in",
"points",
")",
"."
] | cloud9ers/gurumate | python | https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py#L746-L752 | [
"def",
"change_font_size",
"(",
"self",
",",
"delta",
")",
":",
"font",
"=",
"self",
".",
"font",
"size",
"=",
"max",
"(",
"font",
".",
"pointSize",
"(",
")",
"+",
"delta",
",",
"1",
")",
"# minimum 1 point",
"font",
".",
"setPointSize",
"(",
"size",
... | 075dc74d1ee62a8c6b7a8bf2b271364f01629d1e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.