Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chile: refactor equinox holiday to use pymeeus #863

Merged
merged 1 commit into from
Dec 27, 2022
Merged

Chile: refactor equinox holiday to use pymeeus #863

merged 1 commit into from
Dec 27, 2022

Conversation

pmpbaptista
Copy link
Contributor

pymeeus being a dependency already enables the equinox and solstice date calculation
Remove Meeus Algorithms code from utils and refactor Chile holidays to use pymeeus to get equinox dates

@coveralls
Copy link

coveralls commented Dec 21, 2022

Coverage Status

Coverage remained the same at 100.0% when pulling 325a0e0 on Nalguedo:pb-chile-pymeeus into 24441b6 on dr-prodigy:beta.

Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of suggestions for your consideration:

holidays/countries/chile.py Outdated Show resolved Hide resolved
holidays/countries/chile.py Outdated Show resolved Hide resolved
holidays/countries/chile.py Show resolved Hide resolved
pymeeus being a dependency already enables the equinox and
solstice date calculation
Remove Meeus Algorithms code from utils and refactor Chile
holidays to use pymeeus to get equinox dates
@dr-prodigy dr-prodigy merged commit 068b124 into vacanza:beta Dec 27, 2022
@dr-prodigy
Copy link
Collaborator

This is a very valuable review, @Nalguedo , thx! I've just merged it.
Although it is an implicit dependency, in order to make this more robust, I will also explicitly include PyMeeus in the prerequisite libraries in a further commit.
Thank you 👍

dr-prodigy added a commit that referenced this pull request Dec 27, 2022
@dr-prodigy dr-prodigy mentioned this pull request Dec 27, 2022
dr-prodigy added a commit that referenced this pull request Dec 27, 2022
* Refactor weekdays/weekends logic.

  - Deprecate MON-SUN constants in favor of dateutil MO-SA.
  - Deprecate and move `WEEKENDS` from utils to HolidayBase
    (on per country basis as some countries have not usual SAT, SUN weekends).
  - Add `_is_weekend` method into `HolidayBase`.
  - Change isort multi-line import behavior to bracket-less.
  - Update flake8 settings in order to make it stricter.
  - Remove unused imports.
  - Remove unused/commented out code.

* Migrate special holidays for all countries.

Move logic from `_populate` to `special_holidays` for:
  - Botswana
  - Eswatini
  - Hongkong
  - Ireland
  - Japan
  - South Korea
  - Lesotho
  - Namibia
  - Poland
  - Singapore
  - Slovakia
  - South Africa
  - Zambia

* Rename Korea to South Korea.

Update tests and documentation.

* Fix pre-commit.

* Fix pre-comit and sphinx.

* Address review comments.

* Hong Kong:
- holidays establishing years specified
- historical holidays added
- Lunar New Year and Christmas calculation fix
- Ching Ming Festival and Easter Monday overlapping fix
- optimizations
- tests added

* Optimize `if var in iterable:` statements.

Replace a tuple/list with a set in order to achieve
O(n) -> ~O(1) complexity improvement.

* Change `weekend` data type to set.

* Fix pre-commit config.

* Update holidays/countries/israel.py

Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>

* Fix Israel holidays.

* Migrate Singapore polling days.

* v.0.18 beta init

