content
stringlengths
5
1.05M
class Matrix: def __init__(self, matrix_string: str): lines = matrix_string.splitlines() self.__matrix = [list(map(int, line.split())) for line in lines] def row(self, index): return self.__matrix[index - 1] def column(self, index): return [row[index - 1] for row in self.__matrix]
from __future__ import absolute_import, print_function from django.db import router from django.db.models.signals import post_migrate def create_first_user(app_config, using, interactive, **kwargs): if app_config and app_config.name != "sentry": return try: User = app_config.get_model("User") except LookupError: return if User.objects.filter(is_superuser=True).exists(): return if hasattr(router, "allow_migrate"): if not router.allow_migrate(using, User): return else: if not router.allow_syncdb(using, User): return if not interactive: return import click if not click.confirm("\nWould you like to create a user account now?", default=True): # Not using `abort=1` because we don't want to exit out from further execution click.echo("\nRun `sentry createuser` to do this later.\n") return from sentry.runner import call_command call_command("sentry.runner.commands.createuser.createuser", superuser=True) post_migrate.connect(create_first_user, dispatch_uid="create_first_user", weak=False)
import datetime import numpy as np import pandas as pd import matplotlib.pyplot as plt import pytest import oscovida as c import oscovida.plotting_helpers as oph def assert_oscovida_object(ax, cases, deaths): assert isinstance(ax, np.ndarray) assert isinstance(cases, (pd.Series, pd.DataFrame)) assert isinstance(deaths, (pd.Series, pd.DataFrame)) def mock_get_country_data_johns_hopkins(country="China"): cases_values = [548, 643, 920, 1406, 2075, 2877, 5509, 6087, 8141, 9802, 11891, 16630, 19716, 23707, 27440, 30587, 34110, 36814, 39829, 42354, 44386, 44759, 59895, 66358, 68413, 70513, 72434, 74211, 74619, 75077, 75550, 77001, 77022, 77241, 77754, 78166, 78600, 78928, 79356, 79932, 80136, 80261, 80386, 80537, 80690, 80770, 80823, 80860, 80887, 80921, 80932, 80945, 80977, 81003, 81033, 81058, 81102, 81156, 81250, 81305, 81435, 81498, 81591, 81661, 81782, 81897, 81999, 82122, 82198, 82279, 82361, 82432, 82511, 82543, 82602, 82665, 82718, 82809, 82883, 82941] cases_index = pd.date_range("2020-01-22", periods=len(cases_values), freq='D') cases = pd.Series(data=cases_values, index=cases_index) cases.country = "China" deaths = cases.copy(deep=True) deaths.values[:] = cases.values * 0.1 deaths.country = "China" deaths.label = 'deaths' cases.label = 'cases' return cases, deaths def test_mock_get_country_data_johns_hopkins(): cases, deaths = mock_get_country_data_johns_hopkins() assert cases.shape == (80,) assert deaths.shape == (80,) assert deaths.label == 'deaths' assert deaths.country == 'China' def test_overview(): axes, cases, deaths = c.overview("China") assert cases.name == 'China cases' assert deaths.name == 'China deaths' assert_oscovida_object(axes, cases, deaths) assert_oscovida_object(*c.overview("Germany", weeks=8)) assert_oscovida_object(*c.overview("Russia", dates="2020-05-30:2020-06-15")) with pytest.raises(ValueError): c.overview("Argentina", weeks=8, dates="2020-05-30:2020-06-15") days = 10 dates = pd.date_range("2020-03-01", periods=days, freq='D') data1 = np.exp(np.linspace(1, 15, days)) data2 = np.exp(np.linspace(1, 5, days)) cases = pd.Series(data1, index=pd.DatetimeIndex(dates)) deaths = pd.Series(data2, index=pd.DatetimeIndex(dates)) assert_oscovida_object(*c.overview("Narnia", data=(cases, deaths))) def test_US_overview(): axes, cases, deaths = c.overview(country="US", region="New Jersey") assert cases.name == 'US-New Jersey cases' assert deaths.name == 'US-New Jersey deaths' assert_oscovida_object(axes, cases, deaths) def test_germany_overview(): axes, cases, deaths = c.overview(country="Germany", region="Hamburg") assert cases.name == 'Germany-Hamburg cases' assert_oscovida_object(axes, cases, deaths) axes, cases, deaths = c.overview(country="Germany", subregion="LK Pinneberg") assert deaths.name == 'Germany-LK Pinneberg deaths' assert_oscovida_object(axes, cases, deaths) axes, cases, deaths = c.overview(country="Germany", subregion="SK Kassel") assert cases.name == 'Germany-SK Kassel cases' assert deaths.name == 'Germany-SK Kassel deaths' assert_oscovida_object(axes, cases, deaths) axes, cases, deaths = c.overview(country="Germany", subregion="Städteregion Aachen") assert cases.name == 'Germany-Städteregion Aachen cases' assert_oscovida_object(axes, cases, deaths) axes, cases, deaths = c.overview(country="Germany", subregion="Region Hannover") assert cases.name == 'Germany-Region Hannover cases' assert deaths.name == 'Germany-Region Hannover deaths' assert_oscovida_object(axes, cases, deaths) @pytest.mark.xfail def test_get_incidence_rates_germany(): number_of_german_districts = 412 cases, deaths = c.get_incidence_rates_germany() assert len(cases) == len(deaths) == number_of_german_districts cases, deaths = c.get_incidence_rates_germany(7) assert len(cases) == len(deaths) == number_of_german_districts def test_get_US_region_list(): x = c.get_US_region_list() assert x[0] == "Alabama" assert "Hawaii" in x assert len(x) > 50 # at least 50 states, plus diamond Princess def test_Hungary_overview(): axes, cases, deaths = c.overview(country="Hungary", region="Baranya") assert cases.name == 'Hungary-Baranya cases' assert deaths is None isinstance(cases, pd.Series) isinstance(deaths, type(None)) def test_get_Hungary_region_list(): x = c.get_counties_hungary() assert x[0] == "Bács-Kiskun" assert "Budapest" in x assert len(x) == 20 # 19 county and the capital city def test_fetch_data_hungary(): hungary = c.fetch_data_hungary() assert type(hungary) == pd.core.frame.DataFrame assert hungary.shape[1] == 21 # date, 19 counties, capital city assert 'Budapest' in hungary.columns def test_choose_random_counties(): # Hungary related with_local = c.choose_random_counties(exclude_region="Baranya", size=18) # print(with_local) assert 'Baranya' not in with_local assert len(with_local) == 19 def test_make_compare_plot_hungary(): with_local = c.choose_random_counties(exclude_region="Baranya", size=18) axes, cases, deaths = c.make_compare_plot_hungary("Baranya", compare_with_local=with_local) assert deaths is None assert type(cases) == pd.core.frame.DataFrame assert cases.shape[1] == 20 # counties and the capital city def test_label_from_region_subregion(): assert c.label_from_region_subregion(("Hamburg", None)) == "Hamburg" assert c.label_from_region_subregion("Hamburg") == "Hamburg" assert c.label_from_region_subregion(("Schleswig Holstein", "Pinneberg")) == "Schleswig Holstein-Pinneberg" def test_get_country_data(): # Germany cases, deaths = c.get_country_data(country="Germany", region="Bayern") assert isinstance(deaths, pd.Series) assert cases.name == 'Germany-Bayern cases' assert deaths.name == 'Germany-Bayern deaths' cases, deaths = c.get_country_data(country="Germany", subregion="SK Hamburg") assert isinstance(deaths, pd.Series) assert cases.name == 'Germany-SK Hamburg cases' assert deaths.name == 'Germany-SK Hamburg deaths' c2, d2 = c.get_country_data(country="United Kingdom") assert c2.name == "United Kingdom cases" assert d2.name == "United Kingdom deaths" def test_compute_daily_change(): cases, deaths = mock_get_country_data_johns_hopkins() change, smooth, smooth2 = c.compute_daily_change(cases) assert isinstance(change[0], pd.Series) # data assert isinstance(smooth[0], pd.Series) # data assert isinstance(smooth2[0], pd.Series) # data assert isinstance(change[1], str) # label assert isinstance(smooth[1], str) # label assert isinstance(smooth2[1], str) # label assert change[0].shape == (79,) assert smooth[0].shape == (79,) assert smooth2[0].shape == (79,) # The daily diffs should sum up to be the same as the total number in the # original series minus the first data point3 # The total number is the last data point in the input series, i.e. cases[-1] change_data = change[0] assert abs(change_data.sum() + cases[0] - cases[-1]) < 1e-8 # for the mock data: cases[-1] - cases[0] is 82393. Explicitely done: assert abs(change_data.sum() - 82393) < 1e-8 # assure that we haven't changed the data significantly when averaging and smoothing: # some change can come from # - nans, where the rolling function will 'create' a data point (but no nan's in this data set) # - missing points at the boundary, or interpolation at the boundary not based on 7 points. # # We just take the current values and assume they are correct. If the smoothing parameters # are changed, then these need to be updated. smooth_data = smooth[0] assert abs(smooth_data.sum() - 80740.4) < 1 smooth2_data = smooth2[0] assert abs(smooth2_data.sum() - 76903.86) < 1 def test_plot_daily_change(): cases, deaths = mock_get_country_data_johns_hopkins() fig, ax = plt.subplots() ax = c.plot_daily_change(ax, cases, 'C1') fig.savefig('test-plot_daily_change.pdf') def test_plot_incidence_rate(): cases, deaths = mock_get_country_data_johns_hopkins() fig, ax = plt.subplots() ax = c.plot_incidence_rate(ax, cases, cases.country) assert ax is not None assert "per 100K people" in ax.get_ylabel() fig.savefig('test-plot_daily_change.pdf') def test_compute_growth_factor(): cases, deaths = mock_get_country_data_johns_hopkins() f, smooth = c.compute_growth_factor(cases) assert isinstance(f[0], pd.Series) assert isinstance(smooth[0], pd.Series) assert isinstance(f[1], str) assert isinstance(smooth[1], str) assert f[0].shape == (79,) assert smooth[0].shape == (79,) # assure that we haven't changed the data significantly; some change can come from # - nans, where the rolling function will 'create' a data point (but no nan's in this data set) # - missing points at the boundary, or interpolation at the boundary not based on 7 points. # # We just take the current values and assume they are correct. If the smoothing parameters # are changed, then these need to be updated. assert abs(f[0].dropna().sum() - 70.8) < 0.1 # original data, should be the same as cases[-1] assert abs(smooth[0].sum() - 73.05) < 0.1 def test_plot_reproduction_number (): cases, deaths = mock_get_country_data_johns_hopkins() fig, ax = plt.subplots() ax = c.plot_reproduction_number(ax, cases, 'C1') fig.savefig('test-reproduction_number.pdf') def test_plot_reproduction_number_fetch_data(): """Similar to test above, but using fresh data""" for country in ["Korea, South", "China", "Germany"]: cases, deaths = c.get_country_data_johns_hopkins(country) fig, ax = plt.subplots() c.plot_reproduction_number(ax, cases, 'C1', labels=("Germany", "cases")); c.plot_reproduction_number(ax, deaths, 'C0', labels=("Germany", "deaths")); fig.savefig(f'test-reproduction_number-{country}.pdf') def test_compose_dataframe_summary(): cases, deaths = mock_get_country_data_johns_hopkins() table = c.compose_dataframe_summary(cases, deaths) assert table['total cases'][-1] == 643 # check that most recent data item is last # print(table) def test_get_cases_last_week(): index = pd.date_range(start='1/1/2018', end='1/08/2018', freq='D') z = pd.Series(np.zeros(shape=index.shape), index=index) assert c.get_cases_last_week(z) == 0 index = pd.date_range(start='1/1/2018', end='1/08/2018', freq='D') z = pd.Series(np.ones(shape=index.shape), index=index) assert c.get_cases_last_week(z) == 0 assert c.get_cases_last_week(z.cumsum()) == 7 cases, deaths = mock_get_country_data_johns_hopkins(country="China") assert c.get_cases_last_week(cases) == 430 def test_pad_cumulative_series_to_yesterday(): # create fake data now = datetime.datetime.now() today = now.replace(hour=0, minute=0, second=0, microsecond=0) yesterday = today - pd.Timedelta("1D") point1 = today - pd.Timedelta("10D") point2 = today - pd.Timedelta("3D") index = pd.date_range(start=point1, end=point2) x = pd.Series(data=range(len(index)), index=index) # 2020-05-18 0 # 2020-05-19 1 # 2020-05-20 2 # 2020-05-21 3 # 2020-05-22 4 # 2020-05-23 5 # 2020-05-24 6 # 2020-05-25 7 # Freq: D, dtype: int64 assert x[x.index.max()] == 7 x2 = c.pad_cumulative_series_to_yesterday(x) assert x2.index.max() == yesterday assert x2[-1] == 7 assert x2[-2] == 7 assert x2[-3] == 7 assert x2[-4] == 6 index2 = pd.date_range(start=point1, end=yesterday) y = pd.Series(data=range(len(index2)), index=index2) y2 = c.pad_cumulative_series_to_yesterday(y) assert y.shape == (10,) assert y2.shape == y.shape @pytest.mark.xfail def test_germany_get_population(): germany = c.germany_get_population() assert germany.index.name == 'county' assert 'population' in germany.columns assert 'cases7_per_100k' in germany.columns germany_data = c.fetch_data_germany() assert set(germany_data['Landkreis']) == set(germany.index) hamburg = germany.loc['SK Hamburg'].population assert hamburg > 1800000 pinneberg = germany.loc['LK Pinneberg'].population assert pinneberg > 30000 # https://github.com/oscovida/oscovida/issues/210 saarpfalz = germany.loc['LK Saarpfalz-Kreis'].population assert saarpfalz > 130000 aachen = germany.loc['Städteregion Aachen'].population assert aachen > 500000 def test_germany_get_population_data_online(): """If this test passes, then the population data for Germany may be online again (see https://github.com/oscovida/oscovida/issues/261) Hans, 21 August 2021.""" population = c.fetch_csv_data_from_url(c.rki_population_url) population = population.set_index('county') def test_germany_get_population_backup_data_raw(): """Sanity check for backup file""" df = c._germany_get_population_backup_data_raw() # expect 412 districts assert len(df) == 412 # expect about 83 million inhabitants pop = df['EWZ'] # EWZ = EinWohnerZahl = population total = pop.sum() assert 83e6 < total < 83.3e6 # as of Aug 2021: 83166711 def test_get_population(): world = c.get_population() assert world.index.name == 'Country_Region' assert 'population' in world.columns # Check that the case regions and population regions match try: assert set(c.fetch_cases().index) == set(world.index) except AssertionError: failing_states = {'Western Sahara'} if set(c.fetch_cases().index).symmetric_difference(set(world.index)) == failing_states: pass else: raise AssertionError # Tests will have to be updated in 20+ years when the populations increase # more than the 'sensible' lower bound placed here # The lower bound exists in case the summing over regions fails somehow # and includes areas multiple times assert 140_000_000 * 1.5 > world.loc['Russia'].population > 140_000_000 assert 120_000_000 * 1.5 > world.loc['Japan'].population > 120_000_000 assert 320_000_000 * 1.5 > world.loc['US'].population > 320_000_000 assert 80_000_000 * 1.5 > world.loc['Germany'].population > 80_000_000 def test_get_region_label(): countries = ["China", "Germany", "Hungary", "Russia", "US", "Zimbabwe"] for country in countries: assert c.get_region_label(country) == country assert c.get_region_label(country="US", region="New Jersey") == "United States: New Jersey" assert c.get_region_label(country="Germany", region="Hamburg") == "Germany-Hamburg" assert c.get_region_label(country="Germany", region="LK Pinneberg") == "Germany-LK Pinneberg" assert c.get_region_label(country="Hungary", region="Baranya") == "Hungary-Baranya" def test_population(): reference = [("Germany", None, None, 83E6), ("Germany", "Bayern", None, 13E6), ("Germany", None, "LK Pinneberg", 3.1E5), ("Russia", None, None, 1.4E8), ("Japan", "Kyoto", None, 2.6E6), ("US", "New Jersey", None, 8.7E6), ] for country, reg, subreg, ref_pop in reference: actual_population = c.population(country, reg, subreg) print(country) assert isinstance(actual_population, int) assert 0.8 * ref_pop < actual_population < 1.2 * ref_pop # Special cases # pass subregion as region for Germany pinneberg = c.population("Germany", "LK Pinneberg") assert isinstance(pinneberg, int) assert 3E5 < pinneberg < 4E5 # pass both region AND subregion with pytest.raises(NotImplementedError): c.population("Germany", "Schleswig-Holstein", "LK Pinneberg") def test_compare_plot(): assert_oscovida_object(*c.make_compare_plot("Russia")) assert_oscovida_object(*c.make_compare_plot("Namibia", normalise=True)) def test_compare_plot_germany(): assert_oscovida_object(*c.make_compare_plot_germany("Hamburg")) assert_oscovida_object(*c.make_compare_plot_germany("Hamburg", normalise=True)) assert_oscovida_object(*c.make_compare_plot_germany("Hamburg", weeks=7)) assert_oscovida_object(*c.make_compare_plot_germany("Bayern", normalise=True, weeks=8)) assert_oscovida_object(*c.make_compare_plot_germany("Bayern", normalise=True, dates="2020-05-10:2020-06-15")) with pytest.raises(ValueError): c.make_compare_plot_germany("Bayern", normalise=True, weeks=8, dates="2020-05-10:2020-06-15") def test_cut_dates(): cases, deaths = mock_get_country_data_johns_hopkins() cut1 = oph.cut_dates(cases, "2020-02-01:2020-02-20") assert len(cut1) == 20 cut2 = oph.cut_dates(cases, ":2020-02-20") assert len(cut2) == 30 cut3 = oph.cut_dates(cases, "2020-02-20:") assert len(cut3) == 51 with pytest.raises(ValueError): oph.cut_dates(cases, "2020-02-20") def test_day0atleast(): cases, deaths = mock_get_country_data_johns_hopkins() res = c.day0atleast(100, cases) assert type(res) == type(cases) assert len(res) == len(cases) assert len(res[res.index >= 0]) == len(cases) # should cut the first three values: res = c.day0atleast(1000, cases) assert type(res) == type(cases) assert len(res[res.index >= 0]) == len(cases) - 3 # should return an empty series res = c.day0atleast(100000, cases) assert type(res) == type(cases) assert len(res) == 0 def test_uncertain_tail(): cases, deaths = mock_get_country_data_johns_hopkins() fig, ax = plt.subplots() ax = c.plot_daily_change(ax, cases[:-30], 'C1') oph.uncertain_tail(ax, cases.diff().dropna(), days=30)
import unittest from json import loads from reversedns import Response, ErrorMessage _json_response_ok_empty = '''{ "result": [], "size": 0 }''' _json_response_ok = '''{ "result": [ { "value": "ac1.nstld.com 1634338343 1800 900 604800 86400", "name": "abc", "first_seen": 1634338366, "last_visit": 1634338366 }, { "value": "ac1.nstld.com 1634348393 1800 900 604800 86400", "name": "abc", "first_seen": 1634348416, "last_visit": 1634348416 } ], "size": 2 }''' _json_response_error = '''{ "code": 403, "messages": "Access restricted. Check credits balance or enter the correct API key." }''' class TestModel(unittest.TestCase): def test_response_parsing(self): response = loads(_json_response_ok) parsed = Response(response) self.assertEqual(parsed.size, response['size']) self.assertIsInstance(parsed.result, list) self.assertEqual(parsed.result[0].name, response['result'][0]['name']) def test_error_parsing(self): error = loads(_json_response_error) parsed_error = ErrorMessage(error) self.assertEqual(parsed_error.code, error['code']) self.assertEqual(parsed_error.message, error['messages'])
from env_Cleaner import EnvCleaner import random if __name__ == '__main__': env = EnvCleaner(2, 13, 0) max_iter = 1000 for i in range(max_iter): print("iter= ", i) env.render() action_list = [random.randint(0, 3), random.randint(0, 3)] reward = env.step(action_list) print('reward', reward)
'''Test the file 'indexengine.py' Run with `py.test test_indexengine.py` Author: Noémien Kocher Licence: MIT Date: june 2016 ''' import pytest import indexengine as iengine from math import log2 def test_settfidf(): # needed for the total number of documents and the norms # here the number of document is 2 # occurence of word 'wid1' in all documents is 1 # occurence of word 'wid1' in document 'did1' is 1 # norms of document 'did1' is arbitrarily 1.4 repo = { 'did1': [ 'url', 1.4, { 'bid1': 'wid1', 'bid2': 'content2' } ], 'did2': [ 'url', 1, { 'bid1': 'content3', } ] } ii = { 'wid1': [ 0, { # rank 'did1': [ 1, 0, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ] } ] } newrank = (1/1.4)*log2(2/1) truth = { 'wid1': [ 0, { 'did1': [ 1, newrank, { 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ] } ] } assert ii != truth iengine.settfidf(repo, ii) assert ii == truth def test_setwrank(): ii = { 'wid1': [ 0, { # rank 'did1': [ 1, 1.9, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ], 'did2': [ 1, 3.4, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ], 'did3': [ 1, 2.1, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ] } ], 'wid2': [ 0, { # rank 'did9': [ 1, 1.9, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ] } ] } truth = { 'wid1': [ 3.4, { # rank 'did1': [ 1, 1.9, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ], 'did2': [ 1, 3.4, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ], 'did3': [ 1, 2.1, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ] } ], 'wid2': [ 1.9, { # rank 'did9': [ 1, 1.9, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ] } ] } assert ii != truth iengine.setwrank(ii) assert ii == truth def test_mostranked(): ii = { 'wid1': [ 3.4, { # rank 'did1': [ 1, 1.9, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ], 'did2': [ 1, 3.4, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ], 'did3': [ 1, 2.1, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ] } ], 'wid2': [ 1.9, { # rank 'did9': [ 1, 1.9, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ] } ], 'wid3': [ 3.1, { # rank 'did9': [ 1, 1.9, { # nbHits, rank 'hlid1': [ ['bid1', 0, 0] # blockId, positon, domLevel ] } ] } ] } truth = ['wid1','wid3'] res = iengine.mostranked(2, ii) assert res == truth def test_getcontext(): repo = { 'docid': [ 'url1', 2.14, { # url, norms 1: 'This is content 1', 2: 'Content 2' } ], 'docid2' : [ 'url2', 1.12, { 1: 'Hello content, how are you?', 2: 'This is sparta.' } ] } ii = { 'content': [ 12.54, { # rank 'docid': [ 2, 1.54, [ # nbHits, rank [ 1, 8, 0, 'p' ], # blockId, position, domLevel, HTML tag [ 2, 0, 0, 'p' ] ] ], 'docid2': [ 1, 2.32, [ [ 1, 6, 0, 'h1' ] ] ] } ] } keys = ['content'] offset = 5 truth = [ [ 'content', 12.54, [ # wordId, rank [ 2.32, 'url2', [ # rank, url ['...ello ', ' how...'] # wbefore, wafter ], ], [ 1.54, 'url1', [ ['...s is ', '1'], ['', '2'] ] ] ] ] ] res = iengine.getcontext(repo, ii, keys, offset) assert res == truth
from templeplus.pymod import PythonModifier from toee import * import tpdp import char_class_utils import d20_action_utils ################################################### def GetConditionName(): return "Duelist" print "Registering " + GetConditionName() classEnum = stat_level_duelist preciseStrikeEnum = 2400 ################################################### #### standard callbacks - BAB and Save values def OnGetToHitBonusBase(attachee, args, evt_obj): classLvl = attachee.stat_level_get(classEnum) babvalue = game.get_bab_for_class(classEnum, classLvl) evt_obj.bonus_list.add(babvalue, 0, 137) # untyped, description: "Class" return 0 def OnGetSaveThrowFort(attachee, args, evt_obj): value = char_class_utils.SavingThrowLevel(classEnum, attachee, D20_Save_Fortitude) evt_obj.bonus_list.add(value, 0, 137) return 0 def OnGetSaveThrowReflex(attachee, args, evt_obj): value = char_class_utils.SavingThrowLevel(classEnum, attachee, D20_Save_Reflex) evt_obj.bonus_list.add(value, 0, 137) return 0 def OnGetSaveThrowWill(attachee, args, evt_obj): value = char_class_utils.SavingThrowLevel(classEnum, attachee, D20_Save_Will) evt_obj.bonus_list.add(value, 0, 137) return 0 def IsArmorless( obj ): armor = obj.item_worn_at(5) if armor != OBJ_HANDLE_NULL: armorFlags = armor.obj_get_int(obj_f_armor_flags) if armorFlags != ARMOR_TYPE_NONE: return 0 shield = obj.item_worn_at(11) if shield != OBJ_HANDLE_NULL: return 0 return 1 def IsRangedWeapon( weap ): weapFlags = weap.obj_get_int(obj_f_weapon_flags) if (weapFlags & OWF_RANGED_WEAPON) == 0: return 0 return 1 def CannyDefenseAcBonus(attachee, args, evt_obj): if not IsArmorless(attachee): return 0 weap = attachee.item_worn_at(3) if weap == OBJ_HANDLE_NULL or IsRangedWeapon(weap): weap = attachee.item_worn_at(4) if weap == OBJ_HANDLE_NULL or IsRangedWeapon(weap): return 0 duelistLvl = attachee.stat_level_get(classEnum) intScore = attachee.stat_level_get(stat_intelligence) intBonus = (intScore - 10)/2 if intBonus <= 0: return if duelistLvl < intBonus: intBonus = duelistLvl evt_obj.bonus_list.modify(intBonus , 3, 104) # Dexterity bonus, ~Class~[TAG_LEVEL_BONUSES] return 0 def ImprovedReactionInitBonus(attachee, args, evt_obj): duelistLvl = attachee.stat_level_get(classEnum) if duelistLvl < 2: return 0 bonVal = 2 if duelistLvl >= 8: bonVal = 4 evt_obj.bonus_list.add(bonVal, 0, 137 ) # adds untyped bonus to initiative return 0 def EnhancedMobility(attachee, args, evt_obj): duelistLvl = attachee.stat_level_get(classEnum) if duelistLvl < 3: return 0 if not IsArmorless(attachee): return 0 if evt_obj.attack_packet.get_flags() & D20CAF_AOO_MOVEMENT: evt_obj.bonus_list.add(4, 8, 137 ) # adds +4 dodge bonus return 0 def GraceReflexBonus(attachee, args, evt_obj): duelistLvl = attachee.stat_level_get(classEnum) if duelistLvl < 4: return 0 if not IsArmorless(attachee): return 0 evt_obj.bonus_list.add(2, 34, 137) # Competence bonus return 0 # def PreciseStrikeRadial(attachee, args, evt_obj): # duelistLvl = attachee.stat_level_get(classEnum) # if (duelistLvl < 5): # return 0 ## add radial menu action Precise Strike # radialAction = tpdp.RadialMenuEntryPythonAction(-1, D20A_PYTHON_ACTION, preciseStrikeEnum, 0, "TAG_INTERFACE_HELP") # radialParentId = radialAction.add_child_to_standard(attachee, tpdp.RadialMenuStandardNode.Class) # return 0 # def OnPreciseStrikeCheck(attachee, args, evt_obj): # if (not IsUsingLightOrOneHandedPiercing(attachee)): # evt_obj.return_val = AEC_WRONG_WEAPON_TYPE # return 0 # tgt = evt_obj.d20a.target # stdChk = ActionCheckTargetStdAtk(attachee, tgt) # if (stdChk != AEC_OK): # evt_obj.return_val = stdChk # return 0 # def OnPreciseStrikePerform(attachee, args, evt_obj): # print "I performed!" # return 0 preciseStrikeString = "Precise Strike" def PreciseStrikeDamageBonus(attachee, args, evt_obj): duelistLvl = attachee.stat_level_get(classEnum) if duelistLvl < 5: return 0 # check if attacking with one weapon and without a shield if (attachee.item_worn_at(4) != OBJ_HANDLE_NULL and attachee.item_worn_at(3) != OBJ_HANDLE_NULL) or attachee.item_worn_at(11) != OBJ_HANDLE_NULL: return 0 # check if light or one handed piercing if not IsUsingLightOrOneHandedPiercing(attachee): return 0 tgt = evt_obj.attack_packet.target if tgt == OBJ_HANDLE_NULL: # shouldn't happen but better be safe return 0 if tgt.d20_query(Q_Critter_Is_Immune_Critical_Hits): return 0 damage_dice = dice_new('1d6') if duelistLvl >= 10: damage_dice.number = 2 evt_obj.damage_packet.add_dice(damage_dice, -1, 127 ) return 0 def ElaborateParry(attachee, args, evt_obj): duelistLvl = attachee.stat_level_get(classEnum) if duelistLvl < 7: return 0 if not attachee.d20_query(Q_FightingDefensively): # this also covers Total Defense return 0 evt_obj.bonus_list.add(duelistLvl , 8, 137) # Dodge bonus, ~Class~[TAG_LEVEL_BONUSES] return 0 def IsUsingLightOrOneHandedPiercing( obj ): weap = obj.item_worn_at(3) offhand = obj.item_worn_at(4) if weap == OBJ_HANDLE_NULL and offhand == OBJ_HANDLE_NULL: return 0 if weap == OBJ_HANDLE_NULL: weap = offhand offhand = OBJ_HANDLE_NULL if IsWeaponLightOrOneHandedPiercing(obj, weap): return 1 # check the offhand if offhand != OBJ_HANDLE_NULL: if IsWeaponLightOrOneHandedPiercing(obj, offhand): return 1 return 0 def IsWeaponLightOrOneHandedPiercing( obj, weap): # truth table # nor. | enlarged | return # 0 x 1 assume un-enlarged state # 1 0 1 shouldn't be possible... unless it's actually reduce person (I don't really care about that) # 1 1 is_piercing # 1 2 is_piercing # 2 x 0 # 3 x 0 normalWieldType = obj.get_wield_type(weap, 1) # "normal" means weapon is not enlarged if normalWieldType >= 2: # two handed or unwieldable return 0 if normalWieldType == 0: return 1 # otherwise if the weapon is also enlarged; wieldType = obj.get_wield_type(weap, 0) if wieldType == 0: return 1 # weapon is not light, but is one handed - check if piercing attackType = weap.obj_get_int(obj_f_weapon_attacktype) if attackType == D20DT_PIERCING: # should be strictly piercing from what I understand (supposed to be rapier-like) return 1 return 0 def DuelistDeflectArrows(attachee, args, evt_obj): duelistLvl = attachee.stat_level_get(classEnum) if duelistLvl < 9: return 0 offendingWeapon = evt_obj.attack_packet.get_weapon_used() if offendingWeapon == OBJ_HANDLE_NULL: return 0 if not (evt_obj.attack_packet.get_flags() & D20CAF_RANGED): return 0 # check if attacker visible attacker = evt_obj.attack_packet.attacker if attacker == OBJ_HANDLE_NULL: return 0 if attacker.d20_query(Q_Critter_Is_Invisible) and not attachee.d20_query(Q_Critter_Can_See_Invisible): return 0 if attachee.d20_query(Q_Critter_Is_Blinded): return 0 # check flatfooted if attachee.d20_query(Q_Flatfooted): return 0 # check light weapon or one handed piercing if not IsUsingLightOrOneHandedPiercing(attachee): return 0 atkflags = evt_obj.attack_packet.get_flags() atkflags |= D20CAF_DEFLECT_ARROWS atkflags &= ~(D20CAF_HIT | D20CAF_CRITICAL) evt_obj.attack_packet.set_flags(atkflags) return 0 classSpecObj = PythonModifier(GetConditionName(), 0) classSpecObj.AddHook(ET_OnToHitBonusBase, EK_NONE, OnGetToHitBonusBase, ()) classSpecObj.AddHook(ET_OnSaveThrowLevel, EK_SAVE_FORTITUDE, OnGetSaveThrowFort, ()) classSpecObj.AddHook(ET_OnSaveThrowLevel, EK_SAVE_REFLEX, OnGetSaveThrowReflex, ()) classSpecObj.AddHook(ET_OnSaveThrowLevel, EK_SAVE_WILL, OnGetSaveThrowWill, ()) classSpecObj.AddHook(ET_OnGetAC, EK_NONE, CannyDefenseAcBonus, ()) classSpecObj.AddHook(ET_OnGetAC, EK_NONE, EnhancedMobility, ()) classSpecObj.AddHook(ET_OnGetAC, EK_NONE, ElaborateParry, ()) classSpecObj.AddHook(ET_OnGetInitiativeMod, EK_NONE, ImprovedReactionInitBonus, ()) classSpecObj.AddHook(ET_OnSaveThrowLevel, EK_SAVE_REFLEX, GraceReflexBonus, ()) classSpecObj.AddHook(ET_OnDealingDamage, EK_NONE, PreciseStrikeDamageBonus, ()) classSpecObj.AddHook(ET_OnDeflectArrows, EK_NONE, DuelistDeflectArrows, ())
from pyhop_anytime import * global state, goals state = State('state') state.calibration_target = Oset([('instrument0','groundstation0'),('instrument1','star3'),('instrument10','star3'),('instrument11','star1'),('instrument12','groundstation0'),('instrument13','star1'),('instrument14','groundstation2'),('instrument15','groundstation4'),('instrument16','star1'),('instrument17','groundstation0'),('instrument18','star1'),('instrument19','groundstation4'),('instrument2','groundstation0'),('instrument20','star1'),('instrument21','star1'),('instrument22','groundstation0'),('instrument23','star3'),('instrument3','groundstation4'),('instrument4','groundstation2'),('instrument5','groundstation4'),('instrument6','groundstation2'),('instrument7','groundstation0'),('instrument8','groundstation4'),('instrument9','star1')]) state.on_board = Oset([('instrument0','satellite0'),('instrument1','satellite1'),('instrument10','satellite4'),('instrument11','satellite5'),('instrument12','satellite6'),('instrument13','satellite6'),('instrument14','satellite6'),('instrument15','satellite7'),('instrument16','satellite8'),('instrument17','satellite8'),('instrument18','satellite9'),('instrument19','satellite9'),('instrument2','satellite1'),('instrument20','satellite10'),('instrument21','satellite10'),('instrument22','satellite10'),('instrument23','satellite11'),('instrument3','satellite2'),('instrument4','satellite2'),('instrument5','satellite2'),('instrument6','satellite3'),('instrument7','satellite3'),('instrument8','satellite3'),('instrument9','satellite4')]) state.pointing = Oset([('satellite0','planet5'),('satellite1','planet5'),('satellite10','star22'),('satellite11','star8'),('satellite2','star21'),('satellite3','star21'),('satellite4','star22'),('satellite5','groundstation2'),('satellite6','phenomenon20'),('satellite7','planet12'),('satellite8','phenomenon23'),('satellite9','phenomenon20')]) state.power_avail = Oset(['satellite0','satellite1','satellite10','satellite11','satellite2','satellite3','satellite4','satellite5','satellite6','satellite7','satellite8','satellite9']) state.supports = Oset([('instrument0','infrared3'),('instrument1','image0'),('instrument1','infrared2'),('instrument10','image0'),('instrument10','image4'),('instrument11','infrared2'),('instrument12','image4'),('instrument13','image4'),('instrument14','infrared2'),('instrument14','thermograph1'),('instrument15','image0'),('instrument15','thermograph1'),('instrument16','image0'),('instrument16','infrared2'),('instrument17','infrared3'),('instrument18','image4'),('instrument18','infrared2'),('instrument18','thermograph1'),('instrument19','infrared3'),('instrument2','image0'),('instrument2','thermograph1'),('instrument20','infrared2'),('instrument21','image0'),('instrument21','thermograph1'),('instrument22','thermograph1'),('instrument23','image4'),('instrument23','infrared2'),('instrument23','thermograph1'),('instrument3','infrared2'),('instrument3','infrared3'),('instrument4','infrared2'),('instrument4','infrared3'),('instrument4','thermograph1'),('instrument5','thermograph1'),('instrument6','image0'),('instrument6','infrared2'),('instrument7','image0'),('instrument7','infrared3'),('instrument8','image0'),('instrument8','image4'),('instrument8','infrared2'),('instrument9','infrared3')]) state.calibrated = Oset() state.have_image = Oset() state.power_on = Oset() goals = State('goals') goals.have_image = Oset([('phenomenon14','infrared2'),('phenomenon15','infrared2'),('phenomenon17','thermograph1'),('phenomenon23','infrared3'),('phenomenon24','infrared3'),('phenomenon9','image4'),('planet11','image4'),('planet12','thermograph1'),('planet13','infrared3'),('planet16','infrared2'),('planet5','image0'),('planet6','image4'),('planet7','image4'),('star10','thermograph1'),('star18','image4'),('star21','thermograph1'),('star22','image4')]) goals.pointing = Oset([('satellite1','star22'),('satellite4','phenomenon20'),('satellite8','planet16')])
from flask_restful import Resource from models.article import ArticleModel class Articles(Resource): # GET method def get(self): return {'articles': [article.json() for article in ArticleModel.objects()]}
from django import template from django.conf import settings register = template.Library() @register.simple_tag def site_name(): return settings.SITE_NAME @register.simple_tag def site_root(): return settings.SITE_ROOT @register.simple_tag def site_scheme(): parts = settings.SITE_ROOT.split("://") assert parts[0] in ("http", "https") return parts[0] @register.simple_tag def site_hostname(): parts = settings.SITE_ROOT.split("://") return parts[1] @register.simple_tag def site_version(): return settings.VERSION @register.simple_tag def nav_css_class(page_class): if not page_class: return "" else: return page_class
# -*- coding: utf-8 -*- """ Created on Tue Apr 28 15:56:24 2020 @author: giova """ # running stuff with the correct analysis def run(mesh, bcs, material_lib, parameters): solverType = parameters["solver"]["type"] exec("from "+solverType+" import "+solverType) U,K = eval (solverType+"(mesh, bcs, material_lib, parameters)") # ...you might want to have a safer approach to eval: # https://www.geeksforgeeks.org/eval-in-python/ return U,K
import os from os.path import join import pandas as pd import numpy as np import torch from Hessian.GAN_hessian_compute import hessian_compute # from hessian_analysis_tools import scan_hess_npz, plot_spectra, average_H, compute_hess_corr, plot_consistency_example # from hessian_axis_visualize import vis_eigen_explore, vis_eigen_action, vis_eigen_action_row, vis_eigen_explore_row from GAN_utils import loadStyleGAN2, StyleGAN2_wrapper, loadBigGAN, BigGAN_wrapper, loadPGGAN, PGGAN_wrapper import matplotlib.pylab as plt import matplotlib #%% device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') import lpips ImDist = lpips.LPIPS(net="squeeze").cuda() # SSIM import pytorch_msssim D = pytorch_msssim.SSIM() # note SSIM, higher the score the more similar they are. So to confirm to the distance convention, we use 1 - SSIM as a proxy to distance. # L2 / MSE def MSE(im1, im2): return (im1 - im2).pow(2).mean(dim=[1,2,3]) # L1 / MAE # def L1(im1, im2): # return (im1 - im2).abs().mean(dim=[1,2,3]) # Note L1 is less proper for this task, as it's farther away from a distance square function. #%% Utility functions to quantify relationship between 2 eigvals or 2 Hessians. def spectra_cmp(eigvals1, eigvals2, show=True): cc = np.corrcoef((eigvals1), (eigvals2))[0, 1] logcc = np.corrcoef(np.log10(np.abs(eigvals1)+1E-8), np.log10(np.abs(eigvals2)+1E-8))[0, 1] reg_coef = np.polyfit((eigvals1), (eigvals2), 1) logreg_coef = np.polyfit(np.log10(np.abs(eigvals1)+1E-8), np.log10(np.abs(eigvals2)+1E-8), 1) if show: print("Correlation %.3f (lin) %.3f (log). Regress Coef [%.2f, %.2f] (lin) [%.2f, %.2f] (log)"% (cc, logcc, *tuple(reg_coef), *tuple(logreg_coef))) return cc, logcc, reg_coef, logreg_coef def Hessian_cmp(eigvals1, eigvecs1, H1, eigvals2, eigvecs2, H2, show=True): H_cc = np.corrcoef(H1.flatten(), H2.flatten())[0,1] logH1 = eigvecs1 * np.log10(np.abs(eigvals1))[np.newaxis, :] @ eigvecs1.T logH2 = eigvecs2 * np.log10(np.abs(eigvals2))[np.newaxis, :] @ eigvecs2.T logH_cc = np.corrcoef(logH1.flatten(), logH2.flatten())[0, 1] if show: print("Entrywise Correlation Hessian %.3f log Hessian %.3f (log)"% (H_cc, logH_cc,)) return H_cc, logH_cc def top_eigvec_corr(eigvects1, eigvects2, eignum=10): cc_arr = [] for eigi in range(eignum): cc = np.corrcoef(eigvects1[:, -eigi-1], eigvects2[:, -eigi-1])[0, 1] cc_arr.append(cc) return np.abs(cc_arr) def eigvec_H_corr(eigvals1, eigvects1, H1, eigvals2, eigvects2, H2, show=True): vHv12 = np.diag(eigvects1.T @ H2 @ eigvects1) vHv21 = np.diag(eigvects2.T @ H1 @ eigvects2) cc_12 = np.corrcoef(vHv12, eigvals2)[0, 1] cclog_12 = np.corrcoef(np.log(np.abs(vHv12)+1E-8), np.log(np.abs(eigvals2+1E-8)))[0, 1] cc_21 = np.corrcoef(vHv21, eigvals1)[0, 1] cclog_21 = np.corrcoef(np.log(np.abs(vHv21)+1E-8), np.log(np.abs(eigvals1+1E-8)))[0, 1] if show: print("Applying eigvec 1->2: corr %.3f (lin) %.3f (log)"%(cc_12, cclog_12)) print("Applying eigvec 2->1: corr %.3f (lin) %.3f (log)"%(cc_21, cclog_21)) return cc_12, cclog_12, cc_21, cclog_21 #%% saveroot = r"E:\Cluster_Backup" #%% BGAN = loadBigGAN() G = BigGAN_wrapper(BGAN) savedir = join(saveroot, "ImDist_cmp\\BigGAN") os.makedirs(savedir, exist_ok=True) SSIM_stat_col = [] MSE_stat_col = [] for idx in range(100): refvec = G.sample_vector(1, device="cuda")# 0.1 * torch.randn(1, 256) eigvals_PS, eigvects_PS, H_PS = hessian_compute(G, refvec, ImDist, hessian_method="BP") eigvals_SSIM, eigvects_SSIM, H_SSIM = hessian_compute(G, refvec, D, hessian_method="BP") eigvals_MSE, eigvects_MSE, H_MSE = hessian_compute(G, refvec, MSE, hessian_method="BP") #% eigvals_L1, eigvects_L1, H_L1 = hessian_compute(G, refvec, L1, hessian_method="BP") print("SSIM - LPIPS comparison") cc_SSIM, logcc_SSIM, reg_coef_SSIM, logreg_coef_SSIM = spectra_cmp(-eigvals_SSIM[::-1], eigvals_PS, show=True) H_cc_SSIM, logH_cc_SSIM = Hessian_cmp(-eigvals_SSIM[::-1], eigvects_SSIM, -H_SSIM, eigvals_PS, eigvects_PS, H_PS, show=True) SSIM_stat_col.append((idx, cc_SSIM, logcc_SSIM, *tuple(reg_coef_SSIM), *tuple(logreg_coef_SSIM), H_cc_SSIM, logH_cc_SSIM)) print("MSE - LPIPS comparison") cc_MSE, logcc_MSE, reg_coef_MSE, logreg_coef_MSE = spectra_cmp(eigvals_MSE, eigvals_PS, show=True) H_cc_MSE, logH_cc_MSE = Hessian_cmp(eigvals_MSE, eigvects_MSE, H_MSE, eigvals_PS, eigvects_PS, H_PS, show=True) MSE_stat_col.append((idx, cc_MSE, logcc_MSE, *tuple(reg_coef_MSE), *tuple(logreg_coef_MSE), H_cc_MSE, logH_cc_MSE)) np.savez(join(savedir,"Hess_cmp_%03d.npz"%idx), **{"eva_PS":eigvals_PS, "evc_PS":eigvects_PS, "H_PS":H_PS, "eva_SSIM":eigvals_SSIM, "evc_SSIM":eigvects_SSIM, "H_SSIM":H_SSIM, "eva_MSE":eigvals_MSE, "evc_MSE":eigvects_MSE, "H_MSE":H_MSE,}) np.savez(join(savedir, "H_cmp_stat.npz"), MSE_stat=MSE_stat_col, SSIM_stat=SSIM_stat_col) MSE_stat_tab = pd.DataFrame(MSE_stat_col, columns=["id", "cc", "logcc", "reg_slop", "reg_intcp", "reg_log_slop", "reg_log_intcp", "H_cc", "logH_cc"]) MSE_stat_tab.to_csv(join(savedir, "H_cmp_MSE_stat.csv")) SSIM_stat_tab = pd.DataFrame(SSIM_stat_col, columns=["id", "cc", "logcc", "reg_slop", "reg_intcp", "reg_log_slop", "reg_log_intcp", "H_cc", "logH_cc"]) SSIM_stat_tab.to_csv(join(savedir, "H_cmp_SSIM_stat.csv")) del G, BGAN torch.cuda.empty_cache() #%% PGGAN = loadPGGAN() G = PGGAN_wrapper(PGGAN) savedir = join(saveroot, "ImDist_cmp\\PGGAN") os.makedirs(savedir, exist_ok=True) SSIM_stat_col = [] MSE_stat_col = [] for idx in range(100): refvec = G.sample_vector(1, device="cuda")# 0.1 * torch.randn(1, 256) eigvals_PS, eigvects_PS, H_PS = hessian_compute(G, refvec, ImDist, hessian_method="BP") eigvals_SSIM, eigvects_SSIM, H_SSIM = hessian_compute(G, refvec, D, hessian_method="BP") eigvals_MSE, eigvects_MSE, H_MSE = hessian_compute(G, refvec, MSE, hessian_method="BP") #% eigvals_L1, eigvects_L1, H_L1 = hessian_compute(G, refvec, L1, hessian_method="BP") print("SSIM - LPIPS comparison") cc_SSIM, logcc_SSIM, reg_coef_SSIM, logreg_coef_SSIM = spectra_cmp(-eigvals_SSIM[::-1], eigvals_PS, show=True) H_cc_SSIM, logH_cc_SSIM = Hessian_cmp(-eigvals_SSIM[::-1], eigvects_SSIM, -H_SSIM, eigvals_PS, eigvects_PS, H_PS, show=True) SSIM_stat_col.append((idx, cc_SSIM, logcc_SSIM, *tuple(reg_coef_SSIM), *tuple(logreg_coef_SSIM), H_cc_SSIM, logH_cc_SSIM)) print("MSE - LPIPS comparison") cc_MSE, logcc_MSE, reg_coef_MSE, logreg_coef_MSE = spectra_cmp(eigvals_MSE, eigvals_PS, show=True) H_cc_MSE, logH_cc_MSE = Hessian_cmp(eigvals_MSE, eigvects_MSE, H_MSE, eigvals_PS, eigvects_PS, H_PS, show=True) MSE_stat_col.append((idx, cc_MSE, logcc_MSE, *tuple(reg_coef_MSE), *tuple(logreg_coef_MSE), H_cc_MSE, logH_cc_MSE)) np.savez(join(savedir,"Hess_cmp_%03d.npz"%idx), **{"eva_PS":eigvals_PS, "evc_PS":eigvects_PS, "H_PS":H_PS, "eva_SSIM":eigvals_SSIM, "evc_SSIM":eigvects_SSIM, "H_SSIM":H_SSIM, "eva_MSE":eigvals_MSE, "evc_MSE":eigvects_MSE, "H_MSE":H_MSE,}) np.savez(join(savedir, "H_cmp_stat.npz"), MSE_stat=MSE_stat_col, SSIM_stat=SSIM_stat_col) MSE_stat_tab = pd.DataFrame(MSE_stat_col, columns=["id", "cc", "logcc", "reg_slop", "reg_intcp", "reg_log_slop", "reg_log_intcp", "H_cc", "logH_cc"]) MSE_stat_tab.to_csv(join(savedir, "H_cmp_MSE_stat.csv")) SSIM_stat_tab = pd.DataFrame(SSIM_stat_col, columns=["id", "cc", "logcc", "reg_slop", "reg_intcp", "reg_log_slop", "reg_log_intcp", "H_cc", "logH_cc"]) SSIM_stat_tab.to_csv(join(savedir, "H_cmp_SSIM_stat.csv")) #%% modelsnm = "Face256" SGAN = loadStyleGAN2("ffhq-256-config-e-003810.pt", size=256,) G = StyleGAN2_wrapper(SGAN, ) savedir = join(saveroot, "ImDist_cmp\\StyleGAN2\\Face256") os.makedirs(savedir, exist_ok=True) SSIM_stat_col = [] MSE_stat_col = [] for idx in range(100): refvec = G.sample_vector(1, device="cuda")# 0.1 * torch.randn(1, 256) eigvals_PS, eigvects_PS, H_PS = hessian_compute(G, refvec, ImDist, hessian_method="BP") eigvals_SSIM, eigvects_SSIM, H_SSIM = hessian_compute(G, refvec, D, hessian_method="BP") eigvals_MSE, eigvects_MSE, H_MSE = hessian_compute(G, refvec, MSE, hessian_method="BP") #% eigvals_L1, eigvects_L1, H_L1 = hessian_compute(G, refvec, L1, hessian_method="BP") print("SSIM - LPIPS comparison") cc_SSIM, logcc_SSIM, reg_coef_SSIM, logreg_coef_SSIM = spectra_cmp(-eigvals_SSIM[::-1], eigvals_PS, show=True) H_cc_SSIM, logH_cc_SSIM = Hessian_cmp(-eigvals_SSIM[::-1], eigvects_SSIM, -H_SSIM, eigvals_PS, eigvects_PS, H_PS, show=True) SSIM_stat_col.append((idx, cc_SSIM, logcc_SSIM, *tuple(reg_coef_SSIM), *tuple(logreg_coef_SSIM), H_cc_SSIM, logH_cc_SSIM)) print("MSE - LPIPS comparison") cc_MSE, logcc_MSE, reg_coef_MSE, logreg_coef_MSE = spectra_cmp(eigvals_MSE, eigvals_PS, show=True) H_cc_MSE, logH_cc_MSE = Hessian_cmp(eigvals_MSE, eigvects_MSE, H_MSE, eigvals_PS, eigvects_PS, H_PS, show=True) MSE_stat_col.append((idx, cc_MSE, logcc_MSE, *tuple(reg_coef_MSE), *tuple(logreg_coef_MSE), H_cc_MSE, logH_cc_MSE)) np.savez(join(savedir,"Hess_cmp_%03d.npz"%idx), **{"eva_PS":eigvals_PS, "evc_PS":eigvects_PS, "H_PS":H_PS, "eva_SSIM":eigvals_SSIM, "evc_SSIM":eigvects_SSIM, "H_SSIM":H_SSIM, "eva_MSE":eigvals_MSE, "evc_MSE":eigvects_MSE, "H_MSE":H_MSE,}) np.savez(join(savedir, "H_cmp_stat.npz"), MSE_stat=MSE_stat_col, SSIM_stat=SSIM_stat_col) MSE_stat_tab = pd.DataFrame(MSE_stat_col, columns=["id", "cc", "logcc", "reg_slop", "reg_intcp", "reg_log_slop", "reg_log_intcp", "H_cc", "logH_cc"]) MSE_stat_tab.to_csv(join(savedir, "H_cmp_MSE_stat.csv")) SSIM_stat_tab = pd.DataFrame(SSIM_stat_col, columns=["id", "cc", "logcc", "reg_slop", "reg_intcp", "reg_log_slop", "reg_log_intcp", "H_cc", "logH_cc"]) SSIM_stat_tab.to_csv(join(savedir, "H_cmp_SSIM_stat.csv")) #%% cc = np.corrcoef((-eigvals), (eigvals_PS[::-1]))[0, 1] logcc = np.corrcoef(np.log10(-eigvals), np.log10(eigvals_PS[::-1]))[0, 1] logreg_coef = np.polyfit(np.log10(-eigvals), np.log10(eigvals_PS[::-1]),1) reg_coef = np.polyfit((-eigvals), (eigvals_PS[::-1]), 1) #%% functions to compare the Hessian computed by different distance function at same location. #%% im1 = G.visualize(torch.randn(1,256).cuda()) im2 = G.visualize(torch.randn(1,256).cuda()) D(im1, im2) refvec = 0.1 * torch.randn(1,256) eigvals, eigvects, H = hessian_compute(G, refvec, D, hessian_method="BP") #%% #%% from glob import glob # savedir = join(saveroot, "ImDist_cmp\\BigGAN") savedir = join(saveroot, "ImDist_cmp\\PGGAN") savedir = join(saveroot, "ImDist_cmp\\StyleGAN2\\Face256") fullfns = glob(join(savedir, "Hess_cmp_*.npz")) npzpatt = "Hess_cmp_%03d.npz" SSIM_stat_col = [] MSE_stat_col = [] for idx, fn in enumerate(fullfns): assert (npzpatt % idx) in fn data = np.load(fn) eigvals_PS, eigvects_PS, H_PS = data["eva_PS"], data["evc_PS"], data["H_PS"] eigvals_SSIM, eigvects_SSIM, H_SSIM = data["eva_SSIM"], data["evc_SSIM"], data["H_SSIM"] eigvals_MSE, eigvects_MSE, H_MSE = data["eva_MSE"], data["evc_MSE"], data["H_MSE"] print("SSIM - LPIPS comparison") cc_SSIM, logcc_SSIM, reg_coef_SSIM, logreg_coef_SSIM = spectra_cmp(-eigvals_SSIM[::-1], eigvals_PS, show=True) H_cc_SSIM, logH_cc_SSIM = Hessian_cmp(-eigvals_SSIM[::-1], eigvects_SSIM[:, ::-1], -H_SSIM, eigvals_PS, eigvects_PS, H_PS, show=True) xcc_SSIM2PS, xlogcc_SSIM2PS, xcc_PS2SSIM, xlogcc_PS2SSIM = eigvec_H_corr(-eigvals_SSIM[::-1], eigvects_SSIM[:, ::-1], -H_SSIM, eigvals_PS, eigvects_PS, H_PS, show=True) evc_cc_SSIM = top_eigvec_corr(eigvects_SSIM[:, ::-1], eigvects_PS, eignum=10) SSIM_stat_col.append((idx, cc_SSIM, logcc_SSIM, *tuple(reg_coef_SSIM), *tuple(logreg_coef_SSIM), H_cc_SSIM, logH_cc_SSIM, xcc_SSIM2PS, xlogcc_SSIM2PS, xcc_PS2SSIM, xlogcc_PS2SSIM, *tuple(evc_cc_SSIM))) print("MSE - LPIPS comparison") cc_MSE, logcc_MSE, reg_coef_MSE, logreg_coef_MSE = spectra_cmp(eigvals_MSE, eigvals_PS, show=True) H_cc_MSE, logH_cc_MSE = Hessian_cmp(eigvals_MSE, eigvects_MSE, H_MSE, eigvals_PS, eigvects_PS, H_PS, show=True) xcc_MSE2PS, xlogcc_MSE2PS, xcc_PS2MSE, xlogcc_PS2MSE,= eigvec_H_corr(eigvals_MSE, eigvects_MSE, H_MSE, eigvals_PS, eigvects_PS, H_PS, show=True) evc_cc_MSE = top_eigvec_corr(eigvects_MSE, eigvects_PS, eignum=10) MSE_stat_col.append((idx, cc_MSE, logcc_MSE, *tuple(reg_coef_MSE), *tuple(logreg_coef_MSE), H_cc_MSE, logH_cc_MSE, xcc_MSE2PS, xlogcc_MSE2PS, xcc_PS2MSE, xlogcc_PS2MSE, *tuple(evc_cc_MSE))) np.savez(join(savedir, "H_cmp_stat.npz"), MSE_stat=MSE_stat_col, SSIM_stat=SSIM_stat_col) SSIM_stat_tab = pd.DataFrame(SSIM_stat_col, columns=["id", "cc", "logcc", "reg_slop", "reg_intcp", "reg_log_slop", "reg_log_intcp", "H_cc", "logH_cc", "xcc_SSIM2PS", "xlogcc_SSIM2PS", "xcc_PS2SSIM", "xlogcc_PS2SSIM"] + ["eigvec%d_cc" % i for i in range(10)]) SSIM_stat_tab.to_csv(join(savedir, "H_cmp_SSIM_stat.csv")) MSE_stat_tab = pd.DataFrame(MSE_stat_col, columns=["id", "cc", "logcc", "reg_slop", "reg_intcp", "reg_log_slop", "reg_log_intcp", "H_cc", "logH_cc", "xcc_MSE2PS", "xlogcc_MSE2PS", "xcc_PS2MSE", "xlogcc_PS2MSE"] + ["eigvec%d_cc" % i for i in range(10)]) MSE_stat_tab.to_csv(join(savedir, "H_cmp_MSE_stat.csv")) #%% Final Synopsis across GANs. GANdir_col = ["ImDist_cmp\\BigGAN", "ImDist_cmp\\PGGAN", "ImDist_cmp\\StyleGAN2\\Face256"] GANnms = ["BigGAN", "PGGAN", "StyleGAN2"] Stats_nms = ["H_cc", "logH_cc", "cc", "logcc", "xcc_MSE2PS", "xlogcc_MSE2PS", "reg_log_slop", "reg_log_intcp"] for GANnm, GANdir in zip(GANnms, GANdir_col): print("\n%s MSE - PS" % GANnm, end="\t") savedir = join(saveroot, GANdir) tab = pd.read_csv(join(savedir, "H_cmp_MSE_stat.csv")) meanstd_tab = pd.concat([tab.mean(axis=0), tab.std(axis=0)], 1).rename(columns={0: "mean", 1: "std"}) keystats = meanstd_tab.loc[ ["H_cc", "logH_cc", "cc", "logcc", "xcc_MSE2PS", "xlogcc_MSE2PS", "reg_log_slop", "reg_log_intcp"]] # print(keystats) for varnm, row in keystats.iterrows(): print("%.2f(%.2f)" % (row[0], row[1]), end="\t") print("\n%s SSIM - PS" % GANnm, end="\t") tab = pd.read_csv(join(savedir, "H_cmp_SSIM_stat.csv")) meanstd_tab = pd.concat([tab.mean(axis=0), tab.std(axis=0)], 1).rename(columns={0:"mean",1:"std"}) keystats = meanstd_tab.loc[ ["H_cc", "logH_cc", "cc", "logcc", "xcc_SSIM2PS", "xlogcc_SSIM2PS", "reg_log_slop", "reg_log_intcp"]] for varnm, row in keystats.iterrows(): print("%.2f(%.2f)" % (row[0], row[1]), end="\t")
import os.path import numpy as np import scipy.io import pandas as pd import h5py DATA_DIR = "/home/fischer/projects/ROC/01_data/" def load_coexp(file_prefix): network = np.loadtxt(file_prefix + ".txt.gz") with open(file_prefix + "_genes.txt") as fp: genes = fp.read().splitlines() return network, genes def mouse_ppi(): return load_ppi(os.path.join(DATA_DIR, "biogrid_mouse")) def load_ppi(file_prefix): network = scipy.io.mmread(file_prefix + "_ppi.txt").A with open(file_prefix + "_genes.txt") as fp: genes = fp.read().splitlines() return network, genes def load_go_mouse(): result = load_go(os.path.join(DATA_DIR, "go_mouse")) return result[0].T, result[2], result[1] def load_go(file_prefix): network = scipy.io.mmread(file_prefix + ".txt").A with open(file_prefix + "_row_labels.txt") as fp: genes = fp.read().splitlines() with open(file_prefix + "_col_labels.txt") as fp: terms = fp.read().splitlines() return network, genes, terms def mouse_coexp(): f = h5py.File(os.path.join(DATA_DIR, "mouse_cococonet_210420.hdf5"), "r") network = np.array(f["agg"]) genes = list(g.decode("utf-8") for g in f["row"]) mouse_ids = mouse_symbols() known_ids = set(mouse_ids.keys()) keep_gene = [g in known_ids for g in genes] subnetwork = network[np.ix_(keep_gene,keep_gene)] symbols = list(mouse_ids.get(g, None) for g in genes) symbols = list(s for s in symbols if s is not None) return subnetwork, symbols def mouse_symbols(): id_map = pd.read_csv(os.path.join(DATA_DIR, "mouse_ids_210421.csv")).dropna() result = dict(zip(list(id_map["ensembl"]), list(id_map["symbol"]))) return result def mouse_common_genes(): with open(os.path.join(DATA_DIR, "mouse_common_genes.txt")) as fp: genes = fp.read().splitlines() return genes
from setuptools import find_packages, setup requirements = [ 'numpy>=1.10.0', 'scipy>=0.18.0', 'xlrd>=1.1.0', 'pandas>=0.23', ] setup(name='bayesian_benchmarking', version='alpha', author="Hugh Salimbeni", author_email="[email protected]", description=("Bayesian benchmarking"), license="Apache License 2.0", keywords="machine-learning bayesian-methods", url="https://github.com/hughsalimbeni/bayesian_benchmarks", python_requires=">=3.5", packages=find_packages(include=["bayesian_benchmarks", "bayesian_benchmarks.*"]), install_requires=requirements, package_data={"":["bayesian_benchmarksrc"]}, include_package_data=True, classifiers=[ 'License :: OSI Approved :: Apache Software License', 'Natural Language :: English', 'Operating System :: MacOS :: MacOS X', 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX :: Linux', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Topic :: Scientific/Engineering :: Artificial Intelligence' ])
""" dtconv - Date and Time conversion functions =========================================== The module adapya.base.dtconv contains various routines to convert datetime values between various formats. For Gregorian to Julian date conversions and vice versa see http://en.wikipedia.org/wiki/Julian_day#Calculation """ from __future__ import print_function # PY3 import time # for clock_time() from datetime import datetime # 0001-01-01 in Julian days is actually 1721425.5 # because the Julian calendar started at noon. For convenience of # calculation we start 12 hours earlier at midnight: RATADIE = 1721426 DAYSECS = 86400 # seconds in a day SECS1970 = 719162 * DAYSECS # seconds since epoch 0001-01-01 to 1970-01-01 UTC1900=(1900,1,1,0,0,0,0) UTC1970=(1970,1,1,0,0,0,0) UTC1582=(1582,1,1,0,0,0,0) UTCMAX=(9999,12,31,23,59,59,999999) UTCMIN=(1,1,1,0,0,0,0) UTC2008SAMPLE=(2008,12,31,13,20,59,123456) MIC1970=62135596800000000 # microseconds since 0001-01-01 00:00:00.000000 class InvalidDateException(Exception): pass def checkdate(year,month,day): """ Check Gregorian date given as year, month, day :raises InvalidDateException: if invalid input values are given otherwise returns silently Invalid date raises exception: >>> checkdate(2008,12,32) # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): InvalidDateException: day 32 not in range 1..31 Valid dates go trough quiet: >>> checkdate(2008,12,31) """ monthdays=(31,28,31,30,31,30,31,31,30,31,30,31) if not (1 <= year <= 9999): raise InvalidDateException('year %d not in range 1..9999' % year ) if not (1 <= month <= 12): raise InvalidDateException('month %d not in range 1..12' % month ) maxday = monthdays[month-1] if month == 2 and ( # leapyear divisible by 4 but not by 100 unless by 400 (year%400 == 0) or (year%4 == 0) and (year%100 != 0)): maxday+=1 if not (1 <= day <= maxday): raise InvalidDateException('day %d not in range 1..%d' % (day,maxday) ) def jul2jdn(year,month,day): """Calculate Julian day number from julian date - Earliest supported date is March 1, -4800 - 1 BC is year 0, 2 BC is -1 etc. (astronomical year numbering) - Julian year starts at 1. March """ if year < -4800: raise InvalidDateException('year %d outside range (-4800,9999)' % (year,) ) if year == -4800 and month < 3: raise InvalidDateException('month %d outside range (3,12) for year %d' % (month,year) ) a = (14-month)//12 # Jan/Feb: a=1 else a=0 y = year + 4800 - a # astronomical year numbering m = month + 12*a - 3 # Mar=0, ... Feb=11 # 153 days in each 5 month cycle starting May jdn = day + (153*m+2)//5 + 365*y + y//4 - 32083 return jdn def greg2jdn(year,month,day): """Calculate the Julian day number for a proleptic gregorian date: November 24, 4714 BC is Julian day 0 at noon """ a = (14-month)//12 y = year + 4800 - a # astronomical year numbering m = month + 12*a - 3 jdn = day + (153*m+2)//5 + 365*y + y//4 - y//100 + y//400 - 32045 return jdn def gx2utc(halfhours, microsecs): """Convert intermediate timestamp of two 32 bit integers to utc form: year,month,day,hour,minute,second,microsecond :param halfhours: number of halfhours since the epoch 0000-01-02 :param microsecs: number of microseconds within half hour >>> gx2utc(0,0) # 0000-01-02 00:00:00.000000 (0, 1, 2, 0, 0, 0, 0) >>> gx2utc(175316351,1799999999) # 9999-12-31 23:59:59.999999 (9999, 12, 31, 23, 59, 59, 999999) >>> gx2utc(34537296,0) # 1970-01-01 00:00:00.000000 (1970, 1, 1, 0, 0, 0, 0) >>> gx2utc(35221034,1259123456) # UTC2008SAMPLE (2008, 12, 31, 13, 20, 59, 123456) """ y,m,d,h,i,s = sec2utc(halfhours*30*60 + microsecs//10**6 - 365*DAYSECS) return y,m,d,h,i,s, microsecs%10**6 def jdn2greg( jdn ): """Calculate gregorian year, month, day from julian day number. astronomical year numbering year 0 is 1 B.C., -1 is 2 B.C. etc. Even though the first day in the Julian calendar correctly starts at noon rather than on midnight here we assume it to start at midnight (12 hours earlier) """ j = jdn + 32044 b = (4*j+3)//146097 c = j - (b*146097)//4 d = (4*c+3)//1461 e = c - (1461*d)//4 m = (5*e+2)//153 day = e - (153*m+2)//5 + 1 month = m + 3 - 12*(m//10) year = b*100 + d - 4800 + m//10 return year,month,day def jdn2jul( jdn ): """Calculate julian year, month, day from julian day number """ b = 0 c = jdn + 32082 d = (4*c+3)//1461 e = c - (1461*d)//4 m = (5*e+2)//153 day = e - (153*m+2)//5 + 1 month = m + 3 - 12*(m//10) year = b*100 + d - 4800 + m//10 return year,month,day def micro2nattime(mic): """Convert microseconds since 0001-01-01 to NATTIME Value in 10th of second precision """ return mic//10**5 + 365*DAYSECS*10 def micro2utc(microsecs): """Convert seconds since epoch value to list composed of:: year,month,day,hour,minute,second,microsecond :param microsec: number of microseconds since the epoch 0001-01-01 >>> micro2utc(0) # 0001-01-01 00:00:00.000000 (1, 1, 1, 0, 0, 0, 0) >>> micro2utc(315537897599999999) # 9999-12-31 23:59:59.999999 (9999, 12, 31, 23, 59, 59, 999999) >>> micro2utc(62135596800000000) # 1970-01-01 00:00:00.000000 (1970, 1, 1, 0, 0, 0, 0) >>> micro2utc(63366326459123456) # UTC2008SAMPLE (2008, 12, 31, 13, 20, 59, 123456) """ microsec = int(microsecs) % 10**6 i = int(microsecs)//10**6 second = i % 60 i //= 60 minute = i % 60 i //= 60 hour = i % 24 i //= 24 year, month, day = jdn2greg(i + RATADIE) return int(year),int(month),int(day),int(hour), \ int(minute),int(second),int(microsec) def nattime2utc(nt): """ convert NATTIME Value in 10th of second precision to DATETIME value """ y,m,d,h,i,s = sec2utc(nt//10 - 365*DAYSECS) return y,m,d,h,i,s, nt%10 * 10**5 def nattime2micro(nt): """ convert NATTIME Value in 10th of second precision to microseconds since 1.1.1 """ return nt*10**5 - 365*DAYSECS*10**6 def sec2utc(seconds): """Convert seconds since epoch value to tuple composed of year,month,day,hour,minute,second :param seconds: number of seconds since the epoch 0001-01-01 if a float value is given: fraction of seconds yield microseconds """ microsecs = int(seconds*10**6) year,month,day,hour,minute,second,microsec = micro2utc(microsecs) if microsec !=0: second += float(microsec)/10**6 return year,month,day,hour,minute,second def sec2interval(seconds): """Convert seconds to tuple of day, hour, minute and second :param seconds: integer :returns: tuple day, hour, minute, second """ i = int(seconds) second = i % 60 i //= 60 minute = i % 60 i //= 60 hour = i % 24 i //= 24 return i, hour, minute, second def intervalstr(i): days, hours, minutes, seconds = sec2interval(i) days = '%dd' % (days) if days else '' hours = '%dh' % (hours) if hours else '' minutes = '%dm' % (minutes) if minutes else '' seconds = '%ds' % (seconds) if seconds else '' if days or hours or minutes or seconds: # compose nonempty strings with blanks in between return ' '.join([x for x in (days,hours,minutes,seconds) if x]) else: return '0s' def usecintervalstr(u): s = int(u//10**6) usec = u - s*10**6 return intervalstr(s) + ' %010.3fus' % usec stckintervalstr = lambda i: intervalstr(int(i* 1.048576)) stckdintervalstr = lambda i: usecintervalstr(i/4096.) def unix2utc(seconds): """ same as sec2utc() only with epoch 1970-01-01""" return sec2utc(seconds+SECS1970) def utc2gx(*secmsec): """Convert list composed of year,month,day,hour,minute,second,microsecond to gx format list of two 32 bit integers (halfhours, microsecs) since epoch 0000-01-02 :param secmsec: list of year,month,day,hour,minute,second,microsecond :returns: (halfhours, microsecs) since epoch 0000-01-02 """ mics = utc2micro(*secmsec) return (mics+365*DAYSECS*10**6)//(1800*10**6), \ (mics+365*DAYSECS*10**6)%(1800*10**6) def utc2micro(*secmsec): """Convert list composed of year,month,day,hour,minute,second,microsecond :param secmsec: list of year,month,day,hour,minute,second,microsecond :returns: number of microseconds since the epoch 0001-01-01 00:00:00.000000 XTIMESTAMP(epoch 0001) >>> utc2micro(*UTCMIN) # 0001-01-01 00:00:00.000000 0 >>> '%d' % utc2micro(*UTCMAX) # 9999-12-31 23:59:59.999999 '315537897599999999' >>> '%d' % utc2micro(*UTC1970) # 1970-01-01 00:00:00.000000 '62135596800000000' >>> '%d' % utc2micro(*UTC2008SAMPLE) # 2008-12-31 13:20:59.123456 '63366326459123456' XTIMESTAMP(epoch 1970) >>> '%d' % (utc2micro(*UTCMIN)-utc2micro(*UTC1970)) '-62135596800000000' >>> '%d' % (utc2micro(*UTCMAX)-utc2micro(*UTC1970)) '253402300799999999' >>> '%d' % (utc2micro(*UTC1970)-utc2micro(*UTC1970)) '0' >>> '%d' % (utc2micro(*UTC2008SAMPLE)-utc2micro(*UTC1970)) '1230729659123456' """ if len(secmsec) < 2: raise InvalidDateException( 'Only provided %d parameters for utc2sec() with %s' % (len(secmsec), repr(secmsec)) ) microsec = int(secmsec[-1]) second = int(secmsec[-2]) minute=hour=day=month=year=days=0 if len(secmsec) > 2: if not( 0 <= second < 60): raise InvalidDateException( 'Invalid Value for second: %d utc2micro(%s)' % ( second, repr(secmsec)) ) minute = int(secmsec[-3]) if len(secmsec) > 3: hour = int(secmsec[-4]) if not( 0 <= minute < 60): raise InvalidDateException( 'Invalid Value for minute: %d utc2micro(%s)' % (minute, repr(secmsec)) ) if len(secmsec) > 4: days = day = int(secmsec[-5]) if not( 0 <= hour < 60): raise InvalidDateException( 'Invalid Value for hour: %d utc2micro(%s)' % (hour, repr(secmsec)) ) if len(secmsec) > 5: month = int(secmsec[-6]) if len(secmsec) > 6: year = int(secmsec[-7]) if not( 1 <= day <= 31): raise InvalidDateException( 'Invalid Value for day: %d utc2micro(%s)' % (day, repr(secmsec)) ) elif not( 1 <= month <= 12): raise InvalidDateException( 'Invalid Value for month: %d utc2micro(%s)' % (month, repr(secmsec)) ) elif not( 1 <= year <= 9999): raise InvalidDateException( 'Invalid Value for year: %d utc2micro(%s)' % (month, repr(secmsec)) ) days = greg2jdn(year,month,day) - RATADIE return microsec + 10**6 * (second + 60 * (minute + 60*hour) + days * DAYSECS) def utc2nattime(*secmsec): """ convert utc timestamp since 0001-01-01 to NATTIME Value in 10th of second precision """ return micro2nattime(utc2micro(*secmsec)) def utc2sec(*utc): """Convert list composed of year,month,day,hour,minute,second [,microsec] :param utc: list of year,month,day,hour,minute,second :returns: number of seconds since the epoch 0001-01-01 """ utc2=list(utc) if len(utc)<7: utc2.append(0) return int(utc2micro(*utc2)/10**6) def utc2unix(*utc): """ same as sec2utc() only with epoch 1970-01-01""" return utc2sec(*utc)-SECS1970 def utc2xts(*secmsec): """Convert list composed of year,month,day,hour,minute,second,microsecond to XTIMESTAMP (UNIXTIME in microsecond precision) :param secmsec: list of year,month,day,hour,minute,second,microsecond :returns: number of microseconds since the epoch 1970-01-01 00:00:00.000000 """ return utc2micro(*secmsec)-MIC1970 def xts2utc(microseconds): """ same as micro2utc() only with epoch 1970-01-01 """ return micro2utc(microseconds+MIC1970) # # --- Adabas datetime specific conversions --- # # from DATE # def date2datetime(year,month,day): return (year,month,day,0,0,0) def date2timestamp(year,month,day): return (year,month,day,0,0,0,0) def date2natdate(year,month,day): """Convert a gregorian date to a natdate integer No checking is done for valid dates. Natural does not allow dates earlier than 1582-01-01 >>> date2natdate(1,1,1) 365 >>> date2natdate(0,1,1) -1 >>> date2natdate(0,1,2) 0 >>> date2natdate(1900,1,1) 693960 >>> date2natdate(1582,1,1) 577813 >>> date2natdate(1970,1,1) 719527 >>> date2natdate(2000,1,1) 730484 >>> date2natdate(2008,12,31) 733771 >>> date2natdate(9999,12,31) 3652423 """ return greg2jdn(year,month,day)-RATADIE+365 def date2nattime(year,month,day): return date2natdate(year,month,day) * DAYSECS * 10 def date2unixtime(year,month,day): return utc2unix(date2timestamp(year,month,day)) def date2xtimestamp(year,month,day): return utc2xts(date2timestamp(year,month,day)) # # from datetime # def datetime2date(year,month,day,hour,minute,second): return year,month,day def datetime2time(year,month,day,hour,minute,second): return hour,minute,second def datetime2timestamp(year,month,day,hour,minute,second): return year,month,day,hour,minute,second,0 def datetime2natdate(year,month,day,hour,minute,second): return date2natdate(year,month,day) def datetime2nattime(year,month,day,hour,minute,second): return utc2nattime(year,month,day,hour,minute,second) def datetime2unixtime(year,month,day,hour,minute,second): return utc2unix(year,month,day,hour,minute,second,0) def datetime2xtimestamp(year,month,day,hour,minute,second): return datetime2xtimestamp(year,month,day,hour,minute,second) * 10**6 # # from timestamp # def timestamp2date(y,m,d,h,i,s,x): return y,m,d def timestamp2datetime(y,m,d,h,i,s,x): return y,m,d,h,i,s def timestamp2natdate(y,m,d,h,i,s,x): return date2natdate(y,m,d) def timestamp2nattime(y,m,d,h,i,s,x): return utc2nattime(y,m,d,h,i,s,x) def timestamp2unixtime(y,m,d,h,i,s,x): return utc2unix(y,m,d,h,i,s,x) def timestamp2xtimestamp(y,m,d,h,i,s,x): return utc2xts(y,m,d,h,i,s,x) # # from natdate # def natdate2date(nd): return jdn2greg(nd+RATADIE-365) def natdate2nattime(nd): """ convert NATDATE counting days since Jan. 2, 0000 to NATTIME Value in 10th of second precision """ return nd*DAYSECS*10 # # from nattime # def nattime2date(nt): return natdate2date(nt // (DAYSECS*10)) def nattime2datetime(nt): y,m,d,h,i,s,_ = nattime2utc(nt) return y,m,d,h,i,s def nattime2timestamp(nt): return nattime2utc(nt) def nattime2natdate(nt): """Convert NATTIME Value in 10th of second precision to NATDATE couning days since Jan. 2, 0000 """ return nt//(DAYSECS*10) # # from xtimestamp # def xtimestamp2timestamp(mics): """ >>> xtimestamp2timestamp(0) (1970, 1, 1, 0, 0, 0, 0) """ return xts2utc(mics) # # simple datetime tuple to string conversions # DTF="%Y-%m-%d %H:%M:%S" DTN="%Y%m%d%H%M%S" def dt2strf(*dt): """ >>> dt2strf( 2010,4,30, 11, 55, 13) '2010-04-30 11:55:13' >>> d1=(2010,1,2,11,44,55) >>> dt2strf( *d1) '2010-01-02 11:44:55' """ d = datetime(*dt) return d.strftime(DTF) def ts2strf(*ts): """ >>> ts2strf( 2010,4,30, 11, 55, 13, 999999) '2010-04-30 11:55:13.999999' """ d = datetime(*ts) return d.strftime(DTF)+'.%06d'%d.microsecond def dt2str(*dt): """ make a datetime string from a datetime tuple >>> dt2str( 2010,4,30, 11,55,13) '20100430115513' """ d = datetime(*dt) return d.strftime(DTN) def str2dt(ds): """ make a datetime tuple from a datetime string or number >>> str2dt( '20160229115513' ) (2016, 2, 29, 11, 55, 13) >>> str2dt( b'20160301235513' ) (2016, 3, 1, 23, 55, 13) """ if not isinstance(ds, (bytes, bytearray, str)): ds=str(ds) # make it a string if number zero = b'0' if isinstance(ds, (bytes,bytearray)) else '0' if len(ds) < 14: ds = zero*(14-len(ds))+ds if len(ds) == 14: # Datetime ds = zero*(14-len(ds))+ds return int(ds[0:4]), int(ds[4:6]), int(ds[6:8]), \ int(ds[8:10]), int(ds[10:12]), int(ds[12:14]) elif len(ds) == 20: # Timestamp return int(ds[0:4]), int(ds[4:6]), int(ds[6:8]), \ int(ds[8:10]), int(ds[10:12]), int(ds[12:14]), \ int(ds[14:20]) # # test some functions # def testgreg2jdn(): """Conversion of seconds to gregorian date""" samples = ( # year, month, day, secs # ( 1, 1, 1, 0000000000), ( 100, 1, 1, 3124137600), ( 100, 3, 1, 3129235200), ( 200, 1, 1, 6279811200), ( 200, 3, 1, 6284908800), ( 300, 1, 1, 9435484800), ( 300, 3, 1, 9440582400), ( 400, 1, 1, 12591158400), ( 400, 3, 1, 12596342400), ( 500, 1, 1, 15746918400), ( 500, 3, 1, 15752016000), ( 600, 1, 1, 18902592000), ( 600, 3, 1, 18907689600), ( 700, 1, 1, 22058265600), ( 700, 3, 1, 22063363200), ( 800, 1, 1, 25213939200), ( 800, 3, 1, 25219123200), ( 900, 1, 1, 28369699200), ( 900, 3, 1, 28374796800), ( 1000, 1, 1, 31525372800), ( 1000, 3, 1, 31530470400), ( 1100, 1, 1, 34681046400), ( 1100, 3, 1, 34686144000), ( 1200, 1, 1, 37836720000), ( 1200, 3, 1, 37841904000), ( 1300, 1, 1, 40992480000), ( 1300, 3, 1, 40997577600), ( 1400, 1, 1, 44148153600), ( 1400, 3, 1, 44153251200), ( 1500, 1, 1, 47303827200), ( 1500, 3, 1, 47308924800), ( 1582, 1, 1, 49891507200), # 577448*DAYTICS), # ( 1600, 1, 1, 50459500800), ( 1600, 3, 1, 50464684800), ( 1700, 1, 1, 53615260800), ( 1700, 3, 1, 53620358400), ( 1800, 1, 1, 56770934400), ( 1800, 3, 1, 56776032000), ( 1900, 1, 1, 59926608000), ( 1900, 3, 1, 59931705600), ( 1970, 1, 1, 62135596800), # 719162*DAYTICS ( 2000, 1, 1, 63082281600), ( 2000, 3, 1, 63087465600), ( 2100, 1, 1, 66238041600), ( 2100, 3, 1, 66243139200), ( 2200, 1, 1, 69393715200), ( 2200, 3, 1, 69398812800), ( 2300, 1, 1, 72549388800), ( 2300, 3, 1, 72554486400), ( 2400, 1, 1, 75705062400), ( 2400, 3, 1, 75710246400), ( 2500, 1, 1, 78860822400), ( 2500, 3, 1, 78865920000), ( 2600, 1, 1, 82016496000), ( 2600, 3, 1, 82021593600), ( 2700, 1, 1, 85172169600), ( 2700, 3, 1, 85177267200), ( 2800, 1, 1, 88327843200), ( 2800, 3, 1, 88333027200), ( 2900, 1, 1, 91483603200), ( 2900, 3, 1, 91488700800), ( 3000, 1, 1, 94639276800), ( 3000, 3, 1, 94644374400), ( 1 , 1, 1, 0), ( 1601, 1, 1, 50491123200), ( 1899, 12, 31, 59926521600), ( 1904, 1, 1, 60052752000), ( 1970, 1, 1, 62135596800), ( 2001, 1, 1, 63113904000), ( 9900, 3, 1, 312387321600), ( 9999, 12, 31, 315537811200) ) for y,m,d,secs in samples: gy, gm, gd = jdn2greg(secs//DAYSECS + RATADIE) gsec = (greg2jdn(y,m,d)-RATADIE) * DAYSECS # print Y m d secs days natdate nattime # print( y, m, d, secs, secs//DAYSECS, secs//DAYSECS+365, (secs+DAYSECS*365)*10 ) try: assert secs == gsec assert y == gy assert m == gm assert d == gd except: print( "datetime assertion error:", y,m,d,secs, 'vs.', gy,gm,gd,gsec) # time0 = 0 clockbase0 = 0 def clock_time(resync=300): """:param resync: interval for resyncing with time() :returns: high resolution time """ global time0, clockbase0 clock1 = time.clock() if not time0 or (resync and resync < (clock1+clockbase0 - time0)): time0 = time.time() while 1: # until t=time() changes clock1 = time.clock() t = time.time() if t != time0: time0, clockbase0 = t, t-clock1 # print( 'clock_time()', datetime.fromtimestamp(t)) break return clock1+clockbase0 def demo_clock_time(): # show differences in clock_time to time() when time() changes a = [] t1 = time.time() for i in range(100000): c,t = clock_time(), time.time() if t != t1: t1=t a.append( (c, t) ) for c,t in a: print( datetime.fromtimestamp(c), datetime.fromtimestamp(t)) if __name__ == "__main__": import doctest doctest.testmod() # $Date: 2017-05-17 20:51:16 +0200 (Wed, 17 May 2017) $ # $Rev: 768 $ # # Copyright 2004-2019 Software AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.
from django.conf import settings as django_settings ENABLED = getattr(django_settings, 'LOCALIZE_SEO_ENABLED', not django_settings.DEBUG) IGNORE_URLS = frozenset(getattr(django_settings, 'LOCALIZE_SEO_IGNORE_URLS', ['/sitemap.xml'])) IGNORE_EXTENSIONS = frozenset(getattr(django_settings, 'LOCALIZE_SEO_IGNORE_EXTENSIONS', ( ".js", ".css", ".xml", ".less", ".png", ".jpg", ".jpeg", ".gif", ".pdf", ".doc", ".txt", ".ico", ".rss", ".zip", ".mp3", ".rar", ".exe", ".wmv", ".doc", ".avi", ".ppt", ".mpg", ".mpeg", ".tif", ".wav", ".mov", ".psd", ".ai", ".xls", ".mp4", ".m4a", ".swf", ".dat", ".dmg", ".iso", ".flv", ".m4v", ".torrent", ))) USER_AGENTS = frozenset(getattr(django_settings, 'LOCALIZE_SEO_USER_AGENTS', ( "bot", "crawler", "baiduspider", "80legs", "mediapartners-google", "adsbot-google" ))) PRERENDER_URL = getattr(django_settings, 'LOCALIZE_SEO_PRERENDER_URL', "https://prerender-cdn.localizejs.com/api/prerender/get")
# using if...elif...else num = float(input('Enter a number')) if num > 0: print('Positive Number') elif num == 0: print('Number is Zero') else: print('Negative Number') # using Nested if if num >= 0: if num == 0: print('Number is Zero') else: print('Positive Number') else: print('Negative Number')
import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors import math, os from scipy.ndimage import gaussian_filter as gaussian plt.rcParams["mathtext.fontset"]="cm" plt.rcParams["axes.formatter.use_mathtext"]=True algs = {"C-DQN": "CDQN", "DQN": "DQN", "RG": "Residual"} file_suffix_meaning = {"_.txt": "reward", "mse_.txt": "loss"} game = "Pong" gaussian_smoothing = {"reward": 15, "loss": 3} plt.figure(figsize=(6,2.5)) for i, (suffix, ylabel) in enumerate(file_suffix_meaning.items()): plt.subplot(1,2,i+1) for alg, filename in algs.items(): with open(os.path.join(game+"NoFrameskip-v4", filename+suffix) , 'r') as f: lines = f.readlines() lines = [line.strip() for line in lines] x = np.array([float(line.split()[0]) for line in lines]) y = np.array([float(line.split()[1]) for line in lines]) plt.plot(x, gaussian(y, sigma=gaussian_smoothing[ylabel], mode="mirror"), label=alg) #/1e6 plt.xlabel("frames") plt.ylabel(ylabel) plt.legend() #loc="lower left" if ylabel=="loss": plt.yscale("log"); plt.xscale("log"); plt.xlim(left=3e5, right=1e8) else: plt.xlim(left=0, right=1e8) plt.tight_layout() plt.subplots_adjust(wspace=0.3) plt.savefig("{}.pdf".format(game)) plt.tight_layout() plt.close() game = "SpaceInvaders" gaussian_smoothing = {"reward": 60, "loss": 2} plt.figure(figsize=(6,2.5)) for i, (suffix, ylabel) in enumerate(file_suffix_meaning.items()): plt.subplot(1,2,i+1) for alg, filename in algs.items(): with open(os.path.join(game+"NoFrameskip-v4", filename+suffix) , 'r') as f: lines = f.readlines() lines = [line.strip() for line in lines] x = np.array([float(line.split()[0]) for line in lines]) y = np.array([float(line.split()[1]) for line in lines]) plt.plot(x, gaussian(y, sigma=gaussian_smoothing[ylabel], mode="mirror"), label=alg) #/1e6 plt.xlabel("frames") plt.ylabel(ylabel) plt.legend() #loc="lower left" if ylabel=="loss": plt.yscale("log"); plt.xscale("log"); plt.xlim(left=3e5, right=2e8) else: plt.xlim(left=0, right=2e8) plt.tight_layout() plt.subplots_adjust(wspace=0.3) plt.savefig("{}.pdf".format(game)) plt.tight_layout() plt.close()
def sol(num): big = ["", "one thousand", "two thousand", "three thousand", "five thousand"] hundreds = ["", "one hundred", "two hundred", "three hundred", "four hundred", "five hundred", "six hundred", "seven hundred", "eight hundred", "nine hundred"]; teens = ["", "eleven", "twelve", "thirteen", "forteen", "fifteen", "sixteen", "seventeen", "eighteen", "ninteen"]; tens = ["", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninty"]; ones = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]; if num % 100 > 10 and num %100 < 20: return big[(num/1000)%10] + hundreds[(num/100)%10] +' '+ teens[(num%100)%10] else: return big[(num/1000)%10] + hundreds[(num/100)%10] +' '+ teens[(num/10)%10] +' '+ ones[num%10] print sol(3104)
# Generated by Django 3.2.3 on 2021-06-15 18:35 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0002_auto_20210615_1533'), ] operations = [ migrations.AlterField( model_name='novacolecaoindex', name='preco', field=models.DecimalField(decimal_places=0, max_digits=1000, verbose_name='Preco'), ), ]
# Start Imports import os import re import time import shutil import psutil import requests import colorama import subprocess import bimpy as bp import config as cfg import elevate as elevate # mysql-connector-python import mysql.connector from sys import exit from os import listdir from colorama import Fore from os.path import isfile from threading import Thread from datetime import datetime from bimpy.utils import help_marker # End Imports # noinspection PyBroadException class Nex(bp.App): def __init__(self): super(Nex, self).__init__(height=300, width=800, title='Nex Anticheat System') self.sqlCnx = None self.sqlCursor = None self.user_path = '/'.join(os.getcwd().split('\\', 3)[:3]) self.drive_letter = os.getcwd().split('\\', 1)[0]+'/' self.winUsername = os.getlogin() self.javawPid = '' self.mcPath = '' self.lunarClient = False self.recordingResult = '' self.inInstanceCheats = '' self.outCheats = '' self.Check02 = 'passed' self.Check03 = 'passed' self.Check04 = 'passed' self.Check05 = 'passed' self.Check06 = 'passed' self.Check07 = 'passed' self.deletedFiles = '' self.s = bp.String() self.f = bp.Float() self.barValue = 0 self.verified = False self.cancel = False self.startedScan = False self.lastCheck = '' self.currentAction = bp.String() bp.push_style_var(bp.Style.FrameRounding, 10) bp.load_fonts(size=20) colorama.init() @staticmethod def asRoot(): if elevate.isRootUser(): elevate.runRoot(wait=False) exit() # Finds minecraft process and gets info def mcProcess(self): pid = 0 mcprocess_info = {} # Get processes with the name "javaw" process = [p for p in psutil.process_iter(attrs=['pid', 'name']) if 'javaw' in p.info['name']] if process: process = process[0] pid = process.info['pid'] # print(f'{cfg.prefix} Minecraft found on PID: {pid}') else: input('Minecraft not found...\nPress enter to continue') quit() # Get all command line arguments of process process = process.cmdline() for argument in process: if "--" in argument: mcprocess_info[argument.split("--")[1]] = process[process.index(argument) + 1] self.javawPid = pid self.mcPath = mcprocess_info["version"] customClient = False try: detectCustom = mcprocess_info["username"] except: customClient = True if customClient is True: if 'com.moonsworth.lunar.patcher.LunarMain' in process: self.lunarClient = True else: self.lunarClient = False def on_update(self): if self.verified is False: if self.cancel is False: bp.new_line() bp.new_line() bp.new_line() bp.text(' Enter pin :') bp.same_line() bp.input_text('', self.s, 200, bp.InputTextFlags.Password) # bp.input_text('', self.s, 200) if cfg.disableAuth is False: if len(self.s.value) == 5: if self.lastCheck != self.s.value: try: url = f'https://auth2.atome.cc/index.php?pin={self.s.value}' r = requests.get(url) if 'verified' not in r.text: self.cancel = True else: self.verified = True except: self.cancel = True self.lastCheck = self.s.value else: self.verified = True else: bp.new_line() bp.new_line() bp.new_line() bp.text('An error has occured. If this error persist, try to contact the staff.') elif self.cancel is False: bp.new_line() bp.new_line() bp.text(self.currentAction.value) bp.progress_bar(self.barValue) if len(self.recordingResult) > 2: bp.text('Record software found') bp.same_line() help_marker(self.recordingResult + ' has been found') if 'failed' in self.Check02: bp.text('Illegal modifications times found') bp.same_line() help_marker('The explorer process has been restarted in the last 5 minutes') if 'failed' in self.Check03: bp.text('In game cheat found.') bp.same_line() help_marker('Cheat : ' + self.inInstanceCheats) if 'failed' in self.Check04: bp.text('External cheat found') bp.same_line() help_marker('Cheat : ' + self.outCheats) if 'failed' in self.Check05: bp.text('JNativeHook found') if 'failed' in self.Check06: bp.text('Executed deleted files found') bp.same_line() help_marker(self.deletedFiles) if 'failed' in self.Check07: bp.text('Executed library files found') bp.same_line() help_marker(self.deletedDLLs) if self.startedScan is False: self.startedScan = True print('starting scan :D') p = Thread(target=self.doAnything, args=(self, )) p.daemon = False p.start() else: bp.new_line() bp.new_line() bp.new_line() bp.text('An error has occured. If this error persist, try to contact the staff.') def addPercentageToProgress(self, perc): added = 0 for i in range(0, perc * 10): time.sleep(0.004) self.barValue = self.barValue + 0.001 # Downloads all necessary files def dependencies(self): path = f'{self.drive_letter}/Windows/Temp/Nex' if not os.path.exists(path): os.mkdir(path) with open(f'{path}/strings2.exe', 'wb') as f: f.write(requests.get(cfg.stringsSoftware).content) self.currentAction.value = 'Downloading dependencies' # Thread(target=self.addPercentageToProgress, args=(self, 10)).start() self.addPercentageToProgress(10) def connectDatabase(self): # Don't forget to set only read permissions to this user for more security. if cfg.enableDatabase is True: try: self.sqlCnx = mysql.connector.connect(host=f'{cfg.host}', user=f'{cfg.user}', password=f'{cfg.password}', database=f'{cfg.database}') self.sqlCursor = self.sqlCnx.cursor() except: self.cancel = True input('Cannot connect to the database...\nPress enter to continue') quit() @staticmethod def doAnything(self): self.connectDatabase() self.mcProcess() self.dependencies() # Check #01 self.recordingCheck() # Check #02 self.modificationTimes() # Check #03 self.inInstance() # Check #04 self.outOfInstance() # Check #05 self.jnativehook() # Check #06 self.executedDeleted() # Check #07 self.deletedDLL() # Check #08 if cfg.enableCheck08 is True: self.checkScansHistory() return True # Gets PID of a process from name @staticmethod def getPID(name, service=False): if service: response = str(subprocess.check_output(f'tasklist /svc /FI "Services eq {name}')).split('\\r\\n') for process in response: if name in process: pid = process.split()[1] return pid else: pid = [p.pid for p in psutil.process_iter(attrs=['pid', 'name']) if name == p.name()][0] return pid # Get process start time @staticmethod def proc_starttime(pid): # https://gist.github.com/westhood/1073585 p = re.compile(r"^btime (\d+)$", re.MULTILINE) with open("/proc/stat") as f: m = p.search(f.read()) btime = int(m.groups()[0]) clk_tck = os.sysconf(os.sysconf_names["SC_CLK_TCK"]) with open("/proc/%d/stat" % pid) as f: stime = int(f.read().split()[21]) / clk_tck return datetime.fromtimestamp(btime + stime) # Gets/Dumps strings via a PID def dump(self, pid): cmd = f'{self.drive_letter}/Windows/Temp/Nex/strings2.exe -pid {pid} -raw -nh' strings = str(subprocess.check_output(cmd)).replace('\\\\', "/") strings = list(set(strings.split("\\r\\n"))) return strings # Checking for recording software def recordingCheck(self): self.addPercentageToProgress(11) self.currentAction.value = 'Checking for recording software' print(end=f'{cfg.prefix}' + Fore.CYAN + ' Running check #01') tasks = str(subprocess.check_output('tasklist')).lower() found = [x for x in cfg.recordingSoftwares if x in tasks] if found: for software in found: print(' : ' + Fore.RED + f' Not Clean ({cfg.recordingSoftwares[software]})' + Fore.WHITE) self.barValue.value = 1 self.recordingResult = cfg.recordingSoftwares[software] Nex.end() else: print(' :' + Fore.GREEN + ' Clean' + Fore.WHITE) # Checks modification/run times def modificationTimes(self): self.addPercentageToProgress(11) self.currentAction.value = 'Checking modification time.' print(end=f'{cfg.prefix}' + Fore.CYAN + ' Running check #02') SID = str(subprocess.check_output(f'wmic useraccount where name="{self.winUsername}" get sid')).split('\\r\\r\\n')[1] recycle_bin_path = self.drive_letter+"/$Recycle.Bin/"+SID # Recycle bin modified time check recyclebinTime = datetime.fromtimestamp(os.path.getmtime(recycle_bin_path)) currentTime = datetime.now() binDiffTime = currentTime - recyclebinTime minutes = binDiffTime.total_seconds() / 60 explorerPid = self.getPID('explorer.exe') p = psutil.Process(explorerPid) explorerTime = datetime.fromtimestamp(p.create_time()) explorerDiffTime = currentTime - explorerTime minutes2 = explorerDiffTime.total_seconds() / 60 if minutes2 < 300: self.Check02 = 'failed' print(' :' + Fore.RED + ' Not Clean' + Fore.WHITE) else: print(' :' + Fore.GREEN + ' Clean' + Fore.WHITE) @staticmethod def mins_between(d1, d2): d1 = datetime.strptime(d1, "%H-%M-%S") d2 = datetime.strptime(d2, "%H-%M-%S") return abs((d2 - d1).minutes) # In Instance Checks def inInstance(self): self.currentAction.value = 'Checking for in game modifications' self.addPercentageToProgress(6) foundHeuristic = [] print(end=f'{cfg.prefix}' + Fore.CYAN + ' Running check #03') if self.lunarClient is True: javawStrings = self.dump(self.javawPid) found = [f'{cfg.javawStrings[x]}' for x in javawStrings if x in cfg.javawStrings] if '1.8' in self.mcPath: foundHeuristic = [f'{cfg.lunar18Strings[x]}' for x in javawStrings if x in cfg.lunar18Strings] if found: for hack in found: self.Check03 = 'failed' self.inInstanceCheats = hack print(f' :' + Fore.RED + f' Not Clean ({hack})' + Fore.WHITE) elif foundHeuristic: for hack in foundHeuristic: self.Check03 = 'failed' self.inInstanceCheats = hack print(f' :' + Fore.RED + f' Not Clean ({hack})' + Fore.WHITE) else: print(' :' + Fore.GREEN + ' Clean' + Fore.WHITE) else: javawStrings = self.dump(self.javawPid) found = [f'{cfg.javawStrings[x]}' for x in javawStrings if x in cfg.javawStrings] if '1.8' in self.mcPath: foundHeuristic = [f'{cfg.minecraft18Strings[x]}' for x in javawStrings if x in cfg.minecraft18Strings] elif '1.7' in self.mcPath: foundHeuristic = [f'{cfg.minecraft17Strings[x]}' for x in javawStrings if x in cfg.minecraft17Strings] if found: for hack in found: self.Check03 = 'failed' self.inInstanceCheats = hack print(f' :' + Fore.RED + f' Not Clean ({hack})' + Fore.WHITE) elif foundHeuristic: for hack in foundHeuristic: self.Check03 = 'failed' self.inInstanceCheats = hack print(f' :' + Fore.RED + f' Not Clean ({hack})' + Fore.WHITE) else: print(' :' + Fore.GREEN + ' Clean' + Fore.WHITE) self.addPercentageToProgress(6) # Out of instance checks def outOfInstance(self): self.currentAction.value = 'Checking for external modifications' self.addPercentageToProgress(6) print(end=f'{cfg.prefix}' + Fore.CYAN + ' Running check #04') dpsPid = self.getPID('DPS', service=True) strings = self.dump(dpsPid) strings = ['.exe!'+x.split('!')[3] for x in strings if '.exe!' in x and x.startswith('!!')] found = [x for x in cfg.dpsStrings if x in strings] if found: for string in found: self.Check04 = 'failed' self.outCheats = cfg.dpsStrings[string] print(f' :' + Fore.RED + f' Not Clean ({cfg.dpsStrings[string]})' + Fore.WHITE) else: print(' :' + Fore.GREEN + ' Clean' + Fore.WHITE) self.addPercentageToProgress(6) # Checks for JNativeHook based autoclicker def jnativehook(self): self.currentAction.value = 'Checking for JNativeHook' self.addPercentageToProgress(5) print(end=f'{cfg.prefix}' + Fore.CYAN + ' Running check #05') path = f'{self.user_path}/AppData/Local/Temp' found = [x for x in listdir(path) if isfile(f'{path}/{x}') if 'JNativeHook' in x and x.endswith('.dll')] if found: self.Check05 = 'failed' print(f' : ' + Fore.RED + f' Not Clean') else: print(' :' + Fore.GREEN + ' Clean' + Fore.WHITE) self.addPercentageToProgress(6) # Gets recently executed + deleted files def executedDeleted(self): self.currentAction.value = 'Checking for executed and deleted files' self.addPercentageToProgress(5) print(end=f'{cfg.prefix}' + Fore.CYAN + ' Running check #06') pcasvcPid = self.getPID('PcaSvc', service=True) explorerPid = self.getPID('explorer.exe') pcasvcStrings = self.dump(pcasvcPid) explorerStrings = self.dump(explorerPid) deleted = {} for string in pcasvcStrings: # string = string.lower() if string.startswith(self.drive_letter) and string.endswith('.exe'): if not os.path.isfile(string): if string in explorerStrings: filename = string.split('/')[-1] self.Check06 = 'failed' self.deletedFiles = self.deletedFiles + string + '\n' deleted[string] = {'filename': string, 'method': '01'} if explorerStrings: for string in explorerStrings: string = string.lower() if 'trace' and 'pcaclient' in string: try: path = [x for x in string.split(',') if '.exe' in x][0] if not os.path.isfile(path): filename = path.split('/')[-1] self.Check06 = 'failed' self.deletedFiles = self.deletedFiles + path + '\n' deleted[path] = {'filename': path, 'method': '02'} except: continue if deleted: print(' :' + Fore.RED + ' Not Clean') print('') for path in deleted: print(f' - {path}' + Fore.RED) else: print(' :' + Fore.GREEN + ' Clean' + Fore.WHITE) print('') self.addPercentageToProgress(6) # New method to detect deleted dll files. def deletedDLL(self): self.currentAction.value = 'Checking for deleted library files' self.addPercentageToProgress(5) print(end=f'{cfg.prefix}' + Fore.CYAN + ' Running check #07') dllFiles = {} explorerPid = self.getPID('explorer.exe') explorerStrings = self.dump(explorerPid) if explorerStrings: for string in explorerStrings: if string.startswith(self.drive_letter) and string.endswith('.dll'): if not os.path.exists(string) and 'C:\Windows\system32' not in string and 'C:\Windows\System32' not in string: self.Check06 = 'failed' self.deletedDLLs = self.deletedDLLs + string + '\n' dllFiles[string] = {'filename': string, 'method': '03'} if dllFiles is True: print(' :' + Fore.RED + ' Not Clean') self.Check07 = 'failed' print('') for path in dllFiles: print(f' - {path}' + Fore.RED) else: print(' :' + Fore.GREEN + ' Clean' + Fore.WHITE) print('') self.addPercentageToProgress(6) def checkScansHistory(self): self.currentAction.value = 'Checking for old scans in the database' self.addPercentageToProgress(5) print(end=f'{cfg.prefix}' + Fore.CYAN + ' Running check #08') if cfg.enableDatabase is False: self.addPercentageToProgress(5) return Result02 = False Result03 = False Result04 = False Result05 = False query = f'SELECT Check02 FROM scans WHERE HWID = "{cfg.hwid}"' self.sqlCursor.execute(query) for Check02 in self.sqlCursor: if str(Check02) == '(\'failed\',)': Result02 = True query = f'SELECT Check03 FROM scans WHERE HWID = "{cfg.hwid}"' self.sqlCursor.execute(query) for Check03 in self.sqlCursor: if str(Check03) == '(\'failed\',)': Result03 = True query = f'SELECT Check04 FROM scans WHERE HWID = "{cfg.hwid}"' self.sqlCursor.execute(query) for Check04 in self.sqlCursor: if str(Check04) == '(\'failed\',)': Result04 = True query = f'SELECT Check05 FROM scans WHERE HWID = "{cfg.hwid}"' self.sqlCursor.execute(query) for Check05 in self.sqlCursor: if str(Check05) == '(\'failed\',)': Result05 = True allResults = '' if Result02 is True: allResults = 'Check #02, ' if Result03 is True: allResults = allResults + 'Check #03, ' if Result04 is True: allResults = allResults + 'Check #04, ' if Result05 is True: allResults = allResults + 'Check #05' if 'Check' in allResults: print(' :' + Fore.RED + f' Not Clean ({allResults})' + Fore.WHITE) else: print(' :' + Fore.GREEN + ' Clean' + Fore.WHITE) self.addPercentageToProgress(5) @staticmethod def end(): input('\nScan finished\nPress enter to exit..') # input('\nPress enter to exit...') temp = f'{Nex.drive_letter}/Windows/Temp/Nex' if os.path.exists(temp): shutil.rmtree(temp) exit() def saveScan(self): if self.deletedFiles == '': self.deletedFiles = 'none' if cfg.enableDatabase is False: return query = f'INSERT INTO Scans (ScanID, HWID, Check02, Check03, Check04, Check05, Check06, deletedFiles) VALUES ' query = query + f'("{cfg.scanID}", "{cfg.hwid}", "{self.Check02}", "{self.Check03}", "{self.Check04}", ' query = query + f'"{self.Check05}", "{self.Check06}", "{self.deletedFiles}")' self.sqlCursor.execute(query) self.sqlCnx.commit() Nex = Nex() Nex.asRoot() Nex.run() quit() # Nex.connectDatabase() # Nex.mcProcess() # Nex.dependencies() #print(f'{cfg.prefix} Starting Scan with ID: {cfg.scanID}\n') # print(f'{cfg.prefix} HWID : {cfg.hwid}\n') # Check #01 # Nex.recordingCheck() # Check #02 # Nex.modificationTimes() # Check #03 # Nex.inInstance() # Check #04 # Nex.outOfInstance() # Check #05 # Nex.jnativehook() # Check #06 # Nex.executedDeleted() # Check #07 # Nex.deletedDLL() # Check #08 # if cfg.enableCheck08 is True and cfg.enableDatabase is True: # Nex.checkScansHistory() # else: # print(end=f'{cfg.prefix}' + Fore.CYAN + ' Running check #08' + ' :' + Fore.YELLOW + ' Skipped' + Fore.WHITE) # Nex.saveScan() # Nex.end()
import pytest import pytz from django import forms from django.db import models from timezone_field import TimeZoneField, TimeZoneFormField common_tz_names = tuple(tz for tz in pytz.common_timezones) common_tz_objects = tuple(pytz.timezone(tz) for tz in pytz.common_timezones) class ChoicesDisplayForm(forms.Form): limited_tzs = [ 'Asia/Tokyo', 'Asia/Dubai', 'America/Argentina/Buenos_Aires', 'Africa/Nairobi', ] limited_choices = [(tz, tz) for tz in limited_tzs] tz_none = TimeZoneFormField() tz_standard = TimeZoneFormField(choices_display='STANDARD') tz_with_gmt_offset = TimeZoneFormField(choices_display='WITH_GMT_OFFSET') tz_limited_none = TimeZoneFormField(choices=limited_choices) tz_limited_standard = TimeZoneFormField(choices=limited_choices, choices_display='STANDARD') tz_limited_with_gmt_offset = TimeZoneFormField( choices=limited_choices, choices_display='WITH_GMT_OFFSET', ) class ChoicesDisplayModel(models.Model): limited_tzs = [ 'Asia/Tokyo', 'Asia/Dubai', 'America/Argentina/Buenos_Aires', 'Africa/Nairobi', ] limited_choices = [(tz, tz) for tz in limited_tzs] tz_none = TimeZoneField() tz_standard = TimeZoneField(choices_display='STANDARD') tz_with_gmt_offset = TimeZoneField(choices_display='WITH_GMT_OFFSET') tz_limited_none = TimeZoneField(choices=limited_choices) tz_limited_standard = TimeZoneField(choices=limited_choices, choices_display='STANDARD') tz_limited_with_gmt_offset = TimeZoneField( choices=limited_choices, choices_display='WITH_GMT_OFFSET', ) class ChoicesDisplayModelForm(forms.ModelForm): class Meta: model = ChoicesDisplayModel fields = '__all__' def test_db_field_invalid_choices_display(): with pytest.raises(ValueError): TimeZoneField(choices_display='invalid') def test_form_field_invalid_choices_display(): with pytest.raises(ValueError): TimeZoneFormField(choices_display='invalid') def test_form_field_none(): form = ChoicesDisplayForm() values, displays = zip(*form.fields['tz_none'].choices) assert values == common_tz_names assert displays[values.index('America/Los_Angeles')] == 'America/Los Angeles' assert displays[values.index('Asia/Kolkata')] == 'Asia/Kolkata' def test_form_field_standard(): form = ChoicesDisplayForm() assert form.fields['tz_standard'].choices == form.fields['tz_none'].choices def test_form_field_with_gmt_offset(): form = ChoicesDisplayForm() values, displays = zip(*form.fields['tz_with_gmt_offset'].choices) assert values != common_tz_names assert sorted(values) == sorted(common_tz_names) assert ( displays[values.index('America/Argentina/Buenos_Aires')] == 'GMT-03:00 America/Argentina/Buenos Aires' ) assert displays[values.index('Europe/Moscow')] == 'GMT+03:00 Europe/Moscow' def test_form_field_limited_none(): form = ChoicesDisplayForm() assert form.fields['tz_limited_none'].choices == [ ('Asia/Tokyo', 'Asia/Tokyo'), ('Asia/Dubai', 'Asia/Dubai'), ('America/Argentina/Buenos_Aires', 'America/Argentina/Buenos_Aires'), ('Africa/Nairobi', 'Africa/Nairobi'), ] def test_form_field_limited_standard(): form = ChoicesDisplayForm() assert form.fields['tz_limited_standard'].choices == [ ('Asia/Tokyo', 'Asia/Tokyo'), ('Asia/Dubai', 'Asia/Dubai'), ('America/Argentina/Buenos_Aires', 'America/Argentina/Buenos Aires'), ('Africa/Nairobi', 'Africa/Nairobi'), ] def test_form_field_limited_with_gmt_offset(): form = ChoicesDisplayForm() assert form.fields['tz_limited_with_gmt_offset'].choices == [ ('America/Argentina/Buenos_Aires', 'GMT-03:00 America/Argentina/Buenos Aires'), ('Africa/Nairobi', 'GMT+03:00 Africa/Nairobi'), ('Asia/Dubai', 'GMT+04:00 Asia/Dubai'), ('Asia/Tokyo', 'GMT+09:00 Asia/Tokyo'), ] def test_model_form_field_none(): form = ChoicesDisplayModelForm() values, displays = zip(*form.fields['tz_none'].choices) assert values == ('',) + common_tz_objects assert displays[values.index(pytz.timezone('America/Los_Angeles'))] == 'America/Los Angeles' assert displays[values.index(pytz.timezone('Asia/Kolkata'))] == 'Asia/Kolkata' def test_model_form_field_standard(): form = ChoicesDisplayModelForm() assert form.fields['tz_standard'].choices == form.fields['tz_none'].choices def test_model_form_field_with_gmt_offset(): form = ChoicesDisplayModelForm() values, displays = zip(*form.fields['tz_with_gmt_offset'].choices) assert values != common_tz_objects assert sorted(str(v) for v in values) == sorted([''] + [str(tz) for tz in common_tz_objects]) assert ( displays[values.index(pytz.timezone('America/Argentina/Buenos_Aires'))] == 'GMT-03:00 America/Argentina/Buenos Aires' ) assert displays[values.index(pytz.timezone('Europe/Moscow'))] == 'GMT+03:00 Europe/Moscow' def test_model_form_field_limited_none(): form = ChoicesDisplayModelForm() assert form.fields['tz_limited_none'].choices == [ ('', '---------'), (pytz.timezone('Asia/Tokyo'), 'Asia/Tokyo'), (pytz.timezone('Asia/Dubai'), 'Asia/Dubai'), (pytz.timezone('America/Argentina/Buenos_Aires'), 'America/Argentina/Buenos_Aires'), (pytz.timezone('Africa/Nairobi'), 'Africa/Nairobi'), ] def test_moel_form_field_limited_standard(): form = ChoicesDisplayModelForm() assert form.fields['tz_limited_standard'].choices == [ ('', '---------'), (pytz.timezone('Asia/Tokyo'), 'Asia/Tokyo'), (pytz.timezone('Asia/Dubai'), 'Asia/Dubai'), (pytz.timezone('America/Argentina/Buenos_Aires'), 'America/Argentina/Buenos Aires'), (pytz.timezone('Africa/Nairobi'), 'Africa/Nairobi'), ] def test_model_form_field_limited_with_gmt_offset(): form = ChoicesDisplayModelForm() assert form.fields['tz_limited_with_gmt_offset'].choices == [ ('', '---------'), ( pytz.timezone('America/Argentina/Buenos_Aires'), 'GMT-03:00 America/Argentina/Buenos Aires', ), (pytz.timezone('Africa/Nairobi'), 'GMT+03:00 Africa/Nairobi'), (pytz.timezone('Asia/Dubai'), 'GMT+04:00 Asia/Dubai'), (pytz.timezone('Asia/Tokyo'), 'GMT+09:00 Asia/Tokyo'), ]
import Weapon import WeaponGlobals from pirates.audio import SoundGlobals from pirates.audio.SoundGlobals import loadSfx from pirates.uberdog.UberDogGlobals import InventoryType from direct.interval.IntervalGlobal import * from pandac.PandaModules import * from pirates.inventory import ItemGlobals import random def beginInterrupt(av): if av.isLocal(): messenger.send('skillFinished') class Bayonet(Weapon.Weapon): modelTypes = [ 'models/handheld/pir_m_hnd_gun_musket_a', 'models/handheld/pir_m_hnd_gun_musket_b', 'models/handheld/pir_m_hnd_gun_musket_c', 'models/handheld/pir_m_hnd_gun_musket_d', 'models/handheld/pir_m_hnd_gun_musket_e'] walkAnim = 'bayonet_attack_walk' runAnim = 'bayonet_run' walkBackAnim = 'bayonet_attack_walk' neutralAnim = 'bayonet_attack_idle' strafeLeftAnim = 'rifle_fight_run_strafe_left' strafeRightAnim = 'rifle_fight_run_strafe_right' strafeDiagLeftAnim = 'rifle_fight_forward_diagonal_left' strafeDiagRightAnim = 'rifle_fight_forward_diagonal_right' strafeRevDiagLeftAnim = 'rifle_fight_walk_back_diagonal_left' strafeRevDiagRightAnim = 'rifle_fight_walk_back_diagonal_right' fallGroundAnim = 'bayonet_fall_ground' spinLeftAnim = 'bayonet_turn_left' spinRightAnim = 'bayonet_turn_right' painAnim = 'boxing_hit_head_right' def __init__(self, itemId): Weapon.Weapon.__init__(self, itemId, 'bayonet') def loadModel(self): self.prop = self.getModel(self.itemId) self.prop.reparentTo(self) def changeStance(self, av): if av.getGameState() == 'Battle': self.walkAnim = 'bayonet_attack_walk' self.neutralAnim = 'bayonet_attack_idle' self.runAnim = 'bayonet_run' self.walkBackAnim = 'bayonet_attack_walk' else: self.walkAnim = 'bayonet_walk' self.neutralAnim = 'bayonet_idle' self.runAnim = 'bayonet_run' self.walkBackAnim = 'bayonet_walk' av.setWalkForWeapon() def getAmmoModel(): bullet = loader.loadModel('models/props/cannonball-trail-lod') bullet.setScale(0.3) return bullet def getDrawIval(self, av, ammoSkillId=0, blendInT=0.1, blendOutT=0): track = Parallel(av.actorInterval('gun_draw', playRate=1.5, endFrame=35, blendInT=blendInT, blendOutT=blendOutT), Sequence(Wait(0.625), Func(self.attachTo, av))) return track def getReturnIval(self, av, blendInT=0, blendOutT=0.1): track = Parallel(av.actorInterval('gun_putaway', playRate=2, endFrame=37, blendInT=blendInT, blendOutT=blendOutT), Sequence(Wait(0.6), Func(self.detachFrom, av))) if base.cr.targetMgr: track.append(Func(base.cr.targetMgr.setWantAimAssist, 0)) return track def getAnimState(self, av, animState): if av.isNpc and animState == 'LandRoam': return 'BayonetLandRoam' else: return animState @classmethod def setupSounds(cls): Bayonet.hitSfxs = (loadSfx(SoundGlobals.SFX_WEAPON_BAYONET_HIT),) Bayonet.mistimedHitSfxs = ( loadSfx(SoundGlobals.SFX_WEAPON_BAYONET_HIT),) Bayonet.aimSfxs = (None, ) Bayonet.gunCockSfxs = (None, ) Bayonet.reloadSfx = loadSfx(SoundGlobals.SFX_WEAPON_PISTOL_RELOAD) Bayonet.missSfxs = (loadSfx(SoundGlobals.SFX_WEAPON_BAYONET_MISS), loadSfx(SoundGlobals.SFX_WEAPON_BAYONET_MISS_ALT)) Bayonet.skillSfxs = {InventoryType.PistolShoot: loadSfx(SoundGlobals.SFX_WEAPON_MUSKET_SHOOT),InventoryType.PistolTakeAim: loadSfx(SoundGlobals.SFX_WEAPON_MUSKET_SHOOT)} return None def getShootSfx(): return Bayonet.shootSfxs def getHitSfx(): return Bayonet.hitSfxs def getMistimedHitSfx(): return Bayonet.mistimedHitSfxs def getMissSfx(): return Bayonet.missSfxs def getAimSfx(): return Bayonet.aimSfxs def getGunCockSfx(): return Bayonet.gunCockSfxs
def binary_classification_metrics(prediction, ground_truth): ''' Computes metrics for binary classification Arguments: prediction, np array of bool (num_samples) - model predictions ground_truth, np array of bool (num_samples) - true labels Returns: precision, recall, f1, accuracy - classification metrics ''' precision = 0 recall = 0 accuracy = 0 f1 = 0 T = ground_truth[prediction] TP = len(T[T]) F = ground_truth[prediction] == False FP = len(F[F]) N = ground_truth[prediction == False] FN = len(N[N]) #print('True Posit = ',TP,'False Posit = ',FP, 'False Negative = ',FN ) precision = TP /(FP + TP) recall = TP / (TP + FN) accuracy = len(ground_truth[ground_truth == prediction])/len(ground_truth) f1 = (2*precision*recall)/(precision+recall) # TODO: implement metrics! # Some helpful links: # https://en.wikipedia.org/wiki/Precision_and_recall # https://en.wikipedia.org/wiki/F1_score return precision, recall, f1, accuracy def multiclass_accuracy(prediction, ground_truth): ''' Computes metrics for multiclass classification Arguments: prediction, np array of int (num_samples) - model predictions ground_truth, np array of int (num_samples) - true labels Returns: accuracy - ratio of accurate predictions to total samples ''' accuracy = len(ground_truth[ground_truth == prediction])/len(ground_truth) # TODO: Implement computing accuracy return accuracy
# -------------------------------------------------------------------- from petsc4py import PETSc import unittest from sys import getrefcount # -------------------------------------------------------------------- class BaseMyPC(object): def setup(self, pc): pass def reset(self, pc): pass def apply(self, pc, x, y): raise NotImplementedError def applyT(self, pc, x, y): self.apply(pc, x, y) def applyS(self, pc, x, y): self.apply(pc, x, y) def applySL(self, pc, x, y): self.applyS(pc, x, y) def applySR(self, pc, x, y): self.applyS(pc, x, y) def applyRich(self, pc, x, y, w, tols): self.apply(pc, x, y) class MyPCNone(BaseMyPC): def apply(self, pc, x, y): x.copy(y) class MyPCJacobi(BaseMyPC): def setup(self, pc): A, P = pc.getOperators() self.diag = P.getDiagonal() self.diag.reciprocal() def reset(self, pc): self.diag.destroy() del self.diag def apply(self, pc, x, y): y.pointwiseMult(self.diag, x) def applyS(self, pc, x, y): self.diag.copy(y) y.sqrtabs() y.pointwiseMult(y, x) class PC_PYTHON_CLASS(object): def __init__(self): self.impl = None self.log = {} def _log(self, method, *args): self.log.setdefault(method, 0) self.log[method] += 1 def create(self, pc): self._log('create', pc) def destroy(self, pc): self._log('destroy') self.impl = None def reset(self, pc): self._log('reset', pc) def view(self, pc, vw): self._log('view', pc, vw) assert isinstance(pc, PETSc.PC) assert isinstance(vw, PETSc.Viewer) pass def setFromOptions(self, pc): self._log('setFromOptions', pc) assert isinstance(pc, PETSc.PC) OptDB = PETSc.Options(pc) impl = OptDB.getString('impl','MyPCNone') klass = globals()[impl] self.impl = klass() def setUp(self, pc): self._log('setUp', pc) assert isinstance(pc, PETSc.PC) self.impl.setup(pc) def preSolve(self, pc, ksp, b, x): self._log('preSolve', pc, ksp, b, x) def postSolve(self, pc, ksp, b, x): self._log('postSolve', pc, ksp, b, x) def apply(self, pc, x, y): self._log('apply', pc, x, y) assert isinstance(pc, PETSc.PC) assert isinstance(x, PETSc.Vec) assert isinstance(y, PETSc.Vec) self.impl.apply(pc, x, y) def applySymmetricLeft(self, pc, x, y): self._log('applySymmetricLeft', pc, x, y) assert isinstance(pc, PETSc.PC) assert isinstance(x, PETSc.Vec) assert isinstance(y, PETSc.Vec) self.impl.applySL(pc, x, y) def applySymmetricRight(self, pc, x, y): self._log('applySymmetricRight', pc, x, y) assert isinstance(pc, PETSc.PC) assert isinstance(x, PETSc.Vec) assert isinstance(y, PETSc.Vec) self.impl.applySR(pc, x, y) def applyTranspose(self, pc, x, y): self._log('applyTranspose', pc, x, y) assert isinstance(pc, PETSc.PC) assert isinstance(x, PETSc.Vec) assert isinstance(y, PETSc.Vec) self.impl.applyT(pc, x, y) def applyRichardson(self, pc, x, y, w, tols): self._log('applyRichardson', pc, x, y, w, tols) assert isinstance(pc, PETSc.PC) assert isinstance(x, PETSc.Vec) assert isinstance(y, PETSc.Vec) assert isinstance(w, PETSc.Vec) assert isinstance(tols, tuple) assert len(tols) == 4 self.impl.applyRich(pc, x, y, w, tols) class TestPCPYTHON(unittest.TestCase): PC_TYPE = PETSc.PC.Type.PYTHON PC_PREFIX = 'test-' def setUp(self): pc = self.pc = PETSc.PC() pc.create(PETSc.COMM_SELF) pc.setType(self.PC_TYPE) module = __name__ factory = 'PC_PYTHON_CLASS' self.pc.prefix = self.PC_PREFIX OptDB = PETSc.Options(self.pc) assert OptDB.prefix == self.pc.prefix OptDB['pc_python_type'] = '%s.%s' % (module, factory) self.pc.setFromOptions() del OptDB['pc_python_type'] assert self._getCtx().log['create'] == 1 assert self._getCtx().log['setFromOptions'] == 1 ctx = self._getCtx() self.assertEqual(getrefcount(ctx), 3) def tearDown(self): ctx = self._getCtx() self.pc.destroy() # XXX self.pc = None assert ctx.log['destroy'] == 1 self.assertEqual(getrefcount(ctx), 2) def _prepare(self): A = PETSc.Mat().createAIJ([3,3], comm=PETSc.COMM_SELF) A.setUp() A.assemble() A.shift(10) x, y = A.createVecs() x.setRandom() self.pc.setOperators(A, A) assert (A,A) == self.pc.getOperators() return A, x, y def _getCtx(self): return self.pc.getPythonContext() def _applyMeth(self, meth): A, x, y = self._prepare() getattr(self.pc, meth)(x,y) if 'reset' not in self._getCtx().log: assert self._getCtx().log['setUp'] == 1 assert self._getCtx().log[meth] == 1 else: nreset = self._getCtx().log['reset'] nsetup = self._getCtx().log['setUp'] nmeth = self._getCtx().log[meth] assert (nreset == nsetup) assert (nreset == nmeth) if isinstance(self._getCtx().impl, MyPCNone): self.assertTrue(y.equal(x)) def testApply(self): self._applyMeth('apply') def testApplySymmetricLeft(self): self._applyMeth('applySymmetricLeft') def testApplySymmetricRight(self): self._applyMeth('applySymmetricRight') def testApplyTranspose(self): self._applyMeth('applyTranspose') ## def testApplyRichardson(self): ## x, y = self._prepare() ## w = x.duplicate() ## tols = 0,0,0,0 ## self.pc.applyRichardson(x,y,w,tols) ## assert self._getCtx().log['setUp'] == 1 ## assert self._getCtx().log['applyRichardson'] == 1 ## def testView(self): ## vw = PETSc.ViewerString(100, self.pc.comm) ## self.pc.view(vw) ## s = vw.getString() ## assert 'python' in s ## module = __name__ ## factory = 'self._getCtx()' ## assert '.'.join([module, factory]) in s def testResetAndApply(self): self.pc.reset() self.testApply() self.pc.reset() self.testApply() self.pc.reset() def testKSPSolve(self): A, x, y = self._prepare() ksp = PETSc.KSP().create(self.pc.comm) ksp.setType(PETSc.KSP.Type.PREONLY) assert self.pc.getRefCount() == 1 ksp.setPC(self.pc) assert self.pc.getRefCount() == 2 # normal ksp solve, twice ksp.solve(x,y) assert self._getCtx().log['setUp' ] == 1 assert self._getCtx().log['apply' ] == 1 assert self._getCtx().log['preSolve' ] == 1 assert self._getCtx().log['postSolve'] == 1 ksp.solve(x,y) assert self._getCtx().log['setUp' ] == 1 assert self._getCtx().log['apply' ] == 2 assert self._getCtx().log['preSolve' ] == 2 assert self._getCtx().log['postSolve'] == 2 # transpose ksp solve, twice ksp.solveTranspose(x,y) assert self._getCtx().log['setUp' ] == 1 assert self._getCtx().log['applyTranspose'] == 1 ksp.solveTranspose(x,y) assert self._getCtx().log['setUp' ] == 1 assert self._getCtx().log['applyTranspose'] == 2 del ksp # ksp.destroy() assert self.pc.getRefCount() == 1 def testGetSetContext(self): ctx = self.pc.getPythonContext() self.pc.setPythonContext(ctx) self.assertEqual(getrefcount(ctx), 3) del ctx class TestPCPYTHON2(TestPCPYTHON): def setUp(self): OptDB = PETSc.Options(self.PC_PREFIX) OptDB['impl'] = 'MyPCJacobi' super(TestPCPYTHON2, self).setUp() clsname = type(self._getCtx().impl).__name__ assert clsname == OptDB['impl'] del OptDB['impl'] class TestPCPYTHON3(TestPCPYTHON): def setUp(self): pc = self.pc = PETSc.PC() ctx = PC_PYTHON_CLASS() pc.createPython(ctx, comm=PETSc.COMM_SELF) self.pc.prefix = self.PC_PREFIX self.pc.setFromOptions() assert self._getCtx().log['create'] == 1 assert self._getCtx().log['setFromOptions'] == 1 class TestPCPYTHON4(TestPCPYTHON3): def setUp(self): OptDB = PETSc.Options(self.PC_PREFIX) OptDB['impl'] = 'MyPCJacobi' super(TestPCPYTHON4, self).setUp() clsname = type(self._getCtx().impl).__name__ assert clsname == OptDB['impl'] del OptDB['impl'] # -------------------------------------------------------------------- if __name__ == '__main__': unittest.main()
#메뉴처리 from tkinter import * def openFile(): print('[열기] 선택함.') def exitFile(): print('[종료] 선택함.') # def copyFile(): # print('[복사] 선택함.') # def cutFile(): # print('[잘라내기] 선택함.') # def pasteFile(): # print('[붙여넣기] 선택함.') def editFile(num) : print(str(num)+'선택함.') window = Tk() mainMenu = Menu(window) window.config(menu = mainMenu) fileMenu = Menu(mainMenu) mainMenu.add_cascade(label = '파일', menu = fileMenu) fileMenu.add_command(label = '열기(Ctrl+o)',command = openFile) #command : 함수 호출구문,()를 사용 못한다. fileMenu.add_separator() fileMenu.add_command(label = '종료(Ctrl+x)',command = exitFile) #[편집]메뉴 추가 editMenu = Menu(mainMenu) mainMenu.add_cascade(label = '편집', menu = editMenu) editMenu.add_command(label = '복사',command = lambda : editFile(1) ) #command : lambda를 활용해서 ()를 사용 editMenu.add_separator() editMenu.add_command(label = '잘라내기',command = lambda : editFile(2)) editMenu.add_separator() editMenu.add_command(label = '붙여넣기',command = lambda : editFile(3)) window.mainloop()
import numpy as np import pytest from agents.agents import get_agent from environments.environments import get_environment from representations.representations import get_representation from rl_glue.rl_glue import RLGlue agent_info = { "num_states": 5, "algorithm": "ETD", "representations": "TA", "num_dims": 5, "discount_rate": 1.0, "trace_decay": 0.0, "step_size": 0.001, "seed": 42, "interest": "UI", "policy": "random-chain", } env_info = {"env": "RandomWalk", "num_states": 5} @pytest.mark.parametrize("num_states", [5, 19]) def test_chain_init(num_states): environment = get_environment(env_info["env"]) env_info["num_states"] = num_states agent_info["num_states"] = num_states agent_info["num_dims"] = num_states agent = get_agent(agent_info["algorithm"]) rl_glue = RLGlue(environment, agent) rl_glue.rl_init(agent_init_info=agent_info, env_init_info=env_info) (last_state, _) = rl_glue.rl_start() assert last_state == num_states // 2 @pytest.mark.parametrize("algorithm", ["TD", "ETD"]) def test_same_walks_per_run_for_each_algorithm(algorithm): runs_with_episodes = { 0: [[2, 1, 2, 3, 2, 3, 4], [2, 3, 4], [2, 3, 2, 1, 2, 1, 0]], 1: [ [2, 3, 4, 3, 2, 3, 4], [2, 3, 4, 3, 2, 3, 2, 3, 4, 3, 2, 3, 2, 1, 0, 1, 0], [2, 3, 2, 1, 0, 1, 0], ], } env_info["log_episodes"] = 1 env_info["num_states"] = 5 agent_info["num_states"] = 5 agent_info["num_dims"] = 5 num_runs = len(runs_with_episodes) for i in range(num_runs): agent_info["algorithm"] = algorithm agent_info["seed"] = i rl_glue = RLGlue( get_environment(env_info["env"]), get_agent(agent_info["algorithm"]) ) rl_glue.rl_init(agent_info, env_info) num_episodes = len(runs_with_episodes[i]) for j in range(num_episodes): rl_glue.rl_episode(0) assert np.array_equiv( runs_with_episodes[i][j], np.array(rl_glue.rl_env_message("get episode")).squeeze(), ) @pytest.mark.parametrize("representations", ["RB", "R"]) def test_same_feature_representation_for_one_trial(representations): agent_info = { "num_states": 19, "algorithm": "ETD", "representations": representations, "num_features": 18, "num_ones": 10, "discount_rate": 0.95, "trace_decay": 0.5, "step_size": 0.0001, "interest": "UI", "policy": "random-chain", } env_info = {"env": "RandomWalk", "num_states": 19} num_states = agent_info.get("num_states") for seed in np.arange(10): agent_info["seed"] = seed states = np.arange(num_states).reshape(-1, 1) RF = get_representation(agent_info.get("representations"), **agent_info) rl_glue = RLGlue( get_environment(env_info["env"]), get_agent(agent_info["algorithm"]) ) random_features = np.vstack([RF[states[i]] for i in range(num_states)]) rl_glue.rl_init(agent_info, env_info) max_steps_this_episode = 0 for i in range(10): is_terminal = False rl_glue.rl_start() while (not is_terminal) and ( (max_steps_this_episode == 0) or (rl_glue.num_steps < max_steps_this_episode) ): rl_step_result = rl_glue.rl_step() is_terminal = rl_step_result[3] last_state = rl_step_result[2] np.array_equiv( rl_glue.agent.FR[last_state], random_features[last_state] )
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QFileDialog import time import algorithms, tools class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1202, 680) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setMinimumSize(QtCore.QSize(1202, 680)) MainWindow.setMaximumSize(QtCore.QSize(1202, 680)) icon = QtGui.QIcon("icon.ico") MainWindow.setWindowIcon(icon) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.buttonGenRan = QtWidgets.QPushButton(self.centralwidget) self.buttonGenRan.setGeometry(QtCore.QRect(390, 80, 121, 30)) self.buttonGenRan.setObjectName("buttonGenRan") self.labelStatus = QtWidgets.QLabel(self.centralwidget) self.labelStatus.setGeometry(QtCore.QRect(20, 142, 47, 13)) self.labelStatus.setAlignment(QtCore.Qt.AlignCenter) self.labelStatus.setObjectName("labelStatus") self.labelStatusVal = QtWidgets.QLabel(self.centralwidget) self.labelStatusVal.setGeometry(QtCore.QRect(70, 140, 150, 16)) self.labelStatusVal.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.labelStatusVal.setObjectName("labelStatusVal") self.sliderDelay = QtWidgets.QSlider(self.centralwidget) self.sliderDelay.setGeometry(QtCore.QRect(650, 40, 121, 30)) self.sliderDelay.setMinimum(100) self.sliderDelay.setMaximum(1000) self.sliderDelay.setSingleStep(100) self.sliderDelay.setTracking(False) self.sliderDelay.setOrientation(QtCore.Qt.Horizontal) self.sliderDelay.setInvertedAppearance(False) self.sliderDelay.setInvertedControls(False) self.sliderDelay.setTickPosition(QtWidgets.QSlider.NoTicks) self.sliderDelay.setObjectName("sliderDelay") __class__.bar48 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar48.setGeometry(QtCore.QRect(569, 170, 12, 500)) __class__.bar48.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar48.setProperty("value", 50) __class__.bar48.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar48.setTextVisible(False) __class__.bar48.setOrientation(QtCore.Qt.Vertical) __class__.bar48.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar48.setObjectName("bar48") __class__.bar45 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar45.setGeometry(QtCore.QRect(533, 170, 12, 500)) __class__.bar45.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar45.setProperty("value", 50) __class__.bar45.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar45.setTextVisible(False) __class__.bar45.setOrientation(QtCore.Qt.Vertical) __class__.bar45.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar45.setObjectName("bar45") __class__.bar1 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar1.setGeometry(QtCore.QRect(14, 170, 12, 500)) __class__.bar1.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar1.setProperty("value", 50) __class__.bar1.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar1.setTextVisible(False) __class__.bar1.setOrientation(QtCore.Qt.Vertical) __class__.bar1.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar1.setObjectName("bar1") __class__.bar38 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar38.setGeometry(QtCore.QRect(451, 170, 12, 500)) __class__.bar38.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar38.setProperty("value", 50) __class__.bar38.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar38.setTextVisible(False) __class__.bar38.setOrientation(QtCore.Qt.Vertical) __class__.bar38.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar38.setObjectName("bar38") __class__.bar64 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar64.setGeometry(QtCore.QRect(757, 170, 12, 500)) __class__.bar64.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar64.setProperty("value", 50) __class__.bar64.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar64.setTextVisible(False) __class__.bar64.setOrientation(QtCore.Qt.Vertical) __class__.bar64.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar64.setObjectName("bar64") __class__.bar34 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar34.setGeometry(QtCore.QRect(404, 170, 12, 500)) __class__.bar34.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar34.setProperty("value", 50) __class__.bar34.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar34.setTextVisible(False) __class__.bar34.setOrientation(QtCore.Qt.Vertical) __class__.bar34.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar34.setObjectName("bar34") __class__.bar32 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar32.setGeometry(QtCore.QRect(380, 170, 12, 500)) __class__.bar32.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar32.setProperty("value", 50) __class__.bar32.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar32.setTextVisible(False) __class__.bar32.setOrientation(QtCore.Qt.Vertical) __class__.bar32.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar32.setObjectName("bar32") __class__.bar28 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar28.setGeometry(QtCore.QRect(333, 170, 12, 500)) __class__.bar28.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar28.setProperty("value", 50) __class__.bar28.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar28.setTextVisible(False) __class__.bar28.setOrientation(QtCore.Qt.Vertical) __class__.bar28.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar28.setObjectName("bar28") __class__.bar44 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar44.setGeometry(QtCore.QRect(521, 170, 12, 500)) __class__.bar44.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar44.setProperty("value", 50) __class__.bar44.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar44.setTextVisible(False) __class__.bar44.setOrientation(QtCore.Qt.Vertical) __class__.bar44.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar44.setObjectName("bar44") __class__.bar98 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar98.setEnabled(True) __class__.bar98.setGeometry(QtCore.QRect(1158, 170, 12, 500)) __class__.bar98.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar98.setProperty("value", 50) __class__.bar98.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar98.setTextVisible(False) __class__.bar98.setOrientation(QtCore.Qt.Vertical) __class__.bar98.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar98.setObjectName("bar98") __class__.bar2 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar2.setGeometry(QtCore.QRect(26, 170, 12, 500)) __class__.bar2.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar2.setProperty("value", 50) __class__.bar2.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar2.setTextVisible(False) __class__.bar2.setOrientation(QtCore.Qt.Vertical) __class__.bar2.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar2.setObjectName("bar2") __class__.bar56 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar56.setGeometry(QtCore.QRect(663, 170, 12, 500)) __class__.bar56.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar56.setProperty("value", 50) __class__.bar56.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar56.setTextVisible(False) __class__.bar56.setOrientation(QtCore.Qt.Vertical) __class__.bar56.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar56.setObjectName("bar56") __class__.bar49 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar49.setGeometry(QtCore.QRect(580, 170, 12, 500)) __class__.bar49.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar49.setProperty("value", 50) __class__.bar49.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar49.setTextVisible(False) __class__.bar49.setOrientation(QtCore.Qt.Vertical) __class__.bar49.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar49.setObjectName("bar49") __class__.bar99 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar99.setGeometry(QtCore.QRect(1170, 170, 12, 500)) __class__.bar99.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar99.setProperty("value", 50) __class__.bar99.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar99.setTextVisible(False) __class__.bar99.setOrientation(QtCore.Qt.Vertical) __class__.bar99.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar99.setObjectName("bar99") __class__.bar26 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar26.setGeometry(QtCore.QRect(309, 170, 12, 500)) __class__.bar26.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar26.setProperty("value", 50) __class__.bar26.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar26.setTextVisible(False) __class__.bar26.setOrientation(QtCore.Qt.Vertical) __class__.bar26.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar26.setObjectName("bar26") __class__.bar12 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar12.setGeometry(QtCore.QRect(144, 170, 12, 500)) __class__.bar12.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar12.setProperty("value", 50) __class__.bar12.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar12.setTextVisible(False) __class__.bar12.setOrientation(QtCore.Qt.Vertical) __class__.bar12.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar12.setObjectName("bar12") __class__.bar17 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar17.setGeometry(QtCore.QRect(203, 170, 12, 500)) __class__.bar17.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar17.setProperty("value", 50) __class__.bar17.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar17.setTextVisible(False) __class__.bar17.setOrientation(QtCore.Qt.Vertical) __class__.bar17.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar17.setObjectName("bar17") __class__.bar16 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar16.setGeometry(QtCore.QRect(191, 170, 12, 500)) __class__.bar16.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar16.setProperty("value", 50) __class__.bar16.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar16.setTextVisible(False) __class__.bar16.setOrientation(QtCore.Qt.Vertical) __class__.bar16.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar16.setObjectName("bar16") __class__.bar23 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar23.setGeometry(QtCore.QRect(274, 170, 12, 500)) __class__.bar23.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar23.setProperty("value", 50) __class__.bar23.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar23.setTextVisible(False) __class__.bar23.setOrientation(QtCore.Qt.Vertical) __class__.bar23.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar23.setObjectName("bar23") __class__.bar69 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar69.setGeometry(QtCore.QRect(816, 170, 12, 500)) __class__.bar69.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar69.setProperty("value", 50) __class__.bar69.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar69.setTextVisible(False) __class__.bar69.setOrientation(QtCore.Qt.Vertical) __class__.bar69.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar69.setObjectName("bar69") __class__.bar81 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar81.setGeometry(QtCore.QRect(958, 170, 12, 500)) __class__.bar81.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar81.setProperty("value", 50) __class__.bar81.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar81.setTextVisible(False) __class__.bar81.setOrientation(QtCore.Qt.Vertical) __class__.bar81.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar81.setObjectName("bar81") __class__.bar59 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar59.setGeometry(QtCore.QRect(698, 170, 12, 500)) __class__.bar59.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar59.setProperty("value", 50) __class__.bar59.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar59.setTextVisible(False) __class__.bar59.setOrientation(QtCore.Qt.Vertical) __class__.bar59.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar59.setObjectName("bar59") __class__.bar43 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar43.setGeometry(QtCore.QRect(510, 170, 12, 500)) __class__.bar43.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar43.setProperty("value", 50) __class__.bar43.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar43.setTextVisible(False) __class__.bar43.setOrientation(QtCore.Qt.Vertical) __class__.bar43.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar43.setObjectName("bar43") __class__.bar95 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar95.setEnabled(True) __class__.bar95.setGeometry(QtCore.QRect(1123, 170, 12, 500)) __class__.bar95.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar95.setProperty("value", 50) __class__.bar95.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar95.setTextVisible(False) __class__.bar95.setOrientation(QtCore.Qt.Vertical) __class__.bar95.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar95.setObjectName("bar95") __class__.bar89 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar89.setGeometry(QtCore.QRect(1052, 170, 12, 500)) __class__.bar89.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar89.setProperty("value", 50) __class__.bar89.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar89.setTextVisible(False) __class__.bar89.setOrientation(QtCore.Qt.Vertical) __class__.bar89.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar89.setObjectName("bar89") __class__.bar75 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar75.setGeometry(QtCore.QRect(887, 170, 12, 500)) __class__.bar75.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar75.setProperty("value", 50) __class__.bar75.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar75.setTextVisible(False) __class__.bar75.setOrientation(QtCore.Qt.Vertical) __class__.bar75.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar75.setObjectName("bar75") __class__.bar70 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar70.setGeometry(QtCore.QRect(828, 170, 12, 500)) __class__.bar70.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar70.setProperty("value", 50) __class__.bar70.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar70.setTextVisible(False) __class__.bar70.setOrientation(QtCore.Qt.Vertical) __class__.bar70.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar70.setObjectName("bar70") __class__.bar42 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar42.setGeometry(QtCore.QRect(498, 170, 12, 500)) __class__.bar42.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar42.setProperty("value", 50) __class__.bar42.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar42.setTextVisible(False) __class__.bar42.setOrientation(QtCore.Qt.Vertical) __class__.bar42.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar42.setObjectName("bar42") __class__.bar41 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar41.setGeometry(QtCore.QRect(486, 170, 12, 500)) __class__.bar41.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar41.setProperty("value", 50) __class__.bar41.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar41.setTextVisible(False) __class__.bar41.setOrientation(QtCore.Qt.Vertical) __class__.bar41.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar41.setObjectName("bar41") __class__.bar22 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar22.setGeometry(QtCore.QRect(262, 170, 12, 500)) __class__.bar22.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar22.setProperty("value", 50) __class__.bar22.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar22.setTextVisible(False) __class__.bar22.setOrientation(QtCore.Qt.Vertical) __class__.bar22.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar22.setObjectName("bar22") __class__.bar31 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar31.setGeometry(QtCore.QRect(368, 170, 12, 500)) __class__.bar31.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar31.setProperty("value", 50) __class__.bar31.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar31.setTextVisible(False) __class__.bar31.setOrientation(QtCore.Qt.Vertical) __class__.bar31.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar31.setObjectName("bar31") __class__.bar39 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar39.setGeometry(QtCore.QRect(463, 170, 12, 500)) __class__.bar39.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar39.setProperty("value", 50) __class__.bar39.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar39.setTextVisible(False) __class__.bar39.setOrientation(QtCore.Qt.Vertical) __class__.bar39.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar39.setObjectName("bar39") __class__.bar63 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar63.setGeometry(QtCore.QRect(745, 170, 12, 500)) __class__.bar63.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar63.setProperty("value", 50) __class__.bar63.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar63.setTextVisible(False) __class__.bar63.setOrientation(QtCore.Qt.Vertical) __class__.bar63.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar63.setObjectName("bar63") __class__.bar88 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar88.setGeometry(QtCore.QRect(1040, 170, 12, 500)) __class__.bar88.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar88.setProperty("value", 50) __class__.bar88.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar88.setTextVisible(False) __class__.bar88.setOrientation(QtCore.Qt.Vertical) __class__.bar88.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar88.setObjectName("bar88") __class__.bar7 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar7.setGeometry(QtCore.QRect(85, 170, 12, 500)) __class__.bar7.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar7.setProperty("value", 50) __class__.bar7.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar7.setTextVisible(False) __class__.bar7.setOrientation(QtCore.Qt.Vertical) __class__.bar7.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar7.setObjectName("bar7") __class__.bar35 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar35.setGeometry(QtCore.QRect(415, 170, 12, 500)) __class__.bar35.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar35.setProperty("value", 50) __class__.bar35.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar35.setTextVisible(False) __class__.bar35.setOrientation(QtCore.Qt.Vertical) __class__.bar35.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar35.setObjectName("bar35") __class__.bar54 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar54.setGeometry(QtCore.QRect(639, 170, 12, 500)) __class__.bar54.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar54.setProperty("value", 50) __class__.bar54.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar54.setTextVisible(False) __class__.bar54.setOrientation(QtCore.Qt.Vertical) __class__.bar54.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar54.setObjectName("bar54") __class__.bar65 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar65.setGeometry(QtCore.QRect(769, 170, 12, 500)) __class__.bar65.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar65.setProperty("value", 50) __class__.bar65.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar65.setTextVisible(False) __class__.bar65.setOrientation(QtCore.Qt.Vertical) __class__.bar65.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar65.setObjectName("bar65") __class__.bar55 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar55.setGeometry(QtCore.QRect(651, 170, 12, 500)) __class__.bar55.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar55.setProperty("value", 50) __class__.bar55.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar55.setTextVisible(False) __class__.bar55.setOrientation(QtCore.Qt.Vertical) __class__.bar55.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar55.setObjectName("bar55") __class__.bar47 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar47.setGeometry(QtCore.QRect(557, 170, 12, 500)) __class__.bar47.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar47.setProperty("value", 50) __class__.bar47.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar47.setTextVisible(False) __class__.bar47.setOrientation(QtCore.Qt.Vertical) __class__.bar47.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar47.setObjectName("bar47") __class__.bar40 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar40.setGeometry(QtCore.QRect(474, 170, 12, 500)) __class__.bar40.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar40.setProperty("value", 50) __class__.bar40.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar40.setTextVisible(False) __class__.bar40.setOrientation(QtCore.Qt.Vertical) __class__.bar40.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar40.setObjectName("bar40") __class__.bar74 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar74.setGeometry(QtCore.QRect(875, 170, 12, 500)) __class__.bar74.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar74.setProperty("value", 50) __class__.bar74.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar74.setTextVisible(False) __class__.bar74.setOrientation(QtCore.Qt.Vertical) __class__.bar74.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar74.setObjectName("bar74") __class__.bar4 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar4.setGeometry(QtCore.QRect(50, 170, 12, 500)) __class__.bar4.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar4.setProperty("value", 50) __class__.bar4.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar4.setTextVisible(False) __class__.bar4.setOrientation(QtCore.Qt.Vertical) __class__.bar4.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar4.setObjectName("bar4") __class__.bar36 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar36.setGeometry(QtCore.QRect(427, 170, 12, 500)) __class__.bar36.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar36.setProperty("value", 50) __class__.bar36.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar36.setTextVisible(False) __class__.bar36.setOrientation(QtCore.Qt.Vertical) __class__.bar36.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar36.setObjectName("bar36") __class__.bar58 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar58.setGeometry(QtCore.QRect(687, 170, 12, 500)) __class__.bar58.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar58.setProperty("value", 50) __class__.bar58.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar58.setTextVisible(False) __class__.bar58.setOrientation(QtCore.Qt.Vertical) __class__.bar58.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar58.setObjectName("bar58") __class__.bar72 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar72.setGeometry(QtCore.QRect(852, 170, 12, 500)) __class__.bar72.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar72.setProperty("value", 50) __class__.bar72.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar72.setTextVisible(False) __class__.bar72.setOrientation(QtCore.Qt.Vertical) __class__.bar72.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar72.setObjectName("bar72") __class__.bar51 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar51.setGeometry(QtCore.QRect(604, 170, 12, 500)) __class__.bar51.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar51.setProperty("value", 50) __class__.bar51.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar51.setTextVisible(False) __class__.bar51.setOrientation(QtCore.Qt.Vertical) __class__.bar51.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar51.setObjectName("bar51") __class__.bar87 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar87.setGeometry(QtCore.QRect(1028, 170, 12, 500)) __class__.bar87.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar87.setProperty("value", 50) __class__.bar87.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar87.setTextVisible(False) __class__.bar87.setOrientation(QtCore.Qt.Vertical) __class__.bar87.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar87.setObjectName("bar87") __class__.bar79 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar79.setGeometry(QtCore.QRect(934, 170, 12, 500)) __class__.bar79.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar79.setProperty("value", 50) __class__.bar79.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar79.setTextVisible(False) __class__.bar79.setOrientation(QtCore.Qt.Vertical) __class__.bar79.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar79.setObjectName("bar79") __class__.bar94 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar94.setGeometry(QtCore.QRect(1111, 170, 12, 500)) __class__.bar94.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar94.setProperty("value", 50) __class__.bar94.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar94.setTextVisible(False) __class__.bar94.setOrientation(QtCore.Qt.Vertical) __class__.bar94.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar94.setObjectName("bar94") __class__.bar71 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar71.setGeometry(QtCore.QRect(840, 170, 12, 500)) __class__.bar71.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar71.setProperty("value", 50) __class__.bar71.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar71.setTextVisible(False) __class__.bar71.setOrientation(QtCore.Qt.Vertical) __class__.bar71.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar71.setObjectName("bar71") __class__.bar50 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar50.setGeometry(QtCore.QRect(592, 170, 12, 500)) __class__.bar50.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar50.setProperty("value", 50) __class__.bar50.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar50.setTextVisible(False) __class__.bar50.setOrientation(QtCore.Qt.Vertical) __class__.bar50.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar50.setObjectName("bar50") __class__.bar10 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar10.setGeometry(QtCore.QRect(121, 170, 12, 500)) __class__.bar10.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar10.setProperty("value", 50) __class__.bar10.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar10.setTextVisible(False) __class__.bar10.setOrientation(QtCore.Qt.Vertical) __class__.bar10.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar10.setObjectName("bar10") __class__.bar96 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar96.setGeometry(QtCore.QRect(1135, 170, 12, 500)) __class__.bar96.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar96.setProperty("value", 50) __class__.bar96.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar96.setTextVisible(False) __class__.bar96.setOrientation(QtCore.Qt.Vertical) __class__.bar96.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar96.setObjectName("bar96") __class__.bar8 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar8.setGeometry(QtCore.QRect(97, 170, 12, 500)) __class__.bar8.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar8.setProperty("value", 50) __class__.bar8.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar8.setTextVisible(False) __class__.bar8.setOrientation(QtCore.Qt.Vertical) __class__.bar8.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar8.setObjectName("bar8") __class__.bar21 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar21.setGeometry(QtCore.QRect(250, 170, 12, 500)) __class__.bar21.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar21.setProperty("value", 50) __class__.bar21.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar21.setTextVisible(False) __class__.bar21.setOrientation(QtCore.Qt.Vertical) __class__.bar21.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar21.setObjectName("bar21") __class__.bar25 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar25.setGeometry(QtCore.QRect(297, 170, 12, 500)) __class__.bar25.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar25.setProperty("value", 50) __class__.bar25.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar25.setTextVisible(False) __class__.bar25.setOrientation(QtCore.Qt.Vertical) __class__.bar25.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar25.setObjectName("bar25") __class__.bar100 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar100.setGeometry(QtCore.QRect(1182, 170, 12, 500)) __class__.bar100.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar100.setProperty("value", 50) __class__.bar100.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar100.setTextVisible(False) __class__.bar100.setOrientation(QtCore.Qt.Vertical) __class__.bar100.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar100.setObjectName("bar100") __class__.bar80 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar80.setGeometry(QtCore.QRect(946, 170, 12, 500)) __class__.bar80.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar80.setProperty("value", 50) __class__.bar80.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar80.setTextVisible(False) __class__.bar80.setOrientation(QtCore.Qt.Vertical) __class__.bar80.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar80.setObjectName("bar80") __class__.bar29 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar29.setGeometry(QtCore.QRect(345, 170, 12, 500)) __class__.bar29.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar29.setProperty("value", 50) __class__.bar29.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar29.setTextVisible(False) __class__.bar29.setOrientation(QtCore.Qt.Vertical) __class__.bar29.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar29.setObjectName("bar29") __class__.bar78 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar78.setGeometry(QtCore.QRect(922, 170, 12, 500)) __class__.bar78.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar78.setProperty("value", 50) __class__.bar78.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar78.setTextVisible(False) __class__.bar78.setOrientation(QtCore.Qt.Vertical) __class__.bar78.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar78.setObjectName("bar78") __class__.bar86 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar86.setGeometry(QtCore.QRect(1017, 170, 12, 500)) __class__.bar86.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar86.setProperty("value", 50) __class__.bar86.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar86.setTextVisible(False) __class__.bar86.setOrientation(QtCore.Qt.Vertical) __class__.bar86.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar86.setObjectName("bar86") __class__.bar67 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar67.setGeometry(QtCore.QRect(793, 170, 12, 500)) __class__.bar67.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar67.setProperty("value", 50) __class__.bar67.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar67.setTextVisible(False) __class__.bar67.setOrientation(QtCore.Qt.Vertical) __class__.bar67.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar67.setObjectName("bar67") __class__.bar52 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar52.setGeometry(QtCore.QRect(616, 170, 12, 500)) __class__.bar52.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar52.setProperty("value", 50) __class__.bar52.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar52.setTextVisible(False) __class__.bar52.setOrientation(QtCore.Qt.Vertical) __class__.bar52.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar52.setObjectName("bar52") __class__.bar82 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar82.setGeometry(QtCore.QRect(969, 170, 12, 500)) __class__.bar82.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar82.setProperty("value", 50) __class__.bar82.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar82.setTextVisible(False) __class__.bar82.setOrientation(QtCore.Qt.Vertical) __class__.bar82.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar82.setObjectName("bar82") __class__.bar24 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar24.setGeometry(QtCore.QRect(286, 170, 12, 500)) __class__.bar24.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar24.setProperty("value", 50) __class__.bar24.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar24.setTextVisible(False) __class__.bar24.setOrientation(QtCore.Qt.Vertical) __class__.bar24.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar24.setObjectName("bar24") __class__.bar20 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar20.setGeometry(QtCore.QRect(239, 170, 12, 500)) __class__.bar20.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar20.setProperty("value", 50) __class__.bar20.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar20.setTextVisible(False) __class__.bar20.setOrientation(QtCore.Qt.Vertical) __class__.bar20.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar20.setObjectName("bar20") __class__.bar76 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar76.setGeometry(QtCore.QRect(899, 170, 12, 500)) __class__.bar76.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar76.setProperty("value", 50) __class__.bar76.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar76.setTextVisible(False) __class__.bar76.setOrientation(QtCore.Qt.Vertical) __class__.bar76.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar76.setObjectName("bar76") __class__.bar27 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar27.setGeometry(QtCore.QRect(321, 170, 12, 500)) __class__.bar27.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar27.setProperty("value", 50) __class__.bar27.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar27.setTextVisible(False) __class__.bar27.setOrientation(QtCore.Qt.Vertical) __class__.bar27.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar27.setObjectName("bar27") __class__.bar83 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar83.setGeometry(QtCore.QRect(981, 170, 12, 500)) __class__.bar83.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar83.setProperty("value", 50) __class__.bar83.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar83.setTextVisible(False) __class__.bar83.setOrientation(QtCore.Qt.Vertical) __class__.bar83.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar83.setObjectName("bar83") __class__.bar57 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar57.setGeometry(QtCore.QRect(675, 170, 12, 500)) __class__.bar57.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar57.setProperty("value", 50) __class__.bar57.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar57.setTextVisible(False) __class__.bar57.setOrientation(QtCore.Qt.Vertical) __class__.bar57.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar57.setObjectName("bar57") __class__.bar6 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar6.setGeometry(QtCore.QRect(73, 170, 12, 500)) __class__.bar6.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar6.setProperty("value", 50) __class__.bar6.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar6.setTextVisible(False) __class__.bar6.setOrientation(QtCore.Qt.Vertical) __class__.bar6.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar6.setObjectName("bar6") __class__.bar53 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar53.setGeometry(QtCore.QRect(628, 170, 12, 500)) __class__.bar53.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar53.setProperty("value", 50) __class__.bar53.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar53.setTextVisible(False) __class__.bar53.setOrientation(QtCore.Qt.Vertical) __class__.bar53.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar53.setObjectName("bar53") __class__.bar33 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar33.setGeometry(QtCore.QRect(392, 170, 12, 500)) __class__.bar33.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar33.setProperty("value", 50) __class__.bar33.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar33.setTextVisible(False) __class__.bar33.setOrientation(QtCore.Qt.Vertical) __class__.bar33.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar33.setObjectName("bar33") __class__.bar77 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar77.setGeometry(QtCore.QRect(911, 170, 12, 500)) __class__.bar77.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar77.setProperty("value", 50) __class__.bar77.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar77.setTextVisible(False) __class__.bar77.setOrientation(QtCore.Qt.Vertical) __class__.bar77.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar77.setObjectName("bar77") __class__.bar66 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar66.setGeometry(QtCore.QRect(781, 170, 12, 500)) __class__.bar66.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar66.setProperty("value", 50) __class__.bar66.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar66.setTextVisible(False) __class__.bar66.setOrientation(QtCore.Qt.Vertical) __class__.bar66.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar66.setObjectName("bar66") __class__.bar13 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar13.setGeometry(QtCore.QRect(156, 170, 12, 500)) __class__.bar13.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar13.setProperty("value", 50) __class__.bar13.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar13.setTextVisible(False) __class__.bar13.setOrientation(QtCore.Qt.Vertical) __class__.bar13.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar13.setObjectName("bar13") __class__.bar9 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar9.setGeometry(QtCore.QRect(109, 170, 12, 500)) __class__.bar9.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar9.setProperty("value", 50) __class__.bar9.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar9.setTextVisible(False) __class__.bar9.setOrientation(QtCore.Qt.Vertical) __class__.bar9.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar9.setObjectName("bar9") __class__.bar90 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar90.setGeometry(QtCore.QRect(1064, 170, 12, 500)) __class__.bar90.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar90.setProperty("value", 50) __class__.bar90.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar90.setTextVisible(False) __class__.bar90.setOrientation(QtCore.Qt.Vertical) __class__.bar90.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar90.setObjectName("bar90") __class__.bar37 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar37.setGeometry(QtCore.QRect(439, 170, 12, 500)) __class__.bar37.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar37.setProperty("value", 50) __class__.bar37.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar37.setTextVisible(False) __class__.bar37.setOrientation(QtCore.Qt.Vertical) __class__.bar37.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar37.setObjectName("bar37") __class__.bar84 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar84.setGeometry(QtCore.QRect(993, 170, 12, 500)) __class__.bar84.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar84.setProperty("value", 50) __class__.bar84.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar84.setTextVisible(False) __class__.bar84.setOrientation(QtCore.Qt.Vertical) __class__.bar84.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar84.setObjectName("bar84") __class__.bar93 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar93.setGeometry(QtCore.QRect(1099, 170, 12, 500)) __class__.bar93.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar93.setProperty("value", 50) __class__.bar93.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar93.setTextVisible(False) __class__.bar93.setOrientation(QtCore.Qt.Vertical) __class__.bar93.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar93.setObjectName("bar93") __class__.bar18 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar18.setGeometry(QtCore.QRect(215, 170, 12, 500)) __class__.bar18.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar18.setProperty("value", 50) __class__.bar18.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar18.setTextVisible(False) __class__.bar18.setOrientation(QtCore.Qt.Vertical) __class__.bar18.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar18.setObjectName("bar18") __class__.bar97 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar97.setGeometry(QtCore.QRect(1146, 170, 12, 500)) __class__.bar97.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar97.setProperty("value", 50) __class__.bar97.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar97.setTextVisible(False) __class__.bar97.setOrientation(QtCore.Qt.Vertical) __class__.bar97.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar97.setObjectName("bar97") __class__.bar14 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar14.setGeometry(QtCore.QRect(168, 170, 12, 500)) __class__.bar14.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar14.setProperty("value", 50) __class__.bar14.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar14.setTextVisible(False) __class__.bar14.setOrientation(QtCore.Qt.Vertical) __class__.bar14.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar14.setObjectName("bar14") __class__.bar62 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar62.setGeometry(QtCore.QRect(734, 170, 12, 500)) __class__.bar62.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar62.setProperty("value", 50) __class__.bar62.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar62.setTextVisible(False) __class__.bar62.setOrientation(QtCore.Qt.Vertical) __class__.bar62.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar62.setObjectName("bar62") __class__.bar91 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar91.setGeometry(QtCore.QRect(1076, 170, 12, 500)) __class__.bar91.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar91.setProperty("value", 50) __class__.bar91.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar91.setTextVisible(False) __class__.bar91.setOrientation(QtCore.Qt.Vertical) __class__.bar91.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar91.setObjectName("bar91") __class__.bar73 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar73.setGeometry(QtCore.QRect(863, 170, 12, 500)) __class__.bar73.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar73.setProperty("value", 50) __class__.bar73.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar73.setTextVisible(False) __class__.bar73.setOrientation(QtCore.Qt.Vertical) __class__.bar73.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar73.setObjectName("bar73") __class__.bar11 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar11.setGeometry(QtCore.QRect(132, 170, 12, 500)) __class__.bar11.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar11.setProperty("value", 50) __class__.bar11.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar11.setTextVisible(False) __class__.bar11.setOrientation(QtCore.Qt.Vertical) __class__.bar11.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar11.setObjectName("bar11") __class__.bar5 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar5.setGeometry(QtCore.QRect(62, 170, 12, 500)) __class__.bar5.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar5.setProperty("value", 50) __class__.bar5.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar5.setTextVisible(False) __class__.bar5.setOrientation(QtCore.Qt.Vertical) __class__.bar5.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar5.setObjectName("bar5") __class__.bar61 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar61.setGeometry(QtCore.QRect(722, 170, 12, 500)) __class__.bar61.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar61.setProperty("value", 50) __class__.bar61.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar61.setTextVisible(False) __class__.bar61.setOrientation(QtCore.Qt.Vertical) __class__.bar61.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar61.setObjectName("bar61") __class__.bar30 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar30.setGeometry(QtCore.QRect(356, 170, 12, 500)) __class__.bar30.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar30.setProperty("value", 50) __class__.bar30.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar30.setTextVisible(False) __class__.bar30.setOrientation(QtCore.Qt.Vertical) __class__.bar30.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar30.setObjectName("bar30") __class__.bar85 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar85.setGeometry(QtCore.QRect(1005, 170, 12, 500)) __class__.bar85.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar85.setProperty("value", 50) __class__.bar85.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar85.setTextVisible(False) __class__.bar85.setOrientation(QtCore.Qt.Vertical) __class__.bar85.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar85.setObjectName("bar85") __class__.bar46 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar46.setGeometry(QtCore.QRect(545, 170, 12, 500)) __class__.bar46.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar46.setProperty("value", 50) __class__.bar46.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar46.setTextVisible(False) __class__.bar46.setOrientation(QtCore.Qt.Vertical) __class__.bar46.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar46.setObjectName("bar46") __class__.bar19 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar19.setGeometry(QtCore.QRect(227, 170, 12, 500)) __class__.bar19.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar19.setProperty("value", 50) __class__.bar19.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar19.setTextVisible(False) __class__.bar19.setOrientation(QtCore.Qt.Vertical) __class__.bar19.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar19.setObjectName("bar19") __class__.bar60 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar60.setGeometry(QtCore.QRect(710, 170, 12, 500)) __class__.bar60.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar60.setProperty("value", 50) __class__.bar60.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar60.setTextVisible(False) __class__.bar60.setOrientation(QtCore.Qt.Vertical) __class__.bar60.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar60.setObjectName("bar60") __class__.bar68 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar68.setGeometry(QtCore.QRect(804, 170, 12, 500)) __class__.bar68.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar68.setProperty("value", 50) __class__.bar68.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar68.setTextVisible(False) __class__.bar68.setOrientation(QtCore.Qt.Vertical) __class__.bar68.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar68.setObjectName("bar68") __class__.bar3 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar3.setGeometry(QtCore.QRect(38, 170, 12, 500)) __class__.bar3.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar3.setProperty("value", 50) __class__.bar3.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar3.setTextVisible(False) __class__.bar3.setOrientation(QtCore.Qt.Vertical) __class__.bar3.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar3.setObjectName("bar3") __class__.bar15 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar15.setGeometry(QtCore.QRect(180, 170, 12, 500)) __class__.bar15.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar15.setProperty("value", 50) __class__.bar15.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar15.setTextVisible(False) __class__.bar15.setOrientation(QtCore.Qt.Vertical) __class__.bar15.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar15.setObjectName("bar15") __class__.bar92 = QtWidgets.QProgressBar(self.centralwidget) __class__.bar92.setGeometry(QtCore.QRect(1087, 170, 12, 500)) __class__.bar92.setStyleSheet("QProgressBar {\n" " background-color : rgba(0, 0, 0, 0);\n" " border : 1px;\n" "}\n" "\n" "QProgressBar::chunk {\n" " \n" " \n" " background-color: rgb(255, 0, 0);\n" " border: 1px solid black;\n" "}") __class__.bar92.setProperty("value", 50) __class__.bar92.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) __class__.bar92.setTextVisible(False) __class__.bar92.setOrientation(QtCore.Qt.Vertical) __class__.bar92.setTextDirection(QtWidgets.QProgressBar.BottomToTop) __class__.bar92.setObjectName("bar92") self.comboSelect = QtWidgets.QComboBox(self.centralwidget) self.comboSelect.setGeometry(QtCore.QRect(520, 40, 121, 30)) self.comboSelect.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContentsOnFirstShow) self.comboSelect.setObjectName("comboSelect") self.comboSelect.addItem("") self.comboSelect.addItem("") self.comboSelect.addItem("") self.comboSelect.addItem("") self.comboSelect.addItem("") self.comboSelect.addItem("") self.buttonLoadFile = QtWidgets.QPushButton(self.centralwidget) self.buttonLoadFile.setGeometry(QtCore.QRect(390, 40, 121, 30)) self.buttonLoadFile.setObjectName("buttonLoadFile") self.labelData = QtWidgets.QLabel(self.centralwidget) self.labelData.setGeometry(QtCore.QRect(390, 10, 121, 30)) self.labelData.setAlignment(QtCore.Qt.AlignCenter) self.labelData.setObjectName("labelData") self.labelAlgorithm = QtWidgets.QLabel(self.centralwidget) self.labelAlgorithm.setGeometry(QtCore.QRect(520, 10, 121, 30)) self.labelAlgorithm.setAlignment(QtCore.Qt.AlignCenter) self.labelAlgorithm.setObjectName("labelAlgorithm") self.buttonStart = QtWidgets.QPushButton(self.centralwidget) self.buttonStart.setGeometry(QtCore.QRect(520, 130, 121, 30)) self.buttonStart.setObjectName("buttonStart") self.labelTime = QtWidgets.QLabel(self.centralwidget) self.labelTime.setGeometry(QtCore.QRect(1050, 140, 47, 16)) self.labelTime.setAlignment(QtCore.Qt.AlignCenter) self.labelTime.setObjectName("labelTime") self.labelTimeVal = QtWidgets.QLabel(self.centralwidget) self.labelTimeVal.setGeometry(QtCore.QRect(1100, 140, 61, 16)) self.labelTimeVal.setText("") self.labelTimeVal.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.labelTimeVal.setObjectName("labelTimeVal") self.labelDelay = QtWidgets.QLabel(self.centralwidget) self.labelDelay.setGeometry(QtCore.QRect(650, 10, 121, 30)) self.labelDelay.setAlignment(QtCore.Qt.AlignCenter) self.labelDelay.setObjectName("labelDelay") self.lebelDelayVal = QtWidgets.QLabel(self.centralwidget) self.lebelDelayVal.setGeometry(QtCore.QRect(650, 80, 121, 30)) self.lebelDelayVal.setAlignment(QtCore.Qt.AlignCenter) self.lebelDelayVal.setObjectName("lebelDelayVal") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "Algotihim Visualizer")) self.buttonGenRan.setText(_translate("MainWindow", "Generate Random")) self.labelStatus.setText(_translate("MainWindow", "Status:")) self.bar48.setFormat(_translate("MainWindow", "%p")) self.bar45.setFormat(_translate("MainWindow", "%p")) self.bar1.setFormat(_translate("MainWindow", "%p")) self.bar38.setFormat(_translate("MainWindow", "%p")) self.bar64.setFormat(_translate("MainWindow", "%p")) self.bar34.setFormat(_translate("MainWindow", "%p")) self.bar32.setFormat(_translate("MainWindow", "%p")) self.bar28.setFormat(_translate("MainWindow", "%p")) self.bar44.setFormat(_translate("MainWindow", "%p")) self.bar98.setFormat(_translate("MainWindow", "%p")) self.bar2.setFormat(_translate("MainWindow", "%p")) self.bar56.setFormat(_translate("MainWindow", "%p")) self.bar49.setFormat(_translate("MainWindow", "%p")) self.bar99.setFormat(_translate("MainWindow", "%p")) self.bar26.setFormat(_translate("MainWindow", "%p")) self.bar12.setFormat(_translate("MainWindow", "%p")) self.bar17.setFormat(_translate("MainWindow", "%p")) self.bar16.setFormat(_translate("MainWindow", "%p")) self.bar23.setFormat(_translate("MainWindow", "%p")) self.bar69.setFormat(_translate("MainWindow", "%p")) self.bar81.setFormat(_translate("MainWindow", "%p")) self.bar59.setFormat(_translate("MainWindow", "%p")) self.bar43.setFormat(_translate("MainWindow", "%p")) self.bar95.setFormat(_translate("MainWindow", "%p")) self.bar89.setFormat(_translate("MainWindow", "%p")) self.bar75.setFormat(_translate("MainWindow", "%p")) self.bar70.setFormat(_translate("MainWindow", "%p")) self.bar42.setFormat(_translate("MainWindow", "%p")) self.bar41.setFormat(_translate("MainWindow", "%p")) self.bar22.setFormat(_translate("MainWindow", "%p")) self.bar31.setFormat(_translate("MainWindow", "%p")) self.bar39.setFormat(_translate("MainWindow", "%p")) self.bar63.setFormat(_translate("MainWindow", "%p")) self.bar88.setFormat(_translate("MainWindow", "%p")) self.bar7.setFormat(_translate("MainWindow", "%p")) self.bar35.setFormat(_translate("MainWindow", "%p")) self.bar54.setFormat(_translate("MainWindow", "%p")) self.bar65.setFormat(_translate("MainWindow", "%p")) self.bar55.setFormat(_translate("MainWindow", "%p")) self.bar47.setFormat(_translate("MainWindow", "%p")) self.bar40.setFormat(_translate("MainWindow", "%p")) self.bar74.setFormat(_translate("MainWindow", "%p")) self.bar4.setFormat(_translate("MainWindow", "%p")) self.bar36.setFormat(_translate("MainWindow", "%p")) self.bar58.setFormat(_translate("MainWindow", "%p")) self.bar72.setFormat(_translate("MainWindow", "%p")) self.bar51.setFormat(_translate("MainWindow", "%p")) self.bar87.setFormat(_translate("MainWindow", "%p")) self.bar79.setFormat(_translate("MainWindow", "%p")) self.bar94.setFormat(_translate("MainWindow", "%p")) self.bar71.setFormat(_translate("MainWindow", "%p")) self.bar50.setFormat(_translate("MainWindow", "%p")) self.bar10.setFormat(_translate("MainWindow", "%p")) self.bar96.setFormat(_translate("MainWindow", "%p")) self.bar8.setFormat(_translate("MainWindow", "%p")) self.bar21.setFormat(_translate("MainWindow", "%p")) self.bar25.setFormat(_translate("MainWindow", "%p")) self.bar100.setFormat(_translate("MainWindow", "%p")) self.bar80.setFormat(_translate("MainWindow", "%p")) self.bar29.setFormat(_translate("MainWindow", "%p")) self.bar78.setFormat(_translate("MainWindow", "%p")) self.bar86.setFormat(_translate("MainWindow", "%p")) self.bar67.setFormat(_translate("MainWindow", "%p")) self.bar52.setFormat(_translate("MainWindow", "%p")) self.bar82.setFormat(_translate("MainWindow", "%p")) self.bar24.setFormat(_translate("MainWindow", "%p")) self.bar20.setFormat(_translate("MainWindow", "%p")) self.bar76.setFormat(_translate("MainWindow", "%p")) self.bar27.setFormat(_translate("MainWindow", "%p")) self.bar83.setFormat(_translate("MainWindow", "%p")) self.bar57.setFormat(_translate("MainWindow", "%p")) self.bar6.setFormat(_translate("MainWindow", "%p")) self.bar53.setFormat(_translate("MainWindow", "%p")) self.bar33.setFormat(_translate("MainWindow", "%p")) self.bar77.setFormat(_translate("MainWindow", "%p")) self.bar66.setFormat(_translate("MainWindow", "%p")) self.bar13.setFormat(_translate("MainWindow", "%p")) self.bar9.setFormat(_translate("MainWindow", "%p")) self.bar90.setFormat(_translate("MainWindow", "%p")) self.bar37.setFormat(_translate("MainWindow", "%p")) self.bar84.setFormat(_translate("MainWindow", "%p")) self.bar93.setFormat(_translate("MainWindow", "%p")) self.bar18.setFormat(_translate("MainWindow", "%p")) self.bar97.setFormat(_translate("MainWindow", "%p")) self.bar14.setFormat(_translate("MainWindow", "%p")) self.bar62.setFormat(_translate("MainWindow", "%p")) self.bar91.setFormat(_translate("MainWindow", "%p")) self.bar73.setFormat(_translate("MainWindow", "%p")) self.bar11.setFormat(_translate("MainWindow", "%p")) self.bar5.setFormat(_translate("MainWindow", "%p")) self.bar61.setFormat(_translate("MainWindow", "%p")) self.bar30.setFormat(_translate("MainWindow", "%p")) self.bar85.setFormat(_translate("MainWindow", "%p")) self.bar46.setFormat(_translate("MainWindow", "%p")) self.bar19.setFormat(_translate("MainWindow", "%p")) self.bar60.setFormat(_translate("MainWindow", "%p")) self.bar68.setFormat(_translate("MainWindow", "%p")) self.bar3.setFormat(_translate("MainWindow", "%p")) self.bar15.setFormat(_translate("MainWindow", "%p")) self.bar92.setFormat(_translate("MainWindow", "%p")) self.comboSelect.setItemText(0, _translate("MainWindow", "Shell Sort")) self.comboSelect.setItemText(1, _translate("MainWindow", "Insertion Sort")) self.comboSelect.setItemText(2, _translate("MainWindow", "Radix Sort")) self.comboSelect.setItemText(3, _translate("MainWindow", "Selection Sort")) self.comboSelect.setItemText(4, _translate("MainWindow", "Bubble Sort")) self.comboSelect.setItemText(5, _translate("MainWindow", "Comb Sort")) self.labelDelay.setText(_translate("MainWindow", "Delay (ms)")) self.lebelDelayVal.setText(_translate("MainWindow", "0.1")) self.buttonLoadFile.setText(_translate("MainWindow", "Load From File")) self.labelData.setText(_translate("MainWindow", "Data to sort")) self.labelAlgorithm.setText(_translate("MainWindow", "Sorting algorithm")) self.buttonStart.setText(_translate("MainWindow", "START")) self.labelTime.setText(_translate("MainWindow", "Time:")) self.labelTimeVal.setText(_translate("MainWindow", "0s")) self.buttonLoadFile.clicked.connect(self.loadFile) self.buttonGenRan.clicked.connect(self.generateRandom) self.buttonStart.clicked.connect(self.startSort) self.sliderDelay.valueChanged.connect(self.updateDelay) data = [] delay = 0.001 # updates delay def updateDelay(self): self.delay = self.sliderDelay.value() / 1000 self.lebelDelayVal.setText(str(self.sliderDelay.value())) # opens file explorer and passes file name for loading def loadFile(self): fileFilter = "Text Files (*.txt);;All Files (*.*)" fileName = QFileDialog.getOpenFileName(caption="Select file with data", directory=".", filter=fileFilter) if fileName[0] == "": pass else: self.data = tools.readData(fileName[0]) self.setupBars() # calling function to generate random data def generateRandom(self): self.data = tools.generateRandomArray() self.setupBars() # runs sorting and saves sorted data def startSort(self): barArr = [self.bar1, self.bar2, self.bar3, self.bar4, self.bar5, self.bar6, self.bar7, self.bar8, self.bar9, self.bar10, self.bar11, self.bar12, self.bar13, self.bar14, self.bar15, self.bar16, self.bar17, self.bar18, self.bar19, self.bar20, self.bar21, self.bar22, self.bar23, self.bar24, self.bar25, self.bar26, self.bar27, self.bar28, self.bar29, self.bar30, self.bar31, self.bar32, self.bar33, self.bar34, self.bar35, self.bar36, self.bar37, self.bar38, self.bar39, self.bar40, self.bar41, self.bar42, self.bar43, self.bar44, self.bar45, self.bar46, self.bar47, self.bar48, self.bar49, self.bar50, self.bar51, self.bar52, self.bar53, self.bar54, self.bar55, self.bar56, self.bar57, self.bar58, self.bar59, self.bar60, self.bar61, self.bar62, self.bar63, self.bar64, self.bar65, self.bar66, self.bar67, self.bar68, self.bar69, self.bar70, self.bar71, self.bar72, self.bar73, self.bar74, self.bar75, self.bar76, self.bar77, self.bar78, self.bar79, self.bar80, self.bar81, self.bar82, self.bar83, self.bar84, self.bar85, self.bar86, self.bar87, self.bar88, self.bar89, self.bar90, self.bar91, self.bar92, self.bar93, self.bar94, self.bar95, self.bar96, self.bar97, self.bar98, self.bar99, self.bar100] algo = str(self.comboSelect.currentText()) if algo == "Shell Sort": self.labelStatusVal.setText("Sorting with Shell Sort...") startTime = time.time() self.data = algorithms.Algorithms.ShellSort(self.delay) self.labelTimeVal.setText(str(round(time.time() - startTime, 2)) + "s") self.labelStatusVal.setText("Idle") elif algo == "Insertion Sort": self.labelStatusVal.setText("Sorting with Insertion Sort...") startTime = time.time() self.data = algorithms.Algorithms.InsertionSort(self.delay) self.labelTimeVal.setText(str(round(time.time() - startTime, 2)) + "s") self.labelStatusVal.setText("Idle") elif algo == "Radix Sort": self.labelStatusVal.setText("Sorting with Radix Sort...") startTime = time.time() self.data = algorithms.Algorithms.radixSortHelper(self.delay) self.labelTimeVal.setText(str(round(time.time() - startTime, 2)) + "s") self.labelStatusVal.setText("Idle") elif algo == "Selection Sort": self.labelStatusVal.setText("Sorting with Selection Sort....") startTime = time.time() self.data = algorithms.Algorithms.SelectionSort(self.delay) self.labelTimeVal.setText(str(round(time.time() - startTime, 2)) + "s") self.labelStatusVal.setText("Idle") elif algo == "Bubble Sort": self.labelStatusVal.setText("Sorting with Bubble Sort...") startTime = time.time() self.data = algorithms.Algorithms.BubbleSort(self.delay) self.labelTimeVal.setText(str(round(time.time() - startTime, 2)) + "s") self.labelStatusVal.setText("Idle") elif algo == "Comb Sort": self.labelStatusVal.setText("Sorting with Comb Sort...") startTime = time.time() self.data = algorithms.Algorithms.CombSort(self.delay) self.labelTimeVal.setText(str(round(time.time() - startTime, 2)) + "s") self.labelStatusVal.setText("Idle") tools.saveSorted(self.data) # sets up the bars with loaded data def setupBars(self): self.labelStatusVal.setText("Setting up bars...") bars = [self.bar1, self.bar2, self.bar3, self.bar4, self.bar5, self.bar6, self.bar7, self.bar8, self.bar9, self.bar10, self.bar11, self.bar12, self.bar13, self.bar14, self.bar15, self.bar16, self.bar17, self.bar18, self.bar19, self.bar20, self.bar21, self.bar22, self.bar23, self.bar24, self.bar25, self.bar26, self.bar27, self.bar28, self.bar29, self.bar30, self.bar31, self.bar32, self.bar33, self.bar34, self.bar35, self.bar36, self.bar37, self.bar38, self.bar39, self.bar40, self.bar41, self.bar42, self.bar43, self.bar44, self.bar45, self.bar46, self.bar47, self.bar48, self.bar49, self.bar50, self.bar51, self.bar52, self.bar53, self.bar54, self.bar55, self.bar56, self.bar57, self.bar58, self.bar59, self.bar60, self.bar61, self.bar62, self.bar63, self.bar64, self.bar65, self.bar66, self.bar67, self.bar68, self.bar69, self.bar70, self.bar71, self.bar72, self.bar73, self.bar74, self.bar75, self.bar76, self.bar77, self.bar78, self.bar79, self.bar80, self.bar81, self.bar82, self.bar83, self.bar84, self.bar85, self.bar86, self.bar87, self.bar88, self.bar89, self.bar90, self.bar91, self.bar92, self.bar93, self.bar94, self.bar95, self.bar96, self.bar97, self.bar98, self.bar99, self.bar100] for i in range(len(bars)): bars[i].setValue(self.data[i]) time.sleep(self.delay) self.labelStatusVal.setText("Idle")
""" Core module Dashboard URLs """ from django.conf.urls import patterns, url from anaf.core.dashboard import views urlpatterns = patterns('anaf.core.dashboard.views', url(r'^(\.(?P<response_format>\w+))?$', views.index, name='core_dashboard_index'), # Widgets url(r'^widget/add(\.(?P<response_format>\w+))?$', views.dashboard_widget_add, name='core_dashboard_widget_add'), url(r'^widget/add/(?P<module_name>[a-z\.]+)/(?P<widget_name>\w+)(\.(?P<response_format>\w+))?$', views.dashboard_widget_add, name='core_dashboard_widget_add_selected'), url(r'^widget/edit/(?P<widget_id>\d+)(\.(?P<response_format>\w+))?$', views.dashboard_widget_edit, name='core_dashboard_widget_edit'), url(r'^widget/delete/(?P<widget_id>\d+)(\.(?P<response_format>\w+))?$', views.dashboard_widget_delete, name='core_dashboard_widget_delete'), url(r'^widget/arrange/(?P<panel>\w+)?(\.(?P<response_format>\w+))?$', views.dashboard_widget_arrange, name='core_dashboard_widget_arrange'), )
# -*- coding: utf-8 -*- import signal from functools import wraps __author__ = "Grant Hulegaard" __copyright__ = "Copyright (C) Nginx, Inc. All rights reserved." __license__ = "" __maintainer__ = "Grant Hulegaard" __email__ = "[email protected]" class TimeoutException(Exception): description = 'Operation exceeded time allowed' def __init__(self, message=None, payload=None): super(TimeoutException, self).__init__() self.message = message if message is not None else self.description self.payload = payload def __str__(self): return "(message=%s, payload=%s)" % (self.message, self.payload) def timeout(seconds=10, error_message=TimeoutException.description): """ Simple timeout decorator. Not thread safe...if using multi-threading, it will be caught by a random thread. Also note, only works if logic is asynchronous. The `signal` library can only check for signals or obey handlers if the GIL is returned. Adapted from: https://stackoverflow.com/questions/2281850/timeout-function-if-it-takes-too-long-to-finish Example usage:: @timeout() def my_func(): ... @timeout(1, error_message='Timed out after 1 second') def my_func(): ... """ def decorator(func): # define the handler def _handle_timeout(signum, frame): raise TimeoutException(error_message) @wraps(func) def decorated_view(*args, **kwargs): # set create the signal alarm signal.signal(signal.SIGALRM, _handle_timeout) # schedule an alarm signal.alarm(seconds) try: result = func(*args, **kwargs) finally: signal.alarm(0) # disable the alarm return result return decorated_view return decorator
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/grpc/service1.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor.FileDescriptor( name='app/grpc/service1.proto', package='app.grpc', syntax='proto3', serialized_options=None, create_key=_descriptor._internal_create_key, serialized_pb=b'\n\x17\x61pp/grpc/service1.proto\x12\x08\x61pp.grpc\"\"\n\x12ProcessNameRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\"#\n\x13ProcessNameResponse\x12\x0c\n\x04name\x18\x01 \x01(\t2X\n\x08Service1\x12L\n\x0bProcessName\x12\x1c.app.grpc.ProcessNameRequest\x1a\x1d.app.grpc.ProcessNameResponse\"\x00\x62\x06proto3' ) _PROCESSNAMEREQUEST = _descriptor.Descriptor( name='ProcessNameRequest', full_name='app.grpc.ProcessNameRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name='name', full_name='app.grpc.ProcessNameRequest.name', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=37, serialized_end=71, ) _PROCESSNAMERESPONSE = _descriptor.Descriptor( name='ProcessNameResponse', full_name='app.grpc.ProcessNameResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name='name', full_name='app.grpc.ProcessNameResponse.name', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=73, serialized_end=108, ) DESCRIPTOR.message_types_by_name['ProcessNameRequest'] = _PROCESSNAMEREQUEST DESCRIPTOR.message_types_by_name['ProcessNameResponse'] = _PROCESSNAMERESPONSE _sym_db.RegisterFileDescriptor(DESCRIPTOR) ProcessNameRequest = _reflection.GeneratedProtocolMessageType('ProcessNameRequest', (_message.Message,), { 'DESCRIPTOR' : _PROCESSNAMEREQUEST, '__module__' : 'app.grpc.service1_pb2' # @@protoc_insertion_point(class_scope:app.grpc.ProcessNameRequest) }) _sym_db.RegisterMessage(ProcessNameRequest) ProcessNameResponse = _reflection.GeneratedProtocolMessageType('ProcessNameResponse', (_message.Message,), { 'DESCRIPTOR' : _PROCESSNAMERESPONSE, '__module__' : 'app.grpc.service1_pb2' # @@protoc_insertion_point(class_scope:app.grpc.ProcessNameResponse) }) _sym_db.RegisterMessage(ProcessNameResponse) _SERVICE1 = _descriptor.ServiceDescriptor( name='Service1', full_name='app.grpc.Service1', file=DESCRIPTOR, index=0, serialized_options=None, create_key=_descriptor._internal_create_key, serialized_start=110, serialized_end=198, methods=[ _descriptor.MethodDescriptor( name='ProcessName', full_name='app.grpc.Service1.ProcessName', index=0, containing_service=None, input_type=_PROCESSNAMEREQUEST, output_type=_PROCESSNAMERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key, ), ]) _sym_db.RegisterServiceDescriptor(_SERVICE1) DESCRIPTOR.services_by_name['Service1'] = _SERVICE1 # @@protoc_insertion_point(module_scope)
from antlr4.tree.Tree import ParseTree from parser.PlSqlParser import PlSqlParser from .visitor import Visitor from .ast.hie_query import HierarchicalQueryNode from .ast.token import TokenNode from .ast.table_ref import TableRefNode from .ast.selected_item import SelectedItemNode from .ast.dot_id import DotIdNode from .ast.relational_expression import RelationalExpressionNode from .ast.prior_expression import PriorExpressionNode class Translator(object): """ Транслятор нод (ORA -> PG) """ def __init__(self): self.visitor = Visitor(translator=self) def translate(self, tree: ParseTree): return self.visit(tree) def visit(self, ctx: ParseTree): return self.visitor.visit(ctx) def translate_hierarchical_query(self, ctx: PlSqlParser.Query_blockContext): """ """ result = HierarchicalQueryNode() # обрабатываем selected элементы if ctx.selected_list().select_list_elements(): # указано явное перечисление полей for selected_element in ctx.selected_list().select_list_elements(): result.selected_elements.append(self.visit(selected_element)) else: # SELECT * FROM result.selected_elements.append(TokenNode("*")) # обрабатываем выражение FROM for table_ref_ctx in ctx.from_clause().table_ref_list().table_ref(): result.table_refs.append(self.visit(table_ref_ctx)) # стартовая часть иерархического запроса start_part_ctx = ctx.hierarchical_query_clause().start_part() if ctx.hierarchical_query_clause() else None result.start_part = self.visit(start_part_ctx.condition()) if start_part_ctx else None # рекурсивная часть иерархического запроса hie_condition_ctx = ctx.hierarchical_query_clause().condition() if ctx.hierarchical_query_clause() else None result.hie_condition = self.visit(hie_condition_ctx) if hie_condition_ctx else None return result def translate_selected_list_elements(self, ctx: PlSqlParser.Select_list_elementsContext): """ Конвертация правила select_list_elements """ if ctx.ASTERISK() is not None: return SelectedItemNode(name="*", table=self.visit(ctx.table_view_name())) alias = None if ctx.column_alias(): alias = self.visit( ctx=ctx.column_alias().identifier() if ctx.column_alias().identifier() else \ ctx.column_alias().quoted_string() ).get_text() table = None name = None name_node = self.visit(ctx.expression()) if isinstance(name_node, DotIdNode): table, name = name_node.left, name_node.right else: name = name_node.get_text() return SelectedItemNode(table=table, name=name, alias=alias) def translate_dot_id(self, ctx: PlSqlParser.General_element_partContext): """ """ return DotIdNode( left=ctx.id_expression()[0].getText(), right=ctx.id_expression()[1].getText() ) def translate_table_ref_aux(self, ctx: PlSqlParser.Table_ref_auxContext): """ """ return TableRefNode( name=ctx.table_ref_aux_internal().getText(), alias=ctx.table_alias().getText() if ctx.table_alias() else None ) def translate_relational_expression(self, ctx: PlSqlParser.Relational_expressionContext): """ """ return RelationalExpressionNode( left=self.visit(ctx.relational_expression()[0]), op=ctx.relational_operator().getText(), right=self.visit(ctx.relational_expression()[1]) ) def translate_prior_expression(self, ctx: PlSqlParser.Unary_expressionContext): return PriorExpressionNode(self.visit(ctx.unary_expression()))
import sys import fileinput import os import statistics """ Steps: 1. Input a directory into the command line 2. Read the first file in the directory 3. Output some stuff from that file 4. Store that stuff 5. Move on to the next file 6. Once the program has seen all the files, print out the stuff """ folder = sys.argv[1] directory = os.listdir(folder) #later make a thing where it'll do all the subdirectories (one for each genome) #in a parent directory (ex: Promoters) genes = [] hist = {} for file in directory: #need to get the program to open the file; right now it's just looking at the file name f = open(f'{folder}/{file}', 'r') genecount = 0 for line in f: if line.startswith(">"): genecount += 1 genes.append(genecount) if genecount not in hist: hist[genecount] = 1 else: hist[genecount] += 1 print(statistics.mean(genes)) for i in range(1+max(hist.keys())): if i in hist: print(i, '#' * hist[i]) else: print(i) """ data = [] for line in file: if line[0] == '#': continue # skip over comments if line.startswith('#'): continue # same as above line = line.rstrip() # remove newline (return character), often useful data.append(str(line)) # store the data print(data) genecount = 0 for i in data: if ">" in i: genecount += 1 print('GC:', genecount) data = [] for line in fileinput.input(): #if line[0] == '#': continue # skip over comments if line.startswith('#'): continue # same as above line = line.rstrip() # remove newline (return character), often useful data.append(str(line)) # store the data genecount = 0 for i in data: if ">" in i: genecount += 1 print('GC:', genecount) """
import scanpy as sc import pandas as pd import numpy as np import scipy import os from anndata import AnnData,read_csv,read_text,read_mtx from scipy.sparse import issparse def prefilter_cells(adata,min_counts=None,max_counts=None,min_genes=200,max_genes=None): if min_genes is None and min_counts is None and max_genes is None and max_counts is None: raise ValueError('Provide one of min_counts, min_genes, max_counts or max_genes.') id_tmp=np.asarray([True]*adata.shape[0],dtype=bool) id_tmp=np.logical_and(id_tmp,sc.pp.filter_cells(adata.X,min_genes=min_genes)[0]) if min_genes is not None else id_tmp id_tmp=np.logical_and(id_tmp,sc.pp.filter_cells(adata.X,max_genes=max_genes)[0]) if max_genes is not None else id_tmp id_tmp=np.logical_and(id_tmp,sc.pp.filter_cells(adata.X,min_counts=min_counts)[0]) if min_counts is not None else id_tmp id_tmp=np.logical_and(id_tmp,sc.pp.filter_cells(adata.X,max_counts=max_counts)[0]) if max_counts is not None else id_tmp adata._inplace_subset_obs(id_tmp) adata.raw=sc.pp.log1p(adata,copy=True) #check the rowname print("the var_names of adata.raw: adata.raw.var_names.is_unique=:",adata.raw.var_names.is_unique) def prefilter_genes(adata,min_counts=None,max_counts=None,min_cells=10,max_cells=None): if min_cells is None and min_counts is None and max_cells is None and max_counts is None: raise ValueError('Provide one of min_counts, min_genes, max_counts or max_genes.') id_tmp=np.asarray([True]*adata.shape[1],dtype=bool) id_tmp=np.logical_and(id_tmp,sc.pp.filter_genes(adata.X,min_cells=min_cells)[0]) if min_cells is not None else id_tmp id_tmp=np.logical_and(id_tmp,sc.pp.filter_genes(adata.X,max_cells=max_cells)[0]) if max_cells is not None else id_tmp id_tmp=np.logical_and(id_tmp,sc.pp.filter_genes(adata.X,min_counts=min_counts)[0]) if min_counts is not None else id_tmp id_tmp=np.logical_and(id_tmp,sc.pp.filter_genes(adata.X,max_counts=max_counts)[0]) if max_counts is not None else id_tmp adata._inplace_subset_var(id_tmp) def prefilter_specialgenes(adata,Gene1Pattern="ERCC",Gene2Pattern="MT-"): id_tmp1=np.asarray([not str(name).startswith(Gene1Pattern) for name in adata.var_names],dtype=bool) id_tmp2=np.asarray([not str(name).startswith(Gene2Pattern) for name in adata.var_names],dtype=bool) id_tmp=np.logical_and(id_tmp1,id_tmp2) adata._inplace_subset_var(id_tmp) def test_l(adj, list_l): for l in list_l: adj_exp=np.exp(-1*adj/(2*(l**2))) print("l is ",str(l),"Percentage of total expression contributed by neighborhoods:",np.mean(np.sum(adj_exp,1))-1) def find_l(p, adj, start=0.5, end=2,sep=0.01, tol=0.01): for i in np.arange(start, end, sep): adj_exp=np.exp(-1*adj/(2*(i**2))) q=np.mean(np.sum(adj_exp,1))-1 print("L=", str(i), "P=", str(round(q,5))) if np.abs(p-q)<tol: return i print("l not found, try bigger range or smaller sep!") def find_neighbor_clusters(target_cluster,cell_id, x, y, pred,radius, ratio=1/2): cluster_num = dict() for i in pred: cluster_num[i] = cluster_num.get(i, 0) + 1 df = {'cell_id': cell_id, 'x': x, "y":y, "pred":pred} df = pd.DataFrame(data=df) df.index=df['cell_id'] target_df=df[df["pred"]==target_cluster] nbr_num={} row_index=0 num_nbr=[] for index, row in target_df.iterrows(): x=row["x"] y=row["y"] tmp_nbr=df[((df["x"]-x)**2+(df["y"]-y)**2)<=(radius**2)] #tmp_nbr=df[(df["x"]<x+radius) & (df["x"]>x-radius) & (df["y"]<y+radius) & (df["y"]>y-radius)] num_nbr.append(tmp_nbr.shape[0]) for p in tmp_nbr["pred"]: nbr_num[p]=nbr_num.get(p,0)+1 del nbr_num[target_cluster] nbr_num=[(k, v) for k, v in nbr_num.items() if v>(ratio*cluster_num[k])] nbr_num.sort(key=lambda x: -x[1]) print("radius=", radius, "average number of neighbors for each spot is", np.mean(num_nbr)) print(" Cluster",target_cluster, "has neighbors:") for t in nbr_num: print("Dmain ", t[0], ": ",t[1]) ret=[t[0] for t in nbr_num] if len(ret)==0: print("No neighbor domain found, try bigger radius or smaller ratio") else: return ret def rank_genes_groups(input_adata, target_cluster,nbr_list, label_col, adj_nbr=True, log=False): if adj_nbr: nbr_list=nbr_list+[target_cluster] adata=input_adata[input_adata.obs[label_col].isin(nbr_list)] else: adata=input_adata.copy() adata.var_names_make_unique() adata.obs["target"]=((adata.obs[label_col]==target_cluster)*1).astype('category') sc.tl.rank_genes_groups(adata, groupby="target",reference="rest", n_genes=adata.shape[1],method='wilcoxon') pvals_adj=[i[0] for i in adata.uns['rank_genes_groups']["pvals_adj"]] genes=[i[1] for i in adata.uns['rank_genes_groups']["names"]] if issparse(adata.X): obs_tidy=pd.DataFrame(adata.X.A) else: obs_tidy=pd.DataFrame(adata.X) obs_tidy.index=adata.obs["target"].tolist() obs_tidy.columns=adata.var.index.tolist() obs_tidy=obs_tidy.loc[:,genes] # 1. compute mean value mean_obs = obs_tidy.groupby(level=0).mean() # 2. compute fraction of cells having value >0 obs_bool = obs_tidy.astype(bool) fraction_obs = obs_bool.groupby(level=0).sum() / obs_bool.groupby(level=0).count() # compute fold change. if log: #The adata already logged fold_change=np.exp((mean_obs.loc[1] - mean_obs.loc[0]).values) else: fold_change = (mean_obs.loc[1] / (mean_obs.loc[0]+ 1e-9)).values df = {'genes': genes, 'in_group_fraction': fraction_obs.loc[1].tolist(), "out_group_fraction":fraction_obs.loc[0].tolist(),"in_out_group_ratio":(fraction_obs.loc[1]/fraction_obs.loc[0]).tolist(),"in_group_mean_exp": mean_obs.loc[1].tolist(), "out_group_mean_exp": mean_obs.loc[0].tolist(),"fold_change":fold_change.tolist(), "pvals_adj":pvals_adj} df = pd.DataFrame(data=df) return df def relative_func(expres): #expres: an array counts expression for a gene maxd = np.max(expres) - np.min(expres) min_exp=np.min(expres) rexpr = (expres - min_exp)/maxd return rexpr def plot_relative_exp(input_adata, gene, x_name, y_name,color,use_raw=False, spot_size=200000): adata=input_adata.copy() if use_raw: X=adata.X else: X=adata.raw.X if issparse(X): X=pd.DataFrame(X.A) else: X=pd.DataFrame(X) X.index=adata.obs.index X.columns=adata.var.index rexpr=relative_func(X.loc[:,gene]) adata.obs["rexpr"]=rexpr fig=sc.pl.scatter(adata,x=x_name,y=y_name,color="rexpr",title=gene+"_rexpr",color_map=color,show=False,size=spot_size/adata.shape[0]) return fig def plot_log_exp(input_adata, gene, x_name, y_name,color,use_raw=False): adata=input_adata.copy() if use_raw: X=adata.X else: X=adata.raw.X if issparse(X): X=pd.DataFrame(X.A) else: X=pd.DataFrame(X) X.index=adata.obs.index X.columns=adata.var.index adata.obs["log"]=np.log((X.loc[:,gene]+1).tolist()) fig=sc.pl.scatter(adata,x=x_name,y=y_name,color="log",title=gene+"_log",color_map=color,show=False,size=200000/adata.shape[0]) return fig def detect_subclusters(cell_id, x, y, pred, target_cluster, radius=3, res=0.2): df = {'cell_id': cell_id, 'x': x, "y":y, "pred":pred} df = pd.DataFrame(data=df) df.index=df['cell_id'] target_df=df[df["pred"]==target_cluster] nbr=np.zeros([target_df.shape[0],len(set(df["pred"]))],dtype=int) num_nbr=[] row_index=0 for index, row in target_df.iterrows(): x=row["x"] y=row["y"] tmp_nbr=df[(df["x"]<x+radius) & (df["x"]>x-radius) & (df["y"]<y+radius) & (df["y"]>y-radius)] num_nbr.append(tmp_nbr.shape[0]) for p in tmp_nbr["pred"]: nbr[row_index,int(p)]+=1 row_index+=1 #Minus out the cell itself nbr[:,target_cluster]=nbr[:,target_cluster]-1 nbr=sc.AnnData(nbr) sc.pp.neighbors(nbr, n_neighbors=10) sc.tl.louvain(nbr,resolution=res) sub_cluster=nbr.obs['louvain'].astype(int).to_numpy() target_df["sub_cluster"]=sub_cluster target_df["sub_cluster"]=target_df["sub_cluster"].astype('category') tmp=[] for j in df.index: if j in target_df.index: tmp.append(target_df.loc[j,"sub_cluster"]) else: tmp.append("-1") #ret = {'cell_id': cell_id, 'sub_cluster_'+str(target_cluster): tmp} #ret = pd.DataFrame(data=ret) #ret.index=ret['cell_id'] ret=tmp return ret def find_meta_gene(input_adata, pred, target_domain, start_gene, mean_diff=0, early_stop=True, max_iter=5, use_raw=False): meta_name=start_gene adata=input_adata.copy() adata.obs["meta"]=adata.X[:,adata.var.index==start_gene] adata.obs["pred"]=pred num_non_target=adata.shape[0] for i in range(max_iter): #Select cells tmp=adata[((adata.obs["meta"]>np.mean(adata.obs[adata.obs["pred"]==target_domain]["meta"]))|(adata.obs["pred"]==target_domain))] tmp.obs["target"]=((tmp.obs["pred"]==target_domain)*1).astype('category').copy() #DE sc.tl.rank_genes_groups(tmp, groupby="target",reference="rest", n_genes=1,method='wilcoxon') adj_g=tmp.uns['rank_genes_groups']["names"][0][0] add_g=tmp.uns['rank_genes_groups']["names"][0][1] meta_name_cur=meta_name+"+"+add_g+"-"+adj_g print("Add gene: ", add_g) print("Minus gene: ", adj_g) #Meta gene adata.obs[add_g]=adata.X[:,adata.var.index==add_g] adata.obs[adj_g]=adata.X[:,adata.var.index==adj_g] adata.obs["meta_cur"]=(adata.obs["meta"]+adata.obs[add_g]-adata.obs[adj_g]) adata.obs["meta_cur"]=adata.obs["meta_cur"]-np.min(adata.obs["meta_cur"]) mean_diff_cur=np.mean(adata.obs["meta_cur"][adata.obs["pred"]==target_domain])-np.mean(adata.obs["meta_cur"][adata.obs["pred"]!=target_domain]) num_non_target_cur=np.sum(tmp.obs["target"]==0) if (early_stop==False) | ((num_non_target>=num_non_target_cur) & (mean_diff<=mean_diff_cur)): num_non_target=num_non_target_cur mean_diff=mean_diff_cur print("Absolute mean change:", mean_diff) print("Number of non-target spots reduced to:",num_non_target) else: print("Stopped!", "Previous Number of non-target spots",num_non_target, num_non_target_cur, mean_diff,mean_diff_cur) print("Previous Number of non-target spots",num_non_target, num_non_target_cur, mean_diff,mean_diff_cur) print("Previous Number of non-target spots",num_non_target) print("Current Number of non-target spots",num_non_target_cur) print("Absolute mean change", mean_diff) print("===========================================================================") print("Meta gene: ", meta_name) print("===========================================================================") return meta_name, adata.obs["meta"].tolist() meta_name=meta_name_cur adata.obs["meta"]=adata.obs["meta_cur"] print("===========================================================================") print("Meta gene is: ", meta_name) print("===========================================================================") return meta_name, adata.obs["meta"].tolist()
#File to load modules
from nipype import logging logger = logging.getLogger('workflow') import nipype.pipeline.engine as pe import nipype.interfaces.fsl as fsl import nipype.interfaces.utility as util from nipype.interfaces.afni import preprocess # workflow to edit the scan to the proscribed TRs def create_wf_edit_func(wf_name="edit_func"): """ Workflow Inputs:: inputspec.func : func file or a list of func/rest nifti file User input functional(T2*) Image inputspec.start_idx : string Starting volume/slice of the functional image (optional) inputspec.stop_idx : string Last volume/slice of the functional image (optional) Workflow Outputs:: outputspec.edited_func : string (nifti file) Path to Output image with the initial few slices dropped Order of commands: - Get the start and the end volume index of the functional run. If not defined by the user, return the first and last volume. get_idx(in_files, stop_idx, start_idx) - Dropping the initial TRs. For details see `3dcalc <http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dcalc.html>`_:: 3dcalc -a rest.nii.gz[4..299] -expr 'a' -prefix rest_3dc.nii.gz """ # allocate a workflow object preproc = pe.Workflow(name=wf_name) # configure the workflow's input spec inputNode = pe.Node(util.IdentityInterface(fields=['func', 'start_idx', 'stop_idx']), name='inputspec') # configure the workflow's output spec outputNode = pe.Node(util.IdentityInterface(fields=['edited_func']), name='outputspec') # allocate a node to check that the requested edits are # reasonable given the data func_get_idx = pe.Node(util.Function(input_names=['in_files', 'stop_idx', 'start_idx'], output_names=['stopidx', 'startidx'], function=get_idx), name='func_get_idx') # wire in the func_get_idx node preproc.connect(inputNode, 'func', func_get_idx, 'in_files') preproc.connect(inputNode, 'start_idx', func_get_idx, 'start_idx') preproc.connect(inputNode, 'stop_idx', func_get_idx, 'stop_idx') # allocate a node to edit the functional file try: from nipype.interfaces.afni import utils as afni_utils func_drop_trs = pe.Node(interface=afni_utils.Calc(), name='func_drop_trs') except ImportError: func_drop_trs = pe.Node(interface=preprocess.Calc(), name='func_drop_trs') func_drop_trs.inputs.expr = 'a' func_drop_trs.inputs.outputtype = 'NIFTI_GZ' # wire in the inputs preproc.connect(inputNode, 'func', func_drop_trs, 'in_file_a') preproc.connect(func_get_idx, 'startidx', func_drop_trs, 'start_idx') preproc.connect(func_get_idx, 'stopidx', func_drop_trs, 'stop_idx') # wire the output preproc.connect(func_drop_trs, 'out_file', outputNode, 'edited_func') return preproc # functional preprocessing def create_func_preproc(use_bet=False, wf_name='func_preproc'): """ The main purpose of this workflow is to process functional data. Raw rest file is deobliqued and reoriented into RPI. Then take the mean intensity values over all time points for each voxel and use this image to calculate motion parameters. The image is then skullstripped, normalized and a processed mask is obtained to use it further in Image analysis. Parameters ---------- wf_name : string Workflow name Returns ------- func_preproc : workflow object Functional Preprocessing workflow object Notes ----- `Source <https://github.com/FCP-INDI/C-PAC/blob/master/CPAC/func_preproc/func_preproc.py>`_ Workflow Inputs:: inputspec.rest : func/rest file or a list of func/rest nifti file User input functional(T2) Image, in any of the 8 orientations scan_params.tr : string Subject TR scan_params.acquistion : string Acquisition pattern (interleaved/sequential, ascending/descending) scan_params.ref_slice : integer Reference slice for slice timing correction Workflow Outputs:: outputspec.refit : string (nifti file) Path to deobliqued anatomical data outputspec.reorient : string (nifti file) Path to RPI oriented anatomical data outputspec.motion_correct_ref : string (nifti file) Path to Mean intensity Motion corrected image (base reference image for the second motion correction run) outputspec.motion_correct : string (nifti file) Path to motion corrected output file outputspec.max_displacement : string (Mat file) Path to maximum displacement (in mm) for brain voxels in each volume outputspec.movement_parameters : string (Mat file) Path to 1D file containing six movement/motion parameters(3 Translation, 3 Rotations) in different columns (roll pitch yaw dS dL dP) outputspec.skullstrip : string (nifti file) Path to skull stripped Motion Corrected Image outputspec.mask : string (nifti file) Path to brain-only mask outputspec.example_func : string (nifti file) Mean, Skull Stripped, Motion Corrected output T2 Image path (Image with mean intensity values across voxels) outputpsec.preprocessed : string (nifti file) output skull stripped, motion corrected T2 image with normalized intensity values outputspec.preprocessed_mask : string (nifti file) Mask obtained from normalized preprocessed image Order of commands: - Deobliqing the scans. For details see `3drefit <http://afni.nimh.nih.gov/pub/dist/doc/program_help/3drefit.html>`_:: 3drefit -deoblique rest_3dc.nii.gz - Re-orienting the Image into Right-to-Left Posterior-to-Anterior Inferior-to-Superior (RPI) orientation. For details see `3dresample <http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dresample.html>`_:: 3dresample -orient RPI -prefix rest_3dc_RPI.nii.gz -inset rest_3dc.nii.gz - Calculate voxel wise statistics. Get the RPI Image with mean intensity values over all timepoints for each voxel. For details see `3dTstat <http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dTstat.html>`_:: 3dTstat -mean -prefix rest_3dc_RPI_3dT.nii.gz rest_3dc_RPI.nii.gz - Motion Correction. For details see `3dvolreg <http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dvolreg.html>`_:: 3dvolreg -Fourier -twopass -base rest_3dc_RPI_3dT.nii.gz/ -zpad 4 -maxdisp1D rest_3dc_RPI_3dvmd1D.1D -1Dfile rest_3dc_RPI_3dv1D.1D -prefix rest_3dc_RPI_3dv.nii.gz rest_3dc_RPI.nii.gz The base image or the reference image is the mean intensity RPI image obtained in the above the step.For each volume in RPI-oriented T2 image, the command, aligns the image with the base mean image and calculates the motion, displacement and movement parameters. It also outputs the aligned 4D volume and movement and displacement parameters for each volume. - Calculate voxel wise statistics. Get the motion corrected output Image from the above step, with mean intensity values over all timepoints for each voxel. For details see `3dTstat <http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dTstat.html>`_:: 3dTstat -mean -prefix rest_3dc_RPI_3dv_3dT.nii.gz rest_3dc_RPI_3dv.nii.gz - Motion Correction and get motion, movement and displacement parameters. For details see `3dvolreg <http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dvolreg.html>`_:: 3dvolreg -Fourier -twopass -base rest_3dc_RPI_3dv_3dT.nii.gz -zpad 4 -maxdisp1D rest_3dc_RPI_3dvmd1D.1D -1Dfile rest_3dc_RPI_3dv1D.1D -prefix rest_3dc_RPI_3dv.nii.gz rest_3dc_RPI.nii.gz The base image or the reference image is the mean intensity motion corrected image obtained from the above the step (first 3dvolreg run). For each volume in RPI-oriented T2 image, the command, aligns the image with the base mean image and calculates the motion, displacement and movement parameters. It also outputs the aligned 4D volume and movement and displacement parameters for each volume. - Create a brain-only mask. For details see `3dautomask <http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dAutomask.html>`_:: 3dAutomask -prefix rest_3dc_RPI_3dv_automask.nii.gz rest_3dc_RPI_3dv.nii.gz - Edge Detect(remove skull) and get the brain only. For details see `3dcalc <http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dcalc.html>`_:: 3dcalc -a rest_3dc_RPI_3dv.nii.gz -b rest_3dc_RPI_3dv_automask.nii.gz -expr 'a*b' -prefix rest_3dc_RPI_3dv_3dc.nii.gz - Normalizing the image intensity values. For details see `fslmaths <http://www.fmrib.ox.ac.uk/fsl/avwutils/index.html>`_:: fslmaths rest_3dc_RPI_3dv_3dc.nii.gz -ing 10000 rest_3dc_RPI_3dv_3dc_maths.nii.gz -odt float Normalized intensity = (TrueValue*10000)/global4Dmean - Calculate mean of skull stripped image. For details see `3dTstat <http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dTstat.html>`_:: 3dTstat -mean -prefix rest_3dc_RPI_3dv_3dc_3dT.nii.gz rest_3dc_RPI_3dv_3dc.nii.gz - Create Mask (Generate mask from Normalized data). For details see `fslmaths <http://www.fmrib.ox.ac.uk/fsl/avwutils/index.html>`_:: fslmaths rest_3dc_RPI_3dv_3dc_maths.nii.gz -Tmin -bin rest_3dc_RPI_3dv_3dc_maths_maths.nii.gz -odt char High Level Workflow Graph: .. image:: ../images/func_preproc.dot.png :width: 1000 Detailed Workflow Graph: .. image:: ../images/func_preproc_detailed.dot.png :width: 1000 Examples -------- >>> import func_preproc >>> preproc = create_func_preproc(bet=True) >>> preproc.inputs.inputspec.func='sub1/func/rest.nii.gz' >>> preproc.run() #doctest: +SKIP >>> import func_preproc >>> preproc = create_func_preproc(bet=False) >>> preproc.inputs.inputspec.func='sub1/func/rest.nii.gz' >>> preproc.run() #doctest: +SKIP """ preproc = pe.Workflow(name=wf_name) inputNode = pe.Node(util.IdentityInterface(fields=['func']), name='inputspec') outputNode = pe.Node(util.IdentityInterface(fields=['refit', 'reorient', 'reorient_mean', 'motion_correct', 'motion_correct_ref', 'movement_parameters', 'max_displacement', # 'xform_matrix', 'mask', 'skullstrip', 'example_func', 'preprocessed', 'preprocessed_mask', 'slice_time_corrected', 'oned_matrix_save']), name='outputspec') try: from nipype.interfaces.afni import utils as afni_utils func_deoblique = pe.Node(interface=afni_utils.Refit(), name='func_deoblique') except ImportError: func_deoblique = pe.Node(interface=preprocess.Refit(), name='func_deoblique') func_deoblique.inputs.deoblique = True preproc.connect(inputNode, 'func', func_deoblique, 'in_file') try: func_reorient = pe.Node(interface=afni_utils.Resample(), name='func_reorient') except UnboundLocalError: func_reorient = pe.Node(interface=preprocess.Resample(), name='func_reorient') func_reorient.inputs.orientation = 'RPI' func_reorient.inputs.outputtype = 'NIFTI_GZ' preproc.connect(func_deoblique, 'out_file', func_reorient, 'in_file') preproc.connect(func_reorient, 'out_file', outputNode, 'reorient') try: func_get_mean_RPI = pe.Node(interface=afni_utils.TStat(), name='func_get_mean_RPI') except UnboundLocalError: func_get_mean_RPI = pe.Node(interface=preprocess.TStat(), name='func_get_mean_RPI') func_get_mean_RPI.inputs.options = '-mean' func_get_mean_RPI.inputs.outputtype = 'NIFTI_GZ' preproc.connect(func_reorient, 'out_file', func_get_mean_RPI, 'in_file') # calculate motion parameters func_motion_correct = pe.Node(interface=preprocess.Volreg(), name='func_motion_correct') func_motion_correct.inputs.args = '-Fourier -twopass' func_motion_correct.inputs.zpad = 4 func_motion_correct.inputs.outputtype = 'NIFTI_GZ' preproc.connect(func_reorient, 'out_file', func_motion_correct, 'in_file') preproc.connect(func_get_mean_RPI, 'out_file', func_motion_correct, 'basefile') func_get_mean_motion = func_get_mean_RPI.clone('func_get_mean_motion') preproc.connect(func_motion_correct, 'out_file', func_get_mean_motion, 'in_file') preproc.connect(func_get_mean_motion, 'out_file', outputNode, 'motion_correct_ref') func_motion_correct_A = func_motion_correct.clone('func_motion_correct_A') func_motion_correct_A.inputs.md1d_file = 'max_displacement.1D' preproc.connect(func_reorient, 'out_file', func_motion_correct_A, 'in_file') preproc.connect(func_get_mean_motion, 'out_file', func_motion_correct_A, 'basefile') preproc.connect(func_motion_correct_A, 'out_file', outputNode, 'motion_correct') preproc.connect(func_motion_correct_A, 'md1d_file', outputNode, 'max_displacement') preproc.connect(func_motion_correct_A, 'oned_file', outputNode, 'movement_parameters') preproc.connect(func_motion_correct_A, 'oned_matrix_save', outputNode, 'oned_matrix_save') if not use_bet: func_get_brain_mask = pe.Node(interface=preprocess.Automask(), name='func_get_brain_mask') func_get_brain_mask.inputs.outputtype = 'NIFTI_GZ' preproc.connect(func_motion_correct_A, 'out_file', func_get_brain_mask, 'in_file') preproc.connect(func_get_brain_mask, 'out_file', outputNode, 'mask') else: func_get_brain_mask = pe.Node(interface=fsl.BET(), name='func_get_brain_mask_BET') func_get_brain_mask.inputs.mask = True func_get_brain_mask.inputs.functional = True erode_one_voxel = pe.Node(interface=fsl.ErodeImage(), name='erode_one_voxel') erode_one_voxel.inputs.kernel_shape = 'box' erode_one_voxel.inputs.kernel_size = 1.0 preproc.connect(func_motion_correct_A, 'out_file', func_get_brain_mask, 'in_file') preproc.connect(func_get_brain_mask, 'mask_file', erode_one_voxel, 'in_file') preproc.connect(erode_one_voxel, 'out_file', outputNode, 'mask') try: func_edge_detect = pe.Node(interface=afni_utils.Calc(), name='func_edge_detect') except UnboundLocalError: func_edge_detect = pe.Node(interface=preprocess.Calc(), name='func_edge_detect') func_edge_detect.inputs.expr = 'a*b' func_edge_detect.inputs.outputtype = 'NIFTI_GZ' preproc.connect(func_motion_correct_A, 'out_file', func_edge_detect, 'in_file_a') if not use_bet: preproc.connect(func_get_brain_mask, 'out_file', func_edge_detect, 'in_file_b') else: preproc.connect(erode_one_voxel, 'out_file', func_edge_detect, 'in_file_b') preproc.connect(func_edge_detect, 'out_file', outputNode, 'skullstrip') try: func_mean_skullstrip = pe.Node(interface=afni_utils.TStat(), name='func_mean_skullstrip') except UnboundLocalError: func_mean_skullstrip = pe.Node(interface=preprocess.TStat(), name='func_mean_skullstrip') func_mean_skullstrip.inputs.options = '-mean' func_mean_skullstrip.inputs.outputtype = 'NIFTI_GZ' preproc.connect(func_edge_detect, 'out_file', func_mean_skullstrip, 'in_file') preproc.connect(func_mean_skullstrip, 'out_file', outputNode, 'example_func') func_normalize = pe.Node(interface=fsl.ImageMaths(), name='func_normalize') func_normalize.inputs.op_string = '-ing 10000' func_normalize.inputs.out_data_type = 'float' preproc.connect(func_edge_detect, 'out_file', func_normalize, 'in_file') preproc.connect(func_normalize, 'out_file', outputNode, 'preprocessed') func_mask_normalize = pe.Node(interface=fsl.ImageMaths(), name='func_mask_normalize') func_mask_normalize.inputs.op_string = '-Tmin -bin' func_mask_normalize.inputs.out_data_type = 'char' preproc.connect(func_normalize, 'out_file', func_mask_normalize, 'in_file') preproc.connect(func_mask_normalize, 'out_file', outputNode, 'preprocessed_mask') return preproc def get_idx(in_files, stop_idx=None, start_idx=None): """ Method to get the first and the last slice for the functional run. It verifies the user specified first and last slice. If the values are not valid, it calculates and returns the very first and the last slice Parameters ---------- in_file : string (nifti file) Path to input functional run stop_idx : int Last volume to be considered, specified by user in the configuration file stop_idx : int First volume to be considered, specified by user in the configuration file Returns ------- stop_idx : int Value of first slice to consider for the functional run start_idx : int Value of last slice to consider for the functional run """ # stopidx = None # startidx = None # Import packages from nibabel import load # Init variables img = load(in_files) hdr = img.get_header() shape = hdr.get_data_shape() # Check to make sure the input file is 4-dimensional if len(shape) != 4: raise TypeError('Input nifti file: %s is not a 4D file' % in_files) # Grab the number of volumes nvols = int(hdr.get_data_shape()[3]) if (start_idx == None) or (start_idx < 0) or (start_idx > (nvols - 1)): startidx = 0 else: startidx = start_idx if (stop_idx == None) or (stop_idx > (nvols - 1)): stopidx = nvols - 1 else: stopidx = stop_idx return stopidx, startidx
#!/usr/bin/python # Philip Tenteromano # Antonio Segalini # 2/12/2019 # Big Data Programming # Lab 1 # Reducer file # PART 1 # comments added for detailed explaination from operator import itemgetter import sys # nested lists to track ip by time dict_hours = {} dict_ip_count = {} for line in sys.stdin: line = line.strip() # unpack our map values hour, ip, num = line.split('\t') try: num = int(num) # pull the nested list if there is one, if not - make empty try: dict_ip_count = dict_hours[hour] except KeyError: dict_ip_count = {} # increment the count of the IP dict_ip_count[ip] = dict_ip_count.get(ip, 0) + num # point the updated dict back to the proper hour dict_hours[hour] = dict_hours.get(hour, dict_ip_count) except ValueError: pass # new line for output-readability print '\n' # create a sorted list of Time values sorted_times = sorted(dict_hours) # use the list to output times in order for time in sorted_times: print 'Top 3 for time %s:' % (time) # sort the IP's at each time, a list of tuples (ip, count) is returned sorted_ip = sorted(dict_hours[time].items(), key=lambda kv: kv[1]) # only print the top 3 IP's for that time for ip in reversed(sorted_ip[-3:]): print '\t%s\t%s' % (ip[0], ip[1]) print '\n' print 'Complete!'
from mmap import mmap from DyldExtractor.structure import Structure from DyldExtractor.macho.macho_structs import ( segment_command_64, section_64 ) class SegmentContext(object): seg: segment_command_64 sects: dict[bytes, section_64] sectsI: list[section_64] def __init__(self, file: mmap, segment: segment_command_64) -> None: """Represents a segment. This holds information regarding a segment and its sections. Args: file: The data source used for the segment. segment: The segment structure. """ super().__init__() self.seg = segment self.sects = {} self.sectsI = [] sectsStart = segment._fileOff_ + len(segment) for i in range(segment.nsects): sectOff = sectsStart + (i * section_64.SIZE) sect = section_64(file, sectOff) self.sects[sect.sectname] = sect self.sectsI.append(sect)
# pylint: disable=missing-docstring, no-name-in-module, invalid-name from behave import then from nose.tools import assert_is_not_none, assert_in @then("an error saying \"{message}\" is raised") def an_error_is_raised(context, message): assert_is_not_none(context.error, "Expected an error saying {:s}".format(message)) assert_in(message.lower(), context.error.message.lower())
# Copyright 2021 The Brax Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """multi-agent ants environments.""" import functools import itertools from typing import Any, Dict, Sequence from brax.experimental.composer import component_editor from brax.experimental.composer.composer_utils import merge_desc import numpy as np def get_n_agents_desc(agents: Sequence[str], agents_params: Sequence[str] = None, init_r: float = 2): """Get n agents.""" angles = np.linspace(0, 2 * np.pi, len(agents) + 1) agents_params = agents_params or ([None] * len(agents)) components = {} edges = {} for i, (angle, agent, agent_params) in enumerate(zip(angles[:-1], agents, agents_params)): pos = (np.cos(angle) * init_r, np.sin(angle) * init_r, 0) components[f'agent{i}'] = dict(component=agent, pos=pos) if agent_params: components[f'agent{i}'].update(dict(component_params=agent_params)) for k1, k2 in itertools.combinations(list(components), 2): if k1 == k2: continue k1, k2 = sorted([k1, k2]) # ensure the name is always sorted in order edge_name = component_editor.concat_comps(k1, k2) edges[edge_name] = dict( extra_observers=[dict(observer_type='root_vec', indices=(0, 1))]) return dict(components=components, edges=edges) def add_follow(env_desc: Dict[str, Any], leader_vel: float = 3.0): """Add follow task.""" agent_groups = {} components = {} edges = {} agents = sorted(env_desc['components']) leader, followers = agents[0], agents[1:] # leader aims to run at a specific velocity components[leader] = dict( reward_fns=dict( goal=dict( reward_type='root_goal', sdcomp='vel', indices=(0, 1), offset=leader_vel + 2, target_goal=(leader_vel, 0)))) agent_groups[leader] = dict(reward_agents=(leader,)) # follower follows for agent in followers: edge_name = component_editor.concat_comps(agent, leader) edges[edge_name] = dict( reward_fns=dict( dist=dict( reward_type='root_dist', min_dist=1, max_dist=20, offset=21))) agent_groups[agent] = dict(reward_names=(('dist', agent, leader),)) merge_desc( env_desc, dict(agent_groups=agent_groups, components=components, edges=edges)) return env_desc def add_chase(env_desc: Dict[str, Any]): """Add chase task.""" agent_groups = {} edges = {} agents = sorted(env_desc['components']) prey, predators = agents[0], agents[1:] prey_rewards = () for agent in predators: # prey aims to run away from all predators # predators aim to chase the prey edge_name = component_editor.concat_comps(agent, prey) edges[edge_name] = dict( reward_fns=dict( chase=dict( reward_type='root_dist', min_dist=1, offset=11, max_dist=10), escape=dict(reward_type='root_dist', scale=-1), )) prey_rewards += (('escape', agent, prey),) agent_groups[agent] = dict(reward_names=(('chase', agent, prey),)) agent_groups[prey] = dict(reward_names=prey_rewards) merge_desc(env_desc, dict(agent_groups=agent_groups, edges=edges)) return env_desc def create_desc(main_agent: str = 'ant', other_agent: str = 'ant', main_agent_params: Dict[str, Any] = None, other_agent_params: Dict[str, Any] = None, num_agents: int = 2, task: str = 'follow', init_r: float = 2., **kwargs): """Creat env_desc.""" if main_agent_params or other_agent_params: agents_params = [main_agent_params] + [other_agent_params] * ( num_agents - 1) else: agents_params = None env_desc = get_n_agents_desc( agents=[main_agent] + [other_agent] * (num_agents - 1), agents_params=agents_params, init_r=init_r) return dict( follow=add_follow, chase=add_chase)[task]( env_desc=env_desc, **kwargs) ENV_DESCS = dict( follow=functools.partial(create_desc, task='follow'), chase=functools.partial(create_desc, task='chase'), )
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui_newMission.ui' # # Created by: PyQt5 UI code generator 5.14.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QDialog, QApplication, QPushButton, QVBoxLayout from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar import matplotlib.pyplot as plt import random class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1792, 1008) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout_6.setObjectName("verticalLayout_6") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.verticalLayout_8 = QtWidgets.QVBoxLayout() self.verticalLayout_8.setObjectName("verticalLayout_8") self.label = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) self.label.setSizePolicy(sizePolicy) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.verticalLayout_8.addWidget(self.label) self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(5) sizePolicy.setHeightForWidth(self.graphicsView.sizePolicy().hasHeightForWidth()) self.graphicsView.setSizePolicy(sizePolicy) self.graphicsView.setObjectName("graphicsView") self.verticalLayout_8.addWidget(self.graphicsView) self.horizontalLayout.addLayout(self.verticalLayout_8) self.verticalLayout_10 = QtWidgets.QVBoxLayout() self.verticalLayout_10.setObjectName("verticalLayout_10") self.label_5 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) self.label_5.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setBold(False) font.setWeight(50) self.label_5.setFont(font) self.label_5.setAlignment(QtCore.Qt.AlignCenter) self.label_5.setObjectName("label_5") self.verticalLayout_10.addWidget(self.label_5) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") self.label_7 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_7.sizePolicy().hasHeightForWidth()) self.label_7.setSizePolicy(sizePolicy) self.label_7.setObjectName("label_7") self.verticalLayout_3.addWidget(self.label_7) self.graphicsView_4 = QtWidgets.QGraphicsView(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.graphicsView_4.sizePolicy().hasHeightForWidth()) self.graphicsView_4.setSizePolicy(sizePolicy) self.graphicsView_4.setMinimumSize(QtCore.QSize(0, 0)) self.graphicsView_4.setObjectName("graphicsView_4") self.verticalLayout_3.addWidget(self.graphicsView_4) self.label_6 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_6.sizePolicy().hasHeightForWidth()) self.label_6.setSizePolicy(sizePolicy) self.label_6.setObjectName("label_6") self.verticalLayout_3.addWidget(self.label_6) self.graphicsView_6 = QtWidgets.QGraphicsView(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.graphicsView_6.sizePolicy().hasHeightForWidth()) self.graphicsView_6.setSizePolicy(sizePolicy) self.graphicsView_6.setObjectName("graphicsView_6") self.verticalLayout_3.addWidget(self.graphicsView_6) self.horizontalLayout_3.addLayout(self.verticalLayout_3) self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.label_4 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth()) self.label_4.setSizePolicy(sizePolicy) self.label_4.setObjectName("label_4") self.verticalLayout_2.addWidget(self.label_4) self.graphicsView_5 = QtWidgets.QGraphicsView(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.graphicsView_5.sizePolicy().hasHeightForWidth()) self.graphicsView_5.setSizePolicy(sizePolicy) self.graphicsView_5.setObjectName("graphicsView_5") self.verticalLayout_2.addWidget(self.graphicsView_5) self.label_3 = QtWidgets.QLabel(self.centralwidget) self.label_3.setObjectName("label_3") self.verticalLayout_2.addWidget(self.label_3) self.graphicsView_7 = QtWidgets.QGraphicsView(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.graphicsView_7.sizePolicy().hasHeightForWidth()) self.graphicsView_7.setSizePolicy(sizePolicy) self.graphicsView_7.setObjectName("graphicsView_7") self.verticalLayout_2.addWidget(self.graphicsView_7) self.horizontalLayout_3.addLayout(self.verticalLayout_2) self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.label_8 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_8.sizePolicy().hasHeightForWidth()) self.label_8.setSizePolicy(sizePolicy) self.label_8.setObjectName("label_8") self.verticalLayout.addWidget(self.label_8) self.graphicsView_8 = QtWidgets.QGraphicsView(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.graphicsView_8.sizePolicy().hasHeightForWidth()) self.graphicsView_8.setSizePolicy(sizePolicy) self.graphicsView_8.setObjectName("graphicsView_8") self.verticalLayout.addWidget(self.graphicsView_8) self.label_10 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_10.sizePolicy().hasHeightForWidth()) self.label_10.setSizePolicy(sizePolicy) self.label_10.setObjectName("label_10") self.verticalLayout.addWidget(self.label_10) self.graphicsView_9 = QtWidgets.QGraphicsView(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.graphicsView_9.sizePolicy().hasHeightForWidth()) self.graphicsView_9.setSizePolicy(sizePolicy) self.graphicsView_9.setObjectName("graphicsView_9") self.verticalLayout.addWidget(self.graphicsView_9) self.horizontalLayout_3.addLayout(self.verticalLayout) self.verticalLayout_10.addLayout(self.horizontalLayout_3) self.horizontalLayout.addLayout(self.verticalLayout_10) self.verticalLayout_6.addLayout(self.horizontalLayout) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.verticalLayout_9 = QtWidgets.QVBoxLayout() self.verticalLayout_9.setObjectName("verticalLayout_9") self.label_9 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_9.sizePolicy().hasHeightForWidth()) self.label_9.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setBold(False) font.setWeight(50) self.label_9.setFont(font) self.label_9.setAlignment(QtCore.Qt.AlignCenter) self.label_9.setObjectName("label_9") self.verticalLayout_9.addWidget(self.label_9) self.graphicsView_3 = QtWidgets.QGraphicsView(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(5) sizePolicy.setHeightForWidth(self.graphicsView_3.sizePolicy().hasHeightForWidth()) self.graphicsView_3.setSizePolicy(sizePolicy) self.graphicsView_3.setObjectName("graphicsView_3") self.verticalLayout_9.addWidget(self.graphicsView_3) self.horizontalLayout_2.addLayout(self.verticalLayout_9) self.verticalLayout_7 = QtWidgets.QVBoxLayout() self.verticalLayout_7.setObjectName("verticalLayout_7") self.label_2 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setObjectName("label_2") self.verticalLayout_7.addWidget(self.label_2) self.pushButton = QtWidgets.QPushButton(self.centralwidget) self.pushButton.setObjectName("pushButton") self.verticalLayout_7.addWidget(self.pushButton) self.scrollArea = QtWidgets.QScrollArea(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.scrollArea.sizePolicy().hasHeightForWidth()) self.scrollArea.setSizePolicy(sizePolicy) self.scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtWidgets.QWidget() self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 849, 1024)) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") #store graphs self.verticalLayout_graphs = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents) self.verticalLayout_graphs.setObjectName("verticalLayout_graphs") """ self.graphicsView_2 = QtWidgets.QGraphicsView(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(5) sizePolicy.setHeightForWidth(self.graphicsView_2.sizePolicy().hasHeightForWidth()) self.graphicsView_2.setSizePolicy(sizePolicy) self.graphicsView_2.setObjectName("graphicsView_2") self.verticalLayout_7.addWidget(self.graphicsView_2) """ #1 #draw graph self.figure = plt.figure(figsize=(1,2.5)) self.canvas = FigureCanvas(self.figure) self.canvas.setMinimumSize(self.canvas.size()) #fig = plt.gcf() #fig.set_size_inches(5, 5) # self.toolbar = NavigationToolbar(self.canvas, self) plt.suptitle("Temperature") #test temperature data = [random.random() for i in range(10)] self.figure.clear() plt.suptitle("Temperature (C)") y = (25.2,25.3,25.4,25.7,25.6,25.3,25.4,25.6,25.6,25.7) x = (5,10,15,20,25,30,35,40,45,50) ax = self.figure.add_subplot(111) ax.plot(x, y) self.canvas.draw() #self.button = QPushButton('Plot') #self.button.clicked.connect(self.plot) # layout = QVBoxLayout() # self.verticalLayout_7.addWidget(self.toolbar) #self.verticalLayout_7.addWidget(self.canvas) self.verticalLayout_graphs.addWidget(self.canvas) #2 # draw graph self.figure = plt.figure(figsize=(1,2.5)) self.canvas = FigureCanvas(self.figure) self.canvas.setMinimumSize(self.canvas.size()) # fig = plt.gcf() # fig.set_size_inches(5, 5) # self.toolbar = NavigationToolbar(self.canvas, self) plt.suptitle("Temperature") # test temperature data = [random.random() for i in range(10)] self.figure.clear() plt.suptitle("Temperature (C)") y = (25.2, 25.3, 25.4, 25.7, 25.6, 25.3, 25.4, 25.6, 25.6, 25.7) x = (5, 10, 15, 20, 25, 30, 35, 40, 45, 50) ax = self.figure.add_subplot(111) ax.plot(x, y) self.canvas.draw() self.verticalLayout_graphs.addWidget(self.canvas) #self.verticalLayout_7.addWidget(self.button) #3 # draw graph self.figure = plt.figure(figsize=(1,2.5)) self.canvas = FigureCanvas(self.figure) self.canvas.setMinimumSize(self.canvas.size()) # fig = plt.gcf() # fig.set_size_inches(5, 5) # self.toolbar = NavigationToolbar(self.canvas, self) plt.suptitle("Temperature") # test temperature data = [random.random() for i in range(10)] self.figure.clear() plt.suptitle("Temperature (C)") y = (25.2, 25.3, 25.4, 25.7, 25.6, 25.3, 25.4, 25.6, 25.6, 25.7) x = (5, 10, 15, 20, 25, 30, 35, 40, 45, 50) ax = self.figure.add_subplot(111) ax.plot(x, y) self.canvas.draw() self.verticalLayout_graphs.addWidget(self.canvas) #self.verticalLayout_7.addWidget(self.button) #4 # draw graph self.figure = plt.figure(figsize=(1,2.5)) self.canvas = FigureCanvas(self.figure) self.canvas.setMinimumSize(self.canvas.size()) # fig = plt.gcf() # fig.set_size_inches(5, 5) # self.toolbar = NavigationToolbar(self.canvas, self) plt.suptitle("Temperature") # test temperature data = [random.random() for i in range(10)] self.figure.clear() plt.suptitle("Temperature (C)") y = (25.2, 25.3, 25.4, 25.7, 25.6, 25.3, 25.4, 25.6, 25.6, 25.7) x = (5, 10, 15, 20, 25, 30, 35, 40, 45, 50) ax = self.figure.add_subplot(111) ax.plot(x, y) self.canvas.draw() self.verticalLayout_graphs.addWidget(self.canvas) #self.verticalLayout_7.addWidget(self.button) #5 # draw graph self.figure = plt.figure(figsize=(1,2.5)) self.canvas = FigureCanvas(self.figure) self.canvas.setMinimumSize(self.canvas.size()) # fig = plt.gcf() # fig.set_size_inches(5, 5) # self.toolbar = NavigationToolbar(self.canvas, self) plt.suptitle("Temperature") # test temperature data = [random.random() for i in range(10)] self.figure.clear() plt.suptitle("Temperature (C)") y = (25.2, 25.3, 25.4, 25.7, 25.6, 25.3, 25.4, 25.6, 25.6, 25.7) x = (5, 10, 15, 20, 25, 30, 35, 40, 45, 50) ax = self.figure.add_subplot(111) ax.plot(x, y) self.canvas.draw() self.verticalLayout_graphs.addWidget(self.canvas) #self.verticalLayout_7.addWidget(self.button) self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.verticalLayout_7.addWidget(self.scrollArea) self.horizontalLayout_2.addLayout(self.verticalLayout_7) self.verticalLayout_6.addLayout(self.horizontalLayout_2) MainWindow.setCentralWidget(self.centralwidget) #Menu self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1792, 22)) self.menubar.setObjectName("menubar") self.menuMission = QtWidgets.QMenu(self.menubar) self.menuMission.setObjectName("menuFile") self.menuConnection = QtWidgets.QMenu(self.menubar) self.menuConnection.setObjectName("menuConnection") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.actionNew_Mission = QtWidgets.QAction(MainWindow) self.actionNew_Mission.setObjectName("actionNew_Mission") self.actionView_Mission = QtWidgets.QAction(MainWindow) self.actionView_Mission.setObjectName("actionView_Mission") self.actionSave = QtWidgets.QAction(MainWindow) self.actionSave.setObjectName("actionSave") #quit self.actionClose = QtWidgets.QAction(MainWindow) self.actionClose.setObjectName("actionClose") self.actionClose.triggered.connect(QApplication.quit) #connect self.actionConnect = QtWidgets.QAction(MainWindow) self.actionConnect.setObjectName("actionConnect") self.actionConnect.triggered.connect(self.connect) #print(" GPS: %s" % self.drone.gps_0) self.actionDisconnect = QtWidgets.QAction(MainWindow) self.actionDisconnect.setObjectName("actionDisconnect") self.menuMission.addAction(self.actionNew_Mission) self.menuMission.addAction(self.actionSave) self.menuMission.addAction(self.actionClose) self.menuConnection.addAction(self.actionConnect) self.menuConnection.addAction(self.actionDisconnect) self.menubar.addAction(self.menuMission.menuAction()) self.menubar.addAction(self.menuConnection.menuAction()) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) self.menubar.setNativeMenuBar(False) # False for current window, True for parent window def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "Automated Data Collecting System")) self.label.setText(_translate("MainWindow", "Streaming")) self.label_5.setText(_translate("MainWindow", "UAV Details")) self.label_7.setText(_translate("MainWindow", "Airspeed")) self.label_6.setText(_translate("MainWindow", "Turn Coordinator")) self.label_4.setText(_translate("MainWindow", "Attitude")) self.label_3.setText(_translate("MainWindow", "Heading")) self.label_8.setText(_translate("MainWindow", "Altitude")) self.label_10.setText(_translate("MainWindow", "Vertical Speed")) self.label_9.setText(_translate("MainWindow", "Map")) self.label_2.setText(_translate("MainWindow", "Data Collection")) self.pushButton.setText(_translate("MainWindow", "Start")) self.menuMission.setTitle(_translate("MainWindow", "Mission")) self.menuConnection.setTitle(_translate("MainWindow", "Connection")) self.actionNew_Mission.setText(_translate("MainWindow", "New Mission")) self.actionView_Mission.setText(_translate("MainWindow", "View Mission")) self.actionSave.setText(_translate("MainWindow", "Output Result")) self.actionClose.setText(_translate("MainWindow", "Quit")) self.actionConnect.setText(_translate("MainWindow", "Connect")) self.actionDisconnect.setText(_translate("MainWindow", "Disconnect")) def plot(self): data = [random.random() for i in range(10)] self.figure.clear() plt.suptitle("Temperature (C)") ax = self.figure.add_subplot(111) ax.plot(data, '*-') self.canvas.draw() def connect(self): print("Start simulator (SITL)") import dronekit_sitl sitl = dronekit_sitl.start_default() connection_string = 'tcp:127.0.0.1:5760' from dronekit import connect, VehicleMode vehicle = connect(connection_string, wait_ready=True) # Get some vehicle attributes (state) print("Get some vehicle attribute values:") print(" GPS: %s" % vehicle.gps_0) print(" Battery: %s" % vehicle.battery) print(" Last Heartbeat: %s" % vehicle.last_heartbeat) print(" Is Armable?: %s" % vehicle.is_armable) print(" System status: %s" % vehicle.system_status.state) print(" Mode: %s" % vehicle.mode.name) # settable # Close vehicle object before exiting script vehicle.close() # Shut down simulator sitl.stop() print("Completed") import dronekit_sitl from dronekit import connect, VehicleMode class Drone: def __init__(self,conection_string): self.conection_string=conection_string sitl = dronekit_sitl.start_default() def connectDrone(self): drone = connect(self.connection_string, wait_ready=True) def getDrone(self): return self.drone def disconnectDrone(self): self.drone.close() self.sitl.stop()
"""Script for building an Annoy index of text embeddings.""" import argparse import itertools import logging import sys import time from multiprocessing import Process, Manager, cpu_count import coloredlogs import numpy as np from annoy import AnnoyIndex from gensim.models.keyedvectors import KeyedVectors from tqdm import * from preprocessing.clean_text import clean_text from preprocessing.file_tools import wc from tools.embeddings import EMBED_MODES from tools.embeddings import embed_text, get_word_vector_dic coloredlogs.install() logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) # Update this with your models models = { "news": "/home/nikola/data/raw/wiki/GoogleNews-vectors-negative300.bin", "wiki": "/home/nikola/data/raw/word2vec/wiki.en/wiki.en.vec", "wiki_unigrams": "/home/nikola/data/raw/wiki/wiki_unigrams.bin" } parser = argparse.ArgumentParser() parser.add_argument('-src_file', help='The text file to process and embed.', required=True) parser.add_argument('-model', default="wiki_unigrams", help='The embedding model that will be used. ' 'Available models: {}'.format(list(models.keys()))) parser.add_argument('-vec_size', default=600, type=int, help='Dimensionality of the embedding to produce.') parser.add_argument('-precision', default=32, type=int, help='Floating point precision of embeddings') parser.add_argument('-metric', default="angular", type=str, help='Annoy distance metric to use.') parser.add_argument('-emb', default="sent2vec", type=str, help='Embedding approach. Options: {}'.format(EMBED_MODES)) parser.add_argument('-n_trees', default=50, type=int, help='Number of trees for Annoy (read Annoy docs)') parser.add_argument('-n_threads', default=int(cpu_count() * 0.5), type=int, help='Number of threads to use.') parser.add_argument('-chunk_size', default=100000, type=int, help='Process this many lines at once.' 'You may have to adjust this depending on how much' 'RAM you have.') args = parser.parse_args() def text_to_embedding(in_queue, out_list): """Compute a single embedding""" while True: input_id, input_text = in_queue.get() if input_text is None: # exit signal return if args.emb == "sent2vec": clean_input = clean_text(input_text) input_emb = embed_text( clean_input, embedding_model, None, args.vec_size, mode=args.emb, clean=False ).astype(args.precision) input_emb = input_emb[0] elif args.emb == "bert": return embedding_model.encode([input_text]) else: clean_input = clean_text(input_text, lower=True) embeddings = get_word_vector_dic(clean_input, embedding_model) input_emb = embed_text( clean_input, embedding_model, embeddings, args.vec_size, mode=args.emb, clean=False).astype(args.precision) out_list.append((input_id, input_emb)) def parallel_embed(chunk, chunk_id): """Compute embeddings for a chunk using multithreading.""" # Set up simple multiprocessing manager = Manager() results = manager.list() work = manager.Queue(args.n_threads) pool = [] for i in range(args.n_threads): p = Process(target=text_to_embedding, args=(work, results)) p.start() pool.append(p) chunk_iter = itertools.chain( iter(chunk), enumerate((None,) * args.n_threads)) with tqdm(total=len(chunk), desc="Process chunk {}".format(chunk_id)) as pbar2: for d_id, doc in chunk_iter: work.put((d_id, doc)) if doc is not None: pbar2.update() for p in pool: p.join() assert len(results) == len(chunk) return results assert args.precision in [8, 16, 32, 64] args.precision = "float{}".format(args.precision) logging.warning("Checking input file {}...".format(args.src_file)) total_documents = wc(args.src_file) print_every = int(total_documents * 0.001) + 1 logging.warning("Starting to build Annoy index for {} documents...".format(total_documents)) logging.warning("Will use the {} distance metric..".format(args.metric)) model_path = models[args.model] if args.emb == 'avg': model_path = models[args.model] if model_path.endswith(".bin"): embedding_model = KeyedVectors.load_word2vec_format(model_path, binary=True) elif model_path.endswith(".vec"): embedding_model = KeyedVectors.load_word2vec_format(model_path, binary=False) else: embedding_model = KeyedVectors.load(model_path, mmap='r') if args.vec_size is None: args.vec_size = embedding_model.vector_size logging.warning("Loaded Word2Vec model {} with embedding dim {} and vocab size {}".format( args.model, embedding_model.vector_size, len(embedding_model.wv.vocab))) else: embedding_model = None if args.emb == "avg": logging.warning("Will use AVG embedding approach") elif args.emb == "sent2vec": import sent2vec embedding_model = sent2vec.Sent2vecModel() embedding_model.load_model(models["wiki_unigrams"]) logging.info("Loaded sent2vec model") elif args.emb == "bert": # Requires the bert client https://github.com/hanxiao/bert-as-service from bert_serving.client import BertClient embedding_model = BertClient(check_length=False) else: logging.critical("Wrong embedding choice.") sys.exit(0) if __name__ == '__main__': index = AnnoyIndex(args.vec_size, metric=args.metric) start_total = time.time() logging.warning("Starting to build index for {} using arguments: {}".format(args.src_file, vars(args))) with open(args.src_file) as src_file: file_iter = iter(src_file) chunk = [] chunk_count = 0 print() with tqdm(total=total_documents, desc="Total progress") as pbar: for document_id, document in enumerate(file_iter): # If we've reached the chunk limit, compute the embeddings, # otherwise store text in a list. if len(chunk) > args.chunk_size: # Process chunk if args.emb == "bert": embs = embedding_model.encode([p[1] for p in chunk]) assert len(embs) == len(chunk) results = zip([p[0] for p in chunk], embs) else: results = parallel_embed(chunk, chunk_count) for d_id, document_emb in results: index.add_item(d_id, document_emb) pbar.update() chunk = [] chunk_count += 1 else: chunk.append((document_id, document)) # Check if last chunk has been processed. if len(chunk) > 0: if args.emb == "bert": embs = embedding_model.encode([p[1] for p in chunk]) assert len(embs) == len(chunk) results = zip([p[0] for p in chunk], embs) else: results = parallel_embed(chunk, chunk_count) for d_id, document_emb in results: index.add_item(d_id, document_emb) pbar.update() end_total = time.time() - start_total logging.warning("Finished processing {} documents. Took {}s ({}s per doc on average)".format( total_documents, np.round(end_total, 2), np.round(end_total / float(total_documents), 4))) # Try to free up some memory... del embedding_model logging.warning("Starting to build Annoy index.") index.build(args.n_trees) fname = '{}.{}.ann'.format(args.src_file, args.emb) logging.warning("Saving Annoy index with {} items at {}.".format(index.get_n_items(), fname)) index.save(fname) logging.warning("Finished!")
from typing import List from timetrackerctl.model.ticket import Ticket from timetrackerctl.tasks.source import AbstractSource class SavedSource(AbstractSource): @property def name(self): return "saved" def list(self) -> List[Ticket]: lst = [] for t, msg in zip( self.jira.list_tickets(self.config.config['tasks'].keys()), self.config.config['tasks'].values() ): t.msg = msg t.source = self lst.append(t) return lst
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc import AvrService_pb2 as AvrService__pb2 from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 class ConnectionServiceStub(object): """ These are the supported message formats that may be exchanged with the AVR board """ def __init__(self, channel): """Constructor. Args: channel: A grpc.Channel. """ self.QueryPorts = channel.unary_unary( '/AvrDriver.ConnectionService/QueryPorts', request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, response_deserializer=AvrService__pb2.QueryPortsResponse.FromString, ) self.OpenPort = channel.unary_stream( '/AvrDriver.ConnectionService/OpenPort', request_serializer=AvrService__pb2.OpenClosePortRequest.SerializeToString, response_deserializer=AvrService__pb2.AvrMessage.FromString, ) self.ClosePort = channel.unary_unary( '/AvrDriver.ConnectionService/ClosePort', request_serializer=AvrService__pb2.OpenClosePortRequest.SerializeToString, response_deserializer=AvrService__pb2.AvrPortStatus.FromString, ) self.ReadRegister = channel.unary_unary( '/AvrDriver.ConnectionService/ReadRegister', request_serializer=AvrService__pb2.ReadRegRequest.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, ) self.WriteRegister = channel.unary_unary( '/AvrDriver.ConnectionService/WriteRegister', request_serializer=AvrService__pb2.WriteRegRequest.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, ) self.WriteData = channel.stream_unary( '/AvrDriver.ConnectionService/WriteData', request_serializer=AvrService__pb2.AvrData.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, ) self.WriteTestCommand = channel.unary_unary( '/AvrDriver.ConnectionService/WriteTestCommand', request_serializer=AvrService__pb2.AvrData.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, ) self.WriteButtonStatus = channel.unary_unary( '/AvrDriver.ConnectionService/WriteButtonStatus', request_serializer=AvrService__pb2.WriteButtonStatusRequest.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, ) class ConnectionServiceServicer(object): """ These are the supported message formats that may be exchanged with the AVR board """ def QueryPorts(self, request, context): """query the available ports of the system """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def OpenPort(self, request, context): """open the serial port """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def ClosePort(self, request, context): """close the serial port """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def ReadRegister(self, request, context): """read a hw register """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def WriteRegister(self, request, context): """write a hw register """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def WriteData(self, request_iterator, context): """write data to the device """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def WriteTestCommand(self, request, context): """write a test command to the device """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def WriteButtonStatus(self, request, context): """simulate a buttonpress or release """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def add_ConnectionServiceServicer_to_server(servicer, server): rpc_method_handlers = { 'QueryPorts': grpc.unary_unary_rpc_method_handler( servicer.QueryPorts, request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, response_serializer=AvrService__pb2.QueryPortsResponse.SerializeToString, ), 'OpenPort': grpc.unary_stream_rpc_method_handler( servicer.OpenPort, request_deserializer=AvrService__pb2.OpenClosePortRequest.FromString, response_serializer=AvrService__pb2.AvrMessage.SerializeToString, ), 'ClosePort': grpc.unary_unary_rpc_method_handler( servicer.ClosePort, request_deserializer=AvrService__pb2.OpenClosePortRequest.FromString, response_serializer=AvrService__pb2.AvrPortStatus.SerializeToString, ), 'ReadRegister': grpc.unary_unary_rpc_method_handler( servicer.ReadRegister, request_deserializer=AvrService__pb2.ReadRegRequest.FromString, response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, ), 'WriteRegister': grpc.unary_unary_rpc_method_handler( servicer.WriteRegister, request_deserializer=AvrService__pb2.WriteRegRequest.FromString, response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, ), 'WriteData': grpc.stream_unary_rpc_method_handler( servicer.WriteData, request_deserializer=AvrService__pb2.AvrData.FromString, response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, ), 'WriteTestCommand': grpc.unary_unary_rpc_method_handler( servicer.WriteTestCommand, request_deserializer=AvrService__pb2.AvrData.FromString, response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, ), 'WriteButtonStatus': grpc.unary_unary_rpc_method_handler( servicer.WriteButtonStatus, request_deserializer=AvrService__pb2.WriteButtonStatusRequest.FromString, response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'AvrDriver.ConnectionService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) # This class is part of an EXPERIMENTAL API. class ConnectionService(object): """ These are the supported message formats that may be exchanged with the AVR board """ @staticmethod def QueryPorts(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary(request, target, '/AvrDriver.ConnectionService/QueryPorts', google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, AvrService__pb2.QueryPortsResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod def OpenPort(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_stream(request, target, '/AvrDriver.ConnectionService/OpenPort', AvrService__pb2.OpenClosePortRequest.SerializeToString, AvrService__pb2.AvrMessage.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod def ClosePort(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary(request, target, '/AvrDriver.ConnectionService/ClosePort', AvrService__pb2.OpenClosePortRequest.SerializeToString, AvrService__pb2.AvrPortStatus.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod def ReadRegister(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary(request, target, '/AvrDriver.ConnectionService/ReadRegister', AvrService__pb2.ReadRegRequest.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod def WriteRegister(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary(request, target, '/AvrDriver.ConnectionService/WriteRegister', AvrService__pb2.WriteRegRequest.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod def WriteData(request_iterator, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.stream_unary(request_iterator, target, '/AvrDriver.ConnectionService/WriteData', AvrService__pb2.AvrData.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod def WriteTestCommand(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary(request, target, '/AvrDriver.ConnectionService/WriteTestCommand', AvrService__pb2.AvrData.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod def WriteButtonStatus(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary(request, target, '/AvrDriver.ConnectionService/WriteButtonStatus', AvrService__pb2.WriteButtonStatusRequest.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
# Generated by Django 3.0.11 on 2020-12-17 09:16 from django.db import migrations, models import ipapub.contenttyperestrictedfilefield import ipapub.models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='UpFile', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('path', models.CharField(max_length=200)), ('file', ipapub.contenttyperestrictedfilefield.ContentTypeRestrictedFileField(blank=True, null=True, upload_to=ipapub.models.PathAndRename2('upload'))), ('icons', ipapub.contenttyperestrictedfilefield.ContentTypeRestrictedFileField(upload_to=ipapub.models.PathAndRename('package'))), ('iconb', ipapub.contenttyperestrictedfilefield.ContentTypeRestrictedFileField(upload_to=ipapub.models.PathAndRename('package'))), ('plist', models.FileField(upload_to='package')), ('pub', models.FileField(upload_to='package')), ('signed', ipapub.contenttyperestrictedfilefield.ContentTypeRestrictedFileField(blank=True, null=True, upload_to=ipapub.models.PathAndRename('package'))), ('status', models.CharField(blank=True, max_length=10)), ('user', models.CharField(max_length=10)), ('label', models.CharField(blank=True, max_length=200)), ('up_date', models.DateTimeField(auto_now_add=True, verbose_name='upload date')), ('from_ip', models.GenericIPAddressField(blank=True, null=True)), ], ), ]
# -*- coding: utf-8 -*- import random import math import os import json import time import networkx as nx import scipy import numpy as np #import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from tqdm import tqdm import pathos #from pathos.multiprocessing import ProcessingPool EGO_NETWORK = 'ego' GRAPH_KEY_COMMON_NODES_LIST = 'list_' GRAPH_KEY_AVG_COMMON_NODES = 'avg' GRAPH_KEY_STD_COMMON_NODES = 'std' #TODO: check SUCCESSORS = 'suc' #TODO: check PREDECESSORS = 'pre' TIME = 0 def edge_type_identification(g, kmax, ext_dic, return_all_list=False): global silent if not(silent): epbar = tqdm(total=g.number_of_edges(), desc='identifying') for u,v in g.edges(): g[u][v]['type'] = None silks = [] bonds = [] Lbridges = [] Gbridges = [] int_threshold = {} ## phase 1: identify silk links #if not(silent): epbar_p1 = tqdm(total=g.number_of_edges(), desc='phase 1') edges = list(g.edges(data=True)) nextphase = [] degs = dict(g.degree) for e in edges: u,v,w = e if (degs[u] == 1) or (degs[v] == 1): g[u][v]['type'] = 'Silk' silks.append(e) if not(silent): epbar.update(1) else: nextphase.append(e) #if not(silent): epbar_p1.update(1) #print len(silks) if not(silent): print('check phase 1') ## phase 2: identify bond and local bridges for i in range(kmax): l = str(i+1) lindex = 'w'+l+'a' Boname = 'Bond'+l Bdname = 'Local_Bridge'+l T_outk = ext_dic[l] edges = nextphase nextphase = [] nextstep = [] Rnextstep = [] #if not(silent): epbar_p2 = tqdm(total=len(nextphase), desc='phase 2a layer'+l) for e in edges: u,v,w = e Re = w[lindex] if Re>=T_outk: g[u][v]['type'] = Boname bonds.append((Boname, e)) if not(silent): epbar.update(1) else: nextstep.append(e) Rnextstep.append(Re) #if not(silent): epbar_p2.update(1) if len(Rnextstep)==0: T_ink = 0 else: T_ink = scipy.mean(Rnextstep) - scipy.std(Rnextstep) if T_ink<0: T_ink = 0.0 for e in nextstep: u,v,w = e Re = w[lindex] if Re>T_ink: g[u][v]['type'] = Bdname Lbridges.append((Bdname, e)) if not(silent): epbar.update(1) else: nextphase.append(e) int_threshold[l] = T_ink ## for kmax loop end here if not(silent): print('check phase 2') ## phase 3: identify global bridge edges = nextphase #nextphase = [] #if not(silent): epbar_p3 = tqdm(total=len(nextphase), desc='phase 3') for e in edges: u,v,w = e g[u][v]['type'] = 'Global_Bridge' Gbridges.append(e) if not(silent): epbar.update(1) #if not(silent): epbar_p3.update(1) if not(silent): print('check phase 3') if not(silent): print('done identify edge types') if return_all_list: return g, bonds, Lbridges, Gbridges, silks, int_threshold else: return g, int_threshold """ def get_ego_graph(g, s, t, l): index = EGO_NETWORK + str(l - 1) node_list = set() for ng in nx.neighbors(g, s): if ng != t: node_list = node_list | g.nodes[ng][index] return node_list - set([s]) def processing_link_property(iter_item): g, c, sp, s, t = iter_item #debugmsg('analyze the edge (' + s + ', ' + t + ')...') ## from s to t base_st_nodes = set([s, t]) c.nodes[s][0] = set() ## for removing previously accessed neighbor nodes (0~(l-1) layer neighbors) c.nodes[t][0] = set() ## same as above, for the other end s0 = set() t0 = set() for i in range(sp): l = i + 1 #c.nodes[s][l] = get_outgoing_ego_graph(c, s, t, l) - c.nodes[s][0] - base_st_nodes #c.nodes[t][l] = get_incoming_ego_graph(c, t, s, l) - c.nodes[t][0] - base_st_nodes c.nodes[s][l] = get_ego_graph(c, s, t, l) - s0 - base_st_nodes c.nodes[t][l] = get_ego_graph(c, t, s, l) - t0 - base_st_nodes common_nodes = (c.nodes[s][l] & c.nodes[t][l]) | (c.nodes[s][l] & c.nodes[t][l-1]) | (c.nodes[s][l-1] & c.nodes[t][l]) index1 = 'w'+str(l)+'a' ## same as article, from inferior view #index2 = 'w'+str(l)+'b' ## from superior view g[s][t][index1] = None #g[s][t][index2] = None if len(common_nodes)==0: g[s][t][index1] = 0 #g[s][t][index2] = 0 else: part1_a = min(len(c.nodes[s][l] ), len(c.nodes[t][l]) ) part2_a = min(len(c.nodes[s][l] ), len(c.nodes[t][l-1])) part3_a = min(len(c.nodes[s][l-1]), len(c.nodes[t][l]) ) denominator_a = float(part1_a + part2_a + part3_a) #part1_b = max(len(c.nodes[s][l] ), len(c.nodes[t][l]) ) #part2_b = max(len(c.nodes[s][l] ), len(c.nodes[t][l-1])) #part3_b = max(len(c.nodes[s][l-1]), len(c.nodes[t][l]) ) #denominator_b = float(part1_b + part2_b + part3_b) g[s][t][index1] = float(len(common_nodes)) / denominator_a #g[s][t][index2] = float(len(common_nodes)) / denominator_b c.graph[GRAPH_KEY_COMMON_NODES_LIST + str(l)].append(g[s][t][index1]) #c.nodes[s][0] |= c.nodes[s][l] #c.nodes[t][0] |= c.nodes[t][l] s0 |= c.nodes[s][l] t0 |= c.nodes[t][l] #pair = { g[s][t][ind]:v for ind,v in g[s][t].items() } #gnote = { GRAPH_KEY_COMMON_NODES_LIST + str(l): c.graph[GRAPH_KEY_COMMON_NODES_LIST + str(l)] for l in range(1, sp+1) } #compute_link_prop_bar.update(1) # FIXME: review this; has to return something or multiprocessing will not work, it copied everythings # TODO: add showing current completed, replace pbar # REVIEW: not using multiprocessing here already return #pair, gnote def generate_ego_graph(g, sp): for r in range(sp): for n in g.nodes(data = False): if r == 0: g.nodes[n][EGO_NETWORK + str(r)] = set([n]) else: g.nodes[n][EGO_NETWORK + str(r)] = set(g.nodes[n][EGO_NETWORK + str(r - 1)]) for ng in nx.neighbors(g, n): g.nodes[n][EGO_NETWORK + str(r)] = g.nodes[n][EGO_NETWORK + str(r)] | g.nodes[ng][EGO_NETWORK + str(r - 1)] c.graph[GRAPH_KEY_COMMON_NODES_LIST + str(l)].append(g[s][t][index1]) #c.nodes[s][0] |= c.nodes[s][l] #c.nodes[t][0] |= c.nodes[t][l] s0 |= c.nodes[s][l] t0 |= c.nodes[t][l] #pair = { g[s][t][ind]:v for ind,v in g[s][t].items() } #gnote = { GRAPH_KEY_COMMON_NODES_LIST + str(l): c.graph[GRAPH_KEY_COMMON_NODES_LIST + str(l)] for l in range(1, sp+1) } #compute_link_prop_bar.update(1) # FIXME: review this; has to return something or multiprocessing will not work, it copied everythings # TODO: add showing current completed, replace pbar # REVIEW: not using multiprocessing here already return #pair, gnote """ def compute_link_property(g, sp): global silent, threads_no ## g = Graph ## sp = k_max layer #print 'computing link property R' """ 核心演算法:計算目標網絡的每一條連結的兩端節點在不同半徑下除了該連結之外的交集程度,以供稍後判斷 BOND/sink/local bridge/global bridge 時間複雜度:O(m x l) m = 目標網絡的連結數目,在連通圖情況下,m 通常大於節點數目 n,卻遠小於節點數目的平方(n x n) l = 目標網絡的最短路徑,通常 l 遠小於 log(n),可當作常數項 C 看待 參數:g 目標網絡,必須是連通圖,若不是,函數 compute_link_property 將擷取目標網絡 g 最大的 component 來運算分析    sp 整數,通常是目標網絡的平均最短路徑,表示分析的階層數, 0=self, 1=1st deg. neighbor, 2=2nd deg. neighbor """ #c = g.copy() common_nodes_list = {} for layer in range(1, sp+1): #g.graph[GRAPH_KEY_COMMON_NODES_LIST + str(i + 1)] = [] common_nodes_list[GRAPH_KEY_COMMON_NODES_LIST + str(layer)] = [] m0 = nx.to_numpy_matrix(g) diag = np.zeros(m0.shape, int) # the rest is zero np.fill_diagonal(diag, 1) # only diagonal is one Ms = {0: diag} # exactly k step, 0 steps can only reach oneself Ms_pre = {0: diag} # within k steps, 0 steps can only reach oneself for i in range(sp): # 0~~sp-1 mpre = Ms_pre[i] k = i + 1 # 1~~sp m1 = m0**(k) # m1: where non-zero means the number of alternative paths from u to v, zero means not reachable from u to v m1a = np.matrix(np.where(m1==0, -1, 1)) # zero to -1, >0 to 1 # m1a: one means reachable from u to v, including any steps # -1 means not reachable m1b = m1a - mpre # m1b: -1 means can only reach in any step <k but not step k # 0 means can be reach in both step k and any step <k # 1 means can only reach in exactly k steps <---this is our target m1c = np.matrix(np.where(m1b>0, 1., 0.)) # m1c: 1 means can only reach in exactly k steps <---this is our target # 0 means either (cannot reach in step k) or (can be reach in any step < k but not exactly step k) """ # wrong in m1b # m1b = m1a + mpre # m1b: 2 means can reach in both (step k) and (any step <k), # 1 means can only reach in exactly k steps ### >> wrong because also OR only any step < k # m1c = np.matrix(np.where(m1b==1, 1, 0)) # m1c: 1 means can only reach in exactly k steps # 0 means either cannot or can be reach in any step < k """ Ms[k] = m1c Ms_pre[k] = mpre + m1c ndic = {} i = 0 for n in g.nodes(): ndic[n] = i i+=1 for layer in range(1, sp+1): index1 = 'w'+str(layer)+'a' ## same as article, from inferior view #index2 = 'w'+str(l)+'b' ## from superior view k = layer - 1 ml = Ms[layer] mk = Ms[k] for u1,v1 in tqdm(g.edges(), desc='layer: '+str(layer)): u2, v2 = ndic[u1], ndic[v1] # convert name to index arr_u_l = np.delete(ml[u2][:], [u2,v2]) arr_u_k = np.delete(mk[u2][:], [u2,v2]) arr_v_l = np.delete(ml[v2][:], [u2,v2]) arr_v_k = np.delete(mk[v2][:], [u2,v2]) uf_l = np.count_nonzero(arr_u_l == 1) # 1 means friend of u uf_k = np.count_nonzero(arr_u_k == 1) # 1 means friend of u vf_l = np.count_nonzero(arr_v_l == 1) # 1 means friend of v vf_k = np.count_nonzero(arr_v_k == 1) # 1 means friend of v part1_a = min(uf_l, vf_l) part2_a = min(uf_l, vf_k) part3_a = min(uf_k, vf_l) denominator_a = float(part1_a + part2_a + part3_a) arr_sum_a = arr_u_l + arr_v_l # 1 means from 1 side, 2 means from both sides arr_sum_b = arr_u_l + arr_v_k # 1 means from 1 side, 2 means from both sides arr_sum_c = arr_u_k + arr_v_l # 1 means from 1 side, 2 means from both sides c_a = np.count_nonzero(arr_sum_a == 2) # 2 means can be reach from both u_l step, v_l step c_b = np.count_nonzero(arr_sum_b == 2) # 2 means can be reach from both u_l step, v_k step c_c = np.count_nonzero(arr_sum_c == 2) # 2 means can be reach from both u_k step, v_l step common_nodes = float(c_a + c_b + c_c) if common_nodes==0: g[u1][v1][index1] = 0 #g[u1][v1][index2] = 0 else: g[u1][v1][index1] = common_nodes / denominator_a #g.graph[GRAPH_KEY_COMMON_NODES_LIST + str(l)].append(g[u1][v1][index1]) common_nodes_list[GRAPH_KEY_COMMON_NODES_LIST + str(layer)].append(g[u1][v1][index1]) for layer in range(1, sp+1): l = str(layer) #g.graph[GRAPH_KEY_AVG_COMMON_NODES + l] = scipy.mean(g.graph[GRAPH_KEY_COMMON_NODES_LIST + l]) #g.graph[GRAPH_KEY_STD_COMMON_NODES + l] = scipy.std( g.graph[GRAPH_KEY_COMMON_NODES_LIST + l]) g.graph[GRAPH_KEY_AVG_COMMON_NODES + l] = scipy.mean(common_nodes_list[GRAPH_KEY_COMMON_NODES_LIST + l]) g.graph[GRAPH_KEY_STD_COMMON_NODES + l] = scipy.std(common_nodes_list[GRAPH_KEY_COMMON_NODES_LIST + l]) return g def random_once(g, kmax, Q=2): #rg = nx.DiGraph(nx.directed_configuration_model(list(d for n, d in g.in_degree()), list(d for n, d in g.out_degree()), create_using = nx.DiGraph())) rg = g.copy() if g.number_of_edges() > 2: nx.connected_double_edge_swap(rg, (Q * g.number_of_edges())) rg = compute_link_property(rg, kmax) #rgs.append(rg) meas = {str(i+1): rg.graph[GRAPH_KEY_AVG_COMMON_NODES + str(i+1)] for i in range(kmax)} stds = {str(i+1): rg.graph[GRAPH_KEY_STD_COMMON_NODES + str(i+1)] for i in range(kmax)} return meas, stds def randomizing(iter_item): c, g, kmax, random_pre = iter_item global output_random, random_dir#, random_pre #print(output_random) not_before = True if output_random: # check if this c is processed, if so skip random and load result output_path = os.path.join(random_dir, random_pre+str(c)+'.json') if os.path.isfile(output_path): not_before = False with open(output_path, 'r') as fread: tmp = json.load(fread) meas = tmp['mean'] stds = tmp['std'] else: meas, stds = random_once(g, kmax) else: meas, stds = random_once(g, kmax) if output_random and not_before: output_path = os.path.join(random_dir, random_pre+str(c)+'.json') tmp = {'mean': meas, 'std': stds} with open(output_path, 'w') as fp_hand: json.dump(tmp, fp_hand, indent=2, sort_keys=True) if c%10==0: global TIME tempTIME = time.time() print('completed randomizing',c, 'approx. used time: ', (tempTIME-TIME)/60., 'mins for about 10 iter.') TIME = tempTIME return meas, stds def get_external_threshold(g, kmax, times, random_pre): #global kmax global silent, threads_no, TIME#, output_random, random_dir, random_pre if g.number_of_edges()>2: #rgs = [] rgmeans = { str(k+1):[] for k in range(kmax) } rgstds = { str(k+1):[] for k in range(kmax) } #Q = 10 #int(math.log10(g.order()) * math.log10(g.size())) #print Q # 產生供比較對應用的 times 個隨機網絡 random_results = [] #global pbar_pool #pbar_pool = tqdm(total=times)#, desc='randomizing with no. thread: '+str(threads)) if not(silent): tt0 = time.time() TIME = time.time() if g.number_of_edges()>100: #print 'start randomizing with no. thread: '+str(threads) pool = pathos.multiprocessing.ProcessingPool(nodes=threads_no) iterlist = [(c, g, kmax, random_pre) for c in range(times)] random_results = pool.imap(randomizing, iterlist) random_results = list(random_results) else: for c in range(times): random_results.append((randomizing((c, g, kmax, random_pre)))) #pbar_pool.close() if not(silent): tt1 = time.time() print('randomizing used time: {} minutes'.format((tt1-tt0)/60.)) for i in range(kmax): rgmeans[str(i + 1)] = [ meas[str(i + 1)] for meas, stds in random_results ] rgstds[str(i + 1)] = [ stds[str(i + 1)] for meas, stds in random_results ] ext_threshold = {} for i in range(kmax): l = str(i+1) ext = scipy.mean(rgmeans[l]) + scipy.mean(rgstds[l]) if ext>1: ext_threshold[l] = 1.0 else: ext_threshold[l] = ext if not(silent): print('done randomized and calculate external threshold') return ext_threshold else: if not(silent): print('graph has less than 2 edges') return None def average_shortest_path_length(g): nlist = list(node for node in g.nodes()) total = 0 count = 0 for index in tqdm(range(1000), 'Calculating average shortest path length'): s, t = random.sample(nlist, k = 2) if nx.has_path(g, source = s, target = t): total += nx.shortest_path_length(g, source = s, target = t) count += 1 elif nx.has_path(g, source = t, target = s): total += nx.shortest_path_length(g, source = t, target = s) count += 1 if count<=0: aspl = 1 else: aspl = (total / float(count)) return aspl def bridge_or_bond(ginput, times=100, external=None, threads=4, kmax=None, run_silent=False, output_random_res=False, random_dir_path='temp', random_prefix='rand_'): global silent, threads_no, output_random, random_dir#, random_pre silent = run_silent threads_no = threads output_random = output_random_res random_dir = random_dir_path #random_pre = random_prefix # use only the largest weakly connected component # g = sorted(nx.connected_component_subgraphs(ginput, copy=False), key=len, reverse=True)[0] # deprecated largest_cc = max(nx.connected_components(ginput), key=len) g = ginput.subgraph(largest_cc).copy() #kmax = max(1, int(nx.average_shortest_path_length(g) / 2.0)) # 決定每個節點要外看幾層,決定強弱連結 if not(silent): print('no_nodes:', g.number_of_nodes(), ', no_edges:', g.number_of_edges()) if kmax is None: if not(silent): print('calculating kmax') avg_sp = average_shortest_path_length(g) kmax = max(1, int(math.floor(avg_sp / 2.0))) if not(silent): print('max layer is '+str(kmax)) if not(silent): print('computing link property R') g = compute_link_property(g, kmax) if not(silent): print('computing external threshold') if output_random: if not os.path.exists(random_dir): os.makedirs(random_dir) if external is None: random_pre = random_prefix ext_dic = get_external_threshold(g, kmax, times, random_pre) else: if not(silent): print('external threshold is provided, skipped randomization') ext_dic = external if not(silent): print('last step: identifying edge types') #g, bonds, Lbridges, Gbridges, silks, int_dic = edge_type_identification(g, kmax, ext_dic, return_all_list=True) if not(ext_dic is None): g, int_dic = edge_type_identification(g, kmax, ext_dic, return_all_list=False) else: int_dic = None #print len(bonds), len(Lbridges), len(Gbridges), len(silks) return g, ext_dic, int_dic """ drawing """ def community_sorting(g): etypes = { (u,v):d['type'] for u,v,d in g.edges(data=True) } etypes_rev = {'Silk': [], 'Global_Bridge': []} for e,t in etypes.items(): if t not in etypes_rev: etypes_rev[t] = [] etypes_rev[t].append(e) LBs = [ k for k in etypes_rev.keys() if k[:5]=='Local' ] Bs = [ k for k in etypes_rev.keys() if k[:4]=='Bond' ] kmax = 0 for lb in LBs: k = int(lb.replace('Local_Bridge','')) if k>kmax: kmax=k for b in Bs: k = int(b.replace('Bond','')) if k>kmax: kmax=k gcopy = g.copy() nodes_sorted = [] #seps= [] isolates_ori = list(nx.isolates(gcopy))[::-1] # reverse it if len(isolates_ori)>0: nodes_sorted.extend(isolates_ori) gcopy.remove_nodes_from(isolates_ori) #seps.append(len(nodes_sorted)) isolates_bysilk = [] if len(etypes_rev['Silk'])>0: gcopy.remove_edges_from(etypes_rev['Silk']) isolates_bysilk = list(nx.isolates(gcopy))[::-1] nodes_sorted.extend(isolates_bysilk) gcopy.remove_nodes_from(isolates_bysilk) #seps.append(len(nodes_sorted)) if len(etypes_rev['Global_Bridge'])>0: res, coms, hcoms = part_this(gcopy, set(gcopy.nodes()), etypes_rev, kmax+1, isglobal=True) else: res, coms, hcoms = part_this(gcopy, set(gcopy.nodes()), etypes_rev, kmax) nodes_sorted.extend(res) flat_iso_global = isolates_ori + isolates_bysilk #for n in isolates_ori: flat_iso_global[n] = [n] #for n in isolates_bysilk: flat_iso_global[n] = [n] flat_cdic = {} #for n in isolates_ori: flat_cdic[n] = [n] #for n in isolates_bysilk: flat_cdic[n] = [n] for n,c in zip(res, coms): if not(c in flat_cdic): flat_cdic[c] = [] flat_cdic[c].append(n) for c,ns in flat_cdic.items(): flat_cdic[c] = ns[::-1] #print(hcoms) h_tree_dic = get_hcom_list(hcoms, flat_cdic) h_tree_dic.update({ n:n for n in flat_iso_global }) return nodes_sorted[::-1], h_tree_dic, flat_cdic, kmax def get_hcom_list(hcom, flat_cdic): level_name = {} if not isinstance(hcom, list): comlist = flat_cdic[hcom] if len(comlist)>1: level_name[hcom] = comlist else: #elif len(comlist)<=1: level_name[hcom] = comlist[0] return level_name # return a dict with one key, one value else: lead = get_lead(hcom) #diclist = [] hdic = {} # a number of key, value pair, pair number same as length of hcom for c in hcom: cdic = get_hcom_list(c, flat_cdic) # get a dict with one key, one value #diclist.append( cdic ) hdic.update( cdic ) level_name[lead] = hdic #level_name[diclist[0].keys()[0]] = diclist return level_name # return a dict with one key, one value def get_lead(alist): if not(isinstance(alist, list)): return alist else: return get_lead(alist[0]) def part_this(h, sublist, etypes_rev, k, isglobal=False): res_list = [] com_list = [] set_com = [] if k<1: res_list = sublist # return sublist as-is com_list = [list(sublist)[0]]*len(sublist) set_com = com_list[0] return res_list, com_list, set_com else: #print('k:', k, isglobal) if isglobal: this_key = 'Global_Bridge' else: this_key = 'Local_Bridge'+str(k) if not(this_key in etypes_rev): res_list = sublist com_list = [list(sublist)[0]]*len(sublist) set_com = com_list[0] return res_list, com_list, set_com this_LB = etypes_rev[this_key] hsub = h.subgraph(sublist).copy()#nx.DiGraph(h.subgraph(sublist)) hsub.remove_edges_from(this_LB) isolates_byLB = list(nx.isolates(hsub))[::-1] res_list.extend(isolates_byLB) com_list.extend(isolates_byLB) set_com.extend(isolates_byLB) #print(set_com) hsub.remove_nodes_from(isolates_byLB) communities = sorted(nx.connected_components(hsub), key=len) if len(communities)==0: # not network, all isolated return res_list, com_list, set_com elif len(communities)==1: # left one connected component, extend it with isolated and return c = communities[0] res_list.extend(c) com_list.extend([list(c)[0]]*len(c)) set_com.extend([list(c)[0]]) #print(com_list, set_com) return res_list, com_list, set_com else: # more than one connected component, process each CC for c in communities: res, coms, com_ids = part_this(hsub, c, etypes_rev, k-1 ) res_list.extend(res) com_list.extend(coms) if isglobal: if isinstance(com_ids, list): set_com.extend(com_ids) else: set_com.append(com_ids) else: set_com.append(com_ids) return res_list, com_list, set_com def tree_to_level_count(h_tree): layer = 0 levels = {} iso = {} ismax = False this_tree = h_tree while not ismax: next_trees = {} #this_level = 0 levels[layer] = 0 iso[layer] = 0 for k,v in this_tree.items(): if isinstance(v, dict): #this_level+=len(v) levels[layer]+=1 next_trees.update(v) elif isinstance(v, list): if len(v)==1: #print'something wrong' iso[layer]+=1 elif len(v)>1: levels[layer]+=1 else: iso[layer]+=1 #levels[layer] = this_level if len(next_trees)<=0: ismax = True else: layer+=1 this_tree = next_trees level_count = { 'level_{}'.format(str(lvl)):count for lvl,count in levels.items() } iso_count = { 'level_{}'.format(str(lvl)):count for lvl,count in iso.items() } return level_count, iso_count def get_color(d, color_dic=None): if color_dic is None: color_dic = {1:'blue', 2:'red', 3:'green', 4:'yellow', -1:'black'} if 'Bond' in d['type']: return color_dic[1], 1 elif 'Local' in d['type']: return color_dic[2], 2 elif 'Global' in d['type']: return color_dic[3], 3 elif 'Silk' in d['type']: return color_dic[4], 4 else: return color_dic[-1], -1 def draw_mat(dg, ax=None, cmap=None): if ax is None: fig, ax = plt.subplots(figsize=(6,6)) orders, h_tree_dic, flat_dic, kmax = community_sorting(dg) mat = np.zeros((len(orders), len(orders))) for u,v,d in dg.edges(data=True): #print u,v,d u2 = orders.index(u) v2 = orders.index(v) c,ind = get_color(d) mat[u2][v2] = ind if cmap is None: cmap = ListedColormap(['k', 'blue', 'red', 'green', 'yellow']) ax.matshow(mat, cmap=cmap, vmin=0, vmax=4) #return mat def draw_net(dg, pos, ax=None, color_dic=None): if ax is None: fig, ax = plt.subplots(figsize=(6,6)) f = nx.draw_networkx_nodes(dg, pos=pos, ax=ax, size=3, node_color='lightgrey') #f = nx.draw_networkx_labels(dg, pos=pos, ax=ax, size=3) for u,v,d in dg.edges(data=True): uxy = pos[u] vxy = pos[v] col = get_color(d, color_dic=color_dic)[0] ax.annotate('', xy=vxy, xytext=uxy, arrowprops=dict(arrowstyle='-', color=col, connectionstyle='arc3,rad=-0.15') ) ax.set_aspect('equal') def draw_result(dg, pos=None, layout='circular', color_dic=None, cmap=None): if pos is None: if layout=='circular': pos = nx.circular_layout(dg) elif layout=='spring': pos = nx.spring_layout(dg) else: pos = nx.spring_layout(dg) fig, axs = plt.subplots(1, 2, figsize=(14, 7)) ax1, ax2 = axs for ax in axs: ax.axis('off') draw_mat(dg, ax=ax1, cmap=cmap) draw_net(dg, pos, ax=ax2, color_dic=color_dic) plt.tight_layout() return fig, axs def get_type(d): if 'Bond' in d['type']: return 'bond', 1 elif 'Local' in d['type']: return 'local', 2 elif 'Global' in d['type']: return 'global', 3 elif 'Silk' in d['type']: return 'silk', 4 else: return 'unknown', -1 def fingerprint(dg, ebunch=None): counts = { 'bond':0., 'local':0., 'global':0., 'silk':0., 'unknown':0. } total = 0. if ebunch is None: ebunch = list(dg.edges()) dic = { (u,v): d for u,v,d in dg.edges(data=True) } for u,v in ebunch: d = dic[(u,v)] typ = get_type(d)[0] counts[typ]+=1. total+=1. if total>0: proportions = { k:v/total for k,v in counts.items() } ords = ['bond', 'local', 'global', 'silk'] proportions2 = [ proportions[k] for k in ords ] return proportions2 else: return ['-','-','-','-'] def main(): # some test test_data_dir = '../data/net/' fs = sorted(os.listdir(test_data_dir)) fs = [ f for f in fs if f[-4:]=='.net' ] #print(fs) #f = fs[0] t0 = time.time() for f in fs: print(f) fp = os.path.join(test_data_dir, f) g = nx.Graph(nx.read_pajek(fp)) print(g.number_of_edges()) g, ext_dic, int_dic = bridge_or_bond(g, times=1) print(ext_dic, int_dic) print(fingerprint(g)) t1 = time.time() print('----------done----------') print('total', (t1-t0)/60., 'minutes') if __name__ == '__main__': main()
from rest_framework.generics import GenericAPIView as View, get_object_or_404 from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework.status import HTTP_201_CREATED, HTTP_205_RESET_CONTENT from ecommerce.permissions import IsObjectOwner from store.models import Store from store.serializers.store import StoreSerializer class CreateStoreAPI(View): permission_classes = [IsAuthenticated] serializer_class = StoreSerializer def post(self, request): store_data = request.data store_create_serializer = self.get_serializer(data=store_data) store_create_serializer.is_valid(raise_exception=True) store_create_serializer.save(owner=request.user) return Response( {"message": "Store has been created", "data": store_create_serializer.data}, status=HTTP_201_CREATED, ) class DetailStoreAPI(View): serializer_class = StoreSerializer def get(self, request, slug): store = get_object_or_404(Store, slug=slug) store_serializer = self.get_serializer(store) return Response({"data": store_serializer.data}) class UpdateStoreAPI(View): permission_classes = [IsAuthenticated, IsObjectOwner] serializer_class = StoreSerializer def get_object(self, slug): store = get_object_or_404(Store, slug=slug) self.check_object_permissions(self.request, store) return store def put(self, request, slug): store = self.get_object(slug) store_data = request.data store_update_serializer = self.get_serializer( store, data=store_data, partial=True ) store_update_serializer.is_valid(raise_exception=True) store_update_serializer.save() return Response( {"message": "Store has been updated", "data": store_update_serializer.data} ) def delete(self, request, slug): store = self.get_object(slug) store.delete() return Response( {"message": "Store has been deleted"}, status=HTTP_205_RESET_CONTENT )
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: Qot_GetUserSecurityGroup.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database from google.protobuf import descriptor_pb2 # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() import Common_pb2 as Common__pb2 import Qot_Common_pb2 as Qot__Common__pb2 DESCRIPTOR = _descriptor.FileDescriptor( name='Qot_GetUserSecurityGroup.proto', package='Qot_GetUserSecurityGroup', syntax='proto2', serialized_pb=_b('\n\x1eQot_GetUserSecurityGroup.proto\x12\x18Qot_GetUserSecurityGroup\x1a\x0c\x43ommon.proto\x1a\x10Qot_Common.proto\"\x18\n\x03\x43\x32S\x12\x11\n\tgroupType\x18\x01 \x02(\x05\"1\n\tGroupData\x12\x11\n\tgroupName\x18\x01 \x02(\t\x12\x11\n\tgroupType\x18\x02 \x02(\x05\"=\n\x03S2C\x12\x36\n\tgroupList\x18\x01 \x03(\x0b\x32#.Qot_GetUserSecurityGroup.GroupData\"5\n\x07Request\x12*\n\x03\x63\x32s\x18\x01 \x02(\x0b\x32\x1d.Qot_GetUserSecurityGroup.C2S\"n\n\x08Response\x12\x15\n\x07retType\x18\x01 \x02(\x05:\x04-400\x12\x0e\n\x06retMsg\x18\x02 \x01(\t\x12\x0f\n\x07\x65rrCode\x18\x03 \x01(\x05\x12*\n\x03s2c\x18\x04 \x01(\x0b\x32\x1d.Qot_GetUserSecurityGroup.S2C*a\n\tGroupType\x12\x15\n\x11GroupType_Unknown\x10\x00\x12\x14\n\x10GroupType_Custom\x10\x01\x12\x14\n\x10GroupType_System\x10\x02\x12\x11\n\rGroupType_All\x10\x03\x42N\n\x13\x63om.futu.openapi.pbZ7github.com/futuopen/ftapi4go/pb/qotgetusersecuritygroup') , dependencies=[Common__pb2.DESCRIPTOR,Qot__Common__pb2.DESCRIPTOR,]) _GROUPTYPE = _descriptor.EnumDescriptor( name='GroupType', full_name='Qot_GetUserSecurityGroup.GroupType', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='GroupType_Unknown', index=0, number=0, options=None, type=None), _descriptor.EnumValueDescriptor( name='GroupType_Custom', index=1, number=1, options=None, type=None), _descriptor.EnumValueDescriptor( name='GroupType_System', index=2, number=2, options=None, type=None), _descriptor.EnumValueDescriptor( name='GroupType_All', index=3, number=3, options=None, type=None), ], containing_type=None, options=None, serialized_start=399, serialized_end=496, ) _sym_db.RegisterEnumDescriptor(_GROUPTYPE) GroupType = enum_type_wrapper.EnumTypeWrapper(_GROUPTYPE) GroupType_Unknown = 0 GroupType_Custom = 1 GroupType_System = 2 GroupType_All = 3 _C2S = _descriptor.Descriptor( name='C2S', full_name='Qot_GetUserSecurityGroup.C2S', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='groupType', full_name='Qot_GetUserSecurityGroup.C2S.groupType', index=0, number=1, type=5, cpp_type=1, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=92, serialized_end=116, ) _GROUPDATA = _descriptor.Descriptor( name='GroupData', full_name='Qot_GetUserSecurityGroup.GroupData', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='groupName', full_name='Qot_GetUserSecurityGroup.GroupData.groupName', index=0, number=1, type=9, cpp_type=9, label=2, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='groupType', full_name='Qot_GetUserSecurityGroup.GroupData.groupType', index=1, number=2, type=5, cpp_type=1, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=118, serialized_end=167, ) _S2C = _descriptor.Descriptor( name='S2C', full_name='Qot_GetUserSecurityGroup.S2C', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='groupList', full_name='Qot_GetUserSecurityGroup.S2C.groupList', index=0, number=1, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=169, serialized_end=230, ) _REQUEST = _descriptor.Descriptor( name='Request', full_name='Qot_GetUserSecurityGroup.Request', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='c2s', full_name='Qot_GetUserSecurityGroup.Request.c2s', index=0, number=1, type=11, cpp_type=10, label=2, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=232, serialized_end=285, ) _RESPONSE = _descriptor.Descriptor( name='Response', full_name='Qot_GetUserSecurityGroup.Response', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='retType', full_name='Qot_GetUserSecurityGroup.Response.retType', index=0, number=1, type=5, cpp_type=1, label=2, has_default_value=True, default_value=-400, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='retMsg', full_name='Qot_GetUserSecurityGroup.Response.retMsg', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='errCode', full_name='Qot_GetUserSecurityGroup.Response.errCode', index=2, number=3, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='s2c', full_name='Qot_GetUserSecurityGroup.Response.s2c', index=3, number=4, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=287, serialized_end=397, ) _S2C.fields_by_name['groupList'].message_type = _GROUPDATA _REQUEST.fields_by_name['c2s'].message_type = _C2S _RESPONSE.fields_by_name['s2c'].message_type = _S2C DESCRIPTOR.message_types_by_name['C2S'] = _C2S DESCRIPTOR.message_types_by_name['GroupData'] = _GROUPDATA DESCRIPTOR.message_types_by_name['S2C'] = _S2C DESCRIPTOR.message_types_by_name['Request'] = _REQUEST DESCRIPTOR.message_types_by_name['Response'] = _RESPONSE DESCRIPTOR.enum_types_by_name['GroupType'] = _GROUPTYPE _sym_db.RegisterFileDescriptor(DESCRIPTOR) C2S = _reflection.GeneratedProtocolMessageType('C2S', (_message.Message,), dict( DESCRIPTOR = _C2S, __module__ = 'Qot_GetUserSecurityGroup_pb2' # @@protoc_insertion_point(class_scope:Qot_GetUserSecurityGroup.C2S) )) _sym_db.RegisterMessage(C2S) GroupData = _reflection.GeneratedProtocolMessageType('GroupData', (_message.Message,), dict( DESCRIPTOR = _GROUPDATA, __module__ = 'Qot_GetUserSecurityGroup_pb2' # @@protoc_insertion_point(class_scope:Qot_GetUserSecurityGroup.GroupData) )) _sym_db.RegisterMessage(GroupData) S2C = _reflection.GeneratedProtocolMessageType('S2C', (_message.Message,), dict( DESCRIPTOR = _S2C, __module__ = 'Qot_GetUserSecurityGroup_pb2' # @@protoc_insertion_point(class_scope:Qot_GetUserSecurityGroup.S2C) )) _sym_db.RegisterMessage(S2C) Request = _reflection.GeneratedProtocolMessageType('Request', (_message.Message,), dict( DESCRIPTOR = _REQUEST, __module__ = 'Qot_GetUserSecurityGroup_pb2' # @@protoc_insertion_point(class_scope:Qot_GetUserSecurityGroup.Request) )) _sym_db.RegisterMessage(Request) Response = _reflection.GeneratedProtocolMessageType('Response', (_message.Message,), dict( DESCRIPTOR = _RESPONSE, __module__ = 'Qot_GetUserSecurityGroup_pb2' # @@protoc_insertion_point(class_scope:Qot_GetUserSecurityGroup.Response) )) _sym_db.RegisterMessage(Response) DESCRIPTOR.has_options = True DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\023com.futu.openapi.pbZ7github.com/futuopen/ftapi4go/pb/qotgetusersecuritygroup')) # @@protoc_insertion_point(module_scope)
""" Copyright © 2020. All rights reserved. Author: Vyshinsky Ilya <[email protected]> Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 """ import numpy as np import copy from scores.func import * from scores.FormulaVertex import FormulaVertex from scores.FormulaTree import FormulaTree from scores.FormulaTreePopul import FormulaTreePopul from scores.FormulaPopulation import FormulaPopulation def print_tree(tree): print(tree.to_strw()) print(tree.to_str_oper()) print(tree.to_str_connect()) print("Complexity = {}".format(tree.complexity())) def print_rank_tree(tree, type_fit=None): if type_fit == "mean-min": print("Formula={} Rank={} Target={} TargetMin={}".format(tree.to_strw(), tree.rank, tree.ftarget, tree.ftarget_min)) elif type_fit == "mean-complexity": print("Formula={} Rank={} Target={} Complexity={}".format(tree.to_strw(), tree.rank, tree.ftarget, tree.complexity_target)) else: print("Formula={} Target={} TargetMin={} Complexity={}".format(tree.to_strw(), tree.ftarget, tree.ftarget_min, tree.complexity_target)) def print_rank(fp, type_fit=None): for tree in fp.population: print_rank_tree(tree) def get_lin_tmodel(tree): tree.base = FormulaVertex(fsum) vertex = FormulaVertex(fmul) vertex.add(FormulaVertex(None, "x", 0)) vertex.add(FormulaVertex(None, "w", 0)) tree.base.add(vertex) tree.base.add(FormulaVertex(None, "w", 1)) return tree def get_lin_tmodel2(tree): tree.base = FormulaVertex(fsum) vertex1 = FormulaVertex(fmul) vertex2 = FormulaVertex(fmul) vertex2.add(FormulaVertex(None, "x", 0)) vertex2.add(FormulaVertex(None, "w", 1)) vertex1.add(vertex2) vertex1.add(FormulaVertex(None, "w", 0)) tree.base.add(vertex1) tree.base.add(FormulaVertex(None, "w", 1)) return tree def get_model(weights, func): model = FormulaTree(weights=weights) model = func(model) model.update_index() return model if __name__ == "__main__": my_prob = np.ones(len(FUNC_OPERATIONS), dtype=int) inp = np.array([[1], [2], [3], [4], [5]]) targ = np.array([6, 9, 12, 15, 18]) #3 * x + 3 inp.shape = (inp.shape[0], 1) print("Input:", inp) # Обучение единственного дерева tree = get_model(np.array([0.0, 0.0]), get_lin_tmodel2) tree.init_weights() print("predict =", tree.predict(inp)) print("weights =", tree.weights) tree.fit(inp, targ, 100) print_tree(tree) print_rank_tree(tree) print("predict =", tree.predict(inp)) print("weights =", tree.weights) # Обучение популяции print(); print("Formula Population:") fp = FormulaPopulation(input_num=1, weights_num=2, my_func=FUNC_OPERATIONS, my_prob=my_prob, weights_popul=20) fp.start_popul(30) #fp.start_popul_func(30, get_lin_tmodel) #fp.targetfit(inp, targ, maxiter=100) #fp.askfit(inp, targ, maxiter=100) fp.run(inp, targ, iter=100, iterfit=100) #fp.runfit(inp, targ, iter=100, maxiter=100) print_rank(fp) print(); print("Predict:") print(fp.predict(inp)) print(); print("Weights:") print(fp.get_weights())
import json def user_login(self, name, password): return self.client.post( '/api/v1/login', data=json.dumps({'name': name, 'password': password}) )
from django.shortcuts import render from .models import CustomUser from posts.models import Post from django.http import HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic import RedirectView from django.urls import reverse from allauth.account.views import LoginView as AllauthLoginView from allauth.account.utils import get_next_redirect_url from accounts.forms import CustomUserChangeForm from django.shortcuts import redirect, get_object_or_404 from django.http import HttpRequest # Create your views here. def profile_view(request, username): # u = CustomUser.objects.get(username=username) u = get_object_or_404(CustomUser, username=username.lower()) user_posts = Post.objects.filter(author=u).order_by('-date') return render(request, "account/profile.html", {"user_object": u ,"posts":user_posts}) class LoginView(AllauthLoginView): def form_valid(self, form): self.user = form.user # Get the forms user return super().form_valid(form) def get_success_url(self): ret = (get_next_redirect_url(self.request, self.redirect_field_name) or reverse('profile_view', kwargs={'username': self.user.username})) return ret @login_required def edit_profile_view(request,username): if request.method == 'POST': form = CustomUserChangeForm(request.POST, instance=request.user) if form.is_valid(): form.save() return redirect(reverse('profile_view', kwargs={"username": request.user.username} )) else: request.user = CustomUser.objects.get(username=username) args = {"form": form} return render(request, 'account/edit_profile.html', args) else: if username == request.user.username: form = CustomUserChangeForm(instance=request.user) args = {'form': form} return render(request, 'account/edit_profile.html', args) else: return redirect(reverse('profile_view', kwargs={'username': request.user.username}))
from datetime import datetime import pandas as pd import numpy as np from optimization.performance import * now = datetime.now().date() # -------------------------------------------------------------------------- # # Helper Functions # # -utils- # # -------------------------------------------------------------------------- # def build_2D_matrix_by_rule(size, scalar): """ returns a matrix of given size, built through a generalized rule. The matrix must be 2D Parameters: size (tuple): declare the matrix size in this format (m, n), where m = rows and n = columns scalar (tuple): scalars to multiply the log_10 by. Follow the format (m_scalar, n_scalar) m_float: the current cell is equal to m_scalar * log_10(row #) n_float: the current cell is equal to n_scalar * log_10(column #) Returns: a matrix of size m x n whose cell are given by m_float+n_float """ # Initialize a zero-matrix of size = (m x n) matrix = np.zeros(size) for m in range(matrix.shape[0]): for n in range(matrix.shape[1]): matrix[m][n] = round(scalar[0]*np.log10(m+1) + scalar[1]*np.log10(n+1), 2) return matrix # -------------------------------------------------------------------------- # # Score Matrices # # -------------------------------------------------------------------------- # # We encourage developers who fork this project to alter both scoring grids and categorical bins to best suit their use case # The SCRTSybil Credit Score Oracle returns 2 outputs: # 1. score (float): a numerical score # 2. feedback (dict): a qualitative description of the score # Categorical bins duedate = np.array([3, 4, 5]) # bins: 0-90 | 91-120 | 121-150 | 151-180 | 181-270 | >270 days duration = np.array([90, 120, 150, 180, 210, 270]) volume_balance_now = np.array([5000, 6500, 8500, 11000, 13000, 15000]) volume_profit = np.array([500, 1000, 2000, 2500, 3000, 4000]) count_cred_deb_txn = np.array([10, 20, 30, 35, 40, 50]) # Scoring grids # naming convention: shape+denominator, m7x7+Scalars+1.3+1.17 -> m7x7_03_17 # naming convention: shape+denominator, m7x7+Scalars+1.85+1.55 -> m7x7_85_55 m7x7_03_17 = build_2D_matrix_by_rule((7, 7), (1/3.03, 1/1.17)) m7x7_85_55 = build_2D_matrix_by_rule((7, 7), (1/1.85, 1/1.55)) fico = (np.array([300, 500, 560, 650, 740, 800, 870])-300) / \ 600 # Fico score binning - normalized fico_medians = [round(fico[i]+(fico[i+1]-fico[i])/2, 2) for i in range(len(fico)-1)] # Medians of Fico scoring bins fico_medians.append(1) fico_medians = np.array(fico_medians) # Make all scoring grids immutable # (i.e., you can append new elements to the array but you can't rewrite its data, because the array is now read-only) duration.flags.writeable = False volume_balance_now.flags.writeable = False volume_profit.flags.writeable = False count_cred_deb_txn.flags.writeable = False m7x7_03_17.flags.writeable = False m7x7_85_55.flags.writeable = False fico_medians.flags.writeable = False # -------------------------------------------------------------------------- # # Helper Functions # # -------------------------------------------------------------------------- # def nested_dict(d, keys, value): for key in keys[:-1]: d = d.setdefault(key, {}) d[keys[-1]] = value def net_flow(txn, timeframe, feedback): ''' Description: Returns monthly net flow (income - expenses) Parameters: txn (list): transactions history of above-listed accounts timeframe (str): length in months of transaction history feedback (dict): score feedback Returns: flow (dataframe): net monthly flow by datetime ''' try: accepted_types = { 'income': ['fiat_deposit', 'request', 'sell', 'send_credit'], 'expense': ['fiat_withdrawal', 'vault_withdrawal', 'buy', 'send_debit'] } # Store all transactions (income and expenses) in a pandas df income = [(datetime.strptime(d['created_at'], '%Y-%m-%dT%H:%M:%SZ'), abs(float( d['native_amount']['amount']))) for d in txn if d['type'] in accepted_types['income']] expense = [(datetime.strptime(d['created_at'], '%Y-%m-%dT%H:%M:%SZ'), -abs(float( d['native_amount']['amount']))) for d in txn if d['type'] in accepted_types['expense']] net_flow = income + expense df = pd.DataFrame(net_flow, columns=['created_at', 'amount']) df = df.set_index('created_at') if len(df.index) > 0: # bin by month df = df.groupby(pd.Grouper(freq='M')).sum() # exclude current month if df.iloc[-1, ].name.strftime('%Y-%m') == now.strftime('%Y-%m'): df = df[:-1] # keep only past X-many months. If longer, then crop df = df[-timeframe:] else: raise Exception('no consistent net flow') except Exception as e: df = pd.DataFrame() feedback['liquidity']['error'] = str(e) finally: return df, feedback # -------------------------------------------------------------------------- # # Metric #1 KYC # # -------------------------------------------------------------------------- # # @measure_time_and_memory def kyc(acc, txn, feedback): ''' Description: A score based on Coinbase KYC verification process Parameters: acc (list): non-zero balance Coinbase accounts owned by the user in currencies of trusted reputation txn (list): transactions history of above-listed accounts feedback (dict): score feedback Returns: score (int): binary kyc verification feedback (dict): score feedback ''' try: # Assign max score as long as the user owns some credible non-zero balance accounts with some transaction history if acc and txn: score = 1 feedback['kyc']['verified'] = True else: score = 0 feedback['kyc']['verified'] = False except Exception as e: score = 0 feedback['kyc']['error'] = str(e) finally: return score, feedback # -------------------------------------------------------------------------- # # Metric #2 History # # -------------------------------------------------------------------------- # # @measure_time_and_memory def history_acc_longevity(acc, feedback): ''' Description: A score based on the longevity of user's best Coinbase accounts Parameters: acc (list): non-zero balance Coinbase accounts owned by the user in currencies of trusted reputation feedback (dict): score feedback Returns: score (float): score gained based on account longevity feedback (dict): score feedback ''' try: # Retrieve creation date of oldest user account if acc: oldest = min([d['created_at'] for d in acc if d['created_at']]) # age (in days) of longest standing Coinbase account history_acc_longevity.age = (now - oldest).days score = fico_medians[np.digitize( history_acc_longevity.age, duration, right=True)] feedback['history']['wallet_age(days)'] = history_acc_longevity.age else: raise Exception('unknown account longevity') except Exception as e: score = 0 feedback['history']['error'] = str(e) finally: return score, feedback # -------------------------------------------------------------------------- # # Metric #3 Liquidity # # -------------------------------------------------------------------------- # # @measure_time_and_memory def liquidity_tot_balance_now(acc, feedback): ''' Description: A score based on cumulative balance of user's accounts Parameters: acc (list): non-zero balance Coinbase accounts owned by the user in currencies of trusted reputation feedback (dict): score feedback Returns: score (float): score gained based on cumulative balance across accounts feedback (dict): score feedback ''' try: # Calculate tot balance now if acc: balance = sum([float(d['native_balance']['amount']) for d in acc]) # Calculate score if balance == 0: score = 0 elif balance < 500 and balance != 0: score = 0.01 else: score = fico_medians[np.digitize( balance, volume_balance_now, right=True)] feedback['liquidity']['current_balance'] = round(balance, 2) else: raise Exception('no balance') except Exception as e: score = 0 feedback['liquidity']['error'] = str(e) finally: return score, feedback # @measure_time_and_memory def liquidity_loan_duedate(txn, feedback): ''' Description: returns how many months it'll take the user to pay back their loan Parameters: txn (list): transactions history of above-listed accounts feedback (dict): score feedback Returns: feedback (dict): score feedback with a new key-value pair 'loan_duedate':float (# of months in range [3,6]) ''' try: # Read in the date of the oldest txn first_txn = datetime.strptime( txn[-1]['created_at'], '%Y-%m-%dT%H:%M:%SZ').date() txn_length = int((now - first_txn).days/30) # months # Loan duedate is equal to the month of txn history there are due = np.digitize(txn_length, duedate, right=True) how_many_months = np.append(duedate, 6) feedback['liquidity']['loan_duedate'] = how_many_months[due] except Exception as e: feedback['liquidity']['error'] = str(e) finally: return feedback # @measure_time_and_memory def liquidity_avg_running_balance(acc, txn, feedback): ''' Description: A score based on the average running balance maintained for the past 12 months Parameters: acc (list): non-zero balance Coinbase accounts owned by the user in currencies of trusted reputation txn (list): transactions history of above-listed accounts feedback (dict): score feedback Returns: score (float): score gained for mimimum running balance feedback (dict): score feedback ''' try: if txn: balance = sum([float(d['native_balance']['amount']) for d in acc]) # Calculate net flow (i.e, |income-expenses|) each month for past 12 months net, feedback = net_flow(txn, 12, feedback) # Iteratively subtract net flow from balance now to calculate the running balance for the past 12 months net = net['amount'].tolist()[::-1] net = [n+balance for n in net] size = len(net) # Calculate volume using a weighted average weights = np.linspace(0.1, 1, len(net)).tolist()[::-1] volume = sum([x*w for x, w in zip(net, weights)]) / sum(weights) length = size*30 # Compute the score if volume < 500: score = 0.01 else: m = np.digitize(volume, volume_balance_now, right=True) n = np.digitize(length, duration, right=True) # Get the score and add 0.025 score penalty for each 'overdraft' score = m7x7_85_55[m][n] - 0.025 * \ len(list(filter(lambda x: (x < 0), net))) feedback['liquidity']['avg_running_balance'] = round(volume, 2) feedback['liquidity']['balance_timeframe(months)'] = size else: # If the account has no transaction history, get a score = 0, and raise exception raise Exception('no transaction history') except Exception as e: score = 0 feedback['liquidity']['error'] = str(e) finally: return score, feedback # -------------------------------------------------------------------------- # # Metric #4 Activity # # -------------------------------------------------------------------------- # # @measure_time_and_memory def activity_tot_volume_tot_count(txn, type, feedback): ''' Description: A score based on the count and volume of credit OR debit transactions across user's Coinbase accounts Parameters: txn (list): transactions history of non-zero balance Coinbase accounts owned by the user in currencies of trusted reputation type (str): accepts 'credit' or 'debit' Returns: score (float): score gained for count and volume of credit transactions feedback (dict): score feedback ''' try: # Calculate total volume of credit OR debit and txn counts if txn: accepted_types = { 'credit': ['fiat_deposit', 'request', 'buy', 'send_credit'], 'debit': ['fiat_withdrawal', 'vault_withdrawal', 'sell', 'send_debit'] } typed_txn = [float(d['native_amount']['amount']) for d in txn if d['type'] in accepted_types[type]] balance = sum(typed_txn) m = np.digitize(len(typed_txn), count_cred_deb_txn, right=True) n = np.digitize(balance, volume_balance_now, right=True) score = m7x7_03_17[m][n] nested_dict(feedback, ['activity', type, 'tot_volume'], round(balance, 2)) else: raise Exception('no transaction history') except Exception as e: score = 0 feedback['activity']['error'] = str(e) finally: return score, feedback # @measure_time_and_memory def activity_consistency(txn, type, feedback): ''' Description: A score based on the the weigthed monthly average credit OR debit volume over time Parameters: txn (list): transactions history of non-zero balance Coinbase accounts owned by the user in currencies of trusted reputation type (str): accepts 'credit' or 'debit' Returns: score (float): score for consistency of credit OR debit weighted avg monthly volume feedback (dict): score feedback ''' try: if txn: # Declate accepted transaction types accepted_types = { 'credit': ['fiat_deposit', 'request', 'buy', 'send_credit'], 'debit': ['fiat_withdrawal', 'vault_withdrawal', 'sell', 'send_debit'] } # Filter by transaction type and keep txn amounts and dates activity_consistency.typed_txn = [(datetime.strptime(d['created_at'], '%Y-%m-%dT%H:%M:%SZ'), float( d['native_amount']['amount'])) for d in txn if d['type'] in accepted_types[type]] df = pd.DataFrame(activity_consistency.typed_txn, columns=['created_at', 'amount']) df = df.set_index('created_at') activity_consistency.frame = df df = df.groupby(pd.Grouper(freq='M')).sum() df = df[-12:] df = df[df['amount'] != 0] if len(df.index) > 0: weights = np.linspace(0.1, 1, len(df)) w_avg = sum(np.multiply(df['amount'], weights)) / sum(weights) length = len(df.index)*30 m = np.digitize(w_avg, volume_profit*1.5, right=True) n = np.digitize(length, duration, right=True) score = m7x7_85_55[m][n] nested_dict(feedback, ['activity', type, 'weighted_avg_volume'], round(w_avg, 2)) nested_dict(feedback, ['activity', type, 'timeframe(days)'], length) else: # If the account has no transaction history, get a score = 0, and raise exception raise Exception('no transaction history') else: raise Exception('no transaction history') except Exception as e: score = 0 feedback['activity']['error'] = str(e) finally: return score, feedback # @measure_time_and_memory def activity_profit_since_inception(acc, txn, feedback): ''' Description: A score based on total user profit since account inception. We define net profit as: net profit = (tot withdrawals) + (tot Coinbase balance now) - (tot injections into your wallet) Parameters: acc (list): non-zero balance Coinbase accounts owned by the user in currencies of trusted reputation txn (list): transaction history of above-listed accounts Returns: score (int): for user total net profit thus far feedback (dict): score feedback ''' try: accepted_types = { 'credit': ['fiat_deposit', 'request', 'buy', 'send_credit'], 'debit': ['fiat_withdrawal', 'vault_withdrawal', 'send_debit'] } # Calculate total credited volume and withdrawn volume balance = sum([float(d['native_balance']['amount']) for d in acc]) credits = sum([float(d['native_amount']['amount']) for d in txn if d['type'] in accepted_types['credit']]) debits = sum([float(d['native_amount']['amount']) for d in txn if d['type'] in accepted_types['debit']]) profit = (balance - credits) + debits activity_profit_since_inception.profit = profit if profit == 0: raise Exception('no net profit') else: score = fico_medians[np.digitize( profit, volume_profit, right=True)] feedback['activity']['total_net_profit'] = round(profit, 2) except Exception as e: score = 0 feedback['activity']['error'] = str(e) finally: return score, feedback
#!/usr/bin/env python3 from random import randint, sample, uniform from acme import Product # Useful to use with random.sample to generate names ADJECTIVES = ['Awesome', 'Shiny', 'Impressive', 'Portable', 'Improved'] NOUNS = ['Anvil', 'Catapult', 'Disguise', 'Mousetrap', '???'] def generate_products(num_products=30): products = [] # TODO - your code! Generate and add random products. for _ in range(num_products): # create name, price, weight, flammability for each name = sample(ADJECTIVES, 1)[0] + " " + sample(NOUNS, 1)[0] price = randint(5, 101) weight = randint(5, 101) flammability = uniform(0.0, 2.5) prod = Product(name, price, weight, flammability) products.append(prod) #print(name, price, weight, flammability) # print(prod.__dict__) # print(products) return products def inventory_report(products): print("ACME CORPORATION OFFICIAL INVENTORY REPORT") total_price = 0 total_weight = 0 total_flammability = 0 unique_list = [] num_list = len(products) for prod in products: total_price += prod.price total_weight += prod.weight total_flammability += prod.flammability if prod.name not in unique_list: unique_list.append(prod.name) print("Unique product names: ", len(unique_list)) print("Average price: ", total_price/num_list) print("Average weight: ", total_weight/num_list) print("Average flammability: ", total_flammability/num_list) if __name__ == '__main__': inventory_report(generate_products())
import logging import os from glob import glob from subprocess import CalledProcessError, check_output from tempfile import TemporaryDirectory from typing import Dict, List from zipfile import ZipFile import rasterio import requests from stactools.worldpop.constants import API_URL, TILING_PIXEL_SIZE from stactools.worldpop.utils import get_iso3_list, get_metadata logger = logging.getLogger(__name__) def download_create_cog( output_directory: str, access_url: str, retile: bool = False, raise_on_fail: bool = True, dry_run: bool = False, ) -> str: if dry_run: logger.info("Would have downloaded TIFF, created COG, and written COG") return output_directory with TemporaryDirectory() as tmp_dir: # Extract filename from url tmp_file = os.path.join(tmp_dir, access_url.split("/").pop()) logger.info("Downloading TIFF") logger.debug(f"access_url: {access_url}") resp = requests.get(access_url) with open(tmp_file, "wb") as f: logger.info("Writing TIFF") logger.debug(f"tmp_file: {tmp_file}") f.write(resp.content) if access_url.endswith(".zip"): logger.info("Unzipping TIFF") with ZipFile(tmp_file, "r") as zip_ref: zip_ref.extractall(tmp_dir) file_name = glob(f"{tmp_dir}/*.tif").pop() if retile: return create_retiled_cogs(file_name, output_directory, raise_on_fail, dry_run) else: output_file = os.path.join( output_directory, os.path.basename(file_name).replace(".tif", "") + "_cog.tif", ) return create_cog(file_name, output_file, raise_on_fail, dry_run) def create_retiled_cogs( input_path: str, output_directory: str, raise_on_fail: bool = True, dry_run: bool = False, ) -> str: """Split tiff into tiles and create COGs Args: input_path (str): Path to the input raster output_directory (str): The directory to which the COG will be written. raise_on_fail (bool, optional): Whether to raise error on failure. Defaults to True. dry_run (bool, optional): Run without downloading tif, creating COG, and writing COG. Defaults to False. Returns: str: The path to the output COGs. """ output = None try: if dry_run: logger.info( "Would have split TIFF into tiles, created COGs, and written COGs" ) else: logger.info("Retiling TIFF") logger.debug(f"input_path: {input_path}") logger.debug(f"output_directory: {output_directory}") with TemporaryDirectory() as tmp_dir: cmd = [ "gdal_retile.py", "-ps", str(TILING_PIXEL_SIZE[0]), str(TILING_PIXEL_SIZE[1]), "-targetDir", tmp_dir, input_path, ] try: output = check_output(cmd) except CalledProcessError as e: output = e.output raise finally: logger.info(f"output: {str(output)}") file_names = glob(f"{tmp_dir}/*.tif") for f in file_names: input_file = os.path.join(tmp_dir, f) output_file = os.path.join( output_directory, os.path.basename(f).replace(".tif", "") + "_cog.tif", ) with rasterio.open(input_file, "r") as dataset: contains_data = dataset.read().any() # Exclude empty files if contains_data: logger.debug(f"Tile contains data: {input_file}") create_cog(input_file, output_file, raise_on_fail, dry_run) else: logger.debug(f"Ignoring empty tile: {input_file}") except Exception: logger.error("Failed to process {}".format(input_path)) if raise_on_fail: raise return output_directory def create_cog( input_path: str, output_path: str, raise_on_fail: bool = True, dry_run: bool = False, ) -> str: """Create COG from a TIFF Args: input_path (str): Path to input raster output_path (str): The path to which the COG will be written. raise_on_fail (bool, optional): Whether to raise error on failure. Defaults to True. dry_run (bool, optional): Run without downloading TIFF, creating COG, and writing COG. Defaults to False. Returns: str: The path to the output COG. """ output = None try: if dry_run: logger.info("Would have read TIFF, created COG, and written COG") else: logger.info("Converting TIFF to COG") logger.debug(f"input_path: {input_path}") logger.debug(f"output_path: {output_path}") cmd = [ "gdal_translate", "-of", "COG", "-co", "NUM_THREADS=ALL_CPUS", "-co", "BLOCKSIZE=512", "-co", "COMPRESS=DEFLATE", "-co", "LEVEL=9", "-co", "PREDICTOR=YES", "-co", "OVERVIEWS=IGNORE_EXISTING", "-a_nodata", "0", input_path, output_path, ] try: output = check_output(cmd) except CalledProcessError as e: output = e.output raise finally: logger.info(f"output: {str(output)}") except Exception: logger.error("Failed to process {}".format(output_path)) if raise_on_fail: raise return output_path def tile_from_source(projects: Dict[str, List[str]], output_dir: str) -> None: """Created tiled cogs remote .tif files using a dict of project - categories pairs. Output files are named using the following convention: f"{project}_{category}_{iso}_{popyear}_{file_num}_{tile_x}_{tile_y}_cog.tif" Args: projects (dict): Project - categories pairs in the form: ``` { "project1": ["category1, "category2", ...], "project2": ["category1, "category2", ...], ... } ``` output_dir (str): Output directory for tiles. """ for project, categories in projects.items(): for category in categories: for iso in get_iso3_list(project, category): metadata = get_metadata( f"{API_URL}/{project}/{category}?iso3={iso}")["data"] years_and_files = { data["popyear"]: data["files"] for data in metadata } for popyear, files in years_and_files.items(): for file_num, tif in enumerate(files): local_tif_name = ( f"{project}_{category}_{iso}_{popyear}_{file_num}.tif" ) with TemporaryDirectory() as tmp_dir: print(f"Downloading and tiling {tif}") local_tif_path = os.path.join( tmp_dir, local_tif_name) with open(local_tif_path, "wb") as f: response = requests.get(tif) f.write(response.content) create_retiled_cogs(local_tif_path, output_dir)
# -*- coding: UTF-8 -*- from __future__ import unicode_literals, print_function from django_datawatch.backends.base import BaseBackend try: from unittest import mock except ImportError: import mock from django.test.testcases import TestCase, override_settings from django_datawatch.datawatch import datawatch, run_checks from django_datawatch.base import BaseCheck from django_datawatch.models import Result @datawatch.register class CheckTriggerUpdate(BaseCheck): model_class = Result trigger_update = dict(foobar=Result) def get_foobar_payload(self, instance): return instance def get_identifier(self, payload): return payload.pk def check(self, payload): return payload class TriggerUpdateTestCase(TestCase): @override_settings(DJANGO_DATAWATCH_RUN_SIGNALS=True) @mock.patch('django_datawatch.datawatch.DatawatchHandler.update_related') def test_setting_run_signals_true(self, mock_update): run_checks(sender=None, instance=None, created=None, raw=None, using=None) self.assertTrue(mock_update.called) @override_settings(DJANGO_DATAWATCH_RUN_SIGNALS=False) @mock.patch('django_datawatch.datawatch.DatawatchHandler.update_related') def test_setting_run_signals_false(self, mock_update): run_checks(sender=None, instance=None, created=None, raw=None, using=None) self.assertFalse(mock_update.called) @override_settings(DJANGO_DATAWATCH_RUN_SIGNALS=True) @mock.patch('django_datawatch.datawatch.DatawatchHandler.get_backend') def test_update_related_calls_backend(self, mock_get_backend): backend = mock.Mock(spec=BaseBackend) mock_get_backend.return_value = backend datawatch.update_related(sender=Result, instance=Result()) self.assertTrue(backend.run.called)
import unittest import numpy as np from parsing.math_encode import tensor_encode, tensor_decode, get_action_tensor, tensor_decode_fen from parsing.parsing_constant import * from parsing.data_generation import parse_pgn, sample_intermediate_states, generate_dataset from parsing.data_generation import save_tensor_data, save_labels_data class TestParsing(unittest.TestCase): STARTING_STATE = \ [[ROOK_B, KNHT_B, BISH_B, QUEN_B, KING_B, BISH_B, KNHT_B, ROOK_B], [PAWN_B, PAWN_B, PAWN_B, PAWN_B, PAWN_B, PAWN_B, PAWN_B, PAWN_B], [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY], [PAWN_W, PAWN_W, PAWN_W, PAWN_W, PAWN_W, PAWN_W, PAWN_W, PAWN_W], [ROOK_W, KNHT_W, BISH_W, QUEN_W, KING_W, BISH_W, KNHT_W, ROOK_W]] def test_parses_game(self): np.random.seed(486) all_games = parse_pgn('../data/sample_data.pgn', LIMIT=2) game_1 = all_games[0] tensor_1 = tensor_encode(game_1.board()) self.assertEqual(tensor_1.shape, (8, 8, 13)) self.assertTrue((tensor_1 == self.STARTING_STATE).all()) states, labels, sources, targets = generate_dataset('../data/sample_data.pgn', LIMIT=3) self.assertEqual(states.shape[1:], (8, 8, 13)) self.assertEqual(sources.shape[1:], (8, 8)) self.assertEqual(targets.shape[1:], (8, 8)) test_state = states[34, ...] EXPECTED_FLIP = [[EMPTY, EMPTY, EMPTY, BISH_W, EMPTY, EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, PAWN_W, EMPTY, PAWN_W], [EMPTY, EMPTY, EMPTY, EMPTY, PAWN_W, EMPTY, PAWN_W, PAWN_B], [EMPTY, EMPTY, EMPTY, EMPTY, KING_W, EMPTY, PAWN_B, EMPTY], [BISH_B, EMPTY, EMPTY, PAWN_W, EMPTY, EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, ROOK_B, EMPTY], [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, KING_B, EMPTY], [EMPTY, EMPTY, EMPTY, EMPTY, ROOK_W, EMPTY, EMPTY, EMPTY]] self.assertTrue((np.rot90(test_state, 2) == EXPECTED_FLIP).all()) def test_decodes_state(self): test_tensor = np.array(self.STARTING_STATE) expected_board = \ [['r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'], ['p', 'p', 'p', 'p', 'p', 'p', 'p', 'p'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['P', 'P', 'P', 'P', 'P', 'P', 'P', 'P'], ['R', 'N', 'B', 'Q', 'K', 'B', 'N', 'R']] actual_board = tensor_decode(test_tensor).tolist() self.assertEqual(expected_board, actual_board) def test_decodes_state_fen(self): test_tensor_1 = np.array(self.STARTING_STATE) fen1 = tensor_decode_fen(test_tensor_1) self.assertEqual('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 0', fen1) test_state = \ [[ROOK_B, KNHT_B, EMPTY, QUEN_B, EMPTY, BISH_B, KNHT_B, ROOK_B], [PAWN_B, PAWN_B, PAWN_B, PAWN_B, PAWN_B, PAWN_B, PAWN_B, PAWN_B], [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY, PAWN_B, EMPTY, PAWN_W, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, KNHT_W], [PAWN_W, PAWN_W, PAWN_W, PAWN_W, PAWN_W, PAWN_W, PAWN_W, PAWN_W], [ROOK_W, KNHT_W, BISH_W, QUEN_W, KING_W, BISH_W, EMPTY, EMPTY]] test_tensor_2 = np.array(test_state) fen2 = tensor_decode_fen(test_tensor_2) self.assertEqual('rn1q1bnr/pppppppp/8/3p1P2/8/7N/PPPPPPPP/RNBQKB2 w KQkq - 0 0', fen2) if __name__ == "__main__": unittest.main()
import uproot import os import pandas as pd import numpy as np import awkward from tqdm import tqdm def extract_scalar_data(events, branches, entrystop=None, progressbar=False): data = {} data["event"] = events.array("event", entrystop=entrystop) for br in tqdm(branches, disable=not progressbar): data[br] = events.array(br, entrystop=entrystop).flatten() return pd.DataFrame(data) def extract_vector_data(events, branches, entrystop=10, progressbar=False): def get(branch, flat=True): a = events.array(branch, entrystop=entrystop) if flat: return a.flatten() else: return a if len(branches) == 0: return {} first_branch_jagged = get(branches[0], flat=False) first_branch_flat = first_branch_jagged.flatten() event_jagged = get("event") + awkward.JaggedArray( first_branch_jagged.starts, first_branch_jagged.stops, np.zeros(len(first_branch_flat), dtype=np.int) ) data = {} data["event"] = event_jagged.flatten() data[branches[0]] = first_branch_flat for br in tqdm(branches, disable=not progressbar): if br == branches[0]: continue if br in events: data[br] = get(br) else: print('Warning! Branch "' + br + '" not found in input file and skipped.') return pd.DataFrame(data) def nanoaod_to_parquet(input_files, out_dir, entrystop=None, input_prefix="", progressbar=False): def save_parquet(df, name): df.to_parquet(os.path.join(out_dir, name + ".parquet.gzip"), compression="gzip", index=False) out_dir = os.path.expanduser(out_dir) if not os.path.exists(out_dir): os.makedirs(out_dir) n_input_files = len(input_files) for i, input_file in enumerate(input_files): log_prefix = "" if i > 0: log_prefix = f"[{i+1}/{n_input_files}] " def log(s): print(log_prefix + s) log("Opening input file " + input_file) root_file = uproot.open(input_prefix + input_file) events = root_file["Events"] branches = [br.decode("ascii") for br in events.keys()] n_events = len(events[branches[0]]) prefixes = list(set([b.split("_")[0] for b in branches])) vector_groups_present = [p for p in prefixes if "n" + p in events] scalar_branches = ["n" + s for s in vector_groups_present] for br in branches: if br == "event": continue if not br.split("_")[0] in vector_groups_present: scalar_branches.append(br) basename = os.path.basename(input_file)[:-5] log("Loading DataFrame for scalar branches") df_scalar = extract_scalar_data(events, scalar_branches, entrystop=entrystop, progressbar=progressbar) log("Saving DataFrame parquet Scalar") save_parquet(df_scalar, basename + "_Scalar") del df_scalar processed_branches = scalar_branches + ["event"] for group in vector_groups_present: log("Loading DataFrame for object group " + group) filtered_branches = list(filter(lambda br: br == group or br.startswith(group + "_"), branches)) df = extract_vector_data(events, filtered_branches, entrystop=entrystop, progressbar=progressbar) log("Saving DataFrame parquet " + group) save_parquet(df, basename + "_" + group) processed_branches += filtered_branches del df # make sure we considered all the branches assert [b for b in branches if not b in processed_branches] == [] from geeksw.nanocache import list_files import os import subprocess def convert_files_to_parquet(input_files, base_out_dir=".", server="root://polgrid4.in2p3.fr/"): n = len(input_files) for i, input_file in enumerate(input_files): out_dir = base_out_dir + os.path.dirname(input_file) tmp_file_name = os.path.join("/tmp", os.path.basename(input_file)) if os.path.exists(tmp_file_name): subprocess.call(["rm", tmp_file_name]) print(f"File {i+1} of {n}: copying " + input_file + " to " + tmp_file_name) subprocess.call(["xrdcp", server + input_file, tmp_file_name]) nanoaod_to_parquet([tmp_file_name], out_dir, entrystop=None, progressbar=False) subprocess.call(["rm", tmp_file_name]) print("Deleted " + tmp_file_name) def convert_dataset_to_parquet(dataset, base_out_dir=".", server="root://polgrid4.in2p3.fr/"): input_files = list_files(dataset) convert_files_to_parquet(input_files, base_out_dir=base_out_dir, server=server)
from sstcam_simulation.photoelectrons import Photoelectrons from sstcam_simulation.camera.noise import GaussianNoise from sstcam_simulation.camera.pulse import GaussianPulse from sstcam_simulation.event.acquisition import EventAcquisition from sstcam_simulation.camera import Camera, SSTCameraMapping import numpy as np import pytest @pytest.fixture(scope="module") def acquisition(): camera = Camera(continuous_readout_duration=1000, mapping=SSTCameraMapping(n_pixels=2)) acquisition = EventAcquisition(camera=camera) return acquisition def test_get_continuous_readout(acquisition): photoelectrons = Photoelectrons( pixel=np.array([0, 1]), time=np.array([30, 40]), charge=np.array([1.0, 2.0]) ) readout = acquisition.get_continuous_readout(photoelectrons) integral = readout.sum(1) * acquisition.camera.continuous_readout_sample_width argmax = readout.argmax(1) * acquisition.camera.continuous_readout_sample_width np.testing.assert_allclose(integral, photoelectrons.charge) np.testing.assert_allclose(argmax, photoelectrons.time) # Outside of readout duration photoelectrons = Photoelectrons( pixel=np.array([0, 1, 1]), time=np.array([999, 1000, 1001]), charge=np.array([1.0, 2.0, 1.0]) ) readout = acquisition.get_continuous_readout(photoelectrons) integral = readout.sum() * acquisition.camera.continuous_readout_sample_width argmax = readout.argmax() * acquisition.camera.continuous_readout_sample_width assert integral < 1 np.testing.assert_allclose(argmax, 999) def test_get_continuous_readout_with_noise(): pulse = GaussianPulse() noise = GaussianNoise(stddev=pulse.height, seed=1) camera = Camera( continuous_readout_duration=1000, n_waveform_samples=1000, photoelectron_pulse=pulse, readout_noise=noise, mapping=SSTCameraMapping(n_pixels=1) ) acquisition = EventAcquisition(camera=camera, seed=1) photoelectrons = Photoelectrons( pixel=np.array([], dtype=int), time=np.array([]), charge=np.array([]) ) readout = acquisition.get_continuous_readout(photoelectrons) stddev_pe = readout.std() / camera.photoelectron_pulse.height np.testing.assert_allclose(stddev_pe, 1, rtol=1e-2) waveform = acquisition.get_sampled_waveform(readout) predicted_stddev = noise.stddev / np.sqrt(camera.continuous_readout_sample_division) np.testing.assert_allclose(waveform.std(), predicted_stddev, rtol=1e-2) def test_get_sampled_waveform(): camera = Camera() acquisition = EventAcquisition(camera=camera) n_pixels = camera.mapping.n_pixels time_axis = camera.continuous_readout_time_axis n_continuous_samples = time_axis.size n_samples = camera.n_waveform_samples sample = camera.get_waveform_sample_from_time csample = camera.get_continuous_readout_sample_from_time cwidth = camera.continuous_readout_sample_width continuous_readout = np.zeros((n_pixels, n_continuous_samples)) continuous_readout[0, csample(30.0):csample(30.5)] = 100 continuous_readout[2, csample(40.0):csample(41.0)] = 100 waveform = acquisition.get_sampled_waveform(continuous_readout) assert waveform.shape == (n_pixels, n_samples) assert waveform[0].sum() == continuous_readout[0].sum() * cwidth assert waveform[2].sum() == continuous_readout[2].sum() * cwidth assert waveform[0].argmax() == sample(30.0) assert waveform[2].argmax() == sample(40.0) waveform = acquisition.get_sampled_waveform(continuous_readout, 30) assert waveform.shape == (n_pixels, n_samples) assert waveform[0].sum() == continuous_readout[0].sum() * cwidth assert waveform[2].sum() == continuous_readout[2].sum() * cwidth assert waveform[0].argmax() == sample(20.0) assert waveform[2].argmax() == sample(30.0) waveform = acquisition.get_sampled_waveform(continuous_readout, 25) assert waveform.shape == (n_pixels, n_samples) assert waveform[0].sum() == continuous_readout[0].sum() * cwidth assert waveform[2].sum() == continuous_readout[2].sum() * cwidth assert waveform[0].argmax() == sample(25.0) assert waveform[2].argmax() == sample(35.0) # Out of bounds with pytest.raises(ValueError): acquisition.get_sampled_waveform(continuous_readout, 10) with pytest.raises(ValueError): acquisition.get_sampled_waveform(continuous_readout, 900) # Single Pixel camera = Camera(mapping=SSTCameraMapping(n_pixels=1)) acquisition = EventAcquisition(camera=camera) n_pixels = camera.mapping.n_pixels time_axis = camera.continuous_readout_time_axis n_continuous_samples = time_axis.size n_samples = camera.waveform_duration * camera.waveform_sample_width continuous_readout = np.zeros((n_pixels, n_continuous_samples)) continuous_readout[0, csample(30.0):csample(30.5)] = 100 waveform = acquisition.get_sampled_waveform(continuous_readout) assert waveform.shape == (n_pixels, n_samples) assert waveform[0].sum() == continuous_readout[0].sum() * cwidth assert waveform[0].argmax() == sample(30.0) waveform = acquisition.get_sampled_waveform(continuous_readout, 30) assert waveform.shape == (n_pixels, n_samples) assert waveform[0].sum() == continuous_readout[0].sum() * cwidth assert waveform[0].argmax() == sample(20.0) def test_get_sampled_waveform_sample_width(): camera = Camera( mapping=SSTCameraMapping(n_pixels=1), ) pe = Photoelectrons(pixel=np.array([0]), time=np.array([40]), charge=np.array([1])) acquisition = EventAcquisition(camera=camera, seed=1) readout = acquisition.get_continuous_readout(pe) waveform = acquisition.get_sampled_waveform(readout) print(waveform.max())
#!/usr/bin/python3 # requirements: # pip3 install mwapi mwreverts jsonable mwtypes # see https://pythonhosted.org/mwreverts/api.html#module-mwreverts.api import mwapi import mwreverts.api import csv total = 0 reverted = 0 missing = 0 errors = 0 # generate a CSV of revision IDs with revision_ids_for_campaign.rb with open('/home/sage/dumps/spring_2018_revs.csv', 'r') as f: reader = csv.reader(f) revs = list(reader) session = mwapi.Session("https://en.wikipedia.org") # This handles a few revisions per second, so expect this to take many hours for a large set of revisions. for rev in revs: try: status = mwreverts.api.check(session, rev[0]) except KeyError: # this error means the revision couldn't be found, likely deleted missing += 1 status = [None, None] except: # handles other, rare errors with some revisions errors += 1 status = [None, None] total += 1 if status[1] is not None: reverted += 1 print(f"total: {total}") print(f"revert rate: {reverted / total}") # mainspace revert rate print(f"errors: {errors}") # should be very low # Missing count should be very close to the deleted revision count from revision_ids_for_campaign.rb # It's probably more accurate because it will account for deletions that happened after the dashboard # stopped updating, 30 days after course end. print(f"missing: {missing}")
from claripy import Annotation __author__ = "Xingwei Lin, Fengguo Wei" __copyright__ = "Copyright 2018, The Argus-SAF Project" __license__ = "Apache v2.0" class JfieldIDAnnotation(Annotation): """ This annotation is used to store jfieldID type information. """ def __init__(self, class_name=None, field_name=None, field_signature=None): """ :param class_name: :param field_name: :param field_signature: """ self._class_name = class_name self._field_name = field_name self._field_signature = field_signature @property def class_name(self): return self._class_name @class_name.setter def class_name(self, value): self._class_name = value @property def field_name(self): return self._field_name @field_name.setter def field_name(self, value): self._field_name = value @property def field_signature(self): return self._field_signature @field_signature.setter def field_signature(self, value): self._field_signature = value @property def eliminatable(self): return False @property def relocatable(self): return False def relocate(self, src, dst): return self
from Colors import Colors class WireSequences: def __init__(self): self._wireSequences = { Colors.RED: ['C', 'B', 'A', 'AC', 'B', 'AC', 'ABC', 'AB', 'B'], Colors.BLUE: ['B', 'AC', 'B', 'A', 'B', 'BC', 'C', 'AC', 'A'], Colors.BLACK: ['ABC', 'AC', 'B', 'AC', 'B', 'BC', 'AB', 'C', 'C'] } self._wireCounts = { Colors.RED: 0, Colors.BLUE: 0, Colors.BLACK: 0 } def reset(self): self._wireCounts = { Colors.RED: 0, Colors.BLUE: 0, Colors.BLACK: 0 } def _colorToString(self, color): return self._wireSequences[color][self._wireCounts[color]] def shouldICut(self, color, terminal=None): connectionsToCut = self._colorToString(color) self._wireCounts[color] += 1 if terminal is not None: return terminal[0].upper() in connectionsToCut else: return connectionsToCut
import unittest import mongomock from dasbot.db.stats_repo import StatsRepo class TestStatsRepo(unittest.TestCase): def setUp(self): scores_col = mongomock.MongoClient().db.collection stats_col = mongomock.MongoClient().db.collection self.stats_repo = StatsRepo(scores_col, stats_col) def test_get_stats_no_data(self): stats = self.stats_repo.get_stats(1) self.assertDictEqual( {'touched': 0, 'mistakes_30days': [], 'mistakes_alltime': []}, stats) if __name__ == '__main__': unittest.main()
# proxy module from traitsui.wx.constants import *
import datetime from tkapi.stemming import Stemming from tkapi.besluit import Besluit from tkapi.zaak import Zaak from tkapi.zaak import ZaakSoort from tkapi.persoon import Persoon from tkapi.fractie import Fractie from tkapi.util import queries from .core import TKApiTestCase class TestStemming(TKApiTestCase): def test_get_stemmingen(self): stemmingen = self.api.get_stemmingen(filter=None, max_items=10) self.assertEqual(10, len(stemmingen)) def test_get_stemming_attributes(self): dossier_nr = 33885 volgnummer = 16 stemmingen = queries.get_kamerstuk_stemmingen(nummer=dossier_nr, volgnummer=volgnummer) self.assertEqual(16, len(stemmingen)) stemming = stemmingen[0] self.assertFalse(stemming.vergissing) self.assertTrue(stemming.actor_naam) self.assertTrue(stemming.actor_fractie) self.assertFalse(stemming.is_hoofdelijk) # TODO: change if available in OData self.assertIsNone(stemming.persoon) self.assertIsNotNone(stemming.fractie_size) class TestStemmingFilters(TKApiTestCase): def get_pechtold(self): filter = Persoon.create_filter() filter.filter_achternaam('Pechtold') return self.api.get_personen(filter=filter)[0] def get_groenlinks(self): filter = Fractie.create_filter() filter.filter_fractie('GroenLinks') return self.api.get_items(Fractie, filter=filter)[0] def test_filter_moties(self): n_items = 10 filter = Stemming.create_filter() filter.filter_moties() stemmingen = self.api.get_stemmingen(filter=filter, max_items=n_items) self.assertEqual(n_items, len(stemmingen)) for stemming in stemmingen: self.assertEqual(ZaakSoort.MOTIE, stemming.besluit.zaken[0].soort) def test_filter_kamerstukdossier(self): dossier_nr = 33885 zaak_filter = Zaak.create_filter() zaak_filter.filter_kamerstukdossier(nummer=dossier_nr) zaken = self.api.get_zaken(filter=zaak_filter) n_stemmingen = 0 for zaak in zaken: print('=========================================') print('zaak', zaak.nummer, zaak.dossier.nummer, zaak.volgnummer) filter = Besluit.create_filter() filter.filter_zaak(zaak.nummer) besluiten = self.api.get_besluiten(filter=filter) for besluit in besluiten: n_stemmingen += len(besluit.stemmingen) print(len(besluit.stemmingen), besluit.soort, besluit.status, besluit.tekst) for stemming in besluit.stemmingen: print('\t', stemming.soort, stemming.fractie_size) print('stemmingen', n_stemmingen) self.assertEqual(208, n_stemmingen) def test_filter_kamerstuk(self): dossier_nr = 33885 volgnummer = 16 stemmingen = queries.get_kamerstuk_stemmingen(nummer=dossier_nr, volgnummer=volgnummer) self.assertEqual(16, len(stemmingen)) for stemming in stemmingen: stemming.print_json() def test_filter_persoon(self): person = self.get_pechtold() filter = Stemming.create_filter() filter.filter_persoon(person.id) stemmingen = self.api.get_stemmingen(filter=filter) self.assertEqual(211, len(stemmingen)) def test_filter_fractie(self): max_items = 100 fractie = self.get_groenlinks() filter = Stemming.create_filter() filter.filter_fractie(fractie.id) stemmingen = self.api.get_stemmingen(filter=filter, max_items=max_items) self.assertEqual(max_items, len(stemmingen)) def test_filter_persoon_stemming(self): max_items = 10 filter = Stemming.create_filter() filter.filter_persoon_stemmingen() stemmingen = self.api.get_stemmingen(filter=filter, max_items=max_items) self.assertEqual(max_items, len(stemmingen)) for stemming in stemmingen: self.assertIsNotNone(stemming.persoon_id) def test_filter_fractie_stemmingen(self): max_items = 10 filter = Stemming.create_filter() filter.filter_fractie_stemmingen() stemmingen = self.api.get_stemmingen(filter=filter, max_items=max_items) self.assertEqual(max_items, len(stemmingen)) for stemming in stemmingen: self.assertIsNotNone(stemming.fractie_id) class TestStemmingFractie(TKApiTestCase): # NOTE: this currently fails because stemming.fractie relations give empty fracties def test_get_stemmingen(self): stemmingen = queries.get_kamerstuk_stemmingen(nummer=33885, volgnummer=16) for stemming in stemmingen: print(stemming.fractie.naam) self.assertTrue(stemming.fractie.naam)
import math def finalInstances (instances, averageUtil): """ :type instances: int :type averageUtil: List[int] :rtype: int """ ptr = 0 while ptr < len(averageUtil): if 25 <= averageUtil[ptr] <= 60: ptr += 1 elif averageUtil[ptr] < 25 and instances > 1: instances = math.ceil(instances / 2.0) ptr += 11 elif averageUtil[ptr] < 25 and instances <= 1: ptr += 1 elif averageUtil[ptr] > 60 and instances > 0 and (instances * 2) <= (2 * (10 ** 8)): instances = instances * 2 ptr += 11 else: ptr += 1 return instances
import sys, os sys.path.append(os.path.dirname(__file__)) import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import pandas as pd def MyCodeFile(): return(__file__) #https://www.guru99.com/pytorch-tutorial.html #https://nn.readthedocs.io/en/rtd/index.html class NN_1_1(nn.Module): def __init__(self, features): super(NN_1, self).__init__() #super().__init__ self.bn1 = nn.BatchNorm1d(num_features=features) self.layer_In = torch.nn.Linear(features, features) self.layer_h1 = torch.nn.Linear(features, round(features/2)+1) self.layer_h2 = torch.nn.Linear(round(features/2+1), 10) self.layer_Out = torch.nn.Linear(10, 2) self.dropoutRate = 0.01 def forward(self, x): x = self.bn1(x) x = F.dropout(x, p=self.dropoutRate, training=self.training) x = F.relu(self.layer_In(x)) x = F.dropout(x, p=self.dropoutRate/2, training=self.training) x = F.relu(self.layer_h1(x)) x = F.relu(self.layer_h2(x)) x = self.layer_Out(x) x = F.softmax(x.float(), dim=1) return x #https://machinelearningmastery.com/how-to-configure-the-number-of-layers-and-nodes-in-a-neural-network/ class NN_1_(nn.Module): def __init__(self, features): super(NN_1, self).__init__() #super().__init__ self.bn1 = nn.BatchNorm1d(num_features=features) self.layer_In = torch.nn.Linear(features, features) self.layer_h1 = torch.nn.Linear(features, round(features/2)+1) self.layer_h2 = torch.nn.Linear(round(features/2)+1, 10) self.layer_Out = torch.nn.Linear(10, 2) self.dropoutRate = 0.01 self.L_out = {} def forward(self, x): self.L_out['1_x'] = x self.L_out['2_bn1'] = self.L_out['1_x'] #self.bn1(self.L_out['1_x']) self.L_out['3_do1'] = F.dropout(self.L_out['2_bn1'], p=self.dropoutRate, training=self.training) self.L_out['4_in'] = F.relu(self.layer_In(self.L_out['3_do1'])) self.L_out['5_do2'] = F.dropout(self.L_out['4_in'] , p=self.dropoutRate/2, training=self.training) self.L_out['6_h1'] = F.relu(self.layer_h1(self.L_out['5_do2'])) self.L_out['7_h2'] = F.relu(self.layer_h2(self.L_out['6_h1'])) self.L_out['8_out'] = F.relu(self.layer_Out(self.L_out['7_h2'])) self.L_out['9_out_sm'] = F.softmax(self.L_out['8_out'].float(), dim=1) return self.L_out['9_out_sm'] class NN_1__(nn.Module): def __init__(self, features): super(NN_1, self).__init__() #super().__init__ self.hiddenSize = round(2*features) self.layer_In = torch.nn.Linear(features, self.hiddenSize) self.layer_h1 = torch.nn.Linear(self.hiddenSize, self.hiddenSize) self.layer_h2 = torch.nn.Linear(self.hiddenSize, self.hiddenSize) self.layer_h3 = torch.nn.Linear(self.hiddenSize, self.hiddenSize) self.layer_h4 = torch.nn.Linear(self.hiddenSize, self.hiddenSize) self.layer_h5 = torch.nn.Linear(self.hiddenSize, self.hiddenSize) self.layer_Out = torch.nn.Linear(self.hiddenSize, 2) self.dropoutRateIn = 0.5 self.dropoutRate = 0.25 self.L_out = {} def forward(self, x): self.L_out['1_x'] = x self.L_out['2_do1'] = F.dropout(self.L_out['1_x'], p=self.dropoutRateIn, training=self.training) self.L_out['3_in'] = F.relu(self.layer_In(self.L_out['2_do1'])) self.L_out['4_do2'] = F.dropout(self.L_out['3_in'], p=self.dropoutRate, training=self.training) self.L_out['5_h1'] = F.relu(self.layer_h1(self.L_out['4_do2'])) self.L_out['6_do3'] = F.dropout(self.L_out['5_h1'], p=self.dropoutRate, training=self.training) self.L_out['7_h2'] = F.relu(self.layer_h2(self.L_out['6_do3'])) self.L_out['8_do4'] = F.dropout(self.L_out['7_h2'], p=self.dropoutRate, training=self.training) self.L_out['9_h3'] = F.relu(self.layer_h2(self.L_out['8_do4'])) self.L_out['10_do5'] = F.dropout(self.L_out['9_h3'], p=self.dropoutRate, training=self.training) self.L_out['11_h4'] = F.relu(self.layer_h2(self.L_out['10_do5'])) self.L_out['12_do6'] = F.dropout(self.L_out['11_h4'], p=self.dropoutRate, training=self.training) self.L_out['13_h5'] = F.relu(self.layer_h2(self.L_out['12_do6'])) #https://towardsdatascience.com/complete-guide-of-activation-functions-34076e95d044 #https://medium.com/@himanshuxd/activation-functions-sigmoid-relu-leaky-relu-and-softmax-basics-for-neural-networks-and-deep-8d9c70eed91e self.L_out['14_out'] = torch.sigmoid(self.layer_Out(self.L_out['13_h5'])) #F.relu(self.layer_Out(self.L_out['6_do3'])) #torch.sigmoid(self.layer_Out(self.L_out['6_do3'])) self.L_out['15_out_sm'] = F.softmax(self.L_out['14_out'].float(), dim=1) #if self.training: return self.L_out['14_out'] class NN_1(nn.Module): def __init__(self, features, softmaxout=False): super(NN_1, self).__init__() self.features = features self.softmaxout = softmaxout self.hiddenSize = round(2.0*features) self.bn1 = nn.BatchNorm1d(num_features=features) self.layer_In = torch.nn.Linear(features, self.hiddenSize) self.layer_h1 = torch.nn.Linear(self.hiddenSize, self.hiddenSize) self.layer_h2 = torch.nn.Linear(self.hiddenSize, self.hiddenSize) self.layer_Out = torch.nn.Linear(self.hiddenSize, 2) #https://towardsdatascience.com/simplified-math-behind-dropout-in-deep-learning-6d50f3f47275 self.dropoutRateIn = 0.2 self.dropoutRate = 0.5 self.L_out = {} def forward(self, x): self.L_out['1_x'] = x self.L_out['1_bn1'] = self.bn1(self.L_out['1_x']) self.L_out['2_do1'] = F.dropout(self.L_out['1_bn1'], p=self.dropoutRateIn, training=self.training) #https://datascience.stackexchange.com/questions/5706/what-is-the-dying-relu-problem-in-neural-networks self.L_out['3_in'] = F.leaky_relu_(self.layer_In(self.L_out['2_do1'])) self.L_out['4_do2'] = F.dropout(self.L_out['3_in'] , p=self.dropoutRate, training=self.training) self.L_out['5_h1'] = F.leaky_relu_(self.layer_h1(self.L_out['4_do2'])) #self.L_out['6_h2'] = F.leaky_relu_(self.layer_h2(self.L_out['5_h1'])) self.L_out['7_out'] = F.leaky_relu_(self.layer_Out(self.L_out['5_h1'])) #self.layer_Out(self.L_out['5_h1']) #F.leaky_relu_(self.layer_Out(self.L_out['5_h1'])) if self.softmaxout: self.L_out['8_out_sm'] = F.softmax(self.L_out['7_out'].float(), dim=1) return self.L_out['8_out_sm'] else: return self.L_out['7_out'] def Predict(self, x): prediction = self.forward(x) #prediction = prediction.data.numpy() prediction =np.argmax(prediction.data.numpy(), axis=1) #armagx returns a tuple if len(prediction)==1: return prediction[0] return prediction
# %% import pickle import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model import SGDClassifier from sklearn.multioutput import MultiOutputClassifier from sklearn.pipeline import make_pipeline # %% CATEGORIES = ["toxic", "severe_toxic", "obscene", "threat", "insult", "identity_hate"] COLUMNS = {category: bool for category in CATEGORIES} train = pd.read_csv( "var/jigsaw-toxic-comment-classification-challenge-train.csv", dtype=COLUMNS ) x_train = train.comment_text y_train = train.loc[:, CATEGORIES] # %% pipeline = make_pipeline(TfidfVectorizer(), MultiOutputClassifier(SGDClassifier())) pipeline.fit(x_train, y_train) # %% with open("var/toxicity-classifier.obj", "wb+") as checkpoint: pickle.dump(pipeline, checkpoint)
import sys import os import unittest from nose.plugins.attrib import attr # To change this, re-run 'build-unittests.py' from fortranformat._input import input as _input from fortranformat._lexer import lexer as _lexer from fortranformat._parser import parser as _parser import unittest class ENEditDescriptorBatch3TestCase(unittest.TestCase): @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_1(self): inp = '''-0.0001''' fmt = '''(EN4.1E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_2(self): inp = '''-1.96e-16''' fmt = '''(EN4.1E4)''' result = [-1.8999999999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_3(self): inp = '''3.14159''' fmt = '''(EN4.1E4)''' result = [3.1400000000000001e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_4(self): inp = '''- 1.0''' fmt = '''(EN4.1E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_5(self): inp = '''1e12''' fmt = '''(EN4.1E4)''' result = [1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_6(self): inp = '''1E12''' fmt = '''(EN4.1E4)''' result = [1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_7(self): inp = '''-1 e12''' fmt = '''(EN4.1E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_8(self): inp = '''.''' fmt = '''(EN4.1E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_9(self): inp = '''.1''' fmt = '''(EN4.1E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_10(self): inp = '''0.1D+200''' fmt = '''(EN4.1E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_11(self): inp = '''3.''' fmt = '''(EN5.1E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_12(self): inp = '''-3.''' fmt = '''(EN5.1E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_13(self): inp = '''10.''' fmt = '''(EN5.1E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_14(self): inp = '''-10.''' fmt = '''(EN5.1E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_15(self): inp = '''100.''' fmt = '''(EN5.1E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_16(self): inp = '''-100.''' fmt = '''(EN5.1E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_17(self): inp = '''1000.''' fmt = '''(EN5.1E4)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_18(self): inp = '''-1000.''' fmt = '''(EN5.1E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_19(self): inp = '''10000.''' fmt = '''(EN5.1E4)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_20(self): inp = '''-10000.''' fmt = '''(EN5.1E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_21(self): inp = '''100000.''' fmt = '''(EN5.1E4)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_22(self): inp = '''-100000.''' fmt = '''(EN5.1E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_23(self): inp = '''123456789.''' fmt = '''(EN5.1E4)''' result = [1.2345000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_24(self): inp = '''0.1''' fmt = '''(EN5.1E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_25(self): inp = '''-0.1''' fmt = '''(EN5.1E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_26(self): inp = '''0.01''' fmt = '''(EN5.1E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_27(self): inp = '''-0.01''' fmt = '''(EN5.1E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_28(self): inp = '''0.001''' fmt = '''(EN5.1E4)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_29(self): inp = '''-0.001''' fmt = '''(EN5.1E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_30(self): inp = '''0.0001''' fmt = '''(EN5.1E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_31(self): inp = '''-0.0001''' fmt = '''(EN5.1E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_32(self): inp = '''-1.96e-16''' fmt = '''(EN5.1E4)''' result = [-1.9600000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_33(self): inp = '''3.14159''' fmt = '''(EN5.1E4)''' result = [3.1410000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_34(self): inp = '''- 1.0''' fmt = '''(EN5.1E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_35(self): inp = '''1e12''' fmt = '''(EN5.1E4)''' result = [1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_36(self): inp = '''1E12''' fmt = '''(EN5.1E4)''' result = [1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_37(self): inp = '''-1 e12''' fmt = '''(EN5.1E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_38(self): inp = '''.''' fmt = '''(EN5.1E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_39(self): inp = '''.1''' fmt = '''(EN5.1E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_40(self): inp = '''0.1D+200''' fmt = '''(EN5.1E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_41(self): inp = '''3.''' fmt = '''(EN10.1E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_42(self): inp = '''-3.''' fmt = '''(EN10.1E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_43(self): inp = '''10.''' fmt = '''(EN10.1E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_44(self): inp = '''-10.''' fmt = '''(EN10.1E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_45(self): inp = '''100.''' fmt = '''(EN10.1E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_46(self): inp = '''-100.''' fmt = '''(EN10.1E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_47(self): inp = '''1000.''' fmt = '''(EN10.1E4)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_48(self): inp = '''-1000.''' fmt = '''(EN10.1E4)''' result = [-1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_49(self): inp = '''10000.''' fmt = '''(EN10.1E4)''' result = [1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_50(self): inp = '''-10000.''' fmt = '''(EN10.1E4)''' result = [-1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_51(self): inp = '''100000.''' fmt = '''(EN10.1E4)''' result = [1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_52(self): inp = '''-100000.''' fmt = '''(EN10.1E4)''' result = [-1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_53(self): inp = '''123456789.''' fmt = '''(EN10.1E4)''' result = [1.2345678900000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_54(self): inp = '''0.1''' fmt = '''(EN10.1E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_55(self): inp = '''-0.1''' fmt = '''(EN10.1E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_56(self): inp = '''0.01''' fmt = '''(EN10.1E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_57(self): inp = '''-0.01''' fmt = '''(EN10.1E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_58(self): inp = '''0.001''' fmt = '''(EN10.1E4)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_59(self): inp = '''-0.001''' fmt = '''(EN10.1E4)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_60(self): inp = '''0.0001''' fmt = '''(EN10.1E4)''' result = [1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_61(self): inp = '''-0.0001''' fmt = '''(EN10.1E4)''' result = [-1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_62(self): inp = '''-1.96e-16''' fmt = '''(EN10.1E4)''' result = [-1.9600000000000000e-16] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_63(self): inp = '''3.14159''' fmt = '''(EN10.1E4)''' result = [3.1415899999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_64(self): inp = '''- 1.0''' fmt = '''(EN10.1E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_65(self): inp = '''1e12''' fmt = '''(EN10.1E4)''' result = [1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_66(self): inp = '''1E12''' fmt = '''(EN10.1E4)''' result = [1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_67(self): inp = '''-1 e12''' fmt = '''(EN10.1E4)''' result = [-1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_68(self): inp = '''.''' fmt = '''(EN10.1E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_69(self): inp = '''.1''' fmt = '''(EN10.1E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_70(self): inp = '''0.1D+200''' fmt = '''(EN10.1E4)''' result = [1.0000000000000001e+199] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_71(self): inp = '''3.''' fmt = '''(EN2.2E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_72(self): inp = '''-3.''' fmt = '''(EN2.2E4)''' result = [-2.9999999999999999e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_73(self): inp = '''10.''' fmt = '''(EN2.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_74(self): inp = '''-10.''' fmt = '''(EN2.2E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_75(self): inp = '''100.''' fmt = '''(EN2.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_76(self): inp = '''-100.''' fmt = '''(EN2.2E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_77(self): inp = '''1000.''' fmt = '''(EN2.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_78(self): inp = '''-1000.''' fmt = '''(EN2.2E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_79(self): inp = '''10000.''' fmt = '''(EN2.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_80(self): inp = '''-10000.''' fmt = '''(EN2.2E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_81(self): inp = '''100000.''' fmt = '''(EN2.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_82(self): inp = '''-100000.''' fmt = '''(EN2.2E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_83(self): inp = '''123456789.''' fmt = '''(EN2.2E4)''' result = [1.2000000000000000e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_84(self): inp = '''0.1''' fmt = '''(EN2.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_85(self): inp = '''-0.1''' fmt = '''(EN2.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_86(self): inp = '''0.01''' fmt = '''(EN2.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_87(self): inp = '''-0.01''' fmt = '''(EN2.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_88(self): inp = '''0.001''' fmt = '''(EN2.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_89(self): inp = '''-0.001''' fmt = '''(EN2.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_90(self): inp = '''0.0001''' fmt = '''(EN2.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_91(self): inp = '''-0.0001''' fmt = '''(EN2.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_92(self): inp = '''-1.96e-16''' fmt = '''(EN2.2E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_93(self): inp = '''3.14159''' fmt = '''(EN2.2E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_94(self): inp = '''- 1.0''' fmt = '''(EN2.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_95(self): inp = '''1e12''' fmt = '''(EN2.2E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_96(self): inp = '''1E12''' fmt = '''(EN2.2E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_97(self): inp = '''-1 e12''' fmt = '''(EN2.2E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_98(self): inp = '''.''' fmt = '''(EN2.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_99(self): inp = '''.1''' fmt = '''(EN2.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_100(self): inp = '''0.1D+200''' fmt = '''(EN2.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_101(self): inp = '''3.''' fmt = '''(EN3.2E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_102(self): inp = '''-3.''' fmt = '''(EN3.2E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_103(self): inp = '''10.''' fmt = '''(EN3.2E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_104(self): inp = '''-10.''' fmt = '''(EN3.2E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_105(self): inp = '''100.''' fmt = '''(EN3.2E4)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_106(self): inp = '''-100.''' fmt = '''(EN3.2E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_107(self): inp = '''1000.''' fmt = '''(EN3.2E4)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_108(self): inp = '''-1000.''' fmt = '''(EN3.2E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_109(self): inp = '''10000.''' fmt = '''(EN3.2E4)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_110(self): inp = '''-10000.''' fmt = '''(EN3.2E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_111(self): inp = '''100000.''' fmt = '''(EN3.2E4)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_112(self): inp = '''-100000.''' fmt = '''(EN3.2E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_113(self): inp = '''123456789.''' fmt = '''(EN3.2E4)''' result = [1.2300000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_114(self): inp = '''0.1''' fmt = '''(EN3.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_115(self): inp = '''-0.1''' fmt = '''(EN3.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_116(self): inp = '''0.01''' fmt = '''(EN3.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_117(self): inp = '''-0.01''' fmt = '''(EN3.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_118(self): inp = '''0.001''' fmt = '''(EN3.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_119(self): inp = '''-0.001''' fmt = '''(EN3.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_120(self): inp = '''0.0001''' fmt = '''(EN3.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_121(self): inp = '''-0.0001''' fmt = '''(EN3.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_122(self): inp = '''-1.96e-16''' fmt = '''(EN3.2E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_123(self): inp = '''3.14159''' fmt = '''(EN3.2E4)''' result = [3.1000000000000001e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_124(self): inp = '''- 1.0''' fmt = '''(EN3.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_125(self): inp = '''1e12''' fmt = '''(EN3.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_126(self): inp = '''1E12''' fmt = '''(EN3.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_127(self): inp = '''-1 e12''' fmt = '''(EN3.2E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_128(self): inp = '''.''' fmt = '''(EN3.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_129(self): inp = '''.1''' fmt = '''(EN3.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_130(self): inp = '''0.1D+200''' fmt = '''(EN3.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_131(self): inp = '''3.''' fmt = '''(EN4.2E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_132(self): inp = '''-3.''' fmt = '''(EN4.2E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_133(self): inp = '''10.''' fmt = '''(EN4.2E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_134(self): inp = '''-10.''' fmt = '''(EN4.2E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_135(self): inp = '''100.''' fmt = '''(EN4.2E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_136(self): inp = '''-100.''' fmt = '''(EN4.2E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_137(self): inp = '''1000.''' fmt = '''(EN4.2E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_138(self): inp = '''-1000.''' fmt = '''(EN4.2E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_139(self): inp = '''10000.''' fmt = '''(EN4.2E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_140(self): inp = '''-10000.''' fmt = '''(EN4.2E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_141(self): inp = '''100000.''' fmt = '''(EN4.2E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_142(self): inp = '''-100000.''' fmt = '''(EN4.2E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_143(self): inp = '''123456789.''' fmt = '''(EN4.2E4)''' result = [1.2340000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_144(self): inp = '''0.1''' fmt = '''(EN4.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_145(self): inp = '''-0.1''' fmt = '''(EN4.2E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_146(self): inp = '''0.01''' fmt = '''(EN4.2E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_147(self): inp = '''-0.01''' fmt = '''(EN4.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_148(self): inp = '''0.001''' fmt = '''(EN4.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_149(self): inp = '''-0.001''' fmt = '''(EN4.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_150(self): inp = '''0.0001''' fmt = '''(EN4.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_151(self): inp = '''-0.0001''' fmt = '''(EN4.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_152(self): inp = '''-1.96e-16''' fmt = '''(EN4.2E4)''' result = [-1.8999999999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_153(self): inp = '''3.14159''' fmt = '''(EN4.2E4)''' result = [3.1400000000000001e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_154(self): inp = '''- 1.0''' fmt = '''(EN4.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_155(self): inp = '''1e12''' fmt = '''(EN4.2E4)''' result = [1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_156(self): inp = '''1E12''' fmt = '''(EN4.2E4)''' result = [1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_157(self): inp = '''-1 e12''' fmt = '''(EN4.2E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_158(self): inp = '''.''' fmt = '''(EN4.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_159(self): inp = '''.1''' fmt = '''(EN4.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_160(self): inp = '''0.1D+200''' fmt = '''(EN4.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_161(self): inp = '''3.''' fmt = '''(EN5.2E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_162(self): inp = '''-3.''' fmt = '''(EN5.2E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_163(self): inp = '''10.''' fmt = '''(EN5.2E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_164(self): inp = '''-10.''' fmt = '''(EN5.2E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_165(self): inp = '''100.''' fmt = '''(EN5.2E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_166(self): inp = '''-100.''' fmt = '''(EN5.2E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_167(self): inp = '''1000.''' fmt = '''(EN5.2E4)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_168(self): inp = '''-1000.''' fmt = '''(EN5.2E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_169(self): inp = '''10000.''' fmt = '''(EN5.2E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_170(self): inp = '''-10000.''' fmt = '''(EN5.2E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_171(self): inp = '''100000.''' fmt = '''(EN5.2E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_172(self): inp = '''-100000.''' fmt = '''(EN5.2E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_173(self): inp = '''123456789.''' fmt = '''(EN5.2E4)''' result = [1.2345000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_174(self): inp = '''0.1''' fmt = '''(EN5.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_175(self): inp = '''-0.1''' fmt = '''(EN5.2E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_176(self): inp = '''0.01''' fmt = '''(EN5.2E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_177(self): inp = '''-0.01''' fmt = '''(EN5.2E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_178(self): inp = '''0.001''' fmt = '''(EN5.2E4)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_179(self): inp = '''-0.001''' fmt = '''(EN5.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_180(self): inp = '''0.0001''' fmt = '''(EN5.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_181(self): inp = '''-0.0001''' fmt = '''(EN5.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_182(self): inp = '''-1.96e-16''' fmt = '''(EN5.2E4)''' result = [-1.9600000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_183(self): inp = '''3.14159''' fmt = '''(EN5.2E4)''' result = [3.1410000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_184(self): inp = '''- 1.0''' fmt = '''(EN5.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_185(self): inp = '''1e12''' fmt = '''(EN5.2E4)''' result = [1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_186(self): inp = '''1E12''' fmt = '''(EN5.2E4)''' result = [1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_187(self): inp = '''-1 e12''' fmt = '''(EN5.2E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_188(self): inp = '''.''' fmt = '''(EN5.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_189(self): inp = '''.1''' fmt = '''(EN5.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_190(self): inp = '''0.1D+200''' fmt = '''(EN5.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_191(self): inp = '''3.''' fmt = '''(EN10.2E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_192(self): inp = '''-3.''' fmt = '''(EN10.2E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_193(self): inp = '''10.''' fmt = '''(EN10.2E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_194(self): inp = '''-10.''' fmt = '''(EN10.2E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_195(self): inp = '''100.''' fmt = '''(EN10.2E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_196(self): inp = '''-100.''' fmt = '''(EN10.2E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_197(self): inp = '''1000.''' fmt = '''(EN10.2E4)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_198(self): inp = '''-1000.''' fmt = '''(EN10.2E4)''' result = [-1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_199(self): inp = '''10000.''' fmt = '''(EN10.2E4)''' result = [1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_200(self): inp = '''-10000.''' fmt = '''(EN10.2E4)''' result = [-1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_201(self): inp = '''100000.''' fmt = '''(EN10.2E4)''' result = [1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_202(self): inp = '''-100000.''' fmt = '''(EN10.2E4)''' result = [-1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_203(self): inp = '''123456789.''' fmt = '''(EN10.2E4)''' result = [1.2345678900000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_204(self): inp = '''0.1''' fmt = '''(EN10.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_205(self): inp = '''-0.1''' fmt = '''(EN10.2E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_206(self): inp = '''0.01''' fmt = '''(EN10.2E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_207(self): inp = '''-0.01''' fmt = '''(EN10.2E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_208(self): inp = '''0.001''' fmt = '''(EN10.2E4)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_209(self): inp = '''-0.001''' fmt = '''(EN10.2E4)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_210(self): inp = '''0.0001''' fmt = '''(EN10.2E4)''' result = [1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_211(self): inp = '''-0.0001''' fmt = '''(EN10.2E4)''' result = [-1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_212(self): inp = '''-1.96e-16''' fmt = '''(EN10.2E4)''' result = [-1.9600000000000000e-16] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_213(self): inp = '''3.14159''' fmt = '''(EN10.2E4)''' result = [3.1415899999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_214(self): inp = '''- 1.0''' fmt = '''(EN10.2E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_215(self): inp = '''1e12''' fmt = '''(EN10.2E4)''' result = [1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_216(self): inp = '''1E12''' fmt = '''(EN10.2E4)''' result = [1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_217(self): inp = '''-1 e12''' fmt = '''(EN10.2E4)''' result = [-1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_218(self): inp = '''.''' fmt = '''(EN10.2E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_219(self): inp = '''.1''' fmt = '''(EN10.2E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_220(self): inp = '''0.1D+200''' fmt = '''(EN10.2E4)''' result = [1.0000000000000001e+199] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_221(self): inp = '''3.''' fmt = '''(EN3.3E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_222(self): inp = '''-3.''' fmt = '''(EN3.3E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_223(self): inp = '''10.''' fmt = '''(EN3.3E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_224(self): inp = '''-10.''' fmt = '''(EN3.3E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_225(self): inp = '''100.''' fmt = '''(EN3.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_226(self): inp = '''-100.''' fmt = '''(EN3.3E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_227(self): inp = '''1000.''' fmt = '''(EN3.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_228(self): inp = '''-1000.''' fmt = '''(EN3.3E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_229(self): inp = '''10000.''' fmt = '''(EN3.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_230(self): inp = '''-10000.''' fmt = '''(EN3.3E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_231(self): inp = '''100000.''' fmt = '''(EN3.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_232(self): inp = '''-100000.''' fmt = '''(EN3.3E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_233(self): inp = '''123456789.''' fmt = '''(EN3.3E4)''' result = [1.2300000000000000e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_234(self): inp = '''0.1''' fmt = '''(EN3.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_235(self): inp = '''-0.1''' fmt = '''(EN3.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_236(self): inp = '''0.01''' fmt = '''(EN3.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_237(self): inp = '''-0.01''' fmt = '''(EN3.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_238(self): inp = '''0.001''' fmt = '''(EN3.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_239(self): inp = '''-0.001''' fmt = '''(EN3.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_240(self): inp = '''0.0001''' fmt = '''(EN3.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_241(self): inp = '''-0.0001''' fmt = '''(EN3.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_242(self): inp = '''-1.96e-16''' fmt = '''(EN3.3E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_243(self): inp = '''3.14159''' fmt = '''(EN3.3E4)''' result = [3.1000000000000001e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_244(self): inp = '''- 1.0''' fmt = '''(EN3.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_245(self): inp = '''1e12''' fmt = '''(EN3.3E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_246(self): inp = '''1E12''' fmt = '''(EN3.3E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_247(self): inp = '''-1 e12''' fmt = '''(EN3.3E4)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_248(self): inp = '''.''' fmt = '''(EN3.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_249(self): inp = '''.1''' fmt = '''(EN3.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_250(self): inp = '''0.1D+200''' fmt = '''(EN3.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_251(self): inp = '''3.''' fmt = '''(EN4.3E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_252(self): inp = '''-3.''' fmt = '''(EN4.3E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_253(self): inp = '''10.''' fmt = '''(EN4.3E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_254(self): inp = '''-10.''' fmt = '''(EN4.3E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_255(self): inp = '''100.''' fmt = '''(EN4.3E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_256(self): inp = '''-100.''' fmt = '''(EN4.3E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_257(self): inp = '''1000.''' fmt = '''(EN4.3E4)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_258(self): inp = '''-1000.''' fmt = '''(EN4.3E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_259(self): inp = '''10000.''' fmt = '''(EN4.3E4)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_260(self): inp = '''-10000.''' fmt = '''(EN4.3E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_261(self): inp = '''100000.''' fmt = '''(EN4.3E4)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_262(self): inp = '''-100000.''' fmt = '''(EN4.3E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_263(self): inp = '''123456789.''' fmt = '''(EN4.3E4)''' result = [1.2340000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_264(self): inp = '''0.1''' fmt = '''(EN4.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_265(self): inp = '''-0.1''' fmt = '''(EN4.3E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_266(self): inp = '''0.01''' fmt = '''(EN4.3E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_267(self): inp = '''-0.01''' fmt = '''(EN4.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_268(self): inp = '''0.001''' fmt = '''(EN4.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_269(self): inp = '''-0.001''' fmt = '''(EN4.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_270(self): inp = '''0.0001''' fmt = '''(EN4.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_271(self): inp = '''-0.0001''' fmt = '''(EN4.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_272(self): inp = '''-1.96e-16''' fmt = '''(EN4.3E4)''' result = [-1.8999999999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_273(self): inp = '''3.14159''' fmt = '''(EN4.3E4)''' result = [3.1400000000000001e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_274(self): inp = '''- 1.0''' fmt = '''(EN4.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_275(self): inp = '''1e12''' fmt = '''(EN4.3E4)''' result = [1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_276(self): inp = '''1E12''' fmt = '''(EN4.3E4)''' result = [1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_277(self): inp = '''-1 e12''' fmt = '''(EN4.3E4)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_278(self): inp = '''.''' fmt = '''(EN4.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_279(self): inp = '''.1''' fmt = '''(EN4.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_280(self): inp = '''0.1D+200''' fmt = '''(EN4.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_281(self): inp = '''3.''' fmt = '''(EN5.3E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_282(self): inp = '''-3.''' fmt = '''(EN5.3E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_283(self): inp = '''10.''' fmt = '''(EN5.3E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_284(self): inp = '''-10.''' fmt = '''(EN5.3E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_285(self): inp = '''100.''' fmt = '''(EN5.3E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_286(self): inp = '''-100.''' fmt = '''(EN5.3E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_287(self): inp = '''1000.''' fmt = '''(EN5.3E4)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_288(self): inp = '''-1000.''' fmt = '''(EN5.3E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_289(self): inp = '''10000.''' fmt = '''(EN5.3E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_290(self): inp = '''-10000.''' fmt = '''(EN5.3E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_291(self): inp = '''100000.''' fmt = '''(EN5.3E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_292(self): inp = '''-100000.''' fmt = '''(EN5.3E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_293(self): inp = '''123456789.''' fmt = '''(EN5.3E4)''' result = [1.2345000000000001e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_294(self): inp = '''0.1''' fmt = '''(EN5.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_295(self): inp = '''-0.1''' fmt = '''(EN5.3E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_296(self): inp = '''0.01''' fmt = '''(EN5.3E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_297(self): inp = '''-0.01''' fmt = '''(EN5.3E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_298(self): inp = '''0.001''' fmt = '''(EN5.3E4)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_299(self): inp = '''-0.001''' fmt = '''(EN5.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_300(self): inp = '''0.0001''' fmt = '''(EN5.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_301(self): inp = '''-0.0001''' fmt = '''(EN5.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_302(self): inp = '''-1.96e-16''' fmt = '''(EN5.3E4)''' result = [-1.9600000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_303(self): inp = '''3.14159''' fmt = '''(EN5.3E4)''' result = [3.1410000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_304(self): inp = '''- 1.0''' fmt = '''(EN5.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_305(self): inp = '''1e12''' fmt = '''(EN5.3E4)''' result = [1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_306(self): inp = '''1E12''' fmt = '''(EN5.3E4)''' result = [1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_307(self): inp = '''-1 e12''' fmt = '''(EN5.3E4)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_308(self): inp = '''.''' fmt = '''(EN5.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_309(self): inp = '''.1''' fmt = '''(EN5.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_310(self): inp = '''0.1D+200''' fmt = '''(EN5.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_311(self): inp = '''3.''' fmt = '''(EN10.3E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_312(self): inp = '''-3.''' fmt = '''(EN10.3E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_313(self): inp = '''10.''' fmt = '''(EN10.3E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_314(self): inp = '''-10.''' fmt = '''(EN10.3E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_315(self): inp = '''100.''' fmt = '''(EN10.3E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_316(self): inp = '''-100.''' fmt = '''(EN10.3E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_317(self): inp = '''1000.''' fmt = '''(EN10.3E4)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_318(self): inp = '''-1000.''' fmt = '''(EN10.3E4)''' result = [-1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_319(self): inp = '''10000.''' fmt = '''(EN10.3E4)''' result = [1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_320(self): inp = '''-10000.''' fmt = '''(EN10.3E4)''' result = [-1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_321(self): inp = '''100000.''' fmt = '''(EN10.3E4)''' result = [1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_322(self): inp = '''-100000.''' fmt = '''(EN10.3E4)''' result = [-1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_323(self): inp = '''123456789.''' fmt = '''(EN10.3E4)''' result = [1.2345678900000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_324(self): inp = '''0.1''' fmt = '''(EN10.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_325(self): inp = '''-0.1''' fmt = '''(EN10.3E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_326(self): inp = '''0.01''' fmt = '''(EN10.3E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_327(self): inp = '''-0.01''' fmt = '''(EN10.3E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_328(self): inp = '''0.001''' fmt = '''(EN10.3E4)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_329(self): inp = '''-0.001''' fmt = '''(EN10.3E4)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_330(self): inp = '''0.0001''' fmt = '''(EN10.3E4)''' result = [1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_331(self): inp = '''-0.0001''' fmt = '''(EN10.3E4)''' result = [-1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_332(self): inp = '''-1.96e-16''' fmt = '''(EN10.3E4)''' result = [-1.9600000000000000e-16] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_333(self): inp = '''3.14159''' fmt = '''(EN10.3E4)''' result = [3.1415899999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_334(self): inp = '''- 1.0''' fmt = '''(EN10.3E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_335(self): inp = '''1e12''' fmt = '''(EN10.3E4)''' result = [1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_336(self): inp = '''1E12''' fmt = '''(EN10.3E4)''' result = [1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_337(self): inp = '''-1 e12''' fmt = '''(EN10.3E4)''' result = [-1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_338(self): inp = '''.''' fmt = '''(EN10.3E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_339(self): inp = '''.1''' fmt = '''(EN10.3E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_340(self): inp = '''0.1D+200''' fmt = '''(EN10.3E4)''' result = [1.0000000000000001e+199] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_341(self): inp = '''3.''' fmt = '''(EN4.4E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_342(self): inp = '''-3.''' fmt = '''(EN4.4E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_343(self): inp = '''10.''' fmt = '''(EN4.4E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_344(self): inp = '''-10.''' fmt = '''(EN4.4E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_345(self): inp = '''100.''' fmt = '''(EN4.4E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_346(self): inp = '''-100.''' fmt = '''(EN4.4E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_347(self): inp = '''1000.''' fmt = '''(EN4.4E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_348(self): inp = '''-1000.''' fmt = '''(EN4.4E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_349(self): inp = '''10000.''' fmt = '''(EN4.4E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_350(self): inp = '''-10000.''' fmt = '''(EN4.4E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_351(self): inp = '''100000.''' fmt = '''(EN4.4E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_352(self): inp = '''-100000.''' fmt = '''(EN4.4E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_353(self): inp = '''123456789.''' fmt = '''(EN4.4E4)''' result = [1.2340000000000000e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_354(self): inp = '''0.1''' fmt = '''(EN4.4E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_355(self): inp = '''-0.1''' fmt = '''(EN4.4E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_356(self): inp = '''0.01''' fmt = '''(EN4.4E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_357(self): inp = '''-0.01''' fmt = '''(EN4.4E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_358(self): inp = '''0.001''' fmt = '''(EN4.4E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_359(self): inp = '''-0.001''' fmt = '''(EN4.4E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_360(self): inp = '''0.0001''' fmt = '''(EN4.4E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_361(self): inp = '''-0.0001''' fmt = '''(EN4.4E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_362(self): inp = '''-1.96e-16''' fmt = '''(EN4.4E4)''' result = [-1.8999999999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_363(self): inp = '''3.14159''' fmt = '''(EN4.4E4)''' result = [3.1400000000000001e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_364(self): inp = '''- 1.0''' fmt = '''(EN4.4E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_365(self): inp = '''1e12''' fmt = '''(EN4.4E4)''' result = [1.0000000000000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_366(self): inp = '''1E12''' fmt = '''(EN4.4E4)''' result = [1.0000000000000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_367(self): inp = '''-1 e12''' fmt = '''(EN4.4E4)''' result = [-1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_368(self): inp = '''.''' fmt = '''(EN4.4E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_369(self): inp = '''.1''' fmt = '''(EN4.4E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_370(self): inp = '''0.1D+200''' fmt = '''(EN4.4E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_371(self): inp = '''3.''' fmt = '''(EN5.4E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_372(self): inp = '''-3.''' fmt = '''(EN5.4E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_373(self): inp = '''10.''' fmt = '''(EN5.4E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_374(self): inp = '''-10.''' fmt = '''(EN5.4E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_375(self): inp = '''100.''' fmt = '''(EN5.4E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_376(self): inp = '''-100.''' fmt = '''(EN5.4E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_377(self): inp = '''1000.''' fmt = '''(EN5.4E4)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_378(self): inp = '''-1000.''' fmt = '''(EN5.4E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_379(self): inp = '''10000.''' fmt = '''(EN5.4E4)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_380(self): inp = '''-10000.''' fmt = '''(EN5.4E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_381(self): inp = '''100000.''' fmt = '''(EN5.4E4)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_382(self): inp = '''-100000.''' fmt = '''(EN5.4E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_383(self): inp = '''123456789.''' fmt = '''(EN5.4E4)''' result = [1.2344999999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_384(self): inp = '''0.1''' fmt = '''(EN5.4E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_385(self): inp = '''-0.1''' fmt = '''(EN5.4E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_386(self): inp = '''0.01''' fmt = '''(EN5.4E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_387(self): inp = '''-0.01''' fmt = '''(EN5.4E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_388(self): inp = '''0.001''' fmt = '''(EN5.4E4)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_389(self): inp = '''-0.001''' fmt = '''(EN5.4E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_390(self): inp = '''0.0001''' fmt = '''(EN5.4E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_391(self): inp = '''-0.0001''' fmt = '''(EN5.4E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_392(self): inp = '''-1.96e-16''' fmt = '''(EN5.4E4)''' result = [-1.9600000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_393(self): inp = '''3.14159''' fmt = '''(EN5.4E4)''' result = [3.1410000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_394(self): inp = '''- 1.0''' fmt = '''(EN5.4E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_395(self): inp = '''1e12''' fmt = '''(EN5.4E4)''' result = [1.0000000000000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_396(self): inp = '''1E12''' fmt = '''(EN5.4E4)''' result = [1.0000000000000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_397(self): inp = '''-1 e12''' fmt = '''(EN5.4E4)''' result = [-1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_398(self): inp = '''.''' fmt = '''(EN5.4E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_399(self): inp = '''.1''' fmt = '''(EN5.4E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_400(self): inp = '''0.1D+200''' fmt = '''(EN5.4E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_401(self): inp = '''3.''' fmt = '''(EN10.4E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_402(self): inp = '''-3.''' fmt = '''(EN10.4E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_403(self): inp = '''10.''' fmt = '''(EN10.4E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_404(self): inp = '''-10.''' fmt = '''(EN10.4E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_405(self): inp = '''100.''' fmt = '''(EN10.4E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_406(self): inp = '''-100.''' fmt = '''(EN10.4E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_407(self): inp = '''1000.''' fmt = '''(EN10.4E4)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_408(self): inp = '''-1000.''' fmt = '''(EN10.4E4)''' result = [-1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_409(self): inp = '''10000.''' fmt = '''(EN10.4E4)''' result = [1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_410(self): inp = '''-10000.''' fmt = '''(EN10.4E4)''' result = [-1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_411(self): inp = '''100000.''' fmt = '''(EN10.4E4)''' result = [1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_412(self): inp = '''-100000.''' fmt = '''(EN10.4E4)''' result = [-1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_413(self): inp = '''123456789.''' fmt = '''(EN10.4E4)''' result = [1.2345678900000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_414(self): inp = '''0.1''' fmt = '''(EN10.4E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_415(self): inp = '''-0.1''' fmt = '''(EN10.4E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_416(self): inp = '''0.01''' fmt = '''(EN10.4E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_417(self): inp = '''-0.01''' fmt = '''(EN10.4E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_418(self): inp = '''0.001''' fmt = '''(EN10.4E4)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_419(self): inp = '''-0.001''' fmt = '''(EN10.4E4)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_420(self): inp = '''0.0001''' fmt = '''(EN10.4E4)''' result = [1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_421(self): inp = '''-0.0001''' fmt = '''(EN10.4E4)''' result = [-1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_422(self): inp = '''-1.96e-16''' fmt = '''(EN10.4E4)''' result = [-1.9600000000000000e-16] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_423(self): inp = '''3.14159''' fmt = '''(EN10.4E4)''' result = [3.1415899999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_424(self): inp = '''- 1.0''' fmt = '''(EN10.4E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_425(self): inp = '''1e12''' fmt = '''(EN10.4E4)''' result = [1.0000000000000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_426(self): inp = '''1E12''' fmt = '''(EN10.4E4)''' result = [1.0000000000000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_427(self): inp = '''-1 e12''' fmt = '''(EN10.4E4)''' result = [-1.0000000000000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_428(self): inp = '''.''' fmt = '''(EN10.4E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_429(self): inp = '''.1''' fmt = '''(EN10.4E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_430(self): inp = '''0.1D+200''' fmt = '''(EN10.4E4)''' result = [1.0000000000000001e+199] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_431(self): inp = '''3.''' fmt = '''(EN5.5E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_432(self): inp = '''-3.''' fmt = '''(EN5.5E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_433(self): inp = '''10.''' fmt = '''(EN5.5E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_434(self): inp = '''-10.''' fmt = '''(EN5.5E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_435(self): inp = '''100.''' fmt = '''(EN5.5E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_436(self): inp = '''-100.''' fmt = '''(EN5.5E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_437(self): inp = '''1000.''' fmt = '''(EN5.5E4)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_438(self): inp = '''-1000.''' fmt = '''(EN5.5E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_439(self): inp = '''10000.''' fmt = '''(EN5.5E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_440(self): inp = '''-10000.''' fmt = '''(EN5.5E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_441(self): inp = '''100000.''' fmt = '''(EN5.5E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_442(self): inp = '''-100000.''' fmt = '''(EN5.5E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_443(self): inp = '''123456789.''' fmt = '''(EN5.5E4)''' result = [1.2345000000000000e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_444(self): inp = '''0.1''' fmt = '''(EN5.5E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_445(self): inp = '''-0.1''' fmt = '''(EN5.5E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_446(self): inp = '''0.01''' fmt = '''(EN5.5E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_447(self): inp = '''-0.01''' fmt = '''(EN5.5E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_448(self): inp = '''0.001''' fmt = '''(EN5.5E4)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_449(self): inp = '''-0.001''' fmt = '''(EN5.5E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_450(self): inp = '''0.0001''' fmt = '''(EN5.5E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_451(self): inp = '''-0.0001''' fmt = '''(EN5.5E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_452(self): inp = '''-1.96e-16''' fmt = '''(EN5.5E4)''' result = [-1.9600000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_453(self): inp = '''3.14159''' fmt = '''(EN5.5E4)''' result = [3.1410000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_454(self): inp = '''- 1.0''' fmt = '''(EN5.5E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_455(self): inp = '''1e12''' fmt = '''(EN5.5E4)''' result = [1.0000000000000000e+07] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_456(self): inp = '''1E12''' fmt = '''(EN5.5E4)''' result = [1.0000000000000000e+07] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_457(self): inp = '''-1 e12''' fmt = '''(EN5.5E4)''' result = [-1.0000000000000001e-05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_458(self): inp = '''.''' fmt = '''(EN5.5E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_459(self): inp = '''.1''' fmt = '''(EN5.5E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_460(self): inp = '''0.1D+200''' fmt = '''(EN5.5E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_461(self): inp = '''3.''' fmt = '''(EN10.5E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_462(self): inp = '''-3.''' fmt = '''(EN10.5E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_463(self): inp = '''10.''' fmt = '''(EN10.5E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_464(self): inp = '''-10.''' fmt = '''(EN10.5E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_465(self): inp = '''100.''' fmt = '''(EN10.5E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_466(self): inp = '''-100.''' fmt = '''(EN10.5E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_467(self): inp = '''1000.''' fmt = '''(EN10.5E4)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_468(self): inp = '''-1000.''' fmt = '''(EN10.5E4)''' result = [-1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_469(self): inp = '''10000.''' fmt = '''(EN10.5E4)''' result = [1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_470(self): inp = '''-10000.''' fmt = '''(EN10.5E4)''' result = [-1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_471(self): inp = '''100000.''' fmt = '''(EN10.5E4)''' result = [1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_472(self): inp = '''-100000.''' fmt = '''(EN10.5E4)''' result = [-1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_473(self): inp = '''123456789.''' fmt = '''(EN10.5E4)''' result = [1.2345678900000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_474(self): inp = '''0.1''' fmt = '''(EN10.5E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_475(self): inp = '''-0.1''' fmt = '''(EN10.5E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_476(self): inp = '''0.01''' fmt = '''(EN10.5E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_477(self): inp = '''-0.01''' fmt = '''(EN10.5E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_478(self): inp = '''0.001''' fmt = '''(EN10.5E4)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_479(self): inp = '''-0.001''' fmt = '''(EN10.5E4)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_480(self): inp = '''0.0001''' fmt = '''(EN10.5E4)''' result = [1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_481(self): inp = '''-0.0001''' fmt = '''(EN10.5E4)''' result = [-1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_482(self): inp = '''-1.96e-16''' fmt = '''(EN10.5E4)''' result = [-1.9600000000000000e-16] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_483(self): inp = '''3.14159''' fmt = '''(EN10.5E4)''' result = [3.1415899999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_484(self): inp = '''- 1.0''' fmt = '''(EN10.5E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_485(self): inp = '''1e12''' fmt = '''(EN10.5E4)''' result = [1.0000000000000000e+07] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_486(self): inp = '''1E12''' fmt = '''(EN10.5E4)''' result = [1.0000000000000000e+07] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_487(self): inp = '''-1 e12''' fmt = '''(EN10.5E4)''' result = [-1.0000000000000000e+07] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_488(self): inp = '''.''' fmt = '''(EN10.5E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_489(self): inp = '''.1''' fmt = '''(EN10.5E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_490(self): inp = '''0.1D+200''' fmt = '''(EN10.5E4)''' result = [1.0000000000000001e+199] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_491(self): inp = '''3.''' fmt = '''(EN10.10E4)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_492(self): inp = '''-3.''' fmt = '''(EN10.10E4)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_493(self): inp = '''10.''' fmt = '''(EN10.10E4)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_494(self): inp = '''-10.''' fmt = '''(EN10.10E4)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_495(self): inp = '''100.''' fmt = '''(EN10.10E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_496(self): inp = '''-100.''' fmt = '''(EN10.10E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_497(self): inp = '''1000.''' fmt = '''(EN10.10E4)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_498(self): inp = '''-1000.''' fmt = '''(EN10.10E4)''' result = [-1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_499(self): inp = '''10000.''' fmt = '''(EN10.10E4)''' result = [1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_500(self): inp = '''-10000.''' fmt = '''(EN10.10E4)''' result = [-1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_501(self): inp = '''100000.''' fmt = '''(EN10.10E4)''' result = [1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_502(self): inp = '''-100000.''' fmt = '''(EN10.10E4)''' result = [-1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_503(self): inp = '''123456789.''' fmt = '''(EN10.10E4)''' result = [1.2345678900000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_504(self): inp = '''0.1''' fmt = '''(EN10.10E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_505(self): inp = '''-0.1''' fmt = '''(EN10.10E4)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_506(self): inp = '''0.01''' fmt = '''(EN10.10E4)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_507(self): inp = '''-0.01''' fmt = '''(EN10.10E4)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_508(self): inp = '''0.001''' fmt = '''(EN10.10E4)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_509(self): inp = '''-0.001''' fmt = '''(EN10.10E4)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_510(self): inp = '''0.0001''' fmt = '''(EN10.10E4)''' result = [1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_511(self): inp = '''-0.0001''' fmt = '''(EN10.10E4)''' result = [-1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_512(self): inp = '''-1.96e-16''' fmt = '''(EN10.10E4)''' result = [-1.9600000000000000e-16] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_513(self): inp = '''3.14159''' fmt = '''(EN10.10E4)''' result = [3.1415899999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_514(self): inp = '''- 1.0''' fmt = '''(EN10.10E4)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_515(self): inp = '''1e12''' fmt = '''(EN10.10E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_516(self): inp = '''1E12''' fmt = '''(EN10.10E4)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_517(self): inp = '''-1 e12''' fmt = '''(EN10.10E4)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_518(self): inp = '''.''' fmt = '''(EN10.10E4)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_519(self): inp = '''.1''' fmt = '''(EN10.10E4)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_520(self): inp = '''0.1D+200''' fmt = '''(EN10.10E4)''' result = [1.0000000000000001e+199] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_521(self): inp = '''3.''' fmt = '''(EN1.1E5)''' result = [2.9999999999999999e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_522(self): inp = '''-3.''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_523(self): inp = '''10.''' fmt = '''(EN1.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_524(self): inp = '''-10.''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_525(self): inp = '''100.''' fmt = '''(EN1.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_526(self): inp = '''-100.''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_527(self): inp = '''1000.''' fmt = '''(EN1.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_528(self): inp = '''-1000.''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_529(self): inp = '''10000.''' fmt = '''(EN1.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_530(self): inp = '''-10000.''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_531(self): inp = '''100000.''' fmt = '''(EN1.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_532(self): inp = '''-100000.''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_533(self): inp = '''123456789.''' fmt = '''(EN1.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_534(self): inp = '''0.1''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_535(self): inp = '''-0.1''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_536(self): inp = '''0.01''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_537(self): inp = '''-0.01''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_538(self): inp = '''0.001''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_539(self): inp = '''-0.001''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_540(self): inp = '''0.0001''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_541(self): inp = '''-0.0001''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_542(self): inp = '''-1.96e-16''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_543(self): inp = '''3.14159''' fmt = '''(EN1.1E5)''' result = [2.9999999999999999e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_544(self): inp = '''- 1.0''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_545(self): inp = '''1e12''' fmt = '''(EN1.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_546(self): inp = '''1E12''' fmt = '''(EN1.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_547(self): inp = '''-1 e12''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_548(self): inp = '''.''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_549(self): inp = '''.1''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_550(self): inp = '''0.1D+200''' fmt = '''(EN1.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_551(self): inp = '''3.''' fmt = '''(EN2.1E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_552(self): inp = '''-3.''' fmt = '''(EN2.1E5)''' result = [-2.9999999999999999e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_553(self): inp = '''10.''' fmt = '''(EN2.1E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_554(self): inp = '''-10.''' fmt = '''(EN2.1E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_555(self): inp = '''100.''' fmt = '''(EN2.1E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_556(self): inp = '''-100.''' fmt = '''(EN2.1E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_557(self): inp = '''1000.''' fmt = '''(EN2.1E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_558(self): inp = '''-1000.''' fmt = '''(EN2.1E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_559(self): inp = '''10000.''' fmt = '''(EN2.1E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_560(self): inp = '''-10000.''' fmt = '''(EN2.1E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_561(self): inp = '''100000.''' fmt = '''(EN2.1E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_562(self): inp = '''-100000.''' fmt = '''(EN2.1E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_563(self): inp = '''123456789.''' fmt = '''(EN2.1E5)''' result = [1.2000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_564(self): inp = '''0.1''' fmt = '''(EN2.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_565(self): inp = '''-0.1''' fmt = '''(EN2.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_566(self): inp = '''0.01''' fmt = '''(EN2.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_567(self): inp = '''-0.01''' fmt = '''(EN2.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_568(self): inp = '''0.001''' fmt = '''(EN2.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_569(self): inp = '''-0.001''' fmt = '''(EN2.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_570(self): inp = '''0.0001''' fmt = '''(EN2.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_571(self): inp = '''-0.0001''' fmt = '''(EN2.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_572(self): inp = '''-1.96e-16''' fmt = '''(EN2.1E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_573(self): inp = '''3.14159''' fmt = '''(EN2.1E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_574(self): inp = '''- 1.0''' fmt = '''(EN2.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_575(self): inp = '''1e12''' fmt = '''(EN2.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_576(self): inp = '''1E12''' fmt = '''(EN2.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_577(self): inp = '''-1 e12''' fmt = '''(EN2.1E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_578(self): inp = '''.''' fmt = '''(EN2.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_579(self): inp = '''.1''' fmt = '''(EN2.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_580(self): inp = '''0.1D+200''' fmt = '''(EN2.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_581(self): inp = '''3.''' fmt = '''(EN3.1E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_582(self): inp = '''-3.''' fmt = '''(EN3.1E5)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_583(self): inp = '''10.''' fmt = '''(EN3.1E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_584(self): inp = '''-10.''' fmt = '''(EN3.1E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_585(self): inp = '''100.''' fmt = '''(EN3.1E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_586(self): inp = '''-100.''' fmt = '''(EN3.1E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_587(self): inp = '''1000.''' fmt = '''(EN3.1E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_588(self): inp = '''-1000.''' fmt = '''(EN3.1E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_589(self): inp = '''10000.''' fmt = '''(EN3.1E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_590(self): inp = '''-10000.''' fmt = '''(EN3.1E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_591(self): inp = '''100000.''' fmt = '''(EN3.1E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_592(self): inp = '''-100000.''' fmt = '''(EN3.1E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_593(self): inp = '''123456789.''' fmt = '''(EN3.1E5)''' result = [1.2300000000000001e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_594(self): inp = '''0.1''' fmt = '''(EN3.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_595(self): inp = '''-0.1''' fmt = '''(EN3.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_596(self): inp = '''0.01''' fmt = '''(EN3.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_597(self): inp = '''-0.01''' fmt = '''(EN3.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_598(self): inp = '''0.001''' fmt = '''(EN3.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_599(self): inp = '''-0.001''' fmt = '''(EN3.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_600(self): inp = '''0.0001''' fmt = '''(EN3.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_601(self): inp = '''-0.0001''' fmt = '''(EN3.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_602(self): inp = '''-1.96e-16''' fmt = '''(EN3.1E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_603(self): inp = '''3.14159''' fmt = '''(EN3.1E5)''' result = [3.1000000000000001e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_604(self): inp = '''- 1.0''' fmt = '''(EN3.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_605(self): inp = '''1e12''' fmt = '''(EN3.1E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_606(self): inp = '''1E12''' fmt = '''(EN3.1E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_607(self): inp = '''-1 e12''' fmt = '''(EN3.1E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_608(self): inp = '''.''' fmt = '''(EN3.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_609(self): inp = '''.1''' fmt = '''(EN3.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_610(self): inp = '''0.1D+200''' fmt = '''(EN3.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_611(self): inp = '''3.''' fmt = '''(EN4.1E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_612(self): inp = '''-3.''' fmt = '''(EN4.1E5)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_613(self): inp = '''10.''' fmt = '''(EN4.1E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_614(self): inp = '''-10.''' fmt = '''(EN4.1E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_615(self): inp = '''100.''' fmt = '''(EN4.1E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_616(self): inp = '''-100.''' fmt = '''(EN4.1E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_617(self): inp = '''1000.''' fmt = '''(EN4.1E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_618(self): inp = '''-1000.''' fmt = '''(EN4.1E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_619(self): inp = '''10000.''' fmt = '''(EN4.1E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_620(self): inp = '''-10000.''' fmt = '''(EN4.1E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_621(self): inp = '''100000.''' fmt = '''(EN4.1E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_622(self): inp = '''-100000.''' fmt = '''(EN4.1E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_623(self): inp = '''123456789.''' fmt = '''(EN4.1E5)''' result = [1.2340000000000001e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_624(self): inp = '''0.1''' fmt = '''(EN4.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_625(self): inp = '''-0.1''' fmt = '''(EN4.1E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_626(self): inp = '''0.01''' fmt = '''(EN4.1E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_627(self): inp = '''-0.01''' fmt = '''(EN4.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_628(self): inp = '''0.001''' fmt = '''(EN4.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_629(self): inp = '''-0.001''' fmt = '''(EN4.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_630(self): inp = '''0.0001''' fmt = '''(EN4.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_631(self): inp = '''-0.0001''' fmt = '''(EN4.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_632(self): inp = '''-1.96e-16''' fmt = '''(EN4.1E5)''' result = [-1.8999999999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_633(self): inp = '''3.14159''' fmt = '''(EN4.1E5)''' result = [3.1400000000000001e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_634(self): inp = '''- 1.0''' fmt = '''(EN4.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_635(self): inp = '''1e12''' fmt = '''(EN4.1E5)''' result = [1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_636(self): inp = '''1E12''' fmt = '''(EN4.1E5)''' result = [1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_637(self): inp = '''-1 e12''' fmt = '''(EN4.1E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_638(self): inp = '''.''' fmt = '''(EN4.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_639(self): inp = '''.1''' fmt = '''(EN4.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_640(self): inp = '''0.1D+200''' fmt = '''(EN4.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_641(self): inp = '''3.''' fmt = '''(EN5.1E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_642(self): inp = '''-3.''' fmt = '''(EN5.1E5)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_643(self): inp = '''10.''' fmt = '''(EN5.1E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_644(self): inp = '''-10.''' fmt = '''(EN5.1E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_645(self): inp = '''100.''' fmt = '''(EN5.1E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_646(self): inp = '''-100.''' fmt = '''(EN5.1E5)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_647(self): inp = '''1000.''' fmt = '''(EN5.1E5)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_648(self): inp = '''-1000.''' fmt = '''(EN5.1E5)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_649(self): inp = '''10000.''' fmt = '''(EN5.1E5)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_650(self): inp = '''-10000.''' fmt = '''(EN5.1E5)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_651(self): inp = '''100000.''' fmt = '''(EN5.1E5)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_652(self): inp = '''-100000.''' fmt = '''(EN5.1E5)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_653(self): inp = '''123456789.''' fmt = '''(EN5.1E5)''' result = [1.2345000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_654(self): inp = '''0.1''' fmt = '''(EN5.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_655(self): inp = '''-0.1''' fmt = '''(EN5.1E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_656(self): inp = '''0.01''' fmt = '''(EN5.1E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_657(self): inp = '''-0.01''' fmt = '''(EN5.1E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_658(self): inp = '''0.001''' fmt = '''(EN5.1E5)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_659(self): inp = '''-0.001''' fmt = '''(EN5.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_660(self): inp = '''0.0001''' fmt = '''(EN5.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_661(self): inp = '''-0.0001''' fmt = '''(EN5.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_662(self): inp = '''-1.96e-16''' fmt = '''(EN5.1E5)''' result = [-1.9600000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_663(self): inp = '''3.14159''' fmt = '''(EN5.1E5)''' result = [3.1410000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_664(self): inp = '''- 1.0''' fmt = '''(EN5.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_665(self): inp = '''1e12''' fmt = '''(EN5.1E5)''' result = [1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_666(self): inp = '''1E12''' fmt = '''(EN5.1E5)''' result = [1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_667(self): inp = '''-1 e12''' fmt = '''(EN5.1E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_668(self): inp = '''.''' fmt = '''(EN5.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_669(self): inp = '''.1''' fmt = '''(EN5.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_670(self): inp = '''0.1D+200''' fmt = '''(EN5.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_671(self): inp = '''3.''' fmt = '''(EN10.1E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_672(self): inp = '''-3.''' fmt = '''(EN10.1E5)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_673(self): inp = '''10.''' fmt = '''(EN10.1E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_674(self): inp = '''-10.''' fmt = '''(EN10.1E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_675(self): inp = '''100.''' fmt = '''(EN10.1E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_676(self): inp = '''-100.''' fmt = '''(EN10.1E5)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_677(self): inp = '''1000.''' fmt = '''(EN10.1E5)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_678(self): inp = '''-1000.''' fmt = '''(EN10.1E5)''' result = [-1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_679(self): inp = '''10000.''' fmt = '''(EN10.1E5)''' result = [1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_680(self): inp = '''-10000.''' fmt = '''(EN10.1E5)''' result = [-1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_681(self): inp = '''100000.''' fmt = '''(EN10.1E5)''' result = [1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_682(self): inp = '''-100000.''' fmt = '''(EN10.1E5)''' result = [-1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_683(self): inp = '''123456789.''' fmt = '''(EN10.1E5)''' result = [1.2345678900000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_684(self): inp = '''0.1''' fmt = '''(EN10.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_685(self): inp = '''-0.1''' fmt = '''(EN10.1E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_686(self): inp = '''0.01''' fmt = '''(EN10.1E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_687(self): inp = '''-0.01''' fmt = '''(EN10.1E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_688(self): inp = '''0.001''' fmt = '''(EN10.1E5)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_689(self): inp = '''-0.001''' fmt = '''(EN10.1E5)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_690(self): inp = '''0.0001''' fmt = '''(EN10.1E5)''' result = [1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_691(self): inp = '''-0.0001''' fmt = '''(EN10.1E5)''' result = [-1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_692(self): inp = '''-1.96e-16''' fmt = '''(EN10.1E5)''' result = [-1.9600000000000000e-16] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_693(self): inp = '''3.14159''' fmt = '''(EN10.1E5)''' result = [3.1415899999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_694(self): inp = '''- 1.0''' fmt = '''(EN10.1E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_695(self): inp = '''1e12''' fmt = '''(EN10.1E5)''' result = [1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_696(self): inp = '''1E12''' fmt = '''(EN10.1E5)''' result = [1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_697(self): inp = '''-1 e12''' fmt = '''(EN10.1E5)''' result = [-1.0000000000000000e+11] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_698(self): inp = '''.''' fmt = '''(EN10.1E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_699(self): inp = '''.1''' fmt = '''(EN10.1E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_700(self): inp = '''0.1D+200''' fmt = '''(EN10.1E5)''' result = [1.0000000000000001e+199] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_701(self): inp = '''3.''' fmt = '''(EN2.2E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_702(self): inp = '''-3.''' fmt = '''(EN2.2E5)''' result = [-2.9999999999999999e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_703(self): inp = '''10.''' fmt = '''(EN2.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_704(self): inp = '''-10.''' fmt = '''(EN2.2E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_705(self): inp = '''100.''' fmt = '''(EN2.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_706(self): inp = '''-100.''' fmt = '''(EN2.2E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_707(self): inp = '''1000.''' fmt = '''(EN2.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_708(self): inp = '''-1000.''' fmt = '''(EN2.2E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_709(self): inp = '''10000.''' fmt = '''(EN2.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_710(self): inp = '''-10000.''' fmt = '''(EN2.2E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_711(self): inp = '''100000.''' fmt = '''(EN2.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_712(self): inp = '''-100000.''' fmt = '''(EN2.2E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_713(self): inp = '''123456789.''' fmt = '''(EN2.2E5)''' result = [1.2000000000000000e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_714(self): inp = '''0.1''' fmt = '''(EN2.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_715(self): inp = '''-0.1''' fmt = '''(EN2.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_716(self): inp = '''0.01''' fmt = '''(EN2.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_717(self): inp = '''-0.01''' fmt = '''(EN2.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_718(self): inp = '''0.001''' fmt = '''(EN2.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_719(self): inp = '''-0.001''' fmt = '''(EN2.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_720(self): inp = '''0.0001''' fmt = '''(EN2.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_721(self): inp = '''-0.0001''' fmt = '''(EN2.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_722(self): inp = '''-1.96e-16''' fmt = '''(EN2.2E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_723(self): inp = '''3.14159''' fmt = '''(EN2.2E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_724(self): inp = '''- 1.0''' fmt = '''(EN2.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_725(self): inp = '''1e12''' fmt = '''(EN2.2E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_726(self): inp = '''1E12''' fmt = '''(EN2.2E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_727(self): inp = '''-1 e12''' fmt = '''(EN2.2E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_728(self): inp = '''.''' fmt = '''(EN2.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_729(self): inp = '''.1''' fmt = '''(EN2.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_730(self): inp = '''0.1D+200''' fmt = '''(EN2.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_731(self): inp = '''3.''' fmt = '''(EN3.2E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_732(self): inp = '''-3.''' fmt = '''(EN3.2E5)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_733(self): inp = '''10.''' fmt = '''(EN3.2E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_734(self): inp = '''-10.''' fmt = '''(EN3.2E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_735(self): inp = '''100.''' fmt = '''(EN3.2E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_736(self): inp = '''-100.''' fmt = '''(EN3.2E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_737(self): inp = '''1000.''' fmt = '''(EN3.2E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_738(self): inp = '''-1000.''' fmt = '''(EN3.2E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_739(self): inp = '''10000.''' fmt = '''(EN3.2E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_740(self): inp = '''-10000.''' fmt = '''(EN3.2E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_741(self): inp = '''100000.''' fmt = '''(EN3.2E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_742(self): inp = '''-100000.''' fmt = '''(EN3.2E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_743(self): inp = '''123456789.''' fmt = '''(EN3.2E5)''' result = [1.2300000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_744(self): inp = '''0.1''' fmt = '''(EN3.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_745(self): inp = '''-0.1''' fmt = '''(EN3.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_746(self): inp = '''0.01''' fmt = '''(EN3.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_747(self): inp = '''-0.01''' fmt = '''(EN3.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_748(self): inp = '''0.001''' fmt = '''(EN3.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_749(self): inp = '''-0.001''' fmt = '''(EN3.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_750(self): inp = '''0.0001''' fmt = '''(EN3.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_751(self): inp = '''-0.0001''' fmt = '''(EN3.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_752(self): inp = '''-1.96e-16''' fmt = '''(EN3.2E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_753(self): inp = '''3.14159''' fmt = '''(EN3.2E5)''' result = [3.1000000000000001e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_754(self): inp = '''- 1.0''' fmt = '''(EN3.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_755(self): inp = '''1e12''' fmt = '''(EN3.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_756(self): inp = '''1E12''' fmt = '''(EN3.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_757(self): inp = '''-1 e12''' fmt = '''(EN3.2E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_758(self): inp = '''.''' fmt = '''(EN3.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_759(self): inp = '''.1''' fmt = '''(EN3.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_760(self): inp = '''0.1D+200''' fmt = '''(EN3.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_761(self): inp = '''3.''' fmt = '''(EN4.2E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_762(self): inp = '''-3.''' fmt = '''(EN4.2E5)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_763(self): inp = '''10.''' fmt = '''(EN4.2E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_764(self): inp = '''-10.''' fmt = '''(EN4.2E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_765(self): inp = '''100.''' fmt = '''(EN4.2E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_766(self): inp = '''-100.''' fmt = '''(EN4.2E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_767(self): inp = '''1000.''' fmt = '''(EN4.2E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_768(self): inp = '''-1000.''' fmt = '''(EN4.2E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_769(self): inp = '''10000.''' fmt = '''(EN4.2E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_770(self): inp = '''-10000.''' fmt = '''(EN4.2E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_771(self): inp = '''100000.''' fmt = '''(EN4.2E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_772(self): inp = '''-100000.''' fmt = '''(EN4.2E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_773(self): inp = '''123456789.''' fmt = '''(EN4.2E5)''' result = [1.2340000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_774(self): inp = '''0.1''' fmt = '''(EN4.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_775(self): inp = '''-0.1''' fmt = '''(EN4.2E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_776(self): inp = '''0.01''' fmt = '''(EN4.2E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_777(self): inp = '''-0.01''' fmt = '''(EN4.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_778(self): inp = '''0.001''' fmt = '''(EN4.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_779(self): inp = '''-0.001''' fmt = '''(EN4.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_780(self): inp = '''0.0001''' fmt = '''(EN4.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_781(self): inp = '''-0.0001''' fmt = '''(EN4.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_782(self): inp = '''-1.96e-16''' fmt = '''(EN4.2E5)''' result = [-1.8999999999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_783(self): inp = '''3.14159''' fmt = '''(EN4.2E5)''' result = [3.1400000000000001e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_784(self): inp = '''- 1.0''' fmt = '''(EN4.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_785(self): inp = '''1e12''' fmt = '''(EN4.2E5)''' result = [1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_786(self): inp = '''1E12''' fmt = '''(EN4.2E5)''' result = [1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_787(self): inp = '''-1 e12''' fmt = '''(EN4.2E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_788(self): inp = '''.''' fmt = '''(EN4.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_789(self): inp = '''.1''' fmt = '''(EN4.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_790(self): inp = '''0.1D+200''' fmt = '''(EN4.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_791(self): inp = '''3.''' fmt = '''(EN5.2E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_792(self): inp = '''-3.''' fmt = '''(EN5.2E5)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_793(self): inp = '''10.''' fmt = '''(EN5.2E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_794(self): inp = '''-10.''' fmt = '''(EN5.2E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_795(self): inp = '''100.''' fmt = '''(EN5.2E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_796(self): inp = '''-100.''' fmt = '''(EN5.2E5)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_797(self): inp = '''1000.''' fmt = '''(EN5.2E5)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_798(self): inp = '''-1000.''' fmt = '''(EN5.2E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_799(self): inp = '''10000.''' fmt = '''(EN5.2E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_800(self): inp = '''-10000.''' fmt = '''(EN5.2E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_801(self): inp = '''100000.''' fmt = '''(EN5.2E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_802(self): inp = '''-100000.''' fmt = '''(EN5.2E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_803(self): inp = '''123456789.''' fmt = '''(EN5.2E5)''' result = [1.2345000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_804(self): inp = '''0.1''' fmt = '''(EN5.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_805(self): inp = '''-0.1''' fmt = '''(EN5.2E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_806(self): inp = '''0.01''' fmt = '''(EN5.2E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_807(self): inp = '''-0.01''' fmt = '''(EN5.2E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_808(self): inp = '''0.001''' fmt = '''(EN5.2E5)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_809(self): inp = '''-0.001''' fmt = '''(EN5.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_810(self): inp = '''0.0001''' fmt = '''(EN5.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_811(self): inp = '''-0.0001''' fmt = '''(EN5.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_812(self): inp = '''-1.96e-16''' fmt = '''(EN5.2E5)''' result = [-1.9600000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_813(self): inp = '''3.14159''' fmt = '''(EN5.2E5)''' result = [3.1410000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_814(self): inp = '''- 1.0''' fmt = '''(EN5.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_815(self): inp = '''1e12''' fmt = '''(EN5.2E5)''' result = [1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_816(self): inp = '''1E12''' fmt = '''(EN5.2E5)''' result = [1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_817(self): inp = '''-1 e12''' fmt = '''(EN5.2E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_818(self): inp = '''.''' fmt = '''(EN5.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_819(self): inp = '''.1''' fmt = '''(EN5.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_820(self): inp = '''0.1D+200''' fmt = '''(EN5.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_821(self): inp = '''3.''' fmt = '''(EN10.2E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_822(self): inp = '''-3.''' fmt = '''(EN10.2E5)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_823(self): inp = '''10.''' fmt = '''(EN10.2E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_824(self): inp = '''-10.''' fmt = '''(EN10.2E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_825(self): inp = '''100.''' fmt = '''(EN10.2E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_826(self): inp = '''-100.''' fmt = '''(EN10.2E5)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_827(self): inp = '''1000.''' fmt = '''(EN10.2E5)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_828(self): inp = '''-1000.''' fmt = '''(EN10.2E5)''' result = [-1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_829(self): inp = '''10000.''' fmt = '''(EN10.2E5)''' result = [1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_830(self): inp = '''-10000.''' fmt = '''(EN10.2E5)''' result = [-1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_831(self): inp = '''100000.''' fmt = '''(EN10.2E5)''' result = [1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_832(self): inp = '''-100000.''' fmt = '''(EN10.2E5)''' result = [-1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_833(self): inp = '''123456789.''' fmt = '''(EN10.2E5)''' result = [1.2345678900000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_834(self): inp = '''0.1''' fmt = '''(EN10.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_835(self): inp = '''-0.1''' fmt = '''(EN10.2E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_836(self): inp = '''0.01''' fmt = '''(EN10.2E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_837(self): inp = '''-0.01''' fmt = '''(EN10.2E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_838(self): inp = '''0.001''' fmt = '''(EN10.2E5)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_839(self): inp = '''-0.001''' fmt = '''(EN10.2E5)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_840(self): inp = '''0.0001''' fmt = '''(EN10.2E5)''' result = [1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_841(self): inp = '''-0.0001''' fmt = '''(EN10.2E5)''' result = [-1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_842(self): inp = '''-1.96e-16''' fmt = '''(EN10.2E5)''' result = [-1.9600000000000000e-16] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_843(self): inp = '''3.14159''' fmt = '''(EN10.2E5)''' result = [3.1415899999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_844(self): inp = '''- 1.0''' fmt = '''(EN10.2E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_845(self): inp = '''1e12''' fmt = '''(EN10.2E5)''' result = [1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_846(self): inp = '''1E12''' fmt = '''(EN10.2E5)''' result = [1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_847(self): inp = '''-1 e12''' fmt = '''(EN10.2E5)''' result = [-1.0000000000000000e+10] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_848(self): inp = '''.''' fmt = '''(EN10.2E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_849(self): inp = '''.1''' fmt = '''(EN10.2E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_850(self): inp = '''0.1D+200''' fmt = '''(EN10.2E5)''' result = [1.0000000000000001e+199] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_851(self): inp = '''3.''' fmt = '''(EN3.3E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_852(self): inp = '''-3.''' fmt = '''(EN3.3E5)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_853(self): inp = '''10.''' fmt = '''(EN3.3E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_854(self): inp = '''-10.''' fmt = '''(EN3.3E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_855(self): inp = '''100.''' fmt = '''(EN3.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_856(self): inp = '''-100.''' fmt = '''(EN3.3E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_857(self): inp = '''1000.''' fmt = '''(EN3.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_858(self): inp = '''-1000.''' fmt = '''(EN3.3E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_859(self): inp = '''10000.''' fmt = '''(EN3.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_860(self): inp = '''-10000.''' fmt = '''(EN3.3E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_861(self): inp = '''100000.''' fmt = '''(EN3.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_862(self): inp = '''-100000.''' fmt = '''(EN3.3E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_863(self): inp = '''123456789.''' fmt = '''(EN3.3E5)''' result = [1.2300000000000000e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_864(self): inp = '''0.1''' fmt = '''(EN3.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_865(self): inp = '''-0.1''' fmt = '''(EN3.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_866(self): inp = '''0.01''' fmt = '''(EN3.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_867(self): inp = '''-0.01''' fmt = '''(EN3.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_868(self): inp = '''0.001''' fmt = '''(EN3.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_869(self): inp = '''-0.001''' fmt = '''(EN3.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_870(self): inp = '''0.0001''' fmt = '''(EN3.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_871(self): inp = '''-0.0001''' fmt = '''(EN3.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_872(self): inp = '''-1.96e-16''' fmt = '''(EN3.3E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_873(self): inp = '''3.14159''' fmt = '''(EN3.3E5)''' result = [3.1000000000000001e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_874(self): inp = '''- 1.0''' fmt = '''(EN3.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_875(self): inp = '''1e12''' fmt = '''(EN3.3E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_876(self): inp = '''1E12''' fmt = '''(EN3.3E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_877(self): inp = '''-1 e12''' fmt = '''(EN3.3E5)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_878(self): inp = '''.''' fmt = '''(EN3.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_879(self): inp = '''.1''' fmt = '''(EN3.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_880(self): inp = '''0.1D+200''' fmt = '''(EN3.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_881(self): inp = '''3.''' fmt = '''(EN4.3E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_882(self): inp = '''-3.''' fmt = '''(EN4.3E5)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_883(self): inp = '''10.''' fmt = '''(EN4.3E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_884(self): inp = '''-10.''' fmt = '''(EN4.3E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_885(self): inp = '''100.''' fmt = '''(EN4.3E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_886(self): inp = '''-100.''' fmt = '''(EN4.3E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_887(self): inp = '''1000.''' fmt = '''(EN4.3E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_888(self): inp = '''-1000.''' fmt = '''(EN4.3E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_889(self): inp = '''10000.''' fmt = '''(EN4.3E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_890(self): inp = '''-10000.''' fmt = '''(EN4.3E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_891(self): inp = '''100000.''' fmt = '''(EN4.3E5)''' result = [1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_892(self): inp = '''-100000.''' fmt = '''(EN4.3E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_893(self): inp = '''123456789.''' fmt = '''(EN4.3E5)''' result = [1.2340000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_894(self): inp = '''0.1''' fmt = '''(EN4.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_895(self): inp = '''-0.1''' fmt = '''(EN4.3E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_896(self): inp = '''0.01''' fmt = '''(EN4.3E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_897(self): inp = '''-0.01''' fmt = '''(EN4.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_898(self): inp = '''0.001''' fmt = '''(EN4.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_899(self): inp = '''-0.001''' fmt = '''(EN4.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_900(self): inp = '''0.0001''' fmt = '''(EN4.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_901(self): inp = '''-0.0001''' fmt = '''(EN4.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_902(self): inp = '''-1.96e-16''' fmt = '''(EN4.3E5)''' result = [-1.8999999999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_903(self): inp = '''3.14159''' fmt = '''(EN4.3E5)''' result = [3.1400000000000001e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_904(self): inp = '''- 1.0''' fmt = '''(EN4.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_905(self): inp = '''1e12''' fmt = '''(EN4.3E5)''' result = [1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_906(self): inp = '''1E12''' fmt = '''(EN4.3E5)''' result = [1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_907(self): inp = '''-1 e12''' fmt = '''(EN4.3E5)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_908(self): inp = '''.''' fmt = '''(EN4.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_909(self): inp = '''.1''' fmt = '''(EN4.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_910(self): inp = '''0.1D+200''' fmt = '''(EN4.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_911(self): inp = '''3.''' fmt = '''(EN5.3E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_912(self): inp = '''-3.''' fmt = '''(EN5.3E5)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_913(self): inp = '''10.''' fmt = '''(EN5.3E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_914(self): inp = '''-10.''' fmt = '''(EN5.3E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_915(self): inp = '''100.''' fmt = '''(EN5.3E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_916(self): inp = '''-100.''' fmt = '''(EN5.3E5)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_917(self): inp = '''1000.''' fmt = '''(EN5.3E5)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_918(self): inp = '''-1000.''' fmt = '''(EN5.3E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_919(self): inp = '''10000.''' fmt = '''(EN5.3E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_920(self): inp = '''-10000.''' fmt = '''(EN5.3E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_921(self): inp = '''100000.''' fmt = '''(EN5.3E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_922(self): inp = '''-100000.''' fmt = '''(EN5.3E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_923(self): inp = '''123456789.''' fmt = '''(EN5.3E5)''' result = [1.2345000000000001e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_924(self): inp = '''0.1''' fmt = '''(EN5.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_925(self): inp = '''-0.1''' fmt = '''(EN5.3E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_926(self): inp = '''0.01''' fmt = '''(EN5.3E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_927(self): inp = '''-0.01''' fmt = '''(EN5.3E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_928(self): inp = '''0.001''' fmt = '''(EN5.3E5)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_929(self): inp = '''-0.001''' fmt = '''(EN5.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_930(self): inp = '''0.0001''' fmt = '''(EN5.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_931(self): inp = '''-0.0001''' fmt = '''(EN5.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_932(self): inp = '''-1.96e-16''' fmt = '''(EN5.3E5)''' result = [-1.9600000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_933(self): inp = '''3.14159''' fmt = '''(EN5.3E5)''' result = [3.1410000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_934(self): inp = '''- 1.0''' fmt = '''(EN5.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_935(self): inp = '''1e12''' fmt = '''(EN5.3E5)''' result = [1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_936(self): inp = '''1E12''' fmt = '''(EN5.3E5)''' result = [1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_937(self): inp = '''-1 e12''' fmt = '''(EN5.3E5)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_938(self): inp = '''.''' fmt = '''(EN5.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_939(self): inp = '''.1''' fmt = '''(EN5.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_940(self): inp = '''0.1D+200''' fmt = '''(EN5.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_941(self): inp = '''3.''' fmt = '''(EN10.3E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_942(self): inp = '''-3.''' fmt = '''(EN10.3E5)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_943(self): inp = '''10.''' fmt = '''(EN10.3E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_944(self): inp = '''-10.''' fmt = '''(EN10.3E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_945(self): inp = '''100.''' fmt = '''(EN10.3E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_946(self): inp = '''-100.''' fmt = '''(EN10.3E5)''' result = [-1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_947(self): inp = '''1000.''' fmt = '''(EN10.3E5)''' result = [1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_948(self): inp = '''-1000.''' fmt = '''(EN10.3E5)''' result = [-1.0000000000000000e+03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_949(self): inp = '''10000.''' fmt = '''(EN10.3E5)''' result = [1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_950(self): inp = '''-10000.''' fmt = '''(EN10.3E5)''' result = [-1.0000000000000000e+04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_951(self): inp = '''100000.''' fmt = '''(EN10.3E5)''' result = [1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_952(self): inp = '''-100000.''' fmt = '''(EN10.3E5)''' result = [-1.0000000000000000e+05] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_953(self): inp = '''123456789.''' fmt = '''(EN10.3E5)''' result = [1.2345678900000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_954(self): inp = '''0.1''' fmt = '''(EN10.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_955(self): inp = '''-0.1''' fmt = '''(EN10.3E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_956(self): inp = '''0.01''' fmt = '''(EN10.3E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_957(self): inp = '''-0.01''' fmt = '''(EN10.3E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_958(self): inp = '''0.001''' fmt = '''(EN10.3E5)''' result = [1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_959(self): inp = '''-0.001''' fmt = '''(EN10.3E5)''' result = [-1.0000000000000000e-03] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_960(self): inp = '''0.0001''' fmt = '''(EN10.3E5)''' result = [1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_961(self): inp = '''-0.0001''' fmt = '''(EN10.3E5)''' result = [-1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_962(self): inp = '''-1.96e-16''' fmt = '''(EN10.3E5)''' result = [-1.9600000000000000e-16] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_963(self): inp = '''3.14159''' fmt = '''(EN10.3E5)''' result = [3.1415899999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_964(self): inp = '''- 1.0''' fmt = '''(EN10.3E5)''' result = [-1.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_965(self): inp = '''1e12''' fmt = '''(EN10.3E5)''' result = [1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_966(self): inp = '''1E12''' fmt = '''(EN10.3E5)''' result = [1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_967(self): inp = '''-1 e12''' fmt = '''(EN10.3E5)''' result = [-1.0000000000000000e+09] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_968(self): inp = '''.''' fmt = '''(EN10.3E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_969(self): inp = '''.1''' fmt = '''(EN10.3E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_970(self): inp = '''0.1D+200''' fmt = '''(EN10.3E5)''' result = [1.0000000000000001e+199] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_971(self): inp = '''3.''' fmt = '''(EN4.4E5)''' result = [3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_972(self): inp = '''-3.''' fmt = '''(EN4.4E5)''' result = [-3.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_973(self): inp = '''10.''' fmt = '''(EN4.4E5)''' result = [1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_974(self): inp = '''-10.''' fmt = '''(EN4.4E5)''' result = [-1.0000000000000000e+01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_975(self): inp = '''100.''' fmt = '''(EN4.4E5)''' result = [1.0000000000000000e+02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_976(self): inp = '''-100.''' fmt = '''(EN4.4E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_977(self): inp = '''1000.''' fmt = '''(EN4.4E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_978(self): inp = '''-1000.''' fmt = '''(EN4.4E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_979(self): inp = '''10000.''' fmt = '''(EN4.4E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_980(self): inp = '''-10000.''' fmt = '''(EN4.4E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_981(self): inp = '''100000.''' fmt = '''(EN4.4E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_982(self): inp = '''-100000.''' fmt = '''(EN4.4E5)''' result = [-1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_983(self): inp = '''123456789.''' fmt = '''(EN4.4E5)''' result = [1.2340000000000000e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_984(self): inp = '''0.1''' fmt = '''(EN4.4E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_985(self): inp = '''-0.1''' fmt = '''(EN4.4E5)''' result = [-1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_986(self): inp = '''0.01''' fmt = '''(EN4.4E5)''' result = [1.0000000000000000e-02] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_987(self): inp = '''-0.01''' fmt = '''(EN4.4E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_988(self): inp = '''0.001''' fmt = '''(EN4.4E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_989(self): inp = '''-0.001''' fmt = '''(EN4.4E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_990(self): inp = '''0.0001''' fmt = '''(EN4.4E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_991(self): inp = '''-0.0001''' fmt = '''(EN4.4E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_992(self): inp = '''-1.96e-16''' fmt = '''(EN4.4E5)''' result = [-1.8999999999999999e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_993(self): inp = '''3.14159''' fmt = '''(EN4.4E5)''' result = [3.1400000000000001e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_994(self): inp = '''- 1.0''' fmt = '''(EN4.4E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_995(self): inp = '''1e12''' fmt = '''(EN4.4E5)''' result = [1.0000000000000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_996(self): inp = '''1E12''' fmt = '''(EN4.4E5)''' result = [1.0000000000000000e+08] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_997(self): inp = '''-1 e12''' fmt = '''(EN4.4E5)''' result = [-1.0000000000000000e-04] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_998(self): inp = '''.''' fmt = '''(EN4.4E5)''' result = [0.0000000000000000e+00] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) @attr(platform='9-1_linux_intel') @attr('input') @attr(ed='EN') def test_en_ed_input_999(self): inp = '''.1''' fmt = '''(EN4.4E5)''' result = [1.0000000000000001e-01] eds, rev_eds = _parser(_lexer(fmt)) self.assertEqual(result, _input(eds, rev_eds, inp)) if __name__ == '__main__': unittest.main()
sql_locations = [ "/opt/skytools2/share/skytools", ] package_version = "2.1.13"
from unittest import mock import json import unittest from src.backend.vt import manager import tests class TestFunctions(unittest.TestCase): @mock.patch("src.backend.vt.extractor.RequestIP") def test_get_analysis_of_ip(self, mock_request_ip): with open(tests.IP_RESPONSE_PATH, "r") as f: vt_response = json.load(f) mock_request_ip().get_analysis.return_value = vt_response ip = "8.8.8.8" result = manager.get_analysis_of_ip(ip) self.assertEqual( { "ip": ip, "malicious": 1, "suspicious": 0, "harmless": 79, "lastModificationDate": "2021-12-05 11:49:41", }, result.data, ) if __name__ == "__main__": unittest.main()
import fileinput class odor(): def __init__(self, index, name, glom_weights): self.index = index self.name = name self.glom_weights = glom_weights odors = {} # by name for line in fileinput.input('input-odors.txt'): data = line.split('\t') odors.update({data[0]: odor(fileinput.lineno(), data[0], [float(i) for i in data[1:]])}) if __name__ == '__main__': for name in odors: print name, odors[name].index from mayavi.mlab import barchart, show barchart([odors[name].glom_weights for name in odors]) show()
#! /usr/bin/env python # example of for loop in advance # example of parallel iteration names = ['anne', 'beth', 'george', 'damon'] ages = [12, 45, 32, 102] for i in range(len(names)): print names[i], 'is', ages[i], 'years old' # parallel iteration is the built-in function zip print "using zip:", zip(names, ages) for name, age in zip(names, ages): print name, 'is', age, 'years old' # example of numbered iteration index = 0 for string in names: if 'n' in string: names[index] = '[censored]' index += 1 print "final values of names:", names
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- def cf_devcenter_cl(cli_ctx, *_): from azure.cli.core.commands.client_factory import get_mgmt_service_client from azext_devcenter.vendored_sdks.devcenter import DevCenter return get_mgmt_service_client(cli_ctx, DevCenter) def cf_dev_center(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).dev_centers def cf_project(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).projects def cf_attached_network(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).attached_networks def cf_gallery(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).galleries def cf_image(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).images def cf_image_version(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).image_versions def cf_catalog(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).catalogs def cf_environment_type(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).environment_types def cf_project_environment_type(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).project_environment_types def cf_dev_box_definition(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).dev_box_definitions def cf_operation_statuses(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).operation_statuses def cf_usage(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).usages def cf_sku(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).skus def cf_pool(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).pools def cf_schedule(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).schedules def cf_network_connection(cli_ctx, *_): return cf_devcenter_cl(cli_ctx).network_connections
class Solution(object): def pow(self, n, a): result = 1 while a > 0: if a % 2: result = int((result * n) % 1000000007) n = int((n ** 2) % 1000000007) a //= 2 return result def cuttingRope(self, n): """ :type n: int :rtype: int """ if n <= 3: return n - 1 num3 = n / 3 return int((self.pow(3, num3), self.pow(3, num3-1) * 4, self.pow(3, num3) * 2)[n % 3] % 1000000007)
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. # Standard imports import json import os from datetime import datetime, timedelta # Third party imports import numpy as np import pandas as pd import rasterio import xarray as xr from statsmodels.nonparametric.smoothers_lowess import lowess def ard_preprocess( sat_file_links, w_df, sat_res_x, var_name, interp_date_start, interp_date_end, w_parms, input_days, output_days, ref_tm, w_mn, w_sd, ): """ This method takes boundary satellite paths and weather data, creates Analysis Ready DataSet (ARD) # TODO: Add doc string or re-arrange parameters """ sat_file_links["sat_data"] = [ rasterio.open(x).read(1) for x in sat_file_links.filePath.values ] getgeo1 = rasterio.open( sat_file_links.filePath.values[0] ).transform # coordinates of farm sat_data = np.array(sat_file_links.sat_data.values.tolist()) msk = np.broadcast_to( np.mean(sat_data == 0, axis=0) < 1, sat_data.shape ) # mask for removing pixels with 0 value always sat_data1 = np.where(msk, sat_data, np.nan)[ :, ::sat_res_x, ::sat_res_x ] # spatial sampling idx = pd.date_range(interp_date_start, interp_date_end) # interpolation range idx_time = pd.date_range( w_df.dateTime.sort_values().values[0][:10], w_df.dateTime.sort_values(ascending=False).values[0][:10], ) # read satellite data into data array data_array = ( xr.DataArray( sat_data1, [ ("time", pd.to_datetime(sat_file_links.sceneDateTime).dt.date), ( "lat", getgeo1[5] + getgeo1[4] * sat_res_x * np.arange(sat_data1.shape[1]), ), ( "long", getgeo1[2] + getgeo1[0] * sat_res_x * np.arange(sat_data1.shape[2]), ), ], ) .to_dataframe(var_name) .dropna() .unstack(level=[1, 2]) ) # lowess smoothing to remove outliers and cubic spline interpolation data_array = data_array.sort_index(ascending=True) ## Sort before calculating xvals xvals = (pd.Series(data_array.index) - data_array.index.values[0]).dt.days data_inter = pd.DataFrame( { x: lowess(data_array[x], xvals, is_sorted=True, frac=0.2, it=0)[:, 1] for x in data_array.columns } ) data_inter.index = data_array.index data_comb_array = ( data_inter.reindex(idx, fill_value=np.nan) .interpolate(method="cubic", limit_direction="both", limit=100) .reindex(idx_time, fill_value=np.nan) ) # Read Weather Data and normalization w_df[w_parms] = (w_df[w_parms] - w_mn) / (np.maximum(w_sd, 0.001)) w_df["time"] = pd.to_datetime(w_df.dateTime).dt.date # combine interpolated satellite data array with weather data data_comb_df = ( data_comb_array.stack([1, 2], dropna=False) .rename_axis(["time", "lat", "long"]) .reset_index() ) data_comb_df["time"] = pd.to_datetime(data_comb_df.time).dt.date data_comb_df = data_comb_df.merge(w_df, on=["time"], how="inner").sort_values(["lat", "long", "time"]) da1 = data_comb_df # TODO: Change variable names # remove unused data frames da = None da_inter = None da_inter1 = None # define group as every 40 days from referance time ref_tm1 = datetime.strptime(ref_tm, "%d-%m-%Y").date() da1["diffdays"] = (da1.time - ref_tm1).apply(lambda x: x.days) da1["grp1"] = (da1.diffdays / (input_days + output_days)).apply(np.floor) da1["d_remainder"] = da1.diffdays - da1.grp1 * (input_days + output_days) # defining input and forecast da1["label"] = np.where(da1.d_remainder.values < input_days, "input", "output") # combining NDVI and weather variables to a list variable da1["lst1"] = da1[[var_name] + w_parms].values.tolist() # remove data before growing season da2 = ( da1.query("grp1 >= 0") .sort_values(["lat", "long", "label", "time"]) .groupby(["lat", "long", "grp1", "label"])["lst1"] .apply(list) .to_frame() .unstack() .dropna(subset=[("lst1", "input"), ("lst1", "output")]) .reset_index() ) da1 = None da2.columns = ["_".join(col).strip() for col in da2.columns.values] # checking for input and output time steps are complete or not da2["len_input"] = np.array([len(x) for x in da2.lst1_input.values]) da2["len_output"] = np.array([len(x) for x in da2.lst1_output.values]) # removing rows with nan values and incomplete time steps da2 = da2.query( "len_input == " + str(input_days) + " and len_output == " + str(output_days) ) # separating out NDVI/EVI from weather parameters da2["input_evi"] = np.array(da2.lst1_input.tolist())[:, :, 0:1].tolist() da2["input_weather"] = np.array(da2.lst1_input.tolist())[:, :, 1:].tolist() da2["forecast_weather"] = np.array(da2.lst1_output.tolist())[:, :, 1:].tolist() da2["output_evi"] = np.array(da2.lst1_output.tolist())[:, :, 0:1].tolist() da3 = da2[ [ "lat_", "long_", "grp1_", "input_evi", "input_weather", "forecast_weather", "output_evi", ] ] # checking for NDVI between - 1 and 1 in both input and output da3["input_evi_le1"] = ( np.nanmax(np.abs(np.array(da3.input_evi.to_list())), axis=(1, 2)) <= 1 ) da3["output_evi_le1"] = ( np.nanmax(np.abs(np.array(da3.output_evi.to_list())), axis=(1, 2)) <= 1 ) # checking for missing values da3["nan_input_evi"] = [ np.sum(np.isnan(np.array(x))) == 0 for x in da3.input_evi.values ] da3["nan_input_w"] = [ np.sum(np.isnan(np.array(x))) == 0 for x in da3.input_weather.values ] da3["nan_output_evi"] = [ np.sum(np.isnan(np.array(x))) == 0 for x in da3.output_evi.values ] da3["nan_output_w"] = [ np.sum(np.isnan(np.array(x))) == 0 for x in da3.forecast_weather.values ] # Re-index based on lat and long da3.sort_values(by=['lat_','long_'], ascending=[False, True], inplace=True) return da3
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def rangeSumBST(self, root: TreeNode, L: int, R: int) -> int: result = 0 def dfs(node): nonlocal L, R, result if not node: return False if L <= node.val <= R: result += node.val if L < node.val: dfs(node.left) if node.val < R: dfs(node.right) dfs(root) return result
n=int(input("Enter a number ")) sum=0 for x in range(1,n): sum=sum+x print(x,end='+') print(n,"=",sum+n)
# camera from .camera.CameraSingleFrame import CameraSingleFrame from .camera.CameraMultiFrame import CameraMultiFrame from .camera.CameraContinuous import CameraContinuous # video from .video.VideoAVI import VideoAVI from .video.VideoMJPG import VideoMJPG from .video.VideoH264 import VideoH264 # system from .Interface import Interface from .System import System
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import from __future__ import division from __future__ import print_function import io import numpy as np import tensorflow as tf class Test(object): """Testing and simple evaluation of restuls.""" def __init__(self, config, reader, filename, id_tag): self._config = config self._id_tag = id_tag test_data_org = reader.read_corpus(filename, [0, 1, 2, 3, 4, 5, 6, 7]) self._test_sentences_org = reader.sentences(test_data_org) return def write_string(self, out_sentences): f = io.StringIO() for k in range(len(self._test_sentences_org)): for line_number, (e, p) in enumerate( zip(self._test_sentences_org[k], out_sentences[k]), 1): f.write(e[0]) f.write(u'\t') f.write(e[1]) f.write(u'\t') # lemma f.write(u'_') if self._config.tagging == 3: f.write(u'\t') f.write(self._id_tag[p]) f.write(u'\t_\t_\t') elif self._config.tagging == 4: f.write(u'\t_\t') f.write(self._id_tag[p]) f.write(u'\t_\t') elif self._config.tagging == 5: f.write(u'\t_\t_\t') f.write(self._id_tag[p]) f.write(u'\t') f.write(str(1)) f.write(u'\t_\t_\n') f.write(u'\n') f.seek(0) return f def simple_eval(self, out_sentences): """Simple evaluation.""" count = 0.0 correct = 0.0 for k in range(len(self._test_sentences_org)): for (e, p) in zip(self._test_sentences_org[k], out_sentences[k]): if self._id_tag[p] == str(e[self._config.tagging]): correct += 1 count += 1 #print(p, self._id_tag[p], e[2]) return np.float32(correct / count) def write_string_aligned(self, out_sentences): """Aligns output with test input in case of removed multi word tokens.""" f = io.StringIO() for sentence_index, snt_org in enumerate(self._test_sentences_org): token_index_sys = 0 for cnt in range(len(snt_org)): p = out_sentences[sentence_index][token_index_sys] e = self._test_sentences_org[sentence_index][cnt] if u'-' in e[0]: f.write(e[0]) f.write(u'\t') f.write(e[1]) f.write(u'\t_\t_\t_\t_') f.write(u'\t_\t_\t_\t_') f.write(u'\n') continue token_index_sys += 1 f.write(e[0]) f.write(u'\t') f.write(e[1]) f.write(u'\t') # lemma f.write(u'_') if self._config.tagging == 3: f.write(u'\t') f.write(self._id_tag[p]) f.write(u'\t_\t_\t') elif self._config.tagging == 4: f.write(u'\t_\t') f.write(self._id_tag[p]) f.write(u'\t_\t') elif self._config.tagging == 5: f.write(u'\t_\t_\t') f.write(self._id_tag[p]) f.write(u'\t') f.write(str(1).decode('utf-8')) f.write(u'\t_\t_\t_') f.write(u'\n') f.write(u'\n') f.seek(0) return f def write_stringio_to_file(self, filename, stringio): """Writes stringio object to a file. Args: filename: path and file name. stringio: stringio output file. """ stringio.seek(0) with tf.gfile.GFile(filename, 'w') as f: for line in stringio: f.write(line) #f.write(u'\n')
#!/usr/bin/env python """ Daemon to run sbt in the background and pass information back/forward over a port. """ import logging import socket import subprocess from daemon import runner # pylint: disable=no-name-in-module def dispatch(workdir, command): """Determine whether we will "foreground" or "background".""" if command[0] == '~': background(workdir, command) else: foreground(workdir, command) def background(workdir, command): """Run "command" in a new subprocess in the background.""" return "Background not implemented!: {} {}".format(workdir, command) def foreground(workdir, command): """Run "command" using the persistent SBT process for "workdir".""" proc = subprocess.Popen(['sbt', '-Dsbt.log.noformat=true', command], cwd=workdir, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = proc.communicate(command) return "{} {}: {}\n{}".format(workdir, command, out, err) class App(): # pylint: disable=too-few-public-methods """Wrapper class for main logic.""" def __init__(self): self.stdin_path = '/dev/null' self.stdout_path = '/dev/null' self.stderr_path = '/tmp/sbtd.err' self.pidfile_path = '/tmp/sbtd.pid' self.pidfile_timeout = 5 def run(self): # pylint: disable=no-self-use """ Main loop. Initializes and listens to socket, and calls out to subprocess. """ logging.basicConfig(filename='/tmp/sbtd.log', filemode='w+', level=logging.INFO) logger = logging.getLogger(__name__) srv = socket.socket() srv.bind(('localhost', 3587)) srv.listen(5) while True: client, addr = srv.accept() logger.info("Got connection from %s", addr) workdir = client.recv(4096).rstrip() command = client.recv(4096).rstrip() client.send(foreground(workdir, command)) client.close() def main(): """Bootstrap the daemon.""" app = App() daemon_runner = runner.DaemonRunner(app) daemon_runner.do_action() main()
from graphviz import Digraph from torch.autograd import Variable import torch def make_dot(var, params=None): if params is not None: assert isinstance(params.values()[0], Variable) param_map = {id(v): k for k, v in params.items()} node_attr = dict(style="filled", shape="box", align="left", fontsize="12", ranksep="0.1", height="0.2") dot = Digraph(node_attr=node_attr, graph_attr=dict(size="12,12")) seen = set() def size_to_str(size): return "(" + (", ").join(["%d" % v for v in size]) + ")" def add_nodes(var): if var not in seen: if torch.is_tensor(var): dot.node(str(id(var)), size_to_str(var.size()), fillcolor="orange") dot.edge(str(id(var.grad_fn)), str(id(var))) var = var.grad_fn if hasattr(var, "variable"): u = var.variable name = param_map[id(u)] if params is not None else "" node_name = "%s\n %s" % (name, size_to_str(u.size())) dot.node(str(id(var)), node_name, fillcolor="lightblue") else: dot.node(str(id(var)), str(type(var).__name__)) seen.add(var) if hasattr(var, "next_functions"): for u in var.next_functions: if u[0] is not None: dot.edge(str(id(u[0])), str(id(var))) add_nodes(u[0]) if hasattr(var, "saved_tensors"): for t in var.saved_tensors: dot.edge(str(id(t)), str(id(var))) add_nodes(t) add_nodes(var) return dot if __name__ == "__main__": import torchvision.models as models inputs = torch.randn(1, 3, 224, 224) resnet18 = models.resnet18() y = resnet18(inputs) # print(y) g = make_dot(y) g.view()
from utils import detector_utils as detector_utils from utils import pose_classification_utils as classifier import cv2 import tensorflow as tf import multiprocessing from multiprocessing import Queue, Pool import time from utils.detector_utils import WebcamVideoStream import datetime import argparse import os; os.environ['KERAS_BACKEND'] = 'tensorflow' import keras import gui import numpy as np import requests import logging logger = logging.getLogger(__name__) logger.setLevel(level = logging.INFO) handler = logging.FileHandler("music.log") handler.setLevel(logging.INFO) formatter = logging.Formatter('%(asctime)s | %(levelname)s | %(message)s') handler.setFormatter(formatter) console = logging.StreamHandler() console.setLevel(logging.INFO) logger.addHandler(handler) logger.addHandler(console) logger.info('=' * 80) logger.info("Start DEMO of Controlling Patient Table") logger.info('=' * 80) frame_processed = 0 score_thresh = 0.18 # Create a worker thread that loads graph and # does detection on images in an input queue and puts it on an output queue def worker(input_q, output_q, cropped_output_q, inferences_q, cap_params, frame_processed): logger.info(">> loading frozen model for worker") detection_graph, sess = detector_utils.load_inference_graph() sess = tf.Session(graph=detection_graph) logger.info(">> loading keras model for worker") try: model, classification_graph, session = classifier.load_KerasGraph("cnn/models/handposes_vgg64_v1.h5") except Exception as e: logger.error(e) while True: #print("> ===== in worker loop, frame ", frame_processed) frame = input_q.get() if (frame is not None): # Actual detection. Variable boxes contains the bounding box cordinates for hands detected, # while scores contains the confidence for each of these boxes. # Hint: If len(boxes) > 1 , you may assume you have found atleast one hand (within your score threshold) boxes, scores = detector_utils.detect_objects( frame, detection_graph, sess) # get region of interest res = detector_utils.get_box_image(cap_params['num_hands_detect'], cap_params["score_thresh"], scores, boxes, cap_params['im_width'], cap_params['im_height'], frame) # draw bounding boxes detector_utils.draw_box_on_image(cap_params['num_hands_detect'], cap_params["score_thresh"], scores, boxes, cap_params['im_width'], cap_params['im_height'], frame) # classify hand pose if res is not None: class_res = classifier.classify(model, classification_graph, session, res) inferences_q.put(class_res) # add frame annotated with bounding box to queue cropped_output_q.put(res) output_q.put(frame) frame_processed += 1 else: output_q.put(frame) sess.close() if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument( '-src', '--source', dest='video_source', type=int, default=0, help='Device index of the camera.') parser.add_argument( '-nhands', '--num_hands', dest='num_hands', type=int, default=1, help='Max number of hands to detect.') parser.add_argument( '-fps', '--fps', dest='fps', type=int, default=1, help='Show FPS on detection/display visualization') parser.add_argument( '-wd', '--width', dest='width', type=int, default=300, help='Width of the frames in the video stream.') parser.add_argument( '-ht', '--height', dest='height', type=int, default=200, help='Height of the frames in the video stream.') parser.add_argument( '-ds', '--display', dest='display', type=int, default=1, help='Display the detected images using OpenCV. This reduces FPS') parser.add_argument( '-num-w', '--num-workers', dest='num_workers', type=int, default=4, help='Number of workers.') parser.add_argument( '-q-size', '--queue-size', dest='queue_size', type=int, default=5, help='Size of the queue.') args = parser.parse_args() input_q = Queue(maxsize=args.queue_size) output_q = Queue(maxsize=args.queue_size) cropped_output_q = Queue(maxsize=args.queue_size) inferences_q = Queue(maxsize=args.queue_size) video_capture = WebcamVideoStream( src=args.video_source, width=args.width, height=args.height).start() cap_params = {} frame_processed = 0 cap_params['im_width'], cap_params['im_height'] = video_capture.size() cap_params['score_thresh'] = score_thresh logger.info(f"im_width={cap_params['im_width']}, im_height={cap_params['im_height']}") # max number of hands we want to detect/track cap_params['num_hands_detect'] = args.num_hands logger.info(args) logger.info(cap_params) # Count number of files to increment new example directory poses = [] _file = open("poses.txt", "r") lines = _file.readlines() for line in lines: line = line.strip() if(line != ""): print(line) poses.append(line) logger.info(poses) # spin up workers to paralleize detection. pool = Pool(args.num_workers, worker, (input_q, output_q, cropped_output_q, inferences_q, cap_params, frame_processed)) start_time = datetime.datetime.now() num_frames = 0 fps = 0 index = 0 # cv2.namedWindow('Handpose', cv2.WINDOW_NORMAL) cv2.namedWindow('Handpose', 0) cv2.resizeWindow('Handpose', 640, 360) last_time = time.time() duration = 1.0 pose_buf = [] time_buf = [] music_playing = False url_root = 'http://localhost:5000' url_music_play = url_root + '/music/play' url_music_stop = url_root + '/music/stop' url_music_last = url_root + '/music/last' url_music_next = url_root + '/music/next' while True: frame = video_capture.read() frame = cv2.flip(frame, 1) index += 1 input_q.put(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)) output_frame = output_q.get() cropped_output = cropped_output_q.get() inferences = None try: inferences = inferences_q.get_nowait() except Exception as e: pass elapsed_time = (datetime.datetime.now() - start_time).total_seconds() num_frames += 1 fps = num_frames / elapsed_time if inferences is None: logger.debug('No hand detected') # Display inferences if(inferences is not None): logger.debug(inferences) t = time.time() p = np.argmax(inferences) time_buf.insert(0, t) pose_buf.insert(0, p) # remove the data which is not in the time window for i in np.arange(len(time_buf)-1): if time_buf[0] - time_buf[-1] > duration: time_buf.pop() pose_buf.pop() if len(pose_buf) > 5: from collections import Counter c = Counter(pose_buf) most_common_pose, detect_times = c.most_common(1)[0] logger.info(f'Pose {poses[most_common_pose]} happens {detect_times} / {len(pose_buf)}') # pose Palm if most_common_pose == 3: if music_playing: logger.info(' ==> Stop playing music') resp = requests.get(url_music_stop) logger.info(f'Send request, receive: {resp.status_code}') music_playing = False # pose Thumb elif most_common_pose == 4: if not music_playing: logger.info(' ==> Play music') resp = requests.get(url_music_play) logger.info(f'Send request, receive: {resp.status_code}') music_playing = True last_time = t elif most_common_pose == 0: logger.info(' ==> Play last music') resp = requests.get(url_music_last) logger.info(f'Send request, receive: {resp.status_code}') music_playing = True last_time = t elif most_common_pose == 1: logger.info(' ==> Play next music') resp = requests.get(url_music_next) logger.info(f'Send request, receive: {resp.status_code}') music_playing = True last_time = t gui.drawInferences(inferences, poses) if (cropped_output is not None): cropped_output = cv2.cvtColor(cropped_output, cv2.COLOR_RGB2BGR) if (args.display > 0): cv2.namedWindow('Cropped', cv2.WINDOW_NORMAL) cv2.resizeWindow('Cropped', 450, 300) cv2.imshow('Cropped', cropped_output) #cv2.imwrite('image_' + str(num_frames) + '.png', cropped_output) if cv2.waitKey(1) & 0xFF == ord('q'): break else: if (num_frames == 400): num_frames = 0 start_time = datetime.datetime.now() else: logger.info(f'frames processed: {index} elapsed time: {elapsed_time}, fps: {str(int(fps))}') # print("frame ", index, num_frames, elapsed_time, fps) if (output_frame is not None): output_frame = cv2.cvtColor(output_frame, cv2.COLOR_RGB2BGR) if (args.display > 0): if (args.fps > 0): detector_utils.draw_fps_on_image("FPS : " + str(int(fps)), output_frame) cv2.imshow('Handpose', output_frame) if cv2.waitKey(1) & 0xFF == ord('q'): break else: if (num_frames == 400): num_frames = 0 start_time = datetime.datetime.now() else: logger.info(f'frames processed: {index} elapsed time: {elapsed_time}, fps: {str(int(fps))}') else: logger.info("video end") break elapsed_time = (datetime.datetime.now() - start_time).total_seconds() fps = num_frames / elapsed_time logger.info(f'fps: {fps}') pool.terminate() video_capture.stop() cv2.destroyAllWindows()
''' * * Copyright (C) 2020 Universitat Politècnica de Catalunya. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ''' # -*- coding: utf-8 -*- import os, tarfile, numpy, math, networkx, queue, random,traceback from enum import IntEnum class TimeDist(IntEnum): """ Enumeration of the supported time distributions """ EXPONENTIAL_T = 0 DETERMINISTIC_T = 1 UNIFORM_T = 2 NORMAL_T = 3 ONOFF_T = 4 PPBP_T = 5 @staticmethod def getStrig(timeDist): if (timeDist == 0): return ("EXPONENTIAL_T") elif (timeDist == 1): return ("DETERMINISTIC_T") elif (timeDist == 2): return ("UNIFORM_T") elif (timeDist == 3): return ("NORMAL_T") elif (timeDist == 4): return ("ONOFF_T") elif (timeDist == 5): return ("PPBP_T") else: return ("UNKNOWN") class SizeDist(IntEnum): """ Enumeration of the supported size distributions """ DETERMINISTIC_S = 0 UNIFORM_S = 1 BINOMIAL_S = 2 GENERIC_S = 3 @staticmethod def getStrig(sizeDist): if (sizeDist == 0): return ("DETERMINISTIC_S") elif (sizeDist == 1): return ("UNIFORM_S") elif (sizeDist == 2): return ("BINOMIAL_S") elif (sizeDist ==3): return ("GENERIC_S") else: return ("UNKNOWN") class Sample: """ Class used to contain the results of a single iteration in the dataset reading process. ... Attributes ---------- global_packets : double Overall number of packets transmitteds in network global_losses : double Overall number of packets lost in network global_delay : double Overall delay in network maxAvgLambda: double This variable is used in our simulator to define the overall traffic intensity of the network scenario performance_matrix : NxN matrix Matrix where each cell [i,j] contains aggregated and flow-level information about transmission parameters between source i and destination j. traffic_matrix : NxN matrix Matrix where each cell [i,j] contains aggregated and flow-level information about size and time distributions between source i and destination j. routing_matrix : NxN matrix Matrix where each cell [i,j] contains the path, if it exists, between source i and destination j. topology_object : Network topology using networkx format. """ global_packets = None global_losses = None global_delay = None maxAvgLambda = None performance_matrix = None traffic_matrix = None routing_matrix = None topology_object = None _results_line = None _flowresults_line = None _routing_file = None _graph_file = None def get_global_packets(self): """ Return the number of packets transmitted in the network per time unit of this Sample instance. """ return self.global_packets def get_global_losses(self): """ Return the number of packets dropped in the network per time unit of this Sample instance. """ return self.global_losses def get_global_delay(self): """ Return the average per-packet delay over all the packets transmitted in the network in time units of this sample instance. """ return self.global_delay def get_maxAvgLambda(self): """ Returns the maxAvgLamda used in the current iteration. This variable is used in our simulator to define the overall traffic intensity of the network scenario. """ return self.maxAvgLambda def get_performance_matrix(self): """ Returns the performance_matrix of this Sample instance. """ return self.performance_matrix def get_srcdst_performance(self, src, dst): """ Parameters ---------- src : int Source node. dst : int Destination node. Returns ------- Dictionary Information stored in the Result matrix for the requested src-dst. """ return self.performance_matrix[src, dst] def get_traffic_matrix(self): """ Returns the traffic_matrix of this Sample instance. """ return self.traffic_matrix def get_srcdst_traffic(self, src, dst): """ Parameters ---------- src : int Source node. dst : int Destination node. Returns ------- Dictionary Information stored in the Traffic matrix for the requested src-dst. """ return self.traffic_matrix[src, dst] def get_routing_matrix(self): """ Returns the routing_matrix of this Sample instance. """ return self.routing_matrix def get_srcdst_routing(self, src, dst): """ Parameters ---------- src : int Source node. dst : int Destination node. Returns ------- Dictionary Information stored in the Routing matrix for the requested src-dst. """ return self.routing_matrix[src, dst] def get_topology_object(self): """ Returns the topology in networkx format of this Sample instance. """ return self.topology_object def get_network_size(self): """ Returns the number of nodes of the topology. """ return self.topology_object.number_of_nodes() def get_node_properties(self, id): """ Parameters ---------- id : int Node identifier. Returns ------- Dictionary with the parameters of the node None if node doesn't exist """ res = None if id in self.topology_object.nodes: res = self.topology_object.nodes[id] return res def get_link_properties(self, src, dst): """ Parameters ---------- src : int Source node. dst : int Destination node. Returns ------- Dictionary with the parameters of the link None if no link exist between src and dst """ res = None if dst in self.topology_object[src]: res = self.topology_object[src][dst][0] return res def get_srcdst_link_bandwidth(self, src, dst): """ Parameters ---------- src : int Source node. dst : int Destination node. Returns ------- Bandwidth in bits/time unit of the link between nodes src-dst or -1 if not connected """ if dst in self.topology_object[src]: cap = float(self.topology_object[src][dst][0]['bandwidth']) else: cap = -1 return cap def _set_data_set_file_name(self,file): """ Sets the data set file from where the sample is extracted. """ self.data_set_file = file def _set_performance_matrix(self, m): """ Sets the performance_matrix of this Sample instance. """ self.performance_matrix = m def _set_traffic_matrix(self, m): """ Sets the traffic_matrix of this Sample instance. """ self.traffic_matrix = m def _set_routing_matrix(self, m): """ Sets the traffic_matrix of this Sample instance. """ self.routing_matrix = m def _set_topology_object(self, G): """ Sets the topology_object of this Sample instance. """ self.topology_object = G def _set_global_packets(self, x): """ Sets the global_packets of this Sample instance. """ self.global_packets = x def _set_global_losses(self, x): """ Sets the global_losses of this Sample instance. """ self.global_losses = x def _set_global_delay(self, x): """ Sets the global_delay of this Sample instance. """ self.global_delay = x def _get_data_set_file_name(self): """ Gets the data set file from where the sample is extracted. """ return self.data_set_file def _get_path_for_srcdst(self, src, dst): """ Returns the path between node src and node dst. """ return self.routing_matrix[src, dst] def _get_timedis_for_srcdst (self, src, dst): """ Returns the time distribution of traffic between node src and node dst. """ return self.traffic_matrix[src, dst]['TimeDist'] def _get_eqlambda_for_srcdst (self, src, dst): """ Returns the equivalent lambda for the traffic between node src and node dst. """ return self.traffic_matrix[src, dst]['EqLambda'] def _get_timedistparams_for_srcdst (self, src, dst): """ Returns the time distribution parameters for the traffic between node src and node dst. """ return self.traffic_matrix[src, dst]['TimeDistParams'] def _get_sizedist_for_srcdst (self, src, dst): """ Returns the size distribution of traffic between node src and node dst. """ return self.traffic_matrix[src, dst]['SizeDist'] def _get_avgpktsize_for_srcdst_flow (self, src, dst): """ Returns the average packet size for the traffic between node src and node dst. """ return self.traffic_matrix[src, dst]['AvgPktSize'] def _get_sizedistparams_for_srcdst (self, src, dst): """ Returns the time distribution of traffic between node src and node dst. """ return self.traffic_matrix[src, dst]['SizeDistParams'] def _get_resultdict_for_srcdst (self, src, dst): """ Returns the dictionary with all the information for the communication between node src and node dst regarding communication parameters. """ return self.performance_matrix[src, dst] def _get_trafficdict_for_srcdst (self, src, dst): """ Returns the dictionary with all the information for the communication between node src and node dst regarding size and time distribution parameters. """ return self.traffic_matrix[src, dst] class DatanetAPI: """ Class containing all the functionalities to read the dataset line by line by means of an iteratos, and generate a Sample instance with the information gathered. """ def __init__ (self, data_folder, shuffle=False): """ Initialization of the PasringTool instance Parameters ---------- data_folder : str Folder where the dataset is stored. dict_queue : Queue Auxiliar data structures used to conveniently move information between the file where they are read, and the matrix where they are located. shuffle: boolean Specify if all files should be shuffled. By default false Returns ------- None. """ self.data_folder = data_folder self.dict_queue = queue.Queue() self.shuffle = shuffle def _readRoutingFile(self, routing_fd, netSize): """ Pending to compare against getSrcPortDst Parameters ---------- routing_file : str File where the routing information is located. netSize : int Number of nodes in the network. Returns ------- R : netSize x netSize matrix Matrix where each [i,j] states what port node i should use to reach node j. """ R = numpy.zeros((netSize, netSize)) - 1 src = 0 for line in routing_fd: line = line.decode() camps = line.split(',') dst = 0 for port in camps[:-1]: R[src][dst] = port dst += 1 src += 1 return (R) def _getRoutingSrcPortDst(self, G): """ Return a dictionary of dictionaries with the format: node_port_dst[node][port] = next_node Parameters ---------- G : TYPE DESCRIPTION. Returns ------- None. """ node_port_dst = {} for node in G: port_dst = {} node_port_dst[node] = port_dst for destination in G[node].keys(): port = G[node][destination][0]['port'] node_port_dst[node][port] = destination return(node_port_dst) def _create_routing_matrix(self, G,routing_file): """ Parameters ---------- G : graph Graph representing the network. routing_file : str File where the information about routing is located. Returns ------- MatrixPath : NxN Matrix Matrix where each cell [i,j] contains the path to go from node i to node j. """ netSize = G.number_of_nodes() node_port_dst = self._getRoutingSrcPortDst(G) R = self._readRoutingFile(routing_file, netSize) MatrixPath = numpy.empty((netSize, netSize), dtype=object) for src in range (0,netSize): for dst in range (0,netSize): node = src path = [node] while (R[node][dst] != -1): out_port = R[node][dst]; next_node = node_port_dst[node][out_port] path.append(next_node) node = next_node MatrixPath[src][dst] = path return (MatrixPath) def _get_graph_for_tarfile(self, tar): """ Parameters ---------- tar : str tar file where the graph file is located. Returns ------- ret : graph Graph representation of the network. """ for member in tar.getmembers(): if 'graph' in member.name: f = tar.extractfile(member) ret = networkx.read_gml(f, destringizer=int) return ret def __process_params_file(self,params_file): simParameters = {} for line in params_file: line = line.decode() if ("simulationDuration" in line): ptr = line.find("=") simulation_time = int (line[ptr+1:]) simParameters["simulationTime"] = simulation_time continue if ("lowerLambda" in line): ptr = line.find("=") lowerLambda = float(line[ptr+1:]) simParameters["lowerLambda"] = lowerLambda continue if ("upperLambda" in line): ptr = line.find("=") upperLambda = float(line[ptr+1:]) simParameters["upperLambda"] = upperLambda return(simParameters) def __process_graph(self,G): netSize = G.number_of_nodes() for src in range(netSize): for dst in range(netSize): if not dst in G[src]: continue bw = G[src][dst][0]['bandwidth'] bw = bw.replace("kbps","000") G[src][dst][0]['bandwidth'] = bw def __iter__(self): """ Yields ------ s : Sample Sample instance containing information about the last line read from the dataset. """ g = None tuple_files = [] graphs_dic = {} for root, dirs, files in os.walk(self.data_folder): if (not "graph_attr.txt" in files): continue # Generate graphs dictionaries graphs_dic[root] = networkx.read_gml(os.path.join(root, "graph_attr.txt"), destringizer=int) self.__process_graph(graphs_dic[root]) # Extend the list of files to process tuple_files.extend([(root, f) for f in files if f.endswith("tar.gz")]) if self.shuffle: random.Random(1234).shuffle(tuple_files) for root, file in tuple_files: g = graphs_dic[root] tar = tarfile.open(os.path.join(root, file), 'r:gz') dir_info = tar.next() routing_file = tar.extractfile(dir_info.name+"/Routing.txt") results_file = tar.extractfile(dir_info.name+"/simulationResults.txt") if (dir_info.name+"/flowSimulationResults.txt" in tar.getnames()): flowresults_file = tar.extractfile(dir_info.name+"/flowSimulationResults.txt") else: flowresults_file = None params_file = tar.extractfile(dir_info.name+"/params.ini") simParameters = self.__process_params_file(params_file) routing_matrix= self._create_routing_matrix(g, routing_file) while(True): s = Sample() s._set_topology_object(g) s._set_data_set_file_name(os.path.join(root, file)) s._results_line = results_file.readline().decode()[:-2] if (flowresults_file): s._flowresults_line = flowresults_file.readline().decode()[:-2] else: s._flowresults_line = None if (len(s._results_line) == 0): break self._process_flow_results_traffic_line(s._results_line, s._flowresults_line, simParameters, s) s._set_routing_matrix(routing_matrix) yield s def _process_flow_results_traffic_line(self, rline, fline, simParameters, s): """ Parameters ---------- rline : str Last line read in the results file. fline : str Last line read in the flows file. s : Sample Instance of Sample associated with the current iteration. Returns ------- None. """ sim_time = simParameters["simulationTime"] r = rline.split(',') if (fline): f = fline.split(',') else: f = r maxAvgLambda = 0 m_result = [] m_traffic = [] netSize = s.get_network_size() globalPackets = 0 globalLosses = 0 globalDelay = 0 offset = netSize*netSize*3 for src_node in range (netSize): new_result_row = [] new_traffic_row = [] for dst_node in range (netSize): offset_t = (src_node * netSize + dst_node)*3 offset_d = offset + (src_node * netSize + dst_node)*8 pcktsGen = float(r[offset_t + 1]) pcktsDrop = float(r[offset_t + 2]) pcktsDelay = float(r[offset_d]) dict_result_agg = { 'PktsDrop':numpy.round(pcktsDrop/sim_time,6), "AvgDelay":pcktsDelay, "AvgLnDelay":float(r[offset_d + 1]), "p10":float(r[offset_d + 2]), "p20":float(r[offset_d + 3]), "p50":float(r[offset_d + 4]), "p80":float(r[offset_d + 5]), "p90":float(r[offset_d + 6]), "Jitter":float(r[offset_d + 7])} if (src_node != dst_node): globalPackets += pcktsGen globalLosses += pcktsDrop globalDelay += pcktsDelay lst_result_flows = [] lst_traffic_flows = [] dict_result_tmp = { 'PktsDrop':numpy.round(pcktsDrop/sim_time,6), "AvgDelay":pcktsDelay, "AvgLnDelay":float(r[offset_d + 1]), "p10":float(r[offset_d + 2]), "p20":float(r[offset_d + 3]), "p50":float(r[offset_d + 4]), "p80":float(r[offset_d + 5]), "p90":float(r[offset_d + 6]), "Jitter":float(r[offset_d + 7])} lst_result_flows.append(dict_result_tmp) dict_traffic = {} dict_traffic['AvgBw'] = float(r[offset_t])*1000 dict_traffic['PktsGen'] = numpy.round(pcktsGen/sim_time,6) dict_traffic['TotalPktsGen'] = float(pcktsGen) dict_traffic['ToS'] = 0 self._timedistparams(dict_traffic) self._sizedistparams(dict_traffic) lst_traffic_flows.append (dict_traffic) # From kbps to bps dict_traffic_agg = {'AvgBw':float(r[offset_t])*1000, 'PktsGen':numpy.round(pcktsGen/sim_time,6), 'TotalPktsGen':pcktsGen} dict_result_srcdst = {} dict_traffic_srcdst = {} dict_result_srcdst['AggInfo'] = dict_result_agg dict_result_srcdst['Flows'] = lst_result_flows dict_traffic_srcdst['AggInfo'] = dict_traffic_agg dict_traffic_srcdst['Flows'] = lst_traffic_flows new_result_row.append(dict_result_srcdst) new_traffic_row.append(dict_traffic_srcdst) m_result.append(new_result_row) m_traffic.append(new_traffic_row) m_result = numpy.asmatrix(m_result) m_traffic = numpy.asmatrix(m_traffic) s._set_performance_matrix(m_result) s._set_traffic_matrix(m_traffic) s._set_global_packets(numpy.round(globalPackets/sim_time,6)) s._set_global_losses(numpy.round(globalLosses/sim_time,6)) s._set_global_delay(globalDelay/(netSize*(netSize-1))) # Dataset v0 only contain exponential traffic with avg packet size of 1000 def _timedistparams(self, dict_traffic): """ Parameters ---------- dict_traffic: dictionary Dictionary to fill with the time distribution information extracted from data """ dict_traffic['TimeDist'] = TimeDist.EXPONENTIAL_T params = {} params['EqLambda'] = dict_traffic['AvgBw'] params['AvgPktsLambda'] = dict_traffic['AvgBw'] / 1000 # Avg Pkt size 1000 params['ExpMaxFactor'] = 10 dict_traffic['TimeDistParams'] = params # Dataset v0 only contains binomial traffic with avg packet size of 1000 def _sizedistparams(self, dict_traffic): """ Parameters ---------- dict_traffic : dictionary Dictionary to fill with the size distribution information extracted from data """ dict_traffic['SizeDist'] = SizeDist.BINOMIAL_S params = {} params['AvgPktSize'] = 1000 params['PktSize1'] = 300 params['PktSize2'] = 1700 dict_traffic['SizeDistParams'] = params
"""Test the protocol.application.stacks module.""" # Builtins # Packages from phylline.links.loopback import BottomLoopbackLink, TopLoopbackLink from phylline.pipelines import PipelineBottomCoupler from phyllo.protocol.application.stacks import make_minimal, make_pubsub from phyllo.protocol.communication import AutomaticStack from tests.unit.protocol.transport.stacks import assert_loopback_below def test_minimal_loopback_below(): """Test for correct echo from send to receive with minimal stack.""" print('Testing minimal application loopback with BottomLoopbackLink...') stack = AutomaticStack(BottomLoopbackLink(), make_minimal(), name='LoopbackBelow') print(stack) assert_loopback_below(stack, (1, 2, (3, {'foo': 'bar'}))) def test_pubsub_loopback_below(): """Test for correct echo from send to receive with pub-sub stack.""" print('Testing pub-sub application loopback with BottomLoopbackLink...') stack = AutomaticStack(BottomLoopbackLink(), make_pubsub(), name='LoopbackBelow') print(stack) topic = b'test' assert_loopback_below(stack, (topic, (1, 2, (3, {'foo': 'bar'})))) def test_minimal_loopback_coupler(): """Test for correct echo from send to receive.""" print('Testing byte buffer loopback with PipelineBottomCoupler...') stack_one = make_minimal() stack_two = AutomaticStack(make_minimal(), TopLoopbackLink()) coupler = PipelineBottomCoupler(stack_one, stack_two) print(coupler) assert_loopback_below(coupler.pipeline_one, (1, 2, 3)) assert_loopback_below(coupler.pipeline_one, {'hello': 'world', 'foo': 'bar'}) assert_loopback_below( coupler.pipeline_one, (0, 1, 2, True, None, (3, 4), {'foo': 'bar'}) ) assert_loopback_below(coupler.pipeline_one, 12345) def test_pubsub_loopback_coupler(): """Test for correct echo from send to receive.""" print('Testing byte buffer loopback with PipelineBottomCoupler...') stack_one = make_pubsub() stack_two = AutomaticStack(make_pubsub(), TopLoopbackLink()) coupler = PipelineBottomCoupler(stack_one, stack_two) print(coupler) assert_loopback_below(coupler.pipeline_one, (b'list', (1, 2, 3))) assert_loopback_below(coupler.pipeline_one, (b'dict', {'hello': 'world', 'foo': 'bar'})) assert_loopback_below( coupler.pipeline_one, (b'nested', (0, 1, 2, True, None, (3, 4), {'foo': 'bar'})) ) assert_loopback_below(coupler.pipeline_one, (b'number', 12345))
import copy import datetime import functools import os import sys import time from pathlib import Path from random import shuffle import pygame.midi # import cProfile # from music21 import * last_update_time = time.time() # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class Config: progress_update_seconds = 5 last_update_time = 0 max_melodies_per_final_interval_subset = 100 min_melody_intervals = 4 max_melody_intervals = 14 max_melody_height = 19 max_direction_changes = 14 midi_a0 = 21 midi_e3 = 52 midi_c4 = 60 midi_c8 = 108 vocal_ranges = { # "name" : ( "low", "mid", "high" ), "soprano": ("C4", "B4", "G5"), "mezzo-soprano": ("A3", "G4", "F5"), "alto": ("G3", "F4", "D5"), "tenor": ("C3", "B3", "A4"), "baritone": ("G2", "F3", "E4"), "bass": ("F2", "E3", "C4"), } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class Tone: def __init__(self, midi_note): self.midi_note = midi_note note_to_spelling = { 0: "A", 1: "A♯", 2: "B", 3: "C", 4: "C♯", 5: "D", 6: "D♯", 7: "E", 8: "F", 9: "F♯", 10: "G", 11: "G♯"} spelling_to_note = { "A": 0, "A♯": 1, "B♭": 1, "B": 2, "C♭": 2, "B♯": 3, "C": 3, "C♯": 4, "D♭": 4, "D": 5, "D♯": 6, "E♭": 6, "E": 7, "F♭": 7, "E♯": 8, "F": 8, "F♯": 9, "G♭": 9, "G": 10, "G♯": 11, "A♭": 11} def get_note_number(self): return self.midi_note - Config.midi_a0 def get_octave(self): return (self.get_note_number() + 12 - 3) // 12 def get_spelling(self): return self.note_to_spelling[self.get_note_number() % 12] def is_sharp(self): return self.get_spelling()[-1] == '♯' def get_letter(self): return self.get_spelling()[0] def get_spelling_and_octave(self): note = self.get_note_number() name = self.note_to_spelling[note % 12] return name + str(self.get_octave()) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class Melody: possible_first_intervals = \ (-7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7) possible_last_intervals = \ (-7, -4, -3, -2, -1, 1, 2, 5,) possible_following_intervals = { -7: (-2, -1, 1, 2, 5, 6,), -6: (-2, -1, 1, 2, 4, 5, 7), -5: (-2, -1, 1, 2, 3, 4, 6, 7), -4: (-2, -1, 1, 2, 3, 5, 6,), -3: (-2, -1, 1, 2, 4, 5,), -2: (-7, -6, -5, -4, -3, 1, 3, 4, 5, 6, 7), -1: (-7, -6, -5, -4, -3, 2, 3, 4, 5, 6, 7), 1: (-7, -6, -5, -4, -3, -2, 3, 4, 5, 6, 7), 2: (-7, -6, -5, -4, -3, -1, 3, 4, 5, 6, 7), 3: (-5, -4, -2, -1, 1, 2,), 4: (-6, -5, -3, -2, -1, 1, 2,), 5: (-7, -6, -4, -3, -2, -1, 1, 2,), 6: (-7, -5, -4, -2, -1, 1, 2,), 7: (-6, -5, -2, -1, 1, 2,), } perfect_up = (5, 7) perfect_down = (-7, -5) def __init__(self, melody): if melody is None: self.tones = [Tone(Config.midi_e3)] # [ Tone(Config.vocalRanges["bass"][1]) ] self.intervals = [] else: self.tones = copy.deepcopy(melody.tones) self.intervals = copy.deepcopy(melody.intervals) def push_interval(self, interval): self.intervals.append(interval) self.tones.append(Tone(self.tones[-1].midi_note + interval)) def pop_interval(self): self.tones.pop() return self.intervals.pop() def melody_height(self): midi_tones = [x.midi_note for x in self.tones] max_tone = max(midi_tones) min_tone = min(midi_tones) return max_tone - min_tone def num_tones(self): return len(self.tones) def num_intervals(self): return len(self.intervals) def num_direction_changes(self): direction_changes = 0 positive = self.intervals[0] > 0 for interval in self.intervals: if positive is True and interval < 0 or \ positive is False and interval > 0: direction_changes += 1 positive = not positive return direction_changes def has_too_large_a_range(self): return self.melody_height() > Config.max_melody_height def has_too_many_in_same_direction(self): if self.num_intervals() < 5: return False direction = (self.intervals[-5] > 0) for interval in self.intervals[-4:]: if (interval > 0) != direction: return False return True def has_duplicate_tones(self): # ignore melody-final tones if self.tones[0].midi_note == self.tones[-1].midi_note: return False for existing_tone in self.tones[1:-1]: if existing_tone.midi_note == self.tones[-1].midi_note: return True return False def has_duplicate_intervals(self): added_interval = self.intervals[-1] for existing_interval in self.intervals[0:-2]: if existing_interval == added_interval: return True return False def has_three_sequences_of_two(self): # 3 repeats of same two-tone interval sequence_counts = {} for interval in self.intervals: new_count = sequence_counts.get(interval, 0) + 1 if new_count > 2: return True sequence_counts[interval] = new_count return False def has_two_sequences_of_three(self): length = self.num_intervals() if length < 4: return False # 2 repeats of longer non-overlapping sequences pattern = (self.intervals[-2], self.intervals[-1]) pos = 0 while length - pos > 2: intervals = (self.intervals[pos], self.intervals[pos + 1]) if pattern == intervals: return True inverted = intervals * -1 if pattern == inverted: return True pos += 1 return False def has_unameliorated_tritone(self): ints = self.num_intervals() if ints < 2: return False elif ints == 2: if self.intervals[0] == -6: if self.intervals[1] not in self.perfect_up: return True elif self.intervals[0] == 6: if self.intervals[1] not in self.perfect_down: return True else: if self.intervals[-2] == -6: if self.intervals[-3] not in self.perfect_up and \ self.intervals[-1] not in self.perfect_up: return True elif self.intervals[-2] == 6: if self.intervals[-3] not in self.perfect_down and \ self.intervals[-1] not in self.perfect_down: return True return False def has_too_many_direction_changes(self): return self.num_direction_changes() > Config.max_direction_changes # def isComplete(self): # return self.tones[0].midi_note == self.tones[-1].midi_note def is_illegal_melody_for_hindemith_chapter_one(self): # Some tests assume we just need to check the # most recently appended note if len(self.intervals) < 2: return False closing = (self.tones[0].midi_note == self.tones[-1].midi_note) if closing and len(self.intervals) < Config.min_melody_intervals: return True if (self.has_duplicate_tones() or self.has_duplicate_intervals() or self.has_unameliorated_tritone() or self.has_too_large_a_range() or self.has_too_many_in_same_direction() or self.has_two_sequences_of_three() or self.has_three_sequences_of_two() or self.has_too_many_direction_changes() ): return True if closing: if self.intervals[-1] not in self.possible_last_intervals: return True return False def intervals_string(self): strings = [] for interval in self.intervals: strings.append(str(interval)) return " ".join(strings) def tones_string(self): strs = [] for tone in self.tones: spelling = tone.get_spelling() # tone.getSpellingAndOctave() strs.append(spelling) return " ".join(strs) def get_name(self): return '{0} / {1}'.format(self.tones_string(), self.intervals_string()) def print(self): print(self.get_name()) def play_midi(self, player, duration, pause): print(self.intervals_string(), " -- ", end='') # music21Notes = [] for tone in self.tones: spelling = tone.get_spelling_and_octave() print(spelling, end=' ') # music21Notes.append(note.Note(spelling)) player.noteOn(tone.midi_note, 127) time.sleep(duration) player.noteOff(tone.midi_note, 127) print() time.sleep(pause) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class MelodiesSubset: def __init__(self, num_direction_changes, melody_size): self.melody_size = melody_size self.num_direction_changes = num_direction_changes self.melodies = {x: [] for x in Melody.possible_last_intervals} def get_name(self): return "Melodies with {0} direction changes and length {1}".format( self.num_direction_changes, self.melody_size) def append(self, melody): self.melodies[melody.intervals[-1]].append(melody) def num_melodies(self): lengths = [len(z) for z in self.melodies.values()] return functools.reduce(lambda x, y: x + y, lengths) def get_all_melodies_up_to_max_for_group(self): all_melodies = [] for last_interval in Melody.possible_last_intervals: melodies = self.melodies[last_interval][0:Config.max_melodies_per_final_interval_subset] all_melodies.extend(melodies) return all_melodies # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class MelodySets: melody_count = 0 def __init__(self): self.direction_changes_set = [] for alt_count in range(0, Config.max_melody_intervals + 2): length_set = [] self.direction_changes_set.append(length_set) for length_count in range(0, Config.max_melody_intervals + 2): length_set.append(MelodiesSubset(alt_count, length_count)) def save_melody(self, melody): self.melody_count += 1 melody = Melody(melody) midi_tones = [x.midi_note for x in melody.tones] max_tone = max(midi_tones) min_tone = min(midi_tones) mid_tone = (max_tone + min_tone) // 2 offset = Config.midi_e3 - mid_tone i = 0 while i < melody.num_tones(): melody.tones[i].midi_note += offset i += 1 length = melody.num_tones() direction_changes = melody.num_direction_changes() melody_set = self.direction_changes_set[direction_changes][length] melody_set.append(melody) current_time = time.time() global last_update_time if (current_time - last_update_time) > Config.progress_update_seconds: self.print_summary() print() melody.print() last_update_time = current_time def extend_melody(self, melody, length_remaining): previous_interval = melody.intervals[-1] for interval in Melody.possible_following_intervals[previous_interval]: melody.push_interval(interval) if not melody.is_illegal_melody_for_hindemith_chapter_one(): if melody.tones[0].midi_note == melody.tones[-1].midi_note: self.save_melody(melody) elif length_remaining > 0: self.extend_melody(melody, length_remaining - 1) melody.pop_interval() def generate_melodies(self, length): for interval in Melody.possible_first_intervals: melody = Melody(None) melody.push_interval(interval) self.extend_melody(melody, length - 1) self.shuffle_if_too_many() self.print_summary() def shuffle_if_too_many(self): for alternation_set in self.direction_changes_set: for length_set in alternation_set: for final_interval in Melody.possible_last_intervals: melodies = length_set.melodies[final_interval] if len(melodies) > Config.max_melodies_per_final_interval_subset: shuffle(melodies) # def print_prefixes(self): # self.print_summary() # for melody_set in self.melodies: # for melody in melody_set: # melody.print() def print_summary(self): print() for i in range(0, len(self.direction_changes_set)): directions_set = self.direction_changes_set[i] for j in range(0, len(directions_set)): length_set = directions_set[j] num_melodies = length_set.num_melodies() if num_melodies > 0: print(num_melodies, " melodies of direction changes ", i, " and size ", j) print("Total: ", self.melody_count) def play_melodies(self): self.print_summary() pygame.midi.init() player = pygame.midi.Output(0) player.setInstrument(0) all_melodies = [] for directions_set in self.melodies: for length_set in directions_set: all_melodies.append(length_set.get_all__melodies()) for melody in all_melodies: melody.play_midi(player, 0.25, 1) # melody.playMidi(player, 0.325, 1.5) # melody.playMidi(player, 0.4, 3) del player pygame.midi.quit() def play_one_melody(self, melody): pygame.midi.init() player = pygame.midi.Output(0) player.setInstrument(0) melody.play_midi(player, 0.25, 2) del player pygame.midi.quit() # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # approx EBNF # # MusicXML File Output = <File Header>, { <Melody> }, <File Footer> # <File Header> = appendFileHeader() # <File Footer> = appendFileFooter() # <Melody> = [ <First Measure> | <New Melody Measure> ] # { <Note Measure> } # <Melody End> # <First Measure> = getMeasureStart() # getExtraForFirstMeasure() # getMelodyTitle() # <Musical Note> # getMeasureEnd() # <New Melody Measure> = getMeasureStart() # getExtraForNewSystem() # getMelodyTitle() # <Musical Note> # getMeasureEnd() # <Note Measure> = getMeasureStart() # <Musical Note> # getMeasureEnd() # <Melody End> = <Multirest Measure> # <Rest Measure> # <Rest Measure> # <Ending Rest Measure> # <Musical Note> = getMusicalNote() # <Multirest Measure> = getMeasureStart() # getMultiRest() # getMeasureEnd() # <Rest Measure> = getMeasureStart() # getRest() # getMeasureEnd() # <Ending Rest Measure> = getMeasureStart() # getRest() # getEndBarline() # getMeasureEnd() class MusicXmlExporter: doc_width = 1200 - 141 - 70 first_measure_extra_width = 165 - 95 new_system_extra_width = 165 - 95 multi_rest_extra_width = 145 - 95 def export_melody_sets(self, melody_sets): for alt_count in range(0, Config.max_melody_intervals + 2): alternation_set = melody_sets.direction_changes_set[alt_count] for length_count in range(0, Config.max_melody_intervals + 2): melody_set = alternation_set[length_count] self.export_melodies(melody_set) def export_melodies(self, melody_subset): if melody_subset.num_melodies() > 0: xml_doc = [] name = melody_subset.get_name() self.append_file_header(xml_doc, name) self.append_melodies(xml_doc, melody_subset) self.append_file_footer(xml_doc) self.write_xml_doc(xml_doc, name) def append_file_header(self, doc, name): title = 'Python-Generated Hindemith-Compliant Melodies' composer = 'Jodawi' copyright_notice = 'Public Domain' subtitle = name software = os.path.basename(sys.argv[0]) today = datetime.date.today().isoformat() header = self.file_header.format( TITLE=title, COMPOSER=composer, COPYRIGHT=copyright_notice, SUBTITLE=subtitle, SOFTWARE=software, DATE=today, ) doc.append(header) def append_file_footer(self, doc): doc.append(self.file_footer) def append_melodies(self, doc, melody_set): melody_count = 0 measure_number = 0 for melody in melody_set.get_all_melodies_up_to_max_for_group(): melody_count += 1 name = '{0}.{1}.{2}: {3}'.format( melody_set.num_direction_changes, melody_set.melody_size, melody_count, melody.get_name()) measure_number += self.append_melody(doc, melody, name, melody_count, measure_number) def get_melody_measure_width(self, melody): shrunken = self.doc_width \ - self.first_measure_extra_width \ - self.multi_rest_extra_width return shrunken // (melody.num_tones() + 1) def get_rest_measure_width(self, melody): return self.doc_width - self.first_measure_extra_width - \ self.get_melody_measure_width(melody) * melody.num_tones() def write_xml_doc(self, doc, name): # TODO: create folder data_folder = Path("out/") file_name = data_folder / (name + '.xml') with open(file_name, mode='w', encoding="utf8") as f: for item in doc: f.write(item) print("Wrote ", file_name) def append_melody(self, doc, melody, name, melody_number, measure_number): base_width = self.get_melody_measure_width(melody) for i in range(len(melody.tones)): width = base_width default_x = 13 if i == 0: width += self.first_measure_extra_width default_x += self.first_measure_extra_width measure_number += 1 doc.append(self.measure_start.format( MEASURE_NUMBER=measure_number, MEASURE_WIDTH=width)) if measure_number == 1: doc.append(self.extra_for_first_measure) elif melody_number != 1 and i == 0: doc.append(self.new_system) if i == 0: doc.append(self.melody_title.format(MELODY_TITLE=name)) tone = melody.tones[i] if tone.is_sharp(): note_str = self.note_sharp( tone.get_letter(), tone.get_octave(), default_x) else: note_str = self.note_natural( tone.get_letter(), tone.get_octave(), default_x) doc.append(note_str) doc.append(self.measure_end) for i in range(4): measure_number += 1 width = 0 rest_str = self.rest if i == 0: width = self.get_rest_measure_width(melody) rest_str = self.multiple_rest + self.rest doc.append(self.measure_start.format( MEASURE_NUMBER=measure_number, MEASURE_WIDTH=width)) doc.append(rest_str) if i == 3: doc.append(self.end_barline) doc.append(self.measure_end) return measure_number measure = '''\ {MEASURE_START_WITH_APPROPRIATE_WIDTH}\ {EXTRA_FOR_FIRST_MEASURE}\ {EXTRA_FOR_NEW_SYSTEM}\ {EXTRA_FOR_MELODY_TITLE}\ {EXTRA_FOR_MUSICAL_NOTE}\ {EXTRA_FOR_MULTIPLE_REST}\ {EXTRA_FOR_REST}\ {EXTRA_FOR_END_BARLINE}\ {MEASURE_END}''' file_header = '''\ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.0 \ Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd"> <score-partwise version="3.0"> <movement-title>{TITLE}</movement-title> <identification> <creator type="composer">{COMPOSER}</creator> <rights>©{COPYRIGHT}</rights> <encoding> <software>{SOFTWARE}</software> <software>Dolet Light for Finale 2012</software> <encoding-date>{DATE}</encoding-date> <supports attribute="new-system" element="print" type="yes" value="yes"/> <supports attribute="new-page" element="print" type="yes" value="yes"/> </encoding> </identification> <defaults> <scaling> <millimeters>7.1967</millimeters> <tenths>40</tenths> </scaling> <page-layout> <page-height>1553</page-height> <page-width>1200</page-width> <page-margins type="both"> <left-margin>141</left-margin> <right-margin>70</right-margin> <top-margin>70</top-margin> <bottom-margin>70</bottom-margin> </page-margins> </page-layout> <system-layout> <system-margins> <left-margin>0</left-margin> <right-margin>0</right-margin> </system-margins> <system-distance>84</system-distance> <top-system-distance>49</top-system-distance> </system-layout> <appearance> <line-width type="stem">0.7487</line-width> <line-width type="beam">5</line-width> <line-width type="staff">0.7487</line-width> <line-width type="light barline">0.7487</line-width> <line-width type="heavy barline">5</line-width> <line-width type="leger">0.7487</line-width> <line-width type="ending">0.7487</line-width> <line-width type="wedge">0.7487</line-width> <line-width type="enclosure">0.7487</line-width> <line-width type="tuplet bracket">0.7487</line-width> <note-size type="grace">60</note-size> <note-size type="cue">60</note-size> <distance type="hyphen">120</distance> <distance type="beam">8</distance> </appearance> <music-font font-family="Maestro,engraved" font-size="20.4"/> <word-font font-family="Times New Roman" font-size="10.2"/> </defaults> <credit page="1"> <credit-type>title</credit-type> <credit-words default-x="635" default-y="1482" font-size="24" \ justify="center" valign="top">{TITLE}</credit-words> </credit> <credit page="1"> <credit-type>composer</credit-type> <credit-words default-x="1127" default-y="1414" font-size="12" \ justify="right" valign="top">{COMPOSER}</credit-words> </credit> <credit page="1"> <credit-type>rights</credit-type> <credit-words default-x="635" default-y="53" font-size="10" \ justify="center" valign="bottom">©{COPYRIGHT}</credit-words> </credit> <credit page="1"> <credit-type>subtitle</credit-type> <credit-words default-x="635" default-y="1418" font-size="18" \ justify="center" valign="top">{SUBTITLE}</credit-words> </credit> <part-list> <score-part id="P1"> <part-name>Bass</part-name> <part-abbreviation>B</part-abbreviation> <score-instrument id="P1-I1"> <instrument-name>ARIA Player</instrument-name> <virtual-instrument> <virtual-library>Garritan Instruments for Finale</virtual-library> <virtual-name>009. Choir/Choir Ahs</virtual-name> </virtual-instrument> </score-instrument> <midi-device>ARIA Player</midi-device> <midi-instrument id="P1-I1"> <midi-channel>1</midi-channel> <midi-program>1</midi-program> <volume>80</volume> <pan>0</pan> </midi-instrument> </score-part> </part-list> <!--=========================================================--> <part id="P1">''' measure_start = ''' <measure number="{MEASURE_NUMBER}" width="{MEASURE_WIDTH}">''' extra_for_first_measure = ''' <print> <system-layout> <top-system-distance>174</top-system-distance> </system-layout> <measure-numbering>system</measure-numbering> </print> <attributes> <divisions>2</divisions> <key> <fifths>0</fifths> <mode>major</mode> </key> <time> <beats>1</beats> <beat-type>1</beat-type> </time> <clef> <sign>F</sign> <line>4</line> </clef> </attributes> <sound tempo="640"/>''' melody_title = ''' <direction placement="above"> <direction-type> <words default-y="38" relative-x="-10" \ valign="top">{MELODY_TITLE}</words> </direction-type> </direction>''' optional_alter = '''\ <alter>{ALTER}</alter> ''' optional_accidental = '''\ <accidental>{ACCIDENTAL}</accidental> ''' def note_sharp(self, step, octave, default_x): alter = self.optional_alter.format(ALTER=1) accidental = self.optional_accidental.format(ACCIDENTAL="sharp") return self.note(step, octave, alter, accidental, default_x) def note_natural(self, step, octave, default_x): return self.note(step, octave, '', '', default_x) def note(self, step, octave, alter, accidental, default_x): return self.musical_note.format( STEP=step, OCTAVE=octave, NOTE_DEFAULT_X=default_x, OPTIONAL_ALTER=alter, OPTIONAL_ACCIDENTAL=accidental) musical_note = ''' <note default-x="{NOTE_DEFAULT_X}"> <pitch> <step>{STEP}</step> {OPTIONAL_ALTER}\ <octave>{OCTAVE}</octave> </pitch> <duration>8</duration> <voice>1</voice> <type>whole</type> {OPTIONAL_ACCIDENTAL}\ </note>''' measure_end = ''' </measure> <!--=======================================================-->''' multiple_rest = ''' <attributes> <measure-style> <multiple-rest>4</multiple-rest> </measure-style> </attributes>''' # with zero width for the final 3 rest = ''' <note> <rest measure="yes"/> <duration>8</duration> <voice>1</voice> </note>''' end_barline = ''' <barline location="right"> <bar-style>light-heavy</bar-style> </barline>''' new_system = ''' <print new-system="yes"> <system-layout> <system-distance>79</system-distance> </system-layout> </print>''' file_footer = ''' </part> <!--=========================================================--> </score-partwise> ''' # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def main(): melody_sets = MelodySets() melody_sets.generate_melodies(Config.max_melody_intervals) exporter = MusicXmlExporter() exporter.export_melody_sets(melody_sets) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # if __name__ == '__main__': # unittest.main() main()
import os import torch import torch.optim as optim from confidnet.models import get_model from confidnet.utils import losses from confidnet.utils.logger import get_logger from confidnet.utils.schedulers import get_scheduler LOGGER = get_logger(__name__, level="DEBUG") class AbstractLeaner: def __init__(self, config_args, train_loader, val_loader, test_loader, start_epoch, device): self.config_args = config_args self.num_classes = config_args['data']['num_classes'] self.task = config_args["training"]["task"] self.loss_args = config_args["training"]["loss"] self.metrics = config_args["training"]["metrics"] self.nb_epochs = config_args["training"]["nb_epochs"] self.output_folder = config_args["training"]["output_folder"] self.lr_schedule = config_args["training"]["lr_schedule"] self.train_loader = train_loader self.val_loader = val_loader self.test_loader = test_loader # Usually val set is made from train set, else compute len as usual try: self.nsamples_train = len(self.train_loader.sampler.indices) self.nsamples_val = len(self.val_loader.sampler.indices) except: self.nsamples_train = len(self.train_loader.dataset) self.nsamples_val = len(self.val_loader.dataset) self.nsamples_test = len(self.test_loader.dataset) # Segmentation case if self.task == "classification": self.prod_train_len = self.nsamples_train self.prod_val_len = self.nsamples_val self.prod_test_len = self.nsamples_test if self.task == "segmentation": self.prod_train_len = ( self.nsamples_train * self.train_loader.dataset[0][0].shape[1] * self.train_loader.dataset[0][0].shape[2] ) self.prod_val_len = ( self.nsamples_val * self.val_loader.dataset[0][0].shape[1] * self.val_loader.dataset[0][0].shape[2] ) self.prod_test_len = ( self.nsamples_test * self.test_loader.dataset[0][0].shape[1] * self.test_loader.dataset[0][0].shape[2] ) self.device = device self.last_epoch = start_epoch - 2 self.criterion, self.scheduler, self.optimizer, self.tb_logger = None, None, None, None # Initialize model self.model = get_model(config_args, self.device).to(self.device) # Set optimizer self.set_optimizer(config_args["training"]["optimizer"]["name"]) # Set loss self.set_loss() # Temperature scaling self.temperature = config_args["training"].get("temperature", None) self.db = 0.0 def train(self, epoch): pass def set_loss(self): if self.loss_args["name"] in losses.CUSTOM_LOSS: self.criterion = losses.CUSTOM_LOSS[self.loss_args["name"]]( config_args=self.config_args, device=self.device ) elif self.loss_args["name"] in losses.PYTORCH_LOSS: self.criterion = losses.PYTORCH_LOSS[self.loss_args["name"]](ignore_index=255) else: raise Exception(f"Loss {self.loss_args['name']} not implemented") LOGGER.info(f"Using loss {self.loss_args['name']}") def set_optimizer(self, optimizer_name): optimizer_params = { k: v for k, v in self.config_args["training"]["optimizer"].items() if k != "name" } LOGGER.info(f"Using optimizer {optimizer_name}") if optimizer_name == "sgd": self.optimizer = optim.SGD(self.model.parameters(), **optimizer_params) elif optimizer_name == "adam": self.optimizer = optim.Adam(self.model.parameters(), **optimizer_params) elif optimizer_name == "adamw": self.optimizer = optim.AdamW(self.model.parameters(), **optimizer_params) elif optimizer_name == "adadelta": self.optimizer = optim.Adadelta(self.model.parameters(), **optimizer_params) else: raise KeyError("Bad optimizer name or not implemented (sgd, adam, adadelta).") def set_scheduler(self): self.scheduler = get_scheduler(self.optimizer, self.lr_schedule, self.last_epoch) def load_checkpoint(self, state_dict, strict=True): self.model.load_state_dict(state_dict, strict=strict) def save_checkpoint(self, epoch): torch.save( { "epoch": epoch, "model_state_dict": self.model.module.state_dict() if isinstance(self.model, torch.nn.DataParallel) else self.model.state_dict(), "optimizer_state_dict": self.optimizer.state_dict(), }, self.output_folder / f"model_epoch_{epoch:03d}.ckpt", ) def save_tb(self, logs_dict): # ================================================================== # # Tensorboard Logging # # ================================================================== # # 1. Log scalar values (scalar summary) epoch = logs_dict["epoch"]["value"] del logs_dict["epoch"] # for tag in logs_dict: # self.tb_logger.scalar_summary(tag, logs_dict[tag]["value"], epoch) # 2. Log values and gradients of the parameters (histogram summary) for tag, value in self.model.named_parameters(): tag = tag.replace(".", "/") # self.tb_logger.histo_summary(tag, value.data.cpu().numpy(), epoch) # if not value.grad is None: # self.tb_logger.histo_summary(tag + "/grad", value.grad.data.cpu().numpy(), epoch)
import os from PyQt5.QtWidgets import QFileDialog from app.data.database import DB from app.editor.data_editor import SingleDatabaseEditor from app.editor.base_database_gui import DatabaseTab import app.engine.skill_component_access as SCA from app.editor.settings import MainSettingsController from app.editor.skill_editor import skill_model, skill_import from app.editor.component_properties import ComponentProperties class SkillProperties(ComponentProperties): title = "Skill" get_components = staticmethod(SCA.get_skill_components) get_templates = staticmethod(SCA.get_templates) class SkillDatabase(DatabaseTab): allow_import_from_lt = True allow_copy_and_paste = True @classmethod def create(cls, parent=None): data = DB.skills title = "Skill" right_frame = SkillProperties deletion_criteria = None collection_model = skill_model.SkillModel dialog = cls(data, title, right_frame, deletion_criteria, collection_model, parent) return dialog def import_data(self): settings = MainSettingsController() starting_path = settings.get_last_open_path() fn, ok = QFileDialog.getOpenFileName(self, "Import skills from status.xml", starting_path, "Status XML (status.xml);;All Files(*)") if ok and fn.endswith('status.xml'): parent_dir = os.path.split(fn)[0] settings.set_last_open_path(parent_dir) new_skills = skill_import.get_from_xml(parent_dir, fn) for skill in new_skills: self._data.append(skill) self.update_list() # Testing # Run "python -m app.editor.skill_editor.skill_tab" from main directory if __name__ == '__main__': import sys from PyQt5.QtWidgets import QApplication app = QApplication(sys.argv) from app.resources.resources import RESOURCES RESOURCES.load('default.ltproj') DB.load('default.ltproj') window = SingleDatabaseEditor(SkillDatabase) window.show() app.exec_()
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import datetime import itertools import mock from oslo_config import cfg from oslo_serialization import jsonutils from oslo_utils import timeutils from wsme import types as wtypes from six.moves.urllib import parse as urlparse from watcher.api.controllers.v1 import audit as api_audit from watcher.common import utils from watcher.db import api as db_api from watcher.decision_engine import rpcapi as deapi from watcher import objects from watcher.tests.api import base as api_base from watcher.tests.api import utils as api_utils from watcher.tests import base from watcher.tests.db import utils as db_utils from watcher.tests.objects import utils as obj_utils def post_get_test_audit(**kw): audit = api_utils.audit_post_data(**kw) audit_template = db_utils.get_test_audit_template() goal = db_utils.get_test_goal() del_keys = ['goal_id', 'strategy_id'] add_keys = {'audit_template_uuid': audit_template['uuid'], 'goal': goal['uuid'], } for k in del_keys: del audit[k] for k in add_keys: audit[k] = kw.get(k, add_keys[k]) return audit def post_get_test_audit_with_predefined_strategy(**kw): spec = kw.pop('strategy_parameters_spec', {}) strategy_id = 2 strategy = db_utils.get_test_strategy(parameters_spec=spec, id=strategy_id) audit = api_utils.audit_post_data(**kw) audit_template = db_utils.get_test_audit_template( strategy_id=strategy['id']) del_keys = ['goal_id', 'strategy_id'] add_keys = {'audit_template_uuid': audit_template['uuid'], } for k in del_keys: del audit[k] for k in add_keys: audit[k] = kw.get(k, add_keys[k]) return audit class TestAuditObject(base.TestCase): def test_audit_init(self): audit_dict = api_utils.audit_post_data(audit_template_id=None, goal_id=None, strategy_id=None) del audit_dict['state'] audit = api_audit.Audit(**audit_dict) self.assertEqual(wtypes.Unset, audit.state) class TestListAudit(api_base.FunctionalTest): def setUp(self): super(TestListAudit, self).setUp() obj_utils.create_test_goal(self.context) obj_utils.create_test_strategy(self.context) obj_utils.create_test_audit_template(self.context) def test_empty(self): response = self.get_json('/audits') self.assertEqual([], response['audits']) def _assert_audit_fields(self, audit): audit_fields = ['audit_type', 'scope', 'state', 'goal_uuid', 'strategy_uuid'] for field in audit_fields: self.assertIn(field, audit) def test_one(self): audit = obj_utils.create_test_audit(self.context) response = self.get_json('/audits') self.assertEqual(audit.uuid, response['audits'][0]["uuid"]) self._assert_audit_fields(response['audits'][0]) def test_one_soft_deleted(self): audit = obj_utils.create_test_audit(self.context) audit.soft_delete() response = self.get_json('/audits', headers={'X-Show-Deleted': 'True'}) self.assertEqual(audit.uuid, response['audits'][0]["uuid"]) self._assert_audit_fields(response['audits'][0]) response = self.get_json('/audits') self.assertEqual([], response['audits']) def test_get_one(self): audit = obj_utils.create_test_audit(self.context) response = self.get_json('/audits/%s' % audit['uuid']) self.assertEqual(audit.uuid, response['uuid']) self._assert_audit_fields(response) def test_get_one_soft_deleted(self): audit = obj_utils.create_test_audit(self.context) audit.soft_delete() response = self.get_json('/audits/%s' % audit['uuid'], headers={'X-Show-Deleted': 'True'}) self.assertEqual(audit.uuid, response['uuid']) self._assert_audit_fields(response) response = self.get_json('/audits/%s' % audit['uuid'], expect_errors=True) self.assertEqual(404, response.status_int) def test_detail(self): audit = obj_utils.create_test_audit(self.context) response = self.get_json('/audits/detail') self.assertEqual(audit.uuid, response['audits'][0]["uuid"]) self._assert_audit_fields(response['audits'][0]) def test_detail_soft_deleted(self): audit = obj_utils.create_test_audit(self.context) audit.soft_delete() response = self.get_json('/audits/detail', headers={'X-Show-Deleted': 'True'}) self.assertEqual(audit.uuid, response['audits'][0]["uuid"]) self._assert_audit_fields(response['audits'][0]) response = self.get_json('/audits/detail') self.assertEqual([], response['audits']) def test_detail_against_single(self): audit = obj_utils.create_test_audit(self.context) response = self.get_json('/audits/%s/detail' % audit['uuid'], expect_errors=True) self.assertEqual(404, response.status_int) def test_many(self): audit_list = [] for id_ in range(5): audit = obj_utils.create_test_audit(self.context, id=id_, uuid=utils.generate_uuid()) audit_list.append(audit.uuid) response = self.get_json('/audits') self.assertEqual(len(audit_list), len(response['audits'])) uuids = [s['uuid'] for s in response['audits']] self.assertEqual(sorted(audit_list), sorted(uuids)) def test_many_without_soft_deleted(self): audit_list = [] for id_ in [1, 2, 3]: audit = obj_utils.create_test_audit(self.context, id=id_, uuid=utils.generate_uuid()) audit_list.append(audit.uuid) for id_ in [4, 5]: audit = obj_utils.create_test_audit(self.context, id=id_, uuid=utils.generate_uuid()) audit.soft_delete() response = self.get_json('/audits') self.assertEqual(3, len(response['audits'])) uuids = [s['uuid'] for s in response['audits']] self.assertEqual(sorted(audit_list), sorted(uuids)) def test_many_with_soft_deleted(self): audit_list = [] for id_ in [1, 2, 3]: audit = obj_utils.create_test_audit(self.context, id=id_, uuid=utils.generate_uuid()) audit_list.append(audit.uuid) for id_ in [4, 5]: audit = obj_utils.create_test_audit(self.context, id=id_, uuid=utils.generate_uuid()) audit.soft_delete() audit_list.append(audit.uuid) response = self.get_json('/audits', headers={'X-Show-Deleted': 'True'}) self.assertEqual(5, len(response['audits'])) uuids = [s['uuid'] for s in response['audits']] self.assertEqual(sorted(audit_list), sorted(uuids)) def test_many_with_sort_key_goal_uuid(self): goal_list = [] for id_ in range(5): goal = obj_utils.create_test_goal( self.context, name='gl{0}'.format(id_), uuid=utils.generate_uuid()) obj_utils.create_test_audit( self.context, id=id_, uuid=utils.generate_uuid(), goal_id=goal.id) goal_list.append(goal.uuid) response = self.get_json('/audits/?sort_key=goal_uuid') self.assertEqual(5, len(response['audits'])) uuids = [s['goal_uuid'] for s in response['audits']] self.assertEqual(sorted(goal_list), uuids) def test_links(self): uuid = utils.generate_uuid() obj_utils.create_test_audit(self.context, id=1, uuid=uuid) response = self.get_json('/audits/%s' % uuid) self.assertIn('links', response.keys()) self.assertEqual(2, len(response['links'])) self.assertIn(uuid, response['links'][0]['href']) for l in response['links']: bookmark = l['rel'] == 'bookmark' self.assertTrue(self.validate_link(l['href'], bookmark=bookmark)) def test_collection_links(self): for id_ in range(5): obj_utils.create_test_audit(self.context, id=id_, uuid=utils.generate_uuid()) response = self.get_json('/audits/?limit=3') self.assertEqual(3, len(response['audits'])) next_marker = response['audits'][-1]['uuid'] self.assertIn(next_marker, response['next']) def test_collection_links_default_limit(self): cfg.CONF.set_override('max_limit', 3, 'api', enforce_type=True) for id_ in range(5): obj_utils.create_test_audit(self.context, id=id_, uuid=utils.generate_uuid()) response = self.get_json('/audits') self.assertEqual(3, len(response['audits'])) next_marker = response['audits'][-1]['uuid'] self.assertIn(next_marker, response['next']) class TestPatch(api_base.FunctionalTest): def setUp(self): super(TestPatch, self).setUp() obj_utils.create_test_goal(self.context) obj_utils.create_test_strategy(self.context) obj_utils.create_test_audit_template(self.context) self.audit = obj_utils.create_test_audit(self.context) p = mock.patch.object(db_api.BaseConnection, 'update_audit') self.mock_audit_update = p.start() self.mock_audit_update.side_effect = self._simulate_rpc_audit_update self.addCleanup(p.stop) def _simulate_rpc_audit_update(self, audit): audit.save() return audit @mock.patch('oslo_utils.timeutils.utcnow') def test_replace_ok(self, mock_utcnow): test_time = datetime.datetime(2000, 1, 1, 0, 0) mock_utcnow.return_value = test_time new_state = objects.audit.State.CANCELLED response = self.get_json('/audits/%s' % self.audit.uuid) self.assertNotEqual(new_state, response['state']) response = self.patch_json( '/audits/%s' % self.audit.uuid, [{'path': '/state', 'value': new_state, 'op': 'replace'}]) self.assertEqual('application/json', response.content_type) self.assertEqual(200, response.status_code) response = self.get_json('/audits/%s' % self.audit.uuid) self.assertEqual(new_state, response['state']) return_updated_at = timeutils.parse_isotime( response['updated_at']).replace(tzinfo=None) self.assertEqual(test_time, return_updated_at) def test_replace_non_existent_audit(self): response = self.patch_json( '/audits/%s' % utils.generate_uuid(), [{'path': '/state', 'value': objects.audit.State.SUCCEEDED, 'op': 'replace'}], expect_errors=True) self.assertEqual(404, response.status_int) self.assertEqual('application/json', response.content_type) self.assertTrue(response.json['error_message']) def test_add_ok(self): new_state = objects.audit.State.SUCCEEDED response = self.patch_json( '/audits/%s' % self.audit.uuid, [{'path': '/state', 'value': new_state, 'op': 'add'}]) self.assertEqual('application/json', response.content_type) self.assertEqual(200, response.status_int) response = self.get_json('/audits/%s' % self.audit.uuid) self.assertEqual(new_state, response['state']) def test_add_non_existent_property(self): response = self.patch_json( '/audits/%s' % self.audit.uuid, [{'path': '/foo', 'value': 'bar', 'op': 'add'}], expect_errors=True) self.assertEqual('application/json', response.content_type) self.assertEqual(400, response.status_int) self.assertTrue(response.json['error_message']) def test_remove_ok(self): response = self.get_json('/audits/%s' % self.audit.uuid) self.assertIsNotNone(response['interval']) response = self.patch_json('/audits/%s' % self.audit.uuid, [{'path': '/interval', 'op': 'remove'}]) self.assertEqual('application/json', response.content_type) self.assertEqual(200, response.status_code) response = self.get_json('/audits/%s' % self.audit.uuid) self.assertIsNone(response['interval']) def test_remove_uuid(self): response = self.patch_json('/audits/%s' % self.audit.uuid, [{'path': '/uuid', 'op': 'remove'}], expect_errors=True) self.assertEqual(400, response.status_int) self.assertEqual('application/json', response.content_type) self.assertTrue(response.json['error_message']) def test_remove_non_existent_property(self): response = self.patch_json( '/audits/%s' % self.audit.uuid, [{'path': '/non-existent', 'op': 'remove'}], expect_errors=True) self.assertEqual(400, response.status_code) self.assertEqual('application/json', response.content_type) self.assertTrue(response.json['error_message']) ALLOWED_TRANSITIONS = [ {"original_state": objects.audit.State.PENDING, "new_state": objects.audit.State.ONGOING}, {"original_state": objects.audit.State.PENDING, "new_state": objects.audit.State.CANCELLED}, {"original_state": objects.audit.State.ONGOING, "new_state": objects.audit.State.FAILED}, {"original_state": objects.audit.State.ONGOING, "new_state": objects.audit.State.SUCCEEDED}, {"original_state": objects.audit.State.ONGOING, "new_state": objects.audit.State.CANCELLED}, {"original_state": objects.audit.State.FAILED, "new_state": objects.audit.State.DELETED}, {"original_state": objects.audit.State.SUCCEEDED, "new_state": objects.audit.State.DELETED}, {"original_state": objects.audit.State.CANCELLED, "new_state": objects.audit.State.DELETED}, ] class TestPatchStateTransitionDenied(api_base.FunctionalTest): STATES = [ ap_state for ap_state in objects.audit.State.__dict__ if not ap_state.startswith("_") ] scenarios = [ ( "%s -> %s" % (original_state, new_state), {"original_state": original_state, "new_state": new_state}, ) for original_state, new_state in list(itertools.product(STATES, STATES)) if original_state != new_state and {"original_state": original_state, "new_state": new_state} not in ALLOWED_TRANSITIONS ] def setUp(self): super(TestPatchStateTransitionDenied, self).setUp() obj_utils.create_test_goal(self.context) obj_utils.create_test_strategy(self.context) obj_utils.create_test_audit_template(self.context) self.audit = obj_utils.create_test_audit(self.context, state=self.original_state) p = mock.patch.object(db_api.BaseConnection, 'update_audit') self.mock_audit_update = p.start() self.mock_audit_update.side_effect = self._simulate_rpc_audit_update self.addCleanup(p.stop) def _simulate_rpc_audit_update(self, audit): audit.save() return audit def test_replace_denied(self): response = self.get_json('/audits/%s' % self.audit.uuid) self.assertNotEqual(self.new_state, response['state']) response = self.patch_json( '/audits/%s' % self.audit.uuid, [{'path': '/state', 'value': self.new_state, 'op': 'replace'}], expect_errors=True) self.assertEqual('application/json', response.content_type) self.assertEqual(400, response.status_code) self.assertTrue(response.json['error_message']) response = self.get_json('/audits/%s' % self.audit.uuid) self.assertEqual(self.original_state, response['state']) class TestPatchStateTransitionOk(api_base.FunctionalTest): scenarios = [ ( "%s -> %s" % (transition["original_state"], transition["new_state"]), transition ) for transition in ALLOWED_TRANSITIONS ] def setUp(self): super(TestPatchStateTransitionOk, self).setUp() obj_utils.create_test_goal(self.context) obj_utils.create_test_strategy(self.context) obj_utils.create_test_audit_template(self.context) self.audit = obj_utils.create_test_audit(self.context, state=self.original_state) p = mock.patch.object(db_api.BaseConnection, 'update_audit') self.mock_audit_update = p.start() self.mock_audit_update.side_effect = self._simulate_rpc_audit_update self.addCleanup(p.stop) def _simulate_rpc_audit_update(self, audit): audit.save() return audit @mock.patch('oslo_utils.timeutils.utcnow') def test_replace_ok(self, mock_utcnow): test_time = datetime.datetime(2000, 1, 1, 0, 0) mock_utcnow.return_value = test_time response = self.get_json('/audits/%s' % self.audit.uuid) self.assertNotEqual(self.new_state, response['state']) response = self.patch_json( '/audits/%s' % self.audit.uuid, [{'path': '/state', 'value': self.new_state, 'op': 'replace'}]) self.assertEqual('application/json', response.content_type) self.assertEqual(200, response.status_code) response = self.get_json('/audits/%s' % self.audit.uuid) self.assertEqual(self.new_state, response['state']) return_updated_at = timeutils.parse_isotime( response['updated_at']).replace(tzinfo=None) self.assertEqual(test_time, return_updated_at) class TestPost(api_base.FunctionalTest): def setUp(self): super(TestPost, self).setUp() obj_utils.create_test_goal(self.context) obj_utils.create_test_strategy(self.context) obj_utils.create_test_audit_template(self.context) p = mock.patch.object(db_api.BaseConnection, 'create_audit') self.mock_create_audit = p.start() self.mock_create_audit.side_effect = ( self._simulate_rpc_audit_create) self.addCleanup(p.stop) def _simulate_rpc_audit_create(self, audit): audit.create() return audit @mock.patch.object(deapi.DecisionEngineAPI, 'trigger_audit') @mock.patch('oslo_utils.timeutils.utcnow') def test_create_audit(self, mock_utcnow, mock_trigger_audit): mock_trigger_audit.return_value = mock.ANY test_time = datetime.datetime(2000, 1, 1, 0, 0) mock_utcnow.return_value = test_time audit_dict = post_get_test_audit(state=objects.audit.State.PENDING) del audit_dict['uuid'] del audit_dict['state'] del audit_dict['interval'] del audit_dict['scope'] response = self.post_json('/audits', audit_dict) self.assertEqual('application/json', response.content_type) self.assertEqual(201, response.status_int) # Check location header self.assertIsNotNone(response.location) expected_location = '/v1/audits/%s' % response.json['uuid'] self.assertEqual(urlparse.urlparse(response.location).path, expected_location) self.assertEqual(objects.audit.State.PENDING, response.json['state']) self.assertNotIn('updated_at', response.json.keys) self.assertNotIn('deleted_at', response.json.keys) return_created_at = timeutils.parse_isotime( response.json['created_at']).replace(tzinfo=None) self.assertEqual(test_time, return_created_at) @mock.patch.object(deapi.DecisionEngineAPI, 'trigger_audit') @mock.patch('oslo_utils.timeutils.utcnow') def test_create_audit_with_state_not_allowed(self, mock_utcnow, mock_trigger_audit): mock_trigger_audit.return_value = mock.ANY test_time = datetime.datetime(2000, 1, 1, 0, 0) mock_utcnow.return_value = test_time audit_dict = post_get_test_audit(state=objects.audit.State.SUCCEEDED) response = self.post_json('/audits', audit_dict, expect_errors=True) self.assertEqual(400, response.status_int) self.assertEqual('application/json', response.content_type) self.assertTrue(response.json['error_message']) @mock.patch('oslo_utils.timeutils.utcnow') def test_create_audit_invalid_audit_template_uuid(self, mock_utcnow): test_time = datetime.datetime(2000, 1, 1, 0, 0) mock_utcnow.return_value = test_time audit_dict = post_get_test_audit() del audit_dict['uuid'] del audit_dict['state'] del audit_dict['interval'] del audit_dict['scope'] # Make the audit template UUID some garbage value audit_dict['audit_template_uuid'] = ( '01234567-8910-1112-1314-151617181920') response = self.post_json('/audits', audit_dict, expect_errors=True) self.assertEqual(400, response.status_int) self.assertEqual("application/json", response.content_type) expected_error_msg = ('The audit template UUID or name specified is ' 'invalid') self.assertTrue(response.json['error_message']) self.assertIn(expected_error_msg, response.json['error_message']) @mock.patch.object(deapi.DecisionEngineAPI, 'trigger_audit') def test_create_audit_doesnt_contain_id(self, mock_trigger_audit): mock_trigger_audit.return_value = mock.ANY audit_dict = post_get_test_audit(state=objects.audit.State.PENDING) state = audit_dict['state'] del audit_dict['uuid'] del audit_dict['state'] del audit_dict['interval'] del audit_dict['scope'] with mock.patch.object(self.dbapi, 'create_audit', wraps=self.dbapi.create_audit) as cn_mock: response = self.post_json('/audits', audit_dict) self.assertEqual(state, response.json['state']) cn_mock.assert_called_once_with(mock.ANY) # Check that 'id' is not in first arg of positional args self.assertNotIn('id', cn_mock.call_args[0][0]) @mock.patch.object(deapi.DecisionEngineAPI, 'trigger_audit') def test_create_audit_generate_uuid(self, mock_trigger_audit): mock_trigger_audit.return_value = mock.ANY audit_dict = post_get_test_audit() del audit_dict['uuid'] del audit_dict['state'] del audit_dict['interval'] del audit_dict['scope'] response = self.post_json('/audits', audit_dict) self.assertEqual('application/json', response.content_type) self.assertEqual(201, response.status_int) self.assertEqual(objects.audit.State.PENDING, response.json['state']) self.assertTrue(utils.is_uuid_like(response.json['uuid'])) @mock.patch.object(deapi.DecisionEngineAPI, 'trigger_audit') def test_create_continuous_audit_with_period(self, mock_trigger_audit): mock_trigger_audit.return_value = mock.ANY audit_dict = post_get_test_audit() del audit_dict['uuid'] del audit_dict['state'] del audit_dict['scope'] audit_dict['audit_type'] = objects.audit.AuditType.CONTINUOUS.value audit_dict['interval'] = 1200 response = self.post_json('/audits', audit_dict) self.assertEqual('application/json', response.content_type) self.assertEqual(201, response.status_int) self.assertEqual(objects.audit.State.PENDING, response.json['state']) self.assertEqual(audit_dict['interval'], response.json['interval']) self.assertTrue(utils.is_uuid_like(response.json['uuid'])) @mock.patch.object(deapi.DecisionEngineAPI, 'trigger_audit') def test_create_continuous_audit_without_period(self, mock_trigger_audit): mock_trigger_audit.return_value = mock.ANY audit_dict = post_get_test_audit() del audit_dict['uuid'] del audit_dict['state'] audit_dict['audit_type'] = objects.audit.AuditType.CONTINUOUS.value del audit_dict['interval'] del audit_dict['scope'] response = self.post_json('/audits', audit_dict, expect_errors=True) self.assertEqual(400, response.status_int) self.assertEqual('application/json', response.content_type) expected_error_msg = ('Interval of audit must be specified ' 'for CONTINUOUS.') self.assertTrue(response.json['error_message']) self.assertIn(expected_error_msg, response.json['error_message']) @mock.patch.object(deapi.DecisionEngineAPI, 'trigger_audit') def test_create_oneshot_audit_with_period(self, mock_trigger_audit): mock_trigger_audit.return_value = mock.ANY audit_dict = post_get_test_audit() del audit_dict['uuid'] del audit_dict['state'] audit_dict['audit_type'] = objects.audit.AuditType.ONESHOT.value audit_dict['interval'] = 1200 del audit_dict['scope'] response = self.post_json('/audits', audit_dict, expect_errors=True) self.assertEqual(400, response.status_int) self.assertEqual('application/json', response.content_type) expected_error_msg = 'Interval of audit must not be set for ONESHOT.' self.assertTrue(response.json['error_message']) self.assertIn(expected_error_msg, response.json['error_message']) def test_create_audit_trigger_decision_engine(self): with mock.patch.object(deapi.DecisionEngineAPI, 'trigger_audit') as de_mock: audit_dict = post_get_test_audit(state=objects.audit.State.PENDING) del audit_dict['uuid'] del audit_dict['state'] del audit_dict['interval'] del audit_dict['scope'] response = self.post_json('/audits', audit_dict) de_mock.assert_called_once_with(mock.ANY, response.json['uuid']) @mock.patch.object(deapi.DecisionEngineAPI, 'trigger_audit') def test_create_audit_with_uuid(self, mock_trigger_audit): mock_trigger_audit.return_value = mock.ANY audit_dict = post_get_test_audit(state=objects.audit.State.PENDING) del audit_dict['scope'] response = self.post_json('/audits', audit_dict, expect_errors=True) self.assertEqual('application/json', response.content_type) self.assertEqual(400, response.status_int) assert not mock_trigger_audit.called @mock.patch.object(deapi.DecisionEngineAPI, 'trigger_audit') def test_create_audit_parameters_no_predefined_strategy( self, mock_trigger_audit): mock_trigger_audit.return_value = mock.ANY audit_dict = post_get_test_audit(parameters={'name': 'Tom'}) del audit_dict['uuid'] del audit_dict['state'] del audit_dict['interval'] del audit_dict['scope'] response = self.post_json('/audits', audit_dict, expect_errors=True) self.assertEqual('application/json', response.content_type) self.assertEqual(400, response.status_int) expected_error_msg = ('Specify parameters but no predefined ' 'strategy for audit template, or no ' 'parameter spec in predefined strategy') self.assertTrue(response.json['error_message']) self.assertIn(expected_error_msg, response.json['error_message']) assert not mock_trigger_audit.called @mock.patch.object(deapi.DecisionEngineAPI, 'trigger_audit') def test_create_audit_parameters_no_schema( self, mock_trigger_audit): mock_trigger_audit.return_value = mock.ANY audit_dict = post_get_test_audit_with_predefined_strategy( parameters={'name': 'Tom'}) del audit_dict['uuid'] del audit_dict['state'] del audit_dict['interval'] del audit_dict['scope'] response = self.post_json('/audits', audit_dict, expect_errors=True) self.assertEqual('application/json', response.content_type) self.assertEqual(400, response.status_int) expected_error_msg = ('Specify parameters but no predefined ' 'strategy for audit template, or no ' 'parameter spec in predefined strategy') self.assertTrue(response.json['error_message']) self.assertIn(expected_error_msg, response.json['error_message']) assert not mock_trigger_audit.called @mock.patch.object(deapi.DecisionEngineAPI, 'trigger_audit') def test_create_audit_with_parameter_not_allowed( self, mock_trigger_audit): mock_trigger_audit.return_value = mock.ANY audit_template = self.prepare_audit_template_strategy_with_parameter() audit_dict = api_utils.audit_post_data( parameters={'fake1': 1, 'fake2': "hello"}) audit_dict['audit_template_uuid'] = audit_template['uuid'] del_keys = ['uuid', 'goal_id', 'strategy_id', 'state', 'interval', 'scope'] for k in del_keys: del audit_dict[k] response = self.post_json('/audits', audit_dict, expect_errors=True) self.assertEqual(400, response.status_int) self.assertEqual("application/json", response.content_type) expected_error_msg = 'Audit parameter fake2 are not allowed' self.assertTrue(response.json['error_message']) self.assertIn(expected_error_msg, response.json['error_message']) assert not mock_trigger_audit.called def prepare_audit_template_strategy_with_parameter(self): fake_spec = { "properties": { "fake1": { "description": "number parameter example", "type": "number", "default": 3.2, "minimum": 1.0, "maximum": 10.2, } } } template_uuid = 'e74c40e0-d825-11e2-a28f-0800200c9a67' strategy_uuid = 'e74c40e0-d825-11e2-a28f-0800200c9a68' template_name = 'my template' strategy_name = 'my strategy' strategy_id = 3 strategy = db_utils.get_test_strategy(parameters_spec=fake_spec, id=strategy_id, uuid=strategy_uuid, name=strategy_name) obj_utils.create_test_strategy(self.context, parameters_spec=fake_spec, id=strategy_id, uuid=strategy_uuid, name=strategy_name) obj_utils.create_test_audit_template(self.context, strategy_id=strategy_id, uuid=template_uuid, name='name') audit_template = db_utils.get_test_audit_template( strategy_id=strategy['id'], uuid=template_uuid, name=template_name) return audit_template class TestDelete(api_base.FunctionalTest): def setUp(self): super(TestDelete, self).setUp() obj_utils.create_test_goal(self.context) obj_utils.create_test_strategy(self.context) obj_utils.create_test_audit_template(self.context) self.audit = obj_utils.create_test_audit(self.context) p = mock.patch.object(db_api.BaseConnection, 'update_audit') self.mock_audit_update = p.start() self.mock_audit_update.side_effect = self._simulate_rpc_audit_update self.addCleanup(p.stop) def _simulate_rpc_audit_update(self, audit): audit.save() return audit @mock.patch('oslo_utils.timeutils.utcnow') def test_delete_audit(self, mock_utcnow): test_time = datetime.datetime(2000, 1, 1, 0, 0) mock_utcnow.return_value = test_time self.delete('/audits/%s' % self.audit.uuid) response = self.get_json('/audits/%s' % self.audit.uuid, expect_errors=True) self.assertEqual(404, response.status_int) self.assertEqual('application/json', response.content_type) self.assertTrue(response.json['error_message']) self.context.show_deleted = True audit = objects.Audit.get_by_uuid(self.context, self.audit.uuid) return_deleted_at = timeutils.strtime(audit['deleted_at']) self.assertEqual(timeutils.strtime(test_time), return_deleted_at) self.assertEqual(objects.audit.State.DELETED, audit['state']) def test_delete_audit_not_found(self): uuid = utils.generate_uuid() response = self.delete('/audits/%s' % uuid, expect_errors=True) self.assertEqual(404, response.status_int) self.assertEqual('application/json', response.content_type) self.assertTrue(response.json['error_message']) class TestAuditPolicyEnforcement(api_base.FunctionalTest): def setUp(self): super(TestAuditPolicyEnforcement, self).setUp() obj_utils.create_test_goal(self.context) def _common_policy_check(self, rule, func, *arg, **kwarg): self.policy.set_rules({ "admin_api": "(role:admin or role:administrator)", "default": "rule:admin_api", rule: "rule:defaut"}) response = func(*arg, **kwarg) self.assertEqual(403, response.status_int) self.assertEqual('application/json', response.content_type) self.assertTrue( "Policy doesn't allow %s to be performed." % rule, jsonutils.loads(response.json['error_message'])['faultstring']) def test_policy_disallow_get_all(self): self._common_policy_check( "audit:get_all", self.get_json, '/audits', expect_errors=True) def test_policy_disallow_get_one(self): audit = obj_utils.create_test_audit(self.context) self._common_policy_check( "audit:get", self.get_json, '/audits/%s' % audit.uuid, expect_errors=True) def test_policy_disallow_detail(self): self._common_policy_check( "audit:detail", self.get_json, '/audits/detail', expect_errors=True) def test_policy_disallow_update(self): audit = obj_utils.create_test_audit(self.context) self._common_policy_check( "audit:update", self.patch_json, '/audits/%s' % audit.uuid, [{'path': '/state', 'value': objects.audit.State.SUCCEEDED, 'op': 'replace'}], expect_errors=True) def test_policy_disallow_create(self): audit_dict = post_get_test_audit(state=objects.audit.State.PENDING) del audit_dict['uuid'] del audit_dict['state'] del audit_dict['scope'] self._common_policy_check( "audit:create", self.post_json, '/audits', audit_dict, expect_errors=True) def test_policy_disallow_delete(self): audit = obj_utils.create_test_audit(self.context) self._common_policy_check( "audit:delete", self.delete, '/audits/%s' % audit.uuid, expect_errors=True) class TestAuditEnforcementWithAdminContext(TestListAudit, api_base.AdminRoleTest): def setUp(self): super(TestAuditEnforcementWithAdminContext, self).setUp() self.policy.set_rules({ "admin_api": "(role:admin or role:administrator)", "default": "rule:admin_api", "audit:create": "rule:default", "audit:delete": "rule:default", "audit:detail": "rule:default", "audit:get": "rule:default", "audit:get_all": "rule:default", "audit:update": "rule:default"})
from pymongo import MongoClient __author__ = 'Parry' from gensim.models import LdaModel from gensim import corpora from Constants import Parameters dictionary = corpora.Dictionary.load(Parameters.Dictionary_path) corpus = corpora.BleiCorpus(Parameters.Corpus_path) lda = LdaModel.load(Parameters.Lda_model_path) corpus_collection = MongoClient(Parameters.MONGO_CONNECTION_STRING)[Parameters.REVIEWS_DATABASE][Parameters.CORPUS_COLLECTION] i=0 corpus_cursor = corpus_collection.find() for review in corpus_cursor: # assume there's one document per line, tokens separated by whitespace i=i+1 print lda[dictionary.doc2bow(review["words"])] if i ==20: break;
import os class Config: STEAM_API_KEY = os.environ.get("STEAM_API_KEY")
#!/usr/bin/env python3 from typing import List from cereal import car, log from math import fabs from common.numpy_fast import interp from common.conversions import Conversions as CV from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, is_ecu_disconnected, gen_empty_fingerprint, get_safety_config from selfdrive.car.gm.values import CAR, Ecu, ECU_FINGERPRINT, CruiseButtons, \ AccState, FINGERPRINTS, CarControllerParams from selfdrive.car.interfaces import CarInterfaceBase from common.params import Params from selfdrive.kegman_kans_conf import kegman_kans_conf ButtonType = car.CarState.ButtonEvent.Type EventName = car.CarEvent.EventName class CarInterface(CarInterfaceBase): def __init__(self, CP, CarController, CarState): super().__init__(CP, CarController, CarState) def _update(self, c: car.CarControl) -> car.CarState: pass @staticmethod def get_pid_accel_limits(CP, current_speed, cruise_speed): params = CarControllerParams() return params.ACCEL_MIN, params.ACCEL_MAX # Determined by iteratively plotting and minimizing error for f(angle, speed) = steer. @staticmethod def get_steer_feedforward_volt(desired_angle, v_ego): desired_angle *= 0.02904609 sigmoid = desired_angle / (1 + fabs(desired_angle)) return 0.10006696 * sigmoid * (v_ego + 3.12485927) @staticmethod def get_steer_feedforward_acadia(desired_angle, v_ego): desired_angle *= 0.09760208 sigmoid = desired_angle / (1 + fabs(desired_angle)) return 0.04689655 * sigmoid * (v_ego + 10.028217) def get_steer_feedforward_function(self): if self.CP.carFingerprint == CAR.VOLT: return self.get_steer_feedforward_volt elif self.CP.carFingerprint == CAR.ACADIA: return self.get_steer_feedforward_acadia else: return CarInterfaceBase.get_steer_feedforward_default @staticmethod def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disable_radar=False): ret = CarInterfaceBase.get_std_params(candidate, fingerprint) ret.carName = "gm" ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.gm)] ret.pcmCruise = False # stock cruise control is kept off # These cars have been put into dashcam only due to both a lack of users and test coverage. # These cars likely still work fine. Once a user confirms each car works and a test route is # added to selfdrive/test/test_routes, we can remove it from this list. ret.dashcamOnly = candidate in {CAR.CADILLAC_ATS, CAR.HOLDEN_ASTRA, CAR.MALIBU, CAR.BUICK_REGAL} # Presence of a camera on the object bus is ok. # Have to go to read_only if ASCM is online (ACC-enabled cars), # or camera is on powertrain bus (LKA cars without ACC). # for white panda # ret.enableGasInterceptor = 0x201 in fingerprint[0] ret.enableGasInterceptor = 512 in fingerprint[0] # Params().get_bool("EnableAutoResume") or (512 in fingerprint[0]) ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, Ecu.fwdCamera) ret.openpilotLongitudinalControl = ret.enableCamera or ret.enableGasInterceptor ret.autoResume = Params().get_bool("EnableAutoResume") tire_stiffness_factor = 0.469 # for autohold on ui icon ret.enableAutoHold = 241 in fingerprint[0] # Start with a baseline lateral tuning for all GM vehicles. Override tuning as needed in each model section below. ret.minSteerSpeed = 7 * CV.MPH_TO_MS ret.minEnableSpeed = -1 ret.mass = 1607. + STD_CARGO_KG ret.wheelbase = 2.69 ret.steerRatio = 17.7 ret.steerRateCost = 0.23 ret.steerActuatorDelay = 0.225 # Default delay, not measured yet ret.steerRatioRear = 0. ret.centerToFront = ret.wheelbase * 0.49 # wild guess # live tune kegman_kans = kegman_kans_conf() ret.steerLimitTimer = float(kegman_kans.conf['steerLimitTimer']) ret.disableLateralLiveTuning = False # lateral lateral_control = Params().get("LateralControl", encoding='utf-8') if lateral_control == 'INDI': ret.lateralTuning.init('indi') ret.lateralTuning.indi.innerLoopGainBP = [0.] ret.lateralTuning.indi.innerLoopGainV = [3.3] ret.lateralTuning.indi.outerLoopGainBP = [0.] ret.lateralTuning.indi.outerLoopGainV = [2.8] ret.lateralTuning.indi.timeConstantBP = [0.] ret.lateralTuning.indi.timeConstantV = [1.4] ret.lateralTuning.indi.actuatorEffectivenessBP = [0.] ret.lateralTuning.indi.actuatorEffectivenessV = [1.8] elif lateral_control == 'LQR': ret.lateralTuning.init('lqr') ret.lateralTuning.lqr.scale = 1950.0 ret.lateralTuning.lqr.ki = 0.032 ret.lateralTuning.lqr.dcGain = 0.002237852961363602 ret.lateralTuning.lqr.a = [0., 1., -0.22619643, 1.21822268] ret.lateralTuning.lqr.b = [-1.92006585e-04, 3.95603032e-05] ret.lateralTuning.lqr.c = [1., 0.] ret.lateralTuning.lqr.k = [-110., 451.] ret.lateralTuning.lqr.l = [0.33, 0.318] elif lateral_control == 'TORQUE': ret.lateralTuning.init('torque') ret.lateralTuning.torque.useSteeringAngle = True max_lat_accel = 2.3 ret.lateralTuning.torque.kp = 1.0 / max_lat_accel ret.lateralTuning.torque.kf = 1.0 / max_lat_accel ret.lateralTuning.torque.ki = 0.25 / max_lat_accel ret.lateralTuning.torque.friction = 0.02 ret.lateralTuning.torque.kd = 0.0 ret.lateralTuning.torque.deadzone = 0.0 elif lateral_control == 'PID': ret.lateralTuning.init('pid') if candidate == CAR.VOLT: ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.], [0.]] ret.lateralTuning.pid.kiV, ret.lateralTuning.pid.kpV = [[0.0175], [0.185]] ret.lateralTuning.pid.kf = 1. # get_steer_feedforward_volt() # D gain ret.lateralTuning.pid.kdBP = [0., 15., 33.] ret.lateralTuning.pid.kdV = [0.49, 0.65, 0.725] #corolla from shane fork : 0.725 else: ret.lateralTuning.init('hybrid') # TODO: get actual value, for now starting with reasonable value for # civic and scaling by mass and wheelbase ret.rotationalInertia = scale_rot_inertia(ret.mass, ret.wheelbase) # TODO: start from empirically derived lateral slip stiffness for the civic and scale by # mass and CG position, so all cars will have approximately similar dyn behaviors ret.tireStiffnessFront, ret.tireStiffnessRear = scale_tire_stiffness(ret.mass, ret.wheelbase, ret.centerToFront, \ tire_stiffness_factor=tire_stiffness_factor) ret.stoppingControl = True ret.longitudinalTuning.deadzoneBP = [0., 100.*CV.KPH_TO_MS] ret.longitudinalTuning.deadzoneV = [0.0, .14] ret.longitudinalTuning.kpBP = [0, 10 * CV.KPH_TO_MS, 20 * CV.KPH_TO_MS, 50 * CV.KPH_TO_MS, 70 * CV.KPH_TO_MS, 120 * CV.KPH_TO_MS] ret.longitudinalTuning.kpV = [4.8, 3.5, 3.0, 1.0, 0.7, 0.5] ret.longitudinalTuning.kiBP = [0, 20 * CV.KPH_TO_MS, 30 * CV.KPH_TO_MS, 50 * CV.KPH_TO_MS, 70 * CV.KPH_TO_MS, 120 * CV.KPH_TO_MS] ret.longitudinalTuning.kiV = [0.35, 0.53, 0.62, 0.7, 0.5, 0.36] ret.longitudinalActuatorDelayLowerBound = 0.2 ret.longitudinalActuatorDelayUpperBound = 0.2 ret.stopAccel = -1.7 ret.stoppingDecelRate = 3.8 ret.vEgoStopping = 0.36 ret.vEgoStarting = 0.35 ret.radarTimeStep = 0.0667 # GM radar runs at 15Hz instead of standard 20Hz return ret # returns a car.CarState def update(self, c: car.CarControl, can_strings: List[bytes]) -> car.CarState: self.cp.update_strings(can_strings) self.cp_loopback.update_strings(can_strings) # GM: EPS fault workaround (#22404) self.cp_chassis.update_strings(can_strings) # for Brake Light ret = self.CS.update(self.cp, self.cp_loopback, self.cp_chassis) # GM: EPS fault workaround (#22404) #brake autohold if not self.CS.autoholdBrakeStart and self.CS.brakePressVal > 40.0: self.CS.autoholdBrakeStart = True cruiseEnabled = self.CS.pcm_acc_status != AccState.OFF ret.cruiseState.enabled = cruiseEnabled ret.cruiseGap = self.CS.follow_level ret.canValid = self.cp.can_valid and self.cp_loopback.can_valid # GM: EPS fault workaround (#22404) ret.steeringRateLimited = self.CC.steer_rate_limited if self.CC is not None else False ret.engineRPM = self.CS.engineRPM buttonEvents = [] if self.CS.cruise_buttons != self.CS.prev_cruise_buttons and self.CS.prev_cruise_buttons != CruiseButtons.INIT: be = car.CarState.ButtonEvent.new_message() be.type = ButtonType.unknown if self.CS.cruise_buttons != CruiseButtons.UNPRESS: be.pressed = True but = self.CS.cruise_buttons else: be.pressed = False but = self.CS.prev_cruise_buttons if but == CruiseButtons.RES_ACCEL: if not (ret.cruiseState.enabled and ret.standstill): be.type = ButtonType.accelCruise # Suppress resume button if we're resuming from stop so we don't adjust speed. #elif but == CruiseButtons.RESUME: # if ret.autoResume and ret.cruiseState.enabled and ret.standstill: # be.type = ButtonType.resumeCruise elif but == CruiseButtons.SET_DECEL: if not cruiseEnabled and not self.CS.lkMode: self.lkMode = True be.type = ButtonType.decelCruise elif but == CruiseButtons.CANCEL: be.type = ButtonType.cancel elif but == CruiseButtons.MAIN: be.type = ButtonType.altButton3 buttonEvents.append(be) ret.buttonEvents = buttonEvents if cruiseEnabled and self.CS.lka_button and self.CS.lka_button != self.CS.prev_lka_button: self.CS.lkMode = not self.CS.lkMode if self.CS.distance_button and self.CS.distance_button != self.CS.prev_distance_button: self.CS.follow_level -= 1 if self.CS.follow_level < 1: self.CS.follow_level = 3 events = self.create_common_events(ret, pcm_enable=False) if ret.vEgo < self.CP.minEnableSpeed and self.CS.pcm_acc_status != AccState.ACTIVE: events.add(EventName.belowEngageSpeed) if self.CS.pause_long_on_gas_press: events.add(EventName.gasPressedOverride) #autohold event if self.CS.autoHoldActivated: events.add(car.CarEvent.EventName.autoHoldActivated) # handle button presses for b in ret.buttonEvents: # do enable on both accel(or resume) and decel buttons if b.type == ButtonType.accelCruise and c.hudControl.setSpeed > 0 and c.hudControl.setSpeed < 70 and not b.pressed: events.add(EventName.buttonEnable) if b.type == ButtonType.resumeCruise and c.hudControl.setSpeed > 0 and c.hudControl.setSpeed < 70 and not b.pressed: events.add(EventName.buttonEnable) if b.type == ButtonType.decelCruise and not b.pressed: events.add(EventName.buttonEnable) # do disable on button down if b.type == ButtonType.cancel and b.pressed: events.add(EventName.buttonCancel) elif ret.cruiseState.enabled and not self.CS.out.cruiseState.enabled: events.add(car.CarEvent.EventName.pcmEnable) # cruse is enabled elif (not ret.cruiseState.enabled) and (ret.vEgo > 2.0 or (self.CS.out.cruiseState.enabled and (not ret.standstill))): events.add(car.CarEvent.EventName.pcmDisable) # give up, too fast to resume ret.events = events.to_msg() # copy back carState packet to CS self.CS.out = ret.as_reader() return self.CS.out events = self.create_common_events(ret, pcm_enable=False) if ret.vEgo < self.CP.minEnableSpeed and self.CS.pcm_acc_status != AccState.ACTIVE: events.add(EventName.belowEngageSpeed) if ret.cruiseState.standstill: events.add(EventName.resumeRequired) # autohold on ui icon if self.CS.autoHoldActivated == True: ret.autoHoldActivated = 1 if self.CS.autoHoldActivated == False: ret.autoHoldActivated = 0 # handle button presses for b in ret.buttonEvents: # do enable on both accel(or resume) and decel buttons if b.type == ButtonType.accelCruise and c.hudControl.setSpeed > 0 and c.hudControl.setSpeed < 70 and not b.pressed: events.add(EventName.buttonEnable) if b.type == ButtonType.resumeCruise and c.hudControl.setSpeed > 0 and c.hudControl.setSpeed < 70 and not b.pressed: events.add(EventName.buttonEnable) if b.type == ButtonType.decelCruise and not b.pressed: events.add(EventName.buttonEnable) # do disable on button down if b.type == ButtonType.cancel and b.pressed: events.add(EventName.buttonCancel) elif ret.cruiseState.enabled and not self.CS.out.cruiseState.enabled: events.add(car.CarEvent.EventName.pcmEnable) # cruse is enabled elif (not ret.cruiseState.enabled) and (ret.vEgo > 2.0 or (self.CS.out.cruiseState.enabled and (not ret.standstill))): events.add(car.CarEvent.EventName.pcmDisable) # give up, too fast to resume ret.events = events.to_msg() # copy back carState packet to CS self.CS.out = ret.as_reader() return self.CS.out def apply(self, c, controls): cruiseControl = c.cruiseControl pcm_cancel_cmd = cruiseControl.cancel # For Openpilot, "enabled" includes pre-enable. # In GM, PCM faults out if ACC command overlaps user gas. pause_long_on_gas_press = c.enabled and self.CS.gasPressed and not self.CS.out.brake > 0. and not self.disengage_on_gas self.CS.pause_long_on_gas_press = pause_long_on_gas_press enabled = c.enabled or self.CS.pause_long_on_gas_press ret = self.CC.update(c, self.CS, enabled, controls, pcm_cancel_cmd) #, acc_ResumeButton) # Release Auto Hold and creep smoothly when regenpaddle pressed if (self.CS.regenPaddlePressed or (self.CS.brakePressVal > 9.0 and self.CS.prev_brakePressVal < self.CS.brakePressVal)) and self.CS.autoHold: self.CS.autoHoldActive = False self.CS.autoholdBrakeStart = False if self.CS.autoHold and not self.CS.autoHoldActive and not self.CS.regenPaddlePressed: if self.CS.out.vEgo > 0.02: self.CS.autoHoldActive = True elif self.CS.out.vEgo < 0.01 and self.CS.out.brakePressed: self.CS.autoHoldActive = True return ret
import io import os from typing import List, NamedTuple, Text from urllib.parse import quote, urljoin from httpx import Client from PIL import Image from bernard.conf import settings class Size(NamedTuple): """ Represents a size """ width: int height: int class Color(NamedTuple): """ 8-bit components of a color """ r: int g: int b: int class Video(NamedTuple): """ That's a video from the API """ name: Text width: int height: int frames: int frame_rate: List[int] url: Text first_frame: Text last_frame: Text DISPLAY_SIZE = Size(int(480 * 1.5), int(270 * 1.5)) class Frame: """ Wrapper around frame data to help drawing it on the screen """ def __init__(self, data): self.data = data self.image = None class FrameX: """ Utility class to access the FrameX API """ BASE_URL = settings.BASE_VIDEO_API_URL def __init__(self): self.client = Client() def video(self, video: Text) -> Video: """ Fetches information about a video """ r = self.client.get(urljoin(self.BASE_URL, f"video/{quote(video)}/")) r.raise_for_status() return Video(**r.json()) def video_frame(self, video: Text, frame: int) -> bytes: """ Fetches the JPEG data of a single frame """ r = self.client.get( urljoin(self.BASE_URL, f'video/{quote(video)}/frame/{quote(f"{frame}")}/') ) r.raise_for_status() return r.content class FrameXBisector: """ Helps managing the display of images from the launch """ BASE_URL = settings.BASE_VIDEO_API_URL def __init__(self, name): self.api = FrameX() self.video = self.api.video(name) self._index = 0 self.left = 0 self.right = self.count self.image = None @property def index(self): return self._index @index.setter def index(self, v): """ When a new index is written, download the new frame """ self._index = v self.image = Frame(self.api.video_frame(self.video.name, v)) @property def count(self): return self.video.frames
""" Word Mover Distance """ from collections import Counter from dataclasses import dataclass, field from itertools import product from typing import Dict, List, Tuple from dataclasses_jsonschema import JsonSchemaMixin import numpy as np import pulp from scipy.spatial.distance import euclidean from docsim.elas.search import EsResult from docsim.embedding.fasttext import FastText from docsim.methods.base import Method, Param from docsim.models import QueryDocument, RankItem from docsim.text import Filter, TextProcessor @dataclass class WMDParam(Param, JsonSchemaMixin): n_words: int @dataclass class WMD(Method): param: WMDParam fasttext: FastText = field(default_factory=FastText.create) def count_prob(self, tokens: List[str]) -> Dict[str, float]: """ Compute emergence probabilities for each word """ n_tokens: int = len(tokens) counter: Dict[str, int] = Counter(tokens) return {word: counter[word] / n_tokens for word in counter.keys()} def wmd(self, A_tokens: List[str], B_tokens: List[str]) -> float: """ Return --------------------- Similarity """ all_tokens: List[str] = list(set(A_tokens) | set(B_tokens)) A_prob: Dict[str, float] = self.count_prob(A_tokens) B_prob: Dict[str, float] = self.count_prob(B_tokens) wv: Dict[str, np.ndarray] = {token: self.fasttext.embed(token) for token in all_tokens} var_dict = pulp.LpVariable.dicts( 'T_matrix', list(product(all_tokens, all_tokens)), lowBound=0) prob = pulp.LpProblem('WMD', sense=pulp.LpMinimize) prob += pulp.lpSum([var_dict[token1, token2] * euclidean(wv[token1], wv[token2]) for token1, token2 in product(all_tokens, all_tokens)]) for token2 in B_prob.keys(): prob += pulp.lpSum( [var_dict[token1, token2] for token1 in B_prob.keys()] ) == B_prob[token2] for token1 in A_prob.keys(): prob += pulp.lpSum( [var_dict[token1, token2] for token2 in A_prob.keys()] ) == A_prob[token1] prob.solve() return -pulp.value(prob.objective) def retrieve(self, query_doc: QueryDocument, size: int = 100) -> RankItem: filters: List[Filter] = self.get_default_filtes( n_words=self.param.n_words) processor: TextProcessor = TextProcessor(filters=filters) q_words: List[str] = processor.apply(query_doc.text) candidates: EsResult = self.filter_by_terms( query_doc=query_doc, n_words=self.param.n_words, size=size) tokens_dict: Dict[Tuple[str, str], List[str]] = { (hit.source['docid'], hit.source['tags'][0]): processor.apply(hit.source['text']) for hit in candidates.hits } scores: Dict[Tuple[str, str], float] = dict() for key, tokens in tokens_dict.items(): score: float = self.wmd(q_words, tokens) scores[key] = score return RankItem(query_id=query_doc.docid, scores=scores)
""" A skip list implementation. Skip list allows search, add, erase operation in O(log(n)) time with high probability (w.h.p.). """ import random class Node: """ Attributes: key: the node's key next: the next node prev: the previous node bottom: the bottom node in skip list (the node has same key in the level below) """ def __init__(self, key): """ Create a node. Args: key: the node's key Running Time: O(1) """ self.key = key self.next = None self.prev = None self.bottom = None def find(self, target): """ Find the node whose next node has bigger key than target. Args: target: the bigger key Return: The first node whose next node have the key that is bigger than target Running Time: O(n) """ if(self.next is not None and self.next.key <= target): return self.next.find(target) else: return self def append(self, target): """ Append a node with key of target to current node. Args: target: the key of new node Running Time: O(1) """ # define two side q = self.next p = Node(target) # connect left self.next = p p.prev = self # connect right p.next = q if(q is not None): q.prev = p def delete(self): """ Delete the node next. Running Time: O(1) """ # define two side p = self.prev q = self.next # connect # if(p is not None): p.next = q if(q is not None): q.prev = p del self class Skiplist: """ Attributes: startList: the head node list """ def __init__(self): """ Create a Skiplist. Running Time: O(1) """ self.startList = [Node(-1)] def search(self, target: int) -> bool: """ Query whether the node with target key exist. Args: target: the target key Return: Whether the node with target key exist Running Time: O(log(n)) w.h.p. """ p = self.startList[-1] while(p is not None and p.key < target): p = p.find(target) if(p.key == target): return True else: p = p.bottom return False def add(self, num: int) -> None: """ Add a node with key of num. Args: num: the key of the node Running Time: O(log(n)) w.h.p. """ p = self.startList[-1] s = [] while(p is not None and p.key < num): p = p.find(num) s.append(p) if(p.key == num): s.pop() while(p is not None): s.append(p) p = p.bottom break else: p = p.bottom b = None p = s.pop() p.append(num) p.next.bottom = b b = p.next while(random.choice([True, False])): if(len(s) > 0): p = s.pop() p.append(num) p.next.bottom = b b = p.next else: start = Node(-1) start.next = Node(num) start.bottom = self.startList[-1] start.next.bottom = b start.next.prev = start self.startList.append(start) b = start.next def erase(self, num: int) -> bool: """ Delete the node with key of num. Args: num: the key of the node Return: Whether delete success Running Time: O(log(n)) w.h.p. """ p = self.startList[-1] while(p is not None and p.key < num): p = p.find(num) if(p.key == num): while(p is not None): q = p p = p.bottom q.delete() return True else: p = p.bottom return False
# -*- coding: utf-8 -*- """ Created on Tue Aug 4 15:41:40 2020 @author: MBelobraydic """ import codecs from dbf900_formats import pic_yyyymmdd, pic_yyyymm, pic_numeric, pic_any, pic_latlong, pic_coord def decode_file(file, block_size): ##Requires string for the file location and integer for blocksize print('opening',file) with open(file, 'rb') as ebcdicfl: #Reads the .ebc file data = ebcdicfl.read() print('decoding...') ascii_txt = codecs.decode(data, 'cp1140') #decodes the entire .ebc file to ascii ##This decoding method still leaves a few uncoded "/x0" type characters split_records = [] ##empty array for records print('separating records...') for index in range(0, len(ascii_txt), block_size): ##Creates an array for all records in the file split_records.append(ascii_txt[index : index + block_size]) print('returning records...') return split_records def parse_record(record, layout): values = dict() for name, start, size, convert in layout: if convert == 'pic_yyyymmdd': values[name] = pic_yyyymmdd(record[start:start+size]) elif convert == 'pic_yyyymm': values[name] = pic_yyyymm(record[start:start+size]) elif convert == 'pic_latlong': values[name] = pic_latlong(record[start:start+size], name) elif convert == 'pic_coord': values[name] = pic_coord(record[start:start+size]) # elif convert == 'pic_signed': # values[name] = pic_signed(record[start:start+size]) elif convert == 'pic_numeric': values[name] = pic_numeric(record[start:start+size]) else: values[name] = pic_any(record[start:start+size]) return values
#! /usr/bin/python # -*- coding: utf-8 -*- __author__ = "Osman Baskaya" s10aw = "../data/semeval10/aw/test/English/EnglishAW.test.xml" s10wsi = "../data/semeval10/wsi" s07aw = "../data/semeval07/all-words/english-all-words.test.xml" s3aw = "../data/senseval3/english-all-words.xml" s2aw = "../data/senseval2/english-all-words/test/eng-all-words.test.xml" def get_dataset_path(dataset): path = None if dataset == 's07aw': path = s07aw elif dataset == 's3aw': path = s3aw elif dataset == 's2aw': path = s2aw elif dataset == 's10aw': path = s10aw return path def main(): pass if __name__ == '__main__': main()
import cPickle as pickle import codecs import random from collections import defaultdict from itertools import izip from os.path import dirname, realpath, join import numpy as np import torch.optim as optim import unicodedata import sys from editor_code.copy_editor import data from editor_code.copy_editor.attention_decoder import AttentionDecoderCell from editor_code.copy_editor.editor import EditExample, Editor from editor_code.copy_editor.encoder import Encoder from editor_code.copy_editor.vocab import load_embeddings from editor_code.copy_editor.utils import edit_dist from gtd.chrono import verboserate from gtd.io import num_lines, makedirs from gtd.ml.torch.token_embedder import TokenEmbedder from gtd.ml.torch.training_run import TorchTrainingRun from gtd.ml.torch.utils import similar_size_batches, try_gpu, random_seed, random_state from gtd.ml.training_run import TrainingRuns from gtd.ml.training_run_viewer import TrainingRunViewer, Commit, JSONSelector, NumSteps, run_name, Owner from gtd.utils import sample_if_large, bleu, Config, chunks class EditTrainingRuns(TrainingRuns): def __init__(self, check_commit=True): data_dir = data.workspace.edit_runs src_dir = dirname(dirname(realpath(__file__))) # root of the Git repo super(EditTrainingRuns, self).__init__(data_dir, src_dir, EditTrainingRun, check_commit=check_commit) class EditTrainingRunsViewer(TrainingRunViewer): def __init__(self): runs = EditTrainingRuns(check_commit=False) super(EditTrainingRunsViewer, self).__init__(runs) meta = lambda paths: JSONSelector('metadata.txt', paths) two_digits = lambda x: round(x, 2) # list different formats in which stats were logged legacy = lambda name, high_or_low: [ ('{}_valid'.format(name),), ('stats', 'big', name, 'valid'), ('stats', 'big', name, 'valid', high_or_low), ('stats', 'big', name, high_or_low, 'valid'), ] self.add('#', run_name) self.add('owner', Owner({})) self.add('dset', meta(('config', 'dataset', 'path'))) self.add('enc dropout', meta(('config', 'model', 'encoder_dropout_prob'))) self.add('dec dropout', meta(('config', 'model', 'decoder_dropout_prob'))) self.add('steps', NumSteps()) # best scores on the big validation set self.add('bleu', meta(legacy('bleu', 'high') + legacy('avg_bleu', 'high')), two_digits) self.add('edit dist', meta(legacy('edit_dist', 'low')), two_digits) self.add('exact match', meta(legacy('exact_match', 'high') + legacy('exact_match_prob', 'high')), two_digits) self.add('loss', meta(legacy('loss', 'low')), two_digits) self.add('last seen', meta(('last_seen',))) self.add('commit', Commit()) class EditDataSplits(object): """ Attributes: train (list[EditExample]) valid (list[EditExample]) test (list[EditExample]) """ def __init__(self, data_dir, config): """Load examples for training, validation and testing. Args: data_dir (str): absolute path to dataset config (Config): dataset config Returns: EditDataSplits """ max_seq_length = lambda ex: max(max(len(seq) for seq in ex.input_words), len(ex.target_words)) def examples_from_file(path, seq_length_limit): """Return list[EditExample] from file path.""" examples = [] # count total lines before loading total_lines = num_lines(path) with codecs.open(path, 'r', encoding='utf-8') as f: lnum = 0 for line in verboserate(f, desc='Reading data file.', total=total_lines): split = line.strip().split('\t') lnum += 1 input_words = [] try: for c in config.source_cols: input_words.append(split[c].split(' ')) trg_words = split[config.target_col].split(' ') # gold answer assert len(trg_words) > 0 ex = EditExample(input_words, trg_words) # skip sequences that are too long, because they use up memory if max_seq_length(ex) > seq_length_limit: continue examples.append(ex) except: print 'bad formatting in line ' + str(lnum) print line return examples self.train = examples_from_file(join(data_dir, 'train.tsv'), config.seq_max) self.valid = examples_from_file(join(data_dir, 'valid.tsv'), config.seq_max) self.test = examples_from_file(join(data_dir, 'test.tsv'), float('inf')) # evaluation should not skip examples class EditTrainingRun(TorchTrainingRun): def __init__(self, config, save_dir): super(EditTrainingRun, self).__init__(config, save_dir) # extra dir for storing TrainStates where NaN was encountered self.workspace.add_dir('nan_checkpoints') self.workspace.add_dir('traces') # build model with random_seed(config.optim.seed): print 'seed:'+str(config.optim.seed) model, optimizer = self._build_model(config.model, config.optim, config.dataset) self.train_state = self.checkpoints.load_latest(model, optimizer) # load data data_dir = join(data.workspace.datasets, config.dataset.path) self._examples = EditDataSplits(data_dir, config.dataset) @property def editor(self): """Return the Editor.""" return self.train_state.model @property def examples(self): """Return data splits (EditDataSplits).""" return self._examples @classmethod def _build_model(cls, model_config, optim_config, data_config): """Build Editor. Args: model_config (Config): Editor config optim_config (Config): optimization config data_config (Config): dataset config Returns: Editor """ file_path = join(data.workspace.word_vectors, model_config.wvec_path) word_embeddings = load_embeddings(file_path, model_config.word_dim, model_config.vocab_size, model_config.num_copy_tokens) word_dim = word_embeddings.embed_dim source_token_embedder = TokenEmbedder(word_embeddings, model_config.train_source_embeds) target_token_embedder = TokenEmbedder(word_embeddings, model_config.train_target_embeds) # number of input channels num_inputs = len(data_config.source_cols) decoder_cell = AttentionDecoderCell(target_token_embedder, 2 * word_dim, # 2 * word_dim because we concat base and copy vectors model_config.agenda_dim, model_config.hidden_dim, model_config.hidden_dim, model_config.attention_dim, num_layers=model_config.decoder_layers, num_inputs=num_inputs, dropout_prob=model_config.decoder_dropout_prob, disable_attention=False) encoder = Encoder(word_dim, model_config.agenda_dim, model_config.hidden_dim, model_config.encoder_layers, num_inputs, model_config.encoder_dropout_prob, False) copy_len = [5,5,40] model = Editor(source_token_embedder, encoder, decoder_cell, copy_lens=copy_len) model = try_gpu(model) optimizer = optim.Adam(model.parameters(), lr=optim_config.learning_rate) return model, optimizer def train(self): """Train a model. NOTE: modifies TrainState in place. - parameters of the Editor and Optimizer are updated - train_steps is updated - random number generator states are updated at every checkpoint """ # TODO(kelvin): do something to preserve random state upon reload? train_state = self.train_state examples = self._examples config = self.config workspace = self.workspace with random_state(self.train_state.random_state): editor = train_state.model train_batches = similar_size_batches(examples.train, config.optim.batch_size) editor.test_batch(train_batches[0]) best_exact_match_score = 0.0 while True: random.shuffle(train_batches) for batch in verboserate(train_batches, desc='Streaming training examples'): loss, _, _ = editor.loss(batch) finite_grads, grad_norm = self._take_grad_step(train_state, loss) if not finite_grads: train_state.save(workspace.nan_checkpoints) examples_path = join(workspace.nan_checkpoints, '{}.examples'.format(train_state.train_steps)) with open(examples_path, 'w') as f: pickle.dump(batch, f) print 'Gradient was NaN/inf on step {}.'.format(train_state.train_steps) step = train_state.train_steps # run periodic evaluation and saving if step != 0: if step % 10 == 0: self._update_metadata(train_state) if step % config.timing.eval_small == 0: self.evaluate(step, big_eval=False) self.tb_logger.log_value('grad_norm', grad_norm, step) if step % config.timing.eval_big == 0: train_stats, valid_stats = self.evaluate(step, big_eval=True) exact_match_score = valid_stats[('big', 'exact_match', 'valid')] self.checkpoints.save(train_state) if step >= config.optim.max_iters: return def evaluate(self, train_steps, big_eval, log=True): config = self.config examples = self.examples editor = self.editor def evaluate_on_examples(split_name, examples): # use more samples for big evaluation num_eval = config.eval.big_num_examples if big_eval else config.eval.num_examples big_str = 'big' if big_eval else 'small' # compute metrics stats, edit_traces, loss_traces = self._compute_metrics(editor, examples, num_eval, self.config.optim.batch_size) # prefix the stats stats = {(big_str, stat, split_name): val for stat, val in stats.items()} if log: self._log_stats(stats, train_steps) # write traces for the small evaluation if not big_eval: self._write_traces(split_name, train_steps, edit_traces, loss_traces) return stats train_stats = evaluate_on_examples('train', examples.train) valid_stats = evaluate_on_examples('valid', examples.valid) return train_stats, valid_stats @classmethod def _compute_metrics(cls, editor, examples, num_evaluate_examples, batch_size): """ Args: editor (Editor) examples (list[EditExample]) num_evaluate_examples (int) batch_size (int) Returns: stats (dict[str, float]) edit_traces (list[EditTrace]): of length num_evaluate_examples loss_traces (list[LossTrace]): of length num_evaluate_examples """ sample = sample_if_large(examples, num_evaluate_examples, replace=False) # compute loss # need to break the sample into batches, in case the sample is too large to fit in GPU memory losses, loss_traces, weights, enc_losses = [], [], [], [] for batch in verboserate(chunks(sample, batch_size), desc='Computing loss on examples'): weights.append(len(batch)) loss_var, loss_trace_batch, enc_loss = editor.loss(batch) # convert loss Variable into float loss_val = loss_var.data[0] assert isinstance(loss_val, float) losses.append(loss_val) enc_losses.append(enc_loss) loss_traces.extend(loss_trace_batch) losses, weights = np.array(losses), np.array(weights) loss = np.sum(losses * weights) / np.sum(weights) # weighted average enc_loss = np.sum(np.array(enc_losses) * weights) / np.sum(weights) punct_table = dict.fromkeys(i for i in xrange(sys.maxunicode) if unicodedata.category(unichr(i)).startswith('P')) def remove_punct(s): new_s = [] for t in s: t = unicode(t).translate(punct_table) if t != '': new_s.append(t) return new_s metrics = { 'bleu': (bleu, max), 'edit_dist': (lambda s, t: edit_dist(s, t)[0] / len(s) if len(s) > 0 else len(t), min), 'exact_match': (lambda s, t: 1.0 if remove_punct(s) == remove_punct(t) else 0.0, max) } top_results = defaultdict(list) top5_results = defaultdict(list) # compute predictions beams, edit_traces = editor.edit(sample, batch_size=batch_size, max_seq_length=150, verbose=True) for ex, beam in izip(sample, beams): top = beam[0] top5 = beam[:5] target = ex.target_words for name, (fxn, best) in metrics.items(): top_results[name].append(fxn(top, target)) top5_results[name].append(best(fxn(predict, target) for predict in top5)) # compute averages stats_top = {name: np.mean(vals) for name, vals in top_results.items()} stats_top5 = {'{}_top5'.format(name): np.mean(vals) for name, vals in top5_results.items()} # combine into a single stats object stats = {'loss': loss, 'enc_loss': enc_loss} stats.update(stats_top) stats.update(stats_top5) return stats, edit_traces, loss_traces def _write_traces(self, split_name, train_steps, edit_traces, loss_traces): trace_dir = join(self.workspace.traces, split_name) trace_path = join(trace_dir, '{}.txt'.format(train_steps)) makedirs(trace_dir) with codecs.open(trace_path, 'w', encoding='utf-8') as f: for edit_trace, loss_trace in zip(edit_traces, loss_traces): f.write(unicode(edit_trace)) f.write('\n') f.write(unicode(loss_trace)) f.write('\n\n')
import pathlib import re import sys from contextlib import contextmanager from typing import Any, Dict, Generator, Optional, Tuple from urllib.parse import urlparse import click import hypothesis from .. import utils def validate_schema(ctx: click.core.Context, param: click.core.Parameter, raw_value: str) -> str: if "app" not in ctx.params and not urlparse(raw_value).netloc: if "\x00" in raw_value or not _verify_path(raw_value): raise click.UsageError("Invalid SCHEMA, must be a valid URL or file path.") if "base_url" not in ctx.params: raise click.UsageError('Missing argument, "--base-url" is required for SCHEMA specified by file.') return raw_value def _verify_path(path: str) -> bool: try: return pathlib.Path(path).is_file() except OSError: # For example, path could be too long return False def validate_base_url(ctx: click.core.Context, param: click.core.Parameter, raw_value: str) -> str: if raw_value and not urlparse(raw_value).netloc: raise click.UsageError("Invalid base URL") return raw_value def validate_app(ctx: click.core.Context, param: click.core.Parameter, raw_value: Optional[str]) -> Any: if raw_value is None: return raw_value path, name = (re.split(r":(?![\\/])", raw_value, 1) + [None])[:2] # type: ignore try: __import__(path) except (ImportError, ValueError): raise click.BadParameter("Can not import application from the given module") except Exception as exc: message = utils.format_exception(exc) click.secho(f"Error: {message}", fg="red") raise click.Abort # accessing the module from sys.modules returns a proper module, while `__import__` # may return a parent module (system dependent) module = sys.modules[path] try: return getattr(module, name) except AttributeError: raise click.BadParameter("Can not import application from the given module") def validate_auth( ctx: click.core.Context, param: click.core.Parameter, raw_value: Optional[str] ) -> Optional[Tuple[str, str]]: if raw_value is not None: with reraise_format_error(raw_value): user, password = tuple(raw_value.split(":")) if not user: raise click.BadParameter("Username should not be empty") return user, password return None def validate_headers( ctx: click.core.Context, param: click.core.Parameter, raw_value: Tuple[str, ...] ) -> Dict[str, str]: headers = {} for header in raw_value: with reraise_format_error(header): key, value = header.split(":") if not key: raise click.BadParameter("Header name should not be empty") headers[key] = value.lstrip() return headers def convert_verbosity( ctx: click.core.Context, param: click.core.Parameter, value: Optional[str] ) -> Optional[hypothesis.Verbosity]: if value is None: return value return hypothesis.Verbosity[value] @contextmanager def reraise_format_error(raw_value: str) -> Generator[None, None, None]: try: yield except ValueError: raise click.BadParameter(f"Should be in KEY:VALUE format. Got: {raw_value}")
# IAM policy ARN's list in this variable will be checked against the policies assigned to all IAM # resources (users, groups, roles) and this rule will fail if any policy ARN in the blacklist is # assigned to a user IAM_POLICY_ARN_BLACKLIST = [ 'TEST_BLACKLISTED_ARN', ] def policy(resource): # Check if the IAM resource has any managed policies if resource['ManagedPolicyNames'] is None: return True # Iterate through the blacklist and return true if the resource is in violation for iam_policy in IAM_POLICY_ARN_BLACKLIST: if iam_policy in resource['ManagedPolicyNames']: return False return True
import time def read_file(name): with open(f"files/input{name}") as f: content = f.readlines() return [x.strip() for x in content] def timer(func): def wrapper(*args, **kwargs): start_time = time.time() result = func(*args, **kwargs) print(f"\nTime required: {(time.time() - start_time)*1000:.2f} ms\n") return result return