Skip to content

Commit 3a82e76

Browse files
committed
Unify json imports
1 parent c24e6ef commit 3a82e76

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

pygithub3/core/errors.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
#!/usr/bin/env python
22
# -*- encoding: utf-8 -*-
33

4-
try:
5-
import simplejson as json
6-
except ImportError:
7-
import json
8-
4+
from pygithub3.core.utils import json
95
from pygithub3.exceptions import NotFound, BadRequest, UnprocessableEntity
106

117

pygithub3/core/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
# -*- encoding: utf-8 -*-
33
""" Utils to support python 2.6 compatibility """
44

5+
try:
6+
import simplejson as json
7+
except ImportError:
8+
import json
9+
510
from collections import MutableMapping
611

712

pygithub3/requests/base.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@
22
# -*- encoding: utf-8 -*-
33

44
import re
5-
try:
6-
import simplejson as json
7-
except ImportError:
8-
import json
95

6+
from pygithub3.core.utils import import_module, json
107
from pygithub3.exceptions import (RequestDoesNotExist, UriInvalid,
118
ValidationError, InvalidBodySchema)
129
from pygithub3.resources.base import Raw
13-
from pygithub3.core.utils import import_module
1410

1511
ABS_IMPORT_PREFIX = 'pygithub3.requests'
1612

pygithub3/resources/base.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
#!/usr/bin/env python
22
# -*- encoding: utf-8 -*-
33

4-
try:
5-
import simplejson as json
6-
except ImportError:
7-
import json
4+
from pygithub3.core.utils import json
85

96

107
class Resource(object):

0 commit comments

Comments
 (0)