Skip to content

Commit 5c155b5

Browse files
committed
fix: reorder imports to maintain consistency and improve readability
1 parent 600682c commit 5c155b5

File tree

10 files changed

+23
-30
lines changed

10 files changed

+23
-30
lines changed

.github/workflows/ruff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Set up Python
1111
uses: actions/setup-python@v4
1212
with:
13-
python-version: '3.8'
13+
python-version: '3.13'
1414
cache: 'pip'
1515
- name: Install dependencies
1616
run: |

payjp/api_requestor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
import json
77
import logging
88
import platform
9-
import time
109
import random
10+
import time
1111
from urllib.parse import urlencode, urlsplit, urlunsplit
1212

1313
import payjp
14+
1415
from . import (
1516
error,
1617
http_client,

payjp/error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def __init__(self, message=None, http_body=None, http_status=None, json_body=Non
88
if http_body and hasattr(http_body, "decode"):
99
try:
1010
http_body = http_body.decode("utf-8")
11-
except:
11+
except Exception:
1212
http_body = (
1313
"<Could not decode body as utf-8. Please report to support@pay.jp>"
1414
)

payjp/http_client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# coding: utf-8
22

33
import textwrap
4-
import warnings
5-
6-
from payjp import error
74

85
import requests
96

7+
from payjp import error
8+
109

1110
def new_default_http_client(*args, **kwargs):
1211
impl = RequestsClient

payjp/test/helper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import datetime
2-
import json
32
import os
43
import random
54
import re
65
import string
76
import unittest
87

9-
from mock import patch, Mock
8+
from mock import Mock, patch
109

1110
import payjp
1211

payjp/test/test_http_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# coding: utf-8
22

33
import unittest
4+
import warnings
45

56
from mock import Mock
67

78
import payjp
8-
99
from payjp.test.helper import PayjpUnitTestCase
1010

1111
VALID_API_METHODS = ("get", "post", "delete")
@@ -15,11 +15,11 @@ class HttpClientTests(PayjpUnitTestCase):
1515
def setUp(self):
1616
super(HttpClientTests, self).setUp()
1717

18-
self.original_filters = payjp.http_client.warnings.filters[:]
19-
payjp.http_client.warnings.simplefilter("ignore")
18+
self.original_filters = warnings.filters[:]
19+
warnings.simplefilter("ignore")
2020

2121
def tearDown(self):
22-
payjp.http_client.warnings.filters = self.original_filters
22+
warnings.filters = self.original_filters
2323

2424
super(HttpClientTests, self).tearDown()
2525

payjp/test/test_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# coding: utf-8
22

33
import unittest
4-
import payjp
54

6-
from payjp.test.helper import PayjpTestCase, NOW, DUMMY_CARD
5+
import payjp
6+
from payjp.test.helper import DUMMY_CARD, NOW, PayjpTestCase
77

88

99
class AuthenticationErrorTest(PayjpTestCase):

payjp/test/test_requestor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
import unittest
66
from urllib.parse import parse_qsl, urlsplit
77

8-
from mock import Mock, MagicMock, patch
8+
from mock import Mock, patch
99

1010
import payjp
11-
1211
from payjp.test.helper import PayjpUnitTestCase
1312

1413
VALID_API_METHODS = ("get", "post", "delete")

payjp/test/test_resources.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
# coding: utf-8
22

33
import pickle
4-
import sys
54
import unittest
65

76
import payjp
87
import payjp.resource
9-
108
from payjp.test.helper import (
11-
PayjpUnitTestCase,
12-
PayjpApiTestCase,
13-
MyListable,
14-
MyCreatable,
15-
MyUpdateable,
16-
MyDeletable,
17-
MyResource,
18-
NOW,
199
DUMMY_CARD,
2010
DUMMY_CHARGE,
2111
DUMMY_PLAN,
12+
NOW,
13+
MyCreatable,
14+
MyDeletable,
15+
MyListable,
16+
MyResource,
17+
MyUpdateable,
18+
PayjpApiTestCase,
19+
PayjpUnitTestCase,
2220
)
2321

2422

@@ -129,9 +127,6 @@ def test_repr(self):
129127

130128
res = repr(obj)
131129

132-
if sys.version_info[0] < 3:
133-
res = unicode(repr(obj), "utf-8")
134-
135130
self.assertTrue("<PayjpObject \u4e00boo\u1f00" in res)
136131
self.assertTrue("id=foo" in res)
137132

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = pypy3, py36, py37, py38, py39, ruff
7+
envlist = py38, py39, py310, py311, py312, py313 ruff
88

99
[testenv]
1010
deps =

0 commit comments

Comments
 (0)