def test_polish_deprecated(self): with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") poland = holidays.Polish() self.assertIsInstance(poland, holidays.Poland) self.assertEqual(1, len(w)) self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
def academic_day(day): pl_holidays = holidays.Polish() if day.weekday() == 5 or day.weekday() == 6: return 'Nie' elif datetime.date.today() in pl_holidays == True: return 'Nie' else: return 'Tak'
def academic_day(day): pl_holidays = holidays.Polish() if day in pl_holidays: return f'Nie ->Święto państwowe {pl_holidays.get(day)}' else: if day.weekday() == 5 or day.weekday() == 6: return 'Nie, weekend' else: return 'Tak'
def __init__(self, year, month, hours_range, worker, furlough=None, work=None): self.polish_holidays = holidays.Polish() self.year = year self.month = month self.month_calendar = calendar.monthcalendar(year, month) self.worker = worker self.hours_range = hours_range self.furlough = furlough self.work = work self.worked_days = self._get_worked_days() self.workbook_name = '{}_{}.xlsx'.format(month, year) self.workbook = xlsxwriter.Workbook(self.workbook_name) self.worksheet = self.workbook.add_worksheet(self.workbook_name) self.formats = self._get_formats_for_worksheet()
import holidays, datetime pl_holidays = holidays.Polish() today = datetime.date.today() print(today, 'zajęcia się odbywają:', Student.academic_day(today)) saturday = datetime.datetime.strptime('2019-06-22', '%Y-%m-%d') print(saturday, 'zajęcia się odbywają:', Student.academic_day(saturday)) sunday = datetime.date.today() - datetime.timedelta(days=1) print(sunday, 'zajęcia się odbywają:', Student.academic_day(sunday))
import numpy as np import pathlib import humanize import pandas import calendar import os import requests import datetime import dateutil import math import pandas as pd import holidays from rich import print from rich.table import Table holidays_pl = holidays.Polish() from dateutil.relativedelta import relativedelta key = os.environ["TOGGL_KEY"] auth = (key, "api_token") workspace = os.environ["TOGGL_WORKSPACE"] email = os.environ["TOGGL_EMAIL"] work_tag = os.environ["TOGGL_WORK_TAG"] today = datetime.date.today() offset = None def get_total_in(year: int, month: int) -> float:
import pandas as pd from datetime import date import holidays pd.set_option('display.max_columns', None) pd.set_option('display.max_rows', 60) pd.set_option('expand_frame_repr', False) sciezka = 'C:/Users/ca125/Desktop/' nazwa_pliku_kse = 'KSE.xlsx' pl_holidays = holidays.Polish(years=[rok for rok in range(2009, 2019)]) pl_holidays.append( {date(2018, 11, 12): 'Narodowe Święto Niepodległości (drugi dzień)'}) def czy_weekend(dzien): dni_weekend = ['Sa', 'Su'] if dzien in dni_weekend: return 'W' else: return 'R' def czy_swieto(dzien): if dzien.month == 12 and dzien.day == 24: return 'Wig' elif dzien in pl_holidays: return 'S' else: return 'NS'