repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
hbldh/dlxsudoku
dlxsudoku/sudoku.py
Sudoku.set_cell
def set_cell(self, i, j, value): """Set a cell's value, with a series of safety checks :param i: The row number :type i: int :param j: The column number :type j: int :param value: The value to set :type value: int :raises: :py:class:`dlxsudoku.exceptions....
python
def set_cell(self, i, j, value): """Set a cell's value, with a series of safety checks :param i: The row number :type i: int :param j: The column number :type j: int :param value: The value to set :type value: int :raises: :py:class:`dlxsudoku.exceptions....
[ "def", "set_cell", "(", "self", ",", "i", ",", "j", ",", "value", ")", ":", "bool_tests", "=", "[", "value", "in", "self", ".", "_possibles", "[", "i", "]", "[", "j", "]", ",", "value", "in", "self", ".", "_poss_rows", "[", "i", "]", ",", "valu...
Set a cell's value, with a series of safety checks :param i: The row number :type i: int :param j: The column number :type j: int :param value: The value to set :type value: int :raises: :py:class:`dlxsudoku.exceptions.SudokuHasNoSolutionError`
[ "Set", "a", "cell", "s", "value", "with", "a", "series", "of", "safety", "checks" ]
8d774e0883eb615533d04f07e58a95db716226e0
https://github.com/hbldh/dlxsudoku/blob/8d774e0883eb615533d04f07e58a95db716226e0/dlxsudoku/sudoku.py#L177-L202
train
hbldh/dlxsudoku
dlxsudoku/sudoku.py
Sudoku.solve
def solve(self, verbose=False, allow_brute_force=True): """Solve the Sudoku. :param verbose: If the steps used for solving the Sudoku should be printed. Default is `False` :type verbose: bool :param allow_brute_force: If Dancing Links Brute Force method ...
python
def solve(self, verbose=False, allow_brute_force=True): """Solve the Sudoku. :param verbose: If the steps used for solving the Sudoku should be printed. Default is `False` :type verbose: bool :param allow_brute_force: If Dancing Links Brute Force method ...
[ "def", "solve", "(", "self", ",", "verbose", "=", "False", ",", "allow_brute_force", "=", "True", ")", ":", "while", "not", "self", ".", "is_solved", ":", "# Update possibles arrays.", "self", ".", "_update", "(", ")", "# See if any position can be singled out.", ...
Solve the Sudoku. :param verbose: If the steps used for solving the Sudoku should be printed. Default is `False` :type verbose: bool :param allow_brute_force: If Dancing Links Brute Force method should be used if necessary. Default is `T...
[ "Solve", "the", "Sudoku", "." ]
8d774e0883eb615533d04f07e58a95db716226e0
https://github.com/hbldh/dlxsudoku/blob/8d774e0883eb615533d04f07e58a95db716226e0/dlxsudoku/sudoku.py#L209-L257
train
hbldh/dlxsudoku
dlxsudoku/sudoku.py
Sudoku._update
def _update(self): """Calculate remaining values for each row, column, box and finally cell.""" # Update possible values in each row, column and box. for i, (row, col, box) in enumerate(zip(self.row_iter(), self.col_iter(), self.box_iter())): self._poss_rows[i] = set(self._values).di...
python
def _update(self): """Calculate remaining values for each row, column, box and finally cell.""" # Update possible values in each row, column and box. for i, (row, col, box) in enumerate(zip(self.row_iter(), self.col_iter(), self.box_iter())): self._poss_rows[i] = set(self._values).di...
[ "def", "_update", "(", "self", ")", ":", "# Update possible values in each row, column and box.", "for", "i", ",", "(", "row", ",", "col", ",", "box", ")", "in", "enumerate", "(", "zip", "(", "self", ".", "row_iter", "(", ")", ",", "self", ".", "col_iter",...
Calculate remaining values for each row, column, box and finally cell.
[ "Calculate", "remaining", "values", "for", "each", "row", "column", "box", "and", "finally", "cell", "." ]
8d774e0883eb615533d04f07e58a95db716226e0
https://github.com/hbldh/dlxsudoku/blob/8d774e0883eb615533d04f07e58a95db716226e0/dlxsudoku/sudoku.py#L259-L277
train
hbldh/dlxsudoku
dlxsudoku/sudoku.py
Sudoku._fill_naked_singles
def _fill_naked_singles(self): """Look for naked singles, i.e. cells with ony one possible value. :return: If any Naked Single has been found. :rtype: bool """ simple_found = False for i in utils.range_(self.side): for j in utils.range_(self.side): ...
python
def _fill_naked_singles(self): """Look for naked singles, i.e. cells with ony one possible value. :return: If any Naked Single has been found. :rtype: bool """ simple_found = False for i in utils.range_(self.side): for j in utils.range_(self.side): ...
[ "def", "_fill_naked_singles", "(", "self", ")", ":", "simple_found", "=", "False", "for", "i", "in", "utils", ".", "range_", "(", "self", ".", "side", ")", ":", "for", "j", "in", "utils", ".", "range_", "(", "self", ".", "side", ")", ":", "if", "se...
Look for naked singles, i.e. cells with ony one possible value. :return: If any Naked Single has been found. :rtype: bool
[ "Look", "for", "naked", "singles", "i", ".", "e", ".", "cells", "with", "ony", "one", "possible", "value", "." ]
8d774e0883eb615533d04f07e58a95db716226e0
https://github.com/hbldh/dlxsudoku/blob/8d774e0883eb615533d04f07e58a95db716226e0/dlxsudoku/sudoku.py#L279-L299
train
hbldh/dlxsudoku
dlxsudoku/sudoku.py
Sudoku._fill_hidden_singles
def _fill_hidden_singles(self): """Look for hidden singles, i.e. cells with only one unique possible value in row, column or box. :return: If any Hidden Single has been found. :rtype: bool """ for i in utils.range_(self.side): box_i = (i // self.order) * self.order ...
python
def _fill_hidden_singles(self): """Look for hidden singles, i.e. cells with only one unique possible value in row, column or box. :return: If any Hidden Single has been found. :rtype: bool """ for i in utils.range_(self.side): box_i = (i // self.order) * self.order ...
[ "def", "_fill_hidden_singles", "(", "self", ")", ":", "for", "i", "in", "utils", ".", "range_", "(", "self", ".", "side", ")", ":", "box_i", "=", "(", "i", "//", "self", ".", "order", ")", "*", "self", ".", "order", "for", "j", "in", "utils", "."...
Look for hidden singles, i.e. cells with only one unique possible value in row, column or box. :return: If any Hidden Single has been found. :rtype: bool
[ "Look", "for", "hidden", "singles", "i", ".", "e", ".", "cells", "with", "only", "one", "unique", "possible", "value", "in", "row", "column", "or", "box", "." ]
8d774e0883eb615533d04f07e58a95db716226e0
https://github.com/hbldh/dlxsudoku/blob/8d774e0883eb615533d04f07e58a95db716226e0/dlxsudoku/sudoku.py#L301-L353
train
Capitains/MyCapytain
MyCapytain/resources/collections/dts/_base.py
DtsCollection.parse
def parse(cls, resource, direction="children", **additional_parameters) -> "DtsCollection": """ Given a dict representation of a json object, generate a DTS Collection :param resource: :type resource: dict :param direction: Direction of the hydra:members value :return: DTSCollec...
python
def parse(cls, resource, direction="children", **additional_parameters) -> "DtsCollection": """ Given a dict representation of a json object, generate a DTS Collection :param resource: :type resource: dict :param direction: Direction of the hydra:members value :return: DTSCollec...
[ "def", "parse", "(", "cls", ",", "resource", ",", "direction", "=", "\"children\"", ",", "*", "*", "additional_parameters", ")", "->", "\"DtsCollection\"", ":", "data", "=", "jsonld", ".", "expand", "(", "resource", ")", "if", "len", "(", "data", ")", "=...
Given a dict representation of a json object, generate a DTS Collection :param resource: :type resource: dict :param direction: Direction of the hydra:members value :return: DTSCollection parsed :rtype: DtsCollection
[ "Given", "a", "dict", "representation", "of", "a", "json", "object", "generate", "a", "DTS", "Collection" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/collections/dts/_base.py#L72-L95
train
ChrisBeaumont/smother
smother/python.py
Visitor._filldown
def _filldown(self, lineno): """ Copy current_context into `lines` down up until lineno """ if self.line > lineno: # XXX decorated functions make us jump backwards. # understand this more return self.lines.extend( self.current_cont...
python
def _filldown(self, lineno): """ Copy current_context into `lines` down up until lineno """ if self.line > lineno: # XXX decorated functions make us jump backwards. # understand this more return self.lines.extend( self.current_cont...
[ "def", "_filldown", "(", "self", ",", "lineno", ")", ":", "if", "self", ".", "line", ">", "lineno", ":", "# XXX decorated functions make us jump backwards.", "# understand this more", "return", "self", ".", "lines", ".", "extend", "(", "self", ".", "current_contex...
Copy current_context into `lines` down up until lineno
[ "Copy", "current_context", "into", "lines", "down", "up", "until", "lineno" ]
65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb
https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/python.py#L50-L61
train
ChrisBeaumont/smother
smother/python.py
Visitor._add_section
def _add_section(self, node): """ Register the current node as a new context block """ self._filldown(node.lineno) # push a new context onto stack self.context.append(node.name) self._update_current_context() for _ in map(self.visit, iter_child_nodes(nod...
python
def _add_section(self, node): """ Register the current node as a new context block """ self._filldown(node.lineno) # push a new context onto stack self.context.append(node.name) self._update_current_context() for _ in map(self.visit, iter_child_nodes(nod...
[ "def", "_add_section", "(", "self", ",", "node", ")", ":", "self", ".", "_filldown", "(", "node", ".", "lineno", ")", "# push a new context onto stack", "self", ".", "context", ".", "append", "(", "node", ".", "name", ")", "self", ".", "_update_current_conte...
Register the current node as a new context block
[ "Register", "the", "current", "node", "as", "a", "new", "context", "block" ]
65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb
https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/python.py#L63-L78
train
ChrisBeaumont/smother
smother/python.py
PythonFile._module_name
def _module_name(filename): """ Try to find a module name for a file path by stripping off a prefix found in sys.modules. """ absfile = os.path.abspath(filename) match = filename for base in [''] + sys.path: base = os.path.abspath(base) i...
python
def _module_name(filename): """ Try to find a module name for a file path by stripping off a prefix found in sys.modules. """ absfile = os.path.abspath(filename) match = filename for base in [''] + sys.path: base = os.path.abspath(base) i...
[ "def", "_module_name", "(", "filename", ")", ":", "absfile", "=", "os", ".", "path", ".", "abspath", "(", "filename", ")", "match", "=", "filename", "for", "base", "in", "[", "''", "]", "+", "sys", ".", "path", ":", "base", "=", "os", ".", "path", ...
Try to find a module name for a file path by stripping off a prefix found in sys.modules.
[ "Try", "to", "find", "a", "module", "name", "for", "a", "file", "path", "by", "stripping", "off", "a", "prefix", "found", "in", "sys", ".", "modules", "." ]
65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb
https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/python.py#L140-L155
train
ChrisBeaumont/smother
smother/python.py
PythonFile.from_modulename
def from_modulename(cls, module_name): """ Build a PythonFile given a dotted module name like a.b.c """ # XXX make this more robust (pyc files? zip archives? etc) slug = module_name.replace('.', '/') paths = [slug + '.py', slug + '/__init__.py'] # always search f...
python
def from_modulename(cls, module_name): """ Build a PythonFile given a dotted module name like a.b.c """ # XXX make this more robust (pyc files? zip archives? etc) slug = module_name.replace('.', '/') paths = [slug + '.py', slug + '/__init__.py'] # always search f...
[ "def", "from_modulename", "(", "cls", ",", "module_name", ")", ":", "# XXX make this more robust (pyc files? zip archives? etc)", "slug", "=", "module_name", ".", "replace", "(", "'.'", ",", "'/'", ")", "paths", "=", "[", "slug", "+", "'.py'", ",", "slug", "+", ...
Build a PythonFile given a dotted module name like a.b.c
[ "Build", "a", "PythonFile", "given", "a", "dotted", "module", "name", "like", "a", ".", "b", ".", "c" ]
65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb
https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/python.py#L158-L173
train
ChrisBeaumont/smother
smother/python.py
PythonFile.context_range
def context_range(self, context): """ Return the 1-offset, right-open range of lines spanned by a particular context name. Parameters ---------- context : str Raises ------ ValueError, if context is not present in the file. """ if...
python
def context_range(self, context): """ Return the 1-offset, right-open range of lines spanned by a particular context name. Parameters ---------- context : str Raises ------ ValueError, if context is not present in the file. """ if...
[ "def", "context_range", "(", "self", ",", "context", ")", ":", "if", "not", "context", ".", "startswith", "(", "self", ".", "prefix", ")", ":", "context", "=", "self", ".", "prefix", "+", "'.'", "+", "context", "lo", "=", "hi", "=", "None", "for", ...
Return the 1-offset, right-open range of lines spanned by a particular context name. Parameters ---------- context : str Raises ------ ValueError, if context is not present in the file.
[ "Return", "the", "1", "-", "offset", "right", "-", "open", "range", "of", "lines", "spanned", "by", "a", "particular", "context", "name", "." ]
65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb
https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/python.py#L179-L208
train
ChrisBeaumont/smother
smother/python.py
PythonFile.context
def context(self, line): """ Return the context for a given 1-offset line number. """ # XXX due to a limitation in Visitor, # non-python code after the last python code # in a file is not added to self.lines, so we # have to guard against IndexErrors. idx ...
python
def context(self, line): """ Return the context for a given 1-offset line number. """ # XXX due to a limitation in Visitor, # non-python code after the last python code # in a file is not added to self.lines, so we # have to guard against IndexErrors. idx ...
[ "def", "context", "(", "self", ",", "line", ")", ":", "# XXX due to a limitation in Visitor,", "# non-python code after the last python code", "# in a file is not added to self.lines, so we", "# have to guard against IndexErrors.", "idx", "=", "line", "-", "1", "if", "idx", ">=...
Return the context for a given 1-offset line number.
[ "Return", "the", "context", "for", "a", "given", "1", "-", "offset", "line", "number", "." ]
65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb
https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/python.py#L210-L221
train
infothrill/python-launchd
launchd/plist.py
write
def write(label, plist, scope=USER): ''' Writes the given property list to the appropriate file on disk and returns the absolute filename. :param plist: dict :param label: string :param scope: oneOf(USER, USER_ADMIN, DAEMON_ADMIN, USER_OS, DAEMON_OS) ''' fname = compute_filename(label, ...
python
def write(label, plist, scope=USER): ''' Writes the given property list to the appropriate file on disk and returns the absolute filename. :param plist: dict :param label: string :param scope: oneOf(USER, USER_ADMIN, DAEMON_ADMIN, USER_OS, DAEMON_OS) ''' fname = compute_filename(label, ...
[ "def", "write", "(", "label", ",", "plist", ",", "scope", "=", "USER", ")", ":", "fname", "=", "compute_filename", "(", "label", ",", "scope", ")", "with", "open", "(", "fname", ",", "\"wb\"", ")", "as", "f", ":", "plistlib", ".", "writePlist", "(", ...
Writes the given property list to the appropriate file on disk and returns the absolute filename. :param plist: dict :param label: string :param scope: oneOf(USER, USER_ADMIN, DAEMON_ADMIN, USER_OS, DAEMON_OS)
[ "Writes", "the", "given", "property", "list", "to", "the", "appropriate", "file", "on", "disk", "and", "returns", "the", "absolute", "filename", "." ]
2cd50579e808851b116f5a26f9b871a32b65ce0e
https://github.com/infothrill/python-launchd/blob/2cd50579e808851b116f5a26f9b871a32b65ce0e/launchd/plist.py#L49-L61
train
SHDShim/pytheos
pytheos/eqn_therm.py
alphakt_pth
def alphakt_pth(v, temp, v0, alpha0, k0, n, z, t_ref=300., three_r=3. * constants.R): """ calculate thermal pressure from thermal expansion and bulk modulus :param v: unit-cell volume in A^3 :param temp: temperature in K :param v0: unit-cell volume in A^3 at 1 bar :param alpha0:...
python
def alphakt_pth(v, temp, v0, alpha0, k0, n, z, t_ref=300., three_r=3. * constants.R): """ calculate thermal pressure from thermal expansion and bulk modulus :param v: unit-cell volume in A^3 :param temp: temperature in K :param v0: unit-cell volume in A^3 at 1 bar :param alpha0:...
[ "def", "alphakt_pth", "(", "v", ",", "temp", ",", "v0", ",", "alpha0", ",", "k0", ",", "n", ",", "z", ",", "t_ref", "=", "300.", ",", "three_r", "=", "3.", "*", "constants", ".", "R", ")", ":", "return", "alpha0", "*", "k0", "*", "(", "temp", ...
calculate thermal pressure from thermal expansion and bulk modulus :param v: unit-cell volume in A^3 :param temp: temperature in K :param v0: unit-cell volume in A^3 at 1 bar :param alpha0: thermal expansion parameter at 1 bar in K-1 :param k0: bulk modulus in GPa :param n: number of atoms in a...
[ "calculate", "thermal", "pressure", "from", "thermal", "expansion", "and", "bulk", "modulus" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_therm.py#L5-L21
train
aiidateam/aiida-codtools
aiida_codtools/parsers/cif_cod_deposit.py
CifCodDepositParser._get_output_nodes
def _get_output_nodes(self, output_path, error_path): """ Extracts output nodes from the standard output and standard error files """ status = cod_deposition_states.UNKNOWN messages = [] if output_path is not None: content = None with open(output_...
python
def _get_output_nodes(self, output_path, error_path): """ Extracts output nodes from the standard output and standard error files """ status = cod_deposition_states.UNKNOWN messages = [] if output_path is not None: content = None with open(output_...
[ "def", "_get_output_nodes", "(", "self", ",", "output_path", ",", "error_path", ")", ":", "status", "=", "cod_deposition_states", ".", "UNKNOWN", "messages", "=", "[", "]", "if", "output_path", "is", "not", "None", ":", "content", "=", "None", "with", "open"...
Extracts output nodes from the standard output and standard error files
[ "Extracts", "output", "nodes", "from", "the", "standard", "output", "and", "standard", "error", "files" ]
da5e4259b7a2e86cf0cc3f997e11dd36d445fa94
https://github.com/aiidateam/aiida-codtools/blob/da5e4259b7a2e86cf0cc3f997e11dd36d445fa94/aiida_codtools/parsers/cif_cod_deposit.py#L35-L63
train
chaoss/grimoirelab-cereslib
cereslib/dfutils/filter.py
FilterRows.filter_
def filter_(self, columns, value): """ This method filter some of the rows where the 'value' is found in each of the 'columns'. :param column: list of strings :param value: any type :returns: filtered dataframe :rtype: pandas.DataFrame """ for column in...
python
def filter_(self, columns, value): """ This method filter some of the rows where the 'value' is found in each of the 'columns'. :param column: list of strings :param value: any type :returns: filtered dataframe :rtype: pandas.DataFrame """ for column in...
[ "def", "filter_", "(", "self", ",", "columns", ",", "value", ")", ":", "for", "column", "in", "columns", ":", "if", "column", "not", "in", "self", ".", "data", ".", "columns", ":", "raise", "ValueError", "(", "\"Column %s not in DataFrame columns: %s\"", "%"...
This method filter some of the rows where the 'value' is found in each of the 'columns'. :param column: list of strings :param value: any type :returns: filtered dataframe :rtype: pandas.DataFrame
[ "This", "method", "filter", "some", "of", "the", "rows", "where", "the", "value", "is", "found", "in", "each", "of", "the", "columns", "." ]
5110e6ca490a4f24bec3124286ebf51fd4e08bdd
https://github.com/chaoss/grimoirelab-cereslib/blob/5110e6ca490a4f24bec3124286ebf51fd4e08bdd/cereslib/dfutils/filter.py#L54-L75
train
crdoconnor/commandlib
commandlib/utils.py
_check_directory
def _check_directory(directory): """Raise exception if directory does not exist.""" if directory is not None: if not exists(directory): raise CommandError( "Cannot run command - directory {0} does not exist".format(directory) ) if not isdir(directory): ...
python
def _check_directory(directory): """Raise exception if directory does not exist.""" if directory is not None: if not exists(directory): raise CommandError( "Cannot run command - directory {0} does not exist".format(directory) ) if not isdir(directory): ...
[ "def", "_check_directory", "(", "directory", ")", ":", "if", "directory", "is", "not", "None", ":", "if", "not", "exists", "(", "directory", ")", ":", "raise", "CommandError", "(", "\"Cannot run command - directory {0} does not exist\"", ".", "format", "(", "direc...
Raise exception if directory does not exist.
[ "Raise", "exception", "if", "directory", "does", "not", "exist", "." ]
b630364fd7b0d189b388e22a7f43235d182e12e4
https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/commandlib/utils.py#L5-L18
train
totalgood/twip
twip/features.py
load_tweets
def load_tweets(filename='tweets.zip'): r"""Extract the cached tweets "database" if necessary and load + parse the json. >>> js = load_tweets() >>> len(js) 8000 >>> js[0].keys() [u'contributors', u'truncated', u'text', u'is_quote_status', u'in_reply_to_status_id', u'id'...
python
def load_tweets(filename='tweets.zip'): r"""Extract the cached tweets "database" if necessary and load + parse the json. >>> js = load_tweets() >>> len(js) 8000 >>> js[0].keys() [u'contributors', u'truncated', u'text', u'is_quote_status', u'in_reply_to_status_id', u'id'...
[ "def", "load_tweets", "(", "filename", "=", "'tweets.zip'", ")", ":", "basename", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "json_file", "=", "basename", "+", "'.json'", "json_path", "=", "os", ".", "path", ".", "join", ...
r"""Extract the cached tweets "database" if necessary and load + parse the json. >>> js = load_tweets() >>> len(js) 8000 >>> js[0].keys() [u'contributors', u'truncated', u'text', u'is_quote_status', u'in_reply_to_status_id', u'id', u'favorite_count', u'source', ...
[ "r", "Extract", "the", "cached", "tweets", "database", "if", "necessary", "and", "load", "+", "parse", "the", "json", "." ]
5c0411d2acfbe5b421841072814c9152591c03f7
https://github.com/totalgood/twip/blob/5c0411d2acfbe5b421841072814c9152591c03f7/twip/features.py#L21-L249
train
totalgood/twip
twip/scripts/cat_tweets.py
main
def main(args): """API with args object containing configuration parameters""" global logging, log args = parse_args(args) logging.basicConfig(format=LOG_FORMAT, level=logging.DEBUG if args.verbose else logging.INFO, stream=sys.stdout) df = cat_tweets...
python
def main(args): """API with args object containing configuration parameters""" global logging, log args = parse_args(args) logging.basicConfig(format=LOG_FORMAT, level=logging.DEBUG if args.verbose else logging.INFO, stream=sys.stdout) df = cat_tweets...
[ "def", "main", "(", "args", ")", ":", "global", "logging", ",", "log", "args", "=", "parse_args", "(", "args", ")", "logging", ".", "basicConfig", "(", "format", "=", "LOG_FORMAT", ",", "level", "=", "logging", ".", "DEBUG", "if", "args", ".", "verbose...
API with args object containing configuration parameters
[ "API", "with", "args", "object", "containing", "configuration", "parameters" ]
5c0411d2acfbe5b421841072814c9152591c03f7
https://github.com/totalgood/twip/blob/5c0411d2acfbe5b421841072814c9152591c03f7/twip/scripts/cat_tweets.py#L90-L105
train
totalgood/twip
twip/scripts/cat_tweets.py
drop_nan_columns
def drop_nan_columns(df, thresh=325): """Drop columns that are mostly NaNs Excel files can only have 256 columns, so you may have to drop a lot in order to get down to this """ if thresh < 1: thresh = int(thresh * df) return df.dropna(axis=1, thresh=thresh, inplace=False)
python
def drop_nan_columns(df, thresh=325): """Drop columns that are mostly NaNs Excel files can only have 256 columns, so you may have to drop a lot in order to get down to this """ if thresh < 1: thresh = int(thresh * df) return df.dropna(axis=1, thresh=thresh, inplace=False)
[ "def", "drop_nan_columns", "(", "df", ",", "thresh", "=", "325", ")", ":", "if", "thresh", "<", "1", ":", "thresh", "=", "int", "(", "thresh", "*", "df", ")", "return", "df", ".", "dropna", "(", "axis", "=", "1", ",", "thresh", "=", "thresh", ","...
Drop columns that are mostly NaNs Excel files can only have 256 columns, so you may have to drop a lot in order to get down to this
[ "Drop", "columns", "that", "are", "mostly", "NaNs" ]
5c0411d2acfbe5b421841072814c9152591c03f7
https://github.com/totalgood/twip/blob/5c0411d2acfbe5b421841072814c9152591c03f7/twip/scripts/cat_tweets.py#L184-L191
train
jedie/PyHardLinkBackup
PyHardLinkBackup/phlb/phlb_main.py
FileBackup.fast_deduplication_backup
def fast_deduplication_backup(self, old_backup_entry, process_bar): """ We can just link a old backup entry :param latest_backup: old BackupEntry model instance :param process_bar: tqdm process bar """ # TODO: merge code with parts from deduplication_backup() src...
python
def fast_deduplication_backup(self, old_backup_entry, process_bar): """ We can just link a old backup entry :param latest_backup: old BackupEntry model instance :param process_bar: tqdm process bar """ # TODO: merge code with parts from deduplication_backup() src...
[ "def", "fast_deduplication_backup", "(", "self", ",", "old_backup_entry", ",", "process_bar", ")", ":", "# TODO: merge code with parts from deduplication_backup()", "src_path", "=", "self", ".", "dir_path", ".", "resolved_path", "log", ".", "debug", "(", "\"*** fast dedup...
We can just link a old backup entry :param latest_backup: old BackupEntry model instance :param process_bar: tqdm process bar
[ "We", "can", "just", "link", "a", "old", "backup", "entry" ]
be28666834d2d9e3d8aac1b661cb2d5bd4056c29
https://github.com/jedie/PyHardLinkBackup/blob/be28666834d2d9e3d8aac1b661cb2d5bd4056c29/PyHardLinkBackup/phlb/phlb_main.py#L100-L154
train
jedie/PyHardLinkBackup
PyHardLinkBackup/phlb/phlb_main.py
FileBackup.deduplication_backup
def deduplication_backup(self, process_bar): """ Backup the current file and compare the content. :param process_bar: tqdm process bar """ self.fast_backup = False # Was a fast backup used? src_path = self.dir_path.resolved_path log.debug("*** deduplication bac...
python
def deduplication_backup(self, process_bar): """ Backup the current file and compare the content. :param process_bar: tqdm process bar """ self.fast_backup = False # Was a fast backup used? src_path = self.dir_path.resolved_path log.debug("*** deduplication bac...
[ "def", "deduplication_backup", "(", "self", ",", "process_bar", ")", ":", "self", ".", "fast_backup", "=", "False", "# Was a fast backup used?", "src_path", "=", "self", ".", "dir_path", ".", "resolved_path", "log", ".", "debug", "(", "\"*** deduplication backup: '%...
Backup the current file and compare the content. :param process_bar: tqdm process bar
[ "Backup", "the", "current", "file", "and", "compare", "the", "content", "." ]
be28666834d2d9e3d8aac1b661cb2d5bd4056c29
https://github.com/jedie/PyHardLinkBackup/blob/be28666834d2d9e3d8aac1b661cb2d5bd4056c29/PyHardLinkBackup/phlb/phlb_main.py#L156-L225
train
jedie/PyHardLinkBackup
PyHardLinkBackup/phlb/phlb_main.py
HardLinkBackup._backup_dir_item
def _backup_dir_item(self, dir_path, process_bar): """ Backup one dir item :param dir_path: filesystem_walk.DirEntryPath() instance """ self.path_helper.set_src_filepath(dir_path) if self.path_helper.abs_src_filepath is None: self.total_errored_items += 1 ...
python
def _backup_dir_item(self, dir_path, process_bar): """ Backup one dir item :param dir_path: filesystem_walk.DirEntryPath() instance """ self.path_helper.set_src_filepath(dir_path) if self.path_helper.abs_src_filepath is None: self.total_errored_items += 1 ...
[ "def", "_backup_dir_item", "(", "self", ",", "dir_path", ",", "process_bar", ")", ":", "self", ".", "path_helper", ".", "set_src_filepath", "(", "dir_path", ")", "if", "self", ".", "path_helper", ".", "abs_src_filepath", "is", "None", ":", "self", ".", "tota...
Backup one dir item :param dir_path: filesystem_walk.DirEntryPath() instance
[ "Backup", "one", "dir", "item" ]
be28666834d2d9e3d8aac1b661cb2d5bd4056c29
https://github.com/jedie/PyHardLinkBackup/blob/be28666834d2d9e3d8aac1b661cb2d5bd4056c29/PyHardLinkBackup/phlb/phlb_main.py#L456-L511
train
jedie/PyHardLinkBackup
PyHardLinkBackup/phlb/phlb_main.py
HardLinkBackup.print_update
def print_update(self): """ print some status information in between. """ print("\r\n") now = datetime.datetime.now() print("Update info: (from: %s)" % now.strftime("%c")) current_total_size = self.total_stined_bytes + self.total_new_bytes if self.total_...
python
def print_update(self): """ print some status information in between. """ print("\r\n") now = datetime.datetime.now() print("Update info: (from: %s)" % now.strftime("%c")) current_total_size = self.total_stined_bytes + self.total_new_bytes if self.total_...
[ "def", "print_update", "(", "self", ")", ":", "print", "(", "\"\\r\\n\"", ")", "now", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "print", "(", "\"Update info: (from: %s)\"", "%", "now", ".", "strftime", "(", "\"%c\"", ")", ")", "current_total_...
print some status information in between.
[ "print", "some", "status", "information", "in", "between", "." ]
be28666834d2d9e3d8aac1b661cb2d5bd4056c29
https://github.com/jedie/PyHardLinkBackup/blob/be28666834d2d9e3d8aac1b661cb2d5bd4056c29/PyHardLinkBackup/phlb/phlb_main.py#L551-L586
train
aiidateam/aiida-codtools
aiida_codtools/cli/calculations/cod_tools.py
cli
def cli(code, cif, parameters, daemon): """Run any cod-tools calculation for the given ``CifData`` node. The ``-p/--parameters`` option takes a single string with any command line parameters that you want to be passed to the calculation, and by extension the cod-tools script. Example:: launch_calc...
python
def cli(code, cif, parameters, daemon): """Run any cod-tools calculation for the given ``CifData`` node. The ``-p/--parameters`` option takes a single string with any command line parameters that you want to be passed to the calculation, and by extension the cod-tools script. Example:: launch_calc...
[ "def", "cli", "(", "code", ",", "cif", ",", "parameters", ",", "daemon", ")", ":", "from", "aiida", "import", "orm", "from", "aiida", ".", "plugins", "import", "factories", "from", "aiida_codtools", ".", "common", ".", "cli", "import", "CliParameters", ","...
Run any cod-tools calculation for the given ``CifData`` node. The ``-p/--parameters`` option takes a single string with any command line parameters that you want to be passed to the calculation, and by extension the cod-tools script. Example:: launch_calculation_cod_tools -X cif-filter -N 95 -p '--use...
[ "Run", "any", "cod", "-", "tools", "calculation", "for", "the", "given", "CifData", "node", "." ]
da5e4259b7a2e86cf0cc3f997e11dd36d445fa94
https://github.com/aiidateam/aiida-codtools/blob/da5e4259b7a2e86cf0cc3f997e11dd36d445fa94/aiida_codtools/cli/calculations/cod_tools.py#L22-L50
train
jiasir/playback
playback/cli/environment.py
make
def make(parser): """DEPRECATED prepare OpenStack basic environment""" s = parser.add_subparsers( title='commands', metavar='COMMAND', help='description', ) def gen_pass_f(args): gen_pass() gen_pass_parser = s.add_parser('gen-pass', help='generate the passwor...
python
def make(parser): """DEPRECATED prepare OpenStack basic environment""" s = parser.add_subparsers( title='commands', metavar='COMMAND', help='description', ) def gen_pass_f(args): gen_pass() gen_pass_parser = s.add_parser('gen-pass', help='generate the passwor...
[ "def", "make", "(", "parser", ")", ":", "s", "=", "parser", ".", "add_subparsers", "(", "title", "=", "'commands'", ",", "metavar", "=", "'COMMAND'", ",", "help", "=", "'description'", ",", ")", "def", "gen_pass_f", "(", "args", ")", ":", "gen_pass", "...
DEPRECATED prepare OpenStack basic environment
[ "DEPRECATED", "prepare", "OpenStack", "basic", "environment" ]
58b2a5d669dcfaa8cad50c544a4b068dcacf9b69
https://github.com/jiasir/playback/blob/58b2a5d669dcfaa8cad50c544a4b068dcacf9b69/playback/cli/environment.py#L39-L57
train
klen/muffin-admin
muffin_admin/peewee.py
pw_converter
def pw_converter(handler, flt): """Convert column name to filter.""" import peewee as pw if isinstance(flt, Filter): return flt model = handler.model field = getattr(model, flt) if isinstance(field, pw.BooleanField): return PWBoolFilter(flt) if field.choices: choi...
python
def pw_converter(handler, flt): """Convert column name to filter.""" import peewee as pw if isinstance(flt, Filter): return flt model = handler.model field = getattr(model, flt) if isinstance(field, pw.BooleanField): return PWBoolFilter(flt) if field.choices: choi...
[ "def", "pw_converter", "(", "handler", ",", "flt", ")", ":", "import", "peewee", "as", "pw", "if", "isinstance", "(", "flt", ",", "Filter", ")", ":", "return", "flt", "model", "=", "handler", ".", "model", "field", "=", "getattr", "(", "model", ",", ...
Convert column name to filter.
[ "Convert", "column", "name", "to", "filter", "." ]
404dc8e5107e943b7c42fa21c679c34ddb4de1d5
https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/peewee.py#L24-L41
train
klen/muffin-admin
muffin_admin/peewee.py
RawIDField.process
def process(self, *args, **kwargs): """Get a description.""" super(RawIDField, self).process(*args, **kwargs) if self.object_data: self.description = self.description or str(self.object_data)
python
def process(self, *args, **kwargs): """Get a description.""" super(RawIDField, self).process(*args, **kwargs) if self.object_data: self.description = self.description or str(self.object_data)
[ "def", "process", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "RawIDField", ",", "self", ")", ".", "process", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "self", ".", "object_data", ":", "self", ".", ...
Get a description.
[ "Get", "a", "description", "." ]
404dc8e5107e943b7c42fa21c679c34ddb4de1d5
https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/peewee.py#L53-L57
train
klen/muffin-admin
muffin_admin/peewee.py
RawIDField._value
def _value(self): """Get field value.""" if self.data is not None: value = self.data._data.get(self.field.to_field.name) return str(value) return ''
python
def _value(self): """Get field value.""" if self.data is not None: value = self.data._data.get(self.field.to_field.name) return str(value) return ''
[ "def", "_value", "(", "self", ")", ":", "if", "self", ".", "data", "is", "not", "None", ":", "value", "=", "self", ".", "data", ".", "_data", ".", "get", "(", "self", ".", "field", ".", "to_field", ".", "name", ")", "return", "str", "(", "value",...
Get field value.
[ "Get", "field", "value", "." ]
404dc8e5107e943b7c42fa21c679c34ddb4de1d5
https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/peewee.py#L59-L64
train
klen/muffin-admin
muffin_admin/peewee.py
PWAdminHandler.sort
def sort(self, request, reverse=False): """Sort current collection.""" field = self.model._meta.fields.get(self.columns_sort) if not field: return self.collection if reverse: field = field.desc() return self.collection.order_by(field)
python
def sort(self, request, reverse=False): """Sort current collection.""" field = self.model._meta.fields.get(self.columns_sort) if not field: return self.collection if reverse: field = field.desc() return self.collection.order_by(field)
[ "def", "sort", "(", "self", ",", "request", ",", "reverse", "=", "False", ")", ":", "field", "=", "self", ".", "model", ".", "_meta", ".", "fields", ".", "get", "(", "self", ".", "columns_sort", ")", "if", "not", "field", ":", "return", "self", "."...
Sort current collection.
[ "Sort", "current", "collection", "." ]
404dc8e5107e943b7c42fa21c679c34ddb4de1d5
https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/peewee.py#L157-L166
train
klen/muffin-admin
muffin_admin/peewee.py
PWBoolFilter.value
def value(self, data): """Get value from data.""" value = data.get(self.name) if value: return int(value) return self.default
python
def value(self, data): """Get value from data.""" value = data.get(self.name) if value: return int(value) return self.default
[ "def", "value", "(", "self", ",", "data", ")", ":", "value", "=", "data", ".", "get", "(", "self", ".", "name", ")", "if", "value", ":", "return", "int", "(", "value", ")", "return", "self", ".", "default" ]
Get value from data.
[ "Get", "value", "from", "data", "." ]
404dc8e5107e943b7c42fa21c679c34ddb4de1d5
https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/peewee.py#L251-L256
train
uyar/pygenstub
pygenstub.py
get_fields
def get_fields(node, fields_tag="field_list"): """Get the field names and their values from a node. :sig: (Document, str) -> Dict[str, str] :param node: Node to get the fields from. :param fields_tag: Tag of child node that contains the fields. :return: Names and values of fields. """ field...
python
def get_fields(node, fields_tag="field_list"): """Get the field names and their values from a node. :sig: (Document, str) -> Dict[str, str] :param node: Node to get the fields from. :param fields_tag: Tag of child node that contains the fields. :return: Names and values of fields. """ field...
[ "def", "get_fields", "(", "node", ",", "fields_tag", "=", "\"field_list\"", ")", ":", "fields_nodes", "=", "[", "c", "for", "c", "in", "node", ".", "children", "if", "c", ".", "tagname", "==", "fields_tag", "]", "if", "len", "(", "fields_nodes", ")", "...
Get the field names and their values from a node. :sig: (Document, str) -> Dict[str, str] :param node: Node to get the fields from. :param fields_tag: Tag of child node that contains the fields. :return: Names and values of fields.
[ "Get", "the", "field", "names", "and", "their", "values", "from", "a", "node", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L81-L99
train
uyar/pygenstub
pygenstub.py
extract_signature
def extract_signature(docstring): """Extract the signature from a docstring. :sig: (str) -> Optional[str] :param docstring: Docstring to extract the signature from. :return: Extracted signature, or ``None`` if there's no signature. """ root = publish_doctree(docstring, settings_overrides={"repo...
python
def extract_signature(docstring): """Extract the signature from a docstring. :sig: (str) -> Optional[str] :param docstring: Docstring to extract the signature from. :return: Extracted signature, or ``None`` if there's no signature. """ root = publish_doctree(docstring, settings_overrides={"repo...
[ "def", "extract_signature", "(", "docstring", ")", ":", "root", "=", "publish_doctree", "(", "docstring", ",", "settings_overrides", "=", "{", "\"report_level\"", ":", "5", "}", ")", "fields", "=", "get_fields", "(", "root", ")", "return", "fields", ".", "ge...
Extract the signature from a docstring. :sig: (str) -> Optional[str] :param docstring: Docstring to extract the signature from. :return: Extracted signature, or ``None`` if there's no signature.
[ "Extract", "the", "signature", "from", "a", "docstring", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L102-L111
train
uyar/pygenstub
pygenstub.py
split_parameter_types
def split_parameter_types(parameters): """Split a parameter types declaration into individual types. The input is the left hand side of a signature (the part before the arrow), excluding the parentheses. :sig: (str) -> List[str] :param parameters: Comma separated parameter types. :return: Para...
python
def split_parameter_types(parameters): """Split a parameter types declaration into individual types. The input is the left hand side of a signature (the part before the arrow), excluding the parentheses. :sig: (str) -> List[str] :param parameters: Comma separated parameter types. :return: Para...
[ "def", "split_parameter_types", "(", "parameters", ")", ":", "if", "parameters", "==", "\"\"", ":", "return", "[", "]", "# only consider the top level commas, ignore the ones in []", "commas", "=", "[", "]", "bracket_depth", "=", "0", "for", "i", ",", "char", "in"...
Split a parameter types declaration into individual types. The input is the left hand side of a signature (the part before the arrow), excluding the parentheses. :sig: (str) -> List[str] :param parameters: Comma separated parameter types. :return: Parameter types.
[ "Split", "a", "parameter", "types", "declaration", "into", "individual", "types", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L127-L158
train
uyar/pygenstub
pygenstub.py
parse_signature
def parse_signature(signature): """Parse a signature into its input and return parameter types. This will also collect the types that are required by any of the input and return types. :sig: (str) -> Tuple[List[str], str, Set[str]] :param signature: Signature to parse. :return: Input parameter...
python
def parse_signature(signature): """Parse a signature into its input and return parameter types. This will also collect the types that are required by any of the input and return types. :sig: (str) -> Tuple[List[str], str, Set[str]] :param signature: Signature to parse. :return: Input parameter...
[ "def", "parse_signature", "(", "signature", ")", ":", "if", "\" -> \"", "not", "in", "signature", ":", "# signature comment: no parameters, treat variable type as return type", "param_types", ",", "return_type", "=", "None", ",", "signature", ".", "strip", "(", ")", "...
Parse a signature into its input and return parameter types. This will also collect the types that are required by any of the input and return types. :sig: (str) -> Tuple[List[str], str, Set[str]] :param signature: Signature to parse. :return: Input parameter types, return type, and all required t...
[ "Parse", "a", "signature", "into", "its", "input", "and", "return", "parameter", "types", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L161-L179
train
uyar/pygenstub
pygenstub.py
get_aliases
def get_aliases(lines): """Get the type aliases in the source. :sig: (Sequence[str]) -> Dict[str, str] :param lines: Lines of the source code. :return: Aliases and their their definitions. """ aliases = {} for line in lines: line = line.strip() if len(line) > 0 and line.star...
python
def get_aliases(lines): """Get the type aliases in the source. :sig: (Sequence[str]) -> Dict[str, str] :param lines: Lines of the source code. :return: Aliases and their their definitions. """ aliases = {} for line in lines: line = line.strip() if len(line) > 0 and line.star...
[ "def", "get_aliases", "(", "lines", ")", ":", "aliases", "=", "{", "}", "for", "line", "in", "lines", ":", "line", "=", "line", ".", "strip", "(", ")", "if", "len", "(", "line", ")", ">", "0", "and", "line", ".", "startswith", "(", "SIG_ALIAS", "...
Get the type aliases in the source. :sig: (Sequence[str]) -> Dict[str, str] :param lines: Lines of the source code. :return: Aliases and their their definitions.
[ "Get", "the", "type", "aliases", "in", "the", "source", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L372-L386
train
uyar/pygenstub
pygenstub.py
get_stub
def get_stub(source, generic=False): """Get the stub code for a source code. :sig: (str, bool) -> str :param source: Source code to generate the stub for. :param generic: Whether to produce generic stubs. :return: Generated stub code. """ generator = StubGenerator(source, generic=generic) ...
python
def get_stub(source, generic=False): """Get the stub code for a source code. :sig: (str, bool) -> str :param source: Source code to generate the stub for. :param generic: Whether to produce generic stubs. :return: Generated stub code. """ generator = StubGenerator(source, generic=generic) ...
[ "def", "get_stub", "(", "source", ",", "generic", "=", "False", ")", ":", "generator", "=", "StubGenerator", "(", "source", ",", "generic", "=", "generic", ")", "stub", "=", "generator", ".", "generate_stub", "(", ")", "return", "stub" ]
Get the stub code for a source code. :sig: (str, bool) -> str :param source: Source code to generate the stub for. :param generic: Whether to produce generic stubs. :return: Generated stub code.
[ "Get", "the", "stub", "code", "for", "a", "source", "code", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L745-L755
train
uyar/pygenstub
pygenstub.py
get_mod_paths
def get_mod_paths(mod_name, out_dir): """Get source and stub paths for a module.""" paths = [] try: mod = get_loader(mod_name) source = Path(mod.path) if source.name.endswith(".py"): source_rel = Path(*mod_name.split(".")) if source.name == "__init__.py": ...
python
def get_mod_paths(mod_name, out_dir): """Get source and stub paths for a module.""" paths = [] try: mod = get_loader(mod_name) source = Path(mod.path) if source.name.endswith(".py"): source_rel = Path(*mod_name.split(".")) if source.name == "__init__.py": ...
[ "def", "get_mod_paths", "(", "mod_name", ",", "out_dir", ")", ":", "paths", "=", "[", "]", "try", ":", "mod", "=", "get_loader", "(", "mod_name", ")", "source", "=", "Path", "(", "mod", ".", "path", ")", "if", "source", ".", "name", ".", "endswith", ...
Get source and stub paths for a module.
[ "Get", "source", "and", "stub", "paths", "for", "a", "module", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L758-L773
train
uyar/pygenstub
pygenstub.py
get_pkg_paths
def get_pkg_paths(pkg_name, out_dir): """Recursively get all source and stub paths for a package.""" paths = [] try: pkg = import_module(pkg_name) if not hasattr(pkg, "__path__"): return get_mod_paths(pkg_name, out_dir) for mod_info in walk_packages(pkg.__path__, pkg.__na...
python
def get_pkg_paths(pkg_name, out_dir): """Recursively get all source and stub paths for a package.""" paths = [] try: pkg = import_module(pkg_name) if not hasattr(pkg, "__path__"): return get_mod_paths(pkg_name, out_dir) for mod_info in walk_packages(pkg.__path__, pkg.__na...
[ "def", "get_pkg_paths", "(", "pkg_name", ",", "out_dir", ")", ":", "paths", "=", "[", "]", "try", ":", "pkg", "=", "import_module", "(", "pkg_name", ")", "if", "not", "hasattr", "(", "pkg", ",", "\"__path__\"", ")", ":", "return", "get_mod_paths", "(", ...
Recursively get all source and stub paths for a package.
[ "Recursively", "get", "all", "source", "and", "stub", "paths", "for", "a", "package", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L776-L789
train
uyar/pygenstub
pygenstub.py
process_docstring
def process_docstring(app, what, name, obj, options, lines): """Modify the docstring before generating documentation. This will insert type declarations for parameters and return type into the docstring, and remove the signature field so that it will be excluded from the generated document. """ ...
python
def process_docstring(app, what, name, obj, options, lines): """Modify the docstring before generating documentation. This will insert type declarations for parameters and return type into the docstring, and remove the signature field so that it will be excluded from the generated document. """ ...
[ "def", "process_docstring", "(", "app", ",", "what", ",", "name", ",", "obj", ",", "options", ",", "lines", ")", ":", "aliases", "=", "getattr", "(", "app", ",", "\"_sigaliases\"", ",", "None", ")", "if", "aliases", "is", "None", ":", "if", "what", "...
Modify the docstring before generating documentation. This will insert type declarations for parameters and return type into the docstring, and remove the signature field so that it will be excluded from the generated document.
[ "Modify", "the", "docstring", "before", "generating", "documentation", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L797-L874
train
uyar/pygenstub
pygenstub.py
main
def main(argv=None): """Start the command line interface.""" parser = ArgumentParser(prog="pygenstub") parser.add_argument("--version", action="version", version="%(prog)s " + __version__) parser.add_argument("files", nargs="*", help="generate stubs for given files") parser.add_argument( "-m...
python
def main(argv=None): """Start the command line interface.""" parser = ArgumentParser(prog="pygenstub") parser.add_argument("--version", action="version", version="%(prog)s " + __version__) parser.add_argument("files", nargs="*", help="generate stubs for given files") parser.add_argument( "-m...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "parser", "=", "ArgumentParser", "(", "prog", "=", "\"pygenstub\"", ")", "parser", ".", "add_argument", "(", "\"--version\"", ",", "action", "=", "\"version\"", ",", "version", "=", "\"%(prog)s \"", "+", "...
Start the command line interface.
[ "Start", "the", "command", "line", "interface", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L888-L951
train
uyar/pygenstub
pygenstub.py
StubNode.add_variable
def add_variable(self, node): """Add a variable node to this node. :sig: (VariableNode) -> None :param node: Variable node to add. """ if node.name not in self.variable_names: self.variables.append(node) self.variable_names.add(node.name) node...
python
def add_variable(self, node): """Add a variable node to this node. :sig: (VariableNode) -> None :param node: Variable node to add. """ if node.name not in self.variable_names: self.variables.append(node) self.variable_names.add(node.name) node...
[ "def", "add_variable", "(", "self", ",", "node", ")", ":", "if", "node", ".", "name", "not", "in", "self", ".", "variable_names", ":", "self", ".", "variables", ".", "append", "(", "node", ")", "self", ".", "variable_names", ".", "add", "(", "node", ...
Add a variable node to this node. :sig: (VariableNode) -> None :param node: Variable node to add.
[ "Add", "a", "variable", "node", "to", "this", "node", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L195-L204
train
uyar/pygenstub
pygenstub.py
StubNode.get_code
def get_code(self): """Get the stub code for this node. The stub code for a node consists of the type annotations of its variables, followed by the prototypes of its functions/methods and classes. :sig: () -> List[str] :return: Lines of stub code for this node. """ ...
python
def get_code(self): """Get the stub code for this node. The stub code for a node consists of the type annotations of its variables, followed by the prototypes of its functions/methods and classes. :sig: () -> List[str] :return: Lines of stub code for this node. """ ...
[ "def", "get_code", "(", "self", ")", ":", "stub", "=", "[", "]", "for", "child", "in", "self", ".", "variables", ":", "stub", ".", "extend", "(", "child", ".", "get_code", "(", ")", ")", "if", "(", "(", "len", "(", "self", ".", "variables", ")", ...
Get the stub code for this node. The stub code for a node consists of the type annotations of its variables, followed by the prototypes of its functions/methods and classes. :sig: () -> List[str] :return: Lines of stub code for this node.
[ "Get", "the", "stub", "code", "for", "this", "node", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L215-L235
train
uyar/pygenstub
pygenstub.py
FunctionNode.get_code
def get_code(self): """Get the stub code for this function. :sig: () -> List[str] :return: Lines of stub code for this function. """ stub = [] for deco in self.decorators: if (deco in DECORATORS) or deco.endswith(".setter"): stub.append("@" +...
python
def get_code(self): """Get the stub code for this function. :sig: () -> List[str] :return: Lines of stub code for this function. """ stub = [] for deco in self.decorators: if (deco in DECORATORS) or deco.endswith(".setter"): stub.append("@" +...
[ "def", "get_code", "(", "self", ")", ":", "stub", "=", "[", "]", "for", "deco", "in", "self", ".", "decorators", ":", "if", "(", "deco", "in", "DECORATORS", ")", "or", "deco", ".", "endswith", "(", "\".setter\"", ")", ":", "stub", ".", "append", "(...
Get the stub code for this function. :sig: () -> List[str] :return: Lines of stub code for this function.
[ "Get", "the", "stub", "code", "for", "this", "function", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L290-L331
train
uyar/pygenstub
pygenstub.py
ClassNode.get_code
def get_code(self): """Get the stub code for this class. :sig: () -> List[str] :return: Lines of stub code for this class. """ stub = [] bases = ("(" + ", ".join(self.bases) + ")") if len(self.bases) > 0 else "" slots = {"n": self.name, "b": bases} if (le...
python
def get_code(self): """Get the stub code for this class. :sig: () -> List[str] :return: Lines of stub code for this class. """ stub = [] bases = ("(" + ", ".join(self.bases) + ")") if len(self.bases) > 0 else "" slots = {"n": self.name, "b": bases} if (le...
[ "def", "get_code", "(", "self", ")", ":", "stub", "=", "[", "]", "bases", "=", "(", "\"(\"", "+", "\", \"", ".", "join", "(", "self", ".", "bases", ")", "+", "\")\"", ")", "if", "len", "(", "self", ".", "bases", ")", ">", "0", "else", "\"\"", ...
Get the stub code for this class. :sig: () -> List[str] :return: Lines of stub code for this class.
[ "Get", "the", "stub", "code", "for", "this", "class", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L353-L369
train
uyar/pygenstub
pygenstub.py
StubGenerator.collect_aliases
def collect_aliases(self): """Collect the type aliases in the source. :sig: () -> None """ self.aliases = get_aliases(self._code_lines) for alias, signature in self.aliases.items(): _, _, requires = parse_signature(signature) self.required_types |= requir...
python
def collect_aliases(self): """Collect the type aliases in the source. :sig: () -> None """ self.aliases = get_aliases(self._code_lines) for alias, signature in self.aliases.items(): _, _, requires = parse_signature(signature) self.required_types |= requir...
[ "def", "collect_aliases", "(", "self", ")", ":", "self", ".", "aliases", "=", "get_aliases", "(", "self", ".", "_code_lines", ")", "for", "alias", ",", "signature", "in", "self", ".", "aliases", ".", "items", "(", ")", ":", "_", ",", "_", ",", "requi...
Collect the type aliases in the source. :sig: () -> None
[ "Collect", "the", "type", "aliases", "in", "the", "source", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L417-L426
train
uyar/pygenstub
pygenstub.py
StubGenerator.visit_Import
def visit_Import(self, node): """Visit an import node.""" line = self._code_lines[node.lineno - 1] module_name = line.split("import")[0].strip() for name in node.names: imported_name = name.name if name.asname: imported_name = name.asname + "::" + ...
python
def visit_Import(self, node): """Visit an import node.""" line = self._code_lines[node.lineno - 1] module_name = line.split("import")[0].strip() for name in node.names: imported_name = name.name if name.asname: imported_name = name.asname + "::" + ...
[ "def", "visit_Import", "(", "self", ",", "node", ")", ":", "line", "=", "self", ".", "_code_lines", "[", "node", ".", "lineno", "-", "1", "]", "module_name", "=", "line", ".", "split", "(", "\"import\"", ")", "[", "0", "]", ".", "strip", "(", ")", ...
Visit an import node.
[ "Visit", "an", "import", "node", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L428-L436
train
uyar/pygenstub
pygenstub.py
StubGenerator.visit_ImportFrom
def visit_ImportFrom(self, node): """Visit an from-import node.""" line = self._code_lines[node.lineno - 1] module_name = line.split("from")[1].split("import")[0].strip() for name in node.names: imported_name = name.name if name.asname: imported_na...
python
def visit_ImportFrom(self, node): """Visit an from-import node.""" line = self._code_lines[node.lineno - 1] module_name = line.split("from")[1].split("import")[0].strip() for name in node.names: imported_name = name.name if name.asname: imported_na...
[ "def", "visit_ImportFrom", "(", "self", ",", "node", ")", ":", "line", "=", "self", ".", "_code_lines", "[", "node", ".", "lineno", "-", "1", "]", "module_name", "=", "line", ".", "split", "(", "\"from\"", ")", "[", "1", "]", ".", "split", "(", "\"...
Visit an from-import node.
[ "Visit", "an", "from", "-", "import", "node", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L438-L446
train
uyar/pygenstub
pygenstub.py
StubGenerator.visit_Assign
def visit_Assign(self, node): """Visit an assignment node.""" line = self._code_lines[node.lineno - 1] if SIG_COMMENT in line: line = _RE_COMMENT_IN_STRING.sub("", line) if (SIG_COMMENT not in line) and (not self.generic): return if SIG_COMMENT in line: ...
python
def visit_Assign(self, node): """Visit an assignment node.""" line = self._code_lines[node.lineno - 1] if SIG_COMMENT in line: line = _RE_COMMENT_IN_STRING.sub("", line) if (SIG_COMMENT not in line) and (not self.generic): return if SIG_COMMENT in line: ...
[ "def", "visit_Assign", "(", "self", ",", "node", ")", ":", "line", "=", "self", ".", "_code_lines", "[", "node", ".", "lineno", "-", "1", "]", "if", "SIG_COMMENT", "in", "line", ":", "line", "=", "_RE_COMMENT_IN_STRING", ".", "sub", "(", "\"\"", ",", ...
Visit an assignment node.
[ "Visit", "an", "assignment", "node", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L448-L480
train
uyar/pygenstub
pygenstub.py
StubGenerator.visit_FunctionDef
def visit_FunctionDef(self, node): """Visit a function node.""" node = self.get_function_node(node) if node is not None: node._async = False
python
def visit_FunctionDef(self, node): """Visit a function node.""" node = self.get_function_node(node) if node is not None: node._async = False
[ "def", "visit_FunctionDef", "(", "self", ",", "node", ")", ":", "node", "=", "self", ".", "get_function_node", "(", "node", ")", "if", "node", "is", "not", "None", ":", "node", ".", "_async", "=", "False" ]
Visit a function node.
[ "Visit", "a", "function", "node", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L577-L581
train
uyar/pygenstub
pygenstub.py
StubGenerator.visit_AsyncFunctionDef
def visit_AsyncFunctionDef(self, node): """Visit an async function node.""" node = self.get_function_node(node) if node is not None: node._async = True
python
def visit_AsyncFunctionDef(self, node): """Visit an async function node.""" node = self.get_function_node(node) if node is not None: node._async = True
[ "def", "visit_AsyncFunctionDef", "(", "self", ",", "node", ")", ":", "node", "=", "self", ".", "get_function_node", "(", "node", ")", "if", "node", "is", "not", "None", ":", "node", ".", "_async", "=", "True" ]
Visit an async function node.
[ "Visit", "an", "async", "function", "node", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L583-L587
train
uyar/pygenstub
pygenstub.py
StubGenerator.visit_ClassDef
def visit_ClassDef(self, node): """Visit a class node.""" self.defined_types.add(node.name) bases = [] for n in node.bases: base_parts = [] while True: if not isinstance(n, ast.Attribute): base_parts.append(n.id) ...
python
def visit_ClassDef(self, node): """Visit a class node.""" self.defined_types.add(node.name) bases = [] for n in node.bases: base_parts = [] while True: if not isinstance(n, ast.Attribute): base_parts.append(n.id) ...
[ "def", "visit_ClassDef", "(", "self", ",", "node", ")", ":", "self", ".", "defined_types", ".", "add", "(", "node", ".", "name", ")", "bases", "=", "[", "]", "for", "n", "in", "node", ".", "bases", ":", "base_parts", "=", "[", "]", "while", "True",...
Visit a class node.
[ "Visit", "a", "class", "node", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L589-L612
train
uyar/pygenstub
pygenstub.py
StubGenerator.generate_import_from
def generate_import_from(module_, names): """Generate an import line. :sig: (str, Set[str]) -> str :param module_: Name of module to import the names from. :param names: Names to import. :return: Import line in stub code. """ regular_names = [n for n in names if ...
python
def generate_import_from(module_, names): """Generate an import line. :sig: (str, Set[str]) -> str :param module_: Name of module to import the names from. :param names: Names to import. :return: Import line in stub code. """ regular_names = [n for n in names if ...
[ "def", "generate_import_from", "(", "module_", ",", "names", ")", ":", "regular_names", "=", "[", "n", "for", "n", "in", "names", "if", "\"::\"", "not", "in", "n", "]", "as_names", "=", "[", "n", "for", "n", "in", "names", "if", "\"::\"", "in", "n", ...
Generate an import line. :sig: (str, Set[str]) -> str :param module_: Name of module to import the names from. :param names: Names to import. :return: Import line in stub code.
[ "Generate", "an", "import", "line", "." ]
a6b18a823382d3c6be29c411fb33c58b6090d22c
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L615-L639
train
rochapps/django-csv-exports
django_csv_exports/admin.py
CSVExportAdmin.has_csv_permission
def has_csv_permission(self, request, obj=None): """ Returns True if the given request has permission to add an object. Can be overridden by the user in subclasses. By default, we assume all staff users can use this action unless `DJANGO_EXPORTS_REQUIRE_PERM` is set to True in yo...
python
def has_csv_permission(self, request, obj=None): """ Returns True if the given request has permission to add an object. Can be overridden by the user in subclasses. By default, we assume all staff users can use this action unless `DJANGO_EXPORTS_REQUIRE_PERM` is set to True in yo...
[ "def", "has_csv_permission", "(", "self", ",", "request", ",", "obj", "=", "None", ")", ":", "if", "getattr", "(", "settings", ",", "'DJANGO_EXPORTS_REQUIRE_PERM'", ",", "None", ")", ":", "opts", "=", "self", ".", "opts", "codename", "=", "'%s_%s'", "%", ...
Returns True if the given request has permission to add an object. Can be overridden by the user in subclasses. By default, we assume all staff users can use this action unless `DJANGO_EXPORTS_REQUIRE_PERM` is set to True in your django settings.
[ "Returns", "True", "if", "the", "given", "request", "has", "permission", "to", "add", "an", "object", ".", "Can", "be", "overridden", "by", "the", "user", "in", "subclasses", ".", "By", "default", "we", "assume", "all", "staff", "users", "can", "use", "t...
efcdde401d66f38a64b37afa909bfc16a6c21e9e
https://github.com/rochapps/django-csv-exports/blob/efcdde401d66f38a64b37afa909bfc16a6c21e9e/django_csv_exports/admin.py#L54-L65
train
zhemao/funktown
funktown/dictionary.py
ImmutableDict.assoc
def assoc(self, key, value): '''Returns a new ImmutableDict instance with value associated with key. The implicit parameter is not modified.''' copydict = ImmutableDict() copydict.tree = self.tree.assoc(hash(key), (key, value)) copydict._length = self._length + 1 return c...
python
def assoc(self, key, value): '''Returns a new ImmutableDict instance with value associated with key. The implicit parameter is not modified.''' copydict = ImmutableDict() copydict.tree = self.tree.assoc(hash(key), (key, value)) copydict._length = self._length + 1 return c...
[ "def", "assoc", "(", "self", ",", "key", ",", "value", ")", ":", "copydict", "=", "ImmutableDict", "(", ")", "copydict", ".", "tree", "=", "self", ".", "tree", ".", "assoc", "(", "hash", "(", "key", ")", ",", "(", "key", ",", "value", ")", ")", ...
Returns a new ImmutableDict instance with value associated with key. The implicit parameter is not modified.
[ "Returns", "a", "new", "ImmutableDict", "instance", "with", "value", "associated", "with", "key", ".", "The", "implicit", "parameter", "is", "not", "modified", "." ]
8d5c5a8bdad2b85b33b4cea3febd820c2657c375
https://github.com/zhemao/funktown/blob/8d5c5a8bdad2b85b33b4cea3febd820c2657c375/funktown/dictionary.py#L22-L28
train
zhemao/funktown
funktown/dictionary.py
ImmutableDict.update
def update(self, other=None, **kwargs): '''Takes the same arguments as the update method in the builtin dict class. However, this version returns a new ImmutableDict instead of modifying in-place.''' copydict = ImmutableDict() if other: vallist = [(hash(key), (key, ot...
python
def update(self, other=None, **kwargs): '''Takes the same arguments as the update method in the builtin dict class. However, this version returns a new ImmutableDict instead of modifying in-place.''' copydict = ImmutableDict() if other: vallist = [(hash(key), (key, ot...
[ "def", "update", "(", "self", ",", "other", "=", "None", ",", "*", "*", "kwargs", ")", ":", "copydict", "=", "ImmutableDict", "(", ")", "if", "other", ":", "vallist", "=", "[", "(", "hash", "(", "key", ")", ",", "(", "key", ",", "other", "[", "...
Takes the same arguments as the update method in the builtin dict class. However, this version returns a new ImmutableDict instead of modifying in-place.
[ "Takes", "the", "same", "arguments", "as", "the", "update", "method", "in", "the", "builtin", "dict", "class", ".", "However", "this", "version", "returns", "a", "new", "ImmutableDict", "instead", "of", "modifying", "in", "-", "place", "." ]
8d5c5a8bdad2b85b33b4cea3febd820c2657c375
https://github.com/zhemao/funktown/blob/8d5c5a8bdad2b85b33b4cea3febd820c2657c375/funktown/dictionary.py#L30-L42
train
zhemao/funktown
funktown/dictionary.py
ImmutableDict.remove
def remove(self, key): '''Returns a new ImmutableDict with the given key removed.''' copydict = ImmutableDict() copydict.tree = self.tree.remove(hash(key)) copydict._length = self._length - 1 return copydict
python
def remove(self, key): '''Returns a new ImmutableDict with the given key removed.''' copydict = ImmutableDict() copydict.tree = self.tree.remove(hash(key)) copydict._length = self._length - 1 return copydict
[ "def", "remove", "(", "self", ",", "key", ")", ":", "copydict", "=", "ImmutableDict", "(", ")", "copydict", ".", "tree", "=", "self", ".", "tree", ".", "remove", "(", "hash", "(", "key", ")", ")", "copydict", ".", "_length", "=", "self", ".", "_len...
Returns a new ImmutableDict with the given key removed.
[ "Returns", "a", "new", "ImmutableDict", "with", "the", "given", "key", "removed", "." ]
8d5c5a8bdad2b85b33b4cea3febd820c2657c375
https://github.com/zhemao/funktown/blob/8d5c5a8bdad2b85b33b4cea3febd820c2657c375/funktown/dictionary.py#L44-L49
train
thiagokokada/livedumper
src/livedumper/dumper.py
LivestreamerDumper._load_config
def _load_config(self): "Load and parse config file, pass options to livestreamer" config = SafeConfigParser() config_file = os.path.join(self.config_path, 'settings.ini') config.read(config_file) for option, type in list(AVAILABLE_OPTIONS.items()): if confi...
python
def _load_config(self): "Load and parse config file, pass options to livestreamer" config = SafeConfigParser() config_file = os.path.join(self.config_path, 'settings.ini') config.read(config_file) for option, type in list(AVAILABLE_OPTIONS.items()): if confi...
[ "def", "_load_config", "(", "self", ")", ":", "config", "=", "SafeConfigParser", "(", ")", "config_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "config_path", ",", "'settings.ini'", ")", "config", ".", "read", "(", "config_file", ")", "f...
Load and parse config file, pass options to livestreamer
[ "Load", "and", "parse", "config", "file", "pass", "options", "to", "livestreamer" ]
f6441283269b4a602cafea3be5cda9446fc64005
https://github.com/thiagokokada/livedumper/blob/f6441283269b4a602cafea3be5cda9446fc64005/src/livedumper/dumper.py#L116-L134
train
Capitains/MyCapytain
MyCapytain/resources/prototypes/cts/text.py
PrototypeCtsNode.urn
def urn(self, value: Union[URN, str]): """ Set the urn :param value: URN to be saved :raises: *TypeError* when the value is not URN compatible """ if isinstance(value, str): value = URN(value) elif not isinstance(value, URN): raise TypeError("New...
python
def urn(self, value: Union[URN, str]): """ Set the urn :param value: URN to be saved :raises: *TypeError* when the value is not URN compatible """ if isinstance(value, str): value = URN(value) elif not isinstance(value, URN): raise TypeError("New...
[ "def", "urn", "(", "self", ",", "value", ":", "Union", "[", "URN", ",", "str", "]", ")", ":", "if", "isinstance", "(", "value", ",", "str", ")", ":", "value", "=", "URN", "(", "value", ")", "elif", "not", "isinstance", "(", "value", ",", "URN", ...
Set the urn :param value: URN to be saved :raises: *TypeError* when the value is not URN compatible
[ "Set", "the", "urn" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/text.py#L55-L66
train
Capitains/MyCapytain
MyCapytain/resources/prototypes/cts/text.py
PrototypeCtsNode.get_cts_metadata
def get_cts_metadata(self, key: str, lang: str = None) -> Literal: """ Get easily a metadata from the CTS namespace :param key: CTS property to retrieve :param lang: Language in which it should be :return: Literal value of the CTS graph property """ return self.metadata....
python
def get_cts_metadata(self, key: str, lang: str = None) -> Literal: """ Get easily a metadata from the CTS namespace :param key: CTS property to retrieve :param lang: Language in which it should be :return: Literal value of the CTS graph property """ return self.metadata....
[ "def", "get_cts_metadata", "(", "self", ",", "key", ":", "str", ",", "lang", ":", "str", "=", "None", ")", "->", "Literal", ":", "return", "self", ".", "metadata", ".", "get_single", "(", "RDF_NAMESPACES", ".", "CTS", ".", "term", "(", "key", ")", ",...
Get easily a metadata from the CTS namespace :param key: CTS property to retrieve :param lang: Language in which it should be :return: Literal value of the CTS graph property
[ "Get", "easily", "a", "metadata", "from", "the", "CTS", "namespace" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/text.py#L68-L75
train
Capitains/MyCapytain
MyCapytain/resources/prototypes/cts/text.py
PrototypeCtsNode.set_metadata_from_collection
def set_metadata_from_collection(self, text_metadata: CtsTextMetadata): """ Set the object metadata using its collections recursively :param text_metadata: Object representing the current text as a collection :type text_metadata: CtsEditionMetadata or CtsTranslationMetadata """ ...
python
def set_metadata_from_collection(self, text_metadata: CtsTextMetadata): """ Set the object metadata using its collections recursively :param text_metadata: Object representing the current text as a collection :type text_metadata: CtsEditionMetadata or CtsTranslationMetadata """ ...
[ "def", "set_metadata_from_collection", "(", "self", ",", "text_metadata", ":", "CtsTextMetadata", ")", ":", "edition", ",", "work", ",", "textgroup", "=", "tuple", "(", "(", "[", "text_metadata", "]", "+", "text_metadata", ".", "parents", ")", "[", ":", "3",...
Set the object metadata using its collections recursively :param text_metadata: Object representing the current text as a collection :type text_metadata: CtsEditionMetadata or CtsTranslationMetadata
[ "Set", "the", "object", "metadata", "using", "its", "collections", "recursively" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/text.py#L94-L123
train
hawkular/hawkular-client-python
hawkular/metrics.py
create_datapoint
def create_datapoint(value, timestamp=None, **tags): """ Creates a single datapoint dict with a value, timestamp and tags. :param value: Value of the datapoint. Type depends on the id's MetricType :param timestamp: Optional timestamp of the datapoint. Uses client current time if not set. Millisecond ac...
python
def create_datapoint(value, timestamp=None, **tags): """ Creates a single datapoint dict with a value, timestamp and tags. :param value: Value of the datapoint. Type depends on the id's MetricType :param timestamp: Optional timestamp of the datapoint. Uses client current time if not set. Millisecond ac...
[ "def", "create_datapoint", "(", "value", ",", "timestamp", "=", "None", ",", "*", "*", "tags", ")", ":", "if", "timestamp", "is", "None", ":", "timestamp", "=", "time_millis", "(", ")", "if", "type", "(", "timestamp", ")", "is", "datetime", ":", "times...
Creates a single datapoint dict with a value, timestamp and tags. :param value: Value of the datapoint. Type depends on the id's MetricType :param timestamp: Optional timestamp of the datapoint. Uses client current time if not set. Millisecond accuracy. Can be datetime instance also. :param tags: Optional ...
[ "Creates", "a", "single", "datapoint", "dict", "with", "a", "value", "timestamp", "and", "tags", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L362-L382
train
hawkular/hawkular-client-python
hawkular/metrics.py
create_metric
def create_metric(metric_type, metric_id, data): """ Create Hawkular-Metrics' submittable structure. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id :param data: A datapoint or a list of datapoints created with create_datapoint(value, timest...
python
def create_metric(metric_type, metric_id, data): """ Create Hawkular-Metrics' submittable structure. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id :param data: A datapoint or a list of datapoints created with create_datapoint(value, timest...
[ "def", "create_metric", "(", "metric_type", ",", "metric_id", ",", "data", ")", ":", "if", "not", "isinstance", "(", "data", ",", "list", ")", ":", "data", "=", "[", "data", "]", "return", "{", "'type'", ":", "metric_type", ",", "'id'", ":", "metric_id...
Create Hawkular-Metrics' submittable structure. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id :param data: A datapoint or a list of datapoints created with create_datapoint(value, timestamp, tags)
[ "Create", "Hawkular", "-", "Metrics", "submittable", "structure", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L384-L395
train
hawkular/hawkular-client-python
hawkular/metrics.py
HawkularMetricsClient.put
def put(self, data): """ Send multiple different metric_ids to the server in a single batch. Metrics can be a mixture of types. :param data: A dict or a list of dicts created with create_metric(metric_type, metric_id, datapoints) """ if not isinstance(data, list): ...
python
def put(self, data): """ Send multiple different metric_ids to the server in a single batch. Metrics can be a mixture of types. :param data: A dict or a list of dicts created with create_metric(metric_type, metric_id, datapoints) """ if not isinstance(data, list): ...
[ "def", "put", "(", "self", ",", "data", ")", ":", "if", "not", "isinstance", "(", "data", ",", "list", ")", ":", "data", "=", "[", "data", "]", "r", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "d", "in", "data", ":", "metric_...
Send multiple different metric_ids to the server in a single batch. Metrics can be a mixture of types. :param data: A dict or a list of dicts created with create_metric(metric_type, metric_id, datapoints)
[ "Send", "multiple", "different", "metric_ids", "to", "the", "server", "in", "a", "single", "batch", ".", "Metrics", "can", "be", "a", "mixture", "of", "types", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L109-L129
train
hawkular/hawkular-client-python
hawkular/metrics.py
HawkularMetricsClient.push
def push(self, metric_type, metric_id, value, timestamp=None): """ Pushes a single metric_id, datapoint combination to the server. This method is an assistant method for the put method by removing the need to create data structures first. :param metric_type: MetricType to be ma...
python
def push(self, metric_type, metric_id, value, timestamp=None): """ Pushes a single metric_id, datapoint combination to the server. This method is an assistant method for the put method by removing the need to create data structures first. :param metric_type: MetricType to be ma...
[ "def", "push", "(", "self", ",", "metric_type", ",", "metric_id", ",", "value", ",", "timestamp", "=", "None", ")", ":", "if", "type", "(", "timestamp", ")", "is", "datetime", ":", "timestamp", "=", "datetime_to_time_millis", "(", "timestamp", ")", "item",...
Pushes a single metric_id, datapoint combination to the server. This method is an assistant method for the put method by removing the need to create data structures first. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id ...
[ "Pushes", "a", "single", "metric_id", "datapoint", "combination", "to", "the", "server", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L131-L147
train
hawkular/hawkular-client-python
hawkular/metrics.py
HawkularMetricsClient.query_metric
def query_metric(self, metric_type, metric_id, start=None, end=None, **query_options): """ Query for metrics datapoints from the server. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id :param start: Milliseconds since epo...
python
def query_metric(self, metric_type, metric_id, start=None, end=None, **query_options): """ Query for metrics datapoints from the server. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id :param start: Milliseconds since epo...
[ "def", "query_metric", "(", "self", ",", "metric_type", ",", "metric_id", ",", "start", "=", "None", ",", "end", "=", "None", ",", "*", "*", "query_options", ")", ":", "if", "start", "is", "not", "None", ":", "if", "type", "(", "start", ")", "is", ...
Query for metrics datapoints from the server. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id :param start: Milliseconds since epoch or datetime instance :param end: Milliseconds since epoch or datetime instance :param qu...
[ "Query", "for", "metrics", "datapoints", "from", "the", "server", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L149-L174
train
hawkular/hawkular-client-python
hawkular/metrics.py
HawkularMetricsClient.query_metric_stats
def query_metric_stats(self, metric_type, metric_id=None, start=None, end=None, bucketDuration=None, **query_options): """ Query for metric aggregates from the server. This is called buckets in the Hawkular-Metrics documentation. :param metric_type: MetricType to be matched (required) :...
python
def query_metric_stats(self, metric_type, metric_id=None, start=None, end=None, bucketDuration=None, **query_options): """ Query for metric aggregates from the server. This is called buckets in the Hawkular-Metrics documentation. :param metric_type: MetricType to be matched (required) :...
[ "def", "query_metric_stats", "(", "self", ",", "metric_type", ",", "metric_id", "=", "None", ",", "start", "=", "None", ",", "end", "=", "None", ",", "bucketDuration", "=", "None", ",", "*", "*", "query_options", ")", ":", "if", "start", "is", "not", "...
Query for metric aggregates from the server. This is called buckets in the Hawkular-Metrics documentation. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id or None for tags matching only :param start: Milliseconds since epoch or datetime ...
[ "Query", "for", "metric", "aggregates", "from", "the", "server", ".", "This", "is", "called", "buckets", "in", "the", "Hawkular", "-", "Metrics", "documentation", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L176-L212
train
hawkular/hawkular-client-python
hawkular/metrics.py
HawkularMetricsClient.query_metric_definition
def query_metric_definition(self, metric_type, metric_id): """ Query definition of a single metric id. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id """ return self._get(self._get_metrics_single_url(metric_type,...
python
def query_metric_definition(self, metric_type, metric_id): """ Query definition of a single metric id. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id """ return self._get(self._get_metrics_single_url(metric_type,...
[ "def", "query_metric_definition", "(", "self", ",", "metric_type", ",", "metric_id", ")", ":", "return", "self", ".", "_get", "(", "self", ".", "_get_metrics_single_url", "(", "metric_type", ",", "metric_id", ")", ")" ]
Query definition of a single metric id. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id
[ "Query", "definition", "of", "a", "single", "metric", "id", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L214-L221
train
hawkular/hawkular-client-python
hawkular/metrics.py
HawkularMetricsClient.query_metric_definitions
def query_metric_definitions(self, metric_type=None, id_filter=None, **tags): """ Query available metric definitions. :param metric_type: A MetricType to be queried. If left to None, matches all the MetricTypes :param id_filter: Filter the id with regexp is tag filtering is used, otherw...
python
def query_metric_definitions(self, metric_type=None, id_filter=None, **tags): """ Query available metric definitions. :param metric_type: A MetricType to be queried. If left to None, matches all the MetricTypes :param id_filter: Filter the id with regexp is tag filtering is used, otherw...
[ "def", "query_metric_definitions", "(", "self", ",", "metric_type", "=", "None", ",", "id_filter", "=", "None", ",", "*", "*", "tags", ")", ":", "params", "=", "{", "}", "if", "id_filter", "is", "not", "None", ":", "params", "[", "'id'", "]", "=", "i...
Query available metric definitions. :param metric_type: A MetricType to be queried. If left to None, matches all the MetricTypes :param id_filter: Filter the id with regexp is tag filtering is used, otherwise a list of exact metric ids :param tags: A dict of tag key/value pairs. Uses Hawkular-M...
[ "Query", "available", "metric", "definitions", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L223-L242
train
hawkular/hawkular-client-python
hawkular/metrics.py
HawkularMetricsClient.query_tag_values
def query_tag_values(self, metric_type=None, **tags): """ Query for possible tag values. :param metric_type: A MetricType to be queried. If left to None, matches all the MetricTypes :param tags: A dict of tag key/value pairs. Uses Hawkular-Metrics tag query language for syntax "...
python
def query_tag_values(self, metric_type=None, **tags): """ Query for possible tag values. :param metric_type: A MetricType to be queried. If left to None, matches all the MetricTypes :param tags: A dict of tag key/value pairs. Uses Hawkular-Metrics tag query language for syntax "...
[ "def", "query_tag_values", "(", "self", ",", "metric_type", "=", "None", ",", "*", "*", "tags", ")", ":", "tagql", "=", "self", ".", "_transform_tags", "(", "*", "*", "tags", ")", "return", "self", ".", "_get", "(", "self", ".", "_get_metrics_tags_url", ...
Query for possible tag values. :param metric_type: A MetricType to be queried. If left to None, matches all the MetricTypes :param tags: A dict of tag key/value pairs. Uses Hawkular-Metrics tag query language for syntax
[ "Query", "for", "possible", "tag", "values", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L244-L253
train
hawkular/hawkular-client-python
hawkular/metrics.py
HawkularMetricsClient.query_metric_tags
def query_metric_tags(self, metric_type, metric_id): """ Returns a list of tags in the metric definition. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id """ definition = self._get(self._get_metrics_tags_url(self....
python
def query_metric_tags(self, metric_type, metric_id): """ Returns a list of tags in the metric definition. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id """ definition = self._get(self._get_metrics_tags_url(self....
[ "def", "query_metric_tags", "(", "self", ",", "metric_type", ",", "metric_id", ")", ":", "definition", "=", "self", ".", "_get", "(", "self", ".", "_get_metrics_tags_url", "(", "self", ".", "_get_metrics_single_url", "(", "metric_type", ",", "metric_id", ")", ...
Returns a list of tags in the metric definition. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id
[ "Returns", "a", "list", "of", "tags", "in", "the", "metric", "definition", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L284-L292
train
hawkular/hawkular-client-python
hawkular/metrics.py
HawkularMetricsClient.delete_metric_tags
def delete_metric_tags(self, metric_type, metric_id, **deleted_tags): """ Delete one or more tags from the metric definition. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id :param deleted_tags: List of deleted tag names....
python
def delete_metric_tags(self, metric_type, metric_id, **deleted_tags): """ Delete one or more tags from the metric definition. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id :param deleted_tags: List of deleted tag names....
[ "def", "delete_metric_tags", "(", "self", ",", "metric_type", ",", "metric_id", ",", "*", "*", "deleted_tags", ")", ":", "tags", "=", "self", ".", "_transform_tags", "(", "*", "*", "deleted_tags", ")", "tags_url", "=", "self", ".", "_get_metrics_tags_url", "...
Delete one or more tags from the metric definition. :param metric_type: MetricType to be matched (required) :param metric_id: Exact string matching metric id :param deleted_tags: List of deleted tag names. Values can be set to anything
[ "Delete", "one", "or", "more", "tags", "from", "the", "metric", "definition", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L304-L315
train
hawkular/hawkular-client-python
hawkular/metrics.py
HawkularMetricsClient.create_tenant
def create_tenant(self, tenant_id, retentions=None): """ Create a tenant. Currently nothing can be set (to be fixed after the master version of Hawkular-Metrics has fixed implementation. :param retentions: A set of retention settings, see Hawkular-Metrics documentation for more info ...
python
def create_tenant(self, tenant_id, retentions=None): """ Create a tenant. Currently nothing can be set (to be fixed after the master version of Hawkular-Metrics has fixed implementation. :param retentions: A set of retention settings, see Hawkular-Metrics documentation for more info ...
[ "def", "create_tenant", "(", "self", ",", "tenant_id", ",", "retentions", "=", "None", ")", ":", "item", "=", "{", "'id'", ":", "tenant_id", "}", "if", "retentions", "is", "not", "None", ":", "item", "[", "'retentions'", "]", "=", "retentions", "self", ...
Create a tenant. Currently nothing can be set (to be fixed after the master version of Hawkular-Metrics has fixed implementation. :param retentions: A set of retention settings, see Hawkular-Metrics documentation for more info
[ "Create", "a", "tenant", ".", "Currently", "nothing", "can", "be", "set", "(", "to", "be", "fixed", "after", "the", "master", "version", "of", "Hawkular", "-", "Metrics", "has", "fixed", "implementation", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L327-L338
train
aiidateam/aiida-codtools
aiida_codtools/common/resources.py
get_default_options
def get_default_options(num_machines=1, max_wallclock_seconds=1800, withmpi=False): """ Return an instance of the options dictionary with the minimally required parameters for a JobCalculation and set to default values unless overriden :param num_machines: set the number of nodes, default=1 :param ...
python
def get_default_options(num_machines=1, max_wallclock_seconds=1800, withmpi=False): """ Return an instance of the options dictionary with the minimally required parameters for a JobCalculation and set to default values unless overriden :param num_machines: set the number of nodes, default=1 :param ...
[ "def", "get_default_options", "(", "num_machines", "=", "1", ",", "max_wallclock_seconds", "=", "1800", ",", "withmpi", "=", "False", ")", ":", "return", "{", "'resources'", ":", "{", "'num_machines'", ":", "int", "(", "num_machines", ")", "}", ",", "'max_wa...
Return an instance of the options dictionary with the minimally required parameters for a JobCalculation and set to default values unless overriden :param num_machines: set the number of nodes, default=1 :param max_wallclock_seconds: set the maximum number of wallclock seconds, default=1800 :param with...
[ "Return", "an", "instance", "of", "the", "options", "dictionary", "with", "the", "minimally", "required", "parameters", "for", "a", "JobCalculation", "and", "set", "to", "default", "values", "unless", "overriden" ]
da5e4259b7a2e86cf0cc3f997e11dd36d445fa94
https://github.com/aiidateam/aiida-codtools/blob/da5e4259b7a2e86cf0cc3f997e11dd36d445fa94/aiida_codtools/common/resources.py#L5-L20
train
aloetesting/aloe_webdriver
aloe_webdriver/screenshot_failed.py
take_screenshot
def take_screenshot(self): """Take a screenshot after a failed step.""" if not self.failed: return browser = getattr(world, 'browser', None) if not browser: return try: scenario_name = self.scenario.name scenario_index = \ self.scenario.feature.scenario...
python
def take_screenshot(self): """Take a screenshot after a failed step.""" if not self.failed: return browser = getattr(world, 'browser', None) if not browser: return try: scenario_name = self.scenario.name scenario_index = \ self.scenario.feature.scenario...
[ "def", "take_screenshot", "(", "self", ")", ":", "if", "not", "self", ".", "failed", ":", "return", "browser", "=", "getattr", "(", "world", ",", "'browser'", ",", "None", ")", "if", "not", "browser", ":", "return", "try", ":", "scenario_name", "=", "s...
Take a screenshot after a failed step.
[ "Take", "a", "screenshot", "after", "a", "failed", "step", "." ]
65d847da4bdc63f9c015cb19d4efdee87df8ffad
https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/screenshot_failed.py#L64-L100
train
SHDShim/pytheos
pytheos/eqn_kunc.py
kunc_p
def kunc_p(v, v0, k0, k0p, order=5): """ calculate Kunc EOS see Dorogokupets 2015 for detail :param v: unit-cell volume in A^3 :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at reference conditions ...
python
def kunc_p(v, v0, k0, k0p, order=5): """ calculate Kunc EOS see Dorogokupets 2015 for detail :param v: unit-cell volume in A^3 :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at reference conditions ...
[ "def", "kunc_p", "(", "v", ",", "v0", ",", "k0", ",", "k0p", ",", "order", "=", "5", ")", ":", "return", "cal_p_kunc", "(", "v", ",", "[", "v0", ",", "k0", ",", "k0p", "]", ",", "order", "=", "order", ",", "uncertainties", "=", "isuncertainties",...
calculate Kunc EOS see Dorogokupets 2015 for detail :param v: unit-cell volume in A^3 :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at reference conditions :param order: order for the Kunc equation ...
[ "calculate", "Kunc", "EOS", "see", "Dorogokupets", "2015", "for", "detail" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_kunc.py#L13-L26
train
SHDShim/pytheos
pytheos/eqn_kunc.py
cal_p_kunc
def cal_p_kunc(v, k, order=5, uncertainties=True): """ calculate Kunc EOS, see Dorogokupets2015 for functional form :param v: unit-cell volume in A^3 :param k: [v0, k0, k0p] :param order: order for the Kunc equation :param uncertainties: use of uncertainties package :return: pressure in...
python
def cal_p_kunc(v, k, order=5, uncertainties=True): """ calculate Kunc EOS, see Dorogokupets2015 for functional form :param v: unit-cell volume in A^3 :param k: [v0, k0, k0p] :param order: order for the Kunc equation :param uncertainties: use of uncertainties package :return: pressure in...
[ "def", "cal_p_kunc", "(", "v", ",", "k", ",", "order", "=", "5", ",", "uncertainties", "=", "True", ")", ":", "v0", "=", "k", "[", "0", "]", "k0", "=", "k", "[", "1", "]", "k0p", "=", "k", "[", "2", "]", "x", "=", "np", ".", "power", "(",...
calculate Kunc EOS, see Dorogokupets2015 for functional form :param v: unit-cell volume in A^3 :param k: [v0, k0, k0p] :param order: order for the Kunc equation :param uncertainties: use of uncertainties package :return: pressure in GPa :note: internal function
[ "calculate", "Kunc", "EOS", "see", "Dorogokupets2015", "for", "functional", "form" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_kunc.py#L29-L51
train
totalgood/twip
twip/futil.py
find_files
def find_files(path='', ext='', level=None, typ=list, dirs=False, files=True, verbosity=0): """ Recursively find all files in the indicated directory Filter by the indicated file name extension (ext) Args: path (str): Root/base path to search. ext (str): File name extension. Only file paths...
python
def find_files(path='', ext='', level=None, typ=list, dirs=False, files=True, verbosity=0): """ Recursively find all files in the indicated directory Filter by the indicated file name extension (ext) Args: path (str): Root/base path to search. ext (str): File name extension. Only file paths...
[ "def", "find_files", "(", "path", "=", "''", ",", "ext", "=", "''", ",", "level", "=", "None", ",", "typ", "=", "list", ",", "dirs", "=", "False", ",", "files", "=", "True", ",", "verbosity", "=", "0", ")", ":", "gen", "=", "generate_files", "(",...
Recursively find all files in the indicated directory Filter by the indicated file name extension (ext) Args: path (str): Root/base path to search. ext (str): File name extension. Only file paths that ".endswith()" this string will be returned level (int, optional): Depth of file tree to ...
[ "Recursively", "find", "all", "files", "in", "the", "indicated", "directory" ]
5c0411d2acfbe5b421841072814c9152591c03f7
https://github.com/totalgood/twip/blob/5c0411d2acfbe5b421841072814c9152591c03f7/twip/futil.py#L111-L163
train
erijo/tellive-py
tellive/livemessage.py
LiveMessageToken.serialize
def serialize(self): """Serialize the token and return it as bytes.""" if type(self.value) == int: return "i{:X}s".format(self.value).encode('ascii') if type(self.value) == str: value = self.value.encode('utf-8') return "{:X}:".format(len(value)).encode('asci...
python
def serialize(self): """Serialize the token and return it as bytes.""" if type(self.value) == int: return "i{:X}s".format(self.value).encode('ascii') if type(self.value) == str: value = self.value.encode('utf-8') return "{:X}:".format(len(value)).encode('asci...
[ "def", "serialize", "(", "self", ")", ":", "if", "type", "(", "self", ".", "value", ")", "==", "int", ":", "return", "\"i{:X}s\"", ".", "format", "(", "self", ".", "value", ")", ".", "encode", "(", "'ascii'", ")", "if", "type", "(", "self", ".", ...
Serialize the token and return it as bytes.
[ "Serialize", "the", "token", "and", "return", "it", "as", "bytes", "." ]
a84ebb1eb29ee4c69a085e55e523ac5fff0087fc
https://github.com/erijo/tellive-py/blob/a84ebb1eb29ee4c69a085e55e523ac5fff0087fc/tellive/livemessage.py#L31-L55
train
ChrisBeaumont/smother
smother/control.py
Smother.write
def write(self, file_or_path, append=False, timeout=10): """ Write Smother results to a file. Parameters ---------- fiile_or_path : str Path to write report to append : bool If True, read an existing smother report from `outpath` and c...
python
def write(self, file_or_path, append=False, timeout=10): """ Write Smother results to a file. Parameters ---------- fiile_or_path : str Path to write report to append : bool If True, read an existing smother report from `outpath` and c...
[ "def", "write", "(", "self", ",", "file_or_path", ",", "append", "=", "False", ",", "timeout", "=", "10", ")", ":", "if", "isinstance", "(", "file_or_path", ",", "six", ".", "string_types", ")", ":", "if", "self", ".", "coverage", ":", "file_or_path", ...
Write Smother results to a file. Parameters ---------- fiile_or_path : str Path to write report to append : bool If True, read an existing smother report from `outpath` and combine it with this file before writing. timeout : int Ti...
[ "Write", "Smother", "results", "to", "a", "file", "." ]
65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb
https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/control.py#L87-L137
train
ChrisBeaumont/smother
smother/control.py
Smother.query_context
def query_context(self, regions, file_factory=PythonFile): """ Return which set of test contexts intersect a set of code regions. Parameters ---------- regions: A sequence of Intervals file_factory: Callable (optional, default PythonFile) A callable that ta...
python
def query_context(self, regions, file_factory=PythonFile): """ Return which set of test contexts intersect a set of code regions. Parameters ---------- regions: A sequence of Intervals file_factory: Callable (optional, default PythonFile) A callable that ta...
[ "def", "query_context", "(", "self", ",", "regions", ",", "file_factory", "=", "PythonFile", ")", ":", "result", "=", "set", "(", ")", "for", "region", "in", "regions", ":", "try", ":", "pf", "=", "file_factory", "(", "region", ".", "filename", ")", "e...
Return which set of test contexts intersect a set of code regions. Parameters ---------- regions: A sequence of Intervals file_factory: Callable (optional, default PythonFile) A callable that takes a filename and returns a PythonFile object. Returns ...
[ "Return", "which", "set", "of", "test", "contexts", "intersect", "a", "set", "of", "code", "regions", "." ]
65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb
https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/control.py#L174-L214
train
Capitains/MyCapytain
MyCapytain/common/reference/_base.py
BaseCitationSet.add_child
def add_child(self, child): """ Adds a child to the CitationSet :param child: Child citation to add :return: """ if isinstance(child, BaseCitation): self._children.append(child)
python
def add_child(self, child): """ Adds a child to the CitationSet :param child: Child citation to add :return: """ if isinstance(child, BaseCitation): self._children.append(child)
[ "def", "add_child", "(", "self", ",", "child", ")", ":", "if", "isinstance", "(", "child", ",", "BaseCitation", ")", ":", "self", ".", "_children", ".", "append", "(", "child", ")" ]
Adds a child to the CitationSet :param child: Child citation to add :return:
[ "Adds", "a", "child", "to", "the", "CitationSet" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/common/reference/_base.py#L57-L64
train
Capitains/MyCapytain
MyCapytain/common/reference/_base.py
BaseCitation.depth
def depth(self) -> int: """ Depth of the citation scheme .. example:: If we have a Book, Poem, Line system, and the citation we are looking at is Poem, depth is 1 :rtype: int :return: Depth of the citation scheme """ if len(self.children): return 1 + max([c...
python
def depth(self) -> int: """ Depth of the citation scheme .. example:: If we have a Book, Poem, Line system, and the citation we are looking at is Poem, depth is 1 :rtype: int :return: Depth of the citation scheme """ if len(self.children): return 1 + max([c...
[ "def", "depth", "(", "self", ")", "->", "int", ":", "if", "len", "(", "self", ".", "children", ")", ":", "return", "1", "+", "max", "(", "[", "child", ".", "depth", "for", "child", "in", "self", ".", "children", "]", ")", "else", ":", "return", ...
Depth of the citation scheme .. example:: If we have a Book, Poem, Line system, and the citation we are looking at is Poem, depth is 1 :rtype: int :return: Depth of the citation scheme
[ "Depth", "of", "the", "citation", "scheme" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/common/reference/_base.py#L298-L310
train
Capitains/MyCapytain
MyCapytain/resources/prototypes/cts/inventory.py
PrototypeCtsCollection.set_link
def set_link(self, prop, value): """ Set given link in CTS Namespace .. example:: collection.set_link(NAMESPACES.CTS.about, "urn:cts:latinLit:phi1294.phi002") :param prop: Property to set (Without namespace) :param value: Value to set for given property """ ...
python
def set_link(self, prop, value): """ Set given link in CTS Namespace .. example:: collection.set_link(NAMESPACES.CTS.about, "urn:cts:latinLit:phi1294.phi002") :param prop: Property to set (Without namespace) :param value: Value to set for given property """ ...
[ "def", "set_link", "(", "self", ",", "prop", ",", "value", ")", ":", "# https://rdflib.readthedocs.io/en/stable/", "# URIRef == identifiers (urn, http, URI in general)", "# Literal == String or Number (can have a language)", "# BNode == Anonymous nodes (So no specific identifier)", "#\t\...
Set given link in CTS Namespace .. example:: collection.set_link(NAMESPACES.CTS.about, "urn:cts:latinLit:phi1294.phi002") :param prop: Property to set (Without namespace) :param value: Value to set for given property
[ "Set", "given", "link", "in", "CTS", "Namespace" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L118-L135
train
Capitains/MyCapytain
MyCapytain/resources/prototypes/cts/inventory.py
CtsTextMetadata.editions
def editions(self): """ Get all editions of the texts :return: List of editions :rtype: [CtsTextMetadata] """ return [ item for urn, item in self.parent.children.items() if isinstance(item, CtsEditionMetadata) ]
python
def editions(self): """ Get all editions of the texts :return: List of editions :rtype: [CtsTextMetadata] """ return [ item for urn, item in self.parent.children.items() if isinstance(item, CtsEditionMetadata) ]
[ "def", "editions", "(", "self", ")", ":", "return", "[", "item", "for", "urn", ",", "item", "in", "self", ".", "parent", ".", "children", ".", "items", "(", ")", "if", "isinstance", "(", "item", ",", "CtsEditionMetadata", ")", "]" ]
Get all editions of the texts :return: List of editions :rtype: [CtsTextMetadata]
[ "Get", "all", "editions", "of", "the", "texts" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L263-L273
train
Capitains/MyCapytain
MyCapytain/resources/prototypes/cts/inventory.py
CtsTextMetadata.get_description
def get_description(self, lang=None): """ Get the DC description of the object :param lang: Lang to retrieve :return: Description string representation :rtype: Literal """ return self.metadata.get_single(key=RDF_NAMESPACES.CTS.description, lang=lang)
python
def get_description(self, lang=None): """ Get the DC description of the object :param lang: Lang to retrieve :return: Description string representation :rtype: Literal """ return self.metadata.get_single(key=RDF_NAMESPACES.CTS.description, lang=lang)
[ "def", "get_description", "(", "self", ",", "lang", "=", "None", ")", ":", "return", "self", ".", "metadata", ".", "get_single", "(", "key", "=", "RDF_NAMESPACES", ".", "CTS", ".", "description", ",", "lang", "=", "lang", ")" ]
Get the DC description of the object :param lang: Lang to retrieve :return: Description string representation :rtype: Literal
[ "Get", "the", "DC", "description", "of", "the", "object" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L360-L367
train
Capitains/MyCapytain
MyCapytain/resources/prototypes/cts/inventory.py
CtsWorkMetadata.lang
def lang(self): """ Languages this text is in :return: List of available languages """ return str(self.graph.value(self.asNode(), DC.language))
python
def lang(self): """ Languages this text is in :return: List of available languages """ return str(self.graph.value(self.asNode(), DC.language))
[ "def", "lang", "(", "self", ")", ":", "return", "str", "(", "self", ".", "graph", ".", "value", "(", "self", ".", "asNode", "(", ")", ",", "DC", ".", "language", ")", ")" ]
Languages this text is in :return: List of available languages
[ "Languages", "this", "text", "is", "in" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L461-L466
train
Capitains/MyCapytain
MyCapytain/resources/prototypes/cts/inventory.py
CtsWorkMetadata.lang
def lang(self, lang): """ Language this text is available in :param lang: Language to add :type lang: str """ self.graph.set((self.asNode(), DC.language, Literal(lang)))
python
def lang(self, lang): """ Language this text is available in :param lang: Language to add :type lang: str """ self.graph.set((self.asNode(), DC.language, Literal(lang)))
[ "def", "lang", "(", "self", ",", "lang", ")", ":", "self", ".", "graph", ".", "set", "(", "(", "self", ".", "asNode", "(", ")", ",", "DC", ".", "language", ",", "Literal", "(", "lang", ")", ")", ")" ]
Language this text is available in :param lang: Language to add :type lang: str
[ "Language", "this", "text", "is", "available", "in" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L469-L475
train
Capitains/MyCapytain
MyCapytain/resources/prototypes/cts/inventory.py
CtsWorkMetadata.update
def update(self, other): """ Merge two XmlCtsWorkMetadata Objects. - Original (left Object) keeps his parent. - Added document overwrite text if it already exists :param other: XmlCtsWorkMetadata object :type other: CtsWorkMetadata :return: XmlCtsWorkMetadata Object ...
python
def update(self, other): """ Merge two XmlCtsWorkMetadata Objects. - Original (left Object) keeps his parent. - Added document overwrite text if it already exists :param other: XmlCtsWorkMetadata object :type other: CtsWorkMetadata :return: XmlCtsWorkMetadata Object ...
[ "def", "update", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "CtsWorkMetadata", ")", ":", "raise", "TypeError", "(", "\"Cannot add %s to CtsWorkMetadata\"", "%", "type", "(", "other", ")", ")", "elif", "self", ".", "u...
Merge two XmlCtsWorkMetadata Objects. - Original (left Object) keeps his parent. - Added document overwrite text if it already exists :param other: XmlCtsWorkMetadata object :type other: CtsWorkMetadata :return: XmlCtsWorkMetadata Object :rtype XmlCtsWorkMetadata:
[ "Merge", "two", "XmlCtsWorkMetadata", "Objects", "." ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L477-L498
train
Capitains/MyCapytain
MyCapytain/resources/prototypes/cts/inventory.py
CtsWorkMetadata.get_translation_in
def get_translation_in(self, key=None): """ Find a translation with given language :param key: Language to find :type key: text_type :rtype: [CtsTextMetadata] :returns: List of availables translations """ if key is not None: return [ i...
python
def get_translation_in(self, key=None): """ Find a translation with given language :param key: Language to find :type key: text_type :rtype: [CtsTextMetadata] :returns: List of availables translations """ if key is not None: return [ i...
[ "def", "get_translation_in", "(", "self", ",", "key", "=", "None", ")", ":", "if", "key", "is", "not", "None", ":", "return", "[", "item", "for", "item", "in", "self", ".", "texts", ".", "values", "(", ")", "if", "isinstance", "(", "item", ",", "Ct...
Find a translation with given language :param key: Language to find :type key: text_type :rtype: [CtsTextMetadata] :returns: List of availables translations
[ "Find", "a", "translation", "with", "given", "language" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L500-L519
train
Capitains/MyCapytain
MyCapytain/resources/prototypes/cts/inventory.py
CtsTextgroupMetadata.update
def update(self, other): """ Merge two Textgroup Objects. - Original (left Object) keeps his parent. - Added document merges with work if it already exists :param other: Textgroup object :type other: CtsTextgroupMetadata :return: Textgroup Object :rtype: CtsText...
python
def update(self, other): """ Merge two Textgroup Objects. - Original (left Object) keeps his parent. - Added document merges with work if it already exists :param other: Textgroup object :type other: CtsTextgroupMetadata :return: Textgroup Object :rtype: CtsText...
[ "def", "update", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "CtsTextgroupMetadata", ")", ":", "raise", "TypeError", "(", "\"Cannot add %s to CtsTextgroupMetadata\"", "%", "type", "(", "other", ")", ")", "elif", "str", ...
Merge two Textgroup Objects. - Original (left Object) keeps his parent. - Added document merges with work if it already exists :param other: Textgroup object :type other: CtsTextgroupMetadata :return: Textgroup Object :rtype: CtsTextgroupMetadata
[ "Merge", "two", "Textgroup", "Objects", "." ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L581-L605
train
hawkular/hawkular-client-python
hawkular/alerts/triggers.py
AlertsTriggerClient.get
def get(self, tags=[], trigger_ids=[]): """ Get triggers with optional filtering. Querying without parameters returns all the trigger definitions. :param tags: Fetch triggers with matching tags only. Use * to match all values. :param trigger_ids: List of triggerIds to fetch """ ...
python
def get(self, tags=[], trigger_ids=[]): """ Get triggers with optional filtering. Querying without parameters returns all the trigger definitions. :param tags: Fetch triggers with matching tags only. Use * to match all values. :param trigger_ids: List of triggerIds to fetch """ ...
[ "def", "get", "(", "self", ",", "tags", "=", "[", "]", ",", "trigger_ids", "=", "[", "]", ")", ":", "params", "=", "{", "}", "if", "len", "(", "tags", ")", ">", "0", ":", "params", "[", "'tags'", "]", "=", "','", ".", "join", "(", "tags", "...
Get triggers with optional filtering. Querying without parameters returns all the trigger definitions. :param tags: Fetch triggers with matching tags only. Use * to match all values. :param trigger_ids: List of triggerIds to fetch
[ "Get", "triggers", "with", "optional", "filtering", ".", "Querying", "without", "parameters", "returns", "all", "the", "trigger", "definitions", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L132-L148
train
hawkular/hawkular-client-python
hawkular/alerts/triggers.py
AlertsTriggerClient.create
def create(self, trigger): """ Create a new trigger. :param trigger: FullTrigger or Trigger class to be created :return: The created trigger """ data = self._serialize_object(trigger) if isinstance(trigger, FullTrigger): returned_dict = self._post(sel...
python
def create(self, trigger): """ Create a new trigger. :param trigger: FullTrigger or Trigger class to be created :return: The created trigger """ data = self._serialize_object(trigger) if isinstance(trigger, FullTrigger): returned_dict = self._post(sel...
[ "def", "create", "(", "self", ",", "trigger", ")", ":", "data", "=", "self", ".", "_serialize_object", "(", "trigger", ")", "if", "isinstance", "(", "trigger", ",", "FullTrigger", ")", ":", "returned_dict", "=", "self", ".", "_post", "(", "self", ".", ...
Create a new trigger. :param trigger: FullTrigger or Trigger class to be created :return: The created trigger
[ "Create", "a", "new", "trigger", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L150-L163
train
hawkular/hawkular-client-python
hawkular/alerts/triggers.py
AlertsTriggerClient.update
def update(self, trigger_id, full_trigger): """ Update an existing full trigger. :param full_trigger: FullTrigger with conditions, dampenings and triggers :type full_trigger: FullTrigger :return: Updated FullTrigger definition """ data = self._serialize_object(fu...
python
def update(self, trigger_id, full_trigger): """ Update an existing full trigger. :param full_trigger: FullTrigger with conditions, dampenings and triggers :type full_trigger: FullTrigger :return: Updated FullTrigger definition """ data = self._serialize_object(fu...
[ "def", "update", "(", "self", ",", "trigger_id", ",", "full_trigger", ")", ":", "data", "=", "self", ".", "_serialize_object", "(", "full_trigger", ")", "rdict", "=", "self", ".", "_put", "(", "self", ".", "_service_url", "(", "[", "'triggers'", ",", "'t...
Update an existing full trigger. :param full_trigger: FullTrigger with conditions, dampenings and triggers :type full_trigger: FullTrigger :return: Updated FullTrigger definition
[ "Update", "an", "existing", "full", "trigger", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L165-L175
train
hawkular/hawkular-client-python
hawkular/alerts/triggers.py
AlertsTriggerClient.create_group
def create_group(self, trigger): """ Create a new group trigger. :param trigger: Group member trigger to be created :return: The created group Trigger """ data = self._serialize_object(trigger) return Trigger(self._post(self._service_url(['triggers', 'groups']), ...
python
def create_group(self, trigger): """ Create a new group trigger. :param trigger: Group member trigger to be created :return: The created group Trigger """ data = self._serialize_object(trigger) return Trigger(self._post(self._service_url(['triggers', 'groups']), ...
[ "def", "create_group", "(", "self", ",", "trigger", ")", ":", "data", "=", "self", ".", "_serialize_object", "(", "trigger", ")", "return", "Trigger", "(", "self", ".", "_post", "(", "self", ".", "_service_url", "(", "[", "'triggers'", ",", "'groups'", "...
Create a new group trigger. :param trigger: Group member trigger to be created :return: The created group Trigger
[ "Create", "a", "new", "group", "trigger", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L202-L210
train
hawkular/hawkular-client-python
hawkular/alerts/triggers.py
AlertsTriggerClient.group_members
def group_members(self, group_id, include_orphans=False): """ Find all group member trigger definitions :param group_id: group trigger id :param include_orphans: If True, include orphan members :return: list of asociated group members as trigger objects """ param...
python
def group_members(self, group_id, include_orphans=False): """ Find all group member trigger definitions :param group_id: group trigger id :param include_orphans: If True, include orphan members :return: list of asociated group members as trigger objects """ param...
[ "def", "group_members", "(", "self", ",", "group_id", ",", "include_orphans", "=", "False", ")", ":", "params", "=", "{", "'includeOrphans'", ":", "str", "(", "include_orphans", ")", ".", "lower", "(", ")", "}", "url", "=", "self", ".", "_service_url", "...
Find all group member trigger definitions :param group_id: group trigger id :param include_orphans: If True, include orphan members :return: list of asociated group members as trigger objects
[ "Find", "all", "group", "member", "trigger", "definitions" ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L212-L222
train
hawkular/hawkular-client-python
hawkular/alerts/triggers.py
AlertsTriggerClient.update_group
def update_group(self, group_id, trigger): """ Update an existing group trigger definition and its member definitions. :param group_id: Group trigger id to be updated :param trigger: Trigger object, the group trigger to be updated """ data = self._serialize_object(trigge...
python
def update_group(self, group_id, trigger): """ Update an existing group trigger definition and its member definitions. :param group_id: Group trigger id to be updated :param trigger: Trigger object, the group trigger to be updated """ data = self._serialize_object(trigge...
[ "def", "update_group", "(", "self", ",", "group_id", ",", "trigger", ")", ":", "data", "=", "self", ".", "_serialize_object", "(", "trigger", ")", "self", ".", "_put", "(", "self", ".", "_service_url", "(", "[", "'triggers'", ",", "'groups'", ",", "group...
Update an existing group trigger definition and its member definitions. :param group_id: Group trigger id to be updated :param trigger: Trigger object, the group trigger to be updated
[ "Update", "an", "existing", "group", "trigger", "definition", "and", "its", "member", "definitions", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L224-L232
train
hawkular/hawkular-client-python
hawkular/alerts/triggers.py
AlertsTriggerClient.delete_group
def delete_group(self, group_id, keep_non_orphans=False, keep_orphans=False): """ Delete a group trigger :param group_id: ID of the group trigger to delete :param keep_non_orphans: if True converts the non-orphan member triggers to standard triggers :param keep_orphans: if True ...
python
def delete_group(self, group_id, keep_non_orphans=False, keep_orphans=False): """ Delete a group trigger :param group_id: ID of the group trigger to delete :param keep_non_orphans: if True converts the non-orphan member triggers to standard triggers :param keep_orphans: if True ...
[ "def", "delete_group", "(", "self", ",", "group_id", ",", "keep_non_orphans", "=", "False", ",", "keep_orphans", "=", "False", ")", ":", "params", "=", "{", "'keepNonOrphans'", ":", "str", "(", "keep_non_orphans", ")", ".", "lower", "(", ")", ",", "'keepOr...
Delete a group trigger :param group_id: ID of the group trigger to delete :param keep_non_orphans: if True converts the non-orphan member triggers to standard triggers :param keep_orphans: if True converts the orphan member triggers to standard triggers
[ "Delete", "a", "group", "trigger" ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L234-L243
train
hawkular/hawkular-client-python
hawkular/alerts/triggers.py
AlertsTriggerClient.create_group_member
def create_group_member(self, member): """ Create a new member trigger for a parent trigger. :param member: Group member trigger to be created :type member: GroupMemberInfo :return: A member Trigger object """ data = self._serialize_object(member) return ...
python
def create_group_member(self, member): """ Create a new member trigger for a parent trigger. :param member: Group member trigger to be created :type member: GroupMemberInfo :return: A member Trigger object """ data = self._serialize_object(member) return ...
[ "def", "create_group_member", "(", "self", ",", "member", ")", ":", "data", "=", "self", ".", "_serialize_object", "(", "member", ")", "return", "Trigger", "(", "self", ".", "_post", "(", "self", ".", "_service_url", "(", "[", "'triggers'", ",", "'groups'"...
Create a new member trigger for a parent trigger. :param member: Group member trigger to be created :type member: GroupMemberInfo :return: A member Trigger object
[ "Create", "a", "new", "member", "trigger", "for", "a", "parent", "trigger", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L245-L254
train
hawkular/hawkular-client-python
hawkular/alerts/triggers.py
AlertsTriggerClient.set_group_conditions
def set_group_conditions(self, group_id, conditions, trigger_mode=None): """ Set the group conditions. This replaces any existing conditions on the group and member conditions for all trigger modes. :param group_id: Group to be updated :param conditions: New conditions to repla...
python
def set_group_conditions(self, group_id, conditions, trigger_mode=None): """ Set the group conditions. This replaces any existing conditions on the group and member conditions for all trigger modes. :param group_id: Group to be updated :param conditions: New conditions to repla...
[ "def", "set_group_conditions", "(", "self", ",", "group_id", ",", "conditions", ",", "trigger_mode", "=", "None", ")", ":", "data", "=", "self", ".", "_serialize_object", "(", "conditions", ")", "if", "trigger_mode", "is", "not", "None", ":", "url", "=", "...
Set the group conditions. This replaces any existing conditions on the group and member conditions for all trigger modes. :param group_id: Group to be updated :param conditions: New conditions to replace old ones :param trigger_mode: Optional TriggerMode used :type conditions: ...
[ "Set", "the", "group", "conditions", "." ]
52371f9ebabbe310efee2a8ff8eb735ccc0654bb
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L256-L277
train