Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
wigTrack.region_stats | (self) | return mean, median, stddev ans stderr for the region | return mean, median, stddev ans stderr for the region | def region_stats(self):
""" return mean, median, stddev ans stderr for the region """
return({"mean":self.region_mean(),
"median":self.region_median(),
"standard_deviation":self.region_stddev(),
"standard error": self.region_stderr()}) | [
"def",
"region_stats",
"(",
"self",
")",
":",
"return",
"(",
"{",
"\"mean\"",
":",
"self",
".",
"region_mean",
"(",
")",
",",
"\"median\"",
":",
"self",
".",
"region_median",
"(",
")",
",",
"\"standard_deviation\"",
":",
"self",
".",
"region_stddev",
"(",
... | [
760,
4
] | [
767,
56
] | python | en | ['en', 'no', 'en'] | True |
wigTrack.region_fracbases | (self) | return the fraction of bases in the region that have a signal | return the fraction of bases in the region that have a signal | def region_fracbases(self):
""" return the fraction of bases in the region that have a signal """
return(float(len(self._region_index))/self.region_length()) | [
"def",
"region_fracbases",
"(",
"self",
")",
":",
"return",
"(",
"float",
"(",
"len",
"(",
"self",
".",
"_region_index",
")",
")",
"/",
"self",
".",
"region_length",
"(",
")",
")"
] | [
769,
4
] | [
773,
67
] | python | en | ['en', 'en', 'en'] | True |
wigTrack.region_mean_per_base | (self) | return the sum of the data divided by its length | return the sum of the data divided by its length | def region_mean_per_base(self):
''' return the sum of the data divided by its length '''
if self.region is None:
msg = "No region set"
raise ValueError(msg)
return(self.data[self._region_index].sum()/self.... | [
"def",
"region_mean_per_base",
"(",
"self",
")",
":",
"if",
"self",
".",
"region",
"is",
"None",
":",
"msg",
"=",
"\"No region set\"",
"raise",
"ValueError",
"(",
"msg",
")",
"return",
"(",
"self",
".",
"data",
"[",
"self",
".",
"_region_index",
"]",
"."... | [
775,
4
] | [
783,
72
] | python | en | ['en', 'en', 'en'] | True |
wigTrack.writeWig | (self, filename, fulldata=False, name=None, desc=None,
rgbcolstr=None, writemode="a", skipdefinitionline=False) | writes all, or a subset, of the tract data to the filehandle
Optionally can include a name, desc and colour for the track, specify
whether to write all the data or just the data for the region selected,
and whether to append to a file, or overwrite. | writes all, or a subset, of the tract data to the filehandle
Optionally can include a name, desc and colour for the track, specify
whether to write all the data or just the data for the region selected,
and whether to append to a file, or overwrite. | def writeWig(self, filename, fulldata=False, name=None, desc=None,
rgbcolstr=None, writemode="a", skipdefinitionline=False):
''' writes all, or a subset, of the tract data to the filehandle
Optionally can include a name, desc and colour for the track, specify
... | [
"def",
"writeWig",
"(",
"self",
",",
"filename",
",",
"fulldata",
"=",
"False",
",",
"name",
"=",
"None",
",",
"desc",
"=",
"None",
",",
"rgbcolstr",
"=",
"None",
",",
"writemode",
"=",
"\"a\"",
",",
"skipdefinitionline",
"=",
"False",
")",
":",
"if",
... | [
785,
4
] | [
840,
22
] | python | en | ['en', 'en', 'en'] | True |
component_submatrix | (rxn, components) |
Get the submatrices associated with different components
from the reaction data container.
|
Get the submatrices associated with different components
from the reaction data container.
| def component_submatrix(rxn, components):
"""
Get the submatrices associated with different components
from the reaction data container.
"""
# Get descriptors associated with each submatrix
columns = {}
for key in components:
component_descriptors = []
for col in rxn.dat... | [
"def",
"component_submatrix",
"(",
"rxn",
",",
"components",
")",
":",
"# Get descriptors associated with each submatrix",
"columns",
"=",
"{",
"}",
"for",
"key",
"in",
"components",
":",
"component_descriptors",
"=",
"[",
"]",
"for",
"col",
"in",
"rxn",
".",
"d... | [
22,
0
] | [
48,
22
] | python | en | ['en', 'error', 'th'] | False |
principles | (descriptors, scale='minmax') |
Get principle components associated with each reaction
component. Use the first PC for DOE.
|
Get principle components associated with each reaction
component. Use the first PC for DOE.
| def principles(descriptors, scale='minmax'):
"""
Get principle components associated with each reaction
component. Use the first PC for DOE.
"""
coordinates = {}
for key in descriptors:
unique = descriptors[key].drop_duplicates()
if len(descriptors[key].columns.valu... | [
"def",
"principles",
"(",
"descriptors",
",",
"scale",
"=",
"'minmax'",
")",
":",
"coordinates",
"=",
"{",
"}",
"for",
"key",
"in",
"descriptors",
":",
"unique",
"=",
"descriptors",
"[",
"key",
"]",
".",
"drop_duplicates",
"(",
")",
"if",
"len",
"(",
"... | [
52,
0
] | [
77,
22
] | python | en | ['en', 'error', 'th'] | False |
init_design.get_closest | (self, pc, value) |
Fill a numerical design by getting reaction component
which corresponda to the closest PC value.
|
Fill a numerical design by getting reaction component
which corresponda to the closest PC value.
| def get_closest(self, pc, value):
"""
Fill a numerical design by getting reaction component
which corresponda to the closest PC value.
"""
diff = (self.pcs[pc].iloc[:,1].copy() - value).abs().sort_values()
closest = self.pcs[pc].iloc[diff.index.values[0]]
... | [
"def",
"get_closest",
"(",
"self",
",",
"pc",
",",
"value",
")",
":",
"diff",
"=",
"(",
"self",
".",
"pcs",
"[",
"pc",
"]",
".",
"iloc",
"[",
":",
",",
"1",
"]",
".",
"copy",
"(",
")",
"-",
"value",
")",
".",
"abs",
"(",
")",
".",
"sort_val... | [
105,
4
] | [
114,
29
] | python | en | ['en', 'error', 'th'] | False |
init_design.get_closest_principles | (self) |
Loop get_closest over all principal components.
|
Loop get_closest over all principal components.
| def get_closest_principles(self):
"""
Loop get_closest over all principal components.
"""
experiments = []
for i in range(len(self.design)):
experiment = []
for col in self.design.columns.values:
closest = self.get_closest(col, sel... | [
"def",
"get_closest_principles",
"(",
"self",
")",
":",
"experiments",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"design",
")",
")",
":",
"experiment",
"=",
"[",
"]",
"for",
"col",
"in",
"self",
".",
"design",
".",
"co... | [
116,
4
] | [
130,
81
] | python | en | ['en', 'error', 'th'] | False |
init_design.encoded | (self) |
Get encoded domain points corresponding to an experimental
design.
|
Get encoded domain points corresponding to an experimental
design.
| def encoded(self):
"""
Get encoded domain points corresponding to an experimental
design.
"""
index = self.reaction.base_data[self.reaction.index_headers]
indices = []
for experiment in self.experiment_design.values:
entry = index[(index.valu... | [
"def",
"encoded",
"(",
"self",
")",
":",
"index",
"=",
"self",
".",
"reaction",
".",
"base_data",
"[",
"self",
".",
"reaction",
".",
"index_headers",
"]",
"indices",
"=",
"[",
"]",
"for",
"experiment",
"in",
"self",
".",
"experiment_design",
".",
"values... | [
132,
4
] | [
145,
62
] | python | en | ['en', 'error', 'th'] | False |
init_design.lhs | (self, samples, seed=None) |
Get experiments corresponding to a latin hypercube design.
|
Get experiments corresponding to a latin hypercube design.
| def lhs(self, samples, seed=None):
"""
Get experiments corresponding to a latin hypercube design.
"""
lh = lhs(self.N,
samples=samples,
criterion='center',
random_state=seed)
self.design = pd.DataFrame(lh, co... | [
"def",
"lhs",
"(",
"self",
",",
"samples",
",",
"seed",
"=",
"None",
")",
":",
"lh",
"=",
"lhs",
"(",
"self",
".",
"N",
",",
"samples",
"=",
"samples",
",",
"criterion",
"=",
"'center'",
",",
"random_state",
"=",
"seed",
")",
"self",
".",
"design",... | [
147,
4
] | [
157,
58
] | python | en | ['en', 'error', 'th'] | False |
init_design.pbd | (self) |
Get experiments corresponding to a Plackett-Burman design.
|
Get experiments corresponding to a Plackett-Burman design.
| def pbd(self):
"""
Get experiments corresponding to a Plackett-Burman design.
"""
pb = pd.DataFrame(pbdesign(len(self.levels)), columns=self.names)
pb = Data(pb)
pb.standardize(scaler='minmax', target=None)
self.design = pb.data | [
"def",
"pbd",
"(",
"self",
")",
":",
"pb",
"=",
"pd",
".",
"DataFrame",
"(",
"pbdesign",
"(",
"len",
"(",
"self",
".",
"levels",
")",
")",
",",
"columns",
"=",
"self",
".",
"names",
")",
"pb",
"=",
"Data",
"(",
"pb",
")",
"pb",
".",
"standardiz... | [
159,
4
] | [
168,
29
] | python | en | ['en', 'error', 'th'] | False |
init_design.ccd_lhs | (self, ccd_factors, lhs_factors, add_samples=5, seed=None,
center_fill=False) |
Get experiments corresponding to a hybrid central composit
and latin hypercube design.
|
Get experiments corresponding to a hybrid central composit
and latin hypercube design.
| def ccd_lhs(self, ccd_factors, lhs_factors, add_samples=5, seed=None,
center_fill=False):
"""
Get experiments corresponding to a hybrid central composit
and latin hypercube design.
"""
# Run cc design
cc = pd.DataFrame(ccdesign(len(ccd_factors), (... | [
"def",
"ccd_lhs",
"(",
"self",
",",
"ccd_factors",
",",
"lhs_factors",
",",
"add_samples",
"=",
"5",
",",
"seed",
"=",
"None",
",",
"center_fill",
"=",
"False",
")",
":",
"# Run cc design",
"cc",
"=",
"pd",
".",
"DataFrame",
"(",
"ccdesign",
"(",
"len",
... | [
170,
4
] | [
205,
47
] | python | en | ['en', 'error', 'th'] | False |
init_design.visualize | (self) |
Visualize the selected experiments.
|
Visualize the selected experiments.
| def visualize(self):
"""
Visualize the selected experiments.
"""
for i in self.encoded_design.index.values:
self.reaction.visualize(i) | [
"def",
"visualize",
"(",
"self",
")",
":",
"for",
"i",
"in",
"self",
".",
"encoded_design",
".",
"index",
".",
"values",
":",
"self",
".",
"reaction",
".",
"visualize",
"(",
"i",
")"
] | [
207,
4
] | [
213,
38
] | python | en | ['en', 'error', 'th'] | False |
generalized_subset_design.build | (self, reduction=20) |
Generate the design.
|
Generate the design.
| def build(self, reduction=20):
"""
Generate the design.
"""
gs = gsd(self.levels, reduction)
self.design = pd.DataFrame(gs, columns=self.names) | [
"def",
"build",
"(",
"self",
",",
"reduction",
"=",
"20",
")",
":",
"gs",
"=",
"gsd",
"(",
"self",
".",
"levels",
",",
"reduction",
")",
"self",
".",
"design",
"=",
"pd",
".",
"DataFrame",
"(",
"gs",
",",
"columns",
"=",
"self",
".",
"names",
")"... | [
241,
4
] | [
247,
58
] | python | en | ['en', 'error', 'th'] | False |
generalized_subset_design.get_experiments | (self) |
Get experiments corresponding to the design.
|
Get experiments corresponding to the design.
| def get_experiments(self):
"""
Get experiments corresponding to the design.
"""
# Fill in experiments
experiments = []
for i in range(len(self.design)):
experiment = []
row = self.design.iloc[i]
for col in self.design.colum... | [
"def",
"get_experiments",
"(",
"self",
")",
":",
"# Fill in experiments",
"experiments",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"design",
")",
")",
":",
"experiment",
"=",
"[",
"]",
"row",
"=",
"self",
".",
"design",
... | [
249,
4
] | [
264,
81
] | python | en | ['en', 'error', 'th'] | False |
generalized_subset_design.encoded | (self) |
Get encoded experiments corresponding to the design.
|
Get encoded experiments corresponding to the design.
| def encoded(self):
"""
Get encoded experiments corresponding to the design.
"""
index = self.reaction.base_data[self.reaction.index_headers]
indices = []
for experiment in self.experiment_design.values:
entry = index[(index.values == experiment).all(... | [
"def",
"encoded",
"(",
"self",
")",
":",
"index",
"=",
"self",
".",
"reaction",
".",
"base_data",
"[",
"self",
".",
"reaction",
".",
"index_headers",
"]",
"indices",
"=",
"[",
"]",
"for",
"experiment",
"in",
"self",
".",
"experiment_design",
".",
"values... | [
266,
4
] | [
278,
62
] | python | en | ['en', 'error', 'th'] | False |
external_design.get_experiments | (self) |
Get experiments corresponding to the design.
|
Get experiments corresponding to the design.
| def get_experiments(self):
"""
Get experiments corresponding to the design.
"""
# Fill in experiments
experiments = []
for i in range(len(self.design)):
experiment = []
row = self.design.iloc[i]
for col in self.design.colum... | [
"def",
"get_experiments",
"(",
"self",
")",
":",
"# Fill in experiments",
"experiments",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"design",
")",
")",
":",
"experiment",
"=",
"[",
"]",
"row",
"=",
"self",
".",
"design",
... | [
306,
4
] | [
321,
81
] | python | en | ['en', 'error', 'th'] | False |
external_design.encoded | (self) |
Get encoded experiments corresponding to the design.
|
Get encoded experiments corresponding to the design.
| def encoded(self):
"""
Get encoded experiments corresponding to the design.
"""
index = self.reaction.base_data[self.reaction.index_headers]
indices = []
for experiment in self.experiment_design.values:
entry = index[(index.values == experiment).all(... | [
"def",
"encoded",
"(",
"self",
")",
":",
"index",
"=",
"self",
".",
"reaction",
".",
"base_data",
"[",
"self",
".",
"reaction",
".",
"index_headers",
"]",
"indices",
"=",
"[",
"]",
"for",
"experiment",
"in",
"self",
".",
"experiment_design",
".",
"values... | [
323,
4
] | [
335,
62
] | python | en | ['en', 'error', 'th'] | False |
SunPowerMonitor.__init__ | (self, host) | Initialize. | Initialize. | def __init__(self, host):
"""Initialize."""
self.host = host
self.command_url = "http://{0}/cgi-bin/dl_cgi?Command=".format(host) | [
"def",
"__init__",
"(",
"self",
",",
"host",
")",
":",
"self",
".",
"host",
"=",
"host",
"self",
".",
"command_url",
"=",
"\"http://{0}/cgi-bin/dl_cgi?Command=\"",
".",
"format",
"(",
"host",
")"
] | [
13,
4
] | [
16,
76
] | python | en | ['en', 'en', 'it'] | False |
SunPowerMonitor.generic_command | (self, command) | All 'commands' to the PVS module use this url pattern and return json
The PVS system can take a very long time to respond so timeout is at 2 minutes | All 'commands' to the PVS module use this url pattern and return json
The PVS system can take a very long time to respond so timeout is at 2 minutes | def generic_command(self, command):
"""All 'commands' to the PVS module use this url pattern and return json
The PVS system can take a very long time to respond so timeout is at 2 minutes"""
try:
return requests.get(self.command_url + command, timeout=120).json()
except reque... | [
"def",
"generic_command",
"(",
"self",
",",
"command",
")",
":",
"try",
":",
"return",
"requests",
".",
"get",
"(",
"self",
".",
"command_url",
"+",
"command",
",",
"timeout",
"=",
"120",
")",
".",
"json",
"(",
")",
"except",
"requests",
".",
"exceptio... | [
18,
4
] | [
24,
48
] | python | en | ['en', 'en', 'en'] | True |
SunPowerMonitor.device_list | (self) | Get a list of all devices connected to the PVS | Get a list of all devices connected to the PVS | def device_list(self):
"""Get a list of all devices connected to the PVS"""
return self.generic_command("DeviceList") | [
"def",
"device_list",
"(",
"self",
")",
":",
"return",
"self",
".",
"generic_command",
"(",
"\"DeviceList\"",
")"
] | [
26,
4
] | [
28,
49
] | python | en | ['en', 'en', 'en'] | True |
SunPowerMonitor.network_status | (self) | Get a list of network interfaces on the PVS | Get a list of network interfaces on the PVS | def network_status(self):
"""Get a list of network interfaces on the PVS"""
return self.generic_command("Get_Comm") | [
"def",
"network_status",
"(",
"self",
")",
":",
"return",
"self",
".",
"generic_command",
"(",
"\"Get_Comm\"",
")"
] | [
30,
4
] | [
32,
47
] | python | en | ['en', 'en', 'en'] | True |
WsManOptions.__init__ | (
self, authentication=AuthenticationType.Basic, port=443, connection_timeout=20,
read_timeout=30, max_retries=1, verify_ssl=False
) |
:param authentication: HTTP Authentication type 'Basic', 'Digest'
:param port: https Port number for WSMAN communication
:param connection_timeout: time in seconds to wait for the server to connect before giving up
:param read_timeout: time in seconds to wait for the server to read ... |
:param authentication: HTTP Authentication type 'Basic', 'Digest'
:param port: https Port number for WSMAN communication
:param connection_timeout: time in seconds to wait for the server to connect before giving up
:param read_timeout: time in seconds to wait for the server to read ... | def __init__(
self, authentication=AuthenticationType.Basic, port=443, connection_timeout=20,
read_timeout=30, max_retries=1, verify_ssl=False
):
"""
:param authentication: HTTP Authentication type 'Basic', 'Digest'
:param port: https Port number for WSMAN commu... | [
"def",
"__init__",
"(",
"self",
",",
"authentication",
"=",
"AuthenticationType",
".",
"Basic",
",",
"port",
"=",
"443",
",",
"connection_timeout",
"=",
"20",
",",
"read_timeout",
"=",
"30",
",",
"max_retries",
"=",
"1",
",",
"verify_ssl",
"=",
"False",
")... | [
66,
4
] | [
94,
38
] | python | en | ['en', 'ja', 'th'] | False |
WsManProtocolBase.identify | (self) | Identifies the target product | Identifies the target product | def identify(self):
""" Identifies the target product """
wsm = WsManRequest()
wsm.identify()
return self._communicate(wsm) | [
"def",
"identify",
"(",
"self",
")",
":",
"wsm",
"=",
"WsManRequest",
"(",
")",
"wsm",
".",
"identify",
"(",
")",
"return",
"self",
".",
"_communicate",
"(",
"wsm",
")"
] | [
110,
4
] | [
114,
37
] | python | en | ['en', 'en', 'en'] | True |
WsManProtocolBase._build_redfish_payload | (self, toargs_dict) | Prepare the payload for http methods body
:param toargs_dict: name and value of arguments as dictionary.
:param path: dict. .
:returns: returns a json/dict body for http method
| Prepare the payload for http methods body
:param toargs_dict: name and value of arguments as dictionary.
:param path: dict. .
:returns: returns a json/dict body for http method
| def _build_redfish_payload(self, toargs_dict):
"""Prepare the payload for http methods body
:param toargs_dict: name and value of arguments as dictionary.
:param path: dict. .
:returns: returns a json/dict body for http method
"""
# status = toargs_dict[... | [
"def",
"_build_redfish_payload",
"(",
"self",
",",
"toargs_dict",
")",
":",
"# status = toargs_dict['Status']\r",
"retval",
"=",
"toargs_dict",
"[",
"'retval'",
"]",
"if",
"not",
"retval",
":",
"return",
"None",
"payload",
"=",
"{",
"}",
"for",
"key",
"in",
"r... | [
163,
4
] | [
192,
22
] | python | en | ['en', 'en', 'en'] | True |
WsManProtocolBase._pack_http_method_args | (self, resource_path, http_headers, http_body=None, http_args=None) | Pack the arguments required for the redfish client methods (post/get/put/patch ...) as a key value pair in a dictionary
:param resource_path: resource path on the device.
:param resource_path: str.
:param http_headers: header for http....
:param http_headers: str.
:param h... | Pack the arguments required for the redfish client methods (post/get/put/patch ...) as a key value pair in a dictionary
:param resource_path: resource path on the device.
:param resource_path: str.
:param http_headers: header for http....
:param http_headers: str.
:param h... | def _pack_http_method_args(self, resource_path, http_headers, http_body=None, http_args=None):
"""Pack the arguments required for the redfish client methods (post/get/put/patch ...) as a key value pair in a dictionary
:param resource_path: resource path on the device.
:param resource_path: ... | [
"def",
"_pack_http_method_args",
"(",
"self",
",",
"resource_path",
",",
"http_headers",
",",
"http_body",
"=",
"None",
",",
"http_args",
"=",
"None",
")",
":",
"method_args",
"=",
"{",
"}",
"method_args",
"[",
"'path'",
"]",
"=",
"resource_path",
"method_args... | [
194,
4
] | [
212,
26
] | python | en | ['en', 'en', 'en'] | True |
WsManProtocolBase._pack_rest_method_args | (self, auth, verify=False, data={}, headers=None) | Pack the arguments required for the rest methods (post/get/put/patch ...) as a key value pair in a dictionary
:param auth: authentication object.
:param auth: HttpAuth.
:param verify: verify certificate
:param verify: boolean.
:param data: payload
:param data: dic... | Pack the arguments required for the rest methods (post/get/put/patch ...) as a key value pair in a dictionary
:param auth: authentication object.
:param auth: HttpAuth.
:param verify: verify certificate
:param verify: boolean.
:param data: payload
:param data: dic... | def _pack_rest_method_args(self, auth, verify=False, data={}, headers=None):
"""Pack the arguments required for the rest methods (post/get/put/patch ...) as a key value pair in a dictionary
:param auth: authentication object.
:param auth: HttpAuth.
:param verify: verify certificate... | [
"def",
"_pack_rest_method_args",
"(",
"self",
",",
"auth",
",",
"verify",
"=",
"False",
",",
"data",
"=",
"{",
"}",
",",
"headers",
"=",
"None",
")",
":",
"method_args",
"=",
"{",
"}",
"method_args",
"[",
"'auth'",
"]",
"=",
"auth",
"method_args",
"[",... | [
214,
4
] | [
237,
26
] | python | en | ['en', 'en', 'en'] | True |
WsManProtocolBase._get_redfish_jobid | (self, headers) | Search jobid in the redfish_op
:param headers: response header.
:param headers: dict. .
:returns: returns jobid
| Search jobid in the redfish_op
:param headers: response header.
:param headers: dict. .
:returns: returns jobid
| def _get_redfish_jobid(self, headers):
"""Search jobid in the redfish_op
:param headers: response header.
:param headers: dict. .
:returns: returns jobid
"""
joblocation = headers['Location']
tokens = joblocation.split("/")
if tokens an... | [
"def",
"_get_redfish_jobid",
"(",
"self",
",",
"headers",
")",
":",
"joblocation",
"=",
"headers",
"[",
"'Location'",
"]",
"tokens",
"=",
"joblocation",
".",
"split",
"(",
"\"/\"",
")",
"if",
"tokens",
"and",
"tokens",
".",
"__len__",
"(",
")",
">",
"0",... | [
246,
4
] | [
258,
19
] | python | en | ['en', 'fy', 'en'] | True |
WsManProtocolBase._remove_dummyparams | (self, redfish_cmdlist, redfish_cmdname, argdict) | Remove dummy params which are not required by the actual redfish command,
these dummy params are required for ceratin URI's and other supporting purposes
:param redfish_cmdlist: redfish command list.
:param redfish_cmdlist: list.
:param redfish_cmdname: name of the redfish oper... | Remove dummy params which are not required by the actual redfish command,
these dummy params are required for ceratin URI's and other supporting purposes
:param redfish_cmdlist: redfish command list.
:param redfish_cmdlist: list.
:param redfish_cmdname: name of the redfish oper... | def _remove_dummyparams(self, redfish_cmdlist, redfish_cmdname, argdict):
"""Remove dummy params which are not required by the actual redfish command,
these dummy params are required for ceratin URI's and other supporting purposes
:param redfish_cmdlist: redfish command list.
:... | [
"def",
"_remove_dummyparams",
"(",
"self",
",",
"redfish_cmdlist",
",",
"redfish_cmdname",
",",
"argdict",
")",
":",
"dummyargs",
"=",
"redfish_cmdlist",
"[",
"redfish_cmdname",
"]",
"[",
"'DummyParams'",
"]",
"paramtuples",
"=",
"redfish_cmdlist",
"[",
"redfish_cmd... | [
260,
4
] | [
286,
32
] | python | en | ['en', 'en', 'en'] | True |
WsManProtocolBase.redfish_operation | (self, redfish_cmdlist, redfish_cmdname, *args) | Perform redfish operation as mentioned in redfish_cmdname
:param redfish_cmdlist: redfish command list.
:param redfish_cmdlist: list.
:param redfish_cmdname: name of the redfish operation to be performed
:param redfish_cmdname: str.
:param args: arguments for the redfish o... | Perform redfish operation as mentioned in redfish_cmdname
:param redfish_cmdlist: redfish command list.
:param redfish_cmdlist: list.
:param redfish_cmdname: name of the redfish operation to be performed
:param redfish_cmdname: str.
:param args: arguments for the redfish o... | def redfish_operation(self, redfish_cmdlist, redfish_cmdname, *args):
"""Perform redfish operation as mentioned in redfish_cmdname
:param redfish_cmdlist: redfish command list.
:param redfish_cmdlist: list.
:param redfish_cmdname: name of the redfish operation to be performed
... | [
"def",
"redfish_operation",
"(",
"self",
",",
"redfish_cmdlist",
",",
"redfish_cmdname",
",",
"*",
"args",
")",
":",
"resource_uri",
"=",
"redfish_cmdlist",
"[",
"redfish_cmdname",
"]",
"[",
"\"ResourceURI\"",
"]",
"action",
"=",
"redfish_cmdlist",
"[",
"redfish_c... | [
288,
4
] | [
345,
21
] | python | en | ['en', 'en', 'en'] | True |
WsManProtocolBase._parse_redfish_output | (self, response, success_code, returns_jobid=False) | Parse redfish response
:param redfish_response: response from redfish command.
:param success_code: status code expected. .
:returns: returns a json/dict
| Parse redfish response
:param redfish_response: response from redfish command.
:param success_code: status code expected. .
:returns: returns a json/dict
| def _parse_redfish_output(self, response, success_code, returns_jobid=False):
"""Parse redfish response
:param redfish_response: response from redfish command.
:param success_code: status code expected. .
:returns: returns a json/dict
"""
retval = {}
... | [
"def",
"_parse_redfish_output",
"(",
"self",
",",
"response",
",",
"success_code",
",",
"returns_jobid",
"=",
"False",
")",
":",
"retval",
"=",
"{",
"}",
"Data",
"=",
"{",
"}",
"if",
"response",
"==",
"None",
":",
"logger",
".",
"error",
"(",
"self",
"... | [
347,
4
] | [
400,
21
] | python | en | ['en', 'jv', 'en'] | True |
check_view_restrictions | (page, request, serve_args, serve_kwargs) |
Check whether there are any view restrictions on this page which are
not fulfilled by the given request object. If there are, return an
HttpResponse that will notify the user of that restriction (and possibly
include a password / login form that will allow them to proceed). If
there are no such res... |
Check whether there are any view restrictions on this page which are
not fulfilled by the given request object. If there are, return an
HttpResponse that will notify the user of that restriction (and possibly
include a password / login form that will allow them to proceed). If
there are no such res... | def check_view_restrictions(page, request, serve_args, serve_kwargs):
"""
Check whether there are any view restrictions on this page which are
not fulfilled by the given request object. If there are, return an
HttpResponse that will notify the user of that restriction (and possibly
include a passwor... | [
"def",
"check_view_restrictions",
"(",
"page",
",",
"request",
",",
"serve_args",
",",
"serve_kwargs",
")",
":",
"for",
"restriction",
"in",
"page",
".",
"get_view_restrictions",
"(",
")",
":",
"if",
"not",
"restriction",
".",
"accept_request",
"(",
"request",
... | [
20,
0
] | [
38,
74
] | python | en | ['en', 'error', 'th'] | False |
BasePermissionPolicy.user_has_permission | (self, user, action) |
Return whether the given user has permission to perform the given action
on some or all instances of this model
|
Return whether the given user has permission to perform the given action
on some or all instances of this model
| def user_has_permission(self, user, action):
"""
Return whether the given user has permission to perform the given action
on some or all instances of this model
"""
return (user in self.users_with_permission(action)) | [
"def",
"user_has_permission",
"(",
"self",
",",
"user",
",",
"action",
")",
":",
"return",
"(",
"user",
"in",
"self",
".",
"users_with_permission",
"(",
"action",
")",
")"
] | [
33,
4
] | [
38,
59
] | python | en | ['en', 'error', 'th'] | False |
BasePermissionPolicy.user_has_any_permission | (self, user, actions) |
Return whether the given user has permission to perform any of the given actions
on some or all instances of this model
|
Return whether the given user has permission to perform any of the given actions
on some or all instances of this model
| def user_has_any_permission(self, user, actions):
"""
Return whether the given user has permission to perform any of the given actions
on some or all instances of this model
"""
return any(self.user_has_permission(user, action) for action in actions) | [
"def",
"user_has_any_permission",
"(",
"self",
",",
"user",
",",
"actions",
")",
":",
"return",
"any",
"(",
"self",
".",
"user_has_permission",
"(",
"user",
",",
"action",
")",
"for",
"action",
"in",
"actions",
")"
] | [
40,
4
] | [
45,
80
] | python | en | ['en', 'error', 'th'] | False |
BasePermissionPolicy.users_with_any_permission | (self, actions) |
Return a queryset of users who have permission to perform any of the given actions
on some or all instances of this model
|
Return a queryset of users who have permission to perform any of the given actions
on some or all instances of this model
| def users_with_any_permission(self, actions):
"""
Return a queryset of users who have permission to perform any of the given actions
on some or all instances of this model
"""
raise NotImplementedError | [
"def",
"users_with_any_permission",
"(",
"self",
",",
"actions",
")",
":",
"raise",
"NotImplementedError"
] | [
50,
4
] | [
55,
33
] | python | en | ['en', 'error', 'th'] | False |
BasePermissionPolicy.users_with_permission | (self, action) |
Return a queryset of users who have permission to perform the given action on
some or all instances of this model
|
Return a queryset of users who have permission to perform the given action on
some or all instances of this model
| def users_with_permission(self, action):
"""
Return a queryset of users who have permission to perform the given action on
some or all instances of this model
"""
return self.users_with_any_permission([action]) | [
"def",
"users_with_permission",
"(",
"self",
",",
"action",
")",
":",
"return",
"self",
".",
"users_with_any_permission",
"(",
"[",
"action",
"]",
")"
] | [
57,
4
] | [
62,
55
] | python | en | ['en', 'error', 'th'] | False |
BasePermissionPolicy.user_has_permission_for_instance | (self, user, action, instance) |
Return whether the given user has permission to perform the given action on the
given model instance
|
Return whether the given user has permission to perform the given action on the
given model instance
| def user_has_permission_for_instance(self, user, action, instance):
"""
Return whether the given user has permission to perform the given action on the
given model instance
"""
return self.user_has_permission(user, action) | [
"def",
"user_has_permission_for_instance",
"(",
"self",
",",
"user",
",",
"action",
",",
"instance",
")",
":",
"return",
"self",
".",
"user_has_permission",
"(",
"user",
",",
"action",
")"
] | [
72,
4
] | [
77,
53
] | python | en | ['en', 'error', 'th'] | False |
BasePermissionPolicy.user_has_any_permission_for_instance | (self, user, actions, instance) |
Return whether the given user has permission to perform any of the given actions
on the given model instance
|
Return whether the given user has permission to perform any of the given actions
on the given model instance
| def user_has_any_permission_for_instance(self, user, actions, instance):
"""
Return whether the given user has permission to perform any of the given actions
on the given model instance
"""
return any(
self.user_has_permission_for_instance(user, action, instance)
... | [
"def",
"user_has_any_permission_for_instance",
"(",
"self",
",",
"user",
",",
"actions",
",",
"instance",
")",
":",
"return",
"any",
"(",
"self",
".",
"user_has_permission_for_instance",
"(",
"user",
",",
"action",
",",
"instance",
")",
"for",
"action",
"in",
... | [
79,
4
] | [
87,
9
] | python | en | ['en', 'error', 'th'] | False |
BasePermissionPolicy.instances_user_has_any_permission_for | (self, user, actions) |
Return a queryset of all instances of this model for which the given user has
permission to perform any of the given actions
|
Return a queryset of all instances of this model for which the given user has
permission to perform any of the given actions
| def instances_user_has_any_permission_for(self, user, actions):
"""
Return a queryset of all instances of this model for which the given user has
permission to perform any of the given actions
"""
if self.user_has_any_permission(user, actions):
return self.model.objec... | [
"def",
"instances_user_has_any_permission_for",
"(",
"self",
",",
"user",
",",
"actions",
")",
":",
"if",
"self",
".",
"user_has_any_permission",
"(",
"user",
",",
"actions",
")",
":",
"return",
"self",
".",
"model",
".",
"objects",
".",
"all",
"(",
")",
"... | [
89,
4
] | [
97,
44
] | python | en | ['en', 'error', 'th'] | False |
BasePermissionPolicy.instances_user_has_permission_for | (self, user, action) |
Return a queryset of all instances of this model for which the given user has
permission to perform the given action
|
Return a queryset of all instances of this model for which the given user has
permission to perform the given action
| def instances_user_has_permission_for(self, user, action):
"""
Return a queryset of all instances of this model for which the given user has
permission to perform the given action
"""
return self.instances_user_has_any_permission_for(user, [action]) | [
"def",
"instances_user_has_permission_for",
"(",
"self",
",",
"user",
",",
"action",
")",
":",
"return",
"self",
".",
"instances_user_has_any_permission_for",
"(",
"user",
",",
"[",
"action",
"]",
")"
] | [
99,
4
] | [
104,
73
] | python | en | ['en', 'error', 'th'] | False |
BasePermissionPolicy.users_with_any_permission_for_instance | (self, actions, instance) |
Return a queryset of all users who have permission to perform any of the given
actions on the given model instance
|
Return a queryset of all users who have permission to perform any of the given
actions on the given model instance
| def users_with_any_permission_for_instance(self, actions, instance):
"""
Return a queryset of all users who have permission to perform any of the given
actions on the given model instance
"""
return self.users_with_any_permission(actions) | [
"def",
"users_with_any_permission_for_instance",
"(",
"self",
",",
"actions",
",",
"instance",
")",
":",
"return",
"self",
".",
"users_with_any_permission",
"(",
"actions",
")"
] | [
106,
4
] | [
111,
54
] | python | en | ['en', 'error', 'th'] | False |
BaseDjangoAuthPermissionPolicy._get_permission_name | (self, action) |
Get the full app-label-qualified permission name (as required by
user.has_perm(...) ) for the given action on this model
|
Get the full app-label-qualified permission name (as required by
user.has_perm(...) ) for the given action on this model
| def _get_permission_name(self, action):
"""
Get the full app-label-qualified permission name (as required by
user.has_perm(...) ) for the given action on this model
"""
return '%s.%s_%s' % (self.app_label, action, self.model_name) | [
"def",
"_get_permission_name",
"(",
"self",
",",
"action",
")",
":",
"return",
"'%s.%s_%s'",
"%",
"(",
"self",
".",
"app_label",
",",
"action",
",",
"self",
".",
"model_name",
")"
] | [
182,
4
] | [
187,
69
] | python | en | ['en', 'error', 'th'] | False |
BaseDjangoAuthPermissionPolicy._get_users_with_any_permission_codenames_filter | (self, permission_codenames) |
Given a list of permission codenames, return a filter expression which
will find all users which have any of those permissions - either
through group permissions, user permissions, or implicitly through
being a superuser.
|
Given a list of permission codenames, return a filter expression which
will find all users which have any of those permissions - either
through group permissions, user permissions, or implicitly through
being a superuser.
| def _get_users_with_any_permission_codenames_filter(self, permission_codenames):
"""
Given a list of permission codenames, return a filter expression which
will find all users which have any of those permissions - either
through group permissions, user permissions, or implicitly through
... | [
"def",
"_get_users_with_any_permission_codenames_filter",
"(",
"self",
",",
"permission_codenames",
")",
":",
"permissions",
"=",
"Permission",
".",
"objects",
".",
"filter",
"(",
"content_type",
"=",
"self",
".",
"_content_type",
",",
"codename__in",
"=",
"permission... | [
189,
4
] | [
204,
29
] | python | en | ['en', 'error', 'th'] | False |
BaseDjangoAuthPermissionPolicy._get_users_with_any_permission_codenames | (self, permission_codenames) |
Given a list of permission codenames, return a queryset of users which
have any of those permissions - either through group permissions, user
permissions, or implicitly through being a superuser.
|
Given a list of permission codenames, return a queryset of users which
have any of those permissions - either through group permissions, user
permissions, or implicitly through being a superuser.
| def _get_users_with_any_permission_codenames(self, permission_codenames):
"""
Given a list of permission codenames, return a queryset of users which
have any of those permissions - either through group permissions, user
permissions, or implicitly through being a superuser.
"""
... | [
"def",
"_get_users_with_any_permission_codenames",
"(",
"self",
",",
"permission_codenames",
")",
":",
"filter_expr",
"=",
"self",
".",
"_get_users_with_any_permission_codenames_filter",
"(",
"permission_codenames",
")",
"return",
"get_user_model",
"(",
")",
".",
"objects",... | [
206,
4
] | [
213,
70
] | python | en | ['en', 'error', 'th'] | False |
merge_setting | (request_setting, session_setting, dict_class=OrderedDict) | Determines appropriate setting for a given request, taking into account
the explicit setting on that request, and the setting in the session. If a
setting is a dictionary, they will be merged together using `dict_class`
| Determines appropriate setting for a given request, taking into account
the explicit setting on that request, and the setting in the session. If a
setting is a dictionary, they will be merged together using `dict_class`
| def merge_setting(request_setting, session_setting, dict_class=OrderedDict):
"""Determines appropriate setting for a given request, taking into account
the explicit setting on that request, and the setting in the session. If a
setting is a dictionary, they will be merged together using `dict_class`
"""
... | [
"def",
"merge_setting",
"(",
"request_setting",
",",
"session_setting",
",",
"dict_class",
"=",
"OrderedDict",
")",
":",
"if",
"session_setting",
"is",
"None",
":",
"return",
"request_setting",
"if",
"request_setting",
"is",
"None",
":",
"return",
"session_setting",... | [
49,
0
] | [
77,
25
] | python | en | ['en', 'en', 'en'] | True |
merge_hooks | (request_hooks, session_hooks, dict_class=OrderedDict) | Properly merges both requests and session hooks.
This is necessary because when request_hooks == {'response': []}, the
merge breaks Session hooks entirely.
| Properly merges both requests and session hooks. | def merge_hooks(request_hooks, session_hooks, dict_class=OrderedDict):
"""Properly merges both requests and session hooks.
This is necessary because when request_hooks == {'response': []}, the
merge breaks Session hooks entirely.
"""
if session_hooks is None or session_hooks.get('response') == []:
... | [
"def",
"merge_hooks",
"(",
"request_hooks",
",",
"session_hooks",
",",
"dict_class",
"=",
"OrderedDict",
")",
":",
"if",
"session_hooks",
"is",
"None",
"or",
"session_hooks",
".",
"get",
"(",
"'response'",
")",
"==",
"[",
"]",
":",
"return",
"request_hooks",
... | [
80,
0
] | [
92,
66
] | python | en | ['en', 'en', 'en'] | True |
session | () |
Returns a :class:`Session` for context-management.
.. deprecated:: 1.0.0
This method has been deprecated since version 1.0.0 and is only kept for
backwards compatibility. New code should use :class:`~requests.sessions.Session`
to create a session. This may be removed at a future date.... |
Returns a :class:`Session` for context-management. | def session():
"""
Returns a :class:`Session` for context-management.
.. deprecated:: 1.0.0
This method has been deprecated since version 1.0.0 and is only kept for
backwards compatibility. New code should use :class:`~requests.sessions.Session`
to create a session. This may be rem... | [
"def",
"session",
"(",
")",
":",
"return",
"Session",
"(",
")"
] | [
768,
0
] | [
780,
20
] | python | en | ['en', 'error', 'th'] | False |
SessionRedirectMixin.get_redirect_target | (self, resp) | Receives a Response. Returns a redirect URI or ``None`` | Receives a Response. Returns a redirect URI or ``None`` | def get_redirect_target(self, resp):
"""Receives a Response. Returns a redirect URI or ``None``"""
# Due to the nature of how requests processes redirects this method will
# be called at least once upon the original response and at least twice
# on each subsequent redirect response (if a... | [
"def",
"get_redirect_target",
"(",
"self",
",",
"resp",
")",
":",
"# Due to the nature of how requests processes redirects this method will",
"# be called at least once upon the original response and at least twice",
"# on each subsequent redirect response (if any).",
"# If a custom mixin is u... | [
97,
4
] | [
116,
19
] | python | en | ['en', 'en', 'en'] | True |
SessionRedirectMixin.should_strip_auth | (self, old_url, new_url) | Decide whether Authorization header should be removed when redirecting | Decide whether Authorization header should be removed when redirecting | def should_strip_auth(self, old_url, new_url):
"""Decide whether Authorization header should be removed when redirecting"""
old_parsed = urlparse(old_url)
new_parsed = urlparse(new_url)
if old_parsed.hostname != new_parsed.hostname:
return True
# Special case: allow h... | [
"def",
"should_strip_auth",
"(",
"self",
",",
"old_url",
",",
"new_url",
")",
":",
"old_parsed",
"=",
"urlparse",
"(",
"old_url",
")",
"new_parsed",
"=",
"urlparse",
"(",
"new_url",
")",
"if",
"old_parsed",
".",
"hostname",
"!=",
"new_parsed",
".",
"hostname... | [
118,
4
] | [
141,
45
] | python | en | ['en', 'en', 'en'] | True |
SessionRedirectMixin.resolve_redirects | (self, resp, req, stream=False, timeout=None,
verify=True, cert=None, proxies=None, yield_requests=False, **adapter_kwargs) | Receives a Response. Returns a generator of Responses or Requests. | Receives a Response. Returns a generator of Responses or Requests. | def resolve_redirects(self, resp, req, stream=False, timeout=None,
verify=True, cert=None, proxies=None, yield_requests=False, **adapter_kwargs):
"""Receives a Response. Returns a generator of Responses or Requests."""
hist = [] # keep track of history
url = self.get... | [
"def",
"resolve_redirects",
"(",
"self",
",",
"resp",
",",
"req",
",",
"stream",
"=",
"False",
",",
"timeout",
"=",
"None",
",",
"verify",
"=",
"True",
",",
"cert",
"=",
"None",
",",
"proxies",
"=",
"None",
",",
"yield_requests",
"=",
"False",
",",
"... | [
143,
4
] | [
251,
26
] | python | en | ['en', 'en', 'en'] | True |
SessionRedirectMixin.rebuild_auth | (self, prepared_request, response) | When being redirected we may want to strip authentication from the
request to avoid leaking credentials. This method intelligently removes
and reapplies authentication where possible to avoid credential loss.
| When being redirected we may want to strip authentication from the
request to avoid leaking credentials. This method intelligently removes
and reapplies authentication where possible to avoid credential loss.
| def rebuild_auth(self, prepared_request, response):
"""When being redirected we may want to strip authentication from the
request to avoid leaking credentials. This method intelligently removes
and reapplies authentication where possible to avoid credential loss.
"""
headers = pr... | [
"def",
"rebuild_auth",
"(",
"self",
",",
"prepared_request",
",",
"response",
")",
":",
"headers",
"=",
"prepared_request",
".",
"headers",
"url",
"=",
"prepared_request",
".",
"url",
"if",
"'Authorization'",
"in",
"headers",
"and",
"self",
".",
"should_strip_au... | [
253,
4
] | [
269,
51
] | python | en | ['en', 'en', 'en'] | True |
SessionRedirectMixin.rebuild_proxies | (self, prepared_request, proxies) | This method re-evaluates the proxy configuration by considering the
environment variables. If we are redirected to a URL covered by
NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
proxy keys for this URL (in case they were stripped by a previous
redirect).
... | This method re-evaluates the proxy configuration by considering the
environment variables. If we are redirected to a URL covered by
NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
proxy keys for this URL (in case they were stripped by a previous
redirect). | def rebuild_proxies(self, prepared_request, proxies):
"""This method re-evaluates the proxy configuration by considering the
environment variables. If we are redirected to a URL covered by
NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
proxy keys for this URL (in c... | [
"def",
"rebuild_proxies",
"(",
"self",
",",
"prepared_request",
",",
"proxies",
")",
":",
"proxies",
"=",
"proxies",
"if",
"proxies",
"is",
"not",
"None",
"else",
"{",
"}",
"headers",
"=",
"prepared_request",
".",
"headers",
"url",
"=",
"prepared_request",
"... | [
272,
4
] | [
311,
26
] | python | en | ['en', 'en', 'en'] | True |
SessionRedirectMixin.rebuild_method | (self, prepared_request, response) | When being redirected we may want to change the method of the request
based on certain specs or browser behavior.
| When being redirected we may want to change the method of the request
based on certain specs or browser behavior.
| def rebuild_method(self, prepared_request, response):
"""When being redirected we may want to change the method of the request
based on certain specs or browser behavior.
"""
method = prepared_request.method
# https://tools.ietf.org/html/rfc7231#section-6.4.4
if response... | [
"def",
"rebuild_method",
"(",
"self",
",",
"prepared_request",
",",
"response",
")",
":",
"method",
"=",
"prepared_request",
".",
"method",
"# https://tools.ietf.org/html/rfc7231#section-6.4.4",
"if",
"response",
".",
"status_code",
"==",
"codes",
".",
"see_other",
"a... | [
313,
4
] | [
333,
40
] | python | en | ['en', 'en', 'en'] | True |
Session.prepare_request | (self, request) | Constructs a :class:`PreparedRequest <PreparedRequest>` for
transmission and returns it. The :class:`PreparedRequest` has settings
merged from the :class:`Request <Request>` instance and those of the
:class:`Session`.
:param request: :class:`Request` instance to prepare with this
... | Constructs a :class:`PreparedRequest <PreparedRequest>` for
transmission and returns it. The :class:`PreparedRequest` has settings
merged from the :class:`Request <Request>` instance and those of the
:class:`Session`. | def prepare_request(self, request):
"""Constructs a :class:`PreparedRequest <PreparedRequest>` for
transmission and returns it. The :class:`PreparedRequest` has settings
merged from the :class:`Request <Request>` instance and those of the
:class:`Session`.
:param request: :class... | [
"def",
"prepare_request",
"(",
"self",
",",
"request",
")",
":",
"cookies",
"=",
"request",
".",
"cookies",
"or",
"{",
"}",
"# Bootstrap CookieJar.",
"if",
"not",
"isinstance",
"(",
"cookies",
",",
"cookielib",
".",
"CookieJar",
")",
":",
"cookies",
"=",
"... | [
429,
4
] | [
467,
16
] | python | en | ['en', 'co', 'en'] | True |
Session.request | (self, method, url,
params=None, data=None, headers=None, cookies=None, files=None,
auth=None, timeout=None, allow_redirects=True, proxies=None,
hooks=None, stream=None, verify=None, cert=None, json=None) | Constructs a :class:`Request <Request>`, prepares it and sends it.
Returns :class:`Response <Response>` object.
:param method: method for the new :class:`Request` object.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary or bytes to be sent in the... | Constructs a :class:`Request <Request>`, prepares it and sends it.
Returns :class:`Response <Response>` object. | def request(self, method, url,
params=None, data=None, headers=None, cookies=None, files=None,
auth=None, timeout=None, allow_redirects=True, proxies=None,
hooks=None, stream=None, verify=None, cert=None, json=None):
"""Constructs a :class:`Request <Request>`, prepares it and... | [
"def",
"request",
"(",
"self",
",",
"method",
",",
"url",
",",
"params",
"=",
"None",
",",
"data",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"cookies",
"=",
"None",
",",
"files",
"=",
"None",
",",
"auth",
"=",
"None",
",",
"timeout",
"=",
"N... | [
469,
4
] | [
543,
19
] | python | en | ['en', 'en', 'en'] | True |
Session.get | (self, url, **kwargs) | r"""Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
| r"""Sends a GET request. Returns :class:`Response` object. | def get(self, url, **kwargs):
r"""Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
"""
kwargs.setdefault('allow_redirects',... | [
"def",
"get",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"True",
")",
"return",
"self",
".",
"request",
"(",
"'GET'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | [
545,
4
] | [
554,
49
] | python | en | ['en', 'lb', 'en'] | True |
Session.options | (self, url, **kwargs) | r"""Sends a OPTIONS request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
| r"""Sends a OPTIONS request. Returns :class:`Response` object. | def options(self, url, **kwargs):
r"""Sends a OPTIONS request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
"""
kwargs.setdefault('allow_red... | [
"def",
"options",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"True",
")",
"return",
"self",
".",
"request",
"(",
"'OPTIONS'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | [
556,
4
] | [
565,
53
] | python | en | ['en', 'en', 'en'] | True |
Session.head | (self, url, **kwargs) | r"""Sends a HEAD request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
| r"""Sends a HEAD request. Returns :class:`Response` object. | def head(self, url, **kwargs):
r"""Sends a HEAD request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
"""
kwargs.setdefault('allow_redirects... | [
"def",
"head",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"False",
")",
"return",
"self",
".",
"request",
"(",
"'HEAD'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | [
567,
4
] | [
576,
50
] | python | en | ['en', 'lb', 'en'] | True |
Session.post | (self, url, data=None, json=None, **kwargs) | r"""Sends a POST request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json to send in the bo... | r"""Sends a POST request. Returns :class:`Response` object. | def post(self, url, data=None, json=None, **kwargs):
r"""Sends a POST request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Req... | [
"def",
"post",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
",",
"json",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"request",
"(",
"'POST'",
",",
"url",
",",
"data",
"=",
"data",
",",
"json",
"=",
"json",
",",... | [
578,
4
] | [
589,
72
] | python | en | ['en', 'lb', 'en'] | True |
Session.put | (self, url, data=None, **kwargs) | r"""Sends a PUT request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``re... | r"""Sends a PUT request. Returns :class:`Response` object. | def put(self, url, data=None, **kwargs):
r"""Sends a PUT request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
... | [
"def",
"put",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"request",
"(",
"'PUT'",
",",
"url",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | [
591,
4
] | [
601,
60
] | python | en | ['en', 'lb', 'en'] | True |
Session.patch | (self, url, data=None, **kwargs) | r"""Sends a PATCH request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``... | r"""Sends a PATCH request. Returns :class:`Response` object. | def patch(self, url, data=None, **kwargs):
r"""Sends a PATCH request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
... | [
"def",
"patch",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"request",
"(",
"'PATCH'",
",",
"url",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | [
603,
4
] | [
613,
62
] | python | en | ['en', 'en', 'en'] | True |
Session.delete | (self, url, **kwargs) | r"""Sends a DELETE request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
| r"""Sends a DELETE request. Returns :class:`Response` object. | def delete(self, url, **kwargs):
r"""Sends a DELETE request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
"""
return self.request('DELETE', ... | [
"def",
"delete",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"request",
"(",
"'DELETE'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | [
615,
4
] | [
623,
52
] | python | en | ['en', 'en', 'en'] | True |
Session.send | (self, request, **kwargs) | Send a given PreparedRequest.
:rtype: requests.Response
| Send a given PreparedRequest. | def send(self, request, **kwargs):
"""Send a given PreparedRequest.
:rtype: requests.Response
"""
# Set defaults that the hooks can utilize to ensure they always have
# the correct parameters to reproduce the previous request.
kwargs.setdefault('stream', self.stream)
... | [
"def",
"send",
"(",
"self",
",",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set defaults that the hooks can utilize to ensure they always have",
"# the correct parameters to reproduce the previous request.",
"kwargs",
".",
"setdefault",
"(",
"'stream'",
",",
"self",
"... | [
625,
4
] | [
698,
16
] | python | en | ['en', 'co', 'en'] | True |
Session.merge_environment_settings | (self, url, proxies, stream, verify, cert) |
Check the environment and merge it with some settings.
:rtype: dict
|
Check the environment and merge it with some settings. | def merge_environment_settings(self, url, proxies, stream, verify, cert):
"""
Check the environment and merge it with some settings.
:rtype: dict
"""
# Gather clues from the surrounding environment.
if self.trust_env:
# Set environment's proxies.
... | [
"def",
"merge_environment_settings",
"(",
"self",
",",
"url",
",",
"proxies",
",",
"stream",
",",
"verify",
",",
"cert",
")",
":",
"# Gather clues from the surrounding environment.",
"if",
"self",
".",
"trust_env",
":",
"# Set environment's proxies.",
"no_proxy",
"=",... | [
700,
4
] | [
727,
29
] | python | en | ['en', 'error', 'th'] | False |
Session.get_adapter | (self, url) |
Returns the appropriate connection adapter for the given URL.
:rtype: requests.adapters.BaseAdapter
|
Returns the appropriate connection adapter for the given URL. | def get_adapter(self, url):
"""
Returns the appropriate connection adapter for the given URL.
:rtype: requests.adapters.BaseAdapter
"""
for (prefix, adapter) in self.adapters.items():
if url.lower().startswith(prefix.lower()):
return adapter
... | [
"def",
"get_adapter",
"(",
"self",
",",
"url",
")",
":",
"for",
"(",
"prefix",
",",
"adapter",
")",
"in",
"self",
".",
"adapters",
".",
"items",
"(",
")",
":",
"if",
"url",
".",
"lower",
"(",
")",
".",
"startswith",
"(",
"prefix",
".",
"lower",
"... | [
729,
4
] | [
741,
85
] | python | en | ['en', 'error', 'th'] | False |
Session.close | (self) | Closes all adapters and as such the session | Closes all adapters and as such the session | def close(self):
"""Closes all adapters and as such the session"""
for v in self.adapters.values():
v.close() | [
"def",
"close",
"(",
"self",
")",
":",
"for",
"v",
"in",
"self",
".",
"adapters",
".",
"values",
"(",
")",
":",
"v",
".",
"close",
"(",
")"
] | [
743,
4
] | [
746,
21
] | python | en | ['en', 'en', 'en'] | True |
Session.mount | (self, prefix, adapter) | Registers a connection adapter to a prefix.
Adapters are sorted in descending order by prefix length.
| Registers a connection adapter to a prefix. | def mount(self, prefix, adapter):
"""Registers a connection adapter to a prefix.
Adapters are sorted in descending order by prefix length.
"""
self.adapters[prefix] = adapter
keys_to_move = [k for k in self.adapters if len(k) < len(prefix)]
for key in keys_to_move:
... | [
"def",
"mount",
"(",
"self",
",",
"prefix",
",",
"adapter",
")",
":",
"self",
".",
"adapters",
"[",
"prefix",
"]",
"=",
"adapter",
"keys_to_move",
"=",
"[",
"k",
"for",
"k",
"in",
"self",
".",
"adapters",
"if",
"len",
"(",
"k",
")",
"<",
"len",
"... | [
748,
4
] | [
757,
55
] | python | en | ['en', 'en', 'en'] | True |
BaseSpecifier.__str__ | (self) |
Returns the str representation of this Specifier like object. This
should be representative of the Specifier itself.
|
Returns the str representation of this Specifier like object. This
should be representative of the Specifier itself.
| def __str__(self):
# type: () -> str
"""
Returns the str representation of this Specifier like object. This
should be representative of the Specifier itself.
""" | [
"def",
"__str__",
"(",
"self",
")",
":",
"# type: () -> str"
] | [
41,
4
] | [
46,
11
] | python | en | ['en', 'error', 'th'] | False |
BaseSpecifier.__hash__ | (self) |
Returns a hash value for this Specifier like object.
|
Returns a hash value for this Specifier like object.
| def __hash__(self):
# type: () -> int
"""
Returns a hash value for this Specifier like object.
""" | [
"def",
"__hash__",
"(",
"self",
")",
":",
"# type: () -> int"
] | [
49,
4
] | [
53,
11
] | python | en | ['en', 'error', 'th'] | False |
BaseSpecifier.__eq__ | (self, other) |
Returns a boolean representing whether or not the two Specifier like
objects are equal.
|
Returns a boolean representing whether or not the two Specifier like
objects are equal.
| def __eq__(self, other):
# type: (object) -> bool
"""
Returns a boolean representing whether or not the two Specifier like
objects are equal.
""" | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"# type: (object) -> bool"
] | [
56,
4
] | [
61,
11
] | python | en | ['en', 'error', 'th'] | False |
BaseSpecifier.__ne__ | (self, other) |
Returns a boolean representing whether or not the two Specifier like
objects are not equal.
|
Returns a boolean representing whether or not the two Specifier like
objects are not equal.
| def __ne__(self, other):
# type: (object) -> bool
"""
Returns a boolean representing whether or not the two Specifier like
objects are not equal.
""" | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"# type: (object) -> bool"
] | [
64,
4
] | [
69,
11
] | python | en | ['en', 'error', 'th'] | False |
BaseSpecifier.prereleases | (self) |
Returns whether or not pre-releases as a whole are allowed by this
specifier.
|
Returns whether or not pre-releases as a whole are allowed by this
specifier.
| def prereleases(self):
# type: () -> Optional[bool]
"""
Returns whether or not pre-releases as a whole are allowed by this
specifier.
""" | [
"def",
"prereleases",
"(",
"self",
")",
":",
"# type: () -> Optional[bool]"
] | [
72,
4
] | [
77,
11
] | python | en | ['en', 'error', 'th'] | False |
BaseSpecifier.prereleases | (self, value) |
Sets whether or not pre-releases as a whole are allowed by this
specifier.
|
Sets whether or not pre-releases as a whole are allowed by this
specifier.
| def prereleases(self, value):
# type: (bool) -> None
"""
Sets whether or not pre-releases as a whole are allowed by this
specifier.
""" | [
"def",
"prereleases",
"(",
"self",
",",
"value",
")",
":",
"# type: (bool) -> None"
] | [
80,
4
] | [
85,
11
] | python | en | ['en', 'error', 'th'] | False |
BaseSpecifier.contains | (self, item, prereleases=None) |
Determines if the given item is contained within this specifier.
|
Determines if the given item is contained within this specifier.
| def contains(self, item, prereleases=None):
# type: (str, Optional[bool]) -> bool
"""
Determines if the given item is contained within this specifier.
""" | [
"def",
"contains",
"(",
"self",
",",
"item",
",",
"prereleases",
"=",
"None",
")",
":",
"# type: (str, Optional[bool]) -> bool"
] | [
88,
4
] | [
92,
11
] | python | en | ['en', 'error', 'th'] | False |
BaseSpecifier.filter | (self, iterable, prereleases=None) |
Takes an iterable of items and filters them so that only items which
are contained within this specifier are allowed in it.
|
Takes an iterable of items and filters them so that only items which
are contained within this specifier are allowed in it.
| def filter(self, iterable, prereleases=None):
# type: (Iterable[UnparsedVersion], Optional[bool]) -> Iterable[UnparsedVersion]
"""
Takes an iterable of items and filters them so that only items which
are contained within this specifier are allowed in it.
""" | [
"def",
"filter",
"(",
"self",
",",
"iterable",
",",
"prereleases",
"=",
"None",
")",
":",
"# type: (Iterable[UnparsedVersion], Optional[bool]) -> Iterable[UnparsedVersion]"
] | [
95,
4
] | [
100,
11
] | python | en | ['en', 'error', 'th'] | False |
MasterStub.__init__ | (self, channel) | Constructor.
Args:
channel: A grpc.Channel.
| Constructor. | def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.StartGame = channel.unary_unary(
'/gfootball.eval_server.Master/StartGame',
request_serializer=gfootball_dot_eval__server_dot_proto_dot_master__pb2.StartGameRequest.SerializeToString,
resp... | [
"def",
"__init__",
"(",
"self",
",",
"channel",
")",
":",
"self",
".",
"StartGame",
"=",
"channel",
".",
"unary_unary",
"(",
"'/gfootball.eval_server.Master/StartGame'",
",",
"request_serializer",
"=",
"gfootball_dot_eval__server_dot_proto_dot_master__pb2",
".",
"StartGam... | [
24,
2
] | [
34,
9
] | python | en | ['en', 'en', 'en'] | False |
MasterServicer.StartGame | (self, request, context) | Starts a game, returns side id and game server address.
| Starts a game, returns side id and game server address.
| def StartGame(self, request, context):
"""Starts a game, returns side id and game server address.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | [
"def",
"StartGame",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"context",
".",
"set_code",
"(",
"grpc",
".",
"StatusCode",
".",
"UNIMPLEMENTED",
")",
"context",
".",
"set_details",
"(",
"'Method not implemented!'",
")",
"raise",
"NotImplementedError"... | [
41,
2
] | [
46,
56
] | python | en | ['en', 'en', 'en'] | True |
rebuild_role_ancestor_list | (reverse, model, instance, pk_set, action, **kwargs) | When a role parent is added or removed, update our role hierarchy list | When a role parent is added or removed, update our role hierarchy list | def rebuild_role_ancestor_list(reverse, model, instance, pk_set, action, **kwargs):
'When a role parent is added or removed, update our role hierarchy list'
if action == 'post_add':
if reverse:
model.rebuild_role_ancestor_list(list(pk_set), [])
else:
model.rebuild_role_an... | [
"def",
"rebuild_role_ancestor_list",
"(",
"reverse",
",",
"model",
",",
"instance",
",",
"pk_set",
",",
"action",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"action",
"==",
"'post_add'",
":",
"if",
"reverse",
":",
"model",
".",
"rebuild_role_ancestor_list",
"(... | [
112,
0
] | [
124,
63
] | python | en | ['en', 'en', 'en'] | True |
sync_superuser_status_to_rbac | (instance, **kwargs) | When the is_superuser flag is changed on a user, reflect that in the membership of the System Admnistrator role | When the is_superuser flag is changed on a user, reflect that in the membership of the System Admnistrator role | def sync_superuser_status_to_rbac(instance, **kwargs):
'When the is_superuser flag is changed on a user, reflect that in the membership of the System Admnistrator role'
update_fields = kwargs.get('update_fields', None)
if update_fields and 'is_superuser' not in update_fields:
return
if instance.... | [
"def",
"sync_superuser_status_to_rbac",
"(",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"update_fields",
"=",
"kwargs",
".",
"get",
"(",
"'update_fields'",
",",
"None",
")",
"if",
"update_fields",
"and",
"'is_superuser'",
"not",
"in",
"update_fields",
":",
... | [
127,
0
] | [
135,
84
] | python | en | ['en', 'en', 'en'] | True |
sync_rbac_to_superuser_status | (instance, sender, **kwargs) | When the is_superuser flag is false but a user has the System Admin role, update the database to reflect that | When the is_superuser flag is false but a user has the System Admin role, update the database to reflect that | def sync_rbac_to_superuser_status(instance, sender, **kwargs):
'When the is_superuser flag is false but a user has the System Admin role, update the database to reflect that'
if kwargs['action'] in ['post_add', 'post_remove', 'post_clear']:
new_status_value = bool(kwargs['action'] == 'post_add')
... | [
"def",
"sync_rbac_to_superuser_status",
"(",
"instance",
",",
"sender",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
"[",
"'action'",
"]",
"in",
"[",
"'post_add'",
",",
"'post_remove'",
",",
"'post_clear'",
"]",
":",
"new_status_value",
"=",
"bool",
"(... | [
138,
0
] | [
156,
57
] | python | en | ['en', 'en', 'en'] | True |
save_related_job_templates | (sender, instance, **kwargs) | save_related_job_templates loops through all of the
job templates that use an Inventory that have had their
Organization updated. This triggers the rebuilding of the RBAC hierarchy
and ensures the proper access restrictions.
| save_related_job_templates loops through all of the
job templates that use an Inventory that have had their
Organization updated. This triggers the rebuilding of the RBAC hierarchy
and ensures the proper access restrictions.
| def save_related_job_templates(sender, instance, **kwargs):
"""save_related_job_templates loops through all of the
job templates that use an Inventory that have had their
Organization updated. This triggers the rebuilding of the RBAC hierarchy
and ensures the proper access restrictions.
"""
if s... | [
"def",
"save_related_job_templates",
"(",
"sender",
",",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"sender",
"is",
"not",
"Inventory",
":",
"raise",
"ValueError",
"(",
"'This signal callback is only intended for use with Project or Inventory'",
")",
"update_f... | [
193,
0
] | [
215,
17
] | python | en | ['en', 'en', 'en'] | True |
disable_activity_stream | () |
Context manager to disable capturing activity stream changes.
|
Context manager to disable capturing activity stream changes.
| def disable_activity_stream():
"""
Context manager to disable capturing activity stream changes.
"""
try:
previous_value = activity_stream_enabled.enabled
activity_stream_enabled.enabled = False
yield
finally:
activity_stream_enabled.enabled = previous_value | [
"def",
"disable_activity_stream",
"(",
")",
":",
"try",
":",
"previous_value",
"=",
"activity_stream_enabled",
".",
"enabled",
"activity_stream_enabled",
".",
"enabled",
"=",
"False",
"yield",
"finally",
":",
"activity_stream_enabled",
".",
"enabled",
"=",
"previous_v... | [
339,
0
] | [
348,
56
] | python | en | ['en', 'error', 'th'] | False |
get_current_user_from_drf_request | (sender, **kwargs) |
Provider a signal handler to return the current user from the current
request when using Django REST Framework. Requires that the APIView set
drf_request on the underlying Django Request object.
|
Provider a signal handler to return the current user from the current
request when using Django REST Framework. Requires that the APIView set
drf_request on the underlying Django Request object.
| def get_current_user_from_drf_request(sender, **kwargs):
"""
Provider a signal handler to return the current user from the current
request when using Django REST Framework. Requires that the APIView set
drf_request on the underlying Django Request object.
"""
request = get_current_request()
... | [
"def",
"get_current_user_from_drf_request",
"(",
"sender",
",",
"*",
"*",
"kwargs",
")",
":",
"request",
"=",
"get_current_request",
"(",
")",
"drf_request_user",
"=",
"getattr",
"(",
"request",
",",
"'drf_request_user'",
",",
"False",
")",
"return",
"(",
"drf_r... | [
580,
0
] | [
588,
32
] | python | en | ['en', 'error', 'th'] | False |
generate_time_series_data | (
days: int = 100,
business_hours_base: float = 10,
non_business_hours_base: float = 10,
growth: float = 1,
autocorrelation: float = 0,
spikiness: float = 1,
holiday_rate: float = 0,
frequency: str = CountStat.DAY,
partial_sum: bool = False,
random_seed: int = 26,
) |
Generate semi-realistic looking time series data for testing analytics graphs.
days -- Number of days of data. Is the number of data points generated if
frequency is CountStat.DAY.
business_hours_base -- Average value during a business hour (or day) at beginning of
time series, if frequenc... |
Generate semi-realistic looking time series data for testing analytics graphs. | def generate_time_series_data(
days: int = 100,
business_hours_base: float = 10,
non_business_hours_base: float = 10,
growth: float = 1,
autocorrelation: float = 0,
spikiness: float = 1,
holiday_rate: float = 0,
frequency: str = CountStat.DAY,
partial_sum: bool = False,
random_se... | [
"def",
"generate_time_series_data",
"(",
"days",
":",
"int",
"=",
"100",
",",
"business_hours_base",
":",
"float",
"=",
"10",
",",
"non_business_hours_base",
":",
"float",
"=",
"10",
",",
"growth",
":",
"float",
"=",
"1",
",",
"autocorrelation",
":",
"float"... | [
7,
0
] | [
78,
38
] | python | en | ['en', 'error', 'th'] | False |
add_stderr_logger | (level=logging.DEBUG) |
Helper for quickly adding a StreamHandler to the logger. Useful for
debugging.
Returns the handler after adding it.
|
Helper for quickly adding a StreamHandler to the logger. Useful for
debugging. | def add_stderr_logger(level=logging.DEBUG):
"""
Helper for quickly adding a StreamHandler to the logger. Useful for
debugging.
Returns the handler after adding it.
"""
# This method needs to be in this __init__.py to get the __name__ correct
# even if urllib3 is vendored within another pack... | [
"def",
"add_stderr_logger",
"(",
"level",
"=",
"logging",
".",
"DEBUG",
")",
":",
"# This method needs to be in this __init__.py to get the __name__ correct",
"# even if urllib3 is vendored within another package.",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
"... | [
45,
0
] | [
60,
18
] | python | en | ['en', 'error', 'th'] | False |
disable_warnings | (category=exceptions.HTTPWarning) |
Helper for quickly disabling all urllib3 warnings.
|
Helper for quickly disabling all urllib3 warnings.
| def disable_warnings(category=exceptions.HTTPWarning):
"""
Helper for quickly disabling all urllib3 warnings.
"""
warnings.simplefilter("ignore", category) | [
"def",
"disable_warnings",
"(",
"category",
"=",
"exceptions",
".",
"HTTPWarning",
")",
":",
"warnings",
".",
"simplefilter",
"(",
"\"ignore\"",
",",
"category",
")"
] | [
80,
0
] | [
84,
45
] | python | en | ['en', 'error', 'th'] | False |
associate_extracted_sources | (image_id, deRuiter_r, beamwidths_limit=1,
new_source_sigma_margin=3) |
Associate extracted sources with sources detected in the running
catalog.
See the "developer's reference" section of the docs for a step-by-step
breakdown of the logic encapsulated here.
The dimensionless distance between two sources is given by the
"De Ruiter radius", see Chapters 2 & 3 of S... |
Associate extracted sources with sources detected in the running
catalog. | def associate_extracted_sources(image_id, deRuiter_r, beamwidths_limit=1,
new_source_sigma_margin=3):
"""
Associate extracted sources with sources detected in the running
catalog.
See the "developer's reference" section of the docs for a step-by-step
breakdown of the... | [
"def",
"associate_extracted_sources",
"(",
"image_id",
",",
"deRuiter_r",
",",
"beamwidths_limit",
"=",
"1",
",",
"new_source_sigma_margin",
"=",
"3",
")",
":",
"logger",
".",
"debug",
"(",
"\"Using a De Ruiter radius of %s\"",
"%",
"(",
"deRuiter_r",
",",
")",
")... | [
12,
0
] | [
115,
29
] | python | en | ['en', 'error', 'th'] | False |
_delete_bad_blind_extractions | (image_id) | Remove blind extractions centred outside designated extract region.
These occur sometimes due to highly elliptical fits on noisy data,
creating a best fit centred outside the original pixel region.
The source-extraction code has been modified to (probably) prevent this,
but we check for them anyway.
... | Remove blind extractions centred outside designated extract region. | def _delete_bad_blind_extractions(image_id):
"""Remove blind extractions centred outside designated extract region.
These occur sometimes due to highly elliptical fits on noisy data,
creating a best fit centred outside the original pixel region.
The source-extraction code has been modified to (probably... | [
"def",
"_delete_bad_blind_extractions",
"(",
"image_id",
")",
":",
"query",
"=",
"\"\"\"\\\nDELETE\nFROM extractedsource\nWHERE image = %(imgid)s\n AND id IN (SELECT badid\n FROM (SELECT ex0.id as badid\n ,SQRT(\n ( (ex0.ra - sky.centre_ra)* COS... | [
123,
0
] | [
176,
20
] | python | en | ['en', 'en', 'en'] | True |
_empty_temprunningcatalog | () | Initialize the temporary storage table
Initialize the temporary table temprunningcatalog which contains
the current observed sources.
| Initialize the temporary storage table | def _empty_temprunningcatalog():
"""Initialize the temporary storage table
Initialize the temporary table temprunningcatalog which contains
the current observed sources.
"""
query = "DELETE FROM temprunningcatalog"
tkp.db.execute(query, commit=True) | [
"def",
"_empty_temprunningcatalog",
"(",
")",
":",
"query",
"=",
"\"DELETE FROM temprunningcatalog\"",
"tkp",
".",
"db",
".",
"execute",
"(",
"query",
",",
"commit",
"=",
"True",
")"
] | [
179,
0
] | [
186,
38
] | python | en | ['en', 'en', 'en'] | True |
_check_meridian_wrap | (image_id) |
Checks whether an image is close to the meridian ra = 0 or ra = 360
When so, the association query needs to be rewritten to take into account
sources across the 0/360 meridian.
The query returns:
q_across: true, if the extraction region of the image crosses
the ra=0/360 border
... |
Checks whether an image is close to the meridian ra = 0 or ra = 360 | def _check_meridian_wrap(image_id):
"""
Checks whether an image is close to the meridian ra = 0 or ra = 360
When so, the association query needs to be rewritten to take into account
sources across the 0/360 meridian.
The query returns:
q_across: true, if the extraction region of the image cro... | [
"def",
"_check_meridian_wrap",
"(",
"image_id",
")",
":",
"meridian_wrap_query",
"=",
"\"\"\"\\\nSELECT CASE WHEN s.centre_ra - alpha(s.xtr_radius, s.centre_decl) < 0 OR\n s.centre_ra + alpha(s.xtr_radius, s.centre_decl) > 360\n THEN TRUE\n ELSE FALSE\n EN... | [
190,
0
] | [
303,
5
] | python | en | ['en', 'error', 'th'] | False |
_insert_temprunningcatalog | (image_id, deRuiter_r, beamwidths_limit,
meridian_wrap) | Select matched sources
Here we select the extractedsource that have a positional match
with the sources in the running catalogue table (runningcatalog).
Those sources which *do* have a potential match, will be inserted into the
temporary running catalogue table (temprunningcatalog).
See also:
... | Select matched sources | def _insert_temprunningcatalog(image_id, deRuiter_r, beamwidths_limit,
meridian_wrap):
"""Select matched sources
Here we select the extractedsource that have a positional match
with the sources in the running catalogue table (runningcatalog).
Those sources which *do* have... | [
"def",
"_insert_temprunningcatalog",
"(",
"image_id",
",",
"deRuiter_r",
",",
"beamwidths_limit",
",",
"meridian_wrap",
")",
":",
"# The cross-meridian differs slightly from the normal association query.",
"#",
"# We removed the wm_ra between statement, because the dot-product of the",
... | [
306,
0
] | [
798,
44
] | python | en | ['fr', 'en', 'en'] | True |
_flag_many_to_many_tempruncat | () | Select the many-to-many association pairs in temprunningcatalog.
By flagging the many-to-many associations, we reduce the
processing to one-to-many and many-to-one (identical to one-to-one)
relationships
| Select the many-to-many association pairs in temprunningcatalog. | def _flag_many_to_many_tempruncat():
"""Select the many-to-many association pairs in temprunningcatalog.
By flagging the many-to-many associations, we reduce the
processing to one-to-many and many-to-one (identical to one-to-one)
relationships
"""
# This one selects the farthest out of the ma... | [
"def",
"_flag_many_to_many_tempruncat",
"(",
")",
":",
"# This one selects the farthest out of the many-to-many assocs",
"query",
"=",
"\"\"\"\\\nUPDATE temprunningcatalog\n SET inactive = TRUE\n WHERE EXISTS (SELECT runcat\n ,xtrsrc\n FROM (SELECT t1.runcat\n ... | [
801,
0
] | [
872,
38
] | python | en | ['en', 'en', 'en'] | True |
_insert_1_to_many_runcat | () | Insert the extracted sources that belong to one-to-many
associations in the runningcatalog.
Since for the one-to-many associations (i.e. one runcat source
associated with multiple extracted sources) we cannot a priori
decide which counterpart pair is the correct one, or whether all
are correct (in ... | Insert the extracted sources that belong to one-to-many
associations in the runningcatalog. | def _insert_1_to_many_runcat():
"""Insert the extracted sources that belong to one-to-many
associations in the runningcatalog.
Since for the one-to-many associations (i.e. one runcat source
associated with multiple extracted sources) we cannot a priori
decide which counterpart pair is the correct o... | [
"def",
"_insert_1_to_many_runcat",
"(",
")",
":",
"query",
"=",
"\"\"\"\\\nINSERT INTO runningcatalog\n (xtrsrc\n ,dataset\n ,datapoints\n ,zone\n ,wm_ra\n ,wm_decl\n ,wm_uncertainty_ew\n ,wm_uncertainty_ns\n ,avg_ra_err\n ,avg_decl_err\n ,avg_wra\n ,avg_wdecl\n ,avg_weight_ra\n ,avg_wei... | [
875,
0
] | [
938,
38
] | python | en | ['en', 'en', 'en'] | True |
_insert_1_to_many_runcat_flux | () | Insert the fluxes of the extracted sources that belong
to a one-to-many association in the runningcatalog.
Analogous to the runningcatalog, extracted source properties
are added to the runningcatalog_flux table.
| Insert the fluxes of the extracted sources that belong
to a one-to-many association in the runningcatalog. | def _insert_1_to_many_runcat_flux():
"""Insert the fluxes of the extracted sources that belong
to a one-to-many association in the runningcatalog.
Analogous to the runningcatalog, extracted source properties
are added to the runningcatalog_flux table.
"""
# NB we pull the new runcat id from th... | [
"def",
"_insert_1_to_many_runcat_flux",
"(",
")",
":",
"# NB we pull the new runcat id from the runningcatalog by matching with",
"# temprunningcatalog via xtrsrc. (temprunningcatalog.runcat points at old",
"# runcat entries).",
"query",
"=",
"\"\"\"\\\nINSERT INTO runningcatalog_flux\n (runcat... | [
941,
0
] | [
996,
38
] | python | en | ['en', 'en', 'en'] | True |
_insert_1_to_many_basepoint_assocxtrsource | () | Insert 'base points' for one-to-many associations
Before continuing, we have to insert the 'base points' of the associations,
i.e. the links between the new runningcatalog entries
and their associated (new) extractedsources.
We also calculate the variability indices at the timestamp of the
the cur... | Insert 'base points' for one-to-many associations | def _insert_1_to_many_basepoint_assocxtrsource():
"""Insert 'base points' for one-to-many associations
Before continuing, we have to insert the 'base points' of the associations,
i.e. the links between the new runningcatalog entries
and their associated (new) extractedsources.
We also calculate th... | [
"def",
"_insert_1_to_many_basepoint_assocxtrsource",
"(",
")",
":",
"# NB we pull the new runcat id from the runningcatalog by matching with",
"# temprunningcatalog via xtrsrc. (temprunningcatalog.runcat points at old",
"# runcat entries).",
"query",
"=",
"\"\"\"\\\nINSERT INTO assocxtrsource\n ... | [
999,
0
] | [
1073,
38
] | python | en | ['en', 'en', 'en'] | True |
_insert_1_to_many_replacement_assocxtrsource | () | Insert links into the association table between the new runcat
entries and the old extractedsources.
(New to New ('basepoint') links have been added earlier).
In this case, new entries in the runningcatalog and runningcatalog_flux
were already added (for every extractedsource one), which will replace
... | Insert links into the association table between the new runcat
entries and the old extractedsources.
(New to New ('basepoint') links have been added earlier). | def _insert_1_to_many_replacement_assocxtrsource():
"""Insert links into the association table between the new runcat
entries and the old extractedsources.
(New to New ('basepoint') links have been added earlier).
In this case, new entries in the runningcatalog and runningcatalog_flux
were already ... | [
"def",
"_insert_1_to_many_replacement_assocxtrsource",
"(",
")",
":",
"# NB we pull the new runcat id from the runningcatalog by matching with",
"# temprunningcatalog via xtrsrc. (temprunningcatalog.runcat points at old",
"# runcat entries).",
"query",
"=",
"\"\"\"\\\nINSERT INTO assocxtrsource\... | [
1076,
0
] | [
1134,
38
] | python | en | ['en', 'en', 'en'] | True |
_insert_1_to_many_assocskyrgn | () |
Copy skyregion associations from old runcat entries for new one-to-many
runningcatalog entries.
|
Copy skyregion associations from old runcat entries for new one-to-many
runningcatalog entries.
| def _insert_1_to_many_assocskyrgn():
"""
Copy skyregion associations from old runcat entries for new one-to-many
runningcatalog entries.
"""
# NB we pull the new runcat id from the runningcatalog by matching with
# temprunningcatalog via xtrsrc. (temprunningcatalog.runcat points at old
# run... | [
"def",
"_insert_1_to_many_assocskyrgn",
"(",
")",
":",
"# NB we pull the new runcat id from the runningcatalog by matching with",
"# temprunningcatalog via xtrsrc. (temprunningcatalog.runcat points at old",
"# runcat entries).",
"query",
"=",
"\"\"\"\\\nINSERT INTO assocskyrgn\n (runcat\n ,sky... | [
1137,
0
] | [
1169,
38
] | python | en | ['en', 'error', 'th'] | False |
_insert_1_to_many_newsource | () | Update the runcat id for the one-to-many associations,
and delete the newsource entries of the old runcat id
(the new ones have been added earlier).
In this case, new entries in the runningcatalog and runningcatalog_flux
were already added (for every extractedsource one), which will replace
the exi... | Update the runcat id for the one-to-many associations,
and delete the newsource entries of the old runcat id
(the new ones have been added earlier). | def _insert_1_to_many_newsource():
"""Update the runcat id for the one-to-many associations,
and delete the newsource entries of the old runcat id
(the new ones have been added earlier).
In this case, new entries in the runningcatalog and runningcatalog_flux
were already added (for every extracteds... | [
"def",
"_insert_1_to_many_newsource",
"(",
")",
":",
"query",
"=",
"\"\"\"\\\nINSERT INTO newsource\n (runcat\n ,trigger_xtrsrc\n ,newsource_type\n ,previous_limits_image\n )\n SELECT r.id as new_runcat_id\n ,tr.trigger_xtrsrc\n ,tr.newsource_type\n ,tr.previous_limits_image... | [
1172,
0
] | [
1207,
38
] | python | en | ['en', 'en', 'en'] | True |
_insert_1_to_many_varmetric | () | Update the varmetric entry for a one-to-many runcat associations
| Update the varmetric entry for a one-to-many runcat associations
| def _insert_1_to_many_varmetric():
"""Update the varmetric entry for a one-to-many runcat associations
"""
query = """\
INSERT INTO varmetric
(runcat
,v_int
,eta_int
,band
,newsource
,sigma_rms_max
,sigma_rms_min
,lightcurve_max
,lightcurve_avg
,lightcurve_median
)
SELECT r... | [
"def",
"_insert_1_to_many_varmetric",
"(",
")",
":",
"query",
"=",
"\"\"\"\\\nINSERT INTO varmetric\n (runcat\n ,v_int\n ,eta_int\n ,band\n ,newsource\n ,sigma_rms_max\n ,sigma_rms_min\n ,lightcurve_max\n ,lightcurve_avg\n ,lightcurve_median\n )\n SELECT r.id as new_runcat_id\n ... | [
1210,
0
] | [
1250,
38
] | python | en | ['en', 'en', 'en'] | True |
_delete_1_to_many_inactive_varmetric | () | Delete the varmetric sources of the old runcat
Since we replaced this runcat.id with multiple new ones, we now
delete the old one.
| Delete the varmetric sources of the old runcat | def _delete_1_to_many_inactive_varmetric():
"""Delete the varmetric sources of the old runcat
Since we replaced this runcat.id with multiple new ones, we now
delete the old one.
"""
query = """\
DELETE
FROM varmetric
WHERE runcat IN (SELECT runcat
FROM temprunningcata... | [
"def",
"_delete_1_to_many_inactive_varmetric",
"(",
")",
":",
"query",
"=",
"\"\"\"\\\nDELETE\n FROM varmetric\n WHERE runcat IN (SELECT runcat\n FROM temprunningcatalog\n WHERE inactive = FALSE\n GROUP BY runcat\n ... | [
1253,
0
] | [
1274,
55
] | python | en | ['en', 'fr', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.