* Added Indonesian holidays (#787)

* CHANGES sync

* Korea: fixed holidays relevance period (#791)

* CHANGES sync

* Korea quicker tests

* CHANGES sync

* Clean up unused imports. (#792)

* Implement flake8 suggested fixes.
  - Fine tune flake8 setup.cfg config.
  - Remove unused imports.
  - Add __init__.py to test/financial
    Reconfigure flake8 to use per file ignores.
* Fix pre-commit.
* Add flake8-print.

* flake8 settings review

* flake8 settings, print removal

* Clean up .pre-commit-config.yaml. (#795)

* Clean up .pre-commit-config.yaml.
Re-enable rstcheck hook.
* Change flake8 source URL.
Co-authored-by: dr-prodigy <dr-prodigy@github.com>

* CHANGES sync

* Hong Kong fix

* CHANGES sync

* Zambia: optimizations, added special holidays (#798)

Co-authored-by: dr-prodigy <28216945+dr-prodigy@users.noreply.github.com>

* CHANGES sync

* Vietnam: optimizations, observed holidays calculation (#799)

* CHANGES sync

* CHANGES sync

* Uruguay: update holiday names (#809)

* Easter related holidays refactoring and unification (#803)

* Canada: make observed New Year's Day fall on or after the holiday (#811)

* CHANGES sync

* Bump pypa/gh-action-pypi-publish from 1.5.1 to 1.5.2 (#816)

* Address comments (use `self._is_weekend()`).

* Refactor tests. Introduce `common.TestCase`. (#800)

* Refactor tests. Introduce `common.TestCase`.

The `TestCase` class simplifies country holiday tests by providing
ready to use testing methods. It also reduces code clutter, improves
tests readability.

* Add instance eq. assertion.

Merged by: dr-prodigy <28216945+dr-prodigy@users.noreply.github.com>

* CHANGES sync

* Malaysia: (#802)

- fixed dates of some islamic and lunisolar calendar holidays
- rewritten observed calculation (by states)
- huge refactoring
- rewritten tests

* CHANGES sync

* Nigeria holiday updates (#823)

* Financial holiday - Day of Mourning for President George H.W. Bush (#817)

* Madagascar: added holidays with tests (#818)

* Paraguay updates (#819)

- added special holidays
- fixed observance calculation

* South Africa: optimizations (#820)

* Switzerland: optimizations, Näfelser Fahrt fix (#821)

* Angola: optimizations, observance calculation fix (#822)

* India: Diwali and Holi holidays update (#825)

* Hungary: removed double holiday Dec 31 (#826)

* Observed holidays calc optimizations (#824)

* Address review comments.
Add isort first-parties.

* Remove deprecation warnings.
Fix minor issues.

* Bump actions/setup-python from 4.3.0 to 4.3.1 (#831)

* Bump pypa/gh-action-pypi-publish from 1.5.1 to 1.6.4 (#832)

Co-authored-by: dr-prodigy <28216945+dr-prodigy@users.noreply.github.com>

* chile: Día Nacional de los Pueblos Indígenas (#828)

Fix the holiday day when year > 2021 according to the calculated
solstice datetime adjusted to Chile timezone UTC-3
Added necessary util Class _AstroMeeusAlgorithms

Issue: 666

* Kazakhstan: (#829)

- observed holidays
- holidays relevance period

* Improve `common.TestCase` (#830)

* Adding financial holidays - Hurricane Gloria and Sandy (#833)

Co-authored-by: Arkadii Yakovets <ark@cho.red>

* Angola small refactoring (#835)

* New Zealand: optimizations (#836)

* UK King’s Coronation holiday in 2023 (#840)

* CHANGES sync

* Revert "Kazakhstan: (#829)" (#842)

This reverts commit bfde36d.

* Fix `TestCase::parse_arguments` instance determining logic. (#844)

* Chile:
- holidays relevance period fixes
- historical holidays added
- special holidays added
- tests for all holidays

* Revert "Revert "Kazakhstan: (#829)" (#842)" (#845)

This reverts commit 4008a7e.

* CHANGES sync

* Fix conflict solving errors

* South Africa: added 27 Dec 2002 public holiday (#848)

* CHANGES sync

* Add Pakistan holidays (#847)

* CHANGES

* Added tests for _AstroMeeusAlgorithms (#851)

* Pin `coverage` version. (#862)

Add a temporary version pin in order to fix GH CI/CD.

* japan: refactor japanese equinox holidays

Refactored japanese holidays to make use of Meeus algorithms
Include pymeeus in requirements_dev.txt which was already a
transitive dependency associated with convertdate
Sort dependencies alphabetically in requirements_dev.txt

* NYSE: fix Election Day holiday (#853)

* Fix South Korea deprecation warnings. (#854)

* United States: (#857)

* Malaysia multi-day Islamic holidays fixed (#858)

* Bump actions/setup-python from 4.3.0 to 4.4.0 (#871)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.3.0 to 4.4.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v4.3.0...v4.4.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Maurizio Montel <28216945+dr-prodigy@users.noreply.github.com>

* Kazakhstan: (#867)

- update holidays relevance period
- update holidays names

* New Zealand: observed holidays calc optimizations (#872)

* Refactor imports (#870)

* Reconfigure holidays imports.
  * Unify top level imports style
  * Limit imports for holiday_base and utils
  * Reorder country imports
  * Add Moldova alpha-3 code
  * Add tests

* Redesign holidays imports tests.

* Added Armenia holidays (#875)

* Added Armenia holidays

* Update test/countries/test_armenia.py

Co-authored-by: Arkadii Yakovets <ark@cho.red>

Co-authored-by: Maurizio Montel <28216945+dr-prodigy@users.noreply.github.com>
Co-authored-by: Arkadii Yakovets <ark@cho.red>

* Azerbaijan: full refactoring #859

* CHANGES sync

* Chile: refactor equinox holiday to use pymeeus (#863)

* Add PyMeeus explicit dependency #863

* setup-cfg-fmt update

* v.0.18

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Arkadii Yakovets <ark@cho.red>
Co-authored-by: ~Jhellico <jhellico@gmail.com>
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>
Co-authored-by: Maurizio Montel <28216945+dr-prodigy@users.noreply.github.com>
Co-authored-by: Jason Jensen <jason.o.jensen@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: SnowX65 <39384983+SnowX65@users.noreply.github.com>
Co-authored-by: Pedro Baptista <32106544+Nalguedo@users.noreply.github.com>
Co-authored-by: Nalguedo <pedro.miguel.baptista@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants