Skip to content

Commit

Permalink
Apply isort
Browse files Browse the repository at this point in the history
Apply isort to all python source files
Add isort with profile=black to pre-commit config
  • Loading branch information
simonbowly committed Jun 5, 2023
1 parent b2f8ba3 commit e5a112d
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ repos:
rev: 22.6.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ examples = [

[tool.hatch.version]
path = "src/gurobi_optimods/__init__.py"

[tool.isort]
profile = "black"
5 changes: 2 additions & 3 deletions src/gurobi_optimods/bipartite_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
import logging
from typing import List, overload

import gurobipy as gp
import gurobipy_pandas as gppd
import numpy as np
import pandas as pd
import scipy.sparse as sp

import gurobipy as gp
from gurobipy import GRB
import gurobipy_pandas as gppd

try:
import networkx as nx
Expand Down
4 changes: 2 additions & 2 deletions src/gurobi_optimods/min_cost_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import logging

import gurobipy as gp
import gurobipy_pandas as gppd # noqa: F401
import numpy as np
import pandas as pd
from gurobipy import GRB
import scipy.sparse as sp
import gurobipy_pandas as gppd # noqa: F401
from gurobipy import GRB

try:
import networkx as nx
Expand Down
3 changes: 1 addition & 2 deletions src/gurobi_optimods/mwis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
--------------------------------
"""

import numpy as np

import gurobipy as gp
import numpy as np
from gurobipy import GRB

from gurobi_optimods.utils import optimod
Expand Down
3 changes: 2 additions & 1 deletion src/gurobi_optimods/portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

from dataclasses import dataclass
from typing import Optional

import gurobipy as gp
from gurobipy import GRB
import numpy as np
import pandas as pd
from gurobipy import GRB

from gurobi_optimods.utils import optimod

Expand Down
2 changes: 1 addition & 1 deletion src/gurobi_optimods/qubo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from dataclasses import dataclass

import gurobipy as gp
from gurobipy import GRB
import numpy as np
from gurobipy import GRB

from gurobi_optimods.utils import optimod

Expand Down
2 changes: 1 addition & 1 deletion tests/test_min_cost_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import gurobi_optimods.min_cost_flow as mcf

from .test_graph_utils import (
check_solution_networkx,
check_solution_pandas,
check_solution_scipy,
check_solution_networkx,
)


Expand Down
4 changes: 2 additions & 2 deletions tests/test_mwis.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import unittest

from itertools import combinations
import scipy.sparse as sp

import numpy as np
import scipy.sparse as sp
from numpy.testing import assert_array_equal

from gurobi_optimods.mwis import maximum_weighted_independent_set
Expand Down
3 changes: 2 additions & 1 deletion tests/test_portfolio.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from contextlib import redirect_stdout
import io
import os
import tempfile
import unittest
from contextlib import redirect_stdout

import numpy as np
import pandas as pd
from numpy.testing import assert_allclose, assert_array_equal
Expand Down
3 changes: 2 additions & 1 deletion tests/test_qubo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import unittest

import numpy as np
from numpy.testing import assert_array_equal
import scipy.sparse as sp
from numpy.testing import assert_array_equal

from gurobi_optimods.qubo import solve_qubo

Expand Down
4 changes: 2 additions & 2 deletions tests/test_workforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from textwrap import dedent

import pandas as pd
from pandas.api.types import is_object_dtype, is_datetime64_any_dtype, is_numeric_dtype
from pandas.api.types import is_datetime64_any_dtype, is_numeric_dtype, is_object_dtype
from pandas.testing import assert_frame_equal

from gurobi_optimods.workforce import solve_workforce_scheduling
from gurobi_optimods.datasets import load_workforce
from gurobi_optimods.workforce import solve_workforce_scheduling


def read_csv(text):
Expand Down

0 comments on commit e5a112d

Please sign in to comment.