Skip to content

Commit

Permalink
Merge pull request #229 from dimagi/gh/drop-code-support-py2
Browse files Browse the repository at this point in the history
Drop code supporting Python 2
  • Loading branch information
gherceg authored Sep 9, 2024
2 parents 8b47898 + 317f5c5 commit 3e97012
Show file tree
Hide file tree
Showing 20 changed files with 5,220 additions and 5,595 deletions.
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

0 comments on commit 3e97012

Please sign in to comment.