Skip to content

Commit 086e2ef

Browse files
committed
bump ruff to 0.14.8, resolve issues
1 parent 39afed4 commit 086e2ef

File tree

5 files changed

+29
-24
lines changed

5 files changed

+29
-24
lines changed

nested_diff/cli.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def _decode_fmt_opts(opts):
5757
if opts is None:
5858
return {}
5959

60-
import json
60+
import json # noqa: PLC0415
6161

6262
return json.loads(opts)
6363

@@ -345,7 +345,7 @@ def __init__(self, **kwargs):
345345
"""
346346
super().__init__()
347347

348-
import json
348+
import json # noqa: PLC0415
349349

350350
self.encoder = json.JSONEncoder(**self.get_opts(kwargs))
351351

@@ -383,7 +383,7 @@ def __init__(self, **kwargs):
383383
"""
384384
super().__init__()
385385

386-
import json
386+
import json # noqa: PLC0415
387387

388388
self.decoder = json.JSONDecoder(**self.get_opts(kwargs))
389389

@@ -404,8 +404,8 @@ def __init__(self, **kwargs):
404404
"""
405405
super().__init__()
406406

407-
import configparser
408-
import io
407+
import configparser # noqa: PLC0415
408+
import io # noqa: PLC0415
409409

410410
self.encoder = configparser.ConfigParser(**self.get_opts(kwargs))
411411
self.stringio = io.StringIO()
@@ -430,7 +430,7 @@ def __init__(self, **kwargs):
430430
"""
431431
super().__init__()
432432

433-
import configparser
433+
import configparser # noqa: PLC0415
434434

435435
self.decoder = configparser.ConfigParser(**kwargs)
436436

@@ -457,7 +457,7 @@ def __init__(self, **kwargs):
457457
"""Initialize dumper."""
458458
super().__init__()
459459

460-
import pprint
460+
import pprint # noqa: PLC0415
461461

462462
self.codec = pprint.PrettyPrinter(**self.get_opts(kwargs))
463463

@@ -495,7 +495,7 @@ def __init__(self):
495495
"""Initialize dumper."""
496496
super().__init__()
497497

498-
import tomli_w
498+
import tomli_w # noqa: PLC0415
499499

500500
self.codec = tomli_w
501501

@@ -512,9 +512,9 @@ def __init__(self):
512512
super().__init__()
513513

514514
if sys.version_info >= (3, 11):
515-
import tomllib # pragma nocover
515+
import tomllib # pragma nocover # noqa: PLC0415
516516
else:
517-
import tomli as tomllib # pragma nocover
517+
import tomli as tomllib # pragma nocover # noqa: PLC0415
518518

519519
self.codec = tomllib
520520

@@ -535,12 +535,12 @@ def __init__(self, **kwargs):
535535
"""
536536
super().__init__()
537537

538-
import yaml
538+
import yaml # noqa: PLC0415
539539

540540
try:
541-
from yaml import CSafeDumper as ImportedYamlDumper
541+
from yaml import CSafeDumper as ImportedYamlDumper # noqa: PLC0415
542542
except ImportError:
543-
from yaml import SafeDumper as ImportedYamlDumper
543+
from yaml import SafeDumper as ImportedYamlDumper # noqa: PLC0415
544544

545545
class _YamlDumper(ImportedYamlDumper):
546546
def represent_scalar(self, tag, value, style=None):
@@ -588,16 +588,18 @@ def __init__(self, **kwargs):
588588
"""
589589
super().__init__()
590590

591-
import yaml
591+
import yaml # noqa: PLC0415
592592

593593
try:
594-
from yaml import CSafeLoader as YamlLoader
594+
from yaml import CSafeLoader as YamlLoader # noqa: PLC0415
595595
except ImportError:
596-
from yaml import SafeLoader as YamlLoader
596+
from yaml import SafeLoader as YamlLoader # noqa: PLC0415
597597

598-
from yaml.nodes import MappingNode as YamlMappingNode
599-
from yaml.nodes import ScalarNode as YamlScalarNode
600-
from yaml.nodes import SequenceNode as YamlSequenceNode
598+
from yaml.nodes import ( # noqa: PLC0415
599+
MappingNode as YamlMappingNode,
600+
ScalarNode as YamlScalarNode,
601+
SequenceNode as YamlSequenceNode,
602+
)
601603

602604
self.opts = self.get_opts(kwargs)
603605
self.yaml = yaml

nested_diff/diff_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def __init__( # noqa: PLR0913
279279
kwargs: Passed to base formatter as is.
280280
281281
"""
282-
import nested_diff.formatters
282+
import nested_diff.formatters # noqa: PLC0415
283283

284284
if fmt == 'term':
285285
base_class = nested_diff.formatters.TermFormatter

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ test = [
5757
'pytest',
5858
'pytest-cov',
5959
'pytest-ruff',
60-
'ruff==0.11.13',
60+
'ruff==0.14.8',
6161
]
6262

6363
[project.scripts]
@@ -114,5 +114,8 @@ ignore = [
114114
[tool.ruff.lint.flake8-quotes]
115115
inline-quotes = 'single'
116116

117+
[tool.ruff.lint.isort]
118+
combine-as-imports = true
119+
117120
[tool.ruff.lint.pydocstyle]
118121
convention = 'google'

tests/test_diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def test_different_object_attributes():
8080
reason='reducer_override appeared in 3.8',
8181
)
8282
def test_custom_dumper():
83-
import io
84-
import pickle
83+
import io # noqa: PLC0415
84+
import pickle # noqa: PLC0415
8585

8686
class ClassToTestDiff:
8787
pass

tests/test_patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_text_unsupported_op():
5858

5959

6060
def test_incorrect_diff_format():
61-
with pytest.raises(ValueError, match="{'garbage': 'passed'}"):
61+
with pytest.raises(ValueError, match=r"{'garbage': 'passed'}"):
6262
Patcher().patch({}, {'garbage': 'passed'})
6363

6464

0 commit comments

Comments
 (0)