Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9d7bff

Browse files
authored
Merge pull request #25099 from dstansby/isort
Add isort (import sorting) to pre-commit hooks
2 parents af8a046 + 18b9eb8 commit c9d7bff

File tree

436 files changed

+846
-620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

436 files changed

+846
-620
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,10 @@ repos:
4141
"--skip",
4242
"doc/users/project/credits.rst"
4343
]
44+
45+
- repo: https://github.com/pycqa/isort
46+
rev: 5.12.0
47+
hooks:
48+
- id: isort
49+
name: isort (python)
50+
files: ^tutorials/|^examples/

examples/animation/animate_decay.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313

1414
import itertools
1515

16-
import numpy as np
1716
import matplotlib.pyplot as plt
17+
import numpy as np
18+
1819
import matplotlib.animation as animation
1920

2021

examples/animation/animated_histogram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
histogram.
88
"""
99

10+
import matplotlib.pyplot as plt
1011
import numpy as np
1112

12-
import matplotlib.pyplot as plt
1313
import matplotlib.animation as animation
1414

1515
# Fixing random state for reproducibility

examples/animation/bayes_update.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313

1414
import math
1515

16-
import numpy as np
1716
import matplotlib.pyplot as plt
17+
import numpy as np
18+
1819
from matplotlib.animation import FuncAnimation
1920

2021

examples/animation/double_pendulum.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
Output generate via `matplotlib.animation.Animation.to_jshtml`.
1212
"""
1313

14-
from numpy import sin, cos
15-
import numpy as np
14+
from collections import deque
15+
1616
import matplotlib.pyplot as plt
17+
import numpy as np
18+
from numpy import cos, sin
19+
1720
import matplotlib.animation as animation
18-
from collections import deque
1921

2022
G = 9.8 # acceleration due to gravity, in m/s^2
2123
L1 = 1.0 # length of pendulum 1 in m

examples/animation/dynamic_image.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
Output generate via `matplotlib.animation.Animation.to_jshtml`.
77
"""
88

9-
import numpy as np
109
import matplotlib.pyplot as plt
10+
import numpy as np
11+
1112
import matplotlib.animation as animation
1213

1314
fig, ax = plt.subplots()

examples/animation/frame_grabbing_sgskip.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
"""
1212

1313
import numpy as np
14+
1415
import matplotlib
16+
1517
matplotlib.use("Agg")
1618
import matplotlib.pyplot as plt
19+
1720
from matplotlib.animation import FFMpegWriter
1821

1922
# Fixing random state for reproducibility

examples/animation/multiple_axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
Output generate via `matplotlib.animation.Animation.to_jshtml`.
1212
"""
1313

14-
import numpy as np
1514
import matplotlib.pyplot as plt
15+
import numpy as np
16+
1617
import matplotlib.animation as animation
1718
from matplotlib.patches import ConnectionPatch
1819

examples/animation/pause_resume.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
"""
2121

2222
import matplotlib.pyplot as plt
23-
import matplotlib.animation as animation
2423
import numpy as np
2524

25+
import matplotlib.animation as animation
26+
2627

2728
class PauseAnimation:
2829
def __init__(self):

examples/animation/rain.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
Output generate via `matplotlib.animation.Animation.to_jshtml`.
1212
"""
1313

14-
import numpy as np
1514
import matplotlib.pyplot as plt
15+
import numpy as np
16+
1617
from matplotlib.animation import FuncAnimation
1718

1819
# Fixing random state for reproducibility

examples/animation/random_walk.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
Output generate via `matplotlib.animation.Animation.to_jshtml`.
77
"""
88

9-
import numpy as np
109
import matplotlib.pyplot as plt
10+
import numpy as np
11+
1112
import matplotlib.animation as animation
1213

1314
# Fixing random state for reproducibility

examples/animation/simple_anim.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
Output generate via `matplotlib.animation.Animation.to_jshtml`.
77
"""
88

9-
import numpy as np
109
import matplotlib.pyplot as plt
10+
import numpy as np
11+
1112
import matplotlib.animation as animation
1213

1314
fig, ax = plt.subplots()

examples/animation/simple_scatter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
66
Output generate via `matplotlib.animation.Animation.to_jshtml`.
77
"""
8-
import numpy as np
98
import matplotlib.pyplot as plt
9+
import numpy as np
10+
1011
import matplotlib.animation as animation
1112

