Skip to content

Commit

Permalink
really drop python<=3.7 support (#78)
Browse files Browse the repository at this point in the history
* Filter all code over `pyupgrade --py38-plus`.
* filter all code over ruff as well to drop unused imports

---------

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
  • Loading branch information
kloczek authored Jun 29, 2024
1 parent 099ecc9 commit 74926da
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 25 deletions.
16 changes: 6 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# jsondiff documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 13 17:39:49 2015.
Expand All @@ -12,9 +11,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import shlex

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -46,9 +42,9 @@
master_doc = 'index'

# General information about the project.
project = u'jsondiff'
copyright = u'2015, Eric Reynolds'
author = u'Eric Reynolds'
project = 'jsondiff'
copyright = '2015, Eric Reynolds'
author = 'Eric Reynolds'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -222,8 +218,8 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'jsondiff.tex', u'jsondiff Documentation',
u'Eric Reynolds', 'manual'),
(master_doc, 'jsondiff.tex', 'jsondiff Documentation',
'Eric Reynolds', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -266,7 +262,7 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'jsondiff', u'jsondiff Documentation',
(master_doc, 'jsondiff', 'jsondiff Documentation',
author, 'jsondiff', 'One line description of project.',
'Miscellaneous'),
]
Expand Down
20 changes: 10 additions & 10 deletions jsondiff/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
string_types = basestring


class JsonDumper(object):
class JsonDumper:
def __init__(self, **kwargs):
self.kwargs = kwargs

Expand All @@ -38,7 +38,7 @@ def __call__(self, obj, dest=None):
default_dumper = JsonDumper()


class YamlDumper(object):
class YamlDumper:
"""Write object as YAML string"""

def __init__(self, **kwargs):
Expand All @@ -52,7 +52,7 @@ def __call__(self, obj, dest=None):
"""
return yaml.dump(obj, dest, **self.kwargs)

class JsonLoader(object):
class JsonLoader:
def __init__(self, **kwargs):
self.kwargs = kwargs

Expand All @@ -70,7 +70,7 @@ def __call__(self, src):
default_loader = JsonLoader()


class YamlLoader(object):
class YamlLoader:
"""Load YAML data from file-like object or string"""

def __call__(self, src):
Expand Down Expand Up @@ -121,7 +121,7 @@ def serialize_data(self, obj, stream):
dumper(obj, stream)


class JsonDiffSyntax(object):
class JsonDiffSyntax:
def emit_set_diff(self, a, b, s, added, removed):
raise NotImplementedError()

Expand All @@ -141,7 +141,7 @@ def unpatch(self, a, d):
raise NotImplementedError()


class CompactJsonDiffSyntax(object):
class CompactJsonDiffSyntax:
def emit_set_diff(self, a, b, s, added, removed):
if s == 0.0 or len(removed) == len(a):
return {replace: b} if isinstance(b, dict) else b
Expand Down Expand Up @@ -230,7 +230,7 @@ def patch(self, a, d):
return d


class ExplicitJsonDiffSyntax(object):
class ExplicitJsonDiffSyntax:
def emit_set_diff(self, a, b, s, added, removed):
if s == 0.0 or len(removed) == len(a):
return b
Expand Down Expand Up @@ -277,7 +277,7 @@ def emit_value_diff(self, a, b, s):
return b


class SymmetricJsonDiffSyntax(object):
class SymmetricJsonDiffSyntax:
def emit_set_diff(self, a, b, s, added, removed):
if s == 0.0 or len(removed) == len(a):
return [a, b]
Expand Down Expand Up @@ -447,9 +447,9 @@ def emit_list_diff(self, a, b, s, inserted, changed, deleted):
}


class JsonDiffer(object):
class JsonDiffer:

class Options(object):
class Options:
pass

def __init__(self, syntax='compact', load=False, dump=False, marshal=False,
Expand Down
2 changes: 1 addition & 1 deletion jsondiff/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys

def load_file(serializer, file_path):
with open(file_path, "r") as f:
with open(file_path) as f:
parsed = None
try:
parsed = serializer.deserialize_file(f)
Expand Down
3 changes: 1 addition & 2 deletions jsondiff/symbols.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

class Symbol(object):
class Symbol:
def __init__(self, label):
self._label = label

Expand Down
1 change: 0 additions & 1 deletion tests/generate_readme.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# this is used for generating the repo front page

from __future__ import print_function

def do(cmd, comment=None):
if comment:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_jsondiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest

import jsondiff
from jsondiff import diff, replace, add, discard, insert, delete, update, JsonDiffer
from jsondiff import diff, replace, add, discard, insert, delete, JsonDiffer

from .utils import generate_random_json, perturbate_json

Expand Down

0 comments on commit 74926da

Please sign in to comment.