Fix pep8 and pyflakes
This commit is contained in:
1 parent
4a27ebc261
commit
682a7023ab
4 files changed
+11
-6
No files matched your search
+3
-2
@@ -14,11 +14,11 @@ try:
|
||||
except ImportError:
|
||||
import decimal
|
||||
sys.modules['cdecimal'] = decimal
|
||||
from types import NoneType
|
||||
import threading
|
||||
import datetime
|
||||
from decimal import Decimal
|
||||
from types import NoneType
|
||||
|
||||
import proteus.config
|
||||
from proteus.pyson import PYSONDecoder
|
||||
|
||||
@@ -106,7 +106,8 @@ class BinaryDescriptor(FieldDescriptor):
|
||||
default = None
|
||||
|
||||
def __set__(self, instance, value):
|
||||
assert isinstance(value, (basestring, buffer)) or value in (None, False)
|
||||
assert (isinstance(value, (basestring, buffer))
|
||||
or value in (None, False))
|
||||
super(BinaryDescriptor, self).__set__(instance, value or '')
|
||||
|
||||
|
||||
|
||||
+4
-1
@@ -18,12 +18,14 @@ def dump_decimal(self, value, write):
|
||||
}
|
||||
self.dump_struct(value, write)
|
||||
|
||||
|
||||
def dump_buffer(self, value, write):
|
||||
self.write = write
|
||||
value = xmlrpclib.Binary(value)
|
||||
value.encode(self)
|
||||
del self.write
|
||||
|
||||
|
||||
def dump_date(self, value, write):
|
||||
value = {'__class__': 'date',
|
||||
'year': value.year,
|
||||
@@ -46,13 +48,14 @@ xmlrpclib.Marshaller.dispatch[datetime.date] = dump_date
|
||||
xmlrpclib.Marshaller.dispatch[datetime.time] = dump_time
|
||||
xmlrpclib.Marshaller.dispatch[buffer] = dump_buffer
|
||||
|
||||
|
||||
def end_struct(self, data):
|
||||
mark = self._marks.pop()
|
||||
# map structs to Python dictionaries
|
||||
dct = {}
|
||||
items = self._stack[mark:]
|
||||
for i in range(0, len(items), 2):
|
||||
dct[xmlrpclib._stringify(items[i])] = items[i+1]
|
||||
dct[xmlrpclib._stringify(items[i])] = items[i + 1]
|
||||
if '__class__' in dct:
|
||||
if dct['__class__'] == 'date':
|
||||
dct = datetime.date(dct['year'], dct['month'], dct['day'])
|
||||
|
||||
+3
-2
@@ -24,7 +24,7 @@ class PYSON(object):
|
||||
raise NotImplementedError
|
||||
|
||||
def __invert__(self):
|
||||
if self.types()!= set([bool]):
|
||||
if self.types() != set([bool]):
|
||||
return Not(Bool(self))
|
||||
else:
|
||||
return Not(self)
|
||||
@@ -309,7 +309,8 @@ class If(PYSON):
|
||||
def __init__(self, condition, then_statement, else_statement=None):
|
||||
super(If, self).__init__()
|
||||
if isinstance(condition, PYSON):
|
||||
assert condition.types() == set([bool]), 'condition must be boolean'
|
||||
assert condition.types() == set([bool]), \
|
||||
'condition must be boolean'
|
||||
else:
|
||||
assert isinstance(condition, bool), 'condition must be boolean'
|
||||
if isinstance(then_statement, PYSON):
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
#this repository contains the full copyright notices and license terms.
|
||||
from setuptools import setup, find_packages
|
||||
import sys
|
||||
import os
|
||||
import proteus
|
||||
|
||||
@@ -10,6 +9,7 @@ major_version, minor_version, _ = proteus.__version__.split('.', 2)
|
||||
major_version = int(major_version)
|
||||
minor_version = int(minor_version)
|
||||
|
||||
|
||||
def read(fname):
|
||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||
|
||||
|
||||
Reference in new issue
Block a user