Skip to content

Commit

Permalink
Use isort instead of asottile's reorder-python-imports
Browse files Browse the repository at this point in the history
  • Loading branch information
segsell committed Jun 4, 2024
1 parent fd07a7c commit 8d661a0
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 33 deletions.
15 changes: 11 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,19 @@ repos:
- id: python-no-log-warn
- id: python-use-type-annotations
- id: text-unicode-replacement-char
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.13.0
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: reorder-python-imports
- id: isort
name: isort
args:
- --py37-plus
- --profile=black
# - repo: https://github.com/asottile/reorder-python-imports
# rev: v3.13.0
# hooks:
# - id: reorder-python-imports
# args:
# - --py37-plus
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
hooks:
Expand Down
6 changes: 2 additions & 4 deletions src/upper_envelope/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
from upper_envelope.fues_jax.fues_jax import fues_jax
from upper_envelope.fues_jax.fues_jax import fues_jax_unconstrained
from upper_envelope.fues_numba.fues_numba import fues_numba
from upper_envelope.fues_numba.fues_numba import fues_numba_unconstrained
from upper_envelope.fues_jax.fues_jax import fues_jax, fues_jax_unconstrained
from upper_envelope.fues_numba.fues_numba import fues_numba, fues_numba_unconstrained
1 change: 1 addition & 0 deletions src/upper_envelope/fues_jax/check_and_scan_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import jax
from jax import numpy as jnp

from upper_envelope.math_funcs import calc_gradient


Expand Down
10 changes: 3 additions & 7 deletions src/upper_envelope/fues_jax/fues_jax.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@
"""

from functools import partial
from typing import Callable
from typing import Dict
from typing import Optional
from typing import Tuple
from typing import Callable, Dict, Optional, Tuple

import jax
import jax.numpy as jnp
import numpy as np
from jax import vmap

from upper_envelope.fues_jax.check_and_scan_funcs import (
determine_cases_and_conduct_necessary_scans,
)
from upper_envelope.math_funcs import (
calc_intersection_and_extrapolate_policy,
)
from upper_envelope.math_funcs import calc_intersection_and_extrapolate_policy


@partial(
Expand Down
4 changes: 1 addition & 3 deletions src/upper_envelope/fues_numba/fues_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"""

from typing import Callable
from typing import Optional
from typing import Tuple
from typing import Callable, Optional, Tuple

import numpy as np
from numba import njit
Expand Down
10 changes: 6 additions & 4 deletions tests/test_fues_jax.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
import jax.numpy as jnp
import numpy as np
import pytest
import upper_envelope as upenv
from numpy.testing import assert_array_almost_equal as aaae
from upper_envelope.fues_jax.check_and_scan_funcs import back_and_forward_scan_wrapper

from tests.utils.interpolation import interpolate_policy_and_value_on_wealth_grid
from tests.utils.interpolation import linear_interpolation_with_extrapolation
import upper_envelope as upenv
from tests.utils.interpolation import (
interpolate_policy_and_value_on_wealth_grid,
linear_interpolation_with_extrapolation,
)
from tests.utils.upper_envelope_fedor import upper_envelope
from upper_envelope.fues_jax.check_and_scan_funcs import back_and_forward_scan_wrapper

jax.config.update("jax_enable_x64", True)

Expand Down
8 changes: 5 additions & 3 deletions tests/test_fues_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

import numpy as np
import pytest
import upper_envelope as upenv
from numpy.testing import assert_array_almost_equal as aaae

import upper_envelope as upenv
from tests.utils.fast_upper_envelope_org import fast_upper_envelope_wrapper_org
from tests.utils.interpolation import interpolate_single_policy_and_value_on_wealth_grid
from tests.utils.interpolation import linear_interpolation_with_extrapolation
from tests.utils.interpolation import (
interpolate_single_policy_and_value_on_wealth_grid,
linear_interpolation_with_extrapolation,
)
from tests.utils.upper_envelope_fedor import upper_envelope

# Obtain the test directory of the package.
Expand Down
4 changes: 1 addition & 3 deletions tests/utils/fast_upper_envelope_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
https://dx.doi.org/10.2139/ssrn.4181302
"""
from typing import Callable
from typing import Optional
from typing import Tuple
from typing import Callable, Optional, Tuple

import numpy as np

Expand Down
6 changes: 1 addition & 5 deletions tests/utils/upper_envelope_fedor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
"""

from typing import Callable
from typing import Dict
from typing import List
from typing import Tuple
from typing import Callable, Dict, List, Tuple

import numpy as np
from scipy.optimize import brenth as root


EPS = 2.2204e-16


Expand Down

0 comments on commit 8d661a0

Please sign in to comment.