Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop code supporting Python 2 #229

Merged
merged 3 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 7 additions & 20 deletions jsonobject/__init__.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from .base import JsonObjectMeta
from .containers import JsonArray
from .properties import *
from .api import JsonObject
import six

if six.PY3:
__all__ = [
'IntegerProperty', 'FloatProperty', 'DecimalProperty',
'StringProperty', 'BooleanProperty',
'DateProperty', 'DateTimeProperty', 'TimeProperty',
'ObjectProperty', 'ListProperty', 'DictProperty', 'SetProperty',
'JsonObject', 'JsonArray',
]
else:
__all__ = [
b'IntegerProperty', b'FloatProperty', b'DecimalProperty',
b'StringProperty', b'BooleanProperty',
b'DateProperty', b'DateTimeProperty', b'TimeProperty',
b'ObjectProperty', b'ListProperty', b'DictProperty', b'SetProperty',
b'JsonObject', b'JsonArray',
]
__all__ = [
'IntegerProperty', 'FloatProperty', 'DecimalProperty',
'StringProperty', 'BooleanProperty',
'DateProperty', 'DateTimeProperty', 'TimeProperty',
'ObjectProperty', 'ListProperty', 'DictProperty', 'SetProperty',
'JsonObject', 'JsonArray',
]
741 changes: 332 additions & 409 deletions jsonobject/api.c

Large diffs are not rendered by default.

12 changes: 2 additions & 10 deletions jsonobject/api.pyx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
from __future__ import absolute_import

import datetime
import decimal
import re

import six

from jsonobject.base import JsonObjectBase, _LimitedDictInterfaceMixin
from . import properties
from .containers import JsonArray, JsonDict, JsonSet
Expand All @@ -21,10 +17,6 @@ re_datetime = re.compile(
)
re_decimal = re.compile(r'^(\d+)\.(\d+)$')

if six.PY3:
unicode = str
long = int


class JsonObject(JsonObjectBase, _LimitedDictInterfaceMixin):
def __getstate__(self):
Expand All @@ -40,10 +32,10 @@ class JsonObject(JsonObjectBase, _LimitedDictInterfaceMixin):
datetime.date: properties.DateProperty,
datetime.time: properties.TimeProperty,
str: properties.StringProperty,
unicode: properties.StringProperty,
str: properties.StringProperty,
bool: properties.BooleanProperty,
int: properties.IntegerProperty,
long: properties.IntegerProperty,
int: properties.IntegerProperty,
float: properties.FloatProperty,
list: properties.ListProperty,
dict: properties.DictProperty,
Expand Down
2,830 changes: 1,382 additions & 1,448 deletions jsonobject/base.c

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions jsonobject/base.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import absolute_import
from collections import namedtuple, OrderedDict
import copy
import six
import inspect
from jsonobject.exceptions import (
DeleteNotAllowed,
Expand Down Expand Up @@ -179,8 +177,7 @@ class _JsonObjectPrivateInstanceVariables(object):
self.dynamic_properties = dynamic_properties or {}


@six.add_metaclass(JsonObjectMeta)
class JsonObjectBase(object):
class JsonObjectBase(object, metaclass=JsonObjectMeta):

_allow_dynamic_properties = True
_validate_required_lazily = False
Expand Down
Loading
Loading