Skip to content
Permalink
Browse files

Flake8 fixes

  • Loading branch information...
njoyce committed Feb 7, 2015
1 parent c2b6bb1 commit 21d38dde33014b8cd316de9a71d9c5498b677004
@@ -853,15 +853,22 @@ def register_package(module=None, package=None, separator='.', ignore=None,
module = prev_frame.f_locals

if type(module) is dict:
has = lambda x: x in module
def has(x):
return x in module

get = module.__getitem__
elif type(module) is list:
has = lambda x: x in module
def has(x):
return x in module

get = module.__getitem__
strict = False
else:
has = lambda x: hasattr(module, x)
get = lambda x: getattr(module, x)
def has(x):
return hasattr(module, x)

def get(x):
return getattr(module, x)

if package is None:
if has('__name__'):
@@ -41,7 +41,7 @@

#: List of available status response codes.
STATUS_CODES = {
STATUS_OK: '/onResult',
STATUS_OK: '/onResult',
STATUS_ERROR: '/onStatus',
STATUS_DEBUG: '/onDebugEvents'
}
@@ -11,15 +11,16 @@
@since: 0.1.0
"""

import pyamf
from pyamf import remoting
from pyamf.remoting import gateway


django = __import__('django.http')
http = django.http
conf = __import__('django.conf')
conf = conf.conf

import pyamf
from pyamf import remoting
from pyamf.remoting import gateway

__all__ = ['DjangoGateway']


@@ -15,6 +15,9 @@
import sys
import os.path

from pyamf import remoting, DecodeError
from pyamf.remoting import gateway

try:
sys.path.remove(os.path.dirname(os.path.abspath(__file__)))
except ValueError:
@@ -23,9 +26,6 @@
google = __import__('google.appengine.ext.webapp')
webapp = google.appengine.ext.webapp

from pyamf import remoting, DecodeError
from pyamf.remoting import gateway

__all__ = ['WebAppGateway']


@@ -14,6 +14,9 @@
import sys
import os.path

from pyamf import remoting
from pyamf.remoting import gateway, amf0, amf3

try:
sys.path.remove('')
except ValueError:
@@ -35,9 +38,6 @@
resource = twisted.web.resource
server = twisted.web.server

from pyamf import remoting
from pyamf.remoting import gateway, amf0, amf3

__all__ = ['TwistedGateway']


@@ -324,8 +324,10 @@ def eb(failure):
self.logger.error(errMesg)
self.logger.error(failure.getTraceback())

body = "500 Internal Server Error\n\nThere was an error encoding " \
body = (
"500 Internal Server Error\n\nThere was an error encoding "
"the response."
)

if self.debug:
body += "\n\nTraceback:\n\n%s" % failure.getTraceback()
@@ -360,7 +360,8 @@ def test_elementtree_tag(self):
encoding an xml type.
"""
class NotAnElement(object):
items = lambda self: []
def items(self):
return []

def __iter__(self):
return iter([])
@@ -429,7 +429,8 @@ class Person(object):

def test_elementtree_tag(self):
class NotAnElement(object):
items = lambda self: []
def items(self):
return []

def __iter__(self):
return iter([])
@@ -473,20 +474,20 @@ def test_29b_ints(self):

def test_number(self):
vals = [
(0, '\x04\x00'),
(0.2, '\x05\x3f\xc9\x99\x99\x99\x99\x99\x9a'),
(1, '\x04\x01'),
(127, '\x04\x7f'),
(128, '\x04\x81\x00'),
(0x3fff, '\x04\xff\x7f'),
(0x4000, '\x04\x81\x80\x00'),
(0, '\x04\x00'),
(0.2, '\x05\x3f\xc9\x99\x99\x99\x99\x99\x9a'),
(1, '\x04\x01'),
(127, '\x04\x7f'),
(128, '\x04\x81\x00'),
(0x3fff, '\x04\xff\x7f'),
(0x4000, '\x04\x81\x80\x00'),
(0x1FFFFF, '\x04\xff\xff\x7f'),
(0x200000, '\x04\x80\xc0\x80\x00'),
(0x3FFFFF, '\x04\x80\xff\xff\xff'),
(0x400000, '\x04\x81\x80\x80\x00'),
(-1, '\x04\xff\xff\xff\xff'),
(42, '\x04\x2a'),
(-123, '\x04\xff\xff\xff\x85'),
(-1, '\x04\xff\xff\xff\xff'),
(42, '\x04\x2a'),
(-123, '\x04\xff\xff\xff\x85'),
(amf3.MIN_29B_INT, '\x04\xc0\x80\x80\x00'),
(amf3.MAX_29B_INT, '\x04\xbf\xff\xff\xff'),
(1.23456789, '\x05\x3f\xf3\xc0\xca\x42\x83\xde\x1b')
@@ -472,7 +472,9 @@ def test_empty_target(self):
class QueryBrowserTestCase(unittest.TestCase):
def test_request(self):
gw = gateway.BaseGateway()
echo = lambda x: x

def echo(x):
return x

gw.addService(echo, 'echo', description='This is a test')

@@ -507,7 +509,9 @@ def _auth(self, username, password):

def test_gateway(self):
gw = gateway.BaseGateway(authenticator=self._auth)
echo = lambda x: x

def echo(x):
return x

gw.addService(echo, 'echo')

@@ -524,7 +528,9 @@ def test_gateway(self):

def test_service(self):
gw = gateway.BaseGateway()
echo = lambda x: x

def echo(x):
return x

gw.addService(echo, 'echo', authenticator=self._auth)

@@ -172,11 +172,16 @@ def get_class_meta(klass):
a = klass.__amf__

if type(a) is dict:
in_func = lambda x: x in a
def in_func(x):
return x in a

get_func = a.__getitem__
else:
in_func = lambda x: hasattr(a, x)
get_func = lambda x: getattr(a, x)
def in_func(x):
return hasattr(a, x)

def get_func(x):
return getattr(a, x)

for prop in ['alias', 'amf3', 'dynamic', 'external']:
if in_func(prop):
@@ -52,3 +52,4 @@ sourcecode: yes

[flake8]
exclude=doc,.ropeproject
ignore=E402

0 comments on commit 21d38dd

Please sign in to comment.
You can’t perform that action at this time.