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
get_py_filename
Return a valid python filename in the current directory. If the given name is not a file, it adds '.py' and searches again. Raises IOError with an informative message if the file isn't found. On Windows, apply Windows semantics to the filename. In particular, remove any quoting that has been applied t...
environment/lib/python2.7/site-packages/IPython/utils/path.py
def get_py_filename(name, force_win32=None): """Return a valid python filename in the current directory. If the given name is not a file, it adds '.py' and searches again. Raises IOError with an informative message if the file isn't found. On Windows, apply Windows semantics to the filename. In partic...
def get_py_filename(name, force_win32=None): """Return a valid python filename in the current directory. If the given name is not a file, it adds '.py' and searches again. Raises IOError with an informative message if the file isn't found. On Windows, apply Windows semantics to the filename. In partic...
[ "Return", "a", "valid", "python", "filename", "in", "the", "current", "directory", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L88-L110
[ "def", "get_py_filename", "(", "name", ",", "force_win32", "=", "None", ")", ":", "name", "=", "os", ".", "path", ".", "expanduser", "(", "name", ")", "if", "force_win32", "is", "None", ":", "win32", "=", "(", "sys", ".", "platform", "==", "'win32'", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
filefind
Find a file by looking through a sequence of paths. This iterates through a sequence of paths looking for a file and returns the full, absolute path of the first occurence of the file. If no set of path dirs is given, the filename is tested as is, after running through :func:`expandvars` and :func:`ex...
environment/lib/python2.7/site-packages/IPython/utils/path.py
def filefind(filename, path_dirs=None): """Find a file by looking through a sequence of paths. This iterates through a sequence of paths looking for a file and returns the full, absolute path of the first occurence of the file. If no set of path dirs is given, the filename is tested as is, after runni...
def filefind(filename, path_dirs=None): """Find a file by looking through a sequence of paths. This iterates through a sequence of paths looking for a file and returns the full, absolute path of the first occurence of the file. If no set of path dirs is given, the filename is tested as is, after runni...
[ "Find", "a", "file", "by", "looking", "through", "a", "sequence", "of", "paths", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L113-L164
[ "def", "filefind", "(", "filename", ",", "path_dirs", "=", "None", ")", ":", "# If paths are quoted, abspath gets confused, strip them...", "filename", "=", "filename", ".", "strip", "(", "'\"'", ")", ".", "strip", "(", "\"'\"", ")", "# If the input is an absolute pat...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
get_home_dir
Return the 'home' directory, as a unicode string. * First, check for frozen env in case of py2exe * Otherwise, defer to os.path.expanduser('~') See stdlib docs for how this is determined. $HOME is first priority on *ALL* platforms. Parameters ---------- require_writable : boo...
environment/lib/python2.7/site-packages/IPython/utils/path.py
def get_home_dir(require_writable=False): """Return the 'home' directory, as a unicode string. * First, check for frozen env in case of py2exe * Otherwise, defer to os.path.expanduser('~') See stdlib docs for how this is determined. $HOME is first priority on *ALL* platforms. Paramete...
def get_home_dir(require_writable=False): """Return the 'home' directory, as a unicode string. * First, check for frozen env in case of py2exe * Otherwise, defer to os.path.expanduser('~') See stdlib docs for how this is determined. $HOME is first priority on *ALL* platforms. Paramete...
[ "Return", "the", "home", "directory", "as", "a", "unicode", "string", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L171-L226
[ "def", "get_home_dir", "(", "require_writable", "=", "False", ")", ":", "# first, check py2exe distribution root directory for _ipython.", "# This overrides all. Normally does not exist.", "if", "hasattr", "(", "sys", ",", "\"frozen\"", ")", ":", "#Is frozen by py2exe", "if", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
get_xdg_dir
Return the XDG_CONFIG_HOME, if it is defined and exists, else None. This is only for non-OS X posix (Linux,Unix,etc.) systems.
environment/lib/python2.7/site-packages/IPython/utils/path.py
def get_xdg_dir(): """Return the XDG_CONFIG_HOME, if it is defined and exists, else None. This is only for non-OS X posix (Linux,Unix,etc.) systems. """ env = os.environ if os.name == 'posix' and sys.platform != 'darwin': # Linux, Unix, AIX, etc. # use ~/.config if empty OR not se...
def get_xdg_dir(): """Return the XDG_CONFIG_HOME, if it is defined and exists, else None. This is only for non-OS X posix (Linux,Unix,etc.) systems. """ env = os.environ if os.name == 'posix' and sys.platform != 'darwin': # Linux, Unix, AIX, etc. # use ~/.config if empty OR not se...
[ "Return", "the", "XDG_CONFIG_HOME", "if", "it", "is", "defined", "and", "exists", "else", "None", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L228-L243
[ "def", "get_xdg_dir", "(", ")", ":", "env", "=", "os", ".", "environ", "if", "os", ".", "name", "==", "'posix'", "and", "sys", ".", "platform", "!=", "'darwin'", ":", "# Linux, Unix, AIX, etc.", "# use ~/.config if empty OR not set", "xdg", "=", "env", ".", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
get_ipython_dir
Get the IPython directory for this platform and user. This uses the logic in `get_home_dir` to find the home directory and then adds .ipython to the end of the path.
environment/lib/python2.7/site-packages/IPython/utils/path.py
def get_ipython_dir(): """Get the IPython directory for this platform and user. This uses the logic in `get_home_dir` to find the home directory and then adds .ipython to the end of the path. """ env = os.environ pjoin = os.path.join ipdir_def = '.ipython' xdg_def = 'ipython' ho...
def get_ipython_dir(): """Get the IPython directory for this platform and user. This uses the logic in `get_home_dir` to find the home directory and then adds .ipython to the end of the path. """ env = os.environ pjoin = os.path.join ipdir_def = '.ipython' xdg_def = 'ipython' ho...
[ "Get", "the", "IPython", "directory", "for", "this", "platform", "and", "user", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L246-L299
[ "def", "get_ipython_dir", "(", ")", ":", "env", "=", "os", ".", "environ", "pjoin", "=", "os", ".", "path", ".", "join", "ipdir_def", "=", "'.ipython'", "xdg_def", "=", "'ipython'", "home_dir", "=", "get_home_dir", "(", ")", "xdg_dir", "=", "get_xdg_dir", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
get_ipython_package_dir
Get the base directory where IPython itself is installed.
environment/lib/python2.7/site-packages/IPython/utils/path.py
def get_ipython_package_dir(): """Get the base directory where IPython itself is installed.""" ipdir = os.path.dirname(IPython.__file__) return py3compat.cast_unicode(ipdir, fs_encoding)
def get_ipython_package_dir(): """Get the base directory where IPython itself is installed.""" ipdir = os.path.dirname(IPython.__file__) return py3compat.cast_unicode(ipdir, fs_encoding)
[ "Get", "the", "base", "directory", "where", "IPython", "itself", "is", "installed", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L302-L305
[ "def", "get_ipython_package_dir", "(", ")", ":", "ipdir", "=", "os", ".", "path", ".", "dirname", "(", "IPython", ".", "__file__", ")", "return", "py3compat", ".", "cast_unicode", "(", "ipdir", ",", "fs_encoding", ")" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
get_ipython_module_path
Find the path to an IPython module in this version of IPython. This will always find the version of the module that is in this importable IPython package. This will always return the path to the ``.py`` version of the module.
environment/lib/python2.7/site-packages/IPython/utils/path.py
def get_ipython_module_path(module_str): """Find the path to an IPython module in this version of IPython. This will always find the version of the module that is in this importable IPython package. This will always return the path to the ``.py`` version of the module. """ if module_str == 'IPy...
def get_ipython_module_path(module_str): """Find the path to an IPython module in this version of IPython. This will always find the version of the module that is in this importable IPython package. This will always return the path to the ``.py`` version of the module. """ if module_str == 'IPy...
[ "Find", "the", "path", "to", "an", "IPython", "module", "in", "this", "version", "of", "IPython", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L308-L320
[ "def", "get_ipython_module_path", "(", "module_str", ")", ":", "if", "module_str", "==", "'IPython'", ":", "return", "os", ".", "path", ".", "join", "(", "get_ipython_package_dir", "(", ")", ",", "'__init__.py'", ")", "mod", "=", "import_item", "(", "module_st...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
locate_profile
Find the path to the folder associated with a given profile. I.e. find $IPYTHONDIR/profile_whatever.
environment/lib/python2.7/site-packages/IPython/utils/path.py
def locate_profile(profile='default'): """Find the path to the folder associated with a given profile. I.e. find $IPYTHONDIR/profile_whatever. """ from IPython.core.profiledir import ProfileDir, ProfileDirError try: pd = ProfileDir.find_profile_dir_by_name(get_ipython_dir(), profile) ...
def locate_profile(profile='default'): """Find the path to the folder associated with a given profile. I.e. find $IPYTHONDIR/profile_whatever. """ from IPython.core.profiledir import ProfileDir, ProfileDirError try: pd = ProfileDir.find_profile_dir_by_name(get_ipython_dir(), profile) ...
[ "Find", "the", "path", "to", "the", "folder", "associated", "with", "a", "given", "profile", ".", "I", ".", "e", ".", "find", "$IPYTHONDIR", "/", "profile_whatever", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L322-L333
[ "def", "locate_profile", "(", "profile", "=", "'default'", ")", ":", "from", "IPython", ".", "core", ".", "profiledir", "import", "ProfileDir", ",", "ProfileDirError", "try", ":", "pd", "=", "ProfileDir", ".", "find_profile_dir_by_name", "(", "get_ipython_dir", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
expand_path
Expand $VARS and ~names in a string, like a shell :Examples: In [2]: os.environ['FOO']='test' In [3]: expand_path('variable FOO is $FOO') Out[3]: 'variable FOO is test'
environment/lib/python2.7/site-packages/IPython/utils/path.py
def expand_path(s): """Expand $VARS and ~names in a string, like a shell :Examples: In [2]: os.environ['FOO']='test' In [3]: expand_path('variable FOO is $FOO') Out[3]: 'variable FOO is test' """ # This is a pretty subtle hack. When expand user is given a UNC path # on Window...
def expand_path(s): """Expand $VARS and ~names in a string, like a shell :Examples: In [2]: os.environ['FOO']='test' In [3]: expand_path('variable FOO is $FOO') Out[3]: 'variable FOO is test' """ # This is a pretty subtle hack. When expand user is given a UNC path # on Window...
[ "Expand", "$VARS", "and", "~names", "in", "a", "string", "like", "a", "shell" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L335-L355
[ "def", "expand_path", "(", "s", ")", ":", "# This is a pretty subtle hack. When expand user is given a UNC path", "# on Windows (\\\\server\\share$\\%username%), os.path.expandvars, removes", "# the $ to get (\\\\server\\share\\%username%). I think it considered $", "# alone an empty var. But, we ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
target_outdated
Determine whether a target is out of date. target_outdated(target,deps) -> 1/0 deps: list of filenames which MUST exist. target: single filename which may or may not exist. If target doesn't exist or is older than any file listed in deps, return true, otherwise return false.
environment/lib/python2.7/site-packages/IPython/utils/path.py
def target_outdated(target,deps): """Determine whether a target is out of date. target_outdated(target,deps) -> 1/0 deps: list of filenames which MUST exist. target: single filename which may or may not exist. If target doesn't exist or is older than any file listed in deps, return true, othe...
def target_outdated(target,deps): """Determine whether a target is out of date. target_outdated(target,deps) -> 1/0 deps: list of filenames which MUST exist. target: single filename which may or may not exist. If target doesn't exist or is older than any file listed in deps, return true, othe...
[ "Determine", "whether", "a", "target", "is", "out", "of", "date", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L358-L379
[ "def", "target_outdated", "(", "target", ",", "deps", ")", ":", "try", ":", "target_time", "=", "os", ".", "path", ".", "getmtime", "(", "target", ")", "except", "os", ".", "error", ":", "return", "1", "for", "dep", "in", "deps", ":", "dep_time", "="...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
filehash
Make an MD5 hash of a file, ignoring any differences in line ending characters.
environment/lib/python2.7/site-packages/IPython/utils/path.py
def filehash(path): """Make an MD5 hash of a file, ignoring any differences in line ending characters.""" with open(path, "rU") as f: return md5(py3compat.str_to_bytes(f.read())).hexdigest()
def filehash(path): """Make an MD5 hash of a file, ignoring any differences in line ending characters.""" with open(path, "rU") as f: return md5(py3compat.str_to_bytes(f.read())).hexdigest()
[ "Make", "an", "MD5", "hash", "of", "a", "file", "ignoring", "any", "differences", "in", "line", "ending", "characters", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L393-L397
[ "def", "filehash", "(", "path", ")", ":", "with", "open", "(", "path", ",", "\"rU\"", ")", "as", "f", ":", "return", "md5", "(", "py3compat", ".", "str_to_bytes", "(", "f", ".", "read", "(", ")", ")", ")", ".", "hexdigest", "(", ")" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
check_for_old_config
Check for old config files, and present a warning if they exist. A link to the docs of the new config is included in the message. This should mitigate confusion with the transition to the new config system in 0.11.
environment/lib/python2.7/site-packages/IPython/utils/path.py
def check_for_old_config(ipython_dir=None): """Check for old config files, and present a warning if they exist. A link to the docs of the new config is included in the message. This should mitigate confusion with the transition to the new config system in 0.11. """ if ipython_dir is None: ...
def check_for_old_config(ipython_dir=None): """Check for old config files, and present a warning if they exist. A link to the docs of the new config is included in the message. This should mitigate confusion with the transition to the new config system in 0.11. """ if ipython_dir is None: ...
[ "Check", "for", "old", "config", "files", "and", "present", "a", "warning", "if", "they", "exist", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L405-L436
[ "def", "check_for_old_config", "(", "ipython_dir", "=", "None", ")", ":", "if", "ipython_dir", "is", "None", ":", "ipython_dir", "=", "get_ipython_dir", "(", ")", "old_configs", "=", "[", "'ipy_user_conf.py'", ",", "'ipythonrc'", ",", "'ipython_config.py'", "]", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
get_security_file
Return the absolute path of a security file given by filename and profile This allows users and developers to find security files without knowledge of the IPython directory structure. The search path will be ['.', profile.security_dir] Parameters ---------- filename : str ...
environment/lib/python2.7/site-packages/IPython/utils/path.py
def get_security_file(filename, profile='default'): """Return the absolute path of a security file given by filename and profile This allows users and developers to find security files without knowledge of the IPython directory structure. The search path will be ['.', profile.security_dir] ...
def get_security_file(filename, profile='default'): """Return the absolute path of a security file given by filename and profile This allows users and developers to find security files without knowledge of the IPython directory structure. The search path will be ['.', profile.security_dir] ...
[ "Return", "the", "absolute", "path", "of", "a", "security", "file", "given", "by", "filename", "and", "profile", "This", "allows", "users", "and", "developers", "to", "find", "security", "files", "without", "knowledge", "of", "the", "IPython", "directory", "st...
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L438-L467
[ "def", "get_security_file", "(", "filename", ",", "profile", "=", "'default'", ")", ":", "# import here, because profiledir also imports from utils.path", "from", "IPython", ".", "core", ".", "profiledir", "import", "ProfileDir", "try", ":", "pd", "=", "ProfileDir", "...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
update_suggestions_dictionary
Updates the suggestions' dictionary for an object upon visiting its page
suggestions/views.py
def update_suggestions_dictionary(request, object): """ Updates the suggestions' dictionary for an object upon visiting its page """ if request.user.is_authenticated(): user = request.user content_type = ContentType.objects.get_for_model(type(object)) try: # Check if ...
def update_suggestions_dictionary(request, object): """ Updates the suggestions' dictionary for an object upon visiting its page """ if request.user.is_authenticated(): user = request.user content_type = ContentType.objects.get_for_model(type(object)) try: # Check if ...
[ "Updates", "the", "suggestions", "dictionary", "for", "an", "object", "upon", "visiting", "its", "page" ]
dreidev/Suggestions
python
https://github.com/dreidev/Suggestions/blob/f04c181dc815d32c35b44c6e1c91521e88a9dd6c/suggestions/views.py#L5-L42
[ "def", "update_suggestions_dictionary", "(", "request", ",", "object", ")", ":", "if", "request", ".", "user", ".", "is_authenticated", "(", ")", ":", "user", "=", "request", ".", "user", "content_type", "=", "ContentType", ".", "objects", ".", "get_for_model"...
f04c181dc815d32c35b44c6e1c91521e88a9dd6c
test
get_suggestions_with_size
Gets a list with a certain size of suggestions for an object
suggestions/views.py
def get_suggestions_with_size(object, size): """ Gets a list with a certain size of suggestions for an object """ content_type = ContentType.objects.get_for_model(type(object)) try: return ObjectViewDictionary.objects.filter( current_object_id=object.id, current_content_type=...
def get_suggestions_with_size(object, size): """ Gets a list with a certain size of suggestions for an object """ content_type = ContentType.objects.get_for_model(type(object)) try: return ObjectViewDictionary.objects.filter( current_object_id=object.id, current_content_type=...
[ "Gets", "a", "list", "with", "a", "certain", "size", "of", "suggestions", "for", "an", "object" ]
dreidev/Suggestions
python
https://github.com/dreidev/Suggestions/blob/f04c181dc815d32c35b44c6e1c91521e88a9dd6c/suggestions/views.py#L100-L111
[ "def", "get_suggestions_with_size", "(", "object", ",", "size", ")", ":", "content_type", "=", "ContentType", ".", "objects", ".", "get_for_model", "(", "type", "(", "object", ")", ")", "try", ":", "return", "ObjectViewDictionary", ".", "objects", ".", "filter...
f04c181dc815d32c35b44c6e1c91521e88a9dd6c
test
get_suggestions
Gets a list of all suggestions for an object
suggestions/views.py
def get_suggestions(object): """ Gets a list of all suggestions for an object """ content_type = ContentType.objects.get_for_model(type(object)) return ObjectViewDictionary.objects.filter( current_object_id=object.id, current_content_type=content_type).extra(order_by=['-visits'])
def get_suggestions(object): """ Gets a list of all suggestions for an object """ content_type = ContentType.objects.get_for_model(type(object)) return ObjectViewDictionary.objects.filter( current_object_id=object.id, current_content_type=content_type).extra(order_by=['-visits'])
[ "Gets", "a", "list", "of", "all", "suggestions", "for", "an", "object" ]
dreidev/Suggestions
python
https://github.com/dreidev/Suggestions/blob/f04c181dc815d32c35b44c6e1c91521e88a9dd6c/suggestions/views.py#L114-L119
[ "def", "get_suggestions", "(", "object", ")", ":", "content_type", "=", "ContentType", ".", "objects", ".", "get_for_model", "(", "type", "(", "object", ")", ")", "return", "ObjectViewDictionary", ".", "objects", ".", "filter", "(", "current_object_id", "=", "...
f04c181dc815d32c35b44c6e1c91521e88a9dd6c
test
path.relpath
Return this path as a relative path, based from the current working directory.
environment/lib/python2.7/site-packages/IPython/external/path/_path.py
def relpath(self): """ Return this path as a relative path, based from the current working directory. """ cwd = self.__class__(os.getcwdu()) return cwd.relpathto(self)
def relpath(self): """ Return this path as a relative path, based from the current working directory. """ cwd = self.__class__(os.getcwdu()) return cwd.relpathto(self)
[ "Return", "this", "path", "as", "a", "relative", "path", "based", "from", "the", "current", "working", "directory", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/external/path/_path.py#L244-L249
[ "def", "relpath", "(", "self", ")", ":", "cwd", "=", "self", ".", "__class__", "(", "os", ".", "getcwdu", "(", ")", ")", "return", "cwd", ".", "relpathto", "(", "self", ")" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
path.glob
Return a list of path objects that match the pattern. pattern - a path relative to this directory, with wildcards. For example, path('/users').glob('*/bin/*') returns a list of all the files users have in their bin directories.
environment/lib/python2.7/site-packages/IPython/external/path/_path.py
def glob(self, pattern): """ Return a list of path objects that match the pattern. pattern - a path relative to this directory, with wildcards. For example, path('/users').glob('*/bin/*') returns a list of all the files users have in their bin directories. """ cls = sel...
def glob(self, pattern): """ Return a list of path objects that match the pattern. pattern - a path relative to this directory, with wildcards. For example, path('/users').glob('*/bin/*') returns a list of all the files users have in their bin directories. """ cls = sel...
[ "Return", "a", "list", "of", "path", "objects", "that", "match", "the", "pattern", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/external/path/_path.py#L478-L487
[ "def", "glob", "(", "self", ",", "pattern", ")", ":", "cls", "=", "self", ".", "__class__", "return", "[", "cls", "(", "s", ")", "for", "s", "in", "glob", ".", "glob", "(", "unicode", "(", "self", "/", "pattern", ")", ")", "]" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
path.lines
r""" Open this file, read all lines, return them in a list. Optional arguments: encoding - The Unicode encoding (or character set) of the file. The default is None, meaning the content of the file is read as 8-bit characters and returned as a list of...
environment/lib/python2.7/site-packages/IPython/external/path/_path.py
def lines(self, encoding=None, errors='strict', retain=True): r""" Open this file, read all lines, return them in a list. Optional arguments: encoding - The Unicode encoding (or character set) of the file. The default is None, meaning the content of the file...
def lines(self, encoding=None, errors='strict', retain=True): r""" Open this file, read all lines, return them in a list. Optional arguments: encoding - The Unicode encoding (or character set) of the file. The default is None, meaning the content of the file...
[ "r", "Open", "this", "file", "read", "all", "lines", "return", "them", "in", "a", "list", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/external/path/_path.py#L646-L670
[ "def", "lines", "(", "self", ",", "encoding", "=", "None", ",", "errors", "=", "'strict'", ",", "retain", "=", "True", ")", ":", "if", "encoding", "is", "None", "and", "retain", ":", "f", "=", "self", ".", "open", "(", "'U'", ")", "try", ":", "re...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
path.read_md5
Calculate the md5 hash for this file. This reads through the entire file.
environment/lib/python2.7/site-packages/IPython/external/path/_path.py
def read_md5(self): """ Calculate the md5 hash for this file. This reads through the entire file. """ f = self.open('rb') try: m = md5() while True: d = f.read(8192) if not d: break m.upd...
def read_md5(self): """ Calculate the md5 hash for this file. This reads through the entire file. """ f = self.open('rb') try: m = md5() while True: d = f.read(8192) if not d: break m.upd...
[ "Calculate", "the", "md5", "hash", "for", "this", "file", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/external/path/_path.py#L737-L752
[ "def", "read_md5", "(", "self", ")", ":", "f", "=", "self", ".", "open", "(", "'rb'", ")", "try", ":", "m", "=", "md5", "(", ")", "while", "True", ":", "d", "=", "f", ".", "read", "(", "8192", ")", "if", "not", "d", ":", "break", "m", ".", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
Profile.options
Register commandline options.
environment/lib/python2.7/site-packages/nose/plugins/prof.py
def options(self, parser, env): """Register commandline options. """ if not self.available(): return Plugin.options(self, parser, env) parser.add_option('--profile-sort', action='store', dest='profile_sort', default=env.get('NOSE_PROFILE_SORT...
def options(self, parser, env): """Register commandline options. """ if not self.available(): return Plugin.options(self, parser, env) parser.add_option('--profile-sort', action='store', dest='profile_sort', default=env.get('NOSE_PROFILE_SORT...
[ "Register", "commandline", "options", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/prof.py#L33-L54
[ "def", "options", "(", "self", ",", "parser", ",", "env", ")", ":", "if", "not", "self", ".", "available", "(", ")", ":", "return", "Plugin", ".", "options", "(", "self", ",", "parser", ",", "env", ")", "parser", ".", "add_option", "(", "'--profile-s...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
Profile.begin
Create profile stats file and load profiler.
environment/lib/python2.7/site-packages/nose/plugins/prof.py
def begin(self): """Create profile stats file and load profiler. """ if not self.available(): return self._create_pfile() self.prof = hotshot.Profile(self.pfile)
def begin(self): """Create profile stats file and load profiler. """ if not self.available(): return self._create_pfile() self.prof = hotshot.Profile(self.pfile)
[ "Create", "profile", "stats", "file", "and", "load", "profiler", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/prof.py#L60-L66
[ "def", "begin", "(", "self", ")", ":", "if", "not", "self", ".", "available", "(", ")", ":", "return", "self", ".", "_create_pfile", "(", ")", "self", ".", "prof", "=", "hotshot", ".", "Profile", "(", "self", ".", "pfile", ")" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
Profile.configure
Configure plugin.
environment/lib/python2.7/site-packages/nose/plugins/prof.py
def configure(self, options, conf): """Configure plugin. """ if not self.available(): self.enabled = False return Plugin.configure(self, options, conf) self.conf = conf if options.profile_stats_file: self.pfile = options.profile_stats_f...
def configure(self, options, conf): """Configure plugin. """ if not self.available(): self.enabled = False return Plugin.configure(self, options, conf) self.conf = conf if options.profile_stats_file: self.pfile = options.profile_stats_f...
[ "Configure", "plugin", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/prof.py#L68-L84
[ "def", "configure", "(", "self", ",", "options", ",", "conf", ")", ":", "if", "not", "self", ".", "available", "(", ")", ":", "self", ".", "enabled", "=", "False", "return", "Plugin", ".", "configure", "(", "self", ",", "options", ",", "conf", ")", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
Profile.report
Output profiler report.
environment/lib/python2.7/site-packages/nose/plugins/prof.py
def report(self, stream): """Output profiler report. """ log.debug('printing profiler report') self.prof.close() prof_stats = stats.load(self.pfile) prof_stats.sort_stats(self.sort) # 2.5 has completely different stream handling from 2.4 and earlier. # Be...
def report(self, stream): """Output profiler report. """ log.debug('printing profiler report') self.prof.close() prof_stats = stats.load(self.pfile) prof_stats.sort_stats(self.sort) # 2.5 has completely different stream handling from 2.4 and earlier. # Be...
[ "Output", "profiler", "report", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/prof.py#L97-L125
[ "def", "report", "(", "self", ",", "stream", ")", ":", "log", ".", "debug", "(", "'printing profiler report'", ")", "self", ".", "prof", ".", "close", "(", ")", "prof_stats", "=", "stats", ".", "load", "(", "self", ".", "pfile", ")", "prof_stats", ".",...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
Profile.finalize
Clean up stats file, if configured to do so.
environment/lib/python2.7/site-packages/nose/plugins/prof.py
def finalize(self, result): """Clean up stats file, if configured to do so. """ if not self.available(): return try: self.prof.close() except AttributeError: # TODO: is this trying to catch just the case where not # hasattr(self.pro...
def finalize(self, result): """Clean up stats file, if configured to do so. """ if not self.available(): return try: self.prof.close() except AttributeError: # TODO: is this trying to catch just the case where not # hasattr(self.pro...
[ "Clean", "up", "stats", "file", "if", "configured", "to", "do", "so", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/prof.py#L127-L149
[ "def", "finalize", "(", "self", ",", "result", ")", ":", "if", "not", "self", ".", "available", "(", ")", ":", "return", "try", ":", "self", ".", "prof", ".", "close", "(", ")", "except", "AttributeError", ":", "# TODO: is this trying to catch just the case ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
Command.handle
Handle CLI command
src/sisy/management/commands/sisy_heartbeat.py
def handle(self, *args, **options): """Handle CLI command""" try: while True: Channel(HEARTBEAT_CHANNEL).send({'time':time.time()}) time.sleep(HEARTBEAT_FREQUENCY) except KeyboardInterrupt: print("Received keyboard interrupt, exiting...")
def handle(self, *args, **options): """Handle CLI command""" try: while True: Channel(HEARTBEAT_CHANNEL).send({'time':time.time()}) time.sleep(HEARTBEAT_FREQUENCY) except KeyboardInterrupt: print("Received keyboard interrupt, exiting...")
[ "Handle", "CLI", "command" ]
phoikoi/sisy
python
https://github.com/phoikoi/sisy/blob/840c5463ab65488d34e99531f230e61f755d2d69/src/sisy/management/commands/sisy_heartbeat.py#L15-L22
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "try", ":", "while", "True", ":", "Channel", "(", "HEARTBEAT_CHANNEL", ")", ".", "send", "(", "{", "'time'", ":", "time", ".", "time", "(", ")", "}", ")", "time",...
840c5463ab65488d34e99531f230e61f755d2d69
test
InputHookManager.enable_wx
Enable event loop integration with wxPython. Parameters ---------- app : WX Application, optional. Running application to use. If not given, we probe WX for an existing application object, and create a new one if none is found. Notes ----- This ...
environment/lib/python2.7/site-packages/IPython/lib/inputhook.py
def enable_wx(self, app=None): """Enable event loop integration with wxPython. Parameters ---------- app : WX Application, optional. Running application to use. If not given, we probe WX for an existing application object, and create a new one if none is found. ...
def enable_wx(self, app=None): """Enable event loop integration with wxPython. Parameters ---------- app : WX Application, optional. Running application to use. If not given, we probe WX for an existing application object, and create a new one if none is found. ...
[ "Enable", "event", "loop", "integration", "with", "wxPython", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhook.py#L182-L221
[ "def", "enable_wx", "(", "self", ",", "app", "=", "None", ")", ":", "import", "wx", "wx_version", "=", "V", "(", "wx", ".", "__version__", ")", ".", "version", "if", "wx_version", "<", "[", "2", ",", "8", "]", ":", "raise", "ValueError", "(", "\"re...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
InputHookManager.disable_wx
Disable event loop integration with wxPython. This merely sets PyOS_InputHook to NULL.
environment/lib/python2.7/site-packages/IPython/lib/inputhook.py
def disable_wx(self): """Disable event loop integration with wxPython. This merely sets PyOS_InputHook to NULL. """ if self._apps.has_key(GUI_WX): self._apps[GUI_WX]._in_event_loop = False self.clear_inputhook()
def disable_wx(self): """Disable event loop integration with wxPython. This merely sets PyOS_InputHook to NULL. """ if self._apps.has_key(GUI_WX): self._apps[GUI_WX]._in_event_loop = False self.clear_inputhook()
[ "Disable", "event", "loop", "integration", "with", "wxPython", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhook.py#L223-L230
[ "def", "disable_wx", "(", "self", ")", ":", "if", "self", ".", "_apps", ".", "has_key", "(", "GUI_WX", ")", ":", "self", ".", "_apps", "[", "GUI_WX", "]", ".", "_in_event_loop", "=", "False", "self", ".", "clear_inputhook", "(", ")" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
InputHookManager.enable_qt4
Enable event loop integration with PyQt4. Parameters ---------- app : Qt Application, optional. Running application to use. If not given, we probe Qt for an existing application object, and create a new one if none is found. Notes ----- ...
environment/lib/python2.7/site-packages/IPython/lib/inputhook.py
def enable_qt4(self, app=None): """Enable event loop integration with PyQt4. Parameters ---------- app : Qt Application, optional. Running application to use. If not given, we probe Qt for an existing application object, and create a new one if none is f...
def enable_qt4(self, app=None): """Enable event loop integration with PyQt4. Parameters ---------- app : Qt Application, optional. Running application to use. If not given, we probe Qt for an existing application object, and create a new one if none is f...
[ "Enable", "event", "loop", "integration", "with", "PyQt4", ".", "Parameters", "----------", "app", ":", "Qt", "Application", "optional", ".", "Running", "application", "to", "use", ".", "If", "not", "given", "we", "probe", "Qt", "for", "an", "existing", "app...
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhook.py#L232-L261
[ "def", "enable_qt4", "(", "self", ",", "app", "=", "None", ")", ":", "from", "IPython", ".", "lib", ".", "inputhookqt4", "import", "create_inputhook_qt4", "app", ",", "inputhook_qt4", "=", "create_inputhook_qt4", "(", "self", ",", "app", ")", "self", ".", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
InputHookManager.disable_qt4
Disable event loop integration with PyQt4. This merely sets PyOS_InputHook to NULL.
environment/lib/python2.7/site-packages/IPython/lib/inputhook.py
def disable_qt4(self): """Disable event loop integration with PyQt4. This merely sets PyOS_InputHook to NULL. """ if self._apps.has_key(GUI_QT4): self._apps[GUI_QT4]._in_event_loop = False self.clear_inputhook()
def disable_qt4(self): """Disable event loop integration with PyQt4. This merely sets PyOS_InputHook to NULL. """ if self._apps.has_key(GUI_QT4): self._apps[GUI_QT4]._in_event_loop = False self.clear_inputhook()
[ "Disable", "event", "loop", "integration", "with", "PyQt4", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhook.py#L263-L270
[ "def", "disable_qt4", "(", "self", ")", ":", "if", "self", ".", "_apps", ".", "has_key", "(", "GUI_QT4", ")", ":", "self", ".", "_apps", "[", "GUI_QT4", "]", ".", "_in_event_loop", "=", "False", "self", ".", "clear_inputhook", "(", ")" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
InputHookManager.enable_gtk
Enable event loop integration with PyGTK. Parameters ---------- app : ignored Ignored, it's only a placeholder to keep the call signature of all gui activation methods consistent, which simplifies the logic of supporting magics. Notes ----- ...
environment/lib/python2.7/site-packages/IPython/lib/inputhook.py
def enable_gtk(self, app=None): """Enable event loop integration with PyGTK. Parameters ---------- app : ignored Ignored, it's only a placeholder to keep the call signature of all gui activation methods consistent, which simplifies the logic of supportin...
def enable_gtk(self, app=None): """Enable event loop integration with PyGTK. Parameters ---------- app : ignored Ignored, it's only a placeholder to keep the call signature of all gui activation methods consistent, which simplifies the logic of supportin...
[ "Enable", "event", "loop", "integration", "with", "PyGTK", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhook.py#L272-L296
[ "def", "enable_gtk", "(", "self", ",", "app", "=", "None", ")", ":", "import", "gtk", "try", ":", "gtk", ".", "set_interactive", "(", "True", ")", "self", ".", "_current_gui", "=", "GUI_GTK", "except", "AttributeError", ":", "# For older versions of gtk, use o...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
InputHookManager.enable_tk
Enable event loop integration with Tk. Parameters ---------- app : toplevel :class:`Tkinter.Tk` widget, optional. Running toplevel widget to use. If not given, we probe Tk for an existing one, and create a new one if none is found. Notes ----- I...
environment/lib/python2.7/site-packages/IPython/lib/inputhook.py
def enable_tk(self, app=None): """Enable event loop integration with Tk. Parameters ---------- app : toplevel :class:`Tkinter.Tk` widget, optional. Running toplevel widget to use. If not given, we probe Tk for an existing one, and create a new one if none is fou...
def enable_tk(self, app=None): """Enable event loop integration with Tk. Parameters ---------- app : toplevel :class:`Tkinter.Tk` widget, optional. Running toplevel widget to use. If not given, we probe Tk for an existing one, and create a new one if none is fou...
[ "Enable", "event", "loop", "integration", "with", "Tk", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhook.py#L305-L327
[ "def", "enable_tk", "(", "self", ",", "app", "=", "None", ")", ":", "self", ".", "_current_gui", "=", "GUI_TK", "if", "app", "is", "None", ":", "import", "Tkinter", "app", "=", "Tkinter", ".", "Tk", "(", ")", "app", ".", "withdraw", "(", ")", "self...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
InputHookManager.enable_pyglet
Enable event loop integration with pyglet. Parameters ---------- app : ignored Ignored, it's only a placeholder to keep the call signature of all gui activation methods consistent, which simplifies the logic of supporting magics. Notes ----- ...
environment/lib/python2.7/site-packages/IPython/lib/inputhook.py
def enable_pyglet(self, app=None): """Enable event loop integration with pyglet. Parameters ---------- app : ignored Ignored, it's only a placeholder to keep the call signature of all gui activation methods consistent, which simplifies the logic of suppo...
def enable_pyglet(self, app=None): """Enable event loop integration with pyglet. Parameters ---------- app : ignored Ignored, it's only a placeholder to keep the call signature of all gui activation methods consistent, which simplifies the logic of suppo...
[ "Enable", "event", "loop", "integration", "with", "pyglet", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhook.py#L403-L424
[ "def", "enable_pyglet", "(", "self", ",", "app", "=", "None", ")", ":", "import", "pyglet", "from", "IPython", ".", "lib", ".", "inputhookpyglet", "import", "inputhook_pyglet", "self", ".", "set_inputhook", "(", "inputhook_pyglet", ")", "self", ".", "_current_...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
InputHookManager.enable_gtk3
Enable event loop integration with Gtk3 (gir bindings). Parameters ---------- app : ignored Ignored, it's only a placeholder to keep the call signature of all gui activation methods consistent, which simplifies the logic of supporting magics. Notes ...
environment/lib/python2.7/site-packages/IPython/lib/inputhook.py
def enable_gtk3(self, app=None): """Enable event loop integration with Gtk3 (gir bindings). Parameters ---------- app : ignored Ignored, it's only a placeholder to keep the call signature of all gui activation methods consistent, which simplifies the logic of ...
def enable_gtk3(self, app=None): """Enable event loop integration with Gtk3 (gir bindings). Parameters ---------- app : ignored Ignored, it's only a placeholder to keep the call signature of all gui activation methods consistent, which simplifies the logic of ...
[ "Enable", "event", "loop", "integration", "with", "Gtk3", "(", "gir", "bindings", ")", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhook.py#L433-L451
[ "def", "enable_gtk3", "(", "self", ",", "app", "=", "None", ")", ":", "from", "IPython", ".", "lib", ".", "inputhookgtk3", "import", "inputhook_gtk3", "self", ".", "set_inputhook", "(", "inputhook_gtk3", ")", "self", ".", "_current_gui", "=", "GUI_GTK" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
setup_partitioner
create a partitioner in the engine namespace
environment/share/doc/ipython/examples/parallel/wave2D/parallelwave-mpi.py
def setup_partitioner(index, num_procs, gnum_cells, parts): """create a partitioner in the engine namespace""" global partitioner p = MPIRectPartitioner2D(my_id=index, num_procs=num_procs) p.redim(global_num_cells=gnum_cells, num_parts=parts) p.prepare_communication() # put the partitioner into ...
def setup_partitioner(index, num_procs, gnum_cells, parts): """create a partitioner in the engine namespace""" global partitioner p = MPIRectPartitioner2D(my_id=index, num_procs=num_procs) p.redim(global_num_cells=gnum_cells, num_parts=parts) p.prepare_communication() # put the partitioner into ...
[ "create", "a", "partitioner", "in", "the", "engine", "namespace" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/wave2D/parallelwave-mpi.py#L33-L40
[ "def", "setup_partitioner", "(", "index", ",", "num_procs", ",", "gnum_cells", ",", "parts", ")", ":", "global", "partitioner", "p", "=", "MPIRectPartitioner2D", "(", "my_id", "=", "index", ",", "num_procs", "=", "num_procs", ")", "p", ".", "redim", "(", "...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
wave_saver
save the wave log
environment/share/doc/ipython/examples/parallel/wave2D/parallelwave-mpi.py
def wave_saver(u, x, y, t): """save the wave log""" global u_hist global t_hist t_hist.append(t) u_hist.append(1.0*u)
def wave_saver(u, x, y, t): """save the wave log""" global u_hist global t_hist t_hist.append(t) u_hist.append(1.0*u)
[ "save", "the", "wave", "log" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/wave2D/parallelwave-mpi.py#L47-L52
[ "def", "wave_saver", "(", "u", ",", "x", ",", "y", ",", "t", ")", ":", "global", "u_hist", "global", "t_hist", "t_hist", ".", "append", "(", "t", ")", "u_hist", ".", "append", "(", "1.0", "*", "u", ")" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
extract_hist_ranges
Turn a string of history ranges into 3-tuples of (session, start, stop). Examples -------- list(extract_input_ranges("~8/5-~7/4 2")) [(-8, 5, None), (-7, 1, 4), (0, 2, 3)]
environment/lib/python2.7/site-packages/IPython/core/history.py
def extract_hist_ranges(ranges_str): """Turn a string of history ranges into 3-tuples of (session, start, stop). Examples -------- list(extract_input_ranges("~8/5-~7/4 2")) [(-8, 5, None), (-7, 1, 4), (0, 2, 3)] """ for range_str in ranges_str.split(): rmatch = range_re.match(range_...
def extract_hist_ranges(ranges_str): """Turn a string of history ranges into 3-tuples of (session, start, stop). Examples -------- list(extract_input_ranges("~8/5-~7/4 2")) [(-8, 5, None), (-7, 1, 4), (0, 2, 3)] """ for range_str in ranges_str.split(): rmatch = range_re.match(range_...
[ "Turn", "a", "string", "of", "history", "ranges", "into", "3", "-", "tuples", "of", "(", "session", "start", "stop", ")", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L682-L712
[ "def", "extract_hist_ranges", "(", "ranges_str", ")", ":", "for", "range_str", "in", "ranges_str", ".", "split", "(", ")", ":", "rmatch", "=", "range_re", ".", "match", "(", "range_str", ")", "if", "not", "rmatch", ":", "continue", "start", "=", "int", "...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryAccessor.init_db
Connect to the database, and create tables if necessary.
environment/lib/python2.7/site-packages/IPython/core/history.py
def init_db(self): """Connect to the database, and create tables if necessary.""" # use detect_types so that timestamps return datetime objects self.db = sqlite3.connect(self.hist_file, detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES) self.db.execute("""CR...
def init_db(self): """Connect to the database, and create tables if necessary.""" # use detect_types so that timestamps return datetime objects self.db = sqlite3.connect(self.hist_file, detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES) self.db.execute("""CR...
[ "Connect", "to", "the", "database", "and", "create", "tables", "if", "necessary", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L149-L165
[ "def", "init_db", "(", "self", ")", ":", "# use detect_types so that timestamps return datetime objects", "self", ".", "db", "=", "sqlite3", ".", "connect", "(", "self", ".", "hist_file", ",", "detect_types", "=", "sqlite3", ".", "PARSE_DECLTYPES", "|", "sqlite3", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryAccessor._run_sql
Prepares and runs an SQL query for the history database. Parameters ---------- sql : str Any filtering expressions to go after SELECT ... FROM ... params : tuple Parameters passed to the SQL query (to replace "?") raw, output : bool See :meth:`get_r...
environment/lib/python2.7/site-packages/IPython/core/history.py
def _run_sql(self, sql, params, raw=True, output=False): """Prepares and runs an SQL query for the history database. Parameters ---------- sql : str Any filtering expressions to go after SELECT ... FROM ... params : tuple Parameters passed to the SQL query (t...
def _run_sql(self, sql, params, raw=True, output=False): """Prepares and runs an SQL query for the history database. Parameters ---------- sql : str Any filtering expressions to go after SELECT ... FROM ... params : tuple Parameters passed to the SQL query (t...
[ "Prepares", "and", "runs", "an", "SQL", "query", "for", "the", "history", "database", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L175-L200
[ "def", "_run_sql", "(", "self", ",", "sql", ",", "params", ",", "raw", "=", "True", ",", "output", "=", "False", ")", ":", "toget", "=", "'source_raw'", "if", "raw", "else", "'source'", "sqlfrom", "=", "\"history\"", "if", "output", ":", "sqlfrom", "="...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryAccessor.get_session_info
get info about a session Parameters ---------- session : int Session number to retrieve. The current session is 0, and negative numbers count back from current session, so -1 is previous session. Returns ------- (session_id [int], start [dateti...
environment/lib/python2.7/site-packages/IPython/core/history.py
def get_session_info(self, session=0): """get info about a session Parameters ---------- session : int Session number to retrieve. The current session is 0, and negative numbers count back from current session, so -1 is previous session. Returns ...
def get_session_info(self, session=0): """get info about a session Parameters ---------- session : int Session number to retrieve. The current session is 0, and negative numbers count back from current session, so -1 is previous session. Returns ...
[ "get", "info", "about", "a", "session" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L203-L228
[ "def", "get_session_info", "(", "self", ",", "session", "=", "0", ")", ":", "if", "session", "<=", "0", ":", "session", "+=", "self", ".", "session_number", "query", "=", "\"SELECT * from sessions where session == ?\"", "return", "self", ".", "db", ".", "execu...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryAccessor.get_tail
Get the last n lines from the history database. Parameters ---------- n : int The number of lines to get raw, output : bool See :meth:`get_range` include_latest : bool If False (default), n+1 lines are fetched, and the latest one is discar...
environment/lib/python2.7/site-packages/IPython/core/history.py
def get_tail(self, n=10, raw=True, output=False, include_latest=False): """Get the last n lines from the history database. Parameters ---------- n : int The number of lines to get raw, output : bool See :meth:`get_range` include_latest : bool ...
def get_tail(self, n=10, raw=True, output=False, include_latest=False): """Get the last n lines from the history database. Parameters ---------- n : int The number of lines to get raw, output : bool See :meth:`get_range` include_latest : bool ...
[ "Get", "the", "last", "n", "lines", "from", "the", "history", "database", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L230-L255
[ "def", "get_tail", "(", "self", ",", "n", "=", "10", ",", "raw", "=", "True", ",", "output", "=", "False", ",", "include_latest", "=", "False", ")", ":", "self", ".", "writeout_cache", "(", ")", "if", "not", "include_latest", ":", "n", "+=", "1", "...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryAccessor.search
Search the database using unix glob-style matching (wildcards * and ?). Parameters ---------- pattern : str The wildcarded pattern to match when searching search_raw : bool If True, search the raw input, otherwise, the parsed input raw, output : bool ...
environment/lib/python2.7/site-packages/IPython/core/history.py
def search(self, pattern="*", raw=True, search_raw=True, output=False): """Search the database using unix glob-style matching (wildcards * and ?). Parameters ---------- pattern : str The wildcarded pattern to matc...
def search(self, pattern="*", raw=True, search_raw=True, output=False): """Search the database using unix glob-style matching (wildcards * and ?). Parameters ---------- pattern : str The wildcarded pattern to matc...
[ "Search", "the", "database", "using", "unix", "glob", "-", "style", "matching", "(", "wildcards", "*", "and", "?", ")", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L257-L280
[ "def", "search", "(", "self", ",", "pattern", "=", "\"*\"", ",", "raw", "=", "True", ",", "search_raw", "=", "True", ",", "output", "=", "False", ")", ":", "tosearch", "=", "\"source_raw\"", "if", "search_raw", "else", "\"source\"", "if", "output", ":", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryAccessor.get_range
Retrieve input by session. Parameters ---------- session : int Session number to retrieve. start : int First line to retrieve. stop : int End of line range (excluded from output itself). If None, retrieve to the end of the session....
environment/lib/python2.7/site-packages/IPython/core/history.py
def get_range(self, session, start=1, stop=None, raw=True,output=False): """Retrieve input by session. Parameters ---------- session : int Session number to retrieve. start : int First line to retrieve. stop : int End of line range (ex...
def get_range(self, session, start=1, stop=None, raw=True,output=False): """Retrieve input by session. Parameters ---------- session : int Session number to retrieve. start : int First line to retrieve. stop : int End of line range (ex...
[ "Retrieve", "input", "by", "session", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L282-L316
[ "def", "get_range", "(", "self", ",", "session", ",", "start", "=", "1", ",", "stop", "=", "None", ",", "raw", "=", "True", ",", "output", "=", "False", ")", ":", "if", "stop", ":", "lineclause", "=", "\"line >= ? AND line < ?\"", "params", "=", "(", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryAccessor.get_range_by_str
Get lines of history from a string of ranges, as used by magic commands %hist, %save, %macro, etc. Parameters ---------- rangestr : str A string specifying ranges, e.g. "5 ~2/1-4". See :func:`magic_history` for full details. raw, output : bool As :m...
environment/lib/python2.7/site-packages/IPython/core/history.py
def get_range_by_str(self, rangestr, raw=True, output=False): """Get lines of history from a string of ranges, as used by magic commands %hist, %save, %macro, etc. Parameters ---------- rangestr : str A string specifying ranges, e.g. "5 ~2/1-4". See :func:`ma...
def get_range_by_str(self, rangestr, raw=True, output=False): """Get lines of history from a string of ranges, as used by magic commands %hist, %save, %macro, etc. Parameters ---------- rangestr : str A string specifying ranges, e.g. "5 ~2/1-4". See :func:`ma...
[ "Get", "lines", "of", "history", "from", "a", "string", "of", "ranges", "as", "used", "by", "magic", "commands", "%hist", "%save", "%macro", "etc", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L318-L336
[ "def", "get_range_by_str", "(", "self", ",", "rangestr", ",", "raw", "=", "True", ",", "output", "=", "False", ")", ":", "for", "sess", ",", "s", ",", "e", "in", "extract_hist_ranges", "(", "rangestr", ")", ":", "for", "line", "in", "self", ".", "get...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryManager._get_hist_file_name
Get default history file name based on the Shell's profile. The profile parameter is ignored, but must exist for compatibility with the parent class.
environment/lib/python2.7/site-packages/IPython/core/history.py
def _get_hist_file_name(self, profile=None): """Get default history file name based on the Shell's profile. The profile parameter is ignored, but must exist for compatibility with the parent class.""" profile_dir = self.shell.profile_dir.location return os.path.join(prof...
def _get_hist_file_name(self, profile=None): """Get default history file name based on the Shell's profile. The profile parameter is ignored, but must exist for compatibility with the parent class.""" profile_dir = self.shell.profile_dir.location return os.path.join(prof...
[ "Get", "default", "history", "file", "name", "based", "on", "the", "Shell", "s", "profile", ".", "The", "profile", "parameter", "is", "ignored", "but", "must", "exist", "for", "compatibility", "with", "the", "parent", "class", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L411-L417
[ "def", "_get_hist_file_name", "(", "self", ",", "profile", "=", "None", ")", ":", "profile_dir", "=", "self", ".", "shell", ".", "profile_dir", ".", "location", "return", "os", ".", "path", ".", "join", "(", "profile_dir", ",", "'history.sqlite'", ")" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryManager.new_session
Get a new session number.
environment/lib/python2.7/site-packages/IPython/core/history.py
def new_session(self, conn=None): """Get a new session number.""" if conn is None: conn = self.db with conn: cur = conn.execute("""INSERT INTO sessions VALUES (NULL, ?, NULL, NULL, "") """, (datetime.datetime.now(),)) self....
def new_session(self, conn=None): """Get a new session number.""" if conn is None: conn = self.db with conn: cur = conn.execute("""INSERT INTO sessions VALUES (NULL, ?, NULL, NULL, "") """, (datetime.datetime.now(),)) self....
[ "Get", "a", "new", "session", "number", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L420-L428
[ "def", "new_session", "(", "self", ",", "conn", "=", "None", ")", ":", "if", "conn", "is", "None", ":", "conn", "=", "self", ".", "db", "with", "conn", ":", "cur", "=", "conn", ".", "execute", "(", "\"\"\"INSERT INTO sessions VALUES (NULL, ?, NULL,\n ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryManager.end_session
Close the database session, filling in the end time and line count.
environment/lib/python2.7/site-packages/IPython/core/history.py
def end_session(self): """Close the database session, filling in the end time and line count.""" self.writeout_cache() with self.db: self.db.execute("""UPDATE sessions SET end=?, num_cmds=? WHERE session==?""", (datetime.datetime.now(), ...
def end_session(self): """Close the database session, filling in the end time and line count.""" self.writeout_cache() with self.db: self.db.execute("""UPDATE sessions SET end=?, num_cmds=? WHERE session==?""", (datetime.datetime.now(), ...
[ "Close", "the", "database", "session", "filling", "in", "the", "end", "time", "and", "line", "count", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L430-L437
[ "def", "end_session", "(", "self", ")", ":", "self", ".", "writeout_cache", "(", ")", "with", "self", ".", "db", ":", "self", ".", "db", ".", "execute", "(", "\"\"\"UPDATE sessions SET end=?, num_cmds=? WHERE\n session==?\"\"\"", ",", "(", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryManager.name_session
Give the current session a name in the history database.
environment/lib/python2.7/site-packages/IPython/core/history.py
def name_session(self, name): """Give the current session a name in the history database.""" with self.db: self.db.execute("UPDATE sessions SET remark=? WHERE session==?", (name, self.session_number))
def name_session(self, name): """Give the current session a name in the history database.""" with self.db: self.db.execute("UPDATE sessions SET remark=? WHERE session==?", (name, self.session_number))
[ "Give", "the", "current", "session", "a", "name", "in", "the", "history", "database", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L439-L443
[ "def", "name_session", "(", "self", ",", "name", ")", ":", "with", "self", ".", "db", ":", "self", ".", "db", ".", "execute", "(", "\"UPDATE sessions SET remark=? WHERE session==?\"", ",", "(", "name", ",", "self", ".", "session_number", ")", ")" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryManager.reset
Clear the session history, releasing all object references, and optionally open a new session.
environment/lib/python2.7/site-packages/IPython/core/history.py
def reset(self, new_session=True): """Clear the session history, releasing all object references, and optionally open a new session.""" self.output_hist.clear() # The directory history can't be completely empty self.dir_hist[:] = [os.getcwdu()] if new_session: ...
def reset(self, new_session=True): """Clear the session history, releasing all object references, and optionally open a new session.""" self.output_hist.clear() # The directory history can't be completely empty self.dir_hist[:] = [os.getcwdu()] if new_session: ...
[ "Clear", "the", "session", "history", "releasing", "all", "object", "references", "and", "optionally", "open", "a", "new", "session", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L445-L457
[ "def", "reset", "(", "self", ",", "new_session", "=", "True", ")", ":", "self", ".", "output_hist", ".", "clear", "(", ")", "# The directory history can't be completely empty", "self", ".", "dir_hist", "[", ":", "]", "=", "[", "os", ".", "getcwdu", "(", ")...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryManager._get_range_session
Get input and output history from the current session. Called by get_range, and takes similar parameters.
environment/lib/python2.7/site-packages/IPython/core/history.py
def _get_range_session(self, start=1, stop=None, raw=True, output=False): """Get input and output history from the current session. Called by get_range, and takes similar parameters.""" input_hist = self.input_hist_raw if raw else self.input_hist_parsed n = len(input_hist) ...
def _get_range_session(self, start=1, stop=None, raw=True, output=False): """Get input and output history from the current session. Called by get_range, and takes similar parameters.""" input_hist = self.input_hist_raw if raw else self.input_hist_parsed n = len(input_hist) ...
[ "Get", "input", "and", "output", "history", "from", "the", "current", "session", ".", "Called", "by", "get_range", "and", "takes", "similar", "parameters", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L462-L480
[ "def", "_get_range_session", "(", "self", ",", "start", "=", "1", ",", "stop", "=", "None", ",", "raw", "=", "True", ",", "output", "=", "False", ")", ":", "input_hist", "=", "self", ".", "input_hist_raw", "if", "raw", "else", "self", ".", "input_hist_...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryManager.get_range
Retrieve input by session. Parameters ---------- session : int Session number to retrieve. The current session is 0, and negative numbers count back from current session, so -1 is previous session. start : int First line to retrieve. s...
environment/lib/python2.7/site-packages/IPython/core/history.py
def get_range(self, session=0, start=1, stop=None, raw=True,output=False): """Retrieve input by session. Parameters ---------- session : int Session number to retrieve. The current session is 0, and negative numbers count back from current session, so -1 ...
def get_range(self, session=0, start=1, stop=None, raw=True,output=False): """Retrieve input by session. Parameters ---------- session : int Session number to retrieve. The current session is 0, and negative numbers count back from current session, so -1 ...
[ "Retrieve", "input", "by", "session", ".", "Parameters", "----------", "session", ":", "int", "Session", "number", "to", "retrieve", ".", "The", "current", "session", "is", "0", "and", "negative", "numbers", "count", "back", "from", "current", "session", "so",...
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L482-L514
[ "def", "get_range", "(", "self", ",", "session", "=", "0", ",", "start", "=", "1", ",", "stop", "=", "None", ",", "raw", "=", "True", ",", "output", "=", "False", ")", ":", "if", "session", "<=", "0", ":", "session", "+=", "self", ".", "session_n...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryManager.store_inputs
Store source and raw input in history and create input cache variables _i*. Parameters ---------- line_num : int The prompt number of this input. source : str Python input. source_raw : str, optional If given, this is the raw input without...
environment/lib/python2.7/site-packages/IPython/core/history.py
def store_inputs(self, line_num, source, source_raw=None): """Store source and raw input in history and create input cache variables _i*. Parameters ---------- line_num : int The prompt number of this input. source : str Python input. source...
def store_inputs(self, line_num, source, source_raw=None): """Store source and raw input in history and create input cache variables _i*. Parameters ---------- line_num : int The prompt number of this input. source : str Python input. source...
[ "Store", "source", "and", "raw", "input", "in", "history", "and", "create", "input", "cache", "variables", "_i", "*", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L519-L566
[ "def", "store_inputs", "(", "self", ",", "line_num", ",", "source", ",", "source_raw", "=", "None", ")", ":", "if", "source_raw", "is", "None", ":", "source_raw", "=", "source", "source", "=", "source", ".", "rstrip", "(", "'\\n'", ")", "source_raw", "="...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryManager.store_output
If database output logging is enabled, this saves all the outputs from the indicated prompt number to the database. It's called by run_cell after code has been executed. Parameters ---------- line_num : int The line number from which to save outputs
environment/lib/python2.7/site-packages/IPython/core/history.py
def store_output(self, line_num): """If database output logging is enabled, this saves all the outputs from the indicated prompt number to the database. It's called by run_cell after code has been executed. Parameters ---------- line_num : int The line number f...
def store_output(self, line_num): """If database output logging is enabled, this saves all the outputs from the indicated prompt number to the database. It's called by run_cell after code has been executed. Parameters ---------- line_num : int The line number f...
[ "If", "database", "output", "logging", "is", "enabled", "this", "saves", "all", "the", "outputs", "from", "the", "indicated", "prompt", "number", "to", "the", "database", ".", "It", "s", "called", "by", "run_cell", "after", "code", "has", "been", "executed",...
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L568-L585
[ "def", "store_output", "(", "self", ",", "line_num", ")", ":", "if", "(", "not", "self", ".", "db_log_output", ")", "or", "(", "line_num", "not", "in", "self", ".", "output_hist_reprs", ")", ":", "return", "output", "=", "self", ".", "output_hist_reprs", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistoryManager.writeout_cache
Write any entries in the cache to the database.
environment/lib/python2.7/site-packages/IPython/core/history.py
def writeout_cache(self, conn=None): """Write any entries in the cache to the database.""" if conn is None: conn = self.db with self.db_input_cache_lock: try: self._writeout_input_cache(conn) except sqlite3.IntegrityError: self...
def writeout_cache(self, conn=None): """Write any entries in the cache to the database.""" if conn is None: conn = self.db with self.db_input_cache_lock: try: self._writeout_input_cache(conn) except sqlite3.IntegrityError: self...
[ "Write", "any", "entries", "in", "the", "cache", "to", "the", "database", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L600-L629
[ "def", "writeout_cache", "(", "self", ",", "conn", "=", "None", ")", ":", "if", "conn", "is", "None", ":", "conn", "=", "self", ".", "db", "with", "self", ".", "db_input_cache_lock", ":", "try", ":", "self", ".", "_writeout_input_cache", "(", "conn", "...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
HistorySavingThread.stop
This can be called from the main thread to safely stop this thread. Note that it does not attempt to write out remaining history before exiting. That should be done by calling the HistoryManager's end_session method.
environment/lib/python2.7/site-packages/IPython/core/history.py
def stop(self): """This can be called from the main thread to safely stop this thread. Note that it does not attempt to write out remaining history before exiting. That should be done by calling the HistoryManager's end_session method.""" self.stop_now = True self.histor...
def stop(self): """This can be called from the main thread to safely stop this thread. Note that it does not attempt to write out remaining history before exiting. That should be done by calling the HistoryManager's end_session method.""" self.stop_now = True self.histor...
[ "This", "can", "be", "called", "from", "the", "main", "thread", "to", "safely", "stop", "this", "thread", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/history.py#L661-L669
[ "def", "stop", "(", "self", ")", ":", "self", ".", "stop_now", "=", "True", "self", ".", "history_manager", ".", "save_flag", ".", "set", "(", ")", "self", ".", "join", "(", ")" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
_get_boot_time
Return system boot time (epoch in seconds)
environment/lib/python2.7/site-packages/psutil/_pslinux.py
def _get_boot_time(): """Return system boot time (epoch in seconds)""" f = open('/proc/stat', 'r') try: for line in f: if line.startswith('btime'): return float(line.strip().split()[1]) raise RuntimeError("line not found") finally: f.close()
def _get_boot_time(): """Return system boot time (epoch in seconds)""" f = open('/proc/stat', 'r') try: for line in f: if line.startswith('btime'): return float(line.strip().split()[1]) raise RuntimeError("line not found") finally: f.close()
[ "Return", "system", "boot", "time", "(", "epoch", "in", "seconds", ")" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L34-L43
[ "def", "_get_boot_time", "(", ")", ":", "f", "=", "open", "(", "'/proc/stat'", ",", "'r'", ")", "try", ":", "for", "line", "in", "f", ":", "if", "line", ".", "startswith", "(", "'btime'", ")", ":", "return", "float", "(", "line", ".", "strip", "(",...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
_get_num_cpus
Return the number of CPUs on the system
environment/lib/python2.7/site-packages/psutil/_pslinux.py
def _get_num_cpus(): """Return the number of CPUs on the system""" # we try to determine num CPUs by using different approaches. # SC_NPROCESSORS_ONLN seems to be the safer and it is also # used by multiprocessing module try: return os.sysconf("SC_NPROCESSORS_ONLN") except ValueError: ...
def _get_num_cpus(): """Return the number of CPUs on the system""" # we try to determine num CPUs by using different approaches. # SC_NPROCESSORS_ONLN seems to be the safer and it is also # used by multiprocessing module try: return os.sysconf("SC_NPROCESSORS_ONLN") except ValueError: ...
[ "Return", "the", "number", "of", "CPUs", "on", "the", "system" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L45-L81
[ "def", "_get_num_cpus", "(", ")", ":", "# we try to determine num CPUs by using different approaches.", "# SC_NPROCESSORS_ONLN seems to be the safer and it is also", "# used by multiprocessing module", "try", ":", "return", "os", ".", "sysconf", "(", "\"SC_NPROCESSORS_ONLN\"", ")", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
get_system_cpu_times
Return a named tuple representing the following CPU times: user, nice, system, idle, iowait, irq, softirq.
environment/lib/python2.7/site-packages/psutil/_pslinux.py
def get_system_cpu_times(): """Return a named tuple representing the following CPU times: user, nice, system, idle, iowait, irq, softirq. """ f = open('/proc/stat', 'r') try: values = f.readline().split() finally: f.close() values = values[1:8] values = tuple([float(x) /...
def get_system_cpu_times(): """Return a named tuple representing the following CPU times: user, nice, system, idle, iowait, irq, softirq. """ f = open('/proc/stat', 'r') try: values = f.readline().split() finally: f.close() values = values[1:8] values = tuple([float(x) /...
[ "Return", "a", "named", "tuple", "representing", "the", "following", "CPU", "times", ":", "user", "nice", "system", "idle", "iowait", "irq", "softirq", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L183-L195
[ "def", "get_system_cpu_times", "(", ")", ":", "f", "=", "open", "(", "'/proc/stat'", ",", "'r'", ")", "try", ":", "values", "=", "f", ".", "readline", "(", ")", ".", "split", "(", ")", "finally", ":", "f", ".", "close", "(", ")", "values", "=", "...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
get_system_per_cpu_times
Return a list of namedtuple representing the CPU times for every CPU available on the system.
environment/lib/python2.7/site-packages/psutil/_pslinux.py
def get_system_per_cpu_times(): """Return a list of namedtuple representing the CPU times for every CPU available on the system. """ cpus = [] f = open('/proc/stat', 'r') # get rid of the first line who refers to system wide CPU stats try: f.readline() for line in f.readlines...
def get_system_per_cpu_times(): """Return a list of namedtuple representing the CPU times for every CPU available on the system. """ cpus = [] f = open('/proc/stat', 'r') # get rid of the first line who refers to system wide CPU stats try: f.readline() for line in f.readlines...
[ "Return", "a", "list", "of", "namedtuple", "representing", "the", "CPU", "times", "for", "every", "CPU", "available", "on", "the", "system", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L197-L214
[ "def", "get_system_per_cpu_times", "(", ")", ":", "cpus", "=", "[", "]", "f", "=", "open", "(", "'/proc/stat'", ",", "'r'", ")", "# get rid of the first line who refers to system wide CPU stats", "try", ":", "f", ".", "readline", "(", ")", "for", "line", "in", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
disk_partitions
Return mounted disk partitions as a list of nameduples
environment/lib/python2.7/site-packages/psutil/_pslinux.py
def disk_partitions(all=False): """Return mounted disk partitions as a list of nameduples""" phydevs = [] f = open("/proc/filesystems", "r") try: for line in f: if not line.startswith("nodev"): phydevs.append(line.strip()) finally: f.close() retlist =...
def disk_partitions(all=False): """Return mounted disk partitions as a list of nameduples""" phydevs = [] f = open("/proc/filesystems", "r") try: for line in f: if not line.startswith("nodev"): phydevs.append(line.strip()) finally: f.close() retlist =...
[ "Return", "mounted", "disk", "partitions", "as", "a", "list", "of", "nameduples" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L219-L241
[ "def", "disk_partitions", "(", "all", "=", "False", ")", ":", "phydevs", "=", "[", "]", "f", "=", "open", "(", "\"/proc/filesystems\"", ",", "\"r\"", ")", "try", ":", "for", "line", "in", "f", ":", "if", "not", "line", ".", "startswith", "(", "\"node...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
get_system_users
Return currently connected users as a list of namedtuples.
environment/lib/python2.7/site-packages/psutil/_pslinux.py
def get_system_users(): """Return currently connected users as a list of namedtuples.""" retlist = [] rawlist = _psutil_linux.get_system_users() for item in rawlist: user, tty, hostname, tstamp, user_process = item # XXX the underlying C function includes entries about # system b...
def get_system_users(): """Return currently connected users as a list of namedtuples.""" retlist = [] rawlist = _psutil_linux.get_system_users() for item in rawlist: user, tty, hostname, tstamp, user_process = item # XXX the underlying C function includes entries about # system b...
[ "Return", "currently", "connected", "users", "as", "a", "list", "of", "namedtuples", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L248-L263
[ "def", "get_system_users", "(", ")", ":", "retlist", "=", "[", "]", "rawlist", "=", "_psutil_linux", ".", "get_system_users", "(", ")", "for", "item", "in", "rawlist", ":", "user", ",", "tty", ",", "hostname", ",", "tstamp", ",", "user_process", "=", "it...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
get_pid_list
Returns a list of PIDs currently running on the system.
environment/lib/python2.7/site-packages/psutil/_pslinux.py
def get_pid_list(): """Returns a list of PIDs currently running on the system.""" pids = [int(x) for x in os.listdir('/proc') if x.isdigit()] return pids
def get_pid_list(): """Returns a list of PIDs currently running on the system.""" pids = [int(x) for x in os.listdir('/proc') if x.isdigit()] return pids
[ "Returns", "a", "list", "of", "PIDs", "currently", "running", "on", "the", "system", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L267-L270
[ "def", "get_pid_list", "(", ")", ":", "pids", "=", "[", "int", "(", "x", ")", "for", "x", "in", "os", ".", "listdir", "(", "'/proc'", ")", "if", "x", ".", "isdigit", "(", ")", "]", "return", "pids" ]
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
network_io_counters
Return network I/O statistics for every network interface installed on the system as a dict of raw tuples.
environment/lib/python2.7/site-packages/psutil/_pslinux.py
def network_io_counters(): """Return network I/O statistics for every network interface installed on the system as a dict of raw tuples. """ f = open("/proc/net/dev", "r") try: lines = f.readlines() finally: f.close() retdict = {} for line in lines[2:]: colon = l...
def network_io_counters(): """Return network I/O statistics for every network interface installed on the system as a dict of raw tuples. """ f = open("/proc/net/dev", "r") try: lines = f.readlines() finally: f.close() retdict = {} for line in lines[2:]: colon = l...
[ "Return", "network", "I", "/", "O", "statistics", "for", "every", "network", "interface", "installed", "on", "the", "system", "as", "a", "dict", "of", "raw", "tuples", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L276-L302
[ "def", "network_io_counters", "(", ")", ":", "f", "=", "open", "(", "\"/proc/net/dev\"", ",", "\"r\"", ")", "try", ":", "lines", "=", "f", ".", "readlines", "(", ")", "finally", ":", "f", ".", "close", "(", ")", "retdict", "=", "{", "}", "for", "li...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
disk_io_counters
Return disk I/O statistics for every disk installed on the system as a dict of raw tuples.
environment/lib/python2.7/site-packages/psutil/_pslinux.py
def disk_io_counters(): """Return disk I/O statistics for every disk installed on the system as a dict of raw tuples. """ # man iostat states that sectors are equivalent with blocks and # have a size of 512 bytes since 2.4 kernels. This value is # needed to calculate the amount of disk I/O in by...
def disk_io_counters(): """Return disk I/O statistics for every disk installed on the system as a dict of raw tuples. """ # man iostat states that sectors are equivalent with blocks and # have a size of 512 bytes since 2.4 kernels. This value is # needed to calculate the amount of disk I/O in by...
[ "Return", "disk", "I", "/", "O", "statistics", "for", "every", "disk", "installed", "on", "the", "system", "as", "a", "dict", "of", "raw", "tuples", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L304-L344
[ "def", "disk_io_counters", "(", ")", ":", "# man iostat states that sectors are equivalent with blocks and", "# have a size of 512 bytes since 2.4 kernels. This value is", "# needed to calculate the amount of disk I/O in bytes.", "SECTOR_SIZE", "=", "512", "# determine partitions we want to lo...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
wrap_exceptions
Call callable into a try/except clause and translate ENOENT, EACCES and EPERM in NoSuchProcess or AccessDenied exceptions.
environment/lib/python2.7/site-packages/psutil/_pslinux.py
def wrap_exceptions(callable): """Call callable into a try/except clause and translate ENOENT, EACCES and EPERM in NoSuchProcess or AccessDenied exceptions. """ def wrapper(self, *args, **kwargs): try: return callable(self, *args, **kwargs) except EnvironmentError: ...
def wrap_exceptions(callable): """Call callable into a try/except clause and translate ENOENT, EACCES and EPERM in NoSuchProcess or AccessDenied exceptions. """ def wrapper(self, *args, **kwargs): try: return callable(self, *args, **kwargs) except EnvironmentError: ...
[ "Call", "callable", "into", "a", "try", "/", "except", "clause", "and", "translate", "ENOENT", "EACCES", "and", "EPERM", "in", "NoSuchProcess", "or", "AccessDenied", "exceptions", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L361-L378
[ "def", "wrap_exceptions", "(", "callable", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "callable", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "except", "Envir...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
Process.get_memory_maps
Return process's mapped memory regions as a list of nameduples. Fields are explained in 'man proc'; here is an updated (Apr 2012) version: http://goo.gl/fmebo
environment/lib/python2.7/site-packages/psutil/_pslinux.py
def get_memory_maps(self): """Return process's mapped memory regions as a list of nameduples. Fields are explained in 'man proc'; here is an updated (Apr 2012) version: http://goo.gl/fmebo """ f = None try: f = open("/proc/%s/smaps" % self.pid) fir...
def get_memory_maps(self): """Return process's mapped memory regions as a list of nameduples. Fields are explained in 'man proc'; here is an updated (Apr 2012) version: http://goo.gl/fmebo """ f = None try: f = open("/proc/%s/smaps" % self.pid) fir...
[ "Return", "process", "s", "mapped", "memory", "regions", "as", "a", "list", "of", "nameduples", ".", "Fields", "are", "explained", "in", "man", "proc", ";", "here", "is", "an", "updated", "(", "Apr", "2012", ")", "version", ":", "http", ":", "//", "goo...
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L551-L609
[ "def", "get_memory_maps", "(", "self", ")", ":", "f", "=", "None", "try", ":", "f", "=", "open", "(", "\"/proc/%s/smaps\"", "%", "self", ".", "pid", ")", "first_line", "=", "f", ".", "readline", "(", ")", "current_block", "=", "[", "first_line", "]", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
Process.get_connections
Return connections opened by process as a list of namedtuples. The kind parameter filters for connections that fit the following criteria: Kind Value Number of connections using inet IPv4 and IPv6 inet4 IPv4 inet6 IPv6 tcp ...
environment/lib/python2.7/site-packages/psutil/_pslinux.py
def get_connections(self, kind='inet'): """Return connections opened by process as a list of namedtuples. The kind parameter filters for connections that fit the following criteria: Kind Value Number of connections using inet IPv4 and IPv6 inet4 ...
def get_connections(self, kind='inet'): """Return connections opened by process as a list of namedtuples. The kind parameter filters for connections that fit the following criteria: Kind Value Number of connections using inet IPv4 and IPv6 inet4 ...
[ "Return", "connections", "opened", "by", "process", "as", "a", "list", "of", "namedtuples", ".", "The", "kind", "parameter", "filters", "for", "connections", "that", "fit", "the", "following", "criteria", ":" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L804-L918
[ "def", "get_connections", "(", "self", ",", "kind", "=", "'inet'", ")", ":", "# Note: in case of UNIX sockets we're only able to determine the", "# local bound path while the remote endpoint is not retrievable:", "# http://goo.gl/R3GHM", "inodes", "=", "{", "}", "# os.listdir() is ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
Process._decode_address
Accept an "ip:port" address as displayed in /proc/net/* and convert it into a human readable form, like: "0500000A:0016" -> ("10.0.0.5", 22) "0000000000000000FFFF00000100007F:9E49" -> ("::ffff:127.0.0.1", 40521) The IP address portion is a little or big endian four-byte hexadec...
environment/lib/python2.7/site-packages/psutil/_pslinux.py
def _decode_address(addr, family): """Accept an "ip:port" address as displayed in /proc/net/* and convert it into a human readable form, like: "0500000A:0016" -> ("10.0.0.5", 22) "0000000000000000FFFF00000100007F:9E49" -> ("::ffff:127.0.0.1", 40521) The IP address portion is a ...
def _decode_address(addr, family): """Accept an "ip:port" address as displayed in /proc/net/* and convert it into a human readable form, like: "0500000A:0016" -> ("10.0.0.5", 22) "0000000000000000FFFF00000100007F:9E49" -> ("::ffff:127.0.0.1", 40521) The IP address portion is a ...
[ "Accept", "an", "ip", ":", "port", "address", "as", "displayed", "in", "/", "proc", "/", "net", "/", "*", "and", "convert", "it", "into", "a", "human", "readable", "form", "like", ":" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_pslinux.py#L968-L1011
[ "def", "_decode_address", "(", "addr", ",", "family", ")", ":", "ip", ",", "port", "=", "addr", ".", "split", "(", "':'", ")", "port", "=", "int", "(", "port", ",", "16", ")", "if", "PY3", ":", "ip", "=", "ip", ".", "encode", "(", "'ascii'", ")...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
nice_pair
Make a nice string representation of a pair of numbers. If the numbers are equal, just return the number, otherwise return the pair with a dash between them, indicating the range.
virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py
def nice_pair(pair): """Make a nice string representation of a pair of numbers. If the numbers are equal, just return the number, otherwise return the pair with a dash between them, indicating the range. """ start, end = pair if start == end: return "%d" % start else: retur...
def nice_pair(pair): """Make a nice string representation of a pair of numbers. If the numbers are equal, just return the number, otherwise return the pair with a dash between them, indicating the range. """ start, end = pair if start == end: return "%d" % start else: retur...
[ "Make", "a", "nice", "string", "representation", "of", "a", "pair", "of", "numbers", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py#L12-L23
[ "def", "nice_pair", "(", "pair", ")", ":", "start", ",", "end", "=", "pair", "if", "start", "==", "end", ":", "return", "\"%d\"", "%", "start", "else", ":", "return", "\"%d-%d\"", "%", "(", "start", ",", "end", ")" ]
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
format_lines
Nicely format a list of line numbers. Format a list of line numbers for printing by coalescing groups of lines as long as the lines represent consecutive statements. This will coalesce even if there are gaps between statements. For example, if `statements` is [1,2,3,4,5,10,11,12,13,14] and `lines...
virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py
def format_lines(statements, lines): """Nicely format a list of line numbers. Format a list of line numbers for printing by coalescing groups of lines as long as the lines represent consecutive statements. This will coalesce even if there are gaps between statements. For example, if `statements` ...
def format_lines(statements, lines): """Nicely format a list of line numbers. Format a list of line numbers for printing by coalescing groups of lines as long as the lines represent consecutive statements. This will coalesce even if there are gaps between statements. For example, if `statements` ...
[ "Nicely", "format", "a", "list", "of", "line", "numbers", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py#L26-L56
[ "def", "format_lines", "(", "statements", ",", "lines", ")", ":", "pairs", "=", "[", "]", "i", "=", "0", "j", "=", "0", "start", "=", "None", "statements", "=", "sorted", "(", "statements", ")", "lines", "=", "sorted", "(", "lines", ")", "while", "...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
short_stack
Return a string summarizing the call stack.
virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py
def short_stack(): """Return a string summarizing the call stack.""" stack = inspect.stack()[:0:-1] return "\n".join(["%30s : %s @%d" % (t[3],t[1],t[2]) for t in stack])
def short_stack(): """Return a string summarizing the call stack.""" stack = inspect.stack()[:0:-1] return "\n".join(["%30s : %s @%d" % (t[3],t[1],t[2]) for t in stack])
[ "Return", "a", "string", "summarizing", "the", "call", "stack", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py#L59-L62
[ "def", "short_stack", "(", ")", ":", "stack", "=", "inspect", ".", "stack", "(", ")", "[", ":", "0", ":", "-", "1", "]", "return", "\"\\n\"", ".", "join", "(", "[", "\"%30s : %s @%d\"", "%", "(", "t", "[", "3", "]", ",", "t", "[", "1", "]", "...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
expensive
A decorator to cache the result of an expensive operation. Only applies to methods with no arguments.
virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py
def expensive(fn): """A decorator to cache the result of an expensive operation. Only applies to methods with no arguments. """ attr = "_cache_" + fn.__name__ def _wrapped(self): """Inner fn that checks the cache.""" if not hasattr(self, attr): setattr(self, attr, fn(se...
def expensive(fn): """A decorator to cache the result of an expensive operation. Only applies to methods with no arguments. """ attr = "_cache_" + fn.__name__ def _wrapped(self): """Inner fn that checks the cache.""" if not hasattr(self, attr): setattr(self, attr, fn(se...
[ "A", "decorator", "to", "cache", "the", "result", "of", "an", "expensive", "operation", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py#L65-L77
[ "def", "expensive", "(", "fn", ")", ":", "attr", "=", "\"_cache_\"", "+", "fn", ".", "__name__", "def", "_wrapped", "(", "self", ")", ":", "\"\"\"Inner fn that checks the cache.\"\"\"", "if", "not", "hasattr", "(", "self", ",", "attr", ")", ":", "setattr", ...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
join_regex
Combine a list of regexes into one that matches any of them.
virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py
def join_regex(regexes): """Combine a list of regexes into one that matches any of them.""" if len(regexes) > 1: return "|".join(["(%s)" % r for r in regexes]) elif regexes: return regexes[0] else: return ""
def join_regex(regexes): """Combine a list of regexes into one that matches any of them.""" if len(regexes) > 1: return "|".join(["(%s)" % r for r in regexes]) elif regexes: return regexes[0] else: return ""
[ "Combine", "a", "list", "of", "regexes", "into", "one", "that", "matches", "any", "of", "them", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py#L88-L95
[ "def", "join_regex", "(", "regexes", ")", ":", "if", "len", "(", "regexes", ")", ">", "1", ":", "return", "\"|\"", ".", "join", "(", "[", "\"(%s)\"", "%", "r", "for", "r", "in", "regexes", "]", ")", "elif", "regexes", ":", "return", "regexes", "[",...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
file_be_gone
Remove a file, and don't get annoyed if it doesn't exist.
virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py
def file_be_gone(path): """Remove a file, and don't get annoyed if it doesn't exist.""" try: os.remove(path) except OSError: _, e, _ = sys.exc_info() if e.errno != errno.ENOENT: raise
def file_be_gone(path): """Remove a file, and don't get annoyed if it doesn't exist.""" try: os.remove(path) except OSError: _, e, _ = sys.exc_info() if e.errno != errno.ENOENT: raise
[ "Remove", "a", "file", "and", "don", "t", "get", "annoyed", "if", "it", "doesn", "t", "exist", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py#L98-L105
[ "def", "file_be_gone", "(", "path", ")", ":", "try", ":", "os", ".", "remove", "(", "path", ")", "except", "OSError", ":", "_", ",", "e", ",", "_", "=", "sys", ".", "exc_info", "(", ")", "if", "e", ".", "errno", "!=", "errno", ".", "ENOENT", ":...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
Hasher.update
Add `v` to the hash, recursively if needed.
virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py
def update(self, v): """Add `v` to the hash, recursively if needed.""" self.md5.update(to_bytes(str(type(v)))) if isinstance(v, string_class): self.md5.update(to_bytes(v)) elif v is None: pass elif isinstance(v, (int, float)): self.md5.update(t...
def update(self, v): """Add `v` to the hash, recursively if needed.""" self.md5.update(to_bytes(str(type(v)))) if isinstance(v, string_class): self.md5.update(to_bytes(v)) elif v is None: pass elif isinstance(v, (int, float)): self.md5.update(t...
[ "Add", "v", "to", "the", "hash", "recursively", "if", "needed", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/misc.py#L113-L138
[ "def", "update", "(", "self", ",", "v", ")", ":", "self", ".", "md5", ".", "update", "(", "to_bytes", "(", "str", "(", "type", "(", "v", ")", ")", ")", ")", "if", "isinstance", "(", "v", ",", "string_class", ")", ":", "self", ".", "md5", ".", ...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
ClusterManager.update_profiles
List all profiles in the ipython_dir and cwd.
environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/clustermanager.py
def update_profiles(self): """List all profiles in the ipython_dir and cwd. """ for path in [get_ipython_dir(), os.getcwdu()]: for profile in list_profiles_in(path): pd = self.get_profile_dir(profile, path) if profile not in self.profiles: ...
def update_profiles(self): """List all profiles in the ipython_dir and cwd. """ for path in [get_ipython_dir(), os.getcwdu()]: for profile in list_profiles_in(path): pd = self.get_profile_dir(profile, path) if profile not in self.profiles: ...
[ "List", "all", "profiles", "in", "the", "ipython_dir", "and", "cwd", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/clustermanager.py#L76-L88
[ "def", "update_profiles", "(", "self", ")", ":", "for", "path", "in", "[", "get_ipython_dir", "(", ")", ",", "os", ".", "getcwdu", "(", ")", "]", ":", "for", "profile", "in", "list_profiles_in", "(", "path", ")", ":", "pd", "=", "self", ".", "get_pro...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
ClusterManager.start_cluster
Start a cluster for a given profile.
environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/clustermanager.py
def start_cluster(self, profile, n=None): """Start a cluster for a given profile.""" self.check_profile(profile) data = self.profiles[profile] if data['status'] == 'running': raise web.HTTPError(409, u'cluster already running') cl, esl, default_n = self.build_launcher...
def start_cluster(self, profile, n=None): """Start a cluster for a given profile.""" self.check_profile(profile) data = self.profiles[profile] if data['status'] == 'running': raise web.HTTPError(409, u'cluster already running') cl, esl, default_n = self.build_launcher...
[ "Start", "a", "cluster", "for", "a", "given", "profile", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/clustermanager.py#L110-L146
[ "def", "start_cluster", "(", "self", ",", "profile", ",", "n", "=", "None", ")", ":", "self", ".", "check_profile", "(", "profile", ")", "data", "=", "self", ".", "profiles", "[", "profile", "]", "if", "data", "[", "'status'", "]", "==", "'running'", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
ClusterManager.stop_cluster
Stop a cluster for a given profile.
environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/clustermanager.py
def stop_cluster(self, profile): """Stop a cluster for a given profile.""" self.check_profile(profile) data = self.profiles[profile] if data['status'] == 'stopped': raise web.HTTPError(409, u'cluster not running') data = self.profiles[profile] cl = data['contr...
def stop_cluster(self, profile): """Stop a cluster for a given profile.""" self.check_profile(profile) data = self.profiles[profile] if data['status'] == 'stopped': raise web.HTTPError(409, u'cluster not running') data = self.profiles[profile] cl = data['contr...
[ "Stop", "a", "cluster", "for", "a", "given", "profile", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/clustermanager.py#L148-L168
[ "def", "stop_cluster", "(", "self", ",", "profile", ")", ":", "self", ".", "check_profile", "(", "profile", ")", "data", "=", "self", ".", "profiles", "[", "profile", "]", "if", "data", "[", "'status'", "]", "==", "'stopped'", ":", "raise", "web", ".",...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
RegistrationFactory._propagate_url
Ensure self.url contains full transport://interface:port
environment/lib/python2.7/site-packages/IPython/parallel/factory.py
def _propagate_url(self): """Ensure self.url contains full transport://interface:port""" if self.url: iface = self.url.split('://',1) if len(iface) == 2: self.transport,iface = iface iface = iface.split(':') self.ip = iface[0] i...
def _propagate_url(self): """Ensure self.url contains full transport://interface:port""" if self.url: iface = self.url.split('://',1) if len(iface) == 2: self.transport,iface = iface iface = iface.split(':') self.ip = iface[0] i...
[ "Ensure", "self", ".", "url", "contains", "full", "transport", ":", "//", "interface", ":", "port" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/factory.py#L68-L77
[ "def", "_propagate_url", "(", "self", ")", ":", "if", "self", ".", "url", ":", "iface", "=", "self", ".", "url", ".", "split", "(", "'://'", ",", "1", ")", "if", "len", "(", "iface", ")", "==", "2", ":", "self", ".", "transport", ",", "iface", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
_find_cmd
Find the full path to a .bat or .exe using the win32api module.
environment/lib/python2.7/site-packages/IPython/utils/_process_win32.py
def _find_cmd(cmd): """Find the full path to a .bat or .exe using the win32api module.""" try: from win32api import SearchPath except ImportError: raise ImportError('you need to have pywin32 installed for this to work') else: PATH = os.environ['PATH'] extensions = ['.exe'...
def _find_cmd(cmd): """Find the full path to a .bat or .exe using the win32api module.""" try: from win32api import SearchPath except ImportError: raise ImportError('you need to have pywin32 installed for this to work') else: PATH = os.environ['PATH'] extensions = ['.exe'...
[ "Find", "the", "full", "path", "to", "a", ".", "bat", "or", ".", "exe", "using", "the", "win32api", "module", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/_process_win32.py#L75-L93
[ "def", "_find_cmd", "(", "cmd", ")", ":", "try", ":", "from", "win32api", "import", "SearchPath", "except", "ImportError", ":", "raise", "ImportError", "(", "'you need to have pywin32 installed for this to work'", ")", "else", ":", "PATH", "=", "os", ".", "environ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
_system_body
Callback for _system.
environment/lib/python2.7/site-packages/IPython/utils/_process_win32.py
def _system_body(p): """Callback for _system.""" enc = DEFAULT_ENCODING for line in read_no_interrupt(p.stdout).splitlines(): line = line.decode(enc, 'replace') print(line, file=sys.stdout) for line in read_no_interrupt(p.stderr).splitlines(): line = line.decode(enc, 'replace') ...
def _system_body(p): """Callback for _system.""" enc = DEFAULT_ENCODING for line in read_no_interrupt(p.stdout).splitlines(): line = line.decode(enc, 'replace') print(line, file=sys.stdout) for line in read_no_interrupt(p.stderr).splitlines(): line = line.decode(enc, 'replace') ...
[ "Callback", "for", "_system", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/_process_win32.py#L96-L107
[ "def", "_system_body", "(", "p", ")", ":", "enc", "=", "DEFAULT_ENCODING", "for", "line", "in", "read_no_interrupt", "(", "p", ".", "stdout", ")", ".", "splitlines", "(", ")", ":", "line", "=", "line", ".", "decode", "(", "enc", ",", "'replace'", ")", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
system
Win32 version of os.system() that works with network shares. Note that this implementation returns None, as meant for use in IPython. Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- None : we explicitly do NOT return the subprocess statu...
environment/lib/python2.7/site-packages/IPython/utils/_process_win32.py
def system(cmd): """Win32 version of os.system() that works with network shares. Note that this implementation returns None, as meant for use in IPython. Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- None : we explicitly do NOT ret...
def system(cmd): """Win32 version of os.system() that works with network shares. Note that this implementation returns None, as meant for use in IPython. Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- None : we explicitly do NOT ret...
[ "Win32", "version", "of", "os", ".", "system", "()", "that", "works", "with", "network", "shares", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/_process_win32.py#L110-L134
[ "def", "system", "(", "cmd", ")", ":", "# The controller provides interactivity with both", "# stdin and stdout", "#import _process_win32_controller", "#_process_win32_controller.system(cmd)", "with", "AvoidUNCPath", "(", ")", "as", "path", ":", "if", "path", "is", "not", "...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
getoutput
Return standard output of executing cmd in a shell. Accepts the same arguments as os.system(). Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- stdout : str
environment/lib/python2.7/site-packages/IPython/utils/_process_win32.py
def getoutput(cmd): """Return standard output of executing cmd in a shell. Accepts the same arguments as os.system(). Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- stdout : str """ with AvoidUNCPath() as path: if p...
def getoutput(cmd): """Return standard output of executing cmd in a shell. Accepts the same arguments as os.system(). Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- stdout : str """ with AvoidUNCPath() as path: if p...
[ "Return", "standard", "output", "of", "executing", "cmd", "in", "a", "shell", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/_process_win32.py#L136-L158
[ "def", "getoutput", "(", "cmd", ")", ":", "with", "AvoidUNCPath", "(", ")", "as", "path", ":", "if", "path", "is", "not", "None", ":", "cmd", "=", "'\"pushd %s &&\"%s'", "%", "(", "path", ",", "cmd", ")", "out", "=", "process_handler", "(", "cmd", ",...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
setup_partitioner
create a partitioner in the engine namespace
environment/share/doc/ipython/examples/parallel/wave2D/parallelwave.py
def setup_partitioner(comm, addrs, index, num_procs, gnum_cells, parts): """create a partitioner in the engine namespace""" global partitioner p = ZMQRectPartitioner2D(comm, addrs, my_id=index, num_procs=num_procs) p.redim(global_num_cells=gnum_cells, num_parts=parts) p.prepare_communication() #...
def setup_partitioner(comm, addrs, index, num_procs, gnum_cells, parts): """create a partitioner in the engine namespace""" global partitioner p = ZMQRectPartitioner2D(comm, addrs, my_id=index, num_procs=num_procs) p.redim(global_num_cells=gnum_cells, num_parts=parts) p.prepare_communication() #...
[ "create", "a", "partitioner", "in", "the", "engine", "namespace" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/wave2D/parallelwave.py#L33-L40
[ "def", "setup_partitioner", "(", "comm", ",", "addrs", ",", "index", ",", "num_procs", ",", "gnum_cells", ",", "parts", ")", ":", "global", "partitioner", "p", "=", "ZMQRectPartitioner2D", "(", "comm", ",", "addrs", ",", "my_id", "=", "index", ",", "num_pr...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
TranslationMixin.get_translations
Returns a list of (code, translation) tuples for codes
toolware/utils/translation.py
def get_translations(codes): """ Returns a list of (code, translation) tuples for codes """ codes = codes or self.codes return self._get_priority_translations(priority, codes)
def get_translations(codes): """ Returns a list of (code, translation) tuples for codes """ codes = codes or self.codes return self._get_priority_translations(priority, codes)
[ "Returns", "a", "list", "of", "(", "code", "translation", ")", "tuples", "for", "codes" ]
un33k/django-toolware
python
https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/translation.py#L68-L71
[ "def", "get_translations", "(", "codes", ")", ":", "codes", "=", "codes", "or", "self", ".", "codes", "return", "self", ".", "_get_priority_translations", "(", "priority", ",", "codes", ")" ]
973f3e003dc38b812897dab88455bee37dcaf931
test
TranslationMixin.get_translations_sorted
Returns a sorted list of (code, translation) tuples for codes
toolware/utils/translation.py
def get_translations_sorted(codes): """ Returns a sorted list of (code, translation) tuples for codes """ codes = codes or self.codes return self._get_priority_translations(priority, codes)
def get_translations_sorted(codes): """ Returns a sorted list of (code, translation) tuples for codes """ codes = codes or self.codes return self._get_priority_translations(priority, codes)
[ "Returns", "a", "sorted", "list", "of", "(", "code", "translation", ")", "tuples", "for", "codes" ]
un33k/django-toolware
python
https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/translation.py#L73-L76
[ "def", "get_translations_sorted", "(", "codes", ")", ":", "codes", "=", "codes", "or", "self", ".", "codes", "return", "self", ".", "_get_priority_translations", "(", "priority", ",", "codes", ")" ]
973f3e003dc38b812897dab88455bee37dcaf931
test
TranslationMixin.get_priority_translations
Returns a list of (code, translation) tuples for priority, codes
toolware/utils/translation.py
def get_priority_translations(priority, codes): """ Returns a list of (code, translation) tuples for priority, codes """ priority = priority or self.priority codes = codes or self.codes return self._get_priority_translations(priority, codes)
def get_priority_translations(priority, codes): """ Returns a list of (code, translation) tuples for priority, codes """ priority = priority or self.priority codes = codes or self.codes return self._get_priority_translations(priority, codes)
[ "Returns", "a", "list", "of", "(", "code", "translation", ")", "tuples", "for", "priority", "codes" ]
un33k/django-toolware
python
https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/translation.py#L78-L82
[ "def", "get_priority_translations", "(", "priority", ",", "codes", ")", ":", "priority", "=", "priority", "or", "self", ".", "priority", "codes", "=", "codes", "or", "self", ".", "codes", "return", "self", ".", "_get_priority_translations", "(", "priority", ",...
973f3e003dc38b812897dab88455bee37dcaf931
test
Reporter.find_code_units
Find the code units we'll report on. `morfs` is a list of modules or filenames.
virtualEnvironment/lib/python2.7/site-packages/coverage/report.py
def find_code_units(self, morfs): """Find the code units we'll report on. `morfs` is a list of modules or filenames. """ morfs = morfs or self.coverage.data.measured_files() file_locator = self.coverage.file_locator self.code_units = code_unit_factory(morfs, file_locato...
def find_code_units(self, morfs): """Find the code units we'll report on. `morfs` is a list of modules or filenames. """ morfs = morfs or self.coverage.data.measured_files() file_locator = self.coverage.file_locator self.code_units = code_unit_factory(morfs, file_locato...
[ "Find", "the", "code", "units", "we", "ll", "report", "on", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/report.py#L28-L59
[ "def", "find_code_units", "(", "self", ",", "morfs", ")", ":", "morfs", "=", "morfs", "or", "self", ".", "coverage", ".", "data", ".", "measured_files", "(", ")", "file_locator", "=", "self", ".", "coverage", ".", "file_locator", "self", ".", "code_units",...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
Reporter.report_files
Run a reporting function on a number of morfs. `report_fn` is called for each relative morf in `morfs`. It is called as:: report_fn(code_unit, analysis) where `code_unit` is the `CodeUnit` for the morf, and `analysis` is the `Analysis` for the morf.
virtualEnvironment/lib/python2.7/site-packages/coverage/report.py
def report_files(self, report_fn, morfs, directory=None): """Run a reporting function on a number of morfs. `report_fn` is called for each relative morf in `morfs`. It is called as:: report_fn(code_unit, analysis) where `code_unit` is the `CodeUnit` for the morf, and `ana...
def report_files(self, report_fn, morfs, directory=None): """Run a reporting function on a number of morfs. `report_fn` is called for each relative morf in `morfs`. It is called as:: report_fn(code_unit, analysis) where `code_unit` is the `CodeUnit` for the morf, and `ana...
[ "Run", "a", "reporting", "function", "on", "a", "number", "of", "morfs", "." ]
tnkteja/myhelp
python
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/report.py#L61-L92
[ "def", "report_files", "(", "self", ",", "report_fn", ",", "morfs", ",", "directory", "=", "None", ")", ":", "self", ".", "find_code_units", "(", "morfs", ")", "if", "not", "self", ".", "code_units", ":", "raise", "CoverageException", "(", "\"No data to repo...
fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb
test
make_decorator
Wraps a test decorator so as to properly replicate metadata of the decorated function, including nose's additional stuff (namely, setup and teardown).
environment/lib/python2.7/site-packages/nose/tools/nontrivial.py
def make_decorator(func): """ Wraps a test decorator so as to properly replicate metadata of the decorated function, including nose's additional stuff (namely, setup and teardown). """ def decorate(newfunc): if hasattr(func, 'compat_func_name'): name = func.compat_func_name ...
def make_decorator(func): """ Wraps a test decorator so as to properly replicate metadata of the decorated function, including nose's additional stuff (namely, setup and teardown). """ def decorate(newfunc): if hasattr(func, 'compat_func_name'): name = func.compat_func_name ...
[ "Wraps", "a", "test", "decorator", "so", "as", "to", "properly", "replicate", "metadata", "of", "the", "decorated", "function", "including", "nose", "s", "additional", "stuff", "(", "namely", "setup", "and", "teardown", ")", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/tools/nontrivial.py#L14-L36
[ "def", "make_decorator", "(", "func", ")", ":", "def", "decorate", "(", "newfunc", ")", ":", "if", "hasattr", "(", "func", ",", "'compat_func_name'", ")", ":", "name", "=", "func", ".", "compat_func_name", "else", ":", "name", "=", "func", ".", "__name__...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
raises
Test must raise one of expected exceptions to pass. Example use:: @raises(TypeError, ValueError) def test_raises_type_error(): raise TypeError("This test passes") @raises(Exception) def test_that_fails_by_passing(): pass If you want to test many assertions about e...
environment/lib/python2.7/site-packages/nose/tools/nontrivial.py
def raises(*exceptions): """Test must raise one of expected exceptions to pass. Example use:: @raises(TypeError, ValueError) def test_raises_type_error(): raise TypeError("This test passes") @raises(Exception) def test_that_fails_by_passing(): pass If you want...
def raises(*exceptions): """Test must raise one of expected exceptions to pass. Example use:: @raises(TypeError, ValueError) def test_raises_type_error(): raise TypeError("This test passes") @raises(Exception) def test_that_fails_by_passing(): pass If you want...
[ "Test", "must", "raise", "one", "of", "expected", "exceptions", "to", "pass", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/tools/nontrivial.py#L39-L70
[ "def", "raises", "(", "*", "exceptions", ")", ":", "valid", "=", "' or '", ".", "join", "(", "[", "e", ".", "__name__", "for", "e", "in", "exceptions", "]", ")", "def", "decorate", "(", "func", ")", ":", "name", "=", "func", ".", "__name__", "def",...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
set_trace
Call pdb.set_trace in the calling frame, first restoring sys.stdout to the real output stream. Note that sys.stdout is NOT reset to whatever it was before the call once pdb is done!
environment/lib/python2.7/site-packages/nose/tools/nontrivial.py
def set_trace(): """Call pdb.set_trace in the calling frame, first restoring sys.stdout to the real output stream. Note that sys.stdout is NOT reset to whatever it was before the call once pdb is done! """ import pdb import sys stdout = sys.stdout sys.stdout = sys.__stdout__ pdb.Pdb(...
def set_trace(): """Call pdb.set_trace in the calling frame, first restoring sys.stdout to the real output stream. Note that sys.stdout is NOT reset to whatever it was before the call once pdb is done! """ import pdb import sys stdout = sys.stdout sys.stdout = sys.__stdout__ pdb.Pdb(...
[ "Call", "pdb", ".", "set_trace", "in", "the", "calling", "frame", "first", "restoring", "sys", ".", "stdout", "to", "the", "real", "output", "stream", ".", "Note", "that", "sys", ".", "stdout", "is", "NOT", "reset", "to", "whatever", "it", "was", "before...
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/tools/nontrivial.py#L73-L82
[ "def", "set_trace", "(", ")", ":", "import", "pdb", "import", "sys", "stdout", "=", "sys", ".", "stdout", "sys", ".", "stdout", "=", "sys", ".", "__stdout__", "pdb", ".", "Pdb", "(", ")", ".", "set_trace", "(", "sys", ".", "_getframe", "(", ")", "....
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
timed
Test must finish within specified time limit to pass. Example use:: @timed(.1) def test_that_fails(): time.sleep(.2)
environment/lib/python2.7/site-packages/nose/tools/nontrivial.py
def timed(limit): """Test must finish within specified time limit to pass. Example use:: @timed(.1) def test_that_fails(): time.sleep(.2) """ def decorate(func): def newfunc(*arg, **kw): start = time.time() func(*arg, **kw) end = time.t...
def timed(limit): """Test must finish within specified time limit to pass. Example use:: @timed(.1) def test_that_fails(): time.sleep(.2) """ def decorate(func): def newfunc(*arg, **kw): start = time.time() func(*arg, **kw) end = time.t...
[ "Test", "must", "finish", "within", "specified", "time", "limit", "to", "pass", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/tools/nontrivial.py#L85-L103
[ "def", "timed", "(", "limit", ")", ":", "def", "decorate", "(", "func", ")", ":", "def", "newfunc", "(", "*", "arg", ",", "*", "*", "kw", ")", ":", "start", "=", "time", ".", "time", "(", ")", "func", "(", "*", "arg", ",", "*", "*", "kw", "...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
with_setup
Decorator to add setup and/or teardown methods to a test function:: @with_setup(setup, teardown) def test_something(): " ... " Note that `with_setup` is useful *only* for test functions, not for test methods or inside of TestCase subclasses.
environment/lib/python2.7/site-packages/nose/tools/nontrivial.py
def with_setup(setup=None, teardown=None): """Decorator to add setup and/or teardown methods to a test function:: @with_setup(setup, teardown) def test_something(): " ... " Note that `with_setup` is useful *only* for test functions, not for test methods or inside of TestCase subclass...
def with_setup(setup=None, teardown=None): """Decorator to add setup and/or teardown methods to a test function:: @with_setup(setup, teardown) def test_something(): " ... " Note that `with_setup` is useful *only* for test functions, not for test methods or inside of TestCase subclass...
[ "Decorator", "to", "add", "setup", "and", "/", "or", "teardown", "methods", "to", "a", "test", "function", "::" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/tools/nontrivial.py#L106-L136
[ "def", "with_setup", "(", "setup", "=", "None", ",", "teardown", "=", "None", ")", ":", "def", "decorate", "(", "func", ",", "setup", "=", "setup", ",", "teardown", "=", "teardown", ")", ":", "if", "setup", ":", "if", "hasattr", "(", "func", ",", "...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
InteractiveShellApp.init_gui_pylab
Enable GUI event loop integration, taking pylab into account.
environment/lib/python2.7/site-packages/IPython/core/shellapp.py
def init_gui_pylab(self): """Enable GUI event loop integration, taking pylab into account.""" if self.gui or self.pylab: shell = self.shell try: if self.pylab: gui, backend = pylabtools.find_gui_and_backend(self.pylab) self....
def init_gui_pylab(self): """Enable GUI event loop integration, taking pylab into account.""" if self.gui or self.pylab: shell = self.shell try: if self.pylab: gui, backend = pylabtools.find_gui_and_backend(self.pylab) self....
[ "Enable", "GUI", "event", "loop", "integration", "taking", "pylab", "into", "account", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/shellapp.py#L191-L207
[ "def", "init_gui_pylab", "(", "self", ")", ":", "if", "self", ".", "gui", "or", "self", ".", "pylab", ":", "shell", "=", "self", ".", "shell", "try", ":", "if", "self", ".", "pylab", ":", "gui", ",", "backend", "=", "pylabtools", ".", "find_gui_and_b...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
InteractiveShellApp.init_extensions
Load all IPython extensions in IPythonApp.extensions. This uses the :meth:`ExtensionManager.load_extensions` to load all the extensions listed in ``self.extensions``.
environment/lib/python2.7/site-packages/IPython/core/shellapp.py
def init_extensions(self): """Load all IPython extensions in IPythonApp.extensions. This uses the :meth:`ExtensionManager.load_extensions` to load all the extensions listed in ``self.extensions``. """ try: self.log.debug("Loading IPython extensions...") e...
def init_extensions(self): """Load all IPython extensions in IPythonApp.extensions. This uses the :meth:`ExtensionManager.load_extensions` to load all the extensions listed in ``self.extensions``. """ try: self.log.debug("Loading IPython extensions...") e...
[ "Load", "all", "IPython", "extensions", "in", "IPythonApp", ".", "extensions", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/shellapp.py#L209-L229
[ "def", "init_extensions", "(", "self", ")", ":", "try", ":", "self", ".", "log", ".", "debug", "(", "\"Loading IPython extensions...\"", ")", "extensions", "=", "self", ".", "default_extensions", "+", "self", ".", "extensions", "for", "ext", "in", "extensions"...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
InteractiveShellApp.init_code
run the pre-flight code, specified via exec_lines
environment/lib/python2.7/site-packages/IPython/core/shellapp.py
def init_code(self): """run the pre-flight code, specified via exec_lines""" self._run_startup_files() self._run_exec_lines() self._run_exec_files() self._run_cmd_line_code() self._run_module() # flush output, so itwon't be attached to the first cell ...
def init_code(self): """run the pre-flight code, specified via exec_lines""" self._run_startup_files() self._run_exec_lines() self._run_exec_files() self._run_cmd_line_code() self._run_module() # flush output, so itwon't be attached to the first cell ...
[ "run", "the", "pre", "-", "flight", "code", "specified", "via", "exec_lines" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/shellapp.py#L231-L244
[ "def", "init_code", "(", "self", ")", ":", "self", ".", "_run_startup_files", "(", ")", "self", ".", "_run_exec_lines", "(", ")", "self", ".", "_run_exec_files", "(", ")", "self", ".", "_run_cmd_line_code", "(", ")", "self", ".", "_run_module", "(", ")", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
InteractiveShellApp._run_exec_lines
Run lines of code in IPythonApp.exec_lines in the user's namespace.
environment/lib/python2.7/site-packages/IPython/core/shellapp.py
def _run_exec_lines(self): """Run lines of code in IPythonApp.exec_lines in the user's namespace.""" if not self.exec_lines: return try: self.log.debug("Running code from IPythonApp.exec_lines...") for line in self.exec_lines: try: ...
def _run_exec_lines(self): """Run lines of code in IPythonApp.exec_lines in the user's namespace.""" if not self.exec_lines: return try: self.log.debug("Running code from IPythonApp.exec_lines...") for line in self.exec_lines: try: ...
[ "Run", "lines", "of", "code", "in", "IPythonApp", ".", "exec_lines", "in", "the", "user", "s", "namespace", "." ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/shellapp.py#L246-L263
[ "def", "_run_exec_lines", "(", "self", ")", ":", "if", "not", "self", ".", "exec_lines", ":", "return", "try", ":", "self", ".", "log", ".", "debug", "(", "\"Running code from IPythonApp.exec_lines...\"", ")", "for", "line", "in", "self", ".", "exec_lines", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
InteractiveShellApp._run_startup_files
Run files from profile startup directory
environment/lib/python2.7/site-packages/IPython/core/shellapp.py
def _run_startup_files(self): """Run files from profile startup directory""" startup_dir = self.profile_dir.startup_dir startup_files = glob.glob(os.path.join(startup_dir, '*.py')) startup_files += glob.glob(os.path.join(startup_dir, '*.ipy')) if not startup_files: re...
def _run_startup_files(self): """Run files from profile startup directory""" startup_dir = self.profile_dir.startup_dir startup_files = glob.glob(os.path.join(startup_dir, '*.py')) startup_files += glob.glob(os.path.join(startup_dir, '*.ipy')) if not startup_files: re...
[ "Run", "files", "from", "profile", "startup", "directory" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/shellapp.py#L297-L311
[ "def", "_run_startup_files", "(", "self", ")", ":", "startup_dir", "=", "self", ".", "profile_dir", ".", "startup_dir", "startup_files", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "startup_dir", ",", "'*.py'", ")", ")", "startup_fi...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e
test
InteractiveShellApp._run_exec_files
Run files from IPythonApp.exec_files
environment/lib/python2.7/site-packages/IPython/core/shellapp.py
def _run_exec_files(self): """Run files from IPythonApp.exec_files""" if not self.exec_files: return self.log.debug("Running files in IPythonApp.exec_files...") try: for fname in self.exec_files: self._exec_file(fname) except: ...
def _run_exec_files(self): """Run files from IPythonApp.exec_files""" if not self.exec_files: return self.log.debug("Running files in IPythonApp.exec_files...") try: for fname in self.exec_files: self._exec_file(fname) except: ...
[ "Run", "files", "from", "IPythonApp", ".", "exec_files" ]
cloud9ers/gurumate
python
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/shellapp.py#L313-L324
[ "def", "_run_exec_files", "(", "self", ")", ":", "if", "not", "self", ".", "exec_files", ":", "return", "self", ".", "log", ".", "debug", "(", "\"Running files in IPythonApp.exec_files...\"", ")", "try", ":", "for", "fname", "in", "self", ".", "exec_files", ...
075dc74d1ee62a8c6b7a8bf2b271364f01629d1e