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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d2edc27ba4b32743926edb08b834979f2eb5d428 | qize/ionic_liquids | ionic_liquids/visualization/plots.py | [
"MIT"
] | Python | error_values | <not_specific> | def error_values(X_train,X_test,Y_train,Y_test):
"""
Creates the two predicted values
Input
-----
X_train : numpy array, the 10% of the training set data values
X_test : numpy array, the molecular descriptors for the testing set data values
Y_train: numpy array, the 10% of the training se... |
Creates the two predicted values
Input
-----
X_train : numpy array, the 10% of the training set data values
X_test : numpy array, the molecular descriptors for the testing set data values
Y_train: numpy array, the 10% of the training set of electronic conductivity values
Y_test: numpy ar... | Creates the two predicted values
Input
X_train : numpy array, the 10% of the training set data values
X_test : numpy array, the molecular descriptors for the testing set data values
numpy array, the 10% of the training set of electronic conductivity values
Y_test: numpy array, 'true' (actual) electronic conductivity ... | [
"Creates",
"the",
"two",
"predicted",
"values",
"Input",
"X_train",
":",
"numpy",
"array",
"the",
"10%",
"of",
"the",
"training",
"set",
"data",
"values",
"X_test",
":",
"numpy",
"array",
"the",
"molecular",
"descriptors",
"for",
"the",
"testing",
"set",
"da... | def error_values(X_train,X_test,Y_train,Y_test):
n_train = X_train.shape[0]
n_test = X_test.shape[0]
d = X_train.shape[1]
hdnode = 100
w1 = np.random.normal(0,0.001,d*hdnode).reshape((d,hdnode))
d1 = np.zeros((d,hdnode))
w2 = np.random.normal(0,0.001,hdnode).reshape((hdnode,1))
d2 = np.z... | [
"def",
"error_values",
"(",
"X_train",
",",
"X_test",
",",
"Y_train",
",",
"Y_test",
")",
":",
"n_train",
"=",
"X_train",
".",
"shape",
"[",
"0",
"]",
"n_test",
"=",
"X_test",
".",
"shape",
"[",
"0",
"]",
"d",
"=",
"X_train",
".",
"shape",
"[",
"1"... | Creates the two predicted values
Input | [
"Creates",
"the",
"two",
"predicted",
"values",
"Input"
] | [
"\"\"\"\n Creates the two predicted values\n\n Input\n -----\n X_train : numpy array, the 10% of the training set data values\n X_test : numpy array, the molecular descriptors for the testing set data values \n\n Y_train: numpy array, the 10% of the training set of electronic conductivity values\n... | [
{
"param": "X_train",
"type": null
},
{
"param": "X_test",
"type": null
},
{
"param": "Y_train",
"type": null
},
{
"param": "Y_test",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "X_train",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "X_test",
"type": null,
"docstring": null,
"docstring_token... |
2c6ea6ccad30ee228bf102685a506d23c1f21aa0 | aakanksha023/EVAN | src/03_modelling/07_feature_engineering.py | [
"MIT"
] | Python | fill_geom | <not_specific> | def fill_geom(df):
"""This function fills Geom for some business_id
and recovers around 1000 geoms in train set.
"""
# list of business_id that has null geom
list_of_id = df[df.Geom.isnull()].business_id.unique()
# get all rows for these ids from original df
... | This function fills Geom for some business_id
and recovers around 1000 geoms in train set.
| This function fills Geom for some business_id
and recovers around 1000 geoms in train set. | [
"This",
"function",
"fills",
"Geom",
"for",
"some",
"business_id",
"and",
"recovers",
"around",
"1000",
"geoms",
"in",
"train",
"set",
"."
] | def fill_geom(df):
list_of_id = df[df.Geom.isnull()].business_id.unique()
could_fill = df[df.business_id.isin(list_of_id)]
list_of_id = could_fill[could_fill.Geom.notnull()].business_id.unique()
for i in list_of_id:
df_i = df[df.business_id == i]
geom = df_i[df_i.... | [
"def",
"fill_geom",
"(",
"df",
")",
":",
"list_of_id",
"=",
"df",
"[",
"df",
".",
"Geom",
".",
"isnull",
"(",
")",
"]",
".",
"business_id",
".",
"unique",
"(",
")",
"could_fill",
"=",
"df",
"[",
"df",
".",
"business_id",
".",
"isin",
"(",
"list_of_... | This function fills Geom for some business_id
and recovers around 1000 geoms in train set. | [
"This",
"function",
"fills",
"Geom",
"for",
"some",
"business_id",
"and",
"recovers",
"around",
"1000",
"geoms",
"in",
"train",
"set",
"."
] | [
"\"\"\"This function fills Geom for some business_id\n and recovers around 1000 geoms in train set.\n \"\"\"",
"# list of business_id that has null geom",
"# get all rows for these ids from original df",
"# able to find geom for these ids",
"# fill geoms"
] | [
{
"param": "df",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "df",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2c6ea6ccad30ee228bf102685a506d23c1f21aa0 | aakanksha023/EVAN | src/03_modelling/07_feature_engineering.py | [
"MIT"
] | Python | history | <not_specific> | def history(df):
"""This function assigns a binary variable
to each business id:
if the business has been operating for
more than 5 years, it will be assigned
an 1, otherwise 0.
"""
df['history'] = np.zeros(len(df))
for i in df.business_i... | This function assigns a binary variable
to each business id:
if the business has been operating for
more than 5 years, it will be assigned
an 1, otherwise 0.
| This function assigns a binary variable
to each business id:
if the business has been operating for
more than 5 years, it will be assigned
an 1, otherwise 0. | [
"This",
"function",
"assigns",
"a",
"binary",
"variable",
"to",
"each",
"business",
"id",
":",
"if",
"the",
"business",
"has",
"been",
"operating",
"for",
"more",
"than",
"5",
"years",
"it",
"will",
"be",
"assigned",
"an",
"1",
"otherwise",
"0",
"."
] | def history(df):
df['history'] = np.zeros(len(df))
for i in df.business_id.unique():
id_hist = len(df[df.business_id == i])
if id_hist >= 5:
history = [0]*5+[1]*(id_hist-5)
df.loc[df.business_id == i,
'history'] = history
... | [
"def",
"history",
"(",
"df",
")",
":",
"df",
"[",
"'history'",
"]",
"=",
"np",
".",
"zeros",
"(",
"len",
"(",
"df",
")",
")",
"for",
"i",
"in",
"df",
".",
"business_id",
".",
"unique",
"(",
")",
":",
"id_hist",
"=",
"len",
"(",
"df",
"[",
"df... | This function assigns a binary variable
to each business id:
if the business has been operating for
more than 5 years, it will be assigned
an 1, otherwise 0. | [
"This",
"function",
"assigns",
"a",
"binary",
"variable",
"to",
"each",
"business",
"id",
":",
"if",
"the",
"business",
"has",
"been",
"operating",
"for",
"more",
"than",
"5",
"years",
"it",
"will",
"be",
"assigned",
"an",
"1",
"otherwise",
"0",
"."
] | [
"\"\"\"This function assigns a binary variable\n to each business id:\n if the business has been operating for\n more than 5 years, it will be assigned\n an 1, otherwise 0.\n \"\"\""
] | [
{
"param": "df",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "df",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2c6ea6ccad30ee228bf102685a506d23c1f21aa0 | aakanksha023/EVAN | src/03_modelling/07_feature_engineering.py | [
"MIT"
] | Python | chain | <not_specific> | def chain(df):
"""This function counts how many times a business name
occurs in the entire dataframe.
It is not aggregated to years in order to capture
the scenario of a business gone out of business
for a couple of years but came back at a different
l... | This function counts how many times a business name
occurs in the entire dataframe.
It is not aggregated to years in order to capture
the scenario of a business gone out of business
for a couple of years but came back at a different
location later on.
... | This function counts how many times a business name
occurs in the entire dataframe.
It is not aggregated to years in order to capture
the scenario of a business gone out of business
for a couple of years but came back at a different
location later on.
When counting chain businesses, both business name
and business in... | [
"This",
"function",
"counts",
"how",
"many",
"times",
"a",
"business",
"name",
"occurs",
"in",
"the",
"entire",
"dataframe",
".",
"It",
"is",
"not",
"aggregated",
"to",
"years",
"in",
"order",
"to",
"capture",
"the",
"scenario",
"of",
"a",
"business",
"gon... | def chain(df):
df_copy = df[df.BusinessName.notnull()]
names = []
for i in df_copy.business_id.unique():
names.append(
(df_copy.loc[df_copy.business_id == i,
'BusinessName'].values[0],
df_copy.loc[df_copy.business_id == i,... | [
"def",
"chain",
"(",
"df",
")",
":",
"df_copy",
"=",
"df",
"[",
"df",
".",
"BusinessName",
".",
"notnull",
"(",
")",
"]",
"names",
"=",
"[",
"]",
"for",
"i",
"in",
"df_copy",
".",
"business_id",
".",
"unique",
"(",
")",
":",
"names",
".",
"append... | This function counts how many times a business name
occurs in the entire dataframe. | [
"This",
"function",
"counts",
"how",
"many",
"times",
"a",
"business",
"name",
"occurs",
"in",
"the",
"entire",
"dataframe",
"."
] | [
"\"\"\"This function counts how many times a business name\n occurs in the entire dataframe.\n\n It is not aggregated to years in order to capture\n the scenario of a business gone out of business\n for a couple of years but came back at a different\n location l... | [
{
"param": "df",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "df",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1b1051976bd5221fc0eebaffb286cdfbeb2b252f | aakanksha023/EVAN | src/01_download/01_download_data.py | [
"MIT"
] | Python | main | null | def main(file_path, urls):
"""
Loads files from the array of urls and saves the
downloaded files to the provided file path.
"""
# format urls input
with open(urls, 'r') as file:
urls = file.read().replace('\n', '')
urls = urls.strip('[]')
urls = re.findall(r'\([^\)\(]*\)', urls)... |
Loads files from the array of urls and saves the
downloaded files to the provided file path.
| Loads files from the array of urls and saves the
downloaded files to the provided file path. | [
"Loads",
"files",
"from",
"the",
"array",
"of",
"urls",
"and",
"saves",
"the",
"downloaded",
"files",
"to",
"the",
"provided",
"file",
"path",
"."
] | def main(file_path, urls):
with open(urls, 'r') as file:
urls = file.read().replace('\n', '')
urls = urls.strip('[]')
urls = re.findall(r'\([^\)\(]*\)', urls)
for file in urls:
file_name, url = tuple(file.strip('()').split(', '))
if os.path.exists(os.path.join(file_path, file_nam... | [
"def",
"main",
"(",
"file_path",
",",
"urls",
")",
":",
"with",
"open",
"(",
"urls",
",",
"'r'",
")",
"as",
"file",
":",
"urls",
"=",
"file",
".",
"read",
"(",
")",
".",
"replace",
"(",
"'\\n'",
",",
"''",
")",
"urls",
"=",
"urls",
".",
"strip"... | Loads files from the array of urls and saves the
downloaded files to the provided file path. | [
"Loads",
"files",
"from",
"the",
"array",
"of",
"urls",
"and",
"saves",
"the",
"downloaded",
"files",
"to",
"the",
"provided",
"file",
"path",
"."
] | [
"\"\"\"\n Loads files from the array of urls and saves the\n downloaded files to the provided file path.\n \"\"\"",
"# format urls input",
"# check if file is already downloaded",
"# Create the data subdirectory if it doesn't exist",
"# create response object",
"# download started"
] | [
{
"param": "file_path",
"type": null
},
{
"param": "urls",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "urls",
"type": null,
"docstring": null,
"docstring_token... |
b465cccc5c09b730726e248b27d6329f15b43ff6 | aakanksha023/EVAN | src/03_modelling/011_modelling.py | [
"MIT"
] | Python | evaluate_model | <not_specific> | def evaluate_model(model, X_train=X_train, X_test=X_valid,
y_train=y_train, y_test=y_valid, verbose=True):
"""
This function prints train and test accuracies,
classification report, and confusion matrix.
"""
model.fit(X_train, y_train)
train_acc = m... |
This function prints train and test accuracies,
classification report, and confusion matrix.
| This function prints train and test accuracies,
classification report, and confusion matrix. | [
"This",
"function",
"prints",
"train",
"and",
"test",
"accuracies",
"classification",
"report",
"and",
"confusion",
"matrix",
"."
] | def evaluate_model(model, X_train=X_train, X_test=X_valid,
y_train=y_train, y_test=y_valid, verbose=True):
model.fit(X_train, y_train)
train_acc = model.score(X_train, y_train)
test_acc = model.score(X_test, y_test)
if verbose:
print("Train Accuracy:", ... | [
"def",
"evaluate_model",
"(",
"model",
",",
"X_train",
"=",
"X_train",
",",
"X_test",
"=",
"X_valid",
",",
"y_train",
"=",
"y_train",
",",
"y_test",
"=",
"y_valid",
",",
"verbose",
"=",
"True",
")",
":",
"model",
".",
"fit",
"(",
"X_train",
",",
"y_tra... | This function prints train and test accuracies,
classification report, and confusion matrix. | [
"This",
"function",
"prints",
"train",
"and",
"test",
"accuracies",
"classification",
"report",
"and",
"confusion",
"matrix",
"."
] | [
"\"\"\"\n This function prints train and test accuracies,\n classification report, and confusion matrix.\n \"\"\""
] | [
{
"param": "model",
"type": null
},
{
"param": "X_train",
"type": null
},
{
"param": "X_test",
"type": null
},
{
"param": "y_train",
"type": null
},
{
"param": "y_test",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "model",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "X_train",
"type": null,
"docstring": null,
"docstring_tokens... |
b465cccc5c09b730726e248b27d6329f15b43ff6 | aakanksha023/EVAN | src/03_modelling/011_modelling.py | [
"MIT"
] | Python | convert_for_output | <not_specific> | def convert_for_output(df):
"""
This function convert the output of evaluate model
to more concise form. It will return a confusion matrix
and an accuracy matrix
"""
renew_df = pd.DataFrame.from_dict(df['renewed'])
renew_df.columns = ['renwed']
renew_df['l... |
This function convert the output of evaluate model
to more concise form. It will return a confusion matrix
and an accuracy matrix
| This function convert the output of evaluate model
to more concise form. It will return a confusion matrix
and an accuracy matrix | [
"This",
"function",
"convert",
"the",
"output",
"of",
"evaluate",
"model",
"to",
"more",
"concise",
"form",
".",
"It",
"will",
"return",
"a",
"confusion",
"matrix",
"and",
"an",
"accuracy",
"matrix"
] | def convert_for_output(df):
renew_df = pd.DataFrame.from_dict(df['renewed'])
renew_df.columns = ['renwed']
renew_df['label'] = ['f1', 'recall', 'precision']
renew_df.set_index('label', inplace=True)
no_df = pd.DataFrame.from_dict(df['not_renewed'])
no_df.columns = ['not_r... | [
"def",
"convert_for_output",
"(",
"df",
")",
":",
"renew_df",
"=",
"pd",
".",
"DataFrame",
".",
"from_dict",
"(",
"df",
"[",
"'renewed'",
"]",
")",
"renew_df",
".",
"columns",
"=",
"[",
"'renwed'",
"]",
"renew_df",
"[",
"'label'",
"]",
"=",
"[",
"'f1'"... | This function convert the output of evaluate model
to more concise form. | [
"This",
"function",
"convert",
"the",
"output",
"of",
"evaluate",
"model",
"to",
"more",
"concise",
"form",
"."
] | [
"\"\"\"\n This function convert the output of evaluate model\n to more concise form. It will return a confusion matrix\n and an accuracy matrix\n \"\"\""
] | [
{
"param": "df",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "df",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b465cccc5c09b730726e248b27d6329f15b43ff6 | aakanksha023/EVAN | src/03_modelling/011_modelling.py | [
"MIT"
] | Python | explain_model | <not_specific> | def explain_model(pip, df, verbose=True):
"""
This function will output a pandas dataframe to
show the important features and their weights in a model
"""
pp1_features = num_vars + \
list(pip['preprocessor'].transformers_[
1][1]['onehot'].get_feature_n... |
This function will output a pandas dataframe to
show the important features and their weights in a model
| This function will output a pandas dataframe to
show the important features and their weights in a model | [
"This",
"function",
"will",
"output",
"a",
"pandas",
"dataframe",
"to",
"show",
"the",
"important",
"features",
"and",
"their",
"weights",
"in",
"a",
"model"
] | def explain_model(pip, df, verbose=True):
pp1_features = num_vars + \
list(pip['preprocessor'].transformers_[
1][1]['onehot'].get_feature_names())
return eli5.formatters.as_dataframe.explain_weights_df(
pip['classifier'],
feature_names=pp1_features,
... | [
"def",
"explain_model",
"(",
"pip",
",",
"df",
",",
"verbose",
"=",
"True",
")",
":",
"pp1_features",
"=",
"num_vars",
"+",
"list",
"(",
"pip",
"[",
"'preprocessor'",
"]",
".",
"transformers_",
"[",
"1",
"]",
"[",
"1",
"]",
"[",
"'onehot'",
"]",
".",... | This function will output a pandas dataframe to
show the important features and their weights in a model | [
"This",
"function",
"will",
"output",
"a",
"pandas",
"dataframe",
"to",
"show",
"the",
"important",
"features",
"and",
"their",
"weights",
"in",
"a",
"model"
] | [
"\"\"\"\n This function will output a pandas dataframe to\n show the important features and their weights in a model\n \"\"\""
] | [
{
"param": "pip",
"type": null
},
{
"param": "df",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pip",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "df",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
3ad31bbc750c7477e26b368d81c7494525e4654c | aakanksha023/EVAN | app.py | [
"MIT"
] | Python | build_info_overlay | <not_specific> | def build_info_overlay(id, content):
"""
Build div representing the info overlay for a plot panel
"""
div = html.Div([ # modal div
html.Div([ # content div
html.Div([
html.H3([
"Info",
html.Img(
id=f'cl... |
Build div representing the info overlay for a plot panel
| Build div representing the info overlay for a plot panel | [
"Build",
"div",
"representing",
"the",
"info",
"overlay",
"for",
"a",
"plot",
"panel"
] | def build_info_overlay(id, content):
div = html.Div([
html.Div([
html.Div([
html.H3([
"Info",
html.Img(
id=f'close-{id}-modal',
src="assets/exit.svg",
n_clicks=0,
... | [
"def",
"build_info_overlay",
"(",
"id",
",",
"content",
")",
":",
"div",
"=",
"html",
".",
"Div",
"(",
"[",
"html",
".",
"Div",
"(",
"[",
"html",
".",
"Div",
"(",
"[",
"html",
".",
"H3",
"(",
"[",
"\"Info\"",
",",
"html",
".",
"Img",
"(",
"id",... | Build div representing the info overlay for a plot panel | [
"Build",
"div",
"representing",
"the",
"info",
"overlay",
"for",
"a",
"plot",
"panel"
] | [
"\"\"\"\n Build div representing the info overlay for a plot panel\n \"\"\"",
"# modal div",
"# content div"
] | [
{
"param": "id",
"type": null
},
{
"param": "content",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "content",
"type": null,
"docstring": null,
"docstring_tokens": ... |
98598c1c2f8031ff370ccd5343956cc6f2c92ede | aakanksha023/EVAN | src/02_clean_wrangle/06_synthesis.py | [
"MIT"
] | Python | check_columns | <not_specific> | def check_columns(df, col_lis):
"""
This function check is the dataframe
have all the columns required
"""
assert type(col_lis) == list, 'The col_lis should be a list'
if not set(col_lis).issubset(set(df.columns)):
return False
return True |
This function check is the dataframe
have all the columns required
| This function check is the dataframe
have all the columns required | [
"This",
"function",
"check",
"is",
"the",
"dataframe",
"have",
"all",
"the",
"columns",
"required"
] | def check_columns(df, col_lis):
assert type(col_lis) == list, 'The col_lis should be a list'
if not set(col_lis).issubset(set(df.columns)):
return False
return True | [
"def",
"check_columns",
"(",
"df",
",",
"col_lis",
")",
":",
"assert",
"type",
"(",
"col_lis",
")",
"==",
"list",
",",
"'The col_lis should be a list'",
"if",
"not",
"set",
"(",
"col_lis",
")",
".",
"issubset",
"(",
"set",
"(",
"df",
".",
"columns",
")",... | This function check is the dataframe
have all the columns required | [
"This",
"function",
"check",
"is",
"the",
"dataframe",
"have",
"all",
"the",
"columns",
"required"
] | [
"\"\"\"\n This function check is the dataframe \n have all the columns required\n \"\"\""
] | [
{
"param": "df",
"type": null
},
{
"param": "col_lis",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "df",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "col_lis",
"type": null,
"docstring": null,
"docstring_tokens": ... |
98598c1c2f8031ff370ccd5343956cc6f2c92ede | aakanksha023/EVAN | src/02_clean_wrangle/06_synthesis.py | [
"MIT"
] | Python | fill_missing_year | <not_specific> | def fill_missing_year(df, start_year, end_year):
"""
This function will repeat the dataframe and fill the year
from the start to end
Args:
df (pandas dataframe): The dataframe
start_year (int): The four digit start year
end_year (int): The four digit e... |
This function will repeat the dataframe and fill the year
from the start to end
Args:
df (pandas dataframe): The dataframe
start_year (int): The four digit start year
end_year (int): The four digit end year, note end year not included
Returns:
... | This function will repeat the dataframe and fill the year
from the start to end | [
"This",
"function",
"will",
"repeat",
"the",
"dataframe",
"and",
"fill",
"the",
"year",
"from",
"the",
"start",
"to",
"end"
] | def fill_missing_year(df, start_year, end_year):
assert ~(df.empty), 'Input dataframe is empty'
assert check_columns(df, ['LocalArea']), 'Input dataframe should have LocalArea column'
assert start_year<end_year, 'Start year should be smaller than end year'
assert 0<start_year and 0<end_y... | [
"def",
"fill_missing_year",
"(",
"df",
",",
"start_year",
",",
"end_year",
")",
":",
"assert",
"~",
"(",
"df",
".",
"empty",
")",
",",
"'Input dataframe is empty'",
"assert",
"check_columns",
"(",
"df",
",",
"[",
"'LocalArea'",
"]",
")",
",",
"'Input datafra... | This function will repeat the dataframe and fill the year
from the start to end | [
"This",
"function",
"will",
"repeat",
"the",
"dataframe",
"and",
"fill",
"the",
"year",
"from",
"the",
"start",
"to",
"end"
] | [
"\"\"\"\n This function will repeat the dataframe and fill the year\n from the start to end\n Args:\n df (pandas dataframe): The dataframe\n start_year (int): The four digit start year\n end_year (int): The four digit end year, note end year not included\n\n ... | [
{
"param": "df",
"type": null
},
{
"param": "start_year",
"type": null
},
{
"param": "end_year",
"type": null
}
] | {
"returns": [
{
"docstring": "The expanded dataframe",
"docstring_tokens": [
"The",
"expanded",
"dataframe"
],
"type": "df"
}
],
"raises": [],
"params": [
{
"identifier": "df",
"type": null,
"docstring": null,
"docstring_tokens... |
98598c1c2f8031ff370ccd5343956cc6f2c92ede | aakanksha023/EVAN | src/02_clean_wrangle/06_synthesis.py | [
"MIT"
] | Python | clean_couples_family_structure | <not_specific> | def clean_couples_family_structure(family, start_year, end_year):
"""
This function cleans the family census data
Args:
family (pandas dataframe): The dataframe for family data
start_year (int): The four digit start year
end_year (int): The four digit end year... |
This function cleans the family census data
Args:
family (pandas dataframe): The dataframe for family data
start_year (int): The four digit start year
end_year (int): The four digit end year, note end year not included
Returns:
family: A cleaned ... | This function cleans the family census data | [
"This",
"function",
"cleans",
"the",
"family",
"census",
"data"
] | def clean_couples_family_structure(family, start_year, end_year):
assert check_columns(family, ['Type', 'LocalArea',
'Without children at home',
'1 child',
'2 children',
'3 or more children']), 'Input dataframe d... | [
"def",
"clean_couples_family_structure",
"(",
"family",
",",
"start_year",
",",
"end_year",
")",
":",
"assert",
"check_columns",
"(",
"family",
",",
"[",
"'Type'",
",",
"'LocalArea'",
",",
"'Without children at home'",
",",
"'1 child'",
",",
"'2 children'",
",",
"... | This function cleans the family census data | [
"This",
"function",
"cleans",
"the",
"family",
"census",
"data"
] | [
"\"\"\"\n This function cleans the family census data\n Args:\n family (pandas dataframe): The dataframe for family data\n start_year (int): The four digit start year\n end_year (int): The four digit end year, note end year not included\n\n Returns:\n ... | [
{
"param": "family",
"type": null
},
{
"param": "start_year",
"type": null
},
{
"param": "end_year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "family"
}
],
"raises": [],
"params": [
{
"identifier": "family",
"type": null,
"docstring": "T... |
98598c1c2f8031ff370ccd5343956cc6f2c92ede | aakanksha023/EVAN | src/02_clean_wrangle/06_synthesis.py | [
"MIT"
] | Python | clean_detailed_language | <not_specific> | def clean_detailed_language(language, start_year, end_year):
"""
This function cleans the language census data
Args:
language (pandas dataframe): The dataframe for language data
start_year (int): The four digit start year
end_year (int): The four digit end yea... |
This function cleans the language census data
Args:
language (pandas dataframe): The dataframe for language data
start_year (int): The four digit start year
end_year (int): The four digit end year, note end year not included
Returns:
language: A ... | This function cleans the language census data | [
"This",
"function",
"cleans",
"the",
"language",
"census",
"data"
] | def clean_detailed_language(language, start_year, end_year):
assert check_columns(language, ['Type', 'LocalArea','English', 'French', 'Chinese, n.o.s.',
'Mandarin', 'Cantonese', 'Italian',
'German', 'Spanish']), 'Input dataframe does not have all columns required'
languag... | [
"def",
"clean_detailed_language",
"(",
"language",
",",
"start_year",
",",
"end_year",
")",
":",
"assert",
"check_columns",
"(",
"language",
",",
"[",
"'Type'",
",",
"'LocalArea'",
",",
"'English'",
",",
"'French'",
",",
"'Chinese, n.o.s.'",
",",
"'Mandarin'",
"... | This function cleans the language census data | [
"This",
"function",
"cleans",
"the",
"language",
"census",
"data"
] | [
"\"\"\"\n This function cleans the language census data\n Args:\n language (pandas dataframe): The dataframe for language data\n start_year (int): The four digit start year\n end_year (int): The four digit end year, note end year not included\n\n Returns:\n ... | [
{
"param": "language",
"type": null
},
{
"param": "start_year",
"type": null
},
{
"param": "end_year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "language"
}
],
"raises": [],
"params": [
{
"identifier": "language",
"type": null,
"docstring"... |
98598c1c2f8031ff370ccd5343956cc6f2c92ede | aakanksha023/EVAN | src/02_clean_wrangle/06_synthesis.py | [
"MIT"
] | Python | clean_marital_status | <not_specific> | def clean_marital_status(marital, start_year, end_year):
"""
This function cleans the marital census data
Args:
marital (pandas dataframe): The dataframe for language data
start_year (int): The four digit start year
end_year (int): The four digit end year, not... |
This function cleans the marital census data
Args:
marital (pandas dataframe): The dataframe for language data
start_year (int): The four digit start year
end_year (int): The four digit end year, note end year not included
Returns:
marital: A cle... | This function cleans the marital census data | [
"This",
"function",
"cleans",
"the",
"marital",
"census",
"data"
] | def clean_marital_status(marital, start_year, end_year):
assert check_columns(marital, ['LocalArea',
'Married or living with a or common-law partner',
'Not living with a married spouse or common-law partner']), 'Input dataframe does not have all columns requ... | [
"def",
"clean_marital_status",
"(",
"marital",
",",
"start_year",
",",
"end_year",
")",
":",
"assert",
"check_columns",
"(",
"marital",
",",
"[",
"'LocalArea'",
",",
"'Married or living with a or common-law partner'",
",",
"'Not living with a married spouse or common-law part... | This function cleans the marital census data | [
"This",
"function",
"cleans",
"the",
"marital",
"census",
"data"
] | [
"\"\"\"\n This function cleans the marital census data\n Args:\n marital (pandas dataframe): The dataframe for language data\n start_year (int): The four digit start year\n end_year (int): The four digit end year, note end year not included\n\n Returns:\n ... | [
{
"param": "marital",
"type": null
},
{
"param": "start_year",
"type": null
},
{
"param": "end_year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "marital"
}
],
"raises": [],
"params": [
{
"identifier": "marital",
"type": null,
"docstring": ... |
98598c1c2f8031ff370ccd5343956cc6f2c92ede | aakanksha023/EVAN | src/02_clean_wrangle/06_synthesis.py | [
"MIT"
] | Python | clean_age | <not_specific> | def clean_age(age, start_year, end_year):
"""
This function cleans the marital census data
Args:
age (pandas dataframe): The dataframe for population data
start_year (int): The four digit start year
end_year (int): The four digit end year, note end year not in... |
This function cleans the marital census data
Args:
age (pandas dataframe): The dataframe for population data
start_year (int): The four digit start year
end_year (int): The four digit end year, note end year not included
Returns:
age: A cleaned p... | This function cleans the marital census data | [
"This",
"function",
"cleans",
"the",
"marital",
"census",
"data"
] | def clean_age(age, start_year, end_year):
assert check_columns(age, ['Type']), 'Input dataframe does not have all columns required'
age = age[age['Type'] == 'total']
age['age below 20'] = (age[
'0 to 4 years'] + age[
'5 to 9 years'] + age[
'10 to 14 years'] + ... | [
"def",
"clean_age",
"(",
"age",
",",
"start_year",
",",
"end_year",
")",
":",
"assert",
"check_columns",
"(",
"age",
",",
"[",
"'Type'",
"]",
")",
",",
"'Input dataframe does not have all columns required'",
"age",
"=",
"age",
"[",
"age",
"[",
"'Type'",
"]",
... | This function cleans the marital census data | [
"This",
"function",
"cleans",
"the",
"marital",
"census",
"data"
] | [
"\"\"\"\n This function cleans the marital census data\n Args:\n age (pandas dataframe): The dataframe for population data\n start_year (int): The four digit start year\n end_year (int): The four digit end year, note end year not included\n\n Returns:\n ... | [
{
"param": "age",
"type": null
},
{
"param": "start_year",
"type": null
},
{
"param": "end_year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "age"
}
],
"raises": [],
"params": [
{
"identifier": "age",
"type": null,
"docstring": "The dat... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_couples_family_structure | <not_specific> | def clean_couples_family_structure(family, year):
"""
This function cleans the family census data
Args:
family (pd.DataFrame): The dataframe for family data
year (int): census year
Returns:
family: A cleaned pandas dataframe
"""
famil... |
This function cleans the family census data
Args:
family (pd.DataFrame): The dataframe for family data
year (int): census year
Returns:
family: A cleaned pandas dataframe
| This function cleans the family census data | [
"This",
"function",
"cleans",
"the",
"family",
"census",
"data"
] | def clean_couples_family_structure(family, year):
family = family[family['Type'] == 'total couples']
van_total = family.sum()
van_total['LocalArea'] = 'City of Vancouver'
van_total['Type'] = 'total couples'
family = family.append(van_total, ignore_index=True)
family['With... | [
"def",
"clean_couples_family_structure",
"(",
"family",
",",
"year",
")",
":",
"family",
"=",
"family",
"[",
"family",
"[",
"'Type'",
"]",
"==",
"'total couples'",
"]",
"van_total",
"=",
"family",
".",
"sum",
"(",
")",
"van_total",
"[",
"'LocalArea'",
"]",
... | This function cleans the family census data | [
"This",
"function",
"cleans",
"the",
"family",
"census",
"data"
] | [
"\"\"\"\n This function cleans the family census data\n Args:\n family (pd.DataFrame): The dataframe for family data\n year (int): census year\n\n Returns:\n family: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "family",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "family"
}
],
"raises": [],
"params": [
{
"identifier": "family",
"type": null,
"docstring": "T... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_detailed_language | <not_specific> | def clean_detailed_language(language, year):
"""
This function cleans the language census data
Args:
language (pd.DataFrame): The dataframe for language data
year (int) : Census year
Returns:
language: A cleaned pandas dataframe
"""
#... |
This function cleans the language census data
Args:
language (pd.DataFrame): The dataframe for language data
year (int) : Census year
Returns:
language: A cleaned pandas dataframe
| This function cleans the language census data | [
"This",
"function",
"cleans",
"the",
"language",
"census",
"data"
] | def clean_detailed_language(language, year):
language = language[language['Type'] == 'mother tongue - total']
van_total = language.sum()
van_total['LocalArea'] = 'City of Vancouver'
van_total['Type'] = 'mother tongue - total'
language = language.append(van_total, ignore_index=Tru... | [
"def",
"clean_detailed_language",
"(",
"language",
",",
"year",
")",
":",
"language",
"=",
"language",
"[",
"language",
"[",
"'Type'",
"]",
"==",
"'mother tongue - total'",
"]",
"van_total",
"=",
"language",
".",
"sum",
"(",
")",
"van_total",
"[",
"'LocalArea'... | This function cleans the language census data | [
"This",
"function",
"cleans",
"the",
"language",
"census",
"data"
] | [
"\"\"\"\n This function cleans the language census data\n Args:\n language (pd.DataFrame): The dataframe for language data\n year (int) : Census year\n\n Returns:\n language: A cleaned pandas dataframe\n \"\"\"",
"# only keeping their mother tongue",
... | [
{
"param": "language",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "language"
}
],
"raises": [],
"params": [
{
"identifier": "language",
"type": null,
"docstring"... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_marital_status | <not_specific> | def clean_marital_status(marital, year):
"""
This function cleans the marital census data
Args:
marital (pd.DataFrame): The dataframe for language data
year (int) : Census year
Returns:
marital: A cleaned pandas dataframe
"""
marital[... |
This function cleans the marital census data
Args:
marital (pd.DataFrame): The dataframe for language data
year (int) : Census year
Returns:
marital: A cleaned pandas dataframe
| This function cleans the marital census data | [
"This",
"function",
"cleans",
"the",
"marital",
"census",
"data"
] | def clean_marital_status(marital, year):
marital['Married or living with a or common-law partner'] = marital[
'Married or living with a or common-law partner'] / marital[
'Total population 15 years and over']
marital[
'Not living with a married spouse or commo... | [
"def",
"clean_marital_status",
"(",
"marital",
",",
"year",
")",
":",
"marital",
"[",
"'Married or living with a or common-law partner'",
"]",
"=",
"marital",
"[",
"'Married or living with a or common-law partner'",
"]",
"/",
"marital",
"[",
"'Total population 15 years and ov... | This function cleans the marital census data | [
"This",
"function",
"cleans",
"the",
"marital",
"census",
"data"
] | [
"\"\"\"\n This function cleans the marital census data\n Args:\n marital (pd.DataFrame): The dataframe for language data\n year (int) : Census year\n\n Returns:\n marital: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "marital",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "marital"
}
],
"raises": [],
"params": [
{
"identifier": "marital",
"type": null,
"docstring": ... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_population_age_sex | <not_specific> | def clean_population_age_sex(age, year):
"""
This function cleans the population age census data
Args:
age (pd.DataFrame): The dataframe for population data
year (int) : Census year
Returns:
age: A cleaned pandas dataframe
"""
age = ag... |
This function cleans the population age census data
Args:
age (pd.DataFrame): The dataframe for population data
year (int) : Census year
Returns:
age: A cleaned pandas dataframe
| This function cleans the population age census data | [
"This",
"function",
"cleans",
"the",
"population",
"age",
"census",
"data"
] | def clean_population_age_sex(age, year):
age = age[age['Type'] == 'total']
van_total = age.sum()
van_total['LocalArea'] = 'City of Vancouver'
van_total['Type'] = 'total'
age = age.append(van_total, ignore_index=True)
age['Under 20'] = (age[
'0 to 4 years'] + a... | [
"def",
"clean_population_age_sex",
"(",
"age",
",",
"year",
")",
":",
"age",
"=",
"age",
"[",
"age",
"[",
"'Type'",
"]",
"==",
"'total'",
"]",
"van_total",
"=",
"age",
".",
"sum",
"(",
")",
"van_total",
"[",
"'LocalArea'",
"]",
"=",
"'City of Vancouver'"... | This function cleans the population age census data | [
"This",
"function",
"cleans",
"the",
"population",
"age",
"census",
"data"
] | [
"\"\"\"\n This function cleans the population age census data\n Args:\n age (pd.DataFrame): The dataframe for population data\n year (int) : Census year\n\n Returns:\n age: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "age",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "age"
}
],
"raises": [],
"params": [
{
"identifier": "age",
"type": null,
"docstring": "The dat... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_gender | <not_specific> | def clean_gender(gender, year):
"""
This function cleans the population gender census data
Args:
gender (pd.DataFrame): The dataframe for gender data
year (int): census year
Returns:
gender: A cleaned pandas dataframe
"""
gender = gen... |
This function cleans the population gender census data
Args:
gender (pd.DataFrame): The dataframe for gender data
year (int): census year
Returns:
gender: A cleaned pandas dataframe
| This function cleans the population gender census data | [
"This",
"function",
"cleans",
"the",
"population",
"gender",
"census",
"data"
] | def clean_gender(gender, year):
gender = gender.iloc[:, 1:4].pivot(
index='LocalArea', columns='Type', values='Total'
).reset_index()
gender['female'] = gender['female'] / gender['total']
gender['male'] = gender['male'] / gender['total']
gender = gender[['LocalAre... | [
"def",
"clean_gender",
"(",
"gender",
",",
"year",
")",
":",
"gender",
"=",
"gender",
".",
"iloc",
"[",
":",
",",
"1",
":",
"4",
"]",
".",
"pivot",
"(",
"index",
"=",
"'LocalArea'",
",",
"columns",
"=",
"'Type'",
",",
"values",
"=",
"'Total'",
")",... | This function cleans the population gender census data | [
"This",
"function",
"cleans",
"the",
"population",
"gender",
"census",
"data"
] | [
"\"\"\"\n This function cleans the population gender census data\n Args:\n gender (pd.DataFrame): The dataframe for gender data\n year (int): census year\n\n Returns:\n gender: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "gender",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "gender"
}
],
"raises": [],
"params": [
{
"identifier": "gender",
"type": null,
"docstring": "T... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_visible_minority | <not_specific> | def clean_visible_minority(mino, year):
"""
This function cleans the visible minority census data
Args:
mino (pd.DataFrame): The dataframe for visible minority data
year (int): census year
Returns:
mino: A cleaned pandas dataframe
"""
... |
This function cleans the visible minority census data
Args:
mino (pd.DataFrame): The dataframe for visible minority data
year (int): census year
Returns:
mino: A cleaned pandas dataframe
| This function cleans the visible minority census data | [
"This",
"function",
"cleans",
"the",
"visible",
"minority",
"census",
"data"
] | def clean_visible_minority(mino, year):
if year == 2011:
mino = mino[mino.Type == 'Total']
van_total = mino.sum()
van_total['LocalArea'] = 'City of Vancouver'
van_total['Type'] = 'Total'
mino = mino.append(van_total, ignore_index=True)
cols = [... | [
"def",
"clean_visible_minority",
"(",
"mino",
",",
"year",
")",
":",
"if",
"year",
"==",
"2011",
":",
"mino",
"=",
"mino",
"[",
"mino",
".",
"Type",
"==",
"'Total'",
"]",
"van_total",
"=",
"mino",
".",
"sum",
"(",
")",
"van_total",
"[",
"'LocalArea'",
... | This function cleans the visible minority census data | [
"This",
"function",
"cleans",
"the",
"visible",
"minority",
"census",
"data"
] | [
"\"\"\"\n This function cleans the visible minority census data\n Args:\n mino (pd.DataFrame): The dataframe for visible minority data\n year (int): census year\n\n Returns:\n mino: A cleaned pandas dataframe\n \"\"\"",
"# calculate percentages",
"# c... | [
{
"param": "mino",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "mino"
}
],
"raises": [],
"params": [
{
"identifier": "mino",
"type": null,
"docstring": "The d... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_structural_dwelling_type | <not_specific> | def clean_structural_dwelling_type(dwel, year):
"""
This function cleans the dwelling type census data
Args:
dwel (pd.DataFrame): The dataframe for dwelling type data
year (int): census year
Returns:
dwel: A cleaned pandas dataframe
"""
... |
This function cleans the dwelling type census data
Args:
dwel (pd.DataFrame): The dataframe for dwelling type data
year (int): census year
Returns:
dwel: A cleaned pandas dataframe
| This function cleans the dwelling type census data | [
"This",
"function",
"cleans",
"the",
"dwelling",
"type",
"census",
"data"
] | def clean_structural_dwelling_type(dwel, year):
dwel['House'] = (dwel[
'Single-detached house'] + dwel[
'Semi-detached house'] + dwel[
'Row house']) / dwel['Total']
if year == 2001:
dwel['Apartment (<5 storeys)'] = (dwel[
'Apartment, de... | [
"def",
"clean_structural_dwelling_type",
"(",
"dwel",
",",
"year",
")",
":",
"dwel",
"[",
"'House'",
"]",
"=",
"(",
"dwel",
"[",
"'Single-detached house'",
"]",
"+",
"dwel",
"[",
"'Semi-detached house'",
"]",
"+",
"dwel",
"[",
"'Row house'",
"]",
")",
"/",
... | This function cleans the dwelling type census data | [
"This",
"function",
"cleans",
"the",
"dwelling",
"type",
"census",
"data"
] | [
"\"\"\"\n This function cleans the dwelling type census data\n Args:\n dwel (pd.DataFrame): The dataframe for dwelling type data\n year (int): census year\n\n Returns:\n dwel: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "dwel",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "dwel"
}
],
"raises": [],
"params": [
{
"identifier": "dwel",
"type": null,
"docstring": "The d... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_shelter_tenure | <not_specific> | def clean_shelter_tenure(shel, year):
"""
This function cleans the shelter tenure census data
Args:
shel (pd.DataFrame): The dataframe for shelter tenure data
year (int): census year
Returns:
shel: A cleaned pandas dataframe
"""
if ye... |
This function cleans the shelter tenure census data
Args:
shel (pd.DataFrame): The dataframe for shelter tenure data
year (int): census year
Returns:
shel: A cleaned pandas dataframe
| This function cleans the shelter tenure census data | [
"This",
"function",
"cleans",
"the",
"shelter",
"tenure",
"census",
"data"
] | def clean_shelter_tenure(shel, year):
if year == 2011:
shel = shel.query('Type == "Total"')
van_total = shel.sum()
van_total['LocalArea'] = 'City of Vancouver'
van_total['Type'] = 'Total'
shel = shel.append(van_total, ignore_index=True)
shel['O... | [
"def",
"clean_shelter_tenure",
"(",
"shel",
",",
"year",
")",
":",
"if",
"year",
"==",
"2011",
":",
"shel",
"=",
"shel",
".",
"query",
"(",
"'Type == \"Total\"'",
")",
"van_total",
"=",
"shel",
".",
"sum",
"(",
")",
"van_total",
"[",
"'LocalArea'",
"]",
... | This function cleans the shelter tenure census data | [
"This",
"function",
"cleans",
"the",
"shelter",
"tenure",
"census",
"data"
] | [
"\"\"\"\n This function cleans the shelter tenure census data\n Args:\n shel (pd.DataFrame): The dataframe for shelter tenure data\n year (int): census year\n\n Returns:\n shel: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "shel",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "shel"
}
],
"raises": [],
"params": [
{
"identifier": "shel",
"type": null,
"docstring": "The d... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_immigration_period | <not_specific> | def clean_immigration_period(im_p, year):
"""
This function cleans the immigration period census data
Args:
im_p (pd.DataFrame): The dataframe for immigration period data
year (int): census year
Returns:
im_p: A cleaned pandas dataframe
"""
... |
This function cleans the immigration period census data
Args:
im_p (pd.DataFrame): The dataframe for immigration period data
year (int): census year
Returns:
im_p: A cleaned pandas dataframe
| This function cleans the immigration period census data | [
"This",
"function",
"cleans",
"the",
"immigration",
"period",
"census",
"data"
] | def clean_immigration_period(im_p, year):
if year == 2001:
col_names = ['LocalArea',
'Total immigrant population',
'1996 to 2001']
im_p = im_p[col_names]
im_p.rename(columns={'1996 to 2001': 'Immigrates'}, inplace=True)
... | [
"def",
"clean_immigration_period",
"(",
"im_p",
",",
"year",
")",
":",
"if",
"year",
"==",
"2001",
":",
"col_names",
"=",
"[",
"'LocalArea'",
",",
"'Total immigrant population'",
",",
"'1996 to 2001'",
"]",
"im_p",
"=",
"im_p",
"[",
"col_names",
"]",
"im_p",
... | This function cleans the immigration period census data | [
"This",
"function",
"cleans",
"the",
"immigration",
"period",
"census",
"data"
] | [
"\"\"\"\n This function cleans the immigration period census data\n Args:\n im_p (pd.DataFrame): The dataframe for immigration period data\n year (int): census year\n\n Returns:\n im_p: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "im_p",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "im_p"
}
],
"raises": [],
"params": [
{
"identifier": "im_p",
"type": null,
"docstring": "The d... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_citizenship | <not_specific> | def clean_citizenship(citizen, year):
"""
This function cleans the citizenship census data
Args:
citizen (pd.DataFrame): The dataframe for citizenship data
year (int): census year
Returns:
citizen: A cleaned pandas dataframe
"""
if ye... |
This function cleans the citizenship census data
Args:
citizen (pd.DataFrame): The dataframe for citizenship data
year (int): census year
Returns:
citizen: A cleaned pandas dataframe
| This function cleans the citizenship census data | [
"This",
"function",
"cleans",
"the",
"citizenship",
"census",
"data"
] | def clean_citizenship(citizen, year):
if year == 2011:
citizen = citizen[citizen['Unnamed: 0'] == 0]
van_total = citizen.sum()
van_total['LocalArea'] = 'City of Vancouver'
van_total['Unnamed: 0'] = 0
citizen = citizen.append(van_total, ignore_index=Tru... | [
"def",
"clean_citizenship",
"(",
"citizen",
",",
"year",
")",
":",
"if",
"year",
"==",
"2011",
":",
"citizen",
"=",
"citizen",
"[",
"citizen",
"[",
"'Unnamed: 0'",
"]",
"==",
"0",
"]",
"van_total",
"=",
"citizen",
".",
"sum",
"(",
")",
"van_total",
"["... | This function cleans the citizenship census data | [
"This",
"function",
"cleans",
"the",
"citizenship",
"census",
"data"
] | [
"\"\"\"\n This function cleans the citizenship census data\n Args:\n citizen (pd.DataFrame): The dataframe for citizenship data\n year (int): census year\n\n Returns:\n citizen: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "citizen",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "citizen"
}
],
"raises": [],
"params": [
{
"identifier": "citizen",
"type": null,
"docstring": ... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_generation_status | <not_specific> | def clean_generation_status(gen, year):
"""
This function cleans the generational status census data
Args:
gen (pd.DataFrame): The dataframe for generational status data
year (int): census year
Returns:
gen: A cleaned pandas dataframe
"""
... |
This function cleans the generational status census data
Args:
gen (pd.DataFrame): The dataframe for generational status data
year (int): census year
Returns:
gen: A cleaned pandas dataframe
| This function cleans the generational status census data | [
"This",
"function",
"cleans",
"the",
"generational",
"status",
"census",
"data"
] | def clean_generation_status(gen, year):
for i in gen.columns[3:]:
gen[i] = gen[i] / gen[gen.columns[2]]
gen = gen.iloc[:, [1, 3, 4, 5]]
return gen | [
"def",
"clean_generation_status",
"(",
"gen",
",",
"year",
")",
":",
"for",
"i",
"in",
"gen",
".",
"columns",
"[",
"3",
":",
"]",
":",
"gen",
"[",
"i",
"]",
"=",
"gen",
"[",
"i",
"]",
"/",
"gen",
"[",
"gen",
".",
"columns",
"[",
"2",
"]",
"]"... | This function cleans the generational status census data | [
"This",
"function",
"cleans",
"the",
"generational",
"status",
"census",
"data"
] | [
"\"\"\"\n This function cleans the generational status census data\n Args:\n gen (pd.DataFrame): The dataframe for generational status data\n year (int): census year\n\n Returns:\n gen: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "gen",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "gen"
}
],
"raises": [],
"params": [
{
"identifier": "gen",
"type": null,
"docstring": "The dat... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_household_size | <not_specific> | def clean_household_size(house_size, year):
"""
This function cleans the household size census data
Args:
house_size (pd.DataFrame): The dataframe for household size data
year (int): census year
Returns:
house_size: A cleaned pandas dataframe
... |
This function cleans the household size census data
Args:
house_size (pd.DataFrame): The dataframe for household size data
year (int): census year
Returns:
house_size: A cleaned pandas dataframe
| This function cleans the household size census data | [
"This",
"function",
"cleans",
"the",
"household",
"size",
"census",
"data"
] | def clean_household_size(house_size, year):
col_lis = list(house_size.columns)[3:8]
for col in col_lis:
house_size[col] = house_size[col] / house_size['Total households']
house_size.rename(
columns={'1 person': '1 person',
'2 persons': '2 persons',
... | [
"def",
"clean_household_size",
"(",
"house_size",
",",
"year",
")",
":",
"col_lis",
"=",
"list",
"(",
"house_size",
".",
"columns",
")",
"[",
"3",
":",
"8",
"]",
"for",
"col",
"in",
"col_lis",
":",
"house_size",
"[",
"col",
"]",
"=",
"house_size",
"[",... | This function cleans the household size census data | [
"This",
"function",
"cleans",
"the",
"household",
"size",
"census",
"data"
] | [
"\"\"\"\n This function cleans the household size census data\n Args:\n house_size (pd.DataFrame): The dataframe for household size data\n year (int): census year\n\n Returns:\n house_size: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "house_size",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "house_size"
}
],
"raises": [],
"params": [
{
"identifier": "house_size",
"type": null,
"docstr... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_household_type | <not_specific> | def clean_household_type(house_type, year):
"""
This function cleans the household type census data
Args:
house_type (pd.DataFrame): The dataframe for household type data
year (int): census year
Returns:
house_type: A cleaned pandas dataframe
... |
This function cleans the household type census data
Args:
house_type (pd.DataFrame): The dataframe for household type data
year (int): census year
Returns:
house_type: A cleaned pandas dataframe
| This function cleans the household type census data | [
"This",
"function",
"cleans",
"the",
"household",
"type",
"census",
"data"
] | def clean_household_type(house_type, year):
for i in house_type.columns[3:]:
house_type[i] = house_type[i]/house_type[house_type.columns[2]]
house_type = house_type.iloc[:, [1, 3, 4, 5]]
house_type.columns = ['LocalArea',
'One-family households',
... | [
"def",
"clean_household_type",
"(",
"house_type",
",",
"year",
")",
":",
"for",
"i",
"in",
"house_type",
".",
"columns",
"[",
"3",
":",
"]",
":",
"house_type",
"[",
"i",
"]",
"=",
"house_type",
"[",
"i",
"]",
"/",
"house_type",
"[",
"house_type",
".",
... | This function cleans the household type census data | [
"This",
"function",
"cleans",
"the",
"household",
"type",
"census",
"data"
] | [
"\"\"\"\n This function cleans the household type census data\n Args:\n house_type (pd.DataFrame): The dataframe for household type data\n year (int): census year\n\n Returns:\n house_type: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "house_type",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "house_type"
}
],
"raises": [],
"params": [
{
"identifier": "house_type",
"type": null,
"docstr... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_immigration_age | <not_specific> | def clean_immigration_age(img_age, year):
"""
This function cleans the immigration age census data
Args:
img_age (pd.DataFrame): The dataframe for immigration age data
year (int): census year
Returns:
img_age: A cleaned pandas dataframe
"""
... |
This function cleans the immigration age census data
Args:
img_age (pd.DataFrame): The dataframe for immigration age data
year (int): census year
Returns:
img_age: A cleaned pandas dataframe
| This function cleans the immigration age census data | [
"This",
"function",
"cleans",
"the",
"immigration",
"age",
"census",
"data"
] | def clean_immigration_age(img_age, year):
img_age.rename(
columns={'Under 5 years': 'Immigrants under 5 years',
'5 to 14 years': 'Immigrants 5 to 14 years',
'15 to 24 years': 'Immigrants 15 to 24 years',
'25 to 44 years': 'Immigrants 25 ... | [
"def",
"clean_immigration_age",
"(",
"img_age",
",",
"year",
")",
":",
"img_age",
".",
"rename",
"(",
"columns",
"=",
"{",
"'Under 5 years'",
":",
"'Immigrants under 5 years'",
",",
"'5 to 14 years'",
":",
"'Immigrants 5 to 14 years'",
",",
"'15 to 24 years'",
":",
... | This function cleans the immigration age census data | [
"This",
"function",
"cleans",
"the",
"immigration",
"age",
"census",
"data"
] | [
"\"\"\"\n This function cleans the immigration age census data\n Args:\n img_age (pd.DataFrame): The dataframe for immigration age data\n year (int): census year\n\n Returns:\n img_age: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "img_age",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "img_age"
}
],
"raises": [],
"params": [
{
"identifier": "img_age",
"type": null,
"docstring": ... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_industry | <not_specific> | def clean_industry(ind, year):
"""
This function cleans the work industry census data
Args:
ind (pd.DataFrame): The dataframe for industry data
year (int): census year
Returns:
ind: A cleaned pandas dataframe
"""
col_lis = list(ind.co... |
This function cleans the work industry census data
Args:
ind (pd.DataFrame): The dataframe for industry data
year (int): census year
Returns:
ind: A cleaned pandas dataframe
| This function cleans the work industry census data | [
"This",
"function",
"cleans",
"the",
"work",
"industry",
"census",
"data"
] | def clean_industry(ind, year):
col_lis = list(ind.columns)[5:]
for col in col_lis:
ind[col] = ind[col]/ind['total']
ind['Industry - Not applicable'] = ind[
'Industry - Not applicable'] / ind['total']
ind.drop(columns=['All industries',
'U... | [
"def",
"clean_industry",
"(",
"ind",
",",
"year",
")",
":",
"col_lis",
"=",
"list",
"(",
"ind",
".",
"columns",
")",
"[",
"5",
":",
"]",
"for",
"col",
"in",
"col_lis",
":",
"ind",
"[",
"col",
"]",
"=",
"ind",
"[",
"col",
"]",
"/",
"ind",
"[",
... | This function cleans the work industry census data | [
"This",
"function",
"cleans",
"the",
"work",
"industry",
"census",
"data"
] | [
"\"\"\"\n This function cleans the work industry census data\n Args:\n ind (pd.DataFrame): The dataframe for industry data\n year (int): census year\n\n Returns:\n ind: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "ind",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "ind"
}
],
"raises": [],
"params": [
{
"identifier": "ind",
"type": null,
"docstring": "The dat... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_labour_force_status | <not_specific> | def clean_labour_force_status(labour, year):
"""
This function cleans the labour force status census data
Args:
labour (pd.DataFrame): The dataframe for labour force data
year (int): census year
Returns:
labour: A cleaned pandas dataframe
"""
... |
This function cleans the labour force status census data
Args:
labour (pd.DataFrame): The dataframe for labour force data
year (int): census year
Returns:
labour: A cleaned pandas dataframe
| This function cleans the labour force status census data | [
"This",
"function",
"cleans",
"the",
"labour",
"force",
"status",
"census",
"data"
] | def clean_labour_force_status(labour, year):
labour = labour[labour['Type'] == 'Total']
van_total = labour.sum()
van_total['LocalArea'] = 'City of Vancouver'
van_total['Type'] = 'Total'
labour = labour.append(van_total, ignore_index=True)
labour = labour[['LocalArea',
... | [
"def",
"clean_labour_force_status",
"(",
"labour",
",",
"year",
")",
":",
"labour",
"=",
"labour",
"[",
"labour",
"[",
"'Type'",
"]",
"==",
"'Total'",
"]",
"van_total",
"=",
"labour",
".",
"sum",
"(",
")",
"van_total",
"[",
"'LocalArea'",
"]",
"=",
"'Cit... | This function cleans the labour force status census data | [
"This",
"function",
"cleans",
"the",
"labour",
"force",
"status",
"census",
"data"
] | [
"\"\"\"\n This function cleans the labour force status census data\n Args:\n labour (pd.DataFrame): The dataframe for labour force data\n year (int): census year\n\n Returns:\n labour: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "labour",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "labour"
}
],
"raises": [],
"params": [
{
"identifier": "labour",
"type": null,
"docstring": "T... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_mobility | <not_specific> | def clean_mobility(mob, year):
"""
This function cleans the population mobility census data
Args:
mob (pd.DataFrame): The dataframe for mobility data
year (int): census year
Returns:
mob: A cleaned pandas dataframe
"""
mob['total'] = ... |
This function cleans the population mobility census data
Args:
mob (pd.DataFrame): The dataframe for mobility data
year (int): census year
Returns:
mob: A cleaned pandas dataframe
| This function cleans the population mobility census data | [
"This",
"function",
"cleans",
"the",
"population",
"mobility",
"census",
"data"
] | def clean_mobility(mob, year):
mob['total'] = mob[
'Non-movers 1 yr ago'] + mob[
'Non-migrants 1 yr ago'] + mob[
'Migrants 1 yr ago']
mob['Non-movers 1 yr ago'] = mob[
'Non-movers 1 yr ago'] / mob['total']
mob['Non-migrants 1 yr ago'] =... | [
"def",
"clean_mobility",
"(",
"mob",
",",
"year",
")",
":",
"mob",
"[",
"'total'",
"]",
"=",
"mob",
"[",
"'Non-movers 1 yr ago'",
"]",
"+",
"mob",
"[",
"'Non-migrants 1 yr ago'",
"]",
"+",
"mob",
"[",
"'Migrants 1 yr ago'",
"]",
"mob",
"[",
"'Non-movers 1 yr... | This function cleans the population mobility census data | [
"This",
"function",
"cleans",
"the",
"population",
"mobility",
"census",
"data"
] | [
"\"\"\"\n This function cleans the population mobility census data\n Args:\n mob (pd.DataFrame): The dataframe for mobility data\n year (int): census year\n\n Returns:\n mob: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "mob",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "mob"
}
],
"raises": [],
"params": [
{
"identifier": "mob",
"type": null,
"docstring": "The dat... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_occupation | <not_specific> | def clean_occupation(occ, year):
"""
This function cleans the occupational census data
Args:
occ (pd.DataFrame): The dataframe for occupation data
year (int): census year
Returns:
occ: A cleaned pandas dataframe
"""
occ['total'] = occ... |
This function cleans the occupational census data
Args:
occ (pd.DataFrame): The dataframe for occupation data
year (int): census year
Returns:
occ: A cleaned pandas dataframe
| This function cleans the occupational census data | [
"This",
"function",
"cleans",
"the",
"occupational",
"census",
"data"
] | def clean_occupation(occ, year):
occ['total'] = occ[
list(occ.columns)[3]] + occ[list(occ.columns)[4]]
col_lis = list(occ.columns)[4:]
for col in col_lis:
occ[col] = occ[col]/occ['total']
occ = occ[occ.Type == "Total"]
van_total = occ.mean()
van_to... | [
"def",
"clean_occupation",
"(",
"occ",
",",
"year",
")",
":",
"occ",
"[",
"'total'",
"]",
"=",
"occ",
"[",
"list",
"(",
"occ",
".",
"columns",
")",
"[",
"3",
"]",
"]",
"+",
"occ",
"[",
"list",
"(",
"occ",
".",
"columns",
")",
"[",
"4",
"]",
"... | This function cleans the occupational census data | [
"This",
"function",
"cleans",
"the",
"occupational",
"census",
"data"
] | [
"\"\"\"\n This function cleans the occupational census data\n Args:\n occ (pd.DataFrame): The dataframe for occupation data\n year (int): census year\n\n Returns:\n occ: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "occ",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "occ"
}
],
"raises": [],
"params": [
{
"identifier": "occ",
"type": null,
"docstring": "The dat... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_time_worked | <not_specific> | def clean_time_worked(tw, year):
"""
This function cleans the work time census data
Args:
house_type (pd.DataFrame): The dataframe for work time data
tw (int): census year
Returns:
tw: A cleaned pandas dataframe
"""
tw = tw.query('Typ... |
This function cleans the work time census data
Args:
house_type (pd.DataFrame): The dataframe for work time data
tw (int): census year
Returns:
tw: A cleaned pandas dataframe
| This function cleans the work time census data | [
"This",
"function",
"cleans",
"the",
"work",
"time",
"census",
"data"
] | def clean_time_worked(tw, year):
tw = tw.query('Type == "Total"')
van_total = tw.sum()
van_total['LocalArea'] = 'City of Vancouver'
van_total['Type'] = 'Total'
tw = tw.append(van_total, ignore_index=True)
col_lis = list(tw.columns)[4:6]
for col in col_lis:
... | [
"def",
"clean_time_worked",
"(",
"tw",
",",
"year",
")",
":",
"tw",
"=",
"tw",
".",
"query",
"(",
"'Type == \"Total\"'",
")",
"van_total",
"=",
"tw",
".",
"sum",
"(",
")",
"van_total",
"[",
"'LocalArea'",
"]",
"=",
"'City of Vancouver'",
"van_total",
"[",
... | This function cleans the work time census data | [
"This",
"function",
"cleans",
"the",
"work",
"time",
"census",
"data"
] | [
"\"\"\"\n This function cleans the work time census data\n Args:\n house_type (pd.DataFrame): The dataframe for work time data\n tw (int): census year\n\n Returns:\n tw: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "tw",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "tw"
}
],
"raises": [],
"params": [
{
"identifier": "tw",
"type": null,
"docstring": null,
... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_transport_mode | <not_specific> | def clean_transport_mode(trans, year):
"""
This function cleans the transport mode census data
Args:
trans (pd.DataFrame): The dataframe for transport mode data
year (int): census year
Returns:
trans: A cleaned pandas dataframe
"""
tr... |
This function cleans the transport mode census data
Args:
trans (pd.DataFrame): The dataframe for transport mode data
year (int): census year
Returns:
trans: A cleaned pandas dataframe
| This function cleans the transport mode census data | [
"This",
"function",
"cleans",
"the",
"transport",
"mode",
"census",
"data"
] | def clean_transport_mode(trans, year):
trans = trans.query('Type == "Total"')
van_total = trans.sum()
van_total['LocalArea'] = 'City of Vancouver'
van_total['Type'] = 'Total'
trans = trans.append(van_total, ignore_index=True)
cols = list(trans.columns)[4:]
for c i... | [
"def",
"clean_transport_mode",
"(",
"trans",
",",
"year",
")",
":",
"trans",
"=",
"trans",
".",
"query",
"(",
"'Type == \"Total\"'",
")",
"van_total",
"=",
"trans",
".",
"sum",
"(",
")",
"van_total",
"[",
"'LocalArea'",
"]",
"=",
"'City of Vancouver'",
"van_... | This function cleans the transport mode census data | [
"This",
"function",
"cleans",
"the",
"transport",
"mode",
"census",
"data"
] | [
"\"\"\"\n This function cleans the transport mode census data\n Args:\n trans (pd.DataFrame): The dataframe for transport mode data\n year (int): census year\n\n Returns:\n trans: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "trans",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "trans"
}
],
"raises": [],
"params": [
{
"identifier": "trans",
"type": null,
"docstring": "The... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_workplace_status | <not_specific> | def clean_workplace_status(wp, year):
"""
This function cleans the workplace status census data
Args:
wp (pd.DataFrame): The dataframe for workplace status data
year (int): census year
Returns:
wp: A cleaned pandas dataframe
"""
wp = ... |
This function cleans the workplace status census data
Args:
wp (pd.DataFrame): The dataframe for workplace status data
year (int): census year
Returns:
wp: A cleaned pandas dataframe
| This function cleans the workplace status census data | [
"This",
"function",
"cleans",
"the",
"workplace",
"status",
"census",
"data"
] | def clean_workplace_status(wp, year):
wp = wp.query('Type == "Total"')
van_total = wp.sum()
van_total['LocalArea'] = 'City of Vancouver'
van_total['Type'] = 'Total'
wp = wp.append(van_total, ignore_index=True)
cols = list(wp.columns)[3:]
wp['total'] = wp[list(wp.c... | [
"def",
"clean_workplace_status",
"(",
"wp",
",",
"year",
")",
":",
"wp",
"=",
"wp",
".",
"query",
"(",
"'Type == \"Total\"'",
")",
"van_total",
"=",
"wp",
".",
"sum",
"(",
")",
"van_total",
"[",
"'LocalArea'",
"]",
"=",
"'City of Vancouver'",
"van_total",
... | This function cleans the workplace status census data | [
"This",
"function",
"cleans",
"the",
"workplace",
"status",
"census",
"data"
] | [
"\"\"\"\n This function cleans the workplace status census data\n Args:\n wp (pd.DataFrame): The dataframe for workplace status data\n year (int): census year\n\n Returns:\n wp: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "wp",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "wp"
}
],
"raises": [],
"params": [
{
"identifier": "wp",
"type": null,
"docstring": "The dataf... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_education | <not_specific> | def clean_education(education, year):
"""
This function cleans the education census data
Args:
education (pd.DataFrame): The dataframe for education data
year (int): census year
Returns:
education: A cleaned pandas dataframe
"""
if ye... |
This function cleans the education census data
Args:
education (pd.DataFrame): The dataframe for education data
year (int): census year
Returns:
education: A cleaned pandas dataframe
| This function cleans the education census data | [
"This",
"function",
"cleans",
"the",
"education",
"census",
"data"
] | def clean_education(education, year):
if year == 2001:
no_deg = education[
'population 20 years and over - Less than grade 9'] + education[
'population 20 years and over - Grades 9 to 13'] + education[
'population 20 years and over - Without High schoo... | [
"def",
"clean_education",
"(",
"education",
",",
"year",
")",
":",
"if",
"year",
"==",
"2001",
":",
"no_deg",
"=",
"education",
"[",
"'population 20 years and over - Less than grade 9'",
"]",
"+",
"education",
"[",
"'population 20 years and over - Grades 9 to 13'",
"]",... | This function cleans the education census data | [
"This",
"function",
"cleans",
"the",
"education",
"census",
"data"
] | [
"\"\"\"\n This function cleans the education census data\n Args:\n education (pd.DataFrame): The dataframe for education data\n year (int): census year\n\n Returns:\n education: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "education",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "education"
}
],
"raises": [],
"params": [
{
"identifier": "education",
"type": null,
"docstrin... |
35fef5ba95d1934395613e6011af50456f32b6f9 | aakanksha023/EVAN | src/04_visualization/census_vis_synthesis.py | [
"MIT"
] | Python | clean_immigration_birth_place | <not_specific> | def clean_immigration_birth_place(im_birth, year):
"""
This function cleans the immigration birth place census data
Args:
im_birth (pd.DataFrame): Dataframe for immigrant birth place data
year (int): census year
Returns:
im_birth: A cleaned pandas dat... |
This function cleans the immigration birth place census data
Args:
im_birth (pd.DataFrame): Dataframe for immigrant birth place data
year (int): census year
Returns:
im_birth: A cleaned pandas dataframe
| This function cleans the immigration birth place census data | [
"This",
"function",
"cleans",
"the",
"immigration",
"birth",
"place",
"census",
"data"
] | def clean_immigration_birth_place(im_birth, year):
if year == 2011:
im_birth = im_birth.query('Type == "Total"')
van_total = im_birth.sum()
van_total['LocalArea'] = 'City of Vancouver'
van_total['Type'] = 'Total'
im_birth = im_birth.append(van_total, i... | [
"def",
"clean_immigration_birth_place",
"(",
"im_birth",
",",
"year",
")",
":",
"if",
"year",
"==",
"2011",
":",
"im_birth",
"=",
"im_birth",
".",
"query",
"(",
"'Type == \"Total\"'",
")",
"van_total",
"=",
"im_birth",
".",
"sum",
"(",
")",
"van_total",
"[",... | This function cleans the immigration birth place census data | [
"This",
"function",
"cleans",
"the",
"immigration",
"birth",
"place",
"census",
"data"
] | [
"\"\"\"\n This function cleans the immigration birth place census data\n Args:\n im_birth (pd.DataFrame): Dataframe for immigrant birth place data\n year (int): census year\n\n Returns:\n im_birth: A cleaned pandas dataframe\n \"\"\""
] | [
{
"param": "im_birth",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [
{
"docstring": "A cleaned pandas dataframe",
"docstring_tokens": [
"A",
"cleaned",
"pandas",
"dataframe"
],
"type": "im_birth"
}
],
"raises": [],
"params": [
{
"identifier": "im_birth",
"type": null,
"docstring"... |
7e1acacc236a7db525612ae196d373998ca6d718 | tomdonaldson/servicemon | servicemon/query_runner.py | [
"BSD-3-Clause"
] | Python | _parse_query | <not_specific> | def _parse_query(input_args):
"""
# Parse args and apply defaults.
"""
parser = _create_query_argparser()
# Parse the arguments. If args is None, then the args implicitly come from sys.argv.
args = parser.parse_args(input_args)
# Catch SIGHUP, SIGQUIT and SIGTERM to allow running in the b... |
# Parse args and apply defaults.
| Parse args and apply defaults. | [
"Parse",
"args",
"and",
"apply",
"defaults",
"."
] | def _parse_query(input_args):
parser = _create_query_argparser()
args = parser.parse_args(input_args)
catch_signals()
if ((args.min_radius is not None or
args.max_radius is not None) and
args.num_cones is None):
parser.error(message='argument --num-cones is required when '
... | [
"def",
"_parse_query",
"(",
"input_args",
")",
":",
"parser",
"=",
"_create_query_argparser",
"(",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
"input_args",
")",
"catch_signals",
"(",
")",
"if",
"(",
"(",
"args",
".",
"min_radius",
"is",
"not",
"No... | Parse args and apply defaults. | [
"Parse",
"args",
"and",
"apply",
"defaults",
"."
] | [
"\"\"\"\n # Parse args and apply defaults.\n \"\"\"",
"# Parse the arguments. If args is None, then the args implicitly come from sys.argv.",
"# Catch SIGHUP, SIGQUIT and SIGTERM to allow running in the background.",
"# Validate args.",
"# Apply defaults that couldn't be built in.",
"# Default to t... | [
{
"param": "input_args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7e1acacc236a7db525612ae196d373998ca6d718 | tomdonaldson/servicemon | servicemon/query_runner.py | [
"BSD-3-Clause"
] | Python | _parse_replay | <not_specific> | def _parse_replay(input_args):
"""
# Parse args and apply defaults.
"""
parser = _create_replay_argparser()
# Parse the arguments. If args is None, then the args implicitly come from sys.argv.
args = parser.parse_args(input_args)
# Catch SIGHUP, SIGQUIT and SIGTERM to allow running in the... |
# Parse args and apply defaults.
| Parse args and apply defaults. | [
"Parse",
"args",
"and",
"apply",
"defaults",
"."
] | def _parse_replay(input_args):
parser = _create_replay_argparser()
args = parser.parse_args(input_args)
catch_signals()
apply_query_defaults(args, conelist_defaults)
if args.writers is None:
args.writers = ['csv_writer']
return args | [
"def",
"_parse_replay",
"(",
"input_args",
")",
":",
"parser",
"=",
"_create_replay_argparser",
"(",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
"input_args",
")",
"catch_signals",
"(",
")",
"apply_query_defaults",
"(",
"args",
",",
"conelist_defaults",
... | Parse args and apply defaults. | [
"Parse",
"args",
"and",
"apply",
"defaults",
"."
] | [
"\"\"\"\n # Parse args and apply defaults.\n \"\"\"",
"# Parse the arguments. If args is None, then the args implicitly come from sys.argv.",
"# Catch SIGHUP, SIGQUIT and SIGTERM to allow running in the background.",
"# Apply defaults that couldn't be built in.",
"# Default to the csv_writer and its ... | [
{
"param": "input_args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7e1acacc236a7db525612ae196d373998ca6d718 | tomdonaldson/servicemon | servicemon/query_runner.py | [
"BSD-3-Clause"
] | Python | catch_signals | null | def catch_signals():
"""
Catch SIGHUP, SIGQUIT and SIGTERM to allow running in the background.
When these signals are caught, a message will go to stderr.
SIGTERM also cause a stack trace to be sent to stderr.
"""
# register the signals to be caught
if platform.system() != 'Windows':
... |
Catch SIGHUP, SIGQUIT and SIGTERM to allow running in the background.
When these signals are caught, a message will go to stderr.
SIGTERM also cause a stack trace to be sent to stderr.
| Catch SIGHUP, SIGQUIT and SIGTERM to allow running in the background.
When these signals are caught, a message will go to stderr.
SIGTERM also cause a stack trace to be sent to stderr. | [
"Catch",
"SIGHUP",
"SIGQUIT",
"and",
"SIGTERM",
"to",
"allow",
"running",
"in",
"the",
"background",
".",
"When",
"these",
"signals",
"are",
"caught",
"a",
"message",
"will",
"go",
"to",
"stderr",
".",
"SIGTERM",
"also",
"cause",
"a",
"stack",
"trace",
"to... | def catch_signals():
if platform.system() != 'Windows':
try:
signal.signal(signal.SIGHUP, receiveSignal)
except AttributeError as e:
print(f'Warning: unable to add signal.SIGHUP handler: {repr(e)}')
try:
signal.signal(signal.SIGQUIT, receiveSignal)
... | [
"def",
"catch_signals",
"(",
")",
":",
"if",
"platform",
".",
"system",
"(",
")",
"!=",
"'Windows'",
":",
"try",
":",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGHUP",
",",
"receiveSignal",
")",
"except",
"AttributeError",
"as",
"e",
":",
"print",
... | Catch SIGHUP, SIGQUIT and SIGTERM to allow running in the background. | [
"Catch",
"SIGHUP",
"SIGQUIT",
"and",
"SIGTERM",
"to",
"allow",
"running",
"in",
"the",
"background",
"."
] | [
"\"\"\"\n Catch SIGHUP, SIGQUIT and SIGTERM to allow running in the background.\n\n When these signals are caught, a message will go to stderr.\n\n SIGTERM also cause a stack trace to be sent to stderr.\n \"\"\"",
"# register the signals to be caught",
"# SIGTERM should be available on Windows."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
e989977fa227df7278a686bc63d1462bcc3f13c3 | tomdonaldson/servicemon | servicemon/plugin_support.py | [
"BSD-3-Clause"
] | Python | begin | null | def begin(self, args, **kwargs):
"""
args is the result of an argparse.ArgumentParser's parse_args().
kwargs come from the plug-in specification.
"""
pass |
args is the result of an argparse.ArgumentParser's parse_args().
kwargs come from the plug-in specification.
| args is the result of an argparse.ArgumentParser's parse_args().
kwargs come from the plug-in specification. | [
"args",
"is",
"the",
"result",
"of",
"an",
"argparse",
".",
"ArgumentParser",
"'",
"s",
"parse_args",
"()",
".",
"kwargs",
"come",
"from",
"the",
"plug",
"-",
"in",
"specification",
"."
] | def begin(self, args, **kwargs):
pass | [
"def",
"begin",
"(",
"self",
",",
"args",
",",
"**",
"kwargs",
")",
":",
"pass"
] | args is the result of an argparse.ArgumentParser's parse_args(). | [
"args",
"is",
"the",
"result",
"of",
"an",
"argparse",
".",
"ArgumentParser",
"'",
"s",
"parse_args",
"()",
"."
] | [
"\"\"\"\n args is the result of an argparse.ArgumentParser's parse_args().\n kwargs come from the plug-in specification.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ec75e60093460f44944143f09e7144eaabd206eb | tomasfarias/httpx | tests/conftest.py | [
"BSD-3-Clause"
] | Python | restart | <not_specific> | def restart(backend):
"""Restart the running server from an async test function.
This fixture deals with possible differences between the environment of the
test function and that of the server.
"""
async def restart(server):
await backend.run_in_threadpool(AsyncioBackend().run, server.res... | Restart the running server from an async test function.
This fixture deals with possible differences between the environment of the
test function and that of the server.
| Restart the running server from an async test function.
This fixture deals with possible differences between the environment of the
test function and that of the server. | [
"Restart",
"the",
"running",
"server",
"from",
"an",
"async",
"test",
"function",
".",
"This",
"fixture",
"deals",
"with",
"possible",
"differences",
"between",
"the",
"environment",
"of",
"the",
"test",
"function",
"and",
"that",
"of",
"the",
"server",
"."
] | def restart(backend):
async def restart(server):
await backend.run_in_threadpool(AsyncioBackend().run, server.restart)
return restart | [
"def",
"restart",
"(",
"backend",
")",
":",
"async",
"def",
"restart",
"(",
"server",
")",
":",
"await",
"backend",
".",
"run_in_threadpool",
"(",
"AsyncioBackend",
"(",
")",
".",
"run",
",",
"server",
".",
"restart",
")",
"return",
"restart"
] | Restart the running server from an async test function. | [
"Restart",
"the",
"running",
"server",
"from",
"an",
"async",
"test",
"function",
"."
] | [
"\"\"\"Restart the running server from an async test function.\n\n This fixture deals with possible differences between the environment of the\n test function and that of the server.\n \"\"\""
] | [
{
"param": "backend",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "backend",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b86552dc6b4da37c577c0558fc858a5ffde10e94 | tomasfarias/httpx | tests/dispatch/utils.py | [
"BSD-3-Clause"
] | Python | stream_complete | null | def stream_complete(self, stream_id):
"""
Handler for when the HTTP request is completed.
"""
request = self.requests[stream_id].pop(0)
if not self.requests[stream_id]:
del self.requests[stream_id]
headers_dict = dict(request["headers"])
method = hea... |
Handler for when the HTTP request is completed.
| Handler for when the HTTP request is completed. | [
"Handler",
"for",
"when",
"the",
"HTTP",
"request",
"is",
"completed",
"."
] | def stream_complete(self, stream_id):
request = self.requests[stream_id].pop(0)
if not self.requests[stream_id]:
del self.requests[stream_id]
headers_dict = dict(request["headers"])
method = headers_dict[b":method"].decode("ascii")
url = "%s://%s%s" % (
he... | [
"def",
"stream_complete",
"(",
"self",
",",
"stream_id",
")",
":",
"request",
"=",
"self",
".",
"requests",
"[",
"stream_id",
"]",
".",
"pop",
"(",
"0",
")",
"if",
"not",
"self",
".",
"requests",
"[",
"stream_id",
"]",
":",
"del",
"self",
".",
"reque... | Handler for when the HTTP request is completed. | [
"Handler",
"for",
"when",
"the",
"HTTP",
"request",
"is",
"completed",
"."
] | [
"\"\"\"\n Handler for when the HTTP request is completed.\n \"\"\"",
"# Call out to the app.",
"# Write the response to the buffer."
] | [
{
"param": "self",
"type": null
},
{
"param": "stream_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stream_id",
"type": null,
"docstring": null,
"docstring_token... |
e404546495d6acf40f4e83f11a4e6ee6e33181f7 | adavila0703/warehouse-hub | models/printing_model.py | [
"MIT"
] | Python | update_db | null | def update_db(cls, id, date_created, employee, item, serial_num, ins_type, unit_type, rec_date, rec_pass,
start_date, appearance, functions, notes, complete):
"""Updates all items in printing data table"""
obj = cls.query.filter_by(id=id).first()
obj.date_created = date_created... | Updates all items in printing data table | Updates all items in printing data table | [
"Updates",
"all",
"items",
"in",
"printing",
"data",
"table"
] | def update_db(cls, id, date_created, employee, item, serial_num, ins_type, unit_type, rec_date, rec_pass,
start_date, appearance, functions, notes, complete):
obj = cls.query.filter_by(id=id).first()
obj.date_created = date_created
obj.employee = employee
obj.item = ite... | [
"def",
"update_db",
"(",
"cls",
",",
"id",
",",
"date_created",
",",
"employee",
",",
"item",
",",
"serial_num",
",",
"ins_type",
",",
"unit_type",
",",
"rec_date",
",",
"rec_pass",
",",
"start_date",
",",
"appearance",
",",
"functions",
",",
"notes",
",",... | Updates all items in printing data table | [
"Updates",
"all",
"items",
"in",
"printing",
"data",
"table"
] | [
"\"\"\"Updates all items in printing data table\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "date_created",
"type": null
},
{
"param": "employee",
"type": null
},
{
"param": "item",
"type": null
},
{
"param": "serial_num",
"type": null
},
{
"param": "ins... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
e404546495d6acf40f4e83f11a4e6ee6e33181f7 | adavila0703/warehouse-hub | models/printing_model.py | [
"MIT"
] | Python | update_rec_date | <not_specific> | def update_rec_date(cls, id, rec_date):
"""Updates the receive date for an entry"""
obj = cls.query.filter_by(id=id).first()
obj.rec_date = rec_date
db.session.commit()
return None | Updates the receive date for an entry | Updates the receive date for an entry | [
"Updates",
"the",
"receive",
"date",
"for",
"an",
"entry"
] | def update_rec_date(cls, id, rec_date):
obj = cls.query.filter_by(id=id).first()
obj.rec_date = rec_date
db.session.commit()
return None | [
"def",
"update_rec_date",
"(",
"cls",
",",
"id",
",",
"rec_date",
")",
":",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"id",
")",
".",
"first",
"(",
")",
"obj",
".",
"rec_date",
"=",
"rec_date",
"db",
".",
"session",
".",
... | Updates the receive date for an entry | [
"Updates",
"the",
"receive",
"date",
"for",
"an",
"entry"
] | [
"\"\"\"Updates the receive date for an entry\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "rec_date",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
e404546495d6acf40f4e83f11a4e6ee6e33181f7 | adavila0703/warehouse-hub | models/printing_model.py | [
"MIT"
] | Python | update_rec_pass | null | def update_rec_pass(cls, id, rec_pass):
"""Updates the receive pass/fail for an entry"""
obj = cls.query.filter_by(id=id).first()
obj.rec_pass = rec_pass
db.session.commit() | Updates the receive pass/fail for an entry | Updates the receive pass/fail for an entry | [
"Updates",
"the",
"receive",
"pass",
"/",
"fail",
"for",
"an",
"entry"
] | def update_rec_pass(cls, id, rec_pass):
obj = cls.query.filter_by(id=id).first()
obj.rec_pass = rec_pass
db.session.commit() | [
"def",
"update_rec_pass",
"(",
"cls",
",",
"id",
",",
"rec_pass",
")",
":",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"id",
")",
".",
"first",
"(",
")",
"obj",
".",
"rec_pass",
"=",
"rec_pass",
"db",
".",
"session",
".",
... | Updates the receive pass/fail for an entry | [
"Updates",
"the",
"receive",
"pass",
"/",
"fail",
"for",
"an",
"entry"
] | [
"\"\"\"Updates the receive pass/fail for an entry\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "rec_pass",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
e404546495d6acf40f4e83f11a4e6ee6e33181f7 | adavila0703/warehouse-hub | models/printing_model.py | [
"MIT"
] | Python | update_start_date | <not_specific> | def update_start_date(cls, id, start_date):
"""Updates the start date for an entry"""
obj = cls.query.filter_by(id=id).first()
obj.start_date = start_date
obj.rec_to_start = PrintingModel.lt_check(obj.rec_date, start_date)
db.session.commit()
return None | Updates the start date for an entry | Updates the start date for an entry | [
"Updates",
"the",
"start",
"date",
"for",
"an",
"entry"
] | def update_start_date(cls, id, start_date):
obj = cls.query.filter_by(id=id).first()
obj.start_date = start_date
obj.rec_to_start = PrintingModel.lt_check(obj.rec_date, start_date)
db.session.commit()
return None | [
"def",
"update_start_date",
"(",
"cls",
",",
"id",
",",
"start_date",
")",
":",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"id",
")",
".",
"first",
"(",
")",
"obj",
".",
"start_date",
"=",
"start_date",
"obj",
".",
"rec_to_sta... | Updates the start date for an entry | [
"Updates",
"the",
"start",
"date",
"for",
"an",
"entry"
] | [
"\"\"\"Updates the start date for an entry\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "start_date",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
e404546495d6acf40f4e83f11a4e6ee6e33181f7 | adavila0703/warehouse-hub | models/printing_model.py | [
"MIT"
] | Python | update_appearance | <not_specific> | def update_appearance(cls, id, appearance):
"""Updates the appearance for an entry"""
obj = cls.query.filter_by(id=id).first()
obj.appearance = appearance
db.session.commit()
return None | Updates the appearance for an entry | Updates the appearance for an entry | [
"Updates",
"the",
"appearance",
"for",
"an",
"entry"
] | def update_appearance(cls, id, appearance):
obj = cls.query.filter_by(id=id).first()
obj.appearance = appearance
db.session.commit()
return None | [
"def",
"update_appearance",
"(",
"cls",
",",
"id",
",",
"appearance",
")",
":",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"id",
")",
".",
"first",
"(",
")",
"obj",
".",
"appearance",
"=",
"appearance",
"db",
".",
"session",
... | Updates the appearance for an entry | [
"Updates",
"the",
"appearance",
"for",
"an",
"entry"
] | [
"\"\"\"Updates the appearance for an entry\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "appearance",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
e404546495d6acf40f4e83f11a4e6ee6e33181f7 | adavila0703/warehouse-hub | models/printing_model.py | [
"MIT"
] | Python | update_functions | <not_specific> | def update_functions(cls, id, functions):
"""Updates the functions for an entry"""
obj = cls.query.filter_by(id=id).first()
obj.functions = functions
db.session.commit()
return None | Updates the functions for an entry | Updates the functions for an entry | [
"Updates",
"the",
"functions",
"for",
"an",
"entry"
] | def update_functions(cls, id, functions):
obj = cls.query.filter_by(id=id).first()
obj.functions = functions
db.session.commit()
return None | [
"def",
"update_functions",
"(",
"cls",
",",
"id",
",",
"functions",
")",
":",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"id",
")",
".",
"first",
"(",
")",
"obj",
".",
"functions",
"=",
"functions",
"db",
".",
"session",
"."... | Updates the functions for an entry | [
"Updates",
"the",
"functions",
"for",
"an",
"entry"
] | [
"\"\"\"Updates the functions for an entry\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "functions",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
e404546495d6acf40f4e83f11a4e6ee6e33181f7 | adavila0703/warehouse-hub | models/printing_model.py | [
"MIT"
] | Python | update_complete | <not_specific> | def update_complete(cls, id, complete):
"""Updates the complete for an entry"""
obj = cls.query.filter_by(id=id).first()
obj.complete = complete
obj.start_to_comp = PrintingModel.lt_check(obj.start_date, complete)
db.session.commit()
return None | Updates the complete for an entry | Updates the complete for an entry | [
"Updates",
"the",
"complete",
"for",
"an",
"entry"
] | def update_complete(cls, id, complete):
obj = cls.query.filter_by(id=id).first()
obj.complete = complete
obj.start_to_comp = PrintingModel.lt_check(obj.start_date, complete)
db.session.commit()
return None | [
"def",
"update_complete",
"(",
"cls",
",",
"id",
",",
"complete",
")",
":",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"id",
")",
".",
"first",
"(",
")",
"obj",
".",
"complete",
"=",
"complete",
"obj",
".",
"start_to_comp",
... | Updates the complete for an entry | [
"Updates",
"the",
"complete",
"for",
"an",
"entry"
] | [
"\"\"\"Updates the complete for an entry\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "complete",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
e404546495d6acf40f4e83f11a4e6ee6e33181f7 | adavila0703/warehouse-hub | models/printing_model.py | [
"MIT"
] | Python | update_notes | <not_specific> | def update_notes(cls, id, notes):
"""Updates the notes for an entry"""
obj = cls.query.filter_by(id=id).first()
obj.notes = notes
db.session.commit()
return None | Updates the notes for an entry | Updates the notes for an entry | [
"Updates",
"the",
"notes",
"for",
"an",
"entry"
] | def update_notes(cls, id, notes):
obj = cls.query.filter_by(id=id).first()
obj.notes = notes
db.session.commit()
return None | [
"def",
"update_notes",
"(",
"cls",
",",
"id",
",",
"notes",
")",
":",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"id",
")",
".",
"first",
"(",
")",
"obj",
".",
"notes",
"=",
"notes",
"db",
".",
"session",
".",
"commit",
... | Updates the notes for an entry | [
"Updates",
"the",
"notes",
"for",
"an",
"entry"
] | [
"\"\"\"Updates the notes for an entry\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "notes",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
e404546495d6acf40f4e83f11a4e6ee6e33181f7 | adavila0703/warehouse-hub | models/printing_model.py | [
"MIT"
] | Python | update_transfer | <not_specific> | def update_transfer(cls, id, complete):
"""Updates the transfer for an entry"""
obj = cls.query.filter_by(id=id).first()
obj.complete = complete
obj.start_to_comp = PrintingModel.lt_check(obj.rec_date, complete)
db.session.commit()
return None | Updates the transfer for an entry | Updates the transfer for an entry | [
"Updates",
"the",
"transfer",
"for",
"an",
"entry"
] | def update_transfer(cls, id, complete):
obj = cls.query.filter_by(id=id).first()
obj.complete = complete
obj.start_to_comp = PrintingModel.lt_check(obj.rec_date, complete)
db.session.commit()
return None | [
"def",
"update_transfer",
"(",
"cls",
",",
"id",
",",
"complete",
")",
":",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"id",
")",
".",
"first",
"(",
")",
"obj",
".",
"complete",
"=",
"complete",
"obj",
".",
"start_to_comp",
... | Updates the transfer for an entry | [
"Updates",
"the",
"transfer",
"for",
"an",
"entry"
] | [
"\"\"\"Updates the transfer for an entry\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "complete",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
e404546495d6acf40f4e83f11a4e6ee6e33181f7 | adavila0703/warehouse-hub | models/printing_model.py | [
"MIT"
] | Python | count_completed | <not_specific> | def count_completed(cls, name, month, year):
"""Function which counts how many entries have been completed"""
count = 0
obj = cls.query.filter_by(employee=name).filter(PrintingModel.complete != '').all()
for o in obj:
if o.complete.split('-')[1] == month and o.complete.split(... | Function which counts how many entries have been completed | Function which counts how many entries have been completed | [
"Function",
"which",
"counts",
"how",
"many",
"entries",
"have",
"been",
"completed"
] | def count_completed(cls, name, month, year):
count = 0
obj = cls.query.filter_by(employee=name).filter(PrintingModel.complete != '').all()
for o in obj:
if o.complete.split('-')[1] == month and o.complete.split('-')[0] == year:
count += 1
return count | [
"def",
"count_completed",
"(",
"cls",
",",
"name",
",",
"month",
",",
"year",
")",
":",
"count",
"=",
"0",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"employee",
"=",
"name",
")",
".",
"filter",
"(",
"PrintingModel",
".",
"complete",
"!=... | Function which counts how many entries have been completed | [
"Function",
"which",
"counts",
"how",
"many",
"entries",
"have",
"been",
"completed"
] | [
"\"\"\"Function which counts how many entries have been completed\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "month",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": []... |
e404546495d6acf40f4e83f11a4e6ee6e33181f7 | adavila0703/warehouse-hub | models/printing_model.py | [
"MIT"
] | Python | count_failed | <not_specific> | def count_failed(cls, month, year):
"""Function which counts how many entries have failed"""
count = 0
obj = cls.query.filter(PrintingModel.complete != '').all()
for o in obj:
if o.complete.split('-')[1] == month and o.complete.split('-')[0] == year:
if o.rec_... | Function which counts how many entries have failed | Function which counts how many entries have failed | [
"Function",
"which",
"counts",
"how",
"many",
"entries",
"have",
"failed"
] | def count_failed(cls, month, year):
count = 0
obj = cls.query.filter(PrintingModel.complete != '').all()
for o in obj:
if o.complete.split('-')[1] == month and o.complete.split('-')[0] == year:
if o.rec_pass == 'Fail' or o.functions == 'Fail' or o.appearance == 'Fail'... | [
"def",
"count_failed",
"(",
"cls",
",",
"month",
",",
"year",
")",
":",
"count",
"=",
"0",
"obj",
"=",
"cls",
".",
"query",
".",
"filter",
"(",
"PrintingModel",
".",
"complete",
"!=",
"''",
")",
".",
"all",
"(",
")",
"for",
"o",
"in",
"obj",
":",... | Function which counts how many entries have failed | [
"Function",
"which",
"counts",
"how",
"many",
"entries",
"have",
"failed"
] | [
"\"\"\"Function which counts how many entries have failed\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "month",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "month",
"type": null,
"docstring": null,
"docstring_tokens": [... |
9483f76462cdb8e3ee886b2aefbc1d2ac05e1bc1 | adavila0703/warehouse-hub | utils/patch.py | [
"MIT"
] | Python | patch | null | def patch():
"""Patch.py is meant to move all new files to the installer location"""
print('Pushing Patch')
os.system(f'start cmd /c "pyinstaller app.py -F -n warehousehub --distpath C:/Documents/warehousehub"')
time.sleep(1)
rmtree(f'C:/Documents/warehousehub/templates')
print('Updating Templat... | Patch.py is meant to move all new files to the installer location | Patch.py is meant to move all new files to the installer location | [
"Patch",
".",
"py",
"is",
"meant",
"to",
"move",
"all",
"new",
"files",
"to",
"the",
"installer",
"location"
] | def patch():
print('Pushing Patch')
os.system(f'start cmd /c "pyinstaller app.py -F -n warehousehub --distpath C:/Documents/warehousehub"')
time.sleep(1)
rmtree(f'C:/Documents/warehousehub/templates')
print('Updating Templates')
time.sleep(1)
copytree('C:/warehousehub/templates',
... | [
"def",
"patch",
"(",
")",
":",
"print",
"(",
"'Pushing Patch'",
")",
"os",
".",
"system",
"(",
"f'start cmd /c \"pyinstaller app.py -F -n warehousehub --distpath C:/Documents/warehousehub\"'",
")",
"time",
".",
"sleep",
"(",
"1",
")",
"rmtree",
"(",
"f'C:/Documents/ware... | Patch.py is meant to move all new files to the installer location | [
"Patch",
".",
"py",
"is",
"meant",
"to",
"move",
"all",
"new",
"files",
"to",
"the",
"installer",
"location"
] | [
"\"\"\"Patch.py is meant to move all new files to the installer location\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
19b3b12f916bfa71763e1f5555965f2dffc3a223 | adavila0703/warehouse-hub | utils/update.py | [
"MIT"
] | Python | update | null | def update():
"""Update is a script to auto update all the files that the user is using"""
print('Warehouse Hub is updating, do not close this window...')
time.sleep(3)
print('Applying patch...')
time.sleep(1)
copy('C:/warehousehub/warehousehub.exe', pathlib.Path().absolute())
rmtree(f'{... | Update is a script to auto update all the files that the user is using | Update is a script to auto update all the files that the user is using | [
"Update",
"is",
"a",
"script",
"to",
"auto",
"update",
"all",
"the",
"files",
"that",
"the",
"user",
"is",
"using"
] | def update():
print('Warehouse Hub is updating, do not close this window...')
time.sleep(3)
print('Applying patch...')
time.sleep(1)
copy('C:/warehousehub/warehousehub.exe', pathlib.Path().absolute())
rmtree(f'{pathlib.Path().absolute()}/templates')
copytree('C:/warehousehub/templates', f'{p... | [
"def",
"update",
"(",
")",
":",
"print",
"(",
"'Warehouse Hub is updating, do not close this window...'",
")",
"time",
".",
"sleep",
"(",
"3",
")",
"print",
"(",
"'Applying patch...'",
")",
"time",
".",
"sleep",
"(",
"1",
")",
"copy",
"(",
"'C:/warehousehub/ware... | Update is a script to auto update all the files that the user is using | [
"Update",
"is",
"a",
"script",
"to",
"auto",
"update",
"all",
"the",
"files",
"that",
"the",
"user",
"is",
"using"
] | [
"\"\"\"Update is a script to auto update all the files that the user is using\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
67eba6ebad554160707705ab368564857596e5a5 | adavila0703/warehouse-hub | models/marking_model.py | [
"MIT"
] | Python | update_db | <not_specific> | def update_db(cls, id, date_created, employee, item, serial_num, ins_type, rec_date, start_date, accessories,
appearance, functions, cleaning, complete, notes):
"""Updates all items in marking data table"""
obj = cls.query.filter_by(id=id).first()
obj.date_created = date_create... | Updates all items in marking data table | Updates all items in marking data table | [
"Updates",
"all",
"items",
"in",
"marking",
"data",
"table"
] | def update_db(cls, id, date_created, employee, item, serial_num, ins_type, rec_date, start_date, accessories,
appearance, functions, cleaning, complete, notes):
obj = cls.query.filter_by(id=id).first()
obj.date_created = date_created
obj.employee = employee
obj.item = i... | [
"def",
"update_db",
"(",
"cls",
",",
"id",
",",
"date_created",
",",
"employee",
",",
"item",
",",
"serial_num",
",",
"ins_type",
",",
"rec_date",
",",
"start_date",
",",
"accessories",
",",
"appearance",
",",
"functions",
",",
"cleaning",
",",
"complete",
... | Updates all items in marking data table | [
"Updates",
"all",
"items",
"in",
"marking",
"data",
"table"
] | [
"\"\"\"Updates all items in marking data table\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "date_created",
"type": null
},
{
"param": "employee",
"type": null
},
{
"param": "item",
"type": null
},
{
"param": "serial_num",
"type": null
},
{
"param": "ins... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
67eba6ebad554160707705ab368564857596e5a5 | adavila0703/warehouse-hub | models/marking_model.py | [
"MIT"
] | Python | update_start_date | <not_specific> | def update_start_date(cls, id, start_date):
"""Updates the start date for an entry"""
obj = cls.query.filter_by(id=id).first()
obj.start_date = start_date
obj.rec_to_start = MarkingModel.lt_check(obj.rec_date, start_date)
db.session.commit()
return None | Updates the start date for an entry | Updates the start date for an entry | [
"Updates",
"the",
"start",
"date",
"for",
"an",
"entry"
] | def update_start_date(cls, id, start_date):
obj = cls.query.filter_by(id=id).first()
obj.start_date = start_date
obj.rec_to_start = MarkingModel.lt_check(obj.rec_date, start_date)
db.session.commit()
return None | [
"def",
"update_start_date",
"(",
"cls",
",",
"id",
",",
"start_date",
")",
":",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"id",
")",
".",
"first",
"(",
")",
"obj",
".",
"start_date",
"=",
"start_date",
"obj",
".",
"rec_to_sta... | Updates the start date for an entry | [
"Updates",
"the",
"start",
"date",
"for",
"an",
"entry"
] | [
"\"\"\"Updates the start date for an entry\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "start_date",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
67eba6ebad554160707705ab368564857596e5a5 | adavila0703/warehouse-hub | models/marking_model.py | [
"MIT"
] | Python | update_accessories | <not_specific> | def update_accessories(cls, id, accessories):
"""Updates the accessories for an entry"""
obj = cls.query.filter_by(id=id).first()
obj.accessories = accessories
db.session.commit()
return None | Updates the accessories for an entry | Updates the accessories for an entry | [
"Updates",
"the",
"accessories",
"for",
"an",
"entry"
] | def update_accessories(cls, id, accessories):
obj = cls.query.filter_by(id=id).first()
obj.accessories = accessories
db.session.commit()
return None | [
"def",
"update_accessories",
"(",
"cls",
",",
"id",
",",
"accessories",
")",
":",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"id",
")",
".",
"first",
"(",
")",
"obj",
".",
"accessories",
"=",
"accessories",
"db",
".",
"session... | Updates the accessories for an entry | [
"Updates",
"the",
"accessories",
"for",
"an",
"entry"
] | [
"\"\"\"Updates the accessories for an entry\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "accessories",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
67eba6ebad554160707705ab368564857596e5a5 | adavila0703/warehouse-hub | models/marking_model.py | [
"MIT"
] | Python | update_cleaning | <not_specific> | def update_cleaning(cls, id, cleaning):
"""Updates the cleaning for an entry"""
obj = cls.query.filter_by(id=id).first()
obj.cleaning = cleaning
db.session.commit()
return None | Updates the cleaning for an entry | Updates the cleaning for an entry | [
"Updates",
"the",
"cleaning",
"for",
"an",
"entry"
] | def update_cleaning(cls, id, cleaning):
obj = cls.query.filter_by(id=id).first()
obj.cleaning = cleaning
db.session.commit()
return None | [
"def",
"update_cleaning",
"(",
"cls",
",",
"id",
",",
"cleaning",
")",
":",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"id",
")",
".",
"first",
"(",
")",
"obj",
".",
"cleaning",
"=",
"cleaning",
"db",
".",
"session",
".",
... | Updates the cleaning for an entry | [
"Updates",
"the",
"cleaning",
"for",
"an",
"entry"
] | [
"\"\"\"Updates the cleaning for an entry\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "cleaning",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
67eba6ebad554160707705ab368564857596e5a5 | adavila0703/warehouse-hub | models/marking_model.py | [
"MIT"
] | Python | update_complete | <not_specific> | def update_complete(cls, id, complete):
"""Updates the complete for an entry"""
obj = cls.query.filter_by(id=id).first()
obj.complete = complete
obj.start_to_comp = MarkingModel.lt_check(obj.start_date, complete)
db.session.commit()
return None | Updates the complete for an entry | Updates the complete for an entry | [
"Updates",
"the",
"complete",
"for",
"an",
"entry"
] | def update_complete(cls, id, complete):
obj = cls.query.filter_by(id=id).first()
obj.complete = complete
obj.start_to_comp = MarkingModel.lt_check(obj.start_date, complete)
db.session.commit()
return None | [
"def",
"update_complete",
"(",
"cls",
",",
"id",
",",
"complete",
")",
":",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"id",
")",
".",
"first",
"(",
")",
"obj",
".",
"complete",
"=",
"complete",
"obj",
".",
"start_to_comp",
... | Updates the complete for an entry | [
"Updates",
"the",
"complete",
"for",
"an",
"entry"
] | [
"\"\"\"Updates the complete for an entry\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "complete",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
67eba6ebad554160707705ab368564857596e5a5 | adavila0703/warehouse-hub | models/marking_model.py | [
"MIT"
] | Python | update_transfer | <not_specific> | def update_transfer(cls, id, complete):
"""Update transfer status for an entry"""
obj = cls.query.filter_by(id=id).first()
obj.complete = complete
obj.start_to_comp = MarkingModel.lt_check(obj.rec_date, complete)
db.session.commit()
return None | Update transfer status for an entry | Update transfer status for an entry | [
"Update",
"transfer",
"status",
"for",
"an",
"entry"
] | def update_transfer(cls, id, complete):
obj = cls.query.filter_by(id=id).first()
obj.complete = complete
obj.start_to_comp = MarkingModel.lt_check(obj.rec_date, complete)
db.session.commit()
return None | [
"def",
"update_transfer",
"(",
"cls",
",",
"id",
",",
"complete",
")",
":",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"id",
"=",
"id",
")",
".",
"first",
"(",
")",
"obj",
".",
"complete",
"=",
"complete",
"obj",
".",
"start_to_comp",
... | Update transfer status for an entry | [
"Update",
"transfer",
"status",
"for",
"an",
"entry"
] | [
"\"\"\"Update transfer status for an entry\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "complete",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
67eba6ebad554160707705ab368564857596e5a5 | adavila0703/warehouse-hub | models/marking_model.py | [
"MIT"
] | Python | count_completed | <not_specific> | def count_completed(cls, name, date, year):
"""Function which counts how many entries have been completed"""
count = 0
obj = cls.query.filter_by(employee=name).filter(MarkingModel.complete != '').all()
for o in obj:
if o.complete.split('-')[1] == date and o.complete.split('-'... | Function which counts how many entries have been completed | Function which counts how many entries have been completed | [
"Function",
"which",
"counts",
"how",
"many",
"entries",
"have",
"been",
"completed"
] | def count_completed(cls, name, date, year):
count = 0
obj = cls.query.filter_by(employee=name).filter(MarkingModel.complete != '').all()
for o in obj:
if o.complete.split('-')[1] == date and o.complete.split('-')[0] == year:
count += 1
return count | [
"def",
"count_completed",
"(",
"cls",
",",
"name",
",",
"date",
",",
"year",
")",
":",
"count",
"=",
"0",
"obj",
"=",
"cls",
".",
"query",
".",
"filter_by",
"(",
"employee",
"=",
"name",
")",
".",
"filter",
"(",
"MarkingModel",
".",
"complete",
"!=",... | Function which counts how many entries have been completed | [
"Function",
"which",
"counts",
"how",
"many",
"entries",
"have",
"been",
"completed"
] | [
"\"\"\"Function which counts how many entries have been completed\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "date",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": []... |
67eba6ebad554160707705ab368564857596e5a5 | adavila0703/warehouse-hub | models/marking_model.py | [
"MIT"
] | Python | count_failed | <not_specific> | def count_failed(cls, month, year):
"""Function which counts how many entries have failed"""
count = 0
obj = cls.query.filter(MarkingModel.complete != '').all()
for o in obj:
if o.complete.split('-')[1] == month and o.complete.split('-')[0] == year:
if o.appea... | Function which counts how many entries have failed | Function which counts how many entries have failed | [
"Function",
"which",
"counts",
"how",
"many",
"entries",
"have",
"failed"
] | def count_failed(cls, month, year):
count = 0
obj = cls.query.filter(MarkingModel.complete != '').all()
for o in obj:
if o.complete.split('-')[1] == month and o.complete.split('-')[0] == year:
if o.appearance == 'Fail' or o.functions == 'Fail':
cou... | [
"def",
"count_failed",
"(",
"cls",
",",
"month",
",",
"year",
")",
":",
"count",
"=",
"0",
"obj",
"=",
"cls",
".",
"query",
".",
"filter",
"(",
"MarkingModel",
".",
"complete",
"!=",
"''",
")",
".",
"all",
"(",
")",
"for",
"o",
"in",
"obj",
":",
... | Function which counts how many entries have failed | [
"Function",
"which",
"counts",
"how",
"many",
"entries",
"have",
"failed"
] | [
"\"\"\"Function which counts how many entries have failed\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "month",
"type": null
},
{
"param": "year",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "month",
"type": null,
"docstring": null,
"docstring_tokens": [... |
67eba6ebad554160707705ab368564857596e5a5 | adavila0703/warehouse-hub | models/marking_model.py | [
"MIT"
] | Python | total_count | <not_specific> | def total_count(cls, name, date):
"""Counts the total amount of entries"""
count = 0
obj = cls.query.filter(MarkingModel.complete != '').all()
for o in obj:
if o.complete.split('-')[1] == date:
count += 1
return count | Counts the total amount of entries | Counts the total amount of entries | [
"Counts",
"the",
"total",
"amount",
"of",
"entries"
] | def total_count(cls, name, date):
count = 0
obj = cls.query.filter(MarkingModel.complete != '').all()
for o in obj:
if o.complete.split('-')[1] == date:
count += 1
return count | [
"def",
"total_count",
"(",
"cls",
",",
"name",
",",
"date",
")",
":",
"count",
"=",
"0",
"obj",
"=",
"cls",
".",
"query",
".",
"filter",
"(",
"MarkingModel",
".",
"complete",
"!=",
"''",
")",
".",
"all",
"(",
")",
"for",
"o",
"in",
"obj",
":",
... | Counts the total amount of entries | [
"Counts",
"the",
"total",
"amount",
"of",
"entries"
] | [
"\"\"\"Counts the total amount of entries\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "date",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": []... |
c9993e5a9b843d69e9d48e51122af3aec7ab817f | adavila0703/warehouse-hub | utils/port_data.py | [
"MIT"
] | Python | port_micro | null | def port_micro():
"""Function meant to port all micro data to the new database"""
lb = load_workbook('micro.xlsx')
ws = lb.active
sheet_range = lb['Sheet1']
letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L']
obj = []
lettercount = 0
count = 1
connection = sqli... | Function meant to port all micro data to the new database | Function meant to port all micro data to the new database | [
"Function",
"meant",
"to",
"port",
"all",
"micro",
"data",
"to",
"the",
"new",
"database"
] | def port_micro():
lb = load_workbook('micro.xlsx')
ws = lb.active
sheet_range = lb['Sheet1']
letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L']
obj = []
lettercount = 0
count = 1
connection = sqlite3.connect('data.db')
cursor = connection.cursor()
while True:
... | [
"def",
"port_micro",
"(",
")",
":",
"lb",
"=",
"load_workbook",
"(",
"'micro.xlsx'",
")",
"ws",
"=",
"lb",
".",
"active",
"sheet_range",
"=",
"lb",
"[",
"'Sheet1'",
"]",
"letters",
"=",
"[",
"'A'",
",",
"'B'",
",",
"'C'",
",",
"'D'",
",",
"'E'",
",... | Function meant to port all micro data to the new database | [
"Function",
"meant",
"to",
"port",
"all",
"micro",
"data",
"to",
"the",
"new",
"database"
] | [
"\"\"\"Function meant to port all micro data to the new database\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c9993e5a9b843d69e9d48e51122af3aec7ab817f | adavila0703/warehouse-hub | utils/port_data.py | [
"MIT"
] | Python | port_marking | null | def port_marking():
"""Function meant to port all marking data to the new database"""
lb = load_workbook('marking.xlsx')
ws = lb.active
sheet_range = lb['Sheet1']
letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L']
obj = []
lettercount = 0
count = 1
connection ... | Function meant to port all marking data to the new database | Function meant to port all marking data to the new database | [
"Function",
"meant",
"to",
"port",
"all",
"marking",
"data",
"to",
"the",
"new",
"database"
] | def port_marking():
lb = load_workbook('marking.xlsx')
ws = lb.active
sheet_range = lb['Sheet1']
letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L']
obj = []
lettercount = 0
count = 1
connection = sqlite3.connect('data.db')
cursor = connection.cursor()
while Tr... | [
"def",
"port_marking",
"(",
")",
":",
"lb",
"=",
"load_workbook",
"(",
"'marking.xlsx'",
")",
"ws",
"=",
"lb",
".",
"active",
"sheet_range",
"=",
"lb",
"[",
"'Sheet1'",
"]",
"letters",
"=",
"[",
"'A'",
",",
"'B'",
",",
"'C'",
",",
"'D'",
",",
"'E'",
... | Function meant to port all marking data to the new database | [
"Function",
"meant",
"to",
"port",
"all",
"marking",
"data",
"to",
"the",
"new",
"database"
] | [
"\"\"\"Function meant to port all marking data to the new database\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
40d6afac61001d068d1ea83f9f8b1581ef13fa3c | FelixLabelle/neural_network_expirements | neural_network.py | [
"MIT"
] | Python | step_annealing | <not_specific> | def step_annealing(self,current_iteration):
"""Reduces the learning rate by step_factor for in a step like fashion"""
[reduction_interval, step_factor] = self.hyper_parameters
num_epochs = np.floor((self.batch_size*current_iteration)/self.num_examples)
return self.epsilon * step_factor**... | Reduces the learning rate by step_factor for in a step like fashion | Reduces the learning rate by step_factor for in a step like fashion | [
"Reduces",
"the",
"learning",
"rate",
"by",
"step_factor",
"for",
"in",
"a",
"step",
"like",
"fashion"
] | def step_annealing(self,current_iteration):
[reduction_interval, step_factor] = self.hyper_parameters
num_epochs = np.floor((self.batch_size*current_iteration)/self.num_examples)
return self.epsilon * step_factor**np.ceil(num_epochs/reduction_interval) | [
"def",
"step_annealing",
"(",
"self",
",",
"current_iteration",
")",
":",
"[",
"reduction_interval",
",",
"step_factor",
"]",
"=",
"self",
".",
"hyper_parameters",
"num_epochs",
"=",
"np",
".",
"floor",
"(",
"(",
"self",
".",
"batch_size",
"*",
"current_iterat... | Reduces the learning rate by step_factor for in a step like fashion | [
"Reduces",
"the",
"learning",
"rate",
"by",
"step_factor",
"for",
"in",
"a",
"step",
"like",
"fashion"
] | [
"\"\"\"Reduces the learning rate by step_factor for in a step like fashion\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "current_iteration",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "current_iteration",
"type": null,
"docstring": null,
"docstri... |
40d6afac61001d068d1ea83f9f8b1581ef13fa3c | FelixLabelle/neural_network_expirements | neural_network.py | [
"MIT"
] | Python | configure_classifier | null | def configure_classifier(self, number_of_inputs, number_of_classes, hidden_layers = 5,
activation_function_type = "tanh",batch_size = -1, type = "classifier",anneal = "default",
annealing_hyperparameters=[1, 1],epsilon = 1e-5):
"""Sets training and neu... | Sets training and neural network configurations | Sets training and neural network configurations | [
"Sets",
"training",
"and",
"neural",
"network",
"configurations"
] | def configure_classifier(self, number_of_inputs, number_of_classes, hidden_layers = 5,
activation_function_type = "tanh",batch_size = -1, type = "classifier",anneal = "default",
annealing_hyperparameters=[1, 1],epsilon = 1e-5):
self.layers = [number_of... | [
"def",
"configure_classifier",
"(",
"self",
",",
"number_of_inputs",
",",
"number_of_classes",
",",
"hidden_layers",
"=",
"5",
",",
"activation_function_type",
"=",
"\"tanh\"",
",",
"batch_size",
"=",
"-",
"1",
",",
"type",
"=",
"\"classifier\"",
",",
"anneal",
... | Sets training and neural network configurations | [
"Sets",
"training",
"and",
"neural",
"network",
"configurations"
] | [
"\"\"\"Sets training and neural network configurations\"\"\"",
"# rewrite this as a numpy array",
"# Consider passing function via arguments"
] | [
{
"param": "self",
"type": null
},
{
"param": "number_of_inputs",
"type": null
},
{
"param": "number_of_classes",
"type": null
},
{
"param": "hidden_layers",
"type": null
},
{
"param": "activation_function_type",
"type": null
},
{
"param": "batch_size"... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "number_of_inputs",
"type": null,
"docstring": null,
"docstrin... |
40d6afac61001d068d1ea83f9f8b1581ef13fa3c | FelixLabelle/neural_network_expirements | neural_network.py | [
"MIT"
] | Python | train_model | null | def train_model(self, num_iterations, reg_lambda = 1e-2,
print_loss=False):
"""This function calculates the cost function and backpropagates the error"""
dW = [np.zeros(self.weights[i].shape) for i in range(len(self.layers)-1)]
db = [np.zeros((1, self.layers[i + 1])) for i in... | This function calculates the cost function and backpropagates the error | This function calculates the cost function and backpropagates the error | [
"This",
"function",
"calculates",
"the",
"cost",
"function",
"and",
"backpropagates",
"the",
"error"
] | def train_model(self, num_iterations, reg_lambda = 1e-2,
print_loss=False):
dW = [np.zeros(self.weights[i].shape) for i in range(len(self.layers)-1)]
db = [np.zeros((1, self.layers[i + 1])) for i in range(len(self.layers) - 1)]
for i in range(0, num_iterations):
r... | [
"def",
"train_model",
"(",
"self",
",",
"num_iterations",
",",
"reg_lambda",
"=",
"1e-2",
",",
"print_loss",
"=",
"False",
")",
":",
"dW",
"=",
"[",
"np",
".",
"zeros",
"(",
"self",
".",
"weights",
"[",
"i",
"]",
".",
"shape",
")",
"for",
"i",
"in"... | This function calculates the cost function and backpropagates the error | [
"This",
"function",
"calculates",
"the",
"cost",
"function",
"and",
"backpropagates",
"the",
"error"
] | [
"\"\"\"This function calculates the cost function and backpropagates the error\"\"\"",
"# make sure this gets the whole set",
"# Gradient descent parameter update",
"# TODO ADD GRADIENT CHECK"
] | [
{
"param": "self",
"type": null
},
{
"param": "num_iterations",
"type": null
},
{
"param": "reg_lambda",
"type": null
},
{
"param": "print_loss",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_iterations",
"type": null,
"docstring": null,
"docstring_... |
40d6afac61001d068d1ea83f9f8b1581ef13fa3c | FelixLabelle/neural_network_expirements | neural_network.py | [
"MIT"
] | Python | calculate_loss | <not_specific> | def calculate_loss(self):
""" Evaluate loss function in the model """
probs = self.__forward_prop__(self.X)
# Calculating the loss
corect_logprobs = -np.log(probs[range(self.num_examples), self.Y])
data_loss = np.sum(corect_logprobs)
# Todo: add regulatization term to los... | Evaluate loss function in the model | Evaluate loss function in the model | [
"Evaluate",
"loss",
"function",
"in",
"the",
"model"
] | def calculate_loss(self):
probs = self.__forward_prop__(self.X)
corect_logprobs = -np.log(probs[range(self.num_examples), self.Y])
data_loss = np.sum(corect_logprobs)
return 1. / self.num_examples * data_loss | [
"def",
"calculate_loss",
"(",
"self",
")",
":",
"probs",
"=",
"self",
".",
"__forward_prop__",
"(",
"self",
".",
"X",
")",
"corect_logprobs",
"=",
"-",
"np",
".",
"log",
"(",
"probs",
"[",
"range",
"(",
"self",
".",
"num_examples",
")",
",",
"self",
... | Evaluate loss function in the model | [
"Evaluate",
"loss",
"function",
"in",
"the",
"model"
] | [
"\"\"\" Evaluate loss function in the model \"\"\"",
"# Calculating the loss",
"# Todo: add regulatization term to loss"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8874df39fc794fdac0ce394f8ae4419ca1c4f180 | maniin/scikit-learn | sklearn/utils/_testing.py | [
"BSD-3-Clause"
] | Python | _get_args | <not_specific> | def _get_args(function, varargs=False):
"""Helper to get function arguments."""
try:
params = signature(function).parameters
except ValueError:
# Error on builtin C function
return []
args = [key for key, param in params.items()
if param.kind not in (param.VAR_POSITI... | Helper to get function arguments. | Helper to get function arguments. | [
"Helper",
"to",
"get",
"function",
"arguments",
"."
] | def _get_args(function, varargs=False):
try:
params = signature(function).parameters
except ValueError:
return []
args = [key for key, param in params.items()
if param.kind not in (param.VAR_POSITIONAL, param.VAR_KEYWORD)]
if varargs:
varargs = [param.name for param i... | [
"def",
"_get_args",
"(",
"function",
",",
"varargs",
"=",
"False",
")",
":",
"try",
":",
"params",
"=",
"signature",
"(",
"function",
")",
".",
"parameters",
"except",
"ValueError",
":",
"return",
"[",
"]",
"args",
"=",
"[",
"key",
"for",
"key",
",",
... | Helper to get function arguments. | [
"Helper",
"to",
"get",
"function",
"arguments",
"."
] | [
"\"\"\"Helper to get function arguments.\"\"\"",
"# Error on builtin C function"
] | [
{
"param": "function",
"type": null
},
{
"param": "varargs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "function",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "varargs",
"type": null,
"docstring": null,
"docstring_tok... |
8874df39fc794fdac0ce394f8ae4419ca1c4f180 | maniin/scikit-learn | sklearn/utils/_testing.py | [
"BSD-3-Clause"
] | Python | assert_run_python_script | null | def assert_run_python_script(source_code, timeout=60):
"""Utility to check assertions in an independent Python subprocess.
The script provided in the source code should return 0 and not print
anything on stderr or stdout.
This is a port from cloudpickle https://github.com/cloudpipe/cloudpickle
Pa... | Utility to check assertions in an independent Python subprocess.
The script provided in the source code should return 0 and not print
anything on stderr or stdout.
This is a port from cloudpickle https://github.com/cloudpipe/cloudpickle
Parameters
----------
source_code : str
The Pyth... | Utility to check assertions in an independent Python subprocess.
The script provided in the source code should return 0 and not print
anything on stderr or stdout.
Parameters
source_code : str
The Python source code to execute.
timeout : int, default=60
Time in seconds before timeout. | [
"Utility",
"to",
"check",
"assertions",
"in",
"an",
"independent",
"Python",
"subprocess",
".",
"The",
"script",
"provided",
"in",
"the",
"source",
"code",
"should",
"return",
"0",
"and",
"not",
"print",
"anything",
"on",
"stderr",
"or",
"stdout",
".",
"Para... | def assert_run_python_script(source_code, timeout=60):
fd, source_file = tempfile.mkstemp(suffix='_src_test_sklearn.py')
os.close(fd)
try:
with open(source_file, 'wb') as f:
f.write(source_code.encode('utf-8'))
cmd = [sys.executable, source_file]
cwd = op.normpath(op.join... | [
"def",
"assert_run_python_script",
"(",
"source_code",
",",
"timeout",
"=",
"60",
")",
":",
"fd",
",",
"source_file",
"=",
"tempfile",
".",
"mkstemp",
"(",
"suffix",
"=",
"'_src_test_sklearn.py'",
")",
"os",
".",
"close",
"(",
"fd",
")",
"try",
":",
"with"... | Utility to check assertions in an independent Python subprocess. | [
"Utility",
"to",
"check",
"assertions",
"in",
"an",
"independent",
"Python",
"subprocess",
"."
] | [
"\"\"\"Utility to check assertions in an independent Python subprocess.\n\n The script provided in the source code should return 0 and not print\n anything on stderr or stdout.\n\n This is a port from cloudpickle https://github.com/cloudpipe/cloudpickle\n\n Parameters\n ----------\n source_code : ... | [
{
"param": "source_code",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "source_code",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timeout",
"type": null,
"docstring": null,
"docstring_... |
59165cce8f02eefe3371c6784615cab7f8abf645 | MohamedAli1995/Sign-Language-Recognition | src/data_loader/data_generator.py | [
"MIT"
] | Python | __shuffle_all_data | null | def __shuffle_all_data(self):
"""Private function.
Shuffles the whole training set to avoid patterns recognition by the model(I liked that course:D).
shuffle function is used instead of sklearn shuffle function in order reduce usage of
external dependencies.
Returns:
"""... | Private function.
Shuffles the whole training set to avoid patterns recognition by the model(I liked that course:D).
shuffle function is used instead of sklearn shuffle function in order reduce usage of
external dependencies.
Returns:
| Private function.
Shuffles the whole training set to avoid patterns recognition by the model(I liked that course:D).
shuffle function is used instead of sklearn shuffle function in order reduce usage of
external dependencies. | [
"Private",
"function",
".",
"Shuffles",
"the",
"whole",
"training",
"set",
"to",
"avoid",
"patterns",
"recognition",
"by",
"the",
"model",
"(",
"I",
"liked",
"that",
"course",
":",
"D",
")",
".",
"shuffle",
"function",
"is",
"used",
"instead",
"of",
"sklea... | def __shuffle_all_data(self):
indices_list = [i for i in range(self.x_train.shape[0])]
shuffle(indices_list)
self.x_train = self.x_train[indices_list]
self.y_train = self.y_train[indices_list]
indices_list = [i for i in range(self.x_val.shape[0])]
shuffle(indices_list)
... | [
"def",
"__shuffle_all_data",
"(",
"self",
")",
":",
"indices_list",
"=",
"[",
"i",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"x_train",
".",
"shape",
"[",
"0",
"]",
")",
"]",
"shuffle",
"(",
"indices_list",
")",
"self",
".",
"x_train",
"=",
"self"... | Private function. | [
"Private",
"function",
"."
] | [
"\"\"\"Private function.\n Shuffles the whole training set to avoid patterns recognition by the model(I liked that course:D).\n shuffle function is used instead of sklearn shuffle function in order reduce usage of\n external dependencies.\n\n Returns:\n \"\"\"",
"# Next two line... | [
{
"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
... |
59165cce8f02eefe3371c6784615cab7f8abf645 | MohamedAli1995/Sign-Language-Recognition | src/data_loader/data_generator.py | [
"MIT"
] | Python | prepare_new_epoch_data | null | def prepare_new_epoch_data(self):
"""Prepares the dataset for a new epoch by setting the indx of the batches to 0 and shuffling
the training data.
Returns:
"""
self.indx_batch_train = 0
self.indx_batch_val = 0
self.indx_batch_test = 0
self.__shuffle_all_d... | Prepares the dataset for a new epoch by setting the indx of the batches to 0 and shuffling
the training data.
Returns:
| Prepares the dataset for a new epoch by setting the indx of the batches to 0 and shuffling
the training data. | [
"Prepares",
"the",
"dataset",
"for",
"a",
"new",
"epoch",
"by",
"setting",
"the",
"indx",
"of",
"the",
"batches",
"to",
"0",
"and",
"shuffling",
"the",
"training",
"data",
"."
] | def prepare_new_epoch_data(self):
self.indx_batch_train = 0
self.indx_batch_val = 0
self.indx_batch_test = 0
self.__shuffle_all_data() | [
"def",
"prepare_new_epoch_data",
"(",
"self",
")",
":",
"self",
".",
"indx_batch_train",
"=",
"0",
"self",
".",
"indx_batch_val",
"=",
"0",
"self",
".",
"indx_batch_test",
"=",
"0",
"self",
".",
"__shuffle_all_data",
"(",
")"
] | Prepares the dataset for a new epoch by setting the indx of the batches to 0 and shuffling
the training data. | [
"Prepares",
"the",
"dataset",
"for",
"a",
"new",
"epoch",
"by",
"setting",
"the",
"indx",
"of",
"the",
"batches",
"to",
"0",
"and",
"shuffling",
"the",
"training",
"data",
"."
] | [
"\"\"\"Prepares the dataset for a new epoch by setting the indx of the batches to 0 and shuffling\n the training data.\n\n Returns:\n \"\"\""
] | [
{
"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
... |
3bca8cbc470cfe09dc456e8232ebb7af0a88382d | nlamirault/ocs-sdk | scaleway/tests/apis/test_api_account.py | [
"BSD-2-Clause"
] | Python | compare_results | null | def compare_results(permissions, service=None, name=None,
resource=None, result=None, include_locked=False):
""" Resets the auth API endpoint /tokens/:id/permissions, call
get_resources and compare results with what is expected.
"""
if result i... | Resets the auth API endpoint /tokens/:id/permissions, call
get_resources and compare results with what is expected.
| Resets the auth API endpoint /tokens/:id/permissions, call
get_resources and compare results with what is expected. | [
"Resets",
"the",
"auth",
"API",
"endpoint",
"/",
"tokens",
"/",
":",
"id",
"/",
"permissions",
"call",
"get_resources",
"and",
"compare",
"results",
"with",
"what",
"is",
"expected",
"."
] | def compare_results(permissions, service=None, name=None,
resource=None, result=None, include_locked=False):
if result is None:
result = []
self.make_fake_perms(permissions)
resources = self.api.get_resources(
service=servic... | [
"def",
"compare_results",
"(",
"permissions",
",",
"service",
"=",
"None",
",",
"name",
"=",
"None",
",",
"resource",
"=",
"None",
",",
"result",
"=",
"None",
",",
"include_locked",
"=",
"False",
")",
":",
"if",
"result",
"is",
"None",
":",
"result",
"... | Resets the auth API endpoint /tokens/:id/permissions, call
get_resources and compare results with what is expected. | [
"Resets",
"the",
"auth",
"API",
"endpoint",
"/",
"tokens",
"/",
":",
"id",
"/",
"permissions",
"call",
"get_resources",
"and",
"compare",
"results",
"with",
"what",
"is",
"expected",
"."
] | [
"\"\"\" Resets the auth API endpoint /tokens/:id/permissions, call\n get_resources and compare results with what is expected.\n \"\"\"",
"# XOR on two sets returns the difference between them",
"# Used because we don't know in which order api.get_resources",
"# returns the resources.",
... | [
{
"param": "permissions",
"type": null
},
{
"param": "service",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "resource",
"type": null
},
{
"param": "result",
"type": null
},
{
"param": "include_locked",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "permissions",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "service",
"type": null,
"docstring": null,
"docstring_... |
9dc0aef337f711465dbd28e5d45fdc4ab826d719 | nlamirault/ocs-sdk | scaleway/apis/api_account.py | [
"BSD-2-Clause"
] | Python | perm_matches | <not_specific> | def perm_matches(self, request_perm, effective_perm):
""" Evaluates whether `request_perm` is granted by `effective_perm`.
Permissions are string separated by semi-colon characters.
Checking of permissions is performed from left to right and stops at
the first mismatch between `effectiv... | Evaluates whether `request_perm` is granted by `effective_perm`.
Permissions are string separated by semi-colon characters.
Checking of permissions is performed from left to right and stops at
the first mismatch between `effective_perm` and `request_perm`.
The `*` character is used to... | Evaluates whether `request_perm` is granted by `effective_perm`.
Permissions are string separated by semi-colon characters.
Checking of permissions is performed from left to right and stops at
the first mismatch between `effective_perm` and `request_perm`.
The `*` character is used to match all permissions at a given ... | [
"Evaluates",
"whether",
"`",
"request_perm",
"`",
"is",
"granted",
"by",
"`",
"effective_perm",
"`",
".",
"Permissions",
"are",
"string",
"separated",
"by",
"semi",
"-",
"colon",
"characters",
".",
"Checking",
"of",
"permissions",
"is",
"performed",
"from",
"l... | def perm_matches(self, request_perm, effective_perm):
if request_perm is None:
return True
request_perm_parts = request_perm.split(':')
effective_perm_parts = effective_perm.split(':')
for (request_perm_part,
effective_perm_part) in zip_longest(request_perm_parts... | [
"def",
"perm_matches",
"(",
"self",
",",
"request_perm",
",",
"effective_perm",
")",
":",
"if",
"request_perm",
"is",
"None",
":",
"return",
"True",
"request_perm_parts",
"=",
"request_perm",
".",
"split",
"(",
"':'",
")",
"effective_perm_parts",
"=",
"effective... | Evaluates whether `request_perm` is granted by `effective_perm`. | [
"Evaluates",
"whether",
"`",
"request_perm",
"`",
"is",
"granted",
"by",
"`",
"effective_perm",
"`",
"."
] | [
"\"\"\" Evaluates whether `request_perm` is granted by `effective_perm`.\n\n Permissions are string separated by semi-colon characters.\n Checking of permissions is performed from left to right and stops at\n the first mismatch between `effective_perm` and `request_perm`.\n\n The `*` cha... | [
{
"param": "self",
"type": null
},
{
"param": "request_perm",
"type": null
},
{
"param": "effective_perm",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "request_perm",
"type": null,
"docstring": "Currently granted permis... |
9dc0aef337f711465dbd28e5d45fdc4ab826d719 | nlamirault/ocs-sdk | scaleway/apis/api_account.py | [
"BSD-2-Clause"
] | Python | has_perm | <not_specific> | def has_perm(self, service=None, name=None, resource=None,
include_locked=False):
""" Checks if the token has a permission.
"""
return bool(
self.get_resources(service=service, name=name, resource=resource,
include_locked=include_locked... | Checks if the token has a permission.
| Checks if the token has a permission. | [
"Checks",
"if",
"the",
"token",
"has",
"a",
"permission",
"."
] | def has_perm(self, service=None, name=None, resource=None,
include_locked=False):
return bool(
self.get_resources(service=service, name=name, resource=resource,
include_locked=include_locked)
) | [
"def",
"has_perm",
"(",
"self",
",",
"service",
"=",
"None",
",",
"name",
"=",
"None",
",",
"resource",
"=",
"None",
",",
"include_locked",
"=",
"False",
")",
":",
"return",
"bool",
"(",
"self",
".",
"get_resources",
"(",
"service",
"=",
"service",
","... | Checks if the token has a permission. | [
"Checks",
"if",
"the",
"token",
"has",
"a",
"permission",
"."
] | [
"\"\"\" Checks if the token has a permission.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "service",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "resource",
"type": null
},
{
"param": "include_locked",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "service",
"type": null,
"docstring": null,
"docstring_tokens"... |
090e47ccd020e1ed7497dcaa9bfa41c7a8846fa7 | nlamirault/ocs-sdk | scaleway/tests/apis/test_api_metadata.py | [
"BSD-2-Clause"
] | Python | fake_route_conf | <not_specific> | def fake_route_conf(_, uri, headers):
""" Fakes the /conf route.
Returns metadata of a running server. Our tests don't need to have
all the metadata of a server, so only a few values are returned.
If ?format=json is set, return a JSON dict with a application/json
... | Fakes the /conf route.
Returns metadata of a running server. Our tests don't need to have
all the metadata of a server, so only a few values are returned.
If ?format=json is set, return a JSON dict with a application/json
content
type.
If no fo... | Fakes the /conf route.
Returns metadata of a running server. Our tests don't need to have
all the metadata of a server, so only a few values are returned.
If ?format=json is set, return a JSON dict with a application/json
content
type.
If no format is given, return a text/plain response with a "shell"
format. | [
"Fakes",
"the",
"/",
"conf",
"route",
".",
"Returns",
"metadata",
"of",
"a",
"running",
"server",
".",
"Our",
"tests",
"don",
"'",
"t",
"need",
"to",
"have",
"all",
"the",
"metadata",
"of",
"a",
"server",
"so",
"only",
"a",
"few",
"values",
"are",
"r... | def fake_route_conf(_, uri, headers):
querystring = parse_qs(urlparse(uri).query)
if 'json' in querystring.get('format', []):
return 200, headers, json.dumps(json_response)
headers['content-type'] = 'text/plain'
return 200, headers, '\n'.join(
... | [
"def",
"fake_route_conf",
"(",
"_",
",",
"uri",
",",
"headers",
")",
":",
"querystring",
"=",
"parse_qs",
"(",
"urlparse",
"(",
"uri",
")",
".",
"query",
")",
"if",
"'json'",
"in",
"querystring",
".",
"get",
"(",
"'format'",
",",
"[",
"]",
")",
":",
... | Fakes the /conf route. | [
"Fakes",
"the",
"/",
"conf",
"route",
"."
] | [
"\"\"\" Fakes the /conf route.\n\n Returns metadata of a running server. Our tests don't need to have\n all the metadata of a server, so only a few values are returned.\n\n If ?format=json is set, return a JSON dict with a application/json\n content\n type.\n\n... | [
{
"param": "_",
"type": null
},
{
"param": "uri",
"type": null
},
{
"param": "headers",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "_",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "uri",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
d0ec826285d43b5a62a1959be13caa7b2fad5b16 | EISCAT-AARC-development/EISCAT-AARC-dockers | portal/src/auth.py | [
"Apache-2.0"
] | Python | authorize | <not_specific> | def authorize(passwd):
"check if a password is correct"
for line in passwords:
if crypt.crypt(passwd, line[:2]) == line:
return 1 | check if a password is correct | check if a password is correct | [
"check",
"if",
"a",
"password",
"is",
"correct"
] | def authorize(passwd):
for line in passwords:
if crypt.crypt(passwd, line[:2]) == line:
return 1 | [
"def",
"authorize",
"(",
"passwd",
")",
":",
"for",
"line",
"in",
"passwords",
":",
"if",
"crypt",
".",
"crypt",
"(",
"passwd",
",",
"line",
"[",
":",
"2",
"]",
")",
"==",
"line",
":",
"return",
"1"
] | check if a password is correct | [
"check",
"if",
"a",
"password",
"is",
"correct"
] | [
"\"check if a password is correct\""
] | [
{
"param": "passwd",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "passwd",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d0ec826285d43b5a62a1959be13caa7b2fad5b16 | EISCAT-AARC-development/EISCAT-AARC-dockers | portal/src/auth.py | [
"Apache-2.0"
] | Python | authorize_ip | <not_specific> | def authorize_ip(ip):
"check if ip belongs to internal network"
for net in networks:
if ip.startswith(net):
return 1 | check if ip belongs to internal network | check if ip belongs to internal network | [
"check",
"if",
"ip",
"belongs",
"to",
"internal",
"network"
] | def authorize_ip(ip):
for net in networks:
if ip.startswith(net):
return 1 | [
"def",
"authorize_ip",
"(",
"ip",
")",
":",
"for",
"net",
"in",
"networks",
":",
"if",
"ip",
".",
"startswith",
"(",
"net",
")",
":",
"return",
"1"
] | check if ip belongs to internal network | [
"check",
"if",
"ip",
"belongs",
"to",
"internal",
"network"
] | [
"\"check if ip belongs to internal network\""
] | [
{
"param": "ip",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ip",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ccfbee3535707be9d613cc588b9f71c2e156157d | Liza-Karmannaya/Twitter-NLP-SNA | data_collection_2.py | [
"MIT"
] | Python | collect_followers | null | def collect_followers(elite):
""" This function takes the screen_name of an elite and outputs a csv file
titled 'followers_elitename.csv' into the home directory. """
cursor = tweepy.Cursor(api.followers_ids, screen_name=elite, skip_status=True)
# NB check that 'elite' is a string??? - use str(elite)... | This function takes the screen_name of an elite and outputs a csv file
titled 'followers_elitename.csv' into the home directory. | This function takes the screen_name of an elite and outputs a csv file
titled 'followers_elitename.csv' into the home directory. | [
"This",
"function",
"takes",
"the",
"screen_name",
"of",
"an",
"elite",
"and",
"outputs",
"a",
"csv",
"file",
"titled",
"'",
"followers_elitename",
".",
"csv",
"'",
"into",
"the",
"home",
"directory",
"."
] | def collect_followers(elite):
cursor = tweepy.Cursor(api.followers_ids, screen_name=elite, skip_status=True)
filePath = os.path.join(r"/Users/lizakarmannaya/followers_" + elite + ".csv")
with open(filePath, 'w') as f:
while True:
try:
for follower in cursor.items(): ... | [
"def",
"collect_followers",
"(",
"elite",
")",
":",
"cursor",
"=",
"tweepy",
".",
"Cursor",
"(",
"api",
".",
"followers_ids",
",",
"screen_name",
"=",
"elite",
",",
"skip_status",
"=",
"True",
")",
"filePath",
"=",
"os",
".",
"path",
".",
"join",
"(",
... | This function takes the screen_name of an elite and outputs a csv file
titled 'followers_elitename.csv' into the home directory. | [
"This",
"function",
"takes",
"the",
"screen_name",
"of",
"an",
"elite",
"and",
"outputs",
"a",
"csv",
"file",
"titled",
"'",
"followers_elitename",
".",
"csv",
"'",
"into",
"the",
"home",
"directory",
"."
] | [
"\"\"\" This function takes the screen_name of an elite and outputs a csv file \n titled 'followers_elitename.csv' into the home directory. \"\"\"",
"# NB check that 'elite' is a string??? - use str(elite) ?? ",
"# set up file to save the followers into",
"# write data in file as long as Twitter limit has... | [
{
"param": "elite",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "elite",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b3bb751dc42f1c83fa62780756d93f3742ce0605 | AtlasQuan/wasm | wasm/formatter.py | [
"MIT"
] | Python | format_instruction | <not_specific> | def format_instruction(insn):
"""
Takes a raw `Instruction` and translates it into a human readable text
representation. As of writing, the text representation for WASM is not yet
standardized, so we just emit some generic format.
"""
text = insn.op.mnemonic
if not insn.imm:
return ... |
Takes a raw `Instruction` and translates it into a human readable text
representation. As of writing, the text representation for WASM is not yet
standardized, so we just emit some generic format.
| Takes a raw `Instruction` and translates it into a human readable text
representation. As of writing, the text representation for WASM is not yet
standardized, so we just emit some generic format. | [
"Takes",
"a",
"raw",
"`",
"Instruction",
"`",
"and",
"translates",
"it",
"into",
"a",
"human",
"readable",
"text",
"representation",
".",
"As",
"of",
"writing",
"the",
"text",
"representation",
"for",
"WASM",
"is",
"not",
"yet",
"standardized",
"so",
"we",
... | def format_instruction(insn):
text = insn.op.mnemonic
if not insn.imm:
return text
return text + ' ' + ', '.join([
getattr(insn.op.imm_struct, x.name).to_string(
getattr(insn.imm, x.name)
)
for x in insn.op.imm_struct._meta.fields
]) | [
"def",
"format_instruction",
"(",
"insn",
")",
":",
"text",
"=",
"insn",
".",
"op",
".",
"mnemonic",
"if",
"not",
"insn",
".",
"imm",
":",
"return",
"text",
"return",
"text",
"+",
"' '",
"+",
"', '",
".",
"join",
"(",
"[",
"getattr",
"(",
"insn",
"... | Takes a raw `Instruction` and translates it into a human readable text
representation. | [
"Takes",
"a",
"raw",
"`",
"Instruction",
"`",
"and",
"translates",
"it",
"into",
"a",
"human",
"readable",
"text",
"representation",
"."
] | [
"\"\"\"\n Takes a raw `Instruction` and translates it into a human readable text\n representation. As of writing, the text representation for WASM is not yet\n standardized, so we just emit some generic format.\n \"\"\""
] | [
{
"param": "insn",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "insn",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b3bb751dc42f1c83fa62780756d93f3742ce0605 | AtlasQuan/wasm | wasm/formatter.py | [
"MIT"
] | Python | format_mutability | <not_specific> | def format_mutability(mutability):
"""Takes a value type `int`, returning its string representation."""
try:
return _mutability_str_mapping[mutability]
except KeyError:
raise ValueError('Bad value for value type ({})'.format(mutability)) | Takes a value type `int`, returning its string representation. | Takes a value type `int`, returning its string representation. | [
"Takes",
"a",
"value",
"type",
"`",
"int",
"`",
"returning",
"its",
"string",
"representation",
"."
] | def format_mutability(mutability):
try:
return _mutability_str_mapping[mutability]
except KeyError:
raise ValueError('Bad value for value type ({})'.format(mutability)) | [
"def",
"format_mutability",
"(",
"mutability",
")",
":",
"try",
":",
"return",
"_mutability_str_mapping",
"[",
"mutability",
"]",
"except",
"KeyError",
":",
"raise",
"ValueError",
"(",
"'Bad value for value type ({})'",
".",
"format",
"(",
"mutability",
")",
")"
] | Takes a value type `int`, returning its string representation. | [
"Takes",
"a",
"value",
"type",
"`",
"int",
"`",
"returning",
"its",
"string",
"representation",
"."
] | [
"\"\"\"Takes a value type `int`, returning its string representation.\"\"\""
] | [
{
"param": "mutability",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mutability",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b3bb751dc42f1c83fa62780756d93f3742ce0605 | AtlasQuan/wasm | wasm/formatter.py | [
"MIT"
] | Python | format_lang_type | <not_specific> | def format_lang_type(lang_type):
"""Takes a value type `int`, returning its string representation."""
try:
return _lang_type_str_mapping[lang_type]
except KeyError:
raise ValueError('Bad value for value type ({})'.format(lang_type)) | Takes a value type `int`, returning its string representation. | Takes a value type `int`, returning its string representation. | [
"Takes",
"a",
"value",
"type",
"`",
"int",
"`",
"returning",
"its",
"string",
"representation",
"."
] | def format_lang_type(lang_type):
try:
return _lang_type_str_mapping[lang_type]
except KeyError:
raise ValueError('Bad value for value type ({})'.format(lang_type)) | [
"def",
"format_lang_type",
"(",
"lang_type",
")",
":",
"try",
":",
"return",
"_lang_type_str_mapping",
"[",
"lang_type",
"]",
"except",
"KeyError",
":",
"raise",
"ValueError",
"(",
"'Bad value for value type ({})'",
".",
"format",
"(",
"lang_type",
")",
")"
] | Takes a value type `int`, returning its string representation. | [
"Takes",
"a",
"value",
"type",
"`",
"int",
"`",
"returning",
"its",
"string",
"representation",
"."
] | [
"\"\"\"Takes a value type `int`, returning its string representation.\"\"\""
] | [
{
"param": "lang_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lang_type",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b3bb751dc42f1c83fa62780756d93f3742ce0605 | AtlasQuan/wasm | wasm/formatter.py | [
"MIT"
] | Python | format_function | null | def format_function(
func_body,
func_type=None,
indent=2,
format_locals=True,
):
"""
Takes a `FunctionBody` and optionally a `FunctionType`, yielding the string
representation of the function line by line. The function type is required
for formatting function parameter and return value ... |
Takes a `FunctionBody` and optionally a `FunctionType`, yielding the string
representation of the function line by line. The function type is required
for formatting function parameter and return value information.
| Takes a `FunctionBody` and optionally a `FunctionType`, yielding the string
representation of the function line by line. The function type is required
for formatting function parameter and return value information. | [
"Takes",
"a",
"`",
"FunctionBody",
"`",
"and",
"optionally",
"a",
"`",
"FunctionType",
"`",
"yielding",
"the",
"string",
"representation",
"of",
"the",
"function",
"line",
"by",
"line",
".",
"The",
"function",
"type",
"is",
"required",
"for",
"formatting",
"... | def format_function(
func_body,
func_type=None,
indent=2,
format_locals=True,
):
if func_type is None:
yield 'func'
else:
param_section = ' (param {})'.format(' '.join(
map(format_lang_type, func_type.param_types)
)) if func_type.param_types else ''
re... | [
"def",
"format_function",
"(",
"func_body",
",",
"func_type",
"=",
"None",
",",
"indent",
"=",
"2",
",",
"format_locals",
"=",
"True",
",",
")",
":",
"if",
"func_type",
"is",
"None",
":",
"yield",
"'func'",
"else",
":",
"param_section",
"=",
"' (param {})'... | Takes a `FunctionBody` and optionally a `FunctionType`, yielding the string
representation of the function line by line. | [
"Takes",
"a",
"`",
"FunctionBody",
"`",
"and",
"optionally",
"a",
"`",
"FunctionType",
"`",
"yielding",
"the",
"string",
"representation",
"of",
"the",
"function",
"line",
"by",
"line",
"."
] | [
"\"\"\"\n Takes a `FunctionBody` and optionally a `FunctionType`, yielding the string \n representation of the function line by line. The function type is required\n for formatting function parameter and return value information.\n \"\"\""
] | [
{
"param": "func_body",
"type": null
},
{
"param": "func_type",
"type": null
},
{
"param": "indent",
"type": null
},
{
"param": "format_locals",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "func_body",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "func_type",
"type": null,
"docstring": null,
"docstring_... |
11ba6f94ac6d35e880bd5906c58cb99a421d0967 | AtlasQuan/wasm | wasm/decode.py | [
"MIT"
] | Python | decode_module | null | def decode_module(module, decode_name_subsections=False):
"""Decodes raw WASM modules, yielding `ModuleFragment`s."""
module_wnd = memoryview(module)
# Read & yield module header.
hdr = ModuleHeader()
hdr_len, hdr_data, _ = hdr.from_raw(None, module_wnd)
yield ModuleFragment(hdr, hdr_data)
... | Decodes raw WASM modules, yielding `ModuleFragment`s. | Decodes raw WASM modules, yielding `ModuleFragment`s. | [
"Decodes",
"raw",
"WASM",
"modules",
"yielding",
"`",
"ModuleFragment",
"`",
"s",
"."
] | def decode_module(module, decode_name_subsections=False):
module_wnd = memoryview(module)
hdr = ModuleHeader()
hdr_len, hdr_data, _ = hdr.from_raw(None, module_wnd)
yield ModuleFragment(hdr, hdr_data)
module_wnd = module_wnd[hdr_len:]
while module_wnd:
sec = Section()
sec_len, se... | [
"def",
"decode_module",
"(",
"module",
",",
"decode_name_subsections",
"=",
"False",
")",
":",
"module_wnd",
"=",
"memoryview",
"(",
"module",
")",
"hdr",
"=",
"ModuleHeader",
"(",
")",
"hdr_len",
",",
"hdr_data",
",",
"_",
"=",
"hdr",
".",
"from_raw",
"("... | Decodes raw WASM modules, yielding `ModuleFragment`s. | [
"Decodes",
"raw",
"WASM",
"modules",
"yielding",
"`",
"ModuleFragment",
"`",
"s",
"."
] | [
"\"\"\"Decodes raw WASM modules, yielding `ModuleFragment`s.\"\"\"",
"# Read & yield module header.",
"# Read & yield sections.",
"# If requested, decode name subsections when encountered."
] | [
{
"param": "module",
"type": null
},
{
"param": "decode_name_subsections",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "module",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "decode_name_subsections",
"type": null,
"docstring": null,
... |
b76a22b63971ec2c0610d28f6dd9ef621e29f4bd | AtlasQuan/wasm | wasm/compat.py | [
"MIT"
] | Python | add_metaclass | <not_specific> | def add_metaclass(metaclass):
"""
Class decorator for creating a class with a metaclass.
Borrowed from `six` module.
"""
@functools.wraps(metaclass)
def wrapper(cls):
orig_vars = cls.__dict__.copy()
slots = orig_vars.get('__slots__')
if slots is not None:
if i... |
Class decorator for creating a class with a metaclass.
Borrowed from `six` module.
| Class decorator for creating a class with a metaclass.
Borrowed from `six` module. | [
"Class",
"decorator",
"for",
"creating",
"a",
"class",
"with",
"a",
"metaclass",
".",
"Borrowed",
"from",
"`",
"six",
"`",
"module",
"."
] | def add_metaclass(metaclass):
@functools.wraps(metaclass)
def wrapper(cls):
orig_vars = cls.__dict__.copy()
slots = orig_vars.get('__slots__')
if slots is not None:
if isinstance(slots, str):
slots = [slots]
for slots_var in slots:
... | [
"def",
"add_metaclass",
"(",
"metaclass",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"metaclass",
")",
"def",
"wrapper",
"(",
"cls",
")",
":",
"orig_vars",
"=",
"cls",
".",
"__dict__",
".",
"copy",
"(",
")",
"slots",
"=",
"orig_vars",
".",
"get",
... | Class decorator for creating a class with a metaclass. | [
"Class",
"decorator",
"for",
"creating",
"a",
"class",
"with",
"a",
"metaclass",
"."
] | [
"\"\"\"\n Class decorator for creating a class with a metaclass.\n Borrowed from `six` module.\n \"\"\""
] | [
{
"param": "metaclass",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "metaclass",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
05454bf8ded9a13f75439fa235dce38f790ae4b2 | shinshio/AC2C | src/order2checker.py | [
"OLDAP-2.2.1"
] | Python | odrLevelingOhm | float | def odrLevelingOhm(
recipe: list,
mcu: object,
res: object,
boxRes: list
) -> float:
"""
Order Leveling Ohm to checker and Resistor
Parameters
----------
recipe: list
0: LEVEL-(timing)-(mode)
1: relay number
2: dtc
... |
Order Leveling Ohm to checker and Resistor
Parameters
----------
recipe: list
0: LEVEL-(timing)-(mode)
1: relay number
2: dtc
mcu: object
comm2checker.Serial2Mcu
res: object
comm2resistor.Res
boxRes:
bo... | Order Leveling Ohm to checker and Resistor
Parameters
Returns
float
ohm at detected dtc | [
"Order",
"Leveling",
"Ohm",
"to",
"checker",
"and",
"Resistor",
"Parameters",
"Returns",
"float",
"ohm",
"at",
"detected",
"dtc"
] | def odrLevelingOhm(
recipe: list,
mcu: object,
res: object,
boxRes: list
) -> float:
if res.statusRes==False:
return 'error'
timing = recipe[0][6:10]
mode = recipe[0][11:]
rNum = recipe[1]
dtc = recipe[2]
initOhm = INIT_OHM.copy()
if os.path.exists... | [
"def",
"odrLevelingOhm",
"(",
"recipe",
":",
"list",
",",
"mcu",
":",
"object",
",",
"res",
":",
"object",
",",
"boxRes",
":",
"list",
")",
"->",
"float",
":",
"if",
"res",
".",
"statusRes",
"==",
"False",
":",
"return",
"'error'",
"timing",
"=",
"re... | Order Leveling Ohm to checker and Resistor
Parameters | [
"Order",
"Leveling",
"Ohm",
"to",
"checker",
"and",
"Resistor",
"Parameters"
] | [
"\"\"\"\n Order Leveling Ohm to checker and Resistor\n\n Parameters\n ----------\n recipe: list\n 0: LEVEL-(timing)-(mode)\n 1: relay number\n 2: dtc\n mcu: object\n comm2checker.Serial2Mcu\n res: object\n comm2resistor.Res\n ... | [
{
"param": "recipe",
"type": "list"
},
{
"param": "mcu",
"type": "object"
},
{
"param": "res",
"type": "object"
},
{
"param": "boxRes",
"type": "list"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "recipe",
"type": "list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mcu",
"type": "object",
"docstring": null,
"docstring_tok... |
05454bf8ded9a13f75439fa235dce38f790ae4b2 | shinshio/AC2C | src/order2checker.py | [
"OLDAP-2.2.1"
] | Python | order2checker | <not_specific> | def order2checker(
recipe: list,
mcu: object = None,
dmm: object = None,
res: object = None,
boxRes: list = [0.0]*16
):
"""
Order each message to checker
Parameters
----------
recipe: list
0: main
1-end: option
mcu: obj... |
Order each message to checker
Parameters
----------
recipe: list
0: main
1-end: option
mcu: object
comm2checker.Serial2Mcu
dmm: object
comm2dmm.DmmADCMT
res: object
comm2resistor.Res
boxRes: list
... | Order each message to checker
Parameters
Returns
each message from checker | [
"Order",
"each",
"message",
"to",
"checker",
"Parameters",
"Returns",
"each",
"message",
"from",
"checker"
] | def order2checker(
recipe: list,
mcu: object = None,
dmm: object = None,
res: object = None,
boxRes: list = [0.0]*16
):
mcu.emptySeriBuf(mcu.port)
majC = recipe[0]
if majC == 'IGON':
return odrIGON(recipe, mcu)
elif majC == 'IGOFF':
return odrI... | [
"def",
"order2checker",
"(",
"recipe",
":",
"list",
",",
"mcu",
":",
"object",
"=",
"None",
",",
"dmm",
":",
"object",
"=",
"None",
",",
"res",
":",
"object",
"=",
"None",
",",
"boxRes",
":",
"list",
"=",
"[",
"0.0",
"]",
"*",
"16",
")",
":",
"... | Order each message to checker
Parameters | [
"Order",
"each",
"message",
"to",
"checker",
"Parameters"
] | [
"\"\"\"\n Order each message to checker\n\n Parameters\n ----------\n recipe: list\n 0: main\n 1-end: option\n mcu: object\n comm2checker.Serial2Mcu\n dmm: object\n comm2dmm.DmmADCMT\n res: object\n comm2resistor.Res\n ... | [
{
"param": "recipe",
"type": "list"
},
{
"param": "mcu",
"type": "object"
},
{
"param": "dmm",
"type": "object"
},
{
"param": "res",
"type": "object"
},
{
"param": "boxRes",
"type": "list"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "recipe",
"type": "list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mcu",
"type": "object",
"docstring": null,
"docstring_tok... |
e6feab1c1c1dda51314ebdcb775bfb3e79a6675b | shinshio/AC2C | src/generateExcel.py | [
"OLDAP-2.2.1"
] | Python | _setResultInfo | null | def _setResultInfo(self, data: list):
"""Trim result information to report
Args
----------
data: list
0: checker function (SQ, SAT, LOAD)
1: checker terminal (DAB, FSR, ...)
2: checker status (OPEN, SHORT, ...)
3: criter... | Trim result information to report
Args
----------
data: list
0: checker function (SQ, SAT, LOAD)
1: checker terminal (DAB, FSR, ...)
2: checker status (OPEN, SHORT, ...)
3: criteria (9011, 80011A, ...)
4: result ... | Trim result information to report
Args
set result information | [
"Trim",
"result",
"information",
"to",
"report",
"Args",
"set",
"result",
"information"
] | def _setResultInfo(self, data: list):
repResultInfo = [['機能','端子','状態','判定基準','結果','判定']]
bufResultInfo = [''] * 6
_data = [[d[1].split('_')[0],d[1].split('->')[0].split('_')[1],d[1].split('->')[1],d[2],d[3],d[4]] for d in data]
resultInfo = [[s.replace(',','\n') for s in ss] for ss in _... | [
"def",
"_setResultInfo",
"(",
"self",
",",
"data",
":",
"list",
")",
":",
"repResultInfo",
"=",
"[",
"[",
"'機能','端子",
"'",
",'状態','判",
"定",
"基準','結果'",
",",
"'判定']]",
"",
"",
"",
"",
"",
"",
"bufResultInfo",
"=",
"[",
"''",
"]",
"*",
"6",
"_data",
... | Trim result information to report
Args | [
"Trim",
"result",
"information",
"to",
"report",
"Args"
] | [
"\"\"\"Trim result information to report\n Args\n ----------\n data: list\n 0: checker function (SQ, SAT, LOAD)\n 1: checker terminal (DAB, FSR, ...)\n 2: checker status (OPEN, SHORT, ...)\n 3: criteria (9011, 80011A, ...)\n ... | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": "list"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "list",
"docstring": null,
"docstring_tokens":... |
e6feab1c1c1dda51314ebdcb775bfb3e79a6675b | shinshio/AC2C | src/generateExcel.py | [
"OLDAP-2.2.1"
] | Python | _write2excel | null | def _write2excel(self, sheet: object, data: list, start_row: int, start_col: int):
"""Write data at excel from list
Args
----------
sheet: object
openpyxl's workbook[sheetname]
data: list
demension 1: rows of excel
demension... | Write data at excel from list
Args
----------
sheet: object
openpyxl's workbook[sheetname]
data: list
demension 1: rows of excel
demension 2: columns of excel
start_row: initial wrote cell's row of excel
star... | Write data at excel from list
Args
write data into excel | [
"Write",
"data",
"at",
"excel",
"from",
"list",
"Args",
"write",
"data",
"into",
"excel"
] | def _write2excel(self, sheet: object, data: list, start_row: int, start_col: int):
for r in range(0,len(data)):
for c in range(0,len(data[0])):
sheet.cell(r+start_row,c+start_col).value=data[r][c] | [
"def",
"_write2excel",
"(",
"self",
",",
"sheet",
":",
"object",
",",
"data",
":",
"list",
",",
"start_row",
":",
"int",
",",
"start_col",
":",
"int",
")",
":",
"for",
"r",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"data",
")",
")",
":",
"for",
... | Write data at excel from list
Args | [
"Write",
"data",
"at",
"excel",
"from",
"list",
"Args"
] | [
"\"\"\"Write data at excel from list\n Args\n ----------\n sheet: object\n openpyxl's workbook[sheetname]\n data: list\n demension 1: rows of excel\n demension 2: columns of excel\n start_row: initial wrote cell's row of exc... | [
{
"param": "self",
"type": null
},
{
"param": "sheet",
"type": "object"
},
{
"param": "data",
"type": "list"
},
{
"param": "start_row",
"type": "int"
},
{
"param": "start_col",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sheet",
"type": "object",
"docstring": null,
"docstring_token... |
e6feab1c1c1dda51314ebdcb775bfb3e79a6675b | shinshio/AC2C | src/generateExcel.py | [
"OLDAP-2.2.1"
] | Python | outputLevelCsv | <not_specific> | def outputLevelCsv(self):
"""Generate CSV File of leveling
Args
----------
Nothing
Returns
----------
Nothing: generate csv file
"""
# extract level information from result info
extract_level = []
extract_level = [item for i... | Generate CSV File of leveling
Args
----------
Nothing
Returns
----------
Nothing: generate csv file
| Generate CSV File of leveling
Args
Nothing
Returns
generate csv file | [
"Generate",
"CSV",
"File",
"of",
"leveling",
"Args",
"Nothing",
"Returns",
"generate",
"csv",
"file"
] | def outputLevelCsv(self):
extract_level = []
extract_level = [item for item in self._result_info if self._result_info[2][0:5]=='LEVEL']
if extract_level == []:
print('No Result of LEVEL')
return None
for i, item in enumerate(extract_level):
self._level... | [
"def",
"outputLevelCsv",
"(",
"self",
")",
":",
"extract_level",
"=",
"[",
"]",
"extract_level",
"=",
"[",
"item",
"for",
"item",
"in",
"self",
".",
"_result_info",
"if",
"self",
".",
"_result_info",
"[",
"2",
"]",
"[",
"0",
":",
"5",
"]",
"==",
"'LE... | Generate CSV File of leveling
Args | [
"Generate",
"CSV",
"File",
"of",
"leveling",
"Args"
] | [
"\"\"\"Generate CSV File of leveling\n Args\n ----------\n Nothing\n Returns\n ----------\n Nothing: generate csv file\n \"\"\"",
"# extract level information from result info",
"# copy need information",
"# set csv file name",
"# write csv"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a1ba0b5463d6f10801673a6153e02189f5026f9 | shinshio/AC2C | src/analyzeScenario.py | [
"OLDAP-2.2.1"
] | Python | takeInCover | list | def takeInCover(filename: str) -> list:
"""
Take in cover information from scenario file
Parameters
----------
filename: str
full path of scenario file
Returns
----------
lst_cover: list
0: title, 1: author, 2:ECU type 3: ECU code,
4: summary(... |
Take in cover information from scenario file
Parameters
----------
filename: str
full path of scenario file
Returns
----------
lst_cover: list
0: title, 1: author, 2:ECU type 3: ECU code,
4: summary(1), 5: summary(2), 6: summary(3), 7: summary(4)... | Take in cover information from scenario file
Parameters
str
full path of scenario file
Returns
| [
"Take",
"in",
"cover",
"information",
"from",
"scenario",
"file",
"Parameters",
"str",
"full",
"path",
"of",
"scenario",
"file",
"Returns"
] | def takeInCover(filename: str) -> list:
snHeader = 3
snIndexCol = 0
snSname = 'cover'
df_cover = pd.read_excel(filename,header=snHeader,index_col=snIndexCol,sheet_name=snSname)
lst_cover = sum(df_cover.fillna('').values.tolist(), [])
return lst_cover | [
"def",
"takeInCover",
"(",
"filename",
":",
"str",
")",
"->",
"list",
":",
"snHeader",
"=",
"3",
"snIndexCol",
"=",
"0",
"snSname",
"=",
"'cover'",
"df_cover",
"=",
"pd",
".",
"read_excel",
"(",
"filename",
",",
"header",
"=",
"snHeader",
",",
"index_col... | Take in cover information from scenario file
Parameters | [
"Take",
"in",
"cover",
"information",
"from",
"scenario",
"file",
"Parameters"
] | [
"\"\"\"\n Take in cover information from scenario file\n\n Parameters\n ----------\n filename: str\n full path of scenario file\n Returns\n ----------\n lst_cover: list\n 0: title, 1: author, 2:ECU type 3: ECU code,\n 4: summary(1), 5: summary(2), 6: sum... | [
{
"param": "filename",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a1ba0b5463d6f10801673a6153e02189f5026f9 | shinshio/AC2C | src/analyzeScenario.py | [
"OLDAP-2.2.1"
] | Python | takeInScenario | list | def takeInScenario(filename: str) -> list:
"""
Take in scenario information from scenario file
Parameters
----------
filename: str
full path of scenario file
Returns
----------
lst_scenario: list
demension 1: scenarios
demension 2:
... |
Take in scenario information from scenario file
Parameters
----------
filename: str
full path of scenario file
Returns
----------
lst_scenario: list
demension 1: scenarios
demension 2:
0: numbers, 1: scenario's items (orders and r... | Take in scenario information from scenario file
Parameters
str
full path of scenario file
Returns
| [
"Take",
"in",
"scenario",
"information",
"from",
"scenario",
"file",
"Parameters",
"str",
"full",
"path",
"of",
"scenario",
"file",
"Returns"
] | def takeInScenario(filename: str) -> list:
snHeader = 0
snIndexCol = None
snSname = 'scenario'
df_scenario = pd.read_excel(filename,header=snHeader,index_col=snIndexCol,sheet_name=snSname)
lst_scenario = df_scenario.fillna('').values.tolist()
return lst_scenario | [
"def",
"takeInScenario",
"(",
"filename",
":",
"str",
")",
"->",
"list",
":",
"snHeader",
"=",
"0",
"snIndexCol",
"=",
"None",
"snSname",
"=",
"'scenario'",
"df_scenario",
"=",
"pd",
".",
"read_excel",
"(",
"filename",
",",
"header",
"=",
"snHeader",
",",
... | Take in scenario information from scenario file
Parameters | [
"Take",
"in",
"scenario",
"information",
"from",
"scenario",
"file",
"Parameters"
] | [
"\"\"\"\n Take in scenario information from scenario file\n\n Parameters\n ----------\n filename: str\n full path of scenario file\n Returns\n ----------\n lst_scenario: list\n demension 1: scenarios\n demension 2:\n 0: numbers, 1: scenari... | [
{
"param": "filename",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a1ba0b5463d6f10801673a6153e02189f5026f9 | shinshio/AC2C | src/analyzeScenario.py | [
"OLDAP-2.2.1"
] | Python | takeInCanInfo | list | def takeInCanInfo(filename: str) -> list:
"""
Take in CAN information from scenario file
Parameters
----------
filename: str
full path of scenario file
Returns
----------
lst_can: list
demension 1: keywords
0: id for send, 1: id for respon... |
Take in CAN information from scenario file
Parameters
----------
filename: str
full path of scenario file
Returns
----------
lst_can: list
demension 1: keywords
0: id for send, 1: id for response 2: message of dtc read
3: mess... | Take in CAN information from scenario file
Parameters
str
full path of scenario file
Returns
| [
"Take",
"in",
"CAN",
"information",
"from",
"scenario",
"file",
"Parameters",
"str",
"full",
"path",
"of",
"scenario",
"file",
"Returns"
] | def takeInCanInfo(filename: str) -> list:
snHeader = 0
snIndexCol = None
snSname = 'can'
df_can = pd.read_excel(filename,header=snHeader,index_col=snIndexCol,sheet_name=snSname)
lst_can = df_can.fillna('').values.tolist()
return lst_can | [
"def",
"takeInCanInfo",
"(",
"filename",
":",
"str",
")",
"->",
"list",
":",
"snHeader",
"=",
"0",
"snIndexCol",
"=",
"None",
"snSname",
"=",
"'can'",
"df_can",
"=",
"pd",
".",
"read_excel",
"(",
"filename",
",",
"header",
"=",
"snHeader",
",",
"index_co... | Take in CAN information from scenario file
Parameters | [
"Take",
"in",
"CAN",
"information",
"from",
"scenario",
"file",
"Parameters"
] | [
"\"\"\"\n Take in CAN information from scenario file\n\n Parameters\n ----------\n filename: str\n full path of scenario file\n Returns\n ----------\n lst_can: list\n demension 1: keywords\n 0: id for send, 1: id for response 2: message of dtc read\n... | [
{
"param": "filename",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ad545b3f6f12643539b539eb038384df6f9ae641 | shinshio/AC2C | src/comm2checker.py | [
"OLDAP-2.2.1"
] | Python | _seachCOMPort | str | def _seachCOMPort(self, devname: str) -> str:
"""
Search number of COM port from device name
Parameters
----------
devname: str
device name
Returns
----------
str
COM port
"""
# make list of all devi... |
Search number of COM port from device name
Parameters
----------
devname: str
device name
Returns
----------
str
COM port
| Search number of COM port from device name
Parameters
str
device name
Returns
str
COM port | [
"Search",
"number",
"of",
"COM",
"port",
"from",
"device",
"name",
"Parameters",
"str",
"device",
"name",
"Returns",
"str",
"COM",
"port"
] | def _seachCOMPort(self, devname: str) -> str:
ports = serial.tools.list_ports.comports()
device = [info for info in ports if devname in info.description]
if len(device) == 0:
return None
try:
return str(serial.Serial(device[0].device).port)
except:
... | [
"def",
"_seachCOMPort",
"(",
"self",
",",
"devname",
":",
"str",
")",
"->",
"str",
":",
"ports",
"=",
"serial",
".",
"tools",
".",
"list_ports",
".",
"comports",
"(",
")",
"device",
"=",
"[",
"info",
"for",
"info",
"in",
"ports",
"if",
"devname",
"in... | Search number of COM port from device name
Parameters | [
"Search",
"number",
"of",
"COM",
"port",
"from",
"device",
"name",
"Parameters"
] | [
"\"\"\"\n Search number of COM port from device name\n\n Parameters\n ----------\n devname: str\n device name\n Returns\n ----------\n str\n COM port\n \"\"\"",
"# make list of all device name at each com ports",
"# re... | [
{
"param": "self",
"type": null
},
{
"param": "devname",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "devname",
"type": "str",
"docstring": null,
"docstring_tokens... |
ad545b3f6f12643539b539eb038384df6f9ae641 | shinshio/AC2C | src/comm2checker.py | [
"OLDAP-2.2.1"
] | Python | sendMsg | str | def sendMsg(self, msg: str, waittime: float) -> str:
"""
send message and receive return message
Parameters
----------
port: object
Serial
msg: str
message for checker (only from bit assign)
waittime: float
... |
send message and receive return message
Parameters
----------
port: object
Serial
msg: str
message for checker (only from bit assign)
waittime: float
time out second
Returns
----------
... | send message and receive return message
Parameters
object
Serial
msg: str
message for checker (only from bit assign)
waittime: float
time out second
Returns
str
return message from checker | [
"send",
"message",
"and",
"receive",
"return",
"message",
"Parameters",
"object",
"Serial",
"msg",
":",
"str",
"message",
"for",
"checker",
"(",
"only",
"from",
"bit",
"assign",
")",
"waittime",
":",
"float",
"time",
"out",
"second",
"Returns",
"str",
"retur... | def sendMsg(self, msg: str, waittime: float) -> str:
if msg[0:2].isdecimal() and int(msg[0:2])<100:
tx = msg
else:
print('Error : Serial Message header is only decimal in 0~99.')
return None
self.port.write(tx.encode('utf-8'))
start = time.time()
... | [
"def",
"sendMsg",
"(",
"self",
",",
"msg",
":",
"str",
",",
"waittime",
":",
"float",
")",
"->",
"str",
":",
"if",
"msg",
"[",
"0",
":",
"2",
"]",
".",
"isdecimal",
"(",
")",
"and",
"int",
"(",
"msg",
"[",
"0",
":",
"2",
"]",
")",
"<",
"100... | send message and receive return message
Parameters | [
"send",
"message",
"and",
"receive",
"return",
"message",
"Parameters"
] | [
"\"\"\"\n send message and receive return message\n\n Parameters\n ----------\n port: object\n Serial\n msg: str\n message for checker (only from bit assign)\n waittime: float\n time out second\n Returns\n ... | [
{
"param": "self",
"type": null
},
{
"param": "msg",
"type": "str"
},
{
"param": "waittime",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "msg",
"type": "str",
"docstring": null,
"docstring_tokens": [... |
ad545b3f6f12643539b539eb038384df6f9ae641 | shinshio/AC2C | src/comm2checker.py | [
"OLDAP-2.2.1"
] | Python | sendAddInfo | <not_specific> | def sendAddInfo(self, sermsg: str, addmsg: str, waittime: float):
"""
send additional message to checkers
Parameters
----------
port: object
Serial
sermsg: str
message to checker (only from bit assign)
addmsg: str
... |
send additional message to checkers
Parameters
----------
port: object
Serial
sermsg: str
message to checker (only from bit assign)
addmsg: str
additional message (not only from bit assign)
Returns
... | send additional message to checkers
Parameters
object
Serial
sermsg: str
message to checker (only from bit assign)
addmsg: str
additional message (not only from bit assign)
Returns
str
return message from checker | [
"send",
"additional",
"message",
"to",
"checkers",
"Parameters",
"object",
"Serial",
"sermsg",
":",
"str",
"message",
"to",
"checker",
"(",
"only",
"from",
"bit",
"assign",
")",
"addmsg",
":",
"str",
"additional",
"message",
"(",
"not",
"only",
"from",
"bit"... | def sendAddInfo(self, sermsg: str, addmsg: str, waittime: float):
rx = self.sendMsg(sermsg, waittime)
if rx == 'timeout':
return 'order send error'
if rx != ba.posRes:
return 'additional info send error'
else:
self.port.write(addmsg.encode('utf-8'))
... | [
"def",
"sendAddInfo",
"(",
"self",
",",
"sermsg",
":",
"str",
",",
"addmsg",
":",
"str",
",",
"waittime",
":",
"float",
")",
":",
"rx",
"=",
"self",
".",
"sendMsg",
"(",
"sermsg",
",",
"waittime",
")",
"if",
"rx",
"==",
"'timeout'",
":",
"return",
... | send additional message to checkers
Parameters | [
"send",
"additional",
"message",
"to",
"checkers",
"Parameters"
] | [
"\"\"\"\n send additional message to checkers\n\n Parameters\n ----------\n port: object\n Serial\n sermsg: str\n message to checker (only from bit assign)\n addmsg: str\n additional message (not only from bit assign)... | [
{
"param": "self",
"type": null
},
{
"param": "sermsg",
"type": "str"
},
{
"param": "addmsg",
"type": "str"
},
{
"param": "waittime",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sermsg",
"type": "str",
"docstring": null,
"docstring_tokens"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.