Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt isort #4174

Merged
merged 13 commits into from
Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 3 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ lint_task:
image: python:3.8
cpu: 2
memory: 4G
name: "${CIRRUS_OS}: flake8 and black"
name: "${CIRRUS_OS}: black, flake8 and isort"
pip_cache:
folder: ~/.cache/pip
fingerprint_script:
Expand All @@ -126,8 +126,9 @@ lint_task:
- pip list
- python -m pip install --retries 3 --upgrade ${PIP_CACHE_PACKAGES}
- pip list
- nox --session flake8
- nox --session black
- nox --session flake8
- nox --session isort


#
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ repos:
# Run flake8.
- id: flake8
args: [--config=./setup.cfg]
- repo: https://github.com/pycqa/isort
rev: 5.8.0
hooks:
- id: isort
name: isort
args: ["--profile", "black", "--filter-files"]
2 changes: 1 addition & 1 deletion docs/gallery_code/general/plot_anomaly_log_colouring.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"""

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

import iris
import iris.coord_categorisation
Expand Down
1 change: 0 additions & 1 deletion docs/gallery_code/general/plot_coriolis.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import matplotlib.pyplot as plt
import numpy as np


import iris
from iris.coord_systems import GeogCS
import iris.plot as iplt
Expand Down
5 changes: 2 additions & 3 deletions docs/gallery_code/general/plot_custom_file_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,17 @@

import datetime

from cf_units import Unit, CALENDAR_GREGORIAN
from cf_units import CALENDAR_GREGORIAN, Unit
import matplotlib.pyplot as plt
import numpy as np

import iris
import iris.coords as icoords
import iris.coord_systems as icoord_systems
import iris.coords as icoords
import iris.fileformats
import iris.io.format_picker as format_picker
import iris.plot as iplt


UTC_format = "%H%M%Z %d/%m/%Y"

FLOAT_HEADERS = [
Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_code/general/plot_inset.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import numpy as np

import iris
import iris.quickplot as qplt
import iris.plot as iplt
import iris.quickplot as qplt


def main():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import iris
import iris.plot as iplt


# Define a Cartopy 'ordinary' lat-lon coordinate reference system.
crs_latlon = ccrs.PlateCarree()

Expand Down
3 changes: 1 addition & 2 deletions docs/gallery_tests/gallerytest_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

import contextlib
import os.path
import warnings
import sys
import warnings

import matplotlib.pyplot as plt

Expand All @@ -22,7 +22,6 @@
import iris.plot as iplt
import iris.quickplot as qplt


GALLERY_DIRECTORY = os.path.join(
os.path.dirname(os.path.dirname(__file__)), "gallery_code"
)
Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_COP_1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_COP_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_SOI_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_TEC.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_anomaly_log_colouring.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_atlantic_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_cross_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_custom_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_custom_file_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_deriving_phenomena.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_global_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_hovmoller.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_inset.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_lagged_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_lineplot_with_legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_load_nemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_orca_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_polar_stereo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_polynomial_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_rotated_pole_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_tests/test_plot_wind_speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from .gallerytest_util import (
add_gallery_to_path,
show_replaced_by_check_graphic,
fail_any_deprecation_warnings,
show_replaced_by_check_graphic,
)


Expand Down
1 change: 1 addition & 0 deletions docs/src/common_links.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
.. _Iris GitHub: https://github.com/SciTools/iris
.. _iris-sample-data: https://github.com/SciTools/iris-sample-data
.. _iris-test-data: https://github.com/SciTools/iris-test-data
.. _isort: https://pycqa.github.io/isort/
.. _issue: https://github.com/SciTools/iris/issues
.. _issues: https://github.com/SciTools/iris/issues
.. _legacy documentation: https://scitools.org.uk/iris/docs/v2.4.0/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import iris
import iris.quickplot as qplt


fname = iris.sample_data_path("air_temp.pp")
temperature = iris.load_cube(fname)

Expand Down
1 change: 0 additions & 1 deletion docs/src/userguide/plotting_examples/1d_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import iris
import iris.plot as iplt


fname = iris.sample_data_path("air_temp.pp")
temperature = iris.load_cube(fname)

Expand Down
2 changes: 1 addition & 1 deletion docs/src/userguide/plotting_examples/1d_with_legend.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import matplotlib.pyplot as plt

import iris
import iris.plot as iplt


fname = iris.sample_data_path("air_temp.pp")

# Load exactly one cube from the given file
Expand Down
2 changes: 1 addition & 1 deletion docs/src/userguide/plotting_examples/cube_blockplot.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import matplotlib.pyplot as plt

import iris
import iris.quickplot as qplt


# Load the data for a single value of model level number.
fname = iris.sample_data_path("hybrid_height.nc")
temperature_cube = iris.load_cube(fname, iris.Constraint(model_level_number=1))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import matplotlib.pyplot as plt

import iris
import iris.quickplot as qplt
import iris.plot as iplt

import iris.quickplot as qplt

fname = iris.sample_data_path("air_temp.pp")
temperature_cube = iris.load_cube(fname)
Expand Down
1 change: 0 additions & 1 deletion docs/src/userguide/plotting_examples/cube_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import iris
import iris.quickplot as qplt


fname = iris.sample_data_path("air_temp.pp")
temperature_cube = iris.load_cube(fname)

Expand Down
1 change: 0 additions & 1 deletion docs/src/userguide/plotting_examples/cube_contourf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import iris
import iris.quickplot as qplt


fname = iris.sample_data_path("air_temp.pp")
temperature_cube = iris.load_cube(fname)

Expand Down
Loading