Exemple #1
0
 def __init__(self, file_path):
     self.file_path = file_path
     self.population_data = []
     self.json_data = []
     self.countries = Countries()
     ''' store a dictionary of each country population '''
     self.country_populations = {}
Exemple #2
0
def main(opts):
    try:
        country = format(" ", opts.country)
        city = format("_", opts.city)
        cc = Countries()
        country_code = cc.get_country(country)

        if opts.forecast:
            wf = WeatherForecast(opts.api_key)
            forecast_result = wf.forecast(city, country_code)
            show_result(forecast_result, city, country)

        if opts.hourly:
            wh = WeatherHourly(opts.api_key)
            hourly_result = wh.hourly(city, country_code)
            show_result(hourly_result, city, country)

        if opts.almanac:
            wl = WeatherAlmanac(opts.api_key)
            almanac_result = wl.almanac(city, country_code)
            print "******************** COUNTRY:" + country + " --- CITY: " + city + " ****************************"
            print "****************************** RECORDS ****************************"
            print almanac_result

        if opts.geolookup:
            print "******************** COUNTRY:" + country + " --- CITY: " + city + " ****************************"
            geo = GeoLookup(opts.api_key)
            print geo.geo(city, country_code)

    except KeyError:
        print "Some one of the values (Key, City, Country) are incorrect check and try again"
        sys.exit(-1)
Exemple #3
0
    def __init__(self, parent=None):
        super(CountrySelector, self).__init__(parent)
        ui = Ui_CountrySelector()
        ui.setupUi(self)
        self.ui = ui

        self.countries = Countries()
        self.codes = sorted(self.countries['iso2c'])

        index = self.codes.index("NZ")

        ui.cmbCode.addItems(self.codes)
        ui.cmbCode.setCurrentIndex(index)

        self._on_selection(index)
        ui.cmbCode.currentIndexChanged.connect(self._on_selection)

        self.adjustSize()
Exemple #4
0
def _io_countries(mplot, density_per_country, country):
    color_per_country = _get_color_per_country(density_per_country)
    all_countries = Countries()
    for c in all_countries.countries:
        i_plastic = [
            i for i, s in enumerate(country) if s == c.attributes['SUBUNIT']
        ]
        if len(i_plastic) is not 0:
            c_color = color_per_country[i_plastic[0]]
            mplot.country(c, c_color)
            for i, small_island in enumerate(small_islands):
                if small_island == c.attributes['SUBUNIT']:
                    mplot.points(small_islands_lon[i],
                                 small_islands_lat[i],
                                 marker='o',
                                 facecolor=c_color,
                                 markersize=10)
        else:
            mplot.country(c, 'w')
Exemple #5
0
                hospital_beds=100,
                quarantine_rate=0,
                mean_quarantine=2,
                name='Belgium',
                travel_time=5)

EST = Population(persons_dict['8'],
                 shape9,
                 hospital_factor=0.05,
                 hospital_beds=1000,
                 quarantine_rate=0,
                 mean_quarantine=2,
                 name='Estonia',
                 travel_time=5)

cont = Countries([ES, DE, SE, FR, DK, CH, IT, BE, EST], travels=True)

# Plot interactions
#steps = 600
cont.interact(steps=800, plot=True, save=False)

for population in cont.populations:
    plt.figure()

    plt.bar(list(population.dead_age.keys()),
            population.dead_age.values(),
            color='g')
    plt.show()

    plt.figure()
Exemple #6
0
 def setUp(self):
     self.countries_pt = Countries('pt')
     self.countries_en = Countries('en')
Exemple #7
0
        for row in rows:
            if row[1] != "pg_stat_statements":
                cursor.execute("drop table " + row[1] + " cascade")

        connection.commit()
    return redirect(url_for('create_tables'))


if __name__ == '__main__':
    '''Container objects'''

    app.coaches = Coaches2(app)
    app.coaching = Coaching2(app)
    app.teams = Teams(app)
    app.players = Players(app)
    app.countries = Countries(app)
    app.leagues = Leagues(app)
    app.stadiums = Stadiums(app)
    app.officials = Officials(app)
    app.seasons = Seasons2(app)
    app.matches = Matches(app)
    app.statisticsTeam = StatisticsT(app)
    app.statisticsPlayer = StatisticsP(app)
    app.fixtures = Fixtures(app)
    app.squads = Squads(app)
    app.transfers = Transfers(app)

    VCAP_APP_PORT = os.getenv('VCAP_APP_PORT')
    if VCAP_APP_PORT is not None:
        port, debug = int(VCAP_APP_PORT), False
    else:
Exemple #8
0
from cities import City

from users import User

from travels import Travels, Travel

from votes import Vote

from login import Login

cors = CORS(allow_origins_list=['http://localhost:9000'])

api = falcon.API(middleware=[cors.middleware])

api.add_route('/countries', Countries())

api.add_route('/country/{country}', Country())

api.add_route('/country/{country}/city/{city}', City())

api.add_route('/users/{query}', User())

api.add_route('/travel', Travel())

api.add_route('/travels', Travels())

api.add_route('/travel/vote', Vote())

api.add_route('/login', Login())