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 |
|---|---|---|---|---|---|---|---|
@override_settings(DEV=True)
def test_fx_dev_browser_36_0_a2(self, render_mock):
'Should use dev browser firstrun template for 36.0a2'
req = self.rf.get('/en-US/firefox/tour/')
self.view(req, version='36.0a2')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/dev-firstrun.html']) | -6,082,857,057,709,693,000 | Should use dev browser firstrun template for 36.0a2 | bedrock/firefox/tests/test_base.py | test_fx_dev_browser_36_0_a2 | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_dev_browser_36_0_a2(self, render_mock):
req = self.rf.get('/en-US/firefox/tour/')
self.view(req, version='36.0a2')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/dev-firstrun.html']) |
@override_settings(DEV=True)
def test_fx_dev_browser_34_0_a2(self, render_mock):
'Should use standard firstrun template for older aurora'
req = self.rf.get('/en-US/firefox/tour/')
self.view(req, version='34.0a2')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/help-menu-tour... | 3,963,251,421,227,757,600 | Should use standard firstrun template for older aurora | bedrock/firefox/tests/test_base.py | test_fx_dev_browser_34_0_a2 | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_dev_browser_34_0_a2(self, render_mock):
req = self.rf.get('/en-US/firefox/tour/')
self.view(req, version='34.0a2')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/help-menu-tour.html']) |
@override_settings(DEV=True)
def test_fx_search_tour_34_0(self, render_mock):
'Should use search tour template for 34.0'
req = self.rf.get('/en-US/firefox/tour/')
self.view(req, version='34.0')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/help-menu-34-tour.html']) | 597,794,562,570,242,400 | Should use search tour template for 34.0 | bedrock/firefox/tests/test_base.py | test_fx_search_tour_34_0 | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_search_tour_34_0(self, render_mock):
req = self.rf.get('/en-US/firefox/tour/')
self.view(req, version='34.0')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/help-menu-34-tour.html']) |
@override_settings(DEV=True)
def test_fx_search_tour_34_0_5(self, render_mock):
'Should use search tour template for 34.0.5'
req = self.rf.get('/en-US/firefox/tour/')
self.view(req, version='34.0.5')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/help-menu-34-tour.html']) | -1,516,847,940,988,662,300 | Should use search tour template for 34.0.5 | bedrock/firefox/tests/test_base.py | test_fx_search_tour_34_0_5 | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_search_tour_34_0_5(self, render_mock):
req = self.rf.get('/en-US/firefox/tour/')
self.view(req, version='34.0.5')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/help-menu-34-tour.html']) |
@override_settings(DEV=True)
def test_fx_search_tour_34_0_locales(self, render_mock):
'Should use australis template for 34.0 non en-US locales'
req = self.rf.get('/en-US/firefox/tour/')
req.locale = 'de'
self.view(req, version='34.0')
template = render_mock.call_args[0][1]
eq_(template, ['firef... | -147,627,887,027,707,520 | Should use australis template for 34.0 non en-US locales | bedrock/firefox/tests/test_base.py | test_fx_search_tour_34_0_locales | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_search_tour_34_0_locales(self, render_mock):
req = self.rf.get('/en-US/firefox/tour/')
req.locale = 'de'
self.view(req, version='34.0')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/help-menu-tour.html']) |
@override_settings(DEV=False)
def test_fx_australis_secure_redirect(self, render_mock):
'Should redirect to https'
url = '/en-US/firefox/tour/'
req = self.rf.get(url)
with patch.object(req, 'is_secure', return_value=False):
resp = self.view(req, version='29.0')
eq_(resp['location'], ('https:... | 6,487,019,531,341,117,000 | Should redirect to https | bedrock/firefox/tests/test_base.py | test_fx_australis_secure_redirect | MozFux/bedrock | python | @override_settings(DEV=False)
def test_fx_australis_secure_redirect(self, render_mock):
url = '/en-US/firefox/tour/'
req = self.rf.get(url)
with patch.object(req, 'is_secure', return_value=False):
resp = self.view(req, version='29.0')
eq_(resp['location'], ('https://testserver' + url)) |
@override_settings(DEV=True)
def test_fx_australis_secure_redirect_not_dev(self, render_mock):
'Should not redirect to https: in DEV mode.'
url = '/en-US/firefox/tour/'
req = self.rf.get(url)
with patch.object(req, 'is_secure', return_value=False):
resp = self.view(req, version='29.0')
eq_(r... | -1,218,235,115,904,298,800 | Should not redirect to https: in DEV mode. | bedrock/firefox/tests/test_base.py | test_fx_australis_secure_redirect_not_dev | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_australis_secure_redirect_not_dev(self, render_mock):
url = '/en-US/firefox/tour/'
req = self.rf.get(url)
with patch.object(req, 'is_secure', return_value=False):
resp = self.view(req, version='29.0')
eq_(resp.status_code, 200) |
@override_settings(DEV=True)
def test_fx_australis_secure_redirect_secure(self, render_mock):
'Should not redirect to https: when already secure.'
url = '/en-US/firefox/tour/'
req = self.rf.get(url)
with patch.object(req, 'is_secure', return_value=True):
resp = self.view(req, version='29.0')
... | 8,461,759,121,701,641,000 | Should not redirect to https: when already secure. | bedrock/firefox/tests/test_base.py | test_fx_australis_secure_redirect_secure | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_australis_secure_redirect_secure(self, render_mock):
url = '/en-US/firefox/tour/'
req = self.rf.get(url)
with patch.object(req, 'is_secure', return_value=True):
resp = self.view(req, version='29.0')
eq_(resp.status_code, 200) |
@override_settings(DEV=True)
def test_can_post(self, render_mock):
'Home page must accept post for newsletter signup.'
req = self.rf.post('/en-US/firefox/firstrun/')
self.view(req)
render_mock.assert_called_once_with(req, ['firefox/australis/firstrun-tour.html'], ANY) | -5,104,610,902,209,316,000 | Home page must accept post for newsletter signup. | bedrock/firefox/tests/test_base.py | test_can_post | MozFux/bedrock | python | @override_settings(DEV=True)
def test_can_post(self, render_mock):
req = self.rf.post('/en-US/firefox/firstrun/')
self.view(req)
render_mock.assert_called_once_with(req, ['firefox/australis/firstrun-tour.html'], ANY) |
@override_settings(DEV=True)
def test_fx_australis_29(self, render_mock):
'Should use firstrun tour template'
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='29.0')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/firstrun-tour.html']) | 178,032,531,148,716,450 | Should use firstrun tour template | bedrock/firefox/tests/test_base.py | test_fx_australis_29 | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_australis_29(self, render_mock):
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='29.0')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/firstrun-tour.html']) |
@override_settings(DEV=True)
def test_fx_dev_browser_35_0_a2(self, render_mock):
'Should use dev browser firstrun template for 35.0a2'
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='35.0a2')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/dev-firstrun.html']) | 7,794,727,572,872,333,000 | Should use dev browser firstrun template for 35.0a2 | bedrock/firefox/tests/test_base.py | test_fx_dev_browser_35_0_a2 | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_dev_browser_35_0_a2(self, render_mock):
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='35.0a2')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/dev-firstrun.html']) |
@override_settings(DEV=True)
def test_fx_dev_browser_35_1_a2(self, render_mock):
'Should use dev browser firstrun template for 35.1a2'
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='35.1a2')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/dev-firstrun.html']) | 4,322,405,846,441,060,000 | Should use dev browser firstrun template for 35.1a2 | bedrock/firefox/tests/test_base.py | test_fx_dev_browser_35_1_a2 | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_dev_browser_35_1_a2(self, render_mock):
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='35.1a2')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/dev-firstrun.html']) |
@override_settings(DEV=True)
def test_fx_dev_browser_36_0_a2(self, render_mock):
'Should use dev browser firstrun template for 36.0a2'
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='36.0a2')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/dev-firstrun.html']) | -873,573,943,611,264,300 | Should use dev browser firstrun template for 36.0a2 | bedrock/firefox/tests/test_base.py | test_fx_dev_browser_36_0_a2 | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_dev_browser_36_0_a2(self, render_mock):
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='36.0a2')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/dev-firstrun.html']) |
@override_settings(DEV=True)
def test_fx_dev_browser_34_0_a2(self, render_mock):
'Should use standard firstrun template for older aurora'
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='34.0a2')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/firstrun-t... | 7,913,842,625,163,997,000 | Should use standard firstrun template for older aurora | bedrock/firefox/tests/test_base.py | test_fx_dev_browser_34_0_a2 | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_dev_browser_34_0_a2(self, render_mock):
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='34.0a2')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/firstrun-tour.html']) |
@override_settings(DEV=True)
def test_fx_search_tour_34_0(self, render_mock):
'Should use search tour template for 34.0'
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='34.0')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/firstrun-34-tour.html']) | -2,371,753,744,900,670,500 | Should use search tour template for 34.0 | bedrock/firefox/tests/test_base.py | test_fx_search_tour_34_0 | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_search_tour_34_0(self, render_mock):
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='34.0')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/firstrun-34-tour.html']) |
@override_settings(DEV=True)
def test_fx_search_tour_34_0_5(self, render_mock):
'Should use search tour template for 34.0.5'
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='34.0.5')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/firstrun-34-tour.html']... | 6,636,234,812,839,590,000 | Should use search tour template for 34.0.5 | bedrock/firefox/tests/test_base.py | test_fx_search_tour_34_0_5 | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_search_tour_34_0_5(self, render_mock):
req = self.rf.get('/en-US/firefox/firstrun/')
self.view(req, version='34.0.5')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/firstrun-34-tour.html']) |
@override_settings(DEV=True)
def test_fx_search_tour_34_0_locales(self, render_mock):
'Should use australis template for 34.0 non en-US locales'
req = self.rf.get('/en-US/firefox/firstrun/')
req.locale = 'de'
self.view(req, version='34.0')
template = render_mock.call_args[0][1]
eq_(template, ['f... | -3,163,513,675,798,710,000 | Should use australis template for 34.0 non en-US locales | bedrock/firefox/tests/test_base.py | test_fx_search_tour_34_0_locales | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_search_tour_34_0_locales(self, render_mock):
req = self.rf.get('/en-US/firefox/firstrun/')
req.locale = 'de'
self.view(req, version='34.0')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/firstrun-tour.html']) |
@override_settings(DEV=False)
def test_fx_australis_secure_redirect(self, render_mock):
'Should redirect to https:'
url = '/en-US/firefox/firstrun/'
req = self.rf.get(url)
with patch.object(req, 'is_secure', return_value=False):
resp = self.view(req, version='29.0')
eq_(resp['location'], ('h... | -2,393,300,253,933,957,600 | Should redirect to https: | bedrock/firefox/tests/test_base.py | test_fx_australis_secure_redirect | MozFux/bedrock | python | @override_settings(DEV=False)
def test_fx_australis_secure_redirect(self, render_mock):
url = '/en-US/firefox/firstrun/'
req = self.rf.get(url)
with patch.object(req, 'is_secure', return_value=False):
resp = self.view(req, version='29.0')
eq_(resp['location'], ('https://testserver' + url)) |
@override_settings(DEV=True)
def test_fx_australis_secure_redirect_not_dev(self, render_mock):
'Should not redirect to https: in DEV mode.'
url = '/en-US/firefox/firstrun/'
req = self.rf.get(url)
with patch.object(req, 'is_secure', return_value=False):
resp = self.view(req, version='29.0')
e... | -5,515,797,027,378,008,000 | Should not redirect to https: in DEV mode. | bedrock/firefox/tests/test_base.py | test_fx_australis_secure_redirect_not_dev | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_australis_secure_redirect_not_dev(self, render_mock):
url = '/en-US/firefox/firstrun/'
req = self.rf.get(url)
with patch.object(req, 'is_secure', return_value=False):
resp = self.view(req, version='29.0')
eq_(resp.status_code, 200) |
@override_settings(DEV=True)
def test_fx_australis_secure_redirect_secure(self, render_mock):
'Should not redirect to https: when already secure.'
url = '/en-US/firefox/firstrun/'
req = self.rf.get(url)
with patch.object(req, 'is_secure', return_value=True):
resp = self.view(req, version='29.0')... | 8,509,083,562,283,158,000 | Should not redirect to https: when already secure. | bedrock/firefox/tests/test_base.py | test_fx_australis_secure_redirect_secure | MozFux/bedrock | python | @override_settings(DEV=True)
def test_fx_australis_secure_redirect_secure(self, render_mock):
url = '/en-US/firefox/firstrun/'
req = self.rf.get(url)
with patch.object(req, 'is_secure', return_value=True):
resp = self.view(req, version='29.0')
eq_(resp.status_code, 200) |
def test_non_firefox(self):
'\n Any non-Firefox user agents should be permanently redirected to\n /firefox/new/.\n '
user_agent = 'random'
self.assert_ua_redirects_to(user_agent, 'firefox.new') | 7,932,674,574,691,870,000 | Any non-Firefox user agents should be permanently redirected to
/firefox/new/. | bedrock/firefox/tests/test_base.py | test_non_firefox | MozFux/bedrock | python | def test_non_firefox(self):
'\n Any non-Firefox user agents should be permanently redirected to\n /firefox/new/.\n '
user_agent = 'random'
self.assert_ua_redirects_to(user_agent, 'firefox.new') |
@override_settings(DEV=True)
@patch.dict(product_details.firefox_versions, LATEST_FIREFOX_VERSION='13.0.5')
@patch('bedrock.mozorg.helpers.download_buttons.latest_version', return_value=('13.0.5', GOOD_PLATS))
def test_current_minor_version_firefox(self, latest_mock):
'\n Should show current even if behind b... | -2,307,934,918,529,319,400 | Should show current even if behind by a patch version | bedrock/firefox/tests/test_base.py | test_current_minor_version_firefox | MozFux/bedrock | python | @override_settings(DEV=True)
@patch.dict(product_details.firefox_versions, LATEST_FIREFOX_VERSION='13.0.5')
@patch('bedrock.mozorg.helpers.download_buttons.latest_version', return_value=('13.0.5', GOOD_PLATS))
def test_current_minor_version_firefox(self, latest_mock):
'\n \n '
user_agent = 'Mozill... |
@override_settings(DEV=True)
@patch.dict(product_details.firefox_versions, LATEST_FIREFOX_VERSION='25.0', FIREFOX_ESR='24.1')
@patch('bedrock.mozorg.helpers.download_buttons.latest_version', return_value=('25.0', GOOD_PLATS))
def test_esr_firefox(self, latest_mock):
'\n Currently released ESR firefoxen shoul... | -1,867,156,132,769,996,800 | Currently released ESR firefoxen should not redirect. At present
that is 24.0.x. | bedrock/firefox/tests/test_base.py | test_esr_firefox | MozFux/bedrock | python | @override_settings(DEV=True)
@patch.dict(product_details.firefox_versions, LATEST_FIREFOX_VERSION='25.0', FIREFOX_ESR='24.1')
@patch('bedrock.mozorg.helpers.download_buttons.latest_version', return_value=('25.0', GOOD_PLATS))
def test_esr_firefox(self, latest_mock):
'\n Currently released ESR firefoxen shoul... |
@override_settings(DEV=True)
@patch.dict(product_details.firefox_versions, LATEST_FIREFOX_VERSION='16.0')
@patch('bedrock.mozorg.helpers.download_buttons.latest_version', return_value=('16.0', GOOD_PLATS))
def test_current_firefox(self, latest_mock):
'\n Currently released firefoxen should not redirect.\n ... | 438,300,697,182,293,600 | Currently released firefoxen should not redirect. | bedrock/firefox/tests/test_base.py | test_current_firefox | MozFux/bedrock | python | @override_settings(DEV=True)
@patch.dict(product_details.firefox_versions, LATEST_FIREFOX_VERSION='16.0')
@patch('bedrock.mozorg.helpers.download_buttons.latest_version', return_value=('16.0', GOOD_PLATS))
def test_current_firefox(self, latest_mock):
'\n \n '
user_agent = 'Mozilla/5.0 (Macintosh; ... |
@override_settings(DEV=True)
@patch.dict(product_details.firefox_versions, LATEST_FIREFOX_VERSION='16.0')
@patch('bedrock.mozorg.helpers.download_buttons.latest_version', return_value=('16.0', GOOD_PLATS))
def test_future_firefox(self, latest_mock):
'\n Pre-release firefoxen should not redirect.\n '
... | 6,772,237,399,750,246,000 | Pre-release firefoxen should not redirect. | bedrock/firefox/tests/test_base.py | test_future_firefox | MozFux/bedrock | python | @override_settings(DEV=True)
@patch.dict(product_details.firefox_versions, LATEST_FIREFOX_VERSION='16.0')
@patch('bedrock.mozorg.helpers.download_buttons.latest_version', return_value=('16.0', GOOD_PLATS))
def test_future_firefox(self, latest_mock):
'\n \n '
user_agent = 'Mozilla/5.0 (Macintosh; I... |
@override_settings(DEV=True)
@patch.dict(product_details.firefox_versions, LATEST_FIREFOX_VERSION='16.0')
def test_whatsnew_tour_oldversion(self):
'Should not show tour if upgrading from 33.1 onwards.'
response = self.client.get((self.url + '?oldversion=28.0'), HTTP_USER_AGENT=self.user_agent)
self.assertIn... | 3,527,238,019,798,652,400 | Should not show tour if upgrading from 33.1 onwards. | bedrock/firefox/tests/test_base.py | test_whatsnew_tour_oldversion | MozFux/bedrock | python | @override_settings(DEV=True)
@patch.dict(product_details.firefox_versions, LATEST_FIREFOX_VERSION='16.0')
def test_whatsnew_tour_oldversion(self):
response = self.client.get((self.url + '?oldversion=28.0'), HTTP_USER_AGENT=self.user_agent)
self.assertIn(self.expected, response.content)
response = self.... |
@override_settings(DEV=True)
@patch.dict(product_details.firefox_versions, LATEST_FIREFOX_VERSION='16.0')
def test_whatsnew_search_tour_oldversion(self):
'Should not show tour if upgrading from 34.0 onwards.'
self.url = reverse('firefox.whatsnew', args=['34.1'])
response = self.client.get((self.url + '?oldv... | 3,656,918,458,974,156,300 | Should not show tour if upgrading from 34.0 onwards. | bedrock/firefox/tests/test_base.py | test_whatsnew_search_tour_oldversion | MozFux/bedrock | python | @override_settings(DEV=True)
@patch.dict(product_details.firefox_versions, LATEST_FIREFOX_VERSION='16.0')
def test_whatsnew_search_tour_oldversion(self):
self.url = reverse('firefox.whatsnew', args=['34.1'])
response = self.client.get((self.url + '?oldversion=28.0'), HTTP_USER_AGENT=self.user_agent)
se... |
def calculate_statistics(Y_hat, Y, beta=1, average=None):
"\n\tCalculate the precisions, recalls, F-beta scores, and\n\tsupports for each class in `targets`.\n\n\tParameters\n\t----------\n\tY_hat : array-like, shape=(n_samples,)\n\t\tList of data labels.\n\n\tY : array-like, shape=(n_samples,)\n\t\tList of target ... | 492,335,461,752,231,600 | Calculate the precisions, recalls, F-beta scores, and
supports for each class in `targets`.
Parameters
----------
Y_hat : array-like, shape=(n_samples,)
List of data labels.
Y : array-like, shape=(n_samples,)
List of target truth labels.
beta : float, default=1
Strength of recall relative to ... | sleepens/analysis/_report.py | calculate_statistics | paradoxysm/sleepens | python | def calculate_statistics(Y_hat, Y, beta=1, average=None):
"\n\tCalculate the precisions, recalls, F-beta scores, and\n\tsupports for each class in `targets`.\n\n\tParameters\n\t----------\n\tY_hat : array-like, shape=(n_samples,)\n\t\tList of data labels.\n\n\tY : array-like, shape=(n_samples,)\n\t\tList of target ... |
def classification_report(Y_hat, Y, beta=1):
"\n\tCreate a report on classification statistics.\n\n\tParameters\n\t----------\n\tY_hat : array-like, shape=(n_samples,)\n\t\tList of data labels.\n\n\tY : array-like, shape=(n_samples,)\n\t\tList of target truth labels.\n\n\tbeta : float, default=1\n\t\tStrength of re... | -4,029,619,413,932,635,000 | Create a report on classification statistics.
Parameters
----------
Y_hat : array-like, shape=(n_samples,)
List of data labels.
Y : array-like, shape=(n_samples,)
List of target truth labels.
beta : float, default=1
Strength of recall relative to precision in the F-score.
Returns
-------
rep... | sleepens/analysis/_report.py | classification_report | paradoxysm/sleepens | python | def classification_report(Y_hat, Y, beta=1):
"\n\tCreate a report on classification statistics.\n\n\tParameters\n\t----------\n\tY_hat : array-like, shape=(n_samples,)\n\t\tList of data labels.\n\n\tY : array-like, shape=(n_samples,)\n\t\tList of target truth labels.\n\n\tbeta : float, default=1\n\t\tStrength of re... |
def conv_forward_im2col(x, w, b, conv_param):
'\n A fast implementation of the forward pass for a convolutional layer\n based on im2col and col2im.\n '
(N, C, H, W) = x.shape
(num_filters, _, filter_height, filter_width) = w.shape
(stride, pad) = (conv_param['stride'], conv_param['pad'])
assert (... | -9,140,524,359,592,905,000 | A fast implementation of the forward pass for a convolutional layer
based on im2col and col2im. | 2016winter/assignment2/cs231n/fast_layers.py | conv_forward_im2col | anandsaha/cs231n.assignments | python | def conv_forward_im2col(x, w, b, conv_param):
'\n A fast implementation of the forward pass for a convolutional layer\n based on im2col and col2im.\n '
(N, C, H, W) = x.shape
(num_filters, _, filter_height, filter_width) = w.shape
(stride, pad) = (conv_param['stride'], conv_param['pad'])
assert (... |
def conv_backward_im2col(dout, cache):
'\n A fast implementation of the backward pass for a convolutional layer\n based on im2col and col2im.\n '
(x, w, b, conv_param, x_cols) = cache
(stride, pad) = (conv_param['stride'], conv_param['pad'])
db = np.sum(dout, axis=(0, 2, 3))
(num_filters, _, filt... | 6,272,160,090,445,658,000 | A fast implementation of the backward pass for a convolutional layer
based on im2col and col2im. | 2016winter/assignment2/cs231n/fast_layers.py | conv_backward_im2col | anandsaha/cs231n.assignments | python | def conv_backward_im2col(dout, cache):
'\n A fast implementation of the backward pass for a convolutional layer\n based on im2col and col2im.\n '
(x, w, b, conv_param, x_cols) = cache
(stride, pad) = (conv_param['stride'], conv_param['pad'])
db = np.sum(dout, axis=(0, 2, 3))
(num_filters, _, filt... |
def max_pool_forward_fast(x, pool_param):
'\n A fast implementation of the forward pass for a max pooling layer.\n\n This chooses between the reshape method and the im2col method. If the pooling\n regions are square and tile the input image, then we can use the reshape\n method which is very fast. Otherwise we ... | 7,199,667,716,231,183,000 | A fast implementation of the forward pass for a max pooling layer.
This chooses between the reshape method and the im2col method. If the pooling
regions are square and tile the input image, then we can use the reshape
method which is very fast. Otherwise we fall back on the im2col method, which
is not much faster than... | 2016winter/assignment2/cs231n/fast_layers.py | max_pool_forward_fast | anandsaha/cs231n.assignments | python | def max_pool_forward_fast(x, pool_param):
'\n A fast implementation of the forward pass for a max pooling layer.\n\n This chooses between the reshape method and the im2col method. If the pooling\n regions are square and tile the input image, then we can use the reshape\n method which is very fast. Otherwise we ... |
def max_pool_backward_fast(dout, cache):
'\n A fast implementation of the backward pass for a max pooling layer.\n\n This switches between the reshape method an the im2col method depending on\n which method was used to generate the cache.\n '
(method, real_cache) = cache
if (method == 'reshape'):
... | 2,514,422,792,829,799,400 | A fast implementation of the backward pass for a max pooling layer.
This switches between the reshape method an the im2col method depending on
which method was used to generate the cache. | 2016winter/assignment2/cs231n/fast_layers.py | max_pool_backward_fast | anandsaha/cs231n.assignments | python | def max_pool_backward_fast(dout, cache):
'\n A fast implementation of the backward pass for a max pooling layer.\n\n This switches between the reshape method an the im2col method depending on\n which method was used to generate the cache.\n '
(method, real_cache) = cache
if (method == 'reshape'):
... |
def max_pool_forward_reshape(x, pool_param):
'\n A fast implementation of the forward pass for the max pooling layer that uses\n some clever reshaping.\n\n This can only be used for square pooling regions that tile the input.\n '
(N, C, H, W) = x.shape
(pool_height, pool_width) = (pool_param['pool_heigh... | 1,881,753,171,530,993,200 | A fast implementation of the forward pass for the max pooling layer that uses
some clever reshaping.
This can only be used for square pooling regions that tile the input. | 2016winter/assignment2/cs231n/fast_layers.py | max_pool_forward_reshape | anandsaha/cs231n.assignments | python | def max_pool_forward_reshape(x, pool_param):
'\n A fast implementation of the forward pass for the max pooling layer that uses\n some clever reshaping.\n\n This can only be used for square pooling regions that tile the input.\n '
(N, C, H, W) = x.shape
(pool_height, pool_width) = (pool_param['pool_heigh... |
def max_pool_backward_reshape(dout, cache):
"\n A fast implementation of the backward pass for the max pooling layer that\n uses some clever broadcasting and reshaping.\n\n This can only be used if the forward pass was computed using\n max_pool_forward_reshape.\n\n NOTE: If there are multiple argmaxes, this me... | 3,009,217,698,752,915,000 | A fast implementation of the backward pass for the max pooling layer that
uses some clever broadcasting and reshaping.
This can only be used if the forward pass was computed using
max_pool_forward_reshape.
NOTE: If there are multiple argmaxes, this method will assign gradient to
ALL argmax elements of the input rathe... | 2016winter/assignment2/cs231n/fast_layers.py | max_pool_backward_reshape | anandsaha/cs231n.assignments | python | def max_pool_backward_reshape(dout, cache):
"\n A fast implementation of the backward pass for the max pooling layer that\n uses some clever broadcasting and reshaping.\n\n This can only be used if the forward pass was computed using\n max_pool_forward_reshape.\n\n NOTE: If there are multiple argmaxes, this me... |
def max_pool_forward_im2col(x, pool_param):
"\n An implementation of the forward pass for max pooling based on im2col.\n\n This isn't much faster than the naive version, so it should be avoided if\n possible.\n "
(N, C, H, W) = x.shape
(pool_height, pool_width) = (pool_param['pool_height'], pool_param['... | -5,186,576,365,797,148,000 | An implementation of the forward pass for max pooling based on im2col.
This isn't much faster than the naive version, so it should be avoided if
possible. | 2016winter/assignment2/cs231n/fast_layers.py | max_pool_forward_im2col | anandsaha/cs231n.assignments | python | def max_pool_forward_im2col(x, pool_param):
"\n An implementation of the forward pass for max pooling based on im2col.\n\n This isn't much faster than the naive version, so it should be avoided if\n possible.\n "
(N, C, H, W) = x.shape
(pool_height, pool_width) = (pool_param['pool_height'], pool_param['... |
def max_pool_backward_im2col(dout, cache):
"\n An implementation of the backward pass for max pooling based on im2col.\n\n This isn't much faster than the naive version, so it should be avoided if\n possible.\n "
(x, x_cols, x_cols_argmax, pool_param) = cache
(N, C, H, W) = x.shape
(pool_height, poo... | 8,171,853,346,095,398,000 | An implementation of the backward pass for max pooling based on im2col.
This isn't much faster than the naive version, so it should be avoided if
possible. | 2016winter/assignment2/cs231n/fast_layers.py | max_pool_backward_im2col | anandsaha/cs231n.assignments | python | def max_pool_backward_im2col(dout, cache):
"\n An implementation of the backward pass for max pooling based on im2col.\n\n This isn't much faster than the naive version, so it should be avoided if\n possible.\n "
(x, x_cols, x_cols_argmax, pool_param) = cache
(N, C, H, W) = x.shape
(pool_height, poo... |
def _deserialize_session_json(serialized_json_str: bytes) -> str:
'\n Helper function to deserialize sessiond:sessions hash list values\n :param serialized_json_str\n '
res = _deserialize_generic_json(str(serialized_json_str, 'utf-8', 'ignore'))
dumped = json.dumps(res, indent=2, sort_keys=True)
... | -1,428,529,131,481,541,400 | Helper function to deserialize sessiond:sessions hash list values
:param serialized_json_str | lte/gateway/python/scripts/state_cli.py | _deserialize_session_json | Rajpratik71/magma | python | def _deserialize_session_json(serialized_json_str: bytes) -> str:
'\n Helper function to deserialize sessiond:sessions hash list values\n :param serialized_json_str\n '
res = _deserialize_generic_json(str(serialized_json_str, 'utf-8', 'ignore'))
dumped = json.dumps(res, indent=2, sort_keys=True)
... |
def _deserialize_generic_json(element: Union[(str, dict, list)]) -> Union[(str, dict, list)]:
'\n Helper function to deserialize dictionaries or list with nested\n json strings\n :param element\n '
if isinstance(element, str):
try:
element = ast.literal_eval(element)
exce... | -6,177,858,682,929,662,000 | Helper function to deserialize dictionaries or list with nested
json strings
:param element | lte/gateway/python/scripts/state_cli.py | _deserialize_generic_json | Rajpratik71/magma | python | def _deserialize_generic_json(element: Union[(str, dict, list)]) -> Union[(str, dict, list)]:
'\n Helper function to deserialize dictionaries or list with nested\n json strings\n :param element\n '
if isinstance(element, str):
try:
element = ast.literal_eval(element)
exce... |
def keys(self, redis_key: str):
'\n Get current keys on redis db that match the pattern\n\n Args:\n redis_key:pattern to match the redis keys\n\n '
for k in self.client.keys(pattern='{}*'.format(redis_key)):
deserialized_key = k.decode('utf-8')
print(deserialized_... | 6,918,490,644,040,773,000 | Get current keys on redis db that match the pattern
Args:
redis_key:pattern to match the redis keys | lte/gateway/python/scripts/state_cli.py | keys | Rajpratik71/magma | python | def keys(self, redis_key: str):
'\n Get current keys on redis db that match the pattern\n\n Args:\n redis_key:pattern to match the redis keys\n\n '
for k in self.client.keys(pattern='{}*'.format(redis_key)):
deserialized_key = k.decode('utf-8')
print(deserialized_... |
def parse(self, key: str):
'\n Parse value of redis key on redis for encoded HASH, SET types, or\n JSON / Protobuf encoded state-wrapped types and prints it\n\n Args:\n key: key on redis\n\n '
redis_type = self.client.type(key).decode('utf-8')
key_type = key
if (':... | 7,372,065,754,419,361,000 | Parse value of redis key on redis for encoded HASH, SET types, or
JSON / Protobuf encoded state-wrapped types and prints it
Args:
key: key on redis | lte/gateway/python/scripts/state_cli.py | parse | Rajpratik71/magma | python | def parse(self, key: str):
'\n Parse value of redis key on redis for encoded HASH, SET types, or\n JSON / Protobuf encoded state-wrapped types and prints it\n\n Args:\n key: key on redis\n\n '
redis_type = self.client.type(key).decode('utf-8')
key_type = key
if (':... |
def corrupt(self, key):
'\n Mostly used for debugging, purposely corrupts state encoded protobuf\n in redis, and writes it back to datastore\n\n Args:\n key: key on redis\n\n '
rand_bytes = random.getrandbits(8)
byte_str = bytes([rand_bytes])
self.client[key] = byt... | -9,030,612,015,798,433,000 | Mostly used for debugging, purposely corrupts state encoded protobuf
in redis, and writes it back to datastore
Args:
key: key on redis | lte/gateway/python/scripts/state_cli.py | corrupt | Rajpratik71/magma | python | def corrupt(self, key):
'\n Mostly used for debugging, purposely corrupts state encoded protobuf\n in redis, and writes it back to datastore\n\n Args:\n key: key on redis\n\n '
rand_bytes = random.getrandbits(8)
byte_str = bytes([rand_bytes])
self.client[key] = byt... |
def mlp_discriminator(in_signal, non_linearity=tf.nn.relu, reuse=False, scope=None, b_norm=True, dropout_prob=None):
' used in nips submission.\n '
encoder_args = {'n_filters': [64, 128, 256, 256, 512], 'filter_sizes': [1, 1, 1, 1, 1], 'strides': [1, 1, 1, 1, 1]}
encoder_args['reuse'] = reuse
encoder... | -1,285,864,863,545,570,800 | used in nips submission. | src/generators_discriminators.py | mlp_discriminator | 15034458181/latent_3d_points | python | def mlp_discriminator(in_signal, non_linearity=tf.nn.relu, reuse=False, scope=None, b_norm=True, dropout_prob=None):
' \n '
encoder_args = {'n_filters': [64, 128, 256, 256, 512], 'filter_sizes': [1, 1, 1, 1, 1], 'strides': [1, 1, 1, 1, 1]}
encoder_args['reuse'] = reuse
encoder_args['scope'] = scope
... |
def point_cloud_generator(z, pc_dims, layer_sizes=[64, 128, 512, 1024], non_linearity=tf.nn.relu, b_norm=False, b_norm_last=False, dropout_prob=None):
' used in nips submission.\n '
(n_points, dummy) = pc_dims
if (dummy != 3):
raise ValueError()
out_signal = decoder_with_fc_only(z, layer_size... | 1,197,973,983,239,007,500 | used in nips submission. | src/generators_discriminators.py | point_cloud_generator | 15034458181/latent_3d_points | python | def point_cloud_generator(z, pc_dims, layer_sizes=[64, 128, 512, 1024], non_linearity=tf.nn.relu, b_norm=False, b_norm_last=False, dropout_prob=None):
' \n '
(n_points, dummy) = pc_dims
if (dummy != 3):
raise ValueError()
out_signal = decoder_with_fc_only(z, layer_sizes=layer_sizes, non_linea... |
def latent_code_discriminator_two_layers(in_signal, layer_sizes=[256, 512], b_norm=False, non_linearity=tf.nn.relu, reuse=False, scope=None):
' Used in ICML submission.\n '
layer_sizes = (layer_sizes + [1])
d_logit = decoder_with_fc_only(in_signal, layer_sizes=layer_sizes, non_linearity=non_linearity, b_... | -5,338,603,358,653,517,000 | Used in ICML submission. | src/generators_discriminators.py | latent_code_discriminator_two_layers | 15034458181/latent_3d_points | python | def latent_code_discriminator_two_layers(in_signal, layer_sizes=[256, 512], b_norm=False, non_linearity=tf.nn.relu, reuse=False, scope=None):
' \n '
layer_sizes = (layer_sizes + [1])
d_logit = decoder_with_fc_only(in_signal, layer_sizes=layer_sizes, non_linearity=non_linearity, b_norm=b_norm, reuse=reuse... |
def latent_code_generator_two_layers(z, out_dim, layer_sizes=[128], b_norm=False):
' Used in ICML submission.\n '
layer_sizes = (layer_sizes + out_dim)
out_signal = decoder_with_fc_only(z, layer_sizes=layer_sizes, b_norm=b_norm)
out_signal = tf.nn.relu(out_signal)
return out_signal | -8,565,647,461,382,028,000 | Used in ICML submission. | src/generators_discriminators.py | latent_code_generator_two_layers | 15034458181/latent_3d_points | python | def latent_code_generator_two_layers(z, out_dim, layer_sizes=[128], b_norm=False):
' \n '
layer_sizes = (layer_sizes + out_dim)
out_signal = decoder_with_fc_only(z, layer_sizes=layer_sizes, b_norm=b_norm)
out_signal = tf.nn.relu(out_signal)
return out_signal |
def maxNumber(self, nums1, nums2, k):
'\n :type nums1: List[int]\n :type nums2: List[int]\n :type k: int\n :rtype: List[int]\n '
def prep(nums, k):
dr = (len(nums) - k)
stay = []
for num in nums:
while (dr and stay and (stay[(- 1)] < num)):... | -3,527,442,808,947,760,600 | :type nums1: List[int]
:type nums2: List[int]
:type k: int
:rtype: List[int] | src/321. Create Maximum Number.py | maxNumber | wisesky/LeetCode-Practice | python | def maxNumber(self, nums1, nums2, k):
'\n :type nums1: List[int]\n :type nums2: List[int]\n :type k: int\n :rtype: List[int]\n '
def prep(nums, k):
dr = (len(nums) - k)
stay = []
for num in nums:
while (dr and stay and (stay[(- 1)] < num)):... |
def dbdirname(db, rc):
'Gets the database dir name.'
if (db.get('local', False) is False):
dbsdir = os.path.join(rc.builddir, '_dbs')
dbdir = os.path.join(dbsdir, db['name'])
else:
dbdir = db['url']
return dbdir | 2,476,350,037,564,095,500 | Gets the database dir name. | regolith/tools.py | dbdirname | jc-umana/regolith | python | def dbdirname(db, rc):
if (db.get('local', False) is False):
dbsdir = os.path.join(rc.builddir, '_dbs')
dbdir = os.path.join(dbsdir, db['name'])
else:
dbdir = db['url']
return dbdir |
def dbpathname(db, rc):
'Gets the database path name.'
dbdir = dbdirname(db, rc)
dbpath = os.path.join(dbdir, db['path'])
return dbpath | 8,634,322,216,610,822,000 | Gets the database path name. | regolith/tools.py | dbpathname | jc-umana/regolith | python | def dbpathname(db, rc):
dbdir = dbdirname(db, rc)
dbpath = os.path.join(dbdir, db['path'])
return dbpath |
def fallback(cond, backup):
'Decorator for returning the object if cond is true and a backup if\n cond is false. '
def dec(obj):
return (obj if cond else backup)
return dec | -7,055,294,061,139,205,000 | Decorator for returning the object if cond is true and a backup if
cond is false. | regolith/tools.py | fallback | jc-umana/regolith | python | def fallback(cond, backup):
'Decorator for returning the object if cond is true and a backup if\n cond is false. '
def dec(obj):
return (obj if cond else backup)
return dec |
def all_docs_from_collection(client, collname, copy=True):
'Yield all entries in for all collections of a given name in a given\n database. '
(yield from client.all_documents(collname, copy=copy)) | 4,186,418,632,788,220,000 | Yield all entries in for all collections of a given name in a given
database. | regolith/tools.py | all_docs_from_collection | jc-umana/regolith | python | def all_docs_from_collection(client, collname, copy=True):
'Yield all entries in for all collections of a given name in a given\n database. '
(yield from client.all_documents(collname, copy=copy)) |
def date_to_rfc822(y, m, d=1):
'Converts a date to an RFC 822 formatted string.'
d = datetime(int(y), month_to_int(m), int(d))
return email.utils.format_datetime(d) | 9,035,443,693,733,744,000 | Converts a date to an RFC 822 formatted string. | regolith/tools.py | date_to_rfc822 | jc-umana/regolith | python | def date_to_rfc822(y, m, d=1):
d = datetime(int(y), month_to_int(m), int(d))
return email.utils.format_datetime(d) |
def rfc822now():
'Creates a string of the current time according to RFC 822.'
now = datetime.utcnow()
return email.utils.format_datetime(now) | 8,775,209,818,638,581,000 | Creates a string of the current time according to RFC 822. | regolith/tools.py | rfc822now | jc-umana/regolith | python | def rfc822now():
now = datetime.utcnow()
return email.utils.format_datetime(now) |
def gets(seq, key, default=None):
'Gets a key from every element of a sequence if possible.'
for x in seq:
(yield x.get(key, default)) | 2,666,311,277,258,468,400 | Gets a key from every element of a sequence if possible. | regolith/tools.py | gets | jc-umana/regolith | python | def gets(seq, key, default=None):
for x in seq:
(yield x.get(key, default)) |
def month_and_year(m=None, y=None):
'Creates a string from month and year data, if available.'
if (y is None):
return 'present'
if (m is None):
return str(y)
m = month_to_int(m)
return '{0} {1}'.format(SHORT_MONTH_NAMES[m], y) | 13,686,799,063,267,366 | Creates a string from month and year data, if available. | regolith/tools.py | month_and_year | jc-umana/regolith | python | def month_and_year(m=None, y=None):
if (y is None):
return 'present'
if (m is None):
return str(y)
m = month_to_int(m)
return '{0} {1}'.format(SHORT_MONTH_NAMES[m], y) |
def is_since(y, sy, m=1, d=1, sm=1, sd=1):
'\n tests whether a date is on or since another date\n\n Parameters\n ----------\n y : int\n the year to be tested\n sy : int\n the since year\n m : int or str\n the month to be tested. Optional, defaults to Jan\n d : int\n the day ... | -8,613,150,611,452,172,000 | tests whether a date is on or since another date
Parameters
----------
y : int
the year to be tested
sy : int
the since year
m : int or str
the month to be tested. Optional, defaults to Jan
d : int
the day to be tested. Defaults to 1
sm : int or str
the since month. Optional, defaults to Jan
sd: int
the ... | regolith/tools.py | is_since | jc-umana/regolith | python | def is_since(y, sy, m=1, d=1, sm=1, sd=1):
'\n tests whether a date is on or since another date\n\n Parameters\n ----------\n y : int\n the year to be tested\n sy : int\n the since year\n m : int or str\n the month to be tested. Optional, defaults to Jan\n d : int\n the day ... |
def is_before(y, by, m=12, d=None, bm=12, bd=None):
'\n tests whether a date is on or before another date\n\n Parameters\n ----------\n y : int\n the year to be tested\n by : int\n the before year\n m : int or str\n the month to be tested. Optional, defaults to Dec\n d : int\n ... | -1,713,290,861,960,713,700 | tests whether a date is on or before another date
Parameters
----------
y : int
the year to be tested
by : int
the before year
m : int or str
the month to be tested. Optional, defaults to Dec
d : int
the day to be tested. Defaults to last day of the month
bm : int or str
the before month. Optional, default... | regolith/tools.py | is_before | jc-umana/regolith | python | def is_before(y, by, m=12, d=None, bm=12, bd=None):
'\n tests whether a date is on or before another date\n\n Parameters\n ----------\n y : int\n the year to be tested\n by : int\n the before year\n m : int or str\n the month to be tested. Optional, defaults to Dec\n d : int\n ... |
def is_between(y, sy, by, m=1, d=1, sm=1, sd=1, bm=12, bd=None):
'\n tests whether a date is on or between two other dates\n\n returns true if the target date is between the since date and the before\n date, inclusive.\n\n Parameters\n ----------\n y : int\n the year to be tested\n sy : in... | 2,456,960,928,022,609,000 | tests whether a date is on or between two other dates
returns true if the target date is between the since date and the before
date, inclusive.
Parameters
----------
y : int
the year to be tested
sy : int
the since year
by : int
the before year
m : int or str
the month to be tested. Optional, defaults to Jan
... | regolith/tools.py | is_between | jc-umana/regolith | python | def is_between(y, sy, by, m=1, d=1, sm=1, sd=1, bm=12, bd=None):
'\n tests whether a date is on or between two other dates\n\n returns true if the target date is between the since date and the before\n date, inclusive.\n\n Parameters\n ----------\n y : int\n the year to be tested\n sy : in... |
def has_started(sy, sm=None, sd=None):
'\n true if today is after the dates given, inclusive\n\n Parameters\n ----------\n sy : int\n the year to check today against\n sm : int or str.\n the month to check today against. Should be integer or in regolith MONTHS.\n default is 1\n s... | 878,695,831,259,082,100 | true if today is after the dates given, inclusive
Parameters
----------
sy : int
the year to check today against
sm : int or str.
the month to check today against. Should be integer or in regolith MONTHS.
default is 1
sd : int.
the day to check today against. Default is 1
Returns
-------
bool
true if toda... | regolith/tools.py | has_started | jc-umana/regolith | python | def has_started(sy, sm=None, sd=None):
'\n true if today is after the dates given, inclusive\n\n Parameters\n ----------\n sy : int\n the year to check today against\n sm : int or str.\n the month to check today against. Should be integer or in regolith MONTHS.\n default is 1\n s... |
def has_finished(ey, em=None, ed=None):
'\n true if today is before the dates given, inclusive\n\n Parameters\n ----------\n ey : int\n end year, the year to check today against\n em : int or str.\n end month, the month to check today against. Should be integer or in regolith MONTHS.\n ... | -2,508,334,573,039,119,000 | true if today is before the dates given, inclusive
Parameters
----------
ey : int
end year, the year to check today against
em : int or str.
end month, the month to check today against. Should be integer or in regolith MONTHS.
default is 1
ed : int.
end-day, the day to check today against. Default is last ... | regolith/tools.py | has_finished | jc-umana/regolith | python | def has_finished(ey, em=None, ed=None):
'\n true if today is before the dates given, inclusive\n\n Parameters\n ----------\n ey : int\n end year, the year to check today against\n em : int or str.\n end month, the month to check today against. Should be integer or in regolith MONTHS.\n ... |
def is_current(sy, ey, sm=None, sd=None, em=None, ed=None):
'\n true if today is between the dates given, inclusive\n\n Parameters\n ----------\n sy : int\n start year, the year to check today is after\n ey : int\n end year, the year to check today is before\n sm : int or str\n s... | 6,748,978,171,058,761,000 | true if today is between the dates given, inclusive
Parameters
----------
sy : int
start year, the year to check today is after
ey : int
end year, the year to check today is before
sm : int or str
start month, the month to check today is after. Should be integer or in
regolith MONTHS. Default is 1
sd : int... | regolith/tools.py | is_current | jc-umana/regolith | python | def is_current(sy, ey, sm=None, sd=None, em=None, ed=None):
'\n true if today is between the dates given, inclusive\n\n Parameters\n ----------\n sy : int\n start year, the year to check today is after\n ey : int\n end year, the year to check today is before\n sm : int or str\n s... |
def filter_publications(citations, authors, reverse=False, bold=True):
'Filter publications by the author(s)/editor(s)\n\n Parameters\n ----------\n citations : list of dict\n The publication citations\n authors : set of str\n The authors to be filtered against\n reverse : bool, optiona... | 9,065,536,602,894,445,000 | Filter publications by the author(s)/editor(s)
Parameters
----------
citations : list of dict
The publication citations
authors : set of str
The authors to be filtered against
reverse : bool, optional
If True reverse the order, defaults to False
bold : bool, optional
If True put latex bold around the a... | regolith/tools.py | filter_publications | jc-umana/regolith | python | def filter_publications(citations, authors, reverse=False, bold=True):
'Filter publications by the author(s)/editor(s)\n\n Parameters\n ----------\n citations : list of dict\n The publication citations\n authors : set of str\n The authors to be filtered against\n reverse : bool, optiona... |
def filter_projects(projects, authors, reverse=False):
'Filter projects by the author(s)\n\n Parameters\n ----------\n projects : list of dict\n The publication citations\n authors : set of list of str\n The authors to be filtered against\n reverse : bool, optional\n If True reve... | -185,094,831,037,862,050 | Filter projects by the author(s)
Parameters
----------
projects : list of dict
The publication citations
authors : set of list of str
The authors to be filtered against
reverse : bool, optional
If True reverse the order, defaults to False | regolith/tools.py | filter_projects | jc-umana/regolith | python | def filter_projects(projects, authors, reverse=False):
'Filter projects by the author(s)\n\n Parameters\n ----------\n projects : list of dict\n The publication citations\n authors : set of list of str\n The authors to be filtered against\n reverse : bool, optional\n If True reve... |
def filter_grants(input_grants, names, pi=True, reverse=True, multi_pi=False):
"Filter grants by those involved\n\n Parameters\n ----------\n input_grants : list of dict\n The grants to filter\n names : set of str\n The authors to be filtered against\n pi : bool, optional\n If Tr... | 8,310,129,862,167,256,000 | Filter grants by those involved
Parameters
----------
input_grants : list of dict
The grants to filter
names : set of str
The authors to be filtered against
pi : bool, optional
If True add the grant amount to that person's total amount
reverse : bool, optional
If True reverse the order, defaults to Fal... | regolith/tools.py | filter_grants | jc-umana/regolith | python | def filter_grants(input_grants, names, pi=True, reverse=True, multi_pi=False):
"Filter grants by those involved\n\n Parameters\n ----------\n input_grants : list of dict\n The grants to filter\n names : set of str\n The authors to be filtered against\n pi : bool, optional\n If Tr... |
def awards_grants_honors(p):
'Make sorted awards grants and honors list.\n\n Parameters\n ----------\n p : dict\n The person entry\n '
aghs = []
for x in p.get('funding', ()):
d = {'description': '{0} ({1}{2:,})'.format(latex_safe(x['name']), x.get('currency', '$').replace('$', '\... | 6,206,872,766,831,139,000 | Make sorted awards grants and honors list.
Parameters
----------
p : dict
The person entry | regolith/tools.py | awards_grants_honors | jc-umana/regolith | python | def awards_grants_honors(p):
'Make sorted awards grants and honors list.\n\n Parameters\n ----------\n p : dict\n The person entry\n '
aghs = []
for x in p.get('funding', ()):
d = {'description': '{0} ({1}{2:,})'.format(latex_safe(x['name']), x.get('currency', '$').replace('$', '\... |
def latex_safe_url(s):
'Makes a string that is a URL latex safe.'
return s.replace('#', '\\#') | 6,571,294,783,630,191,000 | Makes a string that is a URL latex safe. | regolith/tools.py | latex_safe_url | jc-umana/regolith | python | def latex_safe_url(s):
return s.replace('#', '\\#') |
def latex_safe(s, url_check=True, wrapper='url'):
"Make string latex safe\n\n Parameters\n ----------\n s : str\n url_check : bool, optional\n If True check for URLs and wrap them, if False check for URL but don't\n wrap, defaults to True\n wrapper : str, optional\n The wrapper f... | 7,536,975,964,445,699,000 | Make string latex safe
Parameters
----------
s : str
url_check : bool, optional
If True check for URLs and wrap them, if False check for URL but don't
wrap, defaults to True
wrapper : str, optional
The wrapper for wrapping urls defaults to url | regolith/tools.py | latex_safe | jc-umana/regolith | python | def latex_safe(s, url_check=True, wrapper='url'):
"Make string latex safe\n\n Parameters\n ----------\n s : str\n url_check : bool, optional\n If True check for URLs and wrap them, if False check for URL but don't\n wrap, defaults to True\n wrapper : str, optional\n The wrapper f... |
def make_bibtex_file(pubs, pid, person_dir='.'):
"Make a bibtex file given the publications\n\n Parameters\n ----------\n pubs : list of dict\n The publications\n pid : str\n The person id\n person_dir : str, optional\n The person's directory\n "
if (not HAVE_BIBTEX_PARSER... | 7,067,784,381,179,065,000 | Make a bibtex file given the publications
Parameters
----------
pubs : list of dict
The publications
pid : str
The person id
person_dir : str, optional
The person's directory | regolith/tools.py | make_bibtex_file | jc-umana/regolith | python | def make_bibtex_file(pubs, pid, person_dir='.'):
"Make a bibtex file given the publications\n\n Parameters\n ----------\n pubs : list of dict\n The publications\n pid : str\n The person id\n person_dir : str, optional\n The person's directory\n "
if (not HAVE_BIBTEX_PARSER... |
def document_by_value(documents, address, value):
'Get a specific document by one of its values\n\n Parameters\n ----------\n documents: generator\n Generator which yields the documents\n address: str or tuple\n The address of the data in the document\n value: any\n The expected ... | -6,065,343,237,551,224,000 | Get a specific document by one of its values
Parameters
----------
documents: generator
Generator which yields the documents
address: str or tuple
The address of the data in the document
value: any
The expected value for the document
Returns
-------
dict:
The first document which matches the request | regolith/tools.py | document_by_value | jc-umana/regolith | python | def document_by_value(documents, address, value):
'Get a specific document by one of its values\n\n Parameters\n ----------\n documents: generator\n Generator which yields the documents\n address: str or tuple\n The address of the data in the document\n value: any\n The expected ... |
def fuzzy_retrieval(documents, sources, value, case_sensitive=True):
"Retrieve a document from the documents where value is compared against\n multiple potential sources\n\n Parameters\n ----------\n documents: generator\n The documents\n sources: iterable\n The potential data sources\n... | 2,397,259,811,125,256,700 | Retrieve a document from the documents where value is compared against
multiple potential sources
Parameters
----------
documents: generator
The documents
sources: iterable
The potential data sources
value:
The value to compare against to find the document of interest
case_sensitive: Bool
When true wil... | regolith/tools.py | fuzzy_retrieval | jc-umana/regolith | python | def fuzzy_retrieval(documents, sources, value, case_sensitive=True):
"Retrieve a document from the documents where value is compared against\n multiple potential sources\n\n Parameters\n ----------\n documents: generator\n The documents\n sources: iterable\n The potential data sources\n... |
def number_suffix(number):
'returns the suffix that adjectivises a number (st, nd, rd, th)\n\n Paramters\n ---------\n number: integer\n The number. If number is not an integer, returns an empty string\n\n Returns\n -------\n suffix: string\n The suffix (st, nd, rd, th)\n '
i... | -1,537,146,430,695,771,000 | returns the suffix that adjectivises a number (st, nd, rd, th)
Paramters
---------
number: integer
The number. If number is not an integer, returns an empty string
Returns
-------
suffix: string
The suffix (st, nd, rd, th) | regolith/tools.py | number_suffix | jc-umana/regolith | python | def number_suffix(number):
'returns the suffix that adjectivises a number (st, nd, rd, th)\n\n Paramters\n ---------\n number: integer\n The number. If number is not an integer, returns an empty string\n\n Returns\n -------\n suffix: string\n The suffix (st, nd, rd, th)\n '
i... |
def dereference_institution(input_record, institutions):
'Tool for replacing placeholders for institutions with the actual\n institution data. Note that the replacement is done inplace\n\n Parameters\n ----------\n input_record : dict\n The record to dereference\n institutions : iterable of di... | -8,456,008,445,291,992,000 | Tool for replacing placeholders for institutions with the actual
institution data. Note that the replacement is done inplace
Parameters
----------
input_record : dict
The record to dereference
institutions : iterable of dicts
The institutions | regolith/tools.py | dereference_institution | jc-umana/regolith | python | def dereference_institution(input_record, institutions):
'Tool for replacing placeholders for institutions with the actual\n institution data. Note that the replacement is done inplace\n\n Parameters\n ----------\n input_record : dict\n The record to dereference\n institutions : iterable of di... |
def merge_collections(a, b, target_id):
'\n merge two collections into a single merged collection\n\n for keys that are in both collections, the value in b will be kept\n\n Parameters\n ----------\n a the inferior collection (will lose values of shared keys)\n b the superior collection (will kee... | 101,764,650,393,760,800 | merge two collections into a single merged collection
for keys that are in both collections, the value in b will be kept
Parameters
----------
a the inferior collection (will lose values of shared keys)
b the superior collection (will keep values of shared keys)
target_id str the name of the key used in b to dere... | regolith/tools.py | merge_collections | jc-umana/regolith | python | def merge_collections(a, b, target_id):
'\n merge two collections into a single merged collection\n\n for keys that are in both collections, the value in b will be kept\n\n Parameters\n ----------\n a the inferior collection (will lose values of shared keys)\n b the superior collection (will kee... |
def update_schemas(default_schema, user_schema):
'\n Merging the user schema into the default schema recursively and return the\n merged schema. The default schema and user schema will not be modified\n during the merging.\n\n Parameters\n ----------\n default_schema : dict\n The default sc... | -8,252,402,807,327,927,000 | Merging the user schema into the default schema recursively and return the
merged schema. The default schema and user schema will not be modified
during the merging.
Parameters
----------
default_schema : dict
The default schema.
user_schema : dict
The user defined schema.
Returns
-------
updated_schema : dic... | regolith/tools.py | update_schemas | jc-umana/regolith | python | def update_schemas(default_schema, user_schema):
'\n Merging the user schema into the default schema recursively and return the\n merged schema. The default schema and user schema will not be modified\n during the merging.\n\n Parameters\n ----------\n default_schema : dict\n The default sc... |
def group(db, by):
'\n Group the document in the database according to the value of the doc[by] in db.\n\n Parameters\n ----------\n db : iterable\n The database of documents.\n by : basestring\n The key to group the documents.\n\n Returns\n -------\n grouped: dict\n A d... | -8,126,863,572,966,259,000 | Group the document in the database according to the value of the doc[by] in db.
Parameters
----------
db : iterable
The database of documents.
by : basestring
The key to group the documents.
Returns
-------
grouped: dict
A dictionary mapping the feature value of group to the list of docs. All docs in the ... | regolith/tools.py | group | jc-umana/regolith | python | def group(db, by):
'\n Group the document in the database according to the value of the doc[by] in db.\n\n Parameters\n ----------\n db : iterable\n The database of documents.\n by : basestring\n The key to group the documents.\n\n Returns\n -------\n grouped: dict\n A d... |
def get_pi_id(rc):
"\n Gets the database id of the group PI\n\n Parameters\n ----------\n rc: runcontrol object\n The runcontrol object. It must contain the 'groups' and 'people'\n collections in the needed databases\n\n Returns\n -------\n The database '_id' of the group PI\n\n "... | 3,363,426,960,476,733,000 | Gets the database id of the group PI
Parameters
----------
rc: runcontrol object
The runcontrol object. It must contain the 'groups' and 'people'
collections in the needed databases
Returns
-------
The database '_id' of the group PI | regolith/tools.py | get_pi_id | jc-umana/regolith | python | def get_pi_id(rc):
"\n Gets the database id of the group PI\n\n Parameters\n ----------\n rc: runcontrol object\n The runcontrol object. It must contain the 'groups' and 'people'\n collections in the needed databases\n\n Returns\n -------\n The database '_id' of the group PI\n\n "... |
def group_member_ids(ppl_coll, grpname):
'Get a list of all group member ids\n\n Parameters\n ----------\n ppl_coll: collection (list of dicts)\n The people collection that should contain the group members\n grp: string\n The id of the group in groups.yml\n\n Returns\n -------\n s... | 7,553,083,287,698,605,000 | Get a list of all group member ids
Parameters
----------
ppl_coll: collection (list of dicts)
The people collection that should contain the group members
grp: string
The id of the group in groups.yml
Returns
-------
set:
The set of ids of the people in the group
Notes
-----
- Groups that are being tracke... | regolith/tools.py | group_member_ids | jc-umana/regolith | python | def group_member_ids(ppl_coll, grpname):
'Get a list of all group member ids\n\n Parameters\n ----------\n ppl_coll: collection (list of dicts)\n The people collection that should contain the group members\n grp: string\n The id of the group in groups.yml\n\n Returns\n -------\n s... |
def report_func(df: pd.DataFrame, **kwargs: Any) -> None:
'\n Create report function, used for performance testing.\n '
create_report(df, **kwargs) | -991,893,151,365,360,800 | Create report function, used for performance testing. | dataprep/tests/benchmarks/eda.py | report_func | Bowen0729/dataprep | python | def report_func(df: pd.DataFrame, **kwargs: Any) -> None:
'\n \n '
create_report(df, **kwargs) |
def test_create_report(benchmark: Any) -> None:
'\n Performance test of create report on titanic dataset.\n '
df = load_dataset('titanic')
benchmark(partial(report_func), df) | 2,975,394,867,720,784,000 | Performance test of create report on titanic dataset. | dataprep/tests/benchmarks/eda.py | test_create_report | Bowen0729/dataprep | python | def test_create_report(benchmark: Any) -> None:
'\n \n '
df = load_dataset('titanic')
benchmark(partial(report_func), df) |
def _get_metadata(*parameters: Parameter) -> Dict[(str, Any)]:
'\n Return a dictionary that contains the parameter metadata grouped by the\n instrument it belongs to.\n '
metadata_timestamp = time.time()
metas: dict = defaultdict(list)
for parameter in parameters:
meta: Dict[(str, Optio... | -1,330,515,832,946,222,600 | Return a dictionary that contains the parameter metadata grouped by the
instrument it belongs to. | qcodes/monitor/monitor.py | _get_metadata | Akshita07/Qcodes | python | def _get_metadata(*parameters: Parameter) -> Dict[(str, Any)]:
'\n Return a dictionary that contains the parameter metadata grouped by the\n instrument it belongs to.\n '
metadata_timestamp = time.time()
metas: dict = defaultdict(list)
for parameter in parameters:
meta: Dict[(str, Optio... |
def _handler(parameters: Sequence[Parameter], interval: float) -> Callable[([websockets.WebSocketServerProtocol, str], Awaitable[None])]:
'\n Return the websockets server handler.\n '
async def server_func(websocket: websockets.WebSocketServerProtocol, _: str) -> None:
'\n Create a websock... | 2,602,754,282,914,915,300 | Return the websockets server handler. | qcodes/monitor/monitor.py | _handler | Akshita07/Qcodes | python | def _handler(parameters: Sequence[Parameter], interval: float) -> Callable[([websockets.WebSocketServerProtocol, str], Awaitable[None])]:
'\n \n '
async def server_func(websocket: websockets.WebSocketServerProtocol, _: str) -> None:
'\n Create a websockets handler that sends parameter valu... |
async def server_func(websocket: websockets.WebSocketServerProtocol, _: str) -> None:
'\n Create a websockets handler that sends parameter values to a listener\n every "interval" seconds.\n '
while True:
try:
try:
meta = _get_metadata(*parameters)
... | -3,658,804,037,770,032,600 | Create a websockets handler that sends parameter values to a listener
every "interval" seconds. | qcodes/monitor/monitor.py | server_func | Akshita07/Qcodes | python | async def server_func(websocket: websockets.WebSocketServerProtocol, _: str) -> None:
'\n Create a websockets handler that sends parameter values to a listener\n every "interval" seconds.\n '
while True:
try:
try:
meta = _get_metadata(*parameters)
... |
def __init__(self, *parameters: Parameter, interval: float=1):
'\n Monitor qcodes parameters.\n\n Args:\n *parameters: Parameters to monitor.\n interval: How often one wants to refresh the values.\n '
super().__init__()
for parameter in parameters:
if (not ... | 5,824,786,925,298,103,000 | Monitor qcodes parameters.
Args:
*parameters: Parameters to monitor.
interval: How often one wants to refresh the values. | qcodes/monitor/monitor.py | __init__ | Akshita07/Qcodes | python | def __init__(self, *parameters: Parameter, interval: float=1):
'\n Monitor qcodes parameters.\n\n Args:\n *parameters: Parameters to monitor.\n interval: How often one wants to refresh the values.\n '
super().__init__()
for parameter in parameters:
if (not ... |
def run(self) -> None:
'\n Start the event loop and run forever.\n '
log.debug('Running Websocket server')
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)
try:
server_start = websockets.serve(self.handler, '127.0.0.1', WEBSOCKET_PORT, close_timeout=1)
... | 6,689,847,950,625,658,000 | Start the event loop and run forever. | qcodes/monitor/monitor.py | run | Akshita07/Qcodes | python | def run(self) -> None:
'\n \n '
log.debug('Running Websocket server')
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)
try:
server_start = websockets.serve(self.handler, '127.0.0.1', WEBSOCKET_PORT, close_timeout=1)
self.server = self.loop.run_unti... |
def update_all(self) -> None:
'\n Update all parameters in the monitor.\n '
for parameter in self._parameters:
with suppress(TypeError):
parameter.get() | 6,364,364,353,977,618,000 | Update all parameters in the monitor. | qcodes/monitor/monitor.py | update_all | Akshita07/Qcodes | python | def update_all(self) -> None:
'\n \n '
for parameter in self._parameters:
with suppress(TypeError):
parameter.get() |
def stop(self) -> None:
'\n Shutdown the server, close the event loop and join the thread.\n Setting active Monitor to ``None``.\n '
self.join()
Monitor.running = None | -9,010,464,473,570,652,000 | Shutdown the server, close the event loop and join the thread.
Setting active Monitor to ``None``. | qcodes/monitor/monitor.py | stop | Akshita07/Qcodes | python | def stop(self) -> None:
'\n Shutdown the server, close the event loop and join the thread.\n Setting active Monitor to ``None``.\n '
self.join()
Monitor.running = None |
def join(self, timeout: Optional[float]=None) -> None:
'\n Overwrite ``Thread.join`` to make sure server is stopped before\n joining avoiding a potential deadlock.\n '
log.debug('Shutting down server')
if (not self.is_alive()):
log.debug('monitor is dead')
return
try... | 1,480,710,171,094,641,700 | Overwrite ``Thread.join`` to make sure server is stopped before
joining avoiding a potential deadlock. | qcodes/monitor/monitor.py | join | Akshita07/Qcodes | python | def join(self, timeout: Optional[float]=None) -> None:
'\n Overwrite ``Thread.join`` to make sure server is stopped before\n joining avoiding a potential deadlock.\n '
log.debug('Shutting down server')
if (not self.is_alive()):
log.debug('monitor is dead')
return
try... |
@staticmethod
def show() -> None:
'\n Overwrite this method to show/raise your monitor GUI\n F.ex.\n\n ::\n\n import webbrowser\n url = "localhost:3000"\n # Open URL in new window, raising the window if possible.\n webbrowser.open_new(url)\n\n ... | 3,710,049,875,675,028,000 | Overwrite this method to show/raise your monitor GUI
F.ex.
::
import webbrowser
url = "localhost:3000"
# Open URL in new window, raising the window if possible.
webbrowser.open_new(url) | qcodes/monitor/monitor.py | show | Akshita07/Qcodes | python | @staticmethod
def show() -> None:
'\n Overwrite this method to show/raise your monitor GUI\n F.ex.\n\n ::\n\n import webbrowser\n url = "localhost:3000"\n # Open URL in new window, raising the window if possible.\n webbrowser.open_new(url)\n\n ... |
def set_test_params(self):
' Setup test environment\n :param:\n :return:\n '
self.setup_clean_chain = True
self.num_nodes = 1
self.extra_args = ([['-staking=1', '-debug=net']] * self.num_nodes) | -2,748,070,360,690,059,300 | Setup test environment
:param:
:return: | test/functional/fake_stake/base_test.py | set_test_params | tdpsdevextreme/TradePlusCoin | python | def set_test_params(self):
' Setup test environment\n :param:\n :return:\n '
self.setup_clean_chain = True
self.num_nodes = 1
self.extra_args = ([['-staking=1', '-debug=net']] * self.num_nodes) |
def setup_network(self):
" Can't rely on syncing all the nodes when staking=1\n :param:\n :return:\n "
self.setup_nodes()
for i in range((self.num_nodes - 1)):
for j in range((i + 1), self.num_nodes):
connect_nodes_bi(self.nodes, i, j) | 4,878,764,237,105,450,000 | Can't rely on syncing all the nodes when staking=1
:param:
:return: | test/functional/fake_stake/base_test.py | setup_network | tdpsdevextreme/TradePlusCoin | python | def setup_network(self):
" Can't rely on syncing all the nodes when staking=1\n :param:\n :return:\n "
self.setup_nodes()
for i in range((self.num_nodes - 1)):
for j in range((i + 1), self.num_nodes):
connect_nodes_bi(self.nodes, i, j) |
def init_test(self):
' Initializes test parameters\n :param:\n :return:\n '
title = ('*** Starting %s ***' % self.__class__.__name__)
underline = ('-' * len(title))
self.log.info('\n\n%s\n%s\n%s\n', title, underline, self.description)
self.DEFAULT_FEE = 0.1
self.NUM_BLOCKS =... | -5,515,092,755,267,224,000 | Initializes test parameters
:param:
:return: | test/functional/fake_stake/base_test.py | init_test | tdpsdevextreme/TradePlusCoin | python | def init_test(self):
' Initializes test parameters\n :param:\n :return:\n '
title = ('*** Starting %s ***' % self.__class__.__name__)
underline = ('-' * len(title))
self.log.info('\n\n%s\n%s\n%s\n', title, underline, self.description)
self.DEFAULT_FEE = 0.1
self.NUM_BLOCKS =... |
def run_test(self):
' Performs the attack of this test - run init_test first.\n :param:\n :return:\n '
self.description = ''
self.init_test()
return | 3,115,403,244,731,384,000 | Performs the attack of this test - run init_test first.
:param:
:return: | test/functional/fake_stake/base_test.py | run_test | tdpsdevextreme/TradePlusCoin | python | def run_test(self):
' Performs the attack of this test - run init_test first.\n :param:\n :return:\n '
self.description =
self.init_test()
return |
def create_spam_block(self, hashPrevBlock, stakingPrevOuts, height, fStakeDoubleSpent=False, fZPoS=False, spendingPrevOuts={}):
' creates a block to spam the network with\n :param hashPrevBlock: (hex string) hash of previous block\n stakingPrevOuts: ({COutPoint --> (int, int, int, s... | 5,502,691,599,703,268,000 | creates a block to spam the network with
:param hashPrevBlock: (hex string) hash of previous block
stakingPrevOuts: ({COutPoint --> (int, int, int, str)} dictionary)
map outpoints (to be used as staking inputs) to amount, block_time, nStakeModifier, hashStake
he... | test/functional/fake_stake/base_test.py | create_spam_block | tdpsdevextreme/TradePlusCoin | python | def create_spam_block(self, hashPrevBlock, stakingPrevOuts, height, fStakeDoubleSpent=False, fZPoS=False, spendingPrevOuts={}):
' creates a block to spam the network with\n :param hashPrevBlock: (hex string) hash of previous block\n stakingPrevOuts: ({COutPoint --> (int, int, int, s... |
def spend_utxo(self, utxo, address_list):
' spend amount from previously unspent output to a provided address\n :param utxo: (JSON) returned from listunspent used as input\n addresslist: (string) destination address\n :return: txhash: (string) tx hash if... | -1,279,210,864,629,148,000 | spend amount from previously unspent output to a provided address
:param utxo: (JSON) returned from listunspent used as input
addresslist: (string) destination address
:return: txhash: (string) tx hash if successful, empty string otherwise | test/functional/fake_stake/base_test.py | spend_utxo | tdpsdevextreme/TradePlusCoin | python | def spend_utxo(self, utxo, address_list):
' spend amount from previously unspent output to a provided address\n :param utxo: (JSON) returned from listunspent used as input\n addresslist: (string) destination address\n :return: txhash: (string) tx hash if... |
def spend_utxos(self, utxo_list, address_list=[]):
' spend utxos to provided list of addresses or 10 new generate ones.\n :param utxo_list: (JSON list) returned from listunspent used as input\n address_list: (string list) [optional] recipient TradePlus_Coin addresses. if not se... | -6,621,179,609,126,178,000 | spend utxos to provided list of addresses or 10 new generate ones.
:param utxo_list: (JSON list) returned from listunspent used as input
address_list: (string list) [optional] recipient TradePlus_Coin addresses. if not set,
10 new addresses will be generated from the ... | test/functional/fake_stake/base_test.py | spend_utxos | tdpsdevextreme/TradePlusCoin | python | def spend_utxos(self, utxo_list, address_list=[]):
' spend utxos to provided list of addresses or 10 new generate ones.\n :param utxo_list: (JSON list) returned from listunspent used as input\n address_list: (string list) [optional] recipient TradePlus_Coin addresses. if not se... |
def stake_amplification_step(self, utxo_list, address_list=[]):
' spends a list of utxos providing the list of new outputs\n :param utxo_list: (JSON list) returned from listunspent used as input\n address_list: (string list) [optional] recipient TradePlus_Coin addresses.\n ... | 1,172,270,517,256,876,300 | spends a list of utxos providing the list of new outputs
:param utxo_list: (JSON list) returned from listunspent used as input
address_list: (string list) [optional] recipient TradePlus_Coin addresses.
:return: new_utxos: (JSON list) list of new (valid) inputs after the spends | test/functional/fake_stake/base_test.py | stake_amplification_step | tdpsdevextreme/TradePlusCoin | python | def stake_amplification_step(self, utxo_list, address_list=[]):
' spends a list of utxos providing the list of new outputs\n :param utxo_list: (JSON list) returned from listunspent used as input\n address_list: (string list) [optional] recipient TradePlus_Coin addresses.\n ... |
def stake_amplification(self, utxo_list, iterations, address_list=[]):
' performs the "stake amplification" which gives higher chances at finding fake stakes\n :param utxo_list: (JSON list) returned from listunspent used as input\n iterations: (int) amount of stake amplification ... | 5,069,938,516,817,489,000 | performs the "stake amplification" which gives higher chances at finding fake stakes
:param utxo_list: (JSON list) returned from listunspent used as input
iterations: (int) amount of stake amplification steps to perform
address_list: (string list) [optional] recipient TradePlus_Coin ad... | test/functional/fake_stake/base_test.py | stake_amplification | tdpsdevextreme/TradePlusCoin | python | def stake_amplification(self, utxo_list, iterations, address_list=[]):
' performs the "stake amplification" which gives higher chances at finding fake stakes\n :param utxo_list: (JSON list) returned from listunspent used as input\n iterations: (int) amount of stake amplification ... |
def sign_stake_tx(self, block, stake_in_value, fZPoS=False):
' signs a coinstake transaction\n :param block: (CBlock) block with stake to sign\n stake_in_value: (int) staked amount\n fZPoS: (bool) zerocoin stake\n :return: stake_tx_sig... | -4,420,679,656,985,043,500 | signs a coinstake transaction
:param block: (CBlock) block with stake to sign
stake_in_value: (int) staked amount
fZPoS: (bool) zerocoin stake
:return: stake_tx_signed: (CTransaction) signed tx | test/functional/fake_stake/base_test.py | sign_stake_tx | tdpsdevextreme/TradePlusCoin | python | def sign_stake_tx(self, block, stake_in_value, fZPoS=False):
' signs a coinstake transaction\n :param block: (CBlock) block with stake to sign\n stake_in_value: (int) staked amount\n fZPoS: (bool) zerocoin stake\n :return: stake_tx_sig... |
def get_prevouts(self, utxo_list, blockHeight, zpos=False):
' get prevouts (map) for each utxo in a list\n :param utxo_list: <if zpos=False> (JSON list) utxos returned from listunspent used as input\n <if zpos=True> (JSON list) mints returned from listmintedzerocoins used as inp... | -6,867,077,410,439,967,000 | get prevouts (map) for each utxo in a list
:param utxo_list: <if zpos=False> (JSON list) utxos returned from listunspent used as input
<if zpos=True> (JSON list) mints returned from listmintedzerocoins used as input
blockHeight: (int) height of the previous block
z... | test/functional/fake_stake/base_test.py | get_prevouts | tdpsdevextreme/TradePlusCoin | python | def get_prevouts(self, utxo_list, blockHeight, zpos=False):
' get prevouts (map) for each utxo in a list\n :param utxo_list: <if zpos=False> (JSON list) utxos returned from listunspent used as input\n <if zpos=True> (JSON list) mints returned from listmintedzerocoins used as inp... |
def log_data_dir_size(self):
" Prints the size of the '/regtest/blocks' directory.\n :param:\n :return:\n "
init_size = dir_size((self.node.datadir + '/regtest/blocks'))
self.log.info(('Size of data dir: %s kilobytes' % str(init_size))) | 4,494,430,405,223,330,000 | Prints the size of the '/regtest/blocks' directory.
:param:
:return: | test/functional/fake_stake/base_test.py | log_data_dir_size | tdpsdevextreme/TradePlusCoin | python | def log_data_dir_size(self):
" Prints the size of the '/regtest/blocks' directory.\n :param:\n :return:\n "
init_size = dir_size((self.node.datadir + '/regtest/blocks'))
self.log.info(('Size of data dir: %s kilobytes' % str(init_size))) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.