partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | _coarsenImage | seems to be a more precise (but slower)
way to down-scale an image | imgProcessor/uncertainty/positionToIntensityUncertainty.py | def _coarsenImage(image, f):
'''
seems to be a more precise (but slower)
way to down-scale an image
'''
from skimage.morphology import square
from skimage.filters import rank
from skimage.transform._warps import rescale
selem = square(f)
arri = rank.mean(image, selem=selem)
... | def _coarsenImage(image, f):
'''
seems to be a more precise (but slower)
way to down-scale an image
'''
from skimage.morphology import square
from skimage.filters import rank
from skimage.transform._warps import rescale
selem = square(f)
arri = rank.mean(image, selem=selem)
... | [
"seems",
"to",
"be",
"a",
"more",
"precise",
"(",
"but",
"slower",
")",
"way",
"to",
"down",
"-",
"scale",
"an",
"image"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/uncertainty/positionToIntensityUncertainty.py#L94-L104 | [
"def",
"_coarsenImage",
"(",
"image",
",",
"f",
")",
":",
"from",
"skimage",
".",
"morphology",
"import",
"square",
"from",
"skimage",
".",
"filters",
"import",
"rank",
"from",
"skimage",
".",
"transform",
".",
"_warps",
"import",
"rescale",
"selem",
"=",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | positionToIntensityUncertaintyForPxGroup | like positionToIntensityUncertainty
but calculated average uncertainty for an area [y0:y1,x0:x1] | imgProcessor/uncertainty/positionToIntensityUncertainty.py | def positionToIntensityUncertaintyForPxGroup(image, std, y0, y1, x0, x1):
'''
like positionToIntensityUncertainty
but calculated average uncertainty for an area [y0:y1,x0:x1]
'''
fy, fx = y1 - y0, x1 - x0
if fy != fx:
raise Exception('averaged area need to be square ATM')
ima... | def positionToIntensityUncertaintyForPxGroup(image, std, y0, y1, x0, x1):
'''
like positionToIntensityUncertainty
but calculated average uncertainty for an area [y0:y1,x0:x1]
'''
fy, fx = y1 - y0, x1 - x0
if fy != fx:
raise Exception('averaged area need to be square ATM')
ima... | [
"like",
"positionToIntensityUncertainty",
"but",
"calculated",
"average",
"uncertainty",
"for",
"an",
"area",
"[",
"y0",
":",
"y1",
"x0",
":",
"x1",
"]"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/uncertainty/positionToIntensityUncertainty.py#L107-L121 | [
"def",
"positionToIntensityUncertaintyForPxGroup",
"(",
"image",
",",
"std",
",",
"y0",
",",
"y1",
",",
"x0",
",",
"x1",
")",
":",
"fy",
",",
"fx",
"=",
"y1",
"-",
"y0",
",",
"x1",
"-",
"x0",
"if",
"fy",
"!=",
"fx",
":",
"raise",
"Exception",
"(",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | nan_maximum_filter | same as scipy.filters.maximum_filter
but working excluding nans | imgProcessor/filters/nan_maximum_filter.py | def nan_maximum_filter(arr, ksize):
'''
same as scipy.filters.maximum_filter
but working excluding nans
'''
out = np.empty_like(arr)
_calc(arr, out, ksize//2)
return out | def nan_maximum_filter(arr, ksize):
'''
same as scipy.filters.maximum_filter
but working excluding nans
'''
out = np.empty_like(arr)
_calc(arr, out, ksize//2)
return out | [
"same",
"as",
"scipy",
".",
"filters",
".",
"maximum_filter",
"but",
"working",
"excluding",
"nans"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/filters/nan_maximum_filter.py#L7-L14 | [
"def",
"nan_maximum_filter",
"(",
"arr",
",",
"ksize",
")",
":",
"out",
"=",
"np",
".",
"empty_like",
"(",
"arr",
")",
"_calc",
"(",
"arr",
",",
"out",
",",
"ksize",
"//",
"2",
")",
"return",
"out"
] | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | medianThreshold | set every the pixel value of the given [img] to the median filtered one
of a given kernel [size]
in case the relative [threshold] is exeeded
condition = '>' OR '<' | imgProcessor/filters/medianThreshold.py | def medianThreshold(img, threshold=0.1, size=3, condition='>', copy=True):
'''
set every the pixel value of the given [img] to the median filtered one
of a given kernel [size]
in case the relative [threshold] is exeeded
condition = '>' OR '<'
'''
from scipy.ndimage import median_filte... | def medianThreshold(img, threshold=0.1, size=3, condition='>', copy=True):
'''
set every the pixel value of the given [img] to the median filtered one
of a given kernel [size]
in case the relative [threshold] is exeeded
condition = '>' OR '<'
'''
from scipy.ndimage import median_filte... | [
"set",
"every",
"the",
"pixel",
"value",
"of",
"the",
"given",
"[",
"img",
"]",
"to",
"the",
"median",
"filtered",
"one",
"of",
"a",
"given",
"kernel",
"[",
"size",
"]",
"in",
"case",
"the",
"relative",
"[",
"threshold",
"]",
"is",
"exeeded",
"conditio... | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/filters/medianThreshold.py#L7-L30 | [
"def",
"medianThreshold",
"(",
"img",
",",
"threshold",
"=",
"0.1",
",",
"size",
"=",
"3",
",",
"condition",
"=",
"'>'",
",",
"copy",
"=",
"True",
")",
":",
"from",
"scipy",
".",
"ndimage",
"import",
"median_filter",
"indices",
"=",
"None",
"if",
"thre... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | fastFilter | fn['nanmean', 'mean', 'nanmedian', 'median']
a fast 2d filter for large kernel sizes that also
works with nans
the computation speed is increased because only 'every'nsth position
within the median kernel is evaluated | imgProcessor/filters/fastFilter.py | def fastFilter(arr, ksize=30, every=None, resize=True, fn='median',
interpolation=cv2.INTER_LANCZOS4,
smoothksize=0,
borderMode=cv2.BORDER_REFLECT):
'''
fn['nanmean', 'mean', 'nanmedian', 'median']
a fast 2d filter for large kernel sizes that... | def fastFilter(arr, ksize=30, every=None, resize=True, fn='median',
interpolation=cv2.INTER_LANCZOS4,
smoothksize=0,
borderMode=cv2.BORDER_REFLECT):
'''
fn['nanmean', 'mean', 'nanmedian', 'median']
a fast 2d filter for large kernel sizes that... | [
"fn",
"[",
"nanmean",
"mean",
"nanmedian",
"median",
"]",
"a",
"fast",
"2d",
"filter",
"for",
"large",
"kernel",
"sizes",
"that",
"also",
"works",
"with",
"nans",
"the",
"computation",
"speed",
"is",
"increased",
"because",
"only",
"every",
"nsth",
"position... | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/filters/fastFilter.py#L9-L48 | [
"def",
"fastFilter",
"(",
"arr",
",",
"ksize",
"=",
"30",
",",
"every",
"=",
"None",
",",
"resize",
"=",
"True",
",",
"fn",
"=",
"'median'",
",",
"interpolation",
"=",
"cv2",
".",
"INTER_LANCZOS4",
",",
"smoothksize",
"=",
"0",
",",
"borderMode",
"=",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | elbin | Read EL images (*.elbin) created by the RELTRON EL Software
http://www.reltron.com/Products/Solar.html | imgProcessor/reader/elbin.py | def elbin(filename):
'''
Read EL images (*.elbin) created by the RELTRON EL Software
http://www.reltron.com/Products/Solar.html
'''
# arrs = []
labels = []
# These are all exposure times [s] to be selectable:
TIMES = (0.3, 0.4, 0.6, 0.8, 1.2, 1.6, 2.4, 3.2, 4.8, 6.4, 9.6, 12.8,... | def elbin(filename):
'''
Read EL images (*.elbin) created by the RELTRON EL Software
http://www.reltron.com/Products/Solar.html
'''
# arrs = []
labels = []
# These are all exposure times [s] to be selectable:
TIMES = (0.3, 0.4, 0.6, 0.8, 1.2, 1.6, 2.4, 3.2, 4.8, 6.4, 9.6, 12.8,... | [
"Read",
"EL",
"images",
"(",
"*",
".",
"elbin",
")",
"created",
"by",
"the",
"RELTRON",
"EL",
"Software",
"http",
":",
"//",
"www",
".",
"reltron",
".",
"com",
"/",
"Products",
"/",
"Solar",
".",
"html"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/reader/elbin.py#L7-L40 | [
"def",
"elbin",
"(",
"filename",
")",
":",
"# arrs = []\r",
"labels",
"=",
"[",
"]",
"# These are all exposure times [s] to be selectable:\r",
"TIMES",
"=",
"(",
"0.3",
",",
"0.4",
",",
"0.6",
",",
"0.8",
",",
"1.2",
",",
"1.6",
",",
"2.4",
",",
"3.2",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | gaussian2d | see http://en.wikipedia.org/wiki/Multivariate_normal_distribution
# probability density function of a vector [x,y]
sx,sy -> sigma (standard deviation)
mx,my: mue (mean position)
rho: correlation between x and y | imgProcessor/equations/gaussian2d.py | def gaussian2d(xy, sx, sy, mx=0, my=0, rho=0, amp=1, offs=0):
'''
see http://en.wikipedia.org/wiki/Multivariate_normal_distribution
# probability density function of a vector [x,y]
sx,sy -> sigma (standard deviation)
mx,my: mue (mean position)
rho: correlation between x and y
'''
... | def gaussian2d(xy, sx, sy, mx=0, my=0, rho=0, amp=1, offs=0):
'''
see http://en.wikipedia.org/wiki/Multivariate_normal_distribution
# probability density function of a vector [x,y]
sx,sy -> sigma (standard deviation)
mx,my: mue (mean position)
rho: correlation between x and y
'''
... | [
"see",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Multivariate_normal_distribution",
"#",
"probability",
"density",
"function",
"of",
"a",
"vector",
"[",
"x",
"y",
"]",
"sx",
"sy",
"-",
">",
"sigma",
"(",
"standard",
"devia... | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/equations/gaussian2d.py#L5-L23 | [
"def",
"gaussian2d",
"(",
"xy",
",",
"sx",
",",
"sy",
",",
"mx",
"=",
"0",
",",
"my",
"=",
"0",
",",
"rho",
"=",
"0",
",",
"amp",
"=",
"1",
",",
"offs",
"=",
"0",
")",
":",
"x",
",",
"y",
"=",
"xy",
"return",
"offs",
"+",
"amp",
"*",
"(... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveImageStitching.fitImg | fit perspective and size of the input image to the base image | imgProcessor/transform/PerspectiveImageStitching.py | def fitImg(self, img_rgb):
'''
fit perspective and size of the input image to the base image
'''
H = self.pattern.findHomography(img_rgb)[0]
H_inv = self.pattern.invertHomography(H)
s = self.img_orig.shape
warped = cv2.warpPerspective(img_rgb, H_inv, (s[1],... | def fitImg(self, img_rgb):
'''
fit perspective and size of the input image to the base image
'''
H = self.pattern.findHomography(img_rgb)[0]
H_inv = self.pattern.invertHomography(H)
s = self.img_orig.shape
warped = cv2.warpPerspective(img_rgb, H_inv, (s[1],... | [
"fit",
"perspective",
"and",
"size",
"of",
"the",
"input",
"image",
"to",
"the",
"base",
"image"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/transform/PerspectiveImageStitching.py#L26-L34 | [
"def",
"fitImg",
"(",
"self",
",",
"img_rgb",
")",
":",
"H",
"=",
"self",
".",
"pattern",
".",
"findHomography",
"(",
"img_rgb",
")",
"[",
"0",
"]",
"H_inv",
"=",
"self",
".",
"pattern",
".",
"invertHomography",
"(",
"H",
")",
"s",
"=",
"self",
"."... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | scaleSignalCut | scaling img cutting x percent of top and bottom part of histogram | imgProcessor/imgSignal.py | def scaleSignalCut(img, ratio, nbins=100):
'''
scaling img cutting x percent of top and bottom part of histogram
'''
start, stop = scaleSignalCutParams(img, ratio, nbins)
img = img - start
img /= (stop - start)
return img | def scaleSignalCut(img, ratio, nbins=100):
'''
scaling img cutting x percent of top and bottom part of histogram
'''
start, stop = scaleSignalCutParams(img, ratio, nbins)
img = img - start
img /= (stop - start)
return img | [
"scaling",
"img",
"cutting",
"x",
"percent",
"of",
"top",
"and",
"bottom",
"part",
"of",
"histogram"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/imgSignal.py#L14-L21 | [
"def",
"scaleSignalCut",
"(",
"img",
",",
"ratio",
",",
"nbins",
"=",
"100",
")",
":",
"start",
",",
"stop",
"=",
"scaleSignalCutParams",
"(",
"img",
",",
"ratio",
",",
"nbins",
")",
"img",
"=",
"img",
"-",
"start",
"img",
"/=",
"(",
"stop",
"-",
"... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | scaleSignal | scale the image between...
backgroundToZero=True -> 0 (average background) and 1 (maximum signal)
backgroundToZero=False -> signal+-3std
reference -> reference image -- scale image to fit this one
returns:
scaled image | imgProcessor/imgSignal.py | def scaleSignal(img, fitParams=None,
backgroundToZero=False, reference=None):
'''
scale the image between...
backgroundToZero=True -> 0 (average background) and 1 (maximum signal)
backgroundToZero=False -> signal+-3std
reference -> reference image -- scale image to fit this... | def scaleSignal(img, fitParams=None,
backgroundToZero=False, reference=None):
'''
scale the image between...
backgroundToZero=True -> 0 (average background) and 1 (maximum signal)
backgroundToZero=False -> signal+-3std
reference -> reference image -- scale image to fit this... | [
"scale",
"the",
"image",
"between",
"...",
"backgroundToZero",
"=",
"True",
"-",
">",
"0",
"(",
"average",
"background",
")",
"and",
"1",
"(",
"maximum",
"signal",
")",
"backgroundToZero",
"=",
"False",
"-",
">",
"signal",
"+",
"-",
"3std",
"reference",
... | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/imgSignal.py#L72-L104 | [
"def",
"scaleSignal",
"(",
"img",
",",
"fitParams",
"=",
"None",
",",
"backgroundToZero",
"=",
"False",
",",
"reference",
"=",
"None",
")",
":",
"img",
"=",
"imread",
"(",
"img",
")",
"if",
"reference",
"is",
"not",
"None",
":",
"# def fn(ii, m,n):... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | getBackgroundRange | return minimum, average, maximum of the background peak | imgProcessor/imgSignal.py | def getBackgroundRange(fitParams):
'''
return minimum, average, maximum of the background peak
'''
smn, _, _ = getSignalParameters(fitParams)
bg = fitParams[0]
_, avg, std = bg
bgmn = max(0, avg - 3 * std)
if avg + 4 * std < smn:
bgmx = avg + 4 * std
if avg + 3 ... | def getBackgroundRange(fitParams):
'''
return minimum, average, maximum of the background peak
'''
smn, _, _ = getSignalParameters(fitParams)
bg = fitParams[0]
_, avg, std = bg
bgmn = max(0, avg - 3 * std)
if avg + 4 * std < smn:
bgmx = avg + 4 * std
if avg + 3 ... | [
"return",
"minimum",
"average",
"maximum",
"of",
"the",
"background",
"peak"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/imgSignal.py#L107-L125 | [
"def",
"getBackgroundRange",
"(",
"fitParams",
")",
":",
"smn",
",",
"_",
",",
"_",
"=",
"getSignalParameters",
"(",
"fitParams",
")",
"bg",
"=",
"fitParams",
"[",
"0",
"]",
"_",
",",
"avg",
",",
"std",
"=",
"bg",
"bgmn",
"=",
"max",
"(",
"0",
",",... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | hasBackground | compare the height of putative bg and signal peak
if ratio if too height assume there is no background | imgProcessor/imgSignal.py | def hasBackground(fitParams):
'''
compare the height of putative bg and signal peak
if ratio if too height assume there is no background
'''
signal = getSignalPeak(fitParams)
bg = getBackgroundPeak(fitParams)
if signal == bg:
return False
r = signal[0] / bg[0]
if r ... | def hasBackground(fitParams):
'''
compare the height of putative bg and signal peak
if ratio if too height assume there is no background
'''
signal = getSignalPeak(fitParams)
bg = getBackgroundPeak(fitParams)
if signal == bg:
return False
r = signal[0] / bg[0]
if r ... | [
"compare",
"the",
"height",
"of",
"putative",
"bg",
"and",
"signal",
"peak",
"if",
"ratio",
"if",
"too",
"height",
"assume",
"there",
"is",
"no",
"background"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/imgSignal.py#L128-L140 | [
"def",
"hasBackground",
"(",
"fitParams",
")",
":",
"signal",
"=",
"getSignalPeak",
"(",
"fitParams",
")",
"bg",
"=",
"getBackgroundPeak",
"(",
"fitParams",
")",
"if",
"signal",
"==",
"bg",
":",
"return",
"False",
"r",
"=",
"signal",
"[",
"0",
"]",
"/",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | signalMinimum2 | minimum position between signal and background peak | imgProcessor/imgSignal.py | def signalMinimum2(img, bins=None):
'''
minimum position between signal and background peak
'''
f = FitHistogramPeaks(img, bins=bins)
i = signalPeakIndex(f.fitParams)
spos = f.fitParams[i][1]
# spos = getSignalPeak(f.fitParams)[1]
# bpos = getBackgroundPeak(f.fitParams)[1]
b... | def signalMinimum2(img, bins=None):
'''
minimum position between signal and background peak
'''
f = FitHistogramPeaks(img, bins=bins)
i = signalPeakIndex(f.fitParams)
spos = f.fitParams[i][1]
# spos = getSignalPeak(f.fitParams)[1]
# bpos = getBackgroundPeak(f.fitParams)[1]
b... | [
"minimum",
"position",
"between",
"signal",
"and",
"background",
"peak"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/imgSignal.py#L161-L179 | [
"def",
"signalMinimum2",
"(",
"img",
",",
"bins",
"=",
"None",
")",
":",
"f",
"=",
"FitHistogramPeaks",
"(",
"img",
",",
"bins",
"=",
"bins",
")",
"i",
"=",
"signalPeakIndex",
"(",
"f",
".",
"fitParams",
")",
"spos",
"=",
"f",
".",
"fitParams",
"[",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | signalMinimum | intersection between signal and background peak | imgProcessor/imgSignal.py | def signalMinimum(img, fitParams=None, n_std=3):
'''
intersection between signal and background peak
'''
if fitParams is None:
fitParams = FitHistogramPeaks(img).fitParams
assert len(fitParams) > 1, 'need 2 peaks so get minimum signal'
i = signalPeakIndex(fitParams)
signal ... | def signalMinimum(img, fitParams=None, n_std=3):
'''
intersection between signal and background peak
'''
if fitParams is None:
fitParams = FitHistogramPeaks(img).fitParams
assert len(fitParams) > 1, 'need 2 peaks so get minimum signal'
i = signalPeakIndex(fitParams)
signal ... | [
"intersection",
"between",
"signal",
"and",
"background",
"peak"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/imgSignal.py#L182-L213 | [
"def",
"signalMinimum",
"(",
"img",
",",
"fitParams",
"=",
"None",
",",
"n_std",
"=",
"3",
")",
":",
"if",
"fitParams",
"is",
"None",
":",
"fitParams",
"=",
"FitHistogramPeaks",
"(",
"img",
")",
".",
"fitParams",
"assert",
"len",
"(",
"fitParams",
")",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | getSignalParameters | return minimum, average, maximum of the signal peak | imgProcessor/imgSignal.py | def getSignalParameters(fitParams, n_std=3):
'''
return minimum, average, maximum of the signal peak
'''
signal = getSignalPeak(fitParams)
mx = signal[1] + n_std * signal[2]
mn = signal[1] - n_std * signal[2]
if mn < fitParams[0][1]:
mn = fitParams[0][1] # set to bg
ret... | def getSignalParameters(fitParams, n_std=3):
'''
return minimum, average, maximum of the signal peak
'''
signal = getSignalPeak(fitParams)
mx = signal[1] + n_std * signal[2]
mn = signal[1] - n_std * signal[2]
if mn < fitParams[0][1]:
mn = fitParams[0][1] # set to bg
ret... | [
"return",
"minimum",
"average",
"maximum",
"of",
"the",
"signal",
"peak"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/imgSignal.py#L250-L259 | [
"def",
"getSignalParameters",
"(",
"fitParams",
",",
"n_std",
"=",
"3",
")",
":",
"signal",
"=",
"getSignalPeak",
"(",
"fitParams",
")",
"mx",
"=",
"signal",
"[",
"1",
"]",
"+",
"n_std",
"*",
"signal",
"[",
"2",
"]",
"mn",
"=",
"signal",
"[",
"1",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | equalizeImage | Equalize the histogram (contrast) of an image
works with RGB/multi-channel images
and flat-arrays
@param img - image_path or np.array
@param save_path if given output images will be saved there
@param name_additive if given this additive will be appended to output images
@return outpu... | imgProcessor/transform/equalizeImage.py | def equalizeImage(img, save_path=None, name_additive='_eqHist'):
'''
Equalize the histogram (contrast) of an image
works with RGB/multi-channel images
and flat-arrays
@param img - image_path or np.array
@param save_path if given output images will be saved there
@param name_additiv... | def equalizeImage(img, save_path=None, name_additive='_eqHist'):
'''
Equalize the histogram (contrast) of an image
works with RGB/multi-channel images
and flat-arrays
@param img - image_path or np.array
@param save_path if given output images will be saved there
@param name_additiv... | [
"Equalize",
"the",
"histogram",
"(",
"contrast",
")",
"of",
"an",
"image",
"works",
"with",
"RGB",
"/",
"multi",
"-",
"channel",
"images",
"and",
"flat",
"-",
"arrays"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/transform/equalizeImage.py#L11-L47 | [
"def",
"equalizeImage",
"(",
"img",
",",
"save_path",
"=",
"None",
",",
"name_additive",
"=",
"'_eqHist'",
")",
":",
"if",
"isinstance",
"(",
"img",
",",
"string_types",
")",
":",
"img",
"=",
"PathStr",
"(",
"img",
")",
"if",
"not",
"img",
".",
"exists... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | _equalizeHistogram | histogram equalisation not bounded to int() or an image depth of 8 bit
works also with negative numbers | imgProcessor/transform/equalizeImage.py | def _equalizeHistogram(img):
'''
histogram equalisation not bounded to int() or an image depth of 8 bit
works also with negative numbers
'''
# to float if int:
intType = None
if 'f' not in img.dtype.str:
TO_FLOAT_TYPES = {np.dtype('uint8'): np.float16,
... | def _equalizeHistogram(img):
'''
histogram equalisation not bounded to int() or an image depth of 8 bit
works also with negative numbers
'''
# to float if int:
intType = None
if 'f' not in img.dtype.str:
TO_FLOAT_TYPES = {np.dtype('uint8'): np.float16,
... | [
"histogram",
"equalisation",
"not",
"bounded",
"to",
"int",
"()",
"or",
"an",
"image",
"depth",
"of",
"8",
"bit",
"works",
"also",
"with",
"negative",
"numbers"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/transform/equalizeImage.py#L50-L83 | [
"def",
"_equalizeHistogram",
"(",
"img",
")",
":",
"# to float if int:\r",
"intType",
"=",
"None",
"if",
"'f'",
"not",
"in",
"img",
".",
"dtype",
".",
"str",
":",
"TO_FLOAT_TYPES",
"=",
"{",
"np",
".",
"dtype",
"(",
"'uint8'",
")",
":",
"np",
".",
"flo... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | localizedMaximum | Returns the local maximum of a given 2d array
thresh -> if given, ignore all values below that value
max_length -> limit length between value has to vary > min_increase
>>> a = np.array([[0,1,2,3,2,1,0], \
[0,1,2,2,3,1,0], \
[0,1,1,2,2,3,0], \
... | imgProcessor/filters/localizedMaximum.py | def localizedMaximum(img, thresh=0, min_increase=0, max_length=0, dtype=bool):
'''
Returns the local maximum of a given 2d array
thresh -> if given, ignore all values below that value
max_length -> limit length between value has to vary > min_increase
>>> a = np.array([[0,1,2,3,2,1,0],... | def localizedMaximum(img, thresh=0, min_increase=0, max_length=0, dtype=bool):
'''
Returns the local maximum of a given 2d array
thresh -> if given, ignore all values below that value
max_length -> limit length between value has to vary > min_increase
>>> a = np.array([[0,1,2,3,2,1,0],... | [
"Returns",
"the",
"local",
"maximum",
"of",
"a",
"given",
"2d",
"array",
"thresh",
"-",
">",
"if",
"given",
"ignore",
"all",
"values",
"below",
"that",
"value",
"max_length",
"-",
">",
"limit",
"length",
"between",
"value",
"has",
"to",
"vary",
">",
"min... | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/filters/localizedMaximum.py#L5-L33 | [
"def",
"localizedMaximum",
"(",
"img",
",",
"thresh",
"=",
"0",
",",
"min_increase",
"=",
"0",
",",
"max_length",
"=",
"0",
",",
"dtype",
"=",
"bool",
")",
":",
"# because numba cannot create arrays:\r",
"out",
"=",
"np",
".",
"zeros",
"(",
"shape",
"=",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveCorrection.setReference | ref ... either quad, grid, homography or reference image
quad --> list of four image points(x,y) marking the edges of the quad
to correct
homography --> h. matrix to correct perspective distortion
referenceImage --> image of same object without perspective distortion | imgProcessor/camera/PerspectiveCorrection.py | def setReference(self, ref):
'''
ref ... either quad, grid, homography or reference image
quad --> list of four image points(x,y) marking the edges of the quad
to correct
homography --> h. matrix to correct perspective distortion
referenceImage --> image o... | def setReference(self, ref):
'''
ref ... either quad, grid, homography or reference image
quad --> list of four image points(x,y) marking the edges of the quad
to correct
homography --> h. matrix to correct perspective distortion
referenceImage --> image o... | [
"ref",
"...",
"either",
"quad",
"grid",
"homography",
"or",
"reference",
"image",
"quad",
"--",
">",
"list",
"of",
"four",
"image",
"points",
"(",
"x",
"y",
")",
"marking",
"the",
"edges",
"of",
"the",
"quad",
"to",
"correct",
"homography",
"--",
">",
... | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L97-L131 | [
"def",
"setReference",
"(",
"self",
",",
"ref",
")",
":",
"# self.maps = {}\r",
"self",
".",
"quad",
"=",
"None",
"# self.refQuad = None\r",
"self",
".",
"_camera_position",
"=",
"None",
"self",
".",
"_homography",
"=",
"None",
"self",
".",
"_hom... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveCorrection.distort | Apply perspective distortion ion self.img
angles are in DEG and need to be positive to fit into image | imgProcessor/camera/PerspectiveCorrection.py | def distort(self, img, rotX=0, rotY=0, quad=None):
'''
Apply perspective distortion ion self.img
angles are in DEG and need to be positive to fit into image
'''
self.img = imread(img)
# fit old image to self.quad:
corr = self.correct(self.img)
... | def distort(self, img, rotX=0, rotY=0, quad=None):
'''
Apply perspective distortion ion self.img
angles are in DEG and need to be positive to fit into image
'''
self.img = imread(img)
# fit old image to self.quad:
corr = self.correct(self.img)
... | [
"Apply",
"perspective",
"distortion",
"ion",
"self",
".",
"img",
"angles",
"are",
"in",
"DEG",
"and",
"need",
"to",
"be",
"positive",
"to",
"fit",
"into",
"image"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L193-L270 | [
"def",
"distort",
"(",
"self",
",",
"img",
",",
"rotX",
"=",
"0",
",",
"rotY",
"=",
"0",
",",
"quad",
"=",
"None",
")",
":",
"self",
".",
"img",
"=",
"imread",
"(",
"img",
")",
"# fit old image to self.quad:\r",
"corr",
"=",
"self",
".",
"correct",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveCorrection.correctGrid | grid -> array of polylines=((p0x,p0y),(p1x,p1y),,,) | imgProcessor/camera/PerspectiveCorrection.py | def correctGrid(self, img, grid):
'''
grid -> array of polylines=((p0x,p0y),(p1x,p1y),,,)
'''
self.img = imread(img)
h = self.homography # TODO: cleanup only needed to get newBorder attr.
if self.opts['do_correctIntensity']:
self.img = self.img / s... | def correctGrid(self, img, grid):
'''
grid -> array of polylines=((p0x,p0y),(p1x,p1y),,,)
'''
self.img = imread(img)
h = self.homography # TODO: cleanup only needed to get newBorder attr.
if self.opts['do_correctIntensity']:
self.img = self.img / s... | [
"grid",
"-",
">",
"array",
"of",
"polylines",
"=",
"((",
"p0x",
"p0y",
")",
"(",
"p1x",
"p1y",
")",
")"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L281-L372 | [
"def",
"correctGrid",
"(",
"self",
",",
"img",
",",
"grid",
")",
":",
"self",
".",
"img",
"=",
"imread",
"(",
"img",
")",
"h",
"=",
"self",
".",
"homography",
"# TODO: cleanup only needed to get newBorder attr.\r",
"if",
"self",
".",
"opts",
"[",
"'do_correc... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveCorrection.correct | ...from perspective distortion:
--> perspective transformation
--> apply tilt factor (view factor) correction | imgProcessor/camera/PerspectiveCorrection.py | def correct(self, img):
'''
...from perspective distortion:
--> perspective transformation
--> apply tilt factor (view factor) correction
'''
print("CORRECT PERSPECTIVE ...")
self.img = imread(img)
if not self._homography_is_fixed:
... | def correct(self, img):
'''
...from perspective distortion:
--> perspective transformation
--> apply tilt factor (view factor) correction
'''
print("CORRECT PERSPECTIVE ...")
self.img = imread(img)
if not self._homography_is_fixed:
... | [
"...",
"from",
"perspective",
"distortion",
":",
"--",
">",
"perspective",
"transformation",
"--",
">",
"apply",
"tilt",
"factor",
"(",
"view",
"factor",
")",
"correction"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L380-L406 | [
"def",
"correct",
"(",
"self",
",",
"img",
")",
":",
"print",
"(",
"\"CORRECT PERSPECTIVE ...\"",
")",
"self",
".",
"img",
"=",
"imread",
"(",
"img",
")",
"if",
"not",
"self",
".",
"_homography_is_fixed",
":",
"self",
".",
"_homography",
"=",
"None",
"h"... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveCorrection.camera_position | returns camera position in world coordinates using self.rvec and self.tvec
from http://stackoverflow.com/questions/14515200/python-opencv-solvepnp-yields-wrong-translation-vector | imgProcessor/camera/PerspectiveCorrection.py | def camera_position(self, pose=None):
'''
returns camera position in world coordinates using self.rvec and self.tvec
from http://stackoverflow.com/questions/14515200/python-opencv-solvepnp-yields-wrong-translation-vector
'''
if pose is None:
pose = self.pose()
... | def camera_position(self, pose=None):
'''
returns camera position in world coordinates using self.rvec and self.tvec
from http://stackoverflow.com/questions/14515200/python-opencv-solvepnp-yields-wrong-translation-vector
'''
if pose is None:
pose = self.pose()
... | [
"returns",
"camera",
"position",
"in",
"world",
"coordinates",
"using",
"self",
".",
"rvec",
"and",
"self",
".",
"tvec",
"from",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"14515200",
"/",
"python",
"-",
"opencv",
"-",
"solvepnp... | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L417-L425 | [
"def",
"camera_position",
"(",
"self",
",",
"pose",
"=",
"None",
")",
":",
"if",
"pose",
"is",
"None",
":",
"pose",
"=",
"self",
".",
"pose",
"(",
")",
"t",
",",
"r",
"=",
"pose",
"return",
"-",
"np",
".",
"matrix",
"(",
"cv2",
".",
"Rodrigues",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveCorrection.viewAngle | calculate view factor between one small and one finite surface
vf =1/pi * integral(cos(beta1)*cos(beta2)/s**2) * dA
according to VDI heatatlas 2010 p961 | imgProcessor/camera/PerspectiveCorrection.py | def viewAngle(self, **kwargs):
'''
calculate view factor between one small and one finite surface
vf =1/pi * integral(cos(beta1)*cos(beta2)/s**2) * dA
according to VDI heatatlas 2010 p961
'''
v0 = self.cam2PlaneVectorField(**kwargs)
# obj cannot be behind c... | def viewAngle(self, **kwargs):
'''
calculate view factor between one small and one finite surface
vf =1/pi * integral(cos(beta1)*cos(beta2)/s**2) * dA
according to VDI heatatlas 2010 p961
'''
v0 = self.cam2PlaneVectorField(**kwargs)
# obj cannot be behind c... | [
"calculate",
"view",
"factor",
"between",
"one",
"small",
"and",
"one",
"finite",
"surface",
"vf",
"=",
"1",
"/",
"pi",
"*",
"integral",
"(",
"cos",
"(",
"beta1",
")",
"*",
"cos",
"(",
"beta2",
")",
"/",
"s",
"**",
"2",
")",
"*",
"dA",
"according",... | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L488-L504 | [
"def",
"viewAngle",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"v0",
"=",
"self",
".",
"cam2PlaneVectorField",
"(",
"*",
"*",
"kwargs",
")",
"# obj cannot be behind camera\r",
"v0",
"[",
"2",
"]",
"[",
"v0",
"[",
"2",
"]",
"<",
"0",
"]",
"=",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveCorrection.foreground | return foreground (quad) mask | imgProcessor/camera/PerspectiveCorrection.py | def foreground(self, quad=None):
'''return foreground (quad) mask'''
fg = np.zeros(shape=self._newBorders[::-1], dtype=np.uint8)
if quad is None:
quad = self.quad
else:
quad = quad.astype(np.int32)
cv2.fillConvexPoly(fg, quad, 1)
return fg.... | def foreground(self, quad=None):
'''return foreground (quad) mask'''
fg = np.zeros(shape=self._newBorders[::-1], dtype=np.uint8)
if quad is None:
quad = self.quad
else:
quad = quad.astype(np.int32)
cv2.fillConvexPoly(fg, quad, 1)
return fg.... | [
"return",
"foreground",
"(",
"quad",
")",
"mask"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L506-L514 | [
"def",
"foreground",
"(",
"self",
",",
"quad",
"=",
"None",
")",
":",
"fg",
"=",
"np",
".",
"zeros",
"(",
"shape",
"=",
"self",
".",
"_newBorders",
"[",
":",
":",
"-",
"1",
"]",
",",
"dtype",
"=",
"np",
".",
"uint8",
")",
"if",
"quad",
"is",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveCorrection.tiltFactor | get tilt factor from inverse distance law
https://en.wikipedia.org/wiki/Inverse-square_law | imgProcessor/camera/PerspectiveCorrection.py | def tiltFactor(self, midpointdepth=None,
printAvAngle=False):
'''
get tilt factor from inverse distance law
https://en.wikipedia.org/wiki/Inverse-square_law
'''
# TODO: can also be only def. with FOV, rot, tilt
beta2 = self.viewAngle(midpointdept... | def tiltFactor(self, midpointdepth=None,
printAvAngle=False):
'''
get tilt factor from inverse distance law
https://en.wikipedia.org/wiki/Inverse-square_law
'''
# TODO: can also be only def. with FOV, rot, tilt
beta2 = self.viewAngle(midpointdept... | [
"get",
"tilt",
"factor",
"from",
"inverse",
"distance",
"law",
"https",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Inverse",
"-",
"square_law"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L516-L539 | [
"def",
"tiltFactor",
"(",
"self",
",",
"midpointdepth",
"=",
"None",
",",
"printAvAngle",
"=",
"False",
")",
":",
"# TODO: can also be only def. with FOV, rot, tilt\r",
"beta2",
"=",
"self",
".",
"viewAngle",
"(",
"midpointdepth",
"=",
"midpointdepth",
")",
"try",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveCorrection.standardUncertainties | focusAtXY - image position with is in focus
if not set it is assumed that the image middle is in focus
sigma_best_focus - standard deviation of the PSF
within the best focus (default blur)
uncertainties - contibutors for standard uncertainty
... | imgProcessor/camera/PerspectiveCorrection.py | def standardUncertainties(self, focal_Length_mm, f_number, midpointdepth=1000,
focusAtYX=None,
# sigma_best_focus=0,
# quad_pos_err=0,
shape=None,
uncertainties=(0, ... | def standardUncertainties(self, focal_Length_mm, f_number, midpointdepth=1000,
focusAtYX=None,
# sigma_best_focus=0,
# quad_pos_err=0,
shape=None,
uncertainties=(0, ... | [
"focusAtXY",
"-",
"image",
"position",
"with",
"is",
"in",
"focus",
"if",
"not",
"set",
"it",
"is",
"assumed",
"that",
"the",
"image",
"middle",
"is",
"in",
"focus",
"sigma_best_focus",
"-",
"standard",
"deviation",
"of",
"the",
"PSF",
"within",
"the",
"be... | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L555-L637 | [
"def",
"standardUncertainties",
"(",
"self",
",",
"focal_Length_mm",
",",
"f_number",
",",
"midpointdepth",
"=",
"1000",
",",
"focusAtYX",
"=",
"None",
",",
"# sigma_best_focus=0,\r",
"# quad_pos_err=0,\r",
"shape",
"=",
"None",
",",
"uncertainties",
"=",
"(",
"0"... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveCorrection._poseFromQuad | estimate the pose of the object plane using quad
setting:
self.rvec -> rotation vector
self.tvec -> translation vector | imgProcessor/camera/PerspectiveCorrection.py | def _poseFromQuad(self, quad=None):
'''
estimate the pose of the object plane using quad
setting:
self.rvec -> rotation vector
self.tvec -> translation vector
'''
if quad is None:
quad = self.quad
if quad.ndim == 3:
qu... | def _poseFromQuad(self, quad=None):
'''
estimate the pose of the object plane using quad
setting:
self.rvec -> rotation vector
self.tvec -> translation vector
'''
if quad is None:
quad = self.quad
if quad.ndim == 3:
qu... | [
"estimate",
"the",
"pose",
"of",
"the",
"object",
"plane",
"using",
"quad",
"setting",
":",
"self",
".",
"rvec",
"-",
">",
"rotation",
"vector",
"self",
".",
"tvec",
"-",
">",
"translation",
"vector"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L692-L718 | [
"def",
"_poseFromQuad",
"(",
"self",
",",
"quad",
"=",
"None",
")",
":",
"if",
"quad",
"is",
"None",
":",
"quad",
"=",
"self",
".",
"quad",
"if",
"quad",
".",
"ndim",
"==",
"3",
":",
"quad",
"=",
"quad",
"[",
"0",
"]",
"# http://answers.opencv.org/qu... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveCorrection.drawQuad | Draw the quad into given img | imgProcessor/camera/PerspectiveCorrection.py | def drawQuad(self, img=None, quad=None, thickness=30):
'''
Draw the quad into given img
'''
if img is None:
img = self.img
if quad is None:
quad = self.quad
q = np.int32(quad)
c = int(img.max())
cv2.line(img, tuple(q[0]),... | def drawQuad(self, img=None, quad=None, thickness=30):
'''
Draw the quad into given img
'''
if img is None:
img = self.img
if quad is None:
quad = self.quad
q = np.int32(quad)
c = int(img.max())
cv2.line(img, tuple(q[0]),... | [
"Draw",
"the",
"quad",
"into",
"given",
"img"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L761-L775 | [
"def",
"drawQuad",
"(",
"self",
",",
"img",
"=",
"None",
",",
"quad",
"=",
"None",
",",
"thickness",
"=",
"30",
")",
":",
"if",
"img",
"is",
"None",
":",
"img",
"=",
"self",
".",
"img",
"if",
"quad",
"is",
"None",
":",
"quad",
"=",
"self",
".",... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveCorrection.draw3dCoordAxis | draw the 3d coordinate axes into given image
if image == False:
create an empty image | imgProcessor/camera/PerspectiveCorrection.py | def draw3dCoordAxis(self, img=None, thickness=8):
'''
draw the 3d coordinate axes into given image
if image == False:
create an empty image
'''
if img is None:
img = self.img
elif img is False:
img = np.zeros(shape=self.img.sha... | def draw3dCoordAxis(self, img=None, thickness=8):
'''
draw the 3d coordinate axes into given image
if image == False:
create an empty image
'''
if img is None:
img = self.img
elif img is False:
img = np.zeros(shape=self.img.sha... | [
"draw",
"the",
"3d",
"coordinate",
"axes",
"into",
"given",
"image",
"if",
"image",
"==",
"False",
":",
"create",
"an",
"empty",
"image"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L777-L807 | [
"def",
"draw3dCoordAxis",
"(",
"self",
",",
"img",
"=",
"None",
",",
"thickness",
"=",
"8",
")",
":",
"if",
"img",
"is",
"None",
":",
"img",
"=",
"self",
".",
"img",
"elif",
"img",
"is",
"False",
":",
"img",
"=",
"np",
".",
"zeros",
"(",
"shape",... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | PerspectiveCorrection._calcQuadSize | return the size of a rectangle in perspective distortion in [px]
DEBUG: PUT THAT BACK IN??::
if aspectRatio is not given is will be determined | imgProcessor/camera/PerspectiveCorrection.py | def _calcQuadSize(corners, aspectRatio):
'''
return the size of a rectangle in perspective distortion in [px]
DEBUG: PUT THAT BACK IN??::
if aspectRatio is not given is will be determined
'''
if aspectRatio > 1: # x is bigger -> reduce y
x_length =... | def _calcQuadSize(corners, aspectRatio):
'''
return the size of a rectangle in perspective distortion in [px]
DEBUG: PUT THAT BACK IN??::
if aspectRatio is not given is will be determined
'''
if aspectRatio > 1: # x is bigger -> reduce y
x_length =... | [
"return",
"the",
"size",
"of",
"a",
"rectangle",
"in",
"perspective",
"distortion",
"in",
"[",
"px",
"]",
"DEBUG",
":",
"PUT",
"THAT",
"BACK",
"IN??",
"::",
"if",
"aspectRatio",
"is",
"not",
"given",
"is",
"will",
"be",
"determined"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L810-L823 | [
"def",
"_calcQuadSize",
"(",
"corners",
",",
"aspectRatio",
")",
":",
"if",
"aspectRatio",
">",
"1",
":",
"# x is bigger -> reduce y\r",
"x_length",
"=",
"PerspectiveCorrection",
".",
"_quadXLength",
"(",
"corners",
")",
"y",
"=",
"x_length",
"/",
"aspectRatio",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | linearToPolar | map a 2d (x,y) Cartesian array to a polar (r, phi) array
using opencv.remap | imgProcessor/transform/polarTransform.py | def linearToPolar(img, center=None,
final_radius=None,
initial_radius=None,
phase_width=None,
interpolation=cv2.INTER_AREA, maps=None,
borderValue=0, borderMode=cv2.BORDER_REFLECT, **opts):
'''
map a 2d (x,y) Cartes... | def linearToPolar(img, center=None,
final_radius=None,
initial_radius=None,
phase_width=None,
interpolation=cv2.INTER_AREA, maps=None,
borderValue=0, borderMode=cv2.BORDER_REFLECT, **opts):
'''
map a 2d (x,y) Cartes... | [
"map",
"a",
"2d",
"(",
"x",
"y",
")",
"Cartesian",
"array",
"to",
"a",
"polar",
"(",
"r",
"phi",
")",
"array",
"using",
"opencv",
".",
"remap"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/transform/polarTransform.py#L45-L66 | [
"def",
"linearToPolar",
"(",
"img",
",",
"center",
"=",
"None",
",",
"final_radius",
"=",
"None",
",",
"initial_radius",
"=",
"None",
",",
"phase_width",
"=",
"None",
",",
"interpolation",
"=",
"cv2",
".",
"INTER_AREA",
",",
"maps",
"=",
"None",
",",
"bo... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | polarToLinear | map a 2d polar (r, phi) polar array to a Cartesian (x,y) array
using opencv.remap | imgProcessor/transform/polarTransform.py | def polarToLinear(img, shape=None, center=None, maps=None,
interpolation=cv2.INTER_AREA,
borderValue=0, borderMode=cv2.BORDER_REFLECT, **opts):
'''
map a 2d polar (r, phi) polar array to a Cartesian (x,y) array
using opencv.remap
'''
if maps is None:
... | def polarToLinear(img, shape=None, center=None, maps=None,
interpolation=cv2.INTER_AREA,
borderValue=0, borderMode=cv2.BORDER_REFLECT, **opts):
'''
map a 2d polar (r, phi) polar array to a Cartesian (x,y) array
using opencv.remap
'''
if maps is None:
... | [
"map",
"a",
"2d",
"polar",
"(",
"r",
"phi",
")",
"polar",
"array",
"to",
"a",
"Cartesian",
"(",
"x",
"y",
")",
"array",
"using",
"opencv",
".",
"remap"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/transform/polarTransform.py#L87-L105 | [
"def",
"polarToLinear",
"(",
"img",
",",
"shape",
"=",
"None",
",",
"center",
"=",
"None",
",",
"maps",
"=",
"None",
",",
"interpolation",
"=",
"cv2",
".",
"INTER_AREA",
",",
"borderValue",
"=",
"0",
",",
"borderMode",
"=",
"cv2",
".",
"BORDER_REFLECT",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | modifiedLaplacian | LAPM' algorithm (Nayar89) | imgProcessor/measure/sharpness/parameters.py | def modifiedLaplacian(img):
''''LAPM' algorithm (Nayar89)'''
M = np.array([-1, 2, -1])
G = cv2.getGaussianKernel(ksize=3, sigma=-1)
Lx = cv2.sepFilter2D(src=img, ddepth=cv2.CV_64F, kernelX=M, kernelY=G)
Ly = cv2.sepFilter2D(src=img, ddepth=cv2.CV_64F, kernelX=G, kernelY=M)
FM = np.abs(Lx) ... | def modifiedLaplacian(img):
''''LAPM' algorithm (Nayar89)'''
M = np.array([-1, 2, -1])
G = cv2.getGaussianKernel(ksize=3, sigma=-1)
Lx = cv2.sepFilter2D(src=img, ddepth=cv2.CV_64F, kernelX=M, kernelY=G)
Ly = cv2.sepFilter2D(src=img, ddepth=cv2.CV_64F, kernelX=G, kernelY=M)
FM = np.abs(Lx) ... | [
"LAPM",
"algorithm",
"(",
"Nayar89",
")"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/measure/sharpness/parameters.py#L16-L23 | [
"def",
"modifiedLaplacian",
"(",
"img",
")",
":",
"M",
"=",
"np",
".",
"array",
"(",
"[",
"-",
"1",
",",
"2",
",",
"-",
"1",
"]",
")",
"G",
"=",
"cv2",
".",
"getGaussianKernel",
"(",
"ksize",
"=",
"3",
",",
"sigma",
"=",
"-",
"1",
")",
"Lx",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | varianceOfLaplacian | LAPV' algorithm (Pech2000) | imgProcessor/measure/sharpness/parameters.py | def varianceOfLaplacian(img):
''''LAPV' algorithm (Pech2000)'''
lap = cv2.Laplacian(img, ddepth=-1)#cv2.cv.CV_64F)
stdev = cv2.meanStdDev(lap)[1]
s = stdev[0]**2
return s[0] | def varianceOfLaplacian(img):
''''LAPV' algorithm (Pech2000)'''
lap = cv2.Laplacian(img, ddepth=-1)#cv2.cv.CV_64F)
stdev = cv2.meanStdDev(lap)[1]
s = stdev[0]**2
return s[0] | [
"LAPV",
"algorithm",
"(",
"Pech2000",
")"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/measure/sharpness/parameters.py#L26-L31 | [
"def",
"varianceOfLaplacian",
"(",
"img",
")",
":",
"lap",
"=",
"cv2",
".",
"Laplacian",
"(",
"img",
",",
"ddepth",
"=",
"-",
"1",
")",
"#cv2.cv.CV_64F)\r",
"stdev",
"=",
"cv2",
".",
"meanStdDev",
"(",
"lap",
")",
"[",
"1",
"]",
"s",
"=",
"stdev",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | tenengrad | TENG' algorithm (Krotkov86) | imgProcessor/measure/sharpness/parameters.py | def tenengrad(img, ksize=3):
''''TENG' algorithm (Krotkov86)'''
Gx = cv2.Sobel(img, ddepth=cv2.CV_64F, dx=1, dy=0, ksize=ksize)
Gy = cv2.Sobel(img, ddepth=cv2.CV_64F, dx=0, dy=1, ksize=ksize)
FM = Gx*Gx + Gy*Gy
mn = cv2.mean(FM)[0]
if np.isnan(mn):
return np.nanmean(FM)
retur... | def tenengrad(img, ksize=3):
''''TENG' algorithm (Krotkov86)'''
Gx = cv2.Sobel(img, ddepth=cv2.CV_64F, dx=1, dy=0, ksize=ksize)
Gy = cv2.Sobel(img, ddepth=cv2.CV_64F, dx=0, dy=1, ksize=ksize)
FM = Gx*Gx + Gy*Gy
mn = cv2.mean(FM)[0]
if np.isnan(mn):
return np.nanmean(FM)
retur... | [
"TENG",
"algorithm",
"(",
"Krotkov86",
")"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/measure/sharpness/parameters.py#L34-L42 | [
"def",
"tenengrad",
"(",
"img",
",",
"ksize",
"=",
"3",
")",
":",
"Gx",
"=",
"cv2",
".",
"Sobel",
"(",
"img",
",",
"ddepth",
"=",
"cv2",
".",
"CV_64F",
",",
"dx",
"=",
"1",
",",
"dy",
"=",
"0",
",",
"ksize",
"=",
"ksize",
")",
"Gy",
"=",
"c... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | normalizedGraylevelVariance | GLVN' algorithm (Santos97) | imgProcessor/measure/sharpness/parameters.py | def normalizedGraylevelVariance(img):
''''GLVN' algorithm (Santos97)'''
mean, stdev = cv2.meanStdDev(img)
s = stdev[0]**2 / mean[0]
return s[0] | def normalizedGraylevelVariance(img):
''''GLVN' algorithm (Santos97)'''
mean, stdev = cv2.meanStdDev(img)
s = stdev[0]**2 / mean[0]
return s[0] | [
"GLVN",
"algorithm",
"(",
"Santos97",
")"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/measure/sharpness/parameters.py#L45-L49 | [
"def",
"normalizedGraylevelVariance",
"(",
"img",
")",
":",
"mean",
",",
"stdev",
"=",
"cv2",
".",
"meanStdDev",
"(",
"img",
")",
"s",
"=",
"stdev",
"[",
"0",
"]",
"**",
"2",
"/",
"mean",
"[",
"0",
"]",
"return",
"s",
"[",
"0",
"]"
] | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | linePlot | returns [img] intensity values along line
defined by [x0, y0, x1, y1]
resolution ... number or data points to evaluate
order ... interpolation precision | imgProcessor/measure/linePlot.py | def linePlot(img, x0, y0, x1, y1, resolution=None, order=3):
'''
returns [img] intensity values along line
defined by [x0, y0, x1, y1]
resolution ... number or data points to evaluate
order ... interpolation precision
'''
if resolution is None:
resolution = int( ((x1-x0... | def linePlot(img, x0, y0, x1, y1, resolution=None, order=3):
'''
returns [img] intensity values along line
defined by [x0, y0, x1, y1]
resolution ... number or data points to evaluate
order ... interpolation precision
'''
if resolution is None:
resolution = int( ((x1-x0... | [
"returns",
"[",
"img",
"]",
"intensity",
"values",
"along",
"line",
"defined",
"by",
"[",
"x0",
"y0",
"x1",
"y1",
"]",
"resolution",
"...",
"number",
"or",
"data",
"points",
"to",
"evaluate",
"order",
"...",
"interpolation",
"precision"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/measure/linePlot.py#L10-L28 | [
"def",
"linePlot",
"(",
"img",
",",
"x0",
",",
"y0",
",",
"x1",
",",
"y1",
",",
"resolution",
"=",
"None",
",",
"order",
"=",
"3",
")",
":",
"if",
"resolution",
"is",
"None",
":",
"resolution",
"=",
"int",
"(",
"(",
"(",
"x1",
"-",
"x0",
")",
... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | FlatFieldFromImgFit.flatFieldFromFunction | calculate flatField from fitting vignetting function to averaged fit-image
returns flatField, average background level, fitted image, valid indices mask | DUMP/FlatFieldFromImgFit.py | def flatFieldFromFunction(self):
'''
calculate flatField from fitting vignetting function to averaged fit-image
returns flatField, average background level, fitted image, valid indices mask
'''
fitimg, mask = self._prepare()
mask = ~mask
s0, s1 = fitimg.s... | def flatFieldFromFunction(self):
'''
calculate flatField from fitting vignetting function to averaged fit-image
returns flatField, average background level, fitted image, valid indices mask
'''
fitimg, mask = self._prepare()
mask = ~mask
s0, s1 = fitimg.s... | [
"calculate",
"flatField",
"from",
"fitting",
"vignetting",
"function",
"to",
"averaged",
"fit",
"-",
"image",
"returns",
"flatField",
"average",
"background",
"level",
"fitted",
"image",
"valid",
"indices",
"mask"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/DUMP/FlatFieldFromImgFit.py#L104-L125 | [
"def",
"flatFieldFromFunction",
"(",
"self",
")",
":",
"fitimg",
",",
"mask",
"=",
"self",
".",
"_prepare",
"(",
")",
"mask",
"=",
"~",
"mask",
"s0",
",",
"s1",
"=",
"fitimg",
".",
"shape",
"#f-value, alpha, fx, cx, cy\r",
"guess",
"=",
"(",
"s1",
"*... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | FlatFieldFromImgFit.flatFieldFromFit | calculate flatField from 2d-polynomal fit filling
all high gradient areas within averaged fit-image
returns flatField, average background level, fitted image, valid indices mask | DUMP/FlatFieldFromImgFit.py | def flatFieldFromFit(self):
'''
calculate flatField from 2d-polynomal fit filling
all high gradient areas within averaged fit-image
returns flatField, average background level, fitted image, valid indices mask
'''
fitimg, mask = self._prepare()
out = fi... | def flatFieldFromFit(self):
'''
calculate flatField from 2d-polynomal fit filling
all high gradient areas within averaged fit-image
returns flatField, average background level, fitted image, valid indices mask
'''
fitimg, mask = self._prepare()
out = fi... | [
"calculate",
"flatField",
"from",
"2d",
"-",
"polynomal",
"fit",
"filling",
"all",
"high",
"gradient",
"areas",
"within",
"averaged",
"fit",
"-",
"image",
"returns",
"flatField",
"average",
"background",
"level",
"fitted",
"image",
"valid",
"indices",
"mask"
] | radjkarl/imgProcessor | python | https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/DUMP/FlatFieldFromImgFit.py#L133-L156 | [
"def",
"flatFieldFromFit",
"(",
"self",
")",
":",
"fitimg",
",",
"mask",
"=",
"self",
".",
"_prepare",
"(",
")",
"out",
"=",
"fitimg",
".",
"copy",
"(",
")",
"lastm",
"=",
"0",
"for",
"_",
"in",
"range",
"(",
"10",
")",
":",
"out",
"=",
"polyfit2... | 7c5a28718f81c01a430152c60a686ac50afbfd7c |
train | parse_vhdl_file | Parse a named VHDL file
Args:
fname(str): Name of file to parse
Returns:
Parsed objects. | hdlparse/vhdl_parser.py | def parse_vhdl_file(fname):
'''Parse a named VHDL file
Args:
fname(str): Name of file to parse
Returns:
Parsed objects.
'''
with open(fname, 'rt') as fh:
text = fh.read()
return parse_vhdl(text) | def parse_vhdl_file(fname):
'''Parse a named VHDL file
Args:
fname(str): Name of file to parse
Returns:
Parsed objects.
'''
with open(fname, 'rt') as fh:
text = fh.read()
return parse_vhdl(text) | [
"Parse",
"a",
"named",
"VHDL",
"file",
"Args",
":",
"fname",
"(",
"str",
")",
":",
"Name",
"of",
"file",
"to",
"parse",
"Returns",
":",
"Parsed",
"objects",
"."
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/vhdl_parser.py#L322-L332 | [
"def",
"parse_vhdl_file",
"(",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
",",
"'rt'",
")",
"as",
"fh",
":",
"text",
"=",
"fh",
".",
"read",
"(",
")",
"return",
"parse_vhdl",
"(",
"text",
")"
] | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | parse_vhdl | Parse a text buffer of VHDL code
Args:
text(str): Source code to parse
Returns:
Parsed objects. | hdlparse/vhdl_parser.py | def parse_vhdl(text):
'''Parse a text buffer of VHDL code
Args:
text(str): Source code to parse
Returns:
Parsed objects.
'''
lex = VhdlLexer
name = None
kind = None
saved_type = None
end_param_group = False
cur_package = None
metacomments = []
parameters = []
param_items = []
g... | def parse_vhdl(text):
'''Parse a text buffer of VHDL code
Args:
text(str): Source code to parse
Returns:
Parsed objects.
'''
lex = VhdlLexer
name = None
kind = None
saved_type = None
end_param_group = False
cur_package = None
metacomments = []
parameters = []
param_items = []
g... | [
"Parse",
"a",
"text",
"buffer",
"of",
"VHDL",
"code"
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/vhdl_parser.py#L334-L508 | [
"def",
"parse_vhdl",
"(",
"text",
")",
":",
"lex",
"=",
"VhdlLexer",
"name",
"=",
"None",
"kind",
"=",
"None",
"saved_type",
"=",
"None",
"end_param_group",
"=",
"False",
"cur_package",
"=",
"None",
"metacomments",
"=",
"[",
"]",
"parameters",
"=",
"[",
... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | subprogram_prototype | Generate a canonical prototype string
Args:
vo (VhdlFunction, VhdlProcedure): Subprogram object
Returns:
Prototype string. | hdlparse/vhdl_parser.py | def subprogram_prototype(vo):
'''Generate a canonical prototype string
Args:
vo (VhdlFunction, VhdlProcedure): Subprogram object
Returns:
Prototype string.
'''
plist = '; '.join(str(p) for p in vo.parameters)
if isinstance(vo, VhdlFunction):
if len(vo.parameters) > 0:
proto = 'functio... | def subprogram_prototype(vo):
'''Generate a canonical prototype string
Args:
vo (VhdlFunction, VhdlProcedure): Subprogram object
Returns:
Prototype string.
'''
plist = '; '.join(str(p) for p in vo.parameters)
if isinstance(vo, VhdlFunction):
if len(vo.parameters) > 0:
proto = 'functio... | [
"Generate",
"a",
"canonical",
"prototype",
"string",
"Args",
":",
"vo",
"(",
"VhdlFunction",
"VhdlProcedure",
")",
":",
"Subprogram",
"object",
"Returns",
":",
"Prototype",
"string",
"."
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/vhdl_parser.py#L511-L531 | [
"def",
"subprogram_prototype",
"(",
"vo",
")",
":",
"plist",
"=",
"'; '",
".",
"join",
"(",
"str",
"(",
"p",
")",
"for",
"p",
"in",
"vo",
".",
"parameters",
")",
"if",
"isinstance",
"(",
"vo",
",",
"VhdlFunction",
")",
":",
"if",
"len",
"(",
"vo",
... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | subprogram_signature | Generate a signature string
Args:
vo (VhdlFunction, VhdlProcedure): Subprogram object
Returns:
Signature string. | hdlparse/vhdl_parser.py | def subprogram_signature(vo, fullname=None):
'''Generate a signature string
Args:
vo (VhdlFunction, VhdlProcedure): Subprogram object
Returns:
Signature string.
'''
if fullname is None:
fullname = vo.name
if isinstance(vo, VhdlFunction):
plist = ','.join(p.data_type for p in vo.paramete... | def subprogram_signature(vo, fullname=None):
'''Generate a signature string
Args:
vo (VhdlFunction, VhdlProcedure): Subprogram object
Returns:
Signature string.
'''
if fullname is None:
fullname = vo.name
if isinstance(vo, VhdlFunction):
plist = ','.join(p.data_type for p in vo.paramete... | [
"Generate",
"a",
"signature",
"string",
"Args",
":",
"vo",
"(",
"VhdlFunction",
"VhdlProcedure",
")",
":",
"Subprogram",
"object",
"Returns",
":",
"Signature",
"string",
"."
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/vhdl_parser.py#L533-L552 | [
"def",
"subprogram_signature",
"(",
"vo",
",",
"fullname",
"=",
"None",
")",
":",
"if",
"fullname",
"is",
"None",
":",
"fullname",
"=",
"vo",
".",
"name",
"if",
"isinstance",
"(",
"vo",
",",
"VhdlFunction",
")",
":",
"plist",
"=",
"','",
".",
"join",
... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | VhdlExtractor.extract_objects_from_source | Extract object declarations from a text buffer
Args:
text (str): Source code to parse
type_filter (class, optional): Object class to filter results
Returns:
List of parsed objects. | hdlparse/vhdl_parser.py | def extract_objects_from_source(self, text, type_filter=None):
'''Extract object declarations from a text buffer
Args:
text (str): Source code to parse
type_filter (class, optional): Object class to filter results
Returns:
List of parsed objects.
'''
objects = parse_vhdl(text)
... | def extract_objects_from_source(self, text, type_filter=None):
'''Extract object declarations from a text buffer
Args:
text (str): Source code to parse
type_filter (class, optional): Object class to filter results
Returns:
List of parsed objects.
'''
objects = parse_vhdl(text)
... | [
"Extract",
"object",
"declarations",
"from",
"a",
"text",
"buffer"
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/vhdl_parser.py#L603-L618 | [
"def",
"extract_objects_from_source",
"(",
"self",
",",
"text",
",",
"type_filter",
"=",
"None",
")",
":",
"objects",
"=",
"parse_vhdl",
"(",
"text",
")",
"self",
".",
"_register_array_types",
"(",
"objects",
")",
"if",
"type_filter",
":",
"objects",
"=",
"[... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | VhdlExtractor.is_array | Check if a type is a known array type
Args:
data_type (str): Name of type to check
Returns:
True if ``data_type`` is a known array type. | hdlparse/vhdl_parser.py | def is_array(self, data_type):
'''Check if a type is a known array type
Args:
data_type (str): Name of type to check
Returns:
True if ``data_type`` is a known array type.
'''
# Split off any brackets
data_type = data_type.split('[')[0].strip()
return data_type.lower() in s... | def is_array(self, data_type):
'''Check if a type is a known array type
Args:
data_type (str): Name of type to check
Returns:
True if ``data_type`` is a known array type.
'''
# Split off any brackets
data_type = data_type.split('[')[0].strip()
return data_type.lower() in s... | [
"Check",
"if",
"a",
"type",
"is",
"a",
"known",
"array",
"type",
"Args",
":",
"data_type",
"(",
"str",
")",
":",
"Name",
"of",
"type",
"to",
"check",
"Returns",
":",
"True",
"if",
"data_type",
"is",
"a",
"known",
"array",
"type",
"."
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/vhdl_parser.py#L621-L633 | [
"def",
"is_array",
"(",
"self",
",",
"data_type",
")",
":",
"# Split off any brackets",
"data_type",
"=",
"data_type",
".",
"split",
"(",
"'['",
")",
"[",
"0",
"]",
".",
"strip",
"(",
")",
"return",
"data_type",
".",
"lower",
"(",
")",
"in",
"self",
".... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | VhdlExtractor.load_array_types | Load file of previously extracted data types
Args:
fname (str): Name of file to load array database from | hdlparse/vhdl_parser.py | def load_array_types(self, fname):
'''Load file of previously extracted data types
Args:
fname (str): Name of file to load array database from
'''
type_defs = ''
with open(fname, 'rt') as fh:
type_defs = fh.read()
try:
type_defs = ast.literal_eval(type_defs)
except Sy... | def load_array_types(self, fname):
'''Load file of previously extracted data types
Args:
fname (str): Name of file to load array database from
'''
type_defs = ''
with open(fname, 'rt') as fh:
type_defs = fh.read()
try:
type_defs = ast.literal_eval(type_defs)
except Sy... | [
"Load",
"file",
"of",
"previously",
"extracted",
"data",
"types",
"Args",
":",
"fname",
"(",
"str",
")",
":",
"Name",
"of",
"file",
"to",
"load",
"array",
"database",
"from"
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/vhdl_parser.py#L645-L660 | [
"def",
"load_array_types",
"(",
"self",
",",
"fname",
")",
":",
"type_defs",
"=",
"''",
"with",
"open",
"(",
"fname",
",",
"'rt'",
")",
"as",
"fh",
":",
"type_defs",
"=",
"fh",
".",
"read",
"(",
")",
"try",
":",
"type_defs",
"=",
"ast",
".",
"liter... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | VhdlExtractor.save_array_types | Save array type registry to a file
Args:
fname (str): Name of file to save array database to | hdlparse/vhdl_parser.py | def save_array_types(self, fname):
'''Save array type registry to a file
Args:
fname (str): Name of file to save array database to
'''
type_defs = {'arrays': sorted(list(self.array_types))}
with open(fname, 'wt') as fh:
pprint(type_defs, stream=fh) | def save_array_types(self, fname):
'''Save array type registry to a file
Args:
fname (str): Name of file to save array database to
'''
type_defs = {'arrays': sorted(list(self.array_types))}
with open(fname, 'wt') as fh:
pprint(type_defs, stream=fh) | [
"Save",
"array",
"type",
"registry",
"to",
"a",
"file",
"Args",
":",
"fname",
"(",
"str",
")",
":",
"Name",
"of",
"file",
"to",
"save",
"array",
"database",
"to"
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/vhdl_parser.py#L662-L670 | [
"def",
"save_array_types",
"(",
"self",
",",
"fname",
")",
":",
"type_defs",
"=",
"{",
"'arrays'",
":",
"sorted",
"(",
"list",
"(",
"self",
".",
"array_types",
")",
")",
"}",
"with",
"open",
"(",
"fname",
",",
"'wt'",
")",
"as",
"fh",
":",
"pprint",
... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | VhdlExtractor._register_array_types | Add array type definitions to internal registry
Args:
objects (list of VhdlType or VhdlSubtype): Array types to track | hdlparse/vhdl_parser.py | def _register_array_types(self, objects):
'''Add array type definitions to internal registry
Args:
objects (list of VhdlType or VhdlSubtype): Array types to track
'''
# Add all array types directly
types = [o for o in objects if isinstance(o, VhdlType) and o.type_of == 'array_type']
f... | def _register_array_types(self, objects):
'''Add array type definitions to internal registry
Args:
objects (list of VhdlType or VhdlSubtype): Array types to track
'''
# Add all array types directly
types = [o for o in objects if isinstance(o, VhdlType) and o.type_of == 'array_type']
f... | [
"Add",
"array",
"type",
"definitions",
"to",
"internal",
"registry",
"Args",
":",
"objects",
"(",
"list",
"of",
"VhdlType",
"or",
"VhdlSubtype",
")",
":",
"Array",
"types",
"to",
"track"
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/vhdl_parser.py#L672-L690 | [
"def",
"_register_array_types",
"(",
"self",
",",
"objects",
")",
":",
"# Add all array types directly",
"types",
"=",
"[",
"o",
"for",
"o",
"in",
"objects",
"if",
"isinstance",
"(",
"o",
",",
"VhdlType",
")",
"and",
"o",
".",
"type_of",
"==",
"'array_type'"... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | VhdlExtractor.register_array_types_from_sources | Add array type definitions from a file list to internal registry
Args:
source_files (list of str): Files to parse for array definitions | hdlparse/vhdl_parser.py | def register_array_types_from_sources(self, source_files):
'''Add array type definitions from a file list to internal registry
Args:
source_files (list of str): Files to parse for array definitions
'''
for fname in source_files:
if is_vhdl(fname):
self._register_array_types(self.ext... | def register_array_types_from_sources(self, source_files):
'''Add array type definitions from a file list to internal registry
Args:
source_files (list of str): Files to parse for array definitions
'''
for fname in source_files:
if is_vhdl(fname):
self._register_array_types(self.ext... | [
"Add",
"array",
"type",
"definitions",
"from",
"a",
"file",
"list",
"to",
"internal",
"registry"
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/vhdl_parser.py#L692-L700 | [
"def",
"register_array_types_from_sources",
"(",
"self",
",",
"source_files",
")",
":",
"for",
"fname",
"in",
"source_files",
":",
"if",
"is_vhdl",
"(",
"fname",
")",
":",
"self",
".",
"_register_array_types",
"(",
"self",
".",
"extract_objects",
"(",
"fname",
... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | MiniLexer.run | Run lexer rules against a source text
Args:
text (str): Text to apply lexer to
Yields:
A sequence of lexer matches. | hdlparse/minilexer.py | def run(self, text):
'''Run lexer rules against a source text
Args:
text (str): Text to apply lexer to
Yields:
A sequence of lexer matches.
'''
stack = ['root']
pos = 0
patterns = self.tokens[stack[-1]]
while True:
for pat, action, new_state in patterns:
m ... | def run(self, text):
'''Run lexer rules against a source text
Args:
text (str): Text to apply lexer to
Yields:
A sequence of lexer matches.
'''
stack = ['root']
pos = 0
patterns = self.tokens[stack[-1]]
while True:
for pat, action, new_state in patterns:
m ... | [
"Run",
"lexer",
"rules",
"against",
"a",
"source",
"text"
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/minilexer.py#L43-L86 | [
"def",
"run",
"(",
"self",
",",
"text",
")",
":",
"stack",
"=",
"[",
"'root'",
"]",
"pos",
"=",
"0",
"patterns",
"=",
"self",
".",
"tokens",
"[",
"stack",
"[",
"-",
"1",
"]",
"]",
"while",
"True",
":",
"for",
"pat",
",",
"action",
",",
"new_sta... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | get_package_version | Scan the script for the version string | doc/conf.py | def get_package_version(verfile):
'''Scan the script for the version string'''
version = None
with open(verfile) as fh:
try:
version = [line.split('=')[1].strip().strip("'") for line in fh if \
line.startswith('__version__')][0]
except IndexError:
pass
return versio... | def get_package_version(verfile):
'''Scan the script for the version string'''
version = None
with open(verfile) as fh:
try:
version = [line.split('=')[1].strip().strip("'") for line in fh if \
line.startswith('__version__')][0]
except IndexError:
pass
return versio... | [
"Scan",
"the",
"script",
"for",
"the",
"version",
"string"
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/doc/conf.py#L57-L66 | [
"def",
"get_package_version",
"(",
"verfile",
")",
":",
"version",
"=",
"None",
"with",
"open",
"(",
"verfile",
")",
"as",
"fh",
":",
"try",
":",
"version",
"=",
"[",
"line",
".",
"split",
"(",
"'='",
")",
"[",
"1",
"]",
".",
"strip",
"(",
")",
"... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | parse_verilog_file | Parse a named Verilog file
Args:
fname (str): File to parse.
Returns:
List of parsed objects. | hdlparse/verilog_parser.py | def parse_verilog_file(fname):
'''Parse a named Verilog file
Args:
fname (str): File to parse.
Returns:
List of parsed objects.
'''
with open(fname, 'rt') as fh:
text = fh.read()
return parse_verilog(text) | def parse_verilog_file(fname):
'''Parse a named Verilog file
Args:
fname (str): File to parse.
Returns:
List of parsed objects.
'''
with open(fname, 'rt') as fh:
text = fh.read()
return parse_verilog(text) | [
"Parse",
"a",
"named",
"Verilog",
"file",
"Args",
":",
"fname",
"(",
"str",
")",
":",
"File",
"to",
"parse",
".",
"Returns",
":",
"List",
"of",
"parsed",
"objects",
"."
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/verilog_parser.py#L90-L100 | [
"def",
"parse_verilog_file",
"(",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
",",
"'rt'",
")",
"as",
"fh",
":",
"text",
"=",
"fh",
".",
"read",
"(",
")",
"return",
"parse_verilog",
"(",
"text",
")"
] | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | parse_verilog | Parse a text buffer of Verilog code
Args:
text (str): Source code to parse
Returns:
List of parsed objects. | hdlparse/verilog_parser.py | def parse_verilog(text):
'''Parse a text buffer of Verilog code
Args:
text (str): Source code to parse
Returns:
List of parsed objects.
'''
lex = VerilogLexer
name = None
kind = None
saved_type = None
mode = 'input'
ptype = 'wire'
metacomments = []
parameters = []
param_items = []
... | def parse_verilog(text):
'''Parse a text buffer of Verilog code
Args:
text (str): Source code to parse
Returns:
List of parsed objects.
'''
lex = VerilogLexer
name = None
kind = None
saved_type = None
mode = 'input'
ptype = 'wire'
metacomments = []
parameters = []
param_items = []
... | [
"Parse",
"a",
"text",
"buffer",
"of",
"Verilog",
"code"
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/verilog_parser.py#L102-L206 | [
"def",
"parse_verilog",
"(",
"text",
")",
":",
"lex",
"=",
"VerilogLexer",
"name",
"=",
"None",
"kind",
"=",
"None",
"saved_type",
"=",
"None",
"mode",
"=",
"'input'",
"ptype",
"=",
"'wire'",
"metacomments",
"=",
"[",
"]",
"parameters",
"=",
"[",
"]",
... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | VerilogExtractor.extract_objects | Extract objects from a source file
Args:
fname(str): Name of file to read from
type_filter (class, optional): Object class to filter results
Returns:
List of objects extracted from the file. | hdlparse/verilog_parser.py | def extract_objects(self, fname, type_filter=None):
'''Extract objects from a source file
Args:
fname(str): Name of file to read from
type_filter (class, optional): Object class to filter results
Returns:
List of objects extracted from the file.
'''
objects = []
if fname in se... | def extract_objects(self, fname, type_filter=None):
'''Extract objects from a source file
Args:
fname(str): Name of file to read from
type_filter (class, optional): Object class to filter results
Returns:
List of objects extracted from the file.
'''
objects = []
if fname in se... | [
"Extract",
"objects",
"from",
"a",
"source",
"file"
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/verilog_parser.py#L225-L246 | [
"def",
"extract_objects",
"(",
"self",
",",
"fname",
",",
"type_filter",
"=",
"None",
")",
":",
"objects",
"=",
"[",
"]",
"if",
"fname",
"in",
"self",
".",
"object_cache",
":",
"objects",
"=",
"self",
".",
"object_cache",
"[",
"fname",
"]",
"else",
":"... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | VerilogExtractor.extract_objects_from_source | Extract object declarations from a text buffer
Args:
text (str): Source code to parse
type_filter (class, optional): Object class to filter results
Returns:
List of parsed objects. | hdlparse/verilog_parser.py | def extract_objects_from_source(self, text, type_filter=None):
'''Extract object declarations from a text buffer
Args:
text (str): Source code to parse
type_filter (class, optional): Object class to filter results
Returns:
List of parsed objects.
'''
objects = parse_verilog(text)
... | def extract_objects_from_source(self, text, type_filter=None):
'''Extract object declarations from a text buffer
Args:
text (str): Source code to parse
type_filter (class, optional): Object class to filter results
Returns:
List of parsed objects.
'''
objects = parse_verilog(text)
... | [
"Extract",
"object",
"declarations",
"from",
"a",
"text",
"buffer"
] | kevinpt/hdlparse | python | https://github.com/kevinpt/hdlparse/blob/be7cdab08a8c18815cc4504003ce9ca7fff41022/hdlparse/verilog_parser.py#L249-L263 | [
"def",
"extract_objects_from_source",
"(",
"self",
",",
"text",
",",
"type_filter",
"=",
"None",
")",
":",
"objects",
"=",
"parse_verilog",
"(",
"text",
")",
"if",
"type_filter",
":",
"objects",
"=",
"[",
"o",
"for",
"o",
"in",
"objects",
"if",
"isinstance... | be7cdab08a8c18815cc4504003ce9ca7fff41022 |
train | load_json_from_file | Load schema from a JSON file | faker_schema/schema_loader.py | def load_json_from_file(file_path):
"""Load schema from a JSON file"""
try:
with open(file_path) as f:
json_data = json.load(f)
except ValueError as e:
raise ValueError('Given file {} is not a valid JSON file: {}'.format(file_path, e))
else:
return json_data | def load_json_from_file(file_path):
"""Load schema from a JSON file"""
try:
with open(file_path) as f:
json_data = json.load(f)
except ValueError as e:
raise ValueError('Given file {} is not a valid JSON file: {}'.format(file_path, e))
else:
return json_data | [
"Load",
"schema",
"from",
"a",
"JSON",
"file"
] | ueg1990/faker-schema | python | https://github.com/ueg1990/faker-schema/blob/419175eaf34baa43b306dd05c17362763948ec49/faker_schema/schema_loader.py#L4-L12 | [
"def",
"load_json_from_file",
"(",
"file_path",
")",
":",
"try",
":",
"with",
"open",
"(",
"file_path",
")",
"as",
"f",
":",
"json_data",
"=",
"json",
".",
"load",
"(",
"f",
")",
"except",
"ValueError",
"as",
"e",
":",
"raise",
"ValueError",
"(",
"'Giv... | 419175eaf34baa43b306dd05c17362763948ec49 |
train | load_json_from_string | Load schema from JSON string | faker_schema/schema_loader.py | def load_json_from_string(string):
"""Load schema from JSON string"""
try:
json_data = json.loads(string)
except ValueError as e:
raise ValueError('Given string is not valid JSON: {}'.format(e))
else:
return json_data | def load_json_from_string(string):
"""Load schema from JSON string"""
try:
json_data = json.loads(string)
except ValueError as e:
raise ValueError('Given string is not valid JSON: {}'.format(e))
else:
return json_data | [
"Load",
"schema",
"from",
"JSON",
"string"
] | ueg1990/faker-schema | python | https://github.com/ueg1990/faker-schema/blob/419175eaf34baa43b306dd05c17362763948ec49/faker_schema/schema_loader.py#L15-L22 | [
"def",
"load_json_from_string",
"(",
"string",
")",
":",
"try",
":",
"json_data",
"=",
"json",
".",
"loads",
"(",
"string",
")",
"except",
"ValueError",
"as",
"e",
":",
"raise",
"ValueError",
"(",
"'Given string is not valid JSON: {}'",
".",
"format",
"(",
"e"... | 419175eaf34baa43b306dd05c17362763948ec49 |
train | FakerSchema._generate_one_fake | Recursively traverse schema dictionary and for each "leaf node", evaluate the fake
value
Implementation:
For each key-value pair:
1) If value is not an iterable (i.e. dict or list), evaluate the fake data (base case)
2) If value is a dictionary, recurse
3) If value is a ... | faker_schema/faker_schema.py | def _generate_one_fake(self, schema):
"""
Recursively traverse schema dictionary and for each "leaf node", evaluate the fake
value
Implementation:
For each key-value pair:
1) If value is not an iterable (i.e. dict or list), evaluate the fake data (base case)
2) I... | def _generate_one_fake(self, schema):
"""
Recursively traverse schema dictionary and for each "leaf node", evaluate the fake
value
Implementation:
For each key-value pair:
1) If value is not an iterable (i.e. dict or list), evaluate the fake data (base case)
2) I... | [
"Recursively",
"traverse",
"schema",
"dictionary",
"and",
"for",
"each",
"leaf",
"node",
"evaluate",
"the",
"fake",
"value"
] | ueg1990/faker-schema | python | https://github.com/ueg1990/faker-schema/blob/419175eaf34baa43b306dd05c17362763948ec49/faker_schema/faker_schema.py#L13-L32 | [
"def",
"_generate_one_fake",
"(",
"self",
",",
"schema",
")",
":",
"data",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"schema",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"dict",
")",
":",
"data",
"[",
"k",
"]",
"=",
"self"... | 419175eaf34baa43b306dd05c17362763948ec49 |
train | fetch | Fetch the given uri and return the contents of the response. | challonge/api.py | def fetch(method, uri, params_prefix=None, **params):
"""Fetch the given uri and return the contents of the response."""
params = urlencode(_prepare_params(params, params_prefix))
binary_params = params.encode('ASCII')
# build the HTTP request
url = "https://%s/%s.xml" % (CHALLONGE_API_URL, uri)
... | def fetch(method, uri, params_prefix=None, **params):
"""Fetch the given uri and return the contents of the response."""
params = urlencode(_prepare_params(params, params_prefix))
binary_params = params.encode('ASCII')
# build the HTTP request
url = "https://%s/%s.xml" % (CHALLONGE_API_URL, uri)
... | [
"Fetch",
"the",
"given",
"uri",
"and",
"return",
"the",
"contents",
"of",
"the",
"response",
"."
] | russ-/pychallonge | python | https://github.com/russ-/pychallonge/blob/bc202d7140cb08d11d345564f721c2f57129b84f/challonge/api.py#L41-L74 | [
"def",
"fetch",
"(",
"method",
",",
"uri",
",",
"params_prefix",
"=",
"None",
",",
"*",
"*",
"params",
")",
":",
"params",
"=",
"urlencode",
"(",
"_prepare_params",
"(",
"params",
",",
"params_prefix",
")",
")",
"binary_params",
"=",
"params",
".",
"enco... | bc202d7140cb08d11d345564f721c2f57129b84f |
train | fetch_and_parse | Fetch the given uri and return the root Element of the response. | challonge/api.py | def fetch_and_parse(method, uri, params_prefix=None, **params):
"""Fetch the given uri and return the root Element of the response."""
doc = ElementTree.parse(fetch(method, uri, params_prefix, **params))
return _parse(doc.getroot()) | def fetch_and_parse(method, uri, params_prefix=None, **params):
"""Fetch the given uri and return the root Element of the response."""
doc = ElementTree.parse(fetch(method, uri, params_prefix, **params))
return _parse(doc.getroot()) | [
"Fetch",
"the",
"given",
"uri",
"and",
"return",
"the",
"root",
"Element",
"of",
"the",
"response",
"."
] | russ-/pychallonge | python | https://github.com/russ-/pychallonge/blob/bc202d7140cb08d11d345564f721c2f57129b84f/challonge/api.py#L77-L80 | [
"def",
"fetch_and_parse",
"(",
"method",
",",
"uri",
",",
"params_prefix",
"=",
"None",
",",
"*",
"*",
"params",
")",
":",
"doc",
"=",
"ElementTree",
".",
"parse",
"(",
"fetch",
"(",
"method",
",",
"uri",
",",
"params_prefix",
",",
"*",
"*",
"params",
... | bc202d7140cb08d11d345564f721c2f57129b84f |
train | _parse | Recursively convert an Element into python data types | challonge/api.py | def _parse(root):
"""Recursively convert an Element into python data types"""
if root.tag == "nil-classes":
return []
elif root.get("type") == "array":
return [_parse(child) for child in root]
d = {}
for child in root:
type = child.get("type") or "string"
if child.g... | def _parse(root):
"""Recursively convert an Element into python data types"""
if root.tag == "nil-classes":
return []
elif root.get("type") == "array":
return [_parse(child) for child in root]
d = {}
for child in root:
type = child.get("type") or "string"
if child.g... | [
"Recursively",
"convert",
"an",
"Element",
"into",
"python",
"data",
"types"
] | russ-/pychallonge | python | https://github.com/russ-/pychallonge/blob/bc202d7140cb08d11d345564f721c2f57129b84f/challonge/api.py#L83-L108 | [
"def",
"_parse",
"(",
"root",
")",
":",
"if",
"root",
".",
"tag",
"==",
"\"nil-classes\"",
":",
"return",
"[",
"]",
"elif",
"root",
".",
"get",
"(",
"\"type\"",
")",
"==",
"\"array\"",
":",
"return",
"[",
"_parse",
"(",
"child",
")",
"for",
"child",
... | bc202d7140cb08d11d345564f721c2f57129b84f |
train | _prepare_params | Prepares parameters to be sent to challonge.com.
The `prefix` can be used to convert parameters with keys that
look like ("name", "url", "tournament_type") into something like
("tournament[name]", "tournament[url]", "tournament[tournament_type]"),
which is how challonge.com expects parameters describin... | challonge/api.py | def _prepare_params(dirty_params, prefix=None):
"""Prepares parameters to be sent to challonge.com.
The `prefix` can be used to convert parameters with keys that
look like ("name", "url", "tournament_type") into something like
("tournament[name]", "tournament[url]", "tournament[tournament_type]"),
... | def _prepare_params(dirty_params, prefix=None):
"""Prepares parameters to be sent to challonge.com.
The `prefix` can be used to convert parameters with keys that
look like ("name", "url", "tournament_type") into something like
("tournament[name]", "tournament[url]", "tournament[tournament_type]"),
... | [
"Prepares",
"parameters",
"to",
"be",
"sent",
"to",
"challonge",
".",
"com",
"."
] | russ-/pychallonge | python | https://github.com/russ-/pychallonge/blob/bc202d7140cb08d11d345564f721c2f57129b84f/challonge/api.py#L111-L134 | [
"def",
"_prepare_params",
"(",
"dirty_params",
",",
"prefix",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"dirty_params",
".",
"items",
"(",
")",
":",
"if",
"hasattr",
"(",
"v",
",",
"\"isoformat\"",
")",
":",
"v",
"... | bc202d7140cb08d11d345564f721c2f57129b84f |
train | TreeOfContents.expandDescendants | Expand descendants from list of branches
:param list branches: list of immediate children as TreeOfContents objs
:return: list of all descendants | md2py/md2py.py | def expandDescendants(self, branches):
"""
Expand descendants from list of branches
:param list branches: list of immediate children as TreeOfContents objs
:return: list of all descendants
"""
return sum([b.descendants() for b in branches], []) + \
[b.source ... | def expandDescendants(self, branches):
"""
Expand descendants from list of branches
:param list branches: list of immediate children as TreeOfContents objs
:return: list of all descendants
"""
return sum([b.descendants() for b in branches], []) + \
[b.source ... | [
"Expand",
"descendants",
"from",
"list",
"of",
"branches"
] | alvinwan/md2py | python | https://github.com/alvinwan/md2py/blob/7f28a008367d7d9b5b3c8bbf7baf17985271489f/md2py/md2py.py#L72-L80 | [
"def",
"expandDescendants",
"(",
"self",
",",
"branches",
")",
":",
"return",
"sum",
"(",
"[",
"b",
".",
"descendants",
"(",
")",
"for",
"b",
"in",
"branches",
"]",
",",
"[",
"]",
")",
"+",
"[",
"b",
".",
"source",
"for",
"b",
"in",
"branches",
"... | 7f28a008367d7d9b5b3c8bbf7baf17985271489f |
train | TreeOfContents.parseBranches | Parse top level of markdown
:param list elements: list of source objects
:return: list of filtered TreeOfContents objects | md2py/md2py.py | def parseBranches(self, descendants):
"""
Parse top level of markdown
:param list elements: list of source objects
:return: list of filtered TreeOfContents objects
"""
parsed, parent, cond = [], False, lambda b: (b.string or '').strip()
for branch in filter(cond,... | def parseBranches(self, descendants):
"""
Parse top level of markdown
:param list elements: list of source objects
:return: list of filtered TreeOfContents objects
"""
parsed, parent, cond = [], False, lambda b: (b.string or '').strip()
for branch in filter(cond,... | [
"Parse",
"top",
"level",
"of",
"markdown"
] | alvinwan/md2py | python | https://github.com/alvinwan/md2py/blob/7f28a008367d7d9b5b3c8bbf7baf17985271489f/md2py/md2py.py#L82-L98 | [
"def",
"parseBranches",
"(",
"self",
",",
"descendants",
")",
":",
"parsed",
",",
"parent",
",",
"cond",
"=",
"[",
"]",
",",
"False",
",",
"lambda",
"b",
":",
"(",
"b",
".",
"string",
"or",
"''",
")",
".",
"strip",
"(",
")",
"for",
"branch",
"in"... | 7f28a008367d7d9b5b3c8bbf7baf17985271489f |
train | TreeOfContents.fromMarkdown | Creates abstraction using path to file
:param str path: path to markdown file
:return: TreeOfContents object | md2py/md2py.py | def fromMarkdown(md, *args, **kwargs):
"""
Creates abstraction using path to file
:param str path: path to markdown file
:return: TreeOfContents object
"""
return TOC.fromHTML(markdown(md, *args, **kwargs)) | def fromMarkdown(md, *args, **kwargs):
"""
Creates abstraction using path to file
:param str path: path to markdown file
:return: TreeOfContents object
"""
return TOC.fromHTML(markdown(md, *args, **kwargs)) | [
"Creates",
"abstraction",
"using",
"path",
"to",
"file"
] | alvinwan/md2py | python | https://github.com/alvinwan/md2py/blob/7f28a008367d7d9b5b3c8bbf7baf17985271489f/md2py/md2py.py#L130-L137 | [
"def",
"fromMarkdown",
"(",
"md",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"TOC",
".",
"fromHTML",
"(",
"markdown",
"(",
"md",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | 7f28a008367d7d9b5b3c8bbf7baf17985271489f |
train | TreeOfContents.fromHTML | Creates abstraction using HTML
:param str html: HTML
:return: TreeOfContents object | md2py/md2py.py | def fromHTML(html, *args, **kwargs):
"""
Creates abstraction using HTML
:param str html: HTML
:return: TreeOfContents object
"""
source = BeautifulSoup(html, 'html.parser', *args, **kwargs)
return TOC('[document]',
source=source,
descendan... | def fromHTML(html, *args, **kwargs):
"""
Creates abstraction using HTML
:param str html: HTML
:return: TreeOfContents object
"""
source = BeautifulSoup(html, 'html.parser', *args, **kwargs)
return TOC('[document]',
source=source,
descendan... | [
"Creates",
"abstraction",
"using",
"HTML"
] | alvinwan/md2py | python | https://github.com/alvinwan/md2py/blob/7f28a008367d7d9b5b3c8bbf7baf17985271489f/md2py/md2py.py#L140-L150 | [
"def",
"fromHTML",
"(",
"html",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"source",
"=",
"BeautifulSoup",
"(",
"html",
",",
"'html.parser'",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"TOC",
"(",
"'[document]'",
",",
"source... | 7f28a008367d7d9b5b3c8bbf7baf17985271489f |
train | Attachment.from_data | Create an attachment from data.
:param str type: attachment type
:param kwargs data: additional attachment data
:return: an attachment subclass object
:rtype: `~groupy.api.attachments.Attachment` | groupy/api/attachments.py | def from_data(cls, type, **data):
"""Create an attachment from data.
:param str type: attachment type
:param kwargs data: additional attachment data
:return: an attachment subclass object
:rtype: `~groupy.api.attachments.Attachment`
"""
try:
return cl... | def from_data(cls, type, **data):
"""Create an attachment from data.
:param str type: attachment type
:param kwargs data: additional attachment data
:return: an attachment subclass object
:rtype: `~groupy.api.attachments.Attachment`
"""
try:
return cl... | [
"Create",
"an",
"attachment",
"from",
"data",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/attachments.py#L35-L49 | [
"def",
"from_data",
"(",
"cls",
",",
"type",
",",
"*",
"*",
"data",
")",
":",
"try",
":",
"return",
"cls",
".",
"_types",
"[",
"type",
"]",
"(",
"*",
"*",
"data",
")",
"except",
"KeyError",
":",
"return",
"cls",
"(",
"type",
"=",
"type",
",",
"... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Images.from_file | Create a new image attachment from an image file.
:param file fp: a file object containing binary image data
:return: an image attachment
:rtype: :class:`~groupy.api.attachments.Image` | groupy/api/attachments.py | def from_file(self, fp):
"""Create a new image attachment from an image file.
:param file fp: a file object containing binary image data
:return: an image attachment
:rtype: :class:`~groupy.api.attachments.Image`
"""
image_urls = self.upload(fp)
return Image(imag... | def from_file(self, fp):
"""Create a new image attachment from an image file.
:param file fp: a file object containing binary image data
:return: an image attachment
:rtype: :class:`~groupy.api.attachments.Image`
"""
image_urls = self.upload(fp)
return Image(imag... | [
"Create",
"a",
"new",
"image",
"attachment",
"from",
"an",
"image",
"file",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/attachments.py#L138-L146 | [
"def",
"from_file",
"(",
"self",
",",
"fp",
")",
":",
"image_urls",
"=",
"self",
".",
"upload",
"(",
"fp",
")",
"return",
"Image",
"(",
"image_urls",
"[",
"'url'",
"]",
",",
"source_url",
"=",
"image_urls",
"[",
"'picture_url'",
"]",
")"
] | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Images.upload | Upload image data to the image service.
Call this, rather than :func:`from_file`, you don't want to
create an attachment of the image.
:param file fp: a file object containing binary image data
:return: the URLs for the image uploaded
:rtype: dict | groupy/api/attachments.py | def upload(self, fp):
"""Upload image data to the image service.
Call this, rather than :func:`from_file`, you don't want to
create an attachment of the image.
:param file fp: a file object containing binary image data
:return: the URLs for the image uploaded
:rtype: di... | def upload(self, fp):
"""Upload image data to the image service.
Call this, rather than :func:`from_file`, you don't want to
create an attachment of the image.
:param file fp: a file object containing binary image data
:return: the URLs for the image uploaded
:rtype: di... | [
"Upload",
"image",
"data",
"to",
"the",
"image",
"service",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/attachments.py#L148-L161 | [
"def",
"upload",
"(",
"self",
",",
"fp",
")",
":",
"url",
"=",
"utils",
".",
"urljoin",
"(",
"self",
".",
"url",
",",
"'pictures'",
")",
"response",
"=",
"self",
".",
"session",
".",
"post",
"(",
"url",
",",
"data",
"=",
"fp",
".",
"read",
"(",
... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Images.download | Download the binary data of an image attachment.
:param image: an image attachment
:type image: :class:`~groupy.api.attachments.Image`
:param str url_field: the field of the image with the right URL
:param str suffix: an optional URL suffix
:return: binary image data
:rt... | groupy/api/attachments.py | def download(self, image, url_field='url', suffix=None):
"""Download the binary data of an image attachment.
:param image: an image attachment
:type image: :class:`~groupy.api.attachments.Image`
:param str url_field: the field of the image with the right URL
:param str suffix: a... | def download(self, image, url_field='url', suffix=None):
"""Download the binary data of an image attachment.
:param image: an image attachment
:type image: :class:`~groupy.api.attachments.Image`
:param str url_field: the field of the image with the right URL
:param str suffix: a... | [
"Download",
"the",
"binary",
"data",
"of",
"an",
"image",
"attachment",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/attachments.py#L163-L177 | [
"def",
"download",
"(",
"self",
",",
"image",
",",
"url_field",
"=",
"'url'",
",",
"suffix",
"=",
"None",
")",
":",
"url",
"=",
"getattr",
"(",
"image",
",",
"url_field",
")",
"if",
"suffix",
"is",
"not",
"None",
":",
"url",
"=",
"'.'",
".",
"join"... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Images.download_preview | Downlaod the binary data of an image attachment at preview size.
:param str url_field: the field of the image with the right URL
:return: binary image data
:rtype: bytes | groupy/api/attachments.py | def download_preview(self, image, url_field='url'):
"""Downlaod the binary data of an image attachment at preview size.
:param str url_field: the field of the image with the right URL
:return: binary image data
:rtype: bytes
"""
return self.download(image, url_field=url... | def download_preview(self, image, url_field='url'):
"""Downlaod the binary data of an image attachment at preview size.
:param str url_field: the field of the image with the right URL
:return: binary image data
:rtype: bytes
"""
return self.download(image, url_field=url... | [
"Downlaod",
"the",
"binary",
"data",
"of",
"an",
"image",
"attachment",
"at",
"preview",
"size",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/attachments.py#L179-L187 | [
"def",
"download_preview",
"(",
"self",
",",
"image",
",",
"url_field",
"=",
"'url'",
")",
":",
"return",
"self",
".",
"download",
"(",
"image",
",",
"url_field",
"=",
"url_field",
",",
"suffix",
"=",
"'preview'",
")"
] | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Images.download_large | Downlaod the binary data of an image attachment at large size.
:param str url_field: the field of the image with the right URL
:return: binary image data
:rtype: bytes | groupy/api/attachments.py | def download_large(self, image, url_field='url'):
"""Downlaod the binary data of an image attachment at large size.
:param str url_field: the field of the image with the right URL
:return: binary image data
:rtype: bytes
"""
return self.download(image, url_field=url_fie... | def download_large(self, image, url_field='url'):
"""Downlaod the binary data of an image attachment at large size.
:param str url_field: the field of the image with the right URL
:return: binary image data
:rtype: bytes
"""
return self.download(image, url_field=url_fie... | [
"Downlaod",
"the",
"binary",
"data",
"of",
"an",
"image",
"attachment",
"at",
"large",
"size",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/attachments.py#L189-L197 | [
"def",
"download_large",
"(",
"self",
",",
"image",
",",
"url_field",
"=",
"'url'",
")",
":",
"return",
"self",
".",
"download",
"(",
"image",
",",
"url_field",
"=",
"url_field",
",",
"suffix",
"=",
"'large'",
")"
] | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Images.download_avatar | Downlaod the binary data of an image attachment at avatar size.
:param str url_field: the field of the image with the right URL
:return: binary image data
:rtype: bytes | groupy/api/attachments.py | def download_avatar(self, image, url_field='url'):
"""Downlaod the binary data of an image attachment at avatar size.
:param str url_field: the field of the image with the right URL
:return: binary image data
:rtype: bytes
"""
return self.download(image, url_field=url_f... | def download_avatar(self, image, url_field='url'):
"""Downlaod the binary data of an image attachment at avatar size.
:param str url_field: the field of the image with the right URL
:return: binary image data
:rtype: bytes
"""
return self.download(image, url_field=url_f... | [
"Downlaod",
"the",
"binary",
"data",
"of",
"an",
"image",
"attachment",
"at",
"avatar",
"size",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/attachments.py#L199-L207 | [
"def",
"download_avatar",
"(",
"self",
",",
"image",
",",
"url_field",
"=",
"'url'",
")",
":",
"return",
"self",
".",
"download",
"(",
"image",
",",
"url_field",
"=",
"url_field",
",",
"suffix",
"=",
"'avatar'",
")"
] | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Pager.autopage | Iterate through results from all pages.
:return: all results
:rtype: generator | groupy/pagers.py | def autopage(self):
"""Iterate through results from all pages.
:return: all results
:rtype: generator
"""
while self.items:
yield from self.items
self.items = self.fetch_next() | def autopage(self):
"""Iterate through results from all pages.
:return: all results
:rtype: generator
"""
while self.items:
yield from self.items
self.items = self.fetch_next() | [
"Iterate",
"through",
"results",
"from",
"all",
"pages",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/pagers.py#L53-L61 | [
"def",
"autopage",
"(",
"self",
")",
":",
"while",
"self",
".",
"items",
":",
"yield",
"from",
"self",
".",
"items",
"self",
".",
"items",
"=",
"self",
".",
"fetch_next",
"(",
")"
] | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | MessageList.detect_mode | Detect which listing mode of the given params.
:params kwargs params: the params
:return: one of the available modes
:rtype: str
:raises ValueError: if multiple modes are detected | groupy/pagers.py | def detect_mode(cls, **params):
"""Detect which listing mode of the given params.
:params kwargs params: the params
:return: one of the available modes
:rtype: str
:raises ValueError: if multiple modes are detected
"""
modes = []
for mode in cls.modes:
... | def detect_mode(cls, **params):
"""Detect which listing mode of the given params.
:params kwargs params: the params
:return: one of the available modes
:rtype: str
:raises ValueError: if multiple modes are detected
"""
modes = []
for mode in cls.modes:
... | [
"Detect",
"which",
"listing",
"mode",
"of",
"the",
"given",
"params",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/pagers.py#L96-L112 | [
"def",
"detect_mode",
"(",
"cls",
",",
"*",
"*",
"params",
")",
":",
"modes",
"=",
"[",
"]",
"for",
"mode",
"in",
"cls",
".",
"modes",
":",
"if",
"params",
".",
"get",
"(",
"mode",
")",
"is",
"not",
"None",
":",
"modes",
".",
"append",
"(",
"mo... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | MessageList.set_next_page_params | Set the params so that the next page is fetched. | groupy/pagers.py | def set_next_page_params(self):
"""Set the params so that the next page is fetched."""
if self.items:
index = self.get_last_item_index()
self.params[self.mode] = self.get_next_page_param(self.items[index]) | def set_next_page_params(self):
"""Set the params so that the next page is fetched."""
if self.items:
index = self.get_last_item_index()
self.params[self.mode] = self.get_next_page_param(self.items[index]) | [
"Set",
"the",
"params",
"so",
"that",
"the",
"next",
"page",
"is",
"fetched",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/pagers.py#L114-L118 | [
"def",
"set_next_page_params",
"(",
"self",
")",
":",
"if",
"self",
".",
"items",
":",
"index",
"=",
"self",
".",
"get_last_item_index",
"(",
")",
"self",
".",
"params",
"[",
"self",
".",
"mode",
"]",
"=",
"self",
".",
"get_next_page_param",
"(",
"self",... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Blocks.list | List the users you have blocked.
:return: a list of :class:`~groupy.api.blocks.Block`'s
:rtype: :class:`list` | groupy/api/blocks.py | def list(self):
"""List the users you have blocked.
:return: a list of :class:`~groupy.api.blocks.Block`'s
:rtype: :class:`list`
"""
params = {'user': self.user_id}
response = self.session.get(self.url, params=params)
blocks = response.data['blocks']
retu... | def list(self):
"""List the users you have blocked.
:return: a list of :class:`~groupy.api.blocks.Block`'s
:rtype: :class:`list`
"""
params = {'user': self.user_id}
response = self.session.get(self.url, params=params)
blocks = response.data['blocks']
retu... | [
"List",
"the",
"users",
"you",
"have",
"blocked",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/blocks.py#L16-L25 | [
"def",
"list",
"(",
"self",
")",
":",
"params",
"=",
"{",
"'user'",
":",
"self",
".",
"user_id",
"}",
"response",
"=",
"self",
".",
"session",
".",
"get",
"(",
"self",
".",
"url",
",",
"params",
"=",
"params",
")",
"blocks",
"=",
"response",
".",
... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Blocks.between | Check if there is a block between you and the given user.
:return: ``True`` if the given user has been blocked
:rtype: bool | groupy/api/blocks.py | def between(self, other_user_id):
"""Check if there is a block between you and the given user.
:return: ``True`` if the given user has been blocked
:rtype: bool
"""
params = {'user': self.user_id, 'otherUser': other_user_id}
response = self.session.get(self.url, params=p... | def between(self, other_user_id):
"""Check if there is a block between you and the given user.
:return: ``True`` if the given user has been blocked
:rtype: bool
"""
params = {'user': self.user_id, 'otherUser': other_user_id}
response = self.session.get(self.url, params=p... | [
"Check",
"if",
"there",
"is",
"a",
"block",
"between",
"you",
"and",
"the",
"given",
"user",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/blocks.py#L27-L35 | [
"def",
"between",
"(",
"self",
",",
"other_user_id",
")",
":",
"params",
"=",
"{",
"'user'",
":",
"self",
".",
"user_id",
",",
"'otherUser'",
":",
"other_user_id",
"}",
"response",
"=",
"self",
".",
"session",
".",
"get",
"(",
"self",
".",
"url",
",",
... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Blocks.block | Block the given user.
:param str other_user_id: the ID of the user to block
:return: the block created
:rtype: :class:`~groupy.api.blocks.Block` | groupy/api/blocks.py | def block(self, other_user_id):
"""Block the given user.
:param str other_user_id: the ID of the user to block
:return: the block created
:rtype: :class:`~groupy.api.blocks.Block`
"""
params = {'user': self.user_id, 'otherUser': other_user_id}
response = self.ses... | def block(self, other_user_id):
"""Block the given user.
:param str other_user_id: the ID of the user to block
:return: the block created
:rtype: :class:`~groupy.api.blocks.Block`
"""
params = {'user': self.user_id, 'otherUser': other_user_id}
response = self.ses... | [
"Block",
"the",
"given",
"user",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/blocks.py#L37-L47 | [
"def",
"block",
"(",
"self",
",",
"other_user_id",
")",
":",
"params",
"=",
"{",
"'user'",
":",
"self",
".",
"user_id",
",",
"'otherUser'",
":",
"other_user_id",
"}",
"response",
"=",
"self",
".",
"session",
".",
"post",
"(",
"self",
".",
"url",
",",
... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Blocks.unblock | Unblock the given user.
:param str other_user_id: the ID of the user to unblock
:return: ``True`` if successful
:rtype: bool | groupy/api/blocks.py | def unblock(self, other_user_id):
"""Unblock the given user.
:param str other_user_id: the ID of the user to unblock
:return: ``True`` if successful
:rtype: bool
"""
params = {'user': self.user_id, 'otherUser': other_user_id}
response = self.session.delete(self.u... | def unblock(self, other_user_id):
"""Unblock the given user.
:param str other_user_id: the ID of the user to unblock
:return: ``True`` if successful
:rtype: bool
"""
params = {'user': self.user_id, 'otherUser': other_user_id}
response = self.session.delete(self.u... | [
"Unblock",
"the",
"given",
"user",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/blocks.py#L49-L58 | [
"def",
"unblock",
"(",
"self",
",",
"other_user_id",
")",
":",
"params",
"=",
"{",
"'user'",
":",
"self",
".",
"user_id",
",",
"'otherUser'",
":",
"other_user_id",
"}",
"response",
"=",
"self",
".",
"session",
".",
"delete",
"(",
"self",
".",
"url",
",... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Chats.list | List a page of chats.
:param int page: which page
:param int per_page: how many chats per page
:return: chats with other users
:rtype: :class:`~groupy.pagers.ChatList` | groupy/api/chats.py | def list(self, page=1, per_page=10):
"""List a page of chats.
:param int page: which page
:param int per_page: how many chats per page
:return: chats with other users
:rtype: :class:`~groupy.pagers.ChatList`
"""
return pagers.ChatList(self, self._raw_list, per_pa... | def list(self, page=1, per_page=10):
"""List a page of chats.
:param int page: which page
:param int per_page: how many chats per page
:return: chats with other users
:rtype: :class:`~groupy.pagers.ChatList`
"""
return pagers.ChatList(self, self._raw_list, per_pa... | [
"List",
"a",
"page",
"of",
"chats",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/chats.py#L17-L26 | [
"def",
"list",
"(",
"self",
",",
"page",
"=",
"1",
",",
"per_page",
"=",
"10",
")",
":",
"return",
"pagers",
".",
"ChatList",
"(",
"self",
",",
"self",
".",
"_raw_list",
",",
"per_page",
"=",
"per_page",
",",
"page",
"=",
"page",
")"
] | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Messages.list | Return a page of group messages.
The messages come in reversed order (newest first). Note you can only
provide _one_ of ``before_id``, ``since_id``, or ``after_id``.
:param str before_id: message ID for paging backwards
:param str after_id: message ID for paging forwards
:param... | groupy/api/messages.py | def list(self, before_id=None, since_id=None, after_id=None, limit=20):
"""Return a page of group messages.
The messages come in reversed order (newest first). Note you can only
provide _one_ of ``before_id``, ``since_id``, or ``after_id``.
:param str before_id: message ID for paging b... | def list(self, before_id=None, since_id=None, after_id=None, limit=20):
"""Return a page of group messages.
The messages come in reversed order (newest first). Note you can only
provide _one_ of ``before_id``, ``since_id``, or ``after_id``.
:param str before_id: message ID for paging b... | [
"Return",
"a",
"page",
"of",
"group",
"messages",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/messages.py#L28-L43 | [
"def",
"list",
"(",
"self",
",",
"before_id",
"=",
"None",
",",
"since_id",
"=",
"None",
",",
"after_id",
"=",
"None",
",",
"limit",
"=",
"20",
")",
":",
"return",
"pagers",
".",
"MessageList",
"(",
"self",
",",
"self",
".",
"_raw_list",
",",
"before... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Messages.list_since | Return a page of group messages created since a message.
This is used to fetch the most recent messages after another. There
may exist messages between the one given and the ones returned. Use
:func:`list_after` to retrieve newer messages without skipping any.
:param str message_id: th... | groupy/api/messages.py | def list_since(self, message_id, limit=None):
"""Return a page of group messages created since a message.
This is used to fetch the most recent messages after another. There
may exist messages between the one given and the ones returned. Use
:func:`list_after` to retrieve newer messages... | def list_since(self, message_id, limit=None):
"""Return a page of group messages created since a message.
This is used to fetch the most recent messages after another. There
may exist messages between the one given and the ones returned. Use
:func:`list_after` to retrieve newer messages... | [
"Return",
"a",
"page",
"of",
"group",
"messages",
"created",
"since",
"a",
"message",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/messages.py#L57-L69 | [
"def",
"list_since",
"(",
"self",
",",
"message_id",
",",
"limit",
"=",
"None",
")",
":",
"return",
"self",
".",
"list",
"(",
"since_id",
"=",
"message_id",
",",
"limit",
"=",
"limit",
")"
] | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Messages.list_after | Return a page of group messages created after a message.
This is used to page forwards through messages.
:param str message_id: the ID of a message
:param int limit: maximum number of messages per page
:return: group messages
:rtype: :class:`~groupy.pagers.MessageList` | groupy/api/messages.py | def list_after(self, message_id, limit=None):
"""Return a page of group messages created after a message.
This is used to page forwards through messages.
:param str message_id: the ID of a message
:param int limit: maximum number of messages per page
:return: group messages
... | def list_after(self, message_id, limit=None):
"""Return a page of group messages created after a message.
This is used to page forwards through messages.
:param str message_id: the ID of a message
:param int limit: maximum number of messages per page
:return: group messages
... | [
"Return",
"a",
"page",
"of",
"group",
"messages",
"created",
"after",
"a",
"message",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/messages.py#L71-L81 | [
"def",
"list_after",
"(",
"self",
",",
"message_id",
",",
"limit",
"=",
"None",
")",
":",
"return",
"self",
".",
"list",
"(",
"after_id",
"=",
"message_id",
",",
"limit",
"=",
"limit",
")"
] | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Messages.list_all_before | Return all group messages created before a message.
:param str message_id: the ID of a message
:param int limit: maximum number of messages per page
:return: group messages
:rtype: generator | groupy/api/messages.py | def list_all_before(self, message_id, limit=None):
"""Return all group messages created before a message.
:param str message_id: the ID of a message
:param int limit: maximum number of messages per page
:return: group messages
:rtype: generator
"""
return self.li... | def list_all_before(self, message_id, limit=None):
"""Return all group messages created before a message.
:param str message_id: the ID of a message
:param int limit: maximum number of messages per page
:return: group messages
:rtype: generator
"""
return self.li... | [
"Return",
"all",
"group",
"messages",
"created",
"before",
"a",
"message",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/messages.py#L92-L100 | [
"def",
"list_all_before",
"(",
"self",
",",
"message_id",
",",
"limit",
"=",
"None",
")",
":",
"return",
"self",
".",
"list_before",
"(",
"message_id",
",",
"limit",
"=",
"limit",
")",
".",
"autopage",
"(",
")"
] | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Messages.list_all_after | Return all group messages created after a message.
:param str message_id: the ID of a message
:param int limit: maximum number of messages per page
:return: group messages
:rtype: generator | groupy/api/messages.py | def list_all_after(self, message_id, limit=None):
"""Return all group messages created after a message.
:param str message_id: the ID of a message
:param int limit: maximum number of messages per page
:return: group messages
:rtype: generator
"""
return self.list... | def list_all_after(self, message_id, limit=None):
"""Return all group messages created after a message.
:param str message_id: the ID of a message
:param int limit: maximum number of messages per page
:return: group messages
:rtype: generator
"""
return self.list... | [
"Return",
"all",
"group",
"messages",
"created",
"after",
"a",
"message",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/messages.py#L102-L110 | [
"def",
"list_all_after",
"(",
"self",
",",
"message_id",
",",
"limit",
"=",
"None",
")",
":",
"return",
"self",
".",
"list_after",
"(",
"message_id",
",",
"limit",
"=",
"limit",
")",
".",
"autopage",
"(",
")"
] | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Messages.create | Create a new message in the group.
:param str text: the text of the message
:param attachments: a list of attachments
:type attachments: :class:`list`
:param str source_guid: a unique identifier for the message
:return: the created message
:rtype: :class:`~groupy.api.mes... | groupy/api/messages.py | def create(self, text=None, attachments=None, source_guid=None):
"""Create a new message in the group.
:param str text: the text of the message
:param attachments: a list of attachments
:type attachments: :class:`list`
:param str source_guid: a unique identifier for the message
... | def create(self, text=None, attachments=None, source_guid=None):
"""Create a new message in the group.
:param str text: the text of the message
:param attachments: a list of attachments
:type attachments: :class:`list`
:param str source_guid: a unique identifier for the message
... | [
"Create",
"a",
"new",
"message",
"in",
"the",
"group",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/messages.py#L112-L135 | [
"def",
"create",
"(",
"self",
",",
"text",
"=",
"None",
",",
"attachments",
"=",
"None",
",",
"source_guid",
"=",
"None",
")",
":",
"message",
"=",
"{",
"'source_guid'",
":",
"source_guid",
"or",
"str",
"(",
"time",
".",
"time",
"(",
")",
")",
",",
... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | DirectMessages.list | Return a page of direct messages.
The messages come in reversed order (newest first). Note you can only
provide _one_ of ``before_id``, ``since_id``.
:param str before_id: message ID for paging backwards
:param str since_id: message ID for most recent messages since
:return: di... | groupy/api/messages.py | def list(self, before_id=None, since_id=None, **kwargs):
"""Return a page of direct messages.
The messages come in reversed order (newest first). Note you can only
provide _one_ of ``before_id``, ``since_id``.
:param str before_id: message ID for paging backwards
:param str sin... | def list(self, before_id=None, since_id=None, **kwargs):
"""Return a page of direct messages.
The messages come in reversed order (newest first). Note you can only
provide _one_ of ``before_id``, ``since_id``.
:param str before_id: message ID for paging backwards
:param str sin... | [
"Return",
"a",
"page",
"of",
"direct",
"messages",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/messages.py#L157-L169 | [
"def",
"list",
"(",
"self",
",",
"before_id",
"=",
"None",
",",
"since_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"pagers",
".",
"MessageList",
"(",
"self",
",",
"self",
".",
"_raw_list",
",",
"before_id",
"=",
"before_id",
",",
"... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | DirectMessages.list_all | Return all direct messages.
The messages come in reversed order (newest first). Note you can only
provide _one_ of ``before_id``, ``since_id``.
:param str before_id: message ID for paging backwards
:param str since_id: message ID for most recent messages since
:return: direct m... | groupy/api/messages.py | def list_all(self, before_id=None, since_id=None, **kwargs):
"""Return all direct messages.
The messages come in reversed order (newest first). Note you can only
provide _one_ of ``before_id``, ``since_id``.
:param str before_id: message ID for paging backwards
:param str since... | def list_all(self, before_id=None, since_id=None, **kwargs):
"""Return all direct messages.
The messages come in reversed order (newest first). Note you can only
provide _one_ of ``before_id``, ``since_id``.
:param str before_id: message ID for paging backwards
:param str since... | [
"Return",
"all",
"direct",
"messages",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/messages.py#L194-L205 | [
"def",
"list_all",
"(",
"self",
",",
"before_id",
"=",
"None",
",",
"since_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"list",
"(",
"before_id",
"=",
"before_id",
",",
"since_id",
"=",
"since_id",
",",
"*",
"*",
"kwarg... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Memberships.add | Add a user to the group.
You must provide either the email, phone number, or user_id that
uniquely identifies a user.
:param str nickname: new name for the user in the group
:param str email: email address of the user
:param str phone_number: phone number of the user
:p... | groupy/api/memberships.py | def add(self, nickname, email=None, phone_number=None, user_id=None):
"""Add a user to the group.
You must provide either the email, phone number, or user_id that
uniquely identifies a user.
:param str nickname: new name for the user in the group
:param str email: email address... | def add(self, nickname, email=None, phone_number=None, user_id=None):
"""Add a user to the group.
You must provide either the email, phone number, or user_id that
uniquely identifies a user.
:param str nickname: new name for the user in the group
:param str email: email address... | [
"Add",
"a",
"user",
"to",
"the",
"group",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/memberships.py#L25-L44 | [
"def",
"add",
"(",
"self",
",",
"nickname",
",",
"email",
"=",
"None",
",",
"phone_number",
"=",
"None",
",",
"user_id",
"=",
"None",
")",
":",
"member",
"=",
"{",
"'nickname'",
":",
"nickname",
",",
"'email'",
":",
"email",
",",
"'phone_number'",
":",... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Memberships.add_multiple | Add multiple users to the group at once.
Each given user must be a dictionary containing a nickname and either
an email, phone number, or user_id.
:param args users: the users to add
:return: a membership request
:rtype: :class:`MembershipRequest` | groupy/api/memberships.py | def add_multiple(self, *users):
"""Add multiple users to the group at once.
Each given user must be a dictionary containing a nickname and either
an email, phone number, or user_id.
:param args users: the users to add
:return: a membership request
:rtype: :class:`Member... | def add_multiple(self, *users):
"""Add multiple users to the group at once.
Each given user must be a dictionary containing a nickname and either
an email, phone number, or user_id.
:param args users: the users to add
:return: a membership request
:rtype: :class:`Member... | [
"Add",
"multiple",
"users",
"to",
"the",
"group",
"at",
"once",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/memberships.py#L46-L64 | [
"def",
"add_multiple",
"(",
"self",
",",
"*",
"users",
")",
":",
"guid",
"=",
"uuid",
".",
"uuid4",
"(",
")",
"for",
"i",
",",
"user_",
"in",
"enumerate",
"(",
"users",
")",
":",
"user_",
"[",
"'guid'",
"]",
"=",
"'{}-{}'",
".",
"format",
"(",
"g... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Memberships.check | Check for results of a membership request.
:param str results_id: the ID of a membership request
:return: successfully created memberships
:rtype: :class:`list`
:raises groupy.exceptions.ResultsNotReady: if the results are not ready
:raises groupy.exceptions.ResultsExpired: if t... | groupy/api/memberships.py | def check(self, results_id):
"""Check for results of a membership request.
:param str results_id: the ID of a membership request
:return: successfully created memberships
:rtype: :class:`list`
:raises groupy.exceptions.ResultsNotReady: if the results are not ready
:raise... | def check(self, results_id):
"""Check for results of a membership request.
:param str results_id: the ID of a membership request
:return: successfully created memberships
:rtype: :class:`list`
:raises groupy.exceptions.ResultsNotReady: if the results are not ready
:raise... | [
"Check",
"for",
"results",
"of",
"a",
"membership",
"request",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/memberships.py#L66-L82 | [
"def",
"check",
"(",
"self",
",",
"results_id",
")",
":",
"path",
"=",
"'results/{}'",
".",
"format",
"(",
"results_id",
")",
"url",
"=",
"utils",
".",
"urljoin",
"(",
"self",
".",
"url",
",",
"path",
")",
"response",
"=",
"self",
".",
"session",
"."... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Memberships.update | Update your own membership.
Note that this fails on former groups.
:param str nickname: new nickname
:return: updated membership
:rtype: :class:`~groupy.api.memberships.Member` | groupy/api/memberships.py | def update(self, nickname=None, **kwargs):
"""Update your own membership.
Note that this fails on former groups.
:param str nickname: new nickname
:return: updated membership
:rtype: :class:`~groupy.api.memberships.Member`
"""
url = self.url + 'hips/update'
... | def update(self, nickname=None, **kwargs):
"""Update your own membership.
Note that this fails on former groups.
:param str nickname: new nickname
:return: updated membership
:rtype: :class:`~groupy.api.memberships.Member`
"""
url = self.url + 'hips/update'
... | [
"Update",
"your",
"own",
"membership",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/memberships.py#L84-L101 | [
"def",
"update",
"(",
"self",
",",
"nickname",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"url",
"=",
"self",
".",
"url",
"+",
"'hips/update'",
"payload",
"=",
"{",
"'membership'",
":",
"{",
"'nickname'",
":",
"nickname",
",",
"}",
",",
"}",
"... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Memberships.remove | Remove a member from the group.
:param str membership_id: the ID of a member in this group
:return: ``True`` if the member was successfully removed
:rtype: bool | groupy/api/memberships.py | def remove(self, membership_id):
"""Remove a member from the group.
:param str membership_id: the ID of a member in this group
:return: ``True`` if the member was successfully removed
:rtype: bool
"""
path = '{}/remove'.format(membership_id)
url = utils.urljoin(s... | def remove(self, membership_id):
"""Remove a member from the group.
:param str membership_id: the ID of a member in this group
:return: ``True`` if the member was successfully removed
:rtype: bool
"""
path = '{}/remove'.format(membership_id)
url = utils.urljoin(s... | [
"Remove",
"a",
"member",
"from",
"the",
"group",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/memberships.py#L103-L114 | [
"def",
"remove",
"(",
"self",
",",
"membership_id",
")",
":",
"path",
"=",
"'{}/remove'",
".",
"format",
"(",
"membership_id",
")",
"url",
"=",
"utils",
".",
"urljoin",
"(",
"self",
".",
"url",
",",
"path",
")",
"payload",
"=",
"{",
"'membership_id'",
... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Member.post | Post a direct message to the user.
:param str text: the message content
:param attachments: message attachments
:param str source_guid: a client-side unique ID for the message
:return: the message sent
:rtype: :class:`~groupy.api.messages.DirectMessage` | groupy/api/memberships.py | def post(self, text=None, attachments=None, source_guid=None):
"""Post a direct message to the user.
:param str text: the message content
:param attachments: message attachments
:param str source_guid: a client-side unique ID for the message
:return: the message sent
:rt... | def post(self, text=None, attachments=None, source_guid=None):
"""Post a direct message to the user.
:param str text: the message content
:param attachments: message attachments
:param str source_guid: a client-side unique ID for the message
:return: the message sent
:rt... | [
"Post",
"a",
"direct",
"message",
"to",
"the",
"user",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/memberships.py#L151-L161 | [
"def",
"post",
"(",
"self",
",",
"text",
"=",
"None",
",",
"attachments",
"=",
"None",
",",
"source_guid",
"=",
"None",
")",
":",
"return",
"self",
".",
"messages",
".",
"create",
"(",
"text",
"=",
"text",
",",
"attachments",
"=",
"attachments",
",",
... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | Member.add_to_group | Add the member to another group.
If a nickname is not provided the member's current nickname is used.
:param str group_id: the group_id of a group
:param str nickname: a new nickname
:return: a membership request
:rtype: :class:`MembershipRequest` | groupy/api/memberships.py | def add_to_group(self, group_id, nickname=None):
"""Add the member to another group.
If a nickname is not provided the member's current nickname is used.
:param str group_id: the group_id of a group
:param str nickname: a new nickname
:return: a membership request
:rtyp... | def add_to_group(self, group_id, nickname=None):
"""Add the member to another group.
If a nickname is not provided the member's current nickname is used.
:param str group_id: the group_id of a group
:param str nickname: a new nickname
:return: a membership request
:rtyp... | [
"Add",
"the",
"member",
"to",
"another",
"group",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/memberships.py#L195-L208 | [
"def",
"add_to_group",
"(",
"self",
",",
"group_id",
",",
"nickname",
"=",
"None",
")",
":",
"if",
"nickname",
"is",
"None",
":",
"nickname",
"=",
"self",
".",
"nickname",
"memberships",
"=",
"Memberships",
"(",
"self",
".",
"manager",
".",
"session",
",... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | MembershipRequest.check_if_ready | Check for and fetch the results if ready. | groupy/api/memberships.py | def check_if_ready(self):
"""Check for and fetch the results if ready."""
try:
results = self.manager.check(self.results_id)
except exceptions.ResultsNotReady as e:
self._is_ready = False
self._not_ready_exception = e
except exceptions.ResultsExpired a... | def check_if_ready(self):
"""Check for and fetch the results if ready."""
try:
results = self.manager.check(self.results_id)
except exceptions.ResultsNotReady as e:
self._is_ready = False
self._not_ready_exception = e
except exceptions.ResultsExpired a... | [
"Check",
"for",
"and",
"fetch",
"the",
"results",
"if",
"ready",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/memberships.py#L231-L246 | [
"def",
"check_if_ready",
"(",
"self",
")",
":",
"try",
":",
"results",
"=",
"self",
".",
"manager",
".",
"check",
"(",
"self",
".",
"results_id",
")",
"except",
"exceptions",
".",
"ResultsNotReady",
"as",
"e",
":",
"self",
".",
"_is_ready",
"=",
"False",... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | MembershipRequest.get_failed_requests | Return the requests that failed.
:param results: the results of a membership request check
:type results: :class:`list`
:return: the failed requests
:rtype: generator | groupy/api/memberships.py | def get_failed_requests(self, results):
"""Return the requests that failed.
:param results: the results of a membership request check
:type results: :class:`list`
:return: the failed requests
:rtype: generator
"""
data = {member['guid']: member for member in resu... | def get_failed_requests(self, results):
"""Return the requests that failed.
:param results: the results of a membership request check
:type results: :class:`list`
:return: the failed requests
:rtype: generator
"""
data = {member['guid']: member for member in resu... | [
"Return",
"the",
"requests",
"that",
"failed",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/memberships.py#L248-L259 | [
"def",
"get_failed_requests",
"(",
"self",
",",
"results",
")",
":",
"data",
"=",
"{",
"member",
"[",
"'guid'",
"]",
":",
"member",
"for",
"member",
"in",
"results",
"}",
"for",
"request",
"in",
"self",
".",
"requests",
":",
"if",
"request",
"[",
"'gui... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
train | MembershipRequest.get_new_members | Return the newly added members.
:param results: the results of a membership request check
:type results: :class:`list`
:return: the successful requests, as :class:`~groupy.api.memberships.Members`
:rtype: generator | groupy/api/memberships.py | def get_new_members(self, results):
"""Return the newly added members.
:param results: the results of a membership request check
:type results: :class:`list`
:return: the successful requests, as :class:`~groupy.api.memberships.Members`
:rtype: generator
"""
for m... | def get_new_members(self, results):
"""Return the newly added members.
:param results: the results of a membership request check
:type results: :class:`list`
:return: the successful requests, as :class:`~groupy.api.memberships.Members`
:rtype: generator
"""
for m... | [
"Return",
"the",
"newly",
"added",
"members",
"."
] | rhgrant10/Groupy | python | https://github.com/rhgrant10/Groupy/blob/ffd8cac57586fa1c218e3b4bfaa531142c3be766/groupy/api/memberships.py#L261-L272 | [
"def",
"get_new_members",
"(",
"self",
",",
"results",
")",
":",
"for",
"member",
"in",
"results",
":",
"guid",
"=",
"member",
".",
"pop",
"(",
"'guid'",
")",
"yield",
"Member",
"(",
"self",
".",
"manager",
",",
"self",
".",
"group_id",
",",
"*",
"*"... | ffd8cac57586fa1c218e3b4bfaa531142c3be766 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.