Skip to content

Commit

Permalink
LINT: fix ruff stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhi committed Sep 10, 2024
1 parent f81e5fe commit cb2a1bd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
19 changes: 11 additions & 8 deletions docs/examples/scatter-selector.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"\n",
"import mpl_interactions.ipyplot as iplt\n",
"from mpl_interactions import indexer, panhandler, zoom_factory\n",
"from mpl_interactions.utils import indexer\n",
"from mpl_interactions.widgets import scatter_selector_index"
]
},
Expand All @@ -57,7 +56,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"with open(\"data/stock-metadata.pickle\", \"rb\") as f:\n",
" meta = pickle.load(f)\n",
"prices = np.load(\"data/stock-prices.npz\")[\"prices\"]\n",
Expand Down Expand Up @@ -167,6 +165,7 @@
"# Download the data from https://www.kaggle.com/camnugent/sandp500\n",
"# and save it into a folder named `data`\n",
"import glob\n",
"import pickle\n",
"\n",
"test = np.loadtxt(\"data/A_data.csv\", delimiter=\",\", skiprows=1, usecols=1)\n",
"sp500_glob = glob.glob(\n",
Expand All @@ -182,7 +181,7 @@
" try:\n",
" prices[i] = np.loadtxt(f, delimiter=\",\", skiprows=1, usecols=1)\n",
" prices_good.append(True)\n",
" except:\n",
" except: # noqa\n",
" fails.append(fname.split(\"_\")[0])\n",
" prices_good.append(False)\n",
" pass\n",
Expand All @@ -197,19 +196,18 @@
"good_names = []\n",
"primary = []\n",
"secondary = []\n",
"good_idx = np.zeros(real_names.shape[0], dtype=bool)\n",
"for i, name in enumerate(real_names):\n",
"good_idx = np.zeros(arr.shape[0], dtype=bool)\n",
"for i, name in enumerate(arr):\n",
" try:\n",
" info = name_dict[name]\n",
" good_idx[i] = True\n",
" good_names.append(info[0])\n",
" primary.append(info[1])\n",
" secondary.append(info[2])\n",
" except:\n",
" except KeyError:\n",
" pass\n",
"psector_dict = {val: i for i, val in enumerate(np.unique(primary))}\n",
"data_colors = np.array([psector_dict[val] for val in primary], dtype=int)\n",
"import pickle\n",
"\n",
"meta = {\n",
" \"good_idx\": good_idx,\n",
Expand All @@ -224,7 +222,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "mpl-ext-dev",
"language": "python",
"name": "python3"
},
Expand All @@ -239,6 +237,11 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
},
"vscode": {
"interpreter": {
"hash": "55dd65db90870e4ef86f9b4099f0eeaeed6e43259b5e360e26f77b1862bc7b1c"
}
}
},
"nbformat": 4,
Expand Down
18 changes: 10 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ addopts = [
# https://github.com/charliermarsh/ruff
[tool.ruff]
line-length = 100
target-version = "py38"

[tool.ruff.lint]
extend-select = [
"E", # style errors
"F", # flakes
Expand All @@ -42,11 +43,11 @@ extend-select = [
"U", # pyupgrade
# "N", # pep8-naming
# "S", # bandit
"C", # flake8-comprehensions
"B", # flake8-bugbear
"A001", # flake8-builtins
"RUF", # ruff-specific rules
"M001", # Unused noqa directive
"C", # flake8-comprehensions
"B", # flake8-bugbear
"A001", # flake8-builtins
"RUF", # ruff-specific rules
"RUF100", # Unused noqa directive
]
extend-ignore = [
"D100", # Missing docstring in public module
Expand All @@ -60,9 +61,10 @@ extend-ignore = [
]


[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/*.py" = ["D"]
"__init__.py" = ["E402", "F403", "D104"]
"docs/conf.py" = ["A001", "C901", "D200", "D400", "D415"]
"docs/examples/**/*.py" = ["D400", "D415", "D205", "D103"]
"mpl_interactions/ipyplot.py" = ["F401"]
"docs/examples/**/*.ipynb" = ["D400", "D415", "D205", "D103", "F811", "E402"]
"ipyplot.py" = ["F401"]
9 changes: 0 additions & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,3 @@ dev =
pre-commit
sphinx-autobuild
tox >= 1.9 # for skip_install, use_develop

[flake8]
max-line-length = 88
docstring-convention = numpy
ignore = D100, D213, D401, D413, D107, W503, E501, E231, W291
per-file-ignores =
*/__init__.py: F401, F403
mpl_interactions/ipyplot.py: F401
tests/test_pyplot.py: F811

0 comments on commit cb2a1bd

Please sign in to comment.