repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
taborlab/FlowCal | FlowCal/plot.py | _LogicleTransform.transform_non_affine | def transform_non_affine(self, s):
"""
Apply transformation to a Nx1 numpy array.
Parameters
----------
s : array
Data to be transformed in display scale units.
Return
------
array or masked array
Transformed data, in data value u... | python | def transform_non_affine(self, s):
"""
Apply transformation to a Nx1 numpy array.
Parameters
----------
s : array
Data to be transformed in display scale units.
Return
------
array or masked array
Transformed data, in data value u... | [
"def",
"transform_non_affine",
"(",
"self",
",",
"s",
")",
":",
"T",
"=",
"self",
".",
"_T",
"M",
"=",
"self",
".",
"_M",
"W",
"=",
"self",
".",
"_W",
"p",
"=",
"self",
".",
"_p",
"# Calculate x",
"return",
"T",
"*",
"10",
"**",
"(",
"-",
"(",
... | Apply transformation to a Nx1 numpy array.
Parameters
----------
s : array
Data to be transformed in display scale units.
Return
------
array or masked array
Transformed data, in data value units. | [
"Apply",
"transformation",
"to",
"a",
"Nx1",
"numpy",
"array",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/plot.py#L349-L369 |
taborlab/FlowCal | FlowCal/plot.py | _LogicleLocator.set_params | def set_params(self, subs=None, numticks=None):
"""
Set parameters within this locator.
Parameters
----------
subs : array, optional
Subtick values, as multiples of the main ticks.
numticks : array, optional
Number of ticks.
"""
i... | python | def set_params(self, subs=None, numticks=None):
"""
Set parameters within this locator.
Parameters
----------
subs : array, optional
Subtick values, as multiples of the main ticks.
numticks : array, optional
Number of ticks.
"""
i... | [
"def",
"set_params",
"(",
"self",
",",
"subs",
"=",
"None",
",",
"numticks",
"=",
"None",
")",
":",
"if",
"numticks",
"is",
"not",
"None",
":",
"self",
".",
"numticks",
"=",
"numticks",
"if",
"subs",
"is",
"not",
"None",
":",
"self",
".",
"_subs",
... | Set parameters within this locator.
Parameters
----------
subs : array, optional
Subtick values, as multiples of the main ticks.
numticks : array, optional
Number of ticks. | [
"Set",
"parameters",
"within",
"this",
"locator",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/plot.py#L407-L422 |
taborlab/FlowCal | FlowCal/plot.py | _LogicleLocator.tick_values | def tick_values(self, vmin, vmax):
"""
Get a set of tick values properly spaced for logicle axis.
"""
# Extract base from transform object
b = self._transform.base
# The logicle domain is divided into two regions: A "linear" region,
# which may include negative n... | python | def tick_values(self, vmin, vmax):
"""
Get a set of tick values properly spaced for logicle axis.
"""
# Extract base from transform object
b = self._transform.base
# The logicle domain is divided into two regions: A "linear" region,
# which may include negative n... | [
"def",
"tick_values",
"(",
"self",
",",
"vmin",
",",
"vmax",
")",
":",
"# Extract base from transform object",
"b",
"=",
"self",
".",
"_transform",
".",
"base",
"# The logicle domain is divided into two regions: A \"linear\" region,",
"# which may include negative numbers, and ... | Get a set of tick values properly spaced for logicle axis. | [
"Get",
"a",
"set",
"of",
"tick",
"values",
"properly",
"spaced",
"for",
"logicle",
"axis",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/plot.py#L433-L608 |
taborlab/FlowCal | FlowCal/plot.py | _LogicleLocator.view_limits | def view_limits(self, vmin, vmax):
"""
Try to choose the view limits intelligently.
"""
b = self._transform.base
if vmax < vmin:
vmin, vmax = vmax, vmin
if not matplotlib.ticker.is_decade(abs(vmin), b):
if vmin < 0:
vmin = -matplo... | python | def view_limits(self, vmin, vmax):
"""
Try to choose the view limits intelligently.
"""
b = self._transform.base
if vmax < vmin:
vmin, vmax = vmax, vmin
if not matplotlib.ticker.is_decade(abs(vmin), b):
if vmin < 0:
vmin = -matplo... | [
"def",
"view_limits",
"(",
"self",
",",
"vmin",
",",
"vmax",
")",
":",
"b",
"=",
"self",
".",
"_transform",
".",
"base",
"if",
"vmax",
"<",
"vmin",
":",
"vmin",
",",
"vmax",
"=",
"vmax",
",",
"vmin",
"if",
"not",
"matplotlib",
".",
"ticker",
".",
... | Try to choose the view limits intelligently. | [
"Try",
"to",
"choose",
"the",
"view",
"limits",
"intelligently",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/plot.py#L611-L639 |
taborlab/FlowCal | FlowCal/plot.py | _LogicleScale.get_transform | def get_transform(self):
"""
Get a new object to perform the scaling transformation.
"""
return _InterpolatedInverseTransform(transform=self._transform,
smin=0,
smax=self._transform._M) | python | def get_transform(self):
"""
Get a new object to perform the scaling transformation.
"""
return _InterpolatedInverseTransform(transform=self._transform,
smin=0,
smax=self._transform._M) | [
"def",
"get_transform",
"(",
"self",
")",
":",
"return",
"_InterpolatedInverseTransform",
"(",
"transform",
"=",
"self",
".",
"_transform",
",",
"smin",
"=",
"0",
",",
"smax",
"=",
"self",
".",
"_transform",
".",
"_M",
")"
] | Get a new object to perform the scaling transformation. | [
"Get",
"a",
"new",
"object",
"to",
"perform",
"the",
"scaling",
"transformation",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/plot.py#L681-L688 |
taborlab/FlowCal | FlowCal/plot.py | _LogicleScale.set_default_locators_and_formatters | def set_default_locators_and_formatters(self, axis):
"""
Set up the locators and formatters for the scale.
Parameters
----------
axis: matplotlib.axis
Axis for which to set locators and formatters.
"""
axis.set_major_locator(_LogicleLocator(self._tra... | python | def set_default_locators_and_formatters(self, axis):
"""
Set up the locators and formatters for the scale.
Parameters
----------
axis: matplotlib.axis
Axis for which to set locators and formatters.
"""
axis.set_major_locator(_LogicleLocator(self._tra... | [
"def",
"set_default_locators_and_formatters",
"(",
"self",
",",
"axis",
")",
":",
"axis",
".",
"set_major_locator",
"(",
"_LogicleLocator",
"(",
"self",
".",
"_transform",
")",
")",
"axis",
".",
"set_minor_locator",
"(",
"_LogicleLocator",
"(",
"self",
".",
"_tr... | Set up the locators and formatters for the scale.
Parameters
----------
axis: matplotlib.axis
Axis for which to set locators and formatters. | [
"Set",
"up",
"the",
"locators",
"and",
"formatters",
"for",
"the",
"scale",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/plot.py#L690-L704 |
taborlab/FlowCal | FlowCal/plot.py | _LogicleScale.limit_range_for_scale | def limit_range_for_scale(self, vmin, vmax, minpos):
"""
Return minimum and maximum bounds for the logicle axis.
Parameters
----------
vmin : float
Minimum data value.
vmax : float
Maximum data value.
minpos : float
Minimum pos... | python | def limit_range_for_scale(self, vmin, vmax, minpos):
"""
Return minimum and maximum bounds for the logicle axis.
Parameters
----------
vmin : float
Minimum data value.
vmax : float
Maximum data value.
minpos : float
Minimum pos... | [
"def",
"limit_range_for_scale",
"(",
"self",
",",
"vmin",
",",
"vmax",
",",
"minpos",
")",
":",
"vmin_bound",
"=",
"self",
".",
"_transform",
".",
"transform_non_affine",
"(",
"0",
")",
"vmax_bound",
"=",
"self",
".",
"_transform",
".",
"transform_non_affine",... | Return minimum and maximum bounds for the logicle axis.
Parameters
----------
vmin : float
Minimum data value.
vmax : float
Maximum data value.
minpos : float
Minimum positive value in the data. Ignored by this function.
Return
... | [
"Return",
"minimum",
"and",
"maximum",
"bounds",
"for",
"the",
"logicle",
"axis",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/plot.py#L706-L731 |
taborlab/FlowCal | FlowCal/stats.py | mean | def mean(data, channels=None):
"""
Calculate the mean of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list o... | python | def mean(data, channels=None):
"""
Calculate the mean of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list o... | [
"def",
"mean",
"(",
"data",
",",
"channels",
"=",
"None",
")",
":",
"# Slice data to take statistics from",
"if",
"channels",
"is",
"None",
":",
"data_stats",
"=",
"data",
"else",
":",
"data_stats",
"=",
"data",
"[",
":",
",",
"channels",
"]",
"# Calculate a... | Calculate the mean of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list of int or list of str, optional
Chan... | [
"Calculate",
"the",
"mean",
"of",
"the",
"events",
"in",
"an",
"FCSData",
"object",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/stats.py#L9-L35 |
taborlab/FlowCal | FlowCal/stats.py | gmean | def gmean(data, channels=None):
"""
Calculate the geometric mean of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or st... | python | def gmean(data, channels=None):
"""
Calculate the geometric mean of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or st... | [
"def",
"gmean",
"(",
"data",
",",
"channels",
"=",
"None",
")",
":",
"# Slice data to take statistics from",
"if",
"channels",
"is",
"None",
":",
"data_stats",
"=",
"data",
"else",
":",
"data_stats",
"=",
"data",
"[",
":",
",",
"channels",
"]",
"# Calculate ... | Calculate the geometric mean of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list of int or list of str, optional
... | [
"Calculate",
"the",
"geometric",
"mean",
"of",
"the",
"events",
"in",
"an",
"FCSData",
"object",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/stats.py#L37-L64 |
taborlab/FlowCal | FlowCal/stats.py | median | def median(data, channels=None):
"""
Calculate the median of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or li... | python | def median(data, channels=None):
"""
Calculate the median of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or li... | [
"def",
"median",
"(",
"data",
",",
"channels",
"=",
"None",
")",
":",
"# Slice data to take statistics from",
"if",
"channels",
"is",
"None",
":",
"data_stats",
"=",
"data",
"else",
":",
"data_stats",
"=",
"data",
"[",
":",
",",
"channels",
"]",
"# Calculate... | Calculate the median of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list of int or list of str, optional
Ch... | [
"Calculate",
"the",
"median",
"of",
"the",
"events",
"in",
"an",
"FCSData",
"object",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/stats.py#L66-L92 |
taborlab/FlowCal | FlowCal/stats.py | mode | def mode(data, channels=None):
"""
Calculate the mode of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list o... | python | def mode(data, channels=None):
"""
Calculate the mode of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list o... | [
"def",
"mode",
"(",
"data",
",",
"channels",
"=",
"None",
")",
":",
"# Slice data to take statistics from",
"if",
"channels",
"is",
"None",
":",
"data_stats",
"=",
"data",
"else",
":",
"data_stats",
"=",
"data",
"[",
":",
",",
"channels",
"]",
"# Calculate a... | Calculate the mode of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list of int or list of str, optional
Chan... | [
"Calculate",
"the",
"mode",
"of",
"the",
"events",
"in",
"an",
"FCSData",
"object",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/stats.py#L94-L125 |
taborlab/FlowCal | FlowCal/stats.py | std | def std(data, channels=None):
"""
Calculate the standard deviation of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or ... | python | def std(data, channels=None):
"""
Calculate the standard deviation of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or ... | [
"def",
"std",
"(",
"data",
",",
"channels",
"=",
"None",
")",
":",
"# Slice data to take statistics from",
"if",
"channels",
"is",
"None",
":",
"data_stats",
"=",
"data",
"else",
":",
"data_stats",
"=",
"data",
"[",
":",
",",
"channels",
"]",
"# Calculate an... | Calculate the standard deviation of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list of int or list of str, optiona... | [
"Calculate",
"the",
"standard",
"deviation",
"of",
"the",
"events",
"in",
"an",
"FCSData",
"object",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/stats.py#L127-L154 |
taborlab/FlowCal | FlowCal/stats.py | cv | def cv(data, channels=None):
"""
Calculate the Coeff. of Variation of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or ... | python | def cv(data, channels=None):
"""
Calculate the Coeff. of Variation of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or ... | [
"def",
"cv",
"(",
"data",
",",
"channels",
"=",
"None",
")",
":",
"# Slice data to take statistics from",
"if",
"channels",
"is",
"None",
":",
"data_stats",
"=",
"data",
"else",
":",
"data_stats",
"=",
"data",
"[",
":",
",",
"channels",
"]",
"# Calculate and... | Calculate the Coeff. of Variation of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list of int or list of str, option... | [
"Calculate",
"the",
"Coeff",
".",
"of",
"Variation",
"of",
"the",
"events",
"in",
"an",
"FCSData",
"object",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/stats.py#L156-L188 |
taborlab/FlowCal | FlowCal/stats.py | gstd | def gstd(data, channels=None):
"""
Calculate the geometric std. dev. of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int o... | python | def gstd(data, channels=None):
"""
Calculate the geometric std. dev. of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int o... | [
"def",
"gstd",
"(",
"data",
",",
"channels",
"=",
"None",
")",
":",
"# Slice data to take statistics from",
"if",
"channels",
"is",
"None",
":",
"data_stats",
"=",
"data",
"else",
":",
"data_stats",
"=",
"data",
"[",
":",
",",
"channels",
"]",
"# Calculate a... | Calculate the geometric std. dev. of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list of int or list of str, option... | [
"Calculate",
"the",
"geometric",
"std",
".",
"dev",
".",
"of",
"the",
"events",
"in",
"an",
"FCSData",
"object",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/stats.py#L190-L217 |
taborlab/FlowCal | FlowCal/stats.py | gcv | def gcv(data, channels=None):
"""
Calculate the geometric CV of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or... | python | def gcv(data, channels=None):
"""
Calculate the geometric CV of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or... | [
"def",
"gcv",
"(",
"data",
",",
"channels",
"=",
"None",
")",
":",
"# Slice data to take statistics from",
"if",
"channels",
"is",
"None",
":",
"data_stats",
"=",
"data",
"else",
":",
"data_stats",
"=",
"data",
"[",
":",
",",
"channels",
"]",
"# Calculate an... | Calculate the geometric CV of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list of int or list of str, optional
... | [
"Calculate",
"the",
"geometric",
"CV",
"of",
"the",
"events",
"in",
"an",
"FCSData",
"object",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/stats.py#L219-L246 |
taborlab/FlowCal | FlowCal/stats.py | iqr | def iqr(data, channels=None):
"""
Calculate the Interquartile Range of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or... | python | def iqr(data, channels=None):
"""
Calculate the Interquartile Range of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or... | [
"def",
"iqr",
"(",
"data",
",",
"channels",
"=",
"None",
")",
":",
"# Slice data to take statistics from",
"if",
"channels",
"is",
"None",
":",
"data_stats",
"=",
"data",
"else",
":",
"data_stats",
"=",
"data",
"[",
":",
",",
"channels",
"]",
"# Calculate an... | Calculate the Interquartile Range of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list of int or list of str, option... | [
"Calculate",
"the",
"Interquartile",
"Range",
"of",
"the",
"events",
"in",
"an",
"FCSData",
"object",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/stats.py#L248-L281 |
taborlab/FlowCal | FlowCal/stats.py | rcv | def rcv(data, channels=None):
"""
Calculate the RCV of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list of ... | python | def rcv(data, channels=None):
"""
Calculate the RCV of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list of ... | [
"def",
"rcv",
"(",
"data",
",",
"channels",
"=",
"None",
")",
":",
"# Slice data to take statistics from",
"if",
"channels",
"is",
"None",
":",
"data_stats",
"=",
"data",
"else",
":",
"data_stats",
"=",
"data",
"[",
":",
",",
"channels",
"]",
"# Calculate an... | Calculate the RCV of the events in an FCSData object.
Parameters
----------
data : FCSData or numpy array
NxD flow cytometry data where N is the number of events and D is
the number of parameters (aka channels).
channels : int or str or list of int or list of str, optional
Chann... | [
"Calculate",
"the",
"RCV",
"of",
"the",
"events",
"in",
"an",
"FCSData",
"object",
"."
] | train | https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/stats.py#L283-L316 |
base4sistemas/satcomum | satcomum/ersat.py | dados_qrcode | def dados_qrcode(cfe):
"""Compila os dados que compõem o QRCode do CF-e-SAT, conforme a
documentação técnica oficial **Guia para Geração do QRCode pelo Aplicativo
Comercial**, a partir de uma instância de ``ElementTree`` que represente a
árvore do XML do CF-e-SAT.
:param cfe: Instância de :py:mod:`... | python | def dados_qrcode(cfe):
"""Compila os dados que compõem o QRCode do CF-e-SAT, conforme a
documentação técnica oficial **Guia para Geração do QRCode pelo Aplicativo
Comercial**, a partir de uma instância de ``ElementTree`` que represente a
árvore do XML do CF-e-SAT.
:param cfe: Instância de :py:mod:`... | [
"def",
"dados_qrcode",
"(",
"cfe",
")",
":",
"infCFe",
"=",
"cfe",
".",
"getroot",
"(",
")",
".",
"find",
"(",
"'./infCFe'",
")",
"cnpjcpf_consumidor",
"=",
"infCFe",
".",
"findtext",
"(",
"'dest/CNPJ'",
")",
"or",
"infCFe",
".",
"findtext",
"(",
"'dest/... | Compila os dados que compõem o QRCode do CF-e-SAT, conforme a
documentação técnica oficial **Guia para Geração do QRCode pelo Aplicativo
Comercial**, a partir de uma instância de ``ElementTree`` que represente a
árvore do XML do CF-e-SAT.
:param cfe: Instância de :py:mod:`xml.etree.ElementTree.ElementT... | [
"Compila",
"os",
"dados",
"que",
"compõem",
"o",
"QRCode",
"do",
"CF",
"-",
"e",
"-",
"SAT",
"conforme",
"a",
"documentação",
"técnica",
"oficial",
"**",
"Guia",
"para",
"Geração",
"do",
"QRCode",
"pelo",
"Aplicativo",
"Comercial",
"**",
"a",
"partir",
"de... | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/ersat.py#L45-L79 |
base4sistemas/satcomum | satcomum/ersat.py | ChaveCFeSAT.partes | def partes(self, num_partes=11):
"""Particiona a chave do CF-e-SAT em uma lista de *n* segmentos.
:param int num_partes: O número de segmentos (partes) em que os digitos
da chave do CF-e-SAT serão particionados. **Esse número deverá
resultar em uma divisão inteira por 44 (o comp... | python | def partes(self, num_partes=11):
"""Particiona a chave do CF-e-SAT em uma lista de *n* segmentos.
:param int num_partes: O número de segmentos (partes) em que os digitos
da chave do CF-e-SAT serão particionados. **Esse número deverá
resultar em uma divisão inteira por 44 (o comp... | [
"def",
"partes",
"(",
"self",
",",
"num_partes",
"=",
"11",
")",
":",
"assert",
"44",
"%",
"num_partes",
"==",
"0",
",",
"'O numero de partes nao produz um '",
"'resultado inteiro (partes por 44 digitos): '",
"'num_partes=%s'",
"%",
"num_partes",
"salto",
"=",
"44",
... | Particiona a chave do CF-e-SAT em uma lista de *n* segmentos.
:param int num_partes: O número de segmentos (partes) em que os digitos
da chave do CF-e-SAT serão particionados. **Esse número deverá
resultar em uma divisão inteira por 44 (o comprimento da chave)**.
Se não for ... | [
"Particiona",
"a",
"chave",
"do",
"CF",
"-",
"e",
"-",
"SAT",
"em",
"uma",
"lista",
"de",
"*",
"n",
"*",
"segmentos",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/ersat.py#L237-L255 |
base4sistemas/satcomum | satcomum/util.py | texto_decimal | def texto_decimal(valor, remover_zeros=True):
"""Converte um valor :py:class:`decimal.Decimal` para texto, com a opção de
remover os zeros à direita não significativos. A conversão para texto irá
considerar o :py:module:`locale` para converter o texto pronto para
apresentação.
:param decimal.Decima... | python | def texto_decimal(valor, remover_zeros=True):
"""Converte um valor :py:class:`decimal.Decimal` para texto, com a opção de
remover os zeros à direita não significativos. A conversão para texto irá
considerar o :py:module:`locale` para converter o texto pronto para
apresentação.
:param decimal.Decima... | [
"def",
"texto_decimal",
"(",
"valor",
",",
"remover_zeros",
"=",
"True",
")",
":",
"texto",
"=",
"'{:n}'",
".",
"format",
"(",
"valor",
")",
"if",
"remover_zeros",
":",
"dp",
"=",
"locale",
".",
"localeconv",
"(",
")",
".",
"get",
"(",
"'decimal_point'",... | Converte um valor :py:class:`decimal.Decimal` para texto, com a opção de
remover os zeros à direita não significativos. A conversão para texto irá
considerar o :py:module:`locale` para converter o texto pronto para
apresentação.
:param decimal.Decimal valor: Valor a converter para texto.
:param boo... | [
"Converte",
"um",
"valor",
":",
"py",
":",
"class",
":",
"decimal",
".",
"Decimal",
"para",
"texto",
"com",
"a",
"opção",
"de",
"remover",
"os",
"zeros",
"à",
"direita",
"não",
"significativos",
".",
"A",
"conversão",
"para",
"texto",
"irá",
"considerar",
... | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/util.py#L28-L44 |
base4sistemas/satcomum | satcomum/util.py | modulo11 | def modulo11(base):
"""Calcula o dígito verificador (DV) para o argumento usando "Módulo 11".
:param str base: String contendo os dígitos sobre os quais o DV será
calculado, assumindo que o DV não está incluído no argumento.
:return: O dígito verificador calculado.
:rtype: int
"""
pes... | python | def modulo11(base):
"""Calcula o dígito verificador (DV) para o argumento usando "Módulo 11".
:param str base: String contendo os dígitos sobre os quais o DV será
calculado, assumindo que o DV não está incluído no argumento.
:return: O dígito verificador calculado.
:rtype: int
"""
pes... | [
"def",
"modulo11",
"(",
"base",
")",
":",
"pesos",
"=",
"'23456789'",
"*",
"(",
"(",
"len",
"(",
"base",
")",
"//",
"8",
")",
"+",
"1",
")",
"acumulado",
"=",
"sum",
"(",
"[",
"int",
"(",
"a",
")",
"*",
"int",
"(",
"b",
")",
"for",
"a",
","... | Calcula o dígito verificador (DV) para o argumento usando "Módulo 11".
:param str base: String contendo os dígitos sobre os quais o DV será
calculado, assumindo que o DV não está incluído no argumento.
:return: O dígito verificador calculado.
:rtype: int | [
"Calcula",
"o",
"dígito",
"verificador",
"(",
"DV",
")",
"para",
"o",
"argumento",
"usando",
"Módulo",
"11",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/util.py#L47-L60 |
base4sistemas/satcomum | satcomum/util.py | validar_casas_decimais | def validar_casas_decimais(valor, minimo=1, maximo=2):
"""Valida o número de casas decimais. Se o número de casas decimais não
estiver dentro do mínimo e máximo, será lançada uma exceção do tipo
:py:exc:`ValueError`.
:param valor: Um objeto :py:class:`~decimal.Decimal`.
:param minimo: Valor inteir... | python | def validar_casas_decimais(valor, minimo=1, maximo=2):
"""Valida o número de casas decimais. Se o número de casas decimais não
estiver dentro do mínimo e máximo, será lançada uma exceção do tipo
:py:exc:`ValueError`.
:param valor: Um objeto :py:class:`~decimal.Decimal`.
:param minimo: Valor inteir... | [
"def",
"validar_casas_decimais",
"(",
"valor",
",",
"minimo",
"=",
"1",
",",
"maximo",
"=",
"2",
")",
":",
"atributos",
"=",
"valor",
".",
"as_tuple",
"(",
")",
"if",
"not",
"(",
"minimo",
"<=",
"abs",
"(",
"atributos",
".",
"exponent",
")",
"<=",
"m... | Valida o número de casas decimais. Se o número de casas decimais não
estiver dentro do mínimo e máximo, será lançada uma exceção do tipo
:py:exc:`ValueError`.
:param valor: Um objeto :py:class:`~decimal.Decimal`.
:param minimo: Valor inteiro maior ou igual a zero indicando o número
mínimo de c... | [
"Valida",
"o",
"número",
"de",
"casas",
"decimais",
".",
"Se",
"o",
"número",
"de",
"casas",
"decimais",
"não",
"estiver",
"dentro",
"do",
"mínimo",
"e",
"máximo",
"será",
"lançada",
"uma",
"exceção",
"do",
"tipo",
":",
"py",
":",
"exc",
":",
"ValueError... | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/util.py#L63-L84 |
base4sistemas/satcomum | satcomum/br.py | uf | def uf(sigla):
"""
Valida a sigla da Unidade Federativa. Se não for uma sigla de UF válida,
será lançada a exceção :exc:`UnidadeFederativaError`.
"""
if not sigla in [s for s, i, n, r in UNIDADES_FEDERACAO]:
raise UnidadeFederativaError('Estado (sigla) UF "%s" '
'inexistente'... | python | def uf(sigla):
"""
Valida a sigla da Unidade Federativa. Se não for uma sigla de UF válida,
será lançada a exceção :exc:`UnidadeFederativaError`.
"""
if not sigla in [s for s, i, n, r in UNIDADES_FEDERACAO]:
raise UnidadeFederativaError('Estado (sigla) UF "%s" '
'inexistente'... | [
"def",
"uf",
"(",
"sigla",
")",
":",
"if",
"not",
"sigla",
"in",
"[",
"s",
"for",
"s",
",",
"i",
",",
"n",
",",
"r",
"in",
"UNIDADES_FEDERACAO",
"]",
":",
"raise",
"UnidadeFederativaError",
"(",
"'Estado (sigla) UF \"%s\" '",
"'inexistente'",
"%",
"sigla",... | Valida a sigla da Unidade Federativa. Se não for uma sigla de UF válida,
será lançada a exceção :exc:`UnidadeFederativaError`. | [
"Valida",
"a",
"sigla",
"da",
"Unidade",
"Federativa",
".",
"Se",
"não",
"for",
"uma",
"sigla",
"de",
"UF",
"válida",
"será",
"lançada",
"a",
"exceção",
":",
"exc",
":",
"UnidadeFederativaError",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L85-L92 |
base4sistemas/satcomum | satcomum/br.py | uf_pelo_codigo | def uf_pelo_codigo(codigo_ibge):
"""Retorna a UF para o código do IBGE informado."""
idx = [i for s, i, n, r in UNIDADES_FEDERACAO].index(codigo_ibge)
return UNIDADES_FEDERACAO[idx][_UF_SIGLA] | python | def uf_pelo_codigo(codigo_ibge):
"""Retorna a UF para o código do IBGE informado."""
idx = [i for s, i, n, r in UNIDADES_FEDERACAO].index(codigo_ibge)
return UNIDADES_FEDERACAO[idx][_UF_SIGLA] | [
"def",
"uf_pelo_codigo",
"(",
"codigo_ibge",
")",
":",
"idx",
"=",
"[",
"i",
"for",
"s",
",",
"i",
",",
"n",
",",
"r",
"in",
"UNIDADES_FEDERACAO",
"]",
".",
"index",
"(",
"codigo_ibge",
")",
"return",
"UNIDADES_FEDERACAO",
"[",
"idx",
"]",
"[",
"_UF_SI... | Retorna a UF para o código do IBGE informado. | [
"Retorna",
"a",
"UF",
"para",
"o",
"código",
"do",
"IBGE",
"informado",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L112-L115 |
base4sistemas/satcomum | satcomum/br.py | codigo_ibge_uf | def codigo_ibge_uf(sigla):
"""Retorna o código do IBGE para a UF informada."""
idx = [s for s, i, n, r in UNIDADES_FEDERACAO].index(sigla)
return UNIDADES_FEDERACAO[idx][_UF_CODIGO_IBGE] | python | def codigo_ibge_uf(sigla):
"""Retorna o código do IBGE para a UF informada."""
idx = [s for s, i, n, r in UNIDADES_FEDERACAO].index(sigla)
return UNIDADES_FEDERACAO[idx][_UF_CODIGO_IBGE] | [
"def",
"codigo_ibge_uf",
"(",
"sigla",
")",
":",
"idx",
"=",
"[",
"s",
"for",
"s",
",",
"i",
",",
"n",
",",
"r",
"in",
"UNIDADES_FEDERACAO",
"]",
".",
"index",
"(",
"sigla",
")",
"return",
"UNIDADES_FEDERACAO",
"[",
"idx",
"]",
"[",
"_UF_CODIGO_IBGE",
... | Retorna o código do IBGE para a UF informada. | [
"Retorna",
"o",
"código",
"do",
"IBGE",
"para",
"a",
"UF",
"informada",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L118-L121 |
base4sistemas/satcomum | satcomum/br.py | cnpj | def cnpj(numero):
"""Valida um número de CNPJ. O número deverá ser informado como uma string
contendo 14 dígitos numéricos. Se o número informado for inválido será
lançada a exceção :exc:`NumeroCNPJError`. Esta implementação da validação
foi delicadamente copiada de `python-sped <http://git.io/vfuGW>`."... | python | def cnpj(numero):
"""Valida um número de CNPJ. O número deverá ser informado como uma string
contendo 14 dígitos numéricos. Se o número informado for inválido será
lançada a exceção :exc:`NumeroCNPJError`. Esta implementação da validação
foi delicadamente copiada de `python-sped <http://git.io/vfuGW>`."... | [
"def",
"cnpj",
"(",
"numero",
")",
":",
"_digitos",
"=",
"[",
"int",
"(",
"c",
")",
"for",
"c",
"in",
"numero",
"if",
"c",
".",
"isdigit",
"(",
")",
"]",
"if",
"len",
"(",
"_digitos",
")",
"!=",
"14",
"or",
"len",
"(",
"numero",
")",
"!=",
"1... | Valida um número de CNPJ. O número deverá ser informado como uma string
contendo 14 dígitos numéricos. Se o número informado for inválido será
lançada a exceção :exc:`NumeroCNPJError`. Esta implementação da validação
foi delicadamente copiada de `python-sped <http://git.io/vfuGW>`. | [
"Valida",
"um",
"número",
"de",
"CNPJ",
".",
"O",
"número",
"deverá",
"ser",
"informado",
"como",
"uma",
"string",
"contendo",
"14",
"dígitos",
"numéricos",
".",
"Se",
"o",
"número",
"informado",
"for",
"inválido",
"será",
"lançada",
"a",
"exceção",
":",
"... | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L124-L151 |
base4sistemas/satcomum | satcomum/br.py | is_cnpj | def is_cnpj(numero, estrito=False):
"""Uma versão conveniente para usar em testes condicionais. Apenas retorna
verdadeiro ou falso, conforme o argumento é validado.
:param bool estrito: Padrão ``False``, indica se apenas os dígitos do
número deverão ser considerados. Se verdadeiro, potenciais carac... | python | def is_cnpj(numero, estrito=False):
"""Uma versão conveniente para usar em testes condicionais. Apenas retorna
verdadeiro ou falso, conforme o argumento é validado.
:param bool estrito: Padrão ``False``, indica se apenas os dígitos do
número deverão ser considerados. Se verdadeiro, potenciais carac... | [
"def",
"is_cnpj",
"(",
"numero",
",",
"estrito",
"=",
"False",
")",
":",
"try",
":",
"cnpj",
"(",
"digitos",
"(",
"numero",
")",
"if",
"not",
"estrito",
"else",
"numero",
")",
"return",
"True",
"except",
"NumeroCNPJError",
":",
"pass",
"return",
"False"
... | Uma versão conveniente para usar em testes condicionais. Apenas retorna
verdadeiro ou falso, conforme o argumento é validado.
:param bool estrito: Padrão ``False``, indica se apenas os dígitos do
número deverão ser considerados. Se verdadeiro, potenciais caracteres
que formam a máscara serão re... | [
"Uma",
"versão",
"conveniente",
"para",
"usar",
"em",
"testes",
"condicionais",
".",
"Apenas",
"retorna",
"verdadeiro",
"ou",
"falso",
"conforme",
"o",
"argumento",
"é",
"validado",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L154-L168 |
base4sistemas/satcomum | satcomum/br.py | as_cnpj | def as_cnpj(numero):
"""Formata um número de CNPJ. Se o número não for um CNPJ válido apenas
retorna o argumento sem qualquer modificação.
"""
_num = digitos(numero)
if is_cnpj(_num):
return '{}.{}.{}/{}-{}'.format(
_num[:2], _num[2:5], _num[5:8], _num[8:12], _num[12:])
r... | python | def as_cnpj(numero):
"""Formata um número de CNPJ. Se o número não for um CNPJ válido apenas
retorna o argumento sem qualquer modificação.
"""
_num = digitos(numero)
if is_cnpj(_num):
return '{}.{}.{}/{}-{}'.format(
_num[:2], _num[2:5], _num[5:8], _num[8:12], _num[12:])
r... | [
"def",
"as_cnpj",
"(",
"numero",
")",
":",
"_num",
"=",
"digitos",
"(",
"numero",
")",
"if",
"is_cnpj",
"(",
"_num",
")",
":",
"return",
"'{}.{}.{}/{}-{}'",
".",
"format",
"(",
"_num",
"[",
":",
"2",
"]",
",",
"_num",
"[",
"2",
":",
"5",
"]",
","... | Formata um número de CNPJ. Se o número não for um CNPJ válido apenas
retorna o argumento sem qualquer modificação. | [
"Formata",
"um",
"número",
"de",
"CNPJ",
".",
"Se",
"o",
"número",
"não",
"for",
"um",
"CNPJ",
"válido",
"apenas",
"retorna",
"o",
"argumento",
"sem",
"qualquer",
"modificação",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L171-L179 |
base4sistemas/satcomum | satcomum/br.py | cpf | def cpf(numero):
"""Valida um número de CPF. O número deverá ser informado como uma string
contendo 11 dígitos numéricos. Se o número informado for inválido será
lançada a exceção :exc:`NumeroCPFError`. Esta implementação da validação
foi delicadamente copiada de `python-sped <http://git.io/vfuGW>`.
... | python | def cpf(numero):
"""Valida um número de CPF. O número deverá ser informado como uma string
contendo 11 dígitos numéricos. Se o número informado for inválido será
lançada a exceção :exc:`NumeroCPFError`. Esta implementação da validação
foi delicadamente copiada de `python-sped <http://git.io/vfuGW>`.
... | [
"def",
"cpf",
"(",
"numero",
")",
":",
"_digitos",
"=",
"[",
"int",
"(",
"c",
")",
"for",
"c",
"in",
"numero",
"if",
"c",
".",
"isdigit",
"(",
")",
"]",
"if",
"len",
"(",
"_digitos",
")",
"!=",
"11",
"or",
"len",
"(",
"numero",
")",
"!=",
"11... | Valida um número de CPF. O número deverá ser informado como uma string
contendo 11 dígitos numéricos. Se o número informado for inválido será
lançada a exceção :exc:`NumeroCPFError`. Esta implementação da validação
foi delicadamente copiada de `python-sped <http://git.io/vfuGW>`. | [
"Valida",
"um",
"número",
"de",
"CPF",
".",
"O",
"número",
"deverá",
"ser",
"informado",
"como",
"uma",
"string",
"contendo",
"11",
"dígitos",
"numéricos",
".",
"Se",
"o",
"número",
"informado",
"for",
"inválido",
"será",
"lançada",
"a",
"exceção",
":",
"e... | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L182-L210 |
base4sistemas/satcomum | satcomum/br.py | is_cpf | def is_cpf(numero, estrito=False):
"""Uma versão conveniente para usar em testes condicionais. Apenas retorna
verdadeiro ou falso, conforme o argumento é validado.
:param bool estrito: Padrão ``False``, indica se apenas os dígitos do
número deverão ser considerados. Se verdadeiro, potenciais caract... | python | def is_cpf(numero, estrito=False):
"""Uma versão conveniente para usar em testes condicionais. Apenas retorna
verdadeiro ou falso, conforme o argumento é validado.
:param bool estrito: Padrão ``False``, indica se apenas os dígitos do
número deverão ser considerados. Se verdadeiro, potenciais caract... | [
"def",
"is_cpf",
"(",
"numero",
",",
"estrito",
"=",
"False",
")",
":",
"try",
":",
"cpf",
"(",
"digitos",
"(",
"numero",
")",
"if",
"not",
"estrito",
"else",
"numero",
")",
"return",
"True",
"except",
"NumeroCPFError",
":",
"pass",
"return",
"False"
] | Uma versão conveniente para usar em testes condicionais. Apenas retorna
verdadeiro ou falso, conforme o argumento é validado.
:param bool estrito: Padrão ``False``, indica se apenas os dígitos do
número deverão ser considerados. Se verdadeiro, potenciais caracteres
que formam a máscara serão re... | [
"Uma",
"versão",
"conveniente",
"para",
"usar",
"em",
"testes",
"condicionais",
".",
"Apenas",
"retorna",
"verdadeiro",
"ou",
"falso",
"conforme",
"o",
"argumento",
"é",
"validado",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L213-L227 |
base4sistemas/satcomum | satcomum/br.py | as_cpf | def as_cpf(numero):
"""Formata um número de CPF. Se o número não for um CPF válido apenas
retorna o argumento sem qualquer modificação.
"""
_num = digitos(numero)
if is_cpf(_num):
return '{}.{}.{}-{}'.format(_num[:3], _num[3:6], _num[6:9], _num[9:])
return numero | python | def as_cpf(numero):
"""Formata um número de CPF. Se o número não for um CPF válido apenas
retorna o argumento sem qualquer modificação.
"""
_num = digitos(numero)
if is_cpf(_num):
return '{}.{}.{}-{}'.format(_num[:3], _num[3:6], _num[6:9], _num[9:])
return numero | [
"def",
"as_cpf",
"(",
"numero",
")",
":",
"_num",
"=",
"digitos",
"(",
"numero",
")",
"if",
"is_cpf",
"(",
"_num",
")",
":",
"return",
"'{}.{}.{}-{}'",
".",
"format",
"(",
"_num",
"[",
":",
"3",
"]",
",",
"_num",
"[",
"3",
":",
"6",
"]",
",",
"... | Formata um número de CPF. Se o número não for um CPF válido apenas
retorna o argumento sem qualquer modificação. | [
"Formata",
"um",
"número",
"de",
"CPF",
".",
"Se",
"o",
"número",
"não",
"for",
"um",
"CPF",
"válido",
"apenas",
"retorna",
"o",
"argumento",
"sem",
"qualquer",
"modificação",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L230-L237 |
base4sistemas/satcomum | satcomum/br.py | cnpjcpf | def cnpjcpf(numero):
"""Valida um número de CNPJ ou CPF. Veja :func:`cnpj` e/ou :func:`cpf`."""
try:
cnpj(numero)
except NumeroCNPJError:
try:
cpf(numero)
except NumeroCPFError:
raise NumeroCNPJCPFError('numero "%s" nao valida como '
'CNPJ ... | python | def cnpjcpf(numero):
"""Valida um número de CNPJ ou CPF. Veja :func:`cnpj` e/ou :func:`cpf`."""
try:
cnpj(numero)
except NumeroCNPJError:
try:
cpf(numero)
except NumeroCPFError:
raise NumeroCNPJCPFError('numero "%s" nao valida como '
'CNPJ ... | [
"def",
"cnpjcpf",
"(",
"numero",
")",
":",
"try",
":",
"cnpj",
"(",
"numero",
")",
"except",
"NumeroCNPJError",
":",
"try",
":",
"cpf",
"(",
"numero",
")",
"except",
"NumeroCPFError",
":",
"raise",
"NumeroCNPJCPFError",
"(",
"'numero \"%s\" nao valida como '",
... | Valida um número de CNPJ ou CPF. Veja :func:`cnpj` e/ou :func:`cpf`. | [
"Valida",
"um",
"número",
"de",
"CNPJ",
"ou",
"CPF",
".",
"Veja",
":",
"func",
":",
"cnpj",
"e",
"/",
"ou",
":",
"func",
":",
"cpf",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L240-L249 |
base4sistemas/satcomum | satcomum/br.py | is_cnpjcpf | def is_cnpjcpf(numero, estrito=False):
"""Uma versão conveniente para usar em testes condicionais. Apenas retorna
verdadeiro ou falso, conforme o argumento é validado.
:param bool estrito: Padrão ``False``, indica se apenas os dígitos do
número deverão ser considerados. Se verdadeiro, potenciais ca... | python | def is_cnpjcpf(numero, estrito=False):
"""Uma versão conveniente para usar em testes condicionais. Apenas retorna
verdadeiro ou falso, conforme o argumento é validado.
:param bool estrito: Padrão ``False``, indica se apenas os dígitos do
número deverão ser considerados. Se verdadeiro, potenciais ca... | [
"def",
"is_cnpjcpf",
"(",
"numero",
",",
"estrito",
"=",
"False",
")",
":",
"_numero",
"=",
"digitos",
"(",
"numero",
")",
"if",
"not",
"estrito",
"else",
"numero",
"try",
":",
"cnpj",
"(",
"_numero",
")",
"return",
"True",
"except",
"NumeroCNPJError",
"... | Uma versão conveniente para usar em testes condicionais. Apenas retorna
verdadeiro ou falso, conforme o argumento é validado.
:param bool estrito: Padrão ``False``, indica se apenas os dígitos do
número deverão ser considerados. Se verdadeiro, potenciais caracteres
que formam a máscara serão re... | [
"Uma",
"versão",
"conveniente",
"para",
"usar",
"em",
"testes",
"condicionais",
".",
"Apenas",
"retorna",
"verdadeiro",
"ou",
"falso",
"conforme",
"o",
"argumento",
"é",
"validado",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L252-L271 |
base4sistemas/satcomum | satcomum/br.py | as_cnpjcpf | def as_cnpjcpf(numero):
"""Formata um número de CNPJ ou CPF. Se o número não for um CNPJ ou CPF
válidos apenas retorna o argumento sem qualquer modificação.
"""
if is_cnpj(numero):
return as_cnpj(numero)
elif is_cpf(numero):
return as_cpf(numero)
return numero | python | def as_cnpjcpf(numero):
"""Formata um número de CNPJ ou CPF. Se o número não for um CNPJ ou CPF
válidos apenas retorna o argumento sem qualquer modificação.
"""
if is_cnpj(numero):
return as_cnpj(numero)
elif is_cpf(numero):
return as_cpf(numero)
return numero | [
"def",
"as_cnpjcpf",
"(",
"numero",
")",
":",
"if",
"is_cnpj",
"(",
"numero",
")",
":",
"return",
"as_cnpj",
"(",
"numero",
")",
"elif",
"is_cpf",
"(",
"numero",
")",
":",
"return",
"as_cpf",
"(",
"numero",
")",
"return",
"numero"
] | Formata um número de CNPJ ou CPF. Se o número não for um CNPJ ou CPF
válidos apenas retorna o argumento sem qualquer modificação. | [
"Formata",
"um",
"número",
"de",
"CNPJ",
"ou",
"CPF",
".",
"Se",
"o",
"número",
"não",
"for",
"um",
"CNPJ",
"ou",
"CPF",
"válidos",
"apenas",
"retorna",
"o",
"argumento",
"sem",
"qualquer",
"modificação",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L274-L282 |
base4sistemas/satcomum | satcomum/br.py | cep | def cep(numero):
"""Valida um número de CEP. O número deverá ser informado como uma string
contendo 8 dígitos numéricos. Se o número informado for inválido será
lançada a exceção :exc:`NumeroCEPError`.
.. warning::
Qualquer string que contenha 8 dígitos será considerada como um CEP
vál... | python | def cep(numero):
"""Valida um número de CEP. O número deverá ser informado como uma string
contendo 8 dígitos numéricos. Se o número informado for inválido será
lançada a exceção :exc:`NumeroCEPError`.
.. warning::
Qualquer string que contenha 8 dígitos será considerada como um CEP
vál... | [
"def",
"cep",
"(",
"numero",
")",
":",
"_digitos",
"=",
"digitos",
"(",
"numero",
")",
"if",
"len",
"(",
"_digitos",
")",
"!=",
"8",
"or",
"len",
"(",
"numero",
")",
"!=",
"8",
":",
"raise",
"NumeroCEPError",
"(",
"'CEP \"%s\" nao possui 8 digitos'",
"%"... | Valida um número de CEP. O número deverá ser informado como uma string
contendo 8 dígitos numéricos. Se o número informado for inválido será
lançada a exceção :exc:`NumeroCEPError`.
.. warning::
Qualquer string que contenha 8 dígitos será considerada como um CEP
válido, desde que os dígito... | [
"Valida",
"um",
"número",
"de",
"CEP",
".",
"O",
"número",
"deverá",
"ser",
"informado",
"como",
"uma",
"string",
"contendo",
"8",
"dígitos",
"numéricos",
".",
"Se",
"o",
"número",
"informado",
"for",
"inválido",
"será",
"lançada",
"a",
"exceção",
":",
"ex... | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L285-L302 |
base4sistemas/satcomum | satcomum/br.py | is_cep | def is_cep(numero, estrito=False):
"""Uma versão conveniente para usar em testes condicionais. Apenas retorna
verdadeiro ou falso, conforme o argumento é validado.
:param bool estrito: Padrão ``False``, indica se apenas os dígitos do
número deverão ser considerados. Se verdadeiro, potenciais caract... | python | def is_cep(numero, estrito=False):
"""Uma versão conveniente para usar em testes condicionais. Apenas retorna
verdadeiro ou falso, conforme o argumento é validado.
:param bool estrito: Padrão ``False``, indica se apenas os dígitos do
número deverão ser considerados. Se verdadeiro, potenciais caract... | [
"def",
"is_cep",
"(",
"numero",
",",
"estrito",
"=",
"False",
")",
":",
"try",
":",
"cep",
"(",
"digitos",
"(",
"numero",
")",
"if",
"not",
"estrito",
"else",
"numero",
")",
"return",
"True",
"except",
"NumeroCEPError",
":",
"pass",
"return",
"False"
] | Uma versão conveniente para usar em testes condicionais. Apenas retorna
verdadeiro ou falso, conforme o argumento é validado.
:param bool estrito: Padrão ``False``, indica se apenas os dígitos do
número deverão ser considerados. Se verdadeiro, potenciais caracteres
que formam a máscara serão re... | [
"Uma",
"versão",
"conveniente",
"para",
"usar",
"em",
"testes",
"condicionais",
".",
"Apenas",
"retorna",
"verdadeiro",
"ou",
"falso",
"conforme",
"o",
"argumento",
"é",
"validado",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L305-L319 |
base4sistemas/satcomum | satcomum/br.py | as_cep | def as_cep(numero):
"""Formata um número de CEP. Se o argumento não for um CEP válido apenas
retorna o argumento sem qualquer modificação.
"""
_numero = digitos(numero)
if is_cep(_numero):
return '{}-{}'.format(_numero[:5], _numero[5:])
return numero | python | def as_cep(numero):
"""Formata um número de CEP. Se o argumento não for um CEP válido apenas
retorna o argumento sem qualquer modificação.
"""
_numero = digitos(numero)
if is_cep(_numero):
return '{}-{}'.format(_numero[:5], _numero[5:])
return numero | [
"def",
"as_cep",
"(",
"numero",
")",
":",
"_numero",
"=",
"digitos",
"(",
"numero",
")",
"if",
"is_cep",
"(",
"_numero",
")",
":",
"return",
"'{}-{}'",
".",
"format",
"(",
"_numero",
"[",
":",
"5",
"]",
",",
"_numero",
"[",
"5",
":",
"]",
")",
"r... | Formata um número de CEP. Se o argumento não for um CEP válido apenas
retorna o argumento sem qualquer modificação. | [
"Formata",
"um",
"número",
"de",
"CEP",
".",
"Se",
"o",
"argumento",
"não",
"for",
"um",
"CEP",
"válido",
"apenas",
"retorna",
"o",
"argumento",
"sem",
"qualquer",
"modificação",
"."
] | train | https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L322-L329 |
Roguelazer/muttdown | muttdown/main.py | convert_tree | def convert_tree(message, config, indent=0, wrap_alternative=True, charset=None):
"""Recursively convert a potentially-multipart tree.
Returns a tuple of (the converted tree, whether any markdown was found)
"""
ct = message.get_content_type()
cs = message.get_content_subtype()
if charset is Non... | python | def convert_tree(message, config, indent=0, wrap_alternative=True, charset=None):
"""Recursively convert a potentially-multipart tree.
Returns a tuple of (the converted tree, whether any markdown was found)
"""
ct = message.get_content_type()
cs = message.get_content_subtype()
if charset is Non... | [
"def",
"convert_tree",
"(",
"message",
",",
"config",
",",
"indent",
"=",
"0",
",",
"wrap_alternative",
"=",
"True",
",",
"charset",
"=",
"None",
")",
":",
"ct",
"=",
"message",
".",
"get_content_type",
"(",
")",
"cs",
"=",
"message",
".",
"get_content_s... | Recursively convert a potentially-multipart tree.
Returns a tuple of (the converted tree, whether any markdown was found) | [
"Recursively",
"convert",
"a",
"potentially",
"-",
"multipart",
"tree",
"."
] | train | https://github.com/Roguelazer/muttdown/blob/5aeb514ba5c4eac00db8dc3690daba60f778076c/muttdown/main.py#L75-L128 |
Roguelazer/muttdown | muttdown/main.py | smtp_connection | def smtp_connection(c):
"""Create an SMTP connection from a Config object"""
if c.smtp_ssl:
klass = smtplib.SMTP_SSL
else:
klass = smtplib.SMTP
conn = klass(c.smtp_host, c.smtp_port, timeout=c.smtp_timeout)
if not c.smtp_ssl:
conn.ehlo()
conn.starttls()
conn.e... | python | def smtp_connection(c):
"""Create an SMTP connection from a Config object"""
if c.smtp_ssl:
klass = smtplib.SMTP_SSL
else:
klass = smtplib.SMTP
conn = klass(c.smtp_host, c.smtp_port, timeout=c.smtp_timeout)
if not c.smtp_ssl:
conn.ehlo()
conn.starttls()
conn.e... | [
"def",
"smtp_connection",
"(",
"c",
")",
":",
"if",
"c",
".",
"smtp_ssl",
":",
"klass",
"=",
"smtplib",
".",
"SMTP_SSL",
"else",
":",
"klass",
"=",
"smtplib",
".",
"SMTP",
"conn",
"=",
"klass",
"(",
"c",
".",
"smtp_host",
",",
"c",
".",
"smtp_port",
... | Create an SMTP connection from a Config object | [
"Create",
"an",
"SMTP",
"connection",
"from",
"a",
"Config",
"object"
] | train | https://github.com/Roguelazer/muttdown/blob/5aeb514ba5c4eac00db8dc3690daba60f778076c/muttdown/main.py#L138-L151 |
mollie/mollie-api-python | mollie/api/objects/method.py | Method.issuers | def issuers(self):
"""Return the list of available issuers for this payment method."""
issuers = self._get_property('issuers') or []
result = {
'_embedded': {
'issuers': issuers,
},
'count': len(issuers),
}
return List(result, I... | python | def issuers(self):
"""Return the list of available issuers for this payment method."""
issuers = self._get_property('issuers') or []
result = {
'_embedded': {
'issuers': issuers,
},
'count': len(issuers),
}
return List(result, I... | [
"def",
"issuers",
"(",
"self",
")",
":",
"issuers",
"=",
"self",
".",
"_get_property",
"(",
"'issuers'",
")",
"or",
"[",
"]",
"result",
"=",
"{",
"'_embedded'",
":",
"{",
"'issuers'",
":",
"issuers",
",",
"}",
",",
"'count'",
":",
"len",
"(",
"issuer... | Return the list of available issuers for this payment method. | [
"Return",
"the",
"list",
"of",
"available",
"issuers",
"for",
"this",
"payment",
"method",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/method.py#L65-L74 |
mollie/mollie-api-python | mollie/api/resources/payments.py | Payments.delete | def delete(self, payment_id, data=None):
"""Cancel payment and return the payment object.
Deleting a payment causes the payment status to change to canceled.
The updated payment object is returned.
"""
if not payment_id or not payment_id.startswith(self.RESOURCE_ID_PREFIX):
... | python | def delete(self, payment_id, data=None):
"""Cancel payment and return the payment object.
Deleting a payment causes the payment status to change to canceled.
The updated payment object is returned.
"""
if not payment_id or not payment_id.startswith(self.RESOURCE_ID_PREFIX):
... | [
"def",
"delete",
"(",
"self",
",",
"payment_id",
",",
"data",
"=",
"None",
")",
":",
"if",
"not",
"payment_id",
"or",
"not",
"payment_id",
".",
"startswith",
"(",
"self",
".",
"RESOURCE_ID_PREFIX",
")",
":",
"raise",
"IdentifierError",
"(",
"\"Invalid paymen... | Cancel payment and return the payment object.
Deleting a payment causes the payment status to change to canceled.
The updated payment object is returned. | [
"Cancel",
"payment",
"and",
"return",
"the",
"payment",
"object",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/resources/payments.py#L20-L32 |
mollie/mollie-api-python | mollie/api/objects/payment.py | Payment.mandate | def mandate(self):
"""Return the mandate for this payment."""
return self.client.customer_mandates.with_parent_id(self.customer_id).get(self.mandate_id) | python | def mandate(self):
"""Return the mandate for this payment."""
return self.client.customer_mandates.with_parent_id(self.customer_id).get(self.mandate_id) | [
"def",
"mandate",
"(",
"self",
")",
":",
"return",
"self",
".",
"client",
".",
"customer_mandates",
".",
"with_parent_id",
"(",
"self",
".",
"customer_id",
")",
".",
"get",
"(",
"self",
".",
"mandate_id",
")"
] | Return the mandate for this payment. | [
"Return",
"the",
"mandate",
"for",
"this",
"payment",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/payment.py#L178-L180 |
mollie/mollie-api-python | mollie/api/objects/payment.py | Payment.subscription | def subscription(self):
"""Return the subscription for this payment."""
return self.client.customer_subscriptions.with_parent_id(self.customer_id).get(self.subscription_id) | python | def subscription(self):
"""Return the subscription for this payment."""
return self.client.customer_subscriptions.with_parent_id(self.customer_id).get(self.subscription_id) | [
"def",
"subscription",
"(",
"self",
")",
":",
"return",
"self",
".",
"client",
".",
"customer_subscriptions",
".",
"with_parent_id",
"(",
"self",
".",
"customer_id",
")",
".",
"get",
"(",
"self",
".",
"subscription_id",
")"
] | Return the subscription for this payment. | [
"Return",
"the",
"subscription",
"for",
"this",
"payment",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/payment.py#L183-L185 |
mollie/mollie-api-python | mollie/api/objects/payment.py | Payment.order | def order(self):
"""Return the order for this payment. """
from ..resources.orders import Order
url = self._get_link('order')
if url:
resp = self.client.orders.perform_api_call(self.client.orders.REST_READ, url)
return Order(resp, self.client) | python | def order(self):
"""Return the order for this payment. """
from ..resources.orders import Order
url = self._get_link('order')
if url:
resp = self.client.orders.perform_api_call(self.client.orders.REST_READ, url)
return Order(resp, self.client) | [
"def",
"order",
"(",
"self",
")",
":",
"from",
".",
".",
"resources",
".",
"orders",
"import",
"Order",
"url",
"=",
"self",
".",
"_get_link",
"(",
"'order'",
")",
"if",
"url",
":",
"resp",
"=",
"self",
".",
"client",
".",
"orders",
".",
"perform_api_... | Return the order for this payment. | [
"Return",
"the",
"order",
"for",
"this",
"payment",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/payment.py#L193-L199 |
mollie/mollie-api-python | setup.py | get_version | def get_version():
"""
Read the version from a file (mollie/api/version.py) in the repository.
We can't import here since we might import from an installed version.
"""
try:
version_file = open(os.path.join(ROOT_DIR, 'mollie', 'api', 'version.py'), encoding='utf=8')
except TypeError:
... | python | def get_version():
"""
Read the version from a file (mollie/api/version.py) in the repository.
We can't import here since we might import from an installed version.
"""
try:
version_file = open(os.path.join(ROOT_DIR, 'mollie', 'api', 'version.py'), encoding='utf=8')
except TypeError:
... | [
"def",
"get_version",
"(",
")",
":",
"try",
":",
"version_file",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"ROOT_DIR",
",",
"'mollie'",
",",
"'api'",
",",
"'version.py'",
")",
",",
"encoding",
"=",
"'utf=8'",
")",
"except",
"TypeError",
":... | Read the version from a file (mollie/api/version.py) in the repository.
We can't import here since we might import from an installed version. | [
"Read",
"the",
"version",
"from",
"a",
"file",
"(",
"mollie",
"/",
"api",
"/",
"version",
".",
"py",
")",
"in",
"the",
"repository",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/setup.py#L19-L35 |
mollie/mollie-api-python | mollie/api/objects/order.py | Order.create_refund | def create_refund(self, data=None, **params):
"""Create a refund for the order. When no data arg is given, a refund for all order lines is assumed."""
if data is None:
data = {'lines': []}
refund = OrderRefunds(self.client).on(self).create(data, **params)
return refund | python | def create_refund(self, data=None, **params):
"""Create a refund for the order. When no data arg is given, a refund for all order lines is assumed."""
if data is None:
data = {'lines': []}
refund = OrderRefunds(self.client).on(self).create(data, **params)
return refund | [
"def",
"create_refund",
"(",
"self",
",",
"data",
"=",
"None",
",",
"*",
"*",
"params",
")",
":",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"{",
"'lines'",
":",
"[",
"]",
"}",
"refund",
"=",
"OrderRefunds",
"(",
"self",
".",
"client",
")",
".... | Create a refund for the order. When no data arg is given, a refund for all order lines is assumed. | [
"Create",
"a",
"refund",
"for",
"the",
"order",
".",
"When",
"no",
"data",
"arg",
"is",
"given",
"a",
"refund",
"for",
"all",
"order",
"lines",
"is",
"assumed",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/order.py#L153-L158 |
mollie/mollie-api-python | mollie/api/objects/order.py | Order.cancel_lines | def cancel_lines(self, data=None):
"""Cancel the lines given. When no lines are given, cancel all the lines.
Canceling an order line causes the order line status to change to canceled.
An empty dictionary will be returned.
"""
from ..resources.order_lines import OrderLines
... | python | def cancel_lines(self, data=None):
"""Cancel the lines given. When no lines are given, cancel all the lines.
Canceling an order line causes the order line status to change to canceled.
An empty dictionary will be returned.
"""
from ..resources.order_lines import OrderLines
... | [
"def",
"cancel_lines",
"(",
"self",
",",
"data",
"=",
"None",
")",
":",
"from",
".",
".",
"resources",
".",
"order_lines",
"import",
"OrderLines",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"{",
"'lines'",
":",
"[",
"]",
"}",
"canceled",
"=",
"Ord... | Cancel the lines given. When no lines are given, cancel all the lines.
Canceling an order line causes the order line status to change to canceled.
An empty dictionary will be returned. | [
"Cancel",
"the",
"lines",
"given",
".",
"When",
"no",
"lines",
"are",
"given",
"cancel",
"all",
"the",
"lines",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/order.py#L160-L171 |
mollie/mollie-api-python | mollie/api/objects/order.py | Order.update_line | def update_line(self, resource_id, data):
"""Update a line for an order."""
return OrderLines(self.client).on(self).update(resource_id, data) | python | def update_line(self, resource_id, data):
"""Update a line for an order."""
return OrderLines(self.client).on(self).update(resource_id, data) | [
"def",
"update_line",
"(",
"self",
",",
"resource_id",
",",
"data",
")",
":",
"return",
"OrderLines",
"(",
"self",
".",
"client",
")",
".",
"on",
"(",
"self",
")",
".",
"update",
"(",
"resource_id",
",",
"data",
")"
] | Update a line for an order. | [
"Update",
"a",
"line",
"for",
"an",
"order",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/order.py#L189-L191 |
mollie/mollie-api-python | mollie/api/objects/order.py | Order.create_shipment | def create_shipment(self, data=None):
"""Create a shipment for an order. When no data arg is given, a shipment for all order lines is assumed."""
if data is None:
data = {'lines': []}
return Shipments(self.client).on(self).create(data) | python | def create_shipment(self, data=None):
"""Create a shipment for an order. When no data arg is given, a shipment for all order lines is assumed."""
if data is None:
data = {'lines': []}
return Shipments(self.client).on(self).create(data) | [
"def",
"create_shipment",
"(",
"self",
",",
"data",
"=",
"None",
")",
":",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"{",
"'lines'",
":",
"[",
"]",
"}",
"return",
"Shipments",
"(",
"self",
".",
"client",
")",
".",
"on",
"(",
"self",
")",
".",... | Create a shipment for an order. When no data arg is given, a shipment for all order lines is assumed. | [
"Create",
"a",
"shipment",
"for",
"an",
"order",
".",
"When",
"no",
"data",
"arg",
"is",
"given",
"a",
"shipment",
"for",
"all",
"order",
"lines",
"is",
"assumed",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/order.py#L198-L202 |
mollie/mollie-api-python | mollie/api/objects/order.py | Order.get_shipment | def get_shipment(self, resource_id):
"""Retrieve a single shipment by a shipment's ID."""
return Shipments(self.client).on(self).get(resource_id) | python | def get_shipment(self, resource_id):
"""Retrieve a single shipment by a shipment's ID."""
return Shipments(self.client).on(self).get(resource_id) | [
"def",
"get_shipment",
"(",
"self",
",",
"resource_id",
")",
":",
"return",
"Shipments",
"(",
"self",
".",
"client",
")",
".",
"on",
"(",
"self",
")",
".",
"get",
"(",
"resource_id",
")"
] | Retrieve a single shipment by a shipment's ID. | [
"Retrieve",
"a",
"single",
"shipment",
"by",
"a",
"shipment",
"s",
"ID",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/order.py#L204-L206 |
mollie/mollie-api-python | mollie/api/objects/order.py | Order.update_shipment | def update_shipment(self, resource_id, data):
"""Update the tracking information of a shipment."""
return Shipments(self.client).on(self).update(resource_id, data) | python | def update_shipment(self, resource_id, data):
"""Update the tracking information of a shipment."""
return Shipments(self.client).on(self).update(resource_id, data) | [
"def",
"update_shipment",
"(",
"self",
",",
"resource_id",
",",
"data",
")",
":",
"return",
"Shipments",
"(",
"self",
".",
"client",
")",
".",
"on",
"(",
"self",
")",
".",
"update",
"(",
"resource_id",
",",
"data",
")"
] | Update the tracking information of a shipment. | [
"Update",
"the",
"tracking",
"information",
"of",
"a",
"shipment",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/order.py#L208-L210 |
mollie/mollie-api-python | mollie/api/objects/order.py | Order.create_payment | def create_payment(self, data):
""" Creates a new payment object for an order. """
return OrderPayments(self.client).on(self).create(data) | python | def create_payment(self, data):
""" Creates a new payment object for an order. """
return OrderPayments(self.client).on(self).create(data) | [
"def",
"create_payment",
"(",
"self",
",",
"data",
")",
":",
"return",
"OrderPayments",
"(",
"self",
".",
"client",
")",
".",
"on",
"(",
"self",
")",
".",
"create",
"(",
"data",
")"
] | Creates a new payment object for an order. | [
"Creates",
"a",
"new",
"payment",
"object",
"for",
"an",
"order",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/order.py#L212-L214 |
mollie/mollie-api-python | mollie/api/resources/order_lines.py | OrderLines.delete | def delete(self, data, *args):
"""
Custom handling for deleting orderlines.
Orderlines are deleted by issuing a DELETE on the orders/*/lines endpoint,
with the orderline IDs and quantities in the request body.
"""
path = self.get_resource_name()
result = self.per... | python | def delete(self, data, *args):
"""
Custom handling for deleting orderlines.
Orderlines are deleted by issuing a DELETE on the orders/*/lines endpoint,
with the orderline IDs and quantities in the request body.
"""
path = self.get_resource_name()
result = self.per... | [
"def",
"delete",
"(",
"self",
",",
"data",
",",
"*",
"args",
")",
":",
"path",
"=",
"self",
".",
"get_resource_name",
"(",
")",
"result",
"=",
"self",
".",
"perform_api_call",
"(",
"self",
".",
"REST_DELETE",
",",
"path",
",",
"data",
"=",
"data",
")... | Custom handling for deleting orderlines.
Orderlines are deleted by issuing a DELETE on the orders/*/lines endpoint,
with the orderline IDs and quantities in the request body. | [
"Custom",
"handling",
"for",
"deleting",
"orderlines",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/resources/order_lines.py#L22-L31 |
mollie/mollie-api-python | mollie/api/resources/order_lines.py | OrderLines.update | def update(self, resource_id, data=None, **params):
"""
Custom handling for updating orderlines.
The API returns an Order object. Since we are sending the request through an orderline object, it makes more
sense to convert the returned object to to the updated orderline object.
... | python | def update(self, resource_id, data=None, **params):
"""
Custom handling for updating orderlines.
The API returns an Order object. Since we are sending the request through an orderline object, it makes more
sense to convert the returned object to to the updated orderline object.
... | [
"def",
"update",
"(",
"self",
",",
"resource_id",
",",
"data",
"=",
"None",
",",
"*",
"*",
"params",
")",
":",
"path",
"=",
"self",
".",
"get_resource_name",
"(",
")",
"+",
"'/'",
"+",
"str",
"(",
"resource_id",
")",
"result",
"=",
"self",
".",
"pe... | Custom handling for updating orderlines.
The API returns an Order object. Since we are sending the request through an orderline object, it makes more
sense to convert the returned object to to the updated orderline object.
If you wish to retrieve the order object, you can do so by using the or... | [
"Custom",
"handling",
"for",
"updating",
"orderlines",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/resources/order_lines.py#L33-L48 |
mollie/mollie-api-python | mollie/api/objects/list.py | List.get_next | def get_next(self):
"""Return the next set of objects in a list"""
url = self._get_link('next')
resource = self.object_type.get_resource_class(self.client)
resp = resource.perform_api_call(resource.REST_READ, url)
return List(resp, self.object_type, self.client) | python | def get_next(self):
"""Return the next set of objects in a list"""
url = self._get_link('next')
resource = self.object_type.get_resource_class(self.client)
resp = resource.perform_api_call(resource.REST_READ, url)
return List(resp, self.object_type, self.client) | [
"def",
"get_next",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_get_link",
"(",
"'next'",
")",
"resource",
"=",
"self",
".",
"object_type",
".",
"get_resource_class",
"(",
"self",
".",
"client",
")",
"resp",
"=",
"resource",
".",
"perform_api_call",
... | Return the next set of objects in a list | [
"Return",
"the",
"next",
"set",
"of",
"objects",
"in",
"a",
"list"
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/list.py#L49-L54 |
mollie/mollie-api-python | mollie/api/resources/customer_subscriptions.py | CustomerSubscriptions.delete | def delete(self, subscription_id, data=None):
"""Cancel subscription and return the subscription object.
Deleting a subscription causes the subscription status to changed to 'canceled'.
The updated subscription object is returned.
"""
if not subscription_id or not subscription_i... | python | def delete(self, subscription_id, data=None):
"""Cancel subscription and return the subscription object.
Deleting a subscription causes the subscription status to changed to 'canceled'.
The updated subscription object is returned.
"""
if not subscription_id or not subscription_i... | [
"def",
"delete",
"(",
"self",
",",
"subscription_id",
",",
"data",
"=",
"None",
")",
":",
"if",
"not",
"subscription_id",
"or",
"not",
"subscription_id",
".",
"startswith",
"(",
"self",
".",
"RESOURCE_ID_PREFIX",
")",
":",
"raise",
"IdentifierError",
"(",
"\... | Cancel subscription and return the subscription object.
Deleting a subscription causes the subscription status to changed to 'canceled'.
The updated subscription object is returned. | [
"Cancel",
"subscription",
"and",
"return",
"the",
"subscription",
"object",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/resources/customer_subscriptions.py#L21-L33 |
mollie/mollie-api-python | mollie/api/resources/chargebacks.py | Chargebacks.get | def get(self, chargeback_id, **params):
"""Verify the chargeback ID and retrieve the chargeback from the API."""
if not chargeback_id or not chargeback_id.startswith(self.RESOURCE_ID_PREFIX):
raise IdentifierError(
"Invalid chargeback ID: '{id}'. A chargeback ID should start ... | python | def get(self, chargeback_id, **params):
"""Verify the chargeback ID and retrieve the chargeback from the API."""
if not chargeback_id or not chargeback_id.startswith(self.RESOURCE_ID_PREFIX):
raise IdentifierError(
"Invalid chargeback ID: '{id}'. A chargeback ID should start ... | [
"def",
"get",
"(",
"self",
",",
"chargeback_id",
",",
"*",
"*",
"params",
")",
":",
"if",
"not",
"chargeback_id",
"or",
"not",
"chargeback_id",
".",
"startswith",
"(",
"self",
".",
"RESOURCE_ID_PREFIX",
")",
":",
"raise",
"IdentifierError",
"(",
"\"Invalid c... | Verify the chargeback ID and retrieve the chargeback from the API. | [
"Verify",
"the",
"chargeback",
"ID",
"and",
"retrieve",
"the",
"chargeback",
"from",
"the",
"API",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/resources/chargebacks.py#L12-L19 |
mollie/mollie-api-python | mollie/api/client.py | generate_querystring | def generate_querystring(params):
"""
Generate a querystring suitable for use in the v2 api.
The Requests library doesn't know how to generate querystrings that encode dictionaries using square brackets:
https://api.mollie.com/v2/methods?amount[value]=100.00&amount[currency]=USD
Note: we use `sort... | python | def generate_querystring(params):
"""
Generate a querystring suitable for use in the v2 api.
The Requests library doesn't know how to generate querystrings that encode dictionaries using square brackets:
https://api.mollie.com/v2/methods?amount[value]=100.00&amount[currency]=USD
Note: we use `sort... | [
"def",
"generate_querystring",
"(",
"params",
")",
":",
"if",
"not",
"params",
":",
"return",
"None",
"parts",
"=",
"[",
"]",
"for",
"param",
",",
"value",
"in",
"sorted",
"(",
"params",
".",
"items",
"(",
")",
")",
":",
"if",
"not",
"isinstance",
"(... | Generate a querystring suitable for use in the v2 api.
The Requests library doesn't know how to generate querystrings that encode dictionaries using square brackets:
https://api.mollie.com/v2/methods?amount[value]=100.00&amount[currency]=USD
Note: we use `sorted()` to work around a difference in iteration... | [
"Generate",
"a",
"querystring",
"suitable",
"for",
"use",
"in",
"the",
"v2",
"api",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/client.py#L172-L194 |
mollie/mollie-api-python | mollie/api/client.py | Client.set_user_agent_component | def set_user_agent_component(self, key, value, sanitize=True):
"""Add or replace new user-agent component strings.
Given strings are formatted along the format agreed upon by Mollie and implementers:
- key and values are separated by a forward slash ("/").
- multiple key/values are sepa... | python | def set_user_agent_component(self, key, value, sanitize=True):
"""Add or replace new user-agent component strings.
Given strings are formatted along the format agreed upon by Mollie and implementers:
- key and values are separated by a forward slash ("/").
- multiple key/values are sepa... | [
"def",
"set_user_agent_component",
"(",
"self",
",",
"key",
",",
"value",
",",
"sanitize",
"=",
"True",
")",
":",
"if",
"sanitize",
":",
"key",
"=",
"''",
".",
"join",
"(",
"_x",
".",
"capitalize",
"(",
")",
"for",
"_x",
"in",
"re",
".",
"findall",
... | Add or replace new user-agent component strings.
Given strings are formatted along the format agreed upon by Mollie and implementers:
- key and values are separated by a forward slash ("/").
- multiple key/values are separated by a space.
- keys are camel-cased, and cannot contain space... | [
"Add",
"or",
"replace",
"new",
"user",
"-",
"agent",
"component",
"strings",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/client.py#L110-L125 |
mollie/mollie-api-python | mollie/api/client.py | Client.user_agent | def user_agent(self):
"""Return the formatted user agent string."""
components = ["/".join(x) for x in self.user_agent_components.items()]
return " ".join(components) | python | def user_agent(self):
"""Return the formatted user agent string."""
components = ["/".join(x) for x in self.user_agent_components.items()]
return " ".join(components) | [
"def",
"user_agent",
"(",
"self",
")",
":",
"components",
"=",
"[",
"\"/\"",
".",
"join",
"(",
"x",
")",
"for",
"x",
"in",
"self",
".",
"user_agent_components",
".",
"items",
"(",
")",
"]",
"return",
"\" \"",
".",
"join",
"(",
"components",
")"
] | Return the formatted user agent string. | [
"Return",
"the",
"formatted",
"user",
"agent",
"string",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/client.py#L128-L131 |
mollie/mollie-api-python | mollie/api/error.py | ResponseError.factory | def factory(resp):
"""
Return a ResponseError subclass based on the API payload.
All errors are documented: https://docs.mollie.com/guides/handling-errors#all-possible-status-codes
More exceptions should be added here when appropriate, and when useful examples of API errors are availabl... | python | def factory(resp):
"""
Return a ResponseError subclass based on the API payload.
All errors are documented: https://docs.mollie.com/guides/handling-errors#all-possible-status-codes
More exceptions should be added here when appropriate, and when useful examples of API errors are availabl... | [
"def",
"factory",
"(",
"resp",
")",
":",
"status",
"=",
"resp",
"[",
"'status'",
"]",
"if",
"status",
"==",
"401",
":",
"return",
"UnauthorizedError",
"(",
"resp",
")",
"elif",
"status",
"==",
"404",
":",
"return",
"NotFoundError",
"(",
"resp",
")",
"e... | Return a ResponseError subclass based on the API payload.
All errors are documented: https://docs.mollie.com/guides/handling-errors#all-possible-status-codes
More exceptions should be added here when appropriate, and when useful examples of API errors are available. | [
"Return",
"a",
"ResponseError",
"subclass",
"based",
"on",
"the",
"API",
"payload",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/error.py#L63-L79 |
mollie/mollie-api-python | mollie/api/resources/orders.py | Orders.delete | def delete(self, order_id, data=None):
"""Cancel order and return the order object.
Deleting an order causes the order status to change to canceled.
The updated order object is returned.
"""
if not order_id or not order_id.startswith(self.RESOURCE_ID_PREFIX):
raise I... | python | def delete(self, order_id, data=None):
"""Cancel order and return the order object.
Deleting an order causes the order status to change to canceled.
The updated order object is returned.
"""
if not order_id or not order_id.startswith(self.RESOURCE_ID_PREFIX):
raise I... | [
"def",
"delete",
"(",
"self",
",",
"order_id",
",",
"data",
"=",
"None",
")",
":",
"if",
"not",
"order_id",
"or",
"not",
"order_id",
".",
"startswith",
"(",
"self",
".",
"RESOURCE_ID_PREFIX",
")",
":",
"raise",
"IdentifierError",
"(",
"\"Invalid order ID: '{... | Cancel order and return the order object.
Deleting an order causes the order status to change to canceled.
The updated order object is returned. | [
"Cancel",
"order",
"and",
"return",
"the",
"order",
"object",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/resources/orders.py#L20-L32 |
mollie/mollie-api-python | mollie/api/objects/subscription.py | Subscription.customer | def customer(self):
"""Return the customer for this subscription."""
url = self._get_link('customer')
if url:
resp = self.client.customers.perform_api_call(self.client.customers.REST_READ, url)
return Customer(resp) | python | def customer(self):
"""Return the customer for this subscription."""
url = self._get_link('customer')
if url:
resp = self.client.customers.perform_api_call(self.client.customers.REST_READ, url)
return Customer(resp) | [
"def",
"customer",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_get_link",
"(",
"'customer'",
")",
"if",
"url",
":",
"resp",
"=",
"self",
".",
"client",
".",
"customers",
".",
"perform_api_call",
"(",
"self",
".",
"client",
".",
"customers",
".",
... | Return the customer for this subscription. | [
"Return",
"the",
"customer",
"for",
"this",
"subscription",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/subscription.py#L85-L90 |
mollie/mollie-api-python | mollie/api/objects/subscription.py | Subscription.payments | def payments(self):
"""Return a list of payments for this subscription."""
payments = self.client.subscription_payments.on(self).list()
return payments | python | def payments(self):
"""Return a list of payments for this subscription."""
payments = self.client.subscription_payments.on(self).list()
return payments | [
"def",
"payments",
"(",
"self",
")",
":",
"payments",
"=",
"self",
".",
"client",
".",
"subscription_payments",
".",
"on",
"(",
"self",
")",
".",
"list",
"(",
")",
"return",
"payments"
] | Return a list of payments for this subscription. | [
"Return",
"a",
"list",
"of",
"payments",
"for",
"this",
"subscription",
"."
] | train | https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/subscription.py#L93-L96 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1.list_groups | def list_groups(self, filtr, url_prefix, auth, session, send_opts):
"""Get the groups the logged in user is a member of.
Optionally filter by 'member' or 'maintainer'.
Args:
filtr (string|None): ['member'|'maintainer'] or defaults to None.
url_prefix (string): Protocol ... | python | def list_groups(self, filtr, url_prefix, auth, session, send_opts):
"""Get the groups the logged in user is a member of.
Optionally filter by 'member' or 'maintainer'.
Args:
filtr (string|None): ['member'|'maintainer'] or defaults to None.
url_prefix (string): Protocol ... | [
"def",
"list_groups",
"(",
"self",
",",
"filtr",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"req",
"=",
"self",
".",
"get_group_request",
"(",
"'GET'",
",",
"'application/json'",
",",
"url_prefix",
",",
"auth",
")",
"if",
... | Get the groups the logged in user is a member of.
Optionally filter by 'member' or 'maintainer'.
Args:
filtr (string|None): ['member'|'maintainer'] or defaults to None.
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to send ... | [
"Get",
"the",
"groups",
"the",
"logged",
"in",
"user",
"is",
"a",
"member",
"of",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L34-L69 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1.delete_group | def delete_group(self, name, url_prefix, auth, session, send_opts):
"""Delete given group.
Args:
name (string): Name of group.
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to send in the request header.
session ... | python | def delete_group(self, name, url_prefix, auth, session, send_opts):
"""Delete given group.
Args:
name (string): Name of group.
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to send in the request header.
session ... | [
"def",
"delete_group",
"(",
"self",
",",
"name",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"req",
"=",
"self",
".",
"get_group_request",
"(",
"'DELETE'",
",",
"'application/json'",
",",
"url_prefix",
",",
"auth",
",",
"nam... | Delete given group.
Args:
name (string): Name of group.
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to send in the request header.
session (requests.Session): HTTP session to use for request.
send_opts (dic... | [
"Delete",
"given",
"group",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L125-L148 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1.list_group_members | def list_group_members(self, name, url_prefix, auth, session, send_opts):
"""Get the members of a group (does not include maintainers).
Args:
name (string): Name of group to query.
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Tok... | python | def list_group_members(self, name, url_prefix, auth, session, send_opts):
"""Get the members of a group (does not include maintainers).
Args:
name (string): Name of group to query.
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Tok... | [
"def",
"list_group_members",
"(",
"self",
",",
"name",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"req",
"=",
"self",
".",
"get_group_members_request",
"(",
"'GET'",
",",
"'application/json'",
",",
"url_prefix",
",",
"auth",
... | Get the members of a group (does not include maintainers).
Args:
name (string): Name of group to query.
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to send in the request header.
session (requests.Session): HTTP sessio... | [
"Get",
"the",
"members",
"of",
"a",
"group",
"(",
"does",
"not",
"include",
"maintainers",
")",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L150-L177 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1.list_permissions | def list_permissions(self, group_name=None, resource=None,
url_prefix=None, auth=None, session=None, send_opts=None):
"""List the permission sets for the logged in user
Optionally filter by resource or group.
Args:
group_name (string): Name of group to filte... | python | def list_permissions(self, group_name=None, resource=None,
url_prefix=None, auth=None, session=None, send_opts=None):
"""List the permission sets for the logged in user
Optionally filter by resource or group.
Args:
group_name (string): Name of group to filte... | [
"def",
"list_permissions",
"(",
"self",
",",
"group_name",
"=",
"None",
",",
"resource",
"=",
"None",
",",
"url_prefix",
"=",
"None",
",",
"auth",
"=",
"None",
",",
"session",
"=",
"None",
",",
"send_opts",
"=",
"None",
")",
":",
"filter_params",
"=",
... | List the permission sets for the logged in user
Optionally filter by resource or group.
Args:
group_name (string): Name of group to filter on
resource (intern.resource.boss.BossResource): Identifies which data model object to filter on
url_prefix (string): Protocol ... | [
"List",
"the",
"permission",
"sets",
"for",
"the",
"logged",
"in",
"user"
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L381-L421 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1.add_permissions | def add_permissions(self, group_name, resource, permissions, url_prefix, auth, session, send_opts):
"""
Args:
group_name (string): Name of group.
resource (intern.resource.boss.BossResource): Identifies which data model object to operate on.
permissions (list): List o... | python | def add_permissions(self, group_name, resource, permissions, url_prefix, auth, session, send_opts):
"""
Args:
group_name (string): Name of group.
resource (intern.resource.boss.BossResource): Identifies which data model object to operate on.
permissions (list): List o... | [
"def",
"add_permissions",
"(",
"self",
",",
"group_name",
",",
"resource",
",",
"permissions",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"post_data",
"=",
"{",
"\"group\"",
":",
"group_name",
",",
"\"permissions\"",
":",
"pe... | Args:
group_name (string): Name of group.
resource (intern.resource.boss.BossResource): Identifies which data model object to operate on.
permissions (list): List of permissions to add to the given resource.
url_prefix (string): Protocol + host such as https://api.theboss... | [
"Args",
":",
"group_name",
"(",
"string",
")",
":",
"Name",
"of",
"group",
".",
"resource",
"(",
"intern",
".",
"resource",
".",
"boss",
".",
"BossResource",
")",
":",
"Identifies",
"which",
"data",
"model",
"object",
"to",
"operate",
"on",
".",
"permiss... | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L456-L480 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1.delete_permissions | def delete_permissions(self, grp_name, resource, url_prefix, auth, session, send_opts):
"""
Args:
grp_name (string): Name of group.
resource (intern.resource.boss.BossResource): Identifies which data model object to operate on.
url_prefix (string): Protocol + host suc... | python | def delete_permissions(self, grp_name, resource, url_prefix, auth, session, send_opts):
"""
Args:
grp_name (string): Name of group.
resource (intern.resource.boss.BossResource): Identifies which data model object to operate on.
url_prefix (string): Protocol + host suc... | [
"def",
"delete_permissions",
"(",
"self",
",",
"grp_name",
",",
"resource",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"filter_params",
"=",
"{",
"\"group\"",
":",
"grp_name",
"}",
"filter_params",
".",
"update",
"(",
"resour... | Args:
grp_name (string): Name of group.
resource (intern.resource.boss.BossResource): Identifies which data model object to operate on.
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to send in the request header.
sess... | [
"Args",
":",
"grp_name",
"(",
"string",
")",
":",
"Name",
"of",
"group",
".",
"resource",
"(",
"intern",
".",
"resource",
".",
"boss",
".",
"BossResource",
")",
":",
"Identifies",
"which",
"data",
"model",
"object",
"to",
"operate",
"on",
".",
"url_prefi... | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L508-L533 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1.get_user_roles | def get_user_roles(self, user, url_prefix, auth, session, send_opts):
"""Get roles associated with the given user.
Args:
user (string): User name.
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to send in the request header.
... | python | def get_user_roles(self, user, url_prefix, auth, session, send_opts):
"""Get roles associated with the given user.
Args:
user (string): User name.
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to send in the request header.
... | [
"def",
"get_user_roles",
"(",
"self",
",",
"user",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"req",
"=",
"self",
".",
"get_user_role_request",
"(",
"'GET'",
",",
"'application/json'",
",",
"url_prefix",
",",
"auth",
",",
"... | Get roles associated with the given user.
Args:
user (string): User name.
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to send in the request header.
session (requests.Session): HTTP session to use for request.
... | [
"Get",
"roles",
"associated",
"with",
"the",
"given",
"user",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L535-L563 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1.add_user | def add_user(
self, user, first_name, last_name, email, password,
url_prefix, auth, session, send_opts):
"""Add a new user.
Args:
user (string): User name.
first_name (string): User's first name.
last_name (string): User's last name.
email... | python | def add_user(
self, user, first_name, last_name, email, password,
url_prefix, auth, session, send_opts):
"""Add a new user.
Args:
user (string): User name.
first_name (string): User's first name.
last_name (string): User's last name.
email... | [
"def",
"add_user",
"(",
"self",
",",
"user",
",",
"first_name",
",",
"last_name",
",",
"email",
",",
"password",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"req",
"=",
"self",
".",
"get_user_request",
"(",
"'POST'",
",",
... | Add a new user.
Args:
user (string): User name.
first_name (string): User's first name.
last_name (string): User's last name.
email: (string): User's email address.
password: (string): User's password.
url_prefix (string): Protocol + host ... | [
"Add",
"a",
"new",
"user",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L651-L682 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1.list | def list(self, resource, url_prefix, auth, session, send_opts):
"""List all resources of the same type as the given resource.
Args:
resource (intern.resource.boss.BossResource): List resources of the same type as this..
url_prefix (string): Protocol + host such as https://api.th... | python | def list(self, resource, url_prefix, auth, session, send_opts):
"""List all resources of the same type as the given resource.
Args:
resource (intern.resource.boss.BossResource): List resources of the same type as this..
url_prefix (string): Protocol + host such as https://api.th... | [
"def",
"list",
"(",
"self",
",",
"resource",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"req",
"=",
"self",
".",
"get_request",
"(",
"resource",
",",
"'GET'",
",",
"'application/json'",
",",
"url_prefix",
",",
"auth",
","... | List all resources of the same type as the given resource.
Args:
resource (intern.resource.boss.BossResource): List resources of the same type as this..
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to send in the request header.
... | [
"List",
"all",
"resources",
"of",
"the",
"same",
"type",
"as",
"the",
"given",
"resource",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L711-L738 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1.update | def update(self, resource_name, resource, url_prefix, auth, session, send_opts):
"""Updates an entity in the data model using the given resource.
Args:
resource_name (string): Current name of the resource (in case the resource is getting its name changed).
resource (intern.resou... | python | def update(self, resource_name, resource, url_prefix, auth, session, send_opts):
"""Updates an entity in the data model using the given resource.
Args:
resource_name (string): Current name of the resource (in case the resource is getting its name changed).
resource (intern.resou... | [
"def",
"update",
"(",
"self",
",",
"resource_name",
",",
"resource",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"# Create a copy of the resource and change its name to resource_name",
"# in case the update includes changing the name of a resourc... | Updates an entity in the data model using the given resource.
Args:
resource_name (string): Current name of the resource (in case the resource is getting its name changed).
resource (intern.resource.boss.BossResource): New attributes for the resource.
url_prefix (string): Pr... | [
"Updates",
"an",
"entity",
"in",
"the",
"data",
"model",
"using",
"the",
"given",
"resource",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L796-L831 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1.delete | def delete(self, resource, url_prefix, auth, session, send_opts):
"""Deletes the entity described by the given resource.
Args:
resource (intern.resource.boss.BossResource)
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to sen... | python | def delete(self, resource, url_prefix, auth, session, send_opts):
"""Deletes the entity described by the given resource.
Args:
resource (intern.resource.boss.BossResource)
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to sen... | [
"def",
"delete",
"(",
"self",
",",
"resource",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"req",
"=",
"self",
".",
"get_request",
"(",
"resource",
",",
"'DELETE'",
",",
"'application/json'",
",",
"url_prefix",
",",
"auth",
... | Deletes the entity described by the given resource.
Args:
resource (intern.resource.boss.BossResource)
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to send in the request header.
session (requests.Session): HTTP session... | [
"Deletes",
"the",
"entity",
"described",
"by",
"the",
"given",
"resource",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L834-L856 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1._get_resource_params | def _get_resource_params(self, resource, for_update=False):
"""Get dictionary containing all parameters for the given resource.
When getting params for a coordinate frame update, only name and
description are returned because they are the only fields that can
be updated.
Args:
... | python | def _get_resource_params(self, resource, for_update=False):
"""Get dictionary containing all parameters for the given resource.
When getting params for a coordinate frame update, only name and
description are returned because they are the only fields that can
be updated.
Args:
... | [
"def",
"_get_resource_params",
"(",
"self",
",",
"resource",
",",
"for_update",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"resource",
",",
"CollectionResource",
")",
":",
"return",
"self",
".",
"_get_collection_params",
"(",
"resource",
")",
"if",
"isin... | Get dictionary containing all parameters for the given resource.
When getting params for a coordinate frame update, only name and
description are returned because they are the only fields that can
be updated.
Args:
resource (intern.resource.boss.resource.BossResource): A su... | [
"Get",
"dictionary",
"containing",
"all",
"parameters",
"for",
"the",
"given",
"resource",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L858-L889 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1._create_resource_from_dict | def _create_resource_from_dict(self, resource, dict):
"""
Args:
resource (intern.resource.boss.BossResource): Used to determine type of resource to create.
dict (dictionary): JSON data returned by the Boss API.
Returns:
(intern.resource.boss.BossResource): In... | python | def _create_resource_from_dict(self, resource, dict):
"""
Args:
resource (intern.resource.boss.BossResource): Used to determine type of resource to create.
dict (dictionary): JSON data returned by the Boss API.
Returns:
(intern.resource.boss.BossResource): In... | [
"def",
"_create_resource_from_dict",
"(",
"self",
",",
"resource",
",",
"dict",
")",
":",
"if",
"isinstance",
"(",
"resource",
",",
"CollectionResource",
")",
":",
"return",
"self",
".",
"_get_collection",
"(",
"dict",
")",
"if",
"isinstance",
"(",
"resource",... | Args:
resource (intern.resource.boss.BossResource): Used to determine type of resource to create.
dict (dictionary): JSON data returned by the Boss API.
Returns:
(intern.resource.boss.BossResource): Instance populated with values from dict.
Raises:
KeyEr... | [
"Args",
":",
"resource",
"(",
"intern",
".",
"resource",
".",
"boss",
".",
"BossResource",
")",
":",
"Used",
"to",
"determine",
"type",
"of",
"resource",
"to",
"create",
".",
"dict",
"(",
"dictionary",
")",
":",
"JSON",
"data",
"returned",
"by",
"the",
... | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L955-L980 |
jhuapl-boss/intern | intern/service/boss/v1/project.py | ProjectService_1._get_resource_list | def _get_resource_list(self, rsrc_dict):
"""Extracts list of resources from the HTTP response.
Args:
rsrc_dict (dict): HTTP response encoded in a dictionary.
Returns:
(list[string]): List of a type of resource (collections, experiments, etc).
Raises:
... | python | def _get_resource_list(self, rsrc_dict):
"""Extracts list of resources from the HTTP response.
Args:
rsrc_dict (dict): HTTP response encoded in a dictionary.
Returns:
(list[string]): List of a type of resource (collections, experiments, etc).
Raises:
... | [
"def",
"_get_resource_list",
"(",
"self",
",",
"rsrc_dict",
")",
":",
"if",
"'collections'",
"in",
"rsrc_dict",
":",
"return",
"rsrc_dict",
"[",
"'collections'",
"]",
"if",
"'experiments'",
"in",
"rsrc_dict",
":",
"return",
"rsrc_dict",
"[",
"'experiments'",
"]"... | Extracts list of resources from the HTTP response.
Args:
rsrc_dict (dict): HTTP response encoded in a dictionary.
Returns:
(list[string]): List of a type of resource (collections, experiments, etc).
Raises:
(RuntimeError): If rsrc_dict does not contain any ... | [
"Extracts",
"list",
"of",
"resources",
"from",
"the",
"HTTP",
"response",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L1024-L1045 |
jhuapl-boss/intern | intern/__init__.py | check_version | def check_version():
"""
Tells you if you have an old version of intern.
"""
import requests
r = requests.get('https://pypi.python.org/pypi/intern/json').json()
r = r['info']['version']
if r != __version__:
print("You are using version {}. A newer version of intern is available: {} "... | python | def check_version():
"""
Tells you if you have an old version of intern.
"""
import requests
r = requests.get('https://pypi.python.org/pypi/intern/json').json()
r = r['info']['version']
if r != __version__:
print("You are using version {}. A newer version of intern is available: {} "... | [
"def",
"check_version",
"(",
")",
":",
"import",
"requests",
"r",
"=",
"requests",
".",
"get",
"(",
"'https://pypi.python.org/pypi/intern/json'",
")",
".",
"json",
"(",
")",
"r",
"=",
"r",
"[",
"'info'",
"]",
"[",
"'version'",
"]",
"if",
"r",
"!=",
"__ve... | Tells you if you have an old version of intern. | [
"Tells",
"you",
"if",
"you",
"have",
"an",
"old",
"version",
"of",
"intern",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/__init__.py#L8-L18 |
jhuapl-boss/intern | intern/service/boss/volume.py | check_channel | def check_channel(fcn):
"""Decorator that ensures a valid channel passed in.
Args:
fcn (function): Function that has a ChannelResource as its second argument.
Returns:
(function): Wraps given function with one that checks for a valid channel.
"""
def wrapper(*args, **kwargs):
... | python | def check_channel(fcn):
"""Decorator that ensures a valid channel passed in.
Args:
fcn (function): Function that has a ChannelResource as its second argument.
Returns:
(function): Wraps given function with one that checks for a valid channel.
"""
def wrapper(*args, **kwargs):
... | [
"def",
"check_channel",
"(",
"fcn",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"args",
"[",
"1",
"]",
",",
"ChannelResource",
")",
":",
"raise",
"RuntimeError",
"(",
"'resource must ... | Decorator that ensures a valid channel passed in.
Args:
fcn (function): Function that has a ChannelResource as its second argument.
Returns:
(function): Wraps given function with one that checks for a valid channel. | [
"Decorator",
"that",
"ensures",
"a",
"valid",
"channel",
"passed",
"in",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/volume.py#L20-L40 |
jhuapl-boss/intern | intern/service/boss/volume.py | VolumeService.get_cutout | def get_cutout(self, resource, resolution, x_range, y_range, z_range, time_range=None, id_list=[], access_mode=CacheMode.no_cache, **kwargs):
"""Get a cutout from the volume service.
Args:
resource (intern.resource.boss.resource.ChannelResource): Channel or layer resource.
resol... | python | def get_cutout(self, resource, resolution, x_range, y_range, z_range, time_range=None, id_list=[], access_mode=CacheMode.no_cache, **kwargs):
"""Get a cutout from the volume service.
Args:
resource (intern.resource.boss.resource.ChannelResource): Channel or layer resource.
resol... | [
"def",
"get_cutout",
"(",
"self",
",",
"resource",
",",
"resolution",
",",
"x_range",
",",
"y_range",
",",
"z_range",
",",
"time_range",
"=",
"None",
",",
"id_list",
"=",
"[",
"]",
",",
"access_mode",
"=",
"CacheMode",
".",
"no_cache",
",",
"*",
"*",
"... | Get a cutout from the volume service.
Args:
resource (intern.resource.boss.resource.ChannelResource): Channel or layer resource.
resolution (int): 0 indicates native resolution.
x_range (list[int]): x range such as [10, 20] which means x>=10 and x<20.
y_range (li... | [
"Get",
"a",
"cutout",
"from",
"the",
"volume",
"service",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/volume.py#L84-L110 |
jhuapl-boss/intern | intern/service/boss/volume.py | VolumeService.reserve_ids | def reserve_ids(self, resource, num_ids):
"""Reserve a block of unique, sequential ids for annotations.
Args:
resource (intern.resource.Resource): Resource should be an annotation channel.
num_ids (int): Number of ids to reserve.
Returns:
(int): First id res... | python | def reserve_ids(self, resource, num_ids):
"""Reserve a block of unique, sequential ids for annotations.
Args:
resource (intern.resource.Resource): Resource should be an annotation channel.
num_ids (int): Number of ids to reserve.
Returns:
(int): First id res... | [
"def",
"reserve_ids",
"(",
"self",
",",
"resource",
",",
"num_ids",
")",
":",
"return",
"self",
".",
"service",
".",
"reserve_ids",
"(",
"resource",
",",
"num_ids",
",",
"self",
".",
"url_prefix",
",",
"self",
".",
"auth",
",",
"self",
".",
"session",
... | Reserve a block of unique, sequential ids for annotations.
Args:
resource (intern.resource.Resource): Resource should be an annotation channel.
num_ids (int): Number of ids to reserve.
Returns:
(int): First id reserved. | [
"Reserve",
"a",
"block",
"of",
"unique",
"sequential",
"ids",
"for",
"annotations",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/volume.py#L113-L126 |
jhuapl-boss/intern | intern/service/boss/volume.py | VolumeService.get_bounding_box | def get_bounding_box(self, resource, resolution, id, bb_type='loose'):
"""Get bounding box containing object specified by id.
Currently only supports 'loose' bounding boxes. The bounding box
returned is cuboid aligned.
Args:
resource (intern.resource.Resource): Resource co... | python | def get_bounding_box(self, resource, resolution, id, bb_type='loose'):
"""Get bounding box containing object specified by id.
Currently only supports 'loose' bounding boxes. The bounding box
returned is cuboid aligned.
Args:
resource (intern.resource.Resource): Resource co... | [
"def",
"get_bounding_box",
"(",
"self",
",",
"resource",
",",
"resolution",
",",
"id",
",",
"bb_type",
"=",
"'loose'",
")",
":",
"return",
"self",
".",
"service",
".",
"get_bounding_box",
"(",
"resource",
",",
"resolution",
",",
"id",
",",
"bb_type",
",",
... | Get bounding box containing object specified by id.
Currently only supports 'loose' bounding boxes. The bounding box
returned is cuboid aligned.
Args:
resource (intern.resource.Resource): Resource compatible with annotation operations.
resolution (int): 0 indicates nat... | [
"Get",
"bounding",
"box",
"containing",
"object",
"specified",
"by",
"id",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/volume.py#L129-L146 |
jhuapl-boss/intern | intern/service/boss/volume.py | VolumeService.get_ids_in_region | def get_ids_in_region(
self, resource, resolution,
x_range, y_range, z_range, time_range=[0, 1]):
"""Get all ids in the region defined by x_range, y_range, z_range.
Args:
resource (intern.resource.Resource): An annotation channel.
resolution (int): 0 indi... | python | def get_ids_in_region(
self, resource, resolution,
x_range, y_range, z_range, time_range=[0, 1]):
"""Get all ids in the region defined by x_range, y_range, z_range.
Args:
resource (intern.resource.Resource): An annotation channel.
resolution (int): 0 indi... | [
"def",
"get_ids_in_region",
"(",
"self",
",",
"resource",
",",
"resolution",
",",
"x_range",
",",
"y_range",
",",
"z_range",
",",
"time_range",
"=",
"[",
"0",
",",
"1",
"]",
")",
":",
"return",
"self",
".",
"service",
".",
"get_ids_in_region",
"(",
"reso... | Get all ids in the region defined by x_range, y_range, z_range.
Args:
resource (intern.resource.Resource): An annotation channel.
resolution (int): 0 indicates native resolution.
x_range (list[int]): x range such as [10, 20] which means x>=10 and x<20.
y_range (l... | [
"Get",
"all",
"ids",
"in",
"the",
"region",
"defined",
"by",
"x_range",
"y_range",
"z_range",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/volume.py#L149-L171 |
jhuapl-boss/intern | intern/service/boss/volume.py | VolumeService.get_neuroglancer_link | def get_neuroglancer_link(self, resource, resolution, x_range, y_range, z_range, **kwargs):
"""
Get a neuroglancer link of the cutout specified from the host specified in the remote configuration step.
Args:
resource (intern.resource.Resource): Resource compatible with cutout opera... | python | def get_neuroglancer_link(self, resource, resolution, x_range, y_range, z_range, **kwargs):
"""
Get a neuroglancer link of the cutout specified from the host specified in the remote configuration step.
Args:
resource (intern.resource.Resource): Resource compatible with cutout opera... | [
"def",
"get_neuroglancer_link",
"(",
"self",
",",
"resource",
",",
"resolution",
",",
"x_range",
",",
"y_range",
",",
"z_range",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"service",
".",
"get_neuroglancer_link",
"(",
"resource",
",",
"resolut... | Get a neuroglancer link of the cutout specified from the host specified in the remote configuration step.
Args:
resource (intern.resource.Resource): Resource compatible with cutout operations.
resolution (int): 0 indicates native resolution.
x_range (list[int]): x range suc... | [
"Get",
"a",
"neuroglancer",
"link",
"of",
"the",
"cutout",
"specified",
"from",
"the",
"host",
"specified",
"in",
"the",
"remote",
"configuration",
"step",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/volume.py#L174-L192 |
jhuapl-boss/intern | intern/service/boss/v1/metadata.py | MetadataService_1.list | def list(self, resource, url_prefix, auth, session, send_opts):
"""List metadata keys associated with the given resource.
Args:
resource (intern.resource.boss.BossResource): List keys associated with this resource.
url_prefix (string): Protocol + host such as https://api.theboss... | python | def list(self, resource, url_prefix, auth, session, send_opts):
"""List metadata keys associated with the given resource.
Args:
resource (intern.resource.boss.BossResource): List keys associated with this resource.
url_prefix (string): Protocol + host such as https://api.theboss... | [
"def",
"list",
"(",
"self",
",",
"resource",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"req",
"=",
"self",
".",
"get_metadata_request",
"(",
"resource",
",",
"'GET'",
",",
"'application/json'",
",",
"url_prefix",
",",
"aut... | List metadata keys associated with the given resource.
Args:
resource (intern.resource.boss.BossResource): List keys associated with this resource.
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (string): Token to send in the request header.
... | [
"List",
"metadata",
"keys",
"associated",
"with",
"the",
"given",
"resource",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/metadata.py#L31-L59 |
jhuapl-boss/intern | intern/service/boss/v1/metadata.py | MetadataService_1.create | def create(self, resource, keys_vals, url_prefix, auth, session, send_opts):
"""Create the given key-value pairs for the given resource.
Will attempt to create all key-value pairs even if a failure is encountered.
Args:
resource (intern.resource.boss.BossResource): List keys associ... | python | def create(self, resource, keys_vals, url_prefix, auth, session, send_opts):
"""Create the given key-value pairs for the given resource.
Will attempt to create all key-value pairs even if a failure is encountered.
Args:
resource (intern.resource.boss.BossResource): List keys associ... | [
"def",
"create",
"(",
"self",
",",
"resource",
",",
"keys_vals",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"success",
"=",
"True",
"exc",
"=",
"HTTPErrorList",
"(",
"'At least one key-value create failed.'",
")",
"for",
"pair"... | Create the given key-value pairs for the given resource.
Will attempt to create all key-value pairs even if a failure is encountered.
Args:
resource (intern.resource.boss.BossResource): List keys associated with this resource.
keys_vals (dictionary): The metadata to associate w... | [
"Create",
"the",
"given",
"key",
"-",
"value",
"pairs",
"for",
"the",
"given",
"resource",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/metadata.py#L61-L98 |
jhuapl-boss/intern | intern/service/boss/v1/volume.py | VolumeService_1.get_bit_width | def get_bit_width(self, resource):
"""Method to return the bit width for blosc based on the Resource"""
datatype = resource.datatype
if "uint" in datatype:
bit_width = int(datatype.split("uint")[1])
else:
raise ValueError("Unsupported datatype: {}".format(datatyp... | python | def get_bit_width(self, resource):
"""Method to return the bit width for blosc based on the Resource"""
datatype = resource.datatype
if "uint" in datatype:
bit_width = int(datatype.split("uint")[1])
else:
raise ValueError("Unsupported datatype: {}".format(datatyp... | [
"def",
"get_bit_width",
"(",
"self",
",",
"resource",
")",
":",
"datatype",
"=",
"resource",
".",
"datatype",
"if",
"\"uint\"",
"in",
"datatype",
":",
"bit_width",
"=",
"int",
"(",
"datatype",
".",
"split",
"(",
"\"uint\"",
")",
"[",
"1",
"]",
")",
"el... | Method to return the bit width for blosc based on the Resource | [
"Method",
"to",
"return",
"the",
"bit",
"width",
"for",
"blosc",
"based",
"on",
"the",
"Resource"
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/volume.py#L38-L47 |
jhuapl-boss/intern | intern/service/boss/v1/volume.py | VolumeService_1.create_cutout | def create_cutout(
self, resource, resolution, x_range, y_range, z_range, time_range, numpyVolume,
url_prefix, auth, session, send_opts):
"""Upload a cutout to the Boss data store.
Args:
resource (intern.resource.resource.Resource): Resource compatible with cutout operations... | python | def create_cutout(
self, resource, resolution, x_range, y_range, z_range, time_range, numpyVolume,
url_prefix, auth, session, send_opts):
"""Upload a cutout to the Boss data store.
Args:
resource (intern.resource.resource.Resource): Resource compatible with cutout operations... | [
"def",
"create_cutout",
"(",
"self",
",",
"resource",
",",
"resolution",
",",
"x_range",
",",
"y_range",
",",
"z_range",
",",
"time_range",
",",
"numpyVolume",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"if",
"numpyVolume",
... | Upload a cutout to the Boss data store.
Args:
resource (intern.resource.resource.Resource): Resource compatible with cutout operations.
resolution (int): 0 indicates native resolution.
x_range (list[int]): x range such as [10, 20] which means x>=10 and x<20.
y_ra... | [
"Upload",
"a",
"cutout",
"to",
"the",
"Boss",
"data",
"store",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/volume.py#L49-L128 |
jhuapl-boss/intern | intern/service/boss/v1/volume.py | VolumeService_1.get_cutout | def get_cutout(
self, resource, resolution, x_range, y_range, z_range, time_range, id_list,
url_prefix, auth, session, send_opts, access_mode=CacheMode.no_cache, **kwargs
):
"""
Upload a cutout to the Boss data store.
Args:
resource (intern.resource.r... | python | def get_cutout(
self, resource, resolution, x_range, y_range, z_range, time_range, id_list,
url_prefix, auth, session, send_opts, access_mode=CacheMode.no_cache, **kwargs
):
"""
Upload a cutout to the Boss data store.
Args:
resource (intern.resource.r... | [
"def",
"get_cutout",
"(",
"self",
",",
"resource",
",",
"resolution",
",",
"x_range",
",",
"y_range",
",",
"z_range",
",",
"time_range",
",",
"id_list",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
",",
"access_mode",
"=",
"CacheMode",
... | Upload a cutout to the Boss data store.
Args:
resource (intern.resource.resource.Resource): Resource compatible
with cutout operations
resolution (int): 0 indicates native resolution.
x_range (list[int]): x range such as [10, 20] which means x>=10 and x<20.
... | [
"Upload",
"a",
"cutout",
"to",
"the",
"Boss",
"data",
"store",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/volume.py#L130-L245 |
jhuapl-boss/intern | intern/service/boss/v1/volume.py | VolumeService_1.reserve_ids | def reserve_ids(
self, resource, num_ids,
url_prefix, auth, session, send_opts):
"""Reserve a block of unique, sequential ids for annotations.
Args:
resource (intern.resource.Resource): Resource should be an annotation channel.
num_ids (int): Number of id... | python | def reserve_ids(
self, resource, num_ids,
url_prefix, auth, session, send_opts):
"""Reserve a block of unique, sequential ids for annotations.
Args:
resource (intern.resource.Resource): Resource should be an annotation channel.
num_ids (int): Number of id... | [
"def",
"reserve_ids",
"(",
"self",
",",
"resource",
",",
"num_ids",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"if",
"not",
"isinstance",
"(",
"resource",
",",
"ChannelResource",
")",
":",
"raise",
"TypeError",
"(",
"'resou... | Reserve a block of unique, sequential ids for annotations.
Args:
resource (intern.resource.Resource): Resource should be an annotation channel.
num_ids (int): Number of ids to reserve.
url_prefix (string): Protocol + host such as https://api.theboss.io
auth (stri... | [
"Reserve",
"a",
"block",
"of",
"unique",
"sequential",
"ids",
"for",
"annotations",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/volume.py#L247-L283 |
jhuapl-boss/intern | intern/service/boss/v1/volume.py | VolumeService_1.get_bounding_box | def get_bounding_box(
self, resource, resolution, _id, bb_type,
url_prefix, auth, session, send_opts):
"""Get bounding box containing object specified by id.
Currently only supports 'loose' bounding boxes. The bounding box
returned is cuboid aligned.
Args:
... | python | def get_bounding_box(
self, resource, resolution, _id, bb_type,
url_prefix, auth, session, send_opts):
"""Get bounding box containing object specified by id.
Currently only supports 'loose' bounding boxes. The bounding box
returned is cuboid aligned.
Args:
... | [
"def",
"get_bounding_box",
"(",
"self",
",",
"resource",
",",
"resolution",
",",
"_id",
",",
"bb_type",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"if",
"not",
"isinstance",
"(",
"resource",
",",
"ChannelResource",
")",
":"... | Get bounding box containing object specified by id.
Currently only supports 'loose' bounding boxes. The bounding box
returned is cuboid aligned.
Args:
resource (intern.resource.Resource): Resource compatible with annotation operations.
resolution (int): 0 indicates nat... | [
"Get",
"bounding",
"box",
"containing",
"object",
"specified",
"by",
"id",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/volume.py#L285-L328 |
jhuapl-boss/intern | intern/service/boss/v1/volume.py | VolumeService_1.get_ids_in_region | def get_ids_in_region(
self, resource, resolution, x_range, y_range, z_range, time_range,
url_prefix, auth, session, send_opts):
"""Get all ids in the region defined by x_range, y_range, z_range.
Args:
resource (intern.resource.Resource): An annotation channel.
... | python | def get_ids_in_region(
self, resource, resolution, x_range, y_range, z_range, time_range,
url_prefix, auth, session, send_opts):
"""Get all ids in the region defined by x_range, y_range, z_range.
Args:
resource (intern.resource.Resource): An annotation channel.
... | [
"def",
"get_ids_in_region",
"(",
"self",
",",
"resource",
",",
"resolution",
",",
"x_range",
",",
"y_range",
",",
"z_range",
",",
"time_range",
",",
"url_prefix",
",",
"auth",
",",
"session",
",",
"send_opts",
")",
":",
"if",
"not",
"isinstance",
"(",
"res... | Get all ids in the region defined by x_range, y_range, z_range.
Args:
resource (intern.resource.Resource): An annotation channel.
resolution (int): 0 indicates native resolution.
x_range (list[int]): x range such as [10, 20] which means x>=10 and x<20.
y_range (l... | [
"Get",
"all",
"ids",
"in",
"the",
"region",
"defined",
"by",
"x_range",
"y_range",
"z_range",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/volume.py#L330-L374 |
jhuapl-boss/intern | intern/service/boss/v1/volume.py | VolumeService_1.get_neuroglancer_link | def get_neuroglancer_link(self, resource, resolution, x_range, y_range, z_range, url_prefix, **kwargs):
"""
Get a neuroglancer link of the cutout specified from the host specified in the remote configuration step.
Args:
resource (intern.resource.Resource): Resource compatible with c... | python | def get_neuroglancer_link(self, resource, resolution, x_range, y_range, z_range, url_prefix, **kwargs):
"""
Get a neuroglancer link of the cutout specified from the host specified in the remote configuration step.
Args:
resource (intern.resource.Resource): Resource compatible with c... | [
"def",
"get_neuroglancer_link",
"(",
"self",
",",
"resource",
",",
"resolution",
",",
"x_range",
",",
"y_range",
",",
"z_range",
",",
"url_prefix",
",",
"*",
"*",
"kwargs",
")",
":",
"link",
"=",
"\"https://neuroglancer.theboss.io/#!{'layers':{'\"",
"+",
"str",
... | Get a neuroglancer link of the cutout specified from the host specified in the remote configuration step.
Args:
resource (intern.resource.Resource): Resource compatible with cutout operations.
resolution (int): 0 indicates native resolution.
x_range (list[int]): x range such... | [
"Get",
"a",
"neuroglancer",
"link",
"of",
"the",
"cutout",
"specified",
"from",
"the",
"host",
"specified",
"in",
"the",
"remote",
"configuration",
"step",
"."
] | train | https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/volume.py#L376-L396 |
falkr/stmpy | stmpy/__init__.py | get_graphviz_dot | def get_graphviz_dot(machine):
"""
Return the graph of the state machine.
The format is the dot format for Graphviz, and can be directly used as input
to Graphviz.
To learn more about Graphviz, visit https://graphviz.gitlab.io.
**Display in Jupyter Notebook**
Install Python support for Gr... | python | def get_graphviz_dot(machine):
"""
Return the graph of the state machine.
The format is the dot format for Graphviz, and can be directly used as input
to Graphviz.
To learn more about Graphviz, visit https://graphviz.gitlab.io.
**Display in Jupyter Notebook**
Install Python support for Gr... | [
"def",
"get_graphviz_dot",
"(",
"machine",
")",
":",
"s",
"=",
"[",
"]",
"s",
".",
"append",
"(",
"'digraph G {\\n'",
")",
"s",
".",
"append",
"(",
"'node [shape=box style=rounded fontname=Helvetica];\\n'",
")",
"s",
".",
"append",
"(",
"'edge [ fontname=Helvetica... | Return the graph of the state machine.
The format is the dot format for Graphviz, and can be directly used as input
to Graphviz.
To learn more about Graphviz, visit https://graphviz.gitlab.io.
**Display in Jupyter Notebook**
Install Python support for Graphviz via `pip install graphviz`.
Inst... | [
"Return",
"the",
"graph",
"of",
"the",
"state",
"machine",
"."
] | train | https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L80-L139 |
falkr/stmpy | stmpy/__init__.py | _parse_arg_list | def _parse_arg_list(arglist):
"""
Parses a list of arguments.
Arguments are expected to be split by a comma, surrounded by any amount
of whitespace. Arguments are then run through Python's eval() method.
"""
args = []
for arg in arglist.split(','):
arg = arg.strip()
if arg: ... | python | def _parse_arg_list(arglist):
"""
Parses a list of arguments.
Arguments are expected to be split by a comma, surrounded by any amount
of whitespace. Arguments are then run through Python's eval() method.
"""
args = []
for arg in arglist.split(','):
arg = arg.strip()
if arg: ... | [
"def",
"_parse_arg_list",
"(",
"arglist",
")",
":",
"args",
"=",
"[",
"]",
"for",
"arg",
"in",
"arglist",
".",
"split",
"(",
"','",
")",
":",
"arg",
"=",
"arg",
".",
"strip",
"(",
")",
"if",
"arg",
":",
"# string is not empty",
"args",
".",
"append",... | Parses a list of arguments.
Arguments are expected to be split by a comma, surrounded by any amount
of whitespace. Arguments are then run through Python's eval() method. | [
"Parses",
"a",
"list",
"of",
"arguments",
"."
] | train | https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L141-L153 |
falkr/stmpy | stmpy/__init__.py | _parse_action | def _parse_action(action):
"""
Parses a single action item, for instance one of the following:
m; m(); m(True); m(*)
The brackets must match.
"""
i_open = action.find('(')
if i_open is -1:
# return action name, finished
return {'name': action, 'args': [], 'event_args': ... | python | def _parse_action(action):
"""
Parses a single action item, for instance one of the following:
m; m(); m(True); m(*)
The brackets must match.
"""
i_open = action.find('(')
if i_open is -1:
# return action name, finished
return {'name': action, 'args': [], 'event_args': ... | [
"def",
"_parse_action",
"(",
"action",
")",
":",
"i_open",
"=",
"action",
".",
"find",
"(",
"'('",
")",
"if",
"i_open",
"is",
"-",
"1",
":",
"# return action name, finished",
"return",
"{",
"'name'",
":",
"action",
",",
"'args'",
":",
"[",
"]",
",",
"'... | Parses a single action item, for instance one of the following:
m; m(); m(True); m(*)
The brackets must match. | [
"Parses",
"a",
"single",
"action",
"item",
"for",
"instance",
"one",
"of",
"the",
"following",
":"
] | train | https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L155-L178 |
falkr/stmpy | stmpy/__init__.py | _parse_action_list_attribute | def _parse_action_list_attribute(attribute):
"""
Parses a list of actions, as found in the effect attribute of
transitions, and the enry and exit actions of states.
Actions are separated by a semicolon, surrounded by any amount of
whitespace. A action can have the following form:
m; m(); m... | python | def _parse_action_list_attribute(attribute):
"""
Parses a list of actions, as found in the effect attribute of
transitions, and the enry and exit actions of states.
Actions are separated by a semicolon, surrounded by any amount of
whitespace. A action can have the following form:
m; m(); m... | [
"def",
"_parse_action_list_attribute",
"(",
"attribute",
")",
":",
"actions",
"=",
"[",
"]",
"for",
"action_call",
"in",
"attribute",
".",
"split",
"(",
"';'",
")",
":",
"action_call",
"=",
"action_call",
".",
"strip",
"(",
")",
"if",
"action_call",
":",
"... | Parses a list of actions, as found in the effect attribute of
transitions, and the enry and exit actions of states.
Actions are separated by a semicolon, surrounded by any amount of
whitespace. A action can have the following form:
m; m(); m(True); m(*)
The asterisk that the state machine sho... | [
"Parses",
"a",
"list",
"of",
"actions",
"as",
"found",
"in",
"the",
"effect",
"attribute",
"of",
"transitions",
"and",
"the",
"enry",
"and",
"exit",
"actions",
"of",
"states",
"."
] | train | https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L180-L198 |
falkr/stmpy | stmpy/__init__.py | Driver.print_status | def print_status(self):
"""Provide a snapshot of the current status."""
s = []
s.append('=== State Machines: ===\n')
for stm_id in Driver._stms_by_id:
stm = Driver._stms_by_id[stm_id]
s.append(' - {} in state {}\n'.format(stm.id, stm.state))
s.append('=... | python | def print_status(self):
"""Provide a snapshot of the current status."""
s = []
s.append('=== State Machines: ===\n')
for stm_id in Driver._stms_by_id:
stm = Driver._stms_by_id[stm_id]
s.append(' - {} in state {}\n'.format(stm.id, stm.state))
s.append('=... | [
"def",
"print_status",
"(",
"self",
")",
":",
"s",
"=",
"[",
"]",
"s",
".",
"append",
"(",
"'=== State Machines: ===\\n'",
")",
"for",
"stm_id",
"in",
"Driver",
".",
"_stms_by_id",
":",
"stm",
"=",
"Driver",
".",
"_stms_by_id",
"[",
"stm_id",
"]",
"s",
... | Provide a snapshot of the current status. | [
"Provide",
"a",
"snapshot",
"of",
"the",
"current",
"status",
"."
] | train | https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L242-L260 |
falkr/stmpy | stmpy/__init__.py | Driver.add_machine | def add_machine(self, machine):
"""Add the state machine to this driver."""
self._logger.debug('Adding machine {} to driver'.format(machine.id))
machine._driver = self
machine._reset()
if machine.id is not None:
# TODO warning when STM already registered
D... | python | def add_machine(self, machine):
"""Add the state machine to this driver."""
self._logger.debug('Adding machine {} to driver'.format(machine.id))
machine._driver = self
machine._reset()
if machine.id is not None:
# TODO warning when STM already registered
D... | [
"def",
"add_machine",
"(",
"self",
",",
"machine",
")",
":",
"self",
".",
"_logger",
".",
"debug",
"(",
"'Adding machine {} to driver'",
".",
"format",
"(",
"machine",
".",
"id",
")",
")",
"machine",
".",
"_driver",
"=",
"self",
"machine",
".",
"_reset",
... | Add the state machine to this driver. | [
"Add",
"the",
"state",
"machine",
"to",
"this",
"driver",
"."
] | train | https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L262-L270 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.