body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def deploySQL(self):
'\n ---------------------------------------------------------------------------\n Returns the SQL code needed to deploy the model.\n\n Returns\n -------\n str\n the SQL code needed to deploy the model.\n '
sql = self.deploy_predict_
if ((self.parameters['d']... | 196,671,721,592,775,420 | ---------------------------------------------------------------------------
Returns the SQL code needed to deploy the model.
Returns
-------
str
the SQL code needed to deploy the model. | verticapy/learn/tsa.py | deploySQL | MiConnell/VerticaPy | python | def deploySQL(self):
'\n ---------------------------------------------------------------------------\n Returns the SQL code needed to deploy the model.\n\n Returns\n -------\n str\n the SQL code needed to deploy the model.\n '
sql = self.deploy_predict_
if ((self.parameters['d']... |
def fpredict(self, L: list):
'\n ---------------------------------------------------------------------------\n Computes the prediction.\n\n Parameters\n ----------\n L: list\n List containing the data. It must be a two-dimensional list containing \n multiple rows. Each row must include ... | -3,849,201,933,801,486,000 | ---------------------------------------------------------------------------
Computes the prediction.
Parameters
----------
L: list
List containing the data. It must be a two-dimensional list containing
multiple rows. Each row must include as first element the ordered predictor
and as nth elements the nth ... | verticapy/learn/tsa.py | fpredict | MiConnell/VerticaPy | python | def fpredict(self, L: list):
'\n ---------------------------------------------------------------------------\n Computes the prediction.\n\n Parameters\n ----------\n L: list\n List containing the data. It must be a two-dimensional list containing \n multiple rows. Each row must include ... |
def fit(self, input_relation: Union[(vDataFrame, str)], y: str, ts: str, X: list=[], test_relation: Union[(vDataFrame, str)]=''):
'\n ---------------------------------------------------------------------------\n Trains the model.\n\n Parameters\n ----------\n input_relation: str/vDataFrame\n T... | -788,220,881,952,957,400 | ---------------------------------------------------------------------------
Trains the model.
Parameters
----------
input_relation: str/vDataFrame
Training relation.
y: str
Response column.
ts: str
vcolumn used to order the data.
X: list, optional
exogenous columns used to fit the model.
test_relation:... | verticapy/learn/tsa.py | fit | MiConnell/VerticaPy | python | def fit(self, input_relation: Union[(vDataFrame, str)], y: str, ts: str, X: list=[], test_relation: Union[(vDataFrame, str)]=):
'\n ---------------------------------------------------------------------------\n Trains the model.\n\n Parameters\n ----------\n input_relation: str/vDataFrame\n Tra... |
def plot(self, vdf: vDataFrame=None, y: str='', ts: str='', X: list=[], dynamic: bool=False, one_step: bool=True, observed: bool=True, confidence: bool=True, nlead: int=10, nlast: int=0, limit: int=1000, ax=None, **style_kwds):
'\n ---------------------------------------------------------------------------\n ... | -6,783,633,173,507,660,000 | ---------------------------------------------------------------------------
Draws the SARIMAX model.
Parameters
----------
vdf: vDataFrame, optional
Object to use to run the prediction.
y: str, optional
Response column.
ts: str, optional
vcolumn used to order the data.
X: list, optional
exogenous vcolu... | verticapy/learn/tsa.py | plot | MiConnell/VerticaPy | python | def plot(self, vdf: vDataFrame=None, y: str=, ts: str=, X: list=[], dynamic: bool=False, one_step: bool=True, observed: bool=True, confidence: bool=True, nlead: int=10, nlast: int=0, limit: int=1000, ax=None, **style_kwds):
'\n ---------------------------------------------------------------------------\n Draw... |
def predict(self, vdf: vDataFrame, y: str='', ts: str='', X: list=[], nlead: int=0, name: str=''):
'\n ---------------------------------------------------------------------------\n Predicts using the input relation.\n\n Parameters\n ----------\n vdf: vDataFrame\n Object to use to run the predi... | 4,688,031,092,358,843,000 | ---------------------------------------------------------------------------
Predicts using the input relation.
Parameters
----------
vdf: vDataFrame
Object to use to run the prediction.
y: str, optional
Response column.
ts: str, optional
vcolumn used to order the data.
X: list, optional
exogenous vcolu... | verticapy/learn/tsa.py | predict | MiConnell/VerticaPy | python | def predict(self, vdf: vDataFrame, y: str=, ts: str=, X: list=[], nlead: int=0, name: str=):
'\n ---------------------------------------------------------------------------\n Predicts using the input relation.\n\n Parameters\n ----------\n vdf: vDataFrame\n Object to use to run the prediction.... |
def deploySQL(self):
'\n ---------------------------------------------------------------------------\n Returns the SQL code needed to deploy the model.\n\n Returns\n -------\n str\n the SQL code needed to deploy the model.\n '
sql = []
for (idx, coefs) in enumerate(self.coef_):
... | 6,084,383,689,124,714,000 | ---------------------------------------------------------------------------
Returns the SQL code needed to deploy the model.
Returns
-------
str
the SQL code needed to deploy the model. | verticapy/learn/tsa.py | deploySQL | MiConnell/VerticaPy | python | def deploySQL(self):
'\n ---------------------------------------------------------------------------\n Returns the SQL code needed to deploy the model.\n\n Returns\n -------\n str\n the SQL code needed to deploy the model.\n '
sql = []
for (idx, coefs) in enumerate(self.coef_):
... |
def features_importance(self, X_idx: int=0, ax=None, show: bool=True, **style_kwds):
"\n ---------------------------------------------------------------------------\n Computes the model's features importance.\n\n Parameters\n ----------\n X_idx: int/str, optional\n Index of the main vector vco... | -3,235,239,240,650,255,400 | ---------------------------------------------------------------------------
Computes the model's features importance.
Parameters
----------
X_idx: int/str, optional
Index of the main vector vcolumn used to draw the features importance.
It can also be the name of a predictor vcolumn.
ax: Matplotlib axes object,... | verticapy/learn/tsa.py | features_importance | MiConnell/VerticaPy | python | def features_importance(self, X_idx: int=0, ax=None, show: bool=True, **style_kwds):
"\n ---------------------------------------------------------------------------\n Computes the model's features importance.\n\n Parameters\n ----------\n X_idx: int/str, optional\n Index of the main vector vco... |
def fit(self, input_relation: Union[(vDataFrame, str)], X: list, ts: str, test_relation: Union[(vDataFrame, str)]=''):
'\n ---------------------------------------------------------------------------\n Trains the model.\n\n Parameters\n ----------\n input_relation: str/vDataFrame\n Training rel... | 4,751,591,637,537,357,000 | ---------------------------------------------------------------------------
Trains the model.
Parameters
----------
input_relation: str/vDataFrame
Training relation.
X: list
List of the response columns.
ts: str
vcolumn used to order the data.
test_relation: str/vDataFrame, optional
Relation used to te... | verticapy/learn/tsa.py | fit | MiConnell/VerticaPy | python | def fit(self, input_relation: Union[(vDataFrame, str)], X: list, ts: str, test_relation: Union[(vDataFrame, str)]=):
'\n ---------------------------------------------------------------------------\n Trains the model.\n\n Parameters\n ----------\n input_relation: str/vDataFrame\n Training relat... |
def fpredict(self, L: list):
'\n ---------------------------------------------------------------------------\n Computes the prediction.\n\n Parameters\n ----------\n L: list\n List containing the data. It must be a two-dimensional list containing \n multiple rows. Each row must include ... | 1,739,647,055,321,242,600 | ---------------------------------------------------------------------------
Computes the prediction.
Parameters
----------
L: list
List containing the data. It must be a two-dimensional list containing
multiple rows. Each row must include as first element the ordered predictor
and as nth elements the nth... | verticapy/learn/tsa.py | fpredict | MiConnell/VerticaPy | python | def fpredict(self, L: list):
'\n ---------------------------------------------------------------------------\n Computes the prediction.\n\n Parameters\n ----------\n L: list\n List containing the data. It must be a two-dimensional list containing \n multiple rows. Each row must include ... |
def plot(self, vdf: vDataFrame=None, X: list=[], ts: str='', X_idx: int=0, dynamic: bool=False, one_step: bool=True, observed: bool=True, confidence: bool=True, nlead: int=10, nlast: int=0, limit: int=1000, ax=None, **style_kwds):
'\n ---------------------------------------------------------------------------\n ... | 2,941,692,781,028,544 | ---------------------------------------------------------------------------
Draws the VAR model.
Parameters
----------
vdf: vDataFrame
Object to use to run the prediction.
X: list, optional
List of the response columns.
ts: str, optional
vcolumn used to order the data.
X_idx: int, optional
Index of the... | verticapy/learn/tsa.py | plot | MiConnell/VerticaPy | python | def plot(self, vdf: vDataFrame=None, X: list=[], ts: str=, X_idx: int=0, dynamic: bool=False, one_step: bool=True, observed: bool=True, confidence: bool=True, nlead: int=10, nlast: int=0, limit: int=1000, ax=None, **style_kwds):
'\n ---------------------------------------------------------------------------\n ... |
def predict(self, vdf: vDataFrame, X: list=[], ts: str='', nlead: int=0, name: list=[]):
'\n ---------------------------------------------------------------------------\n Predicts using the input relation.\n\n Parameters\n ----------\n vdf: vDataFrame\n Object to use to run the prediction.\n ... | 344,865,179,313,746,200 | ---------------------------------------------------------------------------
Predicts using the input relation.
Parameters
----------
vdf: vDataFrame
Object to use to run the prediction.
X: list, optional
List of the response columns.
ts: str, optional
vcolumn used to order the data.
nlead: int, optional
... | verticapy/learn/tsa.py | predict | MiConnell/VerticaPy | python | def predict(self, vdf: vDataFrame, X: list=[], ts: str=, nlead: int=0, name: list=[]):
'\n ---------------------------------------------------------------------------\n Predicts using the input relation.\n\n Parameters\n ----------\n vdf: vDataFrame\n Object to use to run the prediction.\n ... |
def test_status_view_not_logged_in(self):
' test status view '
destination = ('/login/?next=' + urllib.parse.quote('/config/status/', safe=''))
response = self.client.get('/config/status/', follow=True)
self.assertRedirects(response, destination, status_code=302, target_status_code=200) | 3,453,664,318,599,190,000 | test status view | dfirtrack_config/tests/status/test_status_views.py | test_status_view_not_logged_in | cclauss/dfirtrack | python | def test_status_view_not_logged_in(self):
' '
destination = ('/login/?next=' + urllib.parse.quote('/config/status/', safe=))
response = self.client.get('/config/status/', follow=True)
self.assertRedirects(response, destination, status_code=302, target_status_code=200) |
def test_status_view_logged_in(self):
' test status view '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
response = self.client.get('/config/status/')
self.assertEqual(response.status_code, 200) | 8,133,930,087,436,671,000 | test status view | dfirtrack_config/tests/status/test_status_views.py | test_status_view_logged_in | cclauss/dfirtrack | python | def test_status_view_logged_in(self):
' '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
response = self.client.get('/config/status/')
self.assertEqual(response.status_code, 200) |
def test_status_view_template(self):
' test status view '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
response = self.client.get('/config/status/')
self.assertTemplateUsed(response, 'dfirtrack_config/status/status.html') | -8,359,420,942,218,433,000 | test status view | dfirtrack_config/tests/status/test_status_views.py | test_status_view_template | cclauss/dfirtrack | python | def test_status_view_template(self):
' '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
response = self.client.get('/config/status/')
self.assertTemplateUsed(response, 'dfirtrack_config/status/status.html') |
def test_status_view_get_user_context(self):
' test status view '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
response = self.client.get('/config/status/')
self.assertEqual(str(response.context['user']), 'testuser_status') | -5,865,377,632,099,459,000 | test status view | dfirtrack_config/tests/status/test_status_views.py | test_status_view_get_user_context | cclauss/dfirtrack | python | def test_status_view_get_user_context(self):
' '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
response = self.client.get('/config/status/')
self.assertEqual(str(response.context['user']), 'testuser_status') |
def test_status_view_redirect(self):
' test status view '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
destination = urllib.parse.quote('/config/status/', safe='/')
response = self.client.get('/config/status', follow=True)
self.assertRedirects(response, destination,... | 5,283,357,441,722,809,000 | test status view | dfirtrack_config/tests/status/test_status_views.py | test_status_view_redirect | cclauss/dfirtrack | python | def test_status_view_redirect(self):
' '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
destination = urllib.parse.quote('/config/status/', safe='/')
response = self.client.get('/config/status', follow=True)
self.assertRedirects(response, destination, status_code=301... |
def test_status_view_get_object_context(self):
' test status view '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
response = self.client.get('/config/status/')
analysisstatus_all = Analysisstatus.objects.all().order_by('analysisstatus_name')
artifactpriority_all = Ar... | 9,154,925,588,400,285,000 | test status view | dfirtrack_config/tests/status/test_status_views.py | test_status_view_get_object_context | cclauss/dfirtrack | python | def test_status_view_get_object_context(self):
' '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
response = self.client.get('/config/status/')
analysisstatus_all = Analysisstatus.objects.all().order_by('analysisstatus_name')
artifactpriority_all = Artifactpriority.o... |
def test_status_view_get_statushistory_entry_numbers_context(self):
' test status view '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
response = self.client.get('/config/status/')
self.assertEqual(type(response.context['statushistory_all']), type(reversed(Statushistory.... | 4,925,314,560,294,860,000 | test status view | dfirtrack_config/tests/status/test_status_views.py | test_status_view_get_statushistory_entry_numbers_context | cclauss/dfirtrack | python | def test_status_view_get_statushistory_entry_numbers_context(self):
' '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
response = self.client.get('/config/status/')
self.assertEqual(type(response.context['statushistory_all']), type(reversed(Statushistory.objects.all()))) |
def test_status_detail_view_not_logged_in(self):
' test status view '
t_1 = datetime(2020, 11, 22, 11, 22, 33, tzinfo=timezone.utc)
statushistory_id = Statushistory.objects.get(statushistory_time=t_1).statushistory_id
destination = ('/login/?next=' + urllib.parse.quote((('/config/status/' + str(statushi... | -80,654,200,140,861,870 | test status view | dfirtrack_config/tests/status/test_status_views.py | test_status_detail_view_not_logged_in | cclauss/dfirtrack | python | def test_status_detail_view_not_logged_in(self):
' '
t_1 = datetime(2020, 11, 22, 11, 22, 33, tzinfo=timezone.utc)
statushistory_id = Statushistory.objects.get(statushistory_time=t_1).statushistory_id
destination = ('/login/?next=' + urllib.parse.quote((('/config/status/' + str(statushistory_id)) + '/'... |
def test_status_detail_view_logged_in(self):
' test status view '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
t_1 = datetime(2020, 11, 22, 11, 22, 33, tzinfo=timezone.utc)
statushistory_id = Statushistory.objects.get(statushistory_time=t_1).statushistory_id
respons... | -7,726,723,892,825,041,000 | test status view | dfirtrack_config/tests/status/test_status_views.py | test_status_detail_view_logged_in | cclauss/dfirtrack | python | def test_status_detail_view_logged_in(self):
' '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
t_1 = datetime(2020, 11, 22, 11, 22, 33, tzinfo=timezone.utc)
statushistory_id = Statushistory.objects.get(statushistory_time=t_1).statushistory_id
response = self.client.... |
def test_status_detail_view_template(self):
' test status view '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
t_1 = datetime(2020, 11, 22, 11, 22, 33, tzinfo=timezone.utc)
statushistory_id = Statushistory.objects.get(statushistory_time=t_1).statushistory_id
response... | 1,164,327,776,074,919,400 | test status view | dfirtrack_config/tests/status/test_status_views.py | test_status_detail_view_template | cclauss/dfirtrack | python | def test_status_detail_view_template(self):
' '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
t_1 = datetime(2020, 11, 22, 11, 22, 33, tzinfo=timezone.utc)
statushistory_id = Statushistory.objects.get(statushistory_time=t_1).statushistory_id
response = self.client.g... |
def test_status_detail_view_get_user_context(self):
' test status view '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
t_1 = datetime(2020, 11, 22, 11, 22, 33, tzinfo=timezone.utc)
statushistory_id = Statushistory.objects.get(statushistory_time=t_1).statushistory_id
... | 3,040,392,916,661,167,600 | test status view | dfirtrack_config/tests/status/test_status_views.py | test_status_detail_view_get_user_context | cclauss/dfirtrack | python | def test_status_detail_view_get_user_context(self):
' '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
t_1 = datetime(2020, 11, 22, 11, 22, 33, tzinfo=timezone.utc)
statushistory_id = Statushistory.objects.get(statushistory_time=t_1).statushistory_id
response = self.... |
def test_status_detail_view_redirect(self):
' test status view '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
t_1 = datetime(2020, 11, 22, 11, 22, 33, tzinfo=timezone.utc)
statushistory_id = Statushistory.objects.get(statushistory_time=t_1).statushistory_id
destinat... | 2,169,419,817,809,991,700 | test status view | dfirtrack_config/tests/status/test_status_views.py | test_status_detail_view_redirect | cclauss/dfirtrack | python | def test_status_detail_view_redirect(self):
' '
self.client.login(username='testuser_status', password='D9lPsoHFXeCNKEzM3IgE')
t_1 = datetime(2020, 11, 22, 11, 22, 33, tzinfo=timezone.utc)
statushistory_id = Statushistory.objects.get(statushistory_time=t_1).statushistory_id
destination = urllib.par... |
def find_format_specifiers(s):
'Find all format specifiers in a string.'
pos = 0
specifiers = []
while True:
percent = s.find('%', pos)
if (percent < 0):
break
try:
specifiers.append(s[(percent + 1)])
except:
print('Failed to get specif... | -4,348,967,928,584,775,700 | Find all format specifiers in a string. | contrib/devtools/update-translations.py | find_format_specifiers | ALLMINER/elli | python | def find_format_specifiers(s):
pos = 0
specifiers = []
while True:
percent = s.find('%', pos)
if (percent < 0):
break
try:
specifiers.append(s[(percent + 1)])
except:
print('Failed to get specifier')
pos = (percent + 2)
ret... |
def split_format_specifiers(specifiers):
'Split format specifiers between numeric (Qt) and others (strprintf)'
numeric = []
other = []
for s in specifiers:
if (s in {'1', '2', '3', '4', '5', '6', '7', '8', '9'}):
numeric.append(s)
else:
other.append(s)
if nume... | 1,703,264,572,144,296,000 | Split format specifiers between numeric (Qt) and others (strprintf) | contrib/devtools/update-translations.py | split_format_specifiers | ALLMINER/elli | python | def split_format_specifiers(specifiers):
numeric = []
other = []
for s in specifiers:
if (s in {'1', '2', '3', '4', '5', '6', '7', '8', '9'}):
numeric.append(s)
else:
other.append(s)
if numeric:
other = []
return (set(numeric), other) |
def sanitize_string(s):
'Sanitize string for printing'
return s.replace('\n', ' ') | -720,585,957,357,829,600 | Sanitize string for printing | contrib/devtools/update-translations.py | sanitize_string | ALLMINER/elli | python | def sanitize_string(s):
return s.replace('\n', ' ') |
def remove_invalid_characters(s):
'Remove invalid characters from translation string'
return FIX_RE.sub(b'', s) | 4,520,350,627,527,509,500 | Remove invalid characters from translation string | contrib/devtools/update-translations.py | remove_invalid_characters | ALLMINER/elli | python | def remove_invalid_characters(s):
return FIX_RE.sub(b, s) |
def test_constructor_must_create_object_when_analytical_data_has_float_values(self, linearity_validator_obj):
'Given analytical data\n The LinearityValidator\n Should create a list of floats\n '
assert (linearity_validator_obj.analytical_data == [0.1, 0.2, 0.15])
assert (linearity_valid... | -6,116,320,948,205,417,000 | Given analytical data
The LinearityValidator
Should create a list of floats | tests/unit/test_validators/test_linearity_validator.py | test_constructor_must_create_object_when_analytical_data_has_float_values | abxsantos/analytical-validation | python | def test_constructor_must_create_object_when_analytical_data_has_float_values(self, linearity_validator_obj):
'Given analytical data\n The LinearityValidator\n Should create a list of floats\n '
assert (linearity_validator_obj.analytical_data == [0.1, 0.2, 0.15])
assert (linearity_valid... |
def test_ordinary_least_squares_linear_regression_must_pass_float_when_given_correct_data(self, ordinary_least_squares_regression_mock, add_constant_mock, linearity_validator_obj):
'Given concentration values = float\n The ordinary_least_squares_linear_regression\n Then must set properties'
linear... | 8,376,493,372,959,138,000 | Given concentration values = float
The ordinary_least_squares_linear_regression
Then must set properties | tests/unit/test_validators/test_linearity_validator.py | test_ordinary_least_squares_linear_regression_must_pass_float_when_given_correct_data | abxsantos/analytical-validation | python | def test_ordinary_least_squares_linear_regression_must_pass_float_when_given_correct_data(self, ordinary_least_squares_regression_mock, add_constant_mock, linearity_validator_obj):
'Given concentration values = float\n The ordinary_least_squares_linear_regression\n Then must set properties'
linear... |
def test_regression_residues_exists_when_fitted_result_not_none(self, linearity_validator_obj, fitted_result_obj):
'Given a regression model\n when regression_residues is called\n the regression residues must be created'
assert (linearity_validator_obj.regression_residues == fitted_result_obj.resi... | -5,910,100,960,835,499,000 | Given a regression model
when regression_residues is called
the regression residues must be created | tests/unit/test_validators/test_linearity_validator.py | test_regression_residues_exists_when_fitted_result_not_none | abxsantos/analytical-validation | python | def test_regression_residues_exists_when_fitted_result_not_none(self, linearity_validator_obj, fitted_result_obj):
'Given a regression model\n when regression_residues is called\n the regression residues must be created'
assert (linearity_validator_obj.regression_residues == fitted_result_obj.resi... |
@pytest.mark.parametrize('param_anova_f_pvalue, param_alpha, expected_result', [(0.051, 0.05, False), (10, 0.1, False), (0.049, 0.05, True), (0.001, 0.1, True)])
def test_valid_anova_f_pvalue_must_return_true_when_r_squared_is_greater_than_0990(self, param_alpha, linearity_validator_obj, param_anova_f_pvalue, expected_... | 2,461,911,986,618,303,000 | Given data with an aceptable regression model
When valid_anova_f_pvalue is called
Then anova_f_pvalue < alpha must assert true | tests/unit/test_validators/test_linearity_validator.py | test_valid_anova_f_pvalue_must_return_true_when_r_squared_is_greater_than_0990 | abxsantos/analytical-validation | python | @pytest.mark.parametrize('param_anova_f_pvalue, param_alpha, expected_result', [(0.051, 0.05, False), (10, 0.1, False), (0.049, 0.05, True), (0.001, 0.1, True)])
def test_valid_anova_f_pvalue_must_return_true_when_r_squared_is_greater_than_0990(self, param_alpha, linearity_validator_obj, param_anova_f_pvalue, expected_... |
@pytest.mark.parametrize('param_significant_slope, param_alpha, expected_result', [(0.051, 0.05, False), (10, 0.1, False), (0.049, 0.05, True), (0.001, 0.1, True)])
def test_significant_slope_must_return_true_when_slope_pvalue_is_smaller_than_alpha(self, linearity_validator_obj, param_significant_slope, param_alpha, ex... | 7,304,967,778,565,503,000 | Given homokedastic data
When check_hypothesis is called
Then slope_is_significant must assert true | tests/unit/test_validators/test_linearity_validator.py | test_significant_slope_must_return_true_when_slope_pvalue_is_smaller_than_alpha | abxsantos/analytical-validation | python | @pytest.mark.parametrize('param_significant_slope, param_alpha, expected_result', [(0.051, 0.05, False), (10, 0.1, False), (0.049, 0.05, True), (0.001, 0.1, True)])
def test_significant_slope_must_return_true_when_slope_pvalue_is_smaller_than_alpha(self, linearity_validator_obj, param_significant_slope, param_alpha, ex... |
@pytest.mark.parametrize('param_insignificant_intercept, param_alpha, expected_result', [(0.051, 0.05, True), (10, 0.1, True), (0.049, 0.05, False), (0.001, 0.1, False)])
def test_insignificant_intercept_must_return_true_when_intercept_pvalue_is_greater_than_alpha(self, linearity_validator_obj, param_alpha, param_insig... | 3,910,188,703,419,715,000 | Given homokedastic data
When check_hypothesis is called
Then intercept_not_significant must assert true | tests/unit/test_validators/test_linearity_validator.py | test_insignificant_intercept_must_return_true_when_intercept_pvalue_is_greater_than_alpha | abxsantos/analytical-validation | python | @pytest.mark.parametrize('param_insignificant_intercept, param_alpha, expected_result', [(0.051, 0.05, True), (10, 0.1, True), (0.049, 0.05, False), (0.001, 0.1, False)])
def test_insignificant_intercept_must_return_true_when_intercept_pvalue_is_greater_than_alpha(self, linearity_validator_obj, param_alpha, param_insig... |
@pytest.mark.parametrize('param_r_squared, expected_result', [(1, True), (0.99, True), (0.98, False)])
def test_valid_r_squared_must_return_true_when_r_squared_is_greater_than_0990(self, linearity_validator_obj, param_r_squared, expected_result):
'Given homokedastic data\n When check_hypothesis is called\n ... | -1,165,562,256,004,436,000 | Given homokedastic data
When check_hypothesis is called
Then r_squared > 0.990 must assert true | tests/unit/test_validators/test_linearity_validator.py | test_valid_r_squared_must_return_true_when_r_squared_is_greater_than_0990 | abxsantos/analytical-validation | python | @pytest.mark.parametrize('param_r_squared, expected_result', [(1, True), (0.99, True), (0.98, False)])
def test_valid_r_squared_must_return_true_when_r_squared_is_greater_than_0990(self, linearity_validator_obj, param_r_squared, expected_result):
'Given homokedastic data\n When check_hypothesis is called\n ... |
def test_run_breusch_pagan_test_must_raise_exception_when_model_is_none(self):
'Not given a model parameter\n The check_homokedasticity\n Should raise exception'
analytical_data = [[0.1, 0.2, 0.15]]
concentration_data = [[0.2, 0.2, 0.3]]
with pytest.raises(DataWasNotFitted):
Linear... | 3,710,939,284,436,963,300 | Not given a model parameter
The check_homokedasticity
Should raise exception | tests/unit/test_validators/test_linearity_validator.py | test_run_breusch_pagan_test_must_raise_exception_when_model_is_none | abxsantos/analytical-validation | python | def test_run_breusch_pagan_test_must_raise_exception_when_model_is_none(self):
'Not given a model parameter\n The check_homokedasticity\n Should raise exception'
analytical_data = [[0.1, 0.2, 0.15]]
concentration_data = [[0.2, 0.2, 0.3]]
with pytest.raises(DataWasNotFitted):
Linear... |
def test_run_breusch_pagan_test(self, linearity_validator_obj, het_breuschpagan_mock):
'Given heterokedastic data\n When check_homokedasticity is called\n Then must return false'
linearity_validator_obj.run_breusch_pagan_test()
assert (linearity_validator_obj.breusch_pagan_pvalue == 42)
as... | -7,879,011,320,087,054,000 | Given heterokedastic data
When check_homokedasticity is called
Then must return false | tests/unit/test_validators/test_linearity_validator.py | test_run_breusch_pagan_test | abxsantos/analytical-validation | python | def test_run_breusch_pagan_test(self, linearity_validator_obj, het_breuschpagan_mock):
'Given heterokedastic data\n When check_homokedasticity is called\n Then must return false'
linearity_validator_obj.run_breusch_pagan_test()
assert (linearity_validator_obj.breusch_pagan_pvalue == 42)
as... |
@pytest.mark.parametrize('durbin_watson_pvalue', [0.1, 1, 2, 2.5, 3, 3.9])
def test_check_residual_autocorrelation(self, linearity_validator_obj, durbin_watson_mock, durbin_watson_pvalue):
'Given data\n When residual_autocorrelation is called\n Then must create durbin_watson_value'
durbin_watson_m... | 2,716,756,573,364,205,000 | Given data
When residual_autocorrelation is called
Then must create durbin_watson_value | tests/unit/test_validators/test_linearity_validator.py | test_check_residual_autocorrelation | abxsantos/analytical-validation | python | @pytest.mark.parametrize('durbin_watson_pvalue', [0.1, 1, 2, 2.5, 3, 3.9])
def test_check_residual_autocorrelation(self, linearity_validator_obj, durbin_watson_mock, durbin_watson_pvalue):
'Given data\n When residual_autocorrelation is called\n Then must create durbin_watson_value'
durbin_watson_m... |
def test_check_residual_autocorrelation_must_raise_exception_when_data_not_fitted(self, linearity_validator_obj):
'Given data,\n if no regression was calculated\n Should raise an exception'
linearity_validator_obj.fitted_result = None
with pytest.raises(DataWasNotFitted):
linearity_val... | 9,115,932,334,498,802,000 | Given data,
if no regression was calculated
Should raise an exception | tests/unit/test_validators/test_linearity_validator.py | test_check_residual_autocorrelation_must_raise_exception_when_data_not_fitted | abxsantos/analytical-validation | python | def test_check_residual_autocorrelation_must_raise_exception_when_data_not_fitted(self, linearity_validator_obj):
'Given data,\n if no regression was calculated\n Should raise an exception'
linearity_validator_obj.fitted_result = None
with pytest.raises(DataWasNotFitted):
linearity_val... |
@pytest.mark.parametrize('durbin_watson_pvalue', [(- 1), 10, 4.1])
def test_check_residual_autocorrelation_must_pass_when_durbin_watson_value_is_between_0_and_4(self, linearity_validator_obj, durbin_watson_mock, durbin_watson_pvalue):
'Given data,\n When check_residual is called\n after fitting the mo... | 977,011,992,682,152,000 | Given data,
When check_residual is called
after fitting the model
Should pass creating
0 < durbin_watson_value < 4 | tests/unit/test_validators/test_linearity_validator.py | test_check_residual_autocorrelation_must_pass_when_durbin_watson_value_is_between_0_and_4 | abxsantos/analytical-validation | python | @pytest.mark.parametrize('durbin_watson_pvalue', [(- 1), 10, 4.1])
def test_check_residual_autocorrelation_must_pass_when_durbin_watson_value_is_between_0_and_4(self, linearity_validator_obj, durbin_watson_mock, durbin_watson_pvalue):
'Given data,\n When check_residual is called\n after fitting the mo... |
def import_chart(slc_to_import: Slice, slc_to_override: Optional[Slice], import_time: Optional[int]=None) -> int:
'Inserts or overrides slc in the database.\n\n remote_id and import_time fields in params_dict are set to track the\n slice origin and ensure correct overrides for multiple imports.\n Slice.per... | -3,424,731,141,977,397,000 | Inserts or overrides slc in the database.
remote_id and import_time fields in params_dict are set to track the
slice origin and ensure correct overrides for multiple imports.
Slice.perm is used to find the datasources and connect them.
:param Slice slc_to_import: Slice object to import
:param Slice slc_to_override: S... | superset/dashboards/commands/importers/v0.py | import_chart | Jacob-ru/superset | python | def import_chart(slc_to_import: Slice, slc_to_override: Optional[Slice], import_time: Optional[int]=None) -> int:
'Inserts or overrides slc in the database.\n\n remote_id and import_time fields in params_dict are set to track the\n slice origin and ensure correct overrides for multiple imports.\n Slice.per... |
def import_dashboard(dashboard_to_import: Dashboard, dataset_id_mapping: Optional[Dict[(int, int)]]=None, import_time: Optional[int]=None, database_id: Optional[int]=None) -> int:
"Imports the dashboard from the object to the database.\n\n Once dashboard is imported, json_metadata field is extended and stores\n ... | 7,049,112,800,936,609,000 | Imports the dashboard from the object to the database.
Once dashboard is imported, json_metadata field is extended and stores
remote_id and import_time. It helps to decide if the dashboard has to
be overridden or just copies over. Slices that belong to this
dashboard will be wired to existing tables. This function can... | superset/dashboards/commands/importers/v0.py | import_dashboard | Jacob-ru/superset | python | def import_dashboard(dashboard_to_import: Dashboard, dataset_id_mapping: Optional[Dict[(int, int)]]=None, import_time: Optional[int]=None, database_id: Optional[int]=None) -> int:
"Imports the dashboard from the object to the database.\n\n Once dashboard is imported, json_metadata field is extended and stores\n ... |
def decode_dashboards(o: Dict[(str, Any)]) -> Any:
'\n Function to be passed into json.loads obj_hook parameter\n Recreates the dashboard object from a json representation.\n '
from superset.connectors.druid.models import DruidCluster, DruidColumn, DruidDatasource, DruidMetric
if ('__Dashboard__' i... | 5,721,995,801,095,082,000 | Function to be passed into json.loads obj_hook parameter
Recreates the dashboard object from a json representation. | superset/dashboards/commands/importers/v0.py | decode_dashboards | Jacob-ru/superset | python | def decode_dashboards(o: Dict[(str, Any)]) -> Any:
'\n Function to be passed into json.loads obj_hook parameter\n Recreates the dashboard object from a json representation.\n '
from superset.connectors.druid.models import DruidCluster, DruidColumn, DruidDatasource, DruidMetric
if ('__Dashboard__' i... |
def import_dashboards(session: Session, content: str, database_id: Optional[int]=None, import_time: Optional[int]=None) -> None:
'Imports dashboards from a stream to databases'
current_tt = int(time.time())
import_time = (current_tt if (import_time is None) else import_time)
data = json.loads(content, o... | -3,609,365,525,933,547,500 | Imports dashboards from a stream to databases | superset/dashboards/commands/importers/v0.py | import_dashboards | Jacob-ru/superset | python | def import_dashboards(session: Session, content: str, database_id: Optional[int]=None, import_time: Optional[int]=None) -> None:
current_tt = int(time.time())
import_time = (current_tt if (import_time is None) else import_time)
data = json.loads(content, object_hook=decode_dashboards)
if (not data)... |
def alter_positions(dashboard: Dashboard, old_to_new_slc_id_dict: Dict[(int, int)]) -> None:
'Updates slice_ids in the position json.\n\n Sample position_json data:\n {\n "DASHBOARD_VERSION_KEY": "v2",\n "DASHBOARD_ROOT_ID": {\n "type": "DASHBOARD_ROOT_TYPE",\n ... | -8,558,249,195,208,456,000 | Updates slice_ids in the position json.
Sample position_json data:
{
"DASHBOARD_VERSION_KEY": "v2",
"DASHBOARD_ROOT_ID": {
"type": "DASHBOARD_ROOT_TYPE",
"id": "DASHBOARD_ROOT_ID",
"children": ["DASHBOARD_GRID_ID"]
},
"DASHBOARD_GRID_ID": {
"type": "DASHBOARD_GRID_TYPE",... | superset/dashboards/commands/importers/v0.py | alter_positions | Jacob-ru/superset | python | def alter_positions(dashboard: Dashboard, old_to_new_slc_id_dict: Dict[(int, int)]) -> None:
'Updates slice_ids in the position json.\n\n Sample position_json data:\n {\n "DASHBOARD_VERSION_KEY": "v2",\n "DASHBOARD_ROOT_ID": {\n "type": "DASHBOARD_ROOT_TYPE",\n ... |
def test_no_remote_user(self):
'\n Tests requests where no remote user is specified and insures that no\n users get created.\n '
num_users = User.objects.count()
response = self.client.get('/remote_user/')
self.assertTrue(response.context['user'].is_anonymous())
self.assertEqual... | 1,557,096,168,254,504,400 | Tests requests where no remote user is specified and insures that no
users get created. | django/contrib/auth/tests/test_remote_user.py | test_no_remote_user | 2roy999/django | python | def test_no_remote_user(self):
'\n Tests requests where no remote user is specified and insures that no\n users get created.\n '
num_users = User.objects.count()
response = self.client.get('/remote_user/')
self.assertTrue(response.context['user'].is_anonymous())
self.assertEqual... |
def test_unknown_user(self):
'\n Tests the case where the username passed in the header does not exist\n as a User.\n '
num_users = User.objects.count()
response = self.client.get('/remote_user/', **{self.header: 'newuser'})
self.assertEqual(response.context['user'].username, 'newus... | 8,109,131,588,071,182,000 | Tests the case where the username passed in the header does not exist
as a User. | django/contrib/auth/tests/test_remote_user.py | test_unknown_user | 2roy999/django | python | def test_unknown_user(self):
'\n Tests the case where the username passed in the header does not exist\n as a User.\n '
num_users = User.objects.count()
response = self.client.get('/remote_user/', **{self.header: 'newuser'})
self.assertEqual(response.context['user'].username, 'newus... |
def test_known_user(self):
'\n Tests the case where the username passed in the header is a valid User.\n '
User.objects.create(username='knownuser')
User.objects.create(username='knownuser2')
num_users = User.objects.count()
response = self.client.get('/remote_user/', **{self.header: s... | 4,638,689,453,855,815,000 | Tests the case where the username passed in the header is a valid User. | django/contrib/auth/tests/test_remote_user.py | test_known_user | 2roy999/django | python | def test_known_user(self):
'\n \n '
User.objects.create(username='knownuser')
User.objects.create(username='knownuser2')
num_users = User.objects.count()
response = self.client.get('/remote_user/', **{self.header: self.known_user})
self.assertEqual(response.context['user'].username... |
def test_last_login(self):
"\n Tests that a user's last_login is set the first time they make a\n request but not updated in subsequent requests with the same session.\n "
user = User.objects.create(username='knownuser')
default_login = datetime(2000, 1, 1)
if settings.USE_TZ:
... | -8,229,259,613,211,248,000 | Tests that a user's last_login is set the first time they make a
request but not updated in subsequent requests with the same session. | django/contrib/auth/tests/test_remote_user.py | test_last_login | 2roy999/django | python | def test_last_login(self):
"\n Tests that a user's last_login is set the first time they make a\n request but not updated in subsequent requests with the same session.\n "
user = User.objects.create(username='knownuser')
default_login = datetime(2000, 1, 1)
if settings.USE_TZ:
... |
def test_header_disappears(self):
'\n Tests that a logged in user is logged out automatically when\n the REMOTE_USER header disappears during the same browser session.\n '
User.objects.create(username='knownuser')
response = self.client.get('/remote_user/', **{self.header: self.known_us... | -8,593,508,508,490,221,000 | Tests that a logged in user is logged out automatically when
the REMOTE_USER header disappears during the same browser session. | django/contrib/auth/tests/test_remote_user.py | test_header_disappears | 2roy999/django | python | def test_header_disappears(self):
'\n Tests that a logged in user is logged out automatically when\n the REMOTE_USER header disappears during the same browser session.\n '
User.objects.create(username='knownuser')
response = self.client.get('/remote_user/', **{self.header: self.known_us... |
def test_user_switch_forces_new_login(self):
'\n Tests that if the username in the header changes between requests\n that the original user is logged out\n '
User.objects.create(username='knownuser')
response = self.client.get('/remote_user/', **{self.header: self.known_user})
self.... | -2,446,387,448,705,318,000 | Tests that if the username in the header changes between requests
that the original user is logged out | django/contrib/auth/tests/test_remote_user.py | test_user_switch_forces_new_login | 2roy999/django | python | def test_user_switch_forces_new_login(self):
'\n Tests that if the username in the header changes between requests\n that the original user is logged out\n '
User.objects.create(username='knownuser')
response = self.client.get('/remote_user/', **{self.header: self.known_user})
self.... |
def tearDown(self):
'Restores settings to avoid breaking other tests.'
settings.MIDDLEWARE_CLASSES = self.curr_middleware
settings.AUTHENTICATION_BACKENDS = self.curr_auth | 2,779,914,680,300,292,000 | Restores settings to avoid breaking other tests. | django/contrib/auth/tests/test_remote_user.py | tearDown | 2roy999/django | python | def tearDown(self):
settings.MIDDLEWARE_CLASSES = self.curr_middleware
settings.AUTHENTICATION_BACKENDS = self.curr_auth |
def clean_username(self, username):
'\n Grabs username before the @ character.\n '
return username.split('@')[0] | -2,728,894,029,981,582,300 | Grabs username before the @ character. | django/contrib/auth/tests/test_remote_user.py | clean_username | 2roy999/django | python | def clean_username(self, username):
'\n \n '
return username.split('@')[0] |
def configure_user(self, user):
"\n Sets user's email address.\n "
user.email = 'example@example.com'
user.save()
return user | 7,252,543,219,551,633,000 | Sets user's email address. | django/contrib/auth/tests/test_remote_user.py | configure_user | 2roy999/django | python | def configure_user(self, user):
"\n \n "
user.email = 'example@example.com'
user.save()
return user |
def test_known_user(self):
'\n The strings passed in REMOTE_USER should be cleaned and the known users\n should not have been configured with an email address.\n '
super(RemoteUserCustomTest, self).test_known_user()
self.assertEqual(User.objects.get(username='knownuser').email, '')
... | -7,770,742,196,895,024,000 | The strings passed in REMOTE_USER should be cleaned and the known users
should not have been configured with an email address. | django/contrib/auth/tests/test_remote_user.py | test_known_user | 2roy999/django | python | def test_known_user(self):
'\n The strings passed in REMOTE_USER should be cleaned and the known users\n should not have been configured with an email address.\n '
super(RemoteUserCustomTest, self).test_known_user()
self.assertEqual(User.objects.get(username='knownuser').email, )
se... |
def test_unknown_user(self):
'\n The unknown user created should be configured with an email address.\n '
super(RemoteUserCustomTest, self).test_unknown_user()
newuser = User.objects.get(username='newuser')
self.assertEqual(newuser.email, 'example@example.com') | -3,766,192,825,234,334,000 | The unknown user created should be configured with an email address. | django/contrib/auth/tests/test_remote_user.py | test_unknown_user | 2roy999/django | python | def test_unknown_user(self):
'\n \n '
super(RemoteUserCustomTest, self).test_unknown_user()
newuser = User.objects.get(username='newuser')
self.assertEqual(newuser.email, 'example@example.com') |
def word_freq(self, text) -> dict:
'\n Create document word frequency table {w1:f1, ..., wN:fN}.\n Remove stop words, punct, etc. and lowercase\n :rtype: dict\n '
doc = self.nlp(text)
word_freq_table = {}
for token in doc:
ignore = (token.is_stop or token.is_punct or ... | -1,587,509,888,795,626,500 | Create document word frequency table {w1:f1, ..., wN:fN}.
Remove stop words, punct, etc. and lowercase
:rtype: dict | TextSummarization/TF_IDF.py | word_freq | asehmi/Data-Science-Meetup-Oxford | python | def word_freq(self, text) -> dict:
'\n Create document word frequency table {w1:f1, ..., wN:fN}.\n Remove stop words, punct, etc. and lowercase\n :rtype: dict\n '
doc = self.nlp(text)
word_freq_table = {}
for token in doc:
ignore = (token.is_stop or token.is_punct or ... |
def sent_word_freq(self, text) -> dict:
'\n Create sentence word frequency table {s1:{w1:f1, ..., wN:fN}, ..., sN:{w1:f1, ..., wN:fN} }.\n :rtype: dict\n '
doc = self.nlp(text)
sent_word_freq_table = {}
for sent in doc.sents:
word_freq_table = self.word_freq(sent.lower_)
... | 2,916,962,073,247,642,000 | Create sentence word frequency table {s1:{w1:f1, ..., wN:fN}, ..., sN:{w1:f1, ..., wN:fN} }.
:rtype: dict | TextSummarization/TF_IDF.py | sent_word_freq | asehmi/Data-Science-Meetup-Oxford | python | def sent_word_freq(self, text) -> dict:
'\n Create sentence word frequency table {s1:{w1:f1, ..., wN:fN}, ..., sN:{w1:f1, ..., wN:fN} }.\n :rtype: dict\n '
doc = self.nlp(text)
sent_word_freq_table = {}
for sent in doc.sents:
word_freq_table = self.word_freq(sent.lower_)
... |
def __init__(self, **kwargs):
'\n Initializes a new WorkSubmissionKey object with values from keyword arguments.\n The following keyword arguments are supported (corresponding to the getters/setters of this class):\n\n :param work_submission_key:\n The value to assign to the work_sub... | -7,551,299,056,031,745,000 | Initializes a new WorkSubmissionKey object with values from keyword arguments.
The following keyword arguments are supported (corresponding to the getters/setters of this class):
:param work_submission_key:
The value to assign to the work_submission_key property of this WorkSubmissionKey.
:type work_submission_key... | src/oci/management_agent/models/work_submission_key.py | __init__ | LaudateCorpus1/oci-python-sdk | python | def __init__(self, **kwargs):
'\n Initializes a new WorkSubmissionKey object with values from keyword arguments.\n The following keyword arguments are supported (corresponding to the getters/setters of this class):\n\n :param work_submission_key:\n The value to assign to the work_sub... |
@property
def work_submission_key(self):
'\n **[Required]** Gets the work_submission_key of this WorkSubmissionKey.\n Work Submission Identifier\n\n\n :return: The work_submission_key of this WorkSubmissionKey.\n :rtype: str\n '
return self._work_submission_key | -6,673,513,871,980,366,000 | **[Required]** Gets the work_submission_key of this WorkSubmissionKey.
Work Submission Identifier
:return: The work_submission_key of this WorkSubmissionKey.
:rtype: str | src/oci/management_agent/models/work_submission_key.py | work_submission_key | LaudateCorpus1/oci-python-sdk | python | @property
def work_submission_key(self):
'\n **[Required]** Gets the work_submission_key of this WorkSubmissionKey.\n Work Submission Identifier\n\n\n :return: The work_submission_key of this WorkSubmissionKey.\n :rtype: str\n '
return self._work_submission_key |
@work_submission_key.setter
def work_submission_key(self, work_submission_key):
'\n Sets the work_submission_key of this WorkSubmissionKey.\n Work Submission Identifier\n\n\n :param work_submission_key: The work_submission_key of this WorkSubmissionKey.\n :type: str\n '
self._... | -388,778,358,695,815,200 | Sets the work_submission_key of this WorkSubmissionKey.
Work Submission Identifier
:param work_submission_key: The work_submission_key of this WorkSubmissionKey.
:type: str | src/oci/management_agent/models/work_submission_key.py | work_submission_key | LaudateCorpus1/oci-python-sdk | python | @work_submission_key.setter
def work_submission_key(self, work_submission_key):
'\n Sets the work_submission_key of this WorkSubmissionKey.\n Work Submission Identifier\n\n\n :param work_submission_key: The work_submission_key of this WorkSubmissionKey.\n :type: str\n '
self._... |
def process_request(self, request):
"\n Reads url name, args, kwargs from GET parameters, reverses the url and resolves view function\n Returns the result of resolved view function, called with provided args and kwargs\n Since the view function is called directly, it isn't ran through middlewar... | 8,338,263,217,393,306,000 | Reads url name, args, kwargs from GET parameters, reverses the url and resolves view function
Returns the result of resolved view function, called with provided args and kwargs
Since the view function is called directly, it isn't ran through middlewares, so the middlewares must
be added manually
The final result is exa... | djng/middleware.py | process_request | BluABK/django-angular | python | def process_request(self, request):
"\n Reads url name, args, kwargs from GET parameters, reverses the url and resolves view function\n Returns the result of resolved view function, called with provided args and kwargs\n Since the view function is called directly, it isn't ran through middlewar... |
def test_in_response_to_provided(self):
'\n Test that the process of looking up the previous response\n in the conversation is ignored if a previous response is provided.\n '
self.chatbot.get_response(text='Hello', in_response_to='Unique previous response.')
statement = self.chatbot.sto... | 4,884,029,123,685,717,000 | Test that the process of looking up the previous response
in the conversation is ignored if a previous response is provided. | tests/test_chatbot.py | test_in_response_to_provided | nadimpayak/ChatBot | python | def test_in_response_to_provided(self):
'\n Test that the process of looking up the previous response\n in the conversation is ignored if a previous response is provided.\n '
self.chatbot.get_response(text='Hello', in_response_to='Unique previous response.')
statement = self.chatbot.sto... |
def test_get_initialization_functions(self):
'\n Test that the initialization functions are returned.\n '
functions = self.chatbot.get_initialization_functions()
self.assertIn('download_nltk_stopwords', str(functions))
self.assertIn('download_nltk_wordnet', str(functions))
self.assertI... | 1,874,049,852,437,501,200 | Test that the initialization functions are returned. | tests/test_chatbot.py | test_get_initialization_functions | nadimpayak/ChatBot | python | def test_get_initialization_functions(self):
'\n \n '
functions = self.chatbot.get_initialization_functions()
self.assertIn('download_nltk_stopwords', str(functions))
self.assertIn('download_nltk_wordnet', str(functions))
self.assertIn('download_nltk_averaged_perceptron_tagger', str(fu... |
def test_get_initialization_functions_spacy_similarity(self):
'\n Test that the initialization functions are returned.\n '
from chatterbot.comparisons import spacy_similarity
list(self.chatbot.search_algorithms.values())[0].compare_statements = spacy_similarity
functions = self.chatbot.get... | -3,040,526,968,101,790,700 | Test that the initialization functions are returned. | tests/test_chatbot.py | test_get_initialization_functions_spacy_similarity | nadimpayak/ChatBot | python | def test_get_initialization_functions_spacy_similarity(self):
'\n \n '
from chatterbot.comparisons import spacy_similarity
list(self.chatbot.search_algorithms.values())[0].compare_statements = spacy_similarity
functions = self.chatbot.get_initialization_functions()
self.assertIn('downl... |
def test_get_initialization_functions_jaccard_similarity(self):
'\n Test that the initialization functions are returned.\n '
from chatterbot.comparisons import jaccard_similarity
list(self.chatbot.search_algorithms.values())[0].compare_statements = jaccard_similarity
functions = self.chatb... | 4,063,653,913,070,919,000 | Test that the initialization functions are returned. | tests/test_chatbot.py | test_get_initialization_functions_jaccard_similarity | nadimpayak/ChatBot | python | def test_get_initialization_functions_jaccard_similarity(self):
'\n \n '
from chatterbot.comparisons import jaccard_similarity
list(self.chatbot.search_algorithms.values())[0].compare_statements = jaccard_similarity
functions = self.chatbot.get_initialization_functions()
self.assertIn(... |
def test_no_statements_known(self):
"\n If there is no statements in the database, then the\n user's input is the only thing that can be returned.\n "
statement_text = 'How are you?'
response = self.chatbot.get_response(statement_text)
results = list(self.chatbot.storage.filter(text... | 992,647,802,674,425,900 | If there is no statements in the database, then the
user's input is the only thing that can be returned. | tests/test_chatbot.py | test_no_statements_known | nadimpayak/ChatBot | python | def test_no_statements_known(self):
"\n If there is no statements in the database, then the\n user's input is the only thing that can be returned.\n "
statement_text = 'How are you?'
response = self.chatbot.get_response(statement_text)
results = list(self.chatbot.storage.filter(text... |
def test_one_statement_known_no_response(self):
'\n Test the case where a single statement is known, but\n it is not in response to any other statement.\n '
self.chatbot.storage.create(text='Hello', in_response_to=None)
response = self.chatbot.get_response('Hi')
self.assertEqual(res... | -5,050,156,685,655,720,000 | Test the case where a single statement is known, but
it is not in response to any other statement. | tests/test_chatbot.py | test_one_statement_known_no_response | nadimpayak/ChatBot | python | def test_one_statement_known_no_response(self):
'\n Test the case where a single statement is known, but\n it is not in response to any other statement.\n '
self.chatbot.storage.create(text='Hello', in_response_to=None)
response = self.chatbot.get_response('Hi')
self.assertEqual(res... |
def test_one_statement_one_response_known(self):
'\n Test the case that one response is known and there is a response\n entry for it in the database.\n '
self.chatbot.storage.create(text='Hello', in_response_to='Hi')
response = self.chatbot.get_response('Hi')
self.assertEqual(respon... | 911,156,194,905,935,900 | Test the case that one response is known and there is a response
entry for it in the database. | tests/test_chatbot.py | test_one_statement_one_response_known | nadimpayak/ChatBot | python | def test_one_statement_one_response_known(self):
'\n Test the case that one response is known and there is a response\n entry for it in the database.\n '
self.chatbot.storage.create(text='Hello', in_response_to='Hi')
response = self.chatbot.get_response('Hi')
self.assertEqual(respon... |
def test_two_statements_one_response_known(self):
'\n Test the case that one response is known and there is a response\n entry for it in the database.\n '
self.chatbot.storage.create(text='Hi', in_response_to=None)
self.chatbot.storage.create(text='Hello', in_response_to='Hi')
respo... | 867,824,115,065,216,400 | Test the case that one response is known and there is a response
entry for it in the database. | tests/test_chatbot.py | test_two_statements_one_response_known | nadimpayak/ChatBot | python | def test_two_statements_one_response_known(self):
'\n Test the case that one response is known and there is a response\n entry for it in the database.\n '
self.chatbot.storage.create(text='Hi', in_response_to=None)
self.chatbot.storage.create(text='Hello', in_response_to='Hi')
respo... |
def test_statement_added_to_conversation(self):
'\n An input statement should be added to the recent response list.\n '
statement = Statement(text='Wow!', conversation='test')
response = self.chatbot.get_response(statement)
self.assertEqual(statement.text, response.text)
self.assertEqu... | -7,818,882,938,278,926,000 | An input statement should be added to the recent response list. | tests/test_chatbot.py | test_statement_added_to_conversation | nadimpayak/ChatBot | python | def test_statement_added_to_conversation(self):
'\n \n '
statement = Statement(text='Wow!', conversation='test')
response = self.chatbot.get_response(statement)
self.assertEqual(statement.text, response.text)
self.assertEqual(response.conversation, 'test') |
def test_get_response_unicode(self):
'\n Test the case that a unicode string is passed in.\n '
response = self.chatbot.get_response(u'سلام')
self.assertGreater(len(response.text), 0) | -311,454,113,447,001,600 | Test the case that a unicode string is passed in. | tests/test_chatbot.py | test_get_response_unicode | nadimpayak/ChatBot | python | def test_get_response_unicode(self):
'\n \n '
response = self.chatbot.get_response(u'سلام')
self.assertGreater(len(response.text), 0) |
def test_get_response_emoji(self):
'\n Test the case that the input string contains an emoji.\n '
response = self.chatbot.get_response(u'💩 ')
self.assertGreater(len(response.text), 0) | -1,424,362,772,954,990,300 | Test the case that the input string contains an emoji. | tests/test_chatbot.py | test_get_response_emoji | nadimpayak/ChatBot | python | def test_get_response_emoji(self):
'\n \n '
response = self.chatbot.get_response(u'💩 ')
self.assertGreater(len(response.text), 0) |
def test_get_response_non_whitespace(self):
'\n Test the case that a non-whitespace C1 control string is passed in.\n '
response = self.chatbot.get_response(u'\x80\x81\x8e\x8f\x90\x91\x92')
self.assertGreater(len(response.text), 0) | 3,280,001,702,079,089,700 | Test the case that a non-whitespace C1 control string is passed in. | tests/test_chatbot.py | test_get_response_non_whitespace | nadimpayak/ChatBot | python | def test_get_response_non_whitespace(self):
'\n \n '
response = self.chatbot.get_response(u'\x80\x81\x8e\x8f\x90\x91\x92')
self.assertGreater(len(response.text), 0) |
def test_get_response_two_byte_characters(self):
'\n Test the case that a string containing two-byte characters is passed in.\n '
response = self.chatbot.get_response(u'田中さんにあげて下さい')
self.assertGreater(len(response.text), 0) | 8,807,853,710,064,461,000 | Test the case that a string containing two-byte characters is passed in. | tests/test_chatbot.py | test_get_response_two_byte_characters | nadimpayak/ChatBot | python | def test_get_response_two_byte_characters(self):
'\n \n '
response = self.chatbot.get_response(u'田中さんにあげて下さい')
self.assertGreater(len(response.text), 0) |
def test_get_response_corrupted_text(self):
'\n Test the case that a string contains "corrupted" text.\n '
response = self.chatbot.get_response(u'Ṱ̺̺̕h̼͓̲̦̳̘̲e͇̣̰̦̬͎ ̢̼̻̱̘h͚͎͙̜̣̲ͅi̦̲̣̰̤v̻͍e̺̭̳̪̰-m̢iͅn̖̺̞̲̯̰d̵̼̟͙̩̼̘̳.̨̹͈̣')
self.assertGreater(len(response.text), 0) | 7,761,169,289,263,649,000 | Test the case that a string contains "corrupted" text. | tests/test_chatbot.py | test_get_response_corrupted_text | nadimpayak/ChatBot | python | def test_get_response_corrupted_text(self):
'\n \n '
response = self.chatbot.get_response(u'Ṱ̺̺̕h̼͓̲̦̳̘̲e͇̣̰̦̬͎ ̢̼̻̱̘h͚͎͙̜̣̲ͅi̦̲̣̰̤v̻͍e̺̭̳̪̰-m̢iͅn̖̺̞̲̯̰d̵̼̟͙̩̼̘̳.̨̹͈̣')
self.assertGreater(len(response.text), 0) |
def test_response_with_tags_added(self):
'\n If an input statement has tags added to it,\n that data should saved with the input statement.\n '
self.chatbot.get_response(Statement(text='Hello', in_response_to='Hi', tags=['test']))
results = list(self.chatbot.storage.filter(text='Hello')... | 3,352,653,989,076,648,000 | If an input statement has tags added to it,
that data should saved with the input statement. | tests/test_chatbot.py | test_response_with_tags_added | nadimpayak/ChatBot | python | def test_response_with_tags_added(self):
'\n If an input statement has tags added to it,\n that data should saved with the input statement.\n '
self.chatbot.get_response(Statement(text='Hello', in_response_to='Hi', tags=['test']))
results = list(self.chatbot.storage.filter(text='Hello')... |
def test_get_response_does_not_add_new_statement(self):
'\n Test that a new statement is not learned if `read_only` is set to True.\n '
self.chatbot.read_only = True
self.chatbot.get_response('Hi!')
results = list(self.chatbot.storage.filter(text='Hi!'))
self.assertIsLength(results, 0) | 4,665,780,331,034,966,000 | Test that a new statement is not learned if `read_only` is set to True. | tests/test_chatbot.py | test_get_response_does_not_add_new_statement | nadimpayak/ChatBot | python | def test_get_response_does_not_add_new_statement(self):
'\n \n '
self.chatbot.read_only = True
self.chatbot.get_response('Hi!')
results = list(self.chatbot.storage.filter(text='Hi!'))
self.assertIsLength(results, 0) |
def test_search_text_results_after_training(self):
'\n ChatterBot should return close matches to an input\n string when filtering using the search_text parameter.\n '
self.chatbot.storage.create_many([Statement('Example A for search.'), Statement('Another example.'), Statement('Example B fo... | -2,723,408,850,424,878,000 | ChatterBot should return close matches to an input
string when filtering using the search_text parameter. | tests/test_chatbot.py | test_search_text_results_after_training | nadimpayak/ChatBot | python | def test_search_text_results_after_training(self):
'\n ChatterBot should return close matches to an input\n string when filtering using the search_text parameter.\n '
self.chatbot.storage.create_many([Statement('Example A for search.'), Statement('Another example.'), Statement('Example B fo... |
def test_sub_adapter_agreement(self):
'\n In the case that multiple adapters agree on a given\n statement, this statement should be returned with the\n highest confidence available from these matching options.\n '
self.chatbot.logic_adapters = [TestAdapterA(self.chatbot), TestAdapter... | -4,158,896,709,613,299,000 | In the case that multiple adapters agree on a given
statement, this statement should be returned with the
highest confidence available from these matching options. | tests/test_chatbot.py | test_sub_adapter_agreement | nadimpayak/ChatBot | python | def test_sub_adapter_agreement(self):
'\n In the case that multiple adapters agree on a given\n statement, this statement should be returned with the\n highest confidence available from these matching options.\n '
self.chatbot.logic_adapters = [TestAdapterA(self.chatbot), TestAdapter... |
def test_response_persona_is_bot(self):
'\n The response returned from the chatbot should be set to the name of the chatbot.\n '
response = self.chatbot.get_response('Hey everyone!')
self.assertEqual(response.persona, 'bot:Test Bot') | -1,802,674,394,433,953,000 | The response returned from the chatbot should be set to the name of the chatbot. | tests/test_chatbot.py | test_response_persona_is_bot | nadimpayak/ChatBot | python | def test_response_persona_is_bot(self):
'\n \n '
response = self.chatbot.get_response('Hey everyone!')
self.assertEqual(response.persona, 'bot:Test Bot') |
def bind(self, bus):
'Overrides the default bind method of MycroftSkill.\n\n This registers messagebus handlers for the skill during startup\n but is nothing the skill author needs to consider.\n '
if bus:
super().bind(bus)
self.add_event('question:query', self.__handle_ques... | 7,592,947,664,780,378,000 | Overrides the default bind method of MycroftSkill.
This registers messagebus handlers for the skill during startup
but is nothing the skill author needs to consider. | mycroft/skills/common_query_skill.py | bind | AIIX/mycroft-core | python | def bind(self, bus):
'Overrides the default bind method of MycroftSkill.\n\n This registers messagebus handlers for the skill during startup\n but is nothing the skill author needs to consider.\n '
if bus:
super().bind(bus)
self.add_event('question:query', self.__handle_ques... |
def __handle_query_action(self, message):
'Message handler for question:action.\n\n Extracts phrase and data from message forward this to the skills\n CQS_action method.\n '
if (message.data['skill_id'] != self.skill_id):
return
phrase = message.data['phrase']
data = message... | -4,646,801,660,407,673,000 | Message handler for question:action.
Extracts phrase and data from message forward this to the skills
CQS_action method. | mycroft/skills/common_query_skill.py | __handle_query_action | AIIX/mycroft-core | python | def __handle_query_action(self, message):
'Message handler for question:action.\n\n Extracts phrase and data from message forward this to the skills\n CQS_action method.\n '
if (message.data['skill_id'] != self.skill_id):
return
phrase = message.data['phrase']
data = message... |
@abstractmethod
def CQS_match_query_phrase(self, phrase):
'Analyze phrase to see if it is a play-able phrase with this skill.\n\n Needs to be implemented by the skill.\n\n Arguments:\n phrase (str): User phrase, "What is an aardwark"\n\n Returns:\n (match, CQSMatchLevel[, ... | -7,376,553,259,035,771,000 | Analyze phrase to see if it is a play-able phrase with this skill.
Needs to be implemented by the skill.
Arguments:
phrase (str): User phrase, "What is an aardwark"
Returns:
(match, CQSMatchLevel[, callback_data]) or None: Tuple containing
a string with the appropriate matching phrase, the PlayMatch... | mycroft/skills/common_query_skill.py | CQS_match_query_phrase | AIIX/mycroft-core | python | @abstractmethod
def CQS_match_query_phrase(self, phrase):
'Analyze phrase to see if it is a play-able phrase with this skill.\n\n Needs to be implemented by the skill.\n\n Arguments:\n phrase (str): User phrase, "What is an aardwark"\n\n Returns:\n (match, CQSMatchLevel[, ... |
def CQS_action(self, phrase, data):
'Take additional action IF the skill is selected.\n\n The speech is handled by the common query but if the chosen skill\n wants to display media, set a context or prepare for sending\n information info over e-mail this can be implemented here.\n\n Args... | -7,288,892,319,496,509,000 | Take additional action IF the skill is selected.
The speech is handled by the common query but if the chosen skill
wants to display media, set a context or prepare for sending
information info over e-mail this can be implemented here.
Args:
phrase (str): User phrase uttered after "Play", e.g. "some music"
dat... | mycroft/skills/common_query_skill.py | CQS_action | AIIX/mycroft-core | python | def CQS_action(self, phrase, data):
'Take additional action IF the skill is selected.\n\n The speech is handled by the common query but if the chosen skill\n wants to display media, set a context or prepare for sending\n information info over e-mail this can be implemented here.\n\n Args... |
def test_arraystringreader():
'here is my test code\n\n https://docs.pytest.org/en/stable/getting-started.html#create-your-first-test\n '
size = 8
sample_array = np.random.rand(size).astype('float32')
text = ','.join([str(x) for x in sample_array])
reader = ArrayStringReader()
crafted_doc ... | 2,348,139,695,834,759,000 | here is my test code
https://docs.pytest.org/en/stable/getting-started.html#create-your-first-test | crafters/numeric/ArrayStringReader/tests/test_arraystringreader.py | test_arraystringreader | Gracegrx/jina-hub | python | def test_arraystringreader():
'here is my test code\n\n https://docs.pytest.org/en/stable/getting-started.html#create-your-first-test\n '
size = 8
sample_array = np.random.rand(size).astype('float32')
text = ','.join([str(x) for x in sample_array])
reader = ArrayStringReader()
crafted_doc ... |
def __str__(self):
'\n Recursively print CallStructure\n '
stmt = (('\n' + ('.' * self.construct_id.count('.'))) + ('Struct: %s: %s' % (self.construct_id, self.structureType)))
for struct in self.structureItems:
stmt += struct.__str__()
return stmt | 3,533,402,789,938,992,600 | Recursively print CallStructure | simmbse/structure_item.py | __str__ | tsherburne/ma-simpy | python | def __str__(self):
'\n \n '
stmt = (('\n' + ('.' * self.construct_id.count('.'))) + ('Struct: %s: %s' % (self.construct_id, self.structureType)))
for struct in self.structureItems:
stmt += struct.__str__()
return stmt |
def assertGeneratorRunning(self, gen):
"\n Check that a generator-based coroutine hasn't completed yet.\n\n "
next(gen) | 4,792,557,900,963,074,000 | Check that a generator-based coroutine hasn't completed yet. | tests/utils.py | assertGeneratorRunning | LiaoSteve/websockets | python | def assertGeneratorRunning(self, gen):
"\n \n\n "
next(gen) |
def assertGeneratorReturns(self, gen):
'\n Check that a generator-based coroutine completes and return its value.\n\n '
with self.assertRaises(StopIteration) as raised:
next(gen)
return raised.exception.value | -4,097,259,684,251,606,500 | Check that a generator-based coroutine completes and return its value. | tests/utils.py | assertGeneratorReturns | LiaoSteve/websockets | python | def assertGeneratorReturns(self, gen):
'\n \n\n '
with self.assertRaises(StopIteration) as raised:
next(gen)
return raised.exception.value |
def __init_subclass__(cls, **kwargs):
'\n Convert test coroutines to test functions.\n\n This supports asychronous tests transparently.\n\n '
super().__init_subclass__(**kwargs)
for name in unittest.defaultTestLoader.getTestCaseNames(cls):
test = getattr(cls, name)
if as... | 7,922,361,619,117,970,000 | Convert test coroutines to test functions.
This supports asychronous tests transparently. | tests/utils.py | __init_subclass__ | LiaoSteve/websockets | python | def __init_subclass__(cls, **kwargs):
'\n Convert test coroutines to test functions.\n\n This supports asychronous tests transparently.\n\n '
super().__init_subclass__(**kwargs)
for name in unittest.defaultTestLoader.getTestCaseNames(cls):
test = getattr(cls, name)
if as... |
@staticmethod
def convert_async_to_sync(test):
'\n Convert a test coroutine to a test function.\n\n '
@functools.wraps(test)
def test_func(self, *args, **kwargs):
return self.loop.run_until_complete(test(self, *args, **kwargs))
return test_func | 7,222,491,553,220,178,000 | Convert a test coroutine to a test function. | tests/utils.py | convert_async_to_sync | LiaoSteve/websockets | python | @staticmethod
def convert_async_to_sync(test):
'\n \n\n '
@functools.wraps(test)
def test_func(self, *args, **kwargs):
return self.loop.run_until_complete(test(self, *args, **kwargs))
return test_func |
@contextlib.contextmanager
def assertNoLogs(self, logger='websockets', level=logging.ERROR):
'\n No message is logged on the given logger with at least the given level.\n\n '
with self.assertLogs(logger, level) as logs:
logging.getLogger(logger).log(level, 'dummy')
(yield)
leve... | 5,522,975,056,834,048,000 | No message is logged on the given logger with at least the given level. | tests/utils.py | assertNoLogs | LiaoSteve/websockets | python | @contextlib.contextmanager
def assertNoLogs(self, logger='websockets', level=logging.ERROR):
'\n \n\n '
with self.assertLogs(logger, level) as logs:
logging.getLogger(logger).log(level, 'dummy')
(yield)
level_name = logging.getLevelName(level)
self.assertEqual(logs.output, ... |
def assertDeprecationWarnings(self, recorded_warnings, expected_warnings):
'\n Check recorded deprecation warnings match a list of expected messages.\n\n '
self.assertEqual(len(recorded_warnings), len(expected_warnings))
for (recorded, expected) in zip(recorded_warnings, expected_warnings):
... | 5,966,202,690,485,853,000 | Check recorded deprecation warnings match a list of expected messages. | tests/utils.py | assertDeprecationWarnings | LiaoSteve/websockets | python | def assertDeprecationWarnings(self, recorded_warnings, expected_warnings):
'\n \n\n '
self.assertEqual(len(recorded_warnings), len(expected_warnings))
for (recorded, expected) in zip(recorded_warnings, expected_warnings):
actual = recorded.message
self.assertEqual(str(actual), ... |
@pytest.mark.parametrize('scenario', _generate_test_cases())
def test_decrypt_from_file(scenario):
'Tests decrypt from known good files.'
with open(scenario.ciphertext_filename, 'rb') as infile:
ciphertext = infile.read()
with open(scenario.plaintext_filename, 'rb') as infile:
plaintext = in... | 9,093,568,782,376,092,000 | Tests decrypt from known good files. | test/functional/test_f_xcompat.py | test_decrypt_from_file | alex-chew/aws-encryption-sdk-python | python | @pytest.mark.parametrize('scenario', _generate_test_cases())
def test_decrypt_from_file(scenario):
with open(scenario.ciphertext_filename, 'rb') as infile:
ciphertext = infile.read()
with open(scenario.plaintext_filename, 'rb') as infile:
plaintext = infile.read()
key_provider = StaticS... |
def _get_raw_key(self, key_id):
'Finds a loaded raw key.'
try:
(algorithm, key_bits, padding_algorithm, padding_hash) = key_id.upper().split(b'.', 3)
key_bits = int(key_bits)
key_type = _KEY_TYPES_MAP[algorithm]
wrapping_algorithm = _WRAPPING_ALGORITHM_MAP[algorithm][key_bits][pa... | -7,431,842,842,781,503,000 | Finds a loaded raw key. | test/functional/test_f_xcompat.py | _get_raw_key | alex-chew/aws-encryption-sdk-python | python | def _get_raw_key(self, key_id):
try:
(algorithm, key_bits, padding_algorithm, padding_hash) = key_id.upper().split(b'.', 3)
key_bits = int(key_bits)
key_type = _KEY_TYPES_MAP[algorithm]
wrapping_algorithm = _WRAPPING_ALGORITHM_MAP[algorithm][key_bits][padding_algorithm][padding_... |
@property
def key_id(self):
'Build a key ID from instance parameters.'
return '.'.join([self.encryption_algorithm, str(self.key_bits), self.padding_algorithm, self.padding_hash]) | 2,958,328,642,598,319,600 | Build a key ID from instance parameters. | test/functional/test_f_xcompat.py | key_id | alex-chew/aws-encryption-sdk-python | python | @property
def key_id(self):
return '.'.join([self.encryption_algorithm, str(self.key_bits), self.padding_algorithm, self.padding_hash]) |
def test_dimensions(self):
'\n Tests if the input and output dimensions of the cell are as expected.\n '
cell = LSTM2dCell(self.input_dim, self.cell_state_dim, self.device)
(c_ji, s_ji) = cell.forward(x=self.x_j, s_prev_hor=self.s_prev_hor, s_prev_ver=self.s_prev_ver, c_prev_hor=self.c_prev_ho... | -8,588,840,230,380,694,000 | Tests if the input and output dimensions of the cell are as expected. | test/test_lstm2d_cell.py | test_dimensions | FlorianPfisterer/2D-LSTM-Seq2Seq | python | def test_dimensions(self):
'\n \n '
cell = LSTM2dCell(self.input_dim, self.cell_state_dim, self.device)
(c_ji, s_ji) = cell.forward(x=self.x_j, s_prev_hor=self.s_prev_hor, s_prev_ver=self.s_prev_ver, c_prev_hor=self.c_prev_hor, c_prev_ver=self.c_prev_ver)
c_shape = list(c_ji.shape)
s_s... |
def test_same_over_batch(self):
'\n Tests if the outputs of the cell are the same over the batch if the same input is fed in multiple times.\n '
toy_input_dim = 4
toy_batch_size = 7
toy_state_dim = 3
toy_x = torch.Tensor([1.5, 4.2, 3.1415, 2.71]).expand(toy_batch_size, toy_input_dim)
... | 8,572,458,883,497,263,000 | Tests if the outputs of the cell are the same over the batch if the same input is fed in multiple times. | test/test_lstm2d_cell.py | test_same_over_batch | FlorianPfisterer/2D-LSTM-Seq2Seq | python | def test_same_over_batch(self):
'\n \n '
toy_input_dim = 4
toy_batch_size = 7
toy_state_dim = 3
toy_x = torch.Tensor([1.5, 4.2, 3.1415, 2.71]).expand(toy_batch_size, toy_input_dim)
toy_s_prev_hor = torch.Tensor([(- 0.4), 1.2, 42.195]).expand(toy_batch_size, toy_state_dim)
toy_s... |
def rnnt_decoder_predictions_tensor(self, encoder_output: torch.Tensor, encoded_lengths: torch.Tensor, return_hypotheses: bool=False) -> (List[str], Optional[List[List[str]]], Optional[Union[(Hypothesis, NBestHypotheses)]]):
'\n Decode an encoder output by autoregressive decoding of the Decoder+Joint network... | 5,355,723,997,895,747,000 | Decode an encoder output by autoregressive decoding of the Decoder+Joint networks.
Args:
encoder_output: torch.Tensor of shape [B, D, T].
encoded_lengths: torch.Tensor containing lengths of the padded encoder outputs. Shape [B].
return_hypotheses: bool. If set to True it will return list of Hypothesis or N... | nemo/collections/asr/metrics/rnnt_wer.py | rnnt_decoder_predictions_tensor | JINHXu/NeMo | python | def rnnt_decoder_predictions_tensor(self, encoder_output: torch.Tensor, encoded_lengths: torch.Tensor, return_hypotheses: bool=False) -> (List[str], Optional[List[List[str]]], Optional[Union[(Hypothesis, NBestHypotheses)]]):
'\n Decode an encoder output by autoregressive decoding of the Decoder+Joint network... |
def decode_hypothesis(self, hypotheses_list: List[Hypothesis]) -> List[Union[(Hypothesis, NBestHypotheses)]]:
'\n Decode a list of hypotheses into a list of strings.\n\n Args:\n hypotheses_list: List of Hypothesis.\n\n Returns:\n A list of strings.\n '
for ind i... | 1,439,692,469,110,841,900 | Decode a list of hypotheses into a list of strings.
Args:
hypotheses_list: List of Hypothesis.
Returns:
A list of strings. | nemo/collections/asr/metrics/rnnt_wer.py | decode_hypothesis | JINHXu/NeMo | python | def decode_hypothesis(self, hypotheses_list: List[Hypothesis]) -> List[Union[(Hypothesis, NBestHypotheses)]]:
'\n Decode a list of hypotheses into a list of strings.\n\n Args:\n hypotheses_list: List of Hypothesis.\n\n Returns:\n A list of strings.\n '
for ind i... |
@abstractmethod
def decode_tokens_to_str(self, tokens: List[int]) -> str:
'\n Implemented by subclass in order to decoder a token id list into a string.\n\n Args:\n tokens: List of int representing the token ids.\n\n Returns:\n A decoded string.\n '
raise NotImp... | 592,417,000,429,037,200 | Implemented by subclass in order to decoder a token id list into a string.
Args:
tokens: List of int representing the token ids.
Returns:
A decoded string. | nemo/collections/asr/metrics/rnnt_wer.py | decode_tokens_to_str | JINHXu/NeMo | python | @abstractmethod
def decode_tokens_to_str(self, tokens: List[int]) -> str:
'\n Implemented by subclass in order to decoder a token id list into a string.\n\n Args:\n tokens: List of int representing the token ids.\n\n Returns:\n A decoded string.\n '
raise NotImp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.