diff --git a/docs/examples/scatter-selector.ipynb b/docs/examples/scatter-selector.ipynb index ac0d3bd..e450555 100644 --- a/docs/examples/scatter-selector.ipynb +++ b/docs/examples/scatter-selector.ipynb @@ -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" ] }, @@ -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", @@ -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", @@ -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", @@ -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", @@ -224,7 +222,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "mpl-ext-dev", "language": "python", "name": "python3" }, @@ -239,6 +237,11 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.0" + }, + "vscode": { + "interpreter": { + "hash": "55dd65db90870e4ef86f9b4099f0eeaeed6e43259b5e360e26f77b1862bc7b1c" + } } }, "nbformat": 4, diff --git a/pyproject.toml b/pyproject.toml index dd362c5..87ffc6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 @@ -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 @@ -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"] diff --git a/setup.cfg b/setup.cfg index abc8890..303353f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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