Skip to content

Commit

Permalink
style: run isort
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Jan 27, 2021
1 parent b1b2640 commit 93524b1
Show file tree
Hide file tree
Showing 44 changed files with 122 additions and 133 deletions.
7 changes: 3 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
#
import os
import re
import shutil
import sys

# Docs require Python 3.6+ to generate
from pathlib import Path

import shutil
import sys

DIR = Path(__file__).parent.resolve()
BASEDIR = DIR.parent

Expand All @@ -35,7 +34,7 @@
author = "Henry Schreiner, Hans Dembinski"

# It is better to use pkg_resources, but we can't build on RtD
from pkg_resources import get_distribution, DistributionNotFound
from pkg_resources import DistributionNotFound, get_distribution

try:
version = get_distribution("boost_histogram").version
Expand Down
3 changes: 2 additions & 1 deletion examples/simple_2d.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import boost_histogram as bh
import matplotlib.pyplot as plt
import numpy as np

import boost_histogram as bh

# Create 2d-histogram with two axes with 20 equidistant bins from -3 to 3
h = bh.Histogram(
bh.axis.Regular(20, -3, 3, metadata="x"), bh.axis.Regular(20, -3, 3, metadata="y")
Expand Down
8 changes: 5 additions & 3 deletions examples/simple_density.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import numpy as np
import boost_histogram as bh
import matplotlib.pyplot as plt
import functools
import operator

import matplotlib.pyplot as plt
import numpy as np

import boost_histogram as bh

# Make a 2D histogram
hist = bh.Histogram(bh.axis.Regular(50, -3, 3), bh.axis.Regular(50, -3, 3))

Expand Down
5 changes: 3 additions & 2 deletions examples/simple_numpy.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import boost_histogram as bh
import numpy as np
import matplotlib.pyplot as plt
import numpy as np

import boost_histogram as bh

# Create 2d-histogram with two axes with 10 equidistant bins from -3 to 3
h = bh.Histogram(
Expand Down
3 changes: 2 additions & 1 deletion examples/simple_pickly.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import boost_histogram as bh
import pickle
from pathlib import Path

import boost_histogram as bh

h1 = bh.Histogram(bh.axis.Regular(2, -1, 1))
h2 = h1.copy()

Expand Down
2 changes: 1 addition & 1 deletion scripts/performance_report.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from timeit import timeit
import math
import multiprocessing
from timeit import timeit

print("Welcome to boost-histogram's performance report")

Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# -*- coding: utf-8 -*-
from __future__ import division

from setuptools import setup

import sys
import os
import sys

from setuptools import setup

DIR = os.path.abspath(os.path.dirname(__file__))

sys.path.append(os.path.join(DIR, "extern", "pybind11"))
from pybind11.setup_helpers import Pybind11Extension, ParallelCompile # noqa: E402
from pybind11.setup_helpers import ParallelCompile, Pybind11Extension # noqa: E402

del sys.path[-1]

Expand Down
7 changes: 3 additions & 4 deletions src/boost_histogram/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function

from ._internal.hist import Histogram
from . import accumulators, axis, numpy, storage, utils
from ._internal.enum import Kind
from . import axis, storage, accumulators, utils, numpy
from .tag import loc, rebin, sum, underflow, overflow

from ._internal.hist import Histogram
from .tag import loc, overflow, rebin, sum, underflow
from .version import version as __version__

try:
Expand Down
5 changes: 3 additions & 2 deletions src/boost_histogram/_internal/axestuple.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function

from .axis import Axis
from .utils import set_module
from functools import partial

import numpy as np

from .axis import Axis
from .utils import set_module

del absolute_import, division, print_function


Expand Down
13 changes: 6 additions & 7 deletions src/boost_histogram/_internal/axis.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function

from .._core import axis as ca
import copy

from .._core import axis as ca
from .axis_transform import AxisTransform
from .deprecated import deprecated
from .kwargs import KWArgs
from .traits import Traits
from .sig_tools import inject_signature
from .axis_transform import AxisTransform
from .utils import cast, register, set_family, MAIN_FAMILY, set_module
from .six import string_types
from .deprecated import deprecated

import copy
from .traits import Traits
from .utils import MAIN_FAMILY, cast, register, set_family, set_module

del absolute_import, division, print_function

Expand Down
9 changes: 4 additions & 5 deletions src/boost_histogram/_internal/axis_transform.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function

from .._core import axis as ca
import copy

from .utils import register, set_family, MAIN_FAMILY, set_module
from .sig_tools import inject_signature
from .._core import axis as ca
from .kwargs import KWArgs

import copy
from .sig_tools import inject_signature
from .utils import MAIN_FAMILY, register, set_family, set_module

del absolute_import, division, print_function

Expand Down
12 changes: 5 additions & 7 deletions src/boost_histogram/_internal/hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@
import os
import threading
import warnings

from typing import Optional, Any, Tuple
from typing import Any, Optional, Tuple

import numpy as np

from .. import _core
from .axis import Axis
from .axestuple import AxesTuple
from .axis import Axis
from .deprecated import deprecated
from .enum import Kind
from .kwargs import KWArgs
from .sig_tools import inject_signature
from .six import string_types
from .storage import Double, Storage
from .utils import cast, register, set_family, MAIN_FAMILY, set_module
from .utils import MAIN_FAMILY, cast, register, set_family, set_module
from .view import _to_view
from .enum import Kind
from .deprecated import deprecated


ArrayLike = Any

Expand Down
2 changes: 1 addition & 1 deletion src/boost_histogram/_internal/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import absolute_import, division, print_function

from .._core import storage as store
from .utils import set_family, MAIN_FAMILY, set_module
from .utils import MAIN_FAMILY, set_family, set_module

del absolute_import, division, print_function

Expand Down
1 change: 0 additions & 1 deletion src/boost_histogram/_internal/traits.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Any


class Traits:
underflow: bool
overflow: bool
Expand Down
4 changes: 2 additions & 2 deletions src/boost_histogram/_internal/view.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function

from ..accumulators import Mean, WeightedMean, WeightedSum

import numpy as np

from ..accumulators import Mean, WeightedMean, WeightedSum


class View(np.ndarray):
__slots__ = ()
Expand Down
2 changes: 1 addition & 1 deletion src/boost_histogram/accumulators.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function

from ._core.accumulators import Sum, Mean, WeightedSum, WeightedMean
from ._core.accumulators import Mean, Sum, WeightedMean, WeightedSum

del absolute_import, division, print_function

Expand Down
14 changes: 7 additions & 7 deletions src/boost_histogram/axis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function

from .._internal.axis import Axis
from .._core.axis import options
from .._internal.axestuple import ArrayTuple, AxesTuple
from .._internal.axis import (
Regular,
Variable,
Integer,
Axis,
Boolean,
IntCategory,
Integer,
Regular,
StrCategory,
Boolean,
Variable,
)
from .._internal.axestuple import ArrayTuple, AxesTuple
from .._internal.traits import Traits
from .._core.axis import options
from . import transform

del absolute_import, division, print_function
Expand Down
2 changes: 1 addition & 1 deletion src/boost_histogram/axis/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from .._internal.axis_transform import (
AxisTransform,
Pow,
Function,
Pow,
_internal_conversion,
)

Expand Down
15 changes: 7 additions & 8 deletions src/boost_histogram/numpy.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function

from . import axis as _axis
from ._internal import hist as _hist
from ._internal.utils import cast as _cast
from . import _core
from . import storage as _storage

from ._internal.kwargs import KWArgs as _KWArgs
from ._internal.sig_tools import inject_signature as _inject_signature
from functools import reduce as _reduce
from operator import mul as _mul

import numpy as _np

from . import _core
from . import axis as _axis
from . import storage as _storage
from ._internal import hist as _hist
from ._internal.kwargs import KWArgs as _KWArgs
from ._internal.sig_tools import inject_signature as _inject_signature
from ._internal.utils import cast as _cast

del absolute_import, division, print_function # hides these from IPython

Expand Down
8 changes: 4 additions & 4 deletions src/boost_histogram/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from __future__ import absolute_import, division, print_function

from ._internal.storage import (
Storage,
Int64,
Double,
AtomicInt64,
Double,
Int64,
Mean,
Storage,
Unlimited,
Weight,
Mean,
WeightedMean,
)

Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-

import sys

import pytest

import boost_histogram # noqa: F401

import sys

collect_ignore = []
if sys.version_info < (3, 6):
collect_ignore.append("test_docstrings_uhi.py")
Expand Down
4 changes: 2 additions & 2 deletions tests/pickles/make_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@


import pickle
from pathlib import Path

import typer
import boost_histogram as bh

from pathlib import Path
import boost_histogram as bh


def make_pickle(
Expand Down
11 changes: 1 addition & 10 deletions tests/plottable.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,7 @@
"""

import sys
from typing import (
Any,
Iterable,
Optional,
Sequence,
Tuple,
TypeVar,
Union,
)

from typing import Any, Iterable, Optional, Sequence, Tuple, TypeVar, Union

if sys.version_info < (3, 8):
from typing_extensions import Protocol, runtime_checkable
Expand Down
4 changes: 2 additions & 2 deletions tests/test_axes_object.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-

import boost_histogram as bh

import numpy as np

import boost_histogram as bh


def test_axes_all_at_once():
h = bh.Histogram(
Expand Down
Loading

0 comments on commit 93524b1

Please sign in to comment.