Skip to content

Commit 3026199

Browse files
committed
[python3 porting] style fixes
unused imports, import order, blank lines, exceptions that are never raised.
1 parent 85ec6f3 commit 3026199

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

scrapyrt/log.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
# -*- coding: utf-8 -*-
2-
import six
3-
from logging.config import dictConfig
42
import logging
53
import os
64
import sys
5+
from logging.config import dictConfig
76

8-
7+
from scrapy.settings import Settings
8+
from scrapy.utils.log import DEFAULT_LOGGING, TopLevelFormatter
99
from twisted.python import log
1010
from twisted.python.log import startLoggingWithObserver
1111
from twisted.python.logfile import DailyLogFile
12-
from scrapy.settings import Settings
13-
from scrapy.utils.log import DEFAULT_LOGGING, TopLevelFormatter
1412

15-
from scrapyrt.utils import to_bytes
1613
from .conf import settings as scrapyrt_settings
14+
from .utils import to_bytes
1715

1816
DEBUG = logging.DEBUG
1917
INFO = logging.INFO

scrapyrt/resources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def render_POST(self, request, **kwargs):
145145
request_body = request.content.getvalue()
146146
try:
147147
api_params = demjson.decode(request_body)
148-
except (ValueError, demjson.JSONDecodeError) as e:
148+
except demjson.JSONDecodeError as e:
149149
message = "Invalid JSON in POST body. {}"
150150
message = message.format(e.pretty_description())
151151
raise Error('400', message=message)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
'Twisted>=14.0.0',
3838
'Scrapy>=1.0.0',
3939
'demjson',
40-
'six'
40+
'six>=1.5.2'
4141
],
4242
package_data={
4343
'scrapyrt': [

tests/test_resource_serviceresource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def _test_access_control_allow_methods_header(self):
188188
access_control_allow_methods = headers['Access-Control-Allow-Methods']
189189
self.assertEqual(
190190
self.resource.allowedMethods,
191-
list(map(lambda s: s.strip(), access_control_allow_methods.split(',')))
191+
[s.strip() for s in access_control_allow_methods.split(',')]
192192
)
193193

194194
def test_access_control_allow_methods_header_get(self):

0 commit comments

Comments
 (0)