Commit 8e07b88d authored by Jérome Perrin's avatar Jérome Perrin

*: fix some problems reported by pylint

parent 8505693a
......@@ -99,7 +99,6 @@ class SimulatedDeliveryBuilder(BuilderMixin):
Redefine this method, because it seems nothing interesting can be
done before building Delivery.
"""
pass
security.declarePrivate('searchMovementList')
@UnrestrictedMethod
......
......@@ -1099,12 +1099,11 @@ class TestERP5Credential(ERP5TypeTestCase):
default_follow_up_uid=credential_request.getUid())
last_message = self.portal.MailHost._last_message
self.assertNotEqual((), last_message)
mfrom, mto, message_text = last_message
mfrom, mto, _ = last_message
self.assertEqual(mfrom, 'Portal Administrator <postmaster@localhost>')
self.assertEqual(['Vifib Test <barney@duff.com>'], mto)
decoded_message = self.decode_email(last_message[2])
self.assertEqual(decoded_message["headers"]["subject"].encode(), "Welcome")
body_message = decoded_message['body']
self.assertRegex(self.decode_email(last_message[2])['body'], r"Hello\ Vifib\ Test\,")
self.assertRegex(self.decode_email(last_message[2])['body'], "key=%s" % mail_message.getReference())
......
......@@ -28,10 +28,13 @@ import email
import mock
import time
import six
# pylint:disable=no-name-in-module
if six.PY3:
from email import message_from_bytes
else:
from email import message_from_string as message_from_bytes
# pylint:enable=no-name-in-module
from Products.ERP5Type.tests.ERP5TypeLiveTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery
......
......@@ -48,10 +48,12 @@ except ImportError:
not installed yet.
"""
if six.PY2:
from email import message_from_string as message_from_bytes
else:
# pylint:disable=no-name-in-module
if six.PY3:
from email import message_from_bytes
else:
from email import message_from_string as message_from_bytes
# pylint:enable=no-name-in-module
from email.utils import parsedate_tz, mktime_tz
......
......@@ -27,7 +27,6 @@
#
##############################################################################
import six
from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Base import WorkflowMethod
from Products.ERP5Type import Permissions, PropertySheet
......@@ -154,7 +153,7 @@ class File(Document, OFS_File):
security.declarePrivate('update_data')
def update_data(self, *args, **kw):
super(File, self).update_data(*args, **kw)
if six.PY2 and isinstance(self.size, long):
if six.PY2 and isinstance(self.size, long): # pylint:disable=undefined-variable
self.size = int(self.size)
security.declareProtected(Permissions.ModifyPortalContent,'setFile')
......
......@@ -29,7 +29,6 @@
import six
from past.builtins import cmp
from hashlib import md5
# Some workflow does not make sense in the context of mass transition and are
......
......@@ -33,7 +33,6 @@ from Products.ERP5Type.Message import translateString
from Products.ERP5Type import Permissions
from OFS.Image import Pdata
from io import BytesIO
import six
_MARKER = object()
class BaseConvertableFileMixin:
......
......@@ -29,10 +29,12 @@
from warnings import warn
import six
# pylint:disable=no-name-in-module
if six.PY2:
from base64 import decodestring as decodebytes
else:
from base64 import decodebytes
# pylint:enable=no-name-in-module
from zLOG import LOG
from AccessControl import ClassSecurityInfo, getSecurityManager
......
......@@ -31,7 +31,6 @@
from collections import OrderedDict
from warnings import warn
from Products.PythonScripts.Utility import allow_class
from Products.ERP5Type.Utils import ensure_list
class MovementGroupNode:
......
......@@ -28,10 +28,13 @@
##############################################################################
import six
# pylint:disable=no-name-in-module,import-error
if six.PY3:
from collections.abc import Set
else:
from collections import Set
# pylint:enable=no-name-in-module,import-error
import difflib
import warnings
try:
......
......@@ -4,11 +4,12 @@
import io
import six
if six.PY2:
from email import message_from_string as message_from_bytes
else:
# pylint:disable=no-name-in-module
if six.PY3:
from email import message_from_bytes
else:
from email import message_from_string as message_from_bytes
# pylint:enable=no-name-in-module
class TransformException(Exception):
pass
......
......@@ -12,10 +12,12 @@ import glob
import cgi
from six.moves import urllib
import multifile
if six.PY2:
from email import message_from_file as message_from_bytes
else:
# pylint:disable=no-name-in-module
if six.PY3:
from email import message_from_bytes
else:
from email import message_from_string as message_from_bytes
# pylint:enable=no-name-in-module
_TEST_CASE_HEADER = """\
<html>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment