Skip to content

Commit

Permalink
Format with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
bcbnz committed Jan 26, 2025
1 parent f4ad466 commit 5f0fa10
Show file tree
Hide file tree
Showing 54 changed files with 74 additions and 157 deletions.
1 change: 1 addition & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: Blair Bonnett
# SPDX-License-Identifier: BSD-3-Clause


def pytest_itemcollected(item):
"""Use the test docstring (if available) as the node ID.
Expand Down
2 changes: 0 additions & 2 deletions data/share/matplotlib-pgfutils/examples/threecol/double.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=0.4, columns=2)

from matplotlib import pyplot as plt
import numpy as np


t = np.linspace(0, 10, 400)
s = 0.3 * t + 2.5 * np.cos(2 * np.pi * 0.85 * t) - 0.8

Expand Down
2 changes: 0 additions & 2 deletions data/share/matplotlib-pgfutils/examples/threecol/single.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=0.4, columns=1)

from matplotlib import pyplot as plt
import numpy as np


t = np.linspace(0, 10, 200)
s = 0.3 * t + 2.5 * np.cos(2 * np.pi * 0.85 * t) - 0.8

Expand Down
2 changes: 0 additions & 2 deletions data/share/matplotlib-pgfutils/examples/threecol/triple.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=0.4, columns=3)

from matplotlib import pyplot as plt
import numpy as np


t = np.linspace(0, 10, 400)
s = 0.3 * t + 2.5 * np.cos(2 * np.pi * 0.85 * t) - 0.8

Expand Down
2 changes: 0 additions & 2 deletions data/share/matplotlib-pgfutils/examples/twocol/double.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=0.4, columns=2)

from matplotlib import pyplot as plt
import numpy as np


t = np.linspace(0, 10, 400)
s = 0.3 * t + 2.5 * np.cos(2 * np.pi * 0.85 * t) - 0.8

Expand Down
2 changes: 0 additions & 2 deletions data/share/matplotlib-pgfutils/examples/twocol/single.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=0.4, columns=1)

from matplotlib import pyplot as plt
import numpy as np


t = np.linspace(0, 10, 200)
s = 0.3 * t + 2.5 * np.cos(2 * np.pi * 0.85 * t) - 0.8

Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ select = [
"W", # pycodestyle warnings
]

[tool.ruff.isort]
[tool.ruff.lint.isort]
combine-as-imports = true
force-sort-within-sections = true

[tool.ruff.lint.per-file-ignores]
"data/**.py" = ["E402"]
"tests/**.py" = ["E402"]


#
# Testing
Expand Down
2 changes: 0 additions & 2 deletions tests/sources/environment/check_set/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@

from pgfutils import save, setup_figure


setup_figure()

import os


name1 = os.environ.get("name1", "not set")
name2 = os.environ.get("name2", "not set")

Expand Down
3 changes: 0 additions & 3 deletions tests/sources/environment/check_set/override.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@

import os


os.environ["name1"] = "original value"

from pgfutils import save, setup_figure


setup_figure()

import os


name1 = os.environ.get("name1", "not set")
name2 = os.environ.get("name2", "not set")

Expand Down
1 change: 0 additions & 1 deletion tests/sources/environment/invalid/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@

from pgfutils import save, setup_figure


setup_figure()
save()
2 changes: 0 additions & 2 deletions tests/sources/environment/repeated/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@

from pgfutils import save, setup_figure


setup_figure()

import os


name1 = os.environ.get("name1", "not set")
name2 = os.environ.get("name2", "not set")

Expand Down
2 changes: 0 additions & 2 deletions tests/sources/external/cartopy_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=1)

import cartopy.crs as ccrs
import matplotlib.pyplot as plt


ax = plt.axes(projection=ccrs.PlateCarree())
ax.stock_img()

Expand Down
2 changes: 0 additions & 2 deletions tests/sources/external/seaborn_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=1)

import seaborn as sns


sns.set()
tips = sns.load_dataset("tips")
sns.relplot(
Expand Down
5 changes: 2 additions & 3 deletions tests/sources/fix_raster_paths/figures/noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

from pgfutils import save, setup_figure


setup_figure(width=0.95, height=0.4)

from matplotlib import pyplot as plt
import numpy as np


noise = np.random.randn(512, 256)
rng = np.random.default_rng(seed=100)
noise = rng.random((512, 256))
plt.imshow(noise, interpolation="nearest", aspect="auto")
plt.colorbar()

Expand Down
5 changes: 2 additions & 3 deletions tests/sources/fix_raster_paths/speckle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

from pgfutils import save, setup_figure


setup_figure(width=0.95, height=0.4)

from matplotlib import pyplot as plt
import numpy as np


noise = np.random.randn(512, 256) + 1j * np.random.randn(512, 256)
rng = np.random.default_rng(seed=1010)
noise = rng.standard_normal((512, 256)) + 1j * rng.standard_normal((512, 256))
plt.imshow(np.abs(noise) ** 2, interpolation="nearest", aspect="auto")
plt.colorbar()

Expand Down
2 changes: 0 additions & 2 deletions tests/sources/fonts/custom_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import save, setup_figure


setup_figure(width=0.95, height=0.4)

from matplotlib import pyplot as plt
import numpy as np


t = np.linspace(-4, 4, 201)
plt.plot(t, 2 * np.sin(2 * np.pi * 2.5 * t))

Expand Down
2 changes: 0 additions & 2 deletions tests/sources/fonts/noconfig/custom_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from pgfutils import save, setup_figure


setup_figure(
width=0.5,
height=0.4,
Expand All @@ -16,7 +15,6 @@
from matplotlib import pyplot as plt
import numpy as np


t = np.linspace(-4, 4, 201)
plt.plot(t, 2 * np.sin(2 * np.pi * 2.5 * t))

Expand Down
1 change: 0 additions & 1 deletion tests/sources/kwargs/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=1)
save()
1 change: 0 additions & 1 deletion tests/sources/kwargs/overridden.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=1, figure_background="red")
save()
2 changes: 0 additions & 2 deletions tests/sources/legend/legend_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=1)

from matplotlib import pyplot as plt
from matplotlib.lines import Line2D


cmap = plt.cm.coolwarm
custom_lines = [
Line2D([0], [0], color=cmap(0), lw=4),
Expand Down
2 changes: 0 additions & 2 deletions tests/sources/pythonpath/using_custom_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=1)

from custom_library import get_data
import matplotlib.pyplot as plt


t, s = get_data()
plt.plot(t, s)

Expand Down
2 changes: 0 additions & 2 deletions tests/sources/tikzpicture/square.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
# Set up the figure environment.
from pgfutils import save, setup_figure


setup_figure(width=0.9, height=0.4)

from matplotlib import pyplot as plt
import numpy as np


# Generate square wave from a few terms of its Fourier series.
f = 3
t = np.linspace(0, 1, 501)
Expand Down
2 changes: 0 additions & 2 deletions tests/sources/tracking/config_enabled/config_enabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import add_dependencies, save, setup_figure


setup_figure(width=1, height=1)

from matplotlib import pyplot as plt
import numpy as np


noise = np.load("noise.npy")
plt.imshow(noise)
plt.colorbar()
Expand Down
2 changes: 0 additions & 2 deletions tests/sources/tracking/dependency_loadtxt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=1)

from matplotlib import pyplot as plt
import numpy as np


data = np.loadtxt("scatter.csv", delimiter=",", dtype=int)

x = data[:, :3]
Expand Down
2 changes: 0 additions & 2 deletions tests/sources/tracking/dependency_npy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=1)

from matplotlib import pyplot as plt
import numpy as np


data = np.load("noise.npy")

x = data[:, :3]
Expand Down
2 changes: 0 additions & 2 deletions tests/sources/tracking/dependency_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@

from pgfutils import save, setup_figure


setup_figure(width=1, height=1)

import pathlib

from matplotlib import pyplot as plt
import numpy as np


datastr = pathlib.Path("scatter.csv").read_text()
data = np.genfromtxt(datastr.splitlines(), delimiter=",", dtype=int)

Expand Down
2 changes: 0 additions & 2 deletions tests/sources/tracking/extra_dirs/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import add_dependencies, save, setup_figure


setup_figure(width=1, height=1)

from matplotlib import pyplot as plt
import numpy as np


noise = np.load("../noise.npy")
plt.imshow(noise)
plt.colorbar()
Expand Down
2 changes: 0 additions & 2 deletions tests/sources/tracking/imports/cfg_extra/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import save, setup_figure


setup_figure(height=0.3)

from custom_lib import get_data
from matplotlib import pyplot as plt


t, s = get_data()
plt.plot(t, s)

Expand Down
2 changes: 0 additions & 2 deletions tests/sources/tracking/imports/cfg_pythonpath/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from pgfutils import save, setup_figure


setup_figure(height=0.3)

from custom_lib import get_data
from matplotlib import pyplot as plt


t, s = get_data()
plt.plot(t, s)

Expand Down
Loading

0 comments on commit 5f0fa10

Please sign in to comment.