Skip to content

Commit 88a459c

Browse files
committed
Run pre-commit on all.
1 parent 196f77e commit 88a459c

38 files changed

Lines changed: 52 additions & 17 deletions

lib/ncdata/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
thus acting as an efficient exchange channel between any of those forms.
99
1010
"""
11+
1112
# N.B. this file excluded from isort, as we want a specific class order for the docs
1213

1314
from ._core import NameMap, NcAttribute, NcData, NcDimension, NcVariable

lib/ncdata/_core.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
of dimensions referenced by variables.
1212
1313
"""
14+
1415
from functools import wraps
1516
from typing import (
1617
Any,
@@ -377,7 +378,7 @@ def _addlines_indent(text, indent=""):
377378

378379

379380
# common indent spacing
380-
_indent = " " * 4
381+
_STANDARD_INDENT = " " * 4
381382

382383

383384
class NcData(_AttributeAccessMixin):
@@ -420,7 +421,7 @@ def _print_content(self) -> str:
420421
class, so it isn't technically an abstract method).
421422
This "NcData._print_content()" is called recursively for groups.
422423
"""
423-
global _indent
424+
global _STANDARD_INDENT # noqa: F824
424425
# Define a header line (always a separate line).
425426
noname = "<'no-name'>"
426427
lines = [f"<NcData: {self.name or noname}"]
@@ -431,20 +432,20 @@ def _print_content(self) -> str:
431432
if len(els):
432433
if eltype == "attributes":
433434
# Attributes a bit different: #1 add 'globol' to section title.
434-
lines += [f"{_indent}global attributes:"]
435+
lines += [f"{_STANDARD_INDENT}global attributes:"]
435436
# NOTE: #2 show like variable attributes, but *no parent name*.
436437
attrs_lines = [
437438
f":{attr._print_content()}"
438439
for attr in self.attributes.values()
439440
]
440441
lines += _addlines_indent(
441-
"\n".join(attrs_lines), _indent * 2
442+
"\n".join(attrs_lines), _STANDARD_INDENT * 2
442443
)
443444
else:
444-
lines += [f"{_indent}{eltype}:"]
445+
lines += [f"{_STANDARD_INDENT}{eltype}:"]
445446
for el in els.values():
446447
lines += _addlines_indent(
447-
el._print_content(), _indent * 2
448+
el._print_content(), _STANDARD_INDENT * 2
448449
)
449450
lines.append("")
450451

@@ -589,7 +590,7 @@ def __init__(
589590
# return self.data.shape
590591

591592
def _print_content(self):
592-
global _indent
593+
global _STANDARD_INDENT # noqa: F824
593594
dimstr = ", ".join(self.dimensions)
594595
typestr = str(self.dtype) if self.dtype else "<no-dtype>"
595596
hdr = f"<NcVariable({typestr}): {self.name}({dimstr})"
@@ -602,7 +603,7 @@ def _print_content(self):
602603
f"{self.name}:{attr._print_content()}"
603604
for attr in self.attributes.values()
604605
]
605-
lines += _addlines_indent("\n".join(attrs_lines), _indent)
606+
lines += _addlines_indent("\n".join(attrs_lines), _STANDARD_INDENT)
606607
lines += [">"]
607608
return "\n".join(lines)
608609

lib/ncdata/dataset_like.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
:class:`~ncdata.NcVariable` objects, but emulate the access APIs of
1616
:class:`netCDF4.Dataset` :class:`netCDF4.Dimension` and :class:`netCDF4.Variable`.
1717
18-
This is provided primarily to support a re-use of the :mod:`iris.fileformats.netcdf`
18+
This is provided primarily to support the reuse of the :mod:`iris.fileformats.netcdf`
1919
file format load + save, to convert cubes to + from ncdata objects (and hence,
2020
especially, to convert Iris :class:`~iris.cube.Cube`\s to + from an Xarray
2121
:class:`~xarray.Dataset`
@@ -29,6 +29,7 @@
2929
complete, so this module may need to be extended, in future, to support other such uses.
3030
3131
"""
32+
3233
from typing import Any, Dict, List
3334

3435
import dask.array as da

lib/ncdata/iris.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Convert :class:`~ncdata.NcData`\s to and from Iris :class:`~iris.cube.Cube`\s.
55
66
"""
7+
78
from typing import Any, AnyStr, Dict, Iterable, List, Union
89

910
#

lib/ncdata/iris_xarray.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
the relevant load/save routines.
1010
1111
"""
12+
1213
import xarray
1314
from iris.cube import CubeList
1415

lib/ncdata/netcdf4.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Converts :class:`ncdata.NcData` to and from :class:`netCDF4.Dataset` objects.
55
66
"""
7+
78
from pathlib import Path
89
from threading import Lock
910
from typing import Dict, Optional, Union

lib/ncdata/threadlock_sharing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
thread-safe. So probably can only be applied at the outer level of an operation.
5050
5151
"""
52+
5253
from contextlib import contextmanager
5354
from unittest import mock
5455

lib/ncdata/utils/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""General user utility functions."""
2+
23
from ._compare_nc_datasets import dataset_differences, variable_differences
34
from ._copy import ncdata_copy
45
from ._save_errors import save_errors

lib/ncdata/utils/_save_errors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""User utility routines for ncdata."""
2+
23
from typing import Dict, List, Union
34

45
import netCDF4 as nc

tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for :mod:`ncdata`."""
2+
23
from pathlib import Path
34

45
testdata_dir = Path(__file__).parent / "testdata"

0 commit comments

Comments
 (0)