Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ repos:
- types-docutils
- types-polib
- types-python-dateutil
args:
- --ignore-missing-imports
- --implicit-optional
- --show-error-codes
- types-setuptools

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: '1.5.0'
Expand Down
6 changes: 5 additions & 1 deletion holidays/countries/malaysia.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)

from datetime import date
from typing import TYPE_CHECKING

if TYPE_CHECKING: # pragma: no cover
from datetime import date

from gettext import gettext as tr

from holidays.calendars import (
Expand Down
3 changes: 2 additions & 1 deletion holidays/countries/taiwan.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from datetime import date
from gettext import gettext as tr
from typing import Optional

from holidays.calendars.gregorian import (
JAN,
Expand Down Expand Up @@ -86,7 +87,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_observed(
self, dts: set[date], rule: ObservedRule = None, since: int = 2015
self, dts: set[date], rule: Optional[ObservedRule] = None, since: int = 2015
) -> None:
"""
Taiwan's General Observance Rule first started in 2015 as per
Expand Down
2 changes: 1 addition & 1 deletion holidays/holiday_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ def get_named(

def get_closest_holiday(
self,
target_date: DateLike = None,
target_date: Optional[DateLike] = None,
direction: Literal["forward", "backward"] = "forward",
) -> Optional[tuple[date, str]]:
"""Find the closest holiday relative to a given date.
Expand Down
6 changes: 5 additions & 1 deletion holidays/observed_holiday_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ class ObservedHolidayBase(HolidayBase):
observed_label = "%s"

def __init__(
self, observed_rule: ObservedRule = None, observed_since: int = None, *args, **kwargs
self,
observed_rule: Optional[ObservedRule] = None,
observed_since: Optional[int] = None,
*args,
**kwargs,
):
self._observed_rule = observed_rule or ObservedRule()
self._observed_since = observed_since
Expand Down
19 changes: 8 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,27 @@ no_inline_sort = true
profile = "black"
skip = ["docs"]

[tool.mypy]
strict = false
[[tool.mypy.overrides]]
module = "holidays.countries.*"
disable_error_code = ["override"]

[[tool.mypy.overrides]]
module = "holidays.groups.*"
disable_error_code = ["attr-defined"]

[tool.ruff]
line-length = 99
target-version = "py39"

[tool.ruff.lint]
select = ["E4", "E5", "E7", "E9", "F", "N", "PLE", "T", "UP", "W"]
select = ["E4", "E5", "E7", "E9", "F", "N", "PLE", "T", "TC", "UP", "W"]

[tool.ruff.lint.extend-per-file-ignores]
"scripts/generate_release_notes.py" = ["T201"]

[tool.ruff.lint.flake8-errmsg]
max-string-length = 99

[[tool.mypy.overrides]]
module = "holidays.countries.*"
disable_error_code = ["override"]

[[tool.mypy.overrides]]
module = "holidays.groups.*"
disable_error_code = "attr-defined"

[tool.pytest.ini_options]
addopts = [
"--cov-fail-under=100",
Expand Down