Skip to content

Commit

Permalink
Added isort to tox (#221)
Browse files Browse the repository at this point in the history
* setting isort with tox

* running isort (with tox) on the repo

* specifying isort to use Black

* running isort again

* removed unnecessary dep from travis + set up linting

* fix review notes

* removed pylint comment

* ran lint one more time

* ran pylint again
  • Loading branch information
oriash93 authored Oct 7, 2020
1 parent 239b337 commit 07e3599
Show file tree
Hide file tree
Showing 63 changed files with 108 additions and 107 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ jobs:
run: pip install tox
- name: Run black through tox
run: tox -e black
isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install tox
run: pip install tox
- name: Run isort through tox
run: tox -e isort
pylint:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 0 additions & 1 deletion benchmarks/benchmark_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import numpy as np


SPD_MATRIX_5x5 = np.array(
[
[2.3, -2.3, 3.5, 4.2, 1.8],
Expand Down
1 change: 1 addition & 0 deletions benchmarks/ivpsolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Benchmarks for probabilistic ivp solvers
"""
import numpy as np

from probnum.diffeq import lotkavolterra, probsolve_ivp
from probnum.random_variables import Dirac

Expand Down
3 changes: 2 additions & 1 deletion benchmarks/linearsolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"""

import os

import numpy as np
import scipy.sparse

from probnum.linalg import problinsolve
from benchmarks.benchmark_utils import SPD_MATRIX_5x5
from probnum.linalg import problinsolve


def load_poisson_linear_system():
Expand Down
3 changes: 1 addition & 2 deletions benchmarks/random_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

import numpy as np

from probnum import random_variables as rvs
import probnum.linalg.linops as linops

from benchmarks.benchmark_utils import SPD_MATRIX_5x5
from probnum import random_variables as rvs

# Module level variables
RV_NAMES = [
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.

from datetime import datetime
import os
import sys
from datetime import datetime

from pkg_resources import get_distribution

Expand Down
16 changes: 4 additions & 12 deletions src/probnum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,11 @@
diffeq
Probabilistic solvers for ordinary differential equations.
"""
# pylint: disable=wrong-import-order

from . import diffeq
from . import filtsmooth
from . import linalg
from . import quad
from . import random_variables
from . import utils

from .random_variables import asrandvar, RandomVariable

# -*- coding: utf-8 -*-
from pkg_resources import get_distribution, DistributionNotFound
from pkg_resources import DistributionNotFound, get_distribution

from . import diffeq, filtsmooth, linalg, quad, random_variables, utils
from .random_variables import RandomVariable, asrandvar

try:
# Change here if project is renamed and does not equal the package name
Expand Down
1 change: 1 addition & 0 deletions src/probnum/_randomvariablelist.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np

import probnum.random_variables as pnrvs


Expand Down
5 changes: 2 additions & 3 deletions src/probnum/diffeq/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from .ode import *
from .odefiltsmooth import *
from .steprule import *
from .odesolver import *
from .odesolution import ODESolution

from .odesolver import *
from .steprule import *

# Public classes and functions. Order is reflected in documentation.
__all__ = [
Expand Down
1 change: 0 additions & 1 deletion src/probnum/diffeq/ode/ivp.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from probnum.diffeq.ode.ode import ODE


__all__ = ["logistic", "fitzhughnagumo", "lotkavolterra", "IVP"]


Expand Down
2 changes: 1 addition & 1 deletion src/probnum/diffeq/odefiltsmooth/ivp2filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

import numpy as np

from probnum import random_variables as rvs
from probnum.filtsmooth import ExtendedKalman, UnscentedKalman
from probnum.filtsmooth.statespace.discrete import DiscreteGaussianModel
from probnum import random_variables as rvs


def ivp2ekf0(ivp, prior, evlvar):
Expand Down
2 changes: 1 addition & 1 deletion src/probnum/diffeq/odefiltsmooth/ivpfiltsmooth.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import numpy as np

from probnum.random_variables import Normal
from probnum.diffeq import odesolver
from probnum.diffeq.odefiltsmooth.prior import ODEPrior
from probnum.diffeq.odesolution import ODESolution
from probnum.random_variables import Normal


class GaussianIVPFilter(odesolver.ODESolver):
Expand Down
2 changes: 1 addition & 1 deletion src/probnum/diffeq/odefiltsmooth/odefiltsmooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"""

from probnum.diffeq import steprule
from probnum.diffeq.odefiltsmooth import prior, ivp2filter
from probnum.diffeq.odefiltsmooth import ivp2filter, prior
from probnum.diffeq.odefiltsmooth.ivpfiltsmooth import GaussianIVPFilter


Expand Down
1 change: 1 addition & 0 deletions src/probnum/diffeq/odefiltsmooth/prior.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
provided by IOUP and change parameters
"""
import warnings

import numpy as np
from scipy.special import binom # for Matern
from scipy.special import factorial # vectorised factorial for IBM-Q(h)
Expand Down
6 changes: 3 additions & 3 deletions src/probnum/diffeq/odesolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"""
import numpy as np

from probnum.random_variables import Normal
from probnum import utils
from probnum._randomvariablelist import _RandomVariableList
from probnum.filtsmooth.filtsmoothposterior import FiltSmoothPosterior
from probnum.filtsmooth import KalmanPosterior
from probnum import utils
from probnum.filtsmooth.filtsmoothposterior import FiltSmoothPosterior
from probnum.random_variables import Normal


class ODESolution(FiltSmoothPosterior):
Expand Down
2 changes: 1 addition & 1 deletion src/probnum/diffeq/odesolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Abstract ODESolver class. Interface for Runge-Kutta, ODEFilter.
"""

from abc import ABC, abstractmethod
import warnings
from abc import ABC, abstractmethod

from probnum.diffeq.odesolution import ODESolution

Expand Down
4 changes: 2 additions & 2 deletions src/probnum/filtsmooth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
Bayesian filtering and smoothing.
"""

from .statespace import *
from .gaussfiltsmooth import *
from .bayesfiltsmooth import *
from .filtsmoothposterior import FiltSmoothPosterior
from .gaussfiltsmooth import *
from .statespace import *

# Public classes and functions. Order is reflected in documentation.
__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion src/probnum/filtsmooth/gaussfiltsmooth/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .extendedkalman import *
from .gaussfiltsmooth import *
from .kalman import *
from .kalmanposterior import KalmanPosterior
from .unscentedkalman import *
from .unscentedtransform import *
from .kalmanposterior import KalmanPosterior
5 changes: 2 additions & 3 deletions src/probnum/filtsmooth/gaussfiltsmooth/extendedkalman.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
"""
import numpy as np

from probnum.filtsmooth.gaussfiltsmooth._utils import is_cont_disc, is_disc_disc
from probnum.filtsmooth.gaussfiltsmooth.gaussfiltsmooth import (
GaussFiltSmooth,
linear_discrete_update,
)
from probnum.filtsmooth.statespace import DiscreteGaussianModel, LinearSDEModel
from probnum.random_variables import Normal
from probnum.filtsmooth.statespace import LinearSDEModel, DiscreteGaussianModel

from probnum.filtsmooth.gaussfiltsmooth._utils import is_cont_disc, is_disc_disc


class ExtendedKalman(GaussFiltSmooth):
Expand Down
3 changes: 1 addition & 2 deletions src/probnum/filtsmooth/gaussfiltsmooth/gaussfiltsmooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
import numpy as np

from probnum._randomvariablelist import _RandomVariableList

from probnum.random_variables import Normal
from probnum.filtsmooth.bayesfiltsmooth import BayesFiltSmooth
from probnum.filtsmooth.gaussfiltsmooth.kalmanposterior import KalmanPosterior
from probnum.random_variables import Normal


class GaussFiltSmooth(BayesFiltSmooth, ABC):
Expand Down
6 changes: 3 additions & 3 deletions src/probnum/filtsmooth/gaussfiltsmooth/kalman.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"""

import numpy as np

from probnum.filtsmooth.gaussfiltsmooth._utils import is_cont_disc, is_disc_disc
from probnum.filtsmooth.gaussfiltsmooth.gaussfiltsmooth import (
GaussFiltSmooth,
linear_discrete_update,
)
from probnum.filtsmooth.statespace import DiscreteGaussianLinearModel, LinearSDEModel
from probnum.random_variables import Normal
from probnum.filtsmooth.statespace import LinearSDEModel, DiscreteGaussianLinearModel

from probnum.filtsmooth.gaussfiltsmooth._utils import is_cont_disc, is_disc_disc


class Kalman(GaussFiltSmooth):
Expand Down
4 changes: 2 additions & 2 deletions src/probnum/filtsmooth/gaussfiltsmooth/kalmanposterior.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

import numpy as np

from probnum._randomvariablelist import _RandomVariableList
from probnum.filtsmooth.filtsmoothposterior import FiltSmoothPosterior
import probnum.random_variables as rvs
from probnum import utils
from probnum._randomvariablelist import _RandomVariableList
from probnum.filtsmooth.filtsmoothposterior import FiltSmoothPosterior


class KalmanPosterior(FiltSmoothPosterior):
Expand Down
6 changes: 3 additions & 3 deletions src/probnum/filtsmooth/gaussfiltsmooth/unscentedkalman.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
GaussFiltSmooth,
linear_discrete_update,
)
from probnum.random_variables import Normal
from probnum.filtsmooth.gaussfiltsmooth.unscentedtransform import UnscentedTransform
from probnum.filtsmooth.statespace import (
ContinuousModel,
DiscreteGaussianLinearModel,
DiscreteGaussianModel,
DiscreteModel,
LinearSDEModel,
DiscreteGaussianModel,
DiscreteGaussianLinearModel,
)
from probnum.random_variables import Normal


class UnscentedKalman(GaussFiltSmooth):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import numpy as np


__all__ = ["UnscentedTransform"]


Expand Down
2 changes: 1 addition & 1 deletion src/probnum/filtsmooth/statespace/continuous/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Local import, because with a global import this does not seem
to work.
"""
from .linearsdemodel import *
from .continuousmodel import *
from .linearsdemodel import *

__all__ = ["ContinuousModel", "LinearSDEModel", "LTISDEModel"]
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import numpy as np
import scipy.linalg

from probnum.filtsmooth.statespace.continuous import continuousmodel
from probnum.random_variables import Normal

Expand Down
3 changes: 1 addition & 2 deletions src/probnum/filtsmooth/statespace/discrete/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
Local import, because with a global import this does not seem
to work.
"""
from .discretemodel import *
from .discretegaussianmodel import *

from .discretemodel import *

__all__ = [
"DiscreteModel",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
x_{i+1} = N(g(i, x_i), S(i))
"""

from probnum.random_variables import Normal
from probnum.filtsmooth.statespace.discrete import discretemodel

from probnum.random_variables import Normal

__all__ = [
"DiscreteGaussianModel",
Expand Down
3 changes: 1 addition & 2 deletions src/probnum/filtsmooth/statespace/transition.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
"""Markov transition rules: continuous and discrete."""

import abc
from typing import Union, Dict
from typing import Dict, Union

import numpy as np

from probnum.random_variables import RandomVariable


__all__ = ["Transition"]


Expand Down
2 changes: 1 addition & 1 deletion src/probnum/linalg/linearsolvers/linearsolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import scipy.sparse

import probnum
from probnum.linalg import linops
from probnum import utils
from probnum.linalg import linops
from probnum.linalg.linearsolvers.matrixbased import (
AsymmetricMatrixBasedSolver,
NoisySymmetricMatrixBasedSolver,
Expand Down
4 changes: 2 additions & 2 deletions src/probnum/linalg/linearsolvers/matrixbased.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
Implementations of matrix-based linear solvers which perform inference on the matrix or
its inverse given linear observations.
"""
import warnings
import abc
import warnings

import numpy as np
import GPy
import numpy as np

import probnum
from probnum import random_variables as rvs
Expand Down
1 change: 1 addition & 0 deletions src/probnum/linalg/linearsolvers/solutionbased.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import warnings

import numpy as np

from probnum.linalg.linearsolvers.matrixbased import ProbabilisticLinearSolver
Expand Down
2 changes: 1 addition & 1 deletion src/probnum/linalg/linops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
linear operator as a matrix in memory.
"""

from probnum.linalg.linops.linearoperators import *
from probnum.linalg.linops.kronecker import *
from probnum.linalg.linops.linearoperators import *

# Public classes and functions. Order is reflected in documentation.
__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion src/probnum/quad/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
model and using its predictions to adaptively choose points to evaluate the integrand.
"""

from probnum.quad.quadrature import *
from probnum.quad.bayesian import *
from probnum.quad.polynomial import *
from probnum.quad.quadrature import *

# Public classes and functions. Order is reflected in documentation.
__all__ = [
Expand Down
Loading

0 comments on commit 07e3599

Please sign in to comment.