Skip to content

Commit f476363

Browse files
authored
Format with black 22.1.0 (#1715)
Using the first stable release of black released on 29 Jan 2022! Remove spaces around power operators if both operands are simple, and normalize raw f-strings as 'rf' instead of 'fr'.
1 parent dd9fe90 commit f476363

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

examples/gallery/3d_plots/grdview_surface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# https://en.wikipedia.org/wiki/Ackley_function
2424
def ackley(x, y):
2525
return (
26-
-20 * np.exp(-0.2 * np.sqrt(0.5 * (x ** 2 + y ** 2)))
26+
-20 * np.exp(-0.2 * np.sqrt(0.5 * (x**2 + y**2)))
2727
- np.exp(0.5 * (np.cos(2 * np.pi * x) + np.cos(2 * np.pi * y)))
2828
+ np.exp(1)
2929
+ 20

examples/gallery/basemaps/double_y_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class can control which axes should be plotted and optionally show annotations,
2323
# Generate two sample Y data from one common X data
2424
x = np.linspace(1.0, 9.0, num=9)
2525
y1 = x
26-
y2 = x ** 2 + 110
26+
y2 = x**2 + 110
2727

2828
fig = pygmt.Figure()
2929

examples/gallery/images/contours.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
# build the contours underlying data with the function z = x^2 + y^2
2727
X, Y = np.meshgrid(np.linspace(-10, 10, 50), np.linspace(-10, 10, 50))
28-
Z = X ** 2 + Y ** 2
28+
Z = X**2 + Y**2
2929
x, y, z = X.flatten(), Y.flatten(), Z.flatten()
3030

3131

examples/projections/nongeo/cartesian_logarithmic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
# Create a list of x values 0-100
1313
xline = np.arange(0, 101)
1414
# Create a list of y-values that are the square root of the x-values
15-
yline = xline ** 0.5
15+
yline = xline**0.5
1616
# Create a list of x values for every 10 in 0-100
1717
xpoints = np.arange(0, 101, 10)
1818
# Create a list of y-values that are the square root of the x-values
19-
ypoints = xpoints ** 0.5
19+
ypoints = xpoints**0.5
2020

2121
fig = pygmt.Figure()
2222
fig.plot(

examples/projections/nongeo/cartesian_power.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Create a list of y values 0-10
1414
yvalues = np.arange(0, 11)
1515
# Create a list of x-values that are the square of the y-values
16-
xvalues = yvalues ** 2
16+
xvalues = yvalues**2
1717

1818
fig = pygmt.Figure()
1919
fig.plot(

examples/tutorials/basics/plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
fig.plot(
5858
x=data.longitude,
5959
y=data.latitude,
60-
size=0.02 * (2 ** data.magnitude),
60+
size=0.02 * (2**data.magnitude),
6161
style="cc",
6262
color="white",
6363
pen="black",
@@ -85,7 +85,7 @@
8585
fig.plot(
8686
x=data.longitude,
8787
y=data.latitude,
88-
size=0.02 * 2 ** data.magnitude,
88+
size=0.02 * 2**data.magnitude,
8989
color=data.depth_km,
9090
cmap=True,
9191
style="cc",

pygmt/tests/test_clib_loading.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ def test_two_broken_libraries(self, mock_ctypes): # pylint: disable=unused-argu
142142
# pylint: disable=protected-access
143143
lib_fullnames = [self.faked_libgmt1, self.faked_libgmt2]
144144
msg_regex = (
145-
fr"Error loading GMT shared library at '{self.faked_libgmt1._name}'.\n"
146-
fr"Error loading '{self.faked_libgmt1._name}'. Couldn't access.*\n"
147-
fr"Error loading GMT shared library at '{self.faked_libgmt2._name}'.\n"
145+
rf"Error loading GMT shared library at '{self.faked_libgmt1._name}'.\n"
146+
rf"Error loading '{self.faked_libgmt1._name}'. Couldn't access.*\n"
147+
rf"Error loading GMT shared library at '{self.faked_libgmt2._name}'.\n"
148148
f"Error loading '{self.faked_libgmt2._name}'. Couldn't access.*"
149149
)
150150
with pytest.raises(GMTCLibNotFoundError, match=msg_regex):
@@ -162,9 +162,9 @@ def test_load_brokenlib_invalidpath(
162162
# pylint: disable=protected-access
163163
lib_fullnames = [self.faked_libgmt1, self.invalid_path]
164164
msg_regex = (
165-
fr"Error loading GMT shared library at '{self.faked_libgmt1._name}'.\n"
166-
fr"Error loading '{self.faked_libgmt1._name}'. Couldn't access.*\n"
167-
fr"Error loading GMT shared library at '{self.invalid_path}'.\n"
165+
rf"Error loading GMT shared library at '{self.faked_libgmt1._name}'.\n"
166+
rf"Error loading '{self.faked_libgmt1._name}'. Couldn't access.*\n"
167+
rf"Error loading GMT shared library at '{self.invalid_path}'.\n"
168168
f"Unable to find '{self.invalid_path}'"
169169
)
170170
with pytest.raises(GMTCLibNotFoundError, match=msg_regex):

pygmt/tests/test_contour.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def test_contour_vec(region):
4141
)
4242
x = x.flatten()
4343
y = y.flatten()
44-
z = (x - 0.5 * (region[0] + region[1])) ** 2 + 4 * y ** 2
45-
z = np.exp(-z / 10 ** 2 * np.log(2))
44+
z = (x - 0.5 * (region[0] + region[1])) ** 2 + 4 * y**2
45+
z = np.exp(-z / 10**2 * np.log(2))
4646
fig.contour(x=x, y=y, z=z, projection="X10c", region=region, frame="a", pen=True)
4747
return fig
4848

@@ -89,8 +89,8 @@ def test_contour_deprecate_columns_to_incols(region):
8989
)
9090
x = x.flatten()
9191
y = y.flatten()
92-
z = (x - 0.5 * (region[0] + region[1])) ** 2 + 4 * y ** 2
93-
z = np.exp(-z / 10 ** 2 * np.log(2))
92+
z = (x - 0.5 * (region[0] + region[1])) ** 2 + 4 * y**2
93+
z = np.exp(-z / 10**2 * np.log(2))
9494

9595
# generate dataframe
9696
# switch x and y from here onwards to simulate different column order

0 commit comments

Comments
 (0)