Exemple #1
0
    def _populate(cls, year):

        # Exclude the observed day of a holiday that falls on a weekend
        cls.observed = False

        # Populate the holiday list with the default UK holidays
        super()._populate(year)

        # Remove UK holidays which are not needed
        cls.pop_named("New Year Holiday [Scotland]")
        cls.pop_named("St. Patrick's Day [Northern Ireland]")
        cls.pop_named("Battle of the Boyne [Northern Ireland]")
        cls.pop_named("St. Andrew's Day [Scotland]")

        # Add 1st of may sinc its not in the UK dataset
        labour_day = holidays.Austria(years=datetime.now().year).get_named(
            name="Staatsfeiertag"
        )
        cls[labour_day[0]] = "Labour Day"

        # Catch extra-ordinary holiday from UK dataset
        if holidays.Austria(years=datetime.now().year).get_named(
            name="Platinum Jubilee of Elizabeth II"
        ):
            cls.pop_named("Platinum Jubilee of Elizabeth II")

        return
Exemple #2
0
def waterreminder():
    while True:
        now = datetime.datetime.now()
        for key in waterlevels.keys():
            if waterlevels[key] == 4:
                key.create_dm().send(
                    'This is a friendly reminder to drink some water.')
        if now in holidays.Austria(
        ) or now.isoweekday() > 5 or now.hour > 17 or now.hour < 9:
            time.sleep(60)
            continue
        elif (now.hour - 1) % 2 == 0 and now.minute == 0:
            for key in waterlevels.keys():
                if waterlevels[key] == 1:
                    key.create_dm().send(
                        'This is a friendly reminder to drink some water.')
        elif now.minute == 0:
            for key in waterlevels.keys():
                if waterlevels[key] == 2:
                    key.create_dm().send(
                        'This is a friendly reminder to drink some water.')
        elif now.minute == 0 or now.minute == 30:
            for key in waterlevels.keys():
                if waterlevels[key] == 3:
                    key.create_dm().send(
                        'This is a friendly reminder to drink some water.')
        time.sleep(60)
# holiday checker, weighted by the relative exports to that country for that month
country_pop = {
    'AT': 8.352,  # country population in 2010
    'BE': 10.840,
    'CH': 7.786,
    'CZ': 10.460,
    'DE': 81.750,
    'DK': 5.535,
    'FR': 64.610,
    'LU': 0.502,
    'NL': 16.570,
    'PL': 38.53,
    'SE': 9.341
}
holiday_op = [
    ('AT', holidays.Austria()),  # holidays for each country
    ('BE', holidays.Belgium()),  # implented this way because of bug in library
    ('CH', holidays.Switzerland()),
    ('CZ', holidays.Czech()),
    ('DE', holidays.Germany()),
    ('DK', holidays.Denmark()),
    ('FR', holidays.France()),
    ('LU', holidays.Luxembourg()),
    ('NL', holidays.Netherlands()),
    ('PL', holidays.Poland()),
    ('SE', holidays.Sweden())
]


def timedata(dt):
    # create time data extra information for influxDB (makes sorting easier)
Exemple #4
0
### IMPORTS

import holidays

from datetime import date


### STATIC VARIABLES

today = date.today()

australia_holidays = holidays.Australia()
austria_holidays = holidays.Austria()
canada_holidays = holidays.Canada()
colombia_holidays = holidays.Colombia()
czech_holidays = holidays.Czech()
denmark_holidays = holidays.Denmark()
england_holidays = holidays.England()
europeancentralbank_holidays = holidays.EuropeanCentralBank()
germany_holidays = holidays.Germany()
ireland_holidays = holidays.Ireland()
mexico_holidays = holidays.Mexico()
netherlands_holidays = holidays.Netherlands()
newzealand_holidays = holidays.NewZealand()
northernireland_holidays = holidays.NorthernIreland()
norway_holidays = holidays.Norway()
portugal_holidays = holidays.Portugal()
portugalext_holidays = holidays.PortugalExt()
scotland_holidays = holidays.Scotland()
spain_holidays = holidays.Spain()
unitedkingdom_holidays = holidays.UnitedKingdom()