Commit 7a1b583c authored by Jérome Perrin's avatar Jérome Perrin

forge: pylint py3

parent f58fbaf5
# TODO: this module was not ported to python3, it's not clear if this
# is still useful
# pylint:disable=import-error
import compiler
import compiler.ast
import compiler.visitor
......
......@@ -41,7 +41,7 @@ GIT_ASKPASS = os.path.join(Products.ERP5.product_path, 'bin', 'git_askpass')
class GitInstallationError(EnvironmentError):
"""Raised when an installation is broken"""
pass
class GitError(EnvironmentError):
def __init__(self, err, out, returncode):
......@@ -240,7 +240,7 @@ class Git(WorkingCopy):
node_dict[parent] = [path]
path_dict[parent] = status
if parent:
path_list.append(parent)
path_list.append(parent) # pylint:disable=modified-iterating-list
else:
while path_dict.get(parent, status) != status:
path_dict[parent] = status = '*'
......@@ -265,7 +265,7 @@ class Git(WorkingCopy):
else:
child = Dir(basename, dir_status(status))
node.sub_dirs.append(child)
path_list.append((content, child))
path_list.append((content, child)) # pylint:disable=modified-iterating-list
return (root.sub_dirs or root.sub_files) and root
def update(self, keep=False):
......@@ -275,7 +275,7 @@ class Git(WorkingCopy):
if not keep:
self.clean()
self.remote_git('pull', '--ff-only')
elif 1: # elif local_changes:
elif 1: # elif local_changes: # pylint:disable=using-constant-test
raise NotImplementedError
# addremove
# write-tree | commit-tree -> A
......@@ -363,16 +363,15 @@ class Git(WorkingCopy):
raise
# try to update our working copy
# TODO: find a solution if there are other local changes
# TODO: solve conflicts on */bt/revision automatically
try:
self.git(merge, '@{u}', env=env)
except GitError as e:
except GitError as e2:
# XXX: how to know how it failed ?
try:
self.git(merge, '--abort')
except GitError:
pass
raise e
raise e2
# no need to keep a merge commit if push fails again
if merge == 'merge':
reset += 1
......
......@@ -41,6 +41,7 @@ from AccessControl import ClassSecurityInfo
from AccessControl.SecurityInfo import ModuleSecurityInfo
from tempfile import mkdtemp
import shutil
import six
class getTransactionalDirectory(str):
......@@ -63,17 +64,14 @@ class getTransactionalDirectory(str):
class SubversionError(Exception):
"""The base exception class for the Subversion interface.
"""
pass
class SubversionInstallationError(SubversionError):
"""Raised when an installation is broken.
"""
pass
class SubversionTimeoutError(SubversionError):
"""Raised when a Subversion transaction is too long.
"""
pass
class SubversionLoginError(SubversionError):
"""Raised when an authentication is required.
......@@ -140,9 +138,9 @@ try:
self.client.setException(SubversionLoginError(realm))
return False, '', '', False
# BBB. support older versions of pysvn <= 1.6.3
if isinstance(user, unicode):
if six.PY2 and isinstance(user, six.text_type):
user = user.encode('utf-8')
if isinstance(password, unicode):
if six.PY2 and isinstance(password, six.text_type):
password = password.encode('utf-8')
return True, user, password, False
......@@ -178,7 +176,7 @@ try:
def __call__(self, instance):
value = getattr(instance._obj, self._key)
if isinstance(value, unicode):
if six.PY2 and isinstance(value, six.text_type):
value = value.encode('utf-8')
#elif isinstance(value, pysvn.Entry):
elif str(type(value)) == "<type 'entry'>":
......
......@@ -154,7 +154,7 @@ class TestTemplateTool(ERP5TypeTestCase):
"""
self._svn_setup_ssl()
# we make this class a global so that it can be pickled
global PropertiesTool # pylint:disable=global-variable-not-assigned
global PropertiesTool # pylint:disable=global-variable-not-assigned,global-variable-undefined
class PropertiesTool(ActionsTool): # pylint:disable=redefined-outer-name
id = 'portal_properties'
cls = PropertiesTool
......
......@@ -255,6 +255,8 @@ def _getattr(self, name, *args, **kw):
# SOAPPy.Types contains "from SOAPPy.Types import *" which confuses
# this patch
or self.name == 'SOAPpy.Types'
# pysvn also confuses pylint
or self.name == 'pysvn'
):
raise
real_module = __import__(
......
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