Skip to content

Commit

Permalink
adopt ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
juanitorduz committed Nov 7, 2023
1 parent 0ef986a commit 5cb12b1
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 65 deletions.
64 changes: 25 additions & 39 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,28 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude_types: [svg]
- id: end-of-file-fixer
exclude_types: [svg]
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [--profile, black]
types: [python]
- repo: https://github.com/ambv/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-black
# additional_dependencies: [jupytext] # optional, only if you're using Jupytext
- id: nbqa-pyupgrade
args: ["--py37-plus"]
- id: nbqa-isort
args: ["--float-to-top"]
- repo: https://github.com/econchick/interrogate
rev: 1.5.0
hooks:
- id: interrogate
# needed to make excludes in pyproject.toml work
# see here https://github.com/econchick/interrogate/issues/60#issuecomment-735436566
pass_filenames: false
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude_types: [svg]
- id: end-of-file-fixer
exclude_types: [svg]
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.4
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-ruff
- repo: https://github.com/econchick/interrogate
rev: 1.5.0
hooks:
- id: interrogate
# needed to make excludes in pyproject.toml work
# see here https://github.com/econchick/interrogate/issues/60#issuecomment-735436566
pass_filenames: false
17 changes: 13 additions & 4 deletions causalpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import arviz as az

import causalpy.pymc_experiments
import causalpy.pymc_models
import causalpy.skl_experiments
import causalpy.skl_models
from causalpy import pymc_experiments
from causalpy import pymc_models
from causalpy import skl_experiments
from causalpy import skl_models
from causalpy.version import __version__

from .data import load_data

az.style.use("arviz-darkgrid")

__all__ = [
"pymc_experiments",
"pymc_models",
"skl_experiments",
"skl_models",
"load_data",
"__version__",
]
1 change: 0 additions & 1 deletion docs/source/notebooks/did_skl.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"metadata": {},
"outputs": [],
"source": [
"import xarray as xr\n",
"from sklearn.linear_model import LinearRegression\n",
"\n",
"import causalpy as cp"
Expand Down
6 changes: 5 additions & 1 deletion docs/source/notebooks/geolift1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,14 @@
}
],
"source": [
"formula = \"\"\"\n",
" \"Denmark ~ 0 + Austria + Belgium + Bulgaria + Croatia + Cyprus + Czech_Republic\"\n",
"\"\"\"\n",
"\n",
"result = cp.pymc_experiments.SyntheticControl(\n",
" df,\n",
" treatment_time,\n",
" formula=\"Denmark ~ 0 + Austria + Belgium + Bulgaria + Croatia + Cyprus + Czech_Republic\",\n",
" formula=formula,\n",
" model=cp.pymc_models.WeightedSumFitter(\n",
" sample_kwargs={\"target_accept\": 0.95, \"random_seed\": seed}\n",
" ),\n",
Expand Down
17 changes: 1 addition & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,7 @@ docs = [
"statsmodels",
"sphinxcontrib-bibtex",
]
lint = [
"black",
"flake8",
"interrogate",
"isort",
"nbqa",
"pre-commit",
"pylint",
]
lint = ["interrogate", "nbqa", "pre-commit", "ruff"]
test = ["pytest", "pytest-cov"]

[metadata]
Expand All @@ -83,13 +75,6 @@ Homepage = "https://github.com/pymc-labs/CausalPy"
"Bug Reports" = "https://github.com/pymc-labs/CausalPy/issues"
"Source" = "https://github.com/pymc-labs/CausalPy"

[tool.black]
line_length = 88

[tool.isort]
profile = "black"
skip_gitignore = true

[tool.pytest.ini_options]
addopts = [
"-vv",
Expand Down
4 changes: 0 additions & 4 deletions setup.cfg

This file was deleted.

0 comments on commit 5cb12b1

Please sign in to comment.