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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
wesleybeckner/salty | salty/core.py | merge_duplicates | def merge_duplicates(model_name, keep_descriptors=False):
"""
Identifies repeated experimental values and returns mean values for those
data along with their standard deviation. Only aggregates experimental
values that have been acquired at the same temperature and pressure.
Parameters
--------... | python | def merge_duplicates(model_name, keep_descriptors=False):
"""
Identifies repeated experimental values and returns mean values for those
data along with their standard deviation. Only aggregates experimental
values that have been acquired at the same temperature and pressure.
Parameters
--------... | [
"def",
"merge_duplicates",
"(",
"model_name",
",",
"keep_descriptors",
"=",
"False",
")",
":",
"model_outputs",
"=",
"-",
"6",
"+",
"model_name",
".",
"Data_summary",
".",
"shape",
"[",
"0",
"]",
"devmodel",
"=",
"model_name",
"cols",
"=",
"devmodel",
".",
... | Identifies repeated experimental values and returns mean values for those
data along with their standard deviation. Only aggregates experimental
values that have been acquired at the same temperature and pressure.
Parameters
----------
model_name: dev_model
the dev_model object to be interr... | [
"Identifies",
"repeated",
"experimental",
"values",
"and",
"returns",
"mean",
"values",
"for",
"those",
"data",
"along",
"with",
"their",
"standard",
"deviation",
".",
"Only",
"aggregates",
"experimental",
"values",
"that",
"have",
"been",
"acquired",
"at",
"the",... | ef17a97aea3e4f81fcd0359ce85b3438c0e6499b | https://github.com/wesleybeckner/salty/blob/ef17a97aea3e4f81fcd0359ce85b3438c0e6499b/salty/core.py#L85-L159 | train | This function merges the repeated experimental values and returns mean values along with their standard deviation. |
wesleybeckner/salty | salty/core.py | devmodel_to_array | def devmodel_to_array(model_name, train_fraction=1):
"""
a standardized method of turning a dev_model object into training and
testing arrays
Parameters
----------
model_name: dev_model
the dev_model object to be interrogated
train_fraction: int
the fraction to be reserved f... | python | def devmodel_to_array(model_name, train_fraction=1):
"""
a standardized method of turning a dev_model object into training and
testing arrays
Parameters
----------
model_name: dev_model
the dev_model object to be interrogated
train_fraction: int
the fraction to be reserved f... | [
"def",
"devmodel_to_array",
"(",
"model_name",
",",
"train_fraction",
"=",
"1",
")",
":",
"model_outputs",
"=",
"-",
"6",
"+",
"model_name",
".",
"Data_summary",
".",
"shape",
"[",
"0",
"]",
"devmodel",
"=",
"model_name",
"rawdf",
"=",
"devmodel",
".",
"Da... | a standardized method of turning a dev_model object into training and
testing arrays
Parameters
----------
model_name: dev_model
the dev_model object to be interrogated
train_fraction: int
the fraction to be reserved for training
Returns
----------
X_train: array
... | [
"a",
"standardized",
"method",
"of",
"turning",
"a",
"dev_model",
"object",
"into",
"training",
"and",
"testing",
"arrays"
] | ef17a97aea3e4f81fcd0359ce85b3438c0e6499b | https://github.com/wesleybeckner/salty/blob/ef17a97aea3e4f81fcd0359ce85b3438c0e6499b/salty/core.py#L162-L207 | train | This function converts a dev_model object into training and testing arrays. |
wesleybeckner/salty | salty/core.py | aggregate_data | def aggregate_data(data, T=[0, inf], P=[0, inf], data_ranges=None,
merge="overlap", feature_type=None, impute=False,
scale_center=True):
"""
Aggregates molecular data for model training
Parameters
----------
data: list
density, cpt, and/or viscosity
... | python | def aggregate_data(data, T=[0, inf], P=[0, inf], data_ranges=None,
merge="overlap", feature_type=None, impute=False,
scale_center=True):
"""
Aggregates molecular data for model training
Parameters
----------
data: list
density, cpt, and/or viscosity
... | [
"def",
"aggregate_data",
"(",
"data",
",",
"T",
"=",
"[",
"0",
",",
"inf",
"]",
",",
"P",
"=",
"[",
"0",
",",
"inf",
"]",
",",
"data_ranges",
"=",
"None",
",",
"merge",
"=",
"\"overlap\"",
",",
"feature_type",
"=",
"None",
",",
"impute",
"=",
"Fa... | Aggregates molecular data for model training
Parameters
----------
data: list
density, cpt, and/or viscosity
T: array
desired min and max of temperature distribution
P: array
desired min and max of pressure distribution
data_ranges: array
desired min and max of p... | [
"Aggregates",
"molecular",
"data",
"for",
"model",
"training"
] | ef17a97aea3e4f81fcd0359ce85b3438c0e6499b | https://github.com/wesleybeckner/salty/blob/ef17a97aea3e4f81fcd0359ce85b3438c0e6499b/salty/core.py#L210-L302 | train | Aggregates molecular data for a single model training and a single model training and a single model training and a single model training and a single model training and a single model training. |
wesleybeckner/salty | salty/core.py | check_name | def check_name(user_query, index=False):
"""
checkName uses a database to return either SMILES or IUPAC
names of cations/anions.
Default behavior is to return the SMILES encoding of an ion given
the ion name as input.
Parameters
------------------
user_query : str
string that w... | python | def check_name(user_query, index=False):
"""
checkName uses a database to return either SMILES or IUPAC
names of cations/anions.
Default behavior is to return the SMILES encoding of an ion given
the ion name as input.
Parameters
------------------
user_query : str
string that w... | [
"def",
"check_name",
"(",
"user_query",
",",
"index",
"=",
"False",
")",
":",
"df_cation",
"=",
"load_data",
"(",
"\"cationInfo.csv\"",
")",
"df_anion",
"=",
"load_data",
"(",
"\"anionInfo.csv\"",
")",
"def",
"_look_up_info_file",
"(",
"df",
")",
":",
"target_... | checkName uses a database to return either SMILES or IUPAC
names of cations/anions.
Default behavior is to return the SMILES encoding of an ion given
the ion name as input.
Parameters
------------------
user_query : str
string that will be used to query the database.
Returns
-... | [
"checkName",
"uses",
"a",
"database",
"to",
"return",
"either",
"SMILES",
"or",
"IUPAC",
"names",
"of",
"cations",
"/",
"anions",
"."
] | ef17a97aea3e4f81fcd0359ce85b3438c0e6499b | https://github.com/wesleybeckner/salty/blob/ef17a97aea3e4f81fcd0359ce85b3438c0e6499b/salty/core.py#L305-L352 | train | This function checks the name of a cation or anion in the cationInfo. csv file and returns either the SMILES encoding of an ion or IUPAC
names of cations or anions. |
wesleybeckner/salty | salty/core.py | load_data | def load_data(data_file_name, dillFile=False):
"""Loads data from module_path/data/data_file_name.
Parameters
----------
data_file_name : String. Name of csv or dill file to be loaded from
module_path/data/data_file_name. For example 'salt_info.csv'.
Returns
-------
data : Pandas DataFra... | python | def load_data(data_file_name, dillFile=False):
"""Loads data from module_path/data/data_file_name.
Parameters
----------
data_file_name : String. Name of csv or dill file to be loaded from
module_path/data/data_file_name. For example 'salt_info.csv'.
Returns
-------
data : Pandas DataFra... | [
"def",
"load_data",
"(",
"data_file_name",
",",
"dillFile",
"=",
"False",
")",
":",
"module_path",
"=",
"dirname",
"(",
"__file__",
")",
"if",
"dillFile",
":",
"with",
"open",
"(",
"join",
"(",
"module_path",
",",
"'data'",
",",
"data_file_name",
")",
",",... | Loads data from module_path/data/data_file_name.
Parameters
----------
data_file_name : String. Name of csv or dill file to be loaded from
module_path/data/data_file_name. For example 'salt_info.csv'.
Returns
-------
data : Pandas DataFrame
A data frame. For example with each row rep... | [
"Loads",
"data",
"from",
"module_path",
"/",
"data",
"/",
"data_file_name",
".",
"Parameters",
"----------",
"data_file_name",
":",
"String",
".",
"Name",
"of",
"csv",
"or",
"dill",
"file",
"to",
"be",
"loaded",
"from",
"module_path",
"/",
"data",
"/",
"data... | ef17a97aea3e4f81fcd0359ce85b3438c0e6499b | https://github.com/wesleybeckner/salty/blob/ef17a97aea3e4f81fcd0359ce85b3438c0e6499b/salty/core.py#L355-L376 | train | Loads data from a file in the data directory. |
potash/drain | drain/exploration.py | expand | def expand(self, prefix=False, index=True, diff=True, existence=True):
"""
This function is a member of StepFrame and StepSeries. It is used to
expand the kwargs of the steps either into the index (index=True) or
as columns (index=False). By default (diff=True) only the kwargs which
differ among ste... | python | def expand(self, prefix=False, index=True, diff=True, existence=True):
"""
This function is a member of StepFrame and StepSeries. It is used to
expand the kwargs of the steps either into the index (index=True) or
as columns (index=False). By default (diff=True) only the kwargs which
differ among ste... | [
"def",
"expand",
"(",
"self",
",",
"prefix",
"=",
"False",
",",
"index",
"=",
"True",
",",
"diff",
"=",
"True",
",",
"existence",
"=",
"True",
")",
":",
"# collect kwargs resulting in a list of {name: kwargs} dicts",
"dicts",
"=",
"[",
"step",
".",
"_collect_k... | This function is a member of StepFrame and StepSeries. It is used to
expand the kwargs of the steps either into the index (index=True) or
as columns (index=False). By default (diff=True) only the kwargs which
differ among steps are expanded.
Note that index objects in pandas must be hashable so any unh... | [
"This",
"function",
"is",
"a",
"member",
"of",
"StepFrame",
"and",
"StepSeries",
".",
"It",
"is",
"used",
"to",
"expand",
"the",
"kwargs",
"of",
"the",
"steps",
"either",
"into",
"the",
"index",
"(",
"index",
"=",
"True",
")",
"or",
"as",
"columns",
"(... | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/exploration.py#L17-L122 | train | This function expands the kwargs of the steps into a DatFrame. |
potash/drain | drain/exploration.py | dapply | def dapply(self, fn, pairwise=False, symmetric=True, diagonal=False, block=None, **kwargs):
"""
Apply function to each step object in the index
Args:
fn: function to apply. If a list then each function is applied
pairwise: whether to apply the function to pairs of steps
symmetric, d... | python | def dapply(self, fn, pairwise=False, symmetric=True, diagonal=False, block=None, **kwargs):
"""
Apply function to each step object in the index
Args:
fn: function to apply. If a list then each function is applied
pairwise: whether to apply the function to pairs of steps
symmetric, d... | [
"def",
"dapply",
"(",
"self",
",",
"fn",
",",
"pairwise",
"=",
"False",
",",
"symmetric",
"=",
"True",
",",
"diagonal",
"=",
"False",
",",
"block",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"search_keys",
"=",
"[",
"k",
"for",
"k",
",",
"v"... | Apply function to each step object in the index
Args:
fn: function to apply. If a list then each function is applied
pairwise: whether to apply the function to pairs of steps
symmetric, diagonal, block: passed to apply_pairwise when pairwise=True
kwargs: a keyword arguments to pass ... | [
"Apply",
"function",
"to",
"each",
"step",
"object",
"in",
"the",
"index"
] | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/exploration.py#L125-L177 | train | Apply a function to each step object in the index. |
potash/drain | drain/exploration.py | apply_pairwise | def apply_pairwise(self, function, symmetric=True, diagonal=False, block=None, **kwargs):
"""
Helper function for pairwise apply.
Args:
steps: an ordered collection of steps
function: function to apply, first two positional arguments are steps
symmetric: whether function is symmetric... | python | def apply_pairwise(self, function, symmetric=True, diagonal=False, block=None, **kwargs):
"""
Helper function for pairwise apply.
Args:
steps: an ordered collection of steps
function: function to apply, first two positional arguments are steps
symmetric: whether function is symmetric... | [
"def",
"apply_pairwise",
"(",
"self",
",",
"function",
",",
"symmetric",
"=",
"True",
",",
"diagonal",
"=",
"False",
",",
"block",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"steps",
"=",
"self",
".",
"index",
"r",
"=",
"pd",
".",
"DataFrame",
... | Helper function for pairwise apply.
Args:
steps: an ordered collection of steps
function: function to apply, first two positional arguments are steps
symmetric: whether function is symmetric in the two steps
diagonal: whether to apply on the diagonal
block: apply only when th... | [
"Helper",
"function",
"for",
"pairwise",
"apply",
".",
"Args",
":",
"steps",
":",
"an",
"ordered",
"collection",
"of",
"steps",
"function",
":",
"function",
"to",
"apply",
"first",
"two",
"positional",
"arguments",
"are",
"steps",
"symmetric",
":",
"whether",
... | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/exploration.py#L180-L208 | train | Helper function for pairwise apply. |
potash/drain | drain/exploration.py | _print_unhashable | def _print_unhashable(df, columns=None):
"""
Replace unhashable values in a DataFrame with their string repr
Args:
df: DataFrame
columns: columns to replace, if necessary. Default None replaces all columns.
"""
for c in df.columns if columns is None else columns:
if df.dtypes... | python | def _print_unhashable(df, columns=None):
"""
Replace unhashable values in a DataFrame with their string repr
Args:
df: DataFrame
columns: columns to replace, if necessary. Default None replaces all columns.
"""
for c in df.columns if columns is None else columns:
if df.dtypes... | [
"def",
"_print_unhashable",
"(",
"df",
",",
"columns",
"=",
"None",
")",
":",
"for",
"c",
"in",
"df",
".",
"columns",
"if",
"columns",
"is",
"None",
"else",
"columns",
":",
"if",
"df",
".",
"dtypes",
"[",
"c",
"]",
"==",
"object",
":",
"try",
":",
... | Replace unhashable values in a DataFrame with their string repr
Args:
df: DataFrame
columns: columns to replace, if necessary. Default None replaces all columns. | [
"Replace",
"unhashable",
"values",
"in",
"a",
"DataFrame",
"with",
"their",
"string",
"repr",
"Args",
":",
"df",
":",
"DataFrame",
"columns",
":",
"columns",
"to",
"replace",
"if",
"necessary",
".",
"Default",
"None",
"replaces",
"all",
"columns",
"."
] | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/exploration.py#L272-L286 | train | Replace unhashable values in a DataFrame with their string repr
Inviteables |
redhat-cip/python-dciclient | dciclient/v1/shell_commands/tag.py | list | def list(context, verbose):
"""list(context, verbose)
List all tags.
>>> dcictl tag-list
:param boolean verbose: Display verbose output
"""
result = tag.list(context)
utils.format_output(result, context.format, verbose=verbose) | python | def list(context, verbose):
"""list(context, verbose)
List all tags.
>>> dcictl tag-list
:param boolean verbose: Display verbose output
"""
result = tag.list(context)
utils.format_output(result, context.format, verbose=verbose) | [
"def",
"list",
"(",
"context",
",",
"verbose",
")",
":",
"result",
"=",
"tag",
".",
"list",
"(",
"context",
")",
"utils",
".",
"format_output",
"(",
"result",
",",
"context",
".",
"format",
",",
"verbose",
"=",
"verbose",
")"
] | list(context, verbose)
List all tags.
>>> dcictl tag-list
:param boolean verbose: Display verbose output | [
"list",
"(",
"context",
"verbose",
")"
] | a4aa5899062802bbe4c30a075d8447f8d222d214 | https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/tag.py#L29-L39 | train | List all tags. |
redhat-cip/python-dciclient | dciclient/v1/shell_commands/tag.py | create | def create(context, name):
"""create(context, name)
Create a tag.
>>> dcictl tag-create [OPTIONS]
:param string name: Name of the tag [required]
"""
result = tag.create(context, name=name)
utils.format_output(result, context.format) | python | def create(context, name):
"""create(context, name)
Create a tag.
>>> dcictl tag-create [OPTIONS]
:param string name: Name of the tag [required]
"""
result = tag.create(context, name=name)
utils.format_output(result, context.format) | [
"def",
"create",
"(",
"context",
",",
"name",
")",
":",
"result",
"=",
"tag",
".",
"create",
"(",
"context",
",",
"name",
"=",
"name",
")",
"utils",
".",
"format_output",
"(",
"result",
",",
"context",
".",
"format",
")"
] | create(context, name)
Create a tag.
>>> dcictl tag-create [OPTIONS]
:param string name: Name of the tag [required] | [
"create",
"(",
"context",
"name",
")"
] | a4aa5899062802bbe4c30a075d8447f8d222d214 | https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/tag.py#L45-L56 | train | Create a tag.
|
maljovec/topopy | topopy/ContourTree.py | ContourTree.reset | def reset(self):
"""
Empties all internal storage containers
"""
super(ContourTree, self).reset()
self.edges = []
self.augmentedEdges = {}
self.sortedNodes = []
self.branches = set()
self.superNodes = []
self.superArcs = [] | python | def reset(self):
"""
Empties all internal storage containers
"""
super(ContourTree, self).reset()
self.edges = []
self.augmentedEdges = {}
self.sortedNodes = []
self.branches = set()
self.superNodes = []
self.superArcs = [] | [
"def",
"reset",
"(",
"self",
")",
":",
"super",
"(",
"ContourTree",
",",
"self",
")",
".",
"reset",
"(",
")",
"self",
".",
"edges",
"=",
"[",
"]",
"self",
".",
"augmentedEdges",
"=",
"{",
"}",
"self",
".",
"sortedNodes",
"=",
"[",
"]",
"self",
".... | Empties all internal storage containers | [
"Empties",
"all",
"internal",
"storage",
"containers"
] | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/ContourTree.py#L79-L89 | train | Resets internal storage containers to empty state. |
maljovec/topopy | topopy/ContourTree.py | ContourTree.build | def build(self, X, Y, w=None, edges=None):
""" Assigns data to this object and builds the Morse-Smale
Complex
@ In, X, an m-by-n array of values specifying m
n-dimensional samples
@ In, Y, a m vector of values specifying the output
responses correspond... | python | def build(self, X, Y, w=None, edges=None):
""" Assigns data to this object and builds the Morse-Smale
Complex
@ In, X, an m-by-n array of values specifying m
n-dimensional samples
@ In, Y, a m vector of values specifying the output
responses correspond... | [
"def",
"build",
"(",
"self",
",",
"X",
",",
"Y",
",",
"w",
"=",
"None",
",",
"edges",
"=",
"None",
")",
":",
"super",
"(",
"ContourTree",
",",
"self",
")",
".",
"build",
"(",
"X",
",",
"Y",
",",
"w",
",",
"edges",
")",
"# Build the join and split... | Assigns data to this object and builds the Morse-Smale
Complex
@ In, X, an m-by-n array of values specifying m
n-dimensional samples
@ In, Y, a m vector of values specifying the output
responses corresponding to the m samples specified by X
@ In, w... | [
"Assigns",
"data",
"to",
"this",
"object",
"and",
"builds",
"the",
"Morse",
"-",
"Smale",
"Complex"
] | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/ContourTree.py#L91-L142 | train | Builds the Morse - Smale complexcluster tree. |
maljovec/topopy | topopy/ContourTree.py | ContourTree._identifyBranches | def _identifyBranches(self):
""" A helper function for determining all of the branches in the
tree. This should be called after the tree has been fully
constructed and its nodes and edges are populated.
"""
if self.debug:
sys.stdout.write("Identifying branche... | python | def _identifyBranches(self):
""" A helper function for determining all of the branches in the
tree. This should be called after the tree has been fully
constructed and its nodes and edges are populated.
"""
if self.debug:
sys.stdout.write("Identifying branche... | [
"def",
"_identifyBranches",
"(",
"self",
")",
":",
"if",
"self",
".",
"debug",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"\"Identifying branches: \"",
")",
"start",
"=",
"time",
".",
"clock",
"(",
")",
"seen",
"=",
"set",
"(",
")",
"self",
".",
"... | A helper function for determining all of the branches in the
tree. This should be called after the tree has been fully
constructed and its nodes and edges are populated. | [
"A",
"helper",
"function",
"for",
"determining",
"all",
"of",
"the",
"branches",
"in",
"the",
"tree",
".",
"This",
"should",
"be",
"called",
"after",
"the",
"tree",
"has",
"been",
"fully",
"constructed",
"and",
"its",
"nodes",
"and",
"edges",
"are",
"popul... | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/ContourTree.py#L144-L172 | train | This function is used to identify all of the branches in the tree. |
maljovec/topopy | topopy/ContourTree.py | ContourTree._identifySuperGraph | def _identifySuperGraph(self):
""" A helper function for determining the condensed
representation of the tree. That is, one that does not hold
all of the internal nodes of the graph. The results will be
stored in ContourTree.superNodes and ContourTree.superArcs.
T... | python | def _identifySuperGraph(self):
""" A helper function for determining the condensed
representation of the tree. That is, one that does not hold
all of the internal nodes of the graph. The results will be
stored in ContourTree.superNodes and ContourTree.superArcs.
T... | [
"def",
"_identifySuperGraph",
"(",
"self",
")",
":",
"if",
"self",
".",
"debug",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"\"Condensing Graph: \"",
")",
"start",
"=",
"time",
".",
"clock",
"(",
")",
"G",
"=",
"nx",
".",
"DiGraph",
"(",
")",
"G",... | A helper function for determining the condensed
representation of the tree. That is, one that does not hold
all of the internal nodes of the graph. The results will be
stored in ContourTree.superNodes and ContourTree.superArcs.
These two can be used to potentially speed u... | [
"A",
"helper",
"function",
"for",
"determining",
"the",
"condensed",
"representation",
"of",
"the",
"tree",
".",
"That",
"is",
"one",
"that",
"does",
"not",
"hold",
"all",
"of",
"the",
"internal",
"nodes",
"of",
"the",
"graph",
".",
"The",
"results",
"will... | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/ContourTree.py#L174-L263 | train | This function is used to identify the condensed version of the tree. |
maljovec/topopy | topopy/ContourTree.py | ContourTree.get_seeds | def get_seeds(self, threshold):
""" Returns a list of seed points for isosurface extraction
given a threshold value
@ In, threshold, float, the isovalue for which we want to
identify seed points for isosurface extraction
"""
seeds = []
for e1, e2 i... | python | def get_seeds(self, threshold):
""" Returns a list of seed points for isosurface extraction
given a threshold value
@ In, threshold, float, the isovalue for which we want to
identify seed points for isosurface extraction
"""
seeds = []
for e1, e2 i... | [
"def",
"get_seeds",
"(",
"self",
",",
"threshold",
")",
":",
"seeds",
"=",
"[",
"]",
"for",
"e1",
",",
"e2",
"in",
"self",
".",
"superArcs",
":",
"# Because we did some extra work in _process_tree, we can",
"# safely assume e1 is lower than e2",
"if",
"self",
".",
... | Returns a list of seed points for isosurface extraction
given a threshold value
@ In, threshold, float, the isovalue for which we want to
identify seed points for isosurface extraction | [
"Returns",
"a",
"list",
"of",
"seed",
"points",
"for",
"isosurface",
"extraction",
"given",
"a",
"threshold",
"value"
] | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/ContourTree.py#L265-L296 | train | Returns a list of seed points for which we want to be identified by a threshold value. |
maljovec/topopy | topopy/ContourTree.py | ContourTree._construct_nx_tree | def _construct_nx_tree(self, thisTree, thatTree=None):
""" A function for creating networkx instances that can be used
more efficiently for graph manipulation than the MergeTree
class.
@ In, thisTree, a MergeTree instance for which we will
construct a networkx... | python | def _construct_nx_tree(self, thisTree, thatTree=None):
""" A function for creating networkx instances that can be used
more efficiently for graph manipulation than the MergeTree
class.
@ In, thisTree, a MergeTree instance for which we will
construct a networkx... | [
"def",
"_construct_nx_tree",
"(",
"self",
",",
"thisTree",
",",
"thatTree",
"=",
"None",
")",
":",
"if",
"self",
".",
"debug",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"\"Networkx Tree construction: \"",
")",
"start",
"=",
"time",
".",
"clock",
"(",
... | A function for creating networkx instances that can be used
more efficiently for graph manipulation than the MergeTree
class.
@ In, thisTree, a MergeTree instance for which we will
construct a networkx graph
@ In, thatTree, a MergeTree instance optionally ... | [
"A",
"function",
"for",
"creating",
"networkx",
"instances",
"that",
"can",
"be",
"used",
"more",
"efficiently",
"for",
"graph",
"manipulation",
"than",
"the",
"MergeTree",
"class",
"."
] | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/ContourTree.py#L298-L348 | train | A function for creating a networkx graph that can be used to create a MergeTree instance. |
maljovec/topopy | topopy/ContourTree.py | ContourTree._process_tree | def _process_tree(self, thisTree, thatTree):
""" A function that will process either a split or join tree
with reference to the other tree and store it as part of
this CT instance.
@ In, thisTree, a networkx.Graph instance representing a
merge tree for which w... | python | def _process_tree(self, thisTree, thatTree):
""" A function that will process either a split or join tree
with reference to the other tree and store it as part of
this CT instance.
@ In, thisTree, a networkx.Graph instance representing a
merge tree for which w... | [
"def",
"_process_tree",
"(",
"self",
",",
"thisTree",
",",
"thatTree",
")",
":",
"if",
"self",
".",
"debug",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"\"Processing Tree: \"",
")",
"start",
"=",
"time",
".",
"clock",
"(",
")",
"# Get all of the leaf no... | A function that will process either a split or join tree
with reference to the other tree and store it as part of
this CT instance.
@ In, thisTree, a networkx.Graph instance representing a
merge tree for which we will process all of its leaf
nodes into... | [
"A",
"function",
"that",
"will",
"process",
"either",
"a",
"split",
"or",
"join",
"tree",
"with",
"reference",
"to",
"the",
"other",
"tree",
"and",
"store",
"it",
"as",
"part",
"of",
"this",
"CT",
"instance",
"."
] | 4be598d51c4e4043b73d4ad44beed6d289e2f088 | https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/ContourTree.py#L350-L472 | train | This function processes the merge tree and stores the result in the CT object. |
lsst-sqre/documenteer | documenteer/sphinxconfig/utils.py | read_git_branch | def read_git_branch():
"""Obtain the current branch name from the Git repository. If on Travis CI,
use the ``TRAVIS_BRANCH`` environment variable.
"""
if os.getenv('TRAVIS'):
return os.getenv('TRAVIS_BRANCH')
else:
try:
repo = git.repo.base.Repo(search_parent_directories=... | python | def read_git_branch():
"""Obtain the current branch name from the Git repository. If on Travis CI,
use the ``TRAVIS_BRANCH`` environment variable.
"""
if os.getenv('TRAVIS'):
return os.getenv('TRAVIS_BRANCH')
else:
try:
repo = git.repo.base.Repo(search_parent_directories=... | [
"def",
"read_git_branch",
"(",
")",
":",
"if",
"os",
".",
"getenv",
"(",
"'TRAVIS'",
")",
":",
"return",
"os",
".",
"getenv",
"(",
"'TRAVIS_BRANCH'",
")",
"else",
":",
"try",
":",
"repo",
"=",
"git",
".",
"repo",
".",
"base",
".",
"Repo",
"(",
"sea... | Obtain the current branch name from the Git repository. If on Travis CI,
use the ``TRAVIS_BRANCH`` environment variable. | [
"Obtain",
"the",
"current",
"branch",
"name",
"from",
"the",
"Git",
"repository",
".",
"If",
"on",
"Travis",
"CI",
"use",
"the",
"TRAVIS_BRANCH",
"environment",
"variable",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/utils.py#L17-L28 | train | Obtain the current branch name from the Git repository. |
lsst-sqre/documenteer | documenteer/sphinxconfig/utils.py | read_git_commit_timestamp | def read_git_commit_timestamp(repo_path=None):
"""Obtain the timestamp from the current head commit of a Git repository.
Parameters
----------
repo_path : `str`, optional
Path to the Git repository. Leave as `None` to use the current working
directory.
Returns
-------
commi... | python | def read_git_commit_timestamp(repo_path=None):
"""Obtain the timestamp from the current head commit of a Git repository.
Parameters
----------
repo_path : `str`, optional
Path to the Git repository. Leave as `None` to use the current working
directory.
Returns
-------
commi... | [
"def",
"read_git_commit_timestamp",
"(",
"repo_path",
"=",
"None",
")",
":",
"repo",
"=",
"git",
".",
"repo",
".",
"base",
".",
"Repo",
"(",
"path",
"=",
"repo_path",
",",
"search_parent_directories",
"=",
"True",
")",
"head_commit",
"=",
"repo",
".",
"hea... | Obtain the timestamp from the current head commit of a Git repository.
Parameters
----------
repo_path : `str`, optional
Path to the Git repository. Leave as `None` to use the current working
directory.
Returns
-------
commit_timestamp : `datetime.datetime`
The datetime... | [
"Obtain",
"the",
"timestamp",
"from",
"the",
"current",
"head",
"commit",
"of",
"a",
"Git",
"repository",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/utils.py#L31-L47 | train | Obtain the timestamp from the current head commit of a Git repository. |
lsst-sqre/documenteer | documenteer/sphinxconfig/utils.py | read_git_commit_timestamp_for_file | def read_git_commit_timestamp_for_file(filepath, repo_path=None):
"""Obtain the timestamp for the most recent commit to a given file in a
Git repository.
Parameters
----------
filepath : `str`
Repository-relative path for a file.
repo_path : `str`, optional
Path to the Git repos... | python | def read_git_commit_timestamp_for_file(filepath, repo_path=None):
"""Obtain the timestamp for the most recent commit to a given file in a
Git repository.
Parameters
----------
filepath : `str`
Repository-relative path for a file.
repo_path : `str`, optional
Path to the Git repos... | [
"def",
"read_git_commit_timestamp_for_file",
"(",
"filepath",
",",
"repo_path",
"=",
"None",
")",
":",
"repo",
"=",
"git",
".",
"repo",
".",
"base",
".",
"Repo",
"(",
"path",
"=",
"repo_path",
",",
"search_parent_directories",
"=",
"True",
")",
"head_commit",
... | Obtain the timestamp for the most recent commit to a given file in a
Git repository.
Parameters
----------
filepath : `str`
Repository-relative path for a file.
repo_path : `str`, optional
Path to the Git repository. Leave as `None` to use the current working
directory.
... | [
"Obtain",
"the",
"timestamp",
"for",
"the",
"most",
"recent",
"commit",
"to",
"a",
"given",
"file",
"in",
"a",
"Git",
"repository",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/utils.py#L50-L80 | train | Obtain the timestamp for the most recent commit to a given file in a
Git repository. |
lsst-sqre/documenteer | documenteer/sphinxconfig/utils.py | get_filepaths_with_extension | def get_filepaths_with_extension(extname, root_dir='.'):
"""Get relative filepaths of files in a directory, and sub-directories,
with the given extension.
Parameters
----------
extname : `str`
Extension name (e.g. 'txt', 'rst'). Extension comparison is
case-insensitive.
root_dir... | python | def get_filepaths_with_extension(extname, root_dir='.'):
"""Get relative filepaths of files in a directory, and sub-directories,
with the given extension.
Parameters
----------
extname : `str`
Extension name (e.g. 'txt', 'rst'). Extension comparison is
case-insensitive.
root_dir... | [
"def",
"get_filepaths_with_extension",
"(",
"extname",
",",
"root_dir",
"=",
"'.'",
")",
":",
"# needed for comparison with os.path.splitext",
"if",
"not",
"extname",
".",
"startswith",
"(",
"'.'",
")",
":",
"extname",
"=",
"'.'",
"+",
"extname",
"# for case-insensi... | Get relative filepaths of files in a directory, and sub-directories,
with the given extension.
Parameters
----------
extname : `str`
Extension name (e.g. 'txt', 'rst'). Extension comparison is
case-insensitive.
root_dir : `str`, optional
Root directory. Current working direc... | [
"Get",
"relative",
"filepaths",
"of",
"files",
"in",
"a",
"directory",
"and",
"sub",
"-",
"directories",
"with",
"the",
"given",
"extension",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/utils.py#L83-L116 | train | Get relative filepaths of files in a directory and sub - directories and sub - directories with the given extension. |
lsst-sqre/documenteer | documenteer/sphinxconfig/utils.py | get_project_content_commit_date | def get_project_content_commit_date(root_dir='.', exclusions=None):
"""Get the datetime for the most recent commit to a project that
affected Sphinx content.
*Content* is considered any file with one of these extensions:
- ``rst`` (README.rst and LICENSE.rst are excluded)
- ``ipynb``
- ``png``... | python | def get_project_content_commit_date(root_dir='.', exclusions=None):
"""Get the datetime for the most recent commit to a project that
affected Sphinx content.
*Content* is considered any file with one of these extensions:
- ``rst`` (README.rst and LICENSE.rst are excluded)
- ``ipynb``
- ``png``... | [
"def",
"get_project_content_commit_date",
"(",
"root_dir",
"=",
"'.'",
",",
"exclusions",
"=",
"None",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"# Supported 'content' extensions",
"extensions",
"=",
"(",
"'rst'",
",",
"'ipynb'",
... | Get the datetime for the most recent commit to a project that
affected Sphinx content.
*Content* is considered any file with one of these extensions:
- ``rst`` (README.rst and LICENSE.rst are excluded)
- ``ipynb``
- ``png``
- ``jpeg``
- ``jpg``
- ``svg``
- ``gif``
This functio... | [
"Get",
"the",
"datetime",
"for",
"the",
"most",
"recent",
"commit",
"to",
"a",
"project",
"that",
"affected",
"Sphinx",
"content",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/utils.py#L119-L192 | train | Get the datetime for the most recent commit to a project that affected Sphinx content. |
lsst-sqre/documenteer | documenteer/sphinxconfig/utils.py | form_ltd_edition_name | def form_ltd_edition_name(git_ref_name=None):
"""Form the LSST the Docs edition name for this branch, using the same
logic as LTD Keeper does for transforming branch names into edition names.
Parameters
----------
git_ref_name : `str`
Name of the git branch (or git ref, in general, like a ta... | python | def form_ltd_edition_name(git_ref_name=None):
"""Form the LSST the Docs edition name for this branch, using the same
logic as LTD Keeper does for transforming branch names into edition names.
Parameters
----------
git_ref_name : `str`
Name of the git branch (or git ref, in general, like a ta... | [
"def",
"form_ltd_edition_name",
"(",
"git_ref_name",
"=",
"None",
")",
":",
"if",
"git_ref_name",
"is",
"None",
":",
"name",
"=",
"read_git_branch",
"(",
")",
"else",
":",
"name",
"=",
"git_ref_name",
"# First, try to use the JIRA ticket number",
"m",
"=",
"TICKET... | Form the LSST the Docs edition name for this branch, using the same
logic as LTD Keeper does for transforming branch names into edition names.
Parameters
----------
git_ref_name : `str`
Name of the git branch (or git ref, in general, like a tag) that.
Notes
-----
The LTD Keeper (git... | [
"Form",
"the",
"LSST",
"the",
"Docs",
"edition",
"name",
"for",
"this",
"branch",
"using",
"the",
"same",
"logic",
"as",
"LTD",
"Keeper",
"does",
"for",
"transforming",
"branch",
"names",
"into",
"edition",
"names",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/utils.py#L195-L235 | train | Form the LSST the Docs edition name for this branch using the same logic as LTD Keeper does. |
fkarb/xltable | xltable/workbook.py | Workbook.itersheets | def itersheets(self):
"""
Iterates over the worksheets in the book, and sets the active
worksheet as the current one before yielding.
"""
for ws in self.worksheets:
# Expression with no explicit table specified will use None
# when calling get_table, which... | python | def itersheets(self):
"""
Iterates over the worksheets in the book, and sets the active
worksheet as the current one before yielding.
"""
for ws in self.worksheets:
# Expression with no explicit table specified will use None
# when calling get_table, which... | [
"def",
"itersheets",
"(",
"self",
")",
":",
"for",
"ws",
"in",
"self",
".",
"worksheets",
":",
"# Expression with no explicit table specified will use None",
"# when calling get_table, which should return the current worksheet/table",
"prev_ws",
"=",
"self",
".",
"active_worksh... | Iterates over the worksheets in the book, and sets the active
worksheet as the current one before yielding. | [
"Iterates",
"over",
"the",
"worksheets",
"in",
"the",
"book",
"and",
"sets",
"the",
"active",
"worksheet",
"as",
"the",
"current",
"one",
"before",
"yielding",
"."
] | 7a592642d27ad5ee90d2aa8c26338abaa9d84bea | https://github.com/fkarb/xltable/blob/7a592642d27ad5ee90d2aa8c26338abaa9d84bea/xltable/workbook.py#L47-L60 | train | Iterate over the worksheets in the book and sets the active_worksheet to the current one before yielding. |
fkarb/xltable | xltable/workbook.py | Workbook.to_xlsx | def to_xlsx(self, **kwargs):
"""
Write workbook to a .xlsx file using xlsxwriter.
Return a xlsxwriter.workbook.Workbook.
:param kwargs: Extra arguments passed to the xlsxwriter.Workbook
constructor.
"""
from xlsxwriter.workbook import Workbook as _Workbook
... | python | def to_xlsx(self, **kwargs):
"""
Write workbook to a .xlsx file using xlsxwriter.
Return a xlsxwriter.workbook.Workbook.
:param kwargs: Extra arguments passed to the xlsxwriter.Workbook
constructor.
"""
from xlsxwriter.workbook import Workbook as _Workbook
... | [
"def",
"to_xlsx",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"xlsxwriter",
".",
"workbook",
"import",
"Workbook",
"as",
"_Workbook",
"self",
".",
"workbook_obj",
"=",
"_Workbook",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"workbook_obj",
".... | Write workbook to a .xlsx file using xlsxwriter.
Return a xlsxwriter.workbook.Workbook.
:param kwargs: Extra arguments passed to the xlsxwriter.Workbook
constructor. | [
"Write",
"workbook",
"to",
"a",
".",
"xlsx",
"file",
"using",
"xlsxwriter",
".",
"Return",
"a",
"xlsxwriter",
".",
"workbook",
".",
"Workbook",
"."
] | 7a592642d27ad5ee90d2aa8c26338abaa9d84bea | https://github.com/fkarb/xltable/blob/7a592642d27ad5ee90d2aa8c26338abaa9d84bea/xltable/workbook.py#L62-L80 | train | Write the workbook to a. xlsx file using xlsxwriter. Workbook. |
fkarb/xltable | xltable/workbook.py | Workbook.get_table | def get_table(self, name):
"""
Return a table, worksheet pair for the named table
"""
if name is None:
assert self.active_table, "Can't get table without name unless an active table is set"
name = self.active_table.name
if self.active_worksheet:
... | python | def get_table(self, name):
"""
Return a table, worksheet pair for the named table
"""
if name is None:
assert self.active_table, "Can't get table without name unless an active table is set"
name = self.active_table.name
if self.active_worksheet:
... | [
"def",
"get_table",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"is",
"None",
":",
"assert",
"self",
".",
"active_table",
",",
"\"Can't get table without name unless an active table is set\"",
"name",
"=",
"self",
".",
"active_table",
".",
"name",
"if",
"s... | Return a table, worksheet pair for the named table | [
"Return",
"a",
"table",
"worksheet",
"pair",
"for",
"the",
"named",
"table"
] | 7a592642d27ad5ee90d2aa8c26338abaa9d84bea | https://github.com/fkarb/xltable/blob/7a592642d27ad5ee90d2aa8c26338abaa9d84bea/xltable/workbook.py#L141-L186 | train | Return a table and worksheet pair for the named table. |
mastro35/flows | flows/Actions/Action.py | Action.send_message | def send_message(self, output):
"""
Send a message to the socket
"""
file_system_event = None
if self.my_action_input:
file_system_event = self.my_action_input.file_system_event or None
output_action = ActionInput(file_system_event,
... | python | def send_message(self, output):
"""
Send a message to the socket
"""
file_system_event = None
if self.my_action_input:
file_system_event = self.my_action_input.file_system_event or None
output_action = ActionInput(file_system_event,
... | [
"def",
"send_message",
"(",
"self",
",",
"output",
")",
":",
"file_system_event",
"=",
"None",
"if",
"self",
".",
"my_action_input",
":",
"file_system_event",
"=",
"self",
".",
"my_action_input",
".",
"file_system_event",
"or",
"None",
"output_action",
"=",
"Act... | Send a message to the socket | [
"Send",
"a",
"message",
"to",
"the",
"socket"
] | 05e488385673a69597b5b39c7728795aa4d5eb18 | https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/Action.py#L107-L121 | train | Send a message to the socket |
mastro35/flows | flows/Actions/Action.py | Action.stop | def stop(self):
''' Stop the current action '''
Global.LOGGER.debug(f"action {self.name} stopped")
self.is_running = False
self.on_stop() | python | def stop(self):
''' Stop the current action '''
Global.LOGGER.debug(f"action {self.name} stopped")
self.is_running = False
self.on_stop() | [
"def",
"stop",
"(",
"self",
")",
":",
"Global",
".",
"LOGGER",
".",
"debug",
"(",
"f\"action {self.name} stopped\"",
")",
"self",
".",
"is_running",
"=",
"False",
"self",
".",
"on_stop",
"(",
")"
] | Stop the current action | [
"Stop",
"the",
"current",
"action"
] | 05e488385673a69597b5b39c7728795aa4d5eb18 | https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/Action.py#L123-L127 | train | Stop the current action. |
mastro35/flows | flows/Actions/Action.py | Action.run | def run(self):
"""
Start the action
"""
Global.LOGGER.debug(f"action {self.name} is running")
for tmp_monitored_input in self.monitored_input:
sender = "*" + tmp_monitored_input + "*"
Global.LOGGER.debug(f"action {self.name} is monitoring {sender}")
... | python | def run(self):
"""
Start the action
"""
Global.LOGGER.debug(f"action {self.name} is running")
for tmp_monitored_input in self.monitored_input:
sender = "*" + tmp_monitored_input + "*"
Global.LOGGER.debug(f"action {self.name} is monitoring {sender}")
... | [
"def",
"run",
"(",
"self",
")",
":",
"Global",
".",
"LOGGER",
".",
"debug",
"(",
"f\"action {self.name} is running\"",
")",
"for",
"tmp_monitored_input",
"in",
"self",
".",
"monitored_input",
":",
"sender",
"=",
"\"*\"",
"+",
"tmp_monitored_input",
"+",
"\"*\"",... | Start the action | [
"Start",
"the",
"action"
] | 05e488385673a69597b5b39c7728795aa4d5eb18 | https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/Action.py#L129-L145 | train | Start the action. |
mastro35/flows | flows/Actions/Action.py | Action.create_action_for_code | def create_action_for_code(cls, action_code, name, configuration, managed_input):
"""
Factory method to create an instance of an Action from an input code
"""
Global.LOGGER.debug(f"creating action {name} for code {action_code}")
Global.LOGGER.debug(f"configuration length: {len(co... | python | def create_action_for_code(cls, action_code, name, configuration, managed_input):
"""
Factory method to create an instance of an Action from an input code
"""
Global.LOGGER.debug(f"creating action {name} for code {action_code}")
Global.LOGGER.debug(f"configuration length: {len(co... | [
"def",
"create_action_for_code",
"(",
"cls",
",",
"action_code",
",",
"name",
",",
"configuration",
",",
"managed_input",
")",
":",
"Global",
".",
"LOGGER",
".",
"debug",
"(",
"f\"creating action {name} for code {action_code}\"",
")",
"Global",
".",
"LOGGER",
".",
... | Factory method to create an instance of an Action from an input code | [
"Factory",
"method",
"to",
"create",
"an",
"instance",
"of",
"an",
"Action",
"from",
"an",
"input",
"code"
] | 05e488385673a69597b5b39c7728795aa4d5eb18 | https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/Action.py#L214-L238 | train | Create an instance of an action from an input code. |
bluekeyes/sphinx-javalink | javalink/loader.py | extract_class | def extract_class(jar, name):
"""Extracts a LinkableClass from a jar.
Args:
jar: An open ZipFile instance.
name: A string containing the binary name of a class.
Raises:
KeyError: The class does not exist in the jar.
"""
with jar.open(name) as entry:
return Linkable... | python | def extract_class(jar, name):
"""Extracts a LinkableClass from a jar.
Args:
jar: An open ZipFile instance.
name: A string containing the binary name of a class.
Raises:
KeyError: The class does not exist in the jar.
"""
with jar.open(name) as entry:
return Linkable... | [
"def",
"extract_class",
"(",
"jar",
",",
"name",
")",
":",
"with",
"jar",
".",
"open",
"(",
"name",
")",
"as",
"entry",
":",
"return",
"LinkableClass",
"(",
"javatools",
".",
"unpack_class",
"(",
"entry",
")",
")"
] | Extracts a LinkableClass from a jar.
Args:
jar: An open ZipFile instance.
name: A string containing the binary name of a class.
Raises:
KeyError: The class does not exist in the jar. | [
"Extracts",
"a",
"LinkableClass",
"from",
"a",
"jar",
"."
] | 490e37506efa53e95ad88a665e347536e75b6254 | https://github.com/bluekeyes/sphinx-javalink/blob/490e37506efa53e95ad88a665e347536e75b6254/javalink/loader.py#L10-L22 | train | Extracts a LinkableClass from a jar. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/pyapisummary.py | TaskApiDirective.run | def run(self):
"""Main entrypoint method.
Returns
-------
new_nodes : `list`
Nodes to add to the doctree.
"""
logger = getLogger(__name__)
try:
task_class_name = self.arguments[0]
except IndexError:
raise SphinxError(
... | python | def run(self):
"""Main entrypoint method.
Returns
-------
new_nodes : `list`
Nodes to add to the doctree.
"""
logger = getLogger(__name__)
try:
task_class_name = self.arguments[0]
except IndexError:
raise SphinxError(
... | [
"def",
"run",
"(",
"self",
")",
":",
"logger",
"=",
"getLogger",
"(",
"__name__",
")",
"try",
":",
"task_class_name",
"=",
"self",
".",
"arguments",
"[",
"0",
"]",
"except",
"IndexError",
":",
"raise",
"SphinxError",
"(",
"'{} directive requires a Task class '... | Main entrypoint method.
Returns
-------
new_nodes : `list`
Nodes to add to the doctree. | [
"Main",
"entrypoint",
"method",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L33-L60 | train | Main entrypoint method. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/pyapisummary.py | TaskApiDirective._format_summary_node | def _format_summary_node(self, task_class):
"""Format a section node containg a summary of a Task class's key APIs.
"""
modulename = task_class.__module__
classname = task_class.__name__
nodes = []
nodes.append(
self._format_class_nodes(task_class))
... | python | def _format_summary_node(self, task_class):
"""Format a section node containg a summary of a Task class's key APIs.
"""
modulename = task_class.__module__
classname = task_class.__name__
nodes = []
nodes.append(
self._format_class_nodes(task_class))
... | [
"def",
"_format_summary_node",
"(",
"self",
",",
"task_class",
")",
":",
"modulename",
"=",
"task_class",
".",
"__module__",
"classname",
"=",
"task_class",
".",
"__name__",
"nodes",
"=",
"[",
"]",
"nodes",
".",
"append",
"(",
"self",
".",
"_format_class_nodes... | Format a section node containg a summary of a Task class's key APIs. | [
"Format",
"a",
"section",
"node",
"containg",
"a",
"summary",
"of",
"a",
"Task",
"class",
"s",
"key",
"APIs",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L62-L84 | train | Format a section node containg a summary of a Task class s key APIs. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/pyapisummary.py | TaskApiDirective._format_class_nodes | def _format_class_nodes(self, task_class):
"""Create a ``desc`` node summarizing the class docstring.
"""
# Patterned after PyObject.handle_signature in Sphinx.
# https://github.com/sphinx-doc/sphinx/blob/3e57ea0a5253ac198c1bff16c40abe71951bb586/sphinx/domains/python.py#L246
mod... | python | def _format_class_nodes(self, task_class):
"""Create a ``desc`` node summarizing the class docstring.
"""
# Patterned after PyObject.handle_signature in Sphinx.
# https://github.com/sphinx-doc/sphinx/blob/3e57ea0a5253ac198c1bff16c40abe71951bb586/sphinx/domains/python.py#L246
mod... | [
"def",
"_format_class_nodes",
"(",
"self",
",",
"task_class",
")",
":",
"# Patterned after PyObject.handle_signature in Sphinx.",
"# https://github.com/sphinx-doc/sphinx/blob/3e57ea0a5253ac198c1bff16c40abe71951bb586/sphinx/domains/python.py#L246",
"modulename",
"=",
"task_class",
".",
"_... | Create a ``desc`` node summarizing the class docstring. | [
"Create",
"a",
"desc",
"node",
"summarizing",
"the",
"class",
"docstring",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L86-L112 | train | Create a desc node summarizing the class docstring. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/pyapisummary.py | TaskApiDirective._format_method_nodes | def _format_method_nodes(self, task_method, modulename, classname):
"""Create a ``desc`` node summarizing a method docstring.
"""
methodname = task_method.__name__
fullname = '.'.join((modulename, classname, methodname))
# The signature term
signature = Signature(task_me... | python | def _format_method_nodes(self, task_method, modulename, classname):
"""Create a ``desc`` node summarizing a method docstring.
"""
methodname = task_method.__name__
fullname = '.'.join((modulename, classname, methodname))
# The signature term
signature = Signature(task_me... | [
"def",
"_format_method_nodes",
"(",
"self",
",",
"task_method",
",",
"modulename",
",",
"classname",
")",
":",
"methodname",
"=",
"task_method",
".",
"__name__",
"fullname",
"=",
"'.'",
".",
"join",
"(",
"(",
"modulename",
",",
"classname",
",",
"methodname",
... | Create a ``desc`` node summarizing a method docstring. | [
"Create",
"a",
"desc",
"node",
"summarizing",
"a",
"method",
"docstring",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L114-L136 | train | Create a desc node summarizing a method docstring. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/pyapisummary.py | TaskApiDirective._create_doc_summary | def _create_doc_summary(self, obj, fullname, refrole):
"""Create a paragraph containing the object's one-sentence docstring
summary with a link to further documentation.
The paragrah should be inserted into the ``desc`` node's
``desc_content``.
"""
summary_text = extract... | python | def _create_doc_summary(self, obj, fullname, refrole):
"""Create a paragraph containing the object's one-sentence docstring
summary with a link to further documentation.
The paragrah should be inserted into the ``desc`` node's
``desc_content``.
"""
summary_text = extract... | [
"def",
"_create_doc_summary",
"(",
"self",
",",
"obj",
",",
"fullname",
",",
"refrole",
")",
":",
"summary_text",
"=",
"extract_docstring_summary",
"(",
"get_docstring",
"(",
"obj",
")",
")",
"summary_text",
"=",
"summary_text",
".",
"strip",
"(",
")",
"# Stri... | Create a paragraph containing the object's one-sentence docstring
summary with a link to further documentation.
The paragrah should be inserted into the ``desc`` node's
``desc_content``. | [
"Create",
"a",
"paragraph",
"containing",
"the",
"object",
"s",
"one",
"-",
"sentence",
"docstring",
"summary",
"with",
"a",
"link",
"to",
"further",
"documentation",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L175-L189 | train | Create a paragraph containing the object s one - sentence docstring containing the object s summary with a link to further documentation. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/pyapisummary.py | TaskApiDirective._create_api_details_link | def _create_api_details_link(self, fullname, refrole):
"""Appends a link to the API docs, labelled as "...", that is appended
to the content paragraph of an API description.
This affordance indicates that more documentation is available, and
that by clicking on the ellipsis the user can... | python | def _create_api_details_link(self, fullname, refrole):
"""Appends a link to the API docs, labelled as "...", that is appended
to the content paragraph of an API description.
This affordance indicates that more documentation is available, and
that by clicking on the ellipsis the user can... | [
"def",
"_create_api_details_link",
"(",
"self",
",",
"fullname",
",",
"refrole",
")",
":",
"ref_text",
"=",
"'... <{}>'",
".",
"format",
"(",
"fullname",
")",
"xref",
"=",
"PyXRefRole",
"(",
")",
"xref_nodes",
",",
"_",
"=",
"xref",
"(",
"refrole",
",",
... | Appends a link to the API docs, labelled as "...", that is appended
to the content paragraph of an API description.
This affordance indicates that more documentation is available, and
that by clicking on the ellipsis the user can find that documentation. | [
"Appends",
"a",
"link",
"to",
"the",
"API",
"docs",
"labelled",
"as",
"...",
"that",
"is",
"appended",
"to",
"the",
"content",
"paragraph",
"of",
"an",
"API",
"description",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L191-L204 | train | Creates a link to the API documentation. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/pyapisummary.py | TaskApiDirective._format_config_nodes | def _format_config_nodes(self, modulename, classname):
"""Create a ``desc`` node summarizing the config attribute
The ``config`` attribute is not statically available from a task class.
This method manually creates a signature and docstring for the
config attribute.
"""
... | python | def _format_config_nodes(self, modulename, classname):
"""Create a ``desc`` node summarizing the config attribute
The ``config`` attribute is not statically available from a task class.
This method manually creates a signature and docstring for the
config attribute.
"""
... | [
"def",
"_format_config_nodes",
"(",
"self",
",",
"modulename",
",",
"classname",
")",
":",
"fullname",
"=",
"'{0}.{1}.config'",
".",
"format",
"(",
"modulename",
",",
"classname",
")",
"# The signature term",
"desc_sig_node",
"=",
"desc_signature",
"(",
")",
"desc... | Create a ``desc`` node summarizing the config attribute
The ``config`` attribute is not statically available from a task class.
This method manually creates a signature and docstring for the
config attribute. | [
"Create",
"a",
"desc",
"node",
"summarizing",
"the",
"config",
"attribute"
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L206-L242 | train | Create a desc node summarizing the config attribute. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/pyapisummary.py | TaskApiDirective._format_import_example | def _format_import_example(self, task_class):
"""Generate nodes that show a code sample demonstrating how to import
the task class.
Parameters
----------
task_class : ``lsst.pipe.base.Task``-type
The Task class.
Returns
-------
nodes : `list`... | python | def _format_import_example(self, task_class):
"""Generate nodes that show a code sample demonstrating how to import
the task class.
Parameters
----------
task_class : ``lsst.pipe.base.Task``-type
The Task class.
Returns
-------
nodes : `list`... | [
"def",
"_format_import_example",
"(",
"self",
",",
"task_class",
")",
":",
"code",
"=",
"'from {0.__module__} import {0.__name__}'",
".",
"format",
"(",
"task_class",
")",
"# This is a bare-bones version of what Sphinx's code-block directive",
"# does. The 'language' attr triggers ... | Generate nodes that show a code sample demonstrating how to import
the task class.
Parameters
----------
task_class : ``lsst.pipe.base.Task``-type
The Task class.
Returns
-------
nodes : `list` of docutils nodes
Docutils nodes showing a c... | [
"Generate",
"nodes",
"that",
"show",
"a",
"code",
"sample",
"demonstrating",
"how",
"to",
"import",
"the",
"task",
"class",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L244-L265 | train | Generate nodes that show a code sample demonstrating how to import
the task class. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/pyapisummary.py | TaskApiDirective._format_api_docs_link_message | def _format_api_docs_link_message(self, task_class):
"""Format a message referring the reader to the full API docs.
Parameters
----------
task_class : ``lsst.pipe.base.Task``-type
The Task class.
Returns
-------
nodes : `list` of docutils nodes
... | python | def _format_api_docs_link_message(self, task_class):
"""Format a message referring the reader to the full API docs.
Parameters
----------
task_class : ``lsst.pipe.base.Task``-type
The Task class.
Returns
-------
nodes : `list` of docutils nodes
... | [
"def",
"_format_api_docs_link_message",
"(",
"self",
",",
"task_class",
")",
":",
"fullname",
"=",
"'{0.__module__}.{0.__name__}'",
".",
"format",
"(",
"task_class",
")",
"p_node",
"=",
"nodes",
".",
"paragraph",
"(",
")",
"_",
"=",
"'See the '",
"p_node",
"+=",... | Format a message referring the reader to the full API docs.
Parameters
----------
task_class : ``lsst.pipe.base.Task``-type
The Task class.
Returns
-------
nodes : `list` of docutils nodes
Docutils nodes showing a link to the full API docs. | [
"Format",
"a",
"message",
"referring",
"the",
"reader",
"to",
"the",
"full",
"API",
"docs",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L267-L303 | train | Format a message that referring the reader to the full API docs. |
nathan-hoad/aiomanhole | aiomanhole/__init__.py | start_manhole | def start_manhole(banner=None, host='127.0.0.1', port=None, path=None,
namespace=None, loop=None, threaded=False, command_timeout=5,
shared=False):
"""Starts a manhole server on a given TCP and/or UNIX address.
Keyword arguments:
banner - Text to display when client initially connects.... | python | def start_manhole(banner=None, host='127.0.0.1', port=None, path=None,
namespace=None, loop=None, threaded=False, command_timeout=5,
shared=False):
"""Starts a manhole server on a given TCP and/or UNIX address.
Keyword arguments:
banner - Text to display when client initially connects.... | [
"def",
"start_manhole",
"(",
"banner",
"=",
"None",
",",
"host",
"=",
"'127.0.0.1'",
",",
"port",
"=",
"None",
",",
"path",
"=",
"None",
",",
"namespace",
"=",
"None",
",",
"loop",
"=",
"None",
",",
"threaded",
"=",
"False",
",",
"command_timeout",
"="... | Starts a manhole server on a given TCP and/or UNIX address.
Keyword arguments:
banner - Text to display when client initially connects.
host - interface to bind on.
port - port to listen on over TCP. Default is disabled.
path - filesystem path to listen on over UNIX sockets. Deafult... | [
"Starts",
"a",
"manhole",
"server",
"on",
"a",
"given",
"TCP",
"and",
"/",
"or",
"UNIX",
"address",
"."
] | a13394c79e1878cde67aa2637ae5664df468ed04 | https://github.com/nathan-hoad/aiomanhole/blob/a13394c79e1878cde67aa2637ae5664df468ed04/aiomanhole/__init__.py#L240-L289 | train | Starts a manhole server on a given TCP and UNIX address. |
nathan-hoad/aiomanhole | aiomanhole/__init__.py | InteractiveInterpreter.send_exception | def send_exception(self):
"""When an exception has occurred, write the traceback to the user."""
self.compiler.reset()
exc = traceback.format_exc()
self.writer.write(exc.encode('utf8'))
yield from self.writer.drain() | python | def send_exception(self):
"""When an exception has occurred, write the traceback to the user."""
self.compiler.reset()
exc = traceback.format_exc()
self.writer.write(exc.encode('utf8'))
yield from self.writer.drain() | [
"def",
"send_exception",
"(",
"self",
")",
":",
"self",
".",
"compiler",
".",
"reset",
"(",
")",
"exc",
"=",
"traceback",
".",
"format_exc",
"(",
")",
"self",
".",
"writer",
".",
"write",
"(",
"exc",
".",
"encode",
"(",
"'utf8'",
")",
")",
"yield",
... | When an exception has occurred, write the traceback to the user. | [
"When",
"an",
"exception",
"has",
"occurred",
"write",
"the",
"traceback",
"to",
"the",
"user",
"."
] | a13394c79e1878cde67aa2637ae5664df468ed04 | https://github.com/nathan-hoad/aiomanhole/blob/a13394c79e1878cde67aa2637ae5664df468ed04/aiomanhole/__init__.py#L66-L73 | train | When an exception has occurred write the traceback to the user. |
nathan-hoad/aiomanhole | aiomanhole/__init__.py | InteractiveInterpreter.handle_one_command | def handle_one_command(self):
"""Process a single command. May have many lines."""
while True:
yield from self.write_prompt()
codeobj = yield from self.read_command()
if codeobj is not None:
yield from self.run_command(codeobj) | python | def handle_one_command(self):
"""Process a single command. May have many lines."""
while True:
yield from self.write_prompt()
codeobj = yield from self.read_command()
if codeobj is not None:
yield from self.run_command(codeobj) | [
"def",
"handle_one_command",
"(",
"self",
")",
":",
"while",
"True",
":",
"yield",
"from",
"self",
".",
"write_prompt",
"(",
")",
"codeobj",
"=",
"yield",
"from",
"self",
".",
"read_command",
"(",
")",
"if",
"codeobj",
"is",
"not",
"None",
":",
"yield",
... | Process a single command. May have many lines. | [
"Process",
"a",
"single",
"command",
".",
"May",
"have",
"many",
"lines",
"."
] | a13394c79e1878cde67aa2637ae5664df468ed04 | https://github.com/nathan-hoad/aiomanhole/blob/a13394c79e1878cde67aa2637ae5664df468ed04/aiomanhole/__init__.py#L88-L96 | train | Process a single command. May have many lines. |
nathan-hoad/aiomanhole | aiomanhole/__init__.py | InteractiveInterpreter.run_command | def run_command(self, codeobj):
"""Execute a compiled code object, and write the output back to the client."""
try:
value, stdout = yield from self.attempt_exec(codeobj, self.namespace)
except Exception:
yield from self.send_exception()
return
else:
... | python | def run_command(self, codeobj):
"""Execute a compiled code object, and write the output back to the client."""
try:
value, stdout = yield from self.attempt_exec(codeobj, self.namespace)
except Exception:
yield from self.send_exception()
return
else:
... | [
"def",
"run_command",
"(",
"self",
",",
"codeobj",
")",
":",
"try",
":",
"value",
",",
"stdout",
"=",
"yield",
"from",
"self",
".",
"attempt_exec",
"(",
"codeobj",
",",
"self",
".",
"namespace",
")",
"except",
"Exception",
":",
"yield",
"from",
"self",
... | Execute a compiled code object, and write the output back to the client. | [
"Execute",
"a",
"compiled",
"code",
"object",
"and",
"write",
"the",
"output",
"back",
"to",
"the",
"client",
"."
] | a13394c79e1878cde67aa2637ae5664df468ed04 | https://github.com/nathan-hoad/aiomanhole/blob/a13394c79e1878cde67aa2637ae5664df468ed04/aiomanhole/__init__.py#L99-L107 | train | Execute a compiled code object and write the output back to the client. |
nathan-hoad/aiomanhole | aiomanhole/__init__.py | InteractiveInterpreter.read_command | def read_command(self):
"""Read a command from the user line by line.
Returns a code object suitable for execution.
"""
reader = self.reader
line = yield from reader.readline()
if line == b'': # lost connection
raise ConnectionResetError()
try:
... | python | def read_command(self):
"""Read a command from the user line by line.
Returns a code object suitable for execution.
"""
reader = self.reader
line = yield from reader.readline()
if line == b'': # lost connection
raise ConnectionResetError()
try:
... | [
"def",
"read_command",
"(",
"self",
")",
":",
"reader",
"=",
"self",
".",
"reader",
"line",
"=",
"yield",
"from",
"reader",
".",
"readline",
"(",
")",
"if",
"line",
"==",
"b''",
":",
"# lost connection",
"raise",
"ConnectionResetError",
"(",
")",
"try",
... | Read a command from the user line by line.
Returns a code object suitable for execution. | [
"Read",
"a",
"command",
"from",
"the",
"user",
"line",
"by",
"line",
"."
] | a13394c79e1878cde67aa2637ae5664df468ed04 | https://github.com/nathan-hoad/aiomanhole/blob/a13394c79e1878cde67aa2637ae5664df468ed04/aiomanhole/__init__.py#L121-L140 | train | Read a command from the user line by line. Returns a code object suitable for execution. |
nathan-hoad/aiomanhole | aiomanhole/__init__.py | InteractiveInterpreter.send_output | def send_output(self, value, stdout):
"""Write the output or value of the expression back to user.
>>> 5
5
>>> print('cash rules everything around me')
cash rules everything around me
"""
writer = self.writer
if value is not None:
writer.wri... | python | def send_output(self, value, stdout):
"""Write the output or value of the expression back to user.
>>> 5
5
>>> print('cash rules everything around me')
cash rules everything around me
"""
writer = self.writer
if value is not None:
writer.wri... | [
"def",
"send_output",
"(",
"self",
",",
"value",
",",
"stdout",
")",
":",
"writer",
"=",
"self",
".",
"writer",
"if",
"value",
"is",
"not",
"None",
":",
"writer",
".",
"write",
"(",
"'{!r}\\n'",
".",
"format",
"(",
"value",
")",
".",
"encode",
"(",
... | Write the output or value of the expression back to user.
>>> 5
5
>>> print('cash rules everything around me')
cash rules everything around me | [
"Write",
"the",
"output",
"or",
"value",
"of",
"the",
"expression",
"back",
"to",
"user",
"."
] | a13394c79e1878cde67aa2637ae5664df468ed04 | https://github.com/nathan-hoad/aiomanhole/blob/a13394c79e1878cde67aa2637ae5664df468ed04/aiomanhole/__init__.py#L143-L160 | train | Write the output or value of the expression back to user. |
redhat-cip/python-dciclient | dciclient/v1/shell_commands/product.py | list | def list(context, sort, limit, where, verbose):
"""list(context, sort, limit, where, verbose)
List all products.
>>> dcictl product 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 boole... | python | def list(context, sort, limit, where, verbose):
"""list(context, sort, limit, where, verbose)
List all products.
>>> dcictl product 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 boole... | [
"def",
"list",
"(",
"context",
",",
"sort",
",",
"limit",
",",
"where",
",",
"verbose",
")",
":",
"result",
"=",
"product",
".",
"list",
"(",
"context",
",",
"sort",
"=",
"sort",
",",
"limit",
"=",
"limit",
",",
"where",
"=",
"where",
")",
"utils",... | list(context, sort, limit, where, verbose)
List all products.
>>> dcictl product 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/product.py#L33-L46 | train | List all products in the
|
redhat-cip/python-dciclient | dciclient/v1/shell_commands/product.py | create | def create(context, name, label, description, active, team_id):
"""create(context, name, label, description, active, team_id)
Create a product.
>>> dcictl product-create [OPTIONS]
:param string name: Name of the product [required]
:param string label: Label of the product [optional]
:param st... | python | def create(context, name, label, description, active, team_id):
"""create(context, name, label, description, active, team_id)
Create a product.
>>> dcictl product-create [OPTIONS]
:param string name: Name of the product [required]
:param string label: Label of the product [optional]
:param st... | [
"def",
"create",
"(",
"context",
",",
"name",
",",
"label",
",",
"description",
",",
"active",
",",
"team_id",
")",
":",
"state",
"=",
"utils",
".",
"active_string",
"(",
"active",
")",
"result",
"=",
"product",
".",
"create",
"(",
"context",
",",
"nam... | create(context, name, label, description, active, team_id)
Create a product.
>>> dcictl product-create [OPTIONS]
:param string name: Name of the product [required]
:param string label: Label of the product [optional]
:param string description: Description of the product [optional]
:param bool... | [
"create",
"(",
"context",
"name",
"label",
"description",
"active",
"team_id",
")"
] | a4aa5899062802bbe4c30a075d8447f8d222d214 | https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/product.py#L56-L73 | train | Create a new product in the available order |
redhat-cip/python-dciclient | dciclient/v1/shell_commands/product.py | update | def update(context, id, etag, name, description, active, team_id):
"""update(context, id, etag, name, description, active, team_id)
Update a product.
>>> dcictl product-update [OPTIONS]
:param string id: ID of the product to update [required]
:param string etag: Entity tag of the resource [requir... | python | def update(context, id, etag, name, description, active, team_id):
"""update(context, id, etag, name, description, active, team_id)
Update a product.
>>> dcictl product-update [OPTIONS]
:param string id: ID of the product to update [required]
:param string etag: Entity tag of the resource [requir... | [
"def",
"update",
"(",
"context",
",",
"id",
",",
"etag",
",",
"name",
",",
"description",
",",
"active",
",",
"team_id",
")",
":",
"result",
"=",
"product",
".",
"update",
"(",
"context",
",",
"id",
"=",
"id",
",",
"etag",
"=",
"etag",
",",
"name",... | update(context, id, etag, name, description, active, team_id)
Update a product.
>>> dcictl product-update [OPTIONS]
:param string id: ID of the product to update [required]
:param string etag: Entity tag of the resource [required]
:param string name: New name of the product [required]
:param ... | [
"update",
"(",
"context",
"id",
"etag",
"name",
"description",
"active",
"team_id",
")"
] | a4aa5899062802bbe4c30a075d8447f8d222d214 | https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/product.py#L84-L104 | train | Update a specific product in a node |
jslang/responsys | responsys/client.py | InteractClient.call | def call(self, method, *args):
""" Calls the service method defined with the arguments provided """
try:
response = getattr(self.client.service, method)(*args)
except (URLError, SSLError) as e:
log.exception('Failed to connect to responsys service')
raise Conn... | python | def call(self, method, *args):
""" Calls the service method defined with the arguments provided """
try:
response = getattr(self.client.service, method)(*args)
except (URLError, SSLError) as e:
log.exception('Failed to connect to responsys service')
raise Conn... | [
"def",
"call",
"(",
"self",
",",
"method",
",",
"*",
"args",
")",
":",
"try",
":",
"response",
"=",
"getattr",
"(",
"self",
".",
"client",
".",
"service",
",",
"method",
")",
"(",
"*",
"args",
")",
"except",
"(",
"URLError",
",",
"SSLError",
")",
... | Calls the service method defined with the arguments provided | [
"Calls",
"the",
"service",
"method",
"defined",
"with",
"the",
"arguments",
"provided"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L110-L131 | train | Calls the service method with the arguments provided |
jslang/responsys | responsys/client.py | InteractClient.connect | def connect(self):
""" Connects to the Responsys soap service
Uses the credentials passed to the client init to login and setup the session id returned.
Returns True on successful connection, otherwise False.
"""
if self.session and self.session.is_expired:
# Close ... | python | def connect(self):
""" Connects to the Responsys soap service
Uses the credentials passed to the client init to login and setup the session id returned.
Returns True on successful connection, otherwise False.
"""
if self.session and self.session.is_expired:
# Close ... | [
"def",
"connect",
"(",
"self",
")",
":",
"if",
"self",
".",
"session",
"and",
"self",
".",
"session",
".",
"is_expired",
":",
"# Close the session to avoid max concurrent session errors",
"self",
".",
"disconnect",
"(",
"abandon_session",
"=",
"True",
")",
"if",
... | Connects to the Responsys soap service
Uses the credentials passed to the client init to login and setup the session id returned.
Returns True on successful connection, otherwise False. | [
"Connects",
"to",
"the",
"Responsys",
"soap",
"service"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L133-L155 | train | Connect to the Responsys soap service. |
jslang/responsys | responsys/client.py | InteractClient.disconnect | def disconnect(self, abandon_session=False):
""" Disconnects from the Responsys soap service
Calls the service logout method and destroys the client's session information. Returns
True on success, False otherwise.
"""
self.connected = False
if (self.session and self.sess... | python | def disconnect(self, abandon_session=False):
""" Disconnects from the Responsys soap service
Calls the service logout method and destroys the client's session information. Returns
True on success, False otherwise.
"""
self.connected = False
if (self.session and self.sess... | [
"def",
"disconnect",
"(",
"self",
",",
"abandon_session",
"=",
"False",
")",
":",
"self",
".",
"connected",
"=",
"False",
"if",
"(",
"self",
".",
"session",
"and",
"self",
".",
"session",
".",
"is_expired",
")",
"or",
"abandon_session",
":",
"try",
":",
... | Disconnects from the Responsys soap service
Calls the service logout method and destroys the client's session information. Returns
True on success, False otherwise. | [
"Disconnects",
"from",
"the",
"Responsys",
"soap",
"service"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L157-L173 | train | Disconnects from the Responsys soap service. Returns True on success False otherwise. |
jslang/responsys | responsys/client.py | InteractClient.merge_list_members | def merge_list_members(self, list_, record_data, merge_rule):
""" Responsys.mergeListMembers call
Accepts:
InteractObject list_
RecordData record_data
ListMergeRule merge_rule
Returns a MergeResult
"""
list_ = list_.get_soap_object(self.clien... | python | def merge_list_members(self, list_, record_data, merge_rule):
""" Responsys.mergeListMembers call
Accepts:
InteractObject list_
RecordData record_data
ListMergeRule merge_rule
Returns a MergeResult
"""
list_ = list_.get_soap_object(self.clien... | [
"def",
"merge_list_members",
"(",
"self",
",",
"list_",
",",
"record_data",
",",
"merge_rule",
")",
":",
"list_",
"=",
"list_",
".",
"get_soap_object",
"(",
"self",
".",
"client",
")",
"record_data",
"=",
"record_data",
".",
"get_soap_object",
"(",
"self",
"... | Responsys.mergeListMembers call
Accepts:
InteractObject list_
RecordData record_data
ListMergeRule merge_rule
Returns a MergeResult | [
"Responsys",
".",
"mergeListMembers",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L205-L218 | train | This method is used to merge a list of elements in a record. |
jslang/responsys | responsys/client.py | InteractClient.merge_list_members_RIID | def merge_list_members_RIID(self, list_, record_data, merge_rule):
""" Responsys.mergeListMembersRIID call
Accepts:
InteractObject list_
RecordData record_data
ListMergeRule merge_rule
Returns a RecipientResult
"""
list_ = list_.get_soap_obje... | python | def merge_list_members_RIID(self, list_, record_data, merge_rule):
""" Responsys.mergeListMembersRIID call
Accepts:
InteractObject list_
RecordData record_data
ListMergeRule merge_rule
Returns a RecipientResult
"""
list_ = list_.get_soap_obje... | [
"def",
"merge_list_members_RIID",
"(",
"self",
",",
"list_",
",",
"record_data",
",",
"merge_rule",
")",
":",
"list_",
"=",
"list_",
".",
"get_soap_object",
"(",
"self",
".",
"client",
")",
"result",
"=",
"self",
".",
"call",
"(",
"'mergeListMembersRIID'",
"... | Responsys.mergeListMembersRIID call
Accepts:
InteractObject list_
RecordData record_data
ListMergeRule merge_rule
Returns a RecipientResult | [
"Responsys",
".",
"mergeListMembersRIID",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L220-L232 | train | This method is used to merge a list of members with a single entry. |
jslang/responsys | responsys/client.py | InteractClient.delete_list_members | def delete_list_members(self, list_, query_column, ids_to_delete):
""" Responsys.deleteListMembers call
Accepts:
InteractObject list_
string query_column
possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER'
list ids_to_delete
... | python | def delete_list_members(self, list_, query_column, ids_to_delete):
""" Responsys.deleteListMembers call
Accepts:
InteractObject list_
string query_column
possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER'
list ids_to_delete
... | [
"def",
"delete_list_members",
"(",
"self",
",",
"list_",
",",
"query_column",
",",
"ids_to_delete",
")",
":",
"list_",
"=",
"list_",
".",
"get_soap_object",
"(",
"self",
".",
"client",
")",
"result",
"=",
"self",
".",
"call",
"(",
"'deleteListMembers'",
",",... | Responsys.deleteListMembers call
Accepts:
InteractObject list_
string query_column
possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER'
list ids_to_delete
Returns a list of DeleteResult instances | [
"Responsys",
".",
"deleteListMembers",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L234-L249 | train | Responsys. deleteListMembers call |
jslang/responsys | responsys/client.py | InteractClient.retrieve_list_members | def retrieve_list_members(self, list_, query_column, field_list, ids_to_retrieve):
""" Responsys.retrieveListMembers call
Accepts:
InteractObject list_
string query_column
possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER'
list fiel... | python | def retrieve_list_members(self, list_, query_column, field_list, ids_to_retrieve):
""" Responsys.retrieveListMembers call
Accepts:
InteractObject list_
string query_column
possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER'
list fiel... | [
"def",
"retrieve_list_members",
"(",
"self",
",",
"list_",
",",
"query_column",
",",
"field_list",
",",
"ids_to_retrieve",
")",
":",
"list_",
"=",
"list_",
".",
"get_soap_object",
"(",
"self",
".",
"client",
")",
"result",
"=",
"self",
".",
"call",
"(",
"'... | Responsys.retrieveListMembers call
Accepts:
InteractObject list_
string query_column
possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER'
list field_list
list ids_to_retrieve
Returns a RecordData instance | [
"Responsys",
".",
"retrieveListMembers",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L251-L265 | train | This method is used to retrieve the list members of a record. |
jslang/responsys | responsys/client.py | InteractClient.create_table | def create_table(self, table, fields):
""" Responsys.createTable call
Accepts:
InteractObject table
list fields
Returns True on success
"""
table = table.get_soap_object(self.client)
return self.call('createTable', table, fields) | python | def create_table(self, table, fields):
""" Responsys.createTable call
Accepts:
InteractObject table
list fields
Returns True on success
"""
table = table.get_soap_object(self.client)
return self.call('createTable', table, fields) | [
"def",
"create_table",
"(",
"self",
",",
"table",
",",
"fields",
")",
":",
"table",
"=",
"table",
".",
"get_soap_object",
"(",
"self",
".",
"client",
")",
"return",
"self",
".",
"call",
"(",
"'createTable'",
",",
"table",
",",
"fields",
")"
] | Responsys.createTable call
Accepts:
InteractObject table
list fields
Returns True on success | [
"Responsys",
".",
"createTable",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L268-L278 | train | This method creates a table in the Responsys. |
jslang/responsys | responsys/client.py | InteractClient.create_table_with_pk | def create_table_with_pk(self, table, fields, primary_keys):
""" Responsys.createTableWithPK call
Accepts:
InteractObject table
list fields
list primary_keys
Returns True on success
"""
table = table.get_soap_object(self.client)
retur... | python | def create_table_with_pk(self, table, fields, primary_keys):
""" Responsys.createTableWithPK call
Accepts:
InteractObject table
list fields
list primary_keys
Returns True on success
"""
table = table.get_soap_object(self.client)
retur... | [
"def",
"create_table_with_pk",
"(",
"self",
",",
"table",
",",
"fields",
",",
"primary_keys",
")",
":",
"table",
"=",
"table",
".",
"get_soap_object",
"(",
"self",
".",
"client",
")",
"return",
"self",
".",
"call",
"(",
"'createTableWithPK'",
",",
"table",
... | Responsys.createTableWithPK call
Accepts:
InteractObject table
list fields
list primary_keys
Returns True on success | [
"Responsys",
".",
"createTableWithPK",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L280-L291 | train | This method creates a table with primary key. Returns True on success Return False on failure |
jslang/responsys | responsys/client.py | InteractClient.delete_table | def delete_table(self, table):
""" Responsys.deleteTable call
Accepts:
InteractObject table
Returns True on success
"""
table = table.get_soap_object(self.client)
return self.call('deleteTable', table) | python | def delete_table(self, table):
""" Responsys.deleteTable call
Accepts:
InteractObject table
Returns True on success
"""
table = table.get_soap_object(self.client)
return self.call('deleteTable', table) | [
"def",
"delete_table",
"(",
"self",
",",
"table",
")",
":",
"table",
"=",
"table",
".",
"get_soap_object",
"(",
"self",
".",
"client",
")",
"return",
"self",
".",
"call",
"(",
"'deleteTable'",
",",
"table",
")"
] | Responsys.deleteTable call
Accepts:
InteractObject table
Returns True on success | [
"Responsys",
".",
"deleteTable",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L293-L302 | train | Responsys. deleteTable call |
jslang/responsys | responsys/client.py | InteractClient.delete_profile_extension_members | def delete_profile_extension_members(self, profile_extension, query_column, ids_to_delete):
""" Responsys.deleteProfileExtensionRecords call
Accepts:
InteractObject profile_extension
list field_list
list ids_to_retrieve
string query_column
... | python | def delete_profile_extension_members(self, profile_extension, query_column, ids_to_delete):
""" Responsys.deleteProfileExtensionRecords call
Accepts:
InteractObject profile_extension
list field_list
list ids_to_retrieve
string query_column
... | [
"def",
"delete_profile_extension_members",
"(",
"self",
",",
"profile_extension",
",",
"query_column",
",",
"ids_to_delete",
")",
":",
"profile_extension",
"=",
"profile_extension",
".",
"get_soap_object",
"(",
"self",
".",
"client",
")",
"result",
"=",
"self",
".",... | Responsys.deleteProfileExtensionRecords call
Accepts:
InteractObject profile_extension
list field_list
list ids_to_retrieve
string query_column
default: 'RIID'
Returns list of DeleteResults | [
"Responsys",
".",
"deleteProfileExtensionRecords",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L304-L321 | train | Responsys. deleteProfileExtensionRecords call |
jslang/responsys | responsys/client.py | InteractClient.retrieve_profile_extension_records | def retrieve_profile_extension_records(self, profile_extension, field_list, ids_to_retrieve,
query_column='RIID'):
""" Responsys.retrieveProfileExtensionRecords call
Accepts:
InteractObject profile_extension
list field_list
... | python | def retrieve_profile_extension_records(self, profile_extension, field_list, ids_to_retrieve,
query_column='RIID'):
""" Responsys.retrieveProfileExtensionRecords call
Accepts:
InteractObject profile_extension
list field_list
... | [
"def",
"retrieve_profile_extension_records",
"(",
"self",
",",
"profile_extension",
",",
"field_list",
",",
"ids_to_retrieve",
",",
"query_column",
"=",
"'RIID'",
")",
":",
"profile_extension",
"=",
"profile_extension",
".",
"get_soap_object",
"(",
"self",
".",
"clien... | Responsys.retrieveProfileExtensionRecords call
Accepts:
InteractObject profile_extension
list field_list
list ids_to_retrieve
string query_column
default: 'RIID'
Returns RecordData | [
"Responsys",
".",
"retrieveProfileExtensionRecords",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L323-L339 | train | This method returns the list of records associated with a profile extension. |
jslang/responsys | responsys/client.py | InteractClient.truncate_table | def truncate_table(self, table):
""" Responsys.truncateTable call
Accepts:
InteractObject table
Returns True on success
"""
table = table.get_soap_object(self.client)
return self.call('truncateTable', table) | python | def truncate_table(self, table):
""" Responsys.truncateTable call
Accepts:
InteractObject table
Returns True on success
"""
table = table.get_soap_object(self.client)
return self.call('truncateTable', table) | [
"def",
"truncate_table",
"(",
"self",
",",
"table",
")",
":",
"table",
"=",
"table",
".",
"get_soap_object",
"(",
"self",
".",
"client",
")",
"return",
"self",
".",
"call",
"(",
"'truncateTable'",
",",
"table",
")"
] | Responsys.truncateTable call
Accepts:
InteractObject table
Returns True on success | [
"Responsys",
".",
"truncateTable",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L341-L350 | train | Responsys. truncateTable call |
jslang/responsys | responsys/client.py | InteractClient.delete_table_records | def delete_table_records(self, table, query_column, ids_to_delete):
""" Responsys.deleteTableRecords call
Accepts:
InteractObject table
string query_column
possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER'
list ids_to_delete
... | python | def delete_table_records(self, table, query_column, ids_to_delete):
""" Responsys.deleteTableRecords call
Accepts:
InteractObject table
string query_column
possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER'
list ids_to_delete
... | [
"def",
"delete_table_records",
"(",
"self",
",",
"table",
",",
"query_column",
",",
"ids_to_delete",
")",
":",
"table",
"=",
"table",
".",
"get_soap_object",
"(",
"self",
".",
"client",
")",
"result",
"=",
"self",
".",
"call",
"(",
"'deleteTableRecords'",
",... | Responsys.deleteTableRecords call
Accepts:
InteractObject table
string query_column
possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER'
list ids_to_delete
Returns a list of DeleteResult instances | [
"Responsys",
".",
"deleteTableRecords",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L352-L367 | train | Responsys. deleteTableRecords call |
jslang/responsys | responsys/client.py | InteractClient.merge_table_records | def merge_table_records(self, table, record_data, match_column_names):
""" Responsys.mergeTableRecords call
Accepts:
InteractObject table
RecordData record_data
list match_column_names
Returns a MergeResult
"""
table = table.get_soap_object(s... | python | def merge_table_records(self, table, record_data, match_column_names):
""" Responsys.mergeTableRecords call
Accepts:
InteractObject table
RecordData record_data
list match_column_names
Returns a MergeResult
"""
table = table.get_soap_object(s... | [
"def",
"merge_table_records",
"(",
"self",
",",
"table",
",",
"record_data",
",",
"match_column_names",
")",
":",
"table",
"=",
"table",
".",
"get_soap_object",
"(",
"self",
".",
"client",
")",
"record_data",
"=",
"record_data",
".",
"get_soap_object",
"(",
"s... | Responsys.mergeTableRecords call
Accepts:
InteractObject table
RecordData record_data
list match_column_names
Returns a MergeResult | [
"Responsys",
".",
"mergeTableRecords",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L369-L382 | train | This method merges the records in a table. |
jslang/responsys | responsys/client.py | InteractClient.merge_table_records_with_pk | def merge_table_records_with_pk(self, table, record_data, insert_on_no_match, update_on_match):
""" Responsys.mergeTableRecordsWithPK call
Accepts:
InteractObject table
RecordData record_data
string insert_on_no_match
string update_on_match
Retur... | python | def merge_table_records_with_pk(self, table, record_data, insert_on_no_match, update_on_match):
""" Responsys.mergeTableRecordsWithPK call
Accepts:
InteractObject table
RecordData record_data
string insert_on_no_match
string update_on_match
Retur... | [
"def",
"merge_table_records_with_pk",
"(",
"self",
",",
"table",
",",
"record_data",
",",
"insert_on_no_match",
",",
"update_on_match",
")",
":",
"table",
"=",
"table",
".",
"get_soap_object",
"(",
"self",
".",
"client",
")",
"record_data",
"=",
"record_data",
"... | Responsys.mergeTableRecordsWithPK call
Accepts:
InteractObject table
RecordData record_data
string insert_on_no_match
string update_on_match
Returns a MergeResult | [
"Responsys",
".",
"mergeTableRecordsWithPK",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L384-L398 | train | This method performs the Merge Table Records With PK. |
jslang/responsys | responsys/client.py | InteractClient.merge_into_profile_extension | def merge_into_profile_extension(self, profile_extension, record_data, match_column,
insert_on_no_match, update_on_match):
""" Responsys.mergeIntoProfileExtension call
Accepts:
InteractObject profile_extension
RecordData record_data
... | python | def merge_into_profile_extension(self, profile_extension, record_data, match_column,
insert_on_no_match, update_on_match):
""" Responsys.mergeIntoProfileExtension call
Accepts:
InteractObject profile_extension
RecordData record_data
... | [
"def",
"merge_into_profile_extension",
"(",
"self",
",",
"profile_extension",
",",
"record_data",
",",
"match_column",
",",
"insert_on_no_match",
",",
"update_on_match",
")",
":",
"profile_extension",
"=",
"profile_extension",
".",
"get_soap_object",
"(",
"self",
".",
... | Responsys.mergeIntoProfileExtension call
Accepts:
InteractObject profile_extension
RecordData record_data
string match_column
string insert_on_no_match
string update_on_match
Returns a RecipientResult | [
"Responsys",
".",
"mergeIntoProfileExtension",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L400-L418 | train | This method is used to merge into a profile extension. |
jslang/responsys | responsys/client.py | InteractClient.retrieve_table_records | def retrieve_table_records(self, table, query_column, field_list, ids_to_retrieve):
""" Responsys.retrieveTableRecords call
Accepts:
InteractObject table
string query_column
possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER'
list fi... | python | def retrieve_table_records(self, table, query_column, field_list, ids_to_retrieve):
""" Responsys.retrieveTableRecords call
Accepts:
InteractObject table
string query_column
possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER'
list fi... | [
"def",
"retrieve_table_records",
"(",
"self",
",",
"table",
",",
"query_column",
",",
"field_list",
",",
"ids_to_retrieve",
")",
":",
"table",
"=",
"table",
".",
"get_soap_object",
"(",
"self",
".",
"client",
")",
"return",
"RecordData",
".",
"from_soap_type",
... | Responsys.retrieveTableRecords call
Accepts:
InteractObject table
string query_column
possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER'
list field_list
list ids_to_retrieve
Returns a RecordData | [
"Responsys",
".",
"retrieveTableRecords",
"call"
] | 9b355a444c0c75dff41064502c1e2b76dfd5cb93 | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L420-L434 | train | This method returns a list of records from a table. |
bluekeyes/sphinx-javalink | javalink/ref.py | normalize_docroot | def normalize_docroot(app, root):
"""Creates a package-list URL and a link base from a docroot element.
Args:
app: the global app object
root: the docroot element [string or dictionary]
"""
srcdir = app.env.srcdir
default_version = app.config.javalink_default_version
if isinst... | python | def normalize_docroot(app, root):
"""Creates a package-list URL and a link base from a docroot element.
Args:
app: the global app object
root: the docroot element [string or dictionary]
"""
srcdir = app.env.srcdir
default_version = app.config.javalink_default_version
if isinst... | [
"def",
"normalize_docroot",
"(",
"app",
",",
"root",
")",
":",
"srcdir",
"=",
"app",
".",
"env",
".",
"srcdir",
"default_version",
"=",
"app",
".",
"config",
".",
"javalink_default_version",
"if",
"isinstance",
"(",
"root",
",",
"basestring",
")",
":",
"("... | Creates a package-list URL and a link base from a docroot element.
Args:
app: the global app object
root: the docroot element [string or dictionary] | [
"Creates",
"a",
"package",
"-",
"list",
"URL",
"and",
"a",
"link",
"base",
"from",
"a",
"docroot",
"element",
"."
] | 490e37506efa53e95ad88a665e347536e75b6254 | https://github.com/bluekeyes/sphinx-javalink/blob/490e37506efa53e95ad88a665e347536e75b6254/javalink/ref.py#L296-L324 | train | Normalizes a docroot element. |
mojaie/chorus | chorus/descriptor.py | assign_valence | def assign_valence(mol):
"""Assign pi electron and hydrogens"""
for u, v, bond in mol.bonds_iter():
if bond.order == 2:
mol.atom(u).pi = 1
mol.atom(v).pi = 1
if mol.atom(u).symbol == "O" and not mol.atom(u).charge:
mol.atom(v).carbonyl_C = 1
... | python | def assign_valence(mol):
"""Assign pi electron and hydrogens"""
for u, v, bond in mol.bonds_iter():
if bond.order == 2:
mol.atom(u).pi = 1
mol.atom(v).pi = 1
if mol.atom(u).symbol == "O" and not mol.atom(u).charge:
mol.atom(v).carbonyl_C = 1
... | [
"def",
"assign_valence",
"(",
"mol",
")",
":",
"for",
"u",
",",
"v",
",",
"bond",
"in",
"mol",
".",
"bonds_iter",
"(",
")",
":",
"if",
"bond",
".",
"order",
"==",
"2",
":",
"mol",
".",
"atom",
"(",
"u",
")",
".",
"pi",
"=",
"1",
"mol",
".",
... | Assign pi electron and hydrogens | [
"Assign",
"pi",
"electron",
"and",
"hydrogens"
] | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/descriptor.py#L10-L32 | train | Assign pi electron and hydrogens to all the species. |
mojaie/chorus | chorus/descriptor.py | assign_rotatable | def assign_rotatable(mol):
"""Assign rotatable bonds (single and not terminal and not in ring)"""
mol.require("Valence")
mol.require("Topology")
bs = set([(u, v) for u, v, _ in mol.bonds_iter()])
for r in mol.rings:
for a, b in iterator.consecutive(r + [r[0]], 2):
bs -= {(a, b)}
... | python | def assign_rotatable(mol):
"""Assign rotatable bonds (single and not terminal and not in ring)"""
mol.require("Valence")
mol.require("Topology")
bs = set([(u, v) for u, v, _ in mol.bonds_iter()])
for r in mol.rings:
for a, b in iterator.consecutive(r + [r[0]], 2):
bs -= {(a, b)}
... | [
"def",
"assign_rotatable",
"(",
"mol",
")",
":",
"mol",
".",
"require",
"(",
"\"Valence\"",
")",
"mol",
".",
"require",
"(",
"\"Topology\"",
")",
"bs",
"=",
"set",
"(",
"[",
"(",
"u",
",",
"v",
")",
"for",
"u",
",",
"v",
",",
"_",
"in",
"mol",
... | Assign rotatable bonds (single and not terminal and not in ring) | [
"Assign",
"rotatable",
"bonds",
"(",
"single",
"and",
"not",
"terminal",
"and",
"not",
"in",
"ring",
")"
] | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/descriptor.py#L35-L50 | train | Assign rotatable bonds to the next non - terminal one. |
mojaie/chorus | chorus/descriptor.py | assign_aromatic | def assign_aromatic(mol):
"""Assign aromatic ring
sp2 atom:
pi=1 -> +1
N, O, S, C- -> +2
>C=O, B, C+ -> 0
sp3 atom -> not aromatic
sum of the score satisfies 4n+2 -> aromatic
"""
mol.require("Valence")
mol.require("MinifiedRing")
for ring in mol.rings:
pi_cnt = 0
... | python | def assign_aromatic(mol):
"""Assign aromatic ring
sp2 atom:
pi=1 -> +1
N, O, S, C- -> +2
>C=O, B, C+ -> 0
sp3 atom -> not aromatic
sum of the score satisfies 4n+2 -> aromatic
"""
mol.require("Valence")
mol.require("MinifiedRing")
for ring in mol.rings:
pi_cnt = 0
... | [
"def",
"assign_aromatic",
"(",
"mol",
")",
":",
"mol",
".",
"require",
"(",
"\"Valence\"",
")",
"mol",
".",
"require",
"(",
"\"MinifiedRing\"",
")",
"for",
"ring",
"in",
"mol",
".",
"rings",
":",
"pi_cnt",
"=",
"0",
"for",
"r",
"in",
"ring",
":",
"if... | Assign aromatic ring
sp2 atom:
pi=1 -> +1
N, O, S, C- -> +2
>C=O, B, C+ -> 0
sp3 atom -> not aromatic
sum of the score satisfies 4n+2 -> aromatic | [
"Assign",
"aromatic",
"ring",
"sp2",
"atom",
":",
"pi",
"=",
"1",
"-",
">",
"+",
"1",
"N",
"O",
"S",
"C",
"-",
"-",
">",
"+",
"2",
">",
"C",
"=",
"O",
"B",
"C",
"+",
"-",
">",
"0",
"sp3",
"atom",
"-",
">",
"not",
"aromatic",
"sum",
"of",
... | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/descriptor.py#L53-L96 | train | Assign aromatic ring to aromatic molecule. |
mojaie/chorus | chorus/descriptor.py | assign_charge | def assign_charge(mol, force_recalc=False):
"""Assign charges in physiological condition"""
# TODO: not implemented yet
mol.require("Aromatic")
for i, nbrs in mol.neighbors_iter():
atom = mol.atom(i)
nbrcnt = len(nbrs)
if atom.symbol == "N":
if not atom.pi:
... | python | def assign_charge(mol, force_recalc=False):
"""Assign charges in physiological condition"""
# TODO: not implemented yet
mol.require("Aromatic")
for i, nbrs in mol.neighbors_iter():
atom = mol.atom(i)
nbrcnt = len(nbrs)
if atom.symbol == "N":
if not atom.pi:
... | [
"def",
"assign_charge",
"(",
"mol",
",",
"force_recalc",
"=",
"False",
")",
":",
"# TODO: not implemented yet",
"mol",
".",
"require",
"(",
"\"Aromatic\"",
")",
"for",
"i",
",",
"nbrs",
"in",
"mol",
".",
"neighbors_iter",
"(",
")",
":",
"atom",
"=",
"mol",... | Assign charges in physiological condition | [
"Assign",
"charges",
"in",
"physiological",
"condition"
] | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/descriptor.py#L99-L146 | train | Assign charges in physiological condition |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/taskutils.py | get_type | def get_type(type_name):
"""Get a type given its importable name.
Parameters
----------
task_name : `str`
Name of the Python type, such as ``mypackage.MyClass``.
Returns
-------
object
The object.
"""
parts = type_name.split('.')
if len(parts) < 2:
raise... | python | def get_type(type_name):
"""Get a type given its importable name.
Parameters
----------
task_name : `str`
Name of the Python type, such as ``mypackage.MyClass``.
Returns
-------
object
The object.
"""
parts = type_name.split('.')
if len(parts) < 2:
raise... | [
"def",
"get_type",
"(",
"type_name",
")",
":",
"parts",
"=",
"type_name",
".",
"split",
"(",
"'.'",
")",
"if",
"len",
"(",
"parts",
")",
"<",
"2",
":",
"raise",
"SphinxError",
"(",
"'Type must be fully-qualified, '",
"'of the form ``module.MyClass``. Got: {}'",
... | Get a type given its importable name.
Parameters
----------
task_name : `str`
Name of the Python type, such as ``mypackage.MyClass``.
Returns
-------
object
The object. | [
"Get",
"a",
"type",
"given",
"its",
"importable",
"name",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L35-L56 | train | Get a type given its importable name. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/taskutils.py | get_task_config_fields | def get_task_config_fields(config_class):
"""Get all configuration Fields from a Config class.
Parameters
----------
config_class : ``lsst.pipe.base.Config``-type
The configuration class (not an instance) corresponding to a Task.
Returns
-------
config_fields : `dict`
Mappi... | python | def get_task_config_fields(config_class):
"""Get all configuration Fields from a Config class.
Parameters
----------
config_class : ``lsst.pipe.base.Config``-type
The configuration class (not an instance) corresponding to a Task.
Returns
-------
config_fields : `dict`
Mappi... | [
"def",
"get_task_config_fields",
"(",
"config_class",
")",
":",
"from",
"lsst",
".",
"pex",
".",
"config",
"import",
"Field",
"def",
"is_config_field",
"(",
"obj",
")",
":",
"return",
"isinstance",
"(",
"obj",
",",
"Field",
")",
"return",
"_get_alphabetical_me... | Get all configuration Fields from a Config class.
Parameters
----------
config_class : ``lsst.pipe.base.Config``-type
The configuration class (not an instance) corresponding to a Task.
Returns
-------
config_fields : `dict`
Mapping where keys are the config attribute names and ... | [
"Get",
"all",
"configuration",
"Fields",
"from",
"a",
"Config",
"class",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L59-L79 | train | Get all configuration Fields from a Config class. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/taskutils.py | get_subtask_fields | def get_subtask_fields(config_class):
"""Get all configurable subtask fields from a Config class.
Parameters
----------
config_class : ``lsst.pipe.base.Config``-type
The configuration class (not an instance) corresponding to a Task.
Returns
-------
subtask_fields : `dict`
M... | python | def get_subtask_fields(config_class):
"""Get all configurable subtask fields from a Config class.
Parameters
----------
config_class : ``lsst.pipe.base.Config``-type
The configuration class (not an instance) corresponding to a Task.
Returns
-------
subtask_fields : `dict`
M... | [
"def",
"get_subtask_fields",
"(",
"config_class",
")",
":",
"from",
"lsst",
".",
"pex",
".",
"config",
"import",
"ConfigurableField",
",",
"RegistryField",
"def",
"is_subtask_field",
"(",
"obj",
")",
":",
"return",
"isinstance",
"(",
"obj",
",",
"(",
"Configur... | Get all configurable subtask fields from a Config class.
Parameters
----------
config_class : ``lsst.pipe.base.Config``-type
The configuration class (not an instance) corresponding to a Task.
Returns
-------
subtask_fields : `dict`
Mapping where keys are the config attribute na... | [
"Get",
"all",
"configurable",
"subtask",
"fields",
"from",
"a",
"Config",
"class",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L82-L103 | train | Get all configurable subtask fields from a Config class. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/taskutils.py | _get_alphabetical_members | def _get_alphabetical_members(obj, predicate):
"""Get members of an object, sorted alphabetically.
Parameters
----------
obj
An object.
predicate : callable
Callable that takes an attribute and returns a bool of whether the
attribute should be returned or not.
Returns
... | python | def _get_alphabetical_members(obj, predicate):
"""Get members of an object, sorted alphabetically.
Parameters
----------
obj
An object.
predicate : callable
Callable that takes an attribute and returns a bool of whether the
attribute should be returned or not.
Returns
... | [
"def",
"_get_alphabetical_members",
"(",
"obj",
",",
"predicate",
")",
":",
"fields",
"=",
"dict",
"(",
"inspect",
".",
"getmembers",
"(",
"obj",
",",
"predicate",
")",
")",
"keys",
"=",
"list",
"(",
"fields",
".",
"keys",
"(",
")",
")",
"keys",
".",
... | Get members of an object, sorted alphabetically.
Parameters
----------
obj
An object.
predicate : callable
Callable that takes an attribute and returns a bool of whether the
attribute should be returned or not.
Returns
-------
members : `dict`
Dictionary of
... | [
"Get",
"members",
"of",
"an",
"object",
"sorted",
"alphabetically",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L106-L138 | train | Get members of an object sorted alphabetically. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/taskutils.py | typestring | def typestring(obj):
"""Make a string for the object's type
Parameters
----------
obj : obj
Python object.
Returns
-------
`str`
String representation of the object's type. This is the type's
importable namespace.
Examples
--------
>>> import docutils.n... | python | def typestring(obj):
"""Make a string for the object's type
Parameters
----------
obj : obj
Python object.
Returns
-------
`str`
String representation of the object's type. This is the type's
importable namespace.
Examples
--------
>>> import docutils.n... | [
"def",
"typestring",
"(",
"obj",
")",
":",
"obj_type",
"=",
"type",
"(",
"obj",
")",
"return",
"'.'",
".",
"join",
"(",
"(",
"obj_type",
".",
"__module__",
",",
"obj_type",
".",
"__name__",
")",
")"
] | Make a string for the object's type
Parameters
----------
obj : obj
Python object.
Returns
-------
`str`
String representation of the object's type. This is the type's
importable namespace.
Examples
--------
>>> import docutils.nodes
>>> para = docutils... | [
"Make",
"a",
"string",
"for",
"the",
"object",
"s",
"type"
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L141-L163 | train | Make a string for the object s type. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/taskutils.py | get_docstring | def get_docstring(obj):
"""Extract the docstring from an object as individual lines.
Parameters
----------
obj : object
The Python object (class, function or method) to extract docstrings
from.
Returns
-------
lines : `list` of `str`
Individual docstring lines with ... | python | def get_docstring(obj):
"""Extract the docstring from an object as individual lines.
Parameters
----------
obj : object
The Python object (class, function or method) to extract docstrings
from.
Returns
-------
lines : `list` of `str`
Individual docstring lines with ... | [
"def",
"get_docstring",
"(",
"obj",
")",
":",
"docstring",
"=",
"getdoc",
"(",
"obj",
",",
"allow_inherited",
"=",
"True",
")",
"if",
"docstring",
"is",
"None",
":",
"logger",
"=",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"warning",
"(",
"\"Obje... | Extract the docstring from an object as individual lines.
Parameters
----------
obj : object
The Python object (class, function or method) to extract docstrings
from.
Returns
-------
lines : `list` of `str`
Individual docstring lines with common indentation removed, and... | [
"Extract",
"the",
"docstring",
"from",
"an",
"object",
"as",
"individual",
"lines",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L166-L193 | train | Extract the docstring from an object. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/taskutils.py | extract_docstring_summary | def extract_docstring_summary(docstring):
"""Get the first summary sentence from a docstring.
Parameters
----------
docstring : `list` of `str`
Output from `get_docstring`.
Returns
-------
summary : `str`
The plain-text summary sentence from the docstring.
"""
summa... | python | def extract_docstring_summary(docstring):
"""Get the first summary sentence from a docstring.
Parameters
----------
docstring : `list` of `str`
Output from `get_docstring`.
Returns
-------
summary : `str`
The plain-text summary sentence from the docstring.
"""
summa... | [
"def",
"extract_docstring_summary",
"(",
"docstring",
")",
":",
"summary_lines",
"=",
"[",
"]",
"for",
"line",
"in",
"docstring",
":",
"if",
"line",
"==",
"''",
":",
"break",
"else",
":",
"summary_lines",
".",
"append",
"(",
"line",
")",
"return",
"' '",
... | Get the first summary sentence from a docstring.
Parameters
----------
docstring : `list` of `str`
Output from `get_docstring`.
Returns
-------
summary : `str`
The plain-text summary sentence from the docstring. | [
"Get",
"the",
"first",
"summary",
"sentence",
"from",
"a",
"docstring",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L196-L215 | train | Extract the first summary sentence from a docstring. |
ehansis/ozelot | examples/superheroes/superheroes/pipeline.py | get_attribute_data | def get_attribute_data(doc):
"""Helper function: parse attribute data from a wiki html doc
Args:
doc (document parsed with lxml.html): parsed wiki page
Returns:
dict: attributes values and listed links, format ``{<key>: {'value': <value>, 'link': <link>}}``;
only the first hy... | python | def get_attribute_data(doc):
"""Helper function: parse attribute data from a wiki html doc
Args:
doc (document parsed with lxml.html): parsed wiki page
Returns:
dict: attributes values and listed links, format ``{<key>: {'value': <value>, 'link': <link>}}``;
only the first hy... | [
"def",
"get_attribute_data",
"(",
"doc",
")",
":",
"attributes",
"=",
"dict",
"(",
")",
"for",
"attribute_node",
"in",
"doc",
".",
"xpath",
"(",
"\"//div[contains(@class, 'pi-data ')]\"",
")",
":",
"# label node",
"node",
"=",
"attribute_node",
".",
"xpath",
"("... | Helper function: parse attribute data from a wiki html doc
Args:
doc (document parsed with lxml.html): parsed wiki page
Returns:
dict: attributes values and listed links, format ``{<key>: {'value': <value>, 'link': <link>}}``;
only the first hyperlink listed in each attribute val... | [
"Helper",
"function",
":",
"parse",
"attribute",
"data",
"from",
"a",
"wiki",
"html",
"doc"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/superheroes/superheroes/pipeline.py#L123-L157 | train | Parse the attribute data from a wiki html document |
ehansis/ozelot | examples/superheroes/superheroes/pipeline.py | LoadMovieAppearances.run | def run(self):
"""Run loading of movie appearances.
The wiki page structure for this part cannot be easily handled by simple xpath queries.
We need to iterate over the respective portion of the page and parse appearances.
"""
# make all requests via a cache instance
req... | python | def run(self):
"""Run loading of movie appearances.
The wiki page structure for this part cannot be easily handled by simple xpath queries.
We need to iterate over the respective portion of the page and parse appearances.
"""
# make all requests via a cache instance
req... | [
"def",
"run",
"(",
"self",
")",
":",
"# make all requests via a cache instance",
"request_cache",
"=",
"cache",
".",
"get_request_cache",
"(",
")",
"# DB session to operate in",
"session",
"=",
"client",
".",
"get_client",
"(",
")",
".",
"create_session",
"(",
")",
... | Run loading of movie appearances.
The wiki page structure for this part cannot be easily handled by simple xpath queries.
We need to iterate over the respective portion of the page and parse appearances. | [
"Run",
"loading",
"of",
"movie",
"appearances",
"."
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/superheroes/superheroes/pipeline.py#L635-L733 | train | Run loading of movie appearances. |
ehansis/ozelot | examples/superheroes/superheroes/pipeline.py | ConsumerPriceIndexFile.load | def load(self):
"""Load table
Keeps only rows with annual average defined (full year data available).
Returns:
pandas.DataFrame: loaded data
"""
df = pd.read_excel(self.input_file, skiprows=11)
df = df.dropna(subset=['Annual'])
return df | python | def load(self):
"""Load table
Keeps only rows with annual average defined (full year data available).
Returns:
pandas.DataFrame: loaded data
"""
df = pd.read_excel(self.input_file, skiprows=11)
df = df.dropna(subset=['Annual'])
return df | [
"def",
"load",
"(",
"self",
")",
":",
"df",
"=",
"pd",
".",
"read_excel",
"(",
"self",
".",
"input_file",
",",
"skiprows",
"=",
"11",
")",
"df",
"=",
"df",
".",
"dropna",
"(",
"subset",
"=",
"[",
"'Annual'",
"]",
")",
"return",
"df"
] | Load table
Keeps only rows with annual average defined (full year data available).
Returns:
pandas.DataFrame: loaded data | [
"Load",
"table"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/superheroes/superheroes/pipeline.py#L785-L795 | train | Load table
pandas. DataFrame |
ehansis/ozelot | examples/superheroes/superheroes/pipeline.py | InflationAdjustMovieBudgets.clear | def clear(self):
"""Clear task output: remove value ``budget_inflation_adjusted`` from all :class:`Movie` objects.
"""
self.mark_incomplete()
session = client.get_client().create_session()
movies = session.query(models.Movie)
movies.update({'budget_inflation_adjusted': N... | python | def clear(self):
"""Clear task output: remove value ``budget_inflation_adjusted`` from all :class:`Movie` objects.
"""
self.mark_incomplete()
session = client.get_client().create_session()
movies = session.query(models.Movie)
movies.update({'budget_inflation_adjusted': N... | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"mark_incomplete",
"(",
")",
"session",
"=",
"client",
".",
"get_client",
"(",
")",
".",
"create_session",
"(",
")",
"movies",
"=",
"session",
".",
"query",
"(",
"models",
".",
"Movie",
")",
"movies",... | Clear task output: remove value ``budget_inflation_adjusted`` from all :class:`Movie` objects. | [
"Clear",
"task",
"output",
":",
"remove",
"value",
"budget_inflation_adjusted",
"from",
"all",
":",
"class",
":",
"Movie",
"objects",
"."
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/superheroes/superheroes/pipeline.py#L806-L816 | train | Clear task output |
ehansis/ozelot | examples/superheroes/superheroes/pipeline.py | InflationAdjustMovieBudgets.run | def run(self):
"""Compute and store inflation-adjusted movie budgets
"""
self.mark_incomplete()
session = client.get_client().create_session()
# load CPI data
cpi = ConsumerPriceIndexFile().load()
# max year we have CPI data for
max_cpi_year = cpi['Year'... | python | def run(self):
"""Compute and store inflation-adjusted movie budgets
"""
self.mark_incomplete()
session = client.get_client().create_session()
# load CPI data
cpi = ConsumerPriceIndexFile().load()
# max year we have CPI data for
max_cpi_year = cpi['Year'... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"mark_incomplete",
"(",
")",
"session",
"=",
"client",
".",
"get_client",
"(",
")",
".",
"create_session",
"(",
")",
"# load CPI data",
"cpi",
"=",
"ConsumerPriceIndexFile",
"(",
")",
".",
"load",
"(",
")... | Compute and store inflation-adjusted movie budgets | [
"Compute",
"and",
"store",
"inflation",
"-",
"adjusted",
"movie",
"budgets"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/superheroes/superheroes/pipeline.py#L822-L850 | train | Compute and store inflation - adjusted movie budgets
|
potash/drain | drain/metrics.py | _argsort | def _argsort(y_score, k=None):
"""
Returns the indexes in descending order of the top k score
or all scores if k is None
"""
ranks = y_score.argsort()
argsort = ranks[::-1]
if k is not None:
argsort = argsort[0:k]
return argsort | python | def _argsort(y_score, k=None):
"""
Returns the indexes in descending order of the top k score
or all scores if k is None
"""
ranks = y_score.argsort()
argsort = ranks[::-1]
if k is not None:
argsort = argsort[0:k]
return argsort | [
"def",
"_argsort",
"(",
"y_score",
",",
"k",
"=",
"None",
")",
":",
"ranks",
"=",
"y_score",
".",
"argsort",
"(",
")",
"argsort",
"=",
"ranks",
"[",
":",
":",
"-",
"1",
"]",
"if",
"k",
"is",
"not",
"None",
":",
"argsort",
"=",
"argsort",
"[",
"... | Returns the indexes in descending order of the top k score
or all scores if k is None | [
"Returns",
"the",
"indexes",
"in",
"descending",
"order",
"of",
"the",
"top",
"k",
"score",
"or",
"all",
"scores",
"if",
"k",
"is",
"None"
] | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L16-L26 | train | Returns the indexes in descending order of the top k score
or all scores if k is None |
potash/drain | drain/metrics.py | _argtop | def _argtop(y_score, k=None):
"""
Returns the indexes of the top k scores (not necessarily sorted)
"""
# avoid sorting when just want the top all
if k is None:
return slice(0, len(y_score))
else:
return _argsort(y_score, k) | python | def _argtop(y_score, k=None):
"""
Returns the indexes of the top k scores (not necessarily sorted)
"""
# avoid sorting when just want the top all
if k is None:
return slice(0, len(y_score))
else:
return _argsort(y_score, k) | [
"def",
"_argtop",
"(",
"y_score",
",",
"k",
"=",
"None",
")",
":",
"# avoid sorting when just want the top all",
"if",
"k",
"is",
"None",
":",
"return",
"slice",
"(",
"0",
",",
"len",
"(",
"y_score",
")",
")",
"else",
":",
"return",
"_argsort",
"(",
"y_s... | Returns the indexes of the top k scores (not necessarily sorted) | [
"Returns",
"the",
"indexes",
"of",
"the",
"top",
"k",
"scores",
"(",
"not",
"necessarily",
"sorted",
")"
] | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L29-L37 | train | Returns the indexes of the top k scores |
potash/drain | drain/metrics.py | count | def count(y_true, y_score=None, countna=False):
"""
Counts the number of examples. If countna is False then only count labeled examples,
i.e. those with y_true not NaN
"""
if not countna:
return (~np.isnan(to_float(y_true))).sum()
else:
return len(y_true) | python | def count(y_true, y_score=None, countna=False):
"""
Counts the number of examples. If countna is False then only count labeled examples,
i.e. those with y_true not NaN
"""
if not countna:
return (~np.isnan(to_float(y_true))).sum()
else:
return len(y_true) | [
"def",
"count",
"(",
"y_true",
",",
"y_score",
"=",
"None",
",",
"countna",
"=",
"False",
")",
":",
"if",
"not",
"countna",
":",
"return",
"(",
"~",
"np",
".",
"isnan",
"(",
"to_float",
"(",
"y_true",
")",
")",
")",
".",
"sum",
"(",
")",
"else",
... | Counts the number of examples. If countna is False then only count labeled examples,
i.e. those with y_true not NaN | [
"Counts",
"the",
"number",
"of",
"examples",
".",
"If",
"countna",
"is",
"False",
"then",
"only",
"count",
"labeled",
"examples",
"i",
".",
"e",
".",
"those",
"with",
"y_true",
"not",
"NaN"
] | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L40-L48 | train | Counts the number of examples in a single resource set. |
potash/drain | drain/metrics.py | count_series | def count_series(y_true, y_score, countna=False):
"""
Returns series whose i-th entry is the number of examples in the top i
"""
y_true, y_score = to_float(y_true, y_score)
top = _argsort(y_score)
if not countna:
a = (~np.isnan(y_true[top])).cumsum()
else:
a = range(1, len(y... | python | def count_series(y_true, y_score, countna=False):
"""
Returns series whose i-th entry is the number of examples in the top i
"""
y_true, y_score = to_float(y_true, y_score)
top = _argsort(y_score)
if not countna:
a = (~np.isnan(y_true[top])).cumsum()
else:
a = range(1, len(y... | [
"def",
"count_series",
"(",
"y_true",
",",
"y_score",
",",
"countna",
"=",
"False",
")",
":",
"y_true",
",",
"y_score",
"=",
"to_float",
"(",
"y_true",
",",
"y_score",
")",
"top",
"=",
"_argsort",
"(",
"y_score",
")",
"if",
"not",
"countna",
":",
"a",
... | Returns series whose i-th entry is the number of examples in the top i | [
"Returns",
"series",
"whose",
"i",
"-",
"th",
"entry",
"is",
"the",
"number",
"of",
"examples",
"in",
"the",
"top",
"i"
] | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L51-L63 | train | Returns series whose i - th entry is the number of examples in the top i
. |
potash/drain | drain/metrics.py | baseline | def baseline(y_true, y_score=None):
"""
Number of positive labels divided by number of labels,
or zero if there are no labels
"""
if len(y_true) > 0:
return np.nansum(y_true)/count(y_true, countna=False)
else:
return 0.0 | python | def baseline(y_true, y_score=None):
"""
Number of positive labels divided by number of labels,
or zero if there are no labels
"""
if len(y_true) > 0:
return np.nansum(y_true)/count(y_true, countna=False)
else:
return 0.0 | [
"def",
"baseline",
"(",
"y_true",
",",
"y_score",
"=",
"None",
")",
":",
"if",
"len",
"(",
"y_true",
")",
">",
"0",
":",
"return",
"np",
".",
"nansum",
"(",
"y_true",
")",
"/",
"count",
"(",
"y_true",
",",
"countna",
"=",
"False",
")",
"else",
":... | Number of positive labels divided by number of labels,
or zero if there are no labels | [
"Number",
"of",
"positive",
"labels",
"divided",
"by",
"number",
"of",
"labels",
"or",
"zero",
"if",
"there",
"are",
"no",
"labels"
] | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L66-L74 | train | Calculate the baseline of the log - likelihood of a set of positive labels. |
potash/drain | drain/metrics.py | roc_auc | def roc_auc(y_true, y_score):
"""
Returns are under the ROC curve
"""
notnull = ~np.isnan(y_true)
fpr, tpr, thresholds = sklearn.metrics.roc_curve(y_true[notnull], y_score[notnull])
return sklearn.metrics.auc(fpr, tpr) | python | def roc_auc(y_true, y_score):
"""
Returns are under the ROC curve
"""
notnull = ~np.isnan(y_true)
fpr, tpr, thresholds = sklearn.metrics.roc_curve(y_true[notnull], y_score[notnull])
return sklearn.metrics.auc(fpr, tpr) | [
"def",
"roc_auc",
"(",
"y_true",
",",
"y_score",
")",
":",
"notnull",
"=",
"~",
"np",
".",
"isnan",
"(",
"y_true",
")",
"fpr",
",",
"tpr",
",",
"thresholds",
"=",
"sklearn",
".",
"metrics",
".",
"roc_curve",
"(",
"y_true",
"[",
"notnull",
"]",
",",
... | Returns are under the ROC curve | [
"Returns",
"are",
"under",
"the",
"ROC",
"curve"
] | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L77-L83 | train | Returns are under the ROC curve |
potash/drain | drain/metrics.py | precision | def precision(y_true, y_score, k=None, return_bounds=False):
"""
If return_bounds is False then returns precision on the
labeled examples in the top k.
If return_bounds is True the returns a tuple containing:
- precision on the labeled examples in the top k
- number of labeled exampl... | python | def precision(y_true, y_score, k=None, return_bounds=False):
"""
If return_bounds is False then returns precision on the
labeled examples in the top k.
If return_bounds is True the returns a tuple containing:
- precision on the labeled examples in the top k
- number of labeled exampl... | [
"def",
"precision",
"(",
"y_true",
",",
"y_score",
",",
"k",
"=",
"None",
",",
"return_bounds",
"=",
"False",
")",
":",
"y_true",
",",
"y_score",
"=",
"to_float",
"(",
"y_true",
",",
"y_score",
")",
"top",
"=",
"_argtop",
"(",
"y_score",
",",
"k",
")... | If return_bounds is False then returns precision on the
labeled examples in the top k.
If return_bounds is True the returns a tuple containing:
- precision on the labeled examples in the top k
- number of labeled examples in the top k
- lower bound of precision in the top k, assuming... | [
"If",
"return_bounds",
"is",
"False",
"then",
"returns",
"precision",
"on",
"the",
"labeled",
"examples",
"in",
"the",
"top",
"k",
".",
"If",
"return_bounds",
"is",
"True",
"the",
"returns",
"a",
"tuple",
"containing",
":",
"-",
"precision",
"on",
"the",
"... | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L86-L110 | train | Returns the precision of the labeled examples in the top k. |
potash/drain | drain/metrics.py | precision_series | def precision_series(y_true, y_score, k=None):
"""
Returns series of length k whose i-th entry is the precision in the top i
TODO: extrapolate here
"""
y_true, y_score = to_float(y_true, y_score)
top = _argsort(y_score, k)
n = np.nan_to_num(y_true[top]).cumsum() # fill missing labels with ... | python | def precision_series(y_true, y_score, k=None):
"""
Returns series of length k whose i-th entry is the precision in the top i
TODO: extrapolate here
"""
y_true, y_score = to_float(y_true, y_score)
top = _argsort(y_score, k)
n = np.nan_to_num(y_true[top]).cumsum() # fill missing labels with ... | [
"def",
"precision_series",
"(",
"y_true",
",",
"y_score",
",",
"k",
"=",
"None",
")",
":",
"y_true",
",",
"y_score",
"=",
"to_float",
"(",
"y_true",
",",
"y_score",
")",
"top",
"=",
"_argsort",
"(",
"y_score",
",",
"k",
")",
"n",
"=",
"np",
".",
"n... | Returns series of length k whose i-th entry is the precision in the top i
TODO: extrapolate here | [
"Returns",
"series",
"of",
"length",
"k",
"whose",
"i",
"-",
"th",
"entry",
"is",
"the",
"precision",
"in",
"the",
"top",
"i",
"TODO",
":",
"extrapolate",
"here"
] | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L113-L123 | train | Returns a Pandas series of length k whose i - th entry is the precision in the top i - th entry. |
potash/drain | drain/metrics.py | recall | def recall(y_true, y_score, k=None, value=True):
"""
Returns recall (number of positive examples) in the top k
If value is False then counts number of negative examples
TODO: add prop argument to return recall proportion instead of count
"""
y_true, y_score = to_float(y_true, y_score)
top = ... | python | def recall(y_true, y_score, k=None, value=True):
"""
Returns recall (number of positive examples) in the top k
If value is False then counts number of negative examples
TODO: add prop argument to return recall proportion instead of count
"""
y_true, y_score = to_float(y_true, y_score)
top = ... | [
"def",
"recall",
"(",
"y_true",
",",
"y_score",
",",
"k",
"=",
"None",
",",
"value",
"=",
"True",
")",
":",
"y_true",
",",
"y_score",
"=",
"to_float",
"(",
"y_true",
",",
"y_score",
")",
"top",
"=",
"_argtop",
"(",
"y_score",
",",
"k",
")",
"if",
... | Returns recall (number of positive examples) in the top k
If value is False then counts number of negative examples
TODO: add prop argument to return recall proportion instead of count | [
"Returns",
"recall",
"(",
"number",
"of",
"positive",
"examples",
")",
"in",
"the",
"top",
"k",
"If",
"value",
"is",
"False",
"then",
"counts",
"number",
"of",
"negative",
"examples",
"TODO",
":",
"add",
"prop",
"argument",
"to",
"return",
"recall",
"propo... | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L126-L140 | train | Returns the recall of positive examples in the top k
|
potash/drain | drain/metrics.py | recall_series | def recall_series(y_true, y_score, k=None, value=True):
"""
Returns series of length k whose i-th entry is the recall in the top i
"""
y_true, y_score = to_float(y_true, y_score)
top = _argsort(y_score, k)
if not value:
y_true = 1-y_true
a = np.nan_to_num(y_true[top]).cumsum()
... | python | def recall_series(y_true, y_score, k=None, value=True):
"""
Returns series of length k whose i-th entry is the recall in the top i
"""
y_true, y_score = to_float(y_true, y_score)
top = _argsort(y_score, k)
if not value:
y_true = 1-y_true
a = np.nan_to_num(y_true[top]).cumsum()
... | [
"def",
"recall_series",
"(",
"y_true",
",",
"y_score",
",",
"k",
"=",
"None",
",",
"value",
"=",
"True",
")",
":",
"y_true",
",",
"y_score",
"=",
"to_float",
"(",
"y_true",
",",
"y_score",
")",
"top",
"=",
"_argsort",
"(",
"y_score",
",",
"k",
")",
... | Returns series of length k whose i-th entry is the recall in the top i | [
"Returns",
"series",
"of",
"length",
"k",
"whose",
"i",
"-",
"th",
"entry",
"is",
"the",
"recall",
"in",
"the",
"top",
"i"
] | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L143-L154 | train | Returns a pandas Series of length k whose i - th entry is the recall in the top i
|
hbldh/imdirect | imdirect/_autorotate.py | autorotate | def autorotate(image, orientation=None):
"""Rotate and return an image according to its Exif information.
ROTATION_NEEDED = {
1: 0,
2: 0 (Mirrored),
3: 180,
4: 180 (Mirrored),
5: -90 (Mirrored),
6: -90,
7: 90 (Mirrored),
8: 90,
}
Args:
... | python | def autorotate(image, orientation=None):
"""Rotate and return an image according to its Exif information.
ROTATION_NEEDED = {
1: 0,
2: 0 (Mirrored),
3: 180,
4: 180 (Mirrored),
5: -90 (Mirrored),
6: -90,
7: 90 (Mirrored),
8: 90,
}
Args:
... | [
"def",
"autorotate",
"(",
"image",
",",
"orientation",
"=",
"None",
")",
":",
"orientation_value",
"=",
"orientation",
"if",
"orientation",
"else",
"image",
".",
"_getexif",
"(",
")",
".",
"get",
"(",
"EXIF_KEYS",
".",
"get",
"(",
"'Orientation'",
")",
")"... | Rotate and return an image according to its Exif information.
ROTATION_NEEDED = {
1: 0,
2: 0 (Mirrored),
3: 180,
4: 180 (Mirrored),
5: -90 (Mirrored),
6: -90,
7: 90 (Mirrored),
8: 90,
}
Args:
image (PIL.Image.Image): PIL image to rota... | [
"Rotate",
"and",
"return",
"an",
"image",
"according",
"to",
"its",
"Exif",
"information",
"."
] | 12275b9f9faa6952cde2f2fe612bbefab215251a | https://github.com/hbldh/imdirect/blob/12275b9f9faa6952cde2f2fe612bbefab215251a/imdirect/_autorotate.py#L47-L89 | train | Rotate and return an image according to its Exif information. |
hbldh/imdirect | imdirect/_autorotate.py | update_exif_for_rotated_image | def update_exif_for_rotated_image(exif):
"""Modifies the Exif tag if rotation has been performed.
0th, 1st
--------
ImageWidth = 256
ImageLength = 257
XResolution = 282
YResolution = 283
TileWidth = 322
TileLength = 323
Exif
----
PixelXDimension = 40962
PixelYDimens... | python | def update_exif_for_rotated_image(exif):
"""Modifies the Exif tag if rotation has been performed.
0th, 1st
--------
ImageWidth = 256
ImageLength = 257
XResolution = 282
YResolution = 283
TileWidth = 322
TileLength = 323
Exif
----
PixelXDimension = 40962
PixelYDimens... | [
"def",
"update_exif_for_rotated_image",
"(",
"exif",
")",
":",
"orientation_value",
"=",
"exif",
".",
"get",
"(",
"'0th'",
",",
")",
".",
"get",
"(",
"piexif",
".",
"ImageIFD",
".",
"Orientation",
",",
"exif",
".",
"get",
"(",
"'1st'",
",",
")",
".",
"... | Modifies the Exif tag if rotation has been performed.
0th, 1st
--------
ImageWidth = 256
ImageLength = 257
XResolution = 282
YResolution = 283
TileWidth = 322
TileLength = 323
Exif
----
PixelXDimension = 40962
PixelYDimension = 40963
Args:
exif (dict): The ... | [
"Modifies",
"the",
"Exif",
"tag",
"if",
"rotation",
"has",
"been",
"performed",
"."
] | 12275b9f9faa6952cde2f2fe612bbefab215251a | https://github.com/hbldh/imdirect/blob/12275b9f9faa6952cde2f2fe612bbefab215251a/imdirect/_autorotate.py#L92-L165 | train | Updates the exif dict with the new values for the image rotation. |
hbldh/imdirect | imdirect/_autorotate.py | imdirect_open | def imdirect_open(fp):
"""Opens, identifies the given image file, and rotates it if it is a JPEG.
Note that this method does NOT employ the lazy loading methodology that
the PIL Images otherwise use. This is done to avoid having to save new
Args:
fp: A filename (string), pathlib.Path object or... | python | def imdirect_open(fp):
"""Opens, identifies the given image file, and rotates it if it is a JPEG.
Note that this method does NOT employ the lazy loading methodology that
the PIL Images otherwise use. This is done to avoid having to save new
Args:
fp: A filename (string), pathlib.Path object or... | [
"def",
"imdirect_open",
"(",
"fp",
")",
":",
"img",
"=",
"pil_open",
"(",
"fp",
",",
"'r'",
")",
"if",
"img",
".",
"format",
"==",
"'JPEG'",
":",
"# Read Exif tag on image.",
"if",
"isinstance",
"(",
"fp",
",",
"string_types",
")",
":",
"exif",
"=",
"p... | Opens, identifies the given image file, and rotates it if it is a JPEG.
Note that this method does NOT employ the lazy loading methodology that
the PIL Images otherwise use. This is done to avoid having to save new
Args:
fp: A filename (string), pathlib.Path object or a file-like object.
Retu... | [
"Opens",
"identifies",
"the",
"given",
"image",
"file",
"and",
"rotates",
"it",
"if",
"it",
"is",
"a",
"JPEG",
"."
] | 12275b9f9faa6952cde2f2fe612bbefab215251a | https://github.com/hbldh/imdirect/blob/12275b9f9faa6952cde2f2fe612bbefab215251a/imdirect/_autorotate.py#L168-L218 | train | Opens identifies the given image file and rotates it if it is a JPEG. |
hbldh/imdirect | imdirect/_autorotate.py | monkey_patch | def monkey_patch(enabled=True):
"""Monkey patching PIL.Image.open method
Args:
enabled (bool): If the monkey patch should be activated or deactivated.
"""
if enabled:
Image.open = imdirect_open
else:
Image.open = pil_open | python | def monkey_patch(enabled=True):
"""Monkey patching PIL.Image.open method
Args:
enabled (bool): If the monkey patch should be activated or deactivated.
"""
if enabled:
Image.open = imdirect_open
else:
Image.open = pil_open | [
"def",
"monkey_patch",
"(",
"enabled",
"=",
"True",
")",
":",
"if",
"enabled",
":",
"Image",
".",
"open",
"=",
"imdirect_open",
"else",
":",
"Image",
".",
"open",
"=",
"pil_open"
] | Monkey patching PIL.Image.open method
Args:
enabled (bool): If the monkey patch should be activated or deactivated. | [
"Monkey",
"patching",
"PIL",
".",
"Image",
".",
"open",
"method"
] | 12275b9f9faa6952cde2f2fe612bbefab215251a | https://github.com/hbldh/imdirect/blob/12275b9f9faa6952cde2f2fe612bbefab215251a/imdirect/_autorotate.py#L221-L232 | train | Monkey patching PIL. Image. open method. |
hbldh/imdirect | imdirect/_autorotate.py | save_with_exif_info | def save_with_exif_info(img, *args, **kwargs):
"""Saves an image using PIL, preserving the exif information.
Args:
img (PIL.Image.Image):
*args: The arguments for the `save` method of the Image class.
**kwargs: The keywords for the `save` method of the Image class.
"""
if 'exif... | python | def save_with_exif_info(img, *args, **kwargs):
"""Saves an image using PIL, preserving the exif information.
Args:
img (PIL.Image.Image):
*args: The arguments for the `save` method of the Image class.
**kwargs: The keywords for the `save` method of the Image class.
"""
if 'exif... | [
"def",
"save_with_exif_info",
"(",
"img",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'exif'",
"in",
"kwargs",
":",
"exif",
"=",
"kwargs",
".",
"pop",
"(",
"'exif'",
")",
"else",
":",
"exif",
"=",
"img",
".",
"info",
".",
"get",
"... | Saves an image using PIL, preserving the exif information.
Args:
img (PIL.Image.Image):
*args: The arguments for the `save` method of the Image class.
**kwargs: The keywords for the `save` method of the Image class. | [
"Saves",
"an",
"image",
"using",
"PIL",
"preserving",
"the",
"exif",
"information",
"."
] | 12275b9f9faa6952cde2f2fe612bbefab215251a | https://github.com/hbldh/imdirect/blob/12275b9f9faa6952cde2f2fe612bbefab215251a/imdirect/_autorotate.py#L235-L248 | train | Saves an image using PIL preserving the exif information. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.