repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
lsst-sqre/documenteer
documenteer/stackdocs/build.py
link_directories
def link_directories(root_dir, package_doc_dirs): """Create symlinks to package/module documentation directories from the root documentation project. Parameters ---------- root_dir : `str` Directory in the main documentation project where links will be created. For example, this cou...
python
def link_directories(root_dir, package_doc_dirs): """Create symlinks to package/module documentation directories from the root documentation project. Parameters ---------- root_dir : `str` Directory in the main documentation project where links will be created. For example, this cou...
[ "def", "link_directories", "(", "root_dir", ",", "package_doc_dirs", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "for", "dirname", ",", "source_dirname", "in", "package_doc_dirs", ".", "items", "(", ")", ":", "link_name", "=", ...
Create symlinks to package/module documentation directories from the root documentation project. Parameters ---------- root_dir : `str` Directory in the main documentation project where links will be created. For example, this could be a ``'modules'`` directory in the ``pipeline...
[ "Create", "symlinks", "to", "package", "/", "module", "documentation", "directories", "from", "the", "root", "documentation", "project", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/build.py#L403-L431
train
Create symlinks to package and module documentation directories from the base documentation project.
lsst-sqre/documenteer
documenteer/stackdocs/build.py
remove_existing_links
def remove_existing_links(root_dir): """Delete any symlinks present at the root of a directory. Parameters ---------- root_dir : `str` Directory that might contain symlinks. Notes ----- This function is used to remove any symlinks created by `link_directories`. Running ``remove...
python
def remove_existing_links(root_dir): """Delete any symlinks present at the root of a directory. Parameters ---------- root_dir : `str` Directory that might contain symlinks. Notes ----- This function is used to remove any symlinks created by `link_directories`. Running ``remove...
[ "def", "remove_existing_links", "(", "root_dir", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "for", "name", "in", "os", ".", "listdir", "(", "root_dir", ")", ":", "full_name", "=", "os", ".", "path", ".", "join", "(", "r...
Delete any symlinks present at the root of a directory. Parameters ---------- root_dir : `str` Directory that might contain symlinks. Notes ----- This function is used to remove any symlinks created by `link_directories`. Running ``remove_existing_links`` at the beginning of a buil...
[ "Delete", "any", "symlinks", "present", "at", "the", "root", "of", "a", "directory", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/build.py#L434-L455
train
Delete any symlinks present at the root of a directory.
ehansis/ozelot
ozelot/orm/base.py
render_diagram
def render_diagram(out_base): """Render a data model diagram Included in the diagram are all classes from the model registry. For your project, write a small script that imports all models that you would like to have included and then calls this function. .. note:: This function requires the 'dot'...
python
def render_diagram(out_base): """Render a data model diagram Included in the diagram are all classes from the model registry. For your project, write a small script that imports all models that you would like to have included and then calls this function. .. note:: This function requires the 'dot'...
[ "def", "render_diagram", "(", "out_base", ")", ":", "import", "codecs", "import", "subprocess", "import", "sadisplay", "# generate class descriptions", "desc", "=", "sadisplay", ".", "describe", "(", "list", "(", "model_registry", ".", "values", "(", ")", ")", "...
Render a data model diagram Included in the diagram are all classes from the model registry. For your project, write a small script that imports all models that you would like to have included and then calls this function. .. note:: This function requires the 'dot' executable from the GraphViz package...
[ "Render", "a", "data", "model", "diagram" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/orm/base.py#L187-L228
train
Render a data model diagram in a small script that imports all models that you want to be included in the diagram.
ehansis/ozelot
ozelot/orm/base.py
ExtendedBase.get_max_id
def get_max_id(cls, session): """Get the current max value of the ``id`` column. When creating and storing ORM objects in bulk, :mod:`sqlalchemy` does not automatically generate an incrementing primary key ``id``. To do this manually, one needs to know the current max ``id``. For ORM ob...
python
def get_max_id(cls, session): """Get the current max value of the ``id`` column. When creating and storing ORM objects in bulk, :mod:`sqlalchemy` does not automatically generate an incrementing primary key ``id``. To do this manually, one needs to know the current max ``id``. For ORM ob...
[ "def", "get_max_id", "(", "cls", ",", "session", ")", ":", "# sqlalchemy allows only one level of inheritance, so just check this class and all its bases", "id_base", "=", "None", "for", "c", "in", "[", "cls", "]", "+", "list", "(", "cls", ".", "__bases__", ")", ":"...
Get the current max value of the ``id`` column. When creating and storing ORM objects in bulk, :mod:`sqlalchemy` does not automatically generate an incrementing primary key ``id``. To do this manually, one needs to know the current max ``id``. For ORM object classes that are derived from other ...
[ "Get", "the", "current", "max", "value", "of", "the", "id", "column", "." ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/orm/base.py#L112-L146
train
Get the current max value of the id column.
ehansis/ozelot
ozelot/orm/base.py
ExtendedBase.truncate_to_field_length
def truncate_to_field_length(self, field, value): """Truncate the value of a string field to the field's max length. Use this in a validator to check/truncate values before inserting them into the database. Copy the below example code after ``@validates`` to your model class and replace ``field...
python
def truncate_to_field_length(self, field, value): """Truncate the value of a string field to the field's max length. Use this in a validator to check/truncate values before inserting them into the database. Copy the below example code after ``@validates`` to your model class and replace ``field...
[ "def", "truncate_to_field_length", "(", "self", ",", "field", ",", "value", ")", ":", "max_len", "=", "getattr", "(", "self", ".", "__class__", ",", "field", ")", ".", "prop", ".", "columns", "[", "0", "]", ".", "type", ".", "length", "if", "value", ...
Truncate the value of a string field to the field's max length. Use this in a validator to check/truncate values before inserting them into the database. Copy the below example code after ``@validates`` to your model class and replace ``field1`` and ``field2`` with your field name(s). ...
[ "Truncate", "the", "value", "of", "a", "string", "field", "to", "the", "field", "s", "max", "length", "." ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/orm/base.py#L148-L181
train
Truncate the value of a string field to the field s max length.
untwisted/untwisted
untwisted/tkinter.py
extern
def extern(obj, timeout=200): """ Tell Tkinter to process untnwisted event loop. It registers just once the update handle. """ global installed # Register it just once. if not installed: install_hook(obj, timeout) installed = True
python
def extern(obj, timeout=200): """ Tell Tkinter to process untnwisted event loop. It registers just once the update handle. """ global installed # Register it just once. if not installed: install_hook(obj, timeout) installed = True
[ "def", "extern", "(", "obj", ",", "timeout", "=", "200", ")", ":", "global", "installed", "# Register it just once.", "if", "not", "installed", ":", "install_hook", "(", "obj", ",", "timeout", ")", "installed", "=", "True" ]
Tell Tkinter to process untnwisted event loop. It registers just once the update handle.
[ "Tell", "Tkinter", "to", "process", "untnwisted", "event", "loop", ".", "It", "registers", "just", "once", "the", "update", "handle", "." ]
8a8d9c8a8d0f3452d5de67cd760297bb5759f637
https://github.com/untwisted/untwisted/blob/8a8d9c8a8d0f3452d5de67cd760297bb5759f637/untwisted/tkinter.py#L15-L25
train
Installs a hook to process untnwisted event loop.
untwisted/untwisted
untwisted/tkinter.py
intern
def intern(obj, timeout): """ Tell untwisted to process an extern event loop. """ core.gear.timeout = timeout core.gear.pool.append(obj)
python
def intern(obj, timeout): """ Tell untwisted to process an extern event loop. """ core.gear.timeout = timeout core.gear.pool.append(obj)
[ "def", "intern", "(", "obj", ",", "timeout", ")", ":", "core", ".", "gear", ".", "timeout", "=", "timeout", "core", ".", "gear", ".", "pool", ".", "append", "(", "obj", ")" ]
Tell untwisted to process an extern event loop.
[ "Tell", "untwisted", "to", "process", "an", "extern", "event", "loop", "." ]
8a8d9c8a8d0f3452d5de67cd760297bb5759f637
https://github.com/untwisted/untwisted/blob/8a8d9c8a8d0f3452d5de67cd760297bb5759f637/untwisted/tkinter.py#L27-L34
train
Intern a new object into the internal pool.
lsst-sqre/documenteer
documenteer/sphinxext/jira.py
_make_ticket_node
def _make_ticket_node(ticket_id, config, options=None): """Construct a reference node for a JIRA ticket.""" options = options or {} ref = config.jira_uri_template.format(ticket=ticket_id) link = nodes.reference(text=ticket_id, refuri=ref, **options) return link
python
def _make_ticket_node(ticket_id, config, options=None): """Construct a reference node for a JIRA ticket.""" options = options or {} ref = config.jira_uri_template.format(ticket=ticket_id) link = nodes.reference(text=ticket_id, refuri=ref, **options) return link
[ "def", "_make_ticket_node", "(", "ticket_id", ",", "config", ",", "options", "=", "None", ")", ":", "options", "=", "options", "or", "{", "}", "ref", "=", "config", ".", "jira_uri_template", ".", "format", "(", "ticket", "=", "ticket_id", ")", "link", "=...
Construct a reference node for a JIRA ticket.
[ "Construct", "a", "reference", "node", "for", "a", "JIRA", "ticket", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/jira.py#L16-L21
train
Construct a reference node for a JIRA ticket.
lsst-sqre/documenteer
documenteer/sphinxext/jira.py
_oxford_comma_separator
def _oxford_comma_separator(i, length): """Make a separator for a prose-like list with `,` between items except for `, and` after the second to last item. """ if length == 1: return None elif length < 3 and i == 0: return ' and ' elif i < length - 2: return ', ' elif ...
python
def _oxford_comma_separator(i, length): """Make a separator for a prose-like list with `,` between items except for `, and` after the second to last item. """ if length == 1: return None elif length < 3 and i == 0: return ' and ' elif i < length - 2: return ', ' elif ...
[ "def", "_oxford_comma_separator", "(", "i", ",", "length", ")", ":", "if", "length", "==", "1", ":", "return", "None", "elif", "length", "<", "3", "and", "i", "==", "0", ":", "return", "' and '", "elif", "i", "<", "length", "-", "2", ":", "return", ...
Make a separator for a prose-like list with `,` between items except for `, and` after the second to last item.
[ "Make", "a", "separator", "for", "a", "prose", "-", "like", "list", "with", "between", "items", "except", "for", "and", "after", "the", "second", "to", "last", "item", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/jira.py#L37-L50
train
Make a comma - separated list with between items except for and after the last item.
lsst-sqre/documenteer
documenteer/sphinxext/jira.py
jira_role
def jira_role(name, rawtext, text, lineno, inliner, options=None, content=None, oxford_comma=True): """Sphinx role for referencing a JIRA ticket. Examples:: :jira:`DM-6181` -> DM-6181 :jira:`DM-6181,DM-6181` -> DM-6180 and DM-6181 :jira:`DM-6181,DM-6181,DM-6182` -> DM-618...
python
def jira_role(name, rawtext, text, lineno, inliner, options=None, content=None, oxford_comma=True): """Sphinx role for referencing a JIRA ticket. Examples:: :jira:`DM-6181` -> DM-6181 :jira:`DM-6181,DM-6181` -> DM-6180 and DM-6181 :jira:`DM-6181,DM-6181,DM-6182` -> DM-618...
[ "def", "jira_role", "(", "name", ",", "rawtext", ",", "text", ",", "lineno", ",", "inliner", ",", "options", "=", "None", ",", "content", "=", "None", ",", "oxford_comma", "=", "True", ")", ":", "options", "=", "options", "or", "{", "}", "content", "...
Sphinx role for referencing a JIRA ticket. Examples:: :jira:`DM-6181` -> DM-6181 :jira:`DM-6181,DM-6181` -> DM-6180 and DM-6181 :jira:`DM-6181,DM-6181,DM-6182` -> DM-6180, DM-6181, and DM-6182
[ "Sphinx", "role", "for", "referencing", "a", "JIRA", "ticket", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/jira.py#L53-L83
train
Sphinx role for referencing a JIRA ticket.
lsst-sqre/documenteer
documenteer/sphinxext/jira.py
jira_bracket_role
def jira_bracket_role(name, rawtext, text, lineno, inliner, options=None, content=None, open_symbol='[', close_symbol=']'): """Sphinx role for referencing a JIRA ticket with ticket numbers enclosed in braces. Useful for changelogs. Examples:: :jirab:`DM-...
python
def jira_bracket_role(name, rawtext, text, lineno, inliner, options=None, content=None, open_symbol='[', close_symbol=']'): """Sphinx role for referencing a JIRA ticket with ticket numbers enclosed in braces. Useful for changelogs. Examples:: :jirab:`DM-...
[ "def", "jira_bracket_role", "(", "name", ",", "rawtext", ",", "text", ",", "lineno", ",", "inliner", ",", "options", "=", "None", ",", "content", "=", "None", ",", "open_symbol", "=", "'['", ",", "close_symbol", "=", "']'", ")", ":", "node_list", ",", ...
Sphinx role for referencing a JIRA ticket with ticket numbers enclosed in braces. Useful for changelogs. Examples:: :jirab:`DM-6181` -> [DM-6181] :jirab:`DM-6181,DM-6181` -> [DM-6180, DM-6181] :jirab:`DM-6181,DM-6181,DM-6182` -> [DM-6180, DM-6181, DM-6182]
[ "Sphinx", "role", "for", "referencing", "a", "JIRA", "ticket", "with", "ticket", "numbers", "enclosed", "in", "braces", ".", "Useful", "for", "changelogs", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/jira.py#L86-L102
train
Sphinx role for referencing a JIRA ticket with ticket numbers enclosed in braces.
lsst-sqre/documenteer
documenteer/sphinxext/jira.py
jira_parens_role
def jira_parens_role(name, rawtext, text, lineno, inliner, options=None, content=None): """Sphinx role for referencing a JIRA ticket with ticket numbers enclosed in parentheses. Useful for changelogs. Examples:: :jirap:`DM-6181` -> (DM-6181) :jirap:`DM-6181,DM-6181` ->...
python
def jira_parens_role(name, rawtext, text, lineno, inliner, options=None, content=None): """Sphinx role for referencing a JIRA ticket with ticket numbers enclosed in parentheses. Useful for changelogs. Examples:: :jirap:`DM-6181` -> (DM-6181) :jirap:`DM-6181,DM-6181` ->...
[ "def", "jira_parens_role", "(", "name", ",", "rawtext", ",", "text", ",", "lineno", ",", "inliner", ",", "options", "=", "None", ",", "content", "=", "None", ")", ":", "return", "jira_bracket_role", "(", "name", ",", "rawtext", ",", "text", ",", "lineno"...
Sphinx role for referencing a JIRA ticket with ticket numbers enclosed in parentheses. Useful for changelogs. Examples:: :jirap:`DM-6181` -> (DM-6181) :jirap:`DM-6181,DM-6181` -> (DM-6180, DM-6181) :jirap:`DM-6181,DM-6181,DM-6182` -> (DM-6180, DM-6181, DM-6182)
[ "Sphinx", "role", "for", "referencing", "a", "JIRA", "ticket", "with", "ticket", "numbers", "enclosed", "in", "parentheses", ".", "Useful", "for", "changelogs", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/jira.py#L105-L118
train
Sphinx role for referencing a JIRA ticket with ticket numbers enclosed in parentheses. Useful for changelogs.
potash/drain
drain/drake.py
get_inputs_helper
def get_inputs_helper(step, ignore, target): """ Recursion helper used by get_inputs() """ outputs = set() if not ignore and step.target == target: outputs.add(step) if ignore or not step.target: for i in step.inputs: outputs.update(get_inputs_helper(i, ignore=False,...
python
def get_inputs_helper(step, ignore, target): """ Recursion helper used by get_inputs() """ outputs = set() if not ignore and step.target == target: outputs.add(step) if ignore or not step.target: for i in step.inputs: outputs.update(get_inputs_helper(i, ignore=False,...
[ "def", "get_inputs_helper", "(", "step", ",", "ignore", ",", "target", ")", ":", "outputs", "=", "set", "(", ")", "if", "not", "ignore", "and", "step", ".", "target", "==", "target", ":", "outputs", ".", "add", "(", "step", ")", "if", "ignore", "or",...
Recursion helper used by get_inputs()
[ "Recursion", "helper", "used", "by", "get_inputs", "()" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/drake.py#L8-L20
train
Recursive helper used by get_inputs
potash/drain
drain/drake.py
get_drake_data
def get_drake_data(steps): """ Returns: a dictionary of outputs mapped to inputs Note that an output is either a target or a leaf node in the step tree """ output_inputs = {} if len(steps) == 0: return output_inputs for step in steps: output_inputs[step] = get_inputs...
python
def get_drake_data(steps): """ Returns: a dictionary of outputs mapped to inputs Note that an output is either a target or a leaf node in the step tree """ output_inputs = {} if len(steps) == 0: return output_inputs for step in steps: output_inputs[step] = get_inputs...
[ "def", "get_drake_data", "(", "steps", ")", ":", "output_inputs", "=", "{", "}", "if", "len", "(", "steps", ")", "==", "0", ":", "return", "output_inputs", "for", "step", "in", "steps", ":", "output_inputs", "[", "step", "]", "=", "get_inputs", "(", "s...
Returns: a dictionary of outputs mapped to inputs Note that an output is either a target or a leaf node in the step tree
[ "Returns", ":", "a", "dictionary", "of", "outputs", "mapped", "to", "inputs", "Note", "that", "an", "output", "is", "either", "a", "target", "or", "a", "leaf", "node", "in", "the", "step", "tree" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/drake.py#L31-L49
train
Returns a dictionary of outputs mapped to inputs
potash/drain
drain/drake.py
to_drake_step
def to_drake_step(inputs, output): """ Args: inputs: collection of input Steps output: output Step Returns: a string of the drake step for the given inputs and output """ i = [output._yaml_filename] i.extend(map(lambda i: i._target_filename, list(inputs))) i.extend(output.de...
python
def to_drake_step(inputs, output): """ Args: inputs: collection of input Steps output: output Step Returns: a string of the drake step for the given inputs and output """ i = [output._yaml_filename] i.extend(map(lambda i: i._target_filename, list(inputs))) i.extend(output.de...
[ "def", "to_drake_step", "(", "inputs", ",", "output", ")", ":", "i", "=", "[", "output", ".", "_yaml_filename", "]", "i", ".", "extend", "(", "map", "(", "lambda", "i", ":", "i", ".", "_target_filename", ",", "list", "(", "inputs", ")", ")", ")", "...
Args: inputs: collection of input Steps output: output Step Returns: a string of the drake step for the given inputs and output
[ "Args", ":", "inputs", ":", "collection", "of", "input", "Steps", "output", ":", "output", "Step" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/drake.py#L52-L77
train
Returns a string of the drake step for the given inputs and output.
potash/drain
drain/drake.py
to_drakefile
def to_drakefile(steps, preview=True, debug=False, input_drakefile=None, bindir=None): """ Args: steps: collection of drain.step.Step objects for which to generate a drakefile preview: boolean, when False will create directories for output steps. When True do not touch f...
python
def to_drakefile(steps, preview=True, debug=False, input_drakefile=None, bindir=None): """ Args: steps: collection of drain.step.Step objects for which to generate a drakefile preview: boolean, when False will create directories for output steps. When True do not touch f...
[ "def", "to_drakefile", "(", "steps", ",", "preview", "=", "True", ",", "debug", "=", "False", ",", "input_drakefile", "=", "None", ",", "bindir", "=", "None", ")", ":", "data", "=", "get_drake_data", "(", "steps", ")", "drakefile", "=", "StringIO", "(", ...
Args: steps: collection of drain.step.Step objects for which to generate a drakefile preview: boolean, when False will create directories for output steps. When True do not touch filesystem. debug: run python with '-m pdb' drakefile: path to drakefile to include ...
[ "Args", ":", "steps", ":", "collection", "of", "drain", ".", "step", ".", "Step", "objects", "for", "which", "to", "generate", "a", "drakefile", "preview", ":", "boolean", "when", "False", "will", "create", "directories", "for", "output", "steps", ".", "Wh...
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/drake.py#L80-L115
train
Generate a drakefile from a collection of drain. step. Step objects.
ffcalculator/fantasydata-python
fantasy_data/FantasyData.py
FantasyDataBase._method_call
def _method_call(self, method, category, **kwargs): """ Call API method. Generate request. Parse response. Process errors `method` str API method url for request. Contains parameters `params` dict parameters for method url """ session = requests.Session() try: ...
python
def _method_call(self, method, category, **kwargs): """ Call API method. Generate request. Parse response. Process errors `method` str API method url for request. Contains parameters `params` dict parameters for method url """ session = requests.Session() try: ...
[ "def", "_method_call", "(", "self", ",", "method", ",", "category", ",", "*", "*", "kwargs", ")", ":", "session", "=", "requests", ".", "Session", "(", ")", "try", ":", "response", "=", "session", ".", "get", "(", "\"http://\"", "+", "self", ".", "_a...
Call API method. Generate request. Parse response. Process errors `method` str API method url for request. Contains parameters `params` dict parameters for method url
[ "Call", "API", "method", ".", "Generate", "request", ".", "Parse", "response", ".", "Process", "errors", "method", "str", "API", "method", "url", "for", "request", ".", "Contains", "parameters", "params", "dict", "parameters", "for", "method", "url" ]
af90cac1e80d8356cffaa80621ee513201f6c661
https://github.com/ffcalculator/fantasydata-python/blob/af90cac1e80d8356cffaa80621ee513201f6c661/fantasy_data/FantasyData.py#L38-L70
train
Method call for the FantasyData API.
ffcalculator/fantasydata-python
fantasy_data/FantasyData.py
FantasyData.get_schedules_for_season
def get_schedules_for_season(self, season, season_type="REG"): """ Game schedule for a specified season. """ try: season = int(season) if season_type not in ["REG", "PRE", "POST"]: raise ValueError except (ValueError, TypeError): ...
python
def get_schedules_for_season(self, season, season_type="REG"): """ Game schedule for a specified season. """ try: season = int(season) if season_type not in ["REG", "PRE", "POST"]: raise ValueError except (ValueError, TypeError): ...
[ "def", "get_schedules_for_season", "(", "self", ",", "season", ",", "season_type", "=", "\"REG\"", ")", ":", "try", ":", "season", "=", "int", "(", "season", ")", "if", "season_type", "not", "in", "[", "\"REG\"", ",", "\"PRE\"", ",", "\"POST\"", "]", ":"...
Game schedule for a specified season.
[ "Game", "schedule", "for", "a", "specified", "season", "." ]
af90cac1e80d8356cffaa80621ee513201f6c661
https://github.com/ffcalculator/fantasydata-python/blob/af90cac1e80d8356cffaa80621ee513201f6c661/fantasy_data/FantasyData.py#L89-L102
train
Get the game schedule for a specified season.
ffcalculator/fantasydata-python
fantasy_data/FantasyData.py
FantasyData.get_players_game_stats_for_season_for_week
def get_players_game_stats_for_season_for_week(self, season, week, season_type="REG"): """ Game stats for a specified season and week. `season` int `week` int `season_type` str Valid value one of ("REG", "PRE", "POST") """ try: season = int(season) ...
python
def get_players_game_stats_for_season_for_week(self, season, week, season_type="REG"): """ Game stats for a specified season and week. `season` int `week` int `season_type` str Valid value one of ("REG", "PRE", "POST") """ try: season = int(season) ...
[ "def", "get_players_game_stats_for_season_for_week", "(", "self", ",", "season", ",", "week", ",", "season_type", "=", "\"REG\"", ")", ":", "try", ":", "season", "=", "int", "(", "season", ")", "week", "=", "int", "(", "week", ")", "if", "season_type", "no...
Game stats for a specified season and week. `season` int `week` int `season_type` str Valid value one of ("REG", "PRE", "POST")
[ "Game", "stats", "for", "a", "specified", "season", "and", "week", ".", "season", "int", "week", "int", "season_type", "str", "Valid", "value", "one", "of", "(", "REG", "PRE", "POST", ")" ]
af90cac1e80d8356cffaa80621ee513201f6c661
https://github.com/ffcalculator/fantasydata-python/blob/af90cac1e80d8356cffaa80621ee513201f6c661/fantasy_data/FantasyData.py#L127-L144
train
This method returns the game stats for a specified season and week.
ffcalculator/fantasydata-python
fantasy_data/FantasyData.py
FantasyData.get_projected_player_game_stats_by_player
def get_projected_player_game_stats_by_player(self, season, week, player_id): """ Projected Player Game Stats by Player """ result = self._method_call("PlayerGameProjectionStatsByPlayerID/{season}/{week}/{player_id}", "projections", season=season, week=week, player_id=player_id) ...
python
def get_projected_player_game_stats_by_player(self, season, week, player_id): """ Projected Player Game Stats by Player """ result = self._method_call("PlayerGameProjectionStatsByPlayerID/{season}/{week}/{player_id}", "projections", season=season, week=week, player_id=player_id) ...
[ "def", "get_projected_player_game_stats_by_player", "(", "self", ",", "season", ",", "week", ",", "player_id", ")", ":", "result", "=", "self", ".", "_method_call", "(", "\"PlayerGameProjectionStatsByPlayerID/{season}/{week}/{player_id}\"", ",", "\"projections\"", ",", "s...
Projected Player Game Stats by Player
[ "Projected", "Player", "Game", "Stats", "by", "Player" ]
af90cac1e80d8356cffaa80621ee513201f6c661
https://github.com/ffcalculator/fantasydata-python/blob/af90cac1e80d8356cffaa80621ee513201f6c661/fantasy_data/FantasyData.py#L161-L166
train
Get Projected Player Game Stats by Player
ffcalculator/fantasydata-python
fantasy_data/FantasyData.py
FantasyData.get_projected_player_game_stats_by_team
def get_projected_player_game_stats_by_team(self, season, week, team_id): """ Projected Player Game Stats by Team """ result = self._method_call("PlayerGameProjectionStatsByTeam/{season}/{week}/{team_id}", "projections", season=season, week=week, team_id=team_id) return result
python
def get_projected_player_game_stats_by_team(self, season, week, team_id): """ Projected Player Game Stats by Team """ result = self._method_call("PlayerGameProjectionStatsByTeam/{season}/{week}/{team_id}", "projections", season=season, week=week, team_id=team_id) return result
[ "def", "get_projected_player_game_stats_by_team", "(", "self", ",", "season", ",", "week", ",", "team_id", ")", ":", "result", "=", "self", ".", "_method_call", "(", "\"PlayerGameProjectionStatsByTeam/{season}/{week}/{team_id}\"", ",", "\"projections\"", ",", "season", ...
Projected Player Game Stats by Team
[ "Projected", "Player", "Game", "Stats", "by", "Team" ]
af90cac1e80d8356cffaa80621ee513201f6c661
https://github.com/ffcalculator/fantasydata-python/blob/af90cac1e80d8356cffaa80621ee513201f6c661/fantasy_data/FantasyData.py#L168-L173
train
Get Player Game Stats by Team
ffcalculator/fantasydata-python
fantasy_data/FantasyData.py
FantasyData.get_projected_player_game_stats_by_week
def get_projected_player_game_stats_by_week(self, season, week): """ Projected Player Game Stats by Week """ result = self._method_call("PlayerGameProjectionStatsByWeek/{season}/{week}", "projections", season=season, week=week) return result
python
def get_projected_player_game_stats_by_week(self, season, week): """ Projected Player Game Stats by Week """ result = self._method_call("PlayerGameProjectionStatsByWeek/{season}/{week}", "projections", season=season, week=week) return result
[ "def", "get_projected_player_game_stats_by_week", "(", "self", ",", "season", ",", "week", ")", ":", "result", "=", "self", ".", "_method_call", "(", "\"PlayerGameProjectionStatsByWeek/{season}/{week}\"", ",", "\"projections\"", ",", "season", "=", "season", ",", "wee...
Projected Player Game Stats by Week
[ "Projected", "Player", "Game", "Stats", "by", "Week" ]
af90cac1e80d8356cffaa80621ee513201f6c661
https://github.com/ffcalculator/fantasydata-python/blob/af90cac1e80d8356cffaa80621ee513201f6c661/fantasy_data/FantasyData.py#L175-L180
train
Get Player Game Stats by Week
ffcalculator/fantasydata-python
fantasy_data/FantasyData.py
FantasyData.get_projected_fantasy_defense_game_stats_by_week
def get_projected_fantasy_defense_game_stats_by_week(self, season, week): """ Projected Fantasy Defense Game Stats by Week """ result = self._method_call("FantasyDefenseProjectionsByGame/{season}/{week}", "projections", season=season, week=week) return result
python
def get_projected_fantasy_defense_game_stats_by_week(self, season, week): """ Projected Fantasy Defense Game Stats by Week """ result = self._method_call("FantasyDefenseProjectionsByGame/{season}/{week}", "projections", season=season, week=week) return result
[ "def", "get_projected_fantasy_defense_game_stats_by_week", "(", "self", ",", "season", ",", "week", ")", ":", "result", "=", "self", ".", "_method_call", "(", "\"FantasyDefenseProjectionsByGame/{season}/{week}\"", ",", "\"projections\"", ",", "season", "=", "season", ",...
Projected Fantasy Defense Game Stats by Week
[ "Projected", "Fantasy", "Defense", "Game", "Stats", "by", "Week" ]
af90cac1e80d8356cffaa80621ee513201f6c661
https://github.com/ffcalculator/fantasydata-python/blob/af90cac1e80d8356cffaa80621ee513201f6c661/fantasy_data/FantasyData.py#L182-L187
train
Get Projected Fantasy Defense Game Stats by Week
ffcalculator/fantasydata-python
fantasy_data/FantasyData.py
FantasyData.get_injuries
def get_injuries(self, season, week): """ Injuries by week """ result = self._method_call("Injuries/{season}/{week}", "stats", season=season, week=week) return result
python
def get_injuries(self, season, week): """ Injuries by week """ result = self._method_call("Injuries/{season}/{week}", "stats", season=season, week=week) return result
[ "def", "get_injuries", "(", "self", ",", "season", ",", "week", ")", ":", "result", "=", "self", ".", "_method_call", "(", "\"Injuries/{season}/{week}\"", ",", "\"stats\"", ",", "season", "=", "season", ",", "week", "=", "week", ")", "return", "result" ]
Injuries by week
[ "Injuries", "by", "week" ]
af90cac1e80d8356cffaa80621ee513201f6c661
https://github.com/ffcalculator/fantasydata-python/blob/af90cac1e80d8356cffaa80621ee513201f6c661/fantasy_data/FantasyData.py#L232-L237
train
Get the injuries for a given season and week.
ffcalculator/fantasydata-python
fantasy_data/FantasyData.py
FantasyData.get_injuries_by_team
def get_injuries_by_team(self, season, week, team_id): """ Injuries by week and team """ result = self._method_call("Injuries/{season}/{week}/{team_id}", "stats", season=season, week=week, team_id=team_id) return result
python
def get_injuries_by_team(self, season, week, team_id): """ Injuries by week and team """ result = self._method_call("Injuries/{season}/{week}/{team_id}", "stats", season=season, week=week, team_id=team_id) return result
[ "def", "get_injuries_by_team", "(", "self", ",", "season", ",", "week", ",", "team_id", ")", ":", "result", "=", "self", ".", "_method_call", "(", "\"Injuries/{season}/{week}/{team_id}\"", ",", "\"stats\"", ",", "season", "=", "season", ",", "week", "=", "week...
Injuries by week and team
[ "Injuries", "by", "week", "and", "team" ]
af90cac1e80d8356cffaa80621ee513201f6c661
https://github.com/ffcalculator/fantasydata-python/blob/af90cac1e80d8356cffaa80621ee513201f6c661/fantasy_data/FantasyData.py#L239-L244
train
Get the injuries by week and team
ffcalculator/fantasydata-python
fantasy_data/FantasyData.py
FantasyData.get_box_score_by_team
def get_box_score_by_team(self, season, week, team_id): """ Box score by week and team """ result = self._method_call("BoxScoreV3/{season}/{week}/{team_id}", "stats", season=season, week=week, team_id=team_id) return result
python
def get_box_score_by_team(self, season, week, team_id): """ Box score by week and team """ result = self._method_call("BoxScoreV3/{season}/{week}/{team_id}", "stats", season=season, week=week, team_id=team_id) return result
[ "def", "get_box_score_by_team", "(", "self", ",", "season", ",", "week", ",", "team_id", ")", ":", "result", "=", "self", ".", "_method_call", "(", "\"BoxScoreV3/{season}/{week}/{team_id}\"", ",", "\"stats\"", ",", "season", "=", "season", ",", "week", "=", "w...
Box score by week and team
[ "Box", "score", "by", "week", "and", "team" ]
af90cac1e80d8356cffaa80621ee513201f6c661
https://github.com/ffcalculator/fantasydata-python/blob/af90cac1e80d8356cffaa80621ee513201f6c661/fantasy_data/FantasyData.py#L246-L251
train
Get the box score by week and team
ffcalculator/fantasydata-python
fantasy_data/FantasyData.py
FantasyDataNBA.get_games_by_season
def get_games_by_season(self, season): """ Game schedule for a specified season. """ try: season = int(season) except ValueError: raise FantasyDataError('Error: Invalid method parameters') result = self._method_call("Games/{season}", "stats", seas...
python
def get_games_by_season(self, season): """ Game schedule for a specified season. """ try: season = int(season) except ValueError: raise FantasyDataError('Error: Invalid method parameters') result = self._method_call("Games/{season}", "stats", seas...
[ "def", "get_games_by_season", "(", "self", ",", "season", ")", ":", "try", ":", "season", "=", "int", "(", "season", ")", "except", "ValueError", ":", "raise", "FantasyDataError", "(", "'Error: Invalid method parameters'", ")", "result", "=", "self", ".", "_me...
Game schedule for a specified season.
[ "Game", "schedule", "for", "a", "specified", "season", "." ]
af90cac1e80d8356cffaa80621ee513201f6c661
https://github.com/ffcalculator/fantasydata-python/blob/af90cac1e80d8356cffaa80621ee513201f6c661/fantasy_data/FantasyData.py#L275-L285
train
Get a list of games in a specified season.
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
list
def list(context, sort, limit, where, verbose): """list(context, sort, limit, where, verbose) List all jobs. >>> dcictl job-list :param string sort: Field to apply sort :param integer limit: Max number of rows to return :param string where: An optional filter criteria :param boolean verbo...
python
def list(context, sort, limit, where, verbose): """list(context, sort, limit, where, verbose) List all jobs. >>> dcictl job-list :param string sort: Field to apply sort :param integer limit: Max number of rows to return :param string where: An optional filter criteria :param boolean verbo...
[ "def", "list", "(", "context", ",", "sort", ",", "limit", ",", "where", ",", "verbose", ")", ":", "result", "=", "job", ".", "list", "(", "context", ",", "sort", "=", "sort", ",", "limit", "=", "limit", ",", "where", "=", "where", ",", "embed", "...
list(context, sort, limit, where, verbose) List all jobs. >>> dcictl job-list :param string sort: Field to apply sort :param integer limit: Max number of rows to return :param string where: An optional filter criteria :param boolean verbose: Display verbose output
[ "list", "(", "context", "sort", "limit", "where", "verbose", ")" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L35-L53
train
list - List all jobs in the cluster
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
list_results
def list_results(context, id, sort, limit): """list_result(context, id) List all job results. >>> dcictl job-results [OPTIONS] :param string id: ID of the job to consult result for [required] :param string sort: Field to apply sort :param integer limit: Max number of rows to return """ ...
python
def list_results(context, id, sort, limit): """list_result(context, id) List all job results. >>> dcictl job-results [OPTIONS] :param string id: ID of the job to consult result for [required] :param string sort: Field to apply sort :param integer limit: Max number of rows to return """ ...
[ "def", "list_results", "(", "context", ",", "id", ",", "sort", ",", "limit", ")", ":", "headers", "=", "[", "'filename'", ",", "'name'", ",", "'total'", ",", "'success'", ",", "'failures'", ",", "'errors'", ",", "'skips'", ",", "'time'", "]", "result", ...
list_result(context, id) List all job results. >>> dcictl job-results [OPTIONS] :param string id: ID of the job to consult result for [required] :param string sort: Field to apply sort :param integer limit: Max number of rows to return
[ "list_result", "(", "context", "id", ")" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L98-L113
train
List all job results for a specific job
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
attach_issue
def attach_issue(context, id, url): """attach_issue(context, id, url) Attach an issue to a job. >>> dcictl job-attach-issue [OPTIONS] :param string id: ID of the job to attach the issue to [required] :param string url: URL of the issue to attach to the job [required] """ result = job.att...
python
def attach_issue(context, id, url): """attach_issue(context, id, url) Attach an issue to a job. >>> dcictl job-attach-issue [OPTIONS] :param string id: ID of the job to attach the issue to [required] :param string url: URL of the issue to attach to the job [required] """ result = job.att...
[ "def", "attach_issue", "(", "context", ",", "id", ",", "url", ")", ":", "result", "=", "job", ".", "attach_issue", "(", "context", ",", "id", "=", "id", ",", "url", "=", "url", ")", "utils", ".", "format_output", "(", "result", ",", "context", ".", ...
attach_issue(context, id, url) Attach an issue to a job. >>> dcictl job-attach-issue [OPTIONS] :param string id: ID of the job to attach the issue to [required] :param string url: URL of the issue to attach to the job [required]
[ "attach_issue", "(", "context", "id", "url", ")" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L120-L132
train
Attach an issue to a job.
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
unattach_issue
def unattach_issue(context, id, issue_id): """unattach_issue(context, id, issue_id) Unattach an issue from a job. >>> dcictl job-unattach-issue [OPTIONS] :param string id: ID of the job to attach the issue to [required] :param string issue_id: ID of the issue to unattach from the job [required] ...
python
def unattach_issue(context, id, issue_id): """unattach_issue(context, id, issue_id) Unattach an issue from a job. >>> dcictl job-unattach-issue [OPTIONS] :param string id: ID of the job to attach the issue to [required] :param string issue_id: ID of the issue to unattach from the job [required] ...
[ "def", "unattach_issue", "(", "context", ",", "id", ",", "issue_id", ")", ":", "result", "=", "job", ".", "unattach_issue", "(", "context", ",", "id", "=", "id", ",", "issue_id", "=", "issue_id", ")", "if", "result", ".", "status_code", "==", "204", ":...
unattach_issue(context, id, issue_id) Unattach an issue from a job. >>> dcictl job-unattach-issue [OPTIONS] :param string id: ID of the job to attach the issue to [required] :param string issue_id: ID of the issue to unattach from the job [required]
[ "unattach_issue", "(", "context", "id", "issue_id", ")" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L139-L154
train
Unattach an issue from a job.
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
list_issues
def list_issues(context, id, sort, limit, where): """list_issues(context, id) List all job attached issues. >>> dcictl job-list-issue [OPTIONS] :param string id: ID of the job to retrieve issues from [required] :param string sort: Field to apply sort :param integer limit: Max number of rows t...
python
def list_issues(context, id, sort, limit, where): """list_issues(context, id) List all job attached issues. >>> dcictl job-list-issue [OPTIONS] :param string id: ID of the job to retrieve issues from [required] :param string sort: Field to apply sort :param integer limit: Max number of rows t...
[ "def", "list_issues", "(", "context", ",", "id", ",", "sort", ",", "limit", ",", "where", ")", ":", "result", "=", "job", ".", "list_issues", "(", "context", ",", "id", "=", "id", ",", "sort", "=", "sort", ",", "limit", "=", "limit", ",", "where", ...
list_issues(context, id) List all job attached issues. >>> dcictl job-list-issue [OPTIONS] :param string id: ID of the job to retrieve issues from [required] :param string sort: Field to apply sort :param integer limit: Max number of rows to return :param string where: An optional filter crit...
[ "list_issues", "(", "context", "id", ")" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L164-L180
train
List all issues attached to a job
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
output
def output(context, id): """output(context, id) Show a job output. >>> dcictl job-output [OPTIONS] :param string id: ID of the job to show [required] """ colors = { 'pre-run': '\x1b[6;30;44m', 'running': '\x1b[6;30;42m', 'post-run': '\x1b[6;30;44m', 'failure':...
python
def output(context, id): """output(context, id) Show a job output. >>> dcictl job-output [OPTIONS] :param string id: ID of the job to show [required] """ colors = { 'pre-run': '\x1b[6;30;44m', 'running': '\x1b[6;30;42m', 'post-run': '\x1b[6;30;44m', 'failure':...
[ "def", "output", "(", "context", ",", "id", ")", ":", "colors", "=", "{", "'pre-run'", ":", "'\\x1b[6;30;44m'", ",", "'running'", ":", "'\\x1b[6;30;42m'", ",", "'post-run'", ":", "'\\x1b[6;30;44m'", ",", "'failure'", ":", "'\\x1b[6;30;41m'", "}", "result", "="...
output(context, id) Show a job output. >>> dcictl job-output [OPTIONS] :param string id: ID of the job to show [required]
[ "output", "(", "context", "id", ")" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L186-L216
train
Show a job output.
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
add_tag
def add_tag(context, id, name): """add_tag(context, id, name) Attach a tag to a job. >>> dcictl job-add-tag [OPTIONS] :param string id: ID of the job to attach the tag on [required] :param string tag_name: name of the tag to be attached [required] """ result = job.add_tag(context, id=id,...
python
def add_tag(context, id, name): """add_tag(context, id, name) Attach a tag to a job. >>> dcictl job-add-tag [OPTIONS] :param string id: ID of the job to attach the tag on [required] :param string tag_name: name of the tag to be attached [required] """ result = job.add_tag(context, id=id,...
[ "def", "add_tag", "(", "context", ",", "id", ",", "name", ")", ":", "result", "=", "job", ".", "add_tag", "(", "context", ",", "id", "=", "id", ",", "name", "=", "name", ")", "utils", ".", "format_output", "(", "result", ",", "context", ".", "forma...
add_tag(context, id, name) Attach a tag to a job. >>> dcictl job-add-tag [OPTIONS] :param string id: ID of the job to attach the tag on [required] :param string tag_name: name of the tag to be attached [required]
[ "add_tag", "(", "context", "id", "name", ")" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L252-L264
train
Add a tag to a
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
delete_tag
def delete_tag(context, id, tag_id): """delete_tag(context, id, tag_id) Delete a tag from a job. >>> dcictl job-delete-tag [OPTIONS] :param string id: ID of the job to attach the meta to [required] :param string tag_id: ID of the tag to be removed from the job [required] """ result = job...
python
def delete_tag(context, id, tag_id): """delete_tag(context, id, tag_id) Delete a tag from a job. >>> dcictl job-delete-tag [OPTIONS] :param string id: ID of the job to attach the meta to [required] :param string tag_id: ID of the tag to be removed from the job [required] """ result = job...
[ "def", "delete_tag", "(", "context", ",", "id", ",", "tag_id", ")", ":", "result", "=", "job", ".", "delete_tag", "(", "context", ",", "id", "=", "id", ",", "tag_id", "=", "tag_id", ")", "if", "result", ".", "status_code", "==", "204", ":", "utils", ...
delete_tag(context, id, tag_id) Delete a tag from a job. >>> dcictl job-delete-tag [OPTIONS] :param string id: ID of the job to attach the meta to [required] :param string tag_id: ID of the tag to be removed from the job [required]
[ "delete_tag", "(", "context", "id", "tag_id", ")" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L271-L286
train
Delete a tag from a node.
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
list_tags
def list_tags(context, id): """list_tags(context, id) List all tags of a job. >>> dcictl job-list-tags [OPTIONS] :param string id: ID of the job to retrieve tags from [required] """ result = job.list_tags(context, id) utils.format_output(result, context.format)
python
def list_tags(context, id): """list_tags(context, id) List all tags of a job. >>> dcictl job-list-tags [OPTIONS] :param string id: ID of the job to retrieve tags from [required] """ result = job.list_tags(context, id) utils.format_output(result, context.format)
[ "def", "list_tags", "(", "context", ",", "id", ")", ":", "result", "=", "job", ".", "list_tags", "(", "context", ",", "id", ")", "utils", ".", "format_output", "(", "result", ",", "context", ".", "format", ")" ]
list_tags(context, id) List all tags of a job. >>> dcictl job-list-tags [OPTIONS] :param string id: ID of the job to retrieve tags from [required]
[ "list_tags", "(", "context", "id", ")" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L292-L303
train
List all tags of a job
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
file_upload
def file_upload(context, id, name, path, jobstate_id, test_id, mime): """file_upload(context, id, path) Upload a file in a job >>> dcictl job-upload-file [OPTIONS] :param string id: ID of the job to attach file to [required] :param string name: Name of the file [required] :param string path: ...
python
def file_upload(context, id, name, path, jobstate_id, test_id, mime): """file_upload(context, id, path) Upload a file in a job >>> dcictl job-upload-file [OPTIONS] :param string id: ID of the job to attach file to [required] :param string name: Name of the file [required] :param string path: ...
[ "def", "file_upload", "(", "context", ",", "id", ",", "name", ",", "path", ",", "jobstate_id", ",", "test_id", ",", "mime", ")", ":", "result", "=", "dci_file", ".", "create_with_stream", "(", "context", ",", "name", "=", "name", ",", "job_id", "=", "i...
file_upload(context, id, path) Upload a file in a job >>> dcictl job-upload-file [OPTIONS] :param string id: ID of the job to attach file to [required] :param string name: Name of the file [required] :param string path: Path to the file to upload [required] :param string jobstate_id: ID of th...
[ "file_upload", "(", "context", "id", "path", ")" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L314-L335
train
This function uploads a file in a job
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
file_download
def file_download(context, id, file_id, target): """file_download(context, id, path) Download a job file >>> dcictl job-download-file [OPTIONS] :param string id: ID of the job to download file [required] :param string file_id: ID of the job file to download [required] :param string target: De...
python
def file_download(context, id, file_id, target): """file_download(context, id, path) Download a job file >>> dcictl job-download-file [OPTIONS] :param string id: ID of the job to download file [required] :param string file_id: ID of the job file to download [required] :param string target: De...
[ "def", "file_download", "(", "context", ",", "id", ",", "file_id", ",", "target", ")", ":", "dci_file", ".", "download", "(", "context", ",", "id", "=", "id", ",", "file_id", "=", "file_id", ",", "target", "=", "target", ")" ]
file_download(context, id, path) Download a job file >>> dcictl job-download-file [OPTIONS] :param string id: ID of the job to download file [required] :param string file_id: ID of the job file to download [required] :param string target: Destination file [required]
[ "file_download", "(", "context", "id", "path", ")" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L343-L354
train
Download a file from the specified file_id to the specified path
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
file_show
def file_show(context, id, file_id): """file_show(context, id, path) Show a job file >>> dcictl job-show-file [OPTIONS] :param string id: ID of the component to show files [required] :param string file_id: ID of the file to show up [required] """ result = dci_file.get(context, id=file_id)...
python
def file_show(context, id, file_id): """file_show(context, id, path) Show a job file >>> dcictl job-show-file [OPTIONS] :param string id: ID of the component to show files [required] :param string file_id: ID of the file to show up [required] """ result = dci_file.get(context, id=file_id)...
[ "def", "file_show", "(", "context", ",", "id", ",", "file_id", ")", ":", "result", "=", "dci_file", ".", "get", "(", "context", ",", "id", "=", "file_id", ")", "utils", ".", "format_output", "(", "result", ",", "context", ".", "format", ")" ]
file_show(context, id, path) Show a job file >>> dcictl job-show-file [OPTIONS] :param string id: ID of the component to show files [required] :param string file_id: ID of the file to show up [required]
[ "file_show", "(", "context", "id", "path", ")" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L361-L372
train
Show a file in a bunch of work items
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
file_delete
def file_delete(context, id, file_id): """file_delete(context, id, path) Delete a job file >>> dcictl job-delete-file [OPTIONS] :param string id: ID of the job to delete file [required] :param string file_id: ID for the file to delete [required] """ dci_file.delete(context, id=file_id) ...
python
def file_delete(context, id, file_id): """file_delete(context, id, path) Delete a job file >>> dcictl job-delete-file [OPTIONS] :param string id: ID of the job to delete file [required] :param string file_id: ID for the file to delete [required] """ dci_file.delete(context, id=file_id) ...
[ "def", "file_delete", "(", "context", ",", "id", ",", "file_id", ")", ":", "dci_file", ".", "delete", "(", "context", ",", "id", "=", "file_id", ")", "result", "=", "dci_file", ".", "delete", "(", "context", ",", "id", "=", "file_id", ")", "utils", "...
file_delete(context, id, path) Delete a job file >>> dcictl job-delete-file [OPTIONS] :param string id: ID of the job to delete file [required] :param string file_id: ID for the file to delete [required]
[ "file_delete", "(", "context", "id", "path", ")" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L404-L416
train
Delete a file in the
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
LDAPBackend.get_or_create_user
def get_or_create_user(self, username, ldap_user): """ This must return a (User, created) 2-tuple for the given LDAP user. username is the Django-friendly username of the user. ldap_user.dn is the user's DN and ldap_user.attrs contains all of their LDAP attributes. """ mo...
python
def get_or_create_user(self, username, ldap_user): """ This must return a (User, created) 2-tuple for the given LDAP user. username is the Django-friendly username of the user. ldap_user.dn is the user's DN and ldap_user.attrs contains all of their LDAP attributes. """ mo...
[ "def", "get_or_create_user", "(", "self", ",", "username", ",", "ldap_user", ")", ":", "model", "=", "self", ".", "get_user_model", "(", ")", "username_field", "=", "getattr", "(", "model", ",", "'USERNAME_FIELD'", ",", "'username'", ")", "kwargs", "=", "{",...
This must return a (User, created) 2-tuple for the given LDAP user. username is the Django-friendly username of the user. ldap_user.dn is the user's DN and ldap_user.attrs contains all of their LDAP attributes.
[ "This", "must", "return", "a", "(", "User", "created", ")", "2", "-", "tuple", "for", "the", "given", "LDAP", "user", ".", "username", "is", "the", "Django", "-", "friendly", "username", "of", "the", "user", ".", "ldap_user", ".", "dn", "is", "the", ...
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L211-L225
train
This method returns a User object for the given username.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser.authenticate
def authenticate(self, password): """ Authenticates against the LDAP directory and returns the corresponding User object if successful. Returns None on failure. """ user = None try: self._authenticate_user_dn(password) self._check_requirements() ...
python
def authenticate(self, password): """ Authenticates against the LDAP directory and returns the corresponding User object if successful. Returns None on failure. """ user = None try: self._authenticate_user_dn(password) self._check_requirements() ...
[ "def", "authenticate", "(", "self", ",", "password", ")", ":", "user", "=", "None", "try", ":", "self", ".", "_authenticate_user_dn", "(", "password", ")", "self", ".", "_check_requirements", "(", ")", "self", ".", "_get_or_create_user", "(", ")", "user", ...
Authenticates against the LDAP directory and returns the corresponding User object if successful. Returns None on failure.
[ "Authenticates", "against", "the", "LDAP", "directory", "and", "returns", "the", "corresponding", "User", "object", "if", "successful", ".", "Returns", "None", "on", "failure", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L325-L351
train
Authenticates against the LDAP directory and returns the corresponding User object if successful. Returns None on failure.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser.get_group_permissions
def get_group_permissions(self): """ If allowed by the configuration, this returns the set of permissions defined by the user's LDAP group memberships. """ if self._group_permissions is None: self._group_permissions = set() if self.settings.FIND_GROUP_PER...
python
def get_group_permissions(self): """ If allowed by the configuration, this returns the set of permissions defined by the user's LDAP group memberships. """ if self._group_permissions is None: self._group_permissions = set() if self.settings.FIND_GROUP_PER...
[ "def", "get_group_permissions", "(", "self", ")", ":", "if", "self", ".", "_group_permissions", "is", "None", ":", "self", ".", "_group_permissions", "=", "set", "(", ")", "if", "self", ".", "settings", ".", "FIND_GROUP_PERMS", ":", "try", ":", "self", "."...
If allowed by the configuration, this returns the set of permissions defined by the user's LDAP group memberships.
[ "If", "allowed", "by", "the", "configuration", "this", "returns", "the", "set", "of", "permissions", "defined", "by", "the", "user", "s", "LDAP", "group", "memberships", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L353-L372
train
Returns the set of permissions that are allowed by the user s LDAP group memberships.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser.populate_user
def populate_user(self): """ Populates the Django user object using the default bind credentials. """ user = None try: # self.attrs will only be non-None if we were able to load this user # from the LDAP directory, so this filters out nonexistent users. ...
python
def populate_user(self): """ Populates the Django user object using the default bind credentials. """ user = None try: # self.attrs will only be non-None if we were able to load this user # from the LDAP directory, so this filters out nonexistent users. ...
[ "def", "populate_user", "(", "self", ")", ":", "user", "=", "None", "try", ":", "# self.attrs will only be non-None if we were able to load this user", "# from the LDAP directory, so this filters out nonexistent users.", "if", "self", ".", "attrs", "is", "not", "None", ":", ...
Populates the Django user object using the default bind credentials.
[ "Populates", "the", "Django", "user", "object", "using", "the", "default", "bind", "credentials", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L374-L399
train
Populates the user object with the default bind credentials.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser._check_required_group
def _check_required_group(self): """ Returns True if the group requirement (AUTH_LDAP_REQUIRE_GROUP) is met. Always returns True if AUTH_LDAP_REQUIRE_GROUP is None. """ required_group_dn = self.settings.REQUIRE_GROUP if required_group_dn is not None: is_membe...
python
def _check_required_group(self): """ Returns True if the group requirement (AUTH_LDAP_REQUIRE_GROUP) is met. Always returns True if AUTH_LDAP_REQUIRE_GROUP is None. """ required_group_dn = self.settings.REQUIRE_GROUP if required_group_dn is not None: is_membe...
[ "def", "_check_required_group", "(", "self", ")", ":", "required_group_dn", "=", "self", ".", "settings", ".", "REQUIRE_GROUP", "if", "required_group_dn", "is", "not", "None", ":", "is_member", "=", "self", ".", "_get_groups", "(", ")", ".", "is_member_of", "(...
Returns True if the group requirement (AUTH_LDAP_REQUIRE_GROUP) is met. Always returns True if AUTH_LDAP_REQUIRE_GROUP is None.
[ "Returns", "True", "if", "the", "group", "requirement", "(", "AUTH_LDAP_REQUIRE_GROUP", ")", "is", "met", ".", "Always", "returns", "True", "if", "AUTH_LDAP_REQUIRE_GROUP", "is", "None", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L507-L519
train
Checks if the group requirement is met.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser._get_or_create_user
def _get_or_create_user(self, force_populate=False): """ Loads the User model object from the database or creates it if it doesn't exist. Also populates the fields, subject to AUTH_LDAP_ALWAYS_UPDATE_USER. """ save_user = False username = self.backend.ldap_to_dja...
python
def _get_or_create_user(self, force_populate=False): """ Loads the User model object from the database or creates it if it doesn't exist. Also populates the fields, subject to AUTH_LDAP_ALWAYS_UPDATE_USER. """ save_user = False username = self.backend.ldap_to_dja...
[ "def", "_get_or_create_user", "(", "self", ",", "force_populate", "=", "False", ")", ":", "save_user", "=", "False", "username", "=", "self", ".", "backend", ".", "ldap_to_django_username", "(", "self", ".", "_username", ")", "self", ".", "_user", ",", "crea...
Loads the User model object from the database or creates it if it doesn't exist. Also populates the fields, subject to AUTH_LDAP_ALWAYS_UPDATE_USER.
[ "Loads", "the", "User", "model", "object", "from", "the", "database", "or", "creates", "it", "if", "it", "doesn", "t", "exist", ".", "Also", "populates", "the", "fields", "subject", "to", "AUTH_LDAP_ALWAYS_UPDATE_USER", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L539-L582
train
Loads the User model object from the database or creates it if it doesn t exist.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser._populate_user
def _populate_user(self): """ Populates our User object with information from the LDAP directory. """ self._populate_user_from_attributes() self._populate_user_from_group_memberships() self._populate_user_from_dn_regex() self._populate_user_from_dn_regex_negation(...
python
def _populate_user(self): """ Populates our User object with information from the LDAP directory. """ self._populate_user_from_attributes() self._populate_user_from_group_memberships() self._populate_user_from_dn_regex() self._populate_user_from_dn_regex_negation(...
[ "def", "_populate_user", "(", "self", ")", ":", "self", ".", "_populate_user_from_attributes", "(", ")", "self", ".", "_populate_user_from_group_memberships", "(", ")", "self", ".", "_populate_user_from_dn_regex", "(", ")", "self", ".", "_populate_user_from_dn_regex_neg...
Populates our User object with information from the LDAP directory.
[ "Populates", "our", "User", "object", "with", "information", "from", "the", "LDAP", "directory", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L584-L591
train
Populates our User object with information from the LDAP directory.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser._populate_user_from_dn_regex
def _populate_user_from_dn_regex(self): """ Populate the given profile object flags from AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX. Returns True if the profile was modified """ for field, regex in self.settings.USER_FLAGS_BY_DN_REGEX.items(): field_value = False ...
python
def _populate_user_from_dn_regex(self): """ Populate the given profile object flags from AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX. Returns True if the profile was modified """ for field, regex in self.settings.USER_FLAGS_BY_DN_REGEX.items(): field_value = False ...
[ "def", "_populate_user_from_dn_regex", "(", "self", ")", ":", "for", "field", ",", "regex", "in", "self", ".", "settings", ".", "USER_FLAGS_BY_DN_REGEX", ".", "items", "(", ")", ":", "field_value", "=", "False", "if", "re", ".", "search", "(", "regex", ","...
Populate the given profile object flags from AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX. Returns True if the profile was modified
[ "Populate", "the", "given", "profile", "object", "flags", "from", "AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX", ".", "Returns", "True", "if", "the", "profile", "was", "modified" ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L607-L616
train
Populate the user object with the values from the LDAP profile flags from AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser._populate_user_from_dn_regex_negation
def _populate_user_from_dn_regex_negation(self): """ Populate the given profile object flags from AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX. Returns True if the profile was modified """ for field, regex in self.settings.USER_FLAGS_BY_DN_REGEX_NEGATION.items(): field_value =...
python
def _populate_user_from_dn_regex_negation(self): """ Populate the given profile object flags from AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX. Returns True if the profile was modified """ for field, regex in self.settings.USER_FLAGS_BY_DN_REGEX_NEGATION.items(): field_value =...
[ "def", "_populate_user_from_dn_regex_negation", "(", "self", ")", ":", "for", "field", ",", "regex", "in", "self", ".", "settings", ".", "USER_FLAGS_BY_DN_REGEX_NEGATION", ".", "items", "(", ")", ":", "field_value", "=", "True", "if", "re", ".", "search", "(",...
Populate the given profile object flags from AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX. Returns True if the profile was modified
[ "Populate", "the", "given", "profile", "object", "flags", "from", "AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX", ".", "Returns", "True", "if", "the", "profile", "was", "modified" ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L618-L627
train
Populate the user object with the values from LDAP_PROFILE_FLAGS_BY_DN_REGEX.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser._populate_and_save_user_profile
def _populate_and_save_user_profile(self): """ Populates a User profile object with fields from the LDAP directory. """ try: app_label, class_name = django.conf.settings.AUTH_PROFILE_MODULE.split('.') profile_model = apps.get_model(app_label, class_name) ...
python
def _populate_and_save_user_profile(self): """ Populates a User profile object with fields from the LDAP directory. """ try: app_label, class_name = django.conf.settings.AUTH_PROFILE_MODULE.split('.') profile_model = apps.get_model(app_label, class_name) ...
[ "def", "_populate_and_save_user_profile", "(", "self", ")", ":", "try", ":", "app_label", ",", "class_name", "=", "django", ".", "conf", ".", "settings", ".", "AUTH_PROFILE_MODULE", ".", "split", "(", "'.'", ")", "profile_model", "=", "apps", ".", "get_model",...
Populates a User profile object with fields from the LDAP directory.
[ "Populates", "a", "User", "profile", "object", "with", "fields", "from", "the", "LDAP", "directory", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L633-L658
train
Populates a User profile object with fields from the LDAP directory.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser._populate_profile_from_attributes
def _populate_profile_from_attributes(self, profile): """ Populate the given profile object from AUTH_LDAP_PROFILE_ATTR_MAP. Returns True if the profile was modified. """ save_profile = False for field, attr in self.settings.PROFILE_ATTR_MAP.items(): try: ...
python
def _populate_profile_from_attributes(self, profile): """ Populate the given profile object from AUTH_LDAP_PROFILE_ATTR_MAP. Returns True if the profile was modified. """ save_profile = False for field, attr in self.settings.PROFILE_ATTR_MAP.items(): try: ...
[ "def", "_populate_profile_from_attributes", "(", "self", ",", "profile", ")", ":", "save_profile", "=", "False", "for", "field", ",", "attr", "in", "self", ".", "settings", ".", "PROFILE_ATTR_MAP", ".", "items", "(", ")", ":", "try", ":", "# user_attrs is a ha...
Populate the given profile object from AUTH_LDAP_PROFILE_ATTR_MAP. Returns True if the profile was modified.
[ "Populate", "the", "given", "profile", "object", "from", "AUTH_LDAP_PROFILE_ATTR_MAP", ".", "Returns", "True", "if", "the", "profile", "was", "modified", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L660-L675
train
Populate the given profile object from AUTH_LDAP_PROFILE_ATTR_MAP.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser._populate_profile_flags_from_dn_regex
def _populate_profile_flags_from_dn_regex(self, profile): """ Populate the given profile object flags from AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX. Returns True if the profile was modified """ save_profile = True for field, regex in self.settings.PROFILE_FLAGS_BY_DN_REGEX.ite...
python
def _populate_profile_flags_from_dn_regex(self, profile): """ Populate the given profile object flags from AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX. Returns True if the profile was modified """ save_profile = True for field, regex in self.settings.PROFILE_FLAGS_BY_DN_REGEX.ite...
[ "def", "_populate_profile_flags_from_dn_regex", "(", "self", ",", "profile", ")", ":", "save_profile", "=", "True", "for", "field", ",", "regex", "in", "self", ".", "settings", ".", "PROFILE_FLAGS_BY_DN_REGEX", ".", "items", "(", ")", ":", "field_value", "=", ...
Populate the given profile object flags from AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX. Returns True if the profile was modified
[ "Populate", "the", "given", "profile", "object", "flags", "from", "AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX", ".", "Returns", "True", "if", "the", "profile", "was", "modified" ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L677-L690
train
Populate the given profile object flags from AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser._populate_profile_from_group_memberships
def _populate_profile_from_group_memberships(self, profile): """ Populate the given profile object from AUTH_LDAP_PROFILE_FLAGS_BY_GROUP. Returns True if the profile was modified. """ save_profile = False for field, group_dns in self.settings.PROFILE_FLAGS_BY_GROUP.items...
python
def _populate_profile_from_group_memberships(self, profile): """ Populate the given profile object from AUTH_LDAP_PROFILE_FLAGS_BY_GROUP. Returns True if the profile was modified. """ save_profile = False for field, group_dns in self.settings.PROFILE_FLAGS_BY_GROUP.items...
[ "def", "_populate_profile_from_group_memberships", "(", "self", ",", "profile", ")", ":", "save_profile", "=", "False", "for", "field", ",", "group_dns", "in", "self", ".", "settings", ".", "PROFILE_FLAGS_BY_GROUP", ".", "items", "(", ")", ":", "if", "isinstance...
Populate the given profile object from AUTH_LDAP_PROFILE_FLAGS_BY_GROUP. Returns True if the profile was modified.
[ "Populate", "the", "given", "profile", "object", "from", "AUTH_LDAP_PROFILE_FLAGS_BY_GROUP", ".", "Returns", "True", "if", "the", "profile", "was", "modified", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L692-L706
train
Populate the given profile object from AUTH_LDAP_PROFILE_FLAGS_BY_GROUP. Returns True if the profile was modified.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser._mirror_groups
def _mirror_groups(self): """ Mirrors the user's LDAP groups in the Django database and updates the user's membership. """ target_group_names = frozenset(self._get_groups().get_group_names()) current_group_names = frozenset(self._user.groups.values_list('name', flat=True)...
python
def _mirror_groups(self): """ Mirrors the user's LDAP groups in the Django database and updates the user's membership. """ target_group_names = frozenset(self._get_groups().get_group_names()) current_group_names = frozenset(self._user.groups.values_list('name', flat=True)...
[ "def", "_mirror_groups", "(", "self", ")", ":", "target_group_names", "=", "frozenset", "(", "self", ".", "_get_groups", "(", ")", ".", "get_group_names", "(", ")", ")", "current_group_names", "=", "frozenset", "(", "self", ".", "_user", ".", "groups", ".", ...
Mirrors the user's LDAP groups in the Django database and updates the user's membership.
[ "Mirrors", "the", "user", "s", "LDAP", "groups", "in", "the", "Django", "database", "and", "updates", "the", "user", "s", "membership", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L708-L723
train
Mirrors the LDAP groups in the Django database and updates the user s membership.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser._load_group_permissions
def _load_group_permissions(self): """ Populates self._group_permissions based on LDAP group membership and Django group permissions. """ group_names = self._get_groups().get_group_names() perms = Permission.objects.filter(group__name__in=group_names) perms = per...
python
def _load_group_permissions(self): """ Populates self._group_permissions based on LDAP group membership and Django group permissions. """ group_names = self._get_groups().get_group_names() perms = Permission.objects.filter(group__name__in=group_names) perms = per...
[ "def", "_load_group_permissions", "(", "self", ")", ":", "group_names", "=", "self", ".", "_get_groups", "(", ")", ".", "get_group_names", "(", ")", "perms", "=", "Permission", ".", "objects", ".", "filter", "(", "group__name__in", "=", "group_names", ")", "...
Populates self._group_permissions based on LDAP group membership and Django group permissions.
[ "Populates", "self", ".", "_group_permissions", "based", "on", "LDAP", "group", "membership", "and", "Django", "group", "permissions", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L729-L740
train
Loads the group permissions for the LDAP group.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUser._get_connection
def _get_connection(self): """ Returns our cached LDAPObject, which may or may not be bound. """ if self._connection is None: uri = self.settings.SERVER_URI if callable(uri): uri = uri() self._connection = self.backend.ldap.initialize(...
python
def _get_connection(self): """ Returns our cached LDAPObject, which may or may not be bound. """ if self._connection is None: uri = self.settings.SERVER_URI if callable(uri): uri = uri() self._connection = self.backend.ldap.initialize(...
[ "def", "_get_connection", "(", "self", ")", ":", "if", "self", ".", "_connection", "is", "None", ":", "uri", "=", "self", ".", "settings", ".", "SERVER_URI", "if", "callable", "(", "uri", ")", ":", "uri", "=", "uri", "(", ")", "self", ".", "_connecti...
Returns our cached LDAPObject, which may or may not be bound.
[ "Returns", "our", "cached", "LDAPObject", "which", "may", "or", "may", "not", "be", "bound", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L778-L796
train
Returns our LDAPObject which may or may not be bound.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUserGroups.get_group_dns
def get_group_dns(self): """ Returns a (cached) set of the distinguished names in self._group_infos. """ if self._group_dns is None: group_infos = self._get_group_infos() self._group_dns = set(group_info[0] for group_info in group_infos) return self._grou...
python
def get_group_dns(self): """ Returns a (cached) set of the distinguished names in self._group_infos. """ if self._group_dns is None: group_infos = self._get_group_infos() self._group_dns = set(group_info[0] for group_info in group_infos) return self._grou...
[ "def", "get_group_dns", "(", "self", ")", ":", "if", "self", ".", "_group_dns", "is", "None", ":", "group_infos", "=", "self", ".", "_get_group_infos", "(", ")", "self", ".", "_group_dns", "=", "set", "(", "group_info", "[", "0", "]", "for", "group_info"...
Returns a (cached) set of the distinguished names in self._group_infos.
[ "Returns", "a", "(", "cached", ")", "set", "of", "the", "distinguished", "names", "in", "self", ".", "_group_infos", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L868-L876
train
Returns a set of the distinguished names in the group.
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/backend.py
_LDAPUserGroups._cache_key
def _cache_key(self, attr_name): """ Memcache keys can't have spaces in them, so we'll remove them from the DN for maximum compatibility. """ dn = self._ldap_user.dn.replace(' ', '%20') key = u'auth_ldap.%s.%s.%s' % (self.__class__.__name__, attr_name, dn) return...
python
def _cache_key(self, attr_name): """ Memcache keys can't have spaces in them, so we'll remove them from the DN for maximum compatibility. """ dn = self._ldap_user.dn.replace(' ', '%20') key = u'auth_ldap.%s.%s.%s' % (self.__class__.__name__, attr_name, dn) return...
[ "def", "_cache_key", "(", "self", ",", "attr_name", ")", ":", "dn", "=", "self", ".", "_ldap_user", ".", "dn", ".", "replace", "(", "' '", ",", "'%20'", ")", "key", "=", "u'auth_ldap.%s.%s.%s'", "%", "(", "self", ".", "__class__", ".", "__name__", ",",...
Memcache keys can't have spaces in them, so we'll remove them from the DN for maximum compatibility.
[ "Memcache", "keys", "can", "t", "have", "spaces", "in", "them", "so", "we", "ll", "remove", "them", "from", "the", "DN", "for", "maximum", "compatibility", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/backend.py#L901-L909
train
Return the key for the cache entry for the given attribute name.
gmdzy2010/dingtalk_sdk_gmdzy2010
dingtalk_sdk_gmdzy2010/message_request.py
WorkNoticeRequest.get_task_id
def get_task_id(self): """Method to get all department members.""" task_id = self.json_response.get("task_id", None) self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return task_id
python
def get_task_id(self): """Method to get all department members.""" task_id = self.json_response.get("task_id", None) self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return task_id
[ "def", "get_task_id", "(", "self", ")", ":", "task_id", "=", "self", ".", "json_response", ".", "get", "(", "\"task_id\"", ",", "None", ")", "self", ".", "logger", ".", "info", "(", "\"%s\\t%s\"", "%", "(", "self", ".", "request_method", ",", "self", "...
Method to get all department members.
[ "Method", "to", "get", "all", "department", "members", "." ]
b06cb1f78f89be9554dcb6101af8bc72718a9ecd
https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/message_request.py#L24-L28
train
Method to get all department members.
gmdzy2010/dingtalk_sdk_gmdzy2010
dingtalk_sdk_gmdzy2010/message_request.py
GetWorkNoticeSendProgressRequest.get_progress
def get_progress(self): """Method to get the progress of work notice sending.""" progress = self.json_response.get("progress", None) self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return progress
python
def get_progress(self): """Method to get the progress of work notice sending.""" progress = self.json_response.get("progress", None) self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return progress
[ "def", "get_progress", "(", "self", ")", ":", "progress", "=", "self", ".", "json_response", ".", "get", "(", "\"progress\"", ",", "None", ")", "self", ".", "logger", ".", "info", "(", "\"%s\\t%s\"", "%", "(", "self", ".", "request_method", ",", "self", ...
Method to get the progress of work notice sending.
[ "Method", "to", "get", "the", "progress", "of", "work", "notice", "sending", "." ]
b06cb1f78f89be9554dcb6101af8bc72718a9ecd
https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/message_request.py#L48-L52
train
Method to get the progress of work notice sending.
gmdzy2010/dingtalk_sdk_gmdzy2010
dingtalk_sdk_gmdzy2010/message_request.py
GetWorkNoticeSendResultRequest.get_send_result
def get_send_result(self): """Method to get the progress of work notice sending.""" send_result = self.json_response.get("send_result", None) self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return send_result
python
def get_send_result(self): """Method to get the progress of work notice sending.""" send_result = self.json_response.get("send_result", None) self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return send_result
[ "def", "get_send_result", "(", "self", ")", ":", "send_result", "=", "self", ".", "json_response", ".", "get", "(", "\"send_result\"", ",", "None", ")", "self", ".", "logger", ".", "info", "(", "\"%s\\t%s\"", "%", "(", "self", ".", "request_method", ",", ...
Method to get the progress of work notice sending.
[ "Method", "to", "get", "the", "progress", "of", "work", "notice", "sending", "." ]
b06cb1f78f89be9554dcb6101af8bc72718a9ecd
https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/message_request.py#L72-L76
train
Method to get the progress of work notice sending.
gmdzy2010/dingtalk_sdk_gmdzy2010
dingtalk_sdk_gmdzy2010/message_request.py
CreateGroupChatRequest.get_chat_id
def get_chat_id(self): """Method to get chatid of group created.""" chat_id = self.json_response.get("chatid", None) self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return chat_id
python
def get_chat_id(self): """Method to get chatid of group created.""" chat_id = self.json_response.get("chatid", None) self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return chat_id
[ "def", "get_chat_id", "(", "self", ")", ":", "chat_id", "=", "self", ".", "json_response", ".", "get", "(", "\"chatid\"", ",", "None", ")", "self", ".", "logger", ".", "info", "(", "\"%s\\t%s\"", "%", "(", "self", ".", "request_method", ",", "self", "....
Method to get chatid of group created.
[ "Method", "to", "get", "chatid", "of", "group", "created", "." ]
b06cb1f78f89be9554dcb6101af8bc72718a9ecd
https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/message_request.py#L96-L100
train
Method to get chatid of group created.
gmdzy2010/dingtalk_sdk_gmdzy2010
dingtalk_sdk_gmdzy2010/message_request.py
GetGroupChatRequest.get_chat_info
def get_chat_info(self): """Method to get chatid of group created.""" chat_info = self.json_response.get("chat_info", None) self.chat_info = chat_info self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return chat_info
python
def get_chat_info(self): """Method to get chatid of group created.""" chat_info = self.json_response.get("chat_info", None) self.chat_info = chat_info self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return chat_info
[ "def", "get_chat_info", "(", "self", ")", ":", "chat_info", "=", "self", ".", "json_response", ".", "get", "(", "\"chat_info\"", ",", "None", ")", "self", ".", "chat_info", "=", "chat_info", "self", ".", "logger", ".", "info", "(", "\"%s\\t%s\"", "%", "(...
Method to get chatid of group created.
[ "Method", "to", "get", "chatid", "of", "group", "created", "." ]
b06cb1f78f89be9554dcb6101af8bc72718a9ecd
https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/message_request.py#L139-L144
train
Method to get chatid of group created.
gmdzy2010/dingtalk_sdk_gmdzy2010
dingtalk_sdk_gmdzy2010/message_request.py
SendGroupChatRequest.get_message_id
def get_message_id(self): """Method to get messageId of group created.""" message_id = self.json_response.get("messageId", None) self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return message_id
python
def get_message_id(self): """Method to get messageId of group created.""" message_id = self.json_response.get("messageId", None) self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return message_id
[ "def", "get_message_id", "(", "self", ")", ":", "message_id", "=", "self", ".", "json_response", ".", "get", "(", "\"messageId\"", ",", "None", ")", "self", ".", "logger", ".", "info", "(", "\"%s\\t%s\"", "%", "(", "self", ".", "request_method", ",", "se...
Method to get messageId of group created.
[ "Method", "to", "get", "messageId", "of", "group", "created", "." ]
b06cb1f78f89be9554dcb6101af8bc72718a9ecd
https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/message_request.py#L168-L172
train
Method to get messageId of group created.
gmdzy2010/dingtalk_sdk_gmdzy2010
dingtalk_sdk_gmdzy2010/message_request.py
GetReadGroupChatUserIdsRequest.get_read_user_ids
def get_read_user_ids(self): """Method to get chatid of group created.""" read_user_ids = self.json_response.get("readUserIdList", None) self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return read_user_ids
python
def get_read_user_ids(self): """Method to get chatid of group created.""" read_user_ids = self.json_response.get("readUserIdList", None) self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return read_user_ids
[ "def", "get_read_user_ids", "(", "self", ")", ":", "read_user_ids", "=", "self", ".", "json_response", ".", "get", "(", "\"readUserIdList\"", ",", "None", ")", "self", ".", "logger", ".", "info", "(", "\"%s\\t%s\"", "%", "(", "self", ".", "request_method", ...
Method to get chatid of group created.
[ "Method", "to", "get", "chatid", "of", "group", "created", "." ]
b06cb1f78f89be9554dcb6101af8bc72718a9ecd
https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/message_request.py#L192-L196
train
Method to get chatid of group created.
neetjn/pyselenium-js
pyseleniumjs/e2ejs.py
E2EJS.__type2js
def __type2js(cls, value): """ :Description: Convert python value to executable javascript value by type. :param value: Value to transform. :type value: None, bool, int, float, string :return: string """ if value is None: return 'null' elif isi...
python
def __type2js(cls, value): """ :Description: Convert python value to executable javascript value by type. :param value: Value to transform. :type value: None, bool, int, float, string :return: string """ if value is None: return 'null' elif isi...
[ "def", "__type2js", "(", "cls", ",", "value", ")", ":", "if", "value", "is", "None", ":", "return", "'null'", "elif", "isinstance", "(", "value", ",", "bool", ")", ":", "return", "'false'", "if", "not", "value", "else", "'true'", "elif", "isinstance", ...
:Description: Convert python value to executable javascript value by type. :param value: Value to transform. :type value: None, bool, int, float, string :return: string
[ ":", "Description", ":", "Convert", "python", "value", "to", "executable", "javascript", "value", "by", "type", ".", ":", "param", "value", ":", "Value", "to", "transform", ".", ":", "type", "value", ":", "None", "bool", "int", "float", "string", ":", "r...
fe81edcaf9ed76b0ef748c42a51ccacd985d400a
https://github.com/neetjn/pyselenium-js/blob/fe81edcaf9ed76b0ef748c42a51ccacd985d400a/pyseleniumjs/e2ejs.py#L35-L50
train
Converts python value by type to executable javascript value by type.
neetjn/pyselenium-js
pyseleniumjs/e2ejs.py
E2EJS.__type2python
def __type2python(cls, value): """ :Description: Convert javascript value to python value by type. :param value: Value to transform. :type value: None, bool, int, float, string :return: None, bool, int, float, string """ if isinstance(value, string_types): ...
python
def __type2python(cls, value): """ :Description: Convert javascript value to python value by type. :param value: Value to transform. :type value: None, bool, int, float, string :return: None, bool, int, float, string """ if isinstance(value, string_types): ...
[ "def", "__type2python", "(", "cls", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "string_types", ")", ":", "if", "value", "is", "'null'", ":", "return", "None", "elif", "value", "in", "(", "'true'", ",", "'false'", ")", ":", "return",...
:Description: Convert javascript value to python value by type. :param value: Value to transform. :type value: None, bool, int, float, string :return: None, bool, int, float, string
[ ":", "Description", ":", "Convert", "javascript", "value", "to", "python", "value", "by", "type", ".", ":", "param", "value", ":", "Value", "to", "transform", ".", ":", "type", "value", ":", "None", "bool", "int", "float", "string", ":", "return", ":", ...
fe81edcaf9ed76b0ef748c42a51ccacd985d400a
https://github.com/neetjn/pyselenium-js/blob/fe81edcaf9ed76b0ef748c42a51ccacd985d400a/pyseleniumjs/e2ejs.py#L53-L72
train
Convert javascript value by type.
neetjn/pyselenium-js
pyseleniumjs/e2ejs.py
E2EJS.wait
def wait(self, condition, interval, *args): """ :Description: Create an interval in vm.window, will clear interval after condition met. :param condition: Condition in javascript to pass to interval. :example: '$el.innerText == "cheesecake"' :example: '$el[0].disabled && $el[1].di...
python
def wait(self, condition, interval, *args): """ :Description: Create an interval in vm.window, will clear interval after condition met. :param condition: Condition in javascript to pass to interval. :example: '$el.innerText == "cheesecake"' :example: '$el[0].disabled && $el[1].di...
[ "def", "wait", "(", "self", ",", "condition", ",", "interval", ",", "*", "args", ")", ":", "hid", "=", "lambda", ":", "'$'", "+", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", "[", ":", "8", "]", "handle", "=", "hid", "(", ")", "if", "len"...
:Description: Create an interval in vm.window, will clear interval after condition met. :param condition: Condition in javascript to pass to interval. :example: '$el.innerText == "cheesecake"' :example: '$el[0].disabled && $el[1].disabled' :type condition: string :param interval:...
[ ":", "Description", ":", "Create", "an", "interval", "in", "vm", ".", "window", "will", "clear", "interval", "after", "condition", "met", ".", ":", "param", "condition", ":", "Condition", "in", "javascript", "to", "pass", "to", "interval", ".", ":", "examp...
fe81edcaf9ed76b0ef748c42a51ccacd985d400a
https://github.com/neetjn/pyselenium-js/blob/fe81edcaf9ed76b0ef748c42a51ccacd985d400a/pyseleniumjs/e2ejs.py#L74-L126
train
This method will create an interval in vm. window and will clear the interval after condition met.
neetjn/pyselenium-js
pyseleniumjs/e2ejs.py
E2EJS.get_attribute
def get_attribute(self, element, attribute, convert_type=True): """ :Description: Return the given attribute of the target element. :param element: Element for browser instance to target. :type element: WebElement :param attribute: Attribute of target element to return. :...
python
def get_attribute(self, element, attribute, convert_type=True): """ :Description: Return the given attribute of the target element. :param element: Element for browser instance to target. :type element: WebElement :param attribute: Attribute of target element to return. :...
[ "def", "get_attribute", "(", "self", ",", "element", ",", "attribute", ",", "convert_type", "=", "True", ")", ":", "attribute", "=", "self", ".", "browser", ".", "execute_script", "(", "'return arguments[0].getAttribute(\"%s\");'", "%", "attribute", ",", "element"...
:Description: Return the given attribute of the target element. :param element: Element for browser instance to target. :type element: WebElement :param attribute: Attribute of target element to return. :type attribute: string :param convert_type: If enabled, will return pythonic...
[ ":", "Description", ":", "Return", "the", "given", "attribute", "of", "the", "target", "element", ".", ":", "param", "element", ":", "Element", "for", "browser", "instance", "to", "target", ".", ":", "type", "element", ":", "WebElement", ":", "param", "att...
fe81edcaf9ed76b0ef748c42a51ccacd985d400a
https://github.com/neetjn/pyselenium-js/blob/fe81edcaf9ed76b0ef748c42a51ccacd985d400a/pyseleniumjs/e2ejs.py#L207-L221
train
This method returns the given attribute of the given element.
neetjn/pyselenium-js
pyseleniumjs/e2ejs.py
E2EJS.set_attribute
def set_attribute(self, element, attribute, value): """ :Description: Modify the given attribute of the target element. :param element: Element for browser instance to target. :type element: WebElement :param attribute: Attribute of target element to modify. :type attribu...
python
def set_attribute(self, element, attribute, value): """ :Description: Modify the given attribute of the target element. :param element: Element for browser instance to target. :type element: WebElement :param attribute: Attribute of target element to modify. :type attribu...
[ "def", "set_attribute", "(", "self", ",", "element", ",", "attribute", ",", "value", ")", ":", "self", ".", "browser", ".", "execute_script", "(", "'arguments[0].setAttribute(\"%s\", %s);'", "%", "(", "attribute", ",", "self", ".", "__type2js", "(", "value", "...
:Description: Modify the given attribute of the target element. :param element: Element for browser instance to target. :type element: WebElement :param attribute: Attribute of target element to modify. :type attribute: string :param value: Value of target element's attribute to ...
[ ":", "Description", ":", "Modify", "the", "given", "attribute", "of", "the", "target", "element", ".", ":", "param", "element", ":", "Element", "for", "browser", "instance", "to", "target", ".", ":", "type", "element", ":", "WebElement", ":", "param", "att...
fe81edcaf9ed76b0ef748c42a51ccacd985d400a
https://github.com/neetjn/pyselenium-js/blob/fe81edcaf9ed76b0ef748c42a51ccacd985d400a/pyseleniumjs/e2ejs.py#L223-L234
train
Modify the given attribute of the given element.
neetjn/pyselenium-js
pyseleniumjs/e2ejs.py
E2EJS.set_property
def set_property(self, element, prop, value): """ :Description: Modify the given attribute of the target element. :param element: Element for browser instance to target. :type element: WebElement :param prop: Property of target element to modify. :type prop: string ...
python
def set_property(self, element, prop, value): """ :Description: Modify the given attribute of the target element. :param element: Element for browser instance to target. :type element: WebElement :param prop: Property of target element to modify. :type prop: string ...
[ "def", "set_property", "(", "self", ",", "element", ",", "prop", ",", "value", ")", ":", "self", ".", "browser", ".", "execute_script", "(", "'arguments[0][\"%s\"] = %s'", "%", "(", "prop", ",", "self", ".", "__type2js", "(", "value", "=", "value", ")", ...
:Description: Modify the given attribute of the target element. :param element: Element for browser instance to target. :type element: WebElement :param prop: Property of target element to modify. :type prop: string :param value: Value of target element's property to modify. ...
[ ":", "Description", ":", "Modify", "the", "given", "attribute", "of", "the", "target", "element", ".", ":", "param", "element", ":", "Element", "for", "browser", "instance", "to", "target", ".", ":", "type", "element", ":", "WebElement", ":", "param", "pro...
fe81edcaf9ed76b0ef748c42a51ccacd985d400a
https://github.com/neetjn/pyselenium-js/blob/fe81edcaf9ed76b0ef748c42a51ccacd985d400a/pyseleniumjs/e2ejs.py#L257-L268
train
Modify the given property of the given element.
neetjn/pyselenium-js
pyseleniumjs/e2ejs.py
E2EJS.trigger_event
def trigger_event(self, element, event, event_type=None, options=None): """ :Description: Trigger specified event of the given element. :param element: Element for browser instance to target. :type element: WebElement, (WebElement, ...) :param event: Event to trigger from target ...
python
def trigger_event(self, element, event, event_type=None, options=None): """ :Description: Trigger specified event of the given element. :param element: Element for browser instance to target. :type element: WebElement, (WebElement, ...) :param event: Event to trigger from target ...
[ "def", "trigger_event", "(", "self", ",", "element", ",", "event", ",", "event_type", "=", "None", ",", "options", "=", "None", ")", ":", "if", "not", "isinstance", "(", "element", ",", "(", "tuple", ",", "list", ")", ")", ":", "element", "=", "[", ...
:Description: Trigger specified event of the given element. :param element: Element for browser instance to target. :type element: WebElement, (WebElement, ...) :param event: Event to trigger from target element. :type event: string, (string, ...) :param event_type: Event type. ...
[ ":", "Description", ":", "Trigger", "specified", "event", "of", "the", "given", "element", ".", ":", "param", "element", ":", "Element", "for", "browser", "instance", "to", "target", ".", ":", "type", "element", ":", "WebElement", "(", "WebElement", "...", ...
fe81edcaf9ed76b0ef748c42a51ccacd985d400a
https://github.com/neetjn/pyselenium-js/blob/fe81edcaf9ed76b0ef748c42a51ccacd985d400a/pyseleniumjs/e2ejs.py#L299-L325
train
Trigger specified event of the given element.
neetjn/pyselenium-js
pyseleniumjs/e2ejs.py
E2EJS.__d2b_notation
def __d2b_notation(prop): """ :Description: Transform javascript dot notation to bracket notation. :param prop: Property to transform. :type prop: string :example: 'messages.total' >> someObject['messages']['total'] :return: string """ results = re.compile...
python
def __d2b_notation(prop): """ :Description: Transform javascript dot notation to bracket notation. :param prop: Property to transform. :type prop: string :example: 'messages.total' >> someObject['messages']['total'] :return: string """ results = re.compile...
[ "def", "__d2b_notation", "(", "prop", ")", ":", "results", "=", "re", ".", "compile", "(", "'[[$a-zA-Z]{0,}.'", ")", ".", "findall", "(", "prop", ")", "for", "i", "in", "range", "(", "0", ",", "len", "(", "results", ")", ")", ":", "results", "[", "...
:Description: Transform javascript dot notation to bracket notation. :param prop: Property to transform. :type prop: string :example: 'messages.total' >> someObject['messages']['total'] :return: string
[ ":", "Description", ":", "Transform", "javascript", "dot", "notation", "to", "bracket", "notation", ".", ":", "param", "prop", ":", "Property", "to", "transform", ".", ":", "type", "prop", ":", "string", ":", "example", ":", "messages", ".", "total", ">>",...
fe81edcaf9ed76b0ef748c42a51ccacd985d400a
https://github.com/neetjn/pyselenium-js/blob/fe81edcaf9ed76b0ef748c42a51ccacd985d400a/pyseleniumjs/e2ejs.py#L400-L411
train
Transform javascript dot notation to bracket notation.
neetjn/pyselenium-js
pyseleniumjs/e2ejs.py
E2EJS.ng_get_scope_property
def ng_get_scope_property(self, element, prop): """ :Description: Will return value of property of element's scope. :Warning: This will only work for angular.js 1.x. :Warning: Requires angular debugging to be enabled. :param element: Element for browser instance to target. ...
python
def ng_get_scope_property(self, element, prop): """ :Description: Will return value of property of element's scope. :Warning: This will only work for angular.js 1.x. :Warning: Requires angular debugging to be enabled. :param element: Element for browser instance to target. ...
[ "def", "ng_get_scope_property", "(", "self", ",", "element", ",", "prop", ")", ":", "return", "self", ".", "browser", ".", "execute_script", "(", "'return angular.element(arguments[0]).scope()%s;'", "%", "self", ".", "__d2b_notation", "(", "prop", "=", "prop", ")"...
:Description: Will return value of property of element's scope. :Warning: This will only work for angular.js 1.x. :Warning: Requires angular debugging to be enabled. :param element: Element for browser instance to target. :param prop: Property of element's angular scope to target. ...
[ ":", "Description", ":", "Will", "return", "value", "of", "property", "of", "element", "s", "scope", ".", ":", "Warning", ":", "This", "will", "only", "work", "for", "angular", ".", "js", "1", ".", "x", ".", ":", "Warning", ":", "Requires", "angular", ...
fe81edcaf9ed76b0ef748c42a51ccacd985d400a
https://github.com/neetjn/pyselenium-js/blob/fe81edcaf9ed76b0ef748c42a51ccacd985d400a/pyseleniumjs/e2ejs.py#L422-L436
train
This method will return value of property of element s scope.
neetjn/pyselenium-js
pyseleniumjs/e2ejs.py
E2EJS.ng_get_ctrl_property
def ng_get_ctrl_property(self, element, prop): """ :Description: Will return value of property of element's controller. :Warning: This will only work for angular.js 1.x. :Warning: Requires angular debugging to be enabled. :param element: Element for browser instance to target. ...
python
def ng_get_ctrl_property(self, element, prop): """ :Description: Will return value of property of element's controller. :Warning: This will only work for angular.js 1.x. :Warning: Requires angular debugging to be enabled. :param element: Element for browser instance to target. ...
[ "def", "ng_get_ctrl_property", "(", "self", ",", "element", ",", "prop", ")", ":", "return", "self", ".", "browser", ".", "execute_script", "(", "'return angular.element(arguments[0]).controller()%s;'", "%", "self", ".", "__d2b_notation", "(", "prop", "=", "prop", ...
:Description: Will return value of property of element's controller. :Warning: This will only work for angular.js 1.x. :Warning: Requires angular debugging to be enabled. :param element: Element for browser instance to target. :type element: WebElement :param prop: Property of el...
[ ":", "Description", ":", "Will", "return", "value", "of", "property", "of", "element", "s", "controller", ".", ":", "Warning", ":", "This", "will", "only", "work", "for", "angular", ".", "js", "1", ".", "x", ".", ":", "Warning", ":", "Requires", "angul...
fe81edcaf9ed76b0ef748c42a51ccacd985d400a
https://github.com/neetjn/pyselenium-js/blob/fe81edcaf9ed76b0ef748c42a51ccacd985d400a/pyseleniumjs/e2ejs.py#L481-L495
train
This method will return value of property of element s controller.
neetjn/pyselenium-js
pyseleniumjs/e2ejs.py
E2EJS.ng_set_ctrl_property
def ng_set_ctrl_property(self, element, prop, value): """ :Description: Will set value of property of element's controller. :Warning: This will only work for angular.js 1.x. :Warning: Requires angular debugging to be enabled. :param element: Element for browser instance to target...
python
def ng_set_ctrl_property(self, element, prop, value): """ :Description: Will set value of property of element's controller. :Warning: This will only work for angular.js 1.x. :Warning: Requires angular debugging to be enabled. :param element: Element for browser instance to target...
[ "def", "ng_set_ctrl_property", "(", "self", ",", "element", ",", "prop", ",", "value", ")", ":", "self", ".", "browser", ".", "execute_script", "(", "'angular.element(arguments[0]).controller()%s = %s;'", "%", "(", "self", ".", "__d2b_notation", "(", "prop", "=", ...
:Description: Will set value of property of element's controller. :Warning: This will only work for angular.js 1.x. :Warning: Requires angular debugging to be enabled. :param element: Element for browser instance to target. :type element: WebElement :param prop: Property of eleme...
[ ":", "Description", ":", "Will", "set", "value", "of", "property", "of", "element", "s", "controller", ".", ":", "Warning", ":", "This", "will", "only", "work", "for", "angular", ".", "js", "1", ".", "x", ".", ":", "Warning", ":", "Requires", "angular"...
fe81edcaf9ed76b0ef748c42a51ccacd985d400a
https://github.com/neetjn/pyselenium-js/blob/fe81edcaf9ed76b0ef748c42a51ccacd985d400a/pyseleniumjs/e2ejs.py#L497-L513
train
This will set value of controller property of element.
neetjn/pyselenium-js
pyseleniumjs/e2ejs.py
E2EJS.ng_call_ctrl_function
def ng_call_ctrl_function(self, element, func, params='', return_out=False): """ :Description: Will execute controller function with provided parameters. :Warning: This will only work for angular.js 1.x. :Warning: Requires angular debugging to be enabled. :param element: Element ...
python
def ng_call_ctrl_function(self, element, func, params='', return_out=False): """ :Description: Will execute controller function with provided parameters. :Warning: This will only work for angular.js 1.x. :Warning: Requires angular debugging to be enabled. :param element: Element ...
[ "def", "ng_call_ctrl_function", "(", "self", ",", "element", ",", "func", ",", "params", "=", "''", ",", "return_out", "=", "False", ")", ":", "if", "isinstance", "(", "params", ",", "string_types", ")", ":", "param_str", "=", "params", "elif", "isinstance...
:Description: Will execute controller function with provided parameters. :Warning: This will only work for angular.js 1.x. :Warning: Requires angular debugging to be enabled. :param element: Element for browser instance to target. :param func: Function to execute from angular element con...
[ ":", "Description", ":", "Will", "execute", "controller", "function", "with", "provided", "parameters", ".", ":", "Warning", ":", "This", "will", "only", "work", "for", "angular", ".", "js", "1", ".", "x", ".", ":", "Warning", ":", "Requires", "angular", ...
fe81edcaf9ed76b0ef748c42a51ccacd985d400a
https://github.com/neetjn/pyselenium-js/blob/fe81edcaf9ed76b0ef748c42a51ccacd985d400a/pyseleniumjs/e2ejs.py#L515-L539
train
This will execute a controller function with provided parameters.
neetjn/pyselenium-js
pyseleniumjs/e2ejs.py
E2EJS.ng2_get_component_property
def ng2_get_component_property(self, element, prop): """ :Description: Will get value of property of element's component instance. :Warning: This will only work for Angular components. :param element: Element for browser instance to target. :type element: WebElement :para...
python
def ng2_get_component_property(self, element, prop): """ :Description: Will get value of property of element's component instance. :Warning: This will only work for Angular components. :param element: Element for browser instance to target. :type element: WebElement :para...
[ "def", "ng2_get_component_property", "(", "self", ",", "element", ",", "prop", ")", ":", "return", "self", ".", "browser", ".", "execute_script", "(", "'return ng.probe(arguments[0]).componentInstance%s;'", "%", "self", ".", "__d2b_notation", "(", "prop", "=", "prop...
:Description: Will get value of property of element's component instance. :Warning: This will only work for Angular components. :param element: Element for browser instance to target. :type element: WebElement :param prop: Property of element's component to target. :type prop: st...
[ ":", "Description", ":", "Will", "get", "value", "of", "property", "of", "element", "s", "component", "instance", ".", ":", "Warning", ":", "This", "will", "only", "work", "for", "Angular", "components", ".", ":", "param", "element", ":", "Element", "for",...
fe81edcaf9ed76b0ef748c42a51ccacd985d400a
https://github.com/neetjn/pyselenium-js/blob/fe81edcaf9ed76b0ef748c42a51ccacd985d400a/pyseleniumjs/e2ejs.py#L541-L554
train
This method will get value of property of element s component instance.
brutus/wdiffhtml
tasks/__init__.py
change_dir
def change_dir(directory): """ Wraps a function to run in a given directory. """ def cd_decorator(func): @wraps(func) def wrapper(*args, **kwargs): org_path = os.getcwd() os.chdir(directory) func(*args, **kwargs) os.chdir(org_path) return wrapper return cd_decorator
python
def change_dir(directory): """ Wraps a function to run in a given directory. """ def cd_decorator(func): @wraps(func) def wrapper(*args, **kwargs): org_path = os.getcwd() os.chdir(directory) func(*args, **kwargs) os.chdir(org_path) return wrapper return cd_decorator
[ "def", "change_dir", "(", "directory", ")", ":", "def", "cd_decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "org_path", "=", "os", ".", "getcwd", "(", ")", ...
Wraps a function to run in a given directory.
[ "Wraps", "a", "function", "to", "run", "in", "a", "given", "directory", "." ]
e97b524a7945f7a626e33ec141343120c524d9fa
https://github.com/brutus/wdiffhtml/blob/e97b524a7945f7a626e33ec141343120c524d9fa/tasks/__init__.py#L27-L40
train
Decorator to change the working directory of a function.
brutus/wdiffhtml
tasks/__init__.py
build_css
def build_css(minimize=True): """ Builds CSS from SASS. """ print('Build CSS') args = {} args['style'] = 'compressed' if minimize else 'nested' cmd = CMD_SASS.format(**args) run(cmd)
python
def build_css(minimize=True): """ Builds CSS from SASS. """ print('Build CSS') args = {} args['style'] = 'compressed' if minimize else 'nested' cmd = CMD_SASS.format(**args) run(cmd)
[ "def", "build_css", "(", "minimize", "=", "True", ")", ":", "print", "(", "'Build CSS'", ")", "args", "=", "{", "}", "args", "[", "'style'", "]", "=", "'compressed'", "if", "minimize", "else", "'nested'", "cmd", "=", "CMD_SASS", ".", "format", "(", "*"...
Builds CSS from SASS.
[ "Builds", "CSS", "from", "SASS", "." ]
e97b524a7945f7a626e33ec141343120c524d9fa
https://github.com/brutus/wdiffhtml/blob/e97b524a7945f7a626e33ec141343120c524d9fa/tasks/__init__.py#L45-L54
train
Builds CSS from SASS.
mojaie/chorus
chorus/util/debug.py
profile
def profile(func): """ Decorator Execute cProfile """ def _f(*args, **kwargs): print("\n<<<---") pr = cProfile.Profile() pr.enable() res = func(*args, **kwargs) p = pstats.Stats(pr) p.strip_dirs().sort_stats('cumtime').print_stats(20) print("\n--->...
python
def profile(func): """ Decorator Execute cProfile """ def _f(*args, **kwargs): print("\n<<<---") pr = cProfile.Profile() pr.enable() res = func(*args, **kwargs) p = pstats.Stats(pr) p.strip_dirs().sort_stats('cumtime').print_stats(20) print("\n--->...
[ "def", "profile", "(", "func", ")", ":", "def", "_f", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "print", "(", "\"\\n<<<---\"", ")", "pr", "=", "cProfile", ".", "Profile", "(", ")", "pr", ".", "enable", "(", ")", "res", "=", "func", "...
Decorator Execute cProfile
[ "Decorator", "Execute", "cProfile" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/util/debug.py#L17-L30
train
Decorator for cProfile. Profile
mojaie/chorus
chorus/util/debug.py
total_size
def total_size(obj, verbose=False): """ Returns approximate memory size""" seen = set() def sizeof(o): if id(o) in seen: return 0 seen.add(id(o)) s = sys.getsizeof(o, default=0) if verbose: print(s, type(o), repr(o)) if isinstance(o, (tuple, l...
python
def total_size(obj, verbose=False): """ Returns approximate memory size""" seen = set() def sizeof(o): if id(o) in seen: return 0 seen.add(id(o)) s = sys.getsizeof(o, default=0) if verbose: print(s, type(o), repr(o)) if isinstance(o, (tuple, l...
[ "def", "total_size", "(", "obj", ",", "verbose", "=", "False", ")", ":", "seen", "=", "set", "(", ")", "def", "sizeof", "(", "o", ")", ":", "if", "id", "(", "o", ")", "in", "seen", ":", "return", "0", "seen", ".", "add", "(", "id", "(", "o", ...
Returns approximate memory size
[ "Returns", "approximate", "memory", "size" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/util/debug.py#L33-L52
train
Returns approximate memory size of an object.
mojaie/chorus
chorus/util/debug.py
malloc
def malloc(func): """ Decorator Execute tracemalloc """ def _f(*args, **kwargs): print("\n<<<---") tracemalloc.start() res = func(*args, **kwargs) snapshot = tracemalloc.take_snapshot() top_stats = snapshot.statistics('lineno') print("[ Top 10 ]") ...
python
def malloc(func): """ Decorator Execute tracemalloc """ def _f(*args, **kwargs): print("\n<<<---") tracemalloc.start() res = func(*args, **kwargs) snapshot = tracemalloc.take_snapshot() top_stats = snapshot.statistics('lineno') print("[ Top 10 ]") ...
[ "def", "malloc", "(", "func", ")", ":", "def", "_f", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "print", "(", "\"\\n<<<---\"", ")", "tracemalloc", ".", "start", "(", ")", "res", "=", "func", "(", "*", "args", ",", "*", "*", "kwargs", ...
Decorator Execute tracemalloc
[ "Decorator", "Execute", "tracemalloc" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/util/debug.py#L55-L75
train
Decorator for tracing malloc.
mojaie/chorus
chorus/util/debug.py
malloc_diff
def malloc_diff(func): """ Decorator Execute tracemalloc """ def _f(*args, **kwargs): print("\n<<<---") tracemalloc.start() snapshot1 = tracemalloc.take_snapshot() res = func(*args, **kwargs) snapshot2 = tracemalloc.take_snapshot() top_stats = snapshot2.co...
python
def malloc_diff(func): """ Decorator Execute tracemalloc """ def _f(*args, **kwargs): print("\n<<<---") tracemalloc.start() snapshot1 = tracemalloc.take_snapshot() res = func(*args, **kwargs) snapshot2 = tracemalloc.take_snapshot() top_stats = snapshot2.co...
[ "def", "malloc_diff", "(", "func", ")", ":", "def", "_f", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "print", "(", "\"\\n<<<---\"", ")", "tracemalloc", ".", "start", "(", ")", "snapshot1", "=", "tracemalloc", ".", "take_snapshot", "(", ")", ...
Decorator Execute tracemalloc
[ "Decorator", "Execute", "tracemalloc" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/util/debug.py#L78-L94
train
Decorator for tracing malloc functions that returns the result of the wrapped function.
mojaie/chorus
chorus/util/debug.py
mute
def mute(func): """ Decorator Make stdout silent """ def _f(*args, **kwargs): sys.stdout = open(os.devnull, 'w') res = func(*args, **kwargs) sys.stdout.close() sys.stdout = sys.__stdout__ return res return _f
python
def mute(func): """ Decorator Make stdout silent """ def _f(*args, **kwargs): sys.stdout = open(os.devnull, 'w') res = func(*args, **kwargs) sys.stdout.close() sys.stdout = sys.__stdout__ return res return _f
[ "def", "mute", "(", "func", ")", ":", "def", "_f", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "sys", ".", "stdout", "=", "open", "(", "os", ".", "devnull", ",", "'w'", ")", "res", "=", "func", "(", "*", "args", ",", "*", "*", "kwa...
Decorator Make stdout silent
[ "Decorator", "Make", "stdout", "silent" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/util/debug.py#L97-L107
train
Decorator for mute stdout
mastro35/flows
flows/Actions/InputReadFileAction.py
ReadFileAction.try_opening_file
def try_opening_file(self): '''Try to open the input file''' if os.path.isfile(self.path): self.file = open(self.path, 'r') self.file_is_opened = True
python
def try_opening_file(self): '''Try to open the input file''' if os.path.isfile(self.path): self.file = open(self.path, 'r') self.file_is_opened = True
[ "def", "try_opening_file", "(", "self", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "self", ".", "path", ")", ":", "self", ".", "file", "=", "open", "(", "self", ".", "path", ",", "'r'", ")", "self", ".", "file_is_opened", "=", "True" ]
Try to open the input file
[ "Try", "to", "open", "the", "input", "file" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/InputReadFileAction.py#L33-L37
train
Try to open the input file if it is not already opened.
lsst-sqre/documenteer
documenteer/sphinxconfig/stackconf.py
_insert_html_configs
def _insert_html_configs(c, *, project_name, short_project_name): """Insert HTML theme configurations. """ # Use the lsst-sphinx-bootstrap-theme c['templates_path'] = [ '_templates', lsst_sphinx_bootstrap_theme.get_html_templates_path()] c['html_theme'] = 'lsst_sphinx_bootstrap_theme...
python
def _insert_html_configs(c, *, project_name, short_project_name): """Insert HTML theme configurations. """ # Use the lsst-sphinx-bootstrap-theme c['templates_path'] = [ '_templates', lsst_sphinx_bootstrap_theme.get_html_templates_path()] c['html_theme'] = 'lsst_sphinx_bootstrap_theme...
[ "def", "_insert_html_configs", "(", "c", ",", "*", ",", "project_name", ",", "short_project_name", ")", ":", "# Use the lsst-sphinx-bootstrap-theme", "c", "[", "'templates_path'", "]", "=", "[", "'_templates'", ",", "lsst_sphinx_bootstrap_theme", ".", "get_html_template...
Insert HTML theme configurations.
[ "Insert", "HTML", "theme", "configurations", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/stackconf.py#L71-L167
train
Insert HTML theme configurations.
lsst-sqre/documenteer
documenteer/sphinxconfig/stackconf.py
_insert_common_sphinx_configs
def _insert_common_sphinx_configs(c, *, project_name): """Add common core Sphinx configurations to the state. """ c['project'] = project_name # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: c['source_suffix'] = '.rst' # The encoding of source fi...
python
def _insert_common_sphinx_configs(c, *, project_name): """Add common core Sphinx configurations to the state. """ c['project'] = project_name # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: c['source_suffix'] = '.rst' # The encoding of source fi...
[ "def", "_insert_common_sphinx_configs", "(", "c", ",", "*", ",", "project_name", ")", ":", "c", "[", "'project'", "]", "=", "project_name", "# The suffix(es) of source filenames.", "# You can specify multiple suffix as a list of string:", "c", "[", "'source_suffix'", "]", ...
Add common core Sphinx configurations to the state.
[ "Add", "common", "core", "Sphinx", "configurations", "to", "the", "state", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/stackconf.py#L170-L208
train
Add common Sphinx configurations to the state.
lsst-sqre/documenteer
documenteer/sphinxconfig/stackconf.py
_insert_breathe_configs
def _insert_breathe_configs(c, *, project_name, doxygen_xml_dirname): """Add breathe extension configurations to the state. """ if doxygen_xml_dirname is not None: c['breathe_projects'] = {project_name: doxygen_xml_dirname} c['breathe_default_project'] = project_name return c
python
def _insert_breathe_configs(c, *, project_name, doxygen_xml_dirname): """Add breathe extension configurations to the state. """ if doxygen_xml_dirname is not None: c['breathe_projects'] = {project_name: doxygen_xml_dirname} c['breathe_default_project'] = project_name return c
[ "def", "_insert_breathe_configs", "(", "c", ",", "*", ",", "project_name", ",", "doxygen_xml_dirname", ")", ":", "if", "doxygen_xml_dirname", "is", "not", "None", ":", "c", "[", "'breathe_projects'", "]", "=", "{", "project_name", ":", "doxygen_xml_dirname", "}"...
Add breathe extension configurations to the state.
[ "Add", "breathe", "extension", "configurations", "to", "the", "state", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/stackconf.py#L211-L217
train
Insert breathe extension configurations into the state.
lsst-sqre/documenteer
documenteer/sphinxconfig/stackconf.py
_insert_automodapi_configs
def _insert_automodapi_configs(c): """Add configurations related to automodapi, autodoc, and numpydoc to the state. """ # Don't show summaries of the members in each class along with the # class' docstring c['numpydoc_show_class_members'] = False c['autosummary_generate'] = True c['aut...
python
def _insert_automodapi_configs(c): """Add configurations related to automodapi, autodoc, and numpydoc to the state. """ # Don't show summaries of the members in each class along with the # class' docstring c['numpydoc_show_class_members'] = False c['autosummary_generate'] = True c['aut...
[ "def", "_insert_automodapi_configs", "(", "c", ")", ":", "# Don't show summaries of the members in each class along with the", "# class' docstring", "c", "[", "'numpydoc_show_class_members'", "]", "=", "False", "c", "[", "'autosummary_generate'", "]", "=", "True", "c", "[",...
Add configurations related to automodapi, autodoc, and numpydoc to the state.
[ "Add", "configurations", "related", "to", "automodapi", "autodoc", "and", "numpydoc", "to", "the", "state", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/stackconf.py#L220-L254
train
Insert configuration related to automodapi autodoc numpydoc.
lsst-sqre/documenteer
documenteer/sphinxconfig/stackconf.py
_insert_matplotlib_configs
def _insert_matplotlib_configs(c): """Add configurations related to matplotlib's plot directive to the state. """ if 'extensions' not in c: c['extensions'] = [] try: import matplotlib.sphinxext.plot_directive c['extensions'] += [matplotlib.sphinxext.plot_directive.__name__] ...
python
def _insert_matplotlib_configs(c): """Add configurations related to matplotlib's plot directive to the state. """ if 'extensions' not in c: c['extensions'] = [] try: import matplotlib.sphinxext.plot_directive c['extensions'] += [matplotlib.sphinxext.plot_directive.__name__] ...
[ "def", "_insert_matplotlib_configs", "(", "c", ")", ":", "if", "'extensions'", "not", "in", "c", ":", "c", "[", "'extensions'", "]", "=", "[", "]", "try", ":", "import", "matplotlib", ".", "sphinxext", ".", "plot_directive", "c", "[", "'extensions'", "]", ...
Add configurations related to matplotlib's plot directive to the state.
[ "Add", "configurations", "related", "to", "matplotlib", "s", "plot", "directive", "to", "the", "state", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/stackconf.py#L257-L274
train
Add configurations related to matplotlib s plot directive to the state.
lsst-sqre/documenteer
documenteer/sphinxconfig/stackconf.py
_insert_single_package_eups_version
def _insert_single_package_eups_version(c, eups_version): """Insert version information into the configuration namespace. Parameters ---------- eups_version The EUPS version string (as opposed to tag). This comes from the ``__version__`` attribute of individual modules and is only set f...
python
def _insert_single_package_eups_version(c, eups_version): """Insert version information into the configuration namespace. Parameters ---------- eups_version The EUPS version string (as opposed to tag). This comes from the ``__version__`` attribute of individual modules and is only set f...
[ "def", "_insert_single_package_eups_version", "(", "c", ",", "eups_version", ")", ":", "c", "[", "'release_eups_tag'", "]", "=", "'current'", "c", "[", "'release_git_ref'", "]", "=", "'master'", "c", "[", "'version'", "]", "=", "eups_version", "c", "[", "'rele...
Insert version information into the configuration namespace. Parameters ---------- eups_version The EUPS version string (as opposed to tag). This comes from the ``__version__`` attribute of individual modules and is only set for single package documentation builds that use the ...
[ "Insert", "version", "information", "into", "the", "configuration", "namespace", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/stackconf.py#L298-L333
train
Insert version information into the configuration namespace.
lsst-sqre/documenteer
documenteer/sphinxconfig/stackconf.py
_insert_eups_version
def _insert_eups_version(c): """Insert information about the current EUPS tag into the configuration namespace. The variables are: ``release_eups_tag`` The EUPS tag (obtained from the ``EUPS_TAG`` environment variable, falling back to ``d_latest`` if not available). ``version``, ``...
python
def _insert_eups_version(c): """Insert information about the current EUPS tag into the configuration namespace. The variables are: ``release_eups_tag`` The EUPS tag (obtained from the ``EUPS_TAG`` environment variable, falling back to ``d_latest`` if not available). ``version``, ``...
[ "def", "_insert_eups_version", "(", "c", ")", ":", "# Attempt to get the eups tag from the build environment", "eups_tag", "=", "os", ".", "getenv", "(", "'EUPS_TAG'", ")", "if", "eups_tag", "is", "None", ":", "eups_tag", "=", "'d_latest'", "# Try to guess the git ref t...
Insert information about the current EUPS tag into the configuration namespace. The variables are: ``release_eups_tag`` The EUPS tag (obtained from the ``EUPS_TAG`` environment variable, falling back to ``d_latest`` if not available). ``version``, ``release`` Same as ``release_...
[ "Insert", "information", "about", "the", "current", "EUPS", "tag", "into", "the", "configuration", "namespace", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/stackconf.py#L336-L386
train
Insert information about the current EUPS tag into the configuration namespace.
lsst-sqre/documenteer
documenteer/sphinxconfig/stackconf.py
build_package_configs
def build_package_configs(project_name, version=None, copyright=None, doxygen_xml_dirname=None): """Builds a `dict` of Sphinx configurations useful for the ``doc/conf.py`` files of individual LSST Stack packages. The ``doc/conf.p...
python
def build_package_configs(project_name, version=None, copyright=None, doxygen_xml_dirname=None): """Builds a `dict` of Sphinx configurations useful for the ``doc/conf.py`` files of individual LSST Stack packages. The ``doc/conf.p...
[ "def", "build_package_configs", "(", "project_name", ",", "version", "=", "None", ",", "copyright", "=", "None", ",", "doxygen_xml_dirname", "=", "None", ")", ":", "c", "=", "{", "}", "c", "=", "_insert_common_sphinx_configs", "(", "c", ",", "project_name", ...
Builds a `dict` of Sphinx configurations useful for the ``doc/conf.py`` files of individual LSST Stack packages. The ``doc/conf.py`` of packages can ingest these configurations via:: from documenteer.sphinxconfig.stackconf import build_package_configs _g = globals() _g.update(build_packa...
[ "Builds", "a", "dict", "of", "Sphinx", "configurations", "useful", "for", "the", "doc", "/", "conf", ".", "py", "files", "of", "individual", "LSST", "Stack", "packages", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/stackconf.py#L416-L530
train
Builds a dict of Sphinx configuration files useful for the documentation of the LSST Stack packages.
lsst-sqre/documenteer
documenteer/sphinxconfig/stackconf.py
build_pipelines_lsst_io_configs
def build_pipelines_lsst_io_configs(*, project_name, copyright=None): """Build a `dict` of Sphinx configurations that populate the ``conf.py`` of the main pipelines_lsst_io Sphinx project for LSST Science Pipelines documentation. The ``conf.py`` file can ingest these configurations via:: from d...
python
def build_pipelines_lsst_io_configs(*, project_name, copyright=None): """Build a `dict` of Sphinx configurations that populate the ``conf.py`` of the main pipelines_lsst_io Sphinx project for LSST Science Pipelines documentation. The ``conf.py`` file can ingest these configurations via:: from d...
[ "def", "build_pipelines_lsst_io_configs", "(", "*", ",", "project_name", ",", "copyright", "=", "None", ")", ":", "# Work around Sphinx bug related to large and highly-nested source files", "sys", ".", "setrecursionlimit", "(", "2000", ")", "c", "=", "{", "}", "c", "=...
Build a `dict` of Sphinx configurations that populate the ``conf.py`` of the main pipelines_lsst_io Sphinx project for LSST Science Pipelines documentation. The ``conf.py`` file can ingest these configurations via:: from documenteer.sphinxconfig.stackconf import \ build_pipelines_lsst_io...
[ "Build", "a", "dict", "of", "Sphinx", "configurations", "that", "populate", "the", "conf", ".", "py", "of", "the", "main", "pipelines_lsst_io", "Sphinx", "project", "for", "LSST", "Science", "Pipelines", "documentation", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/stackconf.py#L533-L647
train
Build a dict of Sphinx configurations that populate the conf. py file for LSST Science Pipelines.
klen/muffin-redis
muffin_redis.py
Plugin.setup
def setup(self, app): """Setup the plugin.""" super().setup(app) self.cfg.port = int(self.cfg.port) self.cfg.db = int(self.cfg.db) self.cfg.poolsize = int(self.cfg.poolsize)
python
def setup(self, app): """Setup the plugin.""" super().setup(app) self.cfg.port = int(self.cfg.port) self.cfg.db = int(self.cfg.db) self.cfg.poolsize = int(self.cfg.poolsize)
[ "def", "setup", "(", "self", ",", "app", ")", ":", "super", "(", ")", ".", "setup", "(", "app", ")", "self", ".", "cfg", ".", "port", "=", "int", "(", "self", ".", "cfg", ".", "port", ")", "self", ".", "cfg", ".", "db", "=", "int", "(", "se...
Setup the plugin.
[ "Setup", "the", "plugin", "." ]
b0cb8c1ba1511d501c2084def156710e75aaf781
https://github.com/klen/muffin-redis/blob/b0cb8c1ba1511d501c2084def156710e75aaf781/muffin_redis.py#L49-L54
train
Setup the plugin.
klen/muffin-redis
muffin_redis.py
Plugin.startup
async def startup(self, app): """Connect to Redis.""" if self.cfg.fake: if not FakeConnection: raise PluginException('Install fakeredis for fake connections.') self.conn = await FakeConnection.create() if self.cfg.pubsub: self.pubsub_c...
python
async def startup(self, app): """Connect to Redis.""" if self.cfg.fake: if not FakeConnection: raise PluginException('Install fakeredis for fake connections.') self.conn = await FakeConnection.create() if self.cfg.pubsub: self.pubsub_c...
[ "async", "def", "startup", "(", "self", ",", "app", ")", ":", "if", "self", ".", "cfg", ".", "fake", ":", "if", "not", "FakeConnection", ":", "raise", "PluginException", "(", "'Install fakeredis for fake connections.'", ")", "self", ".", "conn", "=", "await"...
Connect to Redis.
[ "Connect", "to", "Redis", "." ]
b0cb8c1ba1511d501c2084def156710e75aaf781
https://github.com/klen/muffin-redis/blob/b0cb8c1ba1511d501c2084def156710e75aaf781/muffin_redis.py#L56-L92
train
Connect to Redis.
klen/muffin-redis
muffin_redis.py
Plugin.cleanup
async def cleanup(self, app): """Close self connections.""" self.conn.close() if self.pubsub_conn: self.pubsub_reader.cancel() self.pubsub_conn.close() # give connections a chance to actually terminate # TODO: use better method once it will be added, ...
python
async def cleanup(self, app): """Close self connections.""" self.conn.close() if self.pubsub_conn: self.pubsub_reader.cancel() self.pubsub_conn.close() # give connections a chance to actually terminate # TODO: use better method once it will be added, ...
[ "async", "def", "cleanup", "(", "self", ",", "app", ")", ":", "self", ".", "conn", ".", "close", "(", ")", "if", "self", ".", "pubsub_conn", ":", "self", ".", "pubsub_reader", ".", "cancel", "(", ")", "self", ".", "pubsub_conn", ".", "close", "(", ...
Close self connections.
[ "Close", "self", "connections", "." ]
b0cb8c1ba1511d501c2084def156710e75aaf781
https://github.com/klen/muffin-redis/blob/b0cb8c1ba1511d501c2084def156710e75aaf781/muffin_redis.py#L94-L103
train
Close all connections and terminate the connection.
klen/muffin-redis
muffin_redis.py
Plugin.set
def set(self, key, value, *args, **kwargs): """Store the given value into Redis. :returns: a coroutine """ if self.cfg.jsonpickle: value = jsonpickle.encode(value) return self.conn.set(key, value, *args, **kwargs)
python
def set(self, key, value, *args, **kwargs): """Store the given value into Redis. :returns: a coroutine """ if self.cfg.jsonpickle: value = jsonpickle.encode(value) return self.conn.set(key, value, *args, **kwargs)
[ "def", "set", "(", "self", ",", "key", ",", "value", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "cfg", ".", "jsonpickle", ":", "value", "=", "jsonpickle", ".", "encode", "(", "value", ")", "return", "self", ".", "conn...
Store the given value into Redis. :returns: a coroutine
[ "Store", "the", "given", "value", "into", "Redis", "." ]
b0cb8c1ba1511d501c2084def156710e75aaf781
https://github.com/klen/muffin-redis/blob/b0cb8c1ba1511d501c2084def156710e75aaf781/muffin_redis.py#L105-L112
train
Store the given value into Redis.
klen/muffin-redis
muffin_redis.py
Plugin.get
async def get(self, key): """Decode the value.""" value = await self.conn.get(key) if self.cfg.jsonpickle: if isinstance(value, bytes): return jsonpickle.decode(value.decode('utf-8')) if isinstance(value, str): return jsonpickle.decode(val...
python
async def get(self, key): """Decode the value.""" value = await self.conn.get(key) if self.cfg.jsonpickle: if isinstance(value, bytes): return jsonpickle.decode(value.decode('utf-8')) if isinstance(value, str): return jsonpickle.decode(val...
[ "async", "def", "get", "(", "self", ",", "key", ")", ":", "value", "=", "await", "self", ".", "conn", ".", "get", "(", "key", ")", "if", "self", ".", "cfg", ".", "jsonpickle", ":", "if", "isinstance", "(", "value", ",", "bytes", ")", ":", "return...
Decode the value.
[ "Decode", "the", "value", "." ]
b0cb8c1ba1511d501c2084def156710e75aaf781
https://github.com/klen/muffin-redis/blob/b0cb8c1ba1511d501c2084def156710e75aaf781/muffin_redis.py#L114-L124
train
Decode the value.