Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Jan 6, 2024
1 parent 58fed0e commit 7ab073f
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- run: make install
- run: venv/bin/python -m pytest tests
- run: venv/bin/python -m black --check .
- run: venv/bin/python -m mypy polars_xdt tests
- run: venv/bin/python -m mypy polars_xdt #tests
- run: venv/bin/python -m ruff .

linux:
Expand Down
16 changes: 9 additions & 7 deletions bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

# Docs are in a a separate repo cause I couldn't figure out
# how to deploy from readthedocs
subprocess.run(['make', 'install'])
subprocess.run(['make', 'clean'], cwd='docs')
subprocess.run(['make', 'html'], cwd='docs')
os.system('cp docs/_build/html/* ../docs-polars-xdt/ -r')
subprocess.run(['git', 'add', '.'], cwd='../docs-polars-xdt')
subprocess.run(['git', 'commit', '-m', '\"new version\"', '--allow-empty'], cwd='../docs-polars-xdt')
subprocess.run(['git', 'push', 'origin', 'HEAD'], cwd='../docs-polars-xdt')
subprocess.run(["make", "install"])
subprocess.run(["make", "clean"], cwd="docs")
subprocess.run(["make", "html"], cwd="docs")
os.system("cp docs/_build/html/* ../docs-polars-xdt/ -r")
subprocess.run(["git", "add", "."], cwd="../docs-polars-xdt")
subprocess.run(
["git", "commit", "-m", '"new version"', "--allow-empty"], cwd="../docs-polars-xdt"
)
subprocess.run(["git", "push", "origin", "HEAD"], cwd="../docs-polars-xdt")

how = sys.argv[1]

Expand Down
31 changes: 15 additions & 16 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,37 @@

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import sphinx_autosummary_accessors # noqa: F401

project = 'polars-xdt'
copyright = '2023, Marco Gorelli'
author = 'Marco Gorelli'
project = "polars-xdt"
copyright = "2023, Marco Gorelli"
author = "Marco Gorelli"

import sphinx_autosummary_accessors

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.githubpages",
"sphinx.ext.intersphinx",
'numpydoc',
"numpydoc",
"sphinx_copybutton",
"sphinx_design",
"sphinx_favicon",
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
numpydoc_show_class_members = False
]

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
numpydoc_show_class_members = False


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_static_path = ['_static']
html_theme = "alabaster"
html_static_path = ["_static"]

intersphinx_mapping = {
"polars": ("https://pola-rs.github.io/polars/py-polars/html/", None),
Expand All @@ -48,7 +47,7 @@
html_theme = "pydata_sphinx_theme"

html_theme_options = {
'navigation_with_keys': False,
"navigation_with_keys": False,
}

numpydoc_show_class_members = False
numpydoc_show_class_members = False
12 changes: 3 additions & 9 deletions polars_xdt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from polars_xdt.ranges import date_range

from polars.type_aliases import PolarsDataType
from typing import Iterable, Literal, Protocol, Sequence, cast, get_args
from typing import Iterable, Literal, Protocol, Sequence, cast

if sys.version_info >= (3, 10):
from typing import TypeAlias
Expand Down Expand Up @@ -198,10 +198,7 @@ def sub(
holidays_int = []
else:
holidays_int = sorted(
{
(holiday - date(1970, 1, 1)).days
for holiday in holidays
}
{(holiday - date(1970, 1, 1)).days for holiday in holidays}
)
if isinstance(end_dates, str):
end_dates = pl.col(end_dates)
Expand All @@ -228,10 +225,7 @@ def is_workday(
holidays_int = []
else:
holidays_int = sorted(
{
(holiday - date(1970, 1, 1)).days
for holiday in holidays
}
{(holiday - date(1970, 1, 1)).days for holiday in holidays}
)
result = self._expr.register_plugin(
lib=lib,
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ pandas
pytest
holidays
mypy
black
ruff
1 change: 0 additions & 1 deletion tests/test_date_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,3 @@ def test_eager_custom_holiday() -> None:
],
)
assert_series_equal(result, expected)

5 changes: 4 additions & 1 deletion tests/test_is_busday.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ def test_against_np_is_busday(
expected = np.is_busday(date, weekmask=weekmask, holidays=holidays)
assert result == expected


@given(
datetime=st.datetimes(min_value=dt.datetime(2000, 1, 1), max_value=dt.datetime(2000, 12, 31)),
datetime=st.datetimes(
min_value=dt.datetime(2000, 1, 1), max_value=dt.datetime(2000, 12, 31)
),
weekend=st.lists(
st.sampled_from(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]),
min_size=0,
Expand Down

0 comments on commit 7ab073f

Please sign in to comment.