Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
korean-holiday-calendar
Advanced tools
korean-specialized holiday calendar based on [python-holidays] package by dr-prodigy
This is a Korean-specialized version of python-holidays package (by dr-prodigy), which contains key functions in existing package, and some new functions for calculating and analysing Korean holidays.
The usage is mostly the same as the existing python-holidays package, so please read its instruction manual for a more complicated usage.
https://python-holidays.readthedocs.io/
Below is a brief instruction manual based on our package.
.. code-block:: python
from datetime import date
import krholidays
kr = krholidays.KR() # this is a dict
# the below is the same, but takes a string:
kr = krholidays.country_holidays('KR') # this is a dict
date(2015, 1, 1) in kr # True
date(2015, 1, 2) in kr # False
kr.get('2014-01-01') # "์ ์ "
For English users, we added English options.
.. code-block:: python
kr_holidays_en = holidays.KR(en_name = True)
kr_holidays_en.get('2014-01-01') # "New Year's Day"
The 'HolidayBase', a dict-like class, will also recognize date strings and Unix timestamps:
.. code-block:: python
'2014-01-01' in krholidays # True
'1/1/2014' in krholidays # True
1388597445 in krholidays # True
Example usage:
.. code-block:: python
from krholidays import country_holidays
kr = country_holidays('KR')
The below will cause 2015 holidays to be calculated on the fly:
.. code-block:: python
from datetime import date
date(2015, 1, 1) in kr # True
The :class:HolidayBase
class also recognizes strings of many formats
and numbers representing a POSIX timestamp:
assert '2014-01-01' in kr assert '1/1/2014' in kr assert 1388597445 in kr
Show the holiday's name:
.. code-block:: python
kr.get('2014-01-01') #"New Year's Day"
Check a range:
.. code-block:: python
kr['2014-01-01': '2014-01-03'] #[datetime.date(2014, 1, 1)]
List all 2020 holidays:
.. code-block:: python
kr_2020 = country_holidays('KR', years=2020)
for day in kr_2020.items():
print(day)
#
(datetime.date(2020, 1, 1), '์ ์ ')
(datetime.date(2020, 1, 24), '์ค๋ ์ฐํด')
(datetime.date(2020, 1, 25), '์ค๋ ')
(datetime.date(2020, 1, 26), '์ค๋ ์ฐํด')
(datetime.date(2020, 1, 27), '์ค๋ ๋์ฒด๊ณตํด์ผ')
(datetime.date(2020, 3, 1), '3ยท1์ ')
(datetime.date(2020, 4, 30), '๋ถ์ฒ๋์ค์ ๋ ')
(datetime.date(2020, 5, 5), '์ด๋ฆฐ์ด๋ ')
(datetime.date(2020, 6, 6), 'ํ์ถฉ์ผ')
(datetime.date(2020, 8, 15), '๊ด๋ณต์ ')
(datetime.date(2020, 10, 1), '์ถ์')
(datetime.date(2020, 10, 2), '์ถ์ ์ฐํด')
(datetime.date(2020, 9, 30), '์ถ์ ์ฐํด')
(datetime.date(2020, 10, 3), '๊ฐ์ฒ์ ')
(datetime.date(2020, 10, 9), 'ํ๊ธ๋ ')
(datetime.date(2020, 12, 25), '๊ธฐ๋
ํ์ ์ผ')
(datetime.date(2020, 4, 15), '์ 21๋ ๊ตญํ์์ ์ ๊ฑฐ์ผ')
(datetime.date(2020, 8, 17), '๊ด๋ณต์ ๊ธฐ๋
(์์๊ณตํด์ผ)')
Append custom holiday dates by passing one of:
dict
with date/name key/value pairs (e.g. {'2010-07-10': 'My birthday!'}),datetime.date
, :class:datetime.datetime
,
:class:str
, :class:int
, or :class:float
); 'Holiday'
will be used as a description,.. code-block:: python
custom_holidays = country_holidays('US', years=2015)
custom_holidays.update({'2015-01-01': "New Year's Day"})
custom_holidays.update(['2015-07-01', '07/04/2015'])
custom_holidays.update(date(2015, 12, 25))
Newly added functions : import them as you want.
count_sun(year), count_sat(year) : Count the number of Sundays / Saturdays for the year.
count_holidays(base, year, include_sun = False, include_sat = False) : Count the number of holidays, which add or disable Saturdays and Sundays as you specify.
'base' is 'a HolidayBase object that predetermined in years'.
years_graph(start, end, sat = False, sun = False) : Draw a matplotlib.pyplot barplot of the number of holidays between specified year term. You can include Saturday and Sunday options like as count_holidays.
months_graph(year) : Draw a matplotlib.pyplot barplot of the number of holidays per month, in a specified year.
.. __: LICENSE
Code and documentation are available according to the MIT License (see LICENSE__).
FAQs
korean-specialized holiday calendar based on [python-holidays] package by dr-prodigy
We found that korean-holiday-calendar demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.