repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
DarkEnergySurvey/ugali | ugali/observation/mask.py | Mask._solidAngleMMD | def _solidAngleMMD(self):
"""
Compute solid angle within the mask annulus (deg^2) as a
function of mag_1 and mag_2
"""
# Take upper corner of the magnitude bin
mag_2,mag_1 = np.meshgrid(self.roi.bins_mag[1:],self.roi.bins_mag[1:])
# Havent tested since adding fra... | python | def _solidAngleMMD(self):
"""
Compute solid angle within the mask annulus (deg^2) as a
function of mag_1 and mag_2
"""
# Take upper corner of the magnitude bin
mag_2,mag_1 = np.meshgrid(self.roi.bins_mag[1:],self.roi.bins_mag[1:])
# Havent tested since adding fra... | [
"def",
"_solidAngleMMD",
"(",
"self",
")",
":",
"# Take upper corner of the magnitude bin",
"mag_2",
",",
"mag_1",
"=",
"np",
".",
"meshgrid",
"(",
"self",
".",
"roi",
".",
"bins_mag",
"[",
"1",
":",
"]",
",",
"self",
".",
"roi",
".",
"bins_mag",
"[",
"1... | Compute solid angle within the mask annulus (deg^2) as a
function of mag_1 and mag_2 | [
"Compute",
"solid",
"angle",
"within",
"the",
"mask",
"annulus",
"(",
"deg^2",
")",
"as",
"a",
"function",
"of",
"mag_1",
"and",
"mag_2"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L115-L133 | train | Compute solid angle within the mask annulus. |
DarkEnergySurvey/ugali | ugali/observation/mask.py | Mask._pruneMMD | def _pruneMMD(self, minimum_solid_angle):
"""
Remove regions of magnitude-magnitude space where the unmasked solid angle is
statistically insufficient to estimate the background.
INPUTS:
solid_angle[1]: minimum solid angle (deg^2)
"""
logger.info('Pruning ma... | python | def _pruneMMD(self, minimum_solid_angle):
"""
Remove regions of magnitude-magnitude space where the unmasked solid angle is
statistically insufficient to estimate the background.
INPUTS:
solid_angle[1]: minimum solid angle (deg^2)
"""
logger.info('Pruning ma... | [
"def",
"_pruneMMD",
"(",
"self",
",",
"minimum_solid_angle",
")",
":",
"logger",
".",
"info",
"(",
"'Pruning mask based on minimum solid angle of %.2f deg^2'",
"%",
"(",
"minimum_solid_angle",
")",
")",
"solid_angle_mmd",
"=",
"self",
".",
"solid_angle_mmd",
"*",
"(",... | Remove regions of magnitude-magnitude space where the unmasked solid angle is
statistically insufficient to estimate the background.
INPUTS:
solid_angle[1]: minimum solid angle (deg^2) | [
"Remove",
"regions",
"of",
"magnitude",
"-",
"magnitude",
"space",
"where",
"the",
"unmasked",
"solid",
"angle",
"is",
"statistically",
"insufficient",
"to",
"estimate",
"the",
"background",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L135-L162 | train | Remove regions of magnitude - magnitude space where the unmasked solid angle isometric insufficient to estimate the background. |
DarkEnergySurvey/ugali | ugali/observation/mask.py | Mask._solidAngleCMD | def _solidAngleCMD(self):
"""
Compute solid angle within the mask annulus (deg^2) as a
function of color and magnitude.
"""
self.solid_angle_cmd = np.zeros([len(self.roi.centers_mag),
len(self.roi.centers_color)])
for index_ma... | python | def _solidAngleCMD(self):
"""
Compute solid angle within the mask annulus (deg^2) as a
function of color and magnitude.
"""
self.solid_angle_cmd = np.zeros([len(self.roi.centers_mag),
len(self.roi.centers_color)])
for index_ma... | [
"def",
"_solidAngleCMD",
"(",
"self",
")",
":",
"self",
".",
"solid_angle_cmd",
"=",
"np",
".",
"zeros",
"(",
"[",
"len",
"(",
"self",
".",
"roi",
".",
"centers_mag",
")",
",",
"len",
"(",
"self",
".",
"roi",
".",
"centers_color",
")",
"]",
")",
"f... | Compute solid angle within the mask annulus (deg^2) as a
function of color and magnitude. | [
"Compute",
"solid",
"angle",
"within",
"the",
"mask",
"annulus",
"(",
"deg^2",
")",
"as",
"a",
"function",
"of",
"color",
"and",
"magnitude",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L164-L213 | train | Compute solid angle within the mask annulus. |
DarkEnergySurvey/ugali | ugali/observation/mask.py | Mask._pruneCMD | def _pruneCMD(self, minimum_solid_angle):
"""
Remove regions of color-magnitude space where the unmasked solid angle is
statistically insufficient to estimate the background.
ADW: Why are we clipping at the bin center instead of edge?
INPUTS:
solid_angle[1]: minimum... | python | def _pruneCMD(self, minimum_solid_angle):
"""
Remove regions of color-magnitude space where the unmasked solid angle is
statistically insufficient to estimate the background.
ADW: Why are we clipping at the bin center instead of edge?
INPUTS:
solid_angle[1]: minimum... | [
"def",
"_pruneCMD",
"(",
"self",
",",
"minimum_solid_angle",
")",
":",
"logger",
".",
"info",
"(",
"'Pruning mask based on minimum solid angle of %.2f deg^2'",
"%",
"(",
"minimum_solid_angle",
")",
")",
"self",
".",
"solid_angle_cmd",
"*=",
"self",
".",
"solid_angle_c... | Remove regions of color-magnitude space where the unmasked solid angle is
statistically insufficient to estimate the background.
ADW: Why are we clipping at the bin center instead of edge?
INPUTS:
solid_angle[1]: minimum solid angle (deg^2) | [
"Remove",
"regions",
"of",
"color",
"-",
"magnitude",
"space",
"where",
"the",
"unmasked",
"solid",
"angle",
"is",
"statistically",
"insufficient",
"to",
"estimate",
"the",
"background",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L257-L294 | train | Remove regions of color - magnitude space where the unmasked solid angle is not insufficient to estimate the background. |
DarkEnergySurvey/ugali | ugali/observation/mask.py | Mask.completeness | def completeness(self, delta, method='step'):
"""
Return the completeness as a function of magnitude.
ADW: Eventually want a completeness mask to set overall efficiency.
"""
delta = np.asarray(delta)
if method == 'step':
func = lambda delta: (delta > 0).astyp... | python | def completeness(self, delta, method='step'):
"""
Return the completeness as a function of magnitude.
ADW: Eventually want a completeness mask to set overall efficiency.
"""
delta = np.asarray(delta)
if method == 'step':
func = lambda delta: (delta > 0).astyp... | [
"def",
"completeness",
"(",
"self",
",",
"delta",
",",
"method",
"=",
"'step'",
")",
":",
"delta",
"=",
"np",
".",
"asarray",
"(",
"delta",
")",
"if",
"method",
"==",
"'step'",
":",
"func",
"=",
"lambda",
"delta",
":",
"(",
"delta",
">",
"0",
")",
... | Return the completeness as a function of magnitude.
ADW: Eventually want a completeness mask to set overall efficiency. | [
"Return",
"the",
"completeness",
"as",
"a",
"function",
"of",
"magnitude",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L297-L326 | train | Return the completeness as a function of magnitude. |
DarkEnergySurvey/ugali | ugali/observation/mask.py | Mask._photometricErrors | def _photometricErrors(self, catalog=None, n_per_bin=100):
"""
Realistic photometric errors estimated from catalog objects and mask.
Extend below the magnitude threshold with a flat extrapolation.
"""
if catalog is None:
# Simple proxy for photometric errors
... | python | def _photometricErrors(self, catalog=None, n_per_bin=100):
"""
Realistic photometric errors estimated from catalog objects and mask.
Extend below the magnitude threshold with a flat extrapolation.
"""
if catalog is None:
# Simple proxy for photometric errors
... | [
"def",
"_photometricErrors",
"(",
"self",
",",
"catalog",
"=",
"None",
",",
"n_per_bin",
"=",
"100",
")",
":",
"if",
"catalog",
"is",
"None",
":",
"# Simple proxy for photometric errors",
"release",
"=",
"self",
".",
"config",
"[",
"'data'",
"]",
"[",
"'rele... | Realistic photometric errors estimated from catalog objects and mask.
Extend below the magnitude threshold with a flat extrapolation. | [
"Realistic",
"photometric",
"errors",
"estimated",
"from",
"catalog",
"objects",
"and",
"mask",
".",
"Extend",
"below",
"the",
"magnitude",
"threshold",
"with",
"a",
"flat",
"extrapolation",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L328-L404 | train | Return the photometric errors for a given catalog object. |
DarkEnergySurvey/ugali | ugali/observation/mask.py | Mask.plotSolidAngleCMD | def plotSolidAngleCMD(self):
"""
Solid angle within the mask as a function of color and magnitude.
"""
msg = "'%s.plotSolidAngleCMD': ADW 2018-05-05"%self.__class__.__name__
DeprecationWarning(msg)
import ugali.utils.plotting
ugali.utils.plotting.twoDimen... | python | def plotSolidAngleCMD(self):
"""
Solid angle within the mask as a function of color and magnitude.
"""
msg = "'%s.plotSolidAngleCMD': ADW 2018-05-05"%self.__class__.__name__
DeprecationWarning(msg)
import ugali.utils.plotting
ugali.utils.plotting.twoDimen... | [
"def",
"plotSolidAngleCMD",
"(",
"self",
")",
":",
"msg",
"=",
"\"'%s.plotSolidAngleCMD': ADW 2018-05-05\"",
"%",
"self",
".",
"__class__",
".",
"__name__",
"DeprecationWarning",
"(",
"msg",
")",
"import",
"ugali",
".",
"utils",
".",
"plotting",
"ugali",
".",
"u... | Solid angle within the mask as a function of color and magnitude. | [
"Solid",
"angle",
"within",
"the",
"mask",
"as",
"a",
"function",
"of",
"color",
"and",
"magnitude",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L406-L421 | train | Function to plot solid angle within the mask. |
DarkEnergySurvey/ugali | ugali/observation/mask.py | Mask.plotSolidAngleMMD | def plotSolidAngleMMD(self):
"""
Solid angle within the mask as a function of color and magnitude.
"""
msg = "'%s.plotSolidAngleMMD': ADW 2018-05-05"%self.__class__.__name__
DeprecationWarning(msg)
import ugali.utils.plotting
ugali.utils.plotting.twoDime... | python | def plotSolidAngleMMD(self):
"""
Solid angle within the mask as a function of color and magnitude.
"""
msg = "'%s.plotSolidAngleMMD': ADW 2018-05-05"%self.__class__.__name__
DeprecationWarning(msg)
import ugali.utils.plotting
ugali.utils.plotting.twoDime... | [
"def",
"plotSolidAngleMMD",
"(",
"self",
")",
":",
"msg",
"=",
"\"'%s.plotSolidAngleMMD': ADW 2018-05-05\"",
"%",
"self",
".",
"__class__",
".",
"__name__",
"DeprecationWarning",
"(",
"msg",
")",
"import",
"ugali",
".",
"utils",
".",
"plotting",
"ugali",
".",
"u... | Solid angle within the mask as a function of color and magnitude. | [
"Solid",
"angle",
"within",
"the",
"mask",
"as",
"a",
"function",
"of",
"color",
"and",
"magnitude",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L423-L439 | train | Plots the solid angle within the mask as a function of color and magnitude. |
DarkEnergySurvey/ugali | ugali/observation/mask.py | Mask.backgroundMMD | def backgroundMMD(self, catalog, method='cloud-in-cells', weights=None):
"""
Generate an empirical background model in magnitude-magnitude space.
INPUTS:
catalog: Catalog object
OUTPUTS:
background
"""
# Select objects in annulus
... | python | def backgroundMMD(self, catalog, method='cloud-in-cells', weights=None):
"""
Generate an empirical background model in magnitude-magnitude space.
INPUTS:
catalog: Catalog object
OUTPUTS:
background
"""
# Select objects in annulus
... | [
"def",
"backgroundMMD",
"(",
"self",
",",
"catalog",
",",
"method",
"=",
"'cloud-in-cells'",
",",
"weights",
"=",
"None",
")",
":",
"# Select objects in annulus",
"cut_annulus",
"=",
"self",
".",
"roi",
".",
"inAnnulus",
"(",
"catalog",
".",
"lon",
",",
"cat... | Generate an empirical background model in magnitude-magnitude space.
INPUTS:
catalog: Catalog object
OUTPUTS:
background | [
"Generate",
"an",
"empirical",
"background",
"model",
"in",
"magnitude",
"-",
"magnitude",
"space",
".",
"INPUTS",
":",
"catalog",
":",
"Catalog",
"object",
"OUTPUTS",
":",
"background"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L443-L544 | train | Generates an empirical background model in magnitude - magnitude space. |
DarkEnergySurvey/ugali | ugali/observation/mask.py | Mask.backgroundCMD | def backgroundCMD(self, catalog, mode='cloud-in-cells', weights=None):
"""
Generate an empirical background model in color-magnitude space.
INPUTS:
catalog: Catalog object
OUTPUTS:
background
"""
# Select objects in annulus
cut_an... | python | def backgroundCMD(self, catalog, mode='cloud-in-cells', weights=None):
"""
Generate an empirical background model in color-magnitude space.
INPUTS:
catalog: Catalog object
OUTPUTS:
background
"""
# Select objects in annulus
cut_an... | [
"def",
"backgroundCMD",
"(",
"self",
",",
"catalog",
",",
"mode",
"=",
"'cloud-in-cells'",
",",
"weights",
"=",
"None",
")",
":",
"# Select objects in annulus",
"cut_annulus",
"=",
"self",
".",
"roi",
".",
"inAnnulus",
"(",
"catalog",
".",
"lon",
",",
"catal... | Generate an empirical background model in color-magnitude space.
INPUTS:
catalog: Catalog object
OUTPUTS:
background | [
"Generate",
"an",
"empirical",
"background",
"model",
"in",
"color",
"-",
"magnitude",
"space",
".",
"INPUTS",
":",
"catalog",
":",
"Catalog",
"object",
"OUTPUTS",
":",
"background"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L546-L649 | train | Generates an empirical background model in color - magnitude space. |
DarkEnergySurvey/ugali | ugali/observation/mask.py | Mask.restrictCatalogToObservableSpaceMMD | def restrictCatalogToObservableSpaceMMD(self, catalog):
"""
Retain only the catalog objects which fall within the observable (i.e., unmasked) space.
Parameters:
catalog: a Catalog object
Returns:
sel : boolean selection array where True means the object would be obser... | python | def restrictCatalogToObservableSpaceMMD(self, catalog):
"""
Retain only the catalog objects which fall within the observable (i.e., unmasked) space.
Parameters:
catalog: a Catalog object
Returns:
sel : boolean selection array where True means the object would be obser... | [
"def",
"restrictCatalogToObservableSpaceMMD",
"(",
"self",
",",
"catalog",
")",
":",
"# ADW: This creates a slope in color-magnitude space near the magnitude limit",
"# i.e., if color=g-r then you can't have an object with g-r=1 and mag_r > mask_r-1",
"# Depending on which is the detection band,... | Retain only the catalog objects which fall within the observable (i.e., unmasked) space.
Parameters:
catalog: a Catalog object
Returns:
sel : boolean selection array where True means the object would be observable (i.e., unmasked).
ADW: Careful, this function is fragile! The... | [
"Retain",
"only",
"the",
"catalog",
"objects",
"which",
"fall",
"within",
"the",
"observable",
"(",
"i",
".",
"e",
".",
"unmasked",
")",
"space",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L651-L684 | train | This function restricts the catalog objects to the observable space. |
DarkEnergySurvey/ugali | ugali/observation/mask.py | Mask.restrictCatalogToObservableSpaceCMD | def restrictCatalogToObservableSpaceCMD(self, catalog):
"""
Retain only the catalog objects which fall within the
observable (i.e., unmasked) space. NOTE: This returns a
*selection* (i.e., objects are retained if the value of the
output array is True).
Parameters:
... | python | def restrictCatalogToObservableSpaceCMD(self, catalog):
"""
Retain only the catalog objects which fall within the
observable (i.e., unmasked) space. NOTE: This returns a
*selection* (i.e., objects are retained if the value of the
output array is True).
Parameters:
... | [
"def",
"restrictCatalogToObservableSpaceCMD",
"(",
"self",
",",
"catalog",
")",
":",
"# ADW: This creates a slope in color-magnitude space near the magnitude limit",
"# i.e., if color=g-r then you can't have an object with g-r=1 and mag_r > mask_r-1",
"# Depending on which is the detection band,... | Retain only the catalog objects which fall within the
observable (i.e., unmasked) space. NOTE: This returns a
*selection* (i.e., objects are retained if the value of the
output array is True).
Parameters:
catalog: a Catalog object
Returns:
sel : boolean selec... | [
"Retain",
"only",
"the",
"catalog",
"objects",
"which",
"fall",
"within",
"the",
"observable",
"(",
"i",
".",
"e",
".",
"unmasked",
")",
"space",
".",
"NOTE",
":",
"This",
"returns",
"a",
"*",
"selection",
"*",
"(",
"i",
".",
"e",
".",
"objects",
"ar... | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L686-L732 | train | This function restricts the catalog to the observable space of the ROI - specific mask. |
DarkEnergySurvey/ugali | ugali/observation/mask.py | MaskBand.completeness | def completeness(self, mags, method='step'):
"""
Return the completeness as a function of magnitude.
ADW: Eventually want a completeness mask to set overall efficiency.
"""
if method == 'step':
func = lambda x: (x < self.mask_roi_unique[:,np.newaxis]).astype(float)
... | python | def completeness(self, mags, method='step'):
"""
Return the completeness as a function of magnitude.
ADW: Eventually want a completeness mask to set overall efficiency.
"""
if method == 'step':
func = lambda x: (x < self.mask_roi_unique[:,np.newaxis]).astype(float)
... | [
"def",
"completeness",
"(",
"self",
",",
"mags",
",",
"method",
"=",
"'step'",
")",
":",
"if",
"method",
"==",
"'step'",
":",
"func",
"=",
"lambda",
"x",
":",
"(",
"x",
"<",
"self",
".",
"mask_roi_unique",
"[",
":",
",",
"np",
".",
"newaxis",
"]",
... | Return the completeness as a function of magnitude.
ADW: Eventually want a completeness mask to set overall efficiency. | [
"Return",
"the",
"completeness",
"as",
"a",
"function",
"of",
"magnitude",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L820-L842 | train | Return the completeness as a function of magnitude. |
DarkEnergySurvey/ugali | ugali/observation/mask.py | MaskBand.plot | def plot(self):
"""
Plot the magnitude depth.
"""
msg = "'%s.plot': ADW 2018-05-05"%self.__class__.__name__
DeprecationWarning(msg)
import ugali.utils.plotting
mask = hp.UNSEEN * np.ones(hp.nside2npix(self.nside))
mask[self.roi.pixels] = self.mask_roi_sp... | python | def plot(self):
"""
Plot the magnitude depth.
"""
msg = "'%s.plot': ADW 2018-05-05"%self.__class__.__name__
DeprecationWarning(msg)
import ugali.utils.plotting
mask = hp.UNSEEN * np.ones(hp.nside2npix(self.nside))
mask[self.roi.pixels] = self.mask_roi_sp... | [
"def",
"plot",
"(",
"self",
")",
":",
"msg",
"=",
"\"'%s.plot': ADW 2018-05-05\"",
"%",
"self",
".",
"__class__",
".",
"__name__",
"DeprecationWarning",
"(",
"msg",
")",
"import",
"ugali",
".",
"utils",
".",
"plotting",
"mask",
"=",
"hp",
".",
"UNSEEN",
"*... | Plot the magnitude depth. | [
"Plot",
"the",
"magnitude",
"depth",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L850-L865 | train | Plot the magnitude depth. |
stevearc/dynamo3 | dynamo3/connection.py | build_expected | def build_expected(dynamizer, expected):
""" Build the Expected parameters from a dict """
ret = {}
for k, v in six.iteritems(expected):
if is_null(v):
ret[k] = {
'Exists': False,
}
else:
ret[k] = {
'Exists': True,
... | python | def build_expected(dynamizer, expected):
""" Build the Expected parameters from a dict """
ret = {}
for k, v in six.iteritems(expected):
if is_null(v):
ret[k] = {
'Exists': False,
}
else:
ret[k] = {
'Exists': True,
... | [
"def",
"build_expected",
"(",
"dynamizer",
",",
"expected",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"six",
".",
"iteritems",
"(",
"expected",
")",
":",
"if",
"is_null",
"(",
"v",
")",
":",
"ret",
"[",
"k",
"]",
"=",
"{",
"'E... | Build the Expected parameters from a dict | [
"Build",
"the",
"Expected",
"parameters",
"from",
"a",
"dict"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L19-L32 | train | Builds the Expected parameters from a dict |
stevearc/dynamo3 | dynamo3/connection.py | build_expression_values | def build_expression_values(dynamizer, expr_values, kwargs):
""" Build ExpresionAttributeValues from a value or kwargs """
if expr_values:
values = expr_values
return dynamizer.encode_keys(values)
elif kwargs:
values = dict(((':' + k, v) for k, v in six.iteritems(kwargs)))
re... | python | def build_expression_values(dynamizer, expr_values, kwargs):
""" Build ExpresionAttributeValues from a value or kwargs """
if expr_values:
values = expr_values
return dynamizer.encode_keys(values)
elif kwargs:
values = dict(((':' + k, v) for k, v in six.iteritems(kwargs)))
re... | [
"def",
"build_expression_values",
"(",
"dynamizer",
",",
"expr_values",
",",
"kwargs",
")",
":",
"if",
"expr_values",
":",
"values",
"=",
"expr_values",
"return",
"dynamizer",
".",
"encode_keys",
"(",
"values",
")",
"elif",
"kwargs",
":",
"values",
"=",
"dict"... | Build ExpresionAttributeValues from a value or kwargs | [
"Build",
"ExpresionAttributeValues",
"from",
"a",
"value",
"or",
"kwargs"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L35-L42 | train | Builds ExpresionAttributeValues from a value or kwargs |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.connect_to_region | def connect_to_region(cls, region, session=None, access_key=None,
secret_key=None, **kwargs):
"""
Connect to an AWS region.
This method has been deprecated in favor of :meth:`~.connect`
Parameters
----------
region : str
Name of an ... | python | def connect_to_region(cls, region, session=None, access_key=None,
secret_key=None, **kwargs):
"""
Connect to an AWS region.
This method has been deprecated in favor of :meth:`~.connect`
Parameters
----------
region : str
Name of an ... | [
"def",
"connect_to_region",
"(",
"cls",
",",
"region",
",",
"session",
"=",
"None",
",",
"access_key",
"=",
"None",
",",
"secret_key",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"\"connect_to_region is deprecated and will be ... | Connect to an AWS region.
This method has been deprecated in favor of :meth:`~.connect`
Parameters
----------
region : str
Name of an AWS region
session : :class:`~botocore.session.Session`, optional
The Session object to use for the connection
a... | [
"Connect",
"to",
"an",
"AWS",
"region",
"."
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L90-L118 | train | Connect to an AWS region. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.connect_to_host | def connect_to_host(cls, host='localhost', port=8000, is_secure=False,
session=None, access_key=None, secret_key=None,
**kwargs):
"""
Connect to a specific host.
This method has been deprecated in favor of :meth:`~.connect`
Parameters
... | python | def connect_to_host(cls, host='localhost', port=8000, is_secure=False,
session=None, access_key=None, secret_key=None,
**kwargs):
"""
Connect to a specific host.
This method has been deprecated in favor of :meth:`~.connect`
Parameters
... | [
"def",
"connect_to_host",
"(",
"cls",
",",
"host",
"=",
"'localhost'",
",",
"port",
"=",
"8000",
",",
"is_secure",
"=",
"False",
",",
"session",
"=",
"None",
",",
"access_key",
"=",
"None",
",",
"secret_key",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
... | Connect to a specific host.
This method has been deprecated in favor of :meth:`~.connect`
Parameters
----------
host : str, optional
Address of the host (default 'localhost')
port : int, optional
Connect to the host on this port (default 8000)
is... | [
"Connect",
"to",
"a",
"specific",
"host",
"."
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L121-L156 | train | Connect to a specific host. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.connect | def connect(cls, region, session=None, access_key=None, secret_key=None,
host=None, port=80, is_secure=True, **kwargs):
"""
Connect to an AWS region.
Parameters
----------
region : str
Name of an AWS region
session : :class:`~botocore.session.... | python | def connect(cls, region, session=None, access_key=None, secret_key=None,
host=None, port=80, is_secure=True, **kwargs):
"""
Connect to an AWS region.
Parameters
----------
region : str
Name of an AWS region
session : :class:`~botocore.session.... | [
"def",
"connect",
"(",
"cls",
",",
"region",
",",
"session",
"=",
"None",
",",
"access_key",
"=",
"None",
",",
"secret_key",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"80",
",",
"is_secure",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",... | Connect to an AWS region.
Parameters
----------
region : str
Name of an AWS region
session : :class:`~botocore.session.Session`, optional
The Session object to use for the connection
access_key : str, optional
If session is None, set this acce... | [
"Connect",
"to",
"an",
"AWS",
"region",
"."
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L159-L194 | train | Connect to an AWS region. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.call | def call(self, command, **kwargs):
"""
Make a request to DynamoDB using the raw botocore API
Parameters
----------
command : str
The name of the Dynamo command to execute
**kwargs : dict
The parameters to pass up in the request
Raises
... | python | def call(self, command, **kwargs):
"""
Make a request to DynamoDB using the raw botocore API
Parameters
----------
command : str
The name of the Dynamo command to execute
**kwargs : dict
The parameters to pass up in the request
Raises
... | [
"def",
"call",
"(",
"self",
",",
"command",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"hook",
"in",
"self",
".",
"_hooks",
"[",
"'precall'",
"]",
":",
"hook",
"(",
"self",
",",
"command",
",",
"kwargs",
")",
"op",
"=",
"getattr",
"(",
"self",
"."... | Make a request to DynamoDB using the raw botocore API
Parameters
----------
command : str
The name of the Dynamo command to execute
**kwargs : dict
The parameters to pass up in the request
Raises
------
exc : :class:`~.DynamoDBError`
... | [
"Make",
"a",
"request",
"to",
"DynamoDB",
"using",
"the",
"raw",
"botocore",
"API"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L196-L254 | train | Executes a command on DynamoDB and returns the response. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.subscribe | def subscribe(self, event, hook):
"""
Subscribe a callback to an event
Parameters
----------
event : str
Available events are 'precall', 'postcall', and 'capacity'.
precall is called with: (connection, command, query_kwargs)
postcall is called... | python | def subscribe(self, event, hook):
"""
Subscribe a callback to an event
Parameters
----------
event : str
Available events are 'precall', 'postcall', and 'capacity'.
precall is called with: (connection, command, query_kwargs)
postcall is called... | [
"def",
"subscribe",
"(",
"self",
",",
"event",
",",
"hook",
")",
":",
"if",
"hook",
"not",
"in",
"self",
".",
"_hooks",
"[",
"event",
"]",
":",
"self",
".",
"_hooks",
"[",
"event",
"]",
".",
"append",
"(",
"hook",
")"
] | Subscribe a callback to an event
Parameters
----------
event : str
Available events are 'precall', 'postcall', and 'capacity'.
precall is called with: (connection, command, query_kwargs)
postcall is called with: (connection, command, query_kwargs, response)
... | [
"Subscribe",
"a",
"callback",
"to",
"an",
"event"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L261-L276 | train | Subscribe a callback to an event. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.unsubscribe | def unsubscribe(self, event, hook):
""" Unsubscribe a hook from an event """
if hook in self._hooks[event]:
self._hooks[event].remove(hook) | python | def unsubscribe(self, event, hook):
""" Unsubscribe a hook from an event """
if hook in self._hooks[event]:
self._hooks[event].remove(hook) | [
"def",
"unsubscribe",
"(",
"self",
",",
"event",
",",
"hook",
")",
":",
"if",
"hook",
"in",
"self",
".",
"_hooks",
"[",
"event",
"]",
":",
"self",
".",
"_hooks",
"[",
"event",
"]",
".",
"remove",
"(",
"hook",
")"
] | Unsubscribe a hook from an event | [
"Unsubscribe",
"a",
"hook",
"from",
"an",
"event"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L278-L281 | train | Unsubscribe a hook from an event |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.add_rate_limit | def add_rate_limit(self, limiter):
""" Add a RateLimit to the connection """
if limiter not in self.rate_limiters:
self.subscribe('capacity', limiter.on_capacity)
self.rate_limiters.append(limiter) | python | def add_rate_limit(self, limiter):
""" Add a RateLimit to the connection """
if limiter not in self.rate_limiters:
self.subscribe('capacity', limiter.on_capacity)
self.rate_limiters.append(limiter) | [
"def",
"add_rate_limit",
"(",
"self",
",",
"limiter",
")",
":",
"if",
"limiter",
"not",
"in",
"self",
".",
"rate_limiters",
":",
"self",
".",
"subscribe",
"(",
"'capacity'",
",",
"limiter",
".",
"on_capacity",
")",
"self",
".",
"rate_limiters",
".",
"appen... | Add a RateLimit to the connection | [
"Add",
"a",
"RateLimit",
"to",
"the",
"connection"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L283-L287 | train | Add a RateLimit to the connection |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.remove_rate_limit | def remove_rate_limit(self, limiter):
""" Remove a RateLimit from the connection """
if limiter in self.rate_limiters:
self.unsubscribe('capacity', limiter.on_capacity)
self.rate_limiters.remove(limiter) | python | def remove_rate_limit(self, limiter):
""" Remove a RateLimit from the connection """
if limiter in self.rate_limiters:
self.unsubscribe('capacity', limiter.on_capacity)
self.rate_limiters.remove(limiter) | [
"def",
"remove_rate_limit",
"(",
"self",
",",
"limiter",
")",
":",
"if",
"limiter",
"in",
"self",
".",
"rate_limiters",
":",
"self",
".",
"unsubscribe",
"(",
"'capacity'",
",",
"limiter",
".",
"on_capacity",
")",
"self",
".",
"rate_limiters",
".",
"remove",
... | Remove a RateLimit from the connection | [
"Remove",
"a",
"RateLimit",
"from",
"the",
"connection"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L289-L293 | train | Remove a RateLimit from the connection |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection._default_capacity | def _default_capacity(self, value):
""" Get the value for ReturnConsumedCapacity from provided value """
if value is not None:
return value
if self.default_return_capacity or self.rate_limiters:
return INDEXES
return NONE | python | def _default_capacity(self, value):
""" Get the value for ReturnConsumedCapacity from provided value """
if value is not None:
return value
if self.default_return_capacity or self.rate_limiters:
return INDEXES
return NONE | [
"def",
"_default_capacity",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"not",
"None",
":",
"return",
"value",
"if",
"self",
".",
"default_return_capacity",
"or",
"self",
".",
"rate_limiters",
":",
"return",
"INDEXES",
"return",
"NONE"
] | Get the value for ReturnConsumedCapacity from provided value | [
"Get",
"the",
"value",
"for",
"ReturnConsumedCapacity",
"from",
"provided",
"value"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L312-L318 | train | Get the value for ReturnConsumedCapacity from provided value |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection._count | def _count(self, method, limit, keywords):
""" Do a scan or query and aggregate the results into a Count """
# The limit will be mutated, so copy it and leave the original intact
limit = limit.copy()
has_more = True
count = None
while has_more:
limit.set_reque... | python | def _count(self, method, limit, keywords):
""" Do a scan or query and aggregate the results into a Count """
# The limit will be mutated, so copy it and leave the original intact
limit = limit.copy()
has_more = True
count = None
while has_more:
limit.set_reque... | [
"def",
"_count",
"(",
"self",
",",
"method",
",",
"limit",
",",
"keywords",
")",
":",
"# The limit will be mutated, so copy it and leave the original intact",
"limit",
"=",
"limit",
".",
"copy",
"(",
")",
"has_more",
"=",
"True",
"count",
"=",
"None",
"while",
"... | Do a scan or query and aggregate the results into a Count | [
"Do",
"a",
"scan",
"or",
"query",
"and",
"aggregate",
"the",
"results",
"into",
"a",
"Count"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L320-L335 | train | Perform a scan or query and aggregate the results into a Count |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.describe_table | def describe_table(self, tablename):
"""
Get the details about a table
Parameters
----------
tablename : str
Name of the table
Returns
-------
table : :class:`~dynamo3.fields.Table`
"""
try:
response = self.call(
... | python | def describe_table(self, tablename):
"""
Get the details about a table
Parameters
----------
tablename : str
Name of the table
Returns
-------
table : :class:`~dynamo3.fields.Table`
"""
try:
response = self.call(
... | [
"def",
"describe_table",
"(",
"self",
",",
"tablename",
")",
":",
"try",
":",
"response",
"=",
"self",
".",
"call",
"(",
"'describe_table'",
",",
"TableName",
"=",
"tablename",
")",
"[",
"'Table'",
"]",
"return",
"Table",
".",
"from_response",
"(",
"respon... | Get the details about a table
Parameters
----------
tablename : str
Name of the table
Returns
-------
table : :class:`~dynamo3.fields.Table` | [
"Get",
"the",
"details",
"about",
"a",
"table"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L354-L376 | train | Get the details about a table. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.create_table | def create_table(self, tablename, hash_key, range_key=None, indexes=None,
global_indexes=None, throughput=None, wait=False):
"""
Create a table
Parameters
----------
tablename : str
Name of the table
hash_key : :class:`~dynamo3.fields.Dyn... | python | def create_table(self, tablename, hash_key, range_key=None, indexes=None,
global_indexes=None, throughput=None, wait=False):
"""
Create a table
Parameters
----------
tablename : str
Name of the table
hash_key : :class:`~dynamo3.fields.Dyn... | [
"def",
"create_table",
"(",
"self",
",",
"tablename",
",",
"hash_key",
",",
"range_key",
"=",
"None",
",",
"indexes",
"=",
"None",
",",
"global_indexes",
"=",
"None",
",",
"throughput",
"=",
"None",
",",
"wait",
"=",
"False",
")",
":",
"if",
"throughput"... | Create a table
Parameters
----------
tablename : str
Name of the table
hash_key : :class:`~dynamo3.fields.DynamoKey`
The key to use as the Hash key
range_key : :class:`~dynamo3.fields.DynamoKey`, optional
The key to use as the Range key
... | [
"Create",
"a",
"table"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L378-L436 | train | Creates a new table in DynamoDB. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.delete_table | def delete_table(self, tablename, wait=False):
"""
Delete a table
Parameters
----------
tablename : str
Name of the table to delete
Returns
-------
response : bool
True if the table was deleted, False if no table exists
"... | python | def delete_table(self, tablename, wait=False):
"""
Delete a table
Parameters
----------
tablename : str
Name of the table to delete
Returns
-------
response : bool
True if the table was deleted, False if no table exists
"... | [
"def",
"delete_table",
"(",
"self",
",",
"tablename",
",",
"wait",
"=",
"False",
")",
":",
"try",
":",
"self",
".",
"call",
"(",
"'delete_table'",
",",
"TableName",
"=",
"tablename",
")",
"if",
"wait",
":",
"self",
".",
"client",
".",
"get_waiter",
"("... | Delete a table
Parameters
----------
tablename : str
Name of the table to delete
Returns
-------
response : bool
True if the table was deleted, False if no table exists | [
"Delete",
"a",
"table"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L438-L464 | train | Delete a table and all related data. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.put_item | def put_item(self, tablename, item, expected=None, returns=NONE,
return_capacity=None, expect_or=False, **kwargs):
"""
Store an item, overwriting existing data
This uses the older version of the DynamoDB API.
See also: :meth:`~.put_item2`.
Parameters
--... | python | def put_item(self, tablename, item, expected=None, returns=NONE,
return_capacity=None, expect_or=False, **kwargs):
"""
Store an item, overwriting existing data
This uses the older version of the DynamoDB API.
See also: :meth:`~.put_item2`.
Parameters
--... | [
"def",
"put_item",
"(",
"self",
",",
"tablename",
",",
"item",
",",
"expected",
"=",
"None",
",",
"returns",
"=",
"NONE",
",",
"return_capacity",
"=",
"None",
",",
"expect_or",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"keywords",
"=",
"{",
"}... | Store an item, overwriting existing data
This uses the older version of the DynamoDB API.
See also: :meth:`~.put_item2`.
Parameters
----------
tablename : str
Name of the table to write
item : dict
Item data
expected : dict, optional
... | [
"Store",
"an",
"item",
"overwriting",
"existing",
"data"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L466-L513 | train | Stores an item in DynamoDB. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.get_item | def get_item(self, tablename, key, attributes=None, consistent=False,
return_capacity=None):
"""
Fetch a single item from a table
This uses the older version of the DynamoDB API.
See also: :meth:`~.get_item2`.
Parameters
----------
tablename : s... | python | def get_item(self, tablename, key, attributes=None, consistent=False,
return_capacity=None):
"""
Fetch a single item from a table
This uses the older version of the DynamoDB API.
See also: :meth:`~.get_item2`.
Parameters
----------
tablename : s... | [
"def",
"get_item",
"(",
"self",
",",
"tablename",
",",
"key",
",",
"attributes",
"=",
"None",
",",
"consistent",
"=",
"False",
",",
"return_capacity",
"=",
"None",
")",
":",
"kwargs",
"=",
"{",
"'TableName'",
":",
"tablename",
",",
"'Key'",
":",
"self",
... | Fetch a single item from a table
This uses the older version of the DynamoDB API.
See also: :meth:`~.get_item2`.
Parameters
----------
tablename : str
Name of the table to fetch from
key : dict
Primary key dict specifying the hash key and, if app... | [
"Fetch",
"a",
"single",
"item",
"from",
"a",
"table"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L570-L604 | train | Fetch a single item from a table. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.get_item2 | def get_item2(self, tablename, key, attributes=None, alias=None,
consistent=False, return_capacity=None):
"""
Fetch a single item from a table
Parameters
----------
tablename : str
Name of the table to fetch from
key : dict
Prima... | python | def get_item2(self, tablename, key, attributes=None, alias=None,
consistent=False, return_capacity=None):
"""
Fetch a single item from a table
Parameters
----------
tablename : str
Name of the table to fetch from
key : dict
Prima... | [
"def",
"get_item2",
"(",
"self",
",",
"tablename",
",",
"key",
",",
"attributes",
"=",
"None",
",",
"alias",
"=",
"None",
",",
"consistent",
"=",
"False",
",",
"return_capacity",
"=",
"None",
")",
":",
"kwargs",
"=",
"{",
"'TableName'",
":",
"tablename",... | Fetch a single item from a table
Parameters
----------
tablename : str
Name of the table to fetch from
key : dict
Primary key dict specifying the hash key and, if applicable, the
range key of the item.
attributes : str or list, optional
... | [
"Fetch",
"a",
"single",
"item",
"from",
"a",
"table"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L606-L644 | train | Fetch a single item from a table. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.delete_item | def delete_item(self, tablename, key, expected=None, returns=NONE,
return_capacity=None, expect_or=False, **kwargs):
"""
Delete an item
This uses the older version of the DynamoDB API.
See also: :meth:`~.delete_item2`.
Parameters
----------
t... | python | def delete_item(self, tablename, key, expected=None, returns=NONE,
return_capacity=None, expect_or=False, **kwargs):
"""
Delete an item
This uses the older version of the DynamoDB API.
See also: :meth:`~.delete_item2`.
Parameters
----------
t... | [
"def",
"delete_item",
"(",
"self",
",",
"tablename",
",",
"key",
",",
"expected",
"=",
"None",
",",
"returns",
"=",
"NONE",
",",
"return_capacity",
"=",
"None",
",",
"expect_or",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"key",
"=",
"self",
".... | Delete an item
This uses the older version of the DynamoDB API.
See also: :meth:`~.delete_item2`.
Parameters
----------
tablename : str
Name of the table to delete from
key : dict
Primary key dict specifying the hash key and, if applicable, the
... | [
"Delete",
"an",
"item"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L646-L693 | train | Delete an item from a table. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.delete_item2 | def delete_item2(self, tablename, key, expr_values=None, alias=None,
condition=None, returns=NONE, return_capacity=None,
return_item_collection_metrics=NONE, **kwargs):
"""
Delete an item from a table
For many parameters you will want to reference the D... | python | def delete_item2(self, tablename, key, expr_values=None, alias=None,
condition=None, returns=NONE, return_capacity=None,
return_item_collection_metrics=NONE, **kwargs):
"""
Delete an item from a table
For many parameters you will want to reference the D... | [
"def",
"delete_item2",
"(",
"self",
",",
"tablename",
",",
"key",
",",
"expr_values",
"=",
"None",
",",
"alias",
"=",
"None",
",",
"condition",
"=",
"None",
",",
"returns",
"=",
"NONE",
",",
"return_capacity",
"=",
"None",
",",
"return_item_collection_metric... | Delete an item from a table
For many parameters you will want to reference the DynamoDB API:
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html
Parameters
----------
tablename : str
Name of the table to update
key : dict
... | [
"Delete",
"an",
"item",
"from",
"a",
"table"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L695-L749 | train | This function deletes an item from a table in DynamoDB. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.batch_write | def batch_write(self, tablename, return_capacity=None,
return_item_collection_metrics=NONE):
"""
Perform a batch write on a table
Parameters
----------
tablename : str
Name of the table to write to
return_capacity : {NONE, INDEXES, TOTAL},... | python | def batch_write(self, tablename, return_capacity=None,
return_item_collection_metrics=NONE):
"""
Perform a batch write on a table
Parameters
----------
tablename : str
Name of the table to write to
return_capacity : {NONE, INDEXES, TOTAL},... | [
"def",
"batch_write",
"(",
"self",
",",
"tablename",
",",
"return_capacity",
"=",
"None",
",",
"return_item_collection_metrics",
"=",
"NONE",
")",
":",
"return_capacity",
"=",
"self",
".",
"_default_capacity",
"(",
"return_capacity",
")",
"return",
"BatchWriter",
... | Perform a batch write on a table
Parameters
----------
tablename : str
Name of the table to write to
return_capacity : {NONE, INDEXES, TOTAL}, optional
INDEXES will return the consumed capacity for indexes, TOTAL will
return the consumed capacity for ... | [
"Perform",
"a",
"batch",
"write",
"on",
"a",
"table"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L751-L779 | train | Perform a batch write on a table. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.batch_get | def batch_get(self, tablename, keys, attributes=None, alias=None,
consistent=False, return_capacity=None):
"""
Perform a batch get of many items in a table
Parameters
----------
tablename : str
Name of the table to fetch from
keys : list or ... | python | def batch_get(self, tablename, keys, attributes=None, alias=None,
consistent=False, return_capacity=None):
"""
Perform a batch get of many items in a table
Parameters
----------
tablename : str
Name of the table to fetch from
keys : list or ... | [
"def",
"batch_get",
"(",
"self",
",",
"tablename",
",",
"keys",
",",
"attributes",
"=",
"None",
",",
"alias",
"=",
"None",
",",
"consistent",
"=",
"False",
",",
"return_capacity",
"=",
"None",
")",
":",
"keys",
"=",
"[",
"self",
".",
"dynamizer",
".",
... | Perform a batch get of many items in a table
Parameters
----------
tablename : str
Name of the table to fetch from
keys : list or iterable
List or iterable of primary key dicts that specify the hash key and
the optional range key of each item to fetch... | [
"Perform",
"a",
"batch",
"get",
"of",
"many",
"items",
"in",
"a",
"table"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L781-L811 | train | Perform a batch get of many items in a table. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.update_item | def update_item(self, tablename, key, updates, returns=NONE,
return_capacity=None, expect_or=False, **kwargs):
"""
Update a single item in a table
This uses the older version of the DynamoDB API.
See also: :meth:`~.update_item2`.
Parameters
---------... | python | def update_item(self, tablename, key, updates, returns=NONE,
return_capacity=None, expect_or=False, **kwargs):
"""
Update a single item in a table
This uses the older version of the DynamoDB API.
See also: :meth:`~.update_item2`.
Parameters
---------... | [
"def",
"update_item",
"(",
"self",
",",
"tablename",
",",
"key",
",",
"updates",
",",
"returns",
"=",
"NONE",
",",
"return_capacity",
"=",
"None",
",",
"expect_or",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"key",
"=",
"self",
".",
"dynamizer",
... | Update a single item in a table
This uses the older version of the DynamoDB API.
See also: :meth:`~.update_item2`.
Parameters
----------
tablename : str
Name of the table to update
key : dict
Primary key dict specifying the hash key and, if appli... | [
"Update",
"a",
"single",
"item",
"in",
"a",
"table"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L813-L880 | train | Update a single item in a table. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.scan | def scan(self, tablename, attributes=None, count=False, limit=None,
return_capacity=None, filter_or=False, exclusive_start_key=None,
**kwargs):
"""
Perform a full-table scan
This uses the older version of the DynamoDB API.
See also: :meth:`~.scan2`.
Pa... | python | def scan(self, tablename, attributes=None, count=False, limit=None,
return_capacity=None, filter_or=False, exclusive_start_key=None,
**kwargs):
"""
Perform a full-table scan
This uses the older version of the DynamoDB API.
See also: :meth:`~.scan2`.
Pa... | [
"def",
"scan",
"(",
"self",
",",
"tablename",
",",
"attributes",
"=",
"None",
",",
"count",
"=",
"False",
",",
"limit",
"=",
"None",
",",
"return_capacity",
"=",
"None",
",",
"filter_or",
"=",
"False",
",",
"exclusive_start_key",
"=",
"None",
",",
"*",
... | Perform a full-table scan
This uses the older version of the DynamoDB API.
See also: :meth:`~.scan2`.
Parameters
----------
tablename : str
Name of the table to scan
attributes : list
If present, only fetch these attributes from the item
... | [
"Perform",
"a",
"full",
"-",
"table",
"scan"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L941-L1005 | train | Perform a full - table scan of the items in the specified table. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.scan2 | def scan2(self, tablename, expr_values=None, alias=None, attributes=None,
consistent=False, select=None, index=None, limit=None,
return_capacity=None, filter=False, segment=None,
total_segments=None, exclusive_start_key=None, **kwargs):
"""
Perform a full-table ... | python | def scan2(self, tablename, expr_values=None, alias=None, attributes=None,
consistent=False, select=None, index=None, limit=None,
return_capacity=None, filter=False, segment=None,
total_segments=None, exclusive_start_key=None, **kwargs):
"""
Perform a full-table ... | [
"def",
"scan2",
"(",
"self",
",",
"tablename",
",",
"expr_values",
"=",
"None",
",",
"alias",
"=",
"None",
",",
"attributes",
"=",
"None",
",",
"consistent",
"=",
"False",
",",
"select",
"=",
"None",
",",
"index",
"=",
"None",
",",
"limit",
"=",
"Non... | Perform a full-table scan
For many parameters you will want to reference the DynamoDB API:
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html
Parameters
----------
tablename : str
Name of the table to scan
expr_values : dict, optiona... | [
"Perform",
"a",
"full",
"-",
"table",
"scan"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L1007-L1097 | train | Perform a full - table scan of the table and return the consumed capacity for the table and the indexes. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.query | def query(self, tablename, attributes=None, consistent=False, count=False,
index=None, limit=None, desc=False, return_capacity=None,
filter=None, filter_or=False, exclusive_start_key=None, **kwargs):
"""
Perform an index query on a table
This uses the older version o... | python | def query(self, tablename, attributes=None, consistent=False, count=False,
index=None, limit=None, desc=False, return_capacity=None,
filter=None, filter_or=False, exclusive_start_key=None, **kwargs):
"""
Perform an index query on a table
This uses the older version o... | [
"def",
"query",
"(",
"self",
",",
"tablename",
",",
"attributes",
"=",
"None",
",",
"consistent",
"=",
"False",
",",
"count",
"=",
"False",
",",
"index",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"desc",
"=",
"False",
",",
"return_capacity",
"=",
... | Perform an index query on a table
This uses the older version of the DynamoDB API.
See also: :meth:`~.query2`.
Parameters
----------
tablename : str
Name of the table to query
attributes : list
If present, only fetch these attributes from the ite... | [
"Perform",
"an",
"index",
"query",
"on",
"a",
"table"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L1099-L1178 | train | Query the DynamoDB table for the items in the specified table. |
stevearc/dynamo3 | dynamo3/connection.py | DynamoDBConnection.update_table | def update_table(self, tablename, throughput=None, global_indexes=None,
index_updates=None):
"""
Update the throughput of a table and/or global indexes
Parameters
----------
tablename : str
Name of the table to update
throughput : :class:... | python | def update_table(self, tablename, throughput=None, global_indexes=None,
index_updates=None):
"""
Update the throughput of a table and/or global indexes
Parameters
----------
tablename : str
Name of the table to update
throughput : :class:... | [
"def",
"update_table",
"(",
"self",
",",
"tablename",
",",
"throughput",
"=",
"None",
",",
"global_indexes",
"=",
"None",
",",
"index_updates",
"=",
"None",
")",
":",
"kwargs",
"=",
"{",
"'TableName'",
":",
"tablename",
"}",
"all_attrs",
"=",
"set",
"(",
... | Update the throughput of a table and/or global indexes
Parameters
----------
tablename : str
Name of the table to update
throughput : :class:`~dynamo3.fields.Throughput`, optional
The new throughput of the table
global_indexes : dict, optional
... | [
"Update",
"the",
"throughput",
"of",
"a",
"table",
"and",
"/",
"or",
"global",
"indexes"
] | f897c40ece28586272dbcab8f0d99a14a1831dda | https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L1267-L1310 | train | Update the throughput of a table and or global indexes. |
DarkEnergySurvey/ugali | ugali/preprocess/pixelize.py | pixelizeCatalog | def pixelizeCatalog(infiles, config, force=False):
"""
Break catalog into chunks by healpix pixel.
Parameters:
-----------
infiles : List of input files
config : Configuration file
force : Overwrite existing files (depricated)
Returns:
--------
None
"""
nside... | python | def pixelizeCatalog(infiles, config, force=False):
"""
Break catalog into chunks by healpix pixel.
Parameters:
-----------
infiles : List of input files
config : Configuration file
force : Overwrite existing files (depricated)
Returns:
--------
None
"""
nside... | [
"def",
"pixelizeCatalog",
"(",
"infiles",
",",
"config",
",",
"force",
"=",
"False",
")",
":",
"nside_catalog",
"=",
"config",
"[",
"'coords'",
"]",
"[",
"'nside_catalog'",
"]",
"nside_pixel",
"=",
"config",
"[",
"'coords'",
"]",
"[",
"'nside_pixel'",
"]",
... | Break catalog into chunks by healpix pixel.
Parameters:
-----------
infiles : List of input files
config : Configuration file
force : Overwrite existing files (depricated)
Returns:
--------
None | [
"Break",
"catalog",
"into",
"chunks",
"by",
"healpix",
"pixel",
".",
"Parameters",
":",
"-----------",
"infiles",
":",
"List",
"of",
"input",
"files",
"config",
":",
"Configuration",
"file",
"force",
":",
"Overwrite",
"existing",
"files",
"(",
"depricated",
")... | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/preprocess/pixelize.py#L29-L113 | train | This function will take a list of input files and create a new catalog with the same nside and pixel. |
etal/biofrills | biofrills/logoutils.py | read_logodata | def read_logodata(handle):
"""Get weblogo data for a sequence alignment.
Returns a list of tuples: (posn, letter_counts, entropy, weight)
"""
seqs = weblogolib.read_seq_data(handle,
alphabet=unambiguous_protein_alphabet)
ldata = weblogolib.LogoData.from_seqs(seqs... | python | def read_logodata(handle):
"""Get weblogo data for a sequence alignment.
Returns a list of tuples: (posn, letter_counts, entropy, weight)
"""
seqs = weblogolib.read_seq_data(handle,
alphabet=unambiguous_protein_alphabet)
ldata = weblogolib.LogoData.from_seqs(seqs... | [
"def",
"read_logodata",
"(",
"handle",
")",
":",
"seqs",
"=",
"weblogolib",
".",
"read_seq_data",
"(",
"handle",
",",
"alphabet",
"=",
"unambiguous_protein_alphabet",
")",
"ldata",
"=",
"weblogolib",
".",
"LogoData",
".",
"from_seqs",
"(",
"seqs",
")",
"letter... | Get weblogo data for a sequence alignment.
Returns a list of tuples: (posn, letter_counts, entropy, weight) | [
"Get",
"weblogo",
"data",
"for",
"a",
"sequence",
"alignment",
"."
] | 36684bb6c7632f96215e8b2b4ebc86640f331bcd | https://github.com/etal/biofrills/blob/36684bb6c7632f96215e8b2b4ebc86640f331bcd/biofrills/logoutils.py#L9-L25 | train | Get weblogo data for a sequence alignment. |
etal/biofrills | biofrills/logoutils.py | aln2logodata | def aln2logodata(aln):
"""Get weblogo data for an alignment object.
Returns a list of tuples: (posn, letter_counts, entropy, weight)
"""
handle = StringIO(aln.format('fasta'))
logodata = read_logodata(handle)
handle.close()
return logodata | python | def aln2logodata(aln):
"""Get weblogo data for an alignment object.
Returns a list of tuples: (posn, letter_counts, entropy, weight)
"""
handle = StringIO(aln.format('fasta'))
logodata = read_logodata(handle)
handle.close()
return logodata | [
"def",
"aln2logodata",
"(",
"aln",
")",
":",
"handle",
"=",
"StringIO",
"(",
"aln",
".",
"format",
"(",
"'fasta'",
")",
")",
"logodata",
"=",
"read_logodata",
"(",
"handle",
")",
"handle",
".",
"close",
"(",
")",
"return",
"logodata"
] | Get weblogo data for an alignment object.
Returns a list of tuples: (posn, letter_counts, entropy, weight) | [
"Get",
"weblogo",
"data",
"for",
"an",
"alignment",
"object",
"."
] | 36684bb6c7632f96215e8b2b4ebc86640f331bcd | https://github.com/etal/biofrills/blob/36684bb6c7632f96215e8b2b4ebc86640f331bcd/biofrills/logoutils.py#L28-L36 | train | Get weblogo data for an alignment object. |
etal/biofrills | biofrills/logoutils.py | letter_scales | def letter_scales(counts):
"""Convert letter counts to frequencies, sorted increasing."""
try:
scale = 1.0 / sum(counts.values())
except ZeroDivisionError:
# This logo is all gaps, nothing can be done
return []
freqs = [(aa, cnt*scale) for aa, cnt in counts.iteritems() if cnt]
... | python | def letter_scales(counts):
"""Convert letter counts to frequencies, sorted increasing."""
try:
scale = 1.0 / sum(counts.values())
except ZeroDivisionError:
# This logo is all gaps, nothing can be done
return []
freqs = [(aa, cnt*scale) for aa, cnt in counts.iteritems() if cnt]
... | [
"def",
"letter_scales",
"(",
"counts",
")",
":",
"try",
":",
"scale",
"=",
"1.0",
"/",
"sum",
"(",
"counts",
".",
"values",
"(",
")",
")",
"except",
"ZeroDivisionError",
":",
"# This logo is all gaps, nothing can be done",
"return",
"[",
"]",
"freqs",
"=",
"... | Convert letter counts to frequencies, sorted increasing. | [
"Convert",
"letter",
"counts",
"to",
"frequencies",
"sorted",
"increasing",
"."
] | 36684bb6c7632f96215e8b2b4ebc86640f331bcd | https://github.com/etal/biofrills/blob/36684bb6c7632f96215e8b2b4ebc86640f331bcd/biofrills/logoutils.py#L46-L55 | train | Convert letter counts to frequencies sorted increasing. |
johnnoone/json-spec | src/jsonspec/operations/__init__.py | check | def check(doc, pointer, expected, raise_onerror=False):
"""Check if value exists into object.
:param doc: the document base
:param pointer: the path to search in
:param expected: the expected value
:param raise_onerror: should raise on error?
:return: boolean
"""
return Target(doc).chec... | python | def check(doc, pointer, expected, raise_onerror=False):
"""Check if value exists into object.
:param doc: the document base
:param pointer: the path to search in
:param expected: the expected value
:param raise_onerror: should raise on error?
:return: boolean
"""
return Target(doc).chec... | [
"def",
"check",
"(",
"doc",
",",
"pointer",
",",
"expected",
",",
"raise_onerror",
"=",
"False",
")",
":",
"return",
"Target",
"(",
"doc",
")",
".",
"check",
"(",
"pointer",
",",
"expected",
",",
"raise_onerror",
")"
] | Check if value exists into object.
:param doc: the document base
:param pointer: the path to search in
:param expected: the expected value
:param raise_onerror: should raise on error?
:return: boolean | [
"Check",
"if",
"value",
"exists",
"into",
"object",
"."
] | f91981724cea0c366bd42a6670eb07bbe31c0e0c | https://github.com/johnnoone/json-spec/blob/f91981724cea0c366bd42a6670eb07bbe31c0e0c/src/jsonspec/operations/__init__.py#L15-L24 | train | Check if value exists into object. |
johnnoone/json-spec | src/jsonspec/operations/__init__.py | add | def add(doc, pointer, value):
"""Add element to sequence, member to mapping.
:param doc: the document base
:param pointer: the path to add in it
:param value: the new value
:return: the new object
"""
return Target(doc).add(pointer, value).document | python | def add(doc, pointer, value):
"""Add element to sequence, member to mapping.
:param doc: the document base
:param pointer: the path to add in it
:param value: the new value
:return: the new object
"""
return Target(doc).add(pointer, value).document | [
"def",
"add",
"(",
"doc",
",",
"pointer",
",",
"value",
")",
":",
"return",
"Target",
"(",
"doc",
")",
".",
"add",
"(",
"pointer",
",",
"value",
")",
".",
"document"
] | Add element to sequence, member to mapping.
:param doc: the document base
:param pointer: the path to add in it
:param value: the new value
:return: the new object | [
"Add",
"element",
"to",
"sequence",
"member",
"to",
"mapping",
"."
] | f91981724cea0c366bd42a6670eb07bbe31c0e0c | https://github.com/johnnoone/json-spec/blob/f91981724cea0c366bd42a6670eb07bbe31c0e0c/src/jsonspec/operations/__init__.py#L38-L46 | train | Add element to sequence member to mapping. it
|
johnnoone/json-spec | src/jsonspec/operations/__init__.py | replace | def replace(doc, pointer, value):
"""Replace element from sequence, member from mapping.
:param doc: the document base
:param pointer: the path to search in
:param value: the new value
:return: the new object
.. note::
This operation is functionally identical to a "remove" operation f... | python | def replace(doc, pointer, value):
"""Replace element from sequence, member from mapping.
:param doc: the document base
:param pointer: the path to search in
:param value: the new value
:return: the new object
.. note::
This operation is functionally identical to a "remove" operation f... | [
"def",
"replace",
"(",
"doc",
",",
"pointer",
",",
"value",
")",
":",
"return",
"Target",
"(",
"doc",
")",
".",
"replace",
"(",
"pointer",
",",
"value",
")",
".",
"document"
] | Replace element from sequence, member from mapping.
:param doc: the document base
:param pointer: the path to search in
:param value: the new value
:return: the new object
.. note::
This operation is functionally identical to a "remove" operation for
a value, followed immediately ... | [
"Replace",
"element",
"from",
"sequence",
"member",
"from",
"mapping",
"."
] | f91981724cea0c366bd42a6670eb07bbe31c0e0c | https://github.com/johnnoone/json-spec/blob/f91981724cea0c366bd42a6670eb07bbe31c0e0c/src/jsonspec/operations/__init__.py#L49-L64 | train | Replace element from sequence member from mapping. |
johnnoone/json-spec | src/jsonspec/operations/__init__.py | move | def move(doc, dest, src):
"""Move element from sequence, member from mapping.
:param doc: the document base
:param dest: the destination
:type dest: Pointer
:param src: the source
:type src: Pointer
:return: the new object
.. note::
it delete then it add to the new location
... | python | def move(doc, dest, src):
"""Move element from sequence, member from mapping.
:param doc: the document base
:param dest: the destination
:type dest: Pointer
:param src: the source
:type src: Pointer
:return: the new object
.. note::
it delete then it add to the new location
... | [
"def",
"move",
"(",
"doc",
",",
"dest",
",",
"src",
")",
":",
"return",
"Target",
"(",
"doc",
")",
".",
"move",
"(",
"dest",
",",
"src",
")",
".",
"document"
] | Move element from sequence, member from mapping.
:param doc: the document base
:param dest: the destination
:type dest: Pointer
:param src: the source
:type src: Pointer
:return: the new object
.. note::
it delete then it add to the new location
soo the dest must refer to ... | [
"Move",
"element",
"from",
"sequence",
"member",
"from",
"mapping",
"."
] | f91981724cea0c366bd42a6670eb07bbe31c0e0c | https://github.com/johnnoone/json-spec/blob/f91981724cea0c366bd42a6670eb07bbe31c0e0c/src/jsonspec/operations/__init__.py#L67-L84 | train | Move element from sequence member from mapping. |
johnnoone/json-spec | src/jsonspec/operations/__init__.py | copy | def copy(doc, dest, src):
"""Copy element from sequence, member from mapping.
:param doc: the document base
:param dest: the destination
:type dest: Pointer
:param src: the source
:type src: Pointer
:return: the new object
"""
return Target(doc).copy(dest, src).document | python | def copy(doc, dest, src):
"""Copy element from sequence, member from mapping.
:param doc: the document base
:param dest: the destination
:type dest: Pointer
:param src: the source
:type src: Pointer
:return: the new object
"""
return Target(doc).copy(dest, src).document | [
"def",
"copy",
"(",
"doc",
",",
"dest",
",",
"src",
")",
":",
"return",
"Target",
"(",
"doc",
")",
".",
"copy",
"(",
"dest",
",",
"src",
")",
".",
"document"
] | Copy element from sequence, member from mapping.
:param doc: the document base
:param dest: the destination
:type dest: Pointer
:param src: the source
:type src: Pointer
:return: the new object | [
"Copy",
"element",
"from",
"sequence",
"member",
"from",
"mapping",
"."
] | f91981724cea0c366bd42a6670eb07bbe31c0e0c | https://github.com/johnnoone/json-spec/blob/f91981724cea0c366bd42a6670eb07bbe31c0e0c/src/jsonspec/operations/__init__.py#L87-L98 | train | Copy element from sequence member from mapping.
|
zero-os/zerotier_client | zerotier/network_service.py | NetworkService.deleteMember | def deleteMember(self, address, id, headers=None, query_params=None, content_type="application/json"):
"""
Delete member from network
It is method for DELETE /network/{id}/member/{address}
"""
uri = self.client.base_url + "/network/"+id+"/member/"+address
return self.clie... | python | def deleteMember(self, address, id, headers=None, query_params=None, content_type="application/json"):
"""
Delete member from network
It is method for DELETE /network/{id}/member/{address}
"""
uri = self.client.base_url + "/network/"+id+"/member/"+address
return self.clie... | [
"def",
"deleteMember",
"(",
"self",
",",
"address",
",",
"id",
",",
"headers",
"=",
"None",
",",
"query_params",
"=",
"None",
",",
"content_type",
"=",
"\"application/json\"",
")",
":",
"uri",
"=",
"self",
".",
"client",
".",
"base_url",
"+",
"\"/network/\... | Delete member from network
It is method for DELETE /network/{id}/member/{address} | [
"Delete",
"member",
"from",
"network",
"It",
"is",
"method",
"for",
"DELETE",
"/",
"network",
"/",
"{",
"id",
"}",
"/",
"member",
"/",
"{",
"address",
"}"
] | 03993da11e69d837a0308a2f41ae7b378692fd82 | https://github.com/zero-os/zerotier_client/blob/03993da11e69d837a0308a2f41ae7b378692fd82/zerotier/network_service.py#L7-L13 | train | This method deletes a member from a network. |
zero-os/zerotier_client | zerotier/network_service.py | NetworkService.getMember | def getMember(self, address, id, headers=None, query_params=None, content_type="application/json"):
"""
Get network member settings
It is method for GET /network/{id}/member/{address}
"""
uri = self.client.base_url + "/network/"+id+"/member/"+address
return self.client.ge... | python | def getMember(self, address, id, headers=None, query_params=None, content_type="application/json"):
"""
Get network member settings
It is method for GET /network/{id}/member/{address}
"""
uri = self.client.base_url + "/network/"+id+"/member/"+address
return self.client.ge... | [
"def",
"getMember",
"(",
"self",
",",
"address",
",",
"id",
",",
"headers",
"=",
"None",
",",
"query_params",
"=",
"None",
",",
"content_type",
"=",
"\"application/json\"",
")",
":",
"uri",
"=",
"self",
".",
"client",
".",
"base_url",
"+",
"\"/network/\"",... | Get network member settings
It is method for GET /network/{id}/member/{address} | [
"Get",
"network",
"member",
"settings",
"It",
"is",
"method",
"for",
"GET",
"/",
"network",
"/",
"{",
"id",
"}",
"/",
"member",
"/",
"{",
"address",
"}"
] | 03993da11e69d837a0308a2f41ae7b378692fd82 | https://github.com/zero-os/zerotier_client/blob/03993da11e69d837a0308a2f41ae7b378692fd82/zerotier/network_service.py#L16-L22 | train | Get member settings for a specific resource. |
zero-os/zerotier_client | zerotier/network_service.py | NetworkService.updateMember | def updateMember(self, data, address, id, headers=None, query_params=None, content_type="application/json"):
"""
Update member settings
It is method for POST /network/{id}/member/{address}
"""
uri = self.client.base_url + "/network/"+id+"/member/"+address
return self.clie... | python | def updateMember(self, data, address, id, headers=None, query_params=None, content_type="application/json"):
"""
Update member settings
It is method for POST /network/{id}/member/{address}
"""
uri = self.client.base_url + "/network/"+id+"/member/"+address
return self.clie... | [
"def",
"updateMember",
"(",
"self",
",",
"data",
",",
"address",
",",
"id",
",",
"headers",
"=",
"None",
",",
"query_params",
"=",
"None",
",",
"content_type",
"=",
"\"application/json\"",
")",
":",
"uri",
"=",
"self",
".",
"client",
".",
"base_url",
"+"... | Update member settings
It is method for POST /network/{id}/member/{address} | [
"Update",
"member",
"settings",
"It",
"is",
"method",
"for",
"POST",
"/",
"network",
"/",
"{",
"id",
"}",
"/",
"member",
"/",
"{",
"address",
"}"
] | 03993da11e69d837a0308a2f41ae7b378692fd82 | https://github.com/zero-os/zerotier_client/blob/03993da11e69d837a0308a2f41ae7b378692fd82/zerotier/network_service.py#L25-L31 | train | This method is used to update the member settings of a specific resource. |
zero-os/zerotier_client | zerotier/network_service.py | NetworkService.listMembers | def listMembers(self, id, headers=None, query_params=None, content_type="application/json"):
"""
Get a list of network members
It is method for GET /network/{id}/member
"""
uri = self.client.base_url + "/network/"+id+"/member"
return self.client.get(uri, None, headers, qu... | python | def listMembers(self, id, headers=None, query_params=None, content_type="application/json"):
"""
Get a list of network members
It is method for GET /network/{id}/member
"""
uri = self.client.base_url + "/network/"+id+"/member"
return self.client.get(uri, None, headers, qu... | [
"def",
"listMembers",
"(",
"self",
",",
"id",
",",
"headers",
"=",
"None",
",",
"query_params",
"=",
"None",
",",
"content_type",
"=",
"\"application/json\"",
")",
":",
"uri",
"=",
"self",
".",
"client",
".",
"base_url",
"+",
"\"/network/\"",
"+",
"id",
... | Get a list of network members
It is method for GET /network/{id}/member | [
"Get",
"a",
"list",
"of",
"network",
"members",
"It",
"is",
"method",
"for",
"GET",
"/",
"network",
"/",
"{",
"id",
"}",
"/",
"member"
] | 03993da11e69d837a0308a2f41ae7b378692fd82 | https://github.com/zero-os/zerotier_client/blob/03993da11e69d837a0308a2f41ae7b378692fd82/zerotier/network_service.py#L34-L40 | train | This method returns a list of members of the network. |
zero-os/zerotier_client | zerotier/network_service.py | NetworkService.deleteNetwork | def deleteNetwork(self, id, headers=None, query_params=None, content_type="application/json"):
"""
Delete network
It is method for DELETE /network/{id}
"""
uri = self.client.base_url + "/network/"+id
return self.client.delete(uri, None, headers, query_params, content_type... | python | def deleteNetwork(self, id, headers=None, query_params=None, content_type="application/json"):
"""
Delete network
It is method for DELETE /network/{id}
"""
uri = self.client.base_url + "/network/"+id
return self.client.delete(uri, None, headers, query_params, content_type... | [
"def",
"deleteNetwork",
"(",
"self",
",",
"id",
",",
"headers",
"=",
"None",
",",
"query_params",
"=",
"None",
",",
"content_type",
"=",
"\"application/json\"",
")",
":",
"uri",
"=",
"self",
".",
"client",
".",
"base_url",
"+",
"\"/network/\"",
"+",
"id",
... | Delete network
It is method for DELETE /network/{id} | [
"Delete",
"network",
"It",
"is",
"method",
"for",
"DELETE",
"/",
"network",
"/",
"{",
"id",
"}"
] | 03993da11e69d837a0308a2f41ae7b378692fd82 | https://github.com/zero-os/zerotier_client/blob/03993da11e69d837a0308a2f41ae7b378692fd82/zerotier/network_service.py#L43-L49 | train | This method deletes the specified network from the server. |
zero-os/zerotier_client | zerotier/network_service.py | NetworkService.updateNetwork | def updateNetwork(self, data, id, headers=None, query_params=None, content_type="application/json"):
"""
Update network configuration
It is method for POST /network/{id}
"""
uri = self.client.base_url + "/network/"+id
return self.client.post(uri, data, headers, query_para... | python | def updateNetwork(self, data, id, headers=None, query_params=None, content_type="application/json"):
"""
Update network configuration
It is method for POST /network/{id}
"""
uri = self.client.base_url + "/network/"+id
return self.client.post(uri, data, headers, query_para... | [
"def",
"updateNetwork",
"(",
"self",
",",
"data",
",",
"id",
",",
"headers",
"=",
"None",
",",
"query_params",
"=",
"None",
",",
"content_type",
"=",
"\"application/json\"",
")",
":",
"uri",
"=",
"self",
".",
"client",
".",
"base_url",
"+",
"\"/network/\""... | Update network configuration
It is method for POST /network/{id} | [
"Update",
"network",
"configuration",
"It",
"is",
"method",
"for",
"POST",
"/",
"network",
"/",
"{",
"id",
"}"
] | 03993da11e69d837a0308a2f41ae7b378692fd82 | https://github.com/zero-os/zerotier_client/blob/03993da11e69d837a0308a2f41ae7b378692fd82/zerotier/network_service.py#L61-L67 | train | This method is used to update the configuration of a specific resource in a network. |
zero-os/zerotier_client | zerotier/network_service.py | NetworkService.createNetwork | def createNetwork(self, data, headers=None, query_params=None, content_type="application/json"):
"""
Create a new network
It is method for POST /network
"""
uri = self.client.base_url + "/network"
return self.client.post(uri, data, headers, query_params, content_type) | python | def createNetwork(self, data, headers=None, query_params=None, content_type="application/json"):
"""
Create a new network
It is method for POST /network
"""
uri = self.client.base_url + "/network"
return self.client.post(uri, data, headers, query_params, content_type) | [
"def",
"createNetwork",
"(",
"self",
",",
"data",
",",
"headers",
"=",
"None",
",",
"query_params",
"=",
"None",
",",
"content_type",
"=",
"\"application/json\"",
")",
":",
"uri",
"=",
"self",
".",
"client",
".",
"base_url",
"+",
"\"/network\"",
"return",
... | Create a new network
It is method for POST /network | [
"Create",
"a",
"new",
"network",
"It",
"is",
"method",
"for",
"POST",
"/",
"network"
] | 03993da11e69d837a0308a2f41ae7b378692fd82 | https://github.com/zero-os/zerotier_client/blob/03993da11e69d837a0308a2f41ae7b378692fd82/zerotier/network_service.py#L79-L85 | train | Create a new network in the cluster. |
heronotears/lazyxml | lazyxml/parser.py | Parser.set_options | def set_options(self, **kw):
r"""Set Parser options.
.. seealso::
``kw`` argument have the same meaning as in :func:`lazyxml.loads`
"""
for k, v in kw.iteritems():
if k in self.__options:
self.__options[k] = v | python | def set_options(self, **kw):
r"""Set Parser options.
.. seealso::
``kw`` argument have the same meaning as in :func:`lazyxml.loads`
"""
for k, v in kw.iteritems():
if k in self.__options:
self.__options[k] = v | [
"def",
"set_options",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"for",
"k",
",",
"v",
"in",
"kw",
".",
"iteritems",
"(",
")",
":",
"if",
"k",
"in",
"self",
".",
"__options",
":",
"self",
".",
"__options",
"[",
"k",
"]",
"=",
"v"
] | r"""Set Parser options.
.. seealso::
``kw`` argument have the same meaning as in :func:`lazyxml.loads` | [
"r",
"Set",
"Parser",
"options",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/parser.py#L39-L47 | train | r Set parser options. |
heronotears/lazyxml | lazyxml/parser.py | Parser.xml2object | def xml2object(self, content):
r"""Convert xml content to python object.
:param content: xml content
:rtype: dict
.. versionadded:: 1.2
"""
content = self.xml_filter(content)
element = ET.fromstring(content)
tree = self.parse(element) if self.__options['... | python | def xml2object(self, content):
r"""Convert xml content to python object.
:param content: xml content
:rtype: dict
.. versionadded:: 1.2
"""
content = self.xml_filter(content)
element = ET.fromstring(content)
tree = self.parse(element) if self.__options['... | [
"def",
"xml2object",
"(",
"self",
",",
"content",
")",
":",
"content",
"=",
"self",
".",
"xml_filter",
"(",
"content",
")",
"element",
"=",
"ET",
".",
"fromstring",
"(",
"content",
")",
"tree",
"=",
"self",
".",
"parse",
"(",
"element",
")",
"if",
"s... | r"""Convert xml content to python object.
:param content: xml content
:rtype: dict
.. versionadded:: 1.2 | [
"r",
"Convert",
"xml",
"content",
"to",
"python",
"object",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/parser.py#L64-L80 | train | Convert xml content to python object. |
heronotears/lazyxml | lazyxml/parser.py | Parser.xml_filter | def xml_filter(self, content):
r"""Filter and preprocess xml content
:param content: xml content
:rtype: str
"""
content = utils.strip_whitespace(content, True) if self.__options['strip'] else content.strip()
if not self.__options['encoding']:
encoding = sel... | python | def xml_filter(self, content):
r"""Filter and preprocess xml content
:param content: xml content
:rtype: str
"""
content = utils.strip_whitespace(content, True) if self.__options['strip'] else content.strip()
if not self.__options['encoding']:
encoding = sel... | [
"def",
"xml_filter",
"(",
"self",
",",
"content",
")",
":",
"content",
"=",
"utils",
".",
"strip_whitespace",
"(",
"content",
",",
"True",
")",
"if",
"self",
".",
"__options",
"[",
"'strip'",
"]",
"else",
"content",
".",
"strip",
"(",
")",
"if",
"not",... | r"""Filter and preprocess xml content
:param content: xml content
:rtype: str | [
"r",
"Filter",
"and",
"preprocess",
"xml",
"content"
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/parser.py#L82-L100 | train | Filter and preprocess xml content
|
heronotears/lazyxml | lazyxml/parser.py | Parser.guess_xml_encoding | def guess_xml_encoding(self, content):
r"""Guess encoding from xml header declaration.
:param content: xml content
:rtype: str or None
"""
matchobj = self.__regex['xml_encoding'].match(content)
return matchobj and matchobj.group(1).lower() | python | def guess_xml_encoding(self, content):
r"""Guess encoding from xml header declaration.
:param content: xml content
:rtype: str or None
"""
matchobj = self.__regex['xml_encoding'].match(content)
return matchobj and matchobj.group(1).lower() | [
"def",
"guess_xml_encoding",
"(",
"self",
",",
"content",
")",
":",
"matchobj",
"=",
"self",
".",
"__regex",
"[",
"'xml_encoding'",
"]",
".",
"match",
"(",
"content",
")",
"return",
"matchobj",
"and",
"matchobj",
".",
"group",
"(",
"1",
")",
".",
"lower"... | r"""Guess encoding from xml header declaration.
:param content: xml content
:rtype: str or None | [
"r",
"Guess",
"encoding",
"from",
"xml",
"header",
"declaration",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/parser.py#L102-L109 | train | Guess encoding from xml header declaration. |
heronotears/lazyxml | lazyxml/parser.py | Parser.parse | def parse(self, element):
r"""Parse xml element.
:param element: an :class:`~xml.etree.ElementTree.Element` instance
:rtype: dict
"""
values = {}
for child in element:
node = self.get_node(child)
subs = self.parse(child)
value = subs o... | python | def parse(self, element):
r"""Parse xml element.
:param element: an :class:`~xml.etree.ElementTree.Element` instance
:rtype: dict
"""
values = {}
for child in element:
node = self.get_node(child)
subs = self.parse(child)
value = subs o... | [
"def",
"parse",
"(",
"self",
",",
"element",
")",
":",
"values",
"=",
"{",
"}",
"for",
"child",
"in",
"element",
":",
"node",
"=",
"self",
".",
"get_node",
"(",
"child",
")",
"subs",
"=",
"self",
".",
"parse",
"(",
"child",
")",
"value",
"=",
"su... | r"""Parse xml element.
:param element: an :class:`~xml.etree.ElementTree.Element` instance
:rtype: dict | [
"r",
"Parse",
"xml",
"element",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/parser.py#L119-L136 | train | Parse xml element.
returns a dict of the keys and the values. |
heronotears/lazyxml | lazyxml/parser.py | Parser.parse_full | def parse_full(self, element):
r"""Parse xml element include the node attributes.
:param element: an :class:`~xml.etree.ElementTree.Element` instance
:rtype: dict
.. versionadded:: 1.2.1
"""
values = collections.defaultdict(dict)
for child in element:
... | python | def parse_full(self, element):
r"""Parse xml element include the node attributes.
:param element: an :class:`~xml.etree.ElementTree.Element` instance
:rtype: dict
.. versionadded:: 1.2.1
"""
values = collections.defaultdict(dict)
for child in element:
... | [
"def",
"parse_full",
"(",
"self",
",",
"element",
")",
":",
"values",
"=",
"collections",
".",
"defaultdict",
"(",
"dict",
")",
"for",
"child",
"in",
"element",
":",
"node",
"=",
"self",
".",
"get_node",
"(",
"child",
")",
"subs",
"=",
"self",
".",
"... | r"""Parse xml element include the node attributes.
:param element: an :class:`~xml.etree.ElementTree.Element` instance
:rtype: dict
.. versionadded:: 1.2.1 | [
"r",
"Parse",
"xml",
"element",
"include",
"the",
"node",
"attributes",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/parser.py#L138-L158 | train | Parse xml element include the node attributes. |
heronotears/lazyxml | lazyxml/parser.py | Parser.get_node | def get_node(self, element):
r"""Get node info.
Parse element and get the element tag info. Include tag name, value, attribute, namespace.
:param element: an :class:`~xml.etree.ElementTree.Element` instance
:rtype: dict
"""
ns, tag = self.split_namespace(element.tag)
... | python | def get_node(self, element):
r"""Get node info.
Parse element and get the element tag info. Include tag name, value, attribute, namespace.
:param element: an :class:`~xml.etree.ElementTree.Element` instance
:rtype: dict
"""
ns, tag = self.split_namespace(element.tag)
... | [
"def",
"get_node",
"(",
"self",
",",
"element",
")",
":",
"ns",
",",
"tag",
"=",
"self",
".",
"split_namespace",
"(",
"element",
".",
"tag",
")",
"return",
"{",
"'tag'",
":",
"tag",
",",
"'value'",
":",
"(",
"element",
".",
"text",
"or",
"''",
")",... | r"""Get node info.
Parse element and get the element tag info. Include tag name, value, attribute, namespace.
:param element: an :class:`~xml.etree.ElementTree.Element` instance
:rtype: dict | [
"r",
"Get",
"node",
"info",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/parser.py#L160-L169 | train | Parse an element and get the node tag info. Include tag name value attribute namespace. |
heronotears/lazyxml | lazyxml/parser.py | Parser.split_namespace | def split_namespace(self, tag):
r"""Split tag namespace.
:param tag: tag name
:return: a pair of (namespace, tag)
:rtype: tuple
"""
matchobj = self.__regex['xml_ns'].search(tag)
return matchobj.groups() if matchobj else ('', tag) | python | def split_namespace(self, tag):
r"""Split tag namespace.
:param tag: tag name
:return: a pair of (namespace, tag)
:rtype: tuple
"""
matchobj = self.__regex['xml_ns'].search(tag)
return matchobj.groups() if matchobj else ('', tag) | [
"def",
"split_namespace",
"(",
"self",
",",
"tag",
")",
":",
"matchobj",
"=",
"self",
".",
"__regex",
"[",
"'xml_ns'",
"]",
".",
"search",
"(",
"tag",
")",
"return",
"matchobj",
".",
"groups",
"(",
")",
"if",
"matchobj",
"else",
"(",
"''",
",",
"tag"... | r"""Split tag namespace.
:param tag: tag name
:return: a pair of (namespace, tag)
:rtype: tuple | [
"r",
"Split",
"tag",
"namespace",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/parser.py#L171-L179 | train | r Split tag namespace. |
LISE-B26/pylabcontrol | build/lib/pylabcontrol/src/core/loading.py | instantiate_probes | def instantiate_probes(probes, instruments):
"""
Creates instances of the probes inputed;
Args:
probes: probes is a nested dictionary with
(key, sub_dict ) = (name of the probe, {'probe_name': value_probe, 'instrument_name': value_inst}),
where value_probe is a valid name... | python | def instantiate_probes(probes, instruments):
"""
Creates instances of the probes inputed;
Args:
probes: probes is a nested dictionary with
(key, sub_dict ) = (name of the probe, {'probe_name': value_probe, 'instrument_name': value_inst}),
where value_probe is a valid name... | [
"def",
"instantiate_probes",
"(",
"probes",
",",
"instruments",
")",
":",
"probe_instances",
"=",
"{",
"}",
"for",
"name",
",",
"sub_dict",
"in",
"probes",
".",
"items",
"(",
")",
":",
"assert",
"isinstance",
"(",
"sub_dict",
",",
"dict",
")",
"assert",
... | Creates instances of the probes inputed;
Args:
probes: probes is a nested dictionary with
(key, sub_dict ) = (name of the probe, {'probe_name': value_probe, 'instrument_name': value_inst}),
where value_probe is a valid name of a probe in intrument with name value_inst
for... | [
"Creates",
"instances",
"of",
"the",
"probes",
"inputed",
";"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/src/core/loading.py#L22-L58 | train | Creates a list of probes that are already instantiated. |
emre/lightsteem | lightsteem/broadcast/key_objects.py | Address.derivesha256address | def derivesha256address(self):
""" Derive address using ``RIPEMD160(SHA256(x))`` """
pkbin = unhexlify(repr(self._pubkey))
addressbin = ripemd160(hexlify(hashlib.sha256(pkbin).digest()))
return Base58(hexlify(addressbin).decode('ascii')) | python | def derivesha256address(self):
""" Derive address using ``RIPEMD160(SHA256(x))`` """
pkbin = unhexlify(repr(self._pubkey))
addressbin = ripemd160(hexlify(hashlib.sha256(pkbin).digest()))
return Base58(hexlify(addressbin).decode('ascii')) | [
"def",
"derivesha256address",
"(",
"self",
")",
":",
"pkbin",
"=",
"unhexlify",
"(",
"repr",
"(",
"self",
".",
"_pubkey",
")",
")",
"addressbin",
"=",
"ripemd160",
"(",
"hexlify",
"(",
"hashlib",
".",
"sha256",
"(",
"pkbin",
")",
".",
"digest",
"(",
")... | Derive address using ``RIPEMD160(SHA256(x))`` | [
"Derive",
"address",
"using",
"RIPEMD160",
"(",
"SHA256",
"(",
"x",
"))"
] | 0fc29a517c20d881cbdbb15b43add4bcf3af242e | https://github.com/emre/lightsteem/blob/0fc29a517c20d881cbdbb15b43add4bcf3af242e/lightsteem/broadcast/key_objects.py#L42-L46 | train | Derive the address from the public key. |
emre/lightsteem | lightsteem/broadcast/key_objects.py | Address.derivesha512address | def derivesha512address(self):
""" Derive address using ``RIPEMD160(SHA512(x))`` """
pkbin = unhexlify(repr(self._pubkey))
addressbin = ripemd160(hexlify(hashlib.sha512(pkbin).digest()))
return Base58(hexlify(addressbin).decode('ascii')) | python | def derivesha512address(self):
""" Derive address using ``RIPEMD160(SHA512(x))`` """
pkbin = unhexlify(repr(self._pubkey))
addressbin = ripemd160(hexlify(hashlib.sha512(pkbin).digest()))
return Base58(hexlify(addressbin).decode('ascii')) | [
"def",
"derivesha512address",
"(",
"self",
")",
":",
"pkbin",
"=",
"unhexlify",
"(",
"repr",
"(",
"self",
".",
"_pubkey",
")",
")",
"addressbin",
"=",
"ripemd160",
"(",
"hexlify",
"(",
"hashlib",
".",
"sha512",
"(",
"pkbin",
")",
".",
"digest",
"(",
")... | Derive address using ``RIPEMD160(SHA512(x))`` | [
"Derive",
"address",
"using",
"RIPEMD160",
"(",
"SHA512",
"(",
"x",
"))"
] | 0fc29a517c20d881cbdbb15b43add4bcf3af242e | https://github.com/emre/lightsteem/blob/0fc29a517c20d881cbdbb15b43add4bcf3af242e/lightsteem/broadcast/key_objects.py#L48-L52 | train | Derive the public key address using SHA512. |
emre/lightsteem | lightsteem/broadcast/key_objects.py | PublicKey.compressed | def compressed(self):
""" Derive compressed public key """
order = ecdsa.SECP256k1.generator.order()
p = ecdsa.VerifyingKey.from_string(
compat_bytes(self), curve=ecdsa.SECP256k1).pubkey.point
x_str = ecdsa.util.number_to_string(p.x(), order)
# y_str = ecdsa.util.numb... | python | def compressed(self):
""" Derive compressed public key """
order = ecdsa.SECP256k1.generator.order()
p = ecdsa.VerifyingKey.from_string(
compat_bytes(self), curve=ecdsa.SECP256k1).pubkey.point
x_str = ecdsa.util.number_to_string(p.x(), order)
# y_str = ecdsa.util.numb... | [
"def",
"compressed",
"(",
"self",
")",
":",
"order",
"=",
"ecdsa",
".",
"SECP256k1",
".",
"generator",
".",
"order",
"(",
")",
"p",
"=",
"ecdsa",
".",
"VerifyingKey",
".",
"from_string",
"(",
"compat_bytes",
"(",
"self",
")",
",",
"curve",
"=",
"ecdsa"... | Derive compressed public key | [
"Derive",
"compressed",
"public",
"key"
] | 0fc29a517c20d881cbdbb15b43add4bcf3af242e | https://github.com/emre/lightsteem/blob/0fc29a517c20d881cbdbb15b43add4bcf3af242e/lightsteem/broadcast/key_objects.py#L106-L116 | train | Derive compressed public key |
emre/lightsteem | lightsteem/broadcast/key_objects.py | PublicKey.unCompressed | def unCompressed(self):
""" Derive uncompressed key """
public_key = repr(self._pk)
prefix = public_key[0:2]
if prefix == "04":
return public_key
assert prefix == "02" or prefix == "03"
x = int(public_key[2:], 16)
y = self._derive_y_from_x(x, (prefix =... | python | def unCompressed(self):
""" Derive uncompressed key """
public_key = repr(self._pk)
prefix = public_key[0:2]
if prefix == "04":
return public_key
assert prefix == "02" or prefix == "03"
x = int(public_key[2:], 16)
y = self._derive_y_from_x(x, (prefix =... | [
"def",
"unCompressed",
"(",
"self",
")",
":",
"public_key",
"=",
"repr",
"(",
"self",
".",
"_pk",
")",
"prefix",
"=",
"public_key",
"[",
"0",
":",
"2",
"]",
"if",
"prefix",
"==",
"\"04\"",
":",
"return",
"public_key",
"assert",
"prefix",
"==",
"\"02\""... | Derive uncompressed key | [
"Derive",
"uncompressed",
"key"
] | 0fc29a517c20d881cbdbb15b43add4bcf3af242e | https://github.com/emre/lightsteem/blob/0fc29a517c20d881cbdbb15b43add4bcf3af242e/lightsteem/broadcast/key_objects.py#L118-L128 | train | Derive uncompressed key from the public key. |
emre/lightsteem | lightsteem/broadcast/key_objects.py | PrivateKey.compressedpubkey | def compressedpubkey(self):
""" Derive uncompressed public key """
secret = unhexlify(repr(self._wif))
order = ecdsa.SigningKey.from_string(
secret, curve=ecdsa.SECP256k1).curve.generator.order()
p = ecdsa.SigningKey.from_string(
secret, curve=ecdsa.SECP256k1).ver... | python | def compressedpubkey(self):
""" Derive uncompressed public key """
secret = unhexlify(repr(self._wif))
order = ecdsa.SigningKey.from_string(
secret, curve=ecdsa.SECP256k1).curve.generator.order()
p = ecdsa.SigningKey.from_string(
secret, curve=ecdsa.SECP256k1).ver... | [
"def",
"compressedpubkey",
"(",
"self",
")",
":",
"secret",
"=",
"unhexlify",
"(",
"repr",
"(",
"self",
".",
"_wif",
")",
")",
"order",
"=",
"ecdsa",
".",
"SigningKey",
".",
"from_string",
"(",
"secret",
",",
"curve",
"=",
"ecdsa",
".",
"SECP256k1",
")... | Derive uncompressed public key | [
"Derive",
"uncompressed",
"public",
"key"
] | 0fc29a517c20d881cbdbb15b43add4bcf3af242e | https://github.com/emre/lightsteem/blob/0fc29a517c20d881cbdbb15b43add4bcf3af242e/lightsteem/broadcast/key_objects.py#L174-L189 | train | Derive compressed public key |
emre/lightsteem | lightsteem/broadcast/key_objects.py | PasswordKey.get_private | def get_private(self):
""" Derive private key from the brain key and the current sequence
number
"""
a = compat_bytes(self.account + self.role + self.password, 'utf8')
s = hashlib.sha256(a).digest()
return PrivateKey(hexlify(s).decode('ascii')) | python | def get_private(self):
""" Derive private key from the brain key and the current sequence
number
"""
a = compat_bytes(self.account + self.role + self.password, 'utf8')
s = hashlib.sha256(a).digest()
return PrivateKey(hexlify(s).decode('ascii')) | [
"def",
"get_private",
"(",
"self",
")",
":",
"a",
"=",
"compat_bytes",
"(",
"self",
".",
"account",
"+",
"self",
".",
"role",
"+",
"self",
".",
"password",
",",
"'utf8'",
")",
"s",
"=",
"hashlib",
".",
"sha256",
"(",
"a",
")",
".",
"digest",
"(",
... | Derive private key from the brain key and the current sequence
number | [
"Derive",
"private",
"key",
"from",
"the",
"brain",
"key",
"and",
"the",
"current",
"sequence",
"number"
] | 0fc29a517c20d881cbdbb15b43add4bcf3af242e | https://github.com/emre/lightsteem/blob/0fc29a517c20d881cbdbb15b43add4bcf3af242e/lightsteem/broadcast/key_objects.py#L224-L230 | train | Derive private key from the brain key and the current sequence
number |
zero-os/zerotier_client | zerotier/NetworkMemberConfig.py | NetworkMemberConfig.create | def create(activeBridge=None, address=None, authorized=None, clock=None, identity=None, ipAssignments=None, memberRevision=None, nwid=None):
"""
:type activeBridge: bool
:type address: str
:type authorized: bool
:type clock: int
:type identity: str
:type ipAssignm... | python | def create(activeBridge=None, address=None, authorized=None, clock=None, identity=None, ipAssignments=None, memberRevision=None, nwid=None):
"""
:type activeBridge: bool
:type address: str
:type authorized: bool
:type clock: int
:type identity: str
:type ipAssignm... | [
"def",
"create",
"(",
"activeBridge",
"=",
"None",
",",
"address",
"=",
"None",
",",
"authorized",
"=",
"None",
",",
"clock",
"=",
"None",
",",
"identity",
"=",
"None",
",",
"ipAssignments",
"=",
"None",
",",
"memberRevision",
"=",
"None",
",",
"nwid",
... | :type activeBridge: bool
:type address: str
:type authorized: bool
:type clock: int
:type identity: str
:type ipAssignments: list[str]
:type memberRevision: int
:type nwid: str
:rtype: NetworkMemberConfig | [
":",
"type",
"activeBridge",
":",
"bool",
":",
"type",
"address",
":",
"str",
":",
"type",
"authorized",
":",
"bool",
":",
"type",
"clock",
":",
"int",
":",
"type",
"identity",
":",
"str",
":",
"type",
"ipAssignments",
":",
"list",
"[",
"str",
"]",
"... | 03993da11e69d837a0308a2f41ae7b378692fd82 | https://github.com/zero-os/zerotier_client/blob/03993da11e69d837a0308a2f41ae7b378692fd82/zerotier/NetworkMemberConfig.py#L14-L36 | train | Creates a new NetworkMemberConfig object from the given parameters. |
lreis2415/PyGeoC | pygeoc/hydro.py | FlowModelConst.get_cell_length | def get_cell_length(flow_model):
"""Get flow direction induced cell length dict.
Args:
flow_model: Currently, "TauDEM", "ArcGIS", and "Whitebox" are supported.
"""
assert flow_model.lower() in FlowModelConst.d8_lens
return FlowModelConst.d8_lens.get(flow_model.lower()... | python | def get_cell_length(flow_model):
"""Get flow direction induced cell length dict.
Args:
flow_model: Currently, "TauDEM", "ArcGIS", and "Whitebox" are supported.
"""
assert flow_model.lower() in FlowModelConst.d8_lens
return FlowModelConst.d8_lens.get(flow_model.lower()... | [
"def",
"get_cell_length",
"(",
"flow_model",
")",
":",
"assert",
"flow_model",
".",
"lower",
"(",
")",
"in",
"FlowModelConst",
".",
"d8_lens",
"return",
"FlowModelConst",
".",
"d8_lens",
".",
"get",
"(",
"flow_model",
".",
"lower",
"(",
")",
")"
] | Get flow direction induced cell length dict.
Args:
flow_model: Currently, "TauDEM", "ArcGIS", and "Whitebox" are supported. | [
"Get",
"flow",
"direction",
"induced",
"cell",
"length",
"dict",
".",
"Args",
":",
"flow_model",
":",
"Currently",
"TauDEM",
"ArcGIS",
"and",
"Whitebox",
"are",
"supported",
"."
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/hydro.py#L103-L109 | train | Get flow direction induced cell length dict. |
lreis2415/PyGeoC | pygeoc/hydro.py | FlowModelConst.get_cell_shift | def get_cell_shift(flow_model):
"""Get flow direction induced cell shift dict.
Args:
flow_model: Currently, "TauDEM", "ArcGIS", and "Whitebox" are supported.
"""
assert flow_model.lower() in FlowModelConst.d8_deltas
return FlowModelConst.d8_deltas.get(flow_model.lower... | python | def get_cell_shift(flow_model):
"""Get flow direction induced cell shift dict.
Args:
flow_model: Currently, "TauDEM", "ArcGIS", and "Whitebox" are supported.
"""
assert flow_model.lower() in FlowModelConst.d8_deltas
return FlowModelConst.d8_deltas.get(flow_model.lower... | [
"def",
"get_cell_shift",
"(",
"flow_model",
")",
":",
"assert",
"flow_model",
".",
"lower",
"(",
")",
"in",
"FlowModelConst",
".",
"d8_deltas",
"return",
"FlowModelConst",
".",
"d8_deltas",
".",
"get",
"(",
"flow_model",
".",
"lower",
"(",
")",
")"
] | Get flow direction induced cell shift dict.
Args:
flow_model: Currently, "TauDEM", "ArcGIS", and "Whitebox" are supported. | [
"Get",
"flow",
"direction",
"induced",
"cell",
"shift",
"dict",
".",
"Args",
":",
"flow_model",
":",
"Currently",
"TauDEM",
"ArcGIS",
"and",
"Whitebox",
"are",
"supported",
"."
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/hydro.py#L112-L118 | train | Get flow direction induced cell shift dict. |
lreis2415/PyGeoC | pygeoc/hydro.py | D8Util.downstream_index | def downstream_index(dir_value, i, j, alg='taudem'):
"""find downslope coordinate for D8 direction."""
assert alg.lower() in FlowModelConst.d8_deltas
delta = FlowModelConst.d8_deltas.get(alg.lower())
drow, dcol = delta[int(dir_value)]
return i + drow, j + dcol | python | def downstream_index(dir_value, i, j, alg='taudem'):
"""find downslope coordinate for D8 direction."""
assert alg.lower() in FlowModelConst.d8_deltas
delta = FlowModelConst.d8_deltas.get(alg.lower())
drow, dcol = delta[int(dir_value)]
return i + drow, j + dcol | [
"def",
"downstream_index",
"(",
"dir_value",
",",
"i",
",",
"j",
",",
"alg",
"=",
"'taudem'",
")",
":",
"assert",
"alg",
".",
"lower",
"(",
")",
"in",
"FlowModelConst",
".",
"d8_deltas",
"delta",
"=",
"FlowModelConst",
".",
"d8_deltas",
".",
"get",
"(",
... | find downslope coordinate for D8 direction. | [
"find",
"downslope",
"coordinate",
"for",
"D8",
"direction",
"."
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/hydro.py#L130-L135 | train | find downslope coordinate for D8 direction |
lreis2415/PyGeoC | pygeoc/hydro.py | D8Util.convert_code | def convert_code(in_file, out_file, in_alg='taudem', out_alg='arcgis', datatype=None):
"""
convert D8 flow direction code from one algorithm to another.
Args:
in_file: input raster file path
out_file: output raster file path
in_alg: available algorithms are in... | python | def convert_code(in_file, out_file, in_alg='taudem', out_alg='arcgis', datatype=None):
"""
convert D8 flow direction code from one algorithm to another.
Args:
in_file: input raster file path
out_file: output raster file path
in_alg: available algorithms are in... | [
"def",
"convert_code",
"(",
"in_file",
",",
"out_file",
",",
"in_alg",
"=",
"'taudem'",
",",
"out_alg",
"=",
"'arcgis'",
",",
"datatype",
"=",
"None",
")",
":",
"FileClass",
".",
"check_file_exists",
"(",
"in_file",
")",
"in_alg",
"=",
"in_alg",
".",
"lowe... | convert D8 flow direction code from one algorithm to another.
Args:
in_file: input raster file path
out_file: output raster file path
in_alg: available algorithms are in FlowModelConst.d8_dirs. "taudem" is the default
out_alg: same as in_alg. "arcgis" is the defau... | [
"convert",
"D8",
"flow",
"direction",
"code",
"from",
"one",
"algorithm",
"to",
"another",
".",
"Args",
":",
"in_file",
":",
"input",
"raster",
"file",
"path",
"out_file",
":",
"output",
"raster",
"file",
"path",
"in_alg",
":",
"available",
"algorithms",
"ar... | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/hydro.py#L138-L163 | train | Convert D8 flow direction code from one algorithm to another. |
nmdp-bioinformatics/SeqAnn | seqann/seq_search.py | SeqSearch.search_seqs | def search_seqs(self, seqrec, in_seq, locus, run=0, partial_ann=None):
"""
search_seqs - method for annotating a BioPython sequence without alignment
:param seqrec: The reference sequence
:type seqrec: SeqRecord
:param locus: The gene locus associated with the sequence.
... | python | def search_seqs(self, seqrec, in_seq, locus, run=0, partial_ann=None):
"""
search_seqs - method for annotating a BioPython sequence without alignment
:param seqrec: The reference sequence
:type seqrec: SeqRecord
:param locus: The gene locus associated with the sequence.
... | [
"def",
"search_seqs",
"(",
"self",
",",
"seqrec",
",",
"in_seq",
",",
"locus",
",",
"run",
"=",
"0",
",",
"partial_ann",
"=",
"None",
")",
":",
"# Extract out the sequences and feature names",
"# from the reference sequences",
"# The mapped features will be subtracted fro... | search_seqs - method for annotating a BioPython sequence without alignment
:param seqrec: The reference sequence
:type seqrec: SeqRecord
:param locus: The gene locus associated with the sequence.
:type locus: str
:param in_seq: The input sequence
:type in_seq: SeqRecord
... | [
"search_seqs",
"-",
"method",
"for",
"annotating",
"a",
"BioPython",
"sequence",
"without",
"alignment"
] | 5ce91559b0a4fbe4fb7758e034eb258202632463 | https://github.com/nmdp-bioinformatics/SeqAnn/blob/5ce91559b0a4fbe4fb7758e034eb258202632463/seqann/seq_search.py#L94-L576 | train | This method searches for a sequence in a given locus. |
heinzK1X/pylibconfig2 | pylibconfig2/parsing.py | convert_group | def convert_group(tokens):
"""Converts parseResult from to ConfGroup type."""
tok = tokens.asList()
dic = dict(tok)
if not (len(dic) == len(tok)):
raise ParseFatalException("Names in group must be unique: %s" % tokens)
return ConfGroup(dic) | python | def convert_group(tokens):
"""Converts parseResult from to ConfGroup type."""
tok = tokens.asList()
dic = dict(tok)
if not (len(dic) == len(tok)):
raise ParseFatalException("Names in group must be unique: %s" % tokens)
return ConfGroup(dic) | [
"def",
"convert_group",
"(",
"tokens",
")",
":",
"tok",
"=",
"tokens",
".",
"asList",
"(",
")",
"dic",
"=",
"dict",
"(",
"tok",
")",
"if",
"not",
"(",
"len",
"(",
"dic",
")",
"==",
"len",
"(",
"tok",
")",
")",
":",
"raise",
"ParseFatalException",
... | Converts parseResult from to ConfGroup type. | [
"Converts",
"parseResult",
"from",
"to",
"ConfGroup",
"type",
"."
] | f3a851ac780da28a42264c24aac51b54fbd63f81 | https://github.com/heinzK1X/pylibconfig2/blob/f3a851ac780da28a42264c24aac51b54fbd63f81/pylibconfig2/parsing.py#L64-L70 | train | Converts parseResult from to ConfGroup type. |
LISE-B26/pylabcontrol | build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py | LoadDialog.name_changed | def name_changed(self, changed_item):
"""
checks if name has been changed and ignores the name change if the changed_item is an existing script
Args:
changed_item:
"""
name = str(changed_item.text())
# if the item has been moved we ignore this because the ite... | python | def name_changed(self, changed_item):
"""
checks if name has been changed and ignores the name change if the changed_item is an existing script
Args:
changed_item:
"""
name = str(changed_item.text())
# if the item has been moved we ignore this because the ite... | [
"def",
"name_changed",
"(",
"self",
",",
"changed_item",
")",
":",
"name",
"=",
"str",
"(",
"changed_item",
".",
"text",
"(",
")",
")",
"# if the item has been moved we ignore this because the item only went from one tree to the other without changing names",
"if",
"name",
... | checks if name has been changed and ignores the name change if the changed_item is an existing script
Args:
changed_item: | [
"checks",
"if",
"name",
"has",
"been",
"changed",
"and",
"ignores",
"the",
"name",
"change",
"if",
"the",
"changed_item",
"is",
"an",
"existing",
"script",
"Args",
":",
"changed_item",
":"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py#L105-L118 | train | checks if the name has been changed and ignores the name change if the item is an existing script or a new script |
LISE-B26/pylabcontrol | build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py | LoadDialog.show_info | def show_info(self):
"""
displays the doc string of the selected element
"""
sender = self.sender()
tree = sender.parent()
index = tree.selectedIndexes()
info = ''
if index != []:
index = index[0]
name = str(index.model().itemFromIn... | python | def show_info(self):
"""
displays the doc string of the selected element
"""
sender = self.sender()
tree = sender.parent()
index = tree.selectedIndexes()
info = ''
if index != []:
index = index[0]
name = str(index.model().itemFromIn... | [
"def",
"show_info",
"(",
"self",
")",
":",
"sender",
"=",
"self",
".",
"sender",
"(",
")",
"tree",
"=",
"sender",
".",
"parent",
"(",
")",
"index",
"=",
"tree",
".",
"selectedIndexes",
"(",
")",
"info",
"=",
"''",
"if",
"index",
"!=",
"[",
"]",
"... | displays the doc string of the selected element | [
"displays",
"the",
"doc",
"string",
"of",
"the",
"selected",
"element"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py#L120-L162 | train | Displays the doc string of the selected element |
LISE-B26/pylabcontrol | build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py | LoadDialog.open_file_dialog | def open_file_dialog(self):
"""
opens a file dialog to get the path to a file and
"""
dialog = QtWidgets.QFileDialog
filename, _ = dialog.getOpenFileName(self, 'Select a file:', self.txt_probe_log_path.text())
if str(filename) != '':
self.txt_probe_log_path.se... | python | def open_file_dialog(self):
"""
opens a file dialog to get the path to a file and
"""
dialog = QtWidgets.QFileDialog
filename, _ = dialog.getOpenFileName(self, 'Select a file:', self.txt_probe_log_path.text())
if str(filename) != '':
self.txt_probe_log_path.se... | [
"def",
"open_file_dialog",
"(",
"self",
")",
":",
"dialog",
"=",
"QtWidgets",
".",
"QFileDialog",
"filename",
",",
"_",
"=",
"dialog",
".",
"getOpenFileName",
"(",
"self",
",",
"'Select a file:'",
",",
"self",
".",
"txt_probe_log_path",
".",
"text",
"(",
")"... | opens a file dialog to get the path to a file and | [
"opens",
"a",
"file",
"dialog",
"to",
"get",
"the",
"path",
"to",
"a",
"file",
"and"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py#L164-L176 | train | Opens a file dialog to get the path to a file and the name of the file and the class name of the class. |
LISE-B26/pylabcontrol | build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py | LoadDialog.load_elements | def load_elements(self, filename):
"""
loads the elements from file filename
"""
input_data = load_b26_file(filename)
if isinstance(input_data, dict) and self.elements_type in input_data:
return input_data[self.elements_type]
else:
return {} | python | def load_elements(self, filename):
"""
loads the elements from file filename
"""
input_data = load_b26_file(filename)
if isinstance(input_data, dict) and self.elements_type in input_data:
return input_data[self.elements_type]
else:
return {} | [
"def",
"load_elements",
"(",
"self",
",",
"filename",
")",
":",
"input_data",
"=",
"load_b26_file",
"(",
"filename",
")",
"if",
"isinstance",
"(",
"input_data",
",",
"dict",
")",
"and",
"self",
".",
"elements_type",
"in",
"input_data",
":",
"return",
"input_... | loads the elements from file filename | [
"loads",
"the",
"elements",
"from",
"file",
"filename"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py#L178-L186 | train | loads the elements from file filename |
LISE-B26/pylabcontrol | build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py | LoadDialog.fill_tree | def fill_tree(self, tree, input_dict):
"""
fills a tree with nested parameters
Args:
tree: QtGui.QTreeView
parameters: dictionary or Parameter object
Returns:
"""
def add_element(item, key, value):
child_name = QtGui.QStandardItem(ke... | python | def fill_tree(self, tree, input_dict):
"""
fills a tree with nested parameters
Args:
tree: QtGui.QTreeView
parameters: dictionary or Parameter object
Returns:
"""
def add_element(item, key, value):
child_name = QtGui.QStandardItem(ke... | [
"def",
"fill_tree",
"(",
"self",
",",
"tree",
",",
"input_dict",
")",
":",
"def",
"add_element",
"(",
"item",
",",
"key",
",",
"value",
")",
":",
"child_name",
"=",
"QtGui",
".",
"QStandardItem",
"(",
"key",
")",
"child_name",
".",
"setDragEnabled",
"(",... | fills a tree with nested parameters
Args:
tree: QtGui.QTreeView
parameters: dictionary or Parameter object
Returns: | [
"fills",
"a",
"tree",
"with",
"nested",
"parameters",
"Args",
":",
"tree",
":",
"QtGui",
".",
"QTreeView",
"parameters",
":",
"dictionary",
"or",
"Parameter",
"object"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py#L188-L230 | train | Fills a tree with nested parameters from a dictionary or Parameter object. |
LISE-B26/pylabcontrol | build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py | LoadDialog.get_values | def get_values(self):
"""
Returns: the selected instruments
"""
elements_selected = {}
for index in range(self.tree_loaded_model.rowCount()):
element_name = str(self.tree_loaded_model.item(index).text())
if element_name in self.elements_old:
... | python | def get_values(self):
"""
Returns: the selected instruments
"""
elements_selected = {}
for index in range(self.tree_loaded_model.rowCount()):
element_name = str(self.tree_loaded_model.item(index).text())
if element_name in self.elements_old:
... | [
"def",
"get_values",
"(",
"self",
")",
":",
"elements_selected",
"=",
"{",
"}",
"for",
"index",
"in",
"range",
"(",
"self",
".",
"tree_loaded_model",
".",
"rowCount",
"(",
")",
")",
":",
"element_name",
"=",
"str",
"(",
"self",
".",
"tree_loaded_model",
... | Returns: the selected instruments | [
"Returns",
":",
"the",
"selected",
"instruments"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py#L232-L245 | train | Returns the selected instruments and instruments from the tree loaded model |
LISE-B26/pylabcontrol | build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py | LoadDialog.add_script_sequence | def add_script_sequence(self):
"""
creates a script sequence based on the script iterator type selected and the selected scripts and sends it to the tree
self.tree_loaded
"""
def empty_tree(tree_model):
# COMMENT_ME
def add_children_to_list(item, somelis... | python | def add_script_sequence(self):
"""
creates a script sequence based on the script iterator type selected and the selected scripts and sends it to the tree
self.tree_loaded
"""
def empty_tree(tree_model):
# COMMENT_ME
def add_children_to_list(item, somelis... | [
"def",
"add_script_sequence",
"(",
"self",
")",
":",
"def",
"empty_tree",
"(",
"tree_model",
")",
":",
"# COMMENT_ME",
"def",
"add_children_to_list",
"(",
"item",
",",
"somelist",
")",
":",
"if",
"item",
".",
"hasChildren",
"(",
")",
":",
"for",
"rownum",
... | creates a script sequence based on the script iterator type selected and the selected scripts and sends it to the tree
self.tree_loaded | [
"creates",
"a",
"script",
"sequence",
"based",
"on",
"the",
"script",
"iterator",
"type",
"selected",
"and",
"the",
"selected",
"scripts",
"and",
"sends",
"it",
"to",
"the",
"tree",
"self",
".",
"tree_loaded"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/src/gui/qt_b26_load_dialog.py#L247-L295 | train | Creates a script sequence based on the selected scripts and sends it to the tree_loaded attribute. |
johnnoone/json-spec | src/jsonspec/validators/formats.py | register | def register(func=None, name=None):
"""
Expose compiler to factory.
:param func: the callable to expose
:type func: callable
:param name: name of format
:type name: str
It can be used as a decorator::
@register(name='my:validator')
def my_validator(obj):
if obj... | python | def register(func=None, name=None):
"""
Expose compiler to factory.
:param func: the callable to expose
:type func: callable
:param name: name of format
:type name: str
It can be used as a decorator::
@register(name='my:validator')
def my_validator(obj):
if obj... | [
"def",
"register",
"(",
"func",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"not",
"name",
":",
"raise",
"CompilationError",
"(",
"'Name is required'",
")",
"if",
"not",
"func",
":",
"return",
"partial",
"(",
"register",
",",
"name",
"=",
"n... | Expose compiler to factory.
:param func: the callable to expose
:type func: callable
:param name: name of format
:type name: str
It can be used as a decorator::
@register(name='my:validator')
def my_validator(obj):
if obj is True:
return obj
... | [
"Expose",
"compiler",
"to",
"factory",
"."
] | f91981724cea0c366bd42a6670eb07bbe31c0e0c | https://github.com/johnnoone/json-spec/blob/f91981724cea0c366bd42a6670eb07bbe31c0e0c/src/jsonspec/validators/formats.py#L112-L143 | train | Decorator to expose a function to expose a format
. |
moonso/ped_parser | ped_parser/parser.py | cli | def cli(family_file, family_type, to_json, to_madeline, to_ped, to_dict,
outfile, logfile, loglevel):
"""Cli for testing the ped parser."""
from pprint import pprint as pp
my_parser = FamilyParser(family_file, family_type)
if to_json:
if outfile:
outfile.write(my_p... | python | def cli(family_file, family_type, to_json, to_madeline, to_ped, to_dict,
outfile, logfile, loglevel):
"""Cli for testing the ped parser."""
from pprint import pprint as pp
my_parser = FamilyParser(family_file, family_type)
if to_json:
if outfile:
outfile.write(my_p... | [
"def",
"cli",
"(",
"family_file",
",",
"family_type",
",",
"to_json",
",",
"to_madeline",
",",
"to_ped",
",",
"to_dict",
",",
"outfile",
",",
"logfile",
",",
"loglevel",
")",
":",
"from",
"pprint",
"import",
"pprint",
"as",
"pp",
"my_parser",
"=",
"FamilyP... | Cli for testing the ped parser. | [
"Cli",
"for",
"testing",
"the",
"ped",
"parser",
"."
] | a7393e47139532782ea3c821aabea33d46f94323 | https://github.com/moonso/ped_parser/blob/a7393e47139532782ea3c821aabea33d46f94323/ped_parser/parser.py#L641-L668 | train | This function is a simple CLI for testing the ped parser. |
moonso/ped_parser | ped_parser/parser.py | FamilyParser.get_individual | def get_individual(self, family_id, sample_id, father_id, mother_id, sex, phenotype,
genetic_models = None, proband='.', consultand='.', alive='.'):
"""
Return a individual object based on the indata.
Arguments:
family_id (str): The id for this family
... | python | def get_individual(self, family_id, sample_id, father_id, mother_id, sex, phenotype,
genetic_models = None, proband='.', consultand='.', alive='.'):
"""
Return a individual object based on the indata.
Arguments:
family_id (str): The id for this family
... | [
"def",
"get_individual",
"(",
"self",
",",
"family_id",
",",
"sample_id",
",",
"father_id",
",",
"mother_id",
",",
"sex",
",",
"phenotype",
",",
"genetic_models",
"=",
"None",
",",
"proband",
"=",
"'.'",
",",
"consultand",
"=",
"'.'",
",",
"alive",
"=",
... | Return a individual object based on the indata.
Arguments:
family_id (str): The id for this family
sample_id (str): The id for this sample
father_id (str): The id for this samples father
mother_id (str): The id for this samples mother
sex (str... | [
"Return",
"a",
"individual",
"object",
"based",
"on",
"the",
"indata",
".",
"Arguments",
":",
"family_id",
"(",
"str",
")",
":",
"The",
"id",
"for",
"this",
"family",
"sample_id",
"(",
"str",
")",
":",
"The",
"id",
"for",
"this",
"sample",
"father_id",
... | a7393e47139532782ea3c821aabea33d46f94323 | https://github.com/moonso/ped_parser/blob/a7393e47139532782ea3c821aabea33d46f94323/ped_parser/parser.py#L127-L193 | train | Returns a individual object based on the indata. |
moonso/ped_parser | ped_parser/parser.py | FamilyParser.check_line_length | def check_line_length(self, splitted_line, expected_length):
"""
Check if the line is correctly formated. Throw a SyntaxError if it is not.
"""
if len(splitted_line) != expected_length:
raise WrongLineFormat(
message='WRONG FORMATED PED LINE!',
... | python | def check_line_length(self, splitted_line, expected_length):
"""
Check if the line is correctly formated. Throw a SyntaxError if it is not.
"""
if len(splitted_line) != expected_length:
raise WrongLineFormat(
message='WRONG FORMATED PED LINE!',
... | [
"def",
"check_line_length",
"(",
"self",
",",
"splitted_line",
",",
"expected_length",
")",
":",
"if",
"len",
"(",
"splitted_line",
")",
"!=",
"expected_length",
":",
"raise",
"WrongLineFormat",
"(",
"message",
"=",
"'WRONG FORMATED PED LINE!'",
",",
"ped_line",
"... | Check if the line is correctly formated. Throw a SyntaxError if it is not. | [
"Check",
"if",
"the",
"line",
"is",
"correctly",
"formated",
".",
"Throw",
"a",
"SyntaxError",
"if",
"it",
"is",
"not",
"."
] | a7393e47139532782ea3c821aabea33d46f94323 | https://github.com/moonso/ped_parser/blob/a7393e47139532782ea3c821aabea33d46f94323/ped_parser/parser.py#L195-L203 | train | Check if the line is correctly formated. Throw a SyntaxError if it is not. |
moonso/ped_parser | ped_parser/parser.py | FamilyParser.ped_parser | def ped_parser(self, family_info):
"""
Parse .ped formatted family info.
Add all family info to the parser object
Arguments:
family_info (iterator): An iterator with family info
"""
for line in family_info:
# Che... | python | def ped_parser(self, family_info):
"""
Parse .ped formatted family info.
Add all family info to the parser object
Arguments:
family_info (iterator): An iterator with family info
"""
for line in family_info:
# Che... | [
"def",
"ped_parser",
"(",
"self",
",",
"family_info",
")",
":",
"for",
"line",
"in",
"family_info",
":",
"# Check if commented line or empty line:",
"if",
"not",
"line",
".",
"startswith",
"(",
"'#'",
")",
"and",
"not",
"all",
"(",
"c",
"in",
"whitespace",
"... | Parse .ped formatted family info.
Add all family info to the parser object
Arguments:
family_info (iterator): An iterator with family info | [
"Parse",
".",
"ped",
"formatted",
"family",
"info",
".",
"Add",
"all",
"family",
"info",
"to",
"the",
"parser",
"object",
"Arguments",
":",
"family_info",
"(",
"iterator",
")",
":",
"An",
"iterator",
"with",
"family",
"info"
] | a7393e47139532782ea3c821aabea33d46f94323 | https://github.com/moonso/ped_parser/blob/a7393e47139532782ea3c821aabea33d46f94323/ped_parser/parser.py#L205-L238 | train | Parse. ped formatted family info. |
moonso/ped_parser | ped_parser/parser.py | FamilyParser.alternative_parser | def alternative_parser(self, family_file):
"""
Parse alternative formatted family info
This parses a information with more than six columns.
For alternative information header comlumn must exist and each row
must have the same amount of columns as the header.
... | python | def alternative_parser(self, family_file):
"""
Parse alternative formatted family info
This parses a information with more than six columns.
For alternative information header comlumn must exist and each row
must have the same amount of columns as the header.
... | [
"def",
"alternative_parser",
"(",
"self",
",",
"family_file",
")",
":",
"alternative_header",
"=",
"None",
"for",
"line",
"in",
"family_file",
":",
"if",
"line",
".",
"startswith",
"(",
"'#'",
")",
":",
"alternative_header",
"=",
"line",
"[",
"1",
":",
"]"... | Parse alternative formatted family info
This parses a information with more than six columns.
For alternative information header comlumn must exist and each row
must have the same amount of columns as the header.
First six columns must be the same as in the ped format.
... | [
"Parse",
"alternative",
"formatted",
"family",
"info",
"This",
"parses",
"a",
"information",
"with",
"more",
"than",
"six",
"columns",
".",
"For",
"alternative",
"information",
"header",
"comlumn",
"must",
"exist",
"and",
"each",
"row",
"must",
"have",
"the",
... | a7393e47139532782ea3c821aabea33d46f94323 | https://github.com/moonso/ped_parser/blob/a7393e47139532782ea3c821aabea33d46f94323/ped_parser/parser.py#L241-L345 | train | This function parses the alternative formatted family info file. |
moonso/ped_parser | ped_parser/parser.py | FamilyParser.check_cmms_id | def check_cmms_id(self, ind_id):
"""
Take the ID and check if it is following the cmms standard.
The standard is year:id-generation-indcode:affectionstatus.
Year is two digits, id three digits, generation in roman letters
indcode are digits and affection status are in ['A', 'U', ... | python | def check_cmms_id(self, ind_id):
"""
Take the ID and check if it is following the cmms standard.
The standard is year:id-generation-indcode:affectionstatus.
Year is two digits, id three digits, generation in roman letters
indcode are digits and affection status are in ['A', 'U', ... | [
"def",
"check_cmms_id",
"(",
"self",
",",
"ind_id",
")",
":",
"ind_id",
"=",
"ind_id",
".",
"split",
"(",
"'-'",
")",
"# This in A (=affected), U (=unaffected) or X (=unknown)",
"family_id",
"=",
"ind_id",
"[",
"0",
"]",
"try",
":",
"int",
"(",
"family_id",
")... | Take the ID and check if it is following the cmms standard.
The standard is year:id-generation-indcode:affectionstatus.
Year is two digits, id three digits, generation in roman letters
indcode are digits and affection status are in ['A', 'U', 'X'].
Example 11001-II-1A.
I... | [
"Take",
"the",
"ID",
"and",
"check",
"if",
"it",
"is",
"following",
"the",
"cmms",
"standard",
".",
"The",
"standard",
"is",
"year",
":",
"id",
"-",
"generation",
"-",
"indcode",
":",
"affectionstatus",
".",
"Year",
"is",
"two",
"digits",
"id",
"three",
... | a7393e47139532782ea3c821aabea33d46f94323 | https://github.com/moonso/ped_parser/blob/a7393e47139532782ea3c821aabea33d46f94323/ped_parser/parser.py#L347-L374 | train | Check if the ID is correct for the cmms standard. |
moonso/ped_parser | ped_parser/parser.py | FamilyParser.check_cmms_affection_status | def check_cmms_affection_status(self, ind_object):
"""
Check if the affection status is correct.
Args:
ind_object : An Individuals object
Yields:
bool : True if affection status is correct
False otherwise
"""
... | python | def check_cmms_affection_status(self, ind_object):
"""
Check if the affection status is correct.
Args:
ind_object : An Individuals object
Yields:
bool : True if affection status is correct
False otherwise
"""
... | [
"def",
"check_cmms_affection_status",
"(",
"self",
",",
"ind_object",
")",
":",
"valid_affection_statuses",
"=",
"[",
"'A'",
",",
"'U'",
",",
"'X'",
"]",
"ind_id",
"=",
"ind_object",
".",
"individual_id",
".",
"split",
"(",
"'-'",
")",
"phenotype",
"=",
"ind... | Check if the affection status is correct.
Args:
ind_object : An Individuals object
Yields:
bool : True if affection status is correct
False otherwise | [
"Check",
"if",
"the",
"affection",
"status",
"is",
"correct",
".",
"Args",
":",
"ind_object",
":",
"An",
"Individuals",
"object",
"Yields",
":",
"bool",
":",
"True",
"if",
"affection",
"status",
"is",
"correct",
"False",
"otherwise"
] | a7393e47139532782ea3c821aabea33d46f94323 | https://github.com/moonso/ped_parser/blob/a7393e47139532782ea3c821aabea33d46f94323/ped_parser/parser.py#L376-L401 | train | Checks if the affection status of an object is correct. |
moonso/ped_parser | ped_parser/parser.py | FamilyParser.check_cmms_gender | def check_cmms_gender(self, ind_object):
"""
Check if the phenotype is correct.
Args:
ind_object : An Individuals object
Yields:
bool : True if phenotype status is correct
False otherwise
"""
ind_id = ind_obje... | python | def check_cmms_gender(self, ind_object):
"""
Check if the phenotype is correct.
Args:
ind_object : An Individuals object
Yields:
bool : True if phenotype status is correct
False otherwise
"""
ind_id = ind_obje... | [
"def",
"check_cmms_gender",
"(",
"self",
",",
"ind_object",
")",
":",
"ind_id",
"=",
"ind_object",
".",
"individual_id",
".",
"split",
"(",
"'-'",
")",
"sex",
"=",
"ind_object",
".",
"sex",
"sex_code",
"=",
"int",
"(",
"ind_id",
"[",
"-",
"1",
"]",
"["... | Check if the phenotype is correct.
Args:
ind_object : An Individuals object
Yields:
bool : True if phenotype status is correct
False otherwise | [
"Check",
"if",
"the",
"phenotype",
"is",
"correct",
".",
"Args",
":",
"ind_object",
":",
"An",
"Individuals",
"object",
"Yields",
":",
"bool",
":",
"True",
"if",
"phenotype",
"status",
"is",
"correct",
"False",
"otherwise"
] | a7393e47139532782ea3c821aabea33d46f94323 | https://github.com/moonso/ped_parser/blob/a7393e47139532782ea3c821aabea33d46f94323/ped_parser/parser.py#L403-L420 | train | Checks if the sex of the assessment is correct. |
moonso/ped_parser | ped_parser/parser.py | FamilyParser.get_models | def get_models(self, genetic_models):
"""
Check what genetic models that are found and return them as a set.
Args:
genetic_models : A string with genetic models
Yields:
correct_model_names : A set with the correct model names
"""
... | python | def get_models(self, genetic_models):
"""
Check what genetic models that are found and return them as a set.
Args:
genetic_models : A string with genetic models
Yields:
correct_model_names : A set with the correct model names
"""
... | [
"def",
"get_models",
"(",
"self",
",",
"genetic_models",
")",
":",
"correct_model_names",
"=",
"set",
"(",
")",
"genetic_models",
"=",
"genetic_models",
".",
"split",
"(",
"';'",
")",
"correct_model_names",
"=",
"set",
"(",
")",
"for",
"model",
"in",
"geneti... | Check what genetic models that are found and return them as a set.
Args:
genetic_models : A string with genetic models
Yields:
correct_model_names : A set with the correct model names | [
"Check",
"what",
"genetic",
"models",
"that",
"are",
"found",
"and",
"return",
"them",
"as",
"a",
"set",
".",
"Args",
":",
"genetic_models",
":",
"A",
"string",
"with",
"genetic",
"models",
"Yields",
":",
"correct_model_names",
":",
"A",
"set",
"with",
"th... | a7393e47139532782ea3c821aabea33d46f94323 | https://github.com/moonso/ped_parser/blob/a7393e47139532782ea3c821aabea33d46f94323/ped_parser/parser.py#L422-L453 | train | Check what genetic models are found and return them as a set. |
moonso/ped_parser | ped_parser/parser.py | FamilyParser.to_dict | def to_dict(self):
"""
Return the information from the pedigree file as a dictionary.
family id is key and a list with dictionarys for each individual
as value.
Returns:
families (dict): A dictionary with the families
"""
self.logger... | python | def to_dict(self):
"""
Return the information from the pedigree file as a dictionary.
family id is key and a list with dictionarys for each individual
as value.
Returns:
families (dict): A dictionary with the families
"""
self.logger... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Return the information as a dictionary\"",
")",
"families",
"=",
"{",
"}",
"for",
"family_id",
"in",
"self",
".",
"families",
":",
"family",
"=",
"[",
"]",
"for",
"indivi... | Return the information from the pedigree file as a dictionary.
family id is key and a list with dictionarys for each individual
as value.
Returns:
families (dict): A dictionary with the families | [
"Return",
"the",
"information",
"from",
"the",
"pedigree",
"file",
"as",
"a",
"dictionary",
".",
"family",
"id",
"is",
"key",
"and",
"a",
"list",
"with",
"dictionarys",
"for",
"each",
"individual",
"as",
"value",
".",
"Returns",
":",
"families",
"(",
"dict... | a7393e47139532782ea3c821aabea33d46f94323 | https://github.com/moonso/ped_parser/blob/a7393e47139532782ea3c821aabea33d46f94323/ped_parser/parser.py#L455-L478 | train | Return the information from the pedigree file as a dictionary. |
moonso/ped_parser | ped_parser/parser.py | FamilyParser.to_madeline | def to_madeline(self):
"""
Return a generator with the info in madeline format.
Yields:
An iterator with family info in madeline format
"""
madeline_header = [
'FamilyID',
'IndividualID',
'Gender',
'... | python | def to_madeline(self):
"""
Return a generator with the info in madeline format.
Yields:
An iterator with family info in madeline format
"""
madeline_header = [
'FamilyID',
'IndividualID',
'Gender',
'... | [
"def",
"to_madeline",
"(",
"self",
")",
":",
"madeline_header",
"=",
"[",
"'FamilyID'",
",",
"'IndividualID'",
",",
"'Gender'",
",",
"'Father'",
",",
"'Mother'",
",",
"'Affected'",
",",
"'Proband'",
",",
"'Consultand'",
",",
"'Alive'",
"]",
"yield",
"'\\t'",
... | Return a generator with the info in madeline format.
Yields:
An iterator with family info in madeline format | [
"Return",
"a",
"generator",
"with",
"the",
"info",
"in",
"madeline",
"format",
".",
"Yields",
":",
"An",
"iterator",
"with",
"family",
"info",
"in",
"madeline",
"format"
] | a7393e47139532782ea3c821aabea33d46f94323 | https://github.com/moonso/ped_parser/blob/a7393e47139532782ea3c821aabea33d46f94323/ped_parser/parser.py#L515-L541 | train | Return a generator with the info in madeline format. |
moonso/ped_parser | ped_parser/parser.py | FamilyParser.to_ped | def to_ped(self):
"""
Return a generator with the info in ped format.
Yields:
An iterator with the family info in ped format
"""
ped_header = [
'#FamilyID',
'IndividualID',
'PaternalID',
'MaternalID',
... | python | def to_ped(self):
"""
Return a generator with the info in ped format.
Yields:
An iterator with the family info in ped format
"""
ped_header = [
'#FamilyID',
'IndividualID',
'PaternalID',
'MaternalID',
... | [
"def",
"to_ped",
"(",
"self",
")",
":",
"ped_header",
"=",
"[",
"'#FamilyID'",
",",
"'IndividualID'",
",",
"'PaternalID'",
",",
"'MaternalID'",
",",
"'Sex'",
",",
"'Phenotype'",
",",
"]",
"extra_headers",
"=",
"[",
"'InheritanceModel'",
",",
"'Proband'",
",",
... | Return a generator with the info in ped format.
Yields:
An iterator with the family info in ped format | [
"Return",
"a",
"generator",
"with",
"the",
"info",
"in",
"ped",
"format",
".",
"Yields",
":",
"An",
"iterator",
"with",
"the",
"family",
"info",
"in",
"ped",
"format"
] | a7393e47139532782ea3c821aabea33d46f94323 | https://github.com/moonso/ped_parser/blob/a7393e47139532782ea3c821aabea33d46f94323/ped_parser/parser.py#L543-L597 | train | Return a generator with the family info in ped format. |
PeerAssets/pypeerassets | pypeerassets/voting.py | deck_vote_tag | def deck_vote_tag(deck: Deck) -> str:
'''deck vote tag address'''
if deck.id is None:
raise Exception("deck.id is required")
deck_vote_tag_privkey = sha256(unhexlify(deck.id) + b"vote_init").hexdigest()
deck_vote_tag_address = Kutil(network=deck.network, privkey=bytearray.fromhex(deck_vote_tag... | python | def deck_vote_tag(deck: Deck) -> str:
'''deck vote tag address'''
if deck.id is None:
raise Exception("deck.id is required")
deck_vote_tag_privkey = sha256(unhexlify(deck.id) + b"vote_init").hexdigest()
deck_vote_tag_address = Kutil(network=deck.network, privkey=bytearray.fromhex(deck_vote_tag... | [
"def",
"deck_vote_tag",
"(",
"deck",
":",
"Deck",
")",
"->",
"str",
":",
"if",
"deck",
".",
"id",
"is",
"None",
":",
"raise",
"Exception",
"(",
"\"deck.id is required\"",
")",
"deck_vote_tag_privkey",
"=",
"sha256",
"(",
"unhexlify",
"(",
"deck",
".",
"id"... | deck vote tag address | [
"deck",
"vote",
"tag",
"address"
] | 8927b4a686887f44fe2cd9de777e2c827c948987 | https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/voting.py#L14-L22 | train | deck vote tag address |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.