Skip to content

Commit

Permalink
feat: add ruff to pre-commit (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoralez authored Aug 21, 2024
1 parent bbb0810 commit e5a0426
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
run: pip install black nbdev pre-commit

- name: Run pre-commit
run: pre-commit run
run: pre-commit run --files nixtla/*
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ repos:
hooks:
- id: nbdev_clean
- id: nbdev_export
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
- id: ruff
7 changes: 3 additions & 4 deletions nbs/nixtla_client.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,13 @@
" RetryCallState,\n",
" retry,\n",
" retry_if_exception,\n",
" retry_if_exception_type,\n",
" stop_after_attempt,\n",
" stop_after_delay,\n",
" wait_fixed,\n",
")\n",
"from utilsforecast.compat import DFType, DataFrame, pl_DataFrame\n",
"from utilsforecast.feature_engineering import _add_time_features, time_features\n",
"from utilsforecast.validation import ensure_time_dtype, validate_format, validate_freq\n",
"from utilsforecast.validation import ensure_time_dtype, validate_format\n",
"if TYPE_CHECKING:\n",
" try:\n",
" from fugue import AnyDataFrame\n",
Expand Down Expand Up @@ -2601,7 +2600,7 @@
" )\n",
"\n",
"def _get_schema(\n",
" df: 'fugue.AnyDataFrame',\n",
" df: 'AnyDataFrame',\n",
" method: str,\n",
" id_col: str,\n",
" time_col: str,\n",
Expand Down Expand Up @@ -2635,7 +2634,7 @@
" return schema\n",
"\n",
"def _distributed_setup(\n",
" df: 'fugue.AnyDataFrame',\n",
" df: 'AnyDataFrame',\n",
" method: str,\n",
" id_col: str,\n",
" time_col: str,\n",
Expand Down
2 changes: 1 addition & 1 deletion nbs/utils.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"source": [
"#| exporti\n",
"def colab_badge(path: str):\n",
" from IPython.display import Markdown\n",
" from IPython.display import Markdown, display\n",
" base_url = \"https://colab.research.google.com/github\"\n",
" badge_svg = \"https://colab.research.google.com/assets/colab-badge.svg\"\n",
" nb_url = f'{base_url}/Nixtla/nixtla/blob/main/nbs/{path}.ipynb'\n",
Expand Down
1 change: 1 addition & 0 deletions nixtla/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
__all__ = ["NixtlaClient"]
__version__ = "0.5.2"

from .nixtla_client import NixtlaClient
7 changes: 3 additions & 4 deletions nixtla/nixtla_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@
RetryCallState,
retry,
retry_if_exception,
retry_if_exception_type,
stop_after_attempt,
stop_after_delay,
wait_fixed,
)
from utilsforecast.compat import DFType, DataFrame, pl_DataFrame
from utilsforecast.feature_engineering import _add_time_features, time_features
from utilsforecast.validation import ensure_time_dtype, validate_format, validate_freq
from utilsforecast.validation import ensure_time_dtype, validate_format

if TYPE_CHECKING:
try:
Expand Down Expand Up @@ -1609,7 +1608,7 @@ def _cross_validation_wrapper(


def _get_schema(
df: "fugue.AnyDataFrame",
df: "AnyDataFrame",
method: str,
id_col: str,
time_col: str,
Expand Down Expand Up @@ -1644,7 +1643,7 @@ def _get_schema(


def _distributed_setup(
df: "fugue.AnyDataFrame",
df: "AnyDataFrame",
method: str,
id_col: str,
time_col: str,
Expand Down
2 changes: 1 addition & 1 deletion nixtla/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# %% ../nbs/utils.ipynb 3
def colab_badge(path: str):
from IPython.display import Markdown
from IPython.display import Markdown, display

base_url = "https://colab.research.google.com/github"
badge_svg = "https://colab.research.google.com/assets/colab-badge.svg"
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[tool.ruff.lint]
select = [
"F", # pyflakes
]

0 comments on commit e5a0426

Please sign in to comment.