repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
ricmoo/pyscrypt
pyscrypt/file.py
ScryptFile._finalize_write
def _finalize_write(self): 'Finishes any unencrypted bytes and writes the final checksum.' # Make sure we have written the header if not self._done_header: self._write_header() # Write the remaining decrypted part to disk block = self._crypto.encrypt(self._decrypted...
python
def _finalize_write(self): 'Finishes any unencrypted bytes and writes the final checksum.' # Make sure we have written the header if not self._done_header: self._write_header() # Write the remaining decrypted part to disk block = self._crypto.encrypt(self._decrypted...
[ "def", "_finalize_write", "(", "self", ")", ":", "# Make sure we have written the header", "if", "not", "self", ".", "_done_header", ":", "self", ".", "_write_header", "(", ")", "# Write the remaining decrypted part to disk", "block", "=", "self", ".", "_crypto", ".",...
Finishes any unencrypted bytes and writes the final checksum.
[ "Finishes", "any", "unencrypted", "bytes", "and", "writes", "the", "final", "checksum", "." ]
131ca39acee4963afd704b4c4631497e4fe34c97
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L468-L483
train
ricmoo/pyscrypt
pyscrypt/file.py
ScryptFile.write
def write(self, str): '''Write string str to the underlying file. Note that due to buffering, flush() or close() may be needed before the file on disk reflects the data written.''' if self.closed: raise ValueError('File closed') if self._mode in _allowed_read: raise...
python
def write(self, str): '''Write string str to the underlying file. Note that due to buffering, flush() or close() may be needed before the file on disk reflects the data written.''' if self.closed: raise ValueError('File closed') if self._mode in _allowed_read: raise...
[ "def", "write", "(", "self", ",", "str", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "'File closed'", ")", "if", "self", ".", "_mode", "in", "_allowed_read", ":", "raise", "Exception", "(", "'File opened for read only'", ")", "i...
Write string str to the underlying file. Note that due to buffering, flush() or close() may be needed before the file on disk reflects the data written.
[ "Write", "string", "str", "to", "the", "underlying", "file", "." ]
131ca39acee4963afd704b4c4631497e4fe34c97
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L485-L504
train
dnanhkhoa/logone
logone/__init__.py
get_logger
def get_logger(logger_name): """ Return a logger with the specified name, creating it if necessary. """ # Use default global logger if logger_name is None: return __instance assert isinstance(logger_name, str), 'Logger name must be a string!' with __lock: if logger_name in...
python
def get_logger(logger_name): """ Return a logger with the specified name, creating it if necessary. """ # Use default global logger if logger_name is None: return __instance assert isinstance(logger_name, str), 'Logger name must be a string!' with __lock: if logger_name in...
[ "def", "get_logger", "(", "logger_name", ")", ":", "# Use default global logger", "if", "logger_name", "is", "None", ":", "return", "__instance", "assert", "isinstance", "(", "logger_name", ",", "str", ")", ",", "'Logger name must be a string!'", "with", "__lock", "...
Return a logger with the specified name, creating it if necessary.
[ "Return", "a", "logger", "with", "the", "specified", "name", "creating", "it", "if", "necessary", "." ]
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/__init__.py#L59-L76
train
mikemelch/hallie
hallie/modules/files.py
removeFile
def removeFile(file): """remove a file""" if "y" in speech.question("Are you sure you want to remove " + file + "? (Y/N): "): speech.speak("Removing " + file + " with the 'rm' command.") subprocess.call(["rm", "-r", file]) else: speech.speak("Okay, I won't remove " + file + ".")
python
def removeFile(file): """remove a file""" if "y" in speech.question("Are you sure you want to remove " + file + "? (Y/N): "): speech.speak("Removing " + file + " with the 'rm' command.") subprocess.call(["rm", "-r", file]) else: speech.speak("Okay, I won't remove " + file + ".")
[ "def", "removeFile", "(", "file", ")", ":", "if", "\"y\"", "in", "speech", ".", "question", "(", "\"Are you sure you want to remove \"", "+", "file", "+", "\"? (Y/N): \"", ")", ":", "speech", ".", "speak", "(", "\"Removing \"", "+", "file", "+", "\" with the '...
remove a file
[ "remove", "a", "file" ]
a6dbb691145a85b776a1919e4c7930e0ae598437
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/files.py#L19-L25
train
mikemelch/hallie
hallie/modules/files.py
copy
def copy(location): """copy file or directory at a given location; can be pasted later""" copyData = settings.getDataFile() copyFileLocation = os.path.abspath(location) copy = {"copyLocation": copyFileLocation} dataFile = open(copyData, "wb") pickle.dump(copy, dataFile) speech.speak(location + " copied successfu...
python
def copy(location): """copy file or directory at a given location; can be pasted later""" copyData = settings.getDataFile() copyFileLocation = os.path.abspath(location) copy = {"copyLocation": copyFileLocation} dataFile = open(copyData, "wb") pickle.dump(copy, dataFile) speech.speak(location + " copied successfu...
[ "def", "copy", "(", "location", ")", ":", "copyData", "=", "settings", ".", "getDataFile", "(", ")", "copyFileLocation", "=", "os", ".", "path", ".", "abspath", "(", "location", ")", "copy", "=", "{", "\"copyLocation\"", ":", "copyFileLocation", "}", "data...
copy file or directory at a given location; can be pasted later
[ "copy", "file", "or", "directory", "at", "a", "given", "location", ";", "can", "be", "pasted", "later" ]
a6dbb691145a85b776a1919e4c7930e0ae598437
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/files.py#L42-L50
train
mikemelch/hallie
hallie/modules/files.py
paste
def paste(location): """paste a file or directory that has been previously copied""" copyData = settings.getDataFile() if not location: location = "." try: data = pickle.load(open(copyData, "rb")) speech.speak("Pasting " + data["copyLocation"] + " to current directory.") except: speech.fail("It doesn't loo...
python
def paste(location): """paste a file or directory that has been previously copied""" copyData = settings.getDataFile() if not location: location = "." try: data = pickle.load(open(copyData, "rb")) speech.speak("Pasting " + data["copyLocation"] + " to current directory.") except: speech.fail("It doesn't loo...
[ "def", "paste", "(", "location", ")", ":", "copyData", "=", "settings", ".", "getDataFile", "(", ")", "if", "not", "location", ":", "location", "=", "\".\"", "try", ":", "data", "=", "pickle", ".", "load", "(", "open", "(", "copyData", ",", "\"rb\"", ...
paste a file or directory that has been previously copied
[ "paste", "a", "file", "or", "directory", "that", "has", "been", "previously", "copied" ]
a6dbb691145a85b776a1919e4c7930e0ae598437
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/files.py#L53-L67
train
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
add_zfs_apt_repository
def add_zfs_apt_repository(): """ adds the ZFS repository """ with settings(hide('warnings', 'running', 'stdout'), warn_only=False, capture=True): sudo('DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get update') install_ubuntu_development_tools() apt_install(packages=['so...
python
def add_zfs_apt_repository(): """ adds the ZFS repository """ with settings(hide('warnings', 'running', 'stdout'), warn_only=False, capture=True): sudo('DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get update') install_ubuntu_development_tools() apt_install(packages=['so...
[ "def", "add_zfs_apt_repository", "(", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "sudo", "(", "'DEBIAN_FRONTEND=noninteractive /us...
adds the ZFS repository
[ "adds", "the", "ZFS", "repository" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L24-L36
train
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
apt_install
def apt_install(**kwargs): """ installs a apt package """ for pkg in list(kwargs['packages']): if is_package_installed(distribution='ubuntu', pkg=pkg) is False: sudo("DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y %s" % pkg) # if we didn't abort above, we shou...
python
def apt_install(**kwargs): """ installs a apt package """ for pkg in list(kwargs['packages']): if is_package_installed(distribution='ubuntu', pkg=pkg) is False: sudo("DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y %s" % pkg) # if we didn't abort above, we shou...
[ "def", "apt_install", "(", "*", "*", "kwargs", ")", ":", "for", "pkg", "in", "list", "(", "kwargs", "[", "'packages'", "]", ")", ":", "if", "is_package_installed", "(", "distribution", "=", "'ubuntu'", ",", "pkg", "=", "pkg", ")", "is", "False", ":", ...
installs a apt package
[ "installs", "a", "apt", "package" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L48-L56
train
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
apt_install_from_url
def apt_install_from_url(pkg_name, url, log=False): """ installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package """ if is_package_installed(distribution='ubuntu', pkg=pkg_name) is False: if log: log_green( ...
python
def apt_install_from_url(pkg_name, url, log=False): """ installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package """ if is_package_installed(distribution='ubuntu', pkg=pkg_name) is False: if log: log_green( ...
[ "def", "apt_install_from_url", "(", "pkg_name", ",", "url", ",", "log", "=", "False", ")", ":", "if", "is_package_installed", "(", "distribution", "=", "'ubuntu'", ",", "pkg", "=", "pkg_name", ")", "is", "False", ":", "if", "log", ":", "log_green", "(", ...
installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package
[ "installs", "a", "pkg", "from", "a", "url", "p", "pkg_name", ":", "the", "name", "of", "the", "package", "to", "install", "p", "url", ":", "the", "full", "URL", "for", "the", "rpm", "package" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L59-L76
train
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
apt_add_key
def apt_add_key(keyid, keyserver='keyserver.ubuntu.com', log=False): """ trust a new PGP key related to a apt-repository """ if log: log_green( 'trusting keyid %s from %s' % (keyid, keyserver) ) with settings(hide('warnings', 'running', 'stdout')): sudo('apt-key adv --key...
python
def apt_add_key(keyid, keyserver='keyserver.ubuntu.com', log=False): """ trust a new PGP key related to a apt-repository """ if log: log_green( 'trusting keyid %s from %s' % (keyid, keyserver) ) with settings(hide('warnings', 'running', 'stdout')): sudo('apt-key adv --key...
[ "def", "apt_add_key", "(", "keyid", ",", "keyserver", "=", "'keyserver.ubuntu.com'", ",", "log", "=", "False", ")", ":", "if", "log", ":", "log_green", "(", "'trusting keyid %s from %s'", "%", "(", "keyid", ",", "keyserver", ")", ")", "with", "settings", "("...
trust a new PGP key related to a apt-repository
[ "trust", "a", "new", "PGP", "key", "related", "to", "a", "apt", "-", "repository" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L96-L104
train
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
enable_apt_repositories
def enable_apt_repositories(prefix, url, version, repositories): """ adds an apt repository """ with settings(hide('warnings', 'running', 'stdout'), warn_only=False, capture=True): sudo('apt-add-repository "%s %s %s %s"' % (prefix, url...
python
def enable_apt_repositories(prefix, url, version, repositories): """ adds an apt repository """ with settings(hide('warnings', 'running', 'stdout'), warn_only=False, capture=True): sudo('apt-add-repository "%s %s %s %s"' % (prefix, url...
[ "def", "enable_apt_repositories", "(", "prefix", ",", "url", ",", "version", ",", "repositories", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "Tr...
adds an apt repository
[ "adds", "an", "apt", "repository" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L107-L121
train
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
install_gem
def install_gem(gem): """ install a particular gem """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): # convert 0 into True, any errors will always raise an exception return not bool( run("gem install %s --no-rdoc --no...
python
def install_gem(gem): """ install a particular gem """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): # convert 0 into True, any errors will always raise an exception return not bool( run("gem install %s --no-rdoc --no...
[ "def", "install_gem", "(", "gem", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "# convert 0 into True, any errors...
install a particular gem
[ "install", "a", "particular", "gem" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L124-L130
train
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
install_python_module_locally
def install_python_module_locally(name): """ instals a python module using pip """ with settings(hide('everything'), warn_only=False, capture=True): # convert 0 into True, any errors will always raise an exception print(not bool(local('pip --quiet install %s' % name).return_cod...
python
def install_python_module_locally(name): """ instals a python module using pip """ with settings(hide('everything'), warn_only=False, capture=True): # convert 0 into True, any errors will always raise an exception print(not bool(local('pip --quiet install %s' % name).return_cod...
[ "def", "install_python_module_locally", "(", "name", ")", ":", "with", "settings", "(", "hide", "(", "'everything'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "# convert 0 into True, any errors will always raise an exception", "print"...
instals a python module using pip
[ "instals", "a", "python", "module", "using", "pip" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L143-L150
train
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
is_package_installed
def is_package_installed(distribution, pkg): """ checks if a particular package is installed """ if ('centos' in distribution or 'el' in distribution or 'redhat' in distribution): return(is_rpm_package_installed(pkg)) if ('ubuntu' in distribution or 'debian' in d...
python
def is_package_installed(distribution, pkg): """ checks if a particular package is installed """ if ('centos' in distribution or 'el' in distribution or 'redhat' in distribution): return(is_rpm_package_installed(pkg)) if ('ubuntu' in distribution or 'debian' in d...
[ "def", "is_package_installed", "(", "distribution", ",", "pkg", ")", ":", "if", "(", "'centos'", "in", "distribution", "or", "'el'", "in", "distribution", "or", "'redhat'", "in", "distribution", ")", ":", "return", "(", "is_rpm_package_installed", "(", "pkg", ...
checks if a particular package is installed
[ "checks", "if", "a", "particular", "package", "is", "installed" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L181-L190
train
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
is_rpm_package_installed
def is_rpm_package_installed(pkg): """ checks if a particular rpm package is installed """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): result = sudo("rpm -q %s" % pkg) if result.return_code == 0: return True ...
python
def is_rpm_package_installed(pkg): """ checks if a particular rpm package is installed """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): result = sudo("rpm -q %s" % pkg) if result.return_code == 0: return True ...
[ "def", "is_rpm_package_installed", "(", "pkg", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "True", ",", "capture", "=", "True", ")", ":", "result", "=", "su...
checks if a particular rpm package is installed
[ "checks", "if", "a", "particular", "rpm", "package", "is", "installed" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L193-L206
train
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
yum_install
def yum_install(**kwargs): """ installs a yum package """ if 'repo' in kwargs: repo = kwargs['repo'] for pkg in list(kwargs['packages']): if is_package_installed(distribution='el', pkg=pkg) is False: if 'repo' in locals(): log_green( ...
python
def yum_install(**kwargs): """ installs a yum package """ if 'repo' in kwargs: repo = kwargs['repo'] for pkg in list(kwargs['packages']): if is_package_installed(distribution='el', pkg=pkg) is False: if 'repo' in locals(): log_green( ...
[ "def", "yum_install", "(", "*", "*", "kwargs", ")", ":", "if", "'repo'", "in", "kwargs", ":", "repo", "=", "kwargs", "[", "'repo'", "]", "for", "pkg", "in", "list", "(", "kwargs", "[", "'packages'", "]", ")", ":", "if", "is_package_installed", "(", "...
installs a yum package
[ "installs", "a", "yum", "package" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L209-L224
train
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
yum_group_install
def yum_group_install(**kwargs): """ instals a yum group """ for grp in list(kwargs['groups']): log_green("installing %s ..." % grp) if 'repo' in kwargs: repo = kwargs['repo'] sudo("yum groupinstall -y --quiet " "--enablerepo=%s '%s'" % (repo, grp)) ...
python
def yum_group_install(**kwargs): """ instals a yum group """ for grp in list(kwargs['groups']): log_green("installing %s ..." % grp) if 'repo' in kwargs: repo = kwargs['repo'] sudo("yum groupinstall -y --quiet " "--enablerepo=%s '%s'" % (repo, grp)) ...
[ "def", "yum_group_install", "(", "*", "*", "kwargs", ")", ":", "for", "grp", "in", "list", "(", "kwargs", "[", "'groups'", "]", ")", ":", "log_green", "(", "\"installing %s ...\"", "%", "grp", ")", "if", "'repo'", "in", "kwargs", ":", "repo", "=", "kwa...
instals a yum group
[ "instals", "a", "yum", "group" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L227-L238
train
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
yum_install_from_url
def yum_install_from_url(pkg_name, url): """ installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package """ if is_package_installed(distribution='el', pkg=pkg_name) is False: log_green( "installing %s from %s" % (pkg_n...
python
def yum_install_from_url(pkg_name, url): """ installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package """ if is_package_installed(distribution='el', pkg=pkg_name) is False: log_green( "installing %s from %s" % (pkg_n...
[ "def", "yum_install_from_url", "(", "pkg_name", ",", "url", ")", ":", "if", "is_package_installed", "(", "distribution", "=", "'el'", ",", "pkg", "=", "pkg_name", ")", "is", "False", ":", "log_green", "(", "\"installing %s from %s\"", "%", "(", "pkg_name", ","...
installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package
[ "installs", "a", "pkg", "from", "a", "url", "p", "pkg_name", ":", "the", "name", "of", "the", "package", "to", "install", "p", "url", ":", "the", "full", "URL", "for", "the", "rpm", "package" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L241-L259
train
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterface.recherche
def recherche(self, pattern, entete, in_all=False): """abstractSearch in fields of collection and reset rendering. Returns number of results. If in_all is True, call get_all before doing the search.""" if in_all: self.collection = self.get_all() self.collection.recher...
python
def recherche(self, pattern, entete, in_all=False): """abstractSearch in fields of collection and reset rendering. Returns number of results. If in_all is True, call get_all before doing the search.""" if in_all: self.collection = self.get_all() self.collection.recher...
[ "def", "recherche", "(", "self", ",", "pattern", ",", "entete", ",", "in_all", "=", "False", ")", ":", "if", "in_all", ":", "self", ".", "collection", "=", "self", ".", "get_all", "(", ")", "self", ".", "collection", ".", "recherche", "(", "pattern", ...
abstractSearch in fields of collection and reset rendering. Returns number of results. If in_all is True, call get_all before doing the search.
[ "abstractSearch", "in", "fields", "of", "collection", "and", "reset", "rendering", ".", "Returns", "number", "of", "results", ".", "If", "in_all", "is", "True", "call", "get_all", "before", "doing", "the", "search", "." ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L119-L127
train
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterface.launch_background_job
def launch_background_job(self, job, on_error=None, on_success=None): """Launch the callable job in background thread. Succes or failure are controlled by on_error and on_success """ if not self.main.mode_online: self.sortie_erreur_GUI( "Local mode activated. ...
python
def launch_background_job(self, job, on_error=None, on_success=None): """Launch the callable job in background thread. Succes or failure are controlled by on_error and on_success """ if not self.main.mode_online: self.sortie_erreur_GUI( "Local mode activated. ...
[ "def", "launch_background_job", "(", "self", ",", "job", ",", "on_error", "=", "None", ",", "on_success", "=", "None", ")", ":", "if", "not", "self", ".", "main", ".", "mode_online", ":", "self", ".", "sortie_erreur_GUI", "(", "\"Local mode activated. Can't ru...
Launch the callable job in background thread. Succes or failure are controlled by on_error and on_success
[ "Launch", "the", "callable", "job", "in", "background", "thread", ".", "Succes", "or", "failure", "are", "controlled", "by", "on_error", "and", "on_success" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L129-L153
train
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterface.filtre
def filtre(liste_base, criteres) -> groups.Collection: """ Return a filter list, bases on criteres :param liste_base: Acces list :param criteres: Criteria { `attribut`:[valeurs,...] } """ def choisi(ac): for cat, li in criteres.items(): v = a...
python
def filtre(liste_base, criteres) -> groups.Collection: """ Return a filter list, bases on criteres :param liste_base: Acces list :param criteres: Criteria { `attribut`:[valeurs,...] } """ def choisi(ac): for cat, li in criteres.items(): v = a...
[ "def", "filtre", "(", "liste_base", ",", "criteres", ")", "->", "groups", ".", "Collection", ":", "def", "choisi", "(", "ac", ")", ":", "for", "cat", ",", "li", "in", "criteres", ".", "items", "(", ")", ":", "v", "=", "ac", "[", "cat", "]", "if",...
Return a filter list, bases on criteres :param liste_base: Acces list :param criteres: Criteria { `attribut`:[valeurs,...] }
[ "Return", "a", "filter", "list", "bases", "on", "criteres" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L175-L190
train
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterInterfaces.load_remote_data
def load_remote_data(self, callback_etat=print): """ Load remote data. On succes, build base. On failure, raise :class:`~.Core.exceptions.StructureError`, :class:`~.Core.exceptions.ConnexionError` :param callback_etat: State renderer str , int , int -> None """ callback_...
python
def load_remote_data(self, callback_etat=print): """ Load remote data. On succes, build base. On failure, raise :class:`~.Core.exceptions.StructureError`, :class:`~.Core.exceptions.ConnexionError` :param callback_etat: State renderer str , int , int -> None """ callback_...
[ "def", "load_remote_data", "(", "self", ",", "callback_etat", "=", "print", ")", ":", "callback_etat", "(", "\"Chargement des utilisateurs\"", ",", "0", ",", "1", ")", "self", ".", "_load_users", "(", ")", "self", ".", "base", "=", "self", ".", "BASE_CLASS",...
Load remote data. On succes, build base. On failure, raise :class:`~.Core.exceptions.StructureError`, :class:`~.Core.exceptions.ConnexionError` :param callback_etat: State renderer str , int , int -> None
[ "Load", "remote", "data", ".", "On", "succes", "build", "base", ".", "On", "failure", "raise", ":", "class", ":", "~", ".", "Core", ".", "exceptions", ".", "StructureError", ":", "class", ":", "~", ".", "Core", ".", "exceptions", ".", "ConnexionError" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L247-L256
train
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterInterfaces._load_users
def _load_users(self): """Default implentation requires users from DB. Should setup `users` attribute""" r = sql.abstractRequetesSQL.get_users()() self.users = {d["id"]: dict(d) for d in r}
python
def _load_users(self): """Default implentation requires users from DB. Should setup `users` attribute""" r = sql.abstractRequetesSQL.get_users()() self.users = {d["id"]: dict(d) for d in r}
[ "def", "_load_users", "(", "self", ")", ":", "r", "=", "sql", ".", "abstractRequetesSQL", ".", "get_users", "(", ")", "(", ")", "self", ".", "users", "=", "{", "d", "[", "\"id\"", "]", ":", "dict", "(", "d", ")", "for", "d", "in", "r", "}" ]
Default implentation requires users from DB. Should setup `users` attribute
[ "Default", "implentation", "requires", "users", "from", "DB", ".", "Should", "setup", "users", "attribute" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L258-L262
train
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterInterfaces.load_modules
def load_modules(self): """Should instance interfaces and set them to interface, following `modules`""" if self.INTERFACES_MODULE is None: raise NotImplementedError("A module containing interfaces modules " "should be setup in INTERFACES_MODULE !") ...
python
def load_modules(self): """Should instance interfaces and set them to interface, following `modules`""" if self.INTERFACES_MODULE is None: raise NotImplementedError("A module containing interfaces modules " "should be setup in INTERFACES_MODULE !") ...
[ "def", "load_modules", "(", "self", ")", ":", "if", "self", ".", "INTERFACES_MODULE", "is", "None", ":", "raise", "NotImplementedError", "(", "\"A module containing interfaces modules \"", "\"should be setup in INTERFACES_MODULE !\"", ")", "else", ":", "for", "module", ...
Should instance interfaces and set them to interface, following `modules`
[ "Should", "instance", "interfaces", "and", "set", "them", "to", "interface", "following", "modules" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L273-L282
train
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterInterfaces.has_autolog
def has_autolog(self, user_id): """ Read auto-connection parameters and returns local password or None """ try: with open("local/init", "rb") as f: s = f.read() s = security.protege_data(s, False) self.autolog = json.loads(s).ge...
python
def has_autolog(self, user_id): """ Read auto-connection parameters and returns local password or None """ try: with open("local/init", "rb") as f: s = f.read() s = security.protege_data(s, False) self.autolog = json.loads(s).ge...
[ "def", "has_autolog", "(", "self", ",", "user_id", ")", ":", "try", ":", "with", "open", "(", "\"local/init\"", ",", "\"rb\"", ")", "as", "f", ":", "s", "=", "f", ".", "read", "(", ")", "s", "=", "security", ".", "protege_data", "(", "s", ",", "F...
Read auto-connection parameters and returns local password or None
[ "Read", "auto", "-", "connection", "parameters", "and", "returns", "local", "password", "or", "None" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L307-L320
train
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterInterfaces.loggin
def loggin(self, user_id, mdp, autolog): """Check mdp and return True it's ok""" r = sql.abstractRequetesSQL.check_mdp_user(user_id, mdp) if r(): # update auto-log params self.autolog[user_id] = autolog and mdp or False self.modules = self.users[user_id]["modu...
python
def loggin(self, user_id, mdp, autolog): """Check mdp and return True it's ok""" r = sql.abstractRequetesSQL.check_mdp_user(user_id, mdp) if r(): # update auto-log params self.autolog[user_id] = autolog and mdp or False self.modules = self.users[user_id]["modu...
[ "def", "loggin", "(", "self", ",", "user_id", ",", "mdp", ",", "autolog", ")", ":", "r", "=", "sql", ".", "abstractRequetesSQL", ".", "check_mdp_user", "(", "user_id", ",", "mdp", ")", "if", "r", "(", ")", ":", "# update auto-log params", "self", ".", ...
Check mdp and return True it's ok
[ "Check", "mdp", "and", "return", "True", "it", "s", "ok" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L322-L339
train
benoitkugler/abstractDataLibrary
pyDLib/GUI/fenetres.py
Window.add_widget
def add_widget(self, w): """Convenience function""" if self.layout(): self.layout().addWidget(w) else: layout = QVBoxLayout(self) layout.addWidget(w)
python
def add_widget(self, w): """Convenience function""" if self.layout(): self.layout().addWidget(w) else: layout = QVBoxLayout(self) layout.addWidget(w)
[ "def", "add_widget", "(", "self", ",", "w", ")", ":", "if", "self", ".", "layout", "(", ")", ":", "self", ".", "layout", "(", ")", ".", "addWidget", "(", "w", ")", "else", ":", "layout", "=", "QVBoxLayout", "(", "self", ")", "layout", ".", "addWi...
Convenience function
[ "Convenience", "function" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/fenetres.py#L114-L120
train
benoitkugler/abstractDataLibrary
pyDLib/GUI/fenetres.py
Window.add_layout
def add_layout(self, l): """Convenience function""" if self.layout(): self.layout().addLayout(l) else: layout = QVBoxLayout(self) layout.addLayout(l)
python
def add_layout(self, l): """Convenience function""" if self.layout(): self.layout().addLayout(l) else: layout = QVBoxLayout(self) layout.addLayout(l)
[ "def", "add_layout", "(", "self", ",", "l", ")", ":", "if", "self", ".", "layout", "(", ")", ":", "self", ".", "layout", "(", ")", ".", "addLayout", "(", "l", ")", "else", ":", "layout", "=", "QVBoxLayout", "(", "self", ")", "layout", ".", "addLa...
Convenience function
[ "Convenience", "function" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/fenetres.py#L122-L128
train
tslight/columns
columns/columns.py
mkpad
def mkpad(items): ''' Find the length of the longest element of a list. Return that value + two. ''' pad = 0 stritems = [str(e) for e in items] # cast list to strings for e in stritems: index = stritems.index(e) if len(stritems[index]) > pad: pad = len(stritems[index...
python
def mkpad(items): ''' Find the length of the longest element of a list. Return that value + two. ''' pad = 0 stritems = [str(e) for e in items] # cast list to strings for e in stritems: index = stritems.index(e) if len(stritems[index]) > pad: pad = len(stritems[index...
[ "def", "mkpad", "(", "items", ")", ":", "pad", "=", "0", "stritems", "=", "[", "str", "(", "e", ")", "for", "e", "in", "items", "]", "# cast list to strings", "for", "e", "in", "stritems", ":", "index", "=", "stritems", ".", "index", "(", "e", ")",...
Find the length of the longest element of a list. Return that value + two.
[ "Find", "the", "length", "of", "the", "longest", "element", "of", "a", "list", ".", "Return", "that", "value", "+", "two", "." ]
609ec92c00c9a6d452d4c6cc20551882997d4871
https://github.com/tslight/columns/blob/609ec92c00c9a6d452d4c6cc20551882997d4871/columns/columns.py#L5-L16
train
tslight/columns
columns/columns.py
mkcols
def mkcols(l, rows): ''' Compute the size of our columns by first making them a divisible of our row height and then splitting our list into smaller lists the size of the row height. ''' cols = [] base = 0 while len(l) > rows and len(l) % rows != 0: l.append("") for i in rang...
python
def mkcols(l, rows): ''' Compute the size of our columns by first making them a divisible of our row height and then splitting our list into smaller lists the size of the row height. ''' cols = [] base = 0 while len(l) > rows and len(l) % rows != 0: l.append("") for i in rang...
[ "def", "mkcols", "(", "l", ",", "rows", ")", ":", "cols", "=", "[", "]", "base", "=", "0", "while", "len", "(", "l", ")", ">", "rows", "and", "len", "(", "l", ")", "%", "rows", "!=", "0", ":", "l", ".", "append", "(", "\"\"", ")", "for", ...
Compute the size of our columns by first making them a divisible of our row height and then splitting our list into smaller lists the size of the row height.
[ "Compute", "the", "size", "of", "our", "columns", "by", "first", "making", "them", "a", "divisible", "of", "our", "row", "height", "and", "then", "splitting", "our", "list", "into", "smaller", "lists", "the", "size", "of", "the", "row", "height", "." ]
609ec92c00c9a6d452d4c6cc20551882997d4871
https://github.com/tslight/columns/blob/609ec92c00c9a6d452d4c6cc20551882997d4871/columns/columns.py#L19-L32
train
tslight/columns
columns/columns.py
mkrows
def mkrows(l, pad, width, height): ''' Compute the optimal number of rows based on our lists' largest element and our terminal size in columns and rows. Work out our maximum column number by dividing the width of the terminal by our largest element. While the length of our list is greater than...
python
def mkrows(l, pad, width, height): ''' Compute the optimal number of rows based on our lists' largest element and our terminal size in columns and rows. Work out our maximum column number by dividing the width of the terminal by our largest element. While the length of our list is greater than...
[ "def", "mkrows", "(", "l", ",", "pad", ",", "width", ",", "height", ")", ":", "maxcols", "=", "int", "(", "width", "/", "pad", ")", "while", "len", "(", "l", ")", ">", "height", "*", "maxcols", ":", "height", "+=", "1", "return", "height" ]
Compute the optimal number of rows based on our lists' largest element and our terminal size in columns and rows. Work out our maximum column number by dividing the width of the terminal by our largest element. While the length of our list is greater than the total number of elements we can fit on...
[ "Compute", "the", "optimal", "number", "of", "rows", "based", "on", "our", "lists", "largest", "element", "and", "our", "terminal", "size", "in", "columns", "and", "rows", "." ]
609ec92c00c9a6d452d4c6cc20551882997d4871
https://github.com/tslight/columns/blob/609ec92c00c9a6d452d4c6cc20551882997d4871/columns/columns.py#L35-L49
train
tslight/columns
columns/columns.py
prtcols
def prtcols(items, vpad=6): ''' After computing the size of our rows and columns based on the terminal size and length of the largest element, use zip to aggregate our column lists into row lists and then iterate over the row lists and print them. ''' from os import get_terminal_size items =...
python
def prtcols(items, vpad=6): ''' After computing the size of our rows and columns based on the terminal size and length of the largest element, use zip to aggregate our column lists into row lists and then iterate over the row lists and print them. ''' from os import get_terminal_size items =...
[ "def", "prtcols", "(", "items", ",", "vpad", "=", "6", ")", ":", "from", "os", "import", "get_terminal_size", "items", "=", "list", "(", "items", ")", "# copy list so we don't mutate it", "width", ",", "height", "=", "get_terminal_size", "(", ")", "height", ...
After computing the size of our rows and columns based on the terminal size and length of the largest element, use zip to aggregate our column lists into row lists and then iterate over the row lists and print them.
[ "After", "computing", "the", "size", "of", "our", "rows", "and", "columns", "based", "on", "the", "terminal", "size", "and", "length", "of", "the", "largest", "element", "use", "zip", "to", "aggregate", "our", "column", "lists", "into", "row", "lists", "an...
609ec92c00c9a6d452d4c6cc20551882997d4871
https://github.com/tslight/columns/blob/609ec92c00c9a6d452d4c6cc20551882997d4871/columns/columns.py#L52-L68
train
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
cmd2list
def cmd2list(cmd): ''' Executes a command through the operating system and returns the output as a list, or on error a string with the standard error. EXAMPLE: >>> from subprocess import Popen, PIPE >>> CMDout2array('ls -l') ''' p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True) stdout, ...
python
def cmd2list(cmd): ''' Executes a command through the operating system and returns the output as a list, or on error a string with the standard error. EXAMPLE: >>> from subprocess import Popen, PIPE >>> CMDout2array('ls -l') ''' p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True) stdout, ...
[ "def", "cmd2list", "(", "cmd", ")", ":", "p", "=", "Popen", "(", "cmd", ",", "stdout", "=", "PIPE", ",", "stderr", "=", "PIPE", ",", "shell", "=", "True", ")", "stdout", ",", "stderr", "=", "p", ".", "communicate", "(", ")", "if", "p", ".", "re...
Executes a command through the operating system and returns the output as a list, or on error a string with the standard error. EXAMPLE: >>> from subprocess import Popen, PIPE >>> CMDout2array('ls -l')
[ "Executes", "a", "command", "through", "the", "operating", "system", "and", "returns", "the", "output", "as", "a", "list", "or", "on", "error", "a", "string", "with", "the", "standard", "error", ".", "EXAMPLE", ":", ">>>", "from", "subprocess", "import", "...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L532-L544
train
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
ProgramList.return_timer
def return_timer(self, name, status, timer): ''' Return a text formatted timer ''' timer_template = '%s %s %s : %s : %9s' t = str(timedelta(0, timer)).split(',')[-1].strip().split(':') #t = str(timedelta(0, timer)).split(':') if len(t) == 4: h, m, s = int(t[0])*24 + int(t[1]), i...
python
def return_timer(self, name, status, timer): ''' Return a text formatted timer ''' timer_template = '%s %s %s : %s : %9s' t = str(timedelta(0, timer)).split(',')[-1].strip().split(':') #t = str(timedelta(0, timer)).split(':') if len(t) == 4: h, m, s = int(t[0])*24 + int(t[1]), i...
[ "def", "return_timer", "(", "self", ",", "name", ",", "status", ",", "timer", ")", ":", "timer_template", "=", "'%s %s %s : %s : %9s'", "t", "=", "str", "(", "timedelta", "(", "0", ",", "timer", ")", ")", ".", "split", "(", "','", ")", "[", "-", "1...
Return a text formatted timer
[ "Return", "a", "text", "formatted", "timer" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L77-L92
train
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
ProgramList.print_timers
def print_timers(self): ''' PRINT EXECUTION TIMES FOR THE LIST OF PROGRAMS ''' self.timer += time() total_time = self.timer tmp = '* %s *' debug.log( '', '* '*29, tmp%(' '*51), tmp%('%s %s %s'%('Program Name'.ljust(20), 'Status'.ljust(7), 'Execute Ti...
python
def print_timers(self): ''' PRINT EXECUTION TIMES FOR THE LIST OF PROGRAMS ''' self.timer += time() total_time = self.timer tmp = '* %s *' debug.log( '', '* '*29, tmp%(' '*51), tmp%('%s %s %s'%('Program Name'.ljust(20), 'Status'.ljust(7), 'Execute Ti...
[ "def", "print_timers", "(", "self", ")", ":", "self", ".", "timer", "+=", "time", "(", ")", "total_time", "=", "self", ".", "timer", "tmp", "=", "'* %s *'", "debug", ".", "log", "(", "''", ",", "'* '", "*", "29", ",", "tmp", "%", "(", "' '", "*...
PRINT EXECUTION TIMES FOR THE LIST OF PROGRAMS
[ "PRINT", "EXECUTION", "TIMES", "FOR", "THE", "LIST", "OF", "PROGRAMS" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L93-L120
train
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.get_cmd
def get_cmd(self): """ This function combines and return the commanline call of the program. """ cmd = [] if self.path is not None: if '/' in self.path and not os.path.exists(self.path): debug.log('Error: path contains / but does not exist: %s'%self.path) else: ...
python
def get_cmd(self): """ This function combines and return the commanline call of the program. """ cmd = [] if self.path is not None: if '/' in self.path and not os.path.exists(self.path): debug.log('Error: path contains / but does not exist: %s'%self.path) else: ...
[ "def", "get_cmd", "(", "self", ")", ":", "cmd", "=", "[", "]", "if", "self", ".", "path", "is", "not", "None", ":", "if", "'/'", "in", "self", ".", "path", "and", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "path", ")", ":", "d...
This function combines and return the commanline call of the program.
[ "This", "function", "combines", "and", "return", "the", "commanline", "call", "of", "the", "program", "." ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L186-L211
train
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.append_args
def append_args(self, arg): """ This function appends the provided arguments to the program object. """ debug.log("Adding Arguments: %s"%(arg)) if isinstance(arg, (int,float)): self.args.append(str(arg)) if isinstance(arg, str): self.args.append(arg) if isinstance(arg, list): ...
python
def append_args(self, arg): """ This function appends the provided arguments to the program object. """ debug.log("Adding Arguments: %s"%(arg)) if isinstance(arg, (int,float)): self.args.append(str(arg)) if isinstance(arg, str): self.args.append(arg) if isinstance(arg, list): ...
[ "def", "append_args", "(", "self", ",", "arg", ")", ":", "debug", ".", "log", "(", "\"Adding Arguments: %s\"", "%", "(", "arg", ")", ")", "if", "isinstance", "(", "arg", ",", "(", "int", ",", "float", ")", ")", ":", "self", ".", "args", ".", "appen...
This function appends the provided arguments to the program object.
[ "This", "function", "appends", "the", "provided", "arguments", "to", "the", "program", "object", "." ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L215-L225
train
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.execute
def execute(self): """ This function Executes the program with set arguments. """ prog_cmd = self.get_cmd().strip() if prog_cmd == '': self.status = 'Failure' debug.log("Error: No program to execute for %s!"%self.name) debug.log(("Could not combine path and arguments into cm...
python
def execute(self): """ This function Executes the program with set arguments. """ prog_cmd = self.get_cmd().strip() if prog_cmd == '': self.status = 'Failure' debug.log("Error: No program to execute for %s!"%self.name) debug.log(("Could not combine path and arguments into cm...
[ "def", "execute", "(", "self", ")", ":", "prog_cmd", "=", "self", ".", "get_cmd", "(", ")", ".", "strip", "(", ")", "if", "prog_cmd", "==", "''", ":", "self", ".", "status", "=", "'Failure'", "debug", ".", "log", "(", "\"Error: No program to execute for ...
This function Executes the program with set arguments.
[ "This", "function", "Executes", "the", "program", "with", "set", "arguments", "." ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L226-L305
train
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.wait
def wait(self, pattern='Done', interval=None, epatterns=['error','Error','STACK','Traceback']): """ This function will wait on a given pattern being shown on the last line of a given outputfile. OPTIONS pattern - The string pattern to recognise when a program ...
python
def wait(self, pattern='Done', interval=None, epatterns=['error','Error','STACK','Traceback']): """ This function will wait on a given pattern being shown on the last line of a given outputfile. OPTIONS pattern - The string pattern to recognise when a program ...
[ "def", "wait", "(", "self", ",", "pattern", "=", "'Done'", ",", "interval", "=", "None", ",", "epatterns", "=", "[", "'error'", ",", "'Error'", ",", "'STACK'", ",", "'Traceback'", "]", ")", ":", "increasing_interval", "=", "False", "if", "interval", "is"...
This function will wait on a given pattern being shown on the last line of a given outputfile. OPTIONS pattern - The string pattern to recognise when a program finished properly. interval - The amount of seconds to wait between checking the ...
[ "This", "function", "will", "wait", "on", "a", "given", "pattern", "being", "shown", "on", "the", "last", "line", "of", "a", "given", "outputfile", "." ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L306-L454
train
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.print_stdout
def print_stdout(self): """ This function will read the standard out of the program and print it """ # First we check if the file we want to print does exists if self.wdir != '': stdout = "%s/%s"%(self.wdir, self.stdout) else: stdout = self.stdout if os.path.exists(...
python
def print_stdout(self): """ This function will read the standard out of the program and print it """ # First we check if the file we want to print does exists if self.wdir != '': stdout = "%s/%s"%(self.wdir, self.stdout) else: stdout = self.stdout if os.path.exists(...
[ "def", "print_stdout", "(", "self", ")", ":", "# First we check if the file we want to print does exists", "if", "self", ".", "wdir", "!=", "''", ":", "stdout", "=", "\"%s/%s\"", "%", "(", "self", ".", "wdir", ",", "self", ".", "stdout", ")", "else", ":", "s...
This function will read the standard out of the program and print it
[ "This", "function", "will", "read", "the", "standard", "out", "of", "the", "program", "and", "print", "it" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L455-L467
train
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.find_out_var
def find_out_var(self, varnames=[]): """ This function will read the standard out of the program, catch variables and return the values EG. #varname=value """ if self.wdir != '': stdout = "%s/%s"%(self.wdir, self.stdout) else: stdout = self.stdout res...
python
def find_out_var(self, varnames=[]): """ This function will read the standard out of the program, catch variables and return the values EG. #varname=value """ if self.wdir != '': stdout = "%s/%s"%(self.wdir, self.stdout) else: stdout = self.stdout res...
[ "def", "find_out_var", "(", "self", ",", "varnames", "=", "[", "]", ")", ":", "if", "self", ".", "wdir", "!=", "''", ":", "stdout", "=", "\"%s/%s\"", "%", "(", "self", ".", "wdir", ",", "self", ".", "stdout", ")", "else", ":", "stdout", "=", "sel...
This function will read the standard out of the program, catch variables and return the values EG. #varname=value
[ "This", "function", "will", "read", "the", "standard", "out", "of", "the", "program", "catch", "variables", "and", "return", "the", "values" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L468-L490
train
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.find_err_pattern
def find_err_pattern(self, pattern): """ This function will read the standard error of the program and return a matching pattern if found. EG. prog_obj.FindErrPattern("Update of mySQL failed") """ if self.wdir != '': stderr = "%s/%s"%(self.wdir, self.stderr) else: ...
python
def find_err_pattern(self, pattern): """ This function will read the standard error of the program and return a matching pattern if found. EG. prog_obj.FindErrPattern("Update of mySQL failed") """ if self.wdir != '': stderr = "%s/%s"%(self.wdir, self.stderr) else: ...
[ "def", "find_err_pattern", "(", "self", ",", "pattern", ")", ":", "if", "self", ".", "wdir", "!=", "''", ":", "stderr", "=", "\"%s/%s\"", "%", "(", "self", ".", "wdir", ",", "self", ".", "stderr", ")", "else", ":", "stderr", "=", "self", ".", "stde...
This function will read the standard error of the program and return a matching pattern if found. EG. prog_obj.FindErrPattern("Update of mySQL failed")
[ "This", "function", "will", "read", "the", "standard", "error", "of", "the", "program", "and", "return", "a", "matching", "pattern", "if", "found", "." ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L491-L510
train
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.find_out_pattern
def find_out_pattern(self, pattern): """ This function will read the standard error of the program and return a matching pattern if found. EG. prog_obj.FindErrPattern("Update of mySQL failed") """ if self.wdir != '': stdout = "%s/%s"%(self.wdir, self.stdout) else: ...
python
def find_out_pattern(self, pattern): """ This function will read the standard error of the program and return a matching pattern if found. EG. prog_obj.FindErrPattern("Update of mySQL failed") """ if self.wdir != '': stdout = "%s/%s"%(self.wdir, self.stdout) else: ...
[ "def", "find_out_pattern", "(", "self", ",", "pattern", ")", ":", "if", "self", ".", "wdir", "!=", "''", ":", "stdout", "=", "\"%s/%s\"", "%", "(", "self", ".", "wdir", ",", "self", ".", "stdout", ")", "else", ":", "stdout", "=", "self", ".", "stdo...
This function will read the standard error of the program and return a matching pattern if found. EG. prog_obj.FindErrPattern("Update of mySQL failed")
[ "This", "function", "will", "read", "the", "standard", "error", "of", "the", "program", "and", "return", "a", "matching", "pattern", "if", "found", "." ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L511-L530
train
moralrecordings/mrcrowbar
mrcrowbar/lib/os/dos.py
decode_nfo
def decode_nfo( buffer ): """Decodes a byte string in NFO format (beloved by PC scener groups) from DOS Code Page 437 to Unicode.""" assert utils.is_bytes( buffer ) return '\n'.join( [''.join( [CP437[y] for y in x] ) for x in buffer.split( b'\r\n' )] )
python
def decode_nfo( buffer ): """Decodes a byte string in NFO format (beloved by PC scener groups) from DOS Code Page 437 to Unicode.""" assert utils.is_bytes( buffer ) return '\n'.join( [''.join( [CP437[y] for y in x] ) for x in buffer.split( b'\r\n' )] )
[ "def", "decode_nfo", "(", "buffer", ")", ":", "assert", "utils", ".", "is_bytes", "(", "buffer", ")", "return", "'\\n'", ".", "join", "(", "[", "''", ".", "join", "(", "[", "CP437", "[", "y", "]", "for", "y", "in", "x", "]", ")", "for", "x", "i...
Decodes a byte string in NFO format (beloved by PC scener groups) from DOS Code Page 437 to Unicode.
[ "Decodes", "a", "byte", "string", "in", "NFO", "format", "(", "beloved", "by", "PC", "scener", "groups", ")", "from", "DOS", "Code", "Page", "437", "to", "Unicode", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/lib/os/dos.py#L10-L14
train
OLC-Bioinformatics/sipprverse
MLSTsippr/mlst.py
GeneSippr.runner
def runner(self): """ Run the necessary methods in the correct order """ if os.path.isfile(self.report): self.report_parse() else: logging.info('Starting {} analysis pipeline'.format(self.analysistype)) # Create the objects to be used in the an...
python
def runner(self): """ Run the necessary methods in the correct order """ if os.path.isfile(self.report): self.report_parse() else: logging.info('Starting {} analysis pipeline'.format(self.analysistype)) # Create the objects to be used in the an...
[ "def", "runner", "(", "self", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "self", ".", "report", ")", ":", "self", ".", "report_parse", "(", ")", "else", ":", "logging", ".", "info", "(", "'Starting {} analysis pipeline'", ".", "format", "("...
Run the necessary methods in the correct order
[ "Run", "the", "necessary", "methods", "in", "the", "correct", "order" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L22-L44
train
OLC-Bioinformatics/sipprverse
MLSTsippr/mlst.py
GeneSippr.reporter
def reporter(self): """ Runs the necessary methods to parse raw read outputs """ logging.info('Preparing reports') # Populate self.plusdict in order to reuse parsing code from an assembly-based method for sample in self.runmetadata.samples: self.plusdict[sampl...
python
def reporter(self): """ Runs the necessary methods to parse raw read outputs """ logging.info('Preparing reports') # Populate self.plusdict in order to reuse parsing code from an assembly-based method for sample in self.runmetadata.samples: self.plusdict[sampl...
[ "def", "reporter", "(", "self", ")", ":", "logging", ".", "info", "(", "'Preparing reports'", ")", "# Populate self.plusdict in order to reuse parsing code from an assembly-based method", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ":", "self", "....
Runs the necessary methods to parse raw read outputs
[ "Runs", "the", "necessary", "methods", "to", "parse", "raw", "read", "outputs" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L46-L82
train
OLC-Bioinformatics/sipprverse
MLSTsippr/mlst.py
GeneSippr.profiler
def profiler(self): """Creates a dictionary from the profile scheme(s)""" logging.info('Loading profiles') # Initialise variables profiledata = defaultdict(make_dict) reverse_profiledata = dict() profileset = set() # Find all the unique profiles to use with a set ...
python
def profiler(self): """Creates a dictionary from the profile scheme(s)""" logging.info('Loading profiles') # Initialise variables profiledata = defaultdict(make_dict) reverse_profiledata = dict() profileset = set() # Find all the unique profiles to use with a set ...
[ "def", "profiler", "(", "self", ")", ":", "logging", ".", "info", "(", "'Loading profiles'", ")", "# Initialise variables", "profiledata", "=", "defaultdict", "(", "make_dict", ")", "reverse_profiledata", "=", "dict", "(", ")", "profileset", "=", "set", "(", "...
Creates a dictionary from the profile scheme(s)
[ "Creates", "a", "dictionary", "from", "the", "profile", "scheme", "(", "s", ")" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L84-L150
train
OLC-Bioinformatics/sipprverse
MLSTsippr/mlst.py
GeneSippr.sequencetyper
def sequencetyper(self): """Determines the sequence type of each strain based on comparisons to sequence type profiles""" logging.info('Performing sequence typing') for sample in self.runmetadata.samples: if sample.general.bestassemblyfile != 'NA': if type(sample[self...
python
def sequencetyper(self): """Determines the sequence type of each strain based on comparisons to sequence type profiles""" logging.info('Performing sequence typing') for sample in self.runmetadata.samples: if sample.general.bestassemblyfile != 'NA': if type(sample[self...
[ "def", "sequencetyper", "(", "self", ")", ":", "logging", ".", "info", "(", "'Performing sequence typing'", ")", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ":", "if", "sample", ".", "general", ".", "bestassemblyfile", "!=", "'NA'", ":...
Determines the sequence type of each strain based on comparisons to sequence type profiles
[ "Determines", "the", "sequence", "type", "of", "each", "strain", "based", "on", "comparisons", "to", "sequence", "type", "profiles" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L152-L337
train
OLC-Bioinformatics/sipprverse
MLSTsippr/mlst.py
GeneSippr.mlstreporter
def mlstreporter(self): """ Parse the results into a report""" logging.info('Writing reports') # Initialise variables header_row = str() combinedrow = str() combined_header_row = str() reportdirset = set() mlst_dict = dict() # Populate a set of all...
python
def mlstreporter(self): """ Parse the results into a report""" logging.info('Writing reports') # Initialise variables header_row = str() combinedrow = str() combined_header_row = str() reportdirset = set() mlst_dict = dict() # Populate a set of all...
[ "def", "mlstreporter", "(", "self", ")", ":", "logging", ".", "info", "(", "'Writing reports'", ")", "# Initialise variables", "header_row", "=", "str", "(", ")", "combinedrow", "=", "str", "(", ")", "combined_header_row", "=", "str", "(", ")", "reportdirset",...
Parse the results into a report
[ "Parse", "the", "results", "into", "a", "report" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L339-L517
train
OLC-Bioinformatics/sipprverse
MLSTsippr/mlst.py
GeneSippr.report_parse
def report_parse(self): """ If the pipeline has previously been run on these data, instead of reading through the results, parse the report instead """ # Initialise lists report_strains = list() genus_list = list() if self.analysistype == 'mlst': ...
python
def report_parse(self): """ If the pipeline has previously been run on these data, instead of reading through the results, parse the report instead """ # Initialise lists report_strains = list() genus_list = list() if self.analysistype == 'mlst': ...
[ "def", "report_parse", "(", "self", ")", ":", "# Initialise lists", "report_strains", "=", "list", "(", ")", "genus_list", "=", "list", "(", ")", "if", "self", ".", "analysistype", "==", "'mlst'", ":", "for", "sample", "in", "self", ".", "runmetadata", "."...
If the pipeline has previously been run on these data, instead of reading through the results, parse the report instead
[ "If", "the", "pipeline", "has", "previously", "been", "run", "on", "these", "data", "instead", "of", "reading", "through", "the", "results", "parse", "the", "report", "instead" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L519-L556
train
kappius/pyheaderfile
pyheaderfile/helpers.py
guess_type
def guess_type(filename, **kwargs): """ Utility function to call classes based on filename extension. Just usefull if you are reading the file and don't know file extension. You can pass kwargs and these args are passed to class only if they are used in class. """ extension = os.path.splitext(f...
python
def guess_type(filename, **kwargs): """ Utility function to call classes based on filename extension. Just usefull if you are reading the file and don't know file extension. You can pass kwargs and these args are passed to class only if they are used in class. """ extension = os.path.splitext(f...
[ "def", "guess_type", "(", "filename", ",", "*", "*", "kwargs", ")", ":", "extension", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "1", "]", "case", "=", "{", "'.xls'", ":", "Xls", ",", "'.xlsx'", ":", "Xlsx", ",", "'.csv'", ...
Utility function to call classes based on filename extension. Just usefull if you are reading the file and don't know file extension. You can pass kwargs and these args are passed to class only if they are used in class.
[ "Utility", "function", "to", "call", "classes", "based", "on", "filename", "extension", ".", "Just", "usefull", "if", "you", "are", "reading", "the", "file", "and", "don", "t", "know", "file", "extension", ".", "You", "can", "pass", "kwargs", "and", "these...
8d587dadae538adcec527fd8e74ad89ed5e2006a
https://github.com/kappius/pyheaderfile/blob/8d587dadae538adcec527fd8e74ad89ed5e2006a/pyheaderfile/helpers.py#L10-L31
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
get_gene_seqs
def get_gene_seqs(database_path, gene): """ This function takes the database path and a gene name as inputs and returns the gene sequence contained in the file given by the gene name """ gene_path = database_path + "/" + gene + ".fsa" gene_seq = "" # Open fasta file with open(gene_path)...
python
def get_gene_seqs(database_path, gene): """ This function takes the database path and a gene name as inputs and returns the gene sequence contained in the file given by the gene name """ gene_path = database_path + "/" + gene + ".fsa" gene_seq = "" # Open fasta file with open(gene_path)...
[ "def", "get_gene_seqs", "(", "database_path", ",", "gene", ")", ":", "gene_path", "=", "database_path", "+", "\"/\"", "+", "gene", "+", "\".fsa\"", "gene_seq", "=", "\"\"", "# Open fasta file", "with", "open", "(", "gene_path", ")", "as", "gene_file", ":", "...
This function takes the database path and a gene name as inputs and returns the gene sequence contained in the file given by the gene name
[ "This", "function", "takes", "the", "database", "path", "and", "a", "gene", "name", "as", "inputs", "and", "returns", "the", "gene", "sequence", "contained", "in", "the", "file", "given", "by", "the", "gene", "name" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L10-L23
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
get_db_mutations
def get_db_mutations(mut_db_path, gene_list, res_stop_codons): """ This function opens the file resistenss-overview.txt, and reads the content into a dict of dicts. The dict will contain information about all known mutations given in the database. This dict is returned. """ # Open resistens-ove...
python
def get_db_mutations(mut_db_path, gene_list, res_stop_codons): """ This function opens the file resistenss-overview.txt, and reads the content into a dict of dicts. The dict will contain information about all known mutations given in the database. This dict is returned. """ # Open resistens-ove...
[ "def", "get_db_mutations", "(", "mut_db_path", ",", "gene_list", ",", "res_stop_codons", ")", ":", "# Open resistens-overview.txt", "try", ":", "drugfile", "=", "open", "(", "mut_db_path", ",", "\"r\"", ")", "except", ":", "sys", ".", "exit", "(", "\"Wrong path:...
This function opens the file resistenss-overview.txt, and reads the content into a dict of dicts. The dict will contain information about all known mutations given in the database. This dict is returned.
[ "This", "function", "opens", "the", "file", "resistenss", "-", "overview", ".", "txt", "and", "reads", "the", "content", "into", "a", "dict", "of", "dicts", ".", "The", "dict", "will", "contain", "information", "about", "all", "known", "mutations", "given", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L25-L128
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
KMA
def KMA(inputfile_1, gene_list, kma_db, out_path, sample_name, min_cov, mapping_path): """ This function is called when KMA is the method of choice. The function calls kma externally and waits for it to finish. The kma output files with the prefixes .res and .aln are parsed throught to obtain the...
python
def KMA(inputfile_1, gene_list, kma_db, out_path, sample_name, min_cov, mapping_path): """ This function is called when KMA is the method of choice. The function calls kma externally and waits for it to finish. The kma output files with the prefixes .res and .aln are parsed throught to obtain the...
[ "def", "KMA", "(", "inputfile_1", ",", "gene_list", ",", "kma_db", ",", "out_path", ",", "sample_name", ",", "min_cov", ",", "mapping_path", ")", ":", "# Get full path to input of output files", "inputfile_1", "=", "os", ".", "path", ".", "abspath", "(", "inputf...
This function is called when KMA is the method of choice. The function calls kma externally and waits for it to finish. The kma output files with the prefixes .res and .aln are parsed throught to obtain the required alignment informations. The subject and query sequences as well as the start and sto...
[ "This", "function", "is", "called", "when", "KMA", "is", "the", "method", "of", "choice", ".", "The", "function", "calls", "kma", "externally", "and", "waits", "for", "it", "to", "finish", ".", "The", "kma", "output", "files", "with", "the", "prefixes", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L130-L250
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
find_best_sequence
def find_best_sequence(hits_found, specie_path, gene, silent_N_flag): """ This function takes the list hits_found as argument. This contains all hits found for the blast search of one gene. A hit includes the subjct sequence, the query, and the start and stop position of the allignment correspond...
python
def find_best_sequence(hits_found, specie_path, gene, silent_N_flag): """ This function takes the list hits_found as argument. This contains all hits found for the blast search of one gene. A hit includes the subjct sequence, the query, and the start and stop position of the allignment correspond...
[ "def", "find_best_sequence", "(", "hits_found", ",", "specie_path", ",", "gene", ",", "silent_N_flag", ")", ":", "# Get information from the fisrt hit found\t", "all_start", "=", "hits_found", "[", "0", "]", "[", "0", "]", "current_end", "=", "hits_found", "[", "0...
This function takes the list hits_found as argument. This contains all hits found for the blast search of one gene. A hit includes the subjct sequence, the query, and the start and stop position of the allignment corresponding to the subject sequence. This function finds the best hit by concatinatin...
[ "This", "function", "takes", "the", "list", "hits_found", "as", "argument", ".", "This", "contains", "all", "hits", "found", "for", "the", "blast", "search", "of", "one", "gene", ".", "A", "hit", "includes", "the", "subjct", "sequence", "the", "query", "an...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L252-L367
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
find_mismatches
def find_mismatches(gene, sbjct_start, sbjct_seq, qry_seq, alternative_overlaps = []): """ This function finds mis matches between two sequeces. Depending on the the sequence type either the function find_codon_mismatches or find_nucleotid_mismatches are called, if the sequences contains both a pr...
python
def find_mismatches(gene, sbjct_start, sbjct_seq, qry_seq, alternative_overlaps = []): """ This function finds mis matches between two sequeces. Depending on the the sequence type either the function find_codon_mismatches or find_nucleotid_mismatches are called, if the sequences contains both a pr...
[ "def", "find_mismatches", "(", "gene", ",", "sbjct_start", ",", "sbjct_seq", ",", "qry_seq", ",", "alternative_overlaps", "=", "[", "]", ")", ":", "# Initiate the mis_matches list that will store all found mis matcehs", "mis_matches", "=", "[", "]", "# Find mis matches in...
This function finds mis matches between two sequeces. Depending on the the sequence type either the function find_codon_mismatches or find_nucleotid_mismatches are called, if the sequences contains both a promoter and a coding region both functions are called. The function can also call it self if al...
[ "This", "function", "finds", "mis", "matches", "between", "two", "sequeces", ".", "Depending", "on", "the", "the", "sequence", "type", "either", "the", "function", "find_codon_mismatches", "or", "find_nucleotid_mismatches", "are", "called", "if", "the", "sequences",...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L370-L455
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
find_nucleotid_mismatches
def find_nucleotid_mismatches(sbjct_start, sbjct_seq, qry_seq, promoter = False): """ This function takes two alligned sequence (subject and query), and the position on the subject where the alignment starts. The sequences are compared one nucleotide at a time. If mis matches are found they are ...
python
def find_nucleotid_mismatches(sbjct_start, sbjct_seq, qry_seq, promoter = False): """ This function takes two alligned sequence (subject and query), and the position on the subject where the alignment starts. The sequences are compared one nucleotide at a time. If mis matches are found they are ...
[ "def", "find_nucleotid_mismatches", "(", "sbjct_start", ",", "sbjct_seq", ",", "qry_seq", ",", "promoter", "=", "False", ")", ":", "# Initiate the mis_matches list that will store all found mis matcehs", "mis_matches", "=", "[", "]", "sbjct_start", "=", "abs", "(", "sbj...
This function takes two alligned sequence (subject and query), and the position on the subject where the alignment starts. The sequences are compared one nucleotide at a time. If mis matches are found they are saved. If a gap is found the function find_nuc_indel is called to find the entire indel and...
[ "This", "function", "takes", "two", "alligned", "sequence", "(", "subject", "and", "query", ")", "and", "the", "position", "on", "the", "subject", "where", "the", "alignment", "starts", ".", "The", "sequences", "are", "compared", "one", "nucleotide", "at", "...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L458-L549
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
find_nuc_indel
def find_nuc_indel(gapped_seq, indel_seq): """ This function finds the entire indel missing in from a gapped sequence compared to the indel_seqeunce. It is assumes that the sequences start with the first position of the gap. """ ref_indel = indel_seq[0] for j in range(1,len(gapped_seq)): ...
python
def find_nuc_indel(gapped_seq, indel_seq): """ This function finds the entire indel missing in from a gapped sequence compared to the indel_seqeunce. It is assumes that the sequences start with the first position of the gap. """ ref_indel = indel_seq[0] for j in range(1,len(gapped_seq)): ...
[ "def", "find_nuc_indel", "(", "gapped_seq", ",", "indel_seq", ")", ":", "ref_indel", "=", "indel_seq", "[", "0", "]", "for", "j", "in", "range", "(", "1", ",", "len", "(", "gapped_seq", ")", ")", ":", "if", "gapped_seq", "[", "j", "]", "==", "\"-\"",...
This function finds the entire indel missing in from a gapped sequence compared to the indel_seqeunce. It is assumes that the sequences start with the first position of the gap.
[ "This", "function", "finds", "the", "entire", "indel", "missing", "in", "from", "a", "gapped", "sequence", "compared", "to", "the", "indel_seqeunce", ".", "It", "is", "assumes", "that", "the", "sequences", "start", "with", "the", "first", "position", "of", "...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L552-L564
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
aa
def aa(codon): """ This function converts a codon to an amino acid. If the codon is not valid an error message is given, or else, the amino acid is returned. """ codon = codon.upper() aa = {"ATT": "I", "ATC": "I", "ATA": "I", "CTT": "L", "CTC": "L", "CTA": "L", "CTG": "L", "TTA": "L...
python
def aa(codon): """ This function converts a codon to an amino acid. If the codon is not valid an error message is given, or else, the amino acid is returned. """ codon = codon.upper() aa = {"ATT": "I", "ATC": "I", "ATA": "I", "CTT": "L", "CTC": "L", "CTA": "L", "CTG": "L", "TTA": "L...
[ "def", "aa", "(", "codon", ")", ":", "codon", "=", "codon", ".", "upper", "(", ")", "aa", "=", "{", "\"ATT\"", ":", "\"I\"", ",", "\"ATC\"", ":", "\"I\"", ",", "\"ATA\"", ":", "\"I\"", ",", "\"CTT\"", ":", "\"L\"", ",", "\"CTC\"", ":", "\"L\"", "...
This function converts a codon to an amino acid. If the codon is not valid an error message is given, or else, the amino acid is returned.
[ "This", "function", "converts", "a", "codon", "to", "an", "amino", "acid", ".", "If", "the", "codon", "is", "not", "valid", "an", "error", "message", "is", "given", "or", "else", "the", "amino", "acid", "is", "returned", "." ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L567-L600
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
get_codon
def get_codon(seq, codon_no, start_offset): """ This function takes a sequece and a codon number and returns the codon found in the sequence at that position """ seq = seq.replace("-","") codon_start_pos = int(codon_no - 1)*3 - start_offset codon = seq[codon_start_pos:codon_start_pos + 3] ...
python
def get_codon(seq, codon_no, start_offset): """ This function takes a sequece and a codon number and returns the codon found in the sequence at that position """ seq = seq.replace("-","") codon_start_pos = int(codon_no - 1)*3 - start_offset codon = seq[codon_start_pos:codon_start_pos + 3] ...
[ "def", "get_codon", "(", "seq", ",", "codon_no", ",", "start_offset", ")", ":", "seq", "=", "seq", ".", "replace", "(", "\"-\"", ",", "\"\"", ")", "codon_start_pos", "=", "int", "(", "codon_no", "-", "1", ")", "*", "3", "-", "start_offset", "codon", ...
This function takes a sequece and a codon number and returns the codon found in the sequence at that position
[ "This", "function", "takes", "a", "sequece", "and", "a", "codon", "number", "and", "returns", "the", "codon", "found", "in", "the", "sequence", "at", "that", "position" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L603-L611
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
name_insertion
def name_insertion(sbjct_seq, codon_no, sbjct_nucs, aa_alt, start_offset): """ This function is used to name a insertion mutation based on the HGVS recommendation. """ start_codon_no = codon_no - 1 if len(sbjct_nucs) == 3: start_codon_no = codon_no start_codon = get_codon(sbjct_seq...
python
def name_insertion(sbjct_seq, codon_no, sbjct_nucs, aa_alt, start_offset): """ This function is used to name a insertion mutation based on the HGVS recommendation. """ start_codon_no = codon_no - 1 if len(sbjct_nucs) == 3: start_codon_no = codon_no start_codon = get_codon(sbjct_seq...
[ "def", "name_insertion", "(", "sbjct_seq", ",", "codon_no", ",", "sbjct_nucs", ",", "aa_alt", ",", "start_offset", ")", ":", "start_codon_no", "=", "codon_no", "-", "1", "if", "len", "(", "sbjct_nucs", ")", "==", "3", ":", "start_codon_no", "=", "codon_no", ...
This function is used to name a insertion mutation based on the HGVS recommendation.
[ "This", "function", "is", "used", "to", "name", "a", "insertion", "mutation", "based", "on", "the", "HGVS", "recommendation", "." ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L614-L625
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
name_indel_mutation
def name_indel_mutation(sbjct_seq, indel, sbjct_rf_indel, qry_rf_indel, codon_no, mut, start_offset): """ This function serves to name the individual mutations dependently on the type of the mutation. """ # Get the subject and query sequences without gaps sbjct_nucs = sbjct_rf_indel.replace("-"...
python
def name_indel_mutation(sbjct_seq, indel, sbjct_rf_indel, qry_rf_indel, codon_no, mut, start_offset): """ This function serves to name the individual mutations dependently on the type of the mutation. """ # Get the subject and query sequences without gaps sbjct_nucs = sbjct_rf_indel.replace("-"...
[ "def", "name_indel_mutation", "(", "sbjct_seq", ",", "indel", ",", "sbjct_rf_indel", ",", "qry_rf_indel", ",", "codon_no", ",", "mut", ",", "start_offset", ")", ":", "# Get the subject and query sequences without gaps", "sbjct_nucs", "=", "sbjct_rf_indel", ".", "replace...
This function serves to name the individual mutations dependently on the type of the mutation.
[ "This", "function", "serves", "to", "name", "the", "individual", "mutations", "dependently", "on", "the", "type", "of", "the", "mutation", "." ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L643-L696
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
get_inframe_gap
def get_inframe_gap(seq, nucs_needed = 3): """ This funtion takes a sequnece starting with a gap or the complementary seqeuence to the gap, and the number of nucleotides that the seqeunce should contain in order to maintain the correct reading frame. The sequence is gone through and the number of ...
python
def get_inframe_gap(seq, nucs_needed = 3): """ This funtion takes a sequnece starting with a gap or the complementary seqeuence to the gap, and the number of nucleotides that the seqeunce should contain in order to maintain the correct reading frame. The sequence is gone through and the number of ...
[ "def", "get_inframe_gap", "(", "seq", ",", "nucs_needed", "=", "3", ")", ":", "nuc_count", "=", "0", "gap_indel", "=", "\"\"", "nucs", "=", "\"\"", "for", "i", "in", "range", "(", "len", "(", "seq", ")", ")", ":", "# Check if the character is not a gap", ...
This funtion takes a sequnece starting with a gap or the complementary seqeuence to the gap, and the number of nucleotides that the seqeunce should contain in order to maintain the correct reading frame. The sequence is gone through and the number of non-gap characters are counted. When the number ha...
[ "This", "funtion", "takes", "a", "sequnece", "starting", "with", "a", "gap", "or", "the", "complementary", "seqeuence", "to", "the", "gap", "and", "the", "number", "of", "nucleotides", "that", "the", "seqeunce", "should", "contain", "in", "order", "to", "mai...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L699-L730
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
get_indels
def get_indels(sbjct_seq, qry_seq, start_pos): """ This function uses regex to find inserts and deletions in sequences given as arguments. A list of these indels are returned. The list includes, type of mutations(ins/del), subject codon no of found mutation, subject sequence position, insert/delet...
python
def get_indels(sbjct_seq, qry_seq, start_pos): """ This function uses regex to find inserts and deletions in sequences given as arguments. A list of these indels are returned. The list includes, type of mutations(ins/del), subject codon no of found mutation, subject sequence position, insert/delet...
[ "def", "get_indels", "(", "sbjct_seq", ",", "qry_seq", ",", "start_pos", ")", ":", "seqs", "=", "[", "sbjct_seq", ",", "qry_seq", "]", "indels", "=", "[", "]", "gap_obj", "=", "re", ".", "compile", "(", "r\"-+\"", ")", "for", "i", "in", "range", "(",...
This function uses regex to find inserts and deletions in sequences given as arguments. A list of these indels are returned. The list includes, type of mutations(ins/del), subject codon no of found mutation, subject sequence position, insert/deletions nucleotide sequence, and the affected qry codon n...
[ "This", "function", "uses", "regex", "to", "find", "inserts", "and", "deletions", "in", "sequences", "given", "as", "arguments", ".", "A", "list", "of", "these", "indels", "are", "returned", ".", "The", "list", "includes", "type", "of", "mutations", "(", "...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L733-L770
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
find_codon_mismatches
def find_codon_mismatches(sbjct_start, sbjct_seq, qry_seq): """ This function takes two alligned sequence (subject and query), and the position on the subject where the alignment starts. The sequences are compared codon by codon. If a mis matches is found it is saved in 'mis_matches'. If a gap is ...
python
def find_codon_mismatches(sbjct_start, sbjct_seq, qry_seq): """ This function takes two alligned sequence (subject and query), and the position on the subject where the alignment starts. The sequences are compared codon by codon. If a mis matches is found it is saved in 'mis_matches'. If a gap is ...
[ "def", "find_codon_mismatches", "(", "sbjct_start", ",", "sbjct_seq", ",", "qry_seq", ")", ":", "mis_matches", "=", "[", "]", "# Find start pos of first codon in frame, i_start", "codon_offset", "=", "(", "sbjct_start", "-", "1", ")", "%", "3", "i_start", "=", "0"...
This function takes two alligned sequence (subject and query), and the position on the subject where the alignment starts. The sequences are compared codon by codon. If a mis matches is found it is saved in 'mis_matches'. If a gap is found the function get_inframe_gap is used to find the indel sequen...
[ "This", "function", "takes", "two", "alligned", "sequence", "(", "subject", "and", "query", ")", "and", "the", "position", "on", "the", "subject", "where", "the", "alignment", "starts", ".", "The", "sequences", "are", "compared", "codon", "by", "codon", ".",...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L773-L931
train
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
write_output
def write_output(gene, gene_name, mis_matches, known_mutations, known_stop_codon, unknown_flag, GENES): """ This function takes a gene name a list of mis matches found betreewn subject and query of this gene, the dictionary of known mutation in the point finder database, and the flag telling weather th...
python
def write_output(gene, gene_name, mis_matches, known_mutations, known_stop_codon, unknown_flag, GENES): """ This function takes a gene name a list of mis matches found betreewn subject and query of this gene, the dictionary of known mutation in the point finder database, and the flag telling weather th...
[ "def", "write_output", "(", "gene", ",", "gene_name", ",", "mis_matches", ",", "known_mutations", ",", "known_stop_codon", ",", "unknown_flag", ",", "GENES", ")", ":", "RNA", "=", "False", "known_header", "=", "\"Mutation\\tNucleotide change\\tAmino acid change\\tResist...
This function takes a gene name a list of mis matches found betreewn subject and query of this gene, the dictionary of known mutation in the point finder database, and the flag telling weather the user wants unknown mutations to be reported. All mis matches are looked up in the known mutation dict to se if...
[ "This", "function", "takes", "a", "gene", "name", "a", "list", "of", "mis", "matches", "found", "betreewn", "subject", "and", "query", "of", "this", "gene", "the", "dictionary", "of", "known", "mutation", "in", "the", "point", "finder", "database", "and", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L933-L1046
train
pymacaron/pymacaron-core
pymacaron_core/swagger/apipool.py
ApiPool.merge
def merge(self): """Try merging all the bravado_core models across all loaded APIs. If duplicates occur, use the same bravado-core model to represent each, so bravado-core won't treat them as different models when passing them from one PyMacaron client stub to an other or when returning ...
python
def merge(self): """Try merging all the bravado_core models across all loaded APIs. If duplicates occur, use the same bravado-core model to represent each, so bravado-core won't treat them as different models when passing them from one PyMacaron client stub to an other or when returning ...
[ "def", "merge", "(", "self", ")", ":", "# The sole purpose of this method is to trick isinstance to return true", "# on model_values of the same kind but different apis/specs at:", "# https://github.com/Yelp/bravado-core/blob/4840a6e374611bb917226157b5948ee263913abc/bravado_core/marshal.py#L160", ...
Try merging all the bravado_core models across all loaded APIs. If duplicates occur, use the same bravado-core model to represent each, so bravado-core won't treat them as different models when passing them from one PyMacaron client stub to an other or when returning them via the PyMacar...
[ "Try", "merging", "all", "the", "bravado_core", "models", "across", "all", "loaded", "APIs", ".", "If", "duplicates", "occur", "use", "the", "same", "bravado", "-", "core", "model", "to", "represent", "each", "so", "bravado", "-", "core", "won", "t", "trea...
95070a39ed7065a84244ff5601fea4d54cc72b66
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/apipool.py#L65-L102
train
pymacaron/pymacaron-core
pymacaron_core/swagger/apipool.py
ApiPool._cmp_models
def _cmp_models(self, m1, m2): """Compare two models from different swagger APIs and tell if they are equal (return 0), or not (return != 0)""" # Don't alter m1/m2 by mistake m1 = copy.deepcopy(m1) m2 = copy.deepcopy(m2) # Remove keys added by bravado-core def _...
python
def _cmp_models(self, m1, m2): """Compare two models from different swagger APIs and tell if they are equal (return 0), or not (return != 0)""" # Don't alter m1/m2 by mistake m1 = copy.deepcopy(m1) m2 = copy.deepcopy(m2) # Remove keys added by bravado-core def _...
[ "def", "_cmp_models", "(", "self", ",", "m1", ",", "m2", ")", ":", "# Don't alter m1/m2 by mistake", "m1", "=", "copy", ".", "deepcopy", "(", "m1", ")", "m2", "=", "copy", ".", "deepcopy", "(", "m2", ")", "# Remove keys added by bravado-core", "def", "_clean...
Compare two models from different swagger APIs and tell if they are equal (return 0), or not (return != 0)
[ "Compare", "two", "models", "from", "different", "swagger", "APIs", "and", "tell", "if", "they", "are", "equal", "(", "return", "0", ")", "or", "not", "(", "return", "!", "=", "0", ")" ]
95070a39ed7065a84244ff5601fea4d54cc72b66
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/apipool.py#L105-L128
train
saltant-org/saltant-py
saltant/models/base_task_type.py
BaseTaskType.sync
def sync(self): """Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.base_task_type.BaseTaskType`: This task type instance after...
python
def sync(self): """Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.base_task_type.BaseTaskType`: This task type instance after...
[ "def", "sync", "(", "self", ")", ":", "self", "=", "self", ".", "manager", ".", "get", "(", "id", "=", "self", ".", "id", ")", "return", "self" ]
Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.base_task_type.BaseTaskType`: This task type instance after syncing.
[ "Sync", "this", "model", "with", "latest", "data", "on", "the", "saltant", "server", "." ]
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_type.py#L82-L94
train
saltant-org/saltant-py
saltant/models/base_task_type.py
BaseTaskTypeManager.create
def create( self, name, command_to_run, description="", environment_variables=None, required_arguments=None, required_arguments_default_values=None, extra_data_to_post=None, ): """Create a task type. Args: name (str): The n...
python
def create( self, name, command_to_run, description="", environment_variables=None, required_arguments=None, required_arguments_default_values=None, extra_data_to_post=None, ): """Create a task type. Args: name (str): The n...
[ "def", "create", "(", "self", ",", "name", ",", "command_to_run", ",", "description", "=", "\"\"", ",", "environment_variables", "=", "None", ",", "required_arguments", "=", "None", ",", "required_arguments_default_values", "=", "None", ",", "extra_data_to_post", ...
Create a task type. Args: name (str): The name of the task. command_to_run (str): The command to run to execute the task. description (str, optional): The description of the task type. environment_variables (list, optional): The environment variab...
[ "Create", "a", "task", "type", "." ]
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_type.py#L160-L229
train
saltant-org/saltant-py
saltant/models/base_task_type.py
BaseTaskTypeManager.put
def put( self, id, name, description, command_to_run, environment_variables, required_arguments, required_arguments_default_values, extra_data_to_put=None, ): """Updates a task type on the saltant server. Args: id (...
python
def put( self, id, name, description, command_to_run, environment_variables, required_arguments, required_arguments_default_values, extra_data_to_put=None, ): """Updates a task type on the saltant server. Args: id (...
[ "def", "put", "(", "self", ",", "id", ",", "name", ",", "description", ",", "command_to_run", ",", "environment_variables", ",", "required_arguments", ",", "required_arguments_default_values", ",", "extra_data_to_put", "=", "None", ",", ")", ":", "# Update the objec...
Updates a task type on the saltant server. Args: id (int): The ID of the task type. name (str): The name of the task type. description (str): The description of the task type. command_to_run (str): The command to run to execute the task. environment_v...
[ "Updates", "a", "task", "type", "on", "the", "saltant", "server", "." ]
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_type.py#L231-L292
train
saltant-org/saltant-py
saltant/models/base_task_type.py
BaseTaskTypeManager.response_data_to_model_instance
def response_data_to_model_instance(self, response_data): """Convert response data to a task type model. Args: response_data (dict): The data from the request's response. Returns: :class:`saltant.models.base_task_type.BaseTaskType`: A model instance repr...
python
def response_data_to_model_instance(self, response_data): """Convert response data to a task type model. Args: response_data (dict): The data from the request's response. Returns: :class:`saltant.models.base_task_type.BaseTaskType`: A model instance repr...
[ "def", "response_data_to_model_instance", "(", "self", ",", "response_data", ")", ":", "# Coerce datetime strings into datetime objects", "response_data", "[", "\"datetime_created\"", "]", "=", "dateutil", ".", "parser", ".", "parse", "(", "response_data", "[", "\"datetim...
Convert response data to a task type model. Args: response_data (dict): The data from the request's response. Returns: :class:`saltant.models.base_task_type.BaseTaskType`: A model instance representing the task type from the reponse data.
[ "Convert", "response", "data", "to", "a", "task", "type", "model", "." ]
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_type.py#L294-L313
train
crdoconnor/pathquery
hitch/key.py
regression
def regression(): """ Run regression testing - lint and then run all tests. """ # HACK: Start using hitchbuildpy to get around this. Command("touch", DIR.project.joinpath("pathquery", "__init__.py").abspath()).run() storybook = _storybook({}).only_uninherited() #storybook.with_params(**{"pyt...
python
def regression(): """ Run regression testing - lint and then run all tests. """ # HACK: Start using hitchbuildpy to get around this. Command("touch", DIR.project.joinpath("pathquery", "__init__.py").abspath()).run() storybook = _storybook({}).only_uninherited() #storybook.with_params(**{"pyt...
[ "def", "regression", "(", ")", ":", "# HACK: Start using hitchbuildpy to get around this.", "Command", "(", "\"touch\"", ",", "DIR", ".", "project", ".", "joinpath", "(", "\"pathquery\"", ",", "\"__init__.py\"", ")", ".", "abspath", "(", ")", ")", ".", "run", "(...
Run regression testing - lint and then run all tests.
[ "Run", "regression", "testing", "-", "lint", "and", "then", "run", "all", "tests", "." ]
4905fef27fc666ea4511eb0eee5098f754bb52ed
https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/hitch/key.py#L291-L302
train
crdoconnor/pathquery
hitch/key.py
deploy
def deploy(version): """ Deploy to pypi as specified version. """ NAME = "pathquery" git = Command("git").in_dir(DIR.project) version_file = DIR.project.joinpath("VERSION") old_version = version_file.bytes().decode('utf8') if version_file.bytes().decode("utf8") != version: DIR.pr...
python
def deploy(version): """ Deploy to pypi as specified version. """ NAME = "pathquery" git = Command("git").in_dir(DIR.project) version_file = DIR.project.joinpath("VERSION") old_version = version_file.bytes().decode('utf8') if version_file.bytes().decode("utf8") != version: DIR.pr...
[ "def", "deploy", "(", "version", ")", ":", "NAME", "=", "\"pathquery\"", "git", "=", "Command", "(", "\"git\"", ")", ".", "in_dir", "(", "DIR", ".", "project", ")", "version_file", "=", "DIR", ".", "project", ".", "joinpath", "(", "\"VERSION\"", ")", "...
Deploy to pypi as specified version.
[ "Deploy", "to", "pypi", "as", "specified", "version", "." ]
4905fef27fc666ea4511eb0eee5098f754bb52ed
https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/hitch/key.py#L308-L341
train
crdoconnor/pathquery
hitch/key.py
hvenvup
def hvenvup(package, directory): """ Install a new version of a package in the hitch venv. """ pip = Command(DIR.gen.joinpath("hvenv", "bin", "pip")) pip("uninstall", package, "-y").run() pip("install", DIR.project.joinpath(directory).abspath()).run()
python
def hvenvup(package, directory): """ Install a new version of a package in the hitch venv. """ pip = Command(DIR.gen.joinpath("hvenv", "bin", "pip")) pip("uninstall", package, "-y").run() pip("install", DIR.project.joinpath(directory).abspath()).run()
[ "def", "hvenvup", "(", "package", ",", "directory", ")", ":", "pip", "=", "Command", "(", "DIR", ".", "gen", ".", "joinpath", "(", "\"hvenv\"", ",", "\"bin\"", ",", "\"pip\"", ")", ")", "pip", "(", "\"uninstall\"", ",", "package", ",", "\"-y\"", ")", ...
Install a new version of a package in the hitch venv.
[ "Install", "a", "new", "version", "of", "a", "package", "in", "the", "hitch", "venv", "." ]
4905fef27fc666ea4511eb0eee5098f754bb52ed
https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/hitch/key.py#L352-L358
train
crdoconnor/pathquery
hitch/key.py
Engine.set_up
def set_up(self): """Set up your applications and the test environment.""" self.path.state = self.path.gen.joinpath("state") if self.path.state.exists(): self.path.state.rmtree(ignore_errors=True) self.path.state.mkdir() if self.path.gen.joinpath("q").exists(): ...
python
def set_up(self): """Set up your applications and the test environment.""" self.path.state = self.path.gen.joinpath("state") if self.path.state.exists(): self.path.state.rmtree(ignore_errors=True) self.path.state.mkdir() if self.path.gen.joinpath("q").exists(): ...
[ "def", "set_up", "(", "self", ")", ":", "self", ".", "path", ".", "state", "=", "self", ".", "path", ".", "gen", ".", "joinpath", "(", "\"state\"", ")", "if", "self", ".", "path", ".", "state", ".", "exists", "(", ")", ":", "self", ".", "path", ...
Set up your applications and the test environment.
[ "Set", "up", "your", "applications", "and", "the", "test", "environment", "." ]
4905fef27fc666ea4511eb0eee5098f754bb52ed
https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/hitch/key.py#L38-L86
train
beczkowb/csvparser
csvparser/parser.py
Parser.is_valid
def is_valid(self): """ Validates single instance. Returns boolean value and store errors in self.errors """ self.errors = [] for field in self.get_all_field_names_declared_by_user(): getattr(type(self), field).is_valid(self, type(self), field) field_erro...
python
def is_valid(self): """ Validates single instance. Returns boolean value and store errors in self.errors """ self.errors = [] for field in self.get_all_field_names_declared_by_user(): getattr(type(self), field).is_valid(self, type(self), field) field_erro...
[ "def", "is_valid", "(", "self", ")", ":", "self", ".", "errors", "=", "[", "]", "for", "field", "in", "self", ".", "get_all_field_names_declared_by_user", "(", ")", ":", "getattr", "(", "type", "(", "self", ")", ",", "field", ")", ".", "is_valid", "(",...
Validates single instance. Returns boolean value and store errors in self.errors
[ "Validates", "single", "instance", ".", "Returns", "boolean", "value", "and", "store", "errors", "in", "self", ".", "errors" ]
f9f9bd37e10e3c1c223d559194367b25900a822a
https://github.com/beczkowb/csvparser/blob/f9f9bd37e10e3c1c223d559194367b25900a822a/csvparser/parser.py#L41-L52
train
OLC-Bioinformatics/sipprverse
method.py
Method.main
def main(self): """ Run the analyses using the inputted values for forward and reverse read length. However, if not all strains pass the quality thresholds, continue to periodically run the analyses on these incomplete strains until either all strains are complete, or the sequencing run ...
python
def main(self): """ Run the analyses using the inputted values for forward and reverse read length. However, if not all strains pass the quality thresholds, continue to periodically run the analyses on these incomplete strains until either all strains are complete, or the sequencing run ...
[ "def", "main", "(", "self", ")", ":", "logging", ".", "info", "(", "'Starting {} analysis pipeline'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "self", ".", "createobjects", "(", ")", "# Run the genesipping analyses", "self", ".", "methods", "...
Run the analyses using the inputted values for forward and reverse read length. However, if not all strains pass the quality thresholds, continue to periodically run the analyses on these incomplete strains until either all strains are complete, or the sequencing run is finished
[ "Run", "the", "analyses", "using", "the", "inputted", "values", "for", "forward", "and", "reverse", "read", "length", ".", "However", "if", "not", "all", "strains", "pass", "the", "quality", "thresholds", "continue", "to", "periodically", "run", "the", "analys...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L25-L44
train
OLC-Bioinformatics/sipprverse
method.py
Method.methods
def methods(self): """ Run the typing methods """ self.contamination_detection() ReportImage(self, 'confindr') self.run_genesippr() ReportImage(self, 'genesippr') self.run_sixteens() self.run_mash() self.run_gdcs() ReportImage(self,...
python
def methods(self): """ Run the typing methods """ self.contamination_detection() ReportImage(self, 'confindr') self.run_genesippr() ReportImage(self, 'genesippr') self.run_sixteens() self.run_mash() self.run_gdcs() ReportImage(self,...
[ "def", "methods", "(", "self", ")", ":", "self", ".", "contamination_detection", "(", ")", "ReportImage", "(", "self", ",", "'confindr'", ")", "self", ".", "run_genesippr", "(", ")", "ReportImage", "(", "self", ",", "'genesippr'", ")", "self", ".", "run_si...
Run the typing methods
[ "Run", "the", "typing", "methods" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L169-L180
train
OLC-Bioinformatics/sipprverse
method.py
Method.contamination_detection
def contamination_detection(self): """ Calculate the levels of contamination in the reads """ self.qualityobject = quality.Quality(self) self.qualityobject.contamination_finder(input_path=self.sequencepath, report_path=self.reportpa...
python
def contamination_detection(self): """ Calculate the levels of contamination in the reads """ self.qualityobject = quality.Quality(self) self.qualityobject.contamination_finder(input_path=self.sequencepath, report_path=self.reportpa...
[ "def", "contamination_detection", "(", "self", ")", ":", "self", ".", "qualityobject", "=", "quality", ".", "Quality", "(", "self", ")", "self", ".", "qualityobject", ".", "contamination_finder", "(", "input_path", "=", "self", ".", "sequencepath", ",", "repor...
Calculate the levels of contamination in the reads
[ "Calculate", "the", "levels", "of", "contamination", "in", "the", "reads" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L182-L188
train
OLC-Bioinformatics/sipprverse
method.py
Method.run_genesippr
def run_genesippr(self): """ Run the genesippr analyses """ GeneSippr(args=self, pipelinecommit=self.commit, startingtime=self.starttime, scriptpath=self.homepath, analysistype='genesippr', cutoff=0...
python
def run_genesippr(self): """ Run the genesippr analyses """ GeneSippr(args=self, pipelinecommit=self.commit, startingtime=self.starttime, scriptpath=self.homepath, analysistype='genesippr', cutoff=0...
[ "def", "run_genesippr", "(", "self", ")", ":", "GeneSippr", "(", "args", "=", "self", ",", "pipelinecommit", "=", "self", ".", "commit", ",", "startingtime", "=", "self", ".", "starttime", ",", "scriptpath", "=", "self", ".", "homepath", ",", "analysistype...
Run the genesippr analyses
[ "Run", "the", "genesippr", "analyses" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L190-L201
train
OLC-Bioinformatics/sipprverse
method.py
Method.run_sixteens
def run_sixteens(self): """ Run the 16S analyses using the filtered database """ SixteensFull(args=self, pipelinecommit=self.commit, startingtime=self.starttime, scriptpath=self.homepath, analysistype='si...
python
def run_sixteens(self): """ Run the 16S analyses using the filtered database """ SixteensFull(args=self, pipelinecommit=self.commit, startingtime=self.starttime, scriptpath=self.homepath, analysistype='si...
[ "def", "run_sixteens", "(", "self", ")", ":", "SixteensFull", "(", "args", "=", "self", ",", "pipelinecommit", "=", "self", ".", "commit", ",", "startingtime", "=", "self", ".", "starttime", ",", "scriptpath", "=", "self", ".", "homepath", ",", "analysisty...
Run the 16S analyses using the filtered database
[ "Run", "the", "16S", "analyses", "using", "the", "filtered", "database" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L203-L212
train
OLC-Bioinformatics/sipprverse
method.py
Method.run_mash
def run_mash(self): """ Run MASH to determine the closest refseq genomes """ self.pipeline = True mash.Mash(inputobject=self, analysistype='mash')
python
def run_mash(self): """ Run MASH to determine the closest refseq genomes """ self.pipeline = True mash.Mash(inputobject=self, analysistype='mash')
[ "def", "run_mash", "(", "self", ")", ":", "self", ".", "pipeline", "=", "True", "mash", ".", "Mash", "(", "inputobject", "=", "self", ",", "analysistype", "=", "'mash'", ")" ]
Run MASH to determine the closest refseq genomes
[ "Run", "MASH", "to", "determine", "the", "closest", "refseq", "genomes" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L214-L220
train
OLC-Bioinformatics/sipprverse
method.py
Method.complete
def complete(self): """ Determine if the analyses of the strains are complete e.g. there are no missing GDCS genes, and the sample.general.bestassemblyfile != 'NA' """ # Boolean to store the completeness of the analyses allcomplete = True # Clear the list of samp...
python
def complete(self): """ Determine if the analyses of the strains are complete e.g. there are no missing GDCS genes, and the sample.general.bestassemblyfile != 'NA' """ # Boolean to store the completeness of the analyses allcomplete = True # Clear the list of samp...
[ "def", "complete", "(", "self", ")", ":", "# Boolean to store the completeness of the analyses", "allcomplete", "=", "True", "# Clear the list of samples that still require more sequence data", "self", ".", "incomplete", "=", "list", "(", ")", "for", "sample", "in", "self",...
Determine if the analyses of the strains are complete e.g. there are no missing GDCS genes, and the sample.general.bestassemblyfile != 'NA'
[ "Determine", "if", "the", "analyses", "of", "the", "strains", "are", "complete", "e", ".", "g", ".", "there", "are", "no", "missing", "GDCS", "genes", "and", "the", "sample", ".", "general", ".", "bestassemblyfile", "!", "=", "NA" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L228-L261
train
OnroerendErfgoed/pyramid_urireferencer
pyramid_urireferencer/protected_resources.py
protected_operation
def protected_operation(fn): """ Use this decorator to prevent an operation from being executed when the related uri resource is still in use. The parent_object must contain: * a request * with a registry.queryUtility(IReferencer) :raises pyramid.httpexceptions.HTTPConflict: Sign...
python
def protected_operation(fn): """ Use this decorator to prevent an operation from being executed when the related uri resource is still in use. The parent_object must contain: * a request * with a registry.queryUtility(IReferencer) :raises pyramid.httpexceptions.HTTPConflict: Sign...
[ "def", "protected_operation", "(", "fn", ")", ":", "@", "functools", ".", "wraps", "(", "fn", ")", "def", "advice", "(", "parent_object", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "response", "=", "_advice", "(", "parent_object", ".", "request",...
Use this decorator to prevent an operation from being executed when the related uri resource is still in use. The parent_object must contain: * a request * with a registry.queryUtility(IReferencer) :raises pyramid.httpexceptions.HTTPConflict: Signals that we don't want to delete ...
[ "Use", "this", "decorator", "to", "prevent", "an", "operation", "from", "being", "executed", "when", "the", "related", "uri", "resource", "is", "still", "in", "use", ".", "The", "parent_object", "must", "contain", ":", "*", "a", "request", "*", "with", "a"...
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/protected_resources.py#L83-L103
train
OnroerendErfgoed/pyramid_urireferencer
pyramid_urireferencer/protected_resources.py
protected_operation_with_request
def protected_operation_with_request(fn): """ Use this decorator to prevent an operation from being executed when the related uri resource is still in use. The request must contain a registry.queryUtility(IReferencer) :raises pyramid.httpexceptions.HTTPConflict: Signals that we don't want to ...
python
def protected_operation_with_request(fn): """ Use this decorator to prevent an operation from being executed when the related uri resource is still in use. The request must contain a registry.queryUtility(IReferencer) :raises pyramid.httpexceptions.HTTPConflict: Signals that we don't want to ...
[ "def", "protected_operation_with_request", "(", "fn", ")", ":", "@", "functools", ".", "wraps", "(", "fn", ")", "def", "wrapped", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "_advice", "(", "request", ")", "if"...
Use this decorator to prevent an operation from being executed when the related uri resource is still in use. The request must contain a registry.queryUtility(IReferencer) :raises pyramid.httpexceptions.HTTPConflict: Signals that we don't want to delete a certain URI because it's still in use somewh...
[ "Use", "this", "decorator", "to", "prevent", "an", "operation", "from", "being", "executed", "when", "the", "related", "uri", "resource", "is", "still", "in", "use", ".", "The", "request", "must", "contain", "a", "registry", ".", "queryUtility", "(", "IRefer...
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/protected_resources.py#L106-L125
train
OnroerendErfgoed/pyramid_urireferencer
pyramid_urireferencer/protected_resources.py
protected_view
def protected_view(view, info): """allows adding `protected=True` to a view_config`""" if info.options.get('protected'): def wrapper_view(context, request): response = _advice(request) if response is not None: return response else: ret...
python
def protected_view(view, info): """allows adding `protected=True` to a view_config`""" if info.options.get('protected'): def wrapper_view(context, request): response = _advice(request) if response is not None: return response else: ret...
[ "def", "protected_view", "(", "view", ",", "info", ")", ":", "if", "info", ".", "options", ".", "get", "(", "'protected'", ")", ":", "def", "wrapper_view", "(", "context", ",", "request", ")", ":", "response", "=", "_advice", "(", "request", ")", "if",...
allows adding `protected=True` to a view_config`
[ "allows", "adding", "protected", "=", "True", "to", "a", "view_config" ]
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/protected_resources.py#L128-L139
train
Riffstation/Flask-Philo-SQLAlchemy
flask_philo_sqlalchemy/__init__.py
syncdb
def syncdb(pool=None): """ Create tables if they don't exist """ from flask_philo_sqlalchemy.schema import Base # noqa from flask_philo_sqlalchemy.orm import BaseModel # noqa from flask_philo_sqlalchemy.connection import create_pool if pool is None: pool = create_pool() for c...
python
def syncdb(pool=None): """ Create tables if they don't exist """ from flask_philo_sqlalchemy.schema import Base # noqa from flask_philo_sqlalchemy.orm import BaseModel # noqa from flask_philo_sqlalchemy.connection import create_pool if pool is None: pool = create_pool() for c...
[ "def", "syncdb", "(", "pool", "=", "None", ")", ":", "from", "flask_philo_sqlalchemy", ".", "schema", "import", "Base", "# noqa", "from", "flask_philo_sqlalchemy", ".", "orm", "import", "BaseModel", "# noqa", "from", "flask_philo_sqlalchemy", ".", "connection", "i...
Create tables if they don't exist
[ "Create", "tables", "if", "they", "don", "t", "exist" ]
71598bb603b8458a2cf9f7989f71d8f1c77fafb9
https://github.com/Riffstation/Flask-Philo-SQLAlchemy/blob/71598bb603b8458a2cf9f7989f71d8f1c77fafb9/flask_philo_sqlalchemy/__init__.py#L4-L16
train
mikemelch/hallie
hallie/modules/install.py
checkInstalledPip
def checkInstalledPip(package, speak=True, speakSimilar=True): """checks if a given package is installed on pip""" packages = sorted([i.key for i in pip.get_installed_distributions()]) installed = package in packages similar = None if not installed: similar = [pkg for pkg in packages if pac...
python
def checkInstalledPip(package, speak=True, speakSimilar=True): """checks if a given package is installed on pip""" packages = sorted([i.key for i in pip.get_installed_distributions()]) installed = package in packages similar = None if not installed: similar = [pkg for pkg in packages if pac...
[ "def", "checkInstalledPip", "(", "package", ",", "speak", "=", "True", ",", "speakSimilar", "=", "True", ")", ":", "packages", "=", "sorted", "(", "[", "i", ".", "key", "for", "i", "in", "pip", ".", "get_installed_distributions", "(", ")", "]", ")", "i...
checks if a given package is installed on pip
[ "checks", "if", "a", "given", "package", "is", "installed", "on", "pip" ]
a6dbb691145a85b776a1919e4c7930e0ae598437
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/install.py#L25-L37
train
mikemelch/hallie
hallie/modules/install.py
checkInstalledBrew
def checkInstalledBrew(package, similar=True, speak=True, speakSimilar=True): """checks if a given package is installed on homebrew""" packages = subprocess.check_output(['brew', 'list']).split() installed = package in packages similar = [] if not installed: similar = [pkg for pkg in packag...
python
def checkInstalledBrew(package, similar=True, speak=True, speakSimilar=True): """checks if a given package is installed on homebrew""" packages = subprocess.check_output(['brew', 'list']).split() installed = package in packages similar = [] if not installed: similar = [pkg for pkg in packag...
[ "def", "checkInstalledBrew", "(", "package", ",", "similar", "=", "True", ",", "speak", "=", "True", ",", "speakSimilar", "=", "True", ")", ":", "packages", "=", "subprocess", ".", "check_output", "(", "[", "'brew'", ",", "'list'", "]", ")", ".", "split"...
checks if a given package is installed on homebrew
[ "checks", "if", "a", "given", "package", "is", "installed", "on", "homebrew" ]
a6dbb691145a85b776a1919e4c7930e0ae598437
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/install.py#L40-L51
train
benoitkugler/abstractDataLibrary
pyDLib/Core/sql.py
init_module
def init_module(remote_credences=None,local_path=None): """Connnexion informations : remote_credences for remote acces OR local_path for local access""" if remote_credences is not None: RemoteConnexion.HOST = remote_credences["DB"]["host"] RemoteConnexion.USER = remote_credences["DB"]["user"] ...
python
def init_module(remote_credences=None,local_path=None): """Connnexion informations : remote_credences for remote acces OR local_path for local access""" if remote_credences is not None: RemoteConnexion.HOST = remote_credences["DB"]["host"] RemoteConnexion.USER = remote_credences["DB"]["user"] ...
[ "def", "init_module", "(", "remote_credences", "=", "None", ",", "local_path", "=", "None", ")", ":", "if", "remote_credences", "is", "not", "None", ":", "RemoteConnexion", ".", "HOST", "=", "remote_credences", "[", "\"DB\"", "]", "[", "\"host\"", "]", "Remo...
Connnexion informations : remote_credences for remote acces OR local_path for local access
[ "Connnexion", "informations", ":", "remote_credences", "for", "remote", "acces", "OR", "local_path", "for", "local", "access" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L23-L40
train
benoitkugler/abstractDataLibrary
pyDLib/Core/sql.py
cree_local_DB
def cree_local_DB(scheme): """Create emmpt DB according to the given scheme : dict { table : [ (column_name, column_type), .. ]} Usefull at installation of application (and for developement) """ conn = LocalConnexion() req = "" for table, fields in scheme.items(): req += f"DROP TABLE IF ...
python
def cree_local_DB(scheme): """Create emmpt DB according to the given scheme : dict { table : [ (column_name, column_type), .. ]} Usefull at installation of application (and for developement) """ conn = LocalConnexion() req = "" for table, fields in scheme.items(): req += f"DROP TABLE IF ...
[ "def", "cree_local_DB", "(", "scheme", ")", ":", "conn", "=", "LocalConnexion", "(", ")", "req", "=", "\"\"", "for", "table", ",", "fields", "in", "scheme", ".", "items", "(", ")", ":", "req", "+=", "f\"DROP TABLE IF EXISTS {table};\"", "req_fields", "=", ...
Create emmpt DB according to the given scheme : dict { table : [ (column_name, column_type), .. ]} Usefull at installation of application (and for developement)
[ "Create", "emmpt", "DB", "according", "to", "the", "given", "scheme", ":", "dict", "{", "table", ":", "[", "(", "column_name", "column_type", ")", "..", "]", "}", "Usefull", "at", "installation", "of", "application", "(", "and", "for", "developement", ")" ...
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L209-L223
train
benoitkugler/abstractDataLibrary
pyDLib/Core/sql.py
abstractConnexion.execute
def execute(self, requete_SQL): """Execute one or many requests requete_SQL may be a tuple(requete,args) or a list of such tuples Return the result or a list of results """ try: cursor = self.cursor() if isinstance(requete_SQL,tuple): res =...
python
def execute(self, requete_SQL): """Execute one or many requests requete_SQL may be a tuple(requete,args) or a list of such tuples Return the result or a list of results """ try: cursor = self.cursor() if isinstance(requete_SQL,tuple): res =...
[ "def", "execute", "(", "self", ",", "requete_SQL", ")", ":", "try", ":", "cursor", "=", "self", ".", "cursor", "(", ")", "if", "isinstance", "(", "requete_SQL", ",", "tuple", ")", ":", "res", "=", "self", ".", "_execute_one", "(", "cursor", ",", "*",...
Execute one or many requests requete_SQL may be a tuple(requete,args) or a list of such tuples Return the result or a list of results
[ "Execute", "one", "or", "many", "requests", "requete_SQL", "may", "be", "a", "tuple", "(", "requete", "args", ")", "or", "a", "list", "of", "such", "tuples", "Return", "the", "result", "or", "a", "list", "of", "results" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L117-L138
train
benoitkugler/abstractDataLibrary
pyDLib/Core/sql.py
abstractRequetesSQL.placeholders
def placeholders(cls,dic): """Placeholders for fields names and value binds""" keys = [str(x) for x in dic] entete = ",".join(keys) placeholders = ",".join(cls.named_style.format(x) for x in keys) entete = f"({entete})" placeholders = f"({placeholders})" return en...
python
def placeholders(cls,dic): """Placeholders for fields names and value binds""" keys = [str(x) for x in dic] entete = ",".join(keys) placeholders = ",".join(cls.named_style.format(x) for x in keys) entete = f"({entete})" placeholders = f"({placeholders})" return en...
[ "def", "placeholders", "(", "cls", ",", "dic", ")", ":", "keys", "=", "[", "str", "(", "x", ")", "for", "x", "in", "dic", "]", "entete", "=", "\",\"", ".", "join", "(", "keys", ")", "placeholders", "=", "\",\"", ".", "join", "(", "cls", ".", "n...
Placeholders for fields names and value binds
[ "Placeholders", "for", "fields", "names", "and", "value", "binds" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L244-L251
train
benoitkugler/abstractDataLibrary
pyDLib/Core/sql.py
abstractRequetesSQL.jsonise
def jsonise(dic): """Renvoie un dictionnaire dont les champs dont compatibles avec SQL Utilise Json. Attention à None : il faut laisser None et non pas null""" d = {} for k, v in dic.items(): if type(v) in abstractRequetesSQL.TYPES_PERMIS: d[k] = v ...
python
def jsonise(dic): """Renvoie un dictionnaire dont les champs dont compatibles avec SQL Utilise Json. Attention à None : il faut laisser None et non pas null""" d = {} for k, v in dic.items(): if type(v) in abstractRequetesSQL.TYPES_PERMIS: d[k] = v ...
[ "def", "jsonise", "(", "dic", ")", ":", "d", "=", "{", "}", "for", "k", ",", "v", "in", "dic", ".", "items", "(", ")", ":", "if", "type", "(", "v", ")", "in", "abstractRequetesSQL", ".", "TYPES_PERMIS", ":", "d", "[", "k", "]", "=", "v", "els...
Renvoie un dictionnaire dont les champs dont compatibles avec SQL Utilise Json. Attention à None : il faut laisser None et non pas null
[ "Renvoie", "un", "dictionnaire", "dont", "les", "champs", "dont", "compatibles", "avec", "SQL", "Utilise", "Json", ".", "Attention", "à", "None", ":", "il", "faut", "laisser", "None", "et", "non", "pas", "null" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L259-L272
train
benoitkugler/abstractDataLibrary
pyDLib/Core/sql.py
abstractRequetesSQL.insert
def insert(table, datas, avoid_conflict=False): """ Insert row from datas :param table: Safe table name :param datas: List of dicts. :param avoid_conflict: Allows ignoring error if already exists (do nothing then) :return: """ if avoid_conflict: debut...
python
def insert(table, datas, avoid_conflict=False): """ Insert row from datas :param table: Safe table name :param datas: List of dicts. :param avoid_conflict: Allows ignoring error if already exists (do nothing then) :return: """ if avoid_conflict: debut...
[ "def", "insert", "(", "table", ",", "datas", ",", "avoid_conflict", "=", "False", ")", ":", "if", "avoid_conflict", ":", "debut", "=", "\"\"\"INSERT INTO {table} {ENTETE_INSERT} VALUES {BIND_INSERT} ON CONFLICT DO NOTHING\"\"\"", "else", ":", "debut", "=", "\"\"\"INSERT I...
Insert row from datas :param table: Safe table name :param datas: List of dicts. :param avoid_conflict: Allows ignoring error if already exists (do nothing then) :return:
[ "Insert", "row", "from", "datas" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L287-L300
train
benoitkugler/abstractDataLibrary
pyDLib/Core/sql.py
abstractRequetesSQL.update
def update(cls,table, dic, Id): """ Update row with Id from table. Set fields given by dic.""" if dic: req = "UPDATE {table} SET {SET} WHERE id = " + cls.named_style.format('__id') + " RETURNING * " r = abstractRequetesSQL.formate(req, SET=dic, table=table, args=dict(dic, __id=I...
python
def update(cls,table, dic, Id): """ Update row with Id from table. Set fields given by dic.""" if dic: req = "UPDATE {table} SET {SET} WHERE id = " + cls.named_style.format('__id') + " RETURNING * " r = abstractRequetesSQL.formate(req, SET=dic, table=table, args=dict(dic, __id=I...
[ "def", "update", "(", "cls", ",", "table", ",", "dic", ",", "Id", ")", ":", "if", "dic", ":", "req", "=", "\"UPDATE {table} SET {SET} WHERE id = \"", "+", "cls", ".", "named_style", ".", "format", "(", "'__id'", ")", "+", "\" RETURNING * \"", "r", "=", "...
Update row with Id from table. Set fields given by dic.
[ "Update", "row", "with", "Id", "from", "table", ".", "Set", "fields", "given", "by", "dic", "." ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L303-L310
train
benoitkugler/abstractDataLibrary
pyDLib/Core/sql.py
abstractRequetesSQL.cree
def cree(table, dic, avoid_conflict=False): """ Create ONE row from dic and returns the entry created """ if avoid_conflict: req = """ INSERT INTO {table} {ENTETE_INSERT} VALUES {BIND_INSERT} ON CONFLICT DO NOTHING RETURNING *""" else: req = """ INSERT INTO {table} {ENTET...
python
def cree(table, dic, avoid_conflict=False): """ Create ONE row from dic and returns the entry created """ if avoid_conflict: req = """ INSERT INTO {table} {ENTETE_INSERT} VALUES {BIND_INSERT} ON CONFLICT DO NOTHING RETURNING *""" else: req = """ INSERT INTO {table} {ENTET...
[ "def", "cree", "(", "table", ",", "dic", ",", "avoid_conflict", "=", "False", ")", ":", "if", "avoid_conflict", ":", "req", "=", "\"\"\" INSERT INTO {table} {ENTETE_INSERT} VALUES {BIND_INSERT} ON CONFLICT DO NOTHING RETURNING *\"\"\"", "else", ":", "req", "=", "\"\"\" IN...
Create ONE row from dic and returns the entry created
[ "Create", "ONE", "row", "from", "dic", "and", "returns", "the", "entry", "created" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L314-L321
train
benoitkugler/abstractDataLibrary
pyDLib/Core/sql.py
abstractRequetesSQL.supprime
def supprime(cls,table, **kwargs): """ Remove entries matchin given condition kwargs is a dict of column name : value , with length ONE. """ assert len(kwargs) == 1 field, value = kwargs.popitem() req = f"""DELETE FROM {table} WHERE {field} = """ + cls.mark_style ...
python
def supprime(cls,table, **kwargs): """ Remove entries matchin given condition kwargs is a dict of column name : value , with length ONE. """ assert len(kwargs) == 1 field, value = kwargs.popitem() req = f"""DELETE FROM {table} WHERE {field} = """ + cls.mark_style ...
[ "def", "supprime", "(", "cls", ",", "table", ",", "*", "*", "kwargs", ")", ":", "assert", "len", "(", "kwargs", ")", "==", "1", "field", ",", "value", "=", "kwargs", ".", "popitem", "(", ")", "req", "=", "f\"\"\"DELETE FROM {table} WHERE {field} = \"\"\"",...
Remove entries matchin given condition kwargs is a dict of column name : value , with length ONE.
[ "Remove", "entries", "matchin", "given", "condition", "kwargs", "is", "a", "dict", "of", "column", "name", ":", "value", "with", "length", "ONE", "." ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L333-L341
train
marrow/web.dispatch.object
web/dispatch/object/dispatch.py
ObjectDispatch.trace
def trace(self, context, obj): """Enumerate the children of the given object, as would be visible and utilized by dispatch.""" root = obj if isroutine(obj): yield Crumb(self, root, endpoint=True, handler=obj, options=opts(obj)) return for name, attr in getmembers(obj if isclass(obj) else obj.__cl...
python
def trace(self, context, obj): """Enumerate the children of the given object, as would be visible and utilized by dispatch.""" root = obj if isroutine(obj): yield Crumb(self, root, endpoint=True, handler=obj, options=opts(obj)) return for name, attr in getmembers(obj if isclass(obj) else obj.__cl...
[ "def", "trace", "(", "self", ",", "context", ",", "obj", ")", ":", "root", "=", "obj", "if", "isroutine", "(", "obj", ")", ":", "yield", "Crumb", "(", "self", ",", "root", ",", "endpoint", "=", "True", ",", "handler", "=", "obj", ",", "options", ...
Enumerate the children of the given object, as would be visible and utilized by dispatch.
[ "Enumerate", "the", "children", "of", "the", "given", "object", "as", "would", "be", "visible", "and", "utilized", "by", "dispatch", "." ]
98af461a404aae8ae58e2cbc2e0acdbf62a705bc
https://github.com/marrow/web.dispatch.object/blob/98af461a404aae8ae58e2cbc2e0acdbf62a705bc/web/dispatch/object/dispatch.py#L23-L58
train