Skip to content

Commit b4d3e9a

Browse files
committed
Switch from black to ruff
1 parent 5f04a9c commit b4d3e9a

14 files changed

+80
-303
lines changed

mpilot/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from .libraries import *
1+
from .libraries import * # noqa: F403
22

33
__version__ = '1.2.5'

mpilot/arguments.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import six
22

33
if six.PY3:
4-
from typing import Any, List
4+
from typing import Any, List # noqa: F401 (used for typing)
55

66

77
class Argument(object):

mpilot/commands.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from .exceptions import UnexpectedError
1010

1111
if six.PY3:
12-
from typing import List, Any, Dict
12+
from typing import List, Any, Dict # noqa: F401 (used for typing)
1313

1414
from mpilot.exceptions import MissingParameters, NoSuchParameter, MPilotError
1515
from mpilot.params import TupleParameter
@@ -148,4 +148,4 @@ def run(self):
148148
self.is_finished = True
149149

150150
def execute(self, **kwargs):
151-
raise NotImplemented
151+
raise NotImplementedError

mpilot/exceptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from six import python_2_unicode_compatible
33

44
if six.PY3:
5-
from typing import Union, Sequence, Set, Any
5+
from typing import Union, Sequence, Set, Any # noqa: F401 (used for typing)
66

77

88
class MPilotError(Exception):

mpilot/libraries/eems/basic.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from functools import reduce
55

66
import numpy
7-
import six
87

98
from mpilot import params
109
from mpilot.commands import Command

mpilot/libraries/eems/exceptions.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
from traceback import format_exc
2-
31
import six
42
from six import python_2_unicode_compatible
53

64
from mpilot.exceptions import ProgramError
75

86
if six.PY3:
9-
from typing import Tuple
7+
from typing import Tuple # noqa: F401 (used for typing)
108

119

1210
@python_2_unicode_compatible
@@ -35,11 +33,7 @@ def __init__(self, problem, solution=None, lineno=None):
3533
super(InvalidDataFile, self).__init__(lineno)
3634

3735
self.problem = problem
38-
self.solution = (
39-
solution
40-
if solution is not None
41-
else "Solution: Double check the data file."
42-
)
36+
self.solution = solution if solution is not None else "Solution: Double check the data file."
4337

4438
def __str__(self):
4539
return "\n".join(("Problem: " + self.problem, "Solution: " + self.solution))
@@ -48,9 +42,7 @@ def __str__(self):
4842
@python_2_unicode_compatible
4943
class EmptyInputs(ProgramError):
5044
def __str__(self):
51-
return "\n".join(
52-
("Problem: The input data is empty.", "Solution: Double check data inputs.")
53-
)
45+
return "\n".join(("Problem: The input data is empty.", "Solution: Double check data inputs."))
5446

5547

5648
@python_2_unicode_compatible
@@ -116,9 +108,7 @@ def __init__(self, len_a, len_b, lineno=None):
116108
def __str__(self):
117109
return "\n".join(
118110
(
119-
"Problem: Array lengths don't match: {} and {}".format(
120-
self.len_a, self.len_b
121-
),
111+
"Problem: Array lengths don't match: {} and {}".format(self.len_a, self.len_b),
122112
"Solution: Make sure that the array lengths are equal.",
123113
)
124114
)

mpilot/libraries/eems/fuzzy.py

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
from mpilot.libraries.eems.exceptions import (
1919
InvalidDirection,
2020
InvalidThresholds,
21-
MixedArrayLengths,
22-
DuplicateRawValues,
2321
InvalidNumberToConsider,
2422
InvalidTruestOrFalsest,
2523
MismatchedWeights,

mpilot/libraries/eems/mixins.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import numpy
1+
import numpy # noqa: F401 (used for typing)
22
import six
33

44
if six.PY3:
5-
from typing import Sequence
5+
from typing import Sequence # noqa: F401 (used for typing)
66

77
from mpilot.libraries.eems.exceptions import MixedArrayShapes, EmptyInputs
88

mpilot/params.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import six
66

77
if six.PY3:
8-
from typing import Any
8+
from typing import Any # noqa: F401 (used for typing)
99

1010
from .arguments import Argument
1111
from .exceptions import (

mpilot/program.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
if six.PY3:
1010
from importlib.util import module_from_spec
1111

12-
from typing import Dict, Any, Union, TextIO, Sequence, Type
13-
from types import ModuleType
12+
from typing import Dict, Any, Union, TextIO, Sequence, Type # noqa: F401 (used for typing)
13+
from types import ModuleType # noqa: F401 (used for typing)
1414

1515
from .arguments import Argument, ListArgument
1616
from .commands import Command

mpilot/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from numpy.ma import is_masked
44

55
if six.PY3:
6-
from typing import Sequence, Any
6+
from typing import Sequence, Any # noqa: F401 (used for typing)
77

88
from mpilot.exceptions import ProgramError
99
from mpilot.parser.parser import CommandNode

0 commit comments

Comments
 (0)