1213
fig, ax = plt.subplots()

examples/animation/strip_chart.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
Output generate via `matplotlib.animation.Animation.to_jshtml`.
99
"""
1010

11-
import numpy as np
12-
from matplotlib.lines import Line2D
1311
import matplotlib.pyplot as plt
12+
import numpy as np
13+
1414
import matplotlib.animation as animation
15+
from matplotlib.lines import Line2D
1516

1617

1718
class Scope:

examples/animation/unchained.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
Output generate via `matplotlib.animation.Animation.to_jshtml`.
1212
"""
1313

14-
import numpy as np
1514
import matplotlib.pyplot as plt
15+
import numpy as np
16+
1617
import matplotlib.animation as animation
1718

1819
# Fixing random state for reproducibility

examples/axes_grid1/demo_anchored_direction_arrows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"""
77
import matplotlib.pyplot as plt
88
import numpy as np
9-
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDirectionArrows
10-
import matplotlib.font_manager as fm
119

10+
import matplotlib.font_manager as fm
11+
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDirectionArrows
1212

1313
# Fixing random state for reproducibility
1414
np.random.seed(19680801)

examples/axes_grid1/demo_axes_divider.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
create a divider for them using existing axes instances.
88
"""
99

10-
from matplotlib import cbook
1110
import matplotlib.pyplot as plt
1211

12+
from matplotlib import cbook
13+
1314

1415
def get_demo_image():
1516
z = cbook.get_sample_data("axes_grid/bivariate_normal.npy", np_load=True)
@@ -27,7 +28,7 @@ def demo_simple_image(ax):
2728

2829
def demo_locatable_axes_hard(fig):
2930

30-
from mpl_toolkits.axes_grid1 import SubplotDivider, Size
31+
from mpl_toolkits.axes_grid1 import Size, SubplotDivider
3132
from mpl_toolkits.axes_grid1.mpl_axes import Axes
3233

3334
divider = SubplotDivider(fig, 2, 2, 2, aspect=True)

examples/axes_grid1/demo_axes_grid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
Grid of 2x2 images with a single colorbar or with one colorbar per axes.
77
"""
88

9-
from matplotlib import cbook
109
import matplotlib.pyplot as plt
11-
from mpl_toolkits.axes_grid1 import ImageGrid
1210

11+
from matplotlib import cbook
12+
from mpl_toolkits.axes_grid1 import ImageGrid
1313

1414
Z = cbook.get_sample_data( # (15, 15) array
1515
"axes_grid/bivariate_normal.npy", np_load=True)

examples/axes_grid1/demo_axes_grid2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
Grid of images with shared xaxis and yaxis.
77
"""
88

9+
import matplotlib.pyplot as plt
910
import numpy as np
11+
1012
from matplotlib import cbook
1113
import matplotlib.colors
12-
import matplotlib.pyplot as plt
1314
from mpl_toolkits.axes_grid1 import ImageGrid
1415

1516

examples/axes_grid1/demo_axes_hbox_divider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
1111
"""
1212

13-
import numpy as np
1413
import matplotlib.pyplot as plt
14+
import numpy as np
15+
1516
from mpl_toolkits.axes_grid1.axes_divider import HBoxDivider, VBoxDivider
1617
import mpl_toolkits.axes_grid1.axes_size as Size
1718

18-
1919
arr1 = np.arange(20).reshape((4, 5))
2020
arr2 = np.arange(20).reshape((5, 4))
2121

examples/axes_grid1/demo_axes_rgb.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
channels.
99
"""
1010

11+
import matplotlib.pyplot as plt
1112
import numpy as np
13+
1214
from matplotlib import cbook
13-
import matplotlib.pyplot as plt
14-
from mpl_toolkits.axes_grid1.axes_rgb import make_rgb_axes, RGBAxes
15+
from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes, make_rgb_axes
1516

1617

1718
def get_rgb():

examples/axes_grid1/demo_colorbar_of_inset_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
===============================
55
"""
66

7-
from matplotlib import cbook
87
import matplotlib.pyplot as plt
9-
from mpl_toolkits.axes_grid1.inset_locator import inset_axes, zoomed_inset_axes
108

9+
from matplotlib import cbook
10+
from mpl_toolkits.axes_grid1.inset_locator import inset_axes, zoomed_inset_axes
1111

1212
fig, ax = plt.subplots(figsize=[5, 4])
1313
ax.set(aspect=1, xlim=(-15, 15), ylim=(-20, 5))

examples/axes_grid1/demo_colorbar_with_axes_divider.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"""
1212

