repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
limix/numpy-sugar
numpy_sugar/linalg/_kron.py
kron_dot
def kron_dot(A, B, C, out=None): r""" Kronecker product followed by dot product. Let :math:`\mathrm A`, :math:`\mathrm B`, and :math:`\mathrm C` be matrices of dimensions :math:`p\times p`, :math:`n\times d`, and :math:`d\times p`. It computes .. math:: \text{unvec}((\mathrm A\otimes\mat...
python
def kron_dot(A, B, C, out=None): r""" Kronecker product followed by dot product. Let :math:`\mathrm A`, :math:`\mathrm B`, and :math:`\mathrm C` be matrices of dimensions :math:`p\times p`, :math:`n\times d`, and :math:`d\times p`. It computes .. math:: \text{unvec}((\mathrm A\otimes\mat...
[ "def", "kron_dot", "(", "A", ",", "B", ",", "C", ",", "out", "=", "None", ")", ":", "from", "numpy", "import", "dot", ",", "zeros", ",", "asarray", "A", "=", "asarray", "(", "A", ")", "B", "=", "asarray", "(", "B", ")", "C", "=", "asarray", "...
r""" Kronecker product followed by dot product. Let :math:`\mathrm A`, :math:`\mathrm B`, and :math:`\mathrm C` be matrices of dimensions :math:`p\times p`, :math:`n\times d`, and :math:`d\times p`. It computes .. math:: \text{unvec}((\mathrm A\otimes\mathrm B)\text{vec}(\mathrm C)) ...
[ "r", "Kronecker", "product", "followed", "by", "dot", "product", "." ]
train
https://github.com/limix/numpy-sugar/blob/4bdfa26913135c76ef3cd542a332f4e5861e948b/numpy_sugar/linalg/_kron.py#L1-L41
limix/numpy-sugar
numpy_sugar/linalg/property.py
check_semidefinite_positiveness
def check_semidefinite_positiveness(A): """Check if ``A`` is a semi-definite positive matrix. Args: A (array_like): Matrix. Returns: bool: ``True`` if ``A`` is definite positive; ``False`` otherwise. """ B = empty_like(A) B[:] = A B[diag_indices_from(B)] += sqrt(finfo(float...
python
def check_semidefinite_positiveness(A): """Check if ``A`` is a semi-definite positive matrix. Args: A (array_like): Matrix. Returns: bool: ``True`` if ``A`` is definite positive; ``False`` otherwise. """ B = empty_like(A) B[:] = A B[diag_indices_from(B)] += sqrt(finfo(float...
[ "def", "check_semidefinite_positiveness", "(", "A", ")", ":", "B", "=", "empty_like", "(", "A", ")", "B", "[", ":", "]", "=", "A", "B", "[", "diag_indices_from", "(", "B", ")", "]", "+=", "sqrt", "(", "finfo", "(", "float", ")", ".", "eps", ")", ...
Check if ``A`` is a semi-definite positive matrix. Args: A (array_like): Matrix. Returns: bool: ``True`` if ``A`` is definite positive; ``False`` otherwise.
[ "Check", "if", "A", "is", "a", "semi", "-", "definite", "positive", "matrix", "." ]
train
https://github.com/limix/numpy-sugar/blob/4bdfa26913135c76ef3cd542a332f4e5861e948b/numpy_sugar/linalg/property.py#L21-L37
limix/numpy-sugar
numpy_sugar/linalg/property.py
check_symmetry
def check_symmetry(A): """Check if ``A`` is a symmetric matrix. Args: A (array_like): Matrix. Returns: bool: ``True`` if ``A`` is symmetric; ``False`` otherwise. """ A = asanyarray(A) if A.ndim != 2: raise ValueError("Checks symmetry only for bi-dimensional arrays.") ...
python
def check_symmetry(A): """Check if ``A`` is a symmetric matrix. Args: A (array_like): Matrix. Returns: bool: ``True`` if ``A`` is symmetric; ``False`` otherwise. """ A = asanyarray(A) if A.ndim != 2: raise ValueError("Checks symmetry only for bi-dimensional arrays.") ...
[ "def", "check_symmetry", "(", "A", ")", ":", "A", "=", "asanyarray", "(", "A", ")", "if", "A", ".", "ndim", "!=", "2", ":", "raise", "ValueError", "(", "\"Checks symmetry only for bi-dimensional arrays.\"", ")", "if", "A", ".", "shape", "[", "0", "]", "!...
Check if ``A`` is a symmetric matrix. Args: A (array_like): Matrix. Returns: bool: ``True`` if ``A`` is symmetric; ``False`` otherwise.
[ "Check", "if", "A", "is", "a", "symmetric", "matrix", "." ]
train
https://github.com/limix/numpy-sugar/blob/4bdfa26913135c76ef3cd542a332f4e5861e948b/numpy_sugar/linalg/property.py#L40-L56
limix/numpy-sugar
numpy_sugar/linalg/cho.py
cho_solve
def cho_solve(L, b): r"""Solve for Cholesky decomposition. Solve the linear equations :math:`\mathrm A \mathbf x = \mathbf b`, given the Cholesky factorization of :math:`\mathrm A`. Args: L (array_like): Lower triangular matrix. b (array_like): Right-hand side. Returns: :c...
python
def cho_solve(L, b): r"""Solve for Cholesky decomposition. Solve the linear equations :math:`\mathrm A \mathbf x = \mathbf b`, given the Cholesky factorization of :math:`\mathrm A`. Args: L (array_like): Lower triangular matrix. b (array_like): Right-hand side. Returns: :c...
[ "def", "cho_solve", "(", "L", ",", "b", ")", ":", "from", "scipy", ".", "linalg", "import", "cho_solve", "as", "sp_cho_solve", "L", "=", "asarray", "(", "L", ",", "float", ")", "b", "=", "asarray", "(", "b", ",", "float", ")", "if", "L", ".", "si...
r"""Solve for Cholesky decomposition. Solve the linear equations :math:`\mathrm A \mathbf x = \mathbf b`, given the Cholesky factorization of :math:`\mathrm A`. Args: L (array_like): Lower triangular matrix. b (array_like): Right-hand side. Returns: :class:`numpy.ndarray`: The...
[ "r", "Solve", "for", "Cholesky", "decomposition", "." ]
train
https://github.com/limix/numpy-sugar/blob/4bdfa26913135c76ef3cd542a332f4e5861e948b/numpy_sugar/linalg/cho.py#L4-L32
opentargets/validator
opentargets_validator/helpers.py
file_or_resource
def file_or_resource(fname=None): '''get filename and check if in getcwd then get from the package resources folder ''' if fname is not None: filename = os.path.expanduser(fname) resource_package = opentargets_validator.__name__ resource_path = os.path.sep.join(('resources',...
python
def file_or_resource(fname=None): '''get filename and check if in getcwd then get from the package resources folder ''' if fname is not None: filename = os.path.expanduser(fname) resource_package = opentargets_validator.__name__ resource_path = os.path.sep.join(('resources',...
[ "def", "file_or_resource", "(", "fname", "=", "None", ")", ":", "if", "fname", "is", "not", "None", ":", "filename", "=", "os", ".", "path", ".", "expanduser", "(", "fname", ")", "resource_package", "=", "opentargets_validator", ".", "__name__", "resource_pa...
get filename and check if in getcwd then get from the package resources folder
[ "get", "filename", "and", "check", "if", "in", "getcwd", "then", "get", "from", "the", "package", "resources", "folder" ]
train
https://github.com/opentargets/validator/blob/0a80c42fc02237c72e27a32e022c1d5d9f4e25ff/opentargets_validator/helpers.py#L157-L171
limix/numpy-sugar
numpy_sugar/linalg/tri.py
stl
def stl(A, b): r"""Shortcut to ``solve_triangular(A, b, lower=True, check_finite=False)``. Solve linear systems :math:`\mathrm A \mathbf x = \mathbf b` when :math:`\mathrm A` is a lower-triangular matrix. Args: A (array_like): A lower-triangular matrix. b (array_like): Ordinate values....
python
def stl(A, b): r"""Shortcut to ``solve_triangular(A, b, lower=True, check_finite=False)``. Solve linear systems :math:`\mathrm A \mathbf x = \mathbf b` when :math:`\mathrm A` is a lower-triangular matrix. Args: A (array_like): A lower-triangular matrix. b (array_like): Ordinate values....
[ "def", "stl", "(", "A", ",", "b", ")", ":", "from", "scipy", ".", "linalg", "import", "solve_triangular", "A", "=", "asarray", "(", "A", ",", "float", ")", "b", "=", "asarray", "(", "b", ",", "float", ")", "return", "solve_triangular", "(", "A", ",...
r"""Shortcut to ``solve_triangular(A, b, lower=True, check_finite=False)``. Solve linear systems :math:`\mathrm A \mathbf x = \mathbf b` when :math:`\mathrm A` is a lower-triangular matrix. Args: A (array_like): A lower-triangular matrix. b (array_like): Ordinate values. Returns: ...
[ "r", "Shortcut", "to", "solve_triangular", "(", "A", "b", "lower", "=", "True", "check_finite", "=", "False", ")", "." ]
train
https://github.com/limix/numpy-sugar/blob/4bdfa26913135c76ef3cd542a332f4e5861e948b/numpy_sugar/linalg/tri.py#L4-L25
DiamondLightSource/python-procrunner
procrunner/__init__.py
_windows_resolve
def _windows_resolve(command): """ Try and find the full path and file extension of the executable to run. This is so that e.g. calls to 'somescript' will point at 'somescript.cmd' without the need to set shell=True in the subprocess. If the executable contains periods it is a special case. Here the...
python
def _windows_resolve(command): """ Try and find the full path and file extension of the executable to run. This is so that e.g. calls to 'somescript' will point at 'somescript.cmd' without the need to set shell=True in the subprocess. If the executable contains periods it is a special case. Here the...
[ "def", "_windows_resolve", "(", "command", ")", ":", "try", ":", "import", "win32api", "except", "ImportError", ":", "if", "(", "2", ",", "8", ")", "<", "sys", ".", "version_info", "<", "(", "3", ",", "5", ")", ":", "logger", ".", "info", "(", "\"R...
Try and find the full path and file extension of the executable to run. This is so that e.g. calls to 'somescript' will point at 'somescript.cmd' without the need to set shell=True in the subprocess. If the executable contains periods it is a special case. Here the win32api call will fail to resolve the...
[ "Try", "and", "find", "the", "full", "path", "and", "file", "extension", "of", "the", "executable", "to", "run", ".", "This", "is", "so", "that", "e", ".", "g", ".", "calls", "to", "somescript", "will", "point", "at", "somescript", ".", "cmd", "without...
train
https://github.com/DiamondLightSource/python-procrunner/blob/e11c446f97f28abceb507d21403259757f08be0a/procrunner/__init__.py#L277-L331
DiamondLightSource/python-procrunner
procrunner/__init__.py
run
def run( command, timeout=None, debug=False, stdin=None, print_stdout=True, print_stderr=True, callback_stdout=None, callback_stderr=None, environment=None, environment_override=None, win32resolve=True, working_directory=None, ): """ Run an external process. ...
python
def run( command, timeout=None, debug=False, stdin=None, print_stdout=True, print_stderr=True, callback_stdout=None, callback_stderr=None, environment=None, environment_override=None, win32resolve=True, working_directory=None, ): """ Run an external process. ...
[ "def", "run", "(", "command", ",", "timeout", "=", "None", ",", "debug", "=", "False", ",", "stdin", "=", "None", ",", "print_stdout", "=", "True", ",", "print_stderr", "=", "True", ",", "callback_stdout", "=", "None", ",", "callback_stderr", "=", "None"...
Run an external process. File system path objects (PEP-519) are accepted in the command, environment, and working directory arguments. :param array command: Command line to be run, specified as array. :param timeout: Terminate program execution after this many seconds. :param boolean debug: Enable...
[ "Run", "an", "external", "process", "." ]
train
https://github.com/DiamondLightSource/python-procrunner/blob/e11c446f97f28abceb507d21403259757f08be0a/procrunner/__init__.py#L381-L590
DiamondLightSource/python-procrunner
procrunner/__init__.py
run_process_dummy
def run_process_dummy(command, **kwargs): """ A stand-in function that returns a valid result dictionary indicating a successful execution. The external process is not run. """ warnings.warn( "procrunner.run_process_dummy() is deprecated", DeprecationWarning, stacklevel=2 ) time_sta...
python
def run_process_dummy(command, **kwargs): """ A stand-in function that returns a valid result dictionary indicating a successful execution. The external process is not run. """ warnings.warn( "procrunner.run_process_dummy() is deprecated", DeprecationWarning, stacklevel=2 ) time_sta...
[ "def", "run_process_dummy", "(", "command", ",", "*", "*", "kwargs", ")", ":", "warnings", ".", "warn", "(", "\"procrunner.run_process_dummy() is deprecated\"", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", "time_start", "=", "time", ".", "strftime"...
A stand-in function that returns a valid result dictionary indicating a successful execution. The external process is not run.
[ "A", "stand", "-", "in", "function", "that", "returns", "a", "valid", "result", "dictionary", "indicating", "a", "successful", "execution", ".", "The", "external", "process", "is", "not", "run", "." ]
train
https://github.com/DiamondLightSource/python-procrunner/blob/e11c446f97f28abceb507d21403259757f08be0a/procrunner/__init__.py#L593-L621
DiamondLightSource/python-procrunner
procrunner/__init__.py
run_process
def run_process(*args, **kwargs): """API used up to version 0.2.0.""" warnings.warn( "procrunner.run_process() is deprecated and has been renamed to run()", DeprecationWarning, stacklevel=2, ) return run(*args, **kwargs)
python
def run_process(*args, **kwargs): """API used up to version 0.2.0.""" warnings.warn( "procrunner.run_process() is deprecated and has been renamed to run()", DeprecationWarning, stacklevel=2, ) return run(*args, **kwargs)
[ "def", "run_process", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "warnings", ".", "warn", "(", "\"procrunner.run_process() is deprecated and has been renamed to run()\"", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ",", ")", "return", "run", ...
API used up to version 0.2.0.
[ "API", "used", "up", "to", "version", "0", ".", "2", ".", "0", "." ]
train
https://github.com/DiamondLightSource/python-procrunner/blob/e11c446f97f28abceb507d21403259757f08be0a/procrunner/__init__.py#L624-L631
DiamondLightSource/python-procrunner
procrunner/__init__.py
_LineAggregator.add
def add(self, data): """ Add a single character to buffer. If one or more full lines are found, print them (if desired) and pass to callback function. """ data = self._decoder.decode(data) if not data: return self._buffer += data if "\n" in dat...
python
def add(self, data): """ Add a single character to buffer. If one or more full lines are found, print them (if desired) and pass to callback function. """ data = self._decoder.decode(data) if not data: return self._buffer += data if "\n" in dat...
[ "def", "add", "(", "self", ",", "data", ")", ":", "data", "=", "self", ".", "_decoder", ".", "decode", "(", "data", ")", "if", "not", "data", ":", "return", "self", ".", "_buffer", "+=", "data", "if", "\"\\n\"", "in", "data", ":", "to_print", ",", ...
Add a single character to buffer. If one or more full lines are found, print them (if desired) and pass to callback function.
[ "Add", "a", "single", "character", "to", "buffer", ".", "If", "one", "or", "more", "full", "lines", "are", "found", "print", "them", "(", "if", "desired", ")", "and", "pass", "to", "callback", "function", "." ]
train
https://github.com/DiamondLightSource/python-procrunner/blob/e11c446f97f28abceb507d21403259757f08be0a/procrunner/__init__.py#L77-L98
DiamondLightSource/python-procrunner
procrunner/__init__.py
_LineAggregator.flush
def flush(self): """Print/send any remaining data to callback function.""" self._buffer += self._decoder.decode(b"", final=True) if self._buffer: if self._print: print(self._buffer) if self._callback: self._callback(self._buffer) se...
python
def flush(self): """Print/send any remaining data to callback function.""" self._buffer += self._decoder.decode(b"", final=True) if self._buffer: if self._print: print(self._buffer) if self._callback: self._callback(self._buffer) se...
[ "def", "flush", "(", "self", ")", ":", "self", ".", "_buffer", "+=", "self", ".", "_decoder", ".", "decode", "(", "b\"\"", ",", "final", "=", "True", ")", "if", "self", ".", "_buffer", ":", "if", "self", ".", "_print", ":", "print", "(", "self", ...
Print/send any remaining data to callback function.
[ "Print", "/", "send", "any", "remaining", "data", "to", "callback", "function", "." ]
train
https://github.com/DiamondLightSource/python-procrunner/blob/e11c446f97f28abceb507d21403259757f08be0a/procrunner/__init__.py#L100-L108
DiamondLightSource/python-procrunner
procrunner/__init__.py
_NonBlockingStreamReader.get_output
def get_output(self): """ Retrieve the stored data in full. This call may block if the reading thread has not yet terminated. """ self._closing = True if not self.has_finished(): if self._debug: # Main thread overtook stream reading thread. ...
python
def get_output(self): """ Retrieve the stored data in full. This call may block if the reading thread has not yet terminated. """ self._closing = True if not self.has_finished(): if self._debug: # Main thread overtook stream reading thread. ...
[ "def", "get_output", "(", "self", ")", ":", "self", ".", "_closing", "=", "True", "if", "not", "self", ".", "has_finished", "(", ")", ":", "if", "self", ".", "_debug", ":", "# Main thread overtook stream reading thread.", "underrun_debug_timer", "=", "timeit", ...
Retrieve the stored data in full. This call may block if the reading thread has not yet terminated.
[ "Retrieve", "the", "stored", "data", "in", "full", ".", "This", "call", "may", "block", "if", "the", "reading", "thread", "has", "not", "yet", "terminated", "." ]
train
https://github.com/DiamondLightSource/python-procrunner/blob/e11c446f97f28abceb507d21403259757f08be0a/procrunner/__init__.py#L173-L202
limix/numpy-sugar
numpy_sugar/linalg/diag.py
trace2
def trace2(A, B): r"""Trace of :math:`\mathrm A \mathrm B^\intercal`. Args: A (array_like): Left-hand side. B (array_like): Right-hand side. Returns: float: Trace of :math:`\mathrm A \mathrm B^\intercal`. """ A = asarray(A, float) B = asarray(B, float) layout_error...
python
def trace2(A, B): r"""Trace of :math:`\mathrm A \mathrm B^\intercal`. Args: A (array_like): Left-hand side. B (array_like): Right-hand side. Returns: float: Trace of :math:`\mathrm A \mathrm B^\intercal`. """ A = asarray(A, float) B = asarray(B, float) layout_error...
[ "def", "trace2", "(", "A", ",", "B", ")", ":", "A", "=", "asarray", "(", "A", ",", "float", ")", "B", "=", "asarray", "(", "B", ",", "float", ")", "layout_error", "=", "\"Wrong matrix layout.\"", "if", "not", "(", "len", "(", "A", ".", "shape", "...
r"""Trace of :math:`\mathrm A \mathrm B^\intercal`. Args: A (array_like): Left-hand side. B (array_like): Right-hand side. Returns: float: Trace of :math:`\mathrm A \mathrm B^\intercal`.
[ "r", "Trace", "of", ":", "math", ":", "\\", "mathrm", "A", "\\", "mathrm", "B^", "\\", "intercal", "." ]
train
https://github.com/limix/numpy-sugar/blob/4bdfa26913135c76ef3cd542a332f4e5861e948b/numpy_sugar/linalg/diag.py#L5-L26
limix/numpy-sugar
numpy_sugar/linalg/diag.py
sum2diag
def sum2diag(A, D, out=None): r"""Add values ``D`` to the diagonal of matrix ``A``. Args: A (array_like): Left-hand side. D (array_like or float): Values to add. out (:class:`numpy.ndarray`, optional): copy result to. Returns: :class:`numpy.ndarray`: Resulting matrix. "...
python
def sum2diag(A, D, out=None): r"""Add values ``D`` to the diagonal of matrix ``A``. Args: A (array_like): Left-hand side. D (array_like or float): Values to add. out (:class:`numpy.ndarray`, optional): copy result to. Returns: :class:`numpy.ndarray`: Resulting matrix. "...
[ "def", "sum2diag", "(", "A", ",", "D", ",", "out", "=", "None", ")", ":", "A", "=", "asarray", "(", "A", ",", "float", ")", "D", "=", "asarray", "(", "D", ",", "float", ")", "if", "out", "is", "None", ":", "out", "=", "copy", "(", "A", ")",...
r"""Add values ``D`` to the diagonal of matrix ``A``. Args: A (array_like): Left-hand side. D (array_like or float): Values to add. out (:class:`numpy.ndarray`, optional): copy result to. Returns: :class:`numpy.ndarray`: Resulting matrix.
[ "r", "Add", "values", "D", "to", "the", "diagonal", "of", "matrix", "A", "." ]
train
https://github.com/limix/numpy-sugar/blob/4bdfa26913135c76ef3cd542a332f4e5861e948b/numpy_sugar/linalg/diag.py#L29-L47
ikegami-yukino/jaconv
jaconv/jaconv.py
hira2kata
def hira2kata(text, ignore=''): """Convert Hiragana to Full-width (Zenkaku) Katakana. Parameters ---------- text : str Hiragana string. ignore : str Characters to be ignored in converting. Return ------ str Katakana string. Examples -------- >>> pri...
python
def hira2kata(text, ignore=''): """Convert Hiragana to Full-width (Zenkaku) Katakana. Parameters ---------- text : str Hiragana string. ignore : str Characters to be ignored in converting. Return ------ str Katakana string. Examples -------- >>> pri...
[ "def", "hira2kata", "(", "text", ",", "ignore", "=", "''", ")", ":", "if", "ignore", ":", "h2k_map", "=", "_exclude_ignorechar", "(", "ignore", ",", "H2K_TABLE", ".", "copy", "(", ")", ")", "return", "_convert", "(", "text", ",", "h2k_map", ")", "retur...
Convert Hiragana to Full-width (Zenkaku) Katakana. Parameters ---------- text : str Hiragana string. ignore : str Characters to be ignored in converting. Return ------ str Katakana string. Examples -------- >>> print(jaconv.hira2kata('ともえまみ')) トモエマミ...
[ "Convert", "Hiragana", "to", "Full", "-", "width", "(", "Zenkaku", ")", "Katakana", "." ]
train
https://github.com/ikegami-yukino/jaconv/blob/5319e4c6b4676ab27b5e9ebec9a299d09a5a62d7/jaconv/jaconv.py#L21-L46
ikegami-yukino/jaconv
jaconv/jaconv.py
hira2hkata
def hira2hkata(text, ignore=''): """Convert Hiragana to Half-width (Hankaku) Katakana Parameters ---------- text : str Hiragana string. ignore : str Characters to be ignored in converting. Return ------ str Half-width Katakana string. Examples -------- ...
python
def hira2hkata(text, ignore=''): """Convert Hiragana to Half-width (Hankaku) Katakana Parameters ---------- text : str Hiragana string. ignore : str Characters to be ignored in converting. Return ------ str Half-width Katakana string. Examples -------- ...
[ "def", "hira2hkata", "(", "text", ",", "ignore", "=", "''", ")", ":", "if", "ignore", ":", "h2hk_map", "=", "_exclude_ignorechar", "(", "ignore", ",", "H2HK_TABLE", ".", "copy", "(", ")", ")", "return", "_convert", "(", "text", ",", "h2hk_map", ")", "r...
Convert Hiragana to Half-width (Hankaku) Katakana Parameters ---------- text : str Hiragana string. ignore : str Characters to be ignored in converting. Return ------ str Half-width Katakana string. Examples -------- >>> print(jaconv.hira2hkata('ともえまみ')...
[ "Convert", "Hiragana", "to", "Half", "-", "width", "(", "Hankaku", ")", "Katakana" ]
train
https://github.com/ikegami-yukino/jaconv/blob/5319e4c6b4676ab27b5e9ebec9a299d09a5a62d7/jaconv/jaconv.py#L49-L74
ikegami-yukino/jaconv
jaconv/jaconv.py
kata2hira
def kata2hira(text, ignore=''): """Convert Full-width Katakana to Hiragana Parameters ---------- text : str Full-width Katakana string. ignore : str Characters to be ignored in converting. Return ------ str Hiragana string. Examples -------- >>> pri...
python
def kata2hira(text, ignore=''): """Convert Full-width Katakana to Hiragana Parameters ---------- text : str Full-width Katakana string. ignore : str Characters to be ignored in converting. Return ------ str Hiragana string. Examples -------- >>> pri...
[ "def", "kata2hira", "(", "text", ",", "ignore", "=", "''", ")", ":", "if", "ignore", ":", "k2h_map", "=", "_exclude_ignorechar", "(", "ignore", ",", "K2H_TABLE", ".", "copy", "(", ")", ")", "return", "_convert", "(", "text", ",", "k2h_map", ")", "retur...
Convert Full-width Katakana to Hiragana Parameters ---------- text : str Full-width Katakana string. ignore : str Characters to be ignored in converting. Return ------ str Hiragana string. Examples -------- >>> print(jaconv.kata2hira('巴マミ')) 巴まみ ...
[ "Convert", "Full", "-", "width", "Katakana", "to", "Hiragana" ]
train
https://github.com/ikegami-yukino/jaconv/blob/5319e4c6b4676ab27b5e9ebec9a299d09a5a62d7/jaconv/jaconv.py#L77-L102
ikegami-yukino/jaconv
jaconv/jaconv.py
h2z
def h2z(text, ignore='', kana=True, ascii=False, digit=False): """Convert Half-width (Hankaku) Katakana to Full-width (Zenkaku) Katakana Parameters ---------- text : str Half-width Katakana string. ignore : str Characters to be ignored in converting. kana : bool Either c...
python
def h2z(text, ignore='', kana=True, ascii=False, digit=False): """Convert Half-width (Hankaku) Katakana to Full-width (Zenkaku) Katakana Parameters ---------- text : str Half-width Katakana string. ignore : str Characters to be ignored in converting. kana : bool Either c...
[ "def", "h2z", "(", "text", ",", "ignore", "=", "''", ",", "kana", "=", "True", ",", "ascii", "=", "False", ",", "digit", "=", "False", ")", ":", "def", "_conv_dakuten", "(", "text", ")", ":", "\"\"\"Convert Hankaku Dakuten Kana to Zenkaku Dakuten Kana\n ...
Convert Half-width (Hankaku) Katakana to Full-width (Zenkaku) Katakana Parameters ---------- text : str Half-width Katakana string. ignore : str Characters to be ignored in converting. kana : bool Either converting Kana or not. ascii : bool Either converting asci...
[ "Convert", "Half", "-", "width", "(", "Hankaku", ")", "Katakana", "to", "Full", "-", "width", "(", "Zenkaku", ")", "Katakana" ]
train
https://github.com/ikegami-yukino/jaconv/blob/5319e4c6b4676ab27b5e9ebec9a299d09a5a62d7/jaconv/jaconv.py#L105-L175
ikegami-yukino/jaconv
jaconv/jaconv.py
z2h
def z2h(text, ignore='', kana=True, ascii=False, digit=False): """Convert Full-width (Zenkaku) Katakana to Half-width (Hankaku) Katakana Parameters ---------- text : str Full-width Katakana string. ignore : str Characters to be ignored in converting. kana : bool Either c...
python
def z2h(text, ignore='', kana=True, ascii=False, digit=False): """Convert Full-width (Zenkaku) Katakana to Half-width (Hankaku) Katakana Parameters ---------- text : str Full-width Katakana string. ignore : str Characters to be ignored in converting. kana : bool Either c...
[ "def", "z2h", "(", "text", ",", "ignore", "=", "''", ",", "kana", "=", "True", ",", "ascii", "=", "False", ",", "digit", "=", "False", ")", ":", "if", "ascii", ":", "if", "digit", ":", "if", "kana", ":", "z2h_map", "=", "Z2H_ALL", "else", ":", ...
Convert Full-width (Zenkaku) Katakana to Half-width (Hankaku) Katakana Parameters ---------- text : str Full-width Katakana string. ignore : str Characters to be ignored in converting. kana : bool Either converting Kana or not. ascii : bool Either converting asci...
[ "Convert", "Full", "-", "width", "(", "Zenkaku", ")", "Katakana", "to", "Half", "-", "width", "(", "Hankaku", ")", "Katakana" ]
train
https://github.com/ikegami-yukino/jaconv/blob/5319e4c6b4676ab27b5e9ebec9a299d09a5a62d7/jaconv/jaconv.py#L178-L229
ikegami-yukino/jaconv
jaconv/jaconv.py
normalize
def normalize(text, mode='NFKC', ignore=''): """Convert Half-width (Hankaku) Katakana to Full-width (Zenkaku) Katakana, Full-width (Zenkaku) ASCII and DIGIT to Half-width (Hankaku) ASCII and DIGIT. Additionally, Full-width wave dash (〜) etc. are normalized Parameters ---------- text : str ...
python
def normalize(text, mode='NFKC', ignore=''): """Convert Half-width (Hankaku) Katakana to Full-width (Zenkaku) Katakana, Full-width (Zenkaku) ASCII and DIGIT to Half-width (Hankaku) ASCII and DIGIT. Additionally, Full-width wave dash (〜) etc. are normalized Parameters ---------- text : str ...
[ "def", "normalize", "(", "text", ",", "mode", "=", "'NFKC'", ",", "ignore", "=", "''", ")", ":", "text", "=", "text", ".", "replace", "(", "'〜', ", "'", "').re", "p", "l", "ace('~'", ",", " 'ー')", "", "", "", "text", "=", "text", ".", "replace", ...
Convert Half-width (Hankaku) Katakana to Full-width (Zenkaku) Katakana, Full-width (Zenkaku) ASCII and DIGIT to Half-width (Hankaku) ASCII and DIGIT. Additionally, Full-width wave dash (〜) etc. are normalized Parameters ---------- text : str Source string. mode : str Unicode...
[ "Convert", "Half", "-", "width", "(", "Hankaku", ")", "Katakana", "to", "Full", "-", "width", "(", "Zenkaku", ")", "Katakana", "Full", "-", "width", "(", "Zenkaku", ")", "ASCII", "and", "DIGIT", "to", "Half", "-", "width", "(", "Hankaku", ")", "ASCII",...
train
https://github.com/ikegami-yukino/jaconv/blob/5319e4c6b4676ab27b5e9ebec9a299d09a5a62d7/jaconv/jaconv.py#L232-L264
ikegami-yukino/jaconv
jaconv/jaconv.py
kana2alphabet
def kana2alphabet(text): """Convert Hiragana to hepburn-style alphabets Parameters ---------- text : str Hiragana string. Return ------ str Hepburn-style alphabets string. Examples -------- >>> print(jaconv.kana2alphabet('まみさん')) mamisan """ text = ...
python
def kana2alphabet(text): """Convert Hiragana to hepburn-style alphabets Parameters ---------- text : str Hiragana string. Return ------ str Hepburn-style alphabets string. Examples -------- >>> print(jaconv.kana2alphabet('まみさん')) mamisan """ text = ...
[ "def", "kana2alphabet", "(", "text", ")", ":", "text", "=", "text", ".", "replace", "(", "'きゃ', 'k", "y", "').re", "p", "l", "ace('きゅ", "'", ", 'kyu')", ".", "eplac", "e", "(", "'きょ', '", "k", "yo')", "", "", "", "text", "=", "text", ".", "replace"...
Convert Hiragana to hepburn-style alphabets Parameters ---------- text : str Hiragana string. Return ------ str Hepburn-style alphabets string. Examples -------- >>> print(jaconv.kana2alphabet('まみさん')) mamisan
[ "Convert", "Hiragana", "to", "hepburn", "-", "style", "alphabets" ]
train
https://github.com/ikegami-yukino/jaconv/blob/5319e4c6b4676ab27b5e9ebec9a299d09a5a62d7/jaconv/jaconv.py#L267-L333
ikegami-yukino/jaconv
jaconv/jaconv.py
alphabet2kana
def alphabet2kana(text): """Convert alphabets to Hiragana Parameters ---------- text : str Alphabets string. Return ------ str Hiragana string. Examples -------- >>> print(jaconv.alphabet2kana('mamisan')) まみさん """ text = text.replace('kya', 'きゃ').re...
python
def alphabet2kana(text): """Convert alphabets to Hiragana Parameters ---------- text : str Alphabets string. Return ------ str Hiragana string. Examples -------- >>> print(jaconv.alphabet2kana('mamisan')) まみさん """ text = text.replace('kya', 'きゃ').re...
[ "def", "alphabet2kana", "(", "text", ")", ":", "text", "=", "text", ".", "replace", "(", "'kya'", ",", "'きゃ').re", "p", "l", "ace('ky", "u", "', 'き", "ゅ", ").replac", "e", "(", "'kyo', ", "'", "きょ')", "", "", "", "text", "=", "text", ".", "replace"...
Convert alphabets to Hiragana Parameters ---------- text : str Alphabets string. Return ------ str Hiragana string. Examples -------- >>> print(jaconv.alphabet2kana('mamisan')) まみさん
[ "Convert", "alphabets", "to", "Hiragana" ]
train
https://github.com/ikegami-yukino/jaconv/blob/5319e4c6b4676ab27b5e9ebec9a299d09a5a62d7/jaconv/jaconv.py#L336-L408
ibab/matplotlib-hep
matplotlib_hep/__init__.py
histpoints
def histpoints(x, bins=None, xerr=None, yerr='gamma', normed=False, **kwargs): """ Plot a histogram as a series of data points. Compute and draw the histogram of *x* using individual (x,y) points for the bin contents. By default, vertical poisson error bars are calculated using the gamma distr...
python
def histpoints(x, bins=None, xerr=None, yerr='gamma', normed=False, **kwargs): """ Plot a histogram as a series of data points. Compute and draw the histogram of *x* using individual (x,y) points for the bin contents. By default, vertical poisson error bars are calculated using the gamma distr...
[ "def", "histpoints", "(", "x", ",", "bins", "=", "None", ",", "xerr", "=", "None", ",", "yerr", "=", "'gamma'", ",", "normed", "=", "False", ",", "*", "*", "kwargs", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "if", "bins", "is", ...
Plot a histogram as a series of data points. Compute and draw the histogram of *x* using individual (x,y) points for the bin contents. By default, vertical poisson error bars are calculated using the gamma distribution. Horizontal error bars are omitted by default. These can be enabled using ...
[ "Plot", "a", "histogram", "as", "a", "series", "of", "data", "points", "." ]
train
https://github.com/ibab/matplotlib-hep/blob/7ff83ffbc059a0ca9326f1ecb39979b13e33b22d/matplotlib_hep/__init__.py#L32-L84
kevinconway/daemons
daemons/message/eventlet.py
EventletMessageManager.pool
def pool(self): """Get an eventlet pool used to dispatch requests.""" self._pool = self._pool or eventlet.GreenPool(size=self.pool_size) return self._pool
python
def pool(self): """Get an eventlet pool used to dispatch requests.""" self._pool = self._pool or eventlet.GreenPool(size=self.pool_size) return self._pool
[ "def", "pool", "(", "self", ")", ":", "self", ".", "_pool", "=", "self", ".", "_pool", "or", "eventlet", ".", "GreenPool", "(", "size", "=", "self", ".", "pool_size", ")", "return", "self", ".", "_pool" ]
Get an eventlet pool used to dispatch requests.
[ "Get", "an", "eventlet", "pool", "used", "to", "dispatch", "requests", "." ]
train
https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/message/eventlet.py#L18-L21
kevinconway/daemons
daemons/startstop/simple.py
SimpleStartStopManager.start
def start(self): """Start the process with daemonization. If the process is already started this call should exit with code ALREADY_RUNNING. Otherwise it must call the 'daemonize' method and then call 'run'. """ if self.pid is not None: LOG.error( ...
python
def start(self): """Start the process with daemonization. If the process is already started this call should exit with code ALREADY_RUNNING. Otherwise it must call the 'daemonize' method and then call 'run'. """ if self.pid is not None: LOG.error( ...
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "pid", "is", "not", "None", ":", "LOG", ".", "error", "(", "\"The process is already running with pid {0}.\"", ".", "format", "(", "self", ".", "pid", ")", ")", "sys", ".", "exit", "(", "exit", ...
Start the process with daemonization. If the process is already started this call should exit with code ALREADY_RUNNING. Otherwise it must call the 'daemonize' method and then call 'run'.
[ "Start", "the", "process", "with", "daemonization", "." ]
train
https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/startstop/simple.py#L24-L49
kevinconway/daemons
daemons/startstop/simple.py
SimpleStartStopManager.stop
def stop(self): """Stop the daemonized process. If the process is already stopped this call should exit successfully. If the process cannot be stopped this call should exit with code STOP_FAILED. """ if self.pid is None: return None try: ...
python
def stop(self): """Stop the daemonized process. If the process is already stopped this call should exit successfully. If the process cannot be stopped this call should exit with code STOP_FAILED. """ if self.pid is None: return None try: ...
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "pid", "is", "None", ":", "return", "None", "try", ":", "while", "True", ":", "self", ".", "send", "(", "signal", ".", "SIGTERM", ")", "time", ".", "sleep", "(", "0.1", ")", "except", "Runt...
Stop the daemonized process. If the process is already stopped this call should exit successfully. If the process cannot be stopped this call should exit with code STOP_FAILED.
[ "Stop", "the", "daemonized", "process", "." ]
train
https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/startstop/simple.py#L51-L87
kevinconway/daemons
daemons/signal/simple.py
SimpleSignalManager.handle
def handle(self, signum, handler): """Set a function to run when the given signal is recieved. Multiple handlers may be assigned to a single signal. The order of handlers does not need to be preserved. 'signum' must be an integer representing a signal. 'handler' must be a call...
python
def handle(self, signum, handler): """Set a function to run when the given signal is recieved. Multiple handlers may be assigned to a single signal. The order of handlers does not need to be preserved. 'signum' must be an integer representing a signal. 'handler' must be a call...
[ "def", "handle", "(", "self", ",", "signum", ",", "handler", ")", ":", "if", "not", "isinstance", "(", "signum", ",", "int", ")", ":", "raise", "TypeError", "(", "\"Signals must be given as integers. Got {0}.\"", ".", "format", "(", "type", "(", "signum", ")...
Set a function to run when the given signal is recieved. Multiple handlers may be assigned to a single signal. The order of handlers does not need to be preserved. 'signum' must be an integer representing a signal. 'handler' must be a callable.
[ "Set", "a", "function", "to", "run", "when", "the", "given", "signal", "is", "recieved", "." ]
train
https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/signal/simple.py#L43-L68
kevinconway/daemons
daemons/signal/simple.py
SimpleSignalManager.send
def send(self, signum): """Send the given signal to the running process. If the process is not running a RuntimeError with a message of "No such process" should be emitted. """ if not isinstance(signum, int): raise TypeError( "Signals must be given a...
python
def send(self, signum): """Send the given signal to the running process. If the process is not running a RuntimeError with a message of "No such process" should be emitted. """ if not isinstance(signum, int): raise TypeError( "Signals must be given a...
[ "def", "send", "(", "self", ",", "signum", ")", ":", "if", "not", "isinstance", "(", "signum", ",", "int", ")", ":", "raise", "TypeError", "(", "\"Signals must be given as integers. Got {0}.\"", ".", "format", "(", "type", "(", "signum", ")", ",", ")", ","...
Send the given signal to the running process. If the process is not running a RuntimeError with a message of "No such process" should be emitted.
[ "Send", "the", "given", "signal", "to", "the", "running", "process", "." ]
train
https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/signal/simple.py#L70-L94
kevinconway/daemons
daemons/signal/simple.py
SimpleSignalManager._handle_signals
def _handle_signals(self, signum, frame): """Handler for all signals. This method must be used to handle all signals for the process. It is responsible for runnin the appropriate signal handlers registered with the 'handle' method unless they are shutdown signals. Shutdown signals ...
python
def _handle_signals(self, signum, frame): """Handler for all signals. This method must be used to handle all signals for the process. It is responsible for runnin the appropriate signal handlers registered with the 'handle' method unless they are shutdown signals. Shutdown signals ...
[ "def", "_handle_signals", "(", "self", ",", "signum", ",", "frame", ")", ":", "if", "signum", "in", "self", ".", "kill_signals", ":", "return", "self", ".", "shutdown", "(", "signum", ")", "for", "handler", "in", "self", ".", "_handlers", "[", "signum", ...
Handler for all signals. This method must be used to handle all signals for the process. It is responsible for runnin the appropriate signal handlers registered with the 'handle' method unless they are shutdown signals. Shutdown signals must trigger the 'shutdown' method.
[ "Handler", "for", "all", "signals", "." ]
train
https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/signal/simple.py#L96-L110
kevinconway/daemons
daemons/signal/simple.py
SimpleSignalManager.shutdown
def shutdown(self, signum): """Handle all signals which trigger a process stop. This method should run all appropriate signal handlers registered through the 'handle' method. At the end it should cause the process to exit with a status code. If any of the handlers raise an exception ...
python
def shutdown(self, signum): """Handle all signals which trigger a process stop. This method should run all appropriate signal handlers registered through the 'handle' method. At the end it should cause the process to exit with a status code. If any of the handlers raise an exception ...
[ "def", "shutdown", "(", "self", ",", "signum", ")", ":", "dirty", "=", "False", "for", "handler", "in", "self", ".", "_handlers", "[", "signum", "]", ":", "try", ":", "handler", "(", ")", "except", ":", "LOG", ".", "exception", "(", "\"A shutdown handl...
Handle all signals which trigger a process stop. This method should run all appropriate signal handlers registered through the 'handle' method. At the end it should cause the process to exit with a status code. If any of the handlers raise an exception the exit code should be SHUTDOWN_F...
[ "Handle", "all", "signals", "which", "trigger", "a", "process", "stop", "." ]
train
https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/signal/simple.py#L112-L140
DEIB-GECO/PyGMQL
gmql/dataset/loaders/Loader.py
preprocess_path
def preprocess_path(path): """ Given a dataset path, the following structure is to be expected: - path/ - files/ - S_00000.gdm - S_00000.gdm.meta - S_00001.gdm - S_00001.gdm.meta - ... - schema.xml ...
python
def preprocess_path(path): """ Given a dataset path, the following structure is to be expected: - path/ - files/ - S_00000.gdm - S_00000.gdm.meta - S_00001.gdm - S_00001.gdm.meta - ... - schema.xml ...
[ "def", "preprocess_path", "(", "path", ")", ":", "if", "path", ".", "startswith", "(", "\"gs://\"", ")", ":", "fs", "=", "gcsfs", ".", "GCSFileSystem", "(", "token", "=", "get_gcloud_token", "(", ")", ")", "for", "sub_f", "in", "fs", ".", "ls", "(", ...
Given a dataset path, the following structure is to be expected: - path/ - files/ - S_00000.gdm - S_00000.gdm.meta - S_00001.gdm - S_00001.gdm.meta - ... - schema.xml - [profile.xml] ...
[ "Given", "a", "dataset", "path", "the", "following", "structure", "is", "to", "be", "expected", ":", "-", "path", "/", "-", "files", "/", "-", "S_00000", ".", "gdm", "-", "S_00000", ".", "gdm", ".", "meta", "-", "S_00001", ".", "gdm", "-", "S_00001",...
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/loaders/Loader.py#L25-L63
DEIB-GECO/PyGMQL
gmql/dataset/loaders/Loader.py
check_for_dataset
def check_for_dataset(files): """ A GDM dataset has the form: - S_00000.gdm - S_00000.gdm.meta - S_00001.gdm - S_00001.gdm.meta - ... - schema.xml - [profile.xml] - [web_profile.xml] :param files: path of the dataset :return: True if the path c...
python
def check_for_dataset(files): """ A GDM dataset has the form: - S_00000.gdm - S_00000.gdm.meta - S_00001.gdm - S_00001.gdm.meta - ... - schema.xml - [profile.xml] - [web_profile.xml] :param files: path of the dataset :return: True if the path c...
[ "def", "check_for_dataset", "(", "files", ")", ":", "all_files", "=", "os", ".", "listdir", "(", "files", ")", "meta_files", "=", "set", "(", "map", "(", "lambda", "y", ":", "y", "[", ":", "-", "9", "]", ",", "filter", "(", "lambda", "x", ":", "x...
A GDM dataset has the form: - S_00000.gdm - S_00000.gdm.meta - S_00001.gdm - S_00001.gdm.meta - ... - schema.xml - [profile.xml] - [web_profile.xml] :param files: path of the dataset :return: True if the path contains a gdm dataset
[ "A", "GDM", "dataset", "has", "the", "form", ":", "-", "S_00000", ".", "gdm", "-", "S_00000", ".", "gdm", ".", "meta", "-", "S_00001", ".", "gdm", "-", "S_00001", ".", "gdm", ".", "meta", "-", "...", "-", "schema", ".", "xml", "-", "[", "profile"...
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/loaders/Loader.py#L66-L82
DEIB-GECO/PyGMQL
gmql/dataset/loaders/Loader.py
load_from_path
def load_from_path(local_path=None, parser=None, all_load=False): """ Loads the data from a local path into a GMQLDataset. The loading of the files is "lazy", which means that the files are loaded only when the user does a materialization (see :func:`~gmql.dataset.GMQLDataset.GMQLDataset.materialize` ). ...
python
def load_from_path(local_path=None, parser=None, all_load=False): """ Loads the data from a local path into a GMQLDataset. The loading of the files is "lazy", which means that the files are loaded only when the user does a materialization (see :func:`~gmql.dataset.GMQLDataset.GMQLDataset.materialize` ). ...
[ "def", "load_from_path", "(", "local_path", "=", "None", ",", "parser", "=", "None", ",", "all_load", "=", "False", ")", ":", "from", ".", ".", "import", "GDataframe", "from", ".", ".", "import", "GMQLDataset", "pmg", "=", "get_python_manager", "(", ")", ...
Loads the data from a local path into a GMQLDataset. The loading of the files is "lazy", which means that the files are loaded only when the user does a materialization (see :func:`~gmql.dataset.GMQLDataset.GMQLDataset.materialize` ). The user can force the materialization of the data (maybe for an initial ...
[ "Loads", "the", "data", "from", "a", "local", "path", "into", "a", "GMQLDataset", ".", "The", "loading", "of", "the", "files", "is", "lazy", "which", "means", "that", "the", "files", "are", "loaded", "only", "when", "the", "user", "does", "a", "materiali...
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/loaders/Loader.py#L85-L142
DEIB-GECO/PyGMQL
gmql/dataset/loaders/Loader.py
load_from_remote
def load_from_remote(remote_name, owner=None): """ Loads the data from a remote repository. :param remote_name: The name of the dataset in the remote repository :param owner: (optional) The owner of the dataset. If nothing is provided, the current user is used. For public datasets use 'pu...
python
def load_from_remote(remote_name, owner=None): """ Loads the data from a remote repository. :param remote_name: The name of the dataset in the remote repository :param owner: (optional) The owner of the dataset. If nothing is provided, the current user is used. For public datasets use 'pu...
[ "def", "load_from_remote", "(", "remote_name", ",", "owner", "=", "None", ")", ":", "from", ".", ".", "import", "GMQLDataset", "pmg", "=", "get_python_manager", "(", ")", "remote_manager", "=", "get_remote_manager", "(", ")", "parser", "=", "remote_manager", "...
Loads the data from a remote repository. :param remote_name: The name of the dataset in the remote repository :param owner: (optional) The owner of the dataset. If nothing is provided, the current user is used. For public datasets use 'public'. :return: A new GMQLDataset or a GDataframe
[ "Loads", "the", "data", "from", "a", "remote", "repository", "." ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/loaders/Loader.py#L145-L166
nathan-hoad/python-iwlib
iwlib/iwlist.py
scan
def scan(interface): """Perform a scan for access points in the area. Arguments: interface - device to use for scanning (e.g. eth1, wlan0). """ interface = _get_bytes(interface) head = ffi.new('wireless_scan_head *') with iwlib_socket() as sock: range = _get_range_info(interfa...
python
def scan(interface): """Perform a scan for access points in the area. Arguments: interface - device to use for scanning (e.g. eth1, wlan0). """ interface = _get_bytes(interface) head = ffi.new('wireless_scan_head *') with iwlib_socket() as sock: range = _get_range_info(interfa...
[ "def", "scan", "(", "interface", ")", ":", "interface", "=", "_get_bytes", "(", "interface", ")", "head", "=", "ffi", ".", "new", "(", "'wireless_scan_head *'", ")", "with", "iwlib_socket", "(", ")", "as", "sock", ":", "range", "=", "_get_range_info", "(",...
Perform a scan for access points in the area. Arguments: interface - device to use for scanning (e.g. eth1, wlan0).
[ "Perform", "a", "scan", "for", "access", "points", "in", "the", "area", "." ]
train
https://github.com/nathan-hoad/python-iwlib/blob/f7604de0a27709fca139c4bada58263bdce4f08e/iwlib/iwlist.py#L21-L74
DEIB-GECO/PyGMQL
gmql/RemoteConnection/RemoteManager.py
RemoteManager.login
def login(self, username=None, password=None): """ Before doing any remote operation, the user has to login to the GMQL serivice. This can be done in the two following ways: * Guest mode: the user has no credentials and uses the system only as a temporary guest * Authenticated m...
python
def login(self, username=None, password=None): """ Before doing any remote operation, the user has to login to the GMQL serivice. This can be done in the two following ways: * Guest mode: the user has no credentials and uses the system only as a temporary guest * Authenticated m...
[ "def", "login", "(", "self", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "if", "(", "username", "is", "None", ")", "and", "(", "password", "is", "None", ")", ":", "auth_token", "=", "self", ".", "__login_guest", "(", ")", ...
Before doing any remote operation, the user has to login to the GMQL serivice. This can be done in the two following ways: * Guest mode: the user has no credentials and uses the system only as a temporary guest * Authenticated mode: the users has credentials and a stable remote account ...
[ "Before", "doing", "any", "remote", "operation", "the", "user", "has", "to", "login", "to", "the", "GMQL", "serivice", ".", "This", "can", "be", "done", "in", "the", "two", "following", "ways", ":" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/RemoteConnection/RemoteManager.py#L93-L119
DEIB-GECO/PyGMQL
gmql/RemoteConnection/RemoteManager.py
RemoteManager.logout
def logout(self): """ Logout from the remote account :return: None """ url = self.address + "/logout" header = self.__check_authentication() response = requests.get(url, headers=header) if response.status_code != 200: raise ValueError("Code {}. {}".fo...
python
def logout(self): """ Logout from the remote account :return: None """ url = self.address + "/logout" header = self.__check_authentication() response = requests.get(url, headers=header) if response.status_code != 200: raise ValueError("Code {}. {}".fo...
[ "def", "logout", "(", "self", ")", ":", "url", "=", "self", ".", "address", "+", "\"/logout\"", "header", "=", "self", ".", "__check_authentication", "(", ")", "response", "=", "requests", ".", "get", "(", "url", ",", "headers", "=", "header", ")", "if...
Logout from the remote account :return: None
[ "Logout", "from", "the", "remote", "account" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/RemoteConnection/RemoteManager.py#L168-L177
DEIB-GECO/PyGMQL
gmql/RemoteConnection/RemoteManager.py
RemoteManager.get_dataset_list
def get_dataset_list(self): """ Returns the list of available datasets for the current user. :return: a pandas Dataframe """ url = self.address + "/datasets" header = self.__check_authentication() response = requests.get(url, headers=header) response = response.j...
python
def get_dataset_list(self): """ Returns the list of available datasets for the current user. :return: a pandas Dataframe """ url = self.address + "/datasets" header = self.__check_authentication() response = requests.get(url, headers=header) response = response.j...
[ "def", "get_dataset_list", "(", "self", ")", ":", "url", "=", "self", ".", "address", "+", "\"/datasets\"", "header", "=", "self", ".", "__check_authentication", "(", ")", "response", "=", "requests", ".", "get", "(", "url", ",", "headers", "=", "header", ...
Returns the list of available datasets for the current user. :return: a pandas Dataframe
[ "Returns", "the", "list", "of", "available", "datasets", "for", "the", "current", "user", "." ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/RemoteConnection/RemoteManager.py#L196-L207
DEIB-GECO/PyGMQL
gmql/RemoteConnection/RemoteManager.py
RemoteManager.get_dataset_samples
def get_dataset_samples(self, dataset_name, owner=None): """ Get the list of samples of a specific remote dataset. :param dataset_name: the dataset name :param owner: (optional) who owns the dataset. If it is not specified, the current user is used. For public dataset use 'public...
python
def get_dataset_samples(self, dataset_name, owner=None): """ Get the list of samples of a specific remote dataset. :param dataset_name: the dataset name :param owner: (optional) who owns the dataset. If it is not specified, the current user is used. For public dataset use 'public...
[ "def", "get_dataset_samples", "(", "self", ",", "dataset_name", ",", "owner", "=", "None", ")", ":", "if", "isinstance", "(", "owner", ",", "str", ")", ":", "owner", "=", "owner", ".", "lower", "(", ")", "dataset_name", "=", "owner", "+", "\".\"", "+",...
Get the list of samples of a specific remote dataset. :param dataset_name: the dataset name :param owner: (optional) who owns the dataset. If it is not specified, the current user is used. For public dataset use 'public'. :return: a pandas Dataframe
[ "Get", "the", "list", "of", "samples", "of", "a", "specific", "remote", "dataset", "." ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/RemoteConnection/RemoteManager.py#L209-L232
DEIB-GECO/PyGMQL
gmql/RemoteConnection/RemoteManager.py
RemoteManager.get_dataset_schema
def get_dataset_schema(self, dataset_name, owner=None): """ Given a dataset name, it returns a BedParser coherent with the schema of it :param dataset_name: a dataset name on the repository :param owner: (optional) who owns the dataset. If it is not specified, the current user is...
python
def get_dataset_schema(self, dataset_name, owner=None): """ Given a dataset name, it returns a BedParser coherent with the schema of it :param dataset_name: a dataset name on the repository :param owner: (optional) who owns the dataset. If it is not specified, the current user is...
[ "def", "get_dataset_schema", "(", "self", ",", "dataset_name", ",", "owner", "=", "None", ")", ":", "if", "isinstance", "(", "owner", ",", "str", ")", ":", "owner", "=", "owner", ".", "lower", "(", ")", "dataset_name", "=", "owner", "+", "\".\"", "+", ...
Given a dataset name, it returns a BedParser coherent with the schema of it :param dataset_name: a dataset name on the repository :param owner: (optional) who owns the dataset. If it is not specified, the current user is used. For public dataset use 'public'. :return: a BedParser
[ "Given", "a", "dataset", "name", "it", "returns", "a", "BedParser", "coherent", "with", "the", "schema", "of", "it" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/RemoteConnection/RemoteManager.py#L234-L304
DEIB-GECO/PyGMQL
gmql/RemoteConnection/RemoteManager.py
RemoteManager.upload_dataset
def upload_dataset(self, dataset, dataset_name, schema_path=None): """ Upload to the repository an entire dataset from a local path :param dataset: the local path of the dataset :param dataset_name: the name you want to assign to the dataset remotely :return: None """ u...
python
def upload_dataset(self, dataset, dataset_name, schema_path=None): """ Upload to the repository an entire dataset from a local path :param dataset: the local path of the dataset :param dataset_name: the name you want to assign to the dataset remotely :return: None """ u...
[ "def", "upload_dataset", "(", "self", ",", "dataset", ",", "dataset_name", ",", "schema_path", "=", "None", ")", ":", "url", "=", "self", ".", "address", "+", "\"/datasets/\"", "+", "dataset_name", "+", "\"/uploadSample\"", "header", "=", "self", ".", "__che...
Upload to the repository an entire dataset from a local path :param dataset: the local path of the dataset :param dataset_name: the name you want to assign to the dataset remotely :return: None
[ "Upload", "to", "the", "repository", "an", "entire", "dataset", "from", "a", "local", "path" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/RemoteConnection/RemoteManager.py#L306-L356
DEIB-GECO/PyGMQL
gmql/RemoteConnection/RemoteManager.py
RemoteManager.delete_dataset
def delete_dataset(self, dataset_name): """ Deletes the dataset having the specified name :param dataset_name: the name that the dataset has on the repository :return: None """ url = self.address + "/datasets/" + dataset_name header = self.__check_authentication() ...
python
def delete_dataset(self, dataset_name): """ Deletes the dataset having the specified name :param dataset_name: the name that the dataset has on the repository :return: None """ url = self.address + "/datasets/" + dataset_name header = self.__check_authentication() ...
[ "def", "delete_dataset", "(", "self", ",", "dataset_name", ")", ":", "url", "=", "self", ".", "address", "+", "\"/datasets/\"", "+", "dataset_name", "header", "=", "self", ".", "__check_authentication", "(", ")", "response", "=", "requests", ".", "delete", "...
Deletes the dataset having the specified name :param dataset_name: the name that the dataset has on the repository :return: None
[ "Deletes", "the", "dataset", "having", "the", "specified", "name" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/RemoteConnection/RemoteManager.py#L358-L369
DEIB-GECO/PyGMQL
gmql/RemoteConnection/RemoteManager.py
RemoteManager.download_dataset
def download_dataset(self, dataset_name, local_path, how="stream"): """ It downloads from the repository the specified dataset and puts it in the specified local folder :param dataset_name: the name the dataset has in the repository :param local_path: where you want to save the dataset ...
python
def download_dataset(self, dataset_name, local_path, how="stream"): """ It downloads from the repository the specified dataset and puts it in the specified local folder :param dataset_name: the name the dataset has in the repository :param local_path: where you want to save the dataset ...
[ "def", "download_dataset", "(", "self", ",", "dataset_name", ",", "local_path", ",", "how", "=", "\"stream\"", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "local_path", ")", ":", "os", ".", "makedirs", "(", "local_path", ")", "else", "...
It downloads from the repository the specified dataset and puts it in the specified local folder :param dataset_name: the name the dataset has in the repository :param local_path: where you want to save the dataset :param how: 'zip' downloads the whole dataset as a zip file and decompre...
[ "It", "downloads", "from", "the", "repository", "the", "specified", "dataset", "and", "puts", "it", "in", "the", "specified", "local", "folder" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/RemoteConnection/RemoteManager.py#L375-L398
DEIB-GECO/PyGMQL
gmql/RemoteConnection/RemoteManager.py
RemoteManager.query
def query(self, query, output_path=None, file_name="query", output="tab"): """ Execute a GMQL textual query on the remote server. :param query: the string containing the query :param output_path (optional): where to store the results locally. If specified the results are download...
python
def query(self, query, output_path=None, file_name="query", output="tab"): """ Execute a GMQL textual query on the remote server. :param query: the string containing the query :param output_path (optional): where to store the results locally. If specified the results are download...
[ "def", "query", "(", "self", ",", "query", ",", "output_path", "=", "None", ",", "file_name", "=", "\"query\"", ",", "output", "=", "\"tab\"", ")", ":", "header", "=", "self", ".", "__check_authentication", "(", ")", "header", "[", "'Content-Type'", "]", ...
Execute a GMQL textual query on the remote server. :param query: the string containing the query :param output_path (optional): where to store the results locally. If specified the results are downloaded locally :param file_name (optional): the name of the query :param ou...
[ "Execute", "a", "GMQL", "textual", "query", "on", "the", "remote", "server", "." ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/RemoteConnection/RemoteManager.py#L490-L516
DEIB-GECO/PyGMQL
gmql/RemoteConnection/RemoteManager.py
RemoteManager.trace_job
def trace_job(self, jobId): """ Get information about the specified remote job :param jobId: the job identifier :return: a dictionary with the information """ header = self.__check_authentication() status_url = self.address + "/jobs/" + jobId + "/trace" status_re...
python
def trace_job(self, jobId): """ Get information about the specified remote job :param jobId: the job identifier :return: a dictionary with the information """ header = self.__check_authentication() status_url = self.address + "/jobs/" + jobId + "/trace" status_re...
[ "def", "trace_job", "(", "self", ",", "jobId", ")", ":", "header", "=", "self", ".", "__check_authentication", "(", ")", "status_url", "=", "self", ".", "address", "+", "\"/jobs/\"", "+", "jobId", "+", "\"/trace\"", "status_resp", "=", "requests", ".", "ge...
Get information about the specified remote job :param jobId: the job identifier :return: a dictionary with the information
[ "Get", "information", "about", "the", "specified", "remote", "job" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/RemoteConnection/RemoteManager.py#L611-L622
DEIB-GECO/PyGMQL
gmql/settings.py
set_mode
def set_mode(how): """ Sets the behavior of the API :param how: if 'remote' all the execution is performed on the remote server; if 'local' all it is executed locally. Default = 'local' :return: None """ global __mode if how == "local": __mode = how elif how == "remote": ...
python
def set_mode(how): """ Sets the behavior of the API :param how: if 'remote' all the execution is performed on the remote server; if 'local' all it is executed locally. Default = 'local' :return: None """ global __mode if how == "local": __mode = how elif how == "remote": ...
[ "def", "set_mode", "(", "how", ")", ":", "global", "__mode", "if", "how", "==", "\"local\"", ":", "__mode", "=", "how", "elif", "how", "==", "\"remote\"", ":", "__mode", "=", "how", "else", ":", "raise", "ValueError", "(", "\"how must be 'local' or 'remote'\...
Sets the behavior of the API :param how: if 'remote' all the execution is performed on the remote server; if 'local' all it is executed locally. Default = 'local' :return: None
[ "Sets", "the", "behavior", "of", "the", "API" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/settings.py#L79-L92
DEIB-GECO/PyGMQL
gmql/settings.py
set_progress
def set_progress(how): """ Enables or disables the progress bars for the loading, writing and downloading of datasets :param how: True if you want the progress bar, False otherwise :return: None Example:: import gmql as gl gl.set_progress(True) # abilitates progress bars ...
python
def set_progress(how): """ Enables or disables the progress bars for the loading, writing and downloading of datasets :param how: True if you want the progress bar, False otherwise :return: None Example:: import gmql as gl gl.set_progress(True) # abilitates progress bars ...
[ "def", "set_progress", "(", "how", ")", ":", "global", "__progress_bar", "if", "isinstance", "(", "how", ",", "bool", ")", ":", "__progress_bar", "=", "how", "else", ":", "raise", "ValueError", "(", "\"how must be a boolean. {} was found\"", ".", "format", "(", ...
Enables or disables the progress bars for the loading, writing and downloading of datasets :param how: True if you want the progress bar, False otherwise :return: None Example:: import gmql as gl gl.set_progress(True) # abilitates progress bars # ....do something... ...
[ "Enables", "or", "disables", "the", "progress", "bars", "for", "the", "loading", "writing", "and", "downloading", "of", "datasets" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/settings.py#L107-L128
DEIB-GECO/PyGMQL
gmql/settings.py
set_meta_profiling
def set_meta_profiling(how): """ Enables or disables the profiling of metadata at the loading of a GMQLDataset :param how: True if you want to analyze the metadata when a GMQLDataset is created by a load_from_*. False otherwise. (Default=True) :return: None """ global __metadata_pro...
python
def set_meta_profiling(how): """ Enables or disables the profiling of metadata at the loading of a GMQLDataset :param how: True if you want to analyze the metadata when a GMQLDataset is created by a load_from_*. False otherwise. (Default=True) :return: None """ global __metadata_pro...
[ "def", "set_meta_profiling", "(", "how", ")", ":", "global", "__metadata_profiling", "if", "isinstance", "(", "how", ",", "bool", ")", ":", "__metadata_profiling", "=", "how", "else", ":", "raise", "TypeError", "(", "\"how must be boolean. {} was provided\"", ".", ...
Enables or disables the profiling of metadata at the loading of a GMQLDataset :param how: True if you want to analyze the metadata when a GMQLDataset is created by a load_from_*. False otherwise. (Default=True) :return: None
[ "Enables", "or", "disables", "the", "profiling", "of", "metadata", "at", "the", "loading", "of", "a", "GMQLDataset" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/settings.py#L136-L147
DEIB-GECO/PyGMQL
gmql/dataset/parsers/RegionParser.py
RegionParser.parse_regions
def parse_regions(self, path): """ Given a file path, it loads it into memory as a Pandas dataframe :param path: file path :return: a Pandas Dataframe """ if self.schema_format.lower() == GTF.lower(): res = self._parse_gtf_regions(path) else: res ...
python
def parse_regions(self, path): """ Given a file path, it loads it into memory as a Pandas dataframe :param path: file path :return: a Pandas Dataframe """ if self.schema_format.lower() == GTF.lower(): res = self._parse_gtf_regions(path) else: res ...
[ "def", "parse_regions", "(", "self", ",", "path", ")", ":", "if", "self", ".", "schema_format", ".", "lower", "(", ")", "==", "GTF", ".", "lower", "(", ")", ":", "res", "=", "self", ".", "_parse_gtf_regions", "(", "path", ")", "else", ":", "res", "...
Given a file path, it loads it into memory as a Pandas dataframe :param path: file path :return: a Pandas Dataframe
[ "Given", "a", "file", "path", "it", "loads", "it", "into", "memory", "as", "a", "Pandas", "dataframe" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/parsers/RegionParser.py#L101-L111
DEIB-GECO/PyGMQL
gmql/dataset/parsers/RegionParser.py
RegionParser.get_attributes
def get_attributes(self): """ Returns the unordered list of attributes :return: list of strings """ attr = ['chr', 'start', 'stop'] if self.strandPos is not None: attr.append('strand') if self.otherPos: for i, o in enumerate(self.otherPos): ...
python
def get_attributes(self): """ Returns the unordered list of attributes :return: list of strings """ attr = ['chr', 'start', 'stop'] if self.strandPos is not None: attr.append('strand') if self.otherPos: for i, o in enumerate(self.otherPos): ...
[ "def", "get_attributes", "(", "self", ")", ":", "attr", "=", "[", "'chr'", ",", "'start'", ",", "'stop'", "]", "if", "self", ".", "strandPos", "is", "not", "None", ":", "attr", ".", "append", "(", "'strand'", ")", "if", "self", ".", "otherPos", ":", ...
Returns the unordered list of attributes :return: list of strings
[ "Returns", "the", "unordered", "list", "of", "attributes" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/parsers/RegionParser.py#L153-L165
DEIB-GECO/PyGMQL
gmql/dataset/parsers/RegionParser.py
RegionParser.get_ordered_attributes
def get_ordered_attributes(self): """ Returns the ordered list of attributes :return: list of strings """ attrs = self.get_attributes() attr_arr = np.array(attrs) poss = [self.chrPos, self.startPos, self.stopPos] if self.strandPos is not None: poss.ap...
python
def get_ordered_attributes(self): """ Returns the ordered list of attributes :return: list of strings """ attrs = self.get_attributes() attr_arr = np.array(attrs) poss = [self.chrPos, self.startPos, self.stopPos] if self.strandPos is not None: poss.ap...
[ "def", "get_ordered_attributes", "(", "self", ")", ":", "attrs", "=", "self", ".", "get_attributes", "(", ")", "attr_arr", "=", "np", ".", "array", "(", "attrs", ")", "poss", "=", "[", "self", ".", "chrPos", ",", "self", ".", "startPos", ",", "self", ...
Returns the ordered list of attributes :return: list of strings
[ "Returns", "the", "ordered", "list", "of", "attributes" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/parsers/RegionParser.py#L167-L182
DEIB-GECO/PyGMQL
gmql/dataset/parsers/RegionParser.py
RegionParser.get_types
def get_types(self): """ Returns the unordered list of data types :return: list of data types """ types = [str, int, int] if self.strandPos is not None: types.append(str) if self.otherPos: for o in self.otherPos: types.append(o[2])...
python
def get_types(self): """ Returns the unordered list of data types :return: list of data types """ types = [str, int, int] if self.strandPos is not None: types.append(str) if self.otherPos: for o in self.otherPos: types.append(o[2])...
[ "def", "get_types", "(", "self", ")", ":", "types", "=", "[", "str", ",", "int", ",", "int", "]", "if", "self", ".", "strandPos", "is", "not", "None", ":", "types", ".", "append", "(", "str", ")", "if", "self", ".", "otherPos", ":", "for", "o", ...
Returns the unordered list of data types :return: list of data types
[ "Returns", "the", "unordered", "list", "of", "data", "types" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/parsers/RegionParser.py#L184-L196
DEIB-GECO/PyGMQL
gmql/dataset/parsers/RegionParser.py
RegionParser.get_name_type_dict
def get_name_type_dict(self): """ Returns a dictionary of the type {'column_name': data_type, ...} :return: dict """ attrs = self.get_attributes() types = self.get_types() d = dict() for i,a in enumerate(attrs): d[a] = types[i] return...
python
def get_name_type_dict(self): """ Returns a dictionary of the type {'column_name': data_type, ...} :return: dict """ attrs = self.get_attributes() types = self.get_types() d = dict() for i,a in enumerate(attrs): d[a] = types[i] return...
[ "def", "get_name_type_dict", "(", "self", ")", ":", "attrs", "=", "self", ".", "get_attributes", "(", ")", "types", "=", "self", ".", "get_types", "(", ")", "d", "=", "dict", "(", ")", "for", "i", ",", "a", "in", "enumerate", "(", "attrs", ")", ":"...
Returns a dictionary of the type {'column_name': data_type, ...} :return: dict
[ "Returns", "a", "dictionary", "of", "the", "type", "{", "column_name", ":", "data_type", "...", "}" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/parsers/RegionParser.py#L198-L210
DEIB-GECO/PyGMQL
gmql/dataset/parsers/RegionParser.py
RegionParser.get_ordered_types
def get_ordered_types(self): """ Returns the ordered list of data types :return: list of data types """ types = self.get_types() types_arr = np.array(types) poss = [self.chrPos, self.startPos, self.stopPos] if self.strandPos is not None: poss.append(s...
python
def get_ordered_types(self): """ Returns the ordered list of data types :return: list of data types """ types = self.get_types() types_arr = np.array(types) poss = [self.chrPos, self.startPos, self.stopPos] if self.strandPos is not None: poss.append(s...
[ "def", "get_ordered_types", "(", "self", ")", ":", "types", "=", "self", ".", "get_types", "(", ")", "types_arr", "=", "np", ".", "array", "(", "types", ")", "poss", "=", "[", "self", ".", "chrPos", ",", "self", ".", "startPos", ",", "self", ".", "...
Returns the ordered list of data types :return: list of data types
[ "Returns", "the", "ordered", "list", "of", "data", "types" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/parsers/RegionParser.py#L212-L226
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.xmeans
def xmeans(cls, initial_centers=None, kmax=20, tolerance=0.025, criterion=splitting_type.BAYESIAN_INFORMATION_CRITERION, ccore=False): """ Constructor of the x-means clustering.rst algorithm :param initial_centers: Initial coordinates of centers of clusters that are represented by list: [center...
python
def xmeans(cls, initial_centers=None, kmax=20, tolerance=0.025, criterion=splitting_type.BAYESIAN_INFORMATION_CRITERION, ccore=False): """ Constructor of the x-means clustering.rst algorithm :param initial_centers: Initial coordinates of centers of clusters that are represented by list: [center...
[ "def", "xmeans", "(", "cls", ",", "initial_centers", "=", "None", ",", "kmax", "=", "20", ",", "tolerance", "=", "0.025", ",", "criterion", "=", "splitting_type", ".", "BAYESIAN_INFORMATION_CRITERION", ",", "ccore", "=", "False", ")", ":", "model", "=", "x...
Constructor of the x-means clustering.rst algorithm :param initial_centers: Initial coordinates of centers of clusters that are represented by list: [center1, center2, ...] Note: The dimensions of the initial centers should be same as of the dataset. :param kmax: Maximum number of clusters that...
[ "Constructor", "of", "the", "x", "-", "means", "clustering", ".", "rst", "algorithm" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L26-L39
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.clarans
def clarans(cls, number_clusters, num_local, max_neighbour): """ Constructor of the CLARANS clustering.rst algorithm :param number_clusters: the number of clusters to be allocated :param num_local: the number of local minima obtained (amount of iterations for solving the problem). ...
python
def clarans(cls, number_clusters, num_local, max_neighbour): """ Constructor of the CLARANS clustering.rst algorithm :param number_clusters: the number of clusters to be allocated :param num_local: the number of local minima obtained (amount of iterations for solving the problem). ...
[ "def", "clarans", "(", "cls", ",", "number_clusters", ",", "num_local", ",", "max_neighbour", ")", ":", "model", "=", "clarans", "(", "None", ",", "number_clusters", ",", "num_local", ",", "max_neighbour", ")", "return", "cls", "(", "model", ")" ]
Constructor of the CLARANS clustering.rst algorithm :param number_clusters: the number of clusters to be allocated :param num_local: the number of local minima obtained (amount of iterations for solving the problem). :param max_neighbour: the number of local minima obtained (amount of iteration...
[ "Constructor", "of", "the", "CLARANS", "clustering", ".", "rst", "algorithm" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L42-L52
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.rock
def rock(cls, data, eps, number_clusters, threshold=0.5, ccore=False): """ Constructor of the ROCK cluster analysis algorithm :param eps: Connectivity radius (similarity threshold), points are neighbors if distance between them is less than connectivity radius :param number_clusters: De...
python
def rock(cls, data, eps, number_clusters, threshold=0.5, ccore=False): """ Constructor of the ROCK cluster analysis algorithm :param eps: Connectivity radius (similarity threshold), points are neighbors if distance between them is less than connectivity radius :param number_clusters: De...
[ "def", "rock", "(", "cls", ",", "data", ",", "eps", ",", "number_clusters", ",", "threshold", "=", "0.5", ",", "ccore", "=", "False", ")", ":", "data", "=", "cls", ".", "input_preprocess", "(", "data", ")", "model", "=", "rock", "(", "data", ",", "...
Constructor of the ROCK cluster analysis algorithm :param eps: Connectivity radius (similarity threshold), points are neighbors if distance between them is less than connectivity radius :param number_clusters: Defines number of clusters that should be allocated from the input data set :param th...
[ "Constructor", "of", "the", "ROCK", "cluster", "analysis", "algorithm" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L55-L67
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.optics
def optics(cls, data, eps, minpts, ccore=False): """ Constructor of OPTICS clustering.rst algorithm :param data: Input data that is presented as a list of points (objects), where each point is represented by list or tuple :param eps: Connectivity radius between points, points may be con...
python
def optics(cls, data, eps, minpts, ccore=False): """ Constructor of OPTICS clustering.rst algorithm :param data: Input data that is presented as a list of points (objects), where each point is represented by list or tuple :param eps: Connectivity radius between points, points may be con...
[ "def", "optics", "(", "cls", ",", "data", ",", "eps", ",", "minpts", ",", "ccore", "=", "False", ")", ":", "data", "=", "cls", ".", "input_preprocess", "(", "data", ")", "model", "=", "optics", "(", "data", ",", "eps", ",", "minpts", ")", "return",...
Constructor of OPTICS clustering.rst algorithm :param data: Input data that is presented as a list of points (objects), where each point is represented by list or tuple :param eps: Connectivity radius between points, points may be connected if distance between them less than the radius :param m...
[ "Constructor", "of", "OPTICS", "clustering", ".", "rst", "algorithm" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L78-L93
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.is_pyclustering_instance
def is_pyclustering_instance(model): """ Checks if the clustering.rst algorithm belongs to pyclustering :param model: the clustering.rst algorithm model :return: the truth value (Boolean) """ return any(isinstance(model, i) for i in [xmeans, clarans, rock, optics])
python
def is_pyclustering_instance(model): """ Checks if the clustering.rst algorithm belongs to pyclustering :param model: the clustering.rst algorithm model :return: the truth value (Boolean) """ return any(isinstance(model, i) for i in [xmeans, clarans, rock, optics])
[ "def", "is_pyclustering_instance", "(", "model", ")", ":", "return", "any", "(", "isinstance", "(", "model", ",", "i", ")", "for", "i", "in", "[", "xmeans", ",", "clarans", ",", "rock", ",", "optics", "]", ")" ]
Checks if the clustering.rst algorithm belongs to pyclustering :param model: the clustering.rst algorithm model :return: the truth value (Boolean)
[ "Checks", "if", "the", "clustering", ".", "rst", "algorithm", "belongs", "to", "pyclustering" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L205-L212
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.fit
def fit(self, data=None): """ Performs clustering.rst :param data: Data to be fit :return: the clustering.rst object """ if self.is_pyclustering_instance(self.model): if isinstance(self.model, xmeans): data = self.input_preprocess(data) ...
python
def fit(self, data=None): """ Performs clustering.rst :param data: Data to be fit :return: the clustering.rst object """ if self.is_pyclustering_instance(self.model): if isinstance(self.model, xmeans): data = self.input_preprocess(data) ...
[ "def", "fit", "(", "self", ",", "data", "=", "None", ")", ":", "if", "self", ".", "is_pyclustering_instance", "(", "self", ".", "model", ")", ":", "if", "isinstance", "(", "self", ".", "model", ",", "xmeans", ")", ":", "data", "=", "self", ".", "in...
Performs clustering.rst :param data: Data to be fit :return: the clustering.rst object
[ "Performs", "clustering", ".", "rst" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L214-L232
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering._labels_from_pyclusters
def _labels_from_pyclusters(self): """ Computes and returns the list of labels indicating the data points and the corresponding cluster ids. :return: The list of labels """ clusters = self.model.get_clusters() labels = [] for i in range(0, len(clusters)): ...
python
def _labels_from_pyclusters(self): """ Computes and returns the list of labels indicating the data points and the corresponding cluster ids. :return: The list of labels """ clusters = self.model.get_clusters() labels = [] for i in range(0, len(clusters)): ...
[ "def", "_labels_from_pyclusters", "(", "self", ")", ":", "clusters", "=", "self", ".", "model", ".", "get_clusters", "(", ")", "labels", "=", "[", "]", "for", "i", "in", "range", "(", "0", ",", "len", "(", "clusters", ")", ")", ":", "for", "j", "in...
Computes and returns the list of labels indicating the data points and the corresponding cluster ids. :return: The list of labels
[ "Computes", "and", "returns", "the", "list", "of", "labels", "indicating", "the", "data", "points", "and", "the", "corresponding", "cluster", "ids", "." ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L235-L246
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.retrieve_cluster
def retrieve_cluster(self, df, cluster_no): """ Extracts the cluster at the given index from the input dataframe :param df: the dataframe that contains the clusters :param cluster_no: the cluster number :return: returns the extracted cluster """ if self.is_pyclus...
python
def retrieve_cluster(self, df, cluster_no): """ Extracts the cluster at the given index from the input dataframe :param df: the dataframe that contains the clusters :param cluster_no: the cluster number :return: returns the extracted cluster """ if self.is_pyclus...
[ "def", "retrieve_cluster", "(", "self", ",", "df", ",", "cluster_no", ")", ":", "if", "self", ".", "is_pyclustering_instance", "(", "self", ".", "model", ")", ":", "clusters", "=", "self", ".", "model", ".", "get_clusters", "(", ")", "mask", "=", "[", ...
Extracts the cluster at the given index from the input dataframe :param df: the dataframe that contains the clusters :param cluster_no: the cluster number :return: returns the extracted cluster
[ "Extracts", "the", "cluster", "at", "the", "given", "index", "from", "the", "input", "dataframe" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L248-L263
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.get_labels
def get_labels(obj): """ Retrieve the labels of a clustering.rst object :param obj: the clustering.rst object :return: the resulting labels """ if Clustering.is_pyclustering_instance(obj.model): return obj._labels_from_pyclusters else: ret...
python
def get_labels(obj): """ Retrieve the labels of a clustering.rst object :param obj: the clustering.rst object :return: the resulting labels """ if Clustering.is_pyclustering_instance(obj.model): return obj._labels_from_pyclusters else: ret...
[ "def", "get_labels", "(", "obj", ")", ":", "if", "Clustering", ".", "is_pyclustering_instance", "(", "obj", ".", "model", ")", ":", "return", "obj", ".", "_labels_from_pyclusters", "else", ":", "return", "obj", ".", "model", ".", "labels_" ]
Retrieve the labels of a clustering.rst object :param obj: the clustering.rst object :return: the resulting labels
[ "Retrieve", "the", "labels", "of", "a", "clustering", ".", "rst", "object" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L266-L276
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.silhouette_n_clusters
def silhouette_n_clusters(data, k_min, k_max, distance='euclidean'): """ Computes and plot the silhouette score vs number of clusters graph to help selecting the number of clusters visually :param data: The data object :param k_min: lowerbound of the cluster range :param k_max: ...
python
def silhouette_n_clusters(data, k_min, k_max, distance='euclidean'): """ Computes and plot the silhouette score vs number of clusters graph to help selecting the number of clusters visually :param data: The data object :param k_min: lowerbound of the cluster range :param k_max: ...
[ "def", "silhouette_n_clusters", "(", "data", ",", "k_min", ",", "k_max", ",", "distance", "=", "'euclidean'", ")", ":", "k_range", "=", "range", "(", "k_min", ",", "k_max", ")", "k_means_var", "=", "[", "Clustering", ".", "kmeans", "(", "k", ")", ".", ...
Computes and plot the silhouette score vs number of clusters graph to help selecting the number of clusters visually :param data: The data object :param k_min: lowerbound of the cluster range :param k_max: upperbound of the cluster range :param distance: the distance metric, 'euclidean'...
[ "Computes", "and", "plot", "the", "silhouette", "score", "vs", "number", "of", "clusters", "graph", "to", "help", "selecting", "the", "number", "of", "clusters", "visually" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L279-L303
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.elbow_method
def elbow_method(data, k_min, k_max, distance='euclidean'): """ Calculates and plots the plot of variance explained - number of clusters Implementation reference: https://github.com/sarguido/k-means-clustering.rst :param data: The dataset :param k_min: lowerbound of the cluster ...
python
def elbow_method(data, k_min, k_max, distance='euclidean'): """ Calculates and plots the plot of variance explained - number of clusters Implementation reference: https://github.com/sarguido/k-means-clustering.rst :param data: The dataset :param k_min: lowerbound of the cluster ...
[ "def", "elbow_method", "(", "data", ",", "k_min", ",", "k_max", ",", "distance", "=", "'euclidean'", ")", ":", "# Determine your k range", "k_range", "=", "range", "(", "k_min", ",", "k_max", ")", "# Fit the kmeans model for each n_clusters = k", "k_means_var", "=",...
Calculates and plots the plot of variance explained - number of clusters Implementation reference: https://github.com/sarguido/k-means-clustering.rst :param data: The dataset :param k_min: lowerbound of the cluster range :param k_max: upperbound of the cluster range :param dista...
[ "Calculates", "and", "plots", "the", "plot", "of", "variance", "explained", "-", "number", "of", "clusters", "Implementation", "reference", ":", "https", ":", "//", "github", ".", "com", "/", "sarguido", "/", "k", "-", "means", "-", "clustering", ".", "rst...
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L307-L350
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.adjusted_mutual_info
def adjusted_mutual_info(self, reference_clusters): """ Calculates the adjusted mutual information score w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: returns the value of the adjusted mutual information...
python
def adjusted_mutual_info(self, reference_clusters): """ Calculates the adjusted mutual information score w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: returns the value of the adjusted mutual information...
[ "def", "adjusted_mutual_info", "(", "self", ",", "reference_clusters", ")", ":", "return", "adjusted_mutual_info_score", "(", "self", ".", "get_labels", "(", "self", ")", ",", "self", ".", "get_labels", "(", "reference_clusters", ")", ")" ]
Calculates the adjusted mutual information score w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: returns the value of the adjusted mutual information score
[ "Calculates", "the", "adjusted", "mutual", "information", "score", "w", ".", "r", ".", "t", ".", "the", "reference", "clusters", "(", "explicit", "evaluation", ")" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L352-L359
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.adjusted_rand_score
def adjusted_rand_score(self, reference_clusters): """ Calculates the adjusted rand score w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: returns the value of the adjusted rand score """ re...
python
def adjusted_rand_score(self, reference_clusters): """ Calculates the adjusted rand score w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: returns the value of the adjusted rand score """ re...
[ "def", "adjusted_rand_score", "(", "self", ",", "reference_clusters", ")", ":", "return", "adjusted_rand_score", "(", "self", ".", "get_labels", "(", "self", ")", ",", "self", ".", "get_labels", "(", "reference_clusters", ")", ")" ]
Calculates the adjusted rand score w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: returns the value of the adjusted rand score
[ "Calculates", "the", "adjusted", "rand", "score", "w", ".", "r", ".", "t", ".", "the", "reference", "clusters", "(", "explicit", "evaluation", ")" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L361-L368
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.completeness_score
def completeness_score(self, reference_clusters): """ Calculates the completeness score w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: the resulting completeness score """ return completen...
python
def completeness_score(self, reference_clusters): """ Calculates the completeness score w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: the resulting completeness score """ return completen...
[ "def", "completeness_score", "(", "self", ",", "reference_clusters", ")", ":", "return", "completeness_score", "(", "self", ".", "get_labels", "(", "self", ")", ",", "self", ".", "get_labels", "(", "reference_clusters", ")", ")" ]
Calculates the completeness score w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: the resulting completeness score
[ "Calculates", "the", "completeness", "score", "w", ".", "r", ".", "t", ".", "the", "reference", "clusters", "(", "explicit", "evaluation", ")" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L379-L386
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.fowlkes_mallows
def fowlkes_mallows(self, reference_clusters): """ Calculates the Fowlkes-Mallows index (FMI) w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: The resulting Fowlkes-Mallows score. """ return...
python
def fowlkes_mallows(self, reference_clusters): """ Calculates the Fowlkes-Mallows index (FMI) w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: The resulting Fowlkes-Mallows score. """ return...
[ "def", "fowlkes_mallows", "(", "self", ",", "reference_clusters", ")", ":", "return", "fowlkes_mallows_score", "(", "self", ".", "get_labels", "(", "self", ")", ",", "self", ".", "get_labels", "(", "reference_clusters", ")", ")" ]
Calculates the Fowlkes-Mallows index (FMI) w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: The resulting Fowlkes-Mallows score.
[ "Calculates", "the", "Fowlkes", "-", "Mallows", "index", "(", "FMI", ")", "w", ".", "r", ".", "t", ".", "the", "reference", "clusters", "(", "explicit", "evaluation", ")" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L388-L395
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.homogeneity_score
def homogeneity_score(self, reference_clusters): """ Calculates the homogeneity score w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: The resulting homogeneity score. """ return homogeneity...
python
def homogeneity_score(self, reference_clusters): """ Calculates the homogeneity score w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: The resulting homogeneity score. """ return homogeneity...
[ "def", "homogeneity_score", "(", "self", ",", "reference_clusters", ")", ":", "return", "homogeneity_score", "(", "self", ".", "get_labels", "(", "self", ")", ",", "self", ".", "get_labels", "(", "reference_clusters", ")", ")" ]
Calculates the homogeneity score w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: The resulting homogeneity score.
[ "Calculates", "the", "homogeneity", "score", "w", ".", "r", ".", "t", ".", "the", "reference", "clusters", "(", "explicit", "evaluation", ")" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L397-L404
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.mutual_info_score
def mutual_info_score(self, reference_clusters): """ Calculates the MI (mutual information) w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: The resulting MI score. """ return mutual_info_sc...
python
def mutual_info_score(self, reference_clusters): """ Calculates the MI (mutual information) w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: The resulting MI score. """ return mutual_info_sc...
[ "def", "mutual_info_score", "(", "self", ",", "reference_clusters", ")", ":", "return", "mutual_info_score", "(", "self", ".", "get_labels", "(", "self", ")", ",", "self", ".", "get_labels", "(", "reference_clusters", ")", ")" ]
Calculates the MI (mutual information) w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: The resulting MI score.
[ "Calculates", "the", "MI", "(", "mutual", "information", ")", "w", ".", "r", ".", "t", ".", "the", "reference", "clusters", "(", "explicit", "evaluation", ")" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L406-L413
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.normalized_mutual_info_score
def normalized_mutual_info_score(self, reference_clusters): """ Calculates the normalized mutual information w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: The resulting normalized mutual information scor...
python
def normalized_mutual_info_score(self, reference_clusters): """ Calculates the normalized mutual information w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: The resulting normalized mutual information scor...
[ "def", "normalized_mutual_info_score", "(", "self", ",", "reference_clusters", ")", ":", "return", "normalized_mutual_info_score", "(", "self", ".", "get_labels", "(", "self", ")", ",", "self", ".", "get_labels", "(", "reference_clusters", ")", ")" ]
Calculates the normalized mutual information w.r.t. the reference clusters (explicit evaluation) :param reference_clusters: Clusters that are to be used as reference :return: The resulting normalized mutual information score.
[ "Calculates", "the", "normalized", "mutual", "information", "w", ".", "r", ".", "t", ".", "the", "reference", "clusters", "(", "explicit", "evaluation", ")" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L415-L422
DEIB-GECO/PyGMQL
gmql/ml/algorithms/clustering.py
Clustering.silhouette_score
def silhouette_score(self, data, metric='euclidean', sample_size=None, random_state=None, **kwds): """ Computes the mean Silhouette Coefficient of all samples (implicit evaluation) :param data: The data that the clusters are generated from :param metric: the pairwise distance metric ...
python
def silhouette_score(self, data, metric='euclidean', sample_size=None, random_state=None, **kwds): """ Computes the mean Silhouette Coefficient of all samples (implicit evaluation) :param data: The data that the clusters are generated from :param metric: the pairwise distance metric ...
[ "def", "silhouette_score", "(", "self", ",", "data", ",", "metric", "=", "'euclidean'", ",", "sample_size", "=", "None", ",", "random_state", "=", "None", ",", "*", "*", "kwds", ")", ":", "return", "silhouette_score", "(", "data", ",", "self", ".", "get_...
Computes the mean Silhouette Coefficient of all samples (implicit evaluation) :param data: The data that the clusters are generated from :param metric: the pairwise distance metric :param sample_size: the size of the sample to use computing the Silhouette Coefficient :param random_state...
[ "Computes", "the", "mean", "Silhouette", "Coefficient", "of", "all", "samples", "(", "implicit", "evaluation", ")" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/clustering.py#L424-L435
DEIB-GECO/PyGMQL
gmql/dataset/loaders/Materializations.py
materialize
def materialize(datasets): """ Multiple materializations. Enables the user to specify a set of GMQLDataset to be materialized. The engine will perform all the materializations at the same time, if an output path is provided, while will perform each operation separately if the output_path is not specified. ...
python
def materialize(datasets): """ Multiple materializations. Enables the user to specify a set of GMQLDataset to be materialized. The engine will perform all the materializations at the same time, if an output path is provided, while will perform each operation separately if the output_path is not specified. ...
[ "def", "materialize", "(", "datasets", ")", ":", "from", ".", ".", "import", "GMQLDataset", "if", "isinstance", "(", "datasets", ",", "dict", ")", ":", "result", "=", "dict", "(", ")", "for", "output_path", "in", "datasets", ".", "keys", "(", ")", ":",...
Multiple materializations. Enables the user to specify a set of GMQLDataset to be materialized. The engine will perform all the materializations at the same time, if an output path is provided, while will perform each operation separately if the output_path is not specified. :param datasets: it can be a li...
[ "Multiple", "materializations", ".", "Enables", "the", "user", "to", "specify", "a", "set", "of", "GMQLDataset", "to", "be", "materialized", ".", "The", "engine", "will", "perform", "all", "the", "materializations", "at", "the", "same", "time", "if", "an", "...
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/loaders/Materializations.py#L9-L38
DEIB-GECO/PyGMQL
gmql/ml/algorithms/biclustering.py
Biclustering.retrieve_bicluster
def retrieve_bicluster(self, df, row_no, column_no): """ Extracts the bicluster at the given row bicluster number and the column bicluster number from the input dataframe. :param df: the input dataframe whose values were biclustered :param row_no: the number of the row bicluster ...
python
def retrieve_bicluster(self, df, row_no, column_no): """ Extracts the bicluster at the given row bicluster number and the column bicluster number from the input dataframe. :param df: the input dataframe whose values were biclustered :param row_no: the number of the row bicluster ...
[ "def", "retrieve_bicluster", "(", "self", ",", "df", ",", "row_no", ",", "column_no", ")", ":", "res", "=", "df", "[", "self", ".", "model", ".", "biclusters_", "[", "0", "]", "[", "row_no", "]", "]", "bicluster", "=", "res", "[", "res", ".", "colu...
Extracts the bicluster at the given row bicluster number and the column bicluster number from the input dataframe. :param df: the input dataframe whose values were biclustered :param row_no: the number of the row bicluster :param column_no: the number of the column bicluster :return: th...
[ "Extracts", "the", "bicluster", "at", "the", "given", "row", "bicluster", "number", "and", "the", "column", "bicluster", "number", "from", "the", "input", "dataframe", "." ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/biclustering.py#L50-L61
DEIB-GECO/PyGMQL
gmql/ml/algorithms/biclustering.py
Biclustering.bicluster_similarity
def bicluster_similarity(self, reference_model): """ Calculates the similarity between the current model of biclusters and the reference model of biclusters :param reference_model: The reference model of biclusters :return: Returns the consensus score(Hochreiter et. al., 2010), i.e. the...
python
def bicluster_similarity(self, reference_model): """ Calculates the similarity between the current model of biclusters and the reference model of biclusters :param reference_model: The reference model of biclusters :return: Returns the consensus score(Hochreiter et. al., 2010), i.e. the...
[ "def", "bicluster_similarity", "(", "self", ",", "reference_model", ")", ":", "similarity_score", "=", "consensus_score", "(", "self", ".", "model", ".", "biclusters_", ",", "reference_model", ".", "biclusters_", ")", "return", "similarity_score" ]
Calculates the similarity between the current model of biclusters and the reference model of biclusters :param reference_model: The reference model of biclusters :return: Returns the consensus score(Hochreiter et. al., 2010), i.e. the similarity of two sets of biclusters.
[ "Calculates", "the", "similarity", "between", "the", "current", "model", "of", "biclusters", "and", "the", "reference", "model", "of", "biclusters" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/biclustering.py#L63-L71
DEIB-GECO/PyGMQL
gmql/ml/multi_ref_model.py
MultiRefModel.load
def load(self, path, genes_uuid, regs=['chr', 'left', 'right', 'strand'], meta=[], values=[], full_load=False): """ Loads the multi referenced mapped data from the file system :param path: The path to the files :param genes_uuid: The unique identifier metadata column name to sep...
python
def load(self, path, genes_uuid, regs=['chr', 'left', 'right', 'strand'], meta=[], values=[], full_load=False): """ Loads the multi referenced mapped data from the file system :param path: The path to the files :param genes_uuid: The unique identifier metadata column name to sep...
[ "def", "load", "(", "self", ",", "path", ",", "genes_uuid", ",", "regs", "=", "[", "'chr'", ",", "'left'", ",", "'right'", ",", "'strand'", "]", ",", "meta", "=", "[", "]", ",", "values", "=", "[", "]", ",", "full_load", "=", "False", ")", ":", ...
Loads the multi referenced mapped data from the file system :param path: The path to the files :param genes_uuid: The unique identifier metadata column name to separate the data by the number of references :param regs: The region data that are to be analyzed :param meta: The met...
[ "Loads", "the", "multi", "referenced", "mapped", "data", "from", "the", "file", "system", ":", "param", "path", ":", "The", "path", "to", "the", "files", ":", "param", "genes_uuid", ":", "The", "unique", "identifier", "metadata", "column", "name", "to", "s...
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/multi_ref_model.py#L21-L55
DEIB-GECO/PyGMQL
gmql/ml/multi_ref_model.py
MultiRefModel.merge
def merge(self, samples_uuid): """ The method to merge the datamodels belonging to different references :param samples_uuid: The unique identifier metadata column name to identify the identical samples having different references :return: Returns the merged dataframe """ ...
python
def merge(self, samples_uuid): """ The method to merge the datamodels belonging to different references :param samples_uuid: The unique identifier metadata column name to identify the identical samples having different references :return: Returns the merged dataframe """ ...
[ "def", "merge", "(", "self", ",", "samples_uuid", ")", ":", "all_meta_data", "=", "pd", ".", "DataFrame", "(", ")", "for", "dm", "in", "self", ".", "data_model", ":", "all_meta_data", "=", "pd", ".", "concat", "(", "[", "all_meta_data", ",", "dm", ".",...
The method to merge the datamodels belonging to different references :param samples_uuid: The unique identifier metadata column name to identify the identical samples having different references :return: Returns the merged dataframe
[ "The", "method", "to", "merge", "the", "datamodels", "belonging", "to", "different", "references" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/multi_ref_model.py#L57-L91
DEIB-GECO/PyGMQL
gmql/ml/multi_ref_model.py
MultiRefModel.compact_view
def compact_view(self, merged_data, selected_meta, reference_no): """ Creates and returns the compact view where the index of the dataframe is a multi index of the selected metadata. Side effect: Alters the merged_data parameter :param merged_data: The merged data that is to be used to ...
python
def compact_view(self, merged_data, selected_meta, reference_no): """ Creates and returns the compact view where the index of the dataframe is a multi index of the selected metadata. Side effect: Alters the merged_data parameter :param merged_data: The merged data that is to be used to ...
[ "def", "compact_view", "(", "self", ",", "merged_data", ",", "selected_meta", ",", "reference_no", ")", ":", "meta_names", "=", "list", "(", "selected_meta", ")", "meta_index", "=", "[", "]", "for", "x", "in", "meta_names", ":", "meta_index", ".", "append", ...
Creates and returns the compact view where the index of the dataframe is a multi index of the selected metadata. Side effect: Alters the merged_data parameter :param merged_data: The merged data that is to be used to create the compact view :param selected_meta: The selected metadata to create ...
[ "Creates", "and", "returns", "the", "compact", "view", "where", "the", "index", "of", "the", "dataframe", "is", "a", "multi", "index", "of", "the", "selected", "metadata", ".", "Side", "effect", ":", "Alters", "the", "merged_data", "parameter" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/multi_ref_model.py#L93-L112
DEIB-GECO/PyGMQL
gmql/ml/algorithms/preprocessing.py
Preprocessing.prune_by_missing_percent
def prune_by_missing_percent(df, percentage=0.4): """ The method to remove the attributes (genes) with more than a percentage of missing values :param df: the dataframe containing the attributes to be pruned :param percentage: the percentage threshold (0.4 by default) :return: t...
python
def prune_by_missing_percent(df, percentage=0.4): """ The method to remove the attributes (genes) with more than a percentage of missing values :param df: the dataframe containing the attributes to be pruned :param percentage: the percentage threshold (0.4 by default) :return: t...
[ "def", "prune_by_missing_percent", "(", "df", ",", "percentage", "=", "0.4", ")", ":", "mask", "=", "(", "df", ".", "isnull", "(", ")", ".", "sum", "(", ")", "/", "df", ".", "shape", "[", "0", "]", ")", ".", "map", "(", "lambda", "x", ":", "Tru...
The method to remove the attributes (genes) with more than a percentage of missing values :param df: the dataframe containing the attributes to be pruned :param percentage: the percentage threshold (0.4 by default) :return: the pruned dataframe
[ "The", "method", "to", "remove", "the", "attributes", "(", "genes", ")", "with", "more", "than", "a", "percentage", "of", "missing", "values" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/preprocessing.py#L36-L46
DEIB-GECO/PyGMQL
gmql/ml/algorithms/preprocessing.py
Preprocessing.impute_using_statistics
def impute_using_statistics(df, method='min'): """ Imputes the missing values by the selected statistical property of each column :param df: The input dataframe that contains missing values :param method: The imputation method (min by default) "zero": fill missing entries wi...
python
def impute_using_statistics(df, method='min'): """ Imputes the missing values by the selected statistical property of each column :param df: The input dataframe that contains missing values :param method: The imputation method (min by default) "zero": fill missing entries wi...
[ "def", "impute_using_statistics", "(", "df", ",", "method", "=", "'min'", ")", ":", "sf", "=", "SimpleFill", "(", "method", ")", "imputed_matrix", "=", "sf", ".", "complete", "(", "df", ".", "values", ")", "imputed_df", "=", "pd", ".", "DataFrame", "(", ...
Imputes the missing values by the selected statistical property of each column :param df: The input dataframe that contains missing values :param method: The imputation method (min by default) "zero": fill missing entries with zeros "mean": fill with column means "me...
[ "Imputes", "the", "missing", "values", "by", "the", "selected", "statistical", "property", "of", "each", "column" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/preprocessing.py#L49-L65
DEIB-GECO/PyGMQL
gmql/ml/algorithms/preprocessing.py
Preprocessing.impute_knn
def impute_knn(df, k=3): """ Nearest neighbour imputations which weights samples using the mean squared difference on features for which two rows both have observed data. :param df: The input dataframe that contains missing values :param k: The number of neighbours :return: the ...
python
def impute_knn(df, k=3): """ Nearest neighbour imputations which weights samples using the mean squared difference on features for which two rows both have observed data. :param df: The input dataframe that contains missing values :param k: The number of neighbours :return: the ...
[ "def", "impute_knn", "(", "df", ",", "k", "=", "3", ")", ":", "imputed_matrix", "=", "KNN", "(", "k", "=", "k", ")", ".", "complete", "(", "df", ".", "values", ")", "imputed_df", "=", "pd", ".", "DataFrame", "(", "imputed_matrix", ",", "df", ".", ...
Nearest neighbour imputations which weights samples using the mean squared difference on features for which two rows both have observed data. :param df: The input dataframe that contains missing values :param k: The number of neighbours :return: the imputed dataframe
[ "Nearest", "neighbour", "imputations", "which", "weights", "samples", "using", "the", "mean", "squared", "difference", "on", "features", "for", "which", "two", "rows", "both", "have", "observed", "data", "." ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/preprocessing.py#L68-L78
DEIB-GECO/PyGMQL
gmql/ml/algorithms/preprocessing.py
Preprocessing.impute_svd
def impute_svd(df, rank=10, convergence_threshold=0.00001, max_iters=200): """ Imputes the missing values by using SVD decomposition Based on the following publication: 'Missing value estimation methods for DNA microarrays' by Troyanskaya et. al. :param df:The input dataframe that conta...
python
def impute_svd(df, rank=10, convergence_threshold=0.00001, max_iters=200): """ Imputes the missing values by using SVD decomposition Based on the following publication: 'Missing value estimation methods for DNA microarrays' by Troyanskaya et. al. :param df:The input dataframe that conta...
[ "def", "impute_svd", "(", "df", ",", "rank", "=", "10", ",", "convergence_threshold", "=", "0.00001", ",", "max_iters", "=", "200", ")", ":", "imputed_matrix", "=", "IterativeSVD", "(", "rank", ",", "convergence_threshold", ",", "max_iters", ")", ".", "compl...
Imputes the missing values by using SVD decomposition Based on the following publication: 'Missing value estimation methods for DNA microarrays' by Troyanskaya et. al. :param df:The input dataframe that contains missing values :param rank: Rank value of the truncated SVD :param converge...
[ "Imputes", "the", "missing", "values", "by", "using", "SVD", "decomposition", "Based", "on", "the", "following", "publication", ":", "Missing", "value", "estimation", "methods", "for", "DNA", "microarrays", "by", "Troyanskaya", "et", ".", "al", "." ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/preprocessing.py#L81-L94
DEIB-GECO/PyGMQL
gmql/ml/algorithms/preprocessing.py
Preprocessing.feature_selection
def feature_selection(df, labels, n_features, method='chi2'): """ Reduces the number of features in the imput dataframe. Ex: labels = gs.meta['biospecimen_sample__sample_type_id'].apply(int).apply(lambda x: 0 if x < 10 else 1) chi2_fs(gs.data, labels, 50) :param df: The inpu...
python
def feature_selection(df, labels, n_features, method='chi2'): """ Reduces the number of features in the imput dataframe. Ex: labels = gs.meta['biospecimen_sample__sample_type_id'].apply(int).apply(lambda x: 0 if x < 10 else 1) chi2_fs(gs.data, labels, 50) :param df: The inpu...
[ "def", "feature_selection", "(", "df", ",", "labels", ",", "n_features", ",", "method", "=", "'chi2'", ")", ":", "fs_obj", "=", "None", "if", "method", "==", "'chi2'", ":", "fs_obj", "=", "chi2", "elif", "method", "==", "'ANOVA'", ":", "fs_obj", "=", "...
Reduces the number of features in the imput dataframe. Ex: labels = gs.meta['biospecimen_sample__sample_type_id'].apply(int).apply(lambda x: 0 if x < 10 else 1) chi2_fs(gs.data, labels, 50) :param df: The input dataframe :param labels: Labels for each row in the df. Type: Pandas.Ser...
[ "Reduces", "the", "number", "of", "features", "in", "the", "imput", "dataframe", ".", "Ex", ":", "labels", "=", "gs", ".", "meta", "[", "biospecimen_sample__sample_type_id", "]", ".", "apply", "(", "int", ")", ".", "apply", "(", "lambda", "x", ":", "0", ...
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/algorithms/preprocessing.py#L97-L125
DEIB-GECO/PyGMQL
gmql/configuration.py
Configuration.set_spark_conf
def set_spark_conf(self, key=None, value=None, d=None): """ Sets a spark property as a ('key', 'value') pair of using a dictionary {'key': 'value', ...} :param key: string :param value: string :param d: dictionary :return: None """ if isinstance(d, dict):...
python
def set_spark_conf(self, key=None, value=None, d=None): """ Sets a spark property as a ('key', 'value') pair of using a dictionary {'key': 'value', ...} :param key: string :param value: string :param d: dictionary :return: None """ if isinstance(d, dict):...
[ "def", "set_spark_conf", "(", "self", ",", "key", "=", "None", ",", "value", "=", "None", ",", "d", "=", "None", ")", ":", "if", "isinstance", "(", "d", ",", "dict", ")", ":", "self", ".", "_properties", ".", "update", "(", "d", ")", "elif", "isi...
Sets a spark property as a ('key', 'value') pair of using a dictionary {'key': 'value', ...} :param key: string :param value: string :param d: dictionary :return: None
[ "Sets", "a", "spark", "property", "as", "a", "(", "key", "value", ")", "pair", "of", "using", "a", "dictionary", "{", "key", ":", "value", "...", "}" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/configuration.py#L39-L53
DEIB-GECO/PyGMQL
gmql/configuration.py
Configuration.set_system_conf
def set_system_conf(self, key=None, value=None, d=None): """ Sets a java system property as a ('key', 'value') pair of using a dictionary {'key': 'value', ...} :param key: string :param value: string :param d: dictionary :return: None """ if isinstance(d,...
python
def set_system_conf(self, key=None, value=None, d=None): """ Sets a java system property as a ('key', 'value') pair of using a dictionary {'key': 'value', ...} :param key: string :param value: string :param d: dictionary :return: None """ if isinstance(d,...
[ "def", "set_system_conf", "(", "self", ",", "key", "=", "None", ",", "value", "=", "None", ",", "d", "=", "None", ")", ":", "if", "isinstance", "(", "d", ",", "dict", ")", ":", "self", ".", "_system", ".", "update", "(", "d", ")", "elif", "isinst...
Sets a java system property as a ('key', 'value') pair of using a dictionary {'key': 'value', ...} :param key: string :param value: string :param d: dictionary :return: None
[ "Sets", "a", "java", "system", "property", "as", "a", "(", "key", "value", ")", "pair", "of", "using", "a", "dictionary", "{", "key", ":", "value", "...", "}" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/configuration.py#L55-L69
DEIB-GECO/PyGMQL
gmql/dataset/DataStructures/MetaField.py
MetaField.isin
def isin(self, values): """ Selects the samples having the metadata attribute between the values provided as input :param values: a list of elements :return a new complex condition """ if not isinstance(values, list): raise TypeError("Input should be a string...
python
def isin(self, values): """ Selects the samples having the metadata attribute between the values provided as input :param values: a list of elements :return a new complex condition """ if not isinstance(values, list): raise TypeError("Input should be a string...
[ "def", "isin", "(", "self", ",", "values", ")", ":", "if", "not", "isinstance", "(", "values", ",", "list", ")", ":", "raise", "TypeError", "(", "\"Input should be a string. {} was provided\"", ".", "format", "(", "type", "(", "values", ")", ")", ")", "if"...
Selects the samples having the metadata attribute between the values provided as input :param values: a list of elements :return a new complex condition
[ "Selects", "the", "samples", "having", "the", "metadata", "attribute", "between", "the", "values", "provided", "as", "input" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/DataStructures/MetaField.py#L75-L95
PragmaticMates/django-flatpages-i18n
flatpages_i18n/templatetags/flatpages_i18n.py
get_flatpages_i18n
def get_flatpages_i18n(parser, token): """ Retrieves all flatpage objects available for the current site and visible to the specific user (or visible to all users if no user is specified). Populates the template context with them in a variable whose name is defined by the ``as`` clause. An opti...
python
def get_flatpages_i18n(parser, token): """ Retrieves all flatpage objects available for the current site and visible to the specific user (or visible to all users if no user is specified). Populates the template context with them in a variable whose name is defined by the ``as`` clause. An opti...
[ "def", "get_flatpages_i18n", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "split_contents", "(", ")", "syntax_message", "=", "(", "\"%(tag_name)s expects a syntax of %(tag_name)s \"", "\"['url_starts_with'] [for user] as context_name\"", "%", "dict", ...
Retrieves all flatpage objects available for the current site and visible to the specific user (or visible to all users if no user is specified). Populates the template context with them in a variable whose name is defined by the ``as`` clause. An optional ``for`` clause can be used to control the user...
[ "Retrieves", "all", "flatpage", "objects", "available", "for", "the", "current", "site", "and", "visible", "to", "the", "specific", "user", "(", "or", "visible", "to", "all", "users", "if", "no", "user", "is", "specified", ")", ".", "Populates", "the", "te...
train
https://github.com/PragmaticMates/django-flatpages-i18n/blob/2d3ed45c14fb0c7fd6ff5263c84f501c6a0c3e9a/flatpages_i18n/templatetags/flatpages_i18n.py#L72-L139
kevinconway/daemons
daemons/daemonize/simple.py
SimpleDaemonizeManager.daemonize
def daemonize(self): """Double fork and set the pid.""" self._double_fork() # Write pidfile. self.pid = os.getpid() LOG.info( "Succesfully daemonized process {0}.".format(self.pid) )
python
def daemonize(self): """Double fork and set the pid.""" self._double_fork() # Write pidfile. self.pid = os.getpid() LOG.info( "Succesfully daemonized process {0}.".format(self.pid) )
[ "def", "daemonize", "(", "self", ")", ":", "self", ".", "_double_fork", "(", ")", "# Write pidfile.", "self", ".", "pid", "=", "os", ".", "getpid", "(", ")", "LOG", ".", "info", "(", "\"Succesfully daemonized process {0}.\"", ".", "format", "(", "self", "....
Double fork and set the pid.
[ "Double", "fork", "and", "set", "the", "pid", "." ]
train
https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/daemonize/simple.py#L22-L31
kevinconway/daemons
daemons/daemonize/simple.py
SimpleDaemonizeManager._double_fork
def _double_fork(self): """Do the UNIX double-fork magic. See Stevens' "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 """ try: pid = os.fork() if pid > 0: ...
python
def _double_fork(self): """Do the UNIX double-fork magic. See Stevens' "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 """ try: pid = os.fork() if pid > 0: ...
[ "def", "_double_fork", "(", "self", ")", ":", "try", ":", "pid", "=", "os", ".", "fork", "(", ")", "if", "pid", ">", "0", ":", "# Exit first parent.", "sys", ".", "exit", "(", "0", ")", "return", "None", "except", "OSError", "as", "err", ":", "LOG"...
Do the UNIX double-fork magic. See Stevens' "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16
[ "Do", "the", "UNIX", "double", "-", "fork", "magic", "." ]
train
https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/daemonize/simple.py#L33-L83
DEIB-GECO/PyGMQL
gmql/ml/genometric_space.py
GenometricSpace.from_memory
def from_memory(cls, data, meta): """ Overloaded constructor to create the GenometricSpace object from memory data and meta variables. The indexes of the data and meta dataframes should be the same. :param data: The data model :param meta: The metadata :return: A Genome...
python
def from_memory(cls, data, meta): """ Overloaded constructor to create the GenometricSpace object from memory data and meta variables. The indexes of the data and meta dataframes should be the same. :param data: The data model :param meta: The metadata :return: A Genome...
[ "def", "from_memory", "(", "cls", ",", "data", ",", "meta", ")", ":", "obj", "=", "cls", "(", ")", "obj", ".", "data", "=", "data", "obj", ".", "meta", "=", "meta", "return", "obj" ]
Overloaded constructor to create the GenometricSpace object from memory data and meta variables. The indexes of the data and meta dataframes should be the same. :param data: The data model :param meta: The metadata :return: A GenometricSpace object
[ "Overloaded", "constructor", "to", "create", "the", "GenometricSpace", "object", "from", "memory", "data", "and", "meta", "variables", ".", "The", "indexes", "of", "the", "data", "and", "meta", "dataframes", "should", "be", "the", "same", "." ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/genometric_space.py#L27-L41
DEIB-GECO/PyGMQL
gmql/ml/genometric_space.py
GenometricSpace.load
def load(self, _path, regs=['chr', 'left', 'right', 'strand'], meta=[], values=[], full_load=False, file_extension="gdm"): """Parses and loads the data into instance attributes. The indexes of the data and meta dataframes should be the same. :param path: The path to the dataset on the filesyste...
python
def load(self, _path, regs=['chr', 'left', 'right', 'strand'], meta=[], values=[], full_load=False, file_extension="gdm"): """Parses and loads the data into instance attributes. The indexes of the data and meta dataframes should be the same. :param path: The path to the dataset on the filesyste...
[ "def", "load", "(", "self", ",", "_path", ",", "regs", "=", "[", "'chr'", ",", "'left'", ",", "'right'", ",", "'strand'", "]", ",", "meta", "=", "[", "]", ",", "values", "=", "[", "]", ",", "full_load", "=", "False", ",", "file_extension", "=", "...
Parses and loads the data into instance attributes. The indexes of the data and meta dataframes should be the same. :param path: The path to the dataset on the filesystem :param regs: the regions that are to be analyzed :param meta: the meta-data that are to be analyzed :param v...
[ "Parses", "and", "loads", "the", "data", "into", "instance", "attributes", ".", "The", "indexes", "of", "the", "data", "and", "meta", "dataframes", "should", "be", "the", "same", "." ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/genometric_space.py#L43-L64
DEIB-GECO/PyGMQL
gmql/ml/genometric_space.py
GenometricSpace.set_meta
def set_meta(self, selected_meta): """Sets one axis of the 2D multi-indexed dataframe index to the selected meta data. :param selected_meta: The list of the metadata users want to index with. """ meta_names = list(selected_meta) meta_names.append('sample') m...
python
def set_meta(self, selected_meta): """Sets one axis of the 2D multi-indexed dataframe index to the selected meta data. :param selected_meta: The list of the metadata users want to index with. """ meta_names = list(selected_meta) meta_names.append('sample') m...
[ "def", "set_meta", "(", "self", ",", "selected_meta", ")", ":", "meta_names", "=", "list", "(", "selected_meta", ")", "meta_names", ".", "append", "(", "'sample'", ")", "meta_index", "=", "[", "]", "# To set the index for existing samples in the region dataframe.", ...
Sets one axis of the 2D multi-indexed dataframe index to the selected meta data. :param selected_meta: The list of the metadata users want to index with.
[ "Sets", "one", "axis", "of", "the", "2D", "multi", "-", "indexed", "dataframe", "index", "to", "the", "selected", "meta", "data", "." ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/genometric_space.py#L66-L84
DEIB-GECO/PyGMQL
gmql/ml/genometric_space.py
GenometricSpace.to_matrix
def to_matrix(self, values, selected_regions, default_value=0): """Creates a 2D multi-indexed matrix representation of the data. This representation allows the data to be sent to the machine learning algorithms. Args: :param values: The value or values that are going to fill the...
python
def to_matrix(self, values, selected_regions, default_value=0): """Creates a 2D multi-indexed matrix representation of the data. This representation allows the data to be sent to the machine learning algorithms. Args: :param values: The value or values that are going to fill the...
[ "def", "to_matrix", "(", "self", ",", "values", ",", "selected_regions", ",", "default_value", "=", "0", ")", ":", "if", "isinstance", "(", "values", ",", "list", ")", ":", "for", "v", "in", "values", ":", "try", ":", "self", ".", "data", "[", "v", ...
Creates a 2D multi-indexed matrix representation of the data. This representation allows the data to be sent to the machine learning algorithms. Args: :param values: The value or values that are going to fill the matrix. :param selected_regions: The index to one axis of the ...
[ "Creates", "a", "2D", "multi", "-", "indexed", "matrix", "representation", "of", "the", "data", ".", "This", "representation", "allows", "the", "data", "to", "be", "sent", "to", "the", "machine", "learning", "algorithms", "." ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/genometric_space.py#L86-L108
DEIB-GECO/PyGMQL
gmql/ml/genometric_space.py
GenometricSpace.get_values
def get_values(self, set, selected_meta): """ Retrieves the selected metadata values of the given set :param set: cluster that contains the data :param selected_meta: the values of the selected_meta :return: the values of the selected meta of the cluster """ warn...
python
def get_values(self, set, selected_meta): """ Retrieves the selected metadata values of the given set :param set: cluster that contains the data :param selected_meta: the values of the selected_meta :return: the values of the selected meta of the cluster """ warn...
[ "def", "get_values", "(", "self", ",", "set", ",", "selected_meta", ")", ":", "warnings", ".", "warn", "(", "\"\\n\\nThis method assumes that the last level of the index is the sample_id.\\n\"", "\"In case of single index, the index itself should be the sample_id\"", ")", "sample_i...
Retrieves the selected metadata values of the given set :param set: cluster that contains the data :param selected_meta: the values of the selected_meta :return: the values of the selected meta of the cluster
[ "Retrieves", "the", "selected", "metadata", "values", "of", "the", "given", "set" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/genometric_space.py#L110-L128
DEIB-GECO/PyGMQL
gmql/ml/genometric_space.py
GenometricSpace.group_statistics
def group_statistics(self, group, selected_meta, stat_code='mean'): """ Provides statistics of a group based on the meta data selected. :param group:The result of a classification or clustering.rst or biclustering algorithm :param selected_meta: The metadata that we are interested in ...
python
def group_statistics(self, group, selected_meta, stat_code='mean'): """ Provides statistics of a group based on the meta data selected. :param group:The result of a classification or clustering.rst or biclustering algorithm :param selected_meta: The metadata that we are interested in ...
[ "def", "group_statistics", "(", "self", ",", "group", ",", "selected_meta", ",", "stat_code", "=", "'mean'", ")", ":", "values", "=", "self", ".", "get_values", "(", "group", ",", "selected_meta", ")", "if", "stat_code", "==", "'mean'", ":", "res", "=", ...
Provides statistics of a group based on the meta data selected. :param group:The result of a classification or clustering.rst or biclustering algorithm :param selected_meta: The metadata that we are interested in :param stat_code: 'mean' for mean or 'variance' for variance or 'std' for standard...
[ "Provides", "statistics", "of", "a", "group", "based", "on", "the", "meta", "data", "selected", "." ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/genometric_space.py#L130-L146
DEIB-GECO/PyGMQL
gmql/ml/genometric_space.py
GenometricSpace.to_bag_of_genomes
def to_bag_of_genomes(self, clustering_object): """ Creates a bag of genomes representation for data mining purposes Each document (genome) in the representation is a set of metadata key and value pairs belonging to the same cluster. The bag of genomes are saved under ./bag_of_genomes/ d...
python
def to_bag_of_genomes(self, clustering_object): """ Creates a bag of genomes representation for data mining purposes Each document (genome) in the representation is a set of metadata key and value pairs belonging to the same cluster. The bag of genomes are saved under ./bag_of_genomes/ d...
[ "def", "to_bag_of_genomes", "(", "self", ",", "clustering_object", ")", ":", "meta_files", "=", "Parser", ".", "_get_files", "(", "'meta'", ",", "self", ".", "_path", ")", "meta_dict", "=", "{", "}", "for", "f", "in", "meta_files", ":", "meta_dict", "[", ...
Creates a bag of genomes representation for data mining purposes Each document (genome) in the representation is a set of metadata key and value pairs belonging to the same cluster. The bag of genomes are saved under ./bag_of_genomes/ directory :param clustering_object: The clustering.rst objec...
[ "Creates", "a", "bag", "of", "genomes", "representation", "for", "data", "mining", "purposes", "Each", "document", "(", "genome", ")", "in", "the", "representation", "is", "a", "set", "of", "metadata", "key", "and", "value", "pairs", "belonging", "to", "the"...
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/genometric_space.py#L148-L188
DEIB-GECO/PyGMQL
gmql/ml/genometric_space.py
GenometricSpace.to_term_document_matrix
def to_term_document_matrix(path_to_bag_of_genomes, max_df=0.99, min_df=1, use_idf=False): """ Creates a term-document matrix which is a mathematical matrix that describes the frequency of terms that occur in a collection of documents (in our case a collection of genomes). :param path_t...
python
def to_term_document_matrix(path_to_bag_of_genomes, max_df=0.99, min_df=1, use_idf=False): """ Creates a term-document matrix which is a mathematical matrix that describes the frequency of terms that occur in a collection of documents (in our case a collection of genomes). :param path_t...
[ "def", "to_term_document_matrix", "(", "path_to_bag_of_genomes", ",", "max_df", "=", "0.99", ",", "min_df", "=", "1", ",", "use_idf", "=", "False", ")", ":", "token_dict", "=", "{", "}", "def", "BoG_tokenizer", "(", "_text", ")", ":", "return", "_text", "....
Creates a term-document matrix which is a mathematical matrix that describes the frequency of terms that occur in a collection of documents (in our case a collection of genomes). :param path_to_bag_of_genomes: Path to the documents (genomes) :param max_df: To prune the terms that are existing i...
[ "Creates", "a", "term", "-", "document", "matrix", "which", "is", "a", "mathematical", "matrix", "that", "describes", "the", "frequency", "of", "terms", "that", "occur", "in", "a", "collection", "of", "documents", "(", "in", "our", "case", "a", "collection",...
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/genometric_space.py#L191-L219
DEIB-GECO/PyGMQL
gmql/ml/genometric_space.py
GenometricSpace.tf
def tf(cluster): """ Computes the term frequency and stores it as a dictionary :param cluster: the cluster that contains the metadata :return: tf dictionary """ counts = dict() words = cluster.split(' ') for word in words: counts[word] = count...
python
def tf(cluster): """ Computes the term frequency and stores it as a dictionary :param cluster: the cluster that contains the metadata :return: tf dictionary """ counts = dict() words = cluster.split(' ') for word in words: counts[word] = count...
[ "def", "tf", "(", "cluster", ")", ":", "counts", "=", "dict", "(", ")", "words", "=", "cluster", ".", "split", "(", "' '", ")", "for", "word", "in", "words", ":", "counts", "[", "word", "]", "=", "counts", ".", "get", "(", "word", ",", "0", ")"...
Computes the term frequency and stores it as a dictionary :param cluster: the cluster that contains the metadata :return: tf dictionary
[ "Computes", "the", "term", "frequency", "and", "stores", "it", "as", "a", "dictionary" ]
train
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/genometric_space.py#L222-L233