hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0969ea63463b14105d9a8a77198468336bfa8520 | pallet-io/Pallet-API | oss_server/explorer/blocktools/base58.py | [
"BSD-3-Clause"
] | Python | b58decode | <not_specific> | def b58decode(v, length):
"""Decode v into a string of len bytes."""
long_value = 0L
for (i, c) in enumerate(v[::-1]):
long_value += __b58chars.find(c) * (__b58base**i)
result = ''
while long_value >= 256:
div, mod = divmod(long_value, 256)
result = chr(mod) + result
... | Decode v into a string of len bytes. | Decode v into a string of len bytes. | [
"Decode",
"v",
"into",
"a",
"string",
"of",
"len",
"bytes",
"."
] | def b58decode(v, length):
long_value = 0L
for (i, c) in enumerate(v[::-1]):
long_value += __b58chars.find(c) * (__b58base**i)
result = ''
while long_value >= 256:
div, mod = divmod(long_value, 256)
result = chr(mod) + result
long_value = div
result = chr(long_value) +... | [
"def",
"b58decode",
"(",
"v",
",",
"length",
")",
":",
"long_value",
"=",
"0L",
"for",
"(",
"i",
",",
"c",
")",
"in",
"enumerate",
"(",
"v",
"[",
":",
":",
"-",
"1",
"]",
")",
":",
"long_value",
"+=",
"__b58chars",
".",
"find",
"(",
"c",
")",
... | Decode v into a string of len bytes. | [
"Decode",
"v",
"into",
"a",
"string",
"of",
"len",
"bytes",
"."
] | [
"\"\"\"Decode v into a string of len bytes.\"\"\""
] | [
{
"param": "v",
"type": null
},
{
"param": "length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "v",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "length",
"type": null,
"docstring": null,
"docstring_tokens": []... |
270c48376c4d6f8933adeb5099f6f502f4b2db40 | adityakoolkarni/SLAM | py_src/mapping.py | [
"MIT"
] | Python | convert2world_frame | <not_specific> | def convert2world_frame(lidar_scan,lidar_pose,head_angles):
'''
This takes in the lidar frame reading and computes the world frame readings
Ideally the z axis should not change
'''
#Pose from lidar to head
#print("Pose is ",lidar_pose)
lid2head_pose = np.hstack((np.eye(3),np.array([0,0,0.15... |
This takes in the lidar frame reading and computes the world frame readings
Ideally the z axis should not change
| This takes in the lidar frame reading and computes the world frame readings
Ideally the z axis should not change | [
"This",
"takes",
"in",
"the",
"lidar",
"frame",
"reading",
"and",
"computes",
"the",
"world",
"frame",
"readings",
"Ideally",
"the",
"z",
"axis",
"should",
"not",
"change"
] | def convert2world_frame(lidar_scan,lidar_pose,head_angles):
lid2head_pose = np.hstack((np.eye(3),np.array([0,0,0.15]).reshape(3,1)))
lid2head_pose = np.vstack((lid2head_pose,np.array([0,0,0,1]).reshape(1,4)))
yaw,pit = head_angles
rot_yaw = np.array([[np.cos(yaw),-np.sin(yaw),0],[np.sin(yaw),np.cos(yaw)... | [
"def",
"convert2world_frame",
"(",
"lidar_scan",
",",
"lidar_pose",
",",
"head_angles",
")",
":",
"lid2head_pose",
"=",
"np",
".",
"hstack",
"(",
"(",
"np",
".",
"eye",
"(",
"3",
")",
",",
"np",
".",
"array",
"(",
"[",
"0",
",",
"0",
",",
"0.15",
"... | This takes in the lidar frame reading and computes the world frame readings
Ideally the z axis should not change | [
"This",
"takes",
"in",
"the",
"lidar",
"frame",
"reading",
"and",
"computes",
"the",
"world",
"frame",
"readings",
"Ideally",
"the",
"z",
"axis",
"should",
"not",
"change"
] | [
"'''\n This takes in the lidar frame reading and computes the world frame readings\n Ideally the z axis should not change\n '''",
"#Pose from lidar to head",
"#print(\"Pose is \",lidar_pose)",
"#Pose from head to body",
"#.astype(float)",
"#.astype(float)",
"#Pose from body to world",
"#.asty... | [
{
"param": "lidar_scan",
"type": null
},
{
"param": "lidar_pose",
"type": null
},
{
"param": "head_angles",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lidar_scan",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lidar_pose",
"type": null,
"docstring": null,
"docstrin... |
baf492e58948d928c5c8f1459f4f2132f2548ff2 | alexji/isochrones | isochrones/grid.py | [
"MIT"
] | Python | _get_df | <not_specific> | def _get_df(self):
"""Returns stellar model grid with desired bandpasses and with standard column names
bands must be iterable, and are parsed according to :func:``get_band``
"""
grids = {}
df = pd.DataFrame()
for bnd in self.bands:
s,b = self.get_band(bnd, *... | Returns stellar model grid with desired bandpasses and with standard column names
bands must be iterable, and are parsed according to :func:``get_band``
| Returns stellar model grid with desired bandpasses and with standard column names
bands must be iterable, and are parsed according to :func:``get_band`` | [
"Returns",
"stellar",
"model",
"grid",
"with",
"desired",
"bandpasses",
"and",
"with",
"standard",
"column",
"names",
"bands",
"must",
"be",
"iterable",
"and",
"are",
"parsed",
"according",
"to",
":",
"func",
":",
"`",
"`",
"get_band",
"`",
"`"
] | def _get_df(self):
grids = {}
df = pd.DataFrame()
for bnd in self.bands:
s,b = self.get_band(bnd, **self.kwargs)
logging.debug('loading {} band from {}'.format(b,s))
if s not in grids:
grids[s] = self.get_hdf(s)
if self.common_colum... | [
"def",
"_get_df",
"(",
"self",
")",
":",
"grids",
"=",
"{",
"}",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"for",
"bnd",
"in",
"self",
".",
"bands",
":",
"s",
",",
"b",
"=",
"self",
".",
"get_band",
"(",
"bnd",
",",
"**",
"self",
".",
"kwa... | Returns stellar model grid with desired bandpasses and with standard column names
bands must be iterable, and are parsed according to :func:``get_band`` | [
"Returns",
"stellar",
"model",
"grid",
"with",
"desired",
"bandpasses",
"and",
"with",
"standard",
"column",
"names",
"bands",
"must",
"be",
"iterable",
"and",
"are",
"parsed",
"according",
"to",
":",
"func",
":",
"`",
"`",
"get_band",
"`",
"`"
] | [
"\"\"\"Returns stellar model grid with desired bandpasses and with standard column names\n\n bands must be iterable, and are parsed according to :func:``get_band``\n \"\"\"",
"#dunno why it has to be this way; something",
"# funny with indexing."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
54b91d480961fd101b758d0217ebdd5b6fe162a2 | alexji/isochrones | isochrones/interp.py | [
"MIT"
] | Python | interp_box | <not_specific> | def interp_box(x, y, z, box, values):
"""
box is 8x3 array, though not really a box
values is length-8 array, corresponding to values at the "box" coords
TODO: should make power `p` an argument
"""
# Calculate the distance to each vertex
val = 0
norm = 0
for i in range(8):
... |
box is 8x3 array, though not really a box
values is length-8 array, corresponding to values at the "box" coords
TODO: should make power `p` an argument
| box is 8x3 array, though not really a box
values is length-8 array, corresponding to values at the "box" coords
should make power `p` an argument | [
"box",
"is",
"8x3",
"array",
"though",
"not",
"really",
"a",
"box",
"values",
"is",
"length",
"-",
"8",
"array",
"corresponding",
"to",
"values",
"at",
"the",
"\"",
"box",
"\"",
"coords",
"should",
"make",
"power",
"`",
"p",
"`",
"an",
"argument"
] | def interp_box(x, y, z, box, values):
val = 0
norm = 0
for i in range(8):
distance = sqrt((x-box[i,0])**2 + (y-box[i,1])**2 + (z-box[i, 2])**2)
if distance == 0:
val = values[i]
norm = 1.
break
w = 1./distance
val += w * values[i]
n... | [
"def",
"interp_box",
"(",
"x",
",",
"y",
",",
"z",
",",
"box",
",",
"values",
")",
":",
"val",
"=",
"0",
"norm",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"8",
")",
":",
"distance",
"=",
"sqrt",
"(",
"(",
"x",
"-",
"box",
"[",
"i",
",",
"... | box is 8x3 array, though not really a box
values is length-8 array, corresponding to values at the "box" coords | [
"box",
"is",
"8x3",
"array",
"though",
"not",
"really",
"a",
"box",
"values",
"is",
"length",
"-",
"8",
"array",
"corresponding",
"to",
"values",
"at",
"the",
"\"",
"box",
"\"",
"coords"
] | [
"\"\"\"\n box is 8x3 array, though not really a box\n\n values is length-8 array, corresponding to values at the \"box\" coords\n\n TODO: should make power `p` an argument\n \"\"\"",
"# Calculate the distance to each vertex",
"# Inv distance, or Inv-dsq weighting",
"# If you happen to land on exac... | [
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
},
{
"param": "z",
"type": null
},
{
"param": "box",
"type": null
},
{
"param": "values",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
54b91d480961fd101b758d0217ebdd5b6fe162a2 | alexji/isochrones | isochrones/interp.py | [
"MIT"
] | Python | interp_values | <not_specific> | def interp_values(mass_arr, age_arr, feh_arr, icol,
grid, mass_col, ages, fehs, grid_Ns):
"""mass_arr, age_arr, feh_arr are all arrays at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of ma... | mass_arr, age_arr, feh_arr are all arrays at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of mass
ages is grid of ages
fehs is grid of fehs
grid_Ns keeps track of nmass in each slice (beyond this a... | mass_arr, age_arr, feh_arr are all arrays at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of mass
ages is grid of ages
fehs is grid of fehs
grid_Ns keeps track of nmass in each slice (beyond this are nans) | [
"mass_arr",
"age_arr",
"feh_arr",
"are",
"all",
"arrays",
"at",
"which",
"values",
"are",
"desired",
"icol",
"is",
"the",
"column",
"index",
"of",
"desired",
"value",
"grid",
"is",
"nfeh",
"x",
"nage",
"x",
"max",
"(",
"nmass",
")",
"x",
"ncols",
"array"... | def interp_values(mass_arr, age_arr, feh_arr, icol,
grid, mass_col, ages, fehs, grid_Ns):
N = len(mass_arr)
results = np.zeros(N)
Nage = len(ages)
Nfeh = len(fehs)
for i in range(N):
results[i] = interp_value(mass_arr[i], age_arr[i], feh_arr[i], icol,
... | [
"def",
"interp_values",
"(",
"mass_arr",
",",
"age_arr",
",",
"feh_arr",
",",
"icol",
",",
"grid",
",",
"mass_col",
",",
"ages",
",",
"fehs",
",",
"grid_Ns",
")",
":",
"N",
"=",
"len",
"(",
"mass_arr",
")",
"results",
"=",
"np",
".",
"zeros",
"(",
... | mass_arr, age_arr, feh_arr are all arrays at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of mass
ages is grid of ages
fehs is grid of fehs
grid_Ns keeps track of nmass in each slice (beyond this are nans) | [
"mass_arr",
"age_arr",
"feh_arr",
"are",
"all",
"arrays",
"at",
"which",
"values",
"are",
"desired",
"icol",
"is",
"the",
"column",
"index",
"of",
"desired",
"value",
"grid",
"is",
"nfeh",
"x",
"nage",
"x",
"max",
"(",
"nmass",
")",
"x",
"ncols",
"array"... | [
"\"\"\"mass_arr, age_arr, feh_arr are all arrays at which values are desired\n\n icol is the column index of desired value\n grid is nfeh x nage x max(nmass) x ncols array\n mass_col is the column index of mass\n ages is grid of ages\n fehs is grid of fehs\n grid_Ns keeps track of nmass in each sl... | [
{
"param": "mass_arr",
"type": null
},
{
"param": "age_arr",
"type": null
},
{
"param": "feh_arr",
"type": null
},
{
"param": "icol",
"type": null
},
{
"param": "grid",
"type": null
},
{
"param": "mass_col",
"type": null
},
{
"param": "ages... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mass_arr",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "age_arr",
"type": null,
"docstring": null,
"docstring_tok... |
54b91d480961fd101b758d0217ebdd5b6fe162a2 | alexji/isochrones | isochrones/interp.py | [
"MIT"
] | Python | interp_value | <not_specific> | def interp_value(mass, age, feh, icol,
grid, mass_col, ages, fehs, grid_Ns, debug):
# return_box):
"""mass, age, feh are *single values* at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the... | mass, age, feh are *single values* at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of mass
ages is grid of ages
fehs is grid of fehs
grid_Ns keeps track of nmass in each slice (beyond this are nans... | mass, age, feh are *single values* at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of mass
ages is grid of ages
fehs is grid of fehs
grid_Ns keeps track of nmass in each slice (beyond this are nans)
fix situation where th... | [
"mass",
"age",
"feh",
"are",
"*",
"single",
"values",
"*",
"at",
"which",
"values",
"are",
"desired",
"icol",
"is",
"the",
"column",
"index",
"of",
"desired",
"value",
"grid",
"is",
"nfeh",
"x",
"nage",
"x",
"max",
"(",
"nmass",
")",
"x",
"ncols",
"a... | def interp_value(mass, age, feh, icol,
grid, mass_col, ages, fehs, grid_Ns, debug):
if np.isnan(mass) or np.isnan(age) or np.isnan(feh):
return np.nan
Nage = len(ages)
Nfeh = len(fehs)
ifeh = searchsorted(fehs, Nfeh, feh)
iage = searchsorted(ages, Nage, age)
if ifeh==0 o... | [
"def",
"interp_value",
"(",
"mass",
",",
"age",
",",
"feh",
",",
"icol",
",",
"grid",
",",
"mass_col",
",",
"ages",
",",
"fehs",
",",
"grid_Ns",
",",
"debug",
")",
":",
"if",
"np",
".",
"isnan",
"(",
"mass",
")",
"or",
"np",
".",
"isnan",
"(",
... | mass, age, feh are *single values* at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of mass
ages is grid of ages
fehs is grid of fehs
grid_Ns keeps track of nmass in each slice (beyond this are nans) | [
"mass",
"age",
"feh",
"are",
"*",
"single",
"values",
"*",
"at",
"which",
"values",
"are",
"desired",
"icol",
"is",
"the",
"column",
"index",
"of",
"desired",
"value",
"grid",
"is",
"nfeh",
"x",
"nage",
"x",
"max",
"(",
"nmass",
")",
"x",
"ncols",
"a... | [
"# return_box):",
"\"\"\"mass, age, feh are *single values* at which values are desired\n\n icol is the column index of desired value\n grid is nfeh x nage x max(nmass) x ncols array\n mass_col is the column index of mass\n ages is grid of ages\n fehs is grid of fehs\n grid_Ns keeps track of nma... | [
{
"param": "mass",
"type": null
},
{
"param": "age",
"type": null
},
{
"param": "feh",
"type": null
},
{
"param": "icol",
"type": null
},
{
"param": "grid",
"type": null
},
{
"param": "mass_col",
"type": null
},
{
"param": "ages",
"type... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mass",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "age",
"type": null,
"docstring": null,
"docstring_tokens": []... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | from_ini | <not_specific> | def from_ini(cls, ic, folder='.', ini_file='star.ini'):
"""
Initialize a StarModel from a .ini file
File should contain all arguments with which to initialize
StarModel.
"""
if not os.path.isabs(ini_file):
ini_file = os.path.join(folder,ini_file)
c... |
Initialize a StarModel from a .ini file
File should contain all arguments with which to initialize
StarModel.
| Initialize a StarModel from a .ini file
File should contain all arguments with which to initialize
StarModel. | [
"Initialize",
"a",
"StarModel",
"from",
"a",
".",
"ini",
"file",
"File",
"should",
"contain",
"all",
"arguments",
"with",
"which",
"to",
"initialize",
"StarModel",
"."
] | def from_ini(cls, ic, folder='.', ini_file='star.ini'):
if not os.path.isabs(ini_file):
ini_file = os.path.join(folder,ini_file)
config = ConfigObj(ini_file)
kwargs = {}
for kw in config.keys():
try:
kwargs[kw] = float(config[kw])
excep... | [
"def",
"from_ini",
"(",
"cls",
",",
"ic",
",",
"folder",
"=",
"'.'",
",",
"ini_file",
"=",
"'star.ini'",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"ini_file",
")",
":",
"ini_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"fol... | Initialize a StarModel from a .ini file
File should contain all arguments with which to initialize
StarModel. | [
"Initialize",
"a",
"StarModel",
"from",
"a",
".",
"ini",
"file",
"File",
"should",
"contain",
"all",
"arguments",
"with",
"which",
"to",
"initialize",
"StarModel",
"."
] | [
"\"\"\"\n Initialize a StarModel from a .ini file\n\n File should contain all arguments with which to initialize\n StarModel. \n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "ic",
"type": null
},
{
"param": "folder",
"type": null
},
{
"param": "ini_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ic",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | _clean_props | null | def _clean_props(self):
"""
Makes sure all properties are legit for isochrone.
Not done in __init__ in order to save speed on loading.
"""
remove = []
for p in self.properties.keys():
if not hasattr(self.ic, p) and \
p not in self.ic.bands and p... |
Makes sure all properties are legit for isochrone.
Not done in __init__ in order to save speed on loading.
| Makes sure all properties are legit for isochrone.
Not done in __init__ in order to save speed on loading. | [
"Makes",
"sure",
"all",
"properties",
"are",
"legit",
"for",
"isochrone",
".",
"Not",
"done",
"in",
"__init__",
"in",
"order",
"to",
"save",
"speed",
"on",
"loading",
"."
] | def _clean_props(self):
remove = []
for p in self.properties.keys():
if not hasattr(self.ic, p) and \
p not in self.ic.bands and p not in ['parallax','feh','age','mass_B','mass_C'] and \
not re.search('delta_',p):
remove.append(p)
for p in ... | [
"def",
"_clean_props",
"(",
"self",
")",
":",
"remove",
"=",
"[",
"]",
"for",
"p",
"in",
"self",
".",
"properties",
".",
"keys",
"(",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
".",
"ic",
",",
"p",
")",
"and",
"p",
"not",
"in",
"self",
".",... | Makes sure all properties are legit for isochrone. | [
"Makes",
"sure",
"all",
"properties",
"are",
"legit",
"for",
"isochrone",
"."
] | [
"\"\"\"\n Makes sure all properties are legit for isochrone.\n\n Not done in __init__ in order to save speed on loading.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | lnlike | <not_specific> | def lnlike(self, p):
"""Log-likelihood of model at given parameters
:param p:
mass, log10(age), feh, [distance, A_V (extinction)].
Final two should only be provided if ``self.fit_for_distance``
is ``True``; that is, apparent magnitudes are provided.
... | Log-likelihood of model at given parameters
:param p:
mass, log10(age), feh, [distance, A_V (extinction)].
Final two should only be provided if ``self.fit_for_distance``
is ``True``; that is, apparent magnitudes are provided.
:return:
... | Log-likelihood of model at given parameters | [
"Log",
"-",
"likelihood",
"of",
"model",
"at",
"given",
"parameters"
] | def lnlike(self, p):
if not self._props_cleaned:
self._clean_props()
if not self.use_emcee:
fit_for_distance = True
mass, age, feh, dist, AV = (p[0], p[1], p[2], p[3], p[4])
else:
if len(p)==5:
fit_for_distance = True
... | [
"def",
"lnlike",
"(",
"self",
",",
"p",
")",
":",
"if",
"not",
"self",
".",
"_props_cleaned",
":",
"self",
".",
"_clean_props",
"(",
")",
"if",
"not",
"self",
".",
"use_emcee",
":",
"fit_for_distance",
"=",
"True",
"mass",
",",
"age",
",",
"feh",
","... | Log-likelihood of model at given parameters | [
"Log",
"-",
"likelihood",
"of",
"model",
"at",
"given",
"parameters"
] | [
"\"\"\"Log-likelihood of model at given parameters\n\n \n :param p: \n mass, log10(age), feh, [distance, A_V (extinction)].\n Final two should only be provided if ``self.fit_for_distance``\n is ``True``; that is, apparent magnitudes are provided.\n \n ... | [
{
"param": "self",
"type": null
},
{
"param": "p",
"type": null
}
] | {
"returns": [
{
"docstring": "log-likelihood. Will be -np.inf if values out of range.",
"docstring_tokens": [
"log",
"-",
"likelihood",
".",
"Will",
"be",
"-",
"np",
".",
"inf",
"if",
"values",
"o... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | lnprior | <not_specific> | def lnprior(self, mass, age, feh,
distance=None, AV=None,
use_local_fehprior=True):
"""
log-prior for model parameters
"""
mass_prior = salpeter_prior(mass)
if mass_prior==0:
mass_lnprior = -np.inf
else:
ma... |
log-prior for model parameters
| log-prior for model parameters | [
"log",
"-",
"prior",
"for",
"model",
"parameters"
] | def lnprior(self, mass, age, feh,
distance=None, AV=None,
use_local_fehprior=True):
mass_prior = salpeter_prior(mass)
if mass_prior==0:
mass_lnprior = -np.inf
else:
mass_lnprior = np.log(mass_prior)
if np.isnan(mass_lnprior):
... | [
"def",
"lnprior",
"(",
"self",
",",
"mass",
",",
"age",
",",
"feh",
",",
"distance",
"=",
"None",
",",
"AV",
"=",
"None",
",",
"use_local_fehprior",
"=",
"True",
")",
":",
"mass_prior",
"=",
"salpeter_prior",
"(",
"mass",
")",
"if",
"mass_prior",
"==",... | log-prior for model parameters | [
"log",
"-",
"prior",
"for",
"model",
"parameters"
] | [
"\"\"\"\n log-prior for model parameters\n \n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "mass",
"type": null
},
{
"param": "age",
"type": null
},
{
"param": "feh",
"type": null
},
{
"param": "distance",
"type": null
},
{
"param": "AV",
"type": null
},
{
"param": "use_local_fehprior... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mass",
"type": null,
"docstring": null,
"docstring_tokens": [... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | lnpost | <not_specific> | def lnpost(self, p, use_local_fehprior=True):
"""
log-posterior of model at given parameters
"""
if not self.use_emcee:
mass, age, feh, dist, AV = (p[0], p[1], p[2], p[3], p[4])
else:
if len(p)==5:
fit_for_distance = True
ma... |
log-posterior of model at given parameters
| log-posterior of model at given parameters | [
"log",
"-",
"posterior",
"of",
"model",
"at",
"given",
"parameters"
] | def lnpost(self, p, use_local_fehprior=True):
if not self.use_emcee:
mass, age, feh, dist, AV = (p[0], p[1], p[2], p[3], p[4])
else:
if len(p)==5:
fit_for_distance = True
mass,age,feh,dist,AV = p
elif len(p)==3:
fit_for_... | [
"def",
"lnpost",
"(",
"self",
",",
"p",
",",
"use_local_fehprior",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"use_emcee",
":",
"mass",
",",
"age",
",",
"feh",
",",
"dist",
",",
"AV",
"=",
"(",
"p",
"[",
"0",
"]",
",",
"p",
"[",
"1",
"]... | log-posterior of model at given parameters | [
"log",
"-",
"posterior",
"of",
"model",
"at",
"given",
"parameters"
] | [
"\"\"\"\n log-posterior of model at given parameters\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "p",
"type": null
},
{
"param": "use_local_fehprior",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "p",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | maxlike | <not_specific> | def maxlike(self,nseeds=50):
"""Returns the best-fit parameters, choosing the best of multiple starting guesses
:param nseeds: (optional)
Number of starting guesses, uniformly distributed throughout
allowed ranges. Default=50.
:return:
list of best-fit para... | Returns the best-fit parameters, choosing the best of multiple starting guesses
:param nseeds: (optional)
Number of starting guesses, uniformly distributed throughout
allowed ranges. Default=50.
:return:
list of best-fit parameters: ``[m,age,feh,[distance,A_V]]``.
... | Returns the best-fit parameters, choosing the best of multiple starting guesses | [
"Returns",
"the",
"best",
"-",
"fit",
"parameters",
"choosing",
"the",
"best",
"of",
"multiple",
"starting",
"guesses"
] | def maxlike(self,nseeds=50):
m0,age0,feh0 = self.ic.random_points(nseeds)
d0 = 10**(rand.uniform(0,np.log10(self.max_distance),size=nseeds))
AV0 = rand.uniform(0,self.maxAV,size=nseeds)
costs = np.zeros(nseeds)
if self.fit_for_distance:
pfits = np.zeros((nseeds,5))
... | [
"def",
"maxlike",
"(",
"self",
",",
"nseeds",
"=",
"50",
")",
":",
"m0",
",",
"age0",
",",
"feh0",
"=",
"self",
".",
"ic",
".",
"random_points",
"(",
"nseeds",
")",
"d0",
"=",
"10",
"**",
"(",
"rand",
".",
"uniform",
"(",
"0",
",",
"np",
".",
... | Returns the best-fit parameters, choosing the best of multiple starting guesses | [
"Returns",
"the",
"best",
"-",
"fit",
"parameters",
"choosing",
"the",
"best",
"of",
"multiple",
"starting",
"guesses"
] | [
"\"\"\"Returns the best-fit parameters, choosing the best of multiple starting guesses\n\n :param nseeds: (optional)\n Number of starting guesses, uniformly distributed throughout\n allowed ranges. Default=50.\n\n :return:\n list of best-fit parameters: ``[m,age,feh,[... | [
{
"param": "self",
"type": null
},
{
"param": "nseeds",
"type": null
}
] | {
"returns": [
{
"docstring": "list of best-fit parameters: ``[m,age,feh,[distance,A_V]]``.\nNote that distance and A_V values will be meaningless unless\nmagnitudes are present in ``self.properties``.",
"docstring_tokens": [
"list",
"of",
"best",
"-",
"fit",
... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | mnest_prior | null | def mnest_prior(self, cube, ndim, nparams):
"""
Transforms unit cube into parameter cube.
Parameters if running multinest must be mass, age, feh, distance, AV.
"""
cube[0] = (self.ic.maxmass - self.ic.minmass)*cube[0] + self.ic.minmass
cube[1] = (self.ic.maxage - self.ic... |
Transforms unit cube into parameter cube.
Parameters if running multinest must be mass, age, feh, distance, AV.
| Transforms unit cube into parameter cube.
Parameters if running multinest must be mass, age, feh, distance, AV. | [
"Transforms",
"unit",
"cube",
"into",
"parameter",
"cube",
".",
"Parameters",
"if",
"running",
"multinest",
"must",
"be",
"mass",
"age",
"feh",
"distance",
"AV",
"."
] | def mnest_prior(self, cube, ndim, nparams):
cube[0] = (self.ic.maxmass - self.ic.minmass)*cube[0] + self.ic.minmass
cube[1] = (self.ic.maxage - self.ic.minage)*cube[1] + self.ic.minage
cube[2] = (self.ic.maxfeh - self.ic.minfeh)*cube[2] + self.ic.minfeh
cube[3] = cube[3]*self.max_distanc... | [
"def",
"mnest_prior",
"(",
"self",
",",
"cube",
",",
"ndim",
",",
"nparams",
")",
":",
"cube",
"[",
"0",
"]",
"=",
"(",
"self",
".",
"ic",
".",
"maxmass",
"-",
"self",
".",
"ic",
".",
"minmass",
")",
"*",
"cube",
"[",
"0",
"]",
"+",
"self",
"... | Transforms unit cube into parameter cube. | [
"Transforms",
"unit",
"cube",
"into",
"parameter",
"cube",
"."
] | [
"\"\"\"\n Transforms unit cube into parameter cube.\n\n Parameters if running multinest must be mass, age, feh, distance, AV.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "cube",
"type": null
},
{
"param": "ndim",
"type": null
},
{
"param": "nparams",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cube",
"type": null,
"docstring": null,
"docstring_tokens": [... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | fit_multinest | null | def fit_multinest(self, n_live_points=1000, basename='chains/single-',
verbose=True, refit=False, overwrite=False,
**kwargs):
"""
Fits model using MultiNest, via pymultinest.
:param n_live_points:
Number of live points to use for MultiNe... |
Fits model using MultiNest, via pymultinest.
:param n_live_points:
Number of live points to use for MultiNest fit.
:param basename:
Where the MulitNest-generated files will live.
By default this will be in a folder named `chains`
in the curr... | Fits model using MultiNest, via pymultinest. | [
"Fits",
"model",
"using",
"MultiNest",
"via",
"pymultinest",
"."
] | def fit_multinest(self, n_live_points=1000, basename='chains/single-',
verbose=True, refit=False, overwrite=False,
**kwargs):
folder = os.path.abspath(os.path.dirname(basename))
if not os.path.exists(folder):
os.makedirs(folder)
prop_nomatc... | [
"def",
"fit_multinest",
"(",
"self",
",",
"n_live_points",
"=",
"1000",
",",
"basename",
"=",
"'chains/single-'",
",",
"verbose",
"=",
"True",
",",
"refit",
"=",
"False",
",",
"overwrite",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"folder",
"=",
"os",... | Fits model using MultiNest, via pymultinest. | [
"Fits",
"model",
"using",
"MultiNest",
"via",
"pymultinest",
"."
] | [
"\"\"\"\n Fits model using MultiNest, via pymultinest. \n\n :param n_live_points:\n Number of live points to use for MultiNest fit.\n\n :param basename:\n Where the MulitNest-generated files will live. \n By default this will be in a folder named `chains`\n ... | [
{
"param": "self",
"type": null
},
{
"param": "n_live_points",
"type": null
},
{
"param": "basename",
"type": null
},
{
"param": "verbose",
"type": null
},
{
"param": "refit",
"type": null
},
{
"param": "overwrite",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "n_live_points",
"type": null,
"docstring": "Number of live points t... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | mnest_analyzer | <not_specific> | def mnest_analyzer(self):
"""
PyMultiNest Analyzer object associated with fit.
See PyMultiNest documentation for more.
"""
return pymultinest.Analyzer(self.n_params, self._mnest_basename) |
PyMultiNest Analyzer object associated with fit.
See PyMultiNest documentation for more.
| PyMultiNest Analyzer object associated with fit.
See PyMultiNest documentation for more. | [
"PyMultiNest",
"Analyzer",
"object",
"associated",
"with",
"fit",
".",
"See",
"PyMultiNest",
"documentation",
"for",
"more",
"."
] | def mnest_analyzer(self):
return pymultinest.Analyzer(self.n_params, self._mnest_basename) | [
"def",
"mnest_analyzer",
"(",
"self",
")",
":",
"return",
"pymultinest",
".",
"Analyzer",
"(",
"self",
".",
"n_params",
",",
"self",
".",
"_mnest_basename",
")"
] | PyMultiNest Analyzer object associated with fit. | [
"PyMultiNest",
"Analyzer",
"object",
"associated",
"with",
"fit",
"."
] | [
"\"\"\"\n PyMultiNest Analyzer object associated with fit. \n\n See PyMultiNest documentation for more.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | fit_mcmc | <not_specific> | def fit_mcmc(self,nwalkers=300,nburn=200,niter=100,
p0=None,initial_burn=None,
ninitial=100, loglike_kwargs=None,
**kwargs):
"""Fits stellar model using MCMC.
:param nwalkers: (optional)
Number of walkers to pass to :class:`emcee.EnsembleSa... | Fits stellar model using MCMC.
:param nwalkers: (optional)
Number of walkers to pass to :class:`emcee.EnsembleSampler`.
Default is 200.
:param nburn: (optional)
Number of iterations for "burn-in." Default is 100.
:param niter: (optional)
Number... | Fits stellar model using MCMC. | [
"Fits",
"stellar",
"model",
"using",
"MCMC",
"."
] | def fit_mcmc(self,nwalkers=300,nburn=200,niter=100,
p0=None,initial_burn=None,
ninitial=100, loglike_kwargs=None,
**kwargs):
if self._samples is not None:
self._samples = None
if self.fit_for_distance:
npars = 5
if in... | [
"def",
"fit_mcmc",
"(",
"self",
",",
"nwalkers",
"=",
"300",
",",
"nburn",
"=",
"200",
",",
"niter",
"=",
"100",
",",
"p0",
"=",
"None",
",",
"initial_burn",
"=",
"None",
",",
"ninitial",
"=",
"100",
",",
"loglike_kwargs",
"=",
"None",
",",
"**",
"... | Fits stellar model using MCMC. | [
"Fits",
"stellar",
"model",
"using",
"MCMC",
"."
] | [
"\"\"\"Fits stellar model using MCMC.\n\n :param nwalkers: (optional)\n Number of walkers to pass to :class:`emcee.EnsembleSampler`.\n Default is 200.\n\n :param nburn: (optional)\n Number of iterations for \"burn-in.\" Default is 100.\n\n :param niter: (option... | [
{
"param": "self",
"type": null
},
{
"param": "nwalkers",
"type": null
},
{
"param": "nburn",
"type": null
},
{
"param": "niter",
"type": null
},
{
"param": "p0",
"type": null
},
{
"param": "initial_burn",
"type": null
},
{
"param": "niniti... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | triangle_plots | <not_specific> | def triangle_plots(self, basename=None, format='png',
**kwargs):
"""Returns two triangle plots, one with physical params, one observational
:param basename:
If basename is provided, then plots will be saved as
"[basename]_physical.[format]" and "[basename]... | Returns two triangle plots, one with physical params, one observational
:param basename:
If basename is provided, then plots will be saved as
"[basename]_physical.[format]" and "[basename]_observed.[format]"
:param format:
Format in which to save figures (e.g., 'png... | Returns two triangle plots, one with physical params, one observational | [
"Returns",
"two",
"triangle",
"plots",
"one",
"with",
"physical",
"params",
"one",
"observational"
] | def triangle_plots(self, basename=None, format='png',
**kwargs):
if self.fit_for_distance:
fig1 = self.triangle(plot_datapoints=False,
params=['mass','radius','Teff','logg','feh','age',
'distance','AV'],... | [
"def",
"triangle_plots",
"(",
"self",
",",
"basename",
"=",
"None",
",",
"format",
"=",
"'png'",
",",
"**",
"kwargs",
")",
":",
"if",
"self",
".",
"fit_for_distance",
":",
"fig1",
"=",
"self",
".",
"triangle",
"(",
"plot_datapoints",
"=",
"False",
",",
... | Returns two triangle plots, one with physical params, one observational | [
"Returns",
"two",
"triangle",
"plots",
"one",
"with",
"physical",
"params",
"one",
"observational"
] | [
"\"\"\"Returns two triangle plots, one with physical params, one observational\n\n :param basename:\n If basename is provided, then plots will be saved as\n \"[basename]_physical.[format]\" and \"[basename]_observed.[format]\"\n\n :param format:\n Format in which to sa... | [
{
"param": "self",
"type": null
},
{
"param": "basename",
"type": null
},
{
"param": "format",
"type": null
}
] | {
"returns": [
{
"docstring": "Physical parameters triangle plot (mass, radius, Teff, feh, age, distance)\nObserved properties triangle plot.",
"docstring_tokens": [
"Physical",
"parameters",
"triangle",
"plot",
"(",
"mass",
"radius",
"Te... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | triangle | <not_specific> | def triangle(self, params=None, query=None, extent=0.999,
**kwargs):
"""
Makes a nifty corner plot.
Uses :func:`triangle.corner`.
:param params: (optional)
Names of columns (from :attr:`StarModel.samples`)
to plot. If ``None``, then it will plo... |
Makes a nifty corner plot.
Uses :func:`triangle.corner`.
:param params: (optional)
Names of columns (from :attr:`StarModel.samples`)
to plot. If ``None``, then it will plot samples
of the parameters used in the MCMC fit-- that is,
mass, age, [F... | Makes a nifty corner plot. | [
"Makes",
"a",
"nifty",
"corner",
"plot",
"."
] | def triangle(self, params=None, query=None, extent=0.999,
**kwargs):
if triangle is None:
raise ImportError('please run "pip install triangle_plot".')
if params is None:
if self.fit_for_distance:
params = ['mass', 'age', 'feh', 'distance', 'AV']
... | [
"def",
"triangle",
"(",
"self",
",",
"params",
"=",
"None",
",",
"query",
"=",
"None",
",",
"extent",
"=",
"0.999",
",",
"**",
"kwargs",
")",
":",
"if",
"triangle",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"'please run \"pip install triangle_plot\".'"... | Makes a nifty corner plot. | [
"Makes",
"a",
"nifty",
"corner",
"plot",
"."
] | [
"\"\"\"\n Makes a nifty corner plot.\n\n Uses :func:`triangle.corner`.\n\n :param params: (optional)\n Names of columns (from :attr:`StarModel.samples`)\n to plot. If ``None``, then it will plot samples\n of the parameters used in the MCMC fit-- that is,\n ... | [
{
"param": "self",
"type": null
},
{
"param": "params",
"type": null
},
{
"param": "query",
"type": null
},
{
"param": "extent",
"type": null
}
] | {
"returns": [
{
"docstring": "Figure oject containing corner plot.",
"docstring_tokens": [
"Figure",
"oject",
"containing",
"corner",
"plot",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | prop_triangle | <not_specific> | def prop_triangle(self, **kwargs):
"""
Makes corner plot of only observable properties.
The idea here is to compare the predictions of the samples
with the actual observed data---this can be a quick way to check
if there are outlier properties that aren't predicted well
... |
Makes corner plot of only observable properties.
The idea here is to compare the predictions of the samples
with the actual observed data---this can be a quick way to check
if there are outlier properties that aren't predicted well
by the model.
:param **kwargs:
... | Makes corner plot of only observable properties.
The idea here is to compare the predictions of the samples
with the actual observed data---this can be a quick way to check
if there are outlier properties that aren't predicted well
by the model. | [
"Makes",
"corner",
"plot",
"of",
"only",
"observable",
"properties",
".",
"The",
"idea",
"here",
"is",
"to",
"compare",
"the",
"predictions",
"of",
"the",
"samples",
"with",
"the",
"actual",
"observed",
"data",
"---",
"this",
"can",
"be",
"a",
"quick",
"wa... | def prop_triangle(self, **kwargs):
truths = []
params = []
for p in self.properties:
try:
val, err = self.properties[p]
except:
continue
if p in self.ic.bands:
params.append('{}_mag'.format(p))
tr... | [
"def",
"prop_triangle",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"truths",
"=",
"[",
"]",
"params",
"=",
"[",
"]",
"for",
"p",
"in",
"self",
".",
"properties",
":",
"try",
":",
"val",
",",
"err",
"=",
"self",
".",
"properties",
"[",
"p",
"]",
... | Makes corner plot of only observable properties. | [
"Makes",
"corner",
"plot",
"of",
"only",
"observable",
"properties",
"."
] | [
"\"\"\"\n Makes corner plot of only observable properties.\n\n The idea here is to compare the predictions of the samples\n with the actual observed data---this can be a quick way to check\n if there are outlier properties that aren't predicted well\n by the model.\n\n :par... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "Figure object containing corner plot.",
"docstring_tokens": [
"Figure",
"object",
"containing",
"corner",
"plot",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | prop_samples | <not_specific> | def prop_samples(self,prop,return_values=True,conf=0.683):
"""Returns samples of given property, based on MCMC sampling
:param prop:
Name of desired property. Must be column of ``self.samples``.
:param return_values: (optional)
If ``True`` (default), then also return (... | Returns samples of given property, based on MCMC sampling
:param prop:
Name of desired property. Must be column of ``self.samples``.
:param return_values: (optional)
If ``True`` (default), then also return (median, lo_err, hi_err)
corresponding to desired credible ... | Returns samples of given property, based on MCMC sampling | [
"Returns",
"samples",
"of",
"given",
"property",
"based",
"on",
"MCMC",
"sampling"
] | def prop_samples(self,prop,return_values=True,conf=0.683):
samples = self.samples[prop].values
if return_values:
sorted = np.sort(samples)
med = np.median(samples)
n = len(samples)
lo_ind = int(n*(0.5 - conf/2))
hi_ind = int(n*(0.5 + conf/2))
... | [
"def",
"prop_samples",
"(",
"self",
",",
"prop",
",",
"return_values",
"=",
"True",
",",
"conf",
"=",
"0.683",
")",
":",
"samples",
"=",
"self",
".",
"samples",
"[",
"prop",
"]",
".",
"values",
"if",
"return_values",
":",
"sorted",
"=",
"np",
".",
"s... | Returns samples of given property, based on MCMC sampling | [
"Returns",
"samples",
"of",
"given",
"property",
"based",
"on",
"MCMC",
"sampling"
] | [
"\"\"\"Returns samples of given property, based on MCMC sampling\n\n :param prop:\n Name of desired property. Must be column of ``self.samples``.\n\n :param return_values: (optional)\n If ``True`` (default), then also return (median, lo_err, hi_err)\n corresponding to... | [
{
"param": "self",
"type": null
},
{
"param": "prop",
"type": null
},
{
"param": "return_values",
"type": null
},
{
"param": "conf",
"type": null
}
] | {
"returns": [
{
"docstring": ":class:`np.ndarray` of desired samples",
"docstring_tokens": [
":",
"class",
":",
"`",
"np",
".",
"ndarray",
"`",
"of",
"desired",
"samples"
],
"type": null
},
{
... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | save_hdf | null | def save_hdf(self, filename, path='', overwrite=False, append=False):
"""Saves object data to HDF file (only works if MCMC is run)
Samples are saved to /samples location under given path,
and object properties are also attached, so suitable for
re-loading via :func:`StarModel.load_hdf`.... | Saves object data to HDF file (only works if MCMC is run)
Samples are saved to /samples location under given path,
and object properties are also attached, so suitable for
re-loading via :func:`StarModel.load_hdf`.
:param filename:
Name of file to save to. Should b... | Saves object data to HDF file (only works if MCMC is run)
Samples are saved to /samples location under given path,
and object properties are also attached, so suitable for
re-loading via :func:`StarModel.load_hdf`. | [
"Saves",
"object",
"data",
"to",
"HDF",
"file",
"(",
"only",
"works",
"if",
"MCMC",
"is",
"run",
")",
"Samples",
"are",
"saved",
"to",
"/",
"samples",
"location",
"under",
"given",
"path",
"and",
"object",
"properties",
"are",
"also",
"attached",
"so",
"... | def save_hdf(self, filename, path='', overwrite=False, append=False):
if os.path.exists(filename):
store = pd.HDFStore(filename)
if path in store:
store.close()
if overwrite:
os.remove(filename)
elif not append:
... | [
"def",
"save_hdf",
"(",
"self",
",",
"filename",
",",
"path",
"=",
"''",
",",
"overwrite",
"=",
"False",
",",
"append",
"=",
"False",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"store",
"=",
"pd",
".",
"HDFStore",
... | Saves object data to HDF file (only works if MCMC is run)
Samples are saved to /samples location under given path,
and object properties are also attached, so suitable for
re-loading via :func:`StarModel.load_hdf`. | [
"Saves",
"object",
"data",
"to",
"HDF",
"file",
"(",
"only",
"works",
"if",
"MCMC",
"is",
"run",
")",
"Samples",
"are",
"saved",
"to",
"/",
"samples",
"location",
"under",
"given",
"path",
"and",
"object",
"properties",
"are",
"also",
"attached",
"so",
"... | [
"\"\"\"Saves object data to HDF file (only works if MCMC is run)\n\n Samples are saved to /samples location under given path,\n and object properties are also attached, so suitable for\n re-loading via :func:`StarModel.load_hdf`.\n \n :param filename:\n Name of file to ... | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "overwrite",
"type": null
},
{
"param": "append",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": "Name of file to save to. Sh... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | load_hdf | <not_specific> | def load_hdf(cls, filename, path='', name=None):
"""
A class method to load a saved StarModel from an HDF5 file.
File must have been created by a call to :func:`StarModel.save_hdf`.
:param filename:
H5 file to load.
:param path: (optional)
Path within H... |
A class method to load a saved StarModel from an HDF5 file.
File must have been created by a call to :func:`StarModel.save_hdf`.
:param filename:
H5 file to load.
:param path: (optional)
Path within HDF file.
:return:
:class:`StarModel` ob... | A class method to load a saved StarModel from an HDF5 file.
File must have been created by a call to :func:`StarModel.save_hdf`. | [
"A",
"class",
"method",
"to",
"load",
"a",
"saved",
"StarModel",
"from",
"an",
"HDF5",
"file",
".",
"File",
"must",
"have",
"been",
"created",
"by",
"a",
"call",
"to",
":",
"func",
":",
"`",
"StarModel",
".",
"save_hdf",
"`",
"."
] | def load_hdf(cls, filename, path='', name=None):
store = pd.HDFStore(filename)
try:
samples = store['{}/samples'.format(path)]
attrs = store.get_storer('{}/samples'.format(path)).attrs
except:
store.close()
raise
properties = attrs.... | [
"def",
"load_hdf",
"(",
"cls",
",",
"filename",
",",
"path",
"=",
"''",
",",
"name",
"=",
"None",
")",
":",
"store",
"=",
"pd",
".",
"HDFStore",
"(",
"filename",
")",
"try",
":",
"samples",
"=",
"store",
"[",
"'{}/samples'",
".",
"format",
"(",
"pa... | A class method to load a saved StarModel from an HDF5 file. | [
"A",
"class",
"method",
"to",
"load",
"a",
"saved",
"StarModel",
"from",
"an",
"HDF5",
"file",
"."
] | [
"\"\"\"\n A class method to load a saved StarModel from an HDF5 file.\n\n File must have been created by a call to :func:`StarModel.save_hdf`.\n\n :param filename:\n H5 file to load.\n\n :param path: (optional)\n Path within HDF file.\n\n :return:\n ... | [
{
"param": "cls",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | lnlike | <not_specific> | def lnlike(self, p):
"""Log-likelihood of model at given parameters
:param p:
mass_A, mass_B, log10(age), feh, [distance, A_V (extinction)].
Final two should only be provided if ``self.fit_for_distance``
is ``True``; that is, apparent magnitudes are provide... | Log-likelihood of model at given parameters
:param p:
mass_A, mass_B, log10(age), feh, [distance, A_V (extinction)].
Final two should only be provided if ``self.fit_for_distance``
is ``True``; that is, apparent magnitudes are provided.
:return:... | Log-likelihood of model at given parameters | [
"Log",
"-",
"likelihood",
"of",
"model",
"at",
"given",
"parameters"
] | def lnlike(self, p):
if not self._props_cleaned:
self._clean_props()
if not self.use_emcee:
fit_for_distance = True
mass_A, mass_B, age, feh, dist, AV = (p[0], p[1], p[2],
p[3], p[4], p[5])
else:
if... | [
"def",
"lnlike",
"(",
"self",
",",
"p",
")",
":",
"if",
"not",
"self",
".",
"_props_cleaned",
":",
"self",
".",
"_clean_props",
"(",
")",
"if",
"not",
"self",
".",
"use_emcee",
":",
"fit_for_distance",
"=",
"True",
"mass_A",
",",
"mass_B",
",",
"age",
... | Log-likelihood of model at given parameters | [
"Log",
"-",
"likelihood",
"of",
"model",
"at",
"given",
"parameters"
] | [
"\"\"\"Log-likelihood of model at given parameters\n\n \n :param p: \n mass_A, mass_B, log10(age), feh, [distance, A_V (extinction)].\n Final two should only be provided if ``self.fit_for_distance``\n is ``True``; that is, apparent magnitudes are provided.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "p",
"type": null
}
] | {
"returns": [
{
"docstring": "log-likelihood. Will be -np.inf if values out of range.",
"docstring_tokens": [
"log",
"-",
"likelihood",
".",
"Will",
"be",
"-",
"np",
".",
"inf",
"if",
"values",
"o... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | maxlike | <not_specific> | def maxlike(self,nseeds=50):
"""Returns the best-fit parameters, choosing the best of multiple starting guesses
:param nseeds: (optional)
Number of starting guesses, uniformly distributed throughout
allowed ranges. Default=50.
:return:
list of best-fit para... | Returns the best-fit parameters, choosing the best of multiple starting guesses
:param nseeds: (optional)
Number of starting guesses, uniformly distributed throughout
allowed ranges. Default=50.
:return:
list of best-fit parameters: ``[mA,mB,age,feh,[distance,A_V]]... | Returns the best-fit parameters, choosing the best of multiple starting guesses | [
"Returns",
"the",
"best",
"-",
"fit",
"parameters",
"choosing",
"the",
"best",
"of",
"multiple",
"starting",
"guesses"
] | def maxlike(self,nseeds=50):
mA_0,age0,feh0 = self.ic.random_points(nseeds)
mB_0,foo1,foo2 = self.ic.random_points(nseeds)
mA_fixed = np.maximum(mA_0,mB_0)
mB_fixed = np.minimum(mA_0,mB_0)
mA_0, mB_0 = (mA_fixed, mB_fixed)
d0 = 10**(rand.uniform(0,np.log10(self.max_distan... | [
"def",
"maxlike",
"(",
"self",
",",
"nseeds",
"=",
"50",
")",
":",
"mA_0",
",",
"age0",
",",
"feh0",
"=",
"self",
".",
"ic",
".",
"random_points",
"(",
"nseeds",
")",
"mB_0",
",",
"foo1",
",",
"foo2",
"=",
"self",
".",
"ic",
".",
"random_points",
... | Returns the best-fit parameters, choosing the best of multiple starting guesses | [
"Returns",
"the",
"best",
"-",
"fit",
"parameters",
"choosing",
"the",
"best",
"of",
"multiple",
"starting",
"guesses"
] | [
"\"\"\"Returns the best-fit parameters, choosing the best of multiple starting guesses\n\n :param nseeds: (optional)\n Number of starting guesses, uniformly distributed throughout\n allowed ranges. Default=50.\n\n :return:\n list of best-fit parameters: ``[mA,mB,age,f... | [
{
"param": "self",
"type": null
},
{
"param": "nseeds",
"type": null
}
] | {
"returns": [
{
"docstring": "list of best-fit parameters: ``[mA,mB,age,feh,[distance,A_V]]``.\nNote that distance and A_V values will be meaningless unless\nmagnitudes are present in ``self.properties``.",
"docstring_tokens": [
"list",
"of",
"best",
"-",
"fit"... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | fit_mcmc | <not_specific> | def fit_mcmc(self,nwalkers=200,nburn=100,niter=200,
p0=None,initial_burn=None,
ninitial=100, loglike_kwargs=None,
**kwargs):
"""Fits stellar model using MCMC.
See :func:`StarModel.fit_mcmc`
"""
#clear any saved _samples
if self... | Fits stellar model using MCMC.
See :func:`StarModel.fit_mcmc`
| Fits stellar model using MCMC. | [
"Fits",
"stellar",
"model",
"using",
"MCMC",
"."
] | def fit_mcmc(self,nwalkers=200,nburn=100,niter=200,
p0=None,initial_burn=None,
ninitial=100, loglike_kwargs=None,
**kwargs):
if self._samples is not None:
self._samples = None
if self.fit_for_distance:
npars = 6
if in... | [
"def",
"fit_mcmc",
"(",
"self",
",",
"nwalkers",
"=",
"200",
",",
"nburn",
"=",
"100",
",",
"niter",
"=",
"200",
",",
"p0",
"=",
"None",
",",
"initial_burn",
"=",
"None",
",",
"ninitial",
"=",
"100",
",",
"loglike_kwargs",
"=",
"None",
",",
"**",
"... | Fits stellar model using MCMC. | [
"Fits",
"stellar",
"model",
"using",
"MCMC",
"."
] | [
"\"\"\"Fits stellar model using MCMC.\n\n See :func:`StarModel.fit_mcmc`\n \"\"\"",
"#clear any saved _samples",
"#ninitial = 300 #should this be parameter?",
"#reset p0"
] | [
{
"param": "self",
"type": null
},
{
"param": "nwalkers",
"type": null
},
{
"param": "nburn",
"type": null
},
{
"param": "niter",
"type": null
},
{
"param": "p0",
"type": null
},
{
"param": "initial_burn",
"type": null
},
{
"param": "niniti... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nwalkers",
"type": null,
"docstring": null,
"docstring_tokens... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | triangle_plots | <not_specific> | def triangle_plots(self, basename=None, format='png',
**kwargs):
"""Returns two triangle plots, one with physical params, one observational
:param basename:
If basename is provided, then plots will be saved as
"[basename]_physical.[format]" and "[basename]... | Returns two triangle plots, one with physical params, one observational
:param basename:
If basename is provided, then plots will be saved as
"[basename]_physical.[format]" and "[basename]_observed.[format]"
:param format:
Format in which to save figures (e.g., 'png... | Returns two triangle plots, one with physical params, one observational | [
"Returns",
"two",
"triangle",
"plots",
"one",
"with",
"physical",
"params",
"one",
"observational"
] | def triangle_plots(self, basename=None, format='png',
**kwargs):
fig1 = self.triangle(plot_datapoints=False,
params=['mass_A', 'mass_B','radius','Teff','logg','feh','age',
'distance', 'AV'],
**kwar... | [
"def",
"triangle_plots",
"(",
"self",
",",
"basename",
"=",
"None",
",",
"format",
"=",
"'png'",
",",
"**",
"kwargs",
")",
":",
"fig1",
"=",
"self",
".",
"triangle",
"(",
"plot_datapoints",
"=",
"False",
",",
"params",
"=",
"[",
"'mass_A'",
",",
"'mass... | Returns two triangle plots, one with physical params, one observational | [
"Returns",
"two",
"triangle",
"plots",
"one",
"with",
"physical",
"params",
"one",
"observational"
] | [
"\"\"\"Returns two triangle plots, one with physical params, one observational\n\n :param basename:\n If basename is provided, then plots will be saved as\n \"[basename]_physical.[format]\" and \"[basename]_observed.[format]\"\n\n :param format:\n Format in which to sa... | [
{
"param": "self",
"type": null
},
{
"param": "basename",
"type": null
},
{
"param": "format",
"type": null
}
] | {
"returns": [
{
"docstring": "Physical parameters triangle plot (mass_A, mass_B, radius, Teff, feh, age, distance)\nObserved properties triangle plot.",
"docstring_tokens": [
"Physical",
"parameters",
"triangle",
"plot",
"(",
"mass_A",
"mass_B",... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | lnlike | <not_specific> | def lnlike(self, p):
"""Log-likelihood of model at given parameters
:param p:
mass_A, mass_B, mass_C, log10(age), feh, [distance, A_V (extinction)].
Final two should only be provided if ``self.fit_for_distance``
is ``True``; that is, apparent magnitudes are... | Log-likelihood of model at given parameters
:param p:
mass_A, mass_B, mass_C, log10(age), feh, [distance, A_V (extinction)].
Final two should only be provided if ``self.fit_for_distance``
is ``True``; that is, apparent magnitudes are provided.
... | Log-likelihood of model at given parameters | [
"Log",
"-",
"likelihood",
"of",
"model",
"at",
"given",
"parameters"
] | def lnlike(self, p):
if not self._props_cleaned:
self._clean_props()
if not self.use_emcee:
fit_for_distance = True
mass_A, mass_B, mass_C, age, feh, dist, AV = (p[0], p[1], p[2],
p[3], p[4], p[5],
... | [
"def",
"lnlike",
"(",
"self",
",",
"p",
")",
":",
"if",
"not",
"self",
".",
"_props_cleaned",
":",
"self",
".",
"_clean_props",
"(",
")",
"if",
"not",
"self",
".",
"use_emcee",
":",
"fit_for_distance",
"=",
"True",
"mass_A",
",",
"mass_B",
",",
"mass_C... | Log-likelihood of model at given parameters | [
"Log",
"-",
"likelihood",
"of",
"model",
"at",
"given",
"parameters"
] | [
"\"\"\"Log-likelihood of model at given parameters\n\n \n :param p: \n mass_A, mass_B, mass_C, log10(age), feh, [distance, A_V (extinction)].\n Final two should only be provided if ``self.fit_for_distance``\n is ``True``; that is, apparent magnitudes are provided.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "p",
"type": null
}
] | {
"returns": [
{
"docstring": "log-likelihood. Will be -np.inf if values out of range.",
"docstring_tokens": [
"log",
"-",
"likelihood",
".",
"Will",
"be",
"-",
"np",
".",
"inf",
"if",
"values",
"o... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | maxlike | <not_specific> | def maxlike(self,nseeds=50):
"""Returns the best-fit parameters, choosing the best of multiple starting guesses
:param nseeds: (optional)
Number of starting guesses, uniformly distributed throughout
allowed ranges. Default=50.
:return:
list of best-fit para... | Returns the best-fit parameters, choosing the best of multiple starting guesses
:param nseeds: (optional)
Number of starting guesses, uniformly distributed throughout
allowed ranges. Default=50.
:return:
list of best-fit parameters: ``[mA,mB,age,feh,[distance,A_V]]... | Returns the best-fit parameters, choosing the best of multiple starting guesses | [
"Returns",
"the",
"best",
"-",
"fit",
"parameters",
"choosing",
"the",
"best",
"of",
"multiple",
"starting",
"guesses"
] | def maxlike(self,nseeds=50):
mA_0,age0,feh0 = self.ic.random_points(nseeds)
mB_0,foo1,foo2 = self.ic.random_points(nseeds)
mC_0,foo3,foo4 = self.ic.random_points(nseeds)
m_all = np.sort(np.array([mA_0, mB_0, mC_0]), axis=0)
mA_0, mB_0, mC_0 = (m_all[0,:], m_all[1,:], m_all[2,:])
... | [
"def",
"maxlike",
"(",
"self",
",",
"nseeds",
"=",
"50",
")",
":",
"mA_0",
",",
"age0",
",",
"feh0",
"=",
"self",
".",
"ic",
".",
"random_points",
"(",
"nseeds",
")",
"mB_0",
",",
"foo1",
",",
"foo2",
"=",
"self",
".",
"ic",
".",
"random_points",
... | Returns the best-fit parameters, choosing the best of multiple starting guesses | [
"Returns",
"the",
"best",
"-",
"fit",
"parameters",
"choosing",
"the",
"best",
"of",
"multiple",
"starting",
"guesses"
] | [
"\"\"\"Returns the best-fit parameters, choosing the best of multiple starting guesses\n\n :param nseeds: (optional)\n Number of starting guesses, uniformly distributed throughout\n allowed ranges. Default=50.\n\n :return:\n list of best-fit parameters: ``[mA,mB,age,f... | [
{
"param": "self",
"type": null
},
{
"param": "nseeds",
"type": null
}
] | {
"returns": [
{
"docstring": "list of best-fit parameters: ``[mA,mB,age,feh,[distance,A_V]]``.\nNote that distance and A_V values will be meaningless unless\nmagnitudes are present in ``self.properties``.",
"docstring_tokens": [
"list",
"of",
"best",
"-",
"fit"... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | fit_mcmc | <not_specific> | def fit_mcmc(self,nwalkers=200,nburn=100,niter=200,
p0=None,initial_burn=None,
ninitial=100, loglike_kwargs=None,
**kwargs):
"""Fits stellar model using MCMC.
See :func:`StarModel.fit_mcmc`.
"""
#clear any saved _samples
... | Fits stellar model using MCMC.
See :func:`StarModel.fit_mcmc`.
| Fits stellar model using MCMC. | [
"Fits",
"stellar",
"model",
"using",
"MCMC",
"."
] | def fit_mcmc(self,nwalkers=200,nburn=100,niter=200,
p0=None,initial_burn=None,
ninitial=100, loglike_kwargs=None,
**kwargs):
if self._samples is not None:
self._samples = None
if self.fit_for_distance:
npars = 7
if in... | [
"def",
"fit_mcmc",
"(",
"self",
",",
"nwalkers",
"=",
"200",
",",
"nburn",
"=",
"100",
",",
"niter",
"=",
"200",
",",
"p0",
"=",
"None",
",",
"initial_burn",
"=",
"None",
",",
"ninitial",
"=",
"100",
",",
"loglike_kwargs",
"=",
"None",
",",
"**",
"... | Fits stellar model using MCMC. | [
"Fits",
"stellar",
"model",
"using",
"MCMC",
"."
] | [
"\"\"\"Fits stellar model using MCMC.\n\n See :func:`StarModel.fit_mcmc`.\n \n \"\"\"",
"#clear any saved _samples",
"#ninitial = 300 #should this be parameter?",
"#reset p0",
"#distance"
] | [
{
"param": "self",
"type": null
},
{
"param": "nwalkers",
"type": null
},
{
"param": "nburn",
"type": null
},
{
"param": "niter",
"type": null
},
{
"param": "p0",
"type": null
},
{
"param": "initial_burn",
"type": null
},
{
"param": "niniti... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nwalkers",
"type": null,
"docstring": null,
"docstring_tokens... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | triangle_plots | <not_specific> | def triangle_plots(self, basename=None, format='png',
**kwargs):
"""Returns two triangle plots, one with physical params, one observational
:return:
* Physical parameters triangle plot (mass_A, mass_B, mass_C, radius,
Teff, feh, age, distance)
... | Returns two triangle plots, one with physical params, one observational
:return:
* Physical parameters triangle plot (mass_A, mass_B, mass_C, radius,
Teff, feh, age, distance)
* Observed properties triangle plot.
| Returns two triangle plots, one with physical params, one observational | [
"Returns",
"two",
"triangle",
"plots",
"one",
"with",
"physical",
"params",
"one",
"observational"
] | def triangle_plots(self, basename=None, format='png',
**kwargs):
fig1 = self.triangle(plot_datapoints=False,
params=['mass_A', 'mass_B', 'mass_C', 'radius',
'Teff','logg','feh','age','distance','AV'],
... | [
"def",
"triangle_plots",
"(",
"self",
",",
"basename",
"=",
"None",
",",
"format",
"=",
"'png'",
",",
"**",
"kwargs",
")",
":",
"fig1",
"=",
"self",
".",
"triangle",
"(",
"plot_datapoints",
"=",
"False",
",",
"params",
"=",
"[",
"'mass_A'",
",",
"'mass... | Returns two triangle plots, one with physical params, one observational | [
"Returns",
"two",
"triangle",
"plots",
"one",
"with",
"physical",
"params",
"one",
"observational"
] | [
"\"\"\"Returns two triangle plots, one with physical params, one observational\n\n :return:\n * Physical parameters triangle plot (mass_A, mass_B, mass_C, radius, \n Teff, feh, age, distance)\n * Observed properties triangle plot.\n \n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "basename",
"type": null
},
{
"param": "format",
"type": null
}
] | {
"returns": [
{
"docstring": "Physical parameters triangle plot (mass_A, mass_B, mass_C, radius,\nTeff, feh, age, distance)\nObserved properties triangle plot.",
"docstring_tokens": [
"Physical",
"parameters",
"triangle",
"plot",
"(",
"mass_A",
... |
f67a89f82609d708bb8d6af7ad088624b9980ca0 | alexji/isochrones | isochrones/starmodel_old.py | [
"MIT"
] | Python | q_prior | <not_specific> | def q_prior(q, m=1, gamma=0.3, qmin=0.1):
"""Default prior on mass ratio q ~ q^gamma
"""
if q < qmin or q > 1:
return 0
C = 1/(1/(gamma+1)*(1 - qmin**(gamma+1)))
return C*q**gamma | Default prior on mass ratio q ~ q^gamma
| Default prior on mass ratio q ~ q^gamma | [
"Default",
"prior",
"on",
"mass",
"ratio",
"q",
"~",
"q^gamma"
] | def q_prior(q, m=1, gamma=0.3, qmin=0.1):
if q < qmin or q > 1:
return 0
C = 1/(1/(gamma+1)*(1 - qmin**(gamma+1)))
return C*q**gamma | [
"def",
"q_prior",
"(",
"q",
",",
"m",
"=",
"1",
",",
"gamma",
"=",
"0.3",
",",
"qmin",
"=",
"0.1",
")",
":",
"if",
"q",
"<",
"qmin",
"or",
"q",
">",
"1",
":",
"return",
"0",
"C",
"=",
"1",
"/",
"(",
"1",
"/",
"(",
"gamma",
"+",
"1",
")"... | Default prior on mass ratio q ~ q^gamma | [
"Default",
"prior",
"on",
"mass",
"ratio",
"q",
"~",
"q^gamma"
] | [
"\"\"\"Default prior on mass ratio q ~ q^gamma\n \"\"\""
] | [
{
"param": "q",
"type": null
},
{
"param": "m",
"type": null
},
{
"param": "gamma",
"type": null
},
{
"param": "qmin",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "q",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "m",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
4990356a621d00449d02db491dfbe1195d31618b | alexji/isochrones | isochrones/mist/utils.py | [
"MIT"
] | Python | interp_box | <not_specific> | def interp_box(x, y, z, box, values):
"""
box is 8x3 array, though not really a box
values is length-8 array, corresponding to values at the "box" coords
"""
# Calculate the distance to each vertex
val = 0
norm = 0
for i in range(8):
# weight = 1./distance
... |
box is 8x3 array, though not really a box
values is length-8 array, corresponding to values at the "box" coords
| box is 8x3 array, though not really a box
values is length-8 array, corresponding to values at the "box" coords | [
"box",
"is",
"8x3",
"array",
"though",
"not",
"really",
"a",
"box",
"values",
"is",
"length",
"-",
"8",
"array",
"corresponding",
"to",
"values",
"at",
"the",
"\"",
"box",
"\"",
"coords"
] | def interp_box(x, y, z, box, values):
val = 0
norm = 0
for i in range(8):
w = 1./sqrt((x-box[i,0])**2 + (y-box[i,1])**2 + (z-box[i, 2])**2)
val += w * values[i]
norm += w
return val/norm | [
"def",
"interp_box",
"(",
"x",
",",
"y",
",",
"z",
",",
"box",
",",
"values",
")",
":",
"val",
"=",
"0",
"norm",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"8",
")",
":",
"w",
"=",
"1.",
"/",
"sqrt",
"(",
"(",
"x",
"-",
"box",
"[",
"i",
... | box is 8x3 array, though not really a box
values is length-8 array, corresponding to values at the "box" coords | [
"box",
"is",
"8x3",
"array",
"though",
"not",
"really",
"a",
"box",
"values",
"is",
"length",
"-",
"8",
"array",
"corresponding",
"to",
"values",
"at",
"the",
"\"",
"box",
"\"",
"coords"
] | [
"\"\"\"\n box is 8x3 array, though not really a box\n \n values is length-8 array, corresponding to values at the \"box\" coords\n \"\"\"",
"# Calculate the distance to each vertex",
"# weight = 1./distance"
] | [
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
},
{
"param": "z",
"type": null
},
{
"param": "box",
"type": null
},
{
"param": "values",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
4990356a621d00449d02db491dfbe1195d31618b | alexji/isochrones | isochrones/mist/utils.py | [
"MIT"
] | Python | interp_values | <not_specific> | def interp_values(mass_arr, age_arr, feh_arr, icol,
grid, mass_col, ages, fehs, grid_Ns):
"""mass_arr, age_arr, feh_arr are all arrays at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of m... | mass_arr, age_arr, feh_arr are all arrays at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of mass
ages is grid of ages
fehs is grid of fehs
grid_Ns keeps track of nmass in each slice (beyond this a... | mass_arr, age_arr, feh_arr are all arrays at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of mass
ages is grid of ages
fehs is grid of fehs
grid_Ns keeps track of nmass in each slice (beyond this are nans) | [
"mass_arr",
"age_arr",
"feh_arr",
"are",
"all",
"arrays",
"at",
"which",
"values",
"are",
"desired",
"icol",
"is",
"the",
"column",
"index",
"of",
"desired",
"value",
"grid",
"is",
"nfeh",
"x",
"nage",
"x",
"max",
"(",
"nmass",
")",
"x",
"ncols",
"array"... | def interp_values(mass_arr, age_arr, feh_arr, icol,
grid, mass_col, ages, fehs, grid_Ns):
N = len(mass_arr)
results = np.zeros(N)
Nage = len(ages)
Nfeh = len(fehs)
for i in range(N):
mass = mass_arr[i]
age = age_arr[i]
feh = feh_arr[i]
ifeh = searchs... | [
"def",
"interp_values",
"(",
"mass_arr",
",",
"age_arr",
",",
"feh_arr",
",",
"icol",
",",
"grid",
",",
"mass_col",
",",
"ages",
",",
"fehs",
",",
"grid_Ns",
")",
":",
"N",
"=",
"len",
"(",
"mass_arr",
")",
"results",
"=",
"np",
".",
"zeros",
"(",
... | mass_arr, age_arr, feh_arr are all arrays at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of mass
ages is grid of ages
fehs is grid of fehs
grid_Ns keeps track of nmass in each slice (beyond this are nans) | [
"mass_arr",
"age_arr",
"feh_arr",
"are",
"all",
"arrays",
"at",
"which",
"values",
"are",
"desired",
"icol",
"is",
"the",
"column",
"index",
"of",
"desired",
"value",
"grid",
"is",
"nfeh",
"x",
"nage",
"x",
"max",
"(",
"nmass",
")",
"x",
"ncols",
"array"... | [
"\"\"\"mass_arr, age_arr, feh_arr are all arrays at which values are desired\n\n icol is the column index of desired value\n grid is nfeh x nage x max(nmass) x ncols array\n mass_col is the column index of mass\n ages is grid of ages\n fehs is grid of fehs\n grid_Ns keeps track of nmass in each sl... | [
{
"param": "mass_arr",
"type": null
},
{
"param": "age_arr",
"type": null
},
{
"param": "feh_arr",
"type": null
},
{
"param": "icol",
"type": null
},
{
"param": "grid",
"type": null
},
{
"param": "mass_col",
"type": null
},
{
"param": "ages... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mass_arr",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "age_arr",
"type": null,
"docstring": null,
"docstring_tok... |
4990356a621d00449d02db491dfbe1195d31618b | alexji/isochrones | isochrones/mist/utils.py | [
"MIT"
] | Python | interp_value | <not_specific> | def interp_value(mass, age, feh, icol,
grid, mass_col, ages, fehs, grid_Ns):
# return_box):
"""mass, age, feh are *single values* at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the colum... | mass, age, feh are *single values* at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of mass
ages is grid of ages
fehs is grid of fehs
grid_Ns keeps track of nmass in each slice (beyond this are nans... | mass, age, feh are *single values* at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of mass
ages is grid of ages
fehs is grid of fehs
grid_Ns keeps track of nmass in each slice (beyond this are nans) | [
"mass",
"age",
"feh",
"are",
"*",
"single",
"values",
"*",
"at",
"which",
"values",
"are",
"desired",
"icol",
"is",
"the",
"column",
"index",
"of",
"desired",
"value",
"grid",
"is",
"nfeh",
"x",
"nage",
"x",
"max",
"(",
"nmass",
")",
"x",
"ncols",
"a... | def interp_value(mass, age, feh, icol,
grid, mass_col, ages, fehs, grid_Ns):
Nage = len(ages)
Nfeh = len(fehs)
ifeh = searchsorted(fehs, Nfeh, feh)
iage = searchsorted(ages, Nage, age)
pts = np.zeros((8,3))
vals = np.zeros(8)
i_f = ifeh - 1
i_a = iage - 1
Nmass = gr... | [
"def",
"interp_value",
"(",
"mass",
",",
"age",
",",
"feh",
",",
"icol",
",",
"grid",
",",
"mass_col",
",",
"ages",
",",
"fehs",
",",
"grid_Ns",
")",
":",
"Nage",
"=",
"len",
"(",
"ages",
")",
"Nfeh",
"=",
"len",
"(",
"fehs",
")",
"ifeh",
"=",
... | mass, age, feh are *single values* at which values are desired
icol is the column index of desired value
grid is nfeh x nage x max(nmass) x ncols array
mass_col is the column index of mass
ages is grid of ages
fehs is grid of fehs
grid_Ns keeps track of nmass in each slice (beyond this are nans) | [
"mass",
"age",
"feh",
"are",
"*",
"single",
"values",
"*",
"at",
"which",
"values",
"are",
"desired",
"icol",
"is",
"the",
"column",
"index",
"of",
"desired",
"value",
"grid",
"is",
"nfeh",
"x",
"nage",
"x",
"max",
"(",
"nmass",
")",
"x",
"ncols",
"a... | [
"# return_box):",
"\"\"\"mass, age, feh are *single values* at which values are desired\n\n icol is the column index of desired value\n grid is nfeh x nage x max(nmass) x ncols array\n mass_col is the column index of mass\n ages is grid of ages\n fehs is grid of fehs\n grid_Ns keeps track of nma... | [
{
"param": "mass",
"type": null
},
{
"param": "age",
"type": null
},
{
"param": "feh",
"type": null
},
{
"param": "icol",
"type": null
},
{
"param": "grid",
"type": null
},
{
"param": "mass_col",
"type": null
},
{
"param": "ages",
"type... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mass",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "age",
"type": null,
"docstring": null,
"docstring_tokens": []... |
6bee0214177021b88b37ef3a99b84dfdb2ddf8bb | collectiveacuity/labPack | labpack/compilers/yaml.py | [
"MIT"
] | Python | walk_data | null | def walk_data(target, source):
''' method to recursively walk parse tree and merge source into target '''
from copy import deepcopy
# skip if target and source are different datatypes
if target.__class__.__name__ != source.__class__.__name__:
pass
# handle maps
elif isinstance(tar... | method to recursively walk parse tree and merge source into target | method to recursively walk parse tree and merge source into target | [
"method",
"to",
"recursively",
"walk",
"parse",
"tree",
"and",
"merge",
"source",
"into",
"target"
] | def walk_data(target, source):
from copy import deepcopy
if target.__class__.__name__ != source.__class__.__name__:
pass
elif isinstance(target, CommentedMap):
count = 0
for k, v in source.items():
comments = source.get_comments(k)
if comments:
... | [
"def",
"walk_data",
"(",
"target",
",",
"source",
")",
":",
"from",
"copy",
"import",
"deepcopy",
"if",
"target",
".",
"__class__",
".",
"__name__",
"!=",
"source",
".",
"__class__",
".",
"__name__",
":",
"pass",
"elif",
"isinstance",
"(",
"target",
",",
... | method to recursively walk parse tree and merge source into target | [
"method",
"to",
"recursively",
"walk",
"parse",
"tree",
"and",
"merge",
"source",
"into",
"target"
] | [
"''' method to recursively walk parse tree and merge source into target '''",
"# skip if target and source are different datatypes",
"# handle maps",
"# retrieve comments of field in source",
"# insert fields not found in target",
"# add comments from source when missing from target",
"# walk down maps ... | [
{
"param": "target",
"type": null
},
{
"param": "source",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "target",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "source",
"type": null,
"docstring": null,
"docstring_tokens... |
6bee0214177021b88b37ef3a99b84dfdb2ddf8bb | collectiveacuity/labPack | labpack/compilers/yaml.py | [
"MIT"
] | Python | merge_yaml_strings | <not_specific> | def merge_yaml_strings(*sources, output=''):
'''
method for merging two or more yaml strings
this method walks the parse tree of yaml data to merge the fields
(and comments) found in subsequent sources into the data structure of the
initial sources. any number of sources can be added to the so... |
method for merging two or more yaml strings
this method walks the parse tree of yaml data to merge the fields
(and comments) found in subsequent sources into the data structure of the
initial sources. any number of sources can be added to the source args, but
only new fields and new comments f... | method for merging two or more yaml strings
this method walks the parse tree of yaml data to merge the fields
(and comments) found in subsequent sources into the data structure of the
initial sources. any number of sources can be added to the source args, but
only new fields and new comments from subsequent sources wil... | [
"method",
"for",
"merging",
"two",
"or",
"more",
"yaml",
"strings",
"this",
"method",
"walks",
"the",
"parse",
"tree",
"of",
"yaml",
"data",
"to",
"merge",
"the",
"fields",
"(",
"and",
"comments",
")",
"found",
"in",
"subsequent",
"sources",
"into",
"the",... | def merge_yaml_strings(*sources, output=''):
import re
from copy import deepcopy
from ruamel.yaml.compat import StringIO
from ruamel.yaml.util import load_yaml_guess_indent
yml = YAML(typ='rt')
yml.default_flow_style = False
combined = None
indent = 2
seq_indent = 0
combined_head... | [
"def",
"merge_yaml_strings",
"(",
"*",
"sources",
",",
"output",
"=",
"''",
")",
":",
"import",
"re",
"from",
"copy",
"import",
"deepcopy",
"from",
"ruamel",
".",
"yaml",
".",
"compat",
"import",
"StringIO",
"from",
"ruamel",
".",
"yaml",
".",
"util",
"i... | method for merging two or more yaml strings
this method walks the parse tree of yaml data to merge the fields
(and comments) found in subsequent sources into the data structure of the
initial sources. | [
"method",
"for",
"merging",
"two",
"or",
"more",
"yaml",
"strings",
"this",
"method",
"walks",
"the",
"parse",
"tree",
"of",
"yaml",
"data",
"to",
"merge",
"the",
"fields",
"(",
"and",
"comments",
")",
"found",
"in",
"subsequent",
"sources",
"into",
"the",... | [
"'''\n method for merging two or more yaml strings\n\n this method walks the parse tree of yaml data to merge the fields\n (and comments) found in subsequent sources into the data structure of the\n initial sources. any number of sources can be added to the source args, but\n only new fields and ... | [
{
"param": "output",
"type": null
}
] | {
"returns": [
{
"docstring": "string with merged data [or StringIO object]",
"docstring_tokens": [
"string",
"with",
"merged",
"data",
"[",
"or",
"StringIO",
"object",
"]"
],
"type": null
}
],
"raises": [],
... |
6bee0214177021b88b37ef3a99b84dfdb2ddf8bb | collectiveacuity/labPack | labpack/compilers/yaml.py | [
"MIT"
] | Python | merge_yaml | <not_specific> | def merge_yaml(*sources, output=''):
'''
method for merging two or more yaml strings
this method walks the parse tree of yaml data to merge the fields
(and comments) found in subsequent sources into the data structure of the
initial sources. any number of sources can be added to the source... |
method for merging two or more yaml strings
this method walks the parse tree of yaml data to merge the fields
(and comments) found in subsequent sources into the data structure of the
initial sources. any number of sources can be added to the source args, but
only new fields and new comments f... | method for merging two or more yaml strings
this method walks the parse tree of yaml data to merge the fields
(and comments) found in subsequent sources into the data structure of the
initial sources. any number of sources can be added to the source args, but
only new fields and new comments from subsequent sources wil... | [
"method",
"for",
"merging",
"two",
"or",
"more",
"yaml",
"strings",
"this",
"method",
"walks",
"the",
"parse",
"tree",
"of",
"yaml",
"data",
"to",
"merge",
"the",
"fields",
"(",
"and",
"comments",
")",
"found",
"in",
"subsequent",
"sources",
"into",
"the",... | def merge_yaml(*sources, output=''):
src = [ open(yaml_path).read() for yaml_path in sources ]
stream = merge_yaml_strings(*src, output='io')
if output:
from shutil import copyfileobj
with open(output, 'w') as f:
stream.seek(0)
copyfileobj(stream, f)
f.clo... | [
"def",
"merge_yaml",
"(",
"*",
"sources",
",",
"output",
"=",
"''",
")",
":",
"src",
"=",
"[",
"open",
"(",
"yaml_path",
")",
".",
"read",
"(",
")",
"for",
"yaml_path",
"in",
"sources",
"]",
"stream",
"=",
"merge_yaml_strings",
"(",
"*",
"src",
",",
... | method for merging two or more yaml strings
this method walks the parse tree of yaml data to merge the fields
(and comments) found in subsequent sources into the data structure of the
initial sources. | [
"method",
"for",
"merging",
"two",
"or",
"more",
"yaml",
"strings",
"this",
"method",
"walks",
"the",
"parse",
"tree",
"of",
"yaml",
"data",
"to",
"merge",
"the",
"fields",
"(",
"and",
"comments",
")",
"found",
"in",
"subsequent",
"sources",
"into",
"the",... | [
"'''\n method for merging two or more yaml strings\n\n this method walks the parse tree of yaml data to merge the fields\n (and comments) found in subsequent sources into the data structure of the\n initial sources. any number of sources can be added to the source args, but\n only new fields and ... | [
{
"param": "output",
"type": null
}
] | {
"returns": [
{
"docstring": "string with merged data",
"docstring_tokens": [
"string",
"with",
"merged",
"data"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "output",
"type": null,
"docstring": "[optional] ... |
9a51d3446118dd41995388b85805f7c48a378624 | collectiveacuity/labPack | labpack/databases/google/datastore.py | [
"MIT"
] | Python | _prepare_record | <not_specific> | def _prepare_record(self, record):
''' a helper method for converting a record to column-based fields '''
fields = {}
for key, value in self.model.keyMap.items():
record_key = key[1:]
if record_key:
if self.item_key.findall(record_key):
... | a helper method for converting a record to column-based fields | a helper method for converting a record to column-based fields | [
"a",
"helper",
"method",
"for",
"converting",
"a",
"record",
"to",
"column",
"-",
"based",
"fields"
] | def _prepare_record(self, record):
fields = {}
for key, value in self.model.keyMap.items():
record_key = key[1:]
if record_key:
if self.item_key.findall(record_key):
pass
else:
if value['value_datatype'] in (... | [
"def",
"_prepare_record",
"(",
"self",
",",
"record",
")",
":",
"fields",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"self",
".",
"model",
".",
"keyMap",
".",
"items",
"(",
")",
":",
"record_key",
"=",
"key",
"[",
"1",
":",
"]",
"if",
"reco... | a helper method for converting a record to column-based fields | [
"a",
"helper",
"method",
"for",
"converting",
"a",
"record",
"to",
"column",
"-",
"based",
"fields"
] | [
"''' a helper method for converting a record to column-based fields '''",
"# add id field if missing"
] | [
{
"param": "self",
"type": null
},
{
"param": "record",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "record",
"type": null,
"docstring": null,
"docstring_tokens":... |
9a51d3446118dd41995388b85805f7c48a378624 | collectiveacuity/labPack | labpack/databases/google/datastore.py | [
"MIT"
] | Python | _reconstruct_record | <not_specific> | def _reconstruct_record(self, entity):
''' a helper method for reconstructing a record from a datastore entity '''
details = {
'id': entity.key._flat_path[-1]
}
current = details
for key, value in self.model.keyMap.items():
record_key = key[1:]
... | a helper method for reconstructing a record from a datastore entity | a helper method for reconstructing a record from a datastore entity | [
"a",
"helper",
"method",
"for",
"reconstructing",
"a",
"record",
"from",
"a",
"datastore",
"entity"
] | def _reconstruct_record(self, entity):
details = {
'id': entity.key._flat_path[-1]
}
current = details
for key, value in self.model.keyMap.items():
record_key = key[1:]
if record_key:
record_value = entity.get(record_key, None)
... | [
"def",
"_reconstruct_record",
"(",
"self",
",",
"entity",
")",
":",
"details",
"=",
"{",
"'id'",
":",
"entity",
".",
"key",
".",
"_flat_path",
"[",
"-",
"1",
"]",
"}",
"current",
"=",
"details",
"for",
"key",
",",
"value",
"in",
"self",
".",
"model",... | a helper method for reconstructing a record from a datastore entity | [
"a",
"helper",
"method",
"for",
"reconstructing",
"a",
"record",
"from",
"a",
"datastore",
"entity"
] | [
"''' a helper method for reconstructing a record from a datastore entity '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "entity",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entity",
"type": null,
"docstring": null,
"docstring_tokens":... |
9a51d3446118dd41995388b85805f7c48a378624 | collectiveacuity/labPack | labpack/databases/google/datastore.py | [
"MIT"
] | Python | _paginate | <not_specific> | def _paginate(self, query, iter_func, end_func):
''' a method to automatically paginate fetch queries '''
next_cursor = True
kwargs = {
'limit': 100
}
count = 0
while next_cursor:
query_iter = query.fetch(**kwargs)
page = next(query_i... | a method to automatically paginate fetch queries | a method to automatically paginate fetch queries | [
"a",
"method",
"to",
"automatically",
"paginate",
"fetch",
"queries"
] | def _paginate(self, query, iter_func, end_func):
next_cursor = True
kwargs = {
'limit': 100
}
count = 0
while next_cursor:
query_iter = query.fetch(**kwargs)
page = next(query_iter.pages)
for entity in page:
iter_fun... | [
"def",
"_paginate",
"(",
"self",
",",
"query",
",",
"iter_func",
",",
"end_func",
")",
":",
"next_cursor",
"=",
"True",
"kwargs",
"=",
"{",
"'limit'",
":",
"100",
"}",
"count",
"=",
"0",
"while",
"next_cursor",
":",
"query_iter",
"=",
"query",
".",
"fe... | a method to automatically paginate fetch queries | [
"a",
"method",
"to",
"automatically",
"paginate",
"fetch",
"queries"
] | [
"''' a method to automatically paginate fetch queries '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "query",
"type": null
},
{
"param": "iter_func",
"type": null
},
{
"param": "end_func",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "query",
"type": null,
"docstring": null,
"docstring_tokens": ... |
9a51d3446118dd41995388b85805f7c48a378624 | collectiveacuity/labPack | labpack/databases/google/datastore.py | [
"MIT"
] | Python | _update_indices | <not_specific> | def _update_indices(self, batch=10):
''' a method to update indexing of fields in all records
NOTE: datastore does not automatically index old records, this method
scans each index and updates the indexing of fields which are
not indexed. RUN THIS METHOD CAUTIOUSLY
... | a method to update indexing of fields in all records
NOTE: datastore does not automatically index old records, this method
scans each index and updates the indexing of fields which are
not indexed. RUN THIS METHOD CAUTIOUSLY
| a method to update indexing of fields in all records
NOTE: datastore does not automatically index old records, this method
scans each index and updates the indexing of fields which are
not indexed. RUN THIS METHOD CAUTIOUSLY | [
"a",
"method",
"to",
"update",
"indexing",
"of",
"fields",
"in",
"all",
"records",
"NOTE",
":",
"datastore",
"does",
"not",
"automatically",
"index",
"old",
"records",
"this",
"method",
"scans",
"each",
"index",
"and",
"updates",
"the",
"indexing",
"of",
"fi... | def _update_indices(self, batch=10):
title = '%s._update_indices' % self.__class__.__name__
args = {
'batch': batch
}
for key, value in args.items():
titlex = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(value, '.%s' % key, titlex)
... | [
"def",
"_update_indices",
"(",
"self",
",",
"batch",
"=",
"10",
")",
":",
"title",
"=",
"'%s._update_indices'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"args",
"=",
"{",
"'batch'",
":",
"batch",
"}",
"for",
"key",
",",
"value",
"in",
"args",
".... | a method to update indexing of fields in all records
NOTE: datastore does not automatically index old records, this method
scans each index and updates the indexing of fields which are
not indexed. | [
"a",
"method",
"to",
"update",
"indexing",
"of",
"fields",
"in",
"all",
"records",
"NOTE",
":",
"datastore",
"does",
"not",
"automatically",
"index",
"old",
"records",
"this",
"method",
"scans",
"each",
"index",
"and",
"updates",
"the",
"indexing",
"of",
"fi... | [
"''' a method to update indexing of fields in all records \n\n NOTE: datastore does not automatically index old records, this method\n scans each index and updates the indexing of fields which are\n not indexed. RUN THIS METHOD CAUTIOUSLY\n '''",
"# validate inputs",
... | [
{
"param": "self",
"type": null
},
{
"param": "batch",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "batch",
"type": null,
"docstring": null,
"docstring_tokens": ... |
9a51d3446118dd41995388b85805f7c48a378624 | collectiveacuity/labPack | labpack/databases/google/datastore.py | [
"MIT"
] | Python | exists | <not_specific> | def exists(self, record_id):
''' a method to determine if record exists
:param record_id: string with id associated with record
:return: boolean to indicate existence of record
'''
query = self.client.query(kind=self.kind)
eval_key = self.client.key(self.kind,... | a method to determine if record exists
:param record_id: string with id associated with record
:return: boolean to indicate existence of record
| a method to determine if record exists | [
"a",
"method",
"to",
"determine",
"if",
"record",
"exists"
] | def exists(self, record_id):
query = self.client.query(kind=self.kind)
eval_key = self.client.key(self.kind, record_id)
query.add_filter('__key__', '=', eval_key)
query.keys_only()
result = list(query.fetch())
if result:
return True
return False | [
"def",
"exists",
"(",
"self",
",",
"record_id",
")",
":",
"query",
"=",
"self",
".",
"client",
".",
"query",
"(",
"kind",
"=",
"self",
".",
"kind",
")",
"eval_key",
"=",
"self",
".",
"client",
".",
"key",
"(",
"self",
".",
"kind",
",",
"record_id",... | a method to determine if record exists | [
"a",
"method",
"to",
"determine",
"if",
"record",
"exists"
] | [
"''' a method to determine if record exists \n \n :param record_id: string with id associated with record\n :return: boolean to indicate existence of record\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "record_id",
"type": null
}
] | {
"returns": [
{
"docstring": "boolean to indicate existence of record",
"docstring_tokens": [
"boolean",
"to",
"indicate",
"existence",
"of",
"record"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",... |
9a51d3446118dd41995388b85805f7c48a378624 | collectiveacuity/labPack | labpack/databases/google/datastore.py | [
"MIT"
] | Python | create | <not_specific> | def create(self, record):
'''
a method to create a new record in the table
NOTE: this class uses the id field as the primary key for all records
if record includes an id field that is an integer, float
or string, then it will be used as the pri... |
a method to create a new record in the table
NOTE: this class uses the id field as the primary key for all records
if record includes an id field that is an integer, float
or string, then it will be used as the primary key.
NOTE: if the... | a method to create a new record in the table
NOTE: this class uses the id field as the primary key for all records
if record includes an id field that is an integer, float
or string, then it will be used as the primary key.
if the id field is missing, a unique 24 character url safe
string will be created for the id ... | [
"a",
"method",
"to",
"create",
"a",
"new",
"record",
"in",
"the",
"table",
"NOTE",
":",
"this",
"class",
"uses",
"the",
"id",
"field",
"as",
"the",
"primary",
"key",
"for",
"all",
"records",
"if",
"record",
"includes",
"an",
"id",
"field",
"that",
"is"... | def create(self, record):
title = '%s.create' % self.__class__.__name__
details = self.model.validate(record, object_title='%s(record={...})' % title)
fields = self._prepare_record(details)
key = None
record_id = None
generated = False
if isinstance(fields['id'], ... | [
"def",
"create",
"(",
"self",
",",
"record",
")",
":",
"title",
"=",
"'%s.create'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"details",
"=",
"self",
".",
"model",
".",
"validate",
"(",
"record",
",",
"object_title",
"=",
"'%s(record={...})'",
"%",
... | a method to create a new record in the table
NOTE: this class uses the id field as the primary key for all records
if record includes an id field that is an integer, float
or string, then it will be used as the primary key. | [
"a",
"method",
"to",
"create",
"a",
"new",
"record",
"in",
"the",
"table",
"NOTE",
":",
"this",
"class",
"uses",
"the",
"id",
"field",
"as",
"the",
"primary",
"key",
"for",
"all",
"records",
"if",
"record",
"includes",
"an",
"id",
"field",
"that",
"is"... | [
"'''\n a method to create a new record in the table\n\n NOTE: this class uses the id field as the primary key for all records\n if record includes an id field that is an integer, float\n or string, then it will be used as the primary key. \n\n ... | [
{
"param": "self",
"type": null
},
{
"param": "record",
"type": null
}
] | {
"returns": [
{
"docstring": "string with id for record",
"docstring_tokens": [
"string",
"with",
"id",
"for",
"record"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring":... |
9a51d3446118dd41995388b85805f7c48a378624 | collectiveacuity/labPack | labpack/databases/google/datastore.py | [
"MIT"
] | Python | read | <not_specific> | def read(self, record_id):
'''
a method to retrieve the details for a record in the table
:param record_id: string or number with unique identifier of record
:return: dictionary with record fields
'''
title = '%s.read' % self.__class__.__name__
# retri... |
a method to retrieve the details for a record in the table
:param record_id: string or number with unique identifier of record
:return: dictionary with record fields
| a method to retrieve the details for a record in the table | [
"a",
"method",
"to",
"retrieve",
"the",
"details",
"for",
"a",
"record",
"in",
"the",
"table"
] | def read(self, record_id):
title = '%s.read' % self.__class__.__name__
key = self.client.key(self.kind, record_id)
entity = self.client.get(key)
if not entity:
return {}
return self._reconstruct_record(entity) | [
"def",
"read",
"(",
"self",
",",
"record_id",
")",
":",
"title",
"=",
"'%s.read'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"key",
"=",
"self",
".",
"client",
".",
"key",
"(",
"self",
".",
"kind",
",",
"record_id",
")",
"entity",
"=",
"self",
... | a method to retrieve the details for a record in the table | [
"a",
"method",
"to",
"retrieve",
"the",
"details",
"for",
"a",
"record",
"in",
"the",
"table"
] | [
"''' \n a method to retrieve the details for a record in the table \n\n :param record_id: string or number with unique identifier of record\n :return: dictionary with record fields \n '''",
"# retrieve entity",
"# reconstruct record from entity values"
] | [
{
"param": "self",
"type": null
},
{
"param": "record_id",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with record fields",
"docstring_tokens": [
"dictionary",
"with",
"record",
"fields"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": nu... |
9a51d3446118dd41995388b85805f7c48a378624 | collectiveacuity/labPack | labpack/databases/google/datastore.py | [
"MIT"
] | Python | update | <not_specific> | def update(self, record):
''' a method to update an existing record
:param record: dictionary with record fields
:return: dictionary with record fields
'''
title = '%s.update' % self.__class__.__name__
# validate inputs
details = self.model.validate... | a method to update an existing record
:param record: dictionary with record fields
:return: dictionary with record fields
| a method to update an existing record | [
"a",
"method",
"to",
"update",
"an",
"existing",
"record"
] | def update(self, record):
title = '%s.update' % self.__class__.__name__
details = self.model.validate(record, object_title='%s(record={...})' % title)
if not 'id' in details.keys():
raise ValueError('%s(record) must contain an id field.' % title)
elif not details['id']:
... | [
"def",
"update",
"(",
"self",
",",
"record",
")",
":",
"title",
"=",
"'%s.update'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"details",
"=",
"self",
".",
"model",
".",
"validate",
"(",
"record",
",",
"object_title",
"=",
"'%s(record={...})'",
"%",
... | a method to update an existing record | [
"a",
"method",
"to",
"update",
"an",
"existing",
"record"
] | [
"''' a method to update an existing record \n \n :param record: dictionary with record fields \n :return: dictionary with record fields \n '''",
"# validate inputs",
"# validate id",
"# prepare record for updating",
"# prepare entity",
"# https://cloud.google.com/datastore/docs... | [
{
"param": "self",
"type": null
},
{
"param": "record",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with record fields",
"docstring_tokens": [
"dictionary",
"with",
"record",
"fields"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": nu... |
9a51d3446118dd41995388b85805f7c48a378624 | collectiveacuity/labPack | labpack/databases/google/datastore.py | [
"MIT"
] | Python | delete | <not_specific> | def delete(self, record_id):
''' a method to delete an existing record
:param record_id: string or number with unique identifier of record
:return: string with status message
'''
# delete entity
key = self.client.key(self.kind, record_id)
self.client.d... | a method to delete an existing record
:param record_id: string or number with unique identifier of record
:return: string with status message
| a method to delete an existing record | [
"a",
"method",
"to",
"delete",
"an",
"existing",
"record"
] | def delete(self, record_id):
key = self.client.key(self.kind, record_id)
self.client.delete(key)
msg = 'Record %s deleted.' % record_id
self.printer(msg)
return msg | [
"def",
"delete",
"(",
"self",
",",
"record_id",
")",
":",
"key",
"=",
"self",
".",
"client",
".",
"key",
"(",
"self",
".",
"kind",
",",
"record_id",
")",
"self",
".",
"client",
".",
"delete",
"(",
"key",
")",
"msg",
"=",
"'Record %s deleted.'",
"%",
... | a method to delete an existing record | [
"a",
"method",
"to",
"delete",
"an",
"existing",
"record"
] | [
"''' a method to delete an existing record \n \n :param record_id: string or number with unique identifier of record\n :return: string with status message\n '''",
"# delete entity",
"# return message"
] | [
{
"param": "self",
"type": null
},
{
"param": "record_id",
"type": null
}
] | {
"returns": [
{
"docstring": "string with status message",
"docstring_tokens": [
"string",
"with",
"status",
"message"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
... |
9a51d3446118dd41995388b85805f7c48a378624 | collectiveacuity/labPack | labpack/databases/google/datastore.py | [
"MIT"
] | Python | remove | <not_specific> | def remove(self):
''' a method to remove all records in table '''
query = self.client.query(kind=self.kind)
query.keys_only()
def iter_func(entity):
self.client.delete(entity.key)
self.printer('Record %s deleted.' % entity.key._flat_path[-1])
def end_f... | a method to remove all records in table | a method to remove all records in table | [
"a",
"method",
"to",
"remove",
"all",
"records",
"in",
"table"
] | def remove(self):
query = self.client.query(kind=self.kind)
query.keys_only()
def iter_func(entity):
self.client.delete(entity.key)
self.printer('Record %s deleted.' % entity.key._flat_path[-1])
def end_func(count):
self.printer('Table %s empty.' % sel... | [
"def",
"remove",
"(",
"self",
")",
":",
"query",
"=",
"self",
".",
"client",
".",
"query",
"(",
"kind",
"=",
"self",
".",
"kind",
")",
"query",
".",
"keys_only",
"(",
")",
"def",
"iter_func",
"(",
"entity",
")",
":",
"self",
".",
"client",
".",
"... | a method to remove all records in table | [
"a",
"method",
"to",
"remove",
"all",
"records",
"in",
"table"
] | [
"''' a method to remove all records in table '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d86721408c6241c3faee98d2aa56b0b36cc88a1 | collectiveacuity/labPack | labpack/email/mailgun.py | [
"MIT"
] | Python | validate_email | <not_specific> | def validate_email(self, email_address):
'''
a method to validate an email address
:param email_address: string with email address to validate
:return: dictionary with validation fields in response_details['json']
'''
title = '%s.validate_email... |
a method to validate an email address
:param email_address: string with email address to validate
:return: dictionary with validation fields in response_details['json']
| a method to validate an email address | [
"a",
"method",
"to",
"validate",
"an",
"email",
"address"
] | def validate_email(self, email_address):
title = '%s.validate_email' % __class__.__name__
object_title = '%s(email_address="")' % title
email_address = self.fields.validate(email_address, '.email_address', object_title)
request_kwargs = {
'url': '%s/address/validate' % self.a... | [
"def",
"validate_email",
"(",
"self",
",",
"email_address",
")",
":",
"title",
"=",
"'%s.validate_email'",
"%",
"__class__",
".",
"__name__",
"object_title",
"=",
"'%s(email_address=\"\")'",
"%",
"title",
"email_address",
"=",
"self",
".",
"fields",
".",
"validate... | a method to validate an email address | [
"a",
"method",
"to",
"validate",
"an",
"email",
"address"
] | [
"'''\r\n a method to validate an email address\r\n \r\n :param email_address: string with email address to validate\r\n :return: dictionary with validation fields in response_details['json']\r\n '''",
"# validate inputs\r",
"# construct request_kwargs\r",
"# send req... | [
{
"param": "self",
"type": null
},
{
"param": "email_address",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with validation fields in response_details['json']",
"docstring_tokens": [
"dictionary",
"with",
"validation",
"fields",
"in",
"response_details",
"[",
"'",
"json",
"'",
"]... |
2f0bafcf84b39c00cff3c4d95a7c900e2223d18d | collectiveacuity/labPack | labpack/email/mandrill.py | [
"MIT"
] | Python | _post_request | <not_specific> | def _post_request(self, url, json):
''' a helper method for handling post requests '''
import requests
# construct request kwargs
request_kwargs = {
'url': url,
'json': { 'key': self.api_key }
}
request_kwargs['json'].update(**json)
... | a helper method for handling post requests | a helper method for handling post requests | [
"a",
"helper",
"method",
"for",
"handling",
"post",
"requests"
] | def _post_request(self, url, json):
import requests
request_kwargs = {
'url': url,
'json': { 'key': self.api_key }
}
request_kwargs['json'].update(**json)
try:
response = requests.post(**request_kwargs)
except Exception:
if ... | [
"def",
"_post_request",
"(",
"self",
",",
"url",
",",
"json",
")",
":",
"import",
"requests",
"request_kwargs",
"=",
"{",
"'url'",
":",
"url",
",",
"'json'",
":",
"{",
"'key'",
":",
"self",
".",
"api_key",
"}",
"}",
"request_kwargs",
"[",
"'json'",
"]"... | a helper method for handling post requests | [
"a",
"helper",
"method",
"for",
"handling",
"post",
"requests"
] | [
"''' a helper method for handling post requests '''",
"# construct request kwargs\r",
"# send request\r",
"# handle response\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "url",
"type": null
},
{
"param": "json",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": []... |
a6ee05679049cee3a473643d3a0e04e197ad0764 | collectiveacuity/labPack | labpack/records/settings.py | [
"MIT"
] | Python | load_settings | <not_specific> | def load_settings(file_path, module_name='', secret_key=''):
''' a method to load data from json valid files
:param file_path: string with path to settings file
:param module_name: [optional] string with name of module containing file path
:param secret_key: [optional] string with key to decrypt... | a method to load data from json valid files
:param file_path: string with path to settings file
:param module_name: [optional] string with name of module containing file path
:param secret_key: [optional] string with key to decrypt drep file
:return: dictionary with settings data
| a method to load data from json valid files | [
"a",
"method",
"to",
"load",
"data",
"from",
"json",
"valid",
"files"
] | def load_settings(file_path, module_name='', secret_key=''):
title = 'load_settings'
try:
_path_arg = '%s(file_path=%s)' % (title, str(file_path))
except:
raise ValueError('%s(file_path=...) must be a string.' % title)
from os import path
if module_name:
try:
_pat... | [
"def",
"load_settings",
"(",
"file_path",
",",
"module_name",
"=",
"''",
",",
"secret_key",
"=",
"''",
")",
":",
"title",
"=",
"'load_settings'",
"try",
":",
"_path_arg",
"=",
"'%s(file_path=%s)'",
"%",
"(",
"title",
",",
"str",
"(",
"file_path",
")",
")",... | a method to load data from json valid files | [
"a",
"method",
"to",
"load",
"data",
"from",
"json",
"valid",
"files"
] | [
"''' a method to load data from json valid files\r\n\r\n :param file_path: string with path to settings file\r\n :param module_name: [optional] string with name of module containing file path\r\n :param secret_key: [optional] string with key to decrypt drep file\r\n :return: dictionary with settings dat... | [
{
"param": "file_path",
"type": null
},
{
"param": "module_name",
"type": null
},
{
"param": "secret_key",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with settings data",
"docstring_tokens": [
"dictionary",
"with",
"settings",
"data"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "file_path",
"type": null,
"docstring... |
a6ee05679049cee3a473643d3a0e04e197ad0764 | collectiveacuity/labPack | labpack/records/settings.py | [
"MIT"
] | Python | save_settings | <not_specific> | def save_settings(file_path, record_details, overwrite=False, secret_key=''):
''' a method to save dictionary typed data to a local file
:param file_path: string with path to settings file
:param record_details: list or dictionary with record details
:param overwrite: [optional] boolean to overw... | a method to save dictionary typed data to a local file
:param file_path: string with path to settings file
:param record_details: list or dictionary with record details
:param overwrite: [optional] boolean to overwrite existing file data
:param secret_key: [optional] string with key to decrypt dr... | a method to save dictionary typed data to a local file | [
"a",
"method",
"to",
"save",
"dictionary",
"typed",
"data",
"to",
"a",
"local",
"file"
] | def save_settings(file_path, record_details, overwrite=False, secret_key=''):
title = 'save_settings'
try:
_path_arg = '%s(file_path=%s)' % (title, str(file_path))
except:
raise ValueError('%s(file_path=...) must be a string.' % title)
_details_arg = '%s(record_details={...})' % title
... | [
"def",
"save_settings",
"(",
"file_path",
",",
"record_details",
",",
"overwrite",
"=",
"False",
",",
"secret_key",
"=",
"''",
")",
":",
"title",
"=",
"'save_settings'",
"try",
":",
"_path_arg",
"=",
"'%s(file_path=%s)'",
"%",
"(",
"title",
",",
"str",
"(",
... | a method to save dictionary typed data to a local file | [
"a",
"method",
"to",
"save",
"dictionary",
"typed",
"data",
"to",
"a",
"local",
"file"
] | [
"''' a method to save dictionary typed data to a local file\r\n\r\n :param file_path: string with path to settings file\r\n :param record_details: list or dictionary with record details\r\n :param overwrite: [optional] boolean to overwrite existing file data\r\n :param secret_key: [optional] string with... | [
{
"param": "file_path",
"type": null
},
{
"param": "record_details",
"type": null
},
{
"param": "overwrite",
"type": null
},
{
"param": "secret_key",
"type": null
}
] | {
"returns": [
{
"docstring": "string with file path",
"docstring_tokens": [
"string",
"with",
"file",
"path"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "file_path",
"type": null,
"docstring": "string with ... |
a6ee05679049cee3a473643d3a0e04e197ad0764 | collectiveacuity/labPack | labpack/records/settings.py | [
"MIT"
] | Python | _remove_settings | null | def _remove_settings(_file_path, _retry_count=10, _remove_dir=False):
'''
a helper method for removing settings file
:param _file_path: string with path to file to remove
:param _retry_count: integer with number of attempts before error is raised
:param _remove_dir: [optional] ... |
a helper method for removing settings file
:param _file_path: string with path to file to remove
:param _retry_count: integer with number of attempts before error is raised
:param _remove_dir: [optional] boolean to remove empty parent directories
:return: None
| a helper method for removing settings file | [
"a",
"helper",
"method",
"for",
"removing",
"settings",
"file"
] | def _remove_settings(_file_path, _retry_count=10, _remove_dir=False):
import os
from time import sleep
count = 0
while True:
try:
os.remove(_file_path)
if _remove_dir:
path_segments = os.path.split(_file_path)
if len(path_segments) > 1:
... | [
"def",
"_remove_settings",
"(",
"_file_path",
",",
"_retry_count",
"=",
"10",
",",
"_remove_dir",
"=",
"False",
")",
":",
"import",
"os",
"from",
"time",
"import",
"sleep",
"count",
"=",
"0",
"while",
"True",
":",
"try",
":",
"os",
".",
"remove",
"(",
... | a helper method for removing settings file | [
"a",
"helper",
"method",
"for",
"removing",
"settings",
"file"
] | [
"'''\r\n a helper method for removing settings file\r\n \r\n :param _file_path: string with path to file to remove \r\n :param _retry_count: integer with number of attempts before error is raised\r\n :param _remove_dir: [optional] boolean to remove empty parent directories\r\n :return: Non... | [
{
"param": "_file_path",
"type": null
},
{
"param": "_retry_count",
"type": null
},
{
"param": "_remove_dir",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "_file_path",
"type": null,
"docstring": "string with path to file to remove",
"docstring_tokens": [
"string... |
a6ee05679049cee3a473643d3a0e04e197ad0764 | collectiveacuity/labPack | labpack/records/settings.py | [
"MIT"
] | Python | ingest_environ | <not_specific> | def ingest_environ(model_path=''):
''' a method to convert environment variables to a python dictionary
:param model_path: [optional] string with path to jsonmodel of data to ingest
:return: dictionary with environmental variables
NOTE: if a model is provided, then only those fields in the m... | a method to convert environment variables to a python dictionary
:param model_path: [optional] string with path to jsonmodel of data to ingest
:return: dictionary with environmental variables
NOTE: if a model is provided, then only those fields in the model will be
added to the output... | a method to convert environment variables to a python dictionary | [
"a",
"method",
"to",
"convert",
"environment",
"variables",
"to",
"a",
"python",
"dictionary"
] | def ingest_environ(model_path=''):
from os import environ, path
typed_dict = {}
environ_variables = dict(environ)
for key, value in environ_variables.items():
if value.lower() == 'true':
typed_dict[key] = True
elif value.lower() == 'false':
typed_dict[key] = False... | [
"def",
"ingest_environ",
"(",
"model_path",
"=",
"''",
")",
":",
"from",
"os",
"import",
"environ",
",",
"path",
"typed_dict",
"=",
"{",
"}",
"environ_variables",
"=",
"dict",
"(",
"environ",
")",
"for",
"key",
",",
"value",
"in",
"environ_variables",
".",... | a method to convert environment variables to a python dictionary | [
"a",
"method",
"to",
"convert",
"environment",
"variables",
"to",
"a",
"python",
"dictionary"
] | [
"''' a method to convert environment variables to a python dictionary\r\n\r\n :param model_path: [optional] string with path to jsonmodel of data to ingest\r\n :return: dictionary with environmental variables\r\n\r\n NOTE: if a model is provided, then only those fields in the model will be\r\n ... | [
{
"param": "model_path",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with environmental variables\nNOTE: if a model is provided, then only those fields in the model will be\nadded to the output and the value of any environment variable which\nmatches the uppercase name of each field in the model will be added\nto the dictionary if ... |
a6ee05679049cee3a473643d3a0e04e197ad0764 | collectiveacuity/labPack | labpack/records/settings.py | [
"MIT"
] | Python | compile_settings | <not_specific> | def compile_settings(model_path, file_path, ignore_errors=False):
''' a method to compile configuration values from different sources
NOTE: method searches the environment variables, a local
configuration path and the default values for a jsonmodel
object for valid ... | a method to compile configuration values from different sources
NOTE: method searches the environment variables, a local
configuration path and the default values for a jsonmodel
object for valid configuration values. if an environmental
variable or key i... | a method to compile configuration values from different sources
NOTE: method searches the environment variables, a local
configuration path and the default values for a jsonmodel
object for valid configuration values. if an environmental
variable or key inside a local config file matches the key
for a configuration s... | [
"a",
"method",
"to",
"compile",
"configuration",
"values",
"from",
"different",
"sources",
"NOTE",
":",
"method",
"searches",
"the",
"environment",
"variables",
"a",
"local",
"configuration",
"path",
"and",
"the",
"default",
"values",
"for",
"a",
"jsonmodel",
"o... | def compile_settings(model_path, file_path, ignore_errors=False):
from jsonmodel.validators import jsonModel
config_model = jsonModel(load_settings(model_path))
default_details = config_model.ingest(**{})
environ_details = ingest_environ()
try:
file_details = load_settings(file_path)
exc... | [
"def",
"compile_settings",
"(",
"model_path",
",",
"file_path",
",",
"ignore_errors",
"=",
"False",
")",
":",
"from",
"jsonmodel",
".",
"validators",
"import",
"jsonModel",
"config_model",
"=",
"jsonModel",
"(",
"load_settings",
"(",
"model_path",
")",
")",
"def... | a method to compile configuration values from different sources
NOTE: method searches the environment variables, a local
configuration path and the default values for a jsonmodel
object for valid configuration values. | [
"a",
"method",
"to",
"compile",
"configuration",
"values",
"from",
"different",
"sources",
"NOTE",
":",
"method",
"searches",
"the",
"environment",
"variables",
"a",
"local",
"configuration",
"path",
"and",
"the",
"default",
"values",
"for",
"a",
"jsonmodel",
"o... | [
"''' a method to compile configuration values from different sources\r\n\r\n NOTE: method searches the environment variables, a local\r\n configuration path and the default values for a jsonmodel\r\n object for valid configuration values. if an environmental\r\n ... | [
{
"param": "model_path",
"type": null
},
{
"param": "file_path",
"type": null
},
{
"param": "ignore_errors",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with settings",
"docstring_tokens": [
"dictionary",
"with",
"settings"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "model_path",
"type": null,
"docstring": "string with path... |
1492f382ecee255798f97bf9b337efa9d0781a53 | collectiveacuity/labPack | labpack/authentication/oauth2.py | [
"MIT"
] | Python | generate_url | <not_specific> | def generate_url(self, service_scope=None, state_value='', additional_fields=None):
''' a method to generate an authorization url to oauth2 service for client
:param service_scope: [optional] list with scope of permissions for agent
:param state_value: [optional] string with unique identi... | a method to generate an authorization url to oauth2 service for client
:param service_scope: [optional] list with scope of permissions for agent
:param state_value: [optional] string with unique identifier for callback
:param additional_fields: [optional] dictionary with key value strings ... | a method to generate an authorization url to oauth2 service for client | [
"a",
"method",
"to",
"generate",
"an",
"authorization",
"url",
"to",
"oauth2",
"service",
"for",
"client"
] | def generate_url(self, service_scope=None, state_value='', additional_fields=None):
title = '%s.generate_url' % self.__class__.__name__
input_fields = {
'state_value': state_value,
'service_scope': service_scope,
'additional_fields': additional_fields
}
... | [
"def",
"generate_url",
"(",
"self",
",",
"service_scope",
"=",
"None",
",",
"state_value",
"=",
"''",
",",
"additional_fields",
"=",
"None",
")",
":",
"title",
"=",
"'%s.generate_url'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{"... | a method to generate an authorization url to oauth2 service for client | [
"a",
"method",
"to",
"generate",
"an",
"authorization",
"url",
"to",
"oauth2",
"service",
"for",
"client"
] | [
"''' a method to generate an authorization url to oauth2 service for client\r\n\r\n :param service_scope: [optional] list with scope of permissions for agent\r\n :param state_value: [optional] string with unique identifier for callback\r\n :param additional_fields: [optional] dictionary with ke... | [
{
"param": "self",
"type": null
},
{
"param": "service_scope",
"type": null
},
{
"param": "state_value",
"type": null
},
{
"param": "additional_fields",
"type": null
}
] | {
"returns": [
{
"docstring": "string with authorization url",
"docstring_tokens": [
"string",
"with",
"authorization",
"url"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": nu... |
1492f382ecee255798f97bf9b337efa9d0781a53 | collectiveacuity/labPack | labpack/authentication/oauth2.py | [
"MIT"
] | Python | renew_token | <not_specific> | def renew_token(self, refresh_token):
''' a method to renew an access token from an oauth2 authorizing party
:param auth_code: string with refresh token provided by service with access token
:return: dictionary with access token details inside [json] key
token_details = self.ob... | a method to renew an access token from an oauth2 authorizing party
:param auth_code: string with refresh token provided by service with access token
:return: dictionary with access token details inside [json] key
token_details = self.objects.token.schema
| a method to renew an access token from an oauth2 authorizing party | [
"a",
"method",
"to",
"renew",
"an",
"access",
"token",
"from",
"an",
"oauth2",
"authorizing",
"party"
] | def renew_token(self, refresh_token):
title = '%s.renew_token' % self.__class__.__name__
input_args = {
'refresh_token': refresh_token
}
for key, value in input_args.items():
if value:
object_title = '%s(%s=%s)' % (title, key, value)
... | [
"def",
"renew_token",
"(",
"self",
",",
"refresh_token",
")",
":",
"title",
"=",
"'%s.renew_token'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_args",
"=",
"{",
"'refresh_token'",
":",
"refresh_token",
"}",
"for",
"key",
",",
"value",
"in",
"inpu... | a method to renew an access token from an oauth2 authorizing party | [
"a",
"method",
"to",
"renew",
"an",
"access",
"token",
"from",
"an",
"oauth2",
"authorizing",
"party"
] | [
"''' a method to renew an access token from an oauth2 authorizing party\r\n\r\n :param auth_code: string with refresh token provided by service with access token\r\n :return: dictionary with access token details inside [json] key\r\n\r\n token_details = self.objects.token.schema\r\n '''"... | [
{
"param": "self",
"type": null
},
{
"param": "refresh_token",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with access token details inside [json] key\ntoken_details = self.objects.token.schema",
"docstring_tokens": [
"dictionary",
"with",
"access",
"token",
"details",
"inside",
"[",
"json",
"]... |
60e562813c4a9894174feed04ae94a4c71ce1463 | collectiveacuity/labPack | labpack/authentication/aws/iam.py | [
"MIT"
] | Python | list_certificates | <not_specific> | def list_certificates(self):
'''
a method to retrieve a list of server certificates
:return: list with certificate name strings
'''
title = '%s.list_certificates' % self.__class__.__name__
# send request for list of certificates
self.printer('Querying AWS for ... |
a method to retrieve a list of server certificates
:return: list with certificate name strings
| a method to retrieve a list of server certificates | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"server",
"certificates"
] | def list_certificates(self):
title = '%s.list_certificates' % self.__class__.__name__
self.printer('Querying AWS for server certificates.')
try:
response = self.connection.list_server_certificates()
except:
raise AWSConnectionError(title)
cert_list = []
... | [
"def",
"list_certificates",
"(",
"self",
")",
":",
"title",
"=",
"'%s.list_certificates'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"self",
".",
"printer",
"(",
"'Querying AWS for server certificates.'",
")",
"try",
":",
"response",
"=",
"self",
".",
"con... | a method to retrieve a list of server certificates | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"server",
"certificates"
] | [
"'''\n a method to retrieve a list of server certificates\n\n :return: list with certificate name strings\n '''",
"# send request for list of certificates",
"# construct certificate list from response",
"# report results and return list"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "list with certificate name strings",
"docstring_tokens": [
"list",
"with",
"certificate",
"name",
"strings"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
60e562813c4a9894174feed04ae94a4c71ce1463 | collectiveacuity/labPack | labpack/authentication/aws/iam.py | [
"MIT"
] | Python | read_certificate | <not_specific> | def read_certificate(self, certificate_name):
'''
a method to retrieve the details about a server certificate
:param certificate_name: string with name of server certificate
:return: dictionary with certificate details
'''
title = '%s.read_certificate' % self.__cla... |
a method to retrieve the details about a server certificate
:param certificate_name: string with name of server certificate
:return: dictionary with certificate details
| a method to retrieve the details about a server certificate | [
"a",
"method",
"to",
"retrieve",
"the",
"details",
"about",
"a",
"server",
"certificate"
] | def read_certificate(self, certificate_name):
title = '%s.read_certificate' % self.__class__.__name__
input_fields = {
'certificate_name': certificate_name
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"read_certificate",
"(",
"self",
",",
"certificate_name",
")",
":",
"title",
"=",
"'%s.read_certificate'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'certificate_name'",
":",
"certificate_name",
"}",
"for",
"key",
",",
"va... | a method to retrieve the details about a server certificate | [
"a",
"method",
"to",
"retrieve",
"the",
"details",
"about",
"a",
"server",
"certificate"
] | [
"'''\n a method to retrieve the details about a server certificate\n\n :param certificate_name: string with name of server certificate\n :return: dictionary with certificate details\n '''",
"# validate inputs",
"# verify existence of server certificate",
"# send request for cer... | [
{
"param": "self",
"type": null
},
{
"param": "certificate_name",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with certificate details",
"docstring_tokens": [
"dictionary",
"with",
"certificate",
"details"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"do... |
60e562813c4a9894174feed04ae94a4c71ce1463 | collectiveacuity/labPack | labpack/authentication/aws/iam.py | [
"MIT"
] | Python | list_roles | <not_specific> | def list_roles(self):
'''
a method to retrieve a list of server certificates
:return: list with certificate name strings
'''
title = '%s.list_certificates' % self.__class__.__name__
# send request for list of certificates
self.printer('Querying AWS for iam... |
a method to retrieve a list of server certificates
:return: list with certificate name strings
| a method to retrieve a list of server certificates | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"server",
"certificates"
] | def list_roles(self):
title = '%s.list_certificates' % self.__class__.__name__
self.printer('Querying AWS for iam roles.')
try:
response = self.connection.list_roles()
except:
raise AWSConnectionError(title)
role_list = []
if 'Roles' in response.ke... | [
"def",
"list_roles",
"(",
"self",
")",
":",
"title",
"=",
"'%s.list_certificates'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"self",
".",
"printer",
"(",
"'Querying AWS for iam roles.'",
")",
"try",
":",
"response",
"=",
"self",
".",
"connection",
".",
... | a method to retrieve a list of server certificates | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"server",
"certificates"
] | [
"'''\n a method to retrieve a list of server certificates\n\n :return: list with certificate name strings\n '''",
"# send request for list of certificates",
"# construct certificate list from response",
"# report results and return list"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "list with certificate name strings",
"docstring_tokens": [
"list",
"with",
"certificate",
"name",
"strings"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
ac82766873b5febda45391ab6c749f47bbfdddd1 | collectiveacuity/labPack | labpack/handlers/requests.py | [
"MIT"
] | Python | _handle_command | <not_specific> | def _handle_command(self, sys_command, pipe=False, interactive=None, print_pipe=False, handle_error=False):
'''
a method to handle system commands which require connectivity
:param sys_command: string with shell command to run in subprocess
:param pipe: boolean t... |
a method to handle system commands which require connectivity
:param sys_command: string with shell command to run in subprocess
:param pipe: boolean to return a Popen object
:param interactive: [optional] callable object that accepts (string, Popen object)
... | a method to handle system commands which require connectivity | [
"a",
"method",
"to",
"handle",
"system",
"commands",
"which",
"require",
"connectivity"
] | def _handle_command(self, sys_command, pipe=False, interactive=None, print_pipe=False, handle_error=False):
import sys
from subprocess import Popen, PIPE, check_output, STDOUT, CalledProcessError
try:
if pipe:
p = Popen(sys_command, shell=True, stdout=PIPE, stderr=PIP... | [
"def",
"_handle_command",
"(",
"self",
",",
"sys_command",
",",
"pipe",
"=",
"False",
",",
"interactive",
"=",
"None",
",",
"print_pipe",
"=",
"False",
",",
"handle_error",
"=",
"False",
")",
":",
"import",
"sys",
"from",
"subprocess",
"import",
"Popen",
"... | a method to handle system commands which require connectivity | [
"a",
"method",
"to",
"handle",
"system",
"commands",
"which",
"require",
"connectivity"
] | [
"'''\r\n a method to handle system commands which require connectivity\r\n \r\n :param sys_command: string with shell command to run in subprocess \r\n :param pipe: boolean to return a Popen object\r\n :param interactive: [optional] callable object that accepts (string, Po... | [
{
"param": "self",
"type": null
},
{
"param": "sys_command",
"type": null
},
{
"param": "pipe",
"type": null
},
{
"param": "interactive",
"type": null
},
{
"param": "print_pipe",
"type": null
},
{
"param": "handle_error",
"type": null
}
] | {
"returns": [
{
"docstring": "Popen object or string or None",
"docstring_tokens": [
"Popen",
"object",
"or",
"string",
"or",
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": nul... |
ac82766873b5febda45391ab6c749f47bbfdddd1 | collectiveacuity/labPack | labpack/handlers/requests.py | [
"MIT"
] | Python | _check_connectivity | null | def _check_connectivity(self, err):
''' a method to check connectivity as source of error '''
try:
import requests
requests.get(self.uptime_ssl)
except:
from requests import Request
request_object = Request(method='GET', url=self... | a method to check connectivity as source of error | a method to check connectivity as source of error | [
"a",
"method",
"to",
"check",
"connectivity",
"as",
"source",
"of",
"error"
] | def _check_connectivity(self, err):
try:
import requests
requests.get(self.uptime_ssl)
except:
from requests import Request
request_object = Request(method='GET', url=self.uptime_ssl)
request_details = self.handle_requests(request_object)
... | [
"def",
"_check_connectivity",
"(",
"self",
",",
"err",
")",
":",
"try",
":",
"import",
"requests",
"requests",
".",
"get",
"(",
"self",
".",
"uptime_ssl",
")",
"except",
":",
"from",
"requests",
"import",
"Request",
"request_object",
"=",
"Request",
"(",
"... | a method to check connectivity as source of error | [
"a",
"method",
"to",
"check",
"connectivity",
"as",
"source",
"of",
"error"
] | [
"''' a method to check connectivity as source of error '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "err",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "err",
"type": null,
"docstring": null,
"docstring_tokens": []... |
ac82766873b5febda45391ab6c749f47bbfdddd1 | collectiveacuity/labPack | labpack/handlers/requests.py | [
"MIT"
] | Python | _request | <not_specific> | def _request(self, **kwargs):
''' a helper method for processing all request types '''
response = None
error = ''
code = 0
# send request
from requests import request
try:
response = request(**kwargs)
# handle... | a helper method for processing all request types | a helper method for processing all request types | [
"a",
"helper",
"method",
"for",
"processing",
"all",
"request",
"types"
] | def _request(self, **kwargs):
response = None
error = ''
code = 0
from requests import request
try:
response = request(**kwargs)
if self.handle_response:
response, error, code = self.handle_response(response)
else:
... | [
"def",
"_request",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"response",
"=",
"None",
"error",
"=",
"''",
"code",
"=",
"0",
"from",
"requests",
"import",
"request",
"try",
":",
"response",
"=",
"request",
"(",
"**",
"kwargs",
")",
"if",
"self",
"."... | a helper method for processing all request types | [
"a",
"helper",
"method",
"for",
"processing",
"all",
"request",
"types"
] | [
"''' a helper method for processing all request types '''",
"# send request\r",
"# handle response\r",
"# handle errors\r"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ac82766873b5febda45391ab6c749f47bbfdddd1 | collectiveacuity/labPack | labpack/handlers/requests.py | [
"MIT"
] | Python | _get_request | <not_specific> | def _get_request(self, url, params=None, **kwargs):
''' a method to catch and report http get request connectivity errors '''
# construct request kwargs
request_kwargs = {
'method': 'GET',
'url': url,
'params': params
}
... | a method to catch and report http get request connectivity errors | a method to catch and report http get request connectivity errors | [
"a",
"method",
"to",
"catch",
"and",
"report",
"http",
"get",
"request",
"connectivity",
"errors"
] | def _get_request(self, url, params=None, **kwargs):
request_kwargs = {
'method': 'GET',
'url': url,
'params': params
}
for key, value in kwargs.items():
request_kwargs[key] = value
return self._request(**request_kwargs) | [
"def",
"_get_request",
"(",
"self",
",",
"url",
",",
"params",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"request_kwargs",
"=",
"{",
"'method'",
":",
"'GET'",
",",
"'url'",
":",
"url",
",",
"'params'",
":",
"params",
"}",
"for",
"key",
",",
"value"... | a method to catch and report http get request connectivity errors | [
"a",
"method",
"to",
"catch",
"and",
"report",
"http",
"get",
"request",
"connectivity",
"errors"
] | [
"''' a method to catch and report http get request connectivity errors '''",
"# construct request kwargs\r",
"# send request and handle response\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "url",
"type": null
},
{
"param": "params",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": []... |
ac82766873b5febda45391ab6c749f47bbfdddd1 | collectiveacuity/labPack | labpack/handlers/requests.py | [
"MIT"
] | Python | _put_request | <not_specific> | def _put_request(self, url, data=None, json=None, **kwargs):
''' a method to catch and report http put request connectivity errors '''
# construct request kwargs
request_kwargs = {
'method': 'PUT',
'url': url,
'data': data,
'... | a method to catch and report http put request connectivity errors | a method to catch and report http put request connectivity errors | [
"a",
"method",
"to",
"catch",
"and",
"report",
"http",
"put",
"request",
"connectivity",
"errors"
] | def _put_request(self, url, data=None, json=None, **kwargs):
request_kwargs = {
'method': 'PUT',
'url': url,
'data': data,
'json': json
}
for key, value in kwargs.items():
request_kwargs[key] = value
return self._request(**reque... | [
"def",
"_put_request",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
",",
"json",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"request_kwargs",
"=",
"{",
"'method'",
":",
"'PUT'",
",",
"'url'",
":",
"url",
",",
"'data'",
":",
"data",
",",
"'js... | a method to catch and report http put request connectivity errors | [
"a",
"method",
"to",
"catch",
"and",
"report",
"http",
"put",
"request",
"connectivity",
"errors"
] | [
"''' a method to catch and report http put request connectivity errors '''",
"# construct request kwargs\r",
"# send request and handle response\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "url",
"type": null
},
{
"param": "data",
"type": null
},
{
"param": "json",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": []... |
ac82766873b5febda45391ab6c749f47bbfdddd1 | collectiveacuity/labPack | labpack/handlers/requests.py | [
"MIT"
] | Python | _patch_request | <not_specific> | def _patch_request(self, url, data=None, json=None, **kwargs):
''' a method to catch and report http patch request connectivity errors '''
# construct request kwargs
request_kwargs = {
'method': 'PATCH',
'url': url,
'data': data,
... | a method to catch and report http patch request connectivity errors | a method to catch and report http patch request connectivity errors | [
"a",
"method",
"to",
"catch",
"and",
"report",
"http",
"patch",
"request",
"connectivity",
"errors"
] | def _patch_request(self, url, data=None, json=None, **kwargs):
request_kwargs = {
'method': 'PATCH',
'url': url,
'data': data,
'json': json
}
for key, value in kwargs.items():
request_kwargs[key] = value
return self._request(**r... | [
"def",
"_patch_request",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
",",
"json",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"request_kwargs",
"=",
"{",
"'method'",
":",
"'PATCH'",
",",
"'url'",
":",
"url",
",",
"'data'",
":",
"data",
",",
... | a method to catch and report http patch request connectivity errors | [
"a",
"method",
"to",
"catch",
"and",
"report",
"http",
"patch",
"request",
"connectivity",
"errors"
] | [
"''' a method to catch and report http patch request connectivity errors '''",
"# construct request kwargs\r",
"# send request and handle response\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "url",
"type": null
},
{
"param": "data",
"type": null
},
{
"param": "json",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": []... |
ac82766873b5febda45391ab6c749f47bbfdddd1 | collectiveacuity/labPack | labpack/handlers/requests.py | [
"MIT"
] | Python | _head_request | <not_specific> | def _head_request(self, url, **kwargs):
''' a method to catch and report http head request connectivity errors '''
# construct request kwargs
request_kwargs = {
'method': 'HEAD',
'url': url
}
for key, value in kwargs.items():
... | a method to catch and report http head request connectivity errors | a method to catch and report http head request connectivity errors | [
"a",
"method",
"to",
"catch",
"and",
"report",
"http",
"head",
"request",
"connectivity",
"errors"
] | def _head_request(self, url, **kwargs):
request_kwargs = {
'method': 'HEAD',
'url': url
}
for key, value in kwargs.items():
request_kwargs[key] = value
return self._request(**request_kwargs) | [
"def",
"_head_request",
"(",
"self",
",",
"url",
",",
"**",
"kwargs",
")",
":",
"request_kwargs",
"=",
"{",
"'method'",
":",
"'HEAD'",
",",
"'url'",
":",
"url",
"}",
"for",
"key",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"request_kw... | a method to catch and report http head request connectivity errors | [
"a",
"method",
"to",
"catch",
"and",
"report",
"http",
"head",
"request",
"connectivity",
"errors"
] | [
"''' a method to catch and report http head request connectivity errors '''",
"# construct request kwargs\r",
"# send request and handle response\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "url",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": []... |
ac82766873b5febda45391ab6c749f47bbfdddd1 | collectiveacuity/labPack | labpack/handlers/requests.py | [
"MIT"
] | Python | _options_request | <not_specific> | def _options_request(self, url, **kwargs):
''' a method to catch and report http options request connectivity errors '''
# construct request kwargs
request_kwargs = {
'method': 'OPTIONS',
'url': url
}
for key, value in kwargs.items()... | a method to catch and report http options request connectivity errors | a method to catch and report http options request connectivity errors | [
"a",
"method",
"to",
"catch",
"and",
"report",
"http",
"options",
"request",
"connectivity",
"errors"
] | def _options_request(self, url, **kwargs):
request_kwargs = {
'method': 'OPTIONS',
'url': url
}
for key, value in kwargs.items():
request_kwargs[key] = value
return self._request(**request_kwargs) | [
"def",
"_options_request",
"(",
"self",
",",
"url",
",",
"**",
"kwargs",
")",
":",
"request_kwargs",
"=",
"{",
"'method'",
":",
"'OPTIONS'",
",",
"'url'",
":",
"url",
"}",
"for",
"key",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"requ... | a method to catch and report http options request connectivity errors | [
"a",
"method",
"to",
"catch",
"and",
"report",
"http",
"options",
"request",
"connectivity",
"errors"
] | [
"''' a method to catch and report http options request connectivity errors '''",
"# construct request kwargs\r",
"# send request and handle response\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "url",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": []... |
ac82766873b5febda45391ab6c749f47bbfdddd1 | collectiveacuity/labPack | labpack/handlers/requests.py | [
"MIT"
] | Python | _delete_request | <not_specific> | def _delete_request(self, url, **kwargs):
''' a method to catch and report http delete request connectivity errors '''
# construct request kwargs
request_kwargs = {
'method': 'DELETE',
'url': url
}
for key, value in kwargs.items():
... | a method to catch and report http delete request connectivity errors | a method to catch and report http delete request connectivity errors | [
"a",
"method",
"to",
"catch",
"and",
"report",
"http",
"delete",
"request",
"connectivity",
"errors"
] | def _delete_request(self, url, **kwargs):
request_kwargs = {
'method': 'DELETE',
'url': url
}
for key, value in kwargs.items():
request_kwargs[key] = value
return self._request(**request_kwargs) | [
"def",
"_delete_request",
"(",
"self",
",",
"url",
",",
"**",
"kwargs",
")",
":",
"request_kwargs",
"=",
"{",
"'method'",
":",
"'DELETE'",
",",
"'url'",
":",
"url",
"}",
"for",
"key",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"reques... | a method to catch and report http delete request connectivity errors | [
"a",
"method",
"to",
"catch",
"and",
"report",
"http",
"delete",
"request",
"connectivity",
"errors"
] | [
"''' a method to catch and report http delete request connectivity errors '''",
"# construct request kwargs\r",
"# send request and handle response\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "url",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": []... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | _validate_tags | null | def _validate_tags(self, tag_values, title):
''' a helper method to validate tag key and value pairs '''
if tag_values:
if len(tag_values.keys()) > 10:
raise Exception("%s(tag_values={...}) is invalid.\n Value %s for field .tag_values failed test 'max_keys': 10" % (... | a helper method to validate tag key and value pairs | a helper method to validate tag key and value pairs | [
"a",
"helper",
"method",
"to",
"validate",
"tag",
"key",
"and",
"value",
"pairs"
] | def _validate_tags(self, tag_values, title):
if tag_values:
if len(tag_values.keys()) > 10:
raise Exception("%s(tag_values={...}) is invalid.\n Value %s for field .tag_values failed test 'max_keys': 10" % (title, len(tag_values.keys())))
for key, value in tag_values.items... | [
"def",
"_validate_tags",
"(",
"self",
",",
"tag_values",
",",
"title",
")",
":",
"if",
"tag_values",
":",
"if",
"len",
"(",
"tag_values",
".",
"keys",
"(",
")",
")",
">",
"10",
":",
"raise",
"Exception",
"(",
"\"%s(tag_values={...}) is invalid.\\n Value %s for... | a helper method to validate tag key and value pairs | [
"a",
"helper",
"method",
"to",
"validate",
"tag",
"key",
"and",
"value",
"pairs"
] | [
"''' a helper method to validate tag key and value pairs '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "tag_values",
"type": null
},
{
"param": "title",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag_values",
"type": null,
"docstring": null,
"docstring_toke... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | check_instance_state | <not_specific> | def check_instance_state(self, instance_id, wait=True):
''' method for checking the state of an instance on AWS EC2
:param instance_id: string with AWS id of instance
:param wait: [optional] boolean to wait for instance while pending
:return: string reporting state of instance
... | method for checking the state of an instance on AWS EC2
:param instance_id: string with AWS id of instance
:param wait: [optional] boolean to wait for instance while pending
:return: string reporting state of instance
| method for checking the state of an instance on AWS EC2 | [
"method",
"for",
"checking",
"the",
"state",
"of",
"an",
"instance",
"on",
"AWS",
"EC2"
] | def check_instance_state(self, instance_id, wait=True):
title = '%s.check_instance_state' % self.__class__.__name__
input_fields = {
'instance_id': instance_id
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"check_instance_state",
"(",
"self",
",",
"instance_id",
",",
"wait",
"=",
"True",
")",
":",
"title",
"=",
"'%s.check_instance_state'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'instance_id'",
":",
"instance_id",
"}",
"... | method for checking the state of an instance on AWS EC2 | [
"method",
"for",
"checking",
"the",
"state",
"of",
"an",
"instance",
"on",
"AWS",
"EC2"
] | [
"''' method for checking the state of an instance on AWS EC2\n\n :param instance_id: string with AWS id of instance\n :param wait: [optional] boolean to wait for instance while pending\n :return: string reporting state of instance\n '''",
"# validate inputs",
"# notify state check",
... | [
{
"param": "self",
"type": null
},
{
"param": "instance_id",
"type": null
},
{
"param": "wait",
"type": null
}
] | {
"returns": [
{
"docstring": "string reporting state of instance",
"docstring_tokens": [
"string",
"reporting",
"state",
"of",
"instance"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | check_instance_status | <not_specific> | def check_instance_status(self, instance_id, wait=True):
'''
a method to wait until AWS instance reports an OK status
:param instance_id: string of instance id on AWS
:param wait: [optional] boolean to wait for instance while initializing
:return: True
'''
... |
a method to wait until AWS instance reports an OK status
:param instance_id: string of instance id on AWS
:param wait: [optional] boolean to wait for instance while initializing
:return: True
| a method to wait until AWS instance reports an OK status | [
"a",
"method",
"to",
"wait",
"until",
"AWS",
"instance",
"reports",
"an",
"OK",
"status"
] | def check_instance_status(self, instance_id, wait=True):
title = '%s.check_instance_status' % self.__class__.__name__
input_fields = {
'instance_id': instance_id
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"check_instance_status",
"(",
"self",
",",
"instance_id",
",",
"wait",
"=",
"True",
")",
":",
"title",
"=",
"'%s.check_instance_status'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'instance_id'",
":",
"instance_id",
"}",
... | a method to wait until AWS instance reports an OK status | [
"a",
"method",
"to",
"wait",
"until",
"AWS",
"instance",
"reports",
"an",
"OK",
"status"
] | [
"'''\n a method to wait until AWS instance reports an OK status\n\n :param instance_id: string of instance id on AWS\n :param wait: [optional] boolean to wait for instance while initializing\n :return: True\n '''",
"# validate inputs",
"# notify status check",
"# check s... | [
{
"param": "self",
"type": null
},
{
"param": "instance_id",
"type": null
},
{
"param": "wait",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | list_instances | <not_specific> | def list_instances(self, tag_values=None):
'''
a method to retrieve the list of instances on AWS EC2
:param tag_values: [optional] dictionary of tag key-values pairs
:return: list of strings with instance AWS ids
'''
title = '%s.list_instances' % self.__class__.__n... |
a method to retrieve the list of instances on AWS EC2
:param tag_values: [optional] dictionary of tag key-values pairs
:return: list of strings with instance AWS ids
| a method to retrieve the list of instances on AWS EC2 | [
"a",
"method",
"to",
"retrieve",
"the",
"list",
"of",
"instances",
"on",
"AWS",
"EC2"
] | def list_instances(self, tag_values=None):
title = '%s.list_instances' % self.__class__.__name__
input_fields = {
'tag_values': tag_values
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"list_instances",
"(",
"self",
",",
"tag_values",
"=",
"None",
")",
":",
"title",
"=",
"'%s.list_instances'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'tag_values'",
":",
"tag_values",
"}",
"for",
"key",
",",
"value",... | a method to retrieve the list of instances on AWS EC2 | [
"a",
"method",
"to",
"retrieve",
"the",
"list",
"of",
"instances",
"on",
"AWS",
"EC2"
] | [
"'''\n a method to retrieve the list of instances on AWS EC2\n\n :param tag_values: [optional] dictionary of tag key-values pairs\n :return: list of strings with instance AWS ids\n '''",
"# validate inputs",
"# add tags to method arguments",
"# request instance details from AWS... | [
{
"param": "self",
"type": null
},
{
"param": "tag_values",
"type": null
}
] | {
"returns": [
{
"docstring": "list of strings with instance AWS ids",
"docstring_tokens": [
"list",
"of",
"strings",
"with",
"instance",
"AWS",
"ids"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": ... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | read_instance | <not_specific> | def read_instance(self, instance_id):
'''
a method to retrieving the details of a single instances on AWS EC2
:param instance_id: string of instance id on AWS
:return: dictionary with instance attributes
relevant fields:
'instance_id': '',
'image_i... |
a method to retrieving the details of a single instances on AWS EC2
:param instance_id: string of instance id on AWS
:return: dictionary with instance attributes
relevant fields:
'instance_id': '',
'image_id': '',
'instance_type': '',
'regi... | a method to retrieving the details of a single instances on AWS EC2 | [
"a",
"method",
"to",
"retrieving",
"the",
"details",
"of",
"a",
"single",
"instances",
"on",
"AWS",
"EC2"
] | def read_instance(self, instance_id):
title = '%s.read_instance' % self.__class__.__name__
input_fields = {
'instance_id': instance_id
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(... | [
"def",
"read_instance",
"(",
"self",
",",
"instance_id",
")",
":",
"title",
"=",
"'%s.read_instance'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'instance_id'",
":",
"instance_id",
"}",
"for",
"key",
",",
"value",
"in",
"inpu... | a method to retrieving the details of a single instances on AWS EC2 | [
"a",
"method",
"to",
"retrieving",
"the",
"details",
"of",
"a",
"single",
"instances",
"on",
"AWS",
"EC2"
] | [
"'''\n a method to retrieving the details of a single instances on AWS EC2\n\n :param instance_id: string of instance id on AWS\n :return: dictionary with instance attributes\n\n relevant fields:\n \n 'instance_id': '',\n 'image_id': '',\n 'instance_type':... | [
{
"param": "self",
"type": null
},
{
"param": "instance_id",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with instance attributes\nrelevant fields.\n\n",
"docstring_tokens": [
"dictionary",
"with",
"instance",
"attributes",
"relevant",
"fields",
"."
],
"type": null
}
],
"raises": [],
"p... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | tag_instance | <not_specific> | def tag_instance(self, instance_id, tag_list):
'''
a method for adding or updating tags on an AWS instance
:param instance_id: string of instance id on AWS
:param tag_list: list of single key-value pairs
:return: dictionary with aws response info
'''
title ... |
a method for adding or updating tags on an AWS instance
:param instance_id: string of instance id on AWS
:param tag_list: list of single key-value pairs
:return: dictionary with aws response info
| a method for adding or updating tags on an AWS instance | [
"a",
"method",
"for",
"adding",
"or",
"updating",
"tags",
"on",
"an",
"AWS",
"instance"
] | def tag_instance(self, instance_id, tag_list):
title = '%s.tag_instance' % self.__class__.__name__
input_fields = {
'instance_id': instance_id,
'tag_list': tag_list
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str... | [
"def",
"tag_instance",
"(",
"self",
",",
"instance_id",
",",
"tag_list",
")",
":",
"title",
"=",
"'%s.tag_instance'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'instance_id'",
":",
"instance_id",
",",
"'tag_list'",
":",
"tag_li... | a method for adding or updating tags on an AWS instance | [
"a",
"method",
"for",
"adding",
"or",
"updating",
"tags",
"on",
"an",
"AWS",
"instance"
] | [
"'''\n a method for adding or updating tags on an AWS instance\n\n :param instance_id: string of instance id on AWS\n :param tag_list: list of single key-value pairs\n :return: dictionary with aws response info\n '''",
"# validate inputs",
"# retrieve tag list of instance"... | [
{
"param": "self",
"type": null
},
{
"param": "instance_id",
"type": null
},
{
"param": "tag_list",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with aws response info",
"docstring_tokens": [
"dictionary",
"with",
"aws",
"response",
"info"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | create_instance | <not_specific> | def create_instance(self, image_id, pem_file, group_ids, instance_type, volume_type='gp2', ebs_optimized=False, instance_monitoring=False, iam_profile='', tag_list=None, auction_bid=0.0):
'''
a method for starting an instance on AWS EC2
:param image_id: string with aws id of im... |
a method for starting an instance on AWS EC2
:param image_id: string with aws id of image for instance
:param pem_file: string with path to pem file to access image
:param group_ids: list with aws id of security group(s) to attach to instance
:param instance_ty... | a method for starting an instance on AWS EC2 | [
"a",
"method",
"for",
"starting",
"an",
"instance",
"on",
"AWS",
"EC2"
] | def create_instance(self, image_id, pem_file, group_ids, instance_type, volume_type='gp2', ebs_optimized=False, instance_monitoring=False, iam_profile='', tag_list=None, auction_bid=0.0):
title = '%s.create_instance' % self.__class__.__name__
input_fields = {
'image_id': image_id,
... | [
"def",
"create_instance",
"(",
"self",
",",
"image_id",
",",
"pem_file",
",",
"group_ids",
",",
"instance_type",
",",
"volume_type",
"=",
"'gp2'",
",",
"ebs_optimized",
"=",
"False",
",",
"instance_monitoring",
"=",
"False",
",",
"iam_profile",
"=",
"''",
",",... | a method for starting an instance on AWS EC2 | [
"a",
"method",
"for",
"starting",
"an",
"instance",
"on",
"AWS",
"EC2"
] | [
"'''\n a method for starting an instance on AWS EC2\n \n :param image_id: string with aws id of image for instance \n :param pem_file: string with path to pem file to access image\n :param group_ids: list with aws id of security group(s) to attach to instance\n :par... | [
{
"param": "self",
"type": null
},
{
"param": "image_id",
"type": null
},
{
"param": "pem_file",
"type": null
},
{
"param": "group_ids",
"type": null
},
{
"param": "instance_type",
"type": null
},
{
"param": "volume_type",
"type": null
},
{
... | {
"returns": [
{
"docstring": "string with id of instance",
"docstring_tokens": [
"string",
"with",
"id",
"of",
"instance"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | delete_instance | <not_specific> | def delete_instance(self, instance_id):
'''
method for removing an instance from AWS EC2
:param instance_id: string of instance id on AWS
:return: string reporting state of instance
'''
title = '%s.delete_instance' % self.__class__.__name__
# validate inputs
... |
method for removing an instance from AWS EC2
:param instance_id: string of instance id on AWS
:return: string reporting state of instance
| method for removing an instance from AWS EC2 | [
"method",
"for",
"removing",
"an",
"instance",
"from",
"AWS",
"EC2"
] | def delete_instance(self, instance_id):
title = '%s.delete_instance' % self.__class__.__name__
input_fields = {
'instance_id': instance_id
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.valid... | [
"def",
"delete_instance",
"(",
"self",
",",
"instance_id",
")",
":",
"title",
"=",
"'%s.delete_instance'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'instance_id'",
":",
"instance_id",
"}",
"for",
"key",
",",
"value",
"in",
"... | method for removing an instance from AWS EC2 | [
"method",
"for",
"removing",
"an",
"instance",
"from",
"AWS",
"EC2"
] | [
"'''\n method for removing an instance from AWS EC2\n\n :param instance_id: string of instance id on AWS\n :return: string reporting state of instance\n '''",
"# validate inputs",
"# report query",
"# retrieve state",
"# discover tags associated with instance id",
"# remove... | [
{
"param": "self",
"type": null
},
{
"param": "instance_id",
"type": null
}
] | {
"returns": [
{
"docstring": "string reporting state of instance",
"docstring_tokens": [
"string",
"reporting",
"state",
"of",
"instance"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | list_addresses | <not_specific> | def list_addresses(self, tag_values=None):
'''
a method to list elastic ip addresses associated with account on AWS
:param tag_values: [optional] dictionary of tag key values
:return: list of strings with ip addresses
'''
title = '%s.lis... |
a method to list elastic ip addresses associated with account on AWS
:param tag_values: [optional] dictionary of tag key values
:return: list of strings with ip addresses
| a method to list elastic ip addresses associated with account on AWS | [
"a",
"method",
"to",
"list",
"elastic",
"ip",
"addresses",
"associated",
"with",
"account",
"on",
"AWS"
] | def list_addresses(self, tag_values=None):
title = '%s.list_addresses' % self.__class__.__name__
input_fields = {
'tag_values': tag_values
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"list_addresses",
"(",
"self",
",",
"tag_values",
"=",
"None",
")",
":",
"title",
"=",
"'%s.list_addresses'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'tag_values'",
":",
"tag_values",
"}",
"for",
"key",
",",
"value",... | a method to list elastic ip addresses associated with account on AWS | [
"a",
"method",
"to",
"list",
"elastic",
"ip",
"addresses",
"associated",
"with",
"account",
"on",
"AWS"
] | [
"'''\n a method to list elastic ip addresses associated with account on AWS\n \n :param tag_values: [optional] dictionary of tag key values\n :return: list of strings with ip addresses\n '''",
"# validate inputs",
"# add tags to method arguments",
"# report query",
... | [
{
"param": "self",
"type": null
},
{
"param": "tag_values",
"type": null
}
] | {
"returns": [
{
"docstring": "list of strings with ip addresses",
"docstring_tokens": [
"list",
"of",
"strings",
"with",
"ip",
"addresses"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | read_address | <not_specific> | def read_address(self, ip_address):
'''
a method to retrieve details about an elastic ip address associated with account on AWS
:param ip_address: string with elastic ipv4 address on ec2
:return: dictionary with ip address details
'''
t... |
a method to retrieve details about an elastic ip address associated with account on AWS
:param ip_address: string with elastic ipv4 address on ec2
:return: dictionary with ip address details
| a method to retrieve details about an elastic ip address associated with account on AWS | [
"a",
"method",
"to",
"retrieve",
"details",
"about",
"an",
"elastic",
"ip",
"address",
"associated",
"with",
"account",
"on",
"AWS"
] | def read_address(self, ip_address):
title = '%s.read_address' % self.__class__.__name__
input_fields = {
'ip_address': ip_address
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"read_address",
"(",
"self",
",",
"ip_address",
")",
":",
"title",
"=",
"'%s.read_address'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'ip_address'",
":",
"ip_address",
"}",
"for",
"key",
",",
"value",
"in",
"input_fie... | a method to retrieve details about an elastic ip address associated with account on AWS | [
"a",
"method",
"to",
"retrieve",
"details",
"about",
"an",
"elastic",
"ip",
"address",
"associated",
"with",
"account",
"on",
"AWS"
] | [
"'''\n a method to retrieve details about an elastic ip address associated with account on AWS\n \n :param ip_address: string with elastic ipv4 address on ec2 \n :return: dictionary with ip address details\n '''",
"# validate inputs",
"# report query",
"# discover de... | [
{
"param": "self",
"type": null
},
{
"param": "ip_address",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with ip address details",
"docstring_tokens": [
"dictionary",
"with",
"ip",
"address",
"details"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | assign_address | <not_specific> | def assign_address(self, ip_address, instance_id):
'''
a method to assign (or reassign) an elastic ip to an instance on AWS
:param ip_address: string with elastic ipv4 address on ec2
:param instance_id: string with aws id for running instance
:return: ... |
a method to assign (or reassign) an elastic ip to an instance on AWS
:param ip_address: string with elastic ipv4 address on ec2
:param instance_id: string with aws id for running instance
:return: dictioanry with response metadata fields
| a method to assign (or reassign) an elastic ip to an instance on AWS | [
"a",
"method",
"to",
"assign",
"(",
"or",
"reassign",
")",
"an",
"elastic",
"ip",
"to",
"an",
"instance",
"on",
"AWS"
] | def assign_address(self, ip_address, instance_id):
title = '%s.assign_address' % self.__class__.__name__
input_fields = {
'ip_address': ip_address,
'instance_id': instance_id
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title... | [
"def",
"assign_address",
"(",
"self",
",",
"ip_address",
",",
"instance_id",
")",
":",
"title",
"=",
"'%s.assign_address'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'ip_address'",
":",
"ip_address",
",",
"'instance_id'",
":",
... | a method to assign (or reassign) an elastic ip to an instance on AWS | [
"a",
"method",
"to",
"assign",
"(",
"or",
"reassign",
")",
"an",
"elastic",
"ip",
"to",
"an",
"instance",
"on",
"AWS"
] | [
"'''\n a method to assign (or reassign) an elastic ip to an instance on AWS\n \n :param ip_address: string with elastic ipv4 address on ec2 \n :param instance_id: string with aws id for running instance\n :return: dictioanry with response metadata fields\n '''",
... | [
{
"param": "self",
"type": null
},
{
"param": "ip_address",
"type": null
},
{
"param": "instance_id",
"type": null
}
] | {
"returns": [
{
"docstring": "dictioanry with response metadata fields",
"docstring_tokens": [
"dictioanry",
"with",
"response",
"metadata",
"fields"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"t... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | check_image_state | <not_specific> | def check_image_state(self, image_id, wait=True):
'''
method for checking the state of an image on AWS EC2
:param image_id: string with AWS id of image
:param wait: [optional] boolean to wait for image while pending
:return: string reporting state of image
'''
... |
method for checking the state of an image on AWS EC2
:param image_id: string with AWS id of image
:param wait: [optional] boolean to wait for image while pending
:return: string reporting state of image
| method for checking the state of an image on AWS EC2 | [
"method",
"for",
"checking",
"the",
"state",
"of",
"an",
"image",
"on",
"AWS",
"EC2"
] | def check_image_state(self, image_id, wait=True):
title = '%s.check_image_state' % self.__class__.__name__
input_fields = {
'image_id': image_id
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields... | [
"def",
"check_image_state",
"(",
"self",
",",
"image_id",
",",
"wait",
"=",
"True",
")",
":",
"title",
"=",
"'%s.check_image_state'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'image_id'",
":",
"image_id",
"}",
"for",
"key",
... | method for checking the state of an image on AWS EC2 | [
"method",
"for",
"checking",
"the",
"state",
"of",
"an",
"image",
"on",
"AWS",
"EC2"
] | [
"'''\n method for checking the state of an image on AWS EC2\n\n :param image_id: string with AWS id of image\n :param wait: [optional] boolean to wait for image while pending\n :return: string reporting state of image\n '''",
"# validate inputs",
"# notify state check",
... | [
{
"param": "self",
"type": null
},
{
"param": "image_id",
"type": null
},
{
"param": "wait",
"type": null
}
] | {
"returns": [
{
"docstring": "string reporting state of image",
"docstring_tokens": [
"string",
"reporting",
"state",
"of",
"image"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | list_images | <not_specific> | def list_images(self, tag_values=None):
'''
a method to retrieve the list of images of account on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of image AWS ids
'''
title = '%s.list_images' % self.__class__.__name__
# validate inputs
... |
a method to retrieve the list of images of account on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of image AWS ids
| a method to retrieve the list of images of account on AWS EC2 | [
"a",
"method",
"to",
"retrieve",
"the",
"list",
"of",
"images",
"of",
"account",
"on",
"AWS",
"EC2"
] | def list_images(self, tag_values=None):
title = '%s.list_images' % self.__class__.__name__
input_fields = {
'tag_values': tag_values
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"list_images",
"(",
"self",
",",
"tag_values",
"=",
"None",
")",
":",
"title",
"=",
"'%s.list_images'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'tag_values'",
":",
"tag_values",
"}",
"for",
"key",
",",
"value",
"in... | a method to retrieve the list of images of account on AWS EC2 | [
"a",
"method",
"to",
"retrieve",
"the",
"list",
"of",
"images",
"of",
"account",
"on",
"AWS",
"EC2"
] | [
"'''\n a method to retrieve the list of images of account on AWS EC2\n\n :param tag_values: [optional] list of tag values\n :return: list of image AWS ids\n '''",
"# validate inputs",
"# add tags to method arguments",
"# request image details from AWS",
"# repeat request",
... | [
{
"param": "self",
"type": null
},
{
"param": "tag_values",
"type": null
}
] | {
"returns": [
{
"docstring": "list of image AWS ids",
"docstring_tokens": [
"list",
"of",
"image",
"AWS",
"ids"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | read_image | <not_specific> | def read_image(self, image_id):
'''
a method to retrieve the details of a single image on AWS EC2
:param image_id: string with AWS id of image
:return: dictionary of image attributes
relevant fields:
'image_id': '',
'snapshot_id': '',
'regi... |
a method to retrieve the details of a single image on AWS EC2
:param image_id: string with AWS id of image
:return: dictionary of image attributes
relevant fields:
'image_id': '',
'snapshot_id': '',
'region': '',
'state': '',
'tags'... | a method to retrieve the details of a single image on AWS EC2 | [
"a",
"method",
"to",
"retrieve",
"the",
"details",
"of",
"a",
"single",
"image",
"on",
"AWS",
"EC2"
] | def read_image(self, image_id):
title = '%s.read_image' % self.__class__.__name__
input_fields = {
'image_id': image_id
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(value, '.%s' % ... | [
"def",
"read_image",
"(",
"self",
",",
"image_id",
")",
":",
"title",
"=",
"'%s.read_image'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'image_id'",
":",
"image_id",
"}",
"for",
"key",
",",
"value",
"in",
"input_fields",
".... | a method to retrieve the details of a single image on AWS EC2 | [
"a",
"method",
"to",
"retrieve",
"the",
"details",
"of",
"a",
"single",
"image",
"on",
"AWS",
"EC2"
] | [
"'''\n a method to retrieve the details of a single image on AWS EC2\n\n :param image_id: string with AWS id of image\n :return: dictionary of image attributes\n\n relevant fields:\n \n 'image_id': '',\n 'snapshot_id': '',\n 'region': '',\n 'state':... | [
{
"param": "self",
"type": null
},
{
"param": "image_id",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary of image attributes\nrelevant fields.\n\n",
"docstring_tokens": [
"dictionary",
"of",
"image",
"attributes",
"relevant",
"fields",
"."
],
"type": null
}
],
"raises": [],
"params": [
... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | tag_image | <not_specific> | def tag_image(self, image_id, tag_list):
'''
a method for adding or updating tags on an AWS instance
:param image_id: string with AWS id of instance
:param tag_list: list of tags to add to instance
:return: dictionary with response data
'''
title = '%s.tag_... |
a method for adding or updating tags on an AWS instance
:param image_id: string with AWS id of instance
:param tag_list: list of tags to add to instance
:return: dictionary with response data
| a method for adding or updating tags on an AWS instance | [
"a",
"method",
"for",
"adding",
"or",
"updating",
"tags",
"on",
"an",
"AWS",
"instance"
] | def tag_image(self, image_id, tag_list):
title = '%s.tag_image' % self.__class__.__name__
input_fields = {
'image_id': image_id,
'tag_list': tag_list
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"tag_image",
"(",
"self",
",",
"image_id",
",",
"tag_list",
")",
":",
"title",
"=",
"'%s.tag_image'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'image_id'",
":",
"image_id",
",",
"'tag_list'",
":",
"tag_list",
"}",
"... | a method for adding or updating tags on an AWS instance | [
"a",
"method",
"for",
"adding",
"or",
"updating",
"tags",
"on",
"an",
"AWS",
"instance"
] | [
"'''\n a method for adding or updating tags on an AWS instance\n\n :param image_id: string with AWS id of instance\n :param tag_list: list of tags to add to instance\n :return: dictionary with response data\n '''",
"# validate inputs",
"# retrieve tag list of image",
"# ... | [
{
"param": "self",
"type": null
},
{
"param": "image_id",
"type": null
},
{
"param": "tag_list",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with response data",
"docstring_tokens": [
"dictionary",
"with",
"response",
"data"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": nu... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | create_image | <not_specific> | def create_image(self, instance_id, image_name, tag_list=None):
'''
method for imaging an instance on AWS EC2
:param instance_id: string with AWS id of running instance
:param image_name: string with name to give new image
:param tag_list: [optional] list of resources tags ... |
method for imaging an instance on AWS EC2
:param instance_id: string with AWS id of running instance
:param image_name: string with name to give new image
:param tag_list: [optional] list of resources tags to add to image
:return: string with AWS id of image
| method for imaging an instance on AWS EC2 | [
"method",
"for",
"imaging",
"an",
"instance",
"on",
"AWS",
"EC2"
] | def create_image(self, instance_id, image_name, tag_list=None):
title = '%s.create_image' % self.__class__.__name__
input_fields = {
'instance_id': instance_id,
'image_name': image_name,
'tag_list': tag_list
}
for key, value in input_fields.items():
... | [
"def",
"create_image",
"(",
"self",
",",
"instance_id",
",",
"image_name",
",",
"tag_list",
"=",
"None",
")",
":",
"title",
"=",
"'%s.create_image'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'instance_id'",
":",
"instance_id",... | method for imaging an instance on AWS EC2 | [
"method",
"for",
"imaging",
"an",
"instance",
"on",
"AWS",
"EC2"
] | [
"'''\n method for imaging an instance on AWS EC2\n\n :param instance_id: string with AWS id of running instance\n :param image_name: string with name to give new image\n :param tag_list: [optional] list of resources tags to add to image\n :return: string with AWS id of image\n... | [
{
"param": "self",
"type": null
},
{
"param": "instance_id",
"type": null
},
{
"param": "image_name",
"type": null
},
{
"param": "tag_list",
"type": null
}
] | {
"returns": [
{
"docstring": "string with AWS id of image",
"docstring_tokens": [
"string",
"with",
"AWS",
"id",
"of",
"image"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | delete_image | <not_specific> | def delete_image(self, image_id):
'''
method for removing an image from AWS EC2
:param image_id: string with AWS id of instance
:return: string with AWS response from snapshot delete
'''
title = '%s.delete_image' % self.__class__.__name__
# validate inputs
... |
method for removing an image from AWS EC2
:param image_id: string with AWS id of instance
:return: string with AWS response from snapshot delete
| method for removing an image from AWS EC2 | [
"method",
"for",
"removing",
"an",
"image",
"from",
"AWS",
"EC2"
] | def delete_image(self, image_id):
title = '%s.delete_image' % self.__class__.__name__
input_fields = {
'image_id': image_id
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(value, '.%s... | [
"def",
"delete_image",
"(",
"self",
",",
"image_id",
")",
":",
"title",
"=",
"'%s.delete_image'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'image_id'",
":",
"image_id",
"}",
"for",
"key",
",",
"value",
"in",
"input_fields",
... | method for removing an image from AWS EC2 | [
"method",
"for",
"removing",
"an",
"image",
"from",
"AWS",
"EC2"
] | [
"'''\n method for removing an image from AWS EC2\n\n :param image_id: string with AWS id of instance\n :return: string with AWS response from snapshot delete\n '''",
"# validate inputs",
"# report query",
"# retrieve state",
"# discover snapshot id and tags associated with in... | [
{
"param": "self",
"type": null
},
{
"param": "image_id",
"type": null
}
] | {
"returns": [
{
"docstring": "string with AWS response from snapshot delete",
"docstring_tokens": [
"string",
"with",
"AWS",
"response",
"from",
"snapshot",
"delete"
],
"type": null
}
],
"raises": [],
"params": [
{
... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | import_image | <not_specific> | def import_image(self, image_id, region_name):
'''
a method to import an image from another AWS region
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html
REQUIRED: aws credentials must have valid access to both regions
:param image_id: string wit... |
a method to import an image from another AWS region
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html
REQUIRED: aws credentials must have valid access to both regions
:param image_id: string with AWS id of source image
:param region_name: string... |
aws credentials must have valid access to both regions | [
"aws",
"credentials",
"must",
"have",
"valid",
"access",
"to",
"both",
"regions"
] | def import_image(self, image_id, region_name):
title = '%s.import_image' % self.__class__.__name__
input_fields = {
'image_id': image_id
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validat... | [
"def",
"import_image",
"(",
"self",
",",
"image_id",
",",
"region_name",
")",
":",
"title",
"=",
"'%s.import_image'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'image_id'",
":",
"image_id",
"}",
"for",
"key",
",",
"value",
... | a method to import an image from another AWS region
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html | [
"a",
"method",
"to",
"import",
"an",
"image",
"from",
"another",
"AWS",
"region",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"AWSEC2",
"/",
"latest",
"/",
"UserGuide",
"/",
"CopyingAMIs",
".",
"html"
] | [
"'''\n a method to import an image from another AWS region\n\n https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html\n\n REQUIRED: aws credentials must have valid access to both regions\n\n :param image_id: string with AWS id of source image\n :param reg... | [
{
"param": "self",
"type": null
},
{
"param": "image_id",
"type": null
},
{
"param": "region_name",
"type": null
}
] | {
"returns": [
{
"docstring": "string with AWS id of new image",
"docstring_tokens": [
"string",
"with",
"AWS",
"id",
"of",
"new",
"image"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | export_image | <not_specific> | def export_image(self, image_id, region_name):
'''
a method to add a copy of an image to another AWS region
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html
REQUIRED: iam credentials must have valid access to both regions
:param image_id: strin... |
a method to add a copy of an image to another AWS region
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html
REQUIRED: iam credentials must have valid access to both regions
:param image_id: string of AWS id of image to be copied
:param region_nam... |
iam credentials must have valid access to both regions | [
"iam",
"credentials",
"must",
"have",
"valid",
"access",
"to",
"both",
"regions"
] | def export_image(self, image_id, region_name):
title = '%s.export_image' % self.__class__.__name__
input_fields = {
'image_id': image_id
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validat... | [
"def",
"export_image",
"(",
"self",
",",
"image_id",
",",
"region_name",
")",
":",
"title",
"=",
"'%s.export_image'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'image_id'",
":",
"image_id",
"}",
"for",
"key",
",",
"value",
... | a method to add a copy of an image to another AWS region
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html | [
"a",
"method",
"to",
"add",
"a",
"copy",
"of",
"an",
"image",
"to",
"another",
"AWS",
"region",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"AWSEC2",
"/",
"latest",
"/",
"UserGuide",
"/",
"CopyingAMIs",
".",
"html"
] | [
"'''\n a method to add a copy of an image to another AWS region\n\n https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html\n\n REQUIRED: iam credentials must have valid access to both regions\n\n :param image_id: string of AWS id of image to be copied\n :... | [
{
"param": "self",
"type": null
},
{
"param": "image_id",
"type": null
},
{
"param": "region_name",
"type": null
}
] | {
"returns": [
{
"docstring": "string with AWS id of new image",
"docstring_tokens": [
"string",
"with",
"AWS",
"id",
"of",
"new",
"image"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | list_keypairs | <not_specific> | def list_keypairs(self):
'''
a method to discover the list of key pairs on AWS
:return: list of key pairs
'''
title = '%s.list_keypairs' % self.__class__.__name__
# request subnet list from AWS
self.iam.printer('Querying AWS region %s for key pairs.' % self.ia... |
a method to discover the list of key pairs on AWS
:return: list of key pairs
| a method to discover the list of key pairs on AWS | [
"a",
"method",
"to",
"discover",
"the",
"list",
"of",
"key",
"pairs",
"on",
"AWS"
] | def list_keypairs(self):
title = '%s.list_keypairs' % self.__class__.__name__
self.iam.printer('Querying AWS region %s for key pairs.' % self.iam.region_name)
keypair_list = []
try:
response = self.connection.describe_key_pairs()
except:
raise AWSConnectio... | [
"def",
"list_keypairs",
"(",
"self",
")",
":",
"title",
"=",
"'%s.list_keypairs'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"self",
".",
"iam",
".",
"printer",
"(",
"'Querying AWS region %s for key pairs.'",
"%",
"self",
".",
"iam",
".",
"region_name",
... | a method to discover the list of key pairs on AWS | [
"a",
"method",
"to",
"discover",
"the",
"list",
"of",
"key",
"pairs",
"on",
"AWS"
] | [
"'''\n a method to discover the list of key pairs on AWS\n\n :return: list of key pairs\n '''",
"# request subnet list from AWS",
"# construct list of keypairs from response",
"# report results and return list"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "list of key pairs",
"docstring_tokens": [
"list",
"of",
"key",
"pairs"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tok... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | list_subnets | <not_specific> | def list_subnets(self, tag_values=None):
'''
a method to discover the list of subnets on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of strings with subnet ids
'''
title = '%s.list_subnets' % self.__class__.__name__
# validate inputs... |
a method to discover the list of subnets on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of strings with subnet ids
| a method to discover the list of subnets on AWS EC2 | [
"a",
"method",
"to",
"discover",
"the",
"list",
"of",
"subnets",
"on",
"AWS",
"EC2"
] | def list_subnets(self, tag_values=None):
title = '%s.list_subnets' % self.__class__.__name__
input_fields = {
'tag_values': tag_values
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"list_subnets",
"(",
"self",
",",
"tag_values",
"=",
"None",
")",
":",
"title",
"=",
"'%s.list_subnets'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'tag_values'",
":",
"tag_values",
"}",
"for",
"key",
",",
"value",
"... | a method to discover the list of subnets on AWS EC2 | [
"a",
"method",
"to",
"discover",
"the",
"list",
"of",
"subnets",
"on",
"AWS",
"EC2"
] | [
"'''\n a method to discover the list of subnets on AWS EC2\n\n :param tag_values: [optional] list of tag values\n :return: list of strings with subnet ids\n '''",
"# validate inputs",
"# add tags to method arguments",
"# request instance details from AWS",
"# construct list o... | [
{
"param": "self",
"type": null
},
{
"param": "tag_values",
"type": null
}
] | {
"returns": [
{
"docstring": "list of strings with subnet ids",
"docstring_tokens": [
"list",
"of",
"strings",
"with",
"subnet",
"ids"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": n... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | read_subnet | <not_specific> | def read_subnet(self, subnet_id):
'''
a method to retrieve the details about a subnet
:param subnet_id: string with AWS id of subnet
:return: dictionary with subnet details
relevant fields:
'subnet_id': '',
'vpc_id': '',
'availability_zone'... |
a method to retrieve the details about a subnet
:param subnet_id: string with AWS id of subnet
:return: dictionary with subnet details
relevant fields:
'subnet_id': '',
'vpc_id': '',
'availability_zone': '',
'state': '',
'tags': [{'... | a method to retrieve the details about a subnet | [
"a",
"method",
"to",
"retrieve",
"the",
"details",
"about",
"a",
"subnet"
] | def read_subnet(self, subnet_id):
title = '%s.read_subnet' % self.__class__.__name__
input_fields = {
'subnet_id': subnet_id
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(value, '.%... | [
"def",
"read_subnet",
"(",
"self",
",",
"subnet_id",
")",
":",
"title",
"=",
"'%s.read_subnet'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'subnet_id'",
":",
"subnet_id",
"}",
"for",
"key",
",",
"value",
"in",
"input_fields",... | a method to retrieve the details about a subnet | [
"a",
"method",
"to",
"retrieve",
"the",
"details",
"about",
"a",
"subnet"
] | [
"'''\n a method to retrieve the details about a subnet\n\n :param subnet_id: string with AWS id of subnet\n :return: dictionary with subnet details\n\n relevant fields:\n \n 'subnet_id': '',\n 'vpc_id': '',\n 'availability_zone': '',\n 'state': '',\... | [
{
"param": "self",
"type": null
},
{
"param": "subnet_id",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with subnet details\nrelevant fields.\n\n",
"docstring_tokens": [
"dictionary",
"with",
"subnet",
"details",
"relevant",
"fields",
"."
],
"type": null
}
],
"raises": [],
"params": [
... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | list_security_groups | <not_specific> | def list_security_groups(self, tag_values=None):
'''
a method to discover the list of security groups on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of strings with security group ids
'''
title = '%s.list_security_groups' % self.__class__... |
a method to discover the list of security groups on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of strings with security group ids
| a method to discover the list of security groups on AWS EC2 | [
"a",
"method",
"to",
"discover",
"the",
"list",
"of",
"security",
"groups",
"on",
"AWS",
"EC2"
] | def list_security_groups(self, tag_values=None):
title = '%s.list_security_groups' % self.__class__.__name__
input_fields = {
'tag_values': tag_values
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, str... | [
"def",
"list_security_groups",
"(",
"self",
",",
"tag_values",
"=",
"None",
")",
":",
"title",
"=",
"'%s.list_security_groups'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'tag_values'",
":",
"tag_values",
"}",
"for",
"key",
","... | a method to discover the list of security groups on AWS EC2 | [
"a",
"method",
"to",
"discover",
"the",
"list",
"of",
"security",
"groups",
"on",
"AWS",
"EC2"
] | [
"'''\n a method to discover the list of security groups on AWS EC2\n\n :param tag_values: [optional] list of tag values\n :return: list of strings with security group ids\n '''",
"# validate inputs",
"# add tags to method arguments",
"# request instance details from AWS",
"# ... | [
{
"param": "self",
"type": null
},
{
"param": "tag_values",
"type": null
}
] | {
"returns": [
{
"docstring": "list of strings with security group ids",
"docstring_tokens": [
"list",
"of",
"strings",
"with",
"security",
"group",
"ids"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifie... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | read_security_group | <not_specific> | def read_security_group(self, group_id):
'''
a method to retrieve the details about a security group
:param group_id: string with AWS id of security group
:return: dictionary with security group details
relevant fields:
'group_id: '',
'vpc_id': '',... |
a method to retrieve the details about a security group
:param group_id: string with AWS id of security group
:return: dictionary with security group details
relevant fields:
'group_id: '',
'vpc_id': '',
'group_name': '',
'tags': [{'key': '... | a method to retrieve the details about a security group | [
"a",
"method",
"to",
"retrieve",
"the",
"details",
"about",
"a",
"security",
"group"
] | def read_security_group(self, group_id):
title = '%s.read_security_group' % self.__class__.__name__
input_fields = {
'group_id': group_id
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.valida... | [
"def",
"read_security_group",
"(",
"self",
",",
"group_id",
")",
":",
"title",
"=",
"'%s.read_security_group'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'group_id'",
":",
"group_id",
"}",
"for",
"key",
",",
"value",
"in",
"i... | a method to retrieve the details about a security group | [
"a",
"method",
"to",
"retrieve",
"the",
"details",
"about",
"a",
"security",
"group"
] | [
"'''\n a method to retrieve the details about a security group\n\n :param group_id: string with AWS id of security group\n :return: dictionary with security group details\n\n relevant fields:\n \n 'group_id: '',\n 'vpc_id': '',\n 'group_name': '',\n ... | [
{
"param": "self",
"type": null
},
{
"param": "group_id",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with security group details\nrelevant fields.\n\n",
"docstring_tokens": [
"dictionary",
"with",
"security",
"group",
"details",
"relevant",
"fields",
"."
],
"type": null
}
],
"... |
8b1f552430a92819069e91f6834e80f3f3dc5775 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | [
"MIT"
] | Python | cleanup | <not_specific> | def cleanup(self):
'''
a method for removing instances and images in unusual states
:return: True
'''
# find non-running instances
self.iam.printer('Cleaning up AWS region %s.' % self.iam.region_name)
response = self.connection.describe_instances()
inst... |
a method for removing instances and images in unusual states
:return: True
| a method for removing instances and images in unusual states | [
"a",
"method",
"for",
"removing",
"instances",
"and",
"images",
"in",
"unusual",
"states"
] | def cleanup(self):
self.iam.printer('Cleaning up AWS region %s.' % self.iam.region_name)
response = self.connection.describe_instances()
instance_list = response['Reservations']
for instance in instance_list:
instance_info = instance['Instances'][0]
if instance_in... | [
"def",
"cleanup",
"(",
"self",
")",
":",
"self",
".",
"iam",
".",
"printer",
"(",
"'Cleaning up AWS region %s.'",
"%",
"self",
".",
"iam",
".",
"region_name",
")",
"response",
"=",
"self",
".",
"connection",
".",
"describe_instances",
"(",
")",
"instance_lis... | a method for removing instances and images in unusual states | [
"a",
"method",
"for",
"removing",
"instances",
"and",
"images",
"in",
"unusual",
"states"
] | [
"'''\n a method for removing instances and images in unusual states\n\n :return: True\n '''",
"# find non-running instances",
"# try to remove tags associated with non-running instance",
"# try stopping non-running instance",
"# try terminating non-running instance",
"# find non-a... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | update_member_profile | <not_specific> | def update_member_profile(self, brief_details, profile_details):
''' a method to update user profile details on meetup
:param brief_details: dictionary with member brief details with updated values
:param profile_details: dictionary with member profile details with updated values
... | a method to update user profile details on meetup
:param brief_details: dictionary with member brief details with updated values
:param profile_details: dictionary with member profile details with updated values
:return: dictionary with partial profile details inside [json] key
| a method to update user profile details on meetup | [
"a",
"method",
"to",
"update",
"user",
"profile",
"details",
"on",
"meetup"
] | def update_member_profile(self, brief_details, profile_details):
title = '%s.update_member_profile' % self.__class__.__name__
if not 'profile_edit' in self.service_scope:
raise ValueError('%s requires group_join as part of oauth2 service_scope permissions.' % title)
brief_details = s... | [
"def",
"update_member_profile",
"(",
"self",
",",
"brief_details",
",",
"profile_details",
")",
":",
"title",
"=",
"'%s.update_member_profile'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"if",
"not",
"'profile_edit'",
"in",
"self",
".",
"service_scope",
":",... | a method to update user profile details on meetup | [
"a",
"method",
"to",
"update",
"user",
"profile",
"details",
"on",
"meetup"
] | [
"''' a method to update user profile details on meetup\r\n\r\n :param brief_details: dictionary with member brief details with updated values\r\n :param profile_details: dictionary with member profile details with updated values\r\n :return: dictionary with partial profile details inside [json]... | [
{
"param": "self",
"type": null
},
{
"param": "brief_details",
"type": null
},
{
"param": "profile_details",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with partial profile details inside [json] key",
"docstring_tokens": [
"dictionary",
"with",
"partial",
"profile",
"details",
"inside",
"[",
"json",
"]",
"key"
],
"type... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | list_member_topics | <not_specific> | def list_member_topics(self, member_id):
''' a method to retrieve a list of topics member follows
:param member_id: integer with meetup member id
:return: dictionary with list of topic details inside [json] key
topic_details = self.objects.topic.schema
'''
# htt... | a method to retrieve a list of topics member follows
:param member_id: integer with meetup member id
:return: dictionary with list of topic details inside [json] key
topic_details = self.objects.topic.schema
| a method to retrieve a list of topics member follows | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"topics",
"member",
"follows"
] | def list_member_topics(self, member_id):
title = '%s.list_member_topics' % self.__class__.__name__
input_fields = {
'member_id': member_id
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"list_member_topics",
"(",
"self",
",",
"member_id",
")",
":",
"title",
"=",
"'%s.list_member_topics'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'member_id'",
":",
"member_id",
"}",
"for",
"key",
",",
"value",
"in",
"... | a method to retrieve a list of topics member follows | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"topics",
"member",
"follows"
] | [
"''' a method to retrieve a list of topics member follows\r\n\r\n :param member_id: integer with meetup member id\r\n :return: dictionary with list of topic details inside [json] key\r\n\r\n topic_details = self.objects.topic.schema\r\n '''",
"# https://www.meetup.com/meetup_api/docs/m... | [
{
"param": "self",
"type": null
},
{
"param": "member_id",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with list of topic details inside [json] key\ntopic_details = self.objects.topic.schema",
"docstring_tokens": [
"dictionary",
"with",
"list",
"of",
"topic",
"details",
"inside",
"[",
"json... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | list_member_groups | <not_specific> | def list_member_groups(self, member_id):
''' a method to retrieve a list of meetup groups member belongs to
:param member_id: integer with meetup member id
:return: dictionary with list of group details in [json]
group_details = self.objects.group_profile.schema
'''
... | a method to retrieve a list of meetup groups member belongs to
:param member_id: integer with meetup member id
:return: dictionary with list of group details in [json]
group_details = self.objects.group_profile.schema
| a method to retrieve a list of meetup groups member belongs to | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"meetup",
"groups",
"member",
"belongs",
"to"
] | def list_member_groups(self, member_id):
title = '%s.list_member_groups' % self.__class__.__name__
input_fields = {
'member_id': member_id
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"list_member_groups",
"(",
"self",
",",
"member_id",
")",
":",
"title",
"=",
"'%s.list_member_groups'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'member_id'",
":",
"member_id",
"}",
"for",
"key",
",",
"value",
"in",
"... | a method to retrieve a list of meetup groups member belongs to | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"meetup",
"groups",
"member",
"belongs",
"to"
] | [
"''' a method to retrieve a list of meetup groups member belongs to\r\n\r\n :param member_id: integer with meetup member id\r\n :return: dictionary with list of group details in [json]\r\n\r\n group_details = self.objects.group_profile.schema\r\n '''",
"# https://www.meetup.com/meetup_... | [
{
"param": "self",
"type": null
},
{
"param": "member_id",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with list of group details in [json]\ngroup_details = self.objects.group_profile.schema",
"docstring_tokens": [
"dictionary",
"with",
"list",
"of",
"group",
"details",
"in",
"[",
"json",
... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | list_member_events | <not_specific> | def list_member_events(self, upcoming=True):
''' a method to retrieve a list of events member attended or will attend
:param upcoming: [optional] boolean to filter list to only future events
:return: dictionary with list of event details inside [json] key
event_details = self._... | a method to retrieve a list of events member attended or will attend
:param upcoming: [optional] boolean to filter list to only future events
:return: dictionary with list of event details inside [json] key
event_details = self._reconstruct_event({})
| a method to retrieve a list of events member attended or will attend | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"events",
"member",
"attended",
"or",
"will",
"attend"
] | def list_member_events(self, upcoming=True):
url = '%s/self/events' % self.endpoint
params = {
'status': 'past',
'fields': 'comment_count,event_hosts,rsvp_rules,short_link,survey_questions,rsvpable'
}
if upcoming:
params['status'] = 'upcoming'
... | [
"def",
"list_member_events",
"(",
"self",
",",
"upcoming",
"=",
"True",
")",
":",
"url",
"=",
"'%s/self/events'",
"%",
"self",
".",
"endpoint",
"params",
"=",
"{",
"'status'",
":",
"'past'",
",",
"'fields'",
":",
"'comment_count,event_hosts,rsvp_rules,short_link,s... | a method to retrieve a list of events member attended or will attend | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"events",
"member",
"attended",
"or",
"will",
"attend"
] | [
"''' a method to retrieve a list of events member attended or will attend\r\n\r\n :param upcoming: [optional] boolean to filter list to only future events\r\n :return: dictionary with list of event details inside [json] key\r\n\r\n event_details = self._reconstruct_event({})\r\n '''",
... | [
{
"param": "self",
"type": null
},
{
"param": "upcoming",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with list of event details inside [json] key\nevent_details = self._reconstruct_event({})",
"docstring_tokens": [
"dictionary",
"with",
"list",
"of",
"event",
"details",
"inside",
"[",
"js... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | list_groups | <not_specific> | def list_groups(self, topics=None, categories=None, text='', country_code='', latitude=0.0, longitude=0.0, location='', radius=0.0, zip_code='', max_results=0, member_groups=True):
''' a method to find meetup groups based upon a number of filters
:param topics: [optional] list of integer meetup id... | a method to find meetup groups based upon a number of filters
:param topics: [optional] list of integer meetup ids for topics
:param text: [optional] string with words in groups to search
:param country_code: [optional] string with two character country code
:param latitude: [opti... | a method to find meetup groups based upon a number of filters | [
"a",
"method",
"to",
"find",
"meetup",
"groups",
"based",
"upon",
"a",
"number",
"of",
"filters"
] | def list_groups(self, topics=None, categories=None, text='', country_code='', latitude=0.0, longitude=0.0, location='', radius=0.0, zip_code='', max_results=0, member_groups=True):
title = '%s.list_groups' % self.__class__.__name__
input_fields = {
'categories': categories,
'topi... | [
"def",
"list_groups",
"(",
"self",
",",
"topics",
"=",
"None",
",",
"categories",
"=",
"None",
",",
"text",
"=",
"''",
",",
"country_code",
"=",
"''",
",",
"latitude",
"=",
"0.0",
",",
"longitude",
"=",
"0.0",
",",
"location",
"=",
"''",
",",
"radius... | a method to find meetup groups based upon a number of filters | [
"a",
"method",
"to",
"find",
"meetup",
"groups",
"based",
"upon",
"a",
"number",
"of",
"filters"
] | [
"''' a method to find meetup groups based upon a number of filters\r\n\r\n :param topics: [optional] list of integer meetup ids for topics\r\n :param text: [optional] string with words in groups to search\r\n :param country_code: [optional] string with two character country code\r\n :par... | [
{
"param": "self",
"type": null
},
{
"param": "topics",
"type": null
},
{
"param": "categories",
"type": null
},
{
"param": "text",
"type": null
},
{
"param": "country_code",
"type": null
},
{
"param": "latitude",
"type": null
},
{
"param":... | {
"returns": [
{
"docstring": "dictionary with list of group details inside [json] key\ngroup_details = self._reconstruct_group(**{})",
"docstring_tokens": [
"dictionary",
"with",
"list",
"of",
"group",
"details",
"inside",
"[",
"... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | list_group_events | <not_specific> | def list_group_events(self, group_url, upcoming=True):
''' a method to retrieve a list of upcoming events hosted by group
:param group_url: string with meetup urlname field of group
:param upcoming: [optional] boolean to filter list to only future events
:return: dictionary with ... | a method to retrieve a list of upcoming events hosted by group
:param group_url: string with meetup urlname field of group
:param upcoming: [optional] boolean to filter list to only future events
:return: dictionary with list of event details inside [json] key
event_details = se... | a method to retrieve a list of upcoming events hosted by group | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"upcoming",
"events",
"hosted",
"by",
"group"
] | def list_group_events(self, group_url, upcoming=True):
title = '%s.list_group_events' % self.__class__.__name__
input_fields = {
'group_url': group_url
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, st... | [
"def",
"list_group_events",
"(",
"self",
",",
"group_url",
",",
"upcoming",
"=",
"True",
")",
":",
"title",
"=",
"'%s.list_group_events'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'group_url'",
":",
"group_url",
"}",
"for",
... | a method to retrieve a list of upcoming events hosted by group | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"upcoming",
"events",
"hosted",
"by",
"group"
] | [
"''' a method to retrieve a list of upcoming events hosted by group\r\n\r\n :param group_url: string with meetup urlname field of group\r\n :param upcoming: [optional] boolean to filter list to only future events\r\n :return: dictionary with list of event details inside [json] key\r\n\r\n ... | [
{
"param": "self",
"type": null
},
{
"param": "group_url",
"type": null
},
{
"param": "upcoming",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with list of event details inside [json] key\nevent_details = self._reconstruct_event({})",
"docstring_tokens": [
"dictionary",
"with",
"list",
"of",
"event",
"details",
"inside",
"[",
"js... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | list_group_members | <not_specific> | def list_group_members(self, group_url, max_results=0):
''' a method to retrieve a list of members for a meetup group
:param group_url: string with meetup urlname for group
:param max_results: [optional] integer with number of members to include
:return: dictionary with list of m... | a method to retrieve a list of members for a meetup group
:param group_url: string with meetup urlname for group
:param max_results: [optional] integer with number of members to include
:return: dictionary with list of member details inside [json] key
member_details = self._reco... | a method to retrieve a list of members for a meetup group | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"members",
"for",
"a",
"meetup",
"group"
] | def list_group_members(self, group_url, max_results=0):
title = '%s.list_group_members' % self.__class__.__name__
input_fields = {
'group_url': group_url,
'max_results': max_results
}
for key, value in input_fields.items():
if value:
ob... | [
"def",
"list_group_members",
"(",
"self",
",",
"group_url",
",",
"max_results",
"=",
"0",
")",
":",
"title",
"=",
"'%s.list_group_members'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'group_url'",
":",
"group_url",
",",
"'max_r... | a method to retrieve a list of members for a meetup group | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"members",
"for",
"a",
"meetup",
"group"
] | [
"''' a method to retrieve a list of members for a meetup group\r\n\r\n :param group_url: string with meetup urlname for group\r\n :param max_results: [optional] integer with number of members to include\r\n :return: dictionary with list of member details inside [json] key\r\n\r\n member_... | [
{
"param": "self",
"type": null
},
{
"param": "group_url",
"type": null
},
{
"param": "max_results",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with list of member details inside [json] key\nmember_details = self._reconstruct_member({})",
"docstring_tokens": [
"dictionary",
"with",
"list",
"of",
"member",
"details",
"inside",
"[",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.