1313
import matplotlib.pyplot as plt
14+
1415
from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable
1516

1617
fig, (ax1, ax2) = plt.subplots(1, 2)

examples/axes_grid1/demo_colorbar_with_inset_locator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"""
1414

1515
import matplotlib.pyplot as plt
16+
1617
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
1718

1819
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=[6, 3])

examples/axes_grid1/demo_edge_colorbar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
of an image grid.
88
"""
99

10-
from matplotlib import cbook
1110
import matplotlib.pyplot as plt
11+
12+
from matplotlib import cbook
1213
from mpl_toolkits.axes_grid1 import AxesGrid
1314

1415

examples/axes_grid1/demo_imagegrid_aspect.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66

77
import matplotlib.pyplot as plt
8+
89
from mpl_toolkits.axes_grid1 import ImageGrid
910

1011
fig = plt.figure()

examples/axes_grid1/inset_locator_demo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
# controlled via the *borderpad* parameter.
1515

1616
import matplotlib.pyplot as plt
17-
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
1817

18+
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
1919

2020
fig, (ax, ax2) = plt.subplots(1, 2, figsize=[5.5, 2.8])
2121

@@ -136,6 +136,7 @@
136136
# Create an inset horizontally centered in figure coordinates and vertically
137137
# bound to line up with the axes.
138138
from matplotlib.transforms import blended_transform_factory # noqa
139+
139140
transform = blended_transform_factory(fig.transFigure, ax2.transAxes)
140141
axins4 = inset_axes(ax2, width="16%", height="34%",
141142
bbox_to_anchor=(0, 0, 1, 1),

examples/axes_grid1/inset_locator_demo2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
:doc:`/gallery/subplots_axes_and_figures/zoom_inset_axes`.
1313
"""
1414

15-
from matplotlib import cbook
1615
import matplotlib.pyplot as plt
17-
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes, mark_inset
18-
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
19-
2016
import numpy as np
2117

18+
from matplotlib import cbook
19+
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
20+
from mpl_toolkits.axes_grid1.inset_locator import mark_inset, zoomed_inset_axes
21+
2222

2323
def get_demo_image():
2424
z = cbook.get_sample_data("axes_grid/bivariate_normal.npy", np_load=True)

examples/axes_grid1/make_room_for_ylabel_using_axesgrid.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from mpl_toolkits.axes_grid1 import make_axes_locatable
1010
from mpl_toolkits.axes_grid1.axes_divider import make_axes_area_auto_adjustable
1111

12-
1312
fig = plt.figure()
1413
ax = fig.add_axes([0, 0, 1, 1])
1514

examples/axes_grid1/parasite_simple.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66

77
import matplotlib.pyplot as plt
8+
89
from mpl_toolkits.axes_grid1 import host_subplot
910

1011
host = host_subplot(111)

examples/axes_grid1/parasite_simple2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
================
55
66
"""
7-
import matplotlib.transforms as mtransforms
87
import matplotlib.pyplot as plt
8+
9+
import matplotlib.transforms as mtransforms
910
from mpl_toolkits.axes_grid1.parasite_axes import HostAxes
1011

1112
obs = [["01_S1", 3.88, 0.14, 1970, 63],

examples/axes_grid1/scatter_hist_locatable_axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
:doc:`/gallery/lines_bars_and_markers/scatter_hist` example.
1616
"""
1717

18-
import numpy as np
1918
import matplotlib.pyplot as plt
19+
import numpy as np
20+
2021
from mpl_toolkits.axes_grid1 import make_axes_locatable
2122

2223
# Fixing random state for reproducibility

examples/axes_grid1/simple_anchored_artists.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def draw_circle(ax):
3737
"""
3838
Draw a circle in axis coordinates
3939
"""
40-
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingArea
4140
from matplotlib.patches import Circle
41+
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingArea
4242
ada = AnchoredDrawingArea(20, 20, 0, 0,
4343
loc='upper right', pad=0., frameon=False)
4444
p = Circle((10, 10), 10)

0 commit comments

Comments
 (0)