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
Collector._installation_trace
Called on new threads, installs the real tracer.
virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py
def _installation_trace(self, frame_unused, event_unused, arg_unused): """Called on new threads, installs the real tracer.""" # Remove ourselves as the trace function sys.settrace(None) # Install the real tracer. fn = self._start_tracer() # Invoke the real trace function ...
def _installation_trace(self, frame_unused, event_unused, arg_unused): """Called on new threads, installs the real tracer.""" # Remove ourselves as the trace function sys.settrace(None) # Install the real tracer. fn = self._start_tracer() # Invoke the real trace function ...
[ "Called", "on", "new", "threads", "installs", "the", "real", "tracer", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py#L245-L256
[ "def", "_installation_trace", "(", "self", ",", "frame_unused", ",", "event_unused", ",", "arg_unused", ")", ":", "# Remove ourselves as the trace function", "sys", ".", "settrace", "(", "None", ")", "# Install the real tracer.", "fn", "=", "self", ".", "_start_tracer...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
Collector.start
Start collecting trace information.
virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py
def start(self): """Start collecting trace information.""" if self._collectors: self._collectors[-1].pause() self._collectors.append(self) #print("Started: %r" % self._collectors, file=sys.stderr) # Check to see whether we had a fullcoverage tracer installed. ...
def start(self): """Start collecting trace information.""" if self._collectors: self._collectors[-1].pause() self._collectors.append(self) #print("Started: %r" % self._collectors, file=sys.stderr) # Check to see whether we had a fullcoverage tracer installed. ...
[ "Start", "collecting", "trace", "information", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py#L258-L288
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "_collectors", ":", "self", ".", "_collectors", "[", "-", "1", "]", ".", "pause", "(", ")", "self", ".", "_collectors", ".", "append", "(", "self", ")", "#print(\"Started: %r\" % self._collectors, f...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
Collector.stop
Stop collecting trace information.
virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py
def stop(self): """Stop collecting trace information.""" #print >>sys.stderr, "Stopping: %r" % self._collectors assert self._collectors assert self._collectors[-1] is self self.pause() self.tracers = [] # Remove this Collector from the stack, and resume the one ...
def stop(self): """Stop collecting trace information.""" #print >>sys.stderr, "Stopping: %r" % self._collectors assert self._collectors assert self._collectors[-1] is self self.pause() self.tracers = [] # Remove this Collector from the stack, and resume the one ...
[ "Stop", "collecting", "trace", "information", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py#L290-L303
[ "def", "stop", "(", "self", ")", ":", "#print >>sys.stderr, \"Stopping: %r\" % self._collectors", "assert", "self", ".", "_collectors", "assert", "self", ".", "_collectors", "[", "-", "1", "]", "is", "self", "self", ".", "pause", "(", ")", "self", ".", "tracer...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
Collector.pause
Pause tracing, but be prepared to `resume`.
virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py
def pause(self): """Pause tracing, but be prepared to `resume`.""" for tracer in self.tracers: tracer.stop() stats = tracer.get_stats() if stats: print("\nCoverage.py tracer stats:") for k in sorted(stats.keys()): pr...
def pause(self): """Pause tracing, but be prepared to `resume`.""" for tracer in self.tracers: tracer.stop() stats = tracer.get_stats() if stats: print("\nCoverage.py tracer stats:") for k in sorted(stats.keys()): pr...
[ "Pause", "tracing", "but", "be", "prepared", "to", "resume", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py#L305-L314
[ "def", "pause", "(", "self", ")", ":", "for", "tracer", "in", "self", ".", "tracers", ":", "tracer", ".", "stop", "(", ")", "stats", "=", "tracer", ".", "get_stats", "(", ")", "if", "stats", ":", "print", "(", "\"\\nCoverage.py tracer stats:\"", ")", "...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
Collector.resume
Resume tracing after a `pause`.
virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py
def resume(self): """Resume tracing after a `pause`.""" for tracer in self.tracers: tracer.start() threading.settrace(self._installation_trace)
def resume(self): """Resume tracing after a `pause`.""" for tracer in self.tracers: tracer.start() threading.settrace(self._installation_trace)
[ "Resume", "tracing", "after", "a", "pause", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py#L316-L320
[ "def", "resume", "(", "self", ")", ":", "for", "tracer", "in", "self", ".", "tracers", ":", "tracer", ".", "start", "(", ")", "threading", ".", "settrace", "(", "self", ".", "_installation_trace", ")" ]
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
Collector.get_line_data
Return the line data collected. Data is { filename: { lineno: None, ...}, ...}
virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py
def get_line_data(self): """Return the line data collected. Data is { filename: { lineno: None, ...}, ...} """ if self.branch: # If we were measuring branches, then we have to re-build the dict # to show line data. line_data = {} for f, a...
def get_line_data(self): """Return the line data collected. Data is { filename: { lineno: None, ...}, ...} """ if self.branch: # If we were measuring branches, then we have to re-build the dict # to show line data. line_data = {} for f, a...
[ "Return", "the", "line", "data", "collected", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py#L322-L339
[ "def", "get_line_data", "(", "self", ")", ":", "if", "self", ".", "branch", ":", "# If we were measuring branches, then we have to re-build the dict", "# to show line data.", "line_data", "=", "{", "}", "for", "f", ",", "arcs", "in", "self", ".", "data", ".", "ite...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
new_code_cell
Create a new code cell with input and output
environment/lib/python2.7/site-packages/IPython/nbformat/v1/nbbase.py
def new_code_cell(code=None, prompt_number=None): """Create a new code cell with input and output""" cell = NotebookNode() cell.cell_type = u'code' if code is not None: cell.code = unicode(code) if prompt_number is not None: cell.prompt_number = int(prompt_number) return cell
def new_code_cell(code=None, prompt_number=None): """Create a new code cell with input and output""" cell = NotebookNode() cell.cell_type = u'code' if code is not None: cell.code = unicode(code) if prompt_number is not None: cell.prompt_number = int(prompt_number) return cell
[ "Create", "a", "new", "code", "cell", "with", "input", "and", "output" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/v1/nbbase.py#L44-L52
[ "def", "new_code_cell", "(", "code", "=", "None", ",", "prompt_number", "=", "None", ")", ":", "cell", "=", "NotebookNode", "(", ")", "cell", ".", "cell_type", "=", "u'code'", "if", "code", "is", "not", "None", ":", "cell", ".", "code", "=", "unicode",...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
new_text_cell
Create a new text cell.
environment/lib/python2.7/site-packages/IPython/nbformat/v1/nbbase.py
def new_text_cell(text=None): """Create a new text cell.""" cell = NotebookNode() if text is not None: cell.text = unicode(text) cell.cell_type = u'text' return cell
def new_text_cell(text=None): """Create a new text cell.""" cell = NotebookNode() if text is not None: cell.text = unicode(text) cell.cell_type = u'text' return cell
[ "Create", "a", "new", "text", "cell", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/v1/nbbase.py#L55-L61
[ "def", "new_text_cell", "(", "text", "=", "None", ")", ":", "cell", "=", "NotebookNode", "(", ")", "if", "text", "is", "not", "None", ":", "cell", ".", "text", "=", "unicode", "(", "text", ")", "cell", ".", "cell_type", "=", "u'text'", "return", "cel...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
new_notebook
Create a notebook by name, id and a list of worksheets.
environment/lib/python2.7/site-packages/IPython/nbformat/v1/nbbase.py
def new_notebook(cells=None): """Create a notebook by name, id and a list of worksheets.""" nb = NotebookNode() if cells is not None: nb.cells = cells else: nb.cells = [] return nb
def new_notebook(cells=None): """Create a notebook by name, id and a list of worksheets.""" nb = NotebookNode() if cells is not None: nb.cells = cells else: nb.cells = [] return nb
[ "Create", "a", "notebook", "by", "name", "id", "and", "a", "list", "of", "worksheets", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/v1/nbbase.py#L64-L71
[ "def", "new_notebook", "(", "cells", "=", "None", ")", ":", "nb", "=", "NotebookNode", "(", ")", "if", "cells", "is", "not", "None", ":", "nb", ".", "cells", "=", "cells", "else", ":", "nb", ".", "cells", "=", "[", "]", "return", "nb" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
eq_
Shorthand for 'assert a == b, "%r != %r" % (a, b)
environment/lib/python2.7/site-packages/nose/tools/trivial.py
def eq_(a, b, msg=None): """Shorthand for 'assert a == b, "%r != %r" % (a, b) """ if not a == b: raise AssertionError(msg or "%r != %r" % (a, b))
def eq_(a, b, msg=None): """Shorthand for 'assert a == b, "%r != %r" % (a, b) """ if not a == b: raise AssertionError(msg or "%r != %r" % (a, b))
[ "Shorthand", "for", "assert", "a", "==", "b", "%r", "!", "=", "%r", "%", "(", "a", "b", ")" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/tools/trivial.py#L25-L29
[ "def", "eq_", "(", "a", ",", "b", ",", "msg", "=", "None", ")", ":", "if", "not", "a", "==", "b", ":", "raise", "AssertionError", "(", "msg", "or", "\"%r != %r\"", "%", "(", "a", ",", "b", ")", ")" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
collect_exceptions
check a result dict for errors, and raise CompositeError if any exist. Passthrough otherwise.
environment/lib/python2.7/site-packages/IPython/parallel/error.py
def collect_exceptions(rdict_or_list, method='unspecified'): """check a result dict for errors, and raise CompositeError if any exist. Passthrough otherwise.""" elist = [] if isinstance(rdict_or_list, dict): rlist = rdict_or_list.values() else: rlist = rdict_or_list for r in rlis...
def collect_exceptions(rdict_or_list, method='unspecified'): """check a result dict for errors, and raise CompositeError if any exist. Passthrough otherwise.""" elist = [] if isinstance(rdict_or_list, dict): rlist = rdict_or_list.values() else: rlist = rdict_or_list for r in rlis...
[ "check", "a", "result", "dict", "for", "errors", "and", "raise", "CompositeError", "if", "any", "exist", ".", "Passthrough", "otherwise", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/error.py#L293-L322
[ "def", "collect_exceptions", "(", "rdict_or_list", ",", "method", "=", "'unspecified'", ")", ":", "elist", "=", "[", "]", "if", "isinstance", "(", "rdict_or_list", ",", "dict", ")", ":", "rlist", "=", "rdict_or_list", ".", "values", "(", ")", "else", ":", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
CompositeError.render_traceback
render one or all of my tracebacks to a list of lines
environment/lib/python2.7/site-packages/IPython/parallel/error.py
def render_traceback(self, excid=None): """render one or all of my tracebacks to a list of lines""" lines = [] if excid is None: for (en,ev,etb,ei) in self.elist: lines.append(self._get_engine_str(ei)) lines.extend((etb or 'No traceback available').spl...
def render_traceback(self, excid=None): """render one or all of my tracebacks to a list of lines""" lines = [] if excid is None: for (en,ev,etb,ei) in self.elist: lines.append(self._get_engine_str(ei)) lines.extend((etb or 'No traceback available').spl...
[ "render", "one", "or", "all", "of", "my", "tracebacks", "to", "a", "list", "of", "lines" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/error.py#L262-L279
[ "def", "render_traceback", "(", "self", ",", "excid", "=", "None", ")", ":", "lines", "=", "[", "]", "if", "excid", "is", "None", ":", "for", "(", "en", ",", "ev", ",", "etb", ",", "ei", ")", "in", "self", ".", "elist", ":", "lines", ".", "appe...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
process_startup
Call this at Python startup to perhaps measure coverage. If the environment variable COVERAGE_PROCESS_START is defined, coverage measurement is started. The value of the variable is the config file to use. There are two ways to configure your Python installation to invoke this function when Pytho...
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def process_startup(): """Call this at Python startup to perhaps measure coverage. If the environment variable COVERAGE_PROCESS_START is defined, coverage measurement is started. The value of the variable is the config file to use. There are two ways to configure your Python installation to invok...
def process_startup(): """Call this at Python startup to perhaps measure coverage. If the environment variable COVERAGE_PROCESS_START is defined, coverage measurement is started. The value of the variable is the config file to use. There are two ways to configure your Python installation to invok...
[ "Call", "this", "at", "Python", "startup", "to", "perhaps", "measure", "coverage", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L750-L775
[ "def", "process_startup", "(", ")", ":", "cps", "=", "os", ".", "environ", ".", "get", "(", "\"COVERAGE_PROCESS_START\"", ")", "if", "cps", ":", "cov", "=", "coverage", "(", "config_file", "=", "cps", ",", "auto_data", "=", "True", ")", "cov", ".", "st...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage._canonical_dir
Return the canonical directory of the module or file `morf`.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def _canonical_dir(self, morf): """Return the canonical directory of the module or file `morf`.""" return os.path.split(CodeUnit(morf, self.file_locator).filename)[0]
def _canonical_dir(self, morf): """Return the canonical directory of the module or file `morf`.""" return os.path.split(CodeUnit(morf, self.file_locator).filename)[0]
[ "Return", "the", "canonical", "directory", "of", "the", "module", "or", "file", "morf", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L209-L211
[ "def", "_canonical_dir", "(", "self", ",", "morf", ")", ":", "return", "os", ".", "path", ".", "split", "(", "CodeUnit", "(", "morf", ",", "self", ".", "file_locator", ")", ".", "filename", ")", "[", "0", "]" ]
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage._source_for_file
Return the source file for `filename`.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def _source_for_file(self, filename): """Return the source file for `filename`.""" if not filename.endswith(".py"): if filename[-4:-1] == ".py": filename = filename[:-1] elif filename.endswith("$py.class"): # jython filename = filename[:-9] + ".py"...
def _source_for_file(self, filename): """Return the source file for `filename`.""" if not filename.endswith(".py"): if filename[-4:-1] == ".py": filename = filename[:-1] elif filename.endswith("$py.class"): # jython filename = filename[:-9] + ".py"...
[ "Return", "the", "source", "file", "for", "filename", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L213-L220
[ "def", "_source_for_file", "(", "self", ",", "filename", ")", ":", "if", "not", "filename", ".", "endswith", "(", "\".py\"", ")", ":", "if", "filename", "[", "-", "4", ":", "-", "1", "]", "==", "\".py\"", ":", "filename", "=", "filename", "[", ":", ...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage._should_trace_with_reason
Decide whether to trace execution in `filename`, with a reason. This function is called from the trace function. As each new file name is encountered, this function determines whether it is traced or not. Returns a pair of values: the first indicates whether the file should be traced...
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def _should_trace_with_reason(self, filename, frame): """Decide whether to trace execution in `filename`, with a reason. This function is called from the trace function. As each new file name is encountered, this function determines whether it is traced or not. Returns a pair of value...
def _should_trace_with_reason(self, filename, frame): """Decide whether to trace execution in `filename`, with a reason. This function is called from the trace function. As each new file name is encountered, this function determines whether it is traced or not. Returns a pair of value...
[ "Decide", "whether", "to", "trace", "execution", "in", "filename", "with", "a", "reason", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L222-L288
[ "def", "_should_trace_with_reason", "(", "self", ",", "filename", ",", "frame", ")", ":", "if", "not", "filename", ":", "# Empty string is pretty useless", "return", "None", ",", "\"empty string isn't a filename\"", "if", "filename", ".", "startswith", "(", "'<'", "...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage._should_trace
Decide whether to trace execution in `filename`. Calls `_should_trace_with_reason`, and returns just the decision.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def _should_trace(self, filename, frame): """Decide whether to trace execution in `filename`. Calls `_should_trace_with_reason`, and returns just the decision. """ canonical, reason = self._should_trace_with_reason(filename, frame) if self.debug.should('trace'): if ...
def _should_trace(self, filename, frame): """Decide whether to trace execution in `filename`. Calls `_should_trace_with_reason`, and returns just the decision. """ canonical, reason = self._should_trace_with_reason(filename, frame) if self.debug.should('trace'): if ...
[ "Decide", "whether", "to", "trace", "execution", "in", "filename", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L290-L303
[ "def", "_should_trace", "(", "self", ",", "filename", ",", "frame", ")", ":", "canonical", ",", "reason", "=", "self", ".", "_should_trace_with_reason", "(", "filename", ",", "frame", ")", "if", "self", ".", "debug", ".", "should", "(", "'trace'", ")", "...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage._warn
Use `msg` as a warning.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def _warn(self, msg): """Use `msg` as a warning.""" self._warnings.append(msg) sys.stderr.write("Coverage.py warning: %s\n" % msg)
def _warn(self, msg): """Use `msg` as a warning.""" self._warnings.append(msg) sys.stderr.write("Coverage.py warning: %s\n" % msg)
[ "Use", "msg", "as", "a", "warning", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L305-L308
[ "def", "_warn", "(", "self", ",", "msg", ")", ":", "self", ".", "_warnings", ".", "append", "(", "msg", ")", "sys", ".", "stderr", ".", "write", "(", "\"Coverage.py warning: %s\\n\"", "%", "msg", ")" ]
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage._check_for_packages
Update the source_match matcher with latest imported packages.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def _check_for_packages(self): """Update the source_match matcher with latest imported packages.""" # Our self.source_pkgs attribute is a list of package names we want to # measure. Each time through here, we see if we've imported any of # them yet. If so, we add its file to source_mat...
def _check_for_packages(self): """Update the source_match matcher with latest imported packages.""" # Our self.source_pkgs attribute is a list of package names we want to # measure. Each time through here, we see if we've imported any of # them yet. If so, we add its file to source_mat...
[ "Update", "the", "source_match", "matcher", "with", "latest", "imported", "packages", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L310-L348
[ "def", "_check_for_packages", "(", "self", ")", ":", "# Our self.source_pkgs attribute is a list of package names we want to", "# measure. Each time through here, we see if we've imported any of", "# them yet. If so, we add its file to source_match, and we don't have", "# to look for that packag...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage.start
Start measuring code coverage. Coverage measurement actually occurs in functions called after `start` is invoked. Statements in the same scope as `start` won't be measured. Once you invoke `start`, you must also call `stop` eventually, or your process might not shut down cleanly.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def start(self): """Start measuring code coverage. Coverage measurement actually occurs in functions called after `start` is invoked. Statements in the same scope as `start` won't be measured. Once you invoke `start`, you must also call `stop` eventually, or your process might...
def start(self): """Start measuring code coverage. Coverage measurement actually occurs in functions called after `start` is invoked. Statements in the same scope as `start` won't be measured. Once you invoke `start`, you must also call `stop` eventually, or your process might...
[ "Start", "measuring", "code", "coverage", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L363-L405
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "run_suffix", ":", "# Calling start() means we're running code, so use the run_suffix", "# as the data_suffix when we eventually save the data.", "self", ".", "data_suffix", "=", "self", ".", "run_suffix", "if", "sel...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage._atexit
Clean up on process shutdown.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def _atexit(self): """Clean up on process shutdown.""" if self._started: self.stop() if self.auto_data: self.save()
def _atexit(self): """Clean up on process shutdown.""" if self._started: self.stop() if self.auto_data: self.save()
[ "Clean", "up", "on", "process", "shutdown", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L412-L417
[ "def", "_atexit", "(", "self", ")", ":", "if", "self", ".", "_started", ":", "self", ".", "stop", "(", ")", "if", "self", ".", "auto_data", ":", "self", ".", "save", "(", ")" ]
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage.exclude
Exclude source lines from execution consideration. A number of lists of regular expressions are maintained. Each list selects lines that are treated differently during reporting. `which` determines which list is modified. The "exclude" list selects lines that are not considered execu...
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def exclude(self, regex, which='exclude'): """Exclude source lines from execution consideration. A number of lists of regular expressions are maintained. Each list selects lines that are treated differently during reporting. `which` determines which list is modified. The "exclude" li...
def exclude(self, regex, which='exclude'): """Exclude source lines from execution consideration. A number of lists of regular expressions are maintained. Each list selects lines that are treated differently during reporting. `which` determines which list is modified. The "exclude" li...
[ "Exclude", "source", "lines", "from", "execution", "consideration", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L434-L451
[ "def", "exclude", "(", "self", ",", "regex", ",", "which", "=", "'exclude'", ")", ":", "excl_list", "=", "getattr", "(", "self", ".", "config", ",", "which", "+", "\"_list\"", ")", "excl_list", ".", "append", "(", "regex", ")", "self", ".", "_exclude_r...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage._exclude_regex
Return a compiled regex for the given exclusion list.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def _exclude_regex(self, which): """Return a compiled regex for the given exclusion list.""" if which not in self._exclude_re: excl_list = getattr(self.config, which + "_list") self._exclude_re[which] = join_regex(excl_list) return self._exclude_re[which]
def _exclude_regex(self, which): """Return a compiled regex for the given exclusion list.""" if which not in self._exclude_re: excl_list = getattr(self.config, which + "_list") self._exclude_re[which] = join_regex(excl_list) return self._exclude_re[which]
[ "Return", "a", "compiled", "regex", "for", "the", "given", "exclusion", "list", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L457-L462
[ "def", "_exclude_regex", "(", "self", ",", "which", ")", ":", "if", "which", "not", "in", "self", ".", "_exclude_re", ":", "excl_list", "=", "getattr", "(", "self", ".", "config", ",", "which", "+", "\"_list\"", ")", "self", ".", "_exclude_re", "[", "w...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage.save
Save the collected coverage data to the data file.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def save(self): """Save the collected coverage data to the data file.""" data_suffix = self.data_suffix if data_suffix is True: # If data_suffix was a simple true value, then make a suffix with # plenty of distinguishing information. We do this here in # `sav...
def save(self): """Save the collected coverage data to the data file.""" data_suffix = self.data_suffix if data_suffix is True: # If data_suffix was a simple true value, then make a suffix with # plenty of distinguishing information. We do this here in # `sav...
[ "Save", "the", "collected", "coverage", "data", "to", "the", "data", "file", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L473-L493
[ "def", "save", "(", "self", ")", ":", "data_suffix", "=", "self", ".", "data_suffix", "if", "data_suffix", "is", "True", ":", "# If data_suffix was a simple true value, then make a suffix with", "# plenty of distinguishing information. We do this here in", "# `save()` at the las...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage.combine
Combine together a number of similarly-named coverage data files. All coverage data files whose name starts with `data_file` (from the coverage() constructor) will be read, and combined together into the current measurements.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def combine(self): """Combine together a number of similarly-named coverage data files. All coverage data files whose name starts with `data_file` (from the coverage() constructor) will be read, and combined together into the current measurements. """ aliases = None ...
def combine(self): """Combine together a number of similarly-named coverage data files. All coverage data files whose name starts with `data_file` (from the coverage() constructor) will be read, and combined together into the current measurements. """ aliases = None ...
[ "Combine", "together", "a", "number", "of", "similarly", "-", "named", "coverage", "data", "files", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L495-L510
[ "def", "combine", "(", "self", ")", ":", "aliases", "=", "None", "if", "self", ".", "config", ".", "paths", ":", "aliases", "=", "PathAliases", "(", "self", ".", "file_locator", ")", "for", "paths", "in", "self", ".", "config", ".", "paths", ".", "va...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage._harvest_data
Get the collected data and reset the collector. Also warn about various problems collecting data.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def _harvest_data(self): """Get the collected data and reset the collector. Also warn about various problems collecting data. """ if not self._measured: return self.data.add_line_data(self.collector.get_line_data()) self.data.add_arc_data(self.collector.get...
def _harvest_data(self): """Get the collected data and reset the collector. Also warn about various problems collecting data. """ if not self._measured: return self.data.add_line_data(self.collector.get_line_data()) self.data.add_arc_data(self.collector.get...
[ "Get", "the", "collected", "data", "and", "reset", "the", "collector", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L512-L548
[ "def", "_harvest_data", "(", "self", ")", ":", "if", "not", "self", ".", "_measured", ":", "return", "self", ".", "data", ".", "add_line_data", "(", "self", ".", "collector", ".", "get_line_data", "(", ")", ")", "self", ".", "data", ".", "add_arc_data", ...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage.analysis
Like `analysis2` but doesn't return excluded line numbers.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def analysis(self, morf): """Like `analysis2` but doesn't return excluded line numbers.""" f, s, _, m, mf = self.analysis2(morf) return f, s, m, mf
def analysis(self, morf): """Like `analysis2` but doesn't return excluded line numbers.""" f, s, _, m, mf = self.analysis2(morf) return f, s, m, mf
[ "Like", "analysis2", "but", "doesn", "t", "return", "excluded", "line", "numbers", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L551-L554
[ "def", "analysis", "(", "self", ",", "morf", ")", ":", "f", ",", "s", ",", "_", ",", "m", ",", "mf", "=", "self", ".", "analysis2", "(", "morf", ")", "return", "f", ",", "s", ",", "m", ",", "mf" ]
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage.analysis2
Analyze a module. `morf` is a module or a filename. It will be analyzed to determine its coverage statistics. The return value is a 5-tuple: * The filename for the module. * A list of line numbers of executable statements. * A list of line numbers of excluded statements. ...
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def analysis2(self, morf): """Analyze a module. `morf` is a module or a filename. It will be analyzed to determine its coverage statistics. The return value is a 5-tuple: * The filename for the module. * A list of line numbers of executable statements. * A list of lin...
def analysis2(self, morf): """Analyze a module. `morf` is a module or a filename. It will be analyzed to determine its coverage statistics. The return value is a 5-tuple: * The filename for the module. * A list of line numbers of executable statements. * A list of lin...
[ "Analyze", "a", "module", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L556-L580
[ "def", "analysis2", "(", "self", ",", "morf", ")", ":", "analysis", "=", "self", ".", "_analyze", "(", "morf", ")", "return", "(", "analysis", ".", "filename", ",", "sorted", "(", "analysis", ".", "statements", ")", ",", "sorted", "(", "analysis", ".",...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage._analyze
Analyze a single morf or code unit. Returns an `Analysis` object.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def _analyze(self, it): """Analyze a single morf or code unit. Returns an `Analysis` object. """ self._harvest_data() if not isinstance(it, CodeUnit): it = code_unit_factory(it, self.file_locator)[0] return Analysis(self, it)
def _analyze(self, it): """Analyze a single morf or code unit. Returns an `Analysis` object. """ self._harvest_data() if not isinstance(it, CodeUnit): it = code_unit_factory(it, self.file_locator)[0] return Analysis(self, it)
[ "Analyze", "a", "single", "morf", "or", "code", "unit", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L582-L592
[ "def", "_analyze", "(", "self", ",", "it", ")", ":", "self", ".", "_harvest_data", "(", ")", "if", "not", "isinstance", "(", "it", ",", "CodeUnit", ")", ":", "it", "=", "code_unit_factory", "(", "it", ",", "self", ".", "file_locator", ")", "[", "0", ...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage.report
Write a summary report to `file`. Each module in `morfs` is listed, with counts of statements, executed statements, missing statements, and a list of lines missed. `include` is a list of filename patterns. Modules whose filenames match those patterns will be included in the report. Mo...
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def report(self, morfs=None, show_missing=True, ignore_errors=None, file=None, # pylint: disable=W0622 omit=None, include=None ): """Write a summary report to `file`. Each module in `morfs` is listed, with counts of statements, ex...
def report(self, morfs=None, show_missing=True, ignore_errors=None, file=None, # pylint: disable=W0622 omit=None, include=None ): """Write a summary report to `file`. Each module in `morfs` is listed, with counts of statements, ex...
[ "Write", "a", "summary", "report", "to", "file", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L594-L616
[ "def", "report", "(", "self", ",", "morfs", "=", "None", ",", "show_missing", "=", "True", ",", "ignore_errors", "=", "None", ",", "file", "=", "None", ",", "# pylint: disable=W0622", "omit", "=", "None", ",", "include", "=", "None", ")", ":", "self", ...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage.annotate
Annotate a list of modules. Each module in `morfs` is annotated. The source is written to a new file, named with a ",cover" suffix, with each line prefixed with a marker to indicate the coverage of the line. Covered lines have ">", excluded lines have "-", and missing lines have "!". ...
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def annotate(self, morfs=None, directory=None, ignore_errors=None, omit=None, include=None): """Annotate a list of modules. Each module in `morfs` is annotated. The source is written to a new file, named with a ",cover" suffix, with each line prefixed with a marker ...
def annotate(self, morfs=None, directory=None, ignore_errors=None, omit=None, include=None): """Annotate a list of modules. Each module in `morfs` is annotated. The source is written to a new file, named with a ",cover" suffix, with each line prefixed with a marker ...
[ "Annotate", "a", "list", "of", "modules", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L618-L635
[ "def", "annotate", "(", "self", ",", "morfs", "=", "None", ",", "directory", "=", "None", ",", "ignore_errors", "=", "None", ",", "omit", "=", "None", ",", "include", "=", "None", ")", ":", "self", ".", "_harvest_data", "(", ")", "self", ".", "config...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage.html_report
Generate an HTML report. The HTML is written to `directory`. The file "index.html" is the overview starting point, with links to more detailed pages for individual modules. `extra_css` is a path to a file of other CSS to apply on the page. It will be copied into the HTML direc...
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def html_report(self, morfs=None, directory=None, ignore_errors=None, omit=None, include=None, extra_css=None, title=None): """Generate an HTML report. The HTML is written to `directory`. The file "index.html" is the overview starting point, with links to more detailed page...
def html_report(self, morfs=None, directory=None, ignore_errors=None, omit=None, include=None, extra_css=None, title=None): """Generate an HTML report. The HTML is written to `directory`. The file "index.html" is the overview starting point, with links to more detailed page...
[ "Generate", "an", "HTML", "report", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L637-L662
[ "def", "html_report", "(", "self", ",", "morfs", "=", "None", ",", "directory", "=", "None", ",", "ignore_errors", "=", "None", ",", "omit", "=", "None", ",", "include", "=", "None", ",", "extra_css", "=", "None", ",", "title", "=", "None", ")", ":",...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage.xml_report
Generate an XML report of coverage results. The report is compatible with Cobertura reports. Each module in `morfs` is included in the report. `outfile` is the path to write the file to, "-" will write to stdout. See `coverage.report()` for other arguments. Returns a float, ...
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def xml_report(self, morfs=None, outfile=None, ignore_errors=None, omit=None, include=None): """Generate an XML report of coverage results. The report is compatible with Cobertura reports. Each module in `morfs` is included in the report. `outfile` is the path to w...
def xml_report(self, morfs=None, outfile=None, ignore_errors=None, omit=None, include=None): """Generate an XML report of coverage results. The report is compatible with Cobertura reports. Each module in `morfs` is included in the report. `outfile` is the path to w...
[ "Generate", "an", "XML", "report", "of", "coverage", "results", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L664-L702
[ "def", "xml_report", "(", "self", ",", "morfs", "=", "None", ",", "outfile", "=", "None", ",", "ignore_errors", "=", "None", ",", "omit", "=", "None", ",", "include", "=", "None", ")", ":", "self", ".", "_harvest_data", "(", ")", "self", ".", "config...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
coverage.sysinfo
Return a list of (key, value) pairs showing internal information.
virtualEnvironment/lib/python2.7/site-packages/coverage/control.py
def sysinfo(self): """Return a list of (key, value) pairs showing internal information.""" import coverage as covmod import platform, re try: implementation = platform.python_implementation() except AttributeError: implementation = "unknown" inf...
def sysinfo(self): """Return a list of (key, value) pairs showing internal information.""" import coverage as covmod import platform, re try: implementation = platform.python_implementation() except AttributeError: implementation = "unknown" inf...
[ "Return", "a", "list", "of", "(", "key", "value", ")", "pairs", "showing", "internal", "information", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/control.py#L704-L747
[ "def", "sysinfo", "(", "self", ")", ":", "import", "coverage", "as", "covmod", "import", "platform", ",", "re", "try", ":", "implementation", "=", "platform", ".", "python_implementation", "(", ")", "except", "AttributeError", ":", "implementation", "=", "\"un...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
display
Display a Python object in all frontends. By default all representations will be computed and sent to the frontends. Frontends can decide which representation is used and how. Parameters ---------- objs : tuple of objects The Python objects to display. include : list or tuple, optional...
environment/lib/python2.7/site-packages/IPython/core/display.py
def display(*objs, **kwargs): """Display a Python object in all frontends. By default all representations will be computed and sent to the frontends. Frontends can decide which representation is used and how. Parameters ---------- objs : tuple of objects The Python objects to display. ...
def display(*objs, **kwargs): """Display a Python object in all frontends. By default all representations will be computed and sent to the frontends. Frontends can decide which representation is used and how. Parameters ---------- objs : tuple of objects The Python objects to display. ...
[ "Display", "a", "Python", "object", "in", "all", "frontends", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/display.py#L35-L64
[ "def", "display", "(", "*", "objs", ",", "*", "*", "kwargs", ")", ":", "include", "=", "kwargs", ".", "get", "(", "'include'", ")", "exclude", "=", "kwargs", ".", "get", "(", "'exclude'", ")", "from", "IPython", ".", "core", ".", "interactiveshell", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
display_pretty
Display the pretty (default) representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw text data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before dis...
environment/lib/python2.7/site-packages/IPython/core/display.py
def display_pretty(*objs, **kwargs): """Display the pretty (default) representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw text data to display. raw : bool Are the data objects raw data or Python objects ...
def display_pretty(*objs, **kwargs): """Display the pretty (default) representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw text data to display. raw : bool Are the data objects raw data or Python objects ...
[ "Display", "the", "pretty", "(", "default", ")", "representation", "of", "an", "object", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/display.py#L67-L84
[ "def", "display_pretty", "(", "*", "objs", ",", "*", "*", "kwargs", ")", ":", "raw", "=", "kwargs", ".", "pop", "(", "'raw'", ",", "False", ")", "if", "raw", ":", "for", "obj", "in", "objs", ":", "publish_pretty", "(", "obj", ")", "else", ":", "d...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
display_html
Display the HTML representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw HTML data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [defau...
environment/lib/python2.7/site-packages/IPython/core/display.py
def display_html(*objs, **kwargs): """Display the HTML representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw HTML data to display. raw : bool Are the data objects raw data or Python objects that need to b...
def display_html(*objs, **kwargs): """Display the HTML representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw HTML data to display. raw : bool Are the data objects raw data or Python objects that need to b...
[ "Display", "the", "HTML", "representation", "of", "an", "object", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/display.py#L87-L104
[ "def", "display_html", "(", "*", "objs", ",", "*", "*", "kwargs", ")", ":", "raw", "=", "kwargs", ".", "pop", "(", "'raw'", ",", "False", ")", "if", "raw", ":", "for", "obj", "in", "objs", ":", "publish_html", "(", "obj", ")", "else", ":", "displ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
display_svg
Display the SVG representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw svg data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default...
environment/lib/python2.7/site-packages/IPython/core/display.py
def display_svg(*objs, **kwargs): """Display the SVG representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw svg data to display. raw : bool Are the data objects raw data or Python objects that need to be ...
def display_svg(*objs, **kwargs): """Display the SVG representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw svg data to display. raw : bool Are the data objects raw data or Python objects that need to be ...
[ "Display", "the", "SVG", "representation", "of", "an", "object", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/display.py#L107-L124
[ "def", "display_svg", "(", "*", "objs", ",", "*", "*", "kwargs", ")", ":", "raw", "=", "kwargs", ".", "pop", "(", "'raw'", ",", "False", ")", "if", "raw", ":", "for", "obj", "in", "objs", ":", "publish_svg", "(", "obj", ")", "else", ":", "display...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
display_png
Display the PNG representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw png data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default...
environment/lib/python2.7/site-packages/IPython/core/display.py
def display_png(*objs, **kwargs): """Display the PNG representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw png data to display. raw : bool Are the data objects raw data or Python objects that need to be ...
def display_png(*objs, **kwargs): """Display the PNG representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw png data to display. raw : bool Are the data objects raw data or Python objects that need to be ...
[ "Display", "the", "PNG", "representation", "of", "an", "object", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/display.py#L127-L144
[ "def", "display_png", "(", "*", "objs", ",", "*", "*", "kwargs", ")", ":", "raw", "=", "kwargs", ".", "pop", "(", "'raw'", ",", "False", ")", "if", "raw", ":", "for", "obj", "in", "objs", ":", "publish_png", "(", "obj", ")", "else", ":", "display...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
display_jpeg
Display the JPEG representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw JPEG data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [defau...
environment/lib/python2.7/site-packages/IPython/core/display.py
def display_jpeg(*objs, **kwargs): """Display the JPEG representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw JPEG data to display. raw : bool Are the data objects raw data or Python objects that need to b...
def display_jpeg(*objs, **kwargs): """Display the JPEG representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw JPEG data to display. raw : bool Are the data objects raw data or Python objects that need to b...
[ "Display", "the", "JPEG", "representation", "of", "an", "object", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/display.py#L147-L164
[ "def", "display_jpeg", "(", "*", "objs", ",", "*", "*", "kwargs", ")", ":", "raw", "=", "kwargs", ".", "pop", "(", "'raw'", ",", "False", ")", "if", "raw", ":", "for", "obj", "in", "objs", ":", "publish_jpeg", "(", "obj", ")", "else", ":", "displ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
display_latex
Display the LaTeX representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw latex data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [def...
environment/lib/python2.7/site-packages/IPython/core/display.py
def display_latex(*objs, **kwargs): """Display the LaTeX representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw latex data to display. raw : bool Are the data objects raw data or Python objects that need t...
def display_latex(*objs, **kwargs): """Display the LaTeX representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw latex data to display. raw : bool Are the data objects raw data or Python objects that need t...
[ "Display", "the", "LaTeX", "representation", "of", "an", "object", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/display.py#L167-L184
[ "def", "display_latex", "(", "*", "objs", ",", "*", "*", "kwargs", ")", ":", "raw", "=", "kwargs", ".", "pop", "(", "'raw'", ",", "False", ")", "if", "raw", ":", "for", "obj", "in", "objs", ":", "publish_latex", "(", "obj", ")", "else", ":", "dis...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
display_json
Display the JSON representation of an object. Note that not many frontends support displaying JSON. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw json data to display. raw : bool Are the data objects raw data or Python objec...
environment/lib/python2.7/site-packages/IPython/core/display.py
def display_json(*objs, **kwargs): """Display the JSON representation of an object. Note that not many frontends support displaying JSON. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw json data to display. raw : bool Are...
def display_json(*objs, **kwargs): """Display the JSON representation of an object. Note that not many frontends support displaying JSON. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw json data to display. raw : bool Are...
[ "Display", "the", "JSON", "representation", "of", "an", "object", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/display.py#L187-L206
[ "def", "display_json", "(", "*", "objs", ",", "*", "*", "kwargs", ")", ":", "raw", "=", "kwargs", ".", "pop", "(", "'raw'", ",", "False", ")", "if", "raw", ":", "for", "obj", "in", "objs", ":", "publish_json", "(", "obj", ")", "else", ":", "displ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
display_javascript
Display the Javascript representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw javascript data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before dis...
environment/lib/python2.7/site-packages/IPython/core/display.py
def display_javascript(*objs, **kwargs): """Display the Javascript representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw javascript data to display. raw : bool Are the data objects raw data or Python obje...
def display_javascript(*objs, **kwargs): """Display the Javascript representation of an object. Parameters ---------- objs : tuple of objects The Python objects to display, or if raw=True raw javascript data to display. raw : bool Are the data objects raw data or Python obje...
[ "Display", "the", "Javascript", "representation", "of", "an", "object", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/display.py#L209-L226
[ "def", "display_javascript", "(", "*", "objs", ",", "*", "*", "kwargs", ")", ":", "raw", "=", "kwargs", ".", "pop", "(", "'raw'", ",", "False", ")", "if", "raw", ":", "for", "obj", "in", "objs", ":", "publish_javascript", "(", "obj", ")", "else", "...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
clear_output
Clear the output of the current cell receiving output. Optionally, each of stdout/stderr or other non-stream data (e.g. anything produced by display()) can be excluded from the clear event. By default, everything is cleared. Parameters ---------- stdout : bool [default: True] ...
environment/lib/python2.7/site-packages/IPython/core/display.py
def clear_output(stdout=True, stderr=True, other=True): """Clear the output of the current cell receiving output. Optionally, each of stdout/stderr or other non-stream data (e.g. anything produced by display()) can be excluded from the clear event. By default, everything is cleared. P...
def clear_output(stdout=True, stderr=True, other=True): """Clear the output of the current cell receiving output. Optionally, each of stdout/stderr or other non-stream data (e.g. anything produced by display()) can be excluded from the clear event. By default, everything is cleared. P...
[ "Clear", "the", "output", "of", "the", "current", "cell", "receiving", "output", ".", "Optionally", "each", "of", "stdout", "/", "stderr", "or", "other", "non", "-", "stream", "data", "(", "e", ".", "g", ".", "anything", "produced", "by", "display", "()"...
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/display.py#L503-L533
[ "def", "clear_output", "(", "stdout", "=", "True", ",", "stderr", "=", "True", ",", "other", "=", "True", ")", ":", "from", "IPython", ".", "core", ".", "interactiveshell", "import", "InteractiveShell", "if", "InteractiveShell", ".", "initialized", "(", ")",...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
DisplayObject.reload
Reload the raw data from file or URL.
environment/lib/python2.7/site-packages/IPython/core/display.py
def reload(self): """Reload the raw data from file or URL.""" if self.filename is not None: with open(self.filename, self._read_flags) as f: self.data = f.read() elif self.url is not None: try: import urllib2 response = urll...
def reload(self): """Reload the raw data from file or URL.""" if self.filename is not None: with open(self.filename, self._read_flags) as f: self.data = f.read() elif self.url is not None: try: import urllib2 response = urll...
[ "Reload", "the", "raw", "data", "from", "file", "or", "URL", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/display.py#L267-L288
[ "def", "reload", "(", "self", ")", ":", "if", "self", ".", "filename", "is", "not", "None", ":", "with", "open", "(", "self", ".", "filename", ",", "self", ".", "_read_flags", ")", "as", "f", ":", "self", ".", "data", "=", "f", ".", "read", "(", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
pip_version_check
Check for an update for pip. Limit the frequency of checks to once per week. State is stored either in the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix of the pip script path.
virtualEnvironment/lib/python2.7/site-packages/pip/utils/outdated.py
def pip_version_check(session): """Check for an update for pip. Limit the frequency of checks to once per week. State is stored either in the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix of the pip script path. """ import pip # imported here to prevent circular import...
def pip_version_check(session): """Check for an update for pip. Limit the frequency of checks to once per week. State is stored either in the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix of the pip script path. """ import pip # imported here to prevent circular import...
[ "Check", "for", "an", "update", "for", "pip", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/pip/utils/outdated.py#L99-L149
[ "def", "pip_version_check", "(", "session", ")", ":", "import", "pip", "# imported here to prevent circular imports", "pypi_version", "=", "None", "try", ":", "state", "=", "load_selfcheck_statefile", "(", ")", "current_time", "=", "datetime", ".", "datetime", ".", ...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
_find_cmd
Find the full path to a command using which.
environment/lib/python2.7/site-packages/IPython/utils/_process_posix.py
def _find_cmd(cmd): """Find the full path to a command using which.""" path = sp.Popen(['/usr/bin/env', 'which', cmd], stdout=sp.PIPE, stderr=sp.PIPE).communicate()[0] return py3compat.bytes_to_str(path)
def _find_cmd(cmd): """Find the full path to a command using which.""" path = sp.Popen(['/usr/bin/env', 'which', cmd], stdout=sp.PIPE, stderr=sp.PIPE).communicate()[0] return py3compat.bytes_to_str(path)
[ "Find", "the", "full", "path", "to", "a", "command", "using", "which", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/_process_posix.py#L35-L40
[ "def", "_find_cmd", "(", "cmd", ")", ":", "path", "=", "sp", ".", "Popen", "(", "[", "'/usr/bin/env'", ",", "'which'", ",", "cmd", "]", ",", "stdout", "=", "sp", ".", "PIPE", ",", "stderr", "=", "sp", ".", "PIPE", ")", ".", "communicate", "(", ")...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
ProcessHandler.getoutput_pexpect
Run a command and return its stdout/stderr as a string. Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- output : str A string containing the combination of stdout and stderr from the subprocess, i...
environment/lib/python2.7/site-packages/IPython/utils/_process_posix.py
def getoutput_pexpect(self, cmd): """Run a command and return its stdout/stderr as a string. Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- output : str A string containing the combination of std...
def getoutput_pexpect(self, cmd): """Run a command and return its stdout/stderr as a string. Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- output : str A string containing the combination of std...
[ "Run", "a", "command", "and", "return", "its", "stdout", "/", "stderr", "as", "a", "string", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/_process_posix.py#L98-L117
[ "def", "getoutput_pexpect", "(", "self", ",", "cmd", ")", ":", "try", ":", "return", "pexpect", ".", "run", "(", "self", ".", "sh", ",", "args", "=", "[", "'-c'", ",", "cmd", "]", ")", ".", "replace", "(", "'\\r\\n'", ",", "'\\n'", ")", "except", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
ProcessHandler.system
Execute a command in a subshell. Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- int : child's exitstatus
environment/lib/python2.7/site-packages/IPython/utils/_process_posix.py
def system(self, cmd): """Execute a command in a subshell. Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- int : child's exitstatus """ # Get likely encoding for the output. enc = DE...
def system(self, cmd): """Execute a command in a subshell. Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- int : child's exitstatus """ # Get likely encoding for the output. enc = DE...
[ "Execute", "a", "command", "in", "a", "subshell", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/_process_posix.py#L119-L187
[ "def", "system", "(", "self", ",", "cmd", ")", ":", "# Get likely encoding for the output.", "enc", "=", "DEFAULT_ENCODING", "# Patterns to match on the output, for pexpect. We read input and", "# allow either a short timeout or EOF", "patterns", "=", "[", "pexpect", ".", "TIM...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
forward_read_events
Forward read events from an FD over a socket. This method wraps a file in a socket pair, so it can be polled for read events by select (specifically zmq.eventloop.ioloop)
environment/lib/python2.7/site-packages/IPython/parallel/apps/win32support.py
def forward_read_events(fd, context=None): """Forward read events from an FD over a socket. This method wraps a file in a socket pair, so it can be polled for read events by select (specifically zmq.eventloop.ioloop) """ if context is None: context = zmq.Context.instance() push = contex...
def forward_read_events(fd, context=None): """Forward read events from an FD over a socket. This method wraps a file in a socket pair, so it can be polled for read events by select (specifically zmq.eventloop.ioloop) """ if context is None: context = zmq.Context.instance() push = contex...
[ "Forward", "read", "events", "from", "an", "FD", "over", "a", "socket", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/apps/win32support.py#L53-L69
[ "def", "forward_read_events", "(", "fd", ",", "context", "=", "None", ")", ":", "if", "context", "is", "None", ":", "context", "=", "zmq", ".", "Context", ".", "instance", "(", ")", "push", "=", "context", ".", "socket", "(", "zmq", ".", "PUSH", ")",...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
ForwarderThread.run
Loop through lines in self.fd, and send them over self.sock.
environment/lib/python2.7/site-packages/IPython/parallel/apps/win32support.py
def run(self): """Loop through lines in self.fd, and send them over self.sock.""" line = self.fd.readline() # allow for files opened in unicode mode if isinstance(line, unicode): send = self.sock.send_unicode else: send = self.sock.send while line:...
def run(self): """Loop through lines in self.fd, and send them over self.sock.""" line = self.fd.readline() # allow for files opened in unicode mode if isinstance(line, unicode): send = self.sock.send_unicode else: send = self.sock.send while line:...
[ "Loop", "through", "lines", "in", "self", ".", "fd", "and", "send", "them", "over", "self", ".", "sock", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/apps/win32support.py#L38-L51
[ "def", "run", "(", "self", ")", ":", "line", "=", "self", ".", "fd", ".", "readline", "(", ")", "# allow for files opened in unicode mode", "if", "isinstance", "(", "line", ",", "unicode", ")", ":", "send", "=", "self", ".", "sock", ".", "send_unicode", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
find_launcher_class
Return a launcher for a given clsname and kind. Parameters ========== clsname : str The full name of the launcher class, either with or without the module path, or an abbreviation (MPI, SSH, SGE, PBS, LSF, WindowsHPC). kind : str Either 'EngineSet' or 'Controller'.
environment/lib/python2.7/site-packages/IPython/parallel/apps/ipclusterapp.py
def find_launcher_class(clsname, kind): """Return a launcher for a given clsname and kind. Parameters ========== clsname : str The full name of the launcher class, either with or without the module path, or an abbreviation (MPI, SSH, SGE, PBS, LSF, WindowsHPC). kind : str ...
def find_launcher_class(clsname, kind): """Return a launcher for a given clsname and kind. Parameters ========== clsname : str The full name of the launcher class, either with or without the module path, or an abbreviation (MPI, SSH, SGE, PBS, LSF, WindowsHPC). kind : str ...
[ "Return", "a", "launcher", "for", "a", "given", "clsname", "and", "kind", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/apps/ipclusterapp.py#L112-L132
[ "def", "find_launcher_class", "(", "clsname", ",", "kind", ")", ":", "if", "'.'", "not", "in", "clsname", ":", "# not a module, presume it's the raw name in apps.launcher", "if", "kind", "and", "kind", "not", "in", "clsname", ":", "# doesn't match necessary full class n...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
IPClusterStop.start
Start the app for the stop subcommand.
environment/lib/python2.7/site-packages/IPython/parallel/apps/ipclusterapp.py
def start(self): """Start the app for the stop subcommand.""" try: pid = self.get_pid_from_file() except PIDFileError: self.log.critical( 'Could not read pid file, cluster is probably not running.' ) # Here I exit with a unusual exi...
def start(self): """Start the app for the stop subcommand.""" try: pid = self.get_pid_from_file() except PIDFileError: self.log.critical( 'Could not read pid file, cluster is probably not running.' ) # Here I exit with a unusual exi...
[ "Start", "the", "app", "for", "the", "stop", "subcommand", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/apps/ipclusterapp.py#L186-L226
[ "def", "start", "(", "self", ")", ":", "try", ":", "pid", "=", "self", ".", "get_pid_from_file", "(", ")", "except", "PIDFileError", ":", "self", ".", "log", ".", "critical", "(", "'Could not read pid file, cluster is probably not running.'", ")", "# Here I exit w...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
IPClusterEngines.build_launcher
import and instantiate a Launcher based on importstring
environment/lib/python2.7/site-packages/IPython/parallel/apps/ipclusterapp.py
def build_launcher(self, clsname, kind=None): """import and instantiate a Launcher based on importstring""" try: klass = find_launcher_class(clsname, kind) except (ImportError, KeyError): self.log.fatal("Could not import launcher class: %r"%clsname) self.exit(...
def build_launcher(self, clsname, kind=None): """import and instantiate a Launcher based on importstring""" try: klass = find_launcher_class(clsname, kind) except (ImportError, KeyError): self.log.fatal("Could not import launcher class: %r"%clsname) self.exit(...
[ "import", "and", "instantiate", "a", "Launcher", "based", "on", "importstring" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/apps/ipclusterapp.py#L331-L343
[ "def", "build_launcher", "(", "self", ",", "clsname", ",", "kind", "=", "None", ")", ":", "try", ":", "klass", "=", "find_launcher_class", "(", "clsname", ",", "kind", ")", "except", "(", "ImportError", ",", "KeyError", ")", ":", "self", ".", "log", "....
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
IPClusterEngines.start
Start the app for the engines subcommand.
environment/lib/python2.7/site-packages/IPython/parallel/apps/ipclusterapp.py
def start(self): """Start the app for the engines subcommand.""" self.log.info("IPython cluster: started") # First see if the cluster is already running # Now log and daemonize self.log.info( 'Starting engines with [daemon=%r]' % self.daemonize ) # TO...
def start(self): """Start the app for the engines subcommand.""" self.log.info("IPython cluster: started") # First see if the cluster is already running # Now log and daemonize self.log.info( 'Starting engines with [daemon=%r]' % self.daemonize ) # TO...
[ "Start", "the", "app", "for", "the", "engines", "subcommand", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/apps/ipclusterapp.py#L411-L437
[ "def", "start", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "\"IPython cluster: started\"", ")", "# First see if the cluster is already running", "# Now log and daemonize", "self", ".", "log", ".", "info", "(", "'Starting engines with [daemon=%r]'", "%"...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
IPClusterStart.start
Start the app for the start subcommand.
environment/lib/python2.7/site-packages/IPython/parallel/apps/ipclusterapp.py
def start(self): """Start the app for the start subcommand.""" # First see if the cluster is already running try: pid = self.get_pid_from_file() except PIDFileError: pass else: if self.check_pid(pid): self.log.critical( ...
def start(self): """Start the app for the start subcommand.""" # First see if the cluster is already running try: pid = self.get_pid_from_file() except PIDFileError: pass else: if self.check_pid(pid): self.log.critical( ...
[ "Start", "the", "app", "for", "the", "start", "subcommand", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/apps/ipclusterapp.py#L535-L580
[ "def", "start", "(", "self", ")", ":", "# First see if the cluster is already running", "try", ":", "pid", "=", "self", ".", "get_pid_from_file", "(", ")", "except", "PIDFileError", ":", "pass", "else", ":", "if", "self", ".", "check_pid", "(", "pid", ")", "...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
get_app_wx
Create a new wx app or return an exiting one.
environment/lib/python2.7/site-packages/IPython/lib/guisupport.py
def get_app_wx(*args, **kwargs): """Create a new wx app or return an exiting one.""" import wx app = wx.GetApp() if app is None: if not kwargs.has_key('redirect'): kwargs['redirect'] = False app = wx.PySimpleApp(*args, **kwargs) return app
def get_app_wx(*args, **kwargs): """Create a new wx app or return an exiting one.""" import wx app = wx.GetApp() if app is None: if not kwargs.has_key('redirect'): kwargs['redirect'] = False app = wx.PySimpleApp(*args, **kwargs) return app
[ "Create", "a", "new", "wx", "app", "or", "return", "an", "exiting", "one", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/guisupport.py#L75-L83
[ "def", "get_app_wx", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "import", "wx", "app", "=", "wx", ".", "GetApp", "(", ")", "if", "app", "is", "None", ":", "if", "not", "kwargs", ".", "has_key", "(", "'redirect'", ")", ":", "kwargs", "["...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
is_event_loop_running_wx
Is the wx event loop running.
environment/lib/python2.7/site-packages/IPython/lib/guisupport.py
def is_event_loop_running_wx(app=None): """Is the wx event loop running.""" if app is None: app = get_app_wx() if hasattr(app, '_in_event_loop'): return app._in_event_loop else: return app.IsMainLoopRunning()
def is_event_loop_running_wx(app=None): """Is the wx event loop running.""" if app is None: app = get_app_wx() if hasattr(app, '_in_event_loop'): return app._in_event_loop else: return app.IsMainLoopRunning()
[ "Is", "the", "wx", "event", "loop", "running", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/guisupport.py#L85-L92
[ "def", "is_event_loop_running_wx", "(", "app", "=", "None", ")", ":", "if", "app", "is", "None", ":", "app", "=", "get_app_wx", "(", ")", "if", "hasattr", "(", "app", ",", "'_in_event_loop'", ")", ":", "return", "app", ".", "_in_event_loop", "else", ":",...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
start_event_loop_wx
Start the wx event loop in a consistent manner.
environment/lib/python2.7/site-packages/IPython/lib/guisupport.py
def start_event_loop_wx(app=None): """Start the wx event loop in a consistent manner.""" if app is None: app = get_app_wx() if not is_event_loop_running_wx(app): app._in_event_loop = True app.MainLoop() app._in_event_loop = False else: app._in_event_loop = True
def start_event_loop_wx(app=None): """Start the wx event loop in a consistent manner.""" if app is None: app = get_app_wx() if not is_event_loop_running_wx(app): app._in_event_loop = True app.MainLoop() app._in_event_loop = False else: app._in_event_loop = True
[ "Start", "the", "wx", "event", "loop", "in", "a", "consistent", "manner", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/guisupport.py#L94-L103
[ "def", "start_event_loop_wx", "(", "app", "=", "None", ")", ":", "if", "app", "is", "None", ":", "app", "=", "get_app_wx", "(", ")", "if", "not", "is_event_loop_running_wx", "(", "app", ")", ":", "app", ".", "_in_event_loop", "=", "True", "app", ".", "...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
get_app_qt4
Create a new qt4 app or return an existing one.
environment/lib/python2.7/site-packages/IPython/lib/guisupport.py
def get_app_qt4(*args, **kwargs): """Create a new qt4 app or return an existing one.""" from IPython.external.qt_for_kernel import QtGui app = QtGui.QApplication.instance() if app is None: if not args: args = ([''],) app = QtGui.QApplication(*args, **kwargs) return app
def get_app_qt4(*args, **kwargs): """Create a new qt4 app or return an existing one.""" from IPython.external.qt_for_kernel import QtGui app = QtGui.QApplication.instance() if app is None: if not args: args = ([''],) app = QtGui.QApplication(*args, **kwargs) return app
[ "Create", "a", "new", "qt4", "app", "or", "return", "an", "existing", "one", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/guisupport.py#L109-L117
[ "def", "get_app_qt4", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", "IPython", ".", "external", ".", "qt_for_kernel", "import", "QtGui", "app", "=", "QtGui", ".", "QApplication", ".", "instance", "(", ")", "if", "app", "is", "None", ":",...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
is_event_loop_running_qt4
Is the qt4 event loop running.
environment/lib/python2.7/site-packages/IPython/lib/guisupport.py
def is_event_loop_running_qt4(app=None): """Is the qt4 event loop running.""" if app is None: app = get_app_qt4(['']) if hasattr(app, '_in_event_loop'): return app._in_event_loop else: # Does qt4 provide a other way to detect this? return False
def is_event_loop_running_qt4(app=None): """Is the qt4 event loop running.""" if app is None: app = get_app_qt4(['']) if hasattr(app, '_in_event_loop'): return app._in_event_loop else: # Does qt4 provide a other way to detect this? return False
[ "Is", "the", "qt4", "event", "loop", "running", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/guisupport.py#L119-L127
[ "def", "is_event_loop_running_qt4", "(", "app", "=", "None", ")", ":", "if", "app", "is", "None", ":", "app", "=", "get_app_qt4", "(", "[", "''", "]", ")", "if", "hasattr", "(", "app", ",", "'_in_event_loop'", ")", ":", "return", "app", ".", "_in_event...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
start_event_loop_qt4
Start the qt4 event loop in a consistent manner.
environment/lib/python2.7/site-packages/IPython/lib/guisupport.py
def start_event_loop_qt4(app=None): """Start the qt4 event loop in a consistent manner.""" if app is None: app = get_app_qt4(['']) if not is_event_loop_running_qt4(app): app._in_event_loop = True app.exec_() app._in_event_loop = False else: app._in_event_loop = Tr...
def start_event_loop_qt4(app=None): """Start the qt4 event loop in a consistent manner.""" if app is None: app = get_app_qt4(['']) if not is_event_loop_running_qt4(app): app._in_event_loop = True app.exec_() app._in_event_loop = False else: app._in_event_loop = Tr...
[ "Start", "the", "qt4", "event", "loop", "in", "a", "consistent", "manner", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/guisupport.py#L129-L138
[ "def", "start_event_loop_qt4", "(", "app", "=", "None", ")", ":", "if", "app", "is", "None", ":", "app", "=", "get_app_qt4", "(", "[", "''", "]", ")", "if", "not", "is_event_loop_running_qt4", "(", "app", ")", ":", "app", ".", "_in_event_loop", "=", "T...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
build_py.check_package
Check namespace packages' __init__ for declare_namespace
environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/command/build_py.py
def check_package(self, package, package_dir): """Check namespace packages' __init__ for declare_namespace""" try: return self.packages_checked[package] except KeyError: pass init_py = _build_py.check_package(self, package, package_dir) self.packages_chec...
def check_package(self, package, package_dir): """Check namespace packages' __init__ for declare_namespace""" try: return self.packages_checked[package] except KeyError: pass init_py = _build_py.check_package(self, package, package_dir) self.packages_chec...
[ "Check", "namespace", "packages", "__init__", "for", "declare_namespace" ]
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/build_py.py#L197-L226
[ "def", "check_package", "(", "self", ",", "package", ",", "package_dir", ")", ":", "try", ":", "return", "self", ".", "packages_checked", "[", "package", "]", "except", "KeyError", ":", "pass", "init_py", "=", "_build_py", ".", "check_package", "(", "self", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
Canvas.blank_canvas
Return a blank canvas to annotate. :param width: xdim (int) :param height: ydim (int) :returns: :class:`jicbioimage.illustrate.Canvas`
jicbioimage/illustrate/__init__.py
def blank_canvas(width, height): """Return a blank canvas to annotate. :param width: xdim (int) :param height: ydim (int) :returns: :class:`jicbioimage.illustrate.Canvas` """ canvas = np.zeros((height, width, 3), dtype=np.uint8) return canvas.view(Canvas)
def blank_canvas(width, height): """Return a blank canvas to annotate. :param width: xdim (int) :param height: ydim (int) :returns: :class:`jicbioimage.illustrate.Canvas` """ canvas = np.zeros((height, width, 3), dtype=np.uint8) return canvas.view(Canvas)
[ "Return", "a", "blank", "canvas", "to", "annotate", "." ]
JIC-CSB/jicbioimage.illustrate
python
https://github.com/JIC-CSB/jicbioimage.illustrate/blob/d88ddf81ee3eb3949677e2ef746af8169ce88092/jicbioimage/illustrate/__init__.py#L55-L63
[ "def", "blank_canvas", "(", "width", ",", "height", ")", ":", "canvas", "=", "np", ".", "zeros", "(", "(", "height", ",", "width", ",", "3", ")", ",", "dtype", "=", "np", ".", "uint8", ")", "return", "canvas", ".", "view", "(", "Canvas", ")" ]
d88ddf81ee3eb3949677e2ef746af8169ce88092
test
Canvas.draw_cross
Draw a cross on the canvas. :param position: (row, col) tuple :param color: RGB tuple :param radius: radius of the cross (int)
jicbioimage/illustrate/__init__.py
def draw_cross(self, position, color=(255, 0, 0), radius=4): """Draw a cross on the canvas. :param position: (row, col) tuple :param color: RGB tuple :param radius: radius of the cross (int) """ y, x = position for xmod in np.arange(-radius, radius+1, 1): ...
def draw_cross(self, position, color=(255, 0, 0), radius=4): """Draw a cross on the canvas. :param position: (row, col) tuple :param color: RGB tuple :param radius: radius of the cross (int) """ y, x = position for xmod in np.arange(-radius, radius+1, 1): ...
[ "Draw", "a", "cross", "on", "the", "canvas", "." ]
JIC-CSB/jicbioimage.illustrate
python
https://github.com/JIC-CSB/jicbioimage.illustrate/blob/d88ddf81ee3eb3949677e2ef746af8169ce88092/jicbioimage/illustrate/__init__.py#L65-L86
[ "def", "draw_cross", "(", "self", ",", "position", ",", "color", "=", "(", "255", ",", "0", ",", "0", ")", ",", "radius", "=", "4", ")", ":", "y", ",", "x", "=", "position", "for", "xmod", "in", "np", ".", "arange", "(", "-", "radius", ",", "...
d88ddf81ee3eb3949677e2ef746af8169ce88092
test
Canvas.draw_line
Draw a line between pos1 and pos2 on the canvas. :param pos1: position 1 (row, col) tuple :param pos2: position 2 (row, col) tuple :param color: RGB tuple
jicbioimage/illustrate/__init__.py
def draw_line(self, pos1, pos2, color=(255, 0, 0)): """Draw a line between pos1 and pos2 on the canvas. :param pos1: position 1 (row, col) tuple :param pos2: position 2 (row, col) tuple :param color: RGB tuple """ r1, c1 = tuple([int(round(i, 0)) for i in pos1]) ...
def draw_line(self, pos1, pos2, color=(255, 0, 0)): """Draw a line between pos1 and pos2 on the canvas. :param pos1: position 1 (row, col) tuple :param pos2: position 2 (row, col) tuple :param color: RGB tuple """ r1, c1 = tuple([int(round(i, 0)) for i in pos1]) ...
[ "Draw", "a", "line", "between", "pos1", "and", "pos2", "on", "the", "canvas", "." ]
JIC-CSB/jicbioimage.illustrate
python
https://github.com/JIC-CSB/jicbioimage.illustrate/blob/d88ddf81ee3eb3949677e2ef746af8169ce88092/jicbioimage/illustrate/__init__.py#L88-L98
[ "def", "draw_line", "(", "self", ",", "pos1", ",", "pos2", ",", "color", "=", "(", "255", ",", "0", ",", "0", ")", ")", ":", "r1", ",", "c1", "=", "tuple", "(", "[", "int", "(", "round", "(", "i", ",", "0", ")", ")", "for", "i", "in", "po...
d88ddf81ee3eb3949677e2ef746af8169ce88092
test
Canvas.text_at
Write text at x, y top left corner position. By default the x and y coordinates represent the top left hand corner of the text. The text can be centered vertically and horizontally by using setting the ``center`` option to ``True``. :param text: text to write :param position: (...
jicbioimage/illustrate/__init__.py
def text_at(self, text, position, color=(255, 255, 255), size=12, antialias=False, center=False): """Write text at x, y top left corner position. By default the x and y coordinates represent the top left hand corner of the text. The text can be centered vertically and horizontal...
def text_at(self, text, position, color=(255, 255, 255), size=12, antialias=False, center=False): """Write text at x, y top left corner position. By default the x and y coordinates represent the top left hand corner of the text. The text can be centered vertically and horizontal...
[ "Write", "text", "at", "x", "y", "top", "left", "corner", "position", "." ]
JIC-CSB/jicbioimage.illustrate
python
https://github.com/JIC-CSB/jicbioimage.illustrate/blob/d88ddf81ee3eb3949677e2ef746af8169ce88092/jicbioimage/illustrate/__init__.py#L108-L152
[ "def", "text_at", "(", "self", ",", "text", ",", "position", ",", "color", "=", "(", "255", ",", "255", ",", "255", ")", ",", "size", "=", "12", ",", "antialias", "=", "False", ",", "center", "=", "False", ")", ":", "def", "antialias_value", "(", ...
d88ddf81ee3eb3949677e2ef746af8169ce88092
test
AnnotatedImage.from_grayscale
Return a canvas from a grayscale image. :param im: single channel image :channels_on: channels to populate with input image :returns: :class:`jicbioimage.illustrate.Canvas`
jicbioimage/illustrate/__init__.py
def from_grayscale(im, channels_on=(True, True, True)): """Return a canvas from a grayscale image. :param im: single channel image :channels_on: channels to populate with input image :returns: :class:`jicbioimage.illustrate.Canvas` """ xdim, ydim = im.shape canva...
def from_grayscale(im, channels_on=(True, True, True)): """Return a canvas from a grayscale image. :param im: single channel image :channels_on: channels to populate with input image :returns: :class:`jicbioimage.illustrate.Canvas` """ xdim, ydim = im.shape canva...
[ "Return", "a", "canvas", "from", "a", "grayscale", "image", "." ]
JIC-CSB/jicbioimage.illustrate
python
https://github.com/JIC-CSB/jicbioimage.illustrate/blob/d88ddf81ee3eb3949677e2ef746af8169ce88092/jicbioimage/illustrate/__init__.py#L159-L171
[ "def", "from_grayscale", "(", "im", ",", "channels_on", "=", "(", "True", ",", "True", ",", "True", ")", ")", ":", "xdim", ",", "ydim", "=", "im", ".", "shape", "canvas", "=", "np", ".", "zeros", "(", "(", "xdim", ",", "ydim", ",", "3", ")", ",...
d88ddf81ee3eb3949677e2ef746af8169ce88092
test
get_uuid
Returns a unique ID of a given length. User `version=2` for cross-systems uniqueness.
toolware/utils/generic.py
def get_uuid(length=32, version=1): """ Returns a unique ID of a given length. User `version=2` for cross-systems uniqueness. """ if version == 1: return uuid.uuid1().hex[:length] else: return uuid.uuid4().hex[:length]
def get_uuid(length=32, version=1): """ Returns a unique ID of a given length. User `version=2` for cross-systems uniqueness. """ if version == 1: return uuid.uuid1().hex[:length] else: return uuid.uuid4().hex[:length]
[ "Returns", "a", "unique", "ID", "of", "a", "given", "length", ".", "User", "version", "=", "2", "for", "cross", "-", "systems", "uniqueness", "." ]
un33k/django-toolware
python
https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/generic.py#L17-L25
[ "def", "get_uuid", "(", "length", "=", "32", ",", "version", "=", "1", ")", ":", "if", "version", "==", "1", ":", "return", "uuid", ".", "uuid1", "(", ")", ".", "hex", "[", ":", "length", "]", "else", ":", "return", "uuid", ".", "uuid4", "(", "...
973f3e003dc38b812897dab88455bee37dcaf931
test
get_dict_to_encoded_url
Converts a dict to an encoded URL. Example: given data = {'a': 1, 'b': 2}, it returns 'a=1&b=2'
toolware/utils/generic.py
def get_dict_to_encoded_url(data): """ Converts a dict to an encoded URL. Example: given data = {'a': 1, 'b': 2}, it returns 'a=1&b=2' """ unicode_data = dict([(k, smart_str(v)) for k, v in data.items()]) encoded = urllib.urlencode(unicode_data) return encoded
def get_dict_to_encoded_url(data): """ Converts a dict to an encoded URL. Example: given data = {'a': 1, 'b': 2}, it returns 'a=1&b=2' """ unicode_data = dict([(k, smart_str(v)) for k, v in data.items()]) encoded = urllib.urlencode(unicode_data) return encoded
[ "Converts", "a", "dict", "to", "an", "encoded", "URL", ".", "Example", ":", "given", "data", "=", "{", "a", ":", "1", "b", ":", "2", "}", "it", "returns", "a", "=", "1&b", "=", "2" ]
un33k/django-toolware
python
https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/generic.py#L61-L68
[ "def", "get_dict_to_encoded_url", "(", "data", ")", ":", "unicode_data", "=", "dict", "(", "[", "(", "k", ",", "smart_str", "(", "v", ")", ")", "for", "k", ",", "v", "in", "data", ".", "items", "(", ")", "]", ")", "encoded", "=", "urllib", ".", "...
973f3e003dc38b812897dab88455bee37dcaf931
test
get_encoded_url_to_dict
Converts an encoded URL to a dict. Example: given string = 'a=1&b=2' it returns {'a': 1, 'b': 2}
toolware/utils/generic.py
def get_encoded_url_to_dict(string): """ Converts an encoded URL to a dict. Example: given string = 'a=1&b=2' it returns {'a': 1, 'b': 2} """ data = urllib.parse.parse_qsl(string, keep_blank_values=True) data = dict(data) return data
def get_encoded_url_to_dict(string): """ Converts an encoded URL to a dict. Example: given string = 'a=1&b=2' it returns {'a': 1, 'b': 2} """ data = urllib.parse.parse_qsl(string, keep_blank_values=True) data = dict(data) return data
[ "Converts", "an", "encoded", "URL", "to", "a", "dict", ".", "Example", ":", "given", "string", "=", "a", "=", "1&b", "=", "2", "it", "returns", "{", "a", ":", "1", "b", ":", "2", "}" ]
un33k/django-toolware
python
https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/generic.py#L71-L78
[ "def", "get_encoded_url_to_dict", "(", "string", ")", ":", "data", "=", "urllib", ".", "parse", ".", "parse_qsl", "(", "string", ",", "keep_blank_values", "=", "True", ")", "data", "=", "dict", "(", "data", ")", "return", "data" ]
973f3e003dc38b812897dab88455bee37dcaf931
test
get_unique_key_from_get
Build a unique key from get data
toolware/utils/generic.py
def get_unique_key_from_get(get_dict): """ Build a unique key from get data """ site = Site.objects.get_current() key = get_dict_to_encoded_url(get_dict) cache_key = '{}_{}'.format(site.domain, key) return hashlib.md5(cache_key).hexdigest()
def get_unique_key_from_get(get_dict): """ Build a unique key from get data """ site = Site.objects.get_current() key = get_dict_to_encoded_url(get_dict) cache_key = '{}_{}'.format(site.domain, key) return hashlib.md5(cache_key).hexdigest()
[ "Build", "a", "unique", "key", "from", "get", "data" ]
un33k/django-toolware
python
https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/generic.py#L93-L100
[ "def", "get_unique_key_from_get", "(", "get_dict", ")", ":", "site", "=", "Site", ".", "objects", ".", "get_current", "(", ")", "key", "=", "get_dict_to_encoded_url", "(", "get_dict", ")", "cache_key", "=", "'{}_{}'", ".", "format", "(", "site", ".", "domain...
973f3e003dc38b812897dab88455bee37dcaf931
test
tobin
Given a decimal number, returns a string bitfield of length = len Example: given deci_num = 1 and len = 10, it return 0000000001
toolware/utils/generic.py
def tobin(deci_num, len=32): """ Given a decimal number, returns a string bitfield of length = len Example: given deci_num = 1 and len = 10, it return 0000000001 """ bitstr = "".join(map(lambda y: str((deci_num >> y) & 1), range(len - 1, -1, -1))) return bitstr
def tobin(deci_num, len=32): """ Given a decimal number, returns a string bitfield of length = len Example: given deci_num = 1 and len = 10, it return 0000000001 """ bitstr = "".join(map(lambda y: str((deci_num >> y) & 1), range(len - 1, -1, -1))) return bitstr
[ "Given", "a", "decimal", "number", "returns", "a", "string", "bitfield", "of", "length", "=", "len", "Example", ":", "given", "deci_num", "=", "1", "and", "len", "=", "10", "it", "return", "0000000001" ]
un33k/django-toolware
python
https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/generic.py#L111-L117
[ "def", "tobin", "(", "deci_num", ",", "len", "=", "32", ")", ":", "bitstr", "=", "\"\"", ".", "join", "(", "map", "(", "lambda", "y", ":", "str", "(", "(", "deci_num", ">>", "y", ")", "&", "1", ")", ",", "range", "(", "len", "-", "1", ",", ...
973f3e003dc38b812897dab88455bee37dcaf931
test
is_valid_email
Validates and email address. Note: valid emails must follow the <name>@<domain><.extension> patterns.
toolware/utils/generic.py
def is_valid_email(email): """ Validates and email address. Note: valid emails must follow the <name>@<domain><.extension> patterns. """ try: validate_email(email) except ValidationError: return False if simple_email_re.match(email): return True return False
def is_valid_email(email): """ Validates and email address. Note: valid emails must follow the <name>@<domain><.extension> patterns. """ try: validate_email(email) except ValidationError: return False if simple_email_re.match(email): return True return False
[ "Validates", "and", "email", "address", ".", "Note", ":", "valid", "emails", "must", "follow", "the", "<name", ">" ]
un33k/django-toolware
python
https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/generic.py#L120-L131
[ "def", "is_valid_email", "(", "email", ")", ":", "try", ":", "validate_email", "(", "email", ")", "except", "ValidationError", ":", "return", "False", "if", "simple_email_re", ".", "match", "(", "email", ")", ":", "return", "True", "return", "False" ]
973f3e003dc38b812897dab88455bee37dcaf931
test
get_domain
Returns domain name portion of a URL
toolware/utils/generic.py
def get_domain(url): """ Returns domain name portion of a URL """ if 'http' not in url.lower(): url = 'http://{}'.format(url) return urllib.parse.urlparse(url).hostname
def get_domain(url): """ Returns domain name portion of a URL """ if 'http' not in url.lower(): url = 'http://{}'.format(url) return urllib.parse.urlparse(url).hostname
[ "Returns", "domain", "name", "portion", "of", "a", "URL" ]
un33k/django-toolware
python
https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/generic.py#L134-L138
[ "def", "get_domain", "(", "url", ")", ":", "if", "'http'", "not", "in", "url", ".", "lower", "(", ")", ":", "url", "=", "'http://{}'", ".", "format", "(", "url", ")", "return", "urllib", ".", "parse", ".", "urlparse", "(", "url", ")", ".", "hostnam...
973f3e003dc38b812897dab88455bee37dcaf931
test
get_url_args
Returns a dictionary from a URL params
toolware/utils/generic.py
def get_url_args(url): """ Returns a dictionary from a URL params """ url_data = urllib.parse.urlparse(url) arg_dict = urllib.parse.parse_qs(url_data.query) return arg_dict
def get_url_args(url): """ Returns a dictionary from a URL params """ url_data = urllib.parse.urlparse(url) arg_dict = urllib.parse.parse_qs(url_data.query) return arg_dict
[ "Returns", "a", "dictionary", "from", "a", "URL", "params" ]
un33k/django-toolware
python
https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/generic.py#L141-L145
[ "def", "get_url_args", "(", "url", ")", ":", "url_data", "=", "urllib", ".", "parse", ".", "urlparse", "(", "url", ")", "arg_dict", "=", "urllib", ".", "parse", ".", "parse_qs", "(", "url_data", ".", "query", ")", "return", "arg_dict" ]
973f3e003dc38b812897dab88455bee37dcaf931
train
train
Trains a k-nearest neighbors classifier for face recognition. :param train_dir: directory that contains a sub-directory for each known person, with its name. (View in source code to see train_dir example tree structure) Structure: <train_dir>/ ├── <person1>/ │ ├── <somename1>....
examples/face_recognition_knn.py
def train(train_dir, model_save_path=None, n_neighbors=None, knn_algo='ball_tree', verbose=False): """ Trains a k-nearest neighbors classifier for face recognition. :param train_dir: directory that contains a sub-directory for each known person, with its name. (View in source code to see train_dir ex...
def train(train_dir, model_save_path=None, n_neighbors=None, knn_algo='ball_tree', verbose=False): """ Trains a k-nearest neighbors classifier for face recognition. :param train_dir: directory that contains a sub-directory for each known person, with its name. (View in source code to see train_dir ex...
[ "Trains", "a", "k", "-", "nearest", "neighbors", "classifier", "for", "face", "recognition", "." ]
ageitgey/face_recognition
python
https://github.com/ageitgey/face_recognition/blob/c96b010c02f15e8eeb0f71308c641179ac1f19bb/examples/face_recognition_knn.py#L46-L108
[ "def", "train", "(", "train_dir", ",", "model_save_path", "=", "None", ",", "n_neighbors", "=", "None", ",", "knn_algo", "=", "'ball_tree'", ",", "verbose", "=", "False", ")", ":", "X", "=", "[", "]", "y", "=", "[", "]", "# Loop through each person in the ...
c96b010c02f15e8eeb0f71308c641179ac1f19bb
train
predict
Recognizes faces in given image using a trained KNN classifier :param X_img_path: path to image to be recognized :param knn_clf: (optional) a knn classifier object. if not specified, model_save_path must be specified. :param model_path: (optional) path to a pickled knn classifier. if not specified, model_s...
examples/face_recognition_knn.py
def predict(X_img_path, knn_clf=None, model_path=None, distance_threshold=0.6): """ Recognizes faces in given image using a trained KNN classifier :param X_img_path: path to image to be recognized :param knn_clf: (optional) a knn classifier object. if not specified, model_save_path must be specified. ...
def predict(X_img_path, knn_clf=None, model_path=None, distance_threshold=0.6): """ Recognizes faces in given image using a trained KNN classifier :param X_img_path: path to image to be recognized :param knn_clf: (optional) a knn classifier object. if not specified, model_save_path must be specified. ...
[ "Recognizes", "faces", "in", "given", "image", "using", "a", "trained", "KNN", "classifier" ]
ageitgey/face_recognition
python
https://github.com/ageitgey/face_recognition/blob/c96b010c02f15e8eeb0f71308c641179ac1f19bb/examples/face_recognition_knn.py#L111-L150
[ "def", "predict", "(", "X_img_path", ",", "knn_clf", "=", "None", ",", "model_path", "=", "None", ",", "distance_threshold", "=", "0.6", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "X_img_path", ")", "or", "os", ".", "path", ".", "s...
c96b010c02f15e8eeb0f71308c641179ac1f19bb
train
show_prediction_labels_on_image
Shows the face recognition results visually. :param img_path: path to image to be recognized :param predictions: results of the predict function :return:
examples/face_recognition_knn.py
def show_prediction_labels_on_image(img_path, predictions): """ Shows the face recognition results visually. :param img_path: path to image to be recognized :param predictions: results of the predict function :return: """ pil_image = Image.open(img_path).convert("RGB") draw = ImageDraw....
def show_prediction_labels_on_image(img_path, predictions): """ Shows the face recognition results visually. :param img_path: path to image to be recognized :param predictions: results of the predict function :return: """ pil_image = Image.open(img_path).convert("RGB") draw = ImageDraw....
[ "Shows", "the", "face", "recognition", "results", "visually", "." ]
ageitgey/face_recognition
python
https://github.com/ageitgey/face_recognition/blob/c96b010c02f15e8eeb0f71308c641179ac1f19bb/examples/face_recognition_knn.py#L153-L181
[ "def", "show_prediction_labels_on_image", "(", "img_path", ",", "predictions", ")", ":", "pil_image", "=", "Image", ".", "open", "(", "img_path", ")", ".", "convert", "(", "\"RGB\"", ")", "draw", "=", "ImageDraw", ".", "Draw", "(", "pil_image", ")", "for", ...
c96b010c02f15e8eeb0f71308c641179ac1f19bb
train
_rect_to_css
Convert a dlib 'rect' object to a plain tuple in (top, right, bottom, left) order :param rect: a dlib 'rect' object :return: a plain tuple representation of the rect in (top, right, bottom, left) order
face_recognition/api.py
def _rect_to_css(rect): """ Convert a dlib 'rect' object to a plain tuple in (top, right, bottom, left) order :param rect: a dlib 'rect' object :return: a plain tuple representation of the rect in (top, right, bottom, left) order """ return rect.top(), rect.right(), rect.bottom(), rect.left()
def _rect_to_css(rect): """ Convert a dlib 'rect' object to a plain tuple in (top, right, bottom, left) order :param rect: a dlib 'rect' object :return: a plain tuple representation of the rect in (top, right, bottom, left) order """ return rect.top(), rect.right(), rect.bottom(), rect.left()
[ "Convert", "a", "dlib", "rect", "object", "to", "a", "plain", "tuple", "in", "(", "top", "right", "bottom", "left", ")", "order" ]
ageitgey/face_recognition
python
https://github.com/ageitgey/face_recognition/blob/c96b010c02f15e8eeb0f71308c641179ac1f19bb/face_recognition/api.py#L32-L39
[ "def", "_rect_to_css", "(", "rect", ")", ":", "return", "rect", ".", "top", "(", ")", ",", "rect", ".", "right", "(", ")", ",", "rect", ".", "bottom", "(", ")", ",", "rect", ".", "left", "(", ")" ]
c96b010c02f15e8eeb0f71308c641179ac1f19bb
train
_trim_css_to_bounds
Make sure a tuple in (top, right, bottom, left) order is within the bounds of the image. :param css: plain tuple representation of the rect in (top, right, bottom, left) order :param image_shape: numpy shape of the image array :return: a trimmed plain tuple representation of the rect in (top, right, botto...
face_recognition/api.py
def _trim_css_to_bounds(css, image_shape): """ Make sure a tuple in (top, right, bottom, left) order is within the bounds of the image. :param css: plain tuple representation of the rect in (top, right, bottom, left) order :param image_shape: numpy shape of the image array :return: a trimmed plain...
def _trim_css_to_bounds(css, image_shape): """ Make sure a tuple in (top, right, bottom, left) order is within the bounds of the image. :param css: plain tuple representation of the rect in (top, right, bottom, left) order :param image_shape: numpy shape of the image array :return: a trimmed plain...
[ "Make", "sure", "a", "tuple", "in", "(", "top", "right", "bottom", "left", ")", "order", "is", "within", "the", "bounds", "of", "the", "image", "." ]
ageitgey/face_recognition
python
https://github.com/ageitgey/face_recognition/blob/c96b010c02f15e8eeb0f71308c641179ac1f19bb/face_recognition/api.py#L52-L60
[ "def", "_trim_css_to_bounds", "(", "css", ",", "image_shape", ")", ":", "return", "max", "(", "css", "[", "0", "]", ",", "0", ")", ",", "min", "(", "css", "[", "1", "]", ",", "image_shape", "[", "1", "]", ")", ",", "min", "(", "css", "[", "2", ...
c96b010c02f15e8eeb0f71308c641179ac1f19bb
train
face_distance
Given a list of face encodings, compare them to a known face encoding and get a euclidean distance for each comparison face. The distance tells you how similar the faces are. :param faces: List of face encodings to compare :param face_to_compare: A face encoding to compare against :return: A numpy ndar...
face_recognition/api.py
def face_distance(face_encodings, face_to_compare): """ Given a list of face encodings, compare them to a known face encoding and get a euclidean distance for each comparison face. The distance tells you how similar the faces are. :param faces: List of face encodings to compare :param face_to_compa...
def face_distance(face_encodings, face_to_compare): """ Given a list of face encodings, compare them to a known face encoding and get a euclidean distance for each comparison face. The distance tells you how similar the faces are. :param faces: List of face encodings to compare :param face_to_compa...
[ "Given", "a", "list", "of", "face", "encodings", "compare", "them", "to", "a", "known", "face", "encoding", "and", "get", "a", "euclidean", "distance", "for", "each", "comparison", "face", ".", "The", "distance", "tells", "you", "how", "similar", "the", "f...
ageitgey/face_recognition
python
https://github.com/ageitgey/face_recognition/blob/c96b010c02f15e8eeb0f71308c641179ac1f19bb/face_recognition/api.py#L63-L75
[ "def", "face_distance", "(", "face_encodings", ",", "face_to_compare", ")", ":", "if", "len", "(", "face_encodings", ")", "==", "0", ":", "return", "np", ".", "empty", "(", "(", "0", ")", ")", "return", "np", ".", "linalg", ".", "norm", "(", "face_enco...
c96b010c02f15e8eeb0f71308c641179ac1f19bb
train
load_image_file
Loads an image file (.jpg, .png, etc) into a numpy array :param file: image file name or file object to load :param mode: format to convert the image to. Only 'RGB' (8-bit RGB, 3 channels) and 'L' (black and white) are supported. :return: image contents as numpy array
face_recognition/api.py
def load_image_file(file, mode='RGB'): """ Loads an image file (.jpg, .png, etc) into a numpy array :param file: image file name or file object to load :param mode: format to convert the image to. Only 'RGB' (8-bit RGB, 3 channels) and 'L' (black and white) are supported. :return: image contents as...
def load_image_file(file, mode='RGB'): """ Loads an image file (.jpg, .png, etc) into a numpy array :param file: image file name or file object to load :param mode: format to convert the image to. Only 'RGB' (8-bit RGB, 3 channels) and 'L' (black and white) are supported. :return: image contents as...
[ "Loads", "an", "image", "file", "(", ".", "jpg", ".", "png", "etc", ")", "into", "a", "numpy", "array" ]
ageitgey/face_recognition
python
https://github.com/ageitgey/face_recognition/blob/c96b010c02f15e8eeb0f71308c641179ac1f19bb/face_recognition/api.py#L78-L89
[ "def", "load_image_file", "(", "file", ",", "mode", "=", "'RGB'", ")", ":", "im", "=", "PIL", ".", "Image", ".", "open", "(", "file", ")", "if", "mode", ":", "im", "=", "im", ".", "convert", "(", "mode", ")", "return", "np", ".", "array", "(", ...
c96b010c02f15e8eeb0f71308c641179ac1f19bb
train
_raw_face_locations
Returns an array of bounding boxes of human faces in a image :param img: An image (as a numpy array) :param number_of_times_to_upsample: How many times to upsample the image looking for faces. Higher numbers find smaller faces. :param model: Which face detection model to use. "hog" is less accurate but fas...
face_recognition/api.py
def _raw_face_locations(img, number_of_times_to_upsample=1, model="hog"): """ Returns an array of bounding boxes of human faces in a image :param img: An image (as a numpy array) :param number_of_times_to_upsample: How many times to upsample the image looking for faces. Higher numbers find smaller face...
def _raw_face_locations(img, number_of_times_to_upsample=1, model="hog"): """ Returns an array of bounding boxes of human faces in a image :param img: An image (as a numpy array) :param number_of_times_to_upsample: How many times to upsample the image looking for faces. Higher numbers find smaller face...
[ "Returns", "an", "array", "of", "bounding", "boxes", "of", "human", "faces", "in", "a", "image" ]
ageitgey/face_recognition
python
https://github.com/ageitgey/face_recognition/blob/c96b010c02f15e8eeb0f71308c641179ac1f19bb/face_recognition/api.py#L92-L105
[ "def", "_raw_face_locations", "(", "img", ",", "number_of_times_to_upsample", "=", "1", ",", "model", "=", "\"hog\"", ")", ":", "if", "model", "==", "\"cnn\"", ":", "return", "cnn_face_detector", "(", "img", ",", "number_of_times_to_upsample", ")", "else", ":", ...
c96b010c02f15e8eeb0f71308c641179ac1f19bb
train
face_locations
Returns an array of bounding boxes of human faces in a image :param img: An image (as a numpy array) :param number_of_times_to_upsample: How many times to upsample the image looking for faces. Higher numbers find smaller faces. :param model: Which face detection model to use. "hog" is less accurate but fas...
face_recognition/api.py
def face_locations(img, number_of_times_to_upsample=1, model="hog"): """ Returns an array of bounding boxes of human faces in a image :param img: An image (as a numpy array) :param number_of_times_to_upsample: How many times to upsample the image looking for faces. Higher numbers find smaller faces. ...
def face_locations(img, number_of_times_to_upsample=1, model="hog"): """ Returns an array of bounding boxes of human faces in a image :param img: An image (as a numpy array) :param number_of_times_to_upsample: How many times to upsample the image looking for faces. Higher numbers find smaller faces. ...
[ "Returns", "an", "array", "of", "bounding", "boxes", "of", "human", "faces", "in", "a", "image" ]
ageitgey/face_recognition
python
https://github.com/ageitgey/face_recognition/blob/c96b010c02f15e8eeb0f71308c641179ac1f19bb/face_recognition/api.py#L108-L121
[ "def", "face_locations", "(", "img", ",", "number_of_times_to_upsample", "=", "1", ",", "model", "=", "\"hog\"", ")", ":", "if", "model", "==", "\"cnn\"", ":", "return", "[", "_trim_css_to_bounds", "(", "_rect_to_css", "(", "face", ".", "rect", ")", ",", "...
c96b010c02f15e8eeb0f71308c641179ac1f19bb
train
batch_face_locations
Returns an 2d array of bounding boxes of human faces in a image using the cnn face detector If you are using a GPU, this can give you much faster results since the GPU can process batches of images at once. If you aren't using a GPU, you don't need this function. :param img: A list of images (each as a num...
face_recognition/api.py
def batch_face_locations(images, number_of_times_to_upsample=1, batch_size=128): """ Returns an 2d array of bounding boxes of human faces in a image using the cnn face detector If you are using a GPU, this can give you much faster results since the GPU can process batches of images at once. If you aren'...
def batch_face_locations(images, number_of_times_to_upsample=1, batch_size=128): """ Returns an 2d array of bounding boxes of human faces in a image using the cnn face detector If you are using a GPU, this can give you much faster results since the GPU can process batches of images at once. If you aren'...
[ "Returns", "an", "2d", "array", "of", "bounding", "boxes", "of", "human", "faces", "in", "a", "image", "using", "the", "cnn", "face", "detector", "If", "you", "are", "using", "a", "GPU", "this", "can", "give", "you", "much", "faster", "results", "since",...
ageitgey/face_recognition
python
https://github.com/ageitgey/face_recognition/blob/c96b010c02f15e8eeb0f71308c641179ac1f19bb/face_recognition/api.py#L135-L151
[ "def", "batch_face_locations", "(", "images", ",", "number_of_times_to_upsample", "=", "1", ",", "batch_size", "=", "128", ")", ":", "def", "convert_cnn_detections_to_css", "(", "detections", ")", ":", "return", "[", "_trim_css_to_bounds", "(", "_rect_to_css", "(", ...
c96b010c02f15e8eeb0f71308c641179ac1f19bb
train
face_landmarks
Given an image, returns a dict of face feature locations (eyes, nose, etc) for each face in the image :param face_image: image to search :param face_locations: Optionally provide a list of face locations to check. :param model: Optional - which model to use. "large" (default) or "small" which only returns ...
face_recognition/api.py
def face_landmarks(face_image, face_locations=None, model="large"): """ Given an image, returns a dict of face feature locations (eyes, nose, etc) for each face in the image :param face_image: image to search :param face_locations: Optionally provide a list of face locations to check. :param model:...
def face_landmarks(face_image, face_locations=None, model="large"): """ Given an image, returns a dict of face feature locations (eyes, nose, etc) for each face in the image :param face_image: image to search :param face_locations: Optionally provide a list of face locations to check. :param model:...
[ "Given", "an", "image", "returns", "a", "dict", "of", "face", "feature", "locations", "(", "eyes", "nose", "etc", ")", "for", "each", "face", "in", "the", "image" ]
ageitgey/face_recognition
python
https://github.com/ageitgey/face_recognition/blob/c96b010c02f15e8eeb0f71308c641179ac1f19bb/face_recognition/api.py#L168-L200
[ "def", "face_landmarks", "(", "face_image", ",", "face_locations", "=", "None", ",", "model", "=", "\"large\"", ")", ":", "landmarks", "=", "_raw_face_landmarks", "(", "face_image", ",", "face_locations", ",", "model", ")", "landmarks_as_tuples", "=", "[", "[", ...
c96b010c02f15e8eeb0f71308c641179ac1f19bb
train
face_encodings
Given an image, return the 128-dimension face encoding for each face in the image. :param face_image: The image that contains one or more faces :param known_face_locations: Optional - the bounding boxes of each face if you already know them. :param num_jitters: How many times to re-sample the face when cal...
face_recognition/api.py
def face_encodings(face_image, known_face_locations=None, num_jitters=1): """ Given an image, return the 128-dimension face encoding for each face in the image. :param face_image: The image that contains one or more faces :param known_face_locations: Optional - the bounding boxes of each face if you al...
def face_encodings(face_image, known_face_locations=None, num_jitters=1): """ Given an image, return the 128-dimension face encoding for each face in the image. :param face_image: The image that contains one or more faces :param known_face_locations: Optional - the bounding boxes of each face if you al...
[ "Given", "an", "image", "return", "the", "128", "-", "dimension", "face", "encoding", "for", "each", "face", "in", "the", "image", "." ]
ageitgey/face_recognition
python
https://github.com/ageitgey/face_recognition/blob/c96b010c02f15e8eeb0f71308c641179ac1f19bb/face_recognition/api.py#L203-L213
[ "def", "face_encodings", "(", "face_image", ",", "known_face_locations", "=", "None", ",", "num_jitters", "=", "1", ")", ":", "raw_landmarks", "=", "_raw_face_landmarks", "(", "face_image", ",", "known_face_locations", ",", "model", "=", "\"small\"", ")", "return"...
c96b010c02f15e8eeb0f71308c641179ac1f19bb
train
_parse_datatype_string
Parses the given data type string to a :class:`DataType`. The data type string format equals to :class:`DataType.simpleString`, except that top level struct type can omit the ``struct<>`` and atomic types use ``typeName()`` as their format, e.g. use ``byte`` instead of ``tinyint`` for :class:`ByteType`. We ...
python/pyspark/sql/types.py
def _parse_datatype_string(s): """ Parses the given data type string to a :class:`DataType`. The data type string format equals to :class:`DataType.simpleString`, except that top level struct type can omit the ``struct<>`` and atomic types use ``typeName()`` as their format, e.g. use ``byte`` instead ...
def _parse_datatype_string(s): """ Parses the given data type string to a :class:`DataType`. The data type string format equals to :class:`DataType.simpleString`, except that top level struct type can omit the ``struct<>`` and atomic types use ``typeName()`` as their format, e.g. use ``byte`` instead ...
[ "Parses", "the", "given", "data", "type", "string", "to", "a", ":", "class", ":", "DataType", ".", "The", "data", "type", "string", "format", "equals", "to", ":", "class", ":", "DataType", ".", "simpleString", "except", "that", "top", "level", "struct", ...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/types.py#L758-L820
[ "def", "_parse_datatype_string", "(", "s", ")", ":", "sc", "=", "SparkContext", ".", "_active_spark_context", "def", "from_ddl_schema", "(", "type_str", ")", ":", "return", "_parse_datatype_json_string", "(", "sc", ".", "_jvm", ".", "org", ".", "apache", ".", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
_int_size_to_type
Return the Catalyst datatype from the size of integers.
python/pyspark/sql/types.py
def _int_size_to_type(size): """ Return the Catalyst datatype from the size of integers. """ if size <= 8: return ByteType if size <= 16: return ShortType if size <= 32: return IntegerType if size <= 64: return LongType
def _int_size_to_type(size): """ Return the Catalyst datatype from the size of integers. """ if size <= 8: return ByteType if size <= 16: return ShortType if size <= 32: return IntegerType if size <= 64: return LongType
[ "Return", "the", "Catalyst", "datatype", "from", "the", "size", "of", "integers", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/types.py#L944-L955
[ "def", "_int_size_to_type", "(", "size", ")", ":", "if", "size", "<=", "8", ":", "return", "ByteType", "if", "size", "<=", "16", ":", "return", "ShortType", "if", "size", "<=", "32", ":", "return", "IntegerType", "if", "size", "<=", "64", ":", "return"...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
_infer_type
Infer the DataType from obj
python/pyspark/sql/types.py
def _infer_type(obj): """Infer the DataType from obj """ if obj is None: return NullType() if hasattr(obj, '__UDT__'): return obj.__UDT__ dataType = _type_mappings.get(type(obj)) if dataType is DecimalType: # the precision and scale of `obj` may be different from row to...
def _infer_type(obj): """Infer the DataType from obj """ if obj is None: return NullType() if hasattr(obj, '__UDT__'): return obj.__UDT__ dataType = _type_mappings.get(type(obj)) if dataType is DecimalType: # the precision and scale of `obj` may be different from row to...
[ "Infer", "the", "DataType", "from", "obj" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/types.py#L1003-L1038
[ "def", "_infer_type", "(", "obj", ")", ":", "if", "obj", "is", "None", ":", "return", "NullType", "(", ")", "if", "hasattr", "(", "obj", ",", "'__UDT__'", ")", ":", "return", "obj", ".", "__UDT__", "dataType", "=", "_type_mappings", ".", "get", "(", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
_infer_schema
Infer the schema from dict/namedtuple/object
python/pyspark/sql/types.py
def _infer_schema(row, names=None): """Infer the schema from dict/namedtuple/object""" if isinstance(row, dict): items = sorted(row.items()) elif isinstance(row, (tuple, list)): if hasattr(row, "__fields__"): # Row items = zip(row.__fields__, tuple(row)) elif hasattr(ro...
def _infer_schema(row, names=None): """Infer the schema from dict/namedtuple/object""" if isinstance(row, dict): items = sorted(row.items()) elif isinstance(row, (tuple, list)): if hasattr(row, "__fields__"): # Row items = zip(row.__fields__, tuple(row)) elif hasattr(ro...
[ "Infer", "the", "schema", "from", "dict", "/", "namedtuple", "/", "object" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/types.py#L1041-L1065
[ "def", "_infer_schema", "(", "row", ",", "names", "=", "None", ")", ":", "if", "isinstance", "(", "row", ",", "dict", ")", ":", "items", "=", "sorted", "(", "row", ".", "items", "(", ")", ")", "elif", "isinstance", "(", "row", ",", "(", "tuple", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
_has_nulltype
Return whether there is NullType in `dt` or not
python/pyspark/sql/types.py
def _has_nulltype(dt): """ Return whether there is NullType in `dt` or not """ if isinstance(dt, StructType): return any(_has_nulltype(f.dataType) for f in dt.fields) elif isinstance(dt, ArrayType): return _has_nulltype((dt.elementType)) elif isinstance(dt, MapType): return _has_...
def _has_nulltype(dt): """ Return whether there is NullType in `dt` or not """ if isinstance(dt, StructType): return any(_has_nulltype(f.dataType) for f in dt.fields) elif isinstance(dt, ArrayType): return _has_nulltype((dt.elementType)) elif isinstance(dt, MapType): return _has_...
[ "Return", "whether", "there", "is", "NullType", "in", "dt", "or", "not" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/types.py#L1068-L1077
[ "def", "_has_nulltype", "(", "dt", ")", ":", "if", "isinstance", "(", "dt", ",", "StructType", ")", ":", "return", "any", "(", "_has_nulltype", "(", "f", ".", "dataType", ")", "for", "f", "in", "dt", ".", "fields", ")", "elif", "isinstance", "(", "dt...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
_create_converter
Create a converter to drop the names of fields in obj
python/pyspark/sql/types.py
def _create_converter(dataType): """Create a converter to drop the names of fields in obj """ if not _need_converter(dataType): return lambda x: x if isinstance(dataType, ArrayType): conv = _create_converter(dataType.elementType) return lambda row: [conv(v) for v in row] elif i...
def _create_converter(dataType): """Create a converter to drop the names of fields in obj """ if not _need_converter(dataType): return lambda x: x if isinstance(dataType, ArrayType): conv = _create_converter(dataType.elementType) return lambda row: [conv(v) for v in row] elif i...
[ "Create", "a", "converter", "to", "drop", "the", "names", "of", "fields", "in", "obj" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/types.py#L1133-L1180
[ "def", "_create_converter", "(", "dataType", ")", ":", "if", "not", "_need_converter", "(", "dataType", ")", ":", "return", "lambda", "x", ":", "x", "if", "isinstance", "(", "dataType", ",", "ArrayType", ")", ":", "conv", "=", "_create_converter", "(", "da...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
_make_type_verifier
Make a verifier that checks the type of obj against dataType and raises a TypeError if they do not match. This verifier also checks the value of obj against datatype and raises a ValueError if it's not within the allowed range, e.g. using 128 as ByteType will overflow. Note that, Python float is not ch...
python/pyspark/sql/types.py
def _make_type_verifier(dataType, nullable=True, name=None): """ Make a verifier that checks the type of obj against dataType and raises a TypeError if they do not match. This verifier also checks the value of obj against datatype and raises a ValueError if it's not within the allowed range, e.g. u...
def _make_type_verifier(dataType, nullable=True, name=None): """ Make a verifier that checks the type of obj against dataType and raises a TypeError if they do not match. This verifier also checks the value of obj against datatype and raises a ValueError if it's not within the allowed range, e.g. u...
[ "Make", "a", "verifier", "that", "checks", "the", "type", "of", "obj", "against", "dataType", "and", "raises", "a", "TypeError", "if", "they", "do", "not", "match", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/types.py#L1202-L1391
[ "def", "_make_type_verifier", "(", "dataType", ",", "nullable", "=", "True", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "new_msg", "=", "lambda", "msg", ":", "msg", "new_name", "=", "lambda", "n", ":", "\"field %s\"", "%", "n"...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
to_arrow_type
Convert Spark data type to pyarrow type
python/pyspark/sql/types.py
def to_arrow_type(dt): """ Convert Spark data type to pyarrow type """ import pyarrow as pa if type(dt) == BooleanType: arrow_type = pa.bool_() elif type(dt) == ByteType: arrow_type = pa.int8() elif type(dt) == ShortType: arrow_type = pa.int16() elif type(dt) == Integ...
def to_arrow_type(dt): """ Convert Spark data type to pyarrow type """ import pyarrow as pa if type(dt) == BooleanType: arrow_type = pa.bool_() elif type(dt) == ByteType: arrow_type = pa.int8() elif type(dt) == ShortType: arrow_type = pa.int16() elif type(dt) == Integ...
[ "Convert", "Spark", "data", "type", "to", "pyarrow", "type" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/types.py#L1581-L1622
[ "def", "to_arrow_type", "(", "dt", ")", ":", "import", "pyarrow", "as", "pa", "if", "type", "(", "dt", ")", "==", "BooleanType", ":", "arrow_type", "=", "pa", ".", "bool_", "(", ")", "elif", "type", "(", "dt", ")", "==", "ByteType", ":", "arrow_type"...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
to_arrow_schema
Convert a schema from Spark to Arrow
python/pyspark/sql/types.py
def to_arrow_schema(schema): """ Convert a schema from Spark to Arrow """ import pyarrow as pa fields = [pa.field(field.name, to_arrow_type(field.dataType), nullable=field.nullable) for field in schema] return pa.schema(fields)
def to_arrow_schema(schema): """ Convert a schema from Spark to Arrow """ import pyarrow as pa fields = [pa.field(field.name, to_arrow_type(field.dataType), nullable=field.nullable) for field in schema] return pa.schema(fields)
[ "Convert", "a", "schema", "from", "Spark", "to", "Arrow" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/types.py#L1625-L1631
[ "def", "to_arrow_schema", "(", "schema", ")", ":", "import", "pyarrow", "as", "pa", "fields", "=", "[", "pa", ".", "field", "(", "field", ".", "name", ",", "to_arrow_type", "(", "field", ".", "dataType", ")", ",", "nullable", "=", "field", ".", "nullab...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
from_arrow_type
Convert pyarrow type to Spark data type.
python/pyspark/sql/types.py
def from_arrow_type(at): """ Convert pyarrow type to Spark data type. """ import pyarrow.types as types if types.is_boolean(at): spark_type = BooleanType() elif types.is_int8(at): spark_type = ByteType() elif types.is_int16(at): spark_type = ShortType() elif types.is_...
def from_arrow_type(at): """ Convert pyarrow type to Spark data type. """ import pyarrow.types as types if types.is_boolean(at): spark_type = BooleanType() elif types.is_int8(at): spark_type = ByteType() elif types.is_int16(at): spark_type = ShortType() elif types.is_...
[ "Convert", "pyarrow", "type", "to", "Spark", "data", "type", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/types.py#L1634-L1674
[ "def", "from_arrow_type", "(", "at", ")", ":", "import", "pyarrow", ".", "types", "as", "types", "if", "types", ".", "is_boolean", "(", "at", ")", ":", "spark_type", "=", "BooleanType", "(", ")", "elif", "types", ".", "is_int8", "(", "at", ")", ":", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
from_arrow_schema
Convert schema from Arrow to Spark.
python/pyspark/sql/types.py
def from_arrow_schema(arrow_schema): """ Convert schema from Arrow to Spark. """ return StructType( [StructField(field.name, from_arrow_type(field.type), nullable=field.nullable) for field in arrow_schema])
def from_arrow_schema(arrow_schema): """ Convert schema from Arrow to Spark. """ return StructType( [StructField(field.name, from_arrow_type(field.type), nullable=field.nullable) for field in arrow_schema])
[ "Convert", "schema", "from", "Arrow", "to", "Spark", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/types.py#L1677-L1682
[ "def", "from_arrow_schema", "(", "arrow_schema", ")", ":", "return", "StructType", "(", "[", "StructField", "(", "field", ".", "name", ",", "from_arrow_type", "(", "field", ".", "type", ")", ",", "nullable", "=", "field", ".", "nullable", ")", "for", "fiel...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
_check_series_localize_timestamps
Convert timezone aware timestamps to timezone-naive in the specified timezone or local timezone. If the input series is not a timestamp series, then the same series is returned. If the input series is a timestamp series, then a converted series is returned. :param s: pandas.Series :param timezone: the...
python/pyspark/sql/types.py
def _check_series_localize_timestamps(s, timezone): """ Convert timezone aware timestamps to timezone-naive in the specified timezone or local timezone. If the input series is not a timestamp series, then the same series is returned. If the input series is a timestamp series, then a converted series is...
def _check_series_localize_timestamps(s, timezone): """ Convert timezone aware timestamps to timezone-naive in the specified timezone or local timezone. If the input series is not a timestamp series, then the same series is returned. If the input series is a timestamp series, then a converted series is...
[ "Convert", "timezone", "aware", "timestamps", "to", "timezone", "-", "naive", "in", "the", "specified", "timezone", "or", "local", "timezone", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/types.py#L1700-L1720
[ "def", "_check_series_localize_timestamps", "(", "s", ",", "timezone", ")", ":", "from", "pyspark", ".", "sql", ".", "utils", "import", "require_minimum_pandas_version", "require_minimum_pandas_version", "(", ")", "from", "pandas", ".", "api", ".", "types", "import"...
618d6bff71073c8c93501ab7392c3cc579730f0b