Skip to content

Commit

Permalink
🎨 Update isort config
Browse files Browse the repository at this point in the history
  • Loading branch information
francois-rozet committed Oct 13, 2024
1 parent f0db631 commit b44446d
Show file tree
Hide file tree
Showing 25 changed files with 14 additions and 15 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pathlib
import re
import subprocess

import zuko

## Project
Expand Down
1 change: 1 addition & 0 deletions docs/tutorials/basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"outputs": [],
"source": [
"import torch\n",
"\n",
"import zuko\n",
"\n",
"_ = torch.random.manual_seed(0)"
Expand Down
1 change: 1 addition & 0 deletions docs/tutorials/forward_kl.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"import matplotlib.pyplot as plt\n",
"import torch\n",
"import torch.utils.data as data\n",
"\n",
"import zuko\n",
"\n",
"_ = torch.random.manual_seed(0)"
Expand Down
1 change: 1 addition & 0 deletions docs/tutorials/reverse_kl.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"source": [
"import matplotlib.pyplot as plt\n",
"import torch\n",
"\n",
"import zuko\n",
"\n",
"_ = torch.random.manual_seed(0)"
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorials/vae.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
"import torch\n",
"import torch.nn as nn\n",
"import torch.utils.data as data\n",
"import zuko\n",
"\n",
"from torch import Tensor\n",
"from torch.distributions import Bernoulli, Distribution, Independent, Normal\n",
"from torchvision.datasets import MNIST\n",
"from torchvision.transforms.functional import to_pil_image, to_tensor\n",
"from tqdm import tqdm\n",
"\n",
"import zuko\n",
"\n",
"_ = torch.random.manual_seed(0)"
]
},
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ preview = true

[tool.ruff.lint.isort]
lines-between-types = 1
no-sections = true
relative-imports-order = "closest-to-furthest"
section-order = ["future", "third-party", "first-party", "local-folder"]

[tool.ruff.format]
preview = true
Expand Down
1 change: 1 addition & 0 deletions tests/test_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import torch

from torch.distributions import *

from zuko.distributions import *


Expand Down
1 change: 1 addition & 0 deletions tests/test_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from functools import partial
from pathlib import Path
from torch import randn

from zuko.flows import *


Expand Down
1 change: 1 addition & 0 deletions tests/test_mixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from pathlib import Path
from torch import randn

from zuko.mixtures import *


Expand Down
1 change: 1 addition & 0 deletions tests/test_nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import torch.nn as nn

from torch import randn

from zuko.nn import *


Expand Down
1 change: 1 addition & 0 deletions tests/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from torch import randn
from torch.distributions import *

from zuko.transforms import *


Expand Down
1 change: 1 addition & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import torch

from torch import randn

from zuko.utils import *


Expand Down
1 change: 1 addition & 0 deletions zuko/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pytest
import torch

import zuko


Expand Down
1 change: 0 additions & 1 deletion zuko/flows/autoregressive.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from torch.distributions import Transform
from typing import Callable, Sequence

# isort: split
from .gaussianization import ElementWiseTransform
from ..distributions import DiagNormal
from ..lazy import Flow, LazyTransform, UnconditionalDistribution
Expand Down
1 change: 0 additions & 1 deletion zuko/flows/continuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from torch import Tensor
from torch.distributions import Transform

# isort: split
from ..distributions import DiagNormal
from ..lazy import Flow, LazyTransform, UnconditionalDistribution
from ..nn import MLP
Expand Down
1 change: 0 additions & 1 deletion zuko/flows/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"Flow",
]

# isort: split
from ..lazy import ( # noqa: F401
Flow,
LazyComposedTransform,
Expand Down
1 change: 0 additions & 1 deletion zuko/flows/coupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from torch.distributions import Transform
from typing import Callable, Sequence

# isort: split
from .gaussianization import ElementWiseTransform
from ..distributions import DiagNormal
from ..lazy import Flow, LazyTransform, UnconditionalDistribution
Expand Down
1 change: 0 additions & 1 deletion zuko/flows/gaussianization.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from torch.distributions import Transform
from typing import Callable, Sequence

# isort: split
from ..distributions import DiagNormal
from ..lazy import Flow, LazyTransform, UnconditionalDistribution, UnconditionalTransform
from ..nn import MLP
Expand Down
1 change: 0 additions & 1 deletion zuko/flows/mixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
"GMM",
]

# isort: split
from ..mixtures import GMM
1 change: 0 additions & 1 deletion zuko/flows/neural.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from torch.distributions import Transform
from typing import Any, Dict

# isort: split
from .autoregressive import MaskedAutoregressiveTransform
from ..distributions import DiagNormal
from ..lazy import Flow, UnconditionalDistribution, UnconditionalTransform
Expand Down
2 changes: 0 additions & 2 deletions zuko/flows/polynomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"SOSPF",
]


# isort: split
from .autoregressive import MAF
from ..lazy import UnconditionalTransform
from ..transforms import BoundedBernsteinTransform, SoftclipTransform, SOSPolynomialTransform
Expand Down
1 change: 0 additions & 1 deletion zuko/flows/spline.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from math import pi
from torch.distributions import Transform

# isort: split
from .autoregressive import MAF
from ..distributions import BoxUniform
from ..lazy import UnconditionalDistribution
Expand Down
1 change: 0 additions & 1 deletion zuko/lazy.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from torch.distributions import Distribution, Transform
from typing import Any, Callable, Sequence, Union

# isort: split
from .distributions import NormalizingFlow
from .transforms import ComposedTransform
from .utils import Partial
Expand Down
1 change: 0 additions & 1 deletion zuko/mixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from torch import Tensor
from torch.distributions import Distribution, MultivariateNormal

# isort: split
from .distributions import Mixture
from .lazy import LazyDistribution
from .nn import MLP
Expand Down
1 change: 0 additions & 1 deletion zuko/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from torch.distributions.utils import _sum_rightmost
from typing import Any, Callable, Iterable, Tuple, Union

# isort: split
from .utils import bisection, broadcast, gauss_legendre, odeint

torch.distributions.transforms._InverseTransform.__name__ = "Inverse"
Expand Down

0 comments on commit b44446d

Please sign in to comment.