summaryrefslogtreecommitdiff
path: root/pygnulib/GLFileSystem.py
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2022-08-04 18:26:08 +0200
committerBruno Haible <bruno@clisp.org>2022-08-04 18:26:08 +0200
commit2a33db96531933f00405522d94ebc658236f0b84 (patch)
treebf3f2ec3e231c0cb6959e5507b9b527d03ba3a4d /pygnulib/GLFileSystem.py
parent948345cceab85ab699910a795d6b69ea2be6e300 (diff)
downloadgnulib-2a33db96531933f00405522d94ebc658236f0b84.tar.gz
gnulib-tool.py: Use mainstream/GNU coding style.
* gnulib-tool.py: Break lines before the % operator, not after. * pygnulib/*.py: Likewise. Avoid line breaks when the resulting lines are not too long.
Diffstat (limited to 'pygnulib/GLFileSystem.py')
-rw-r--r--pygnulib/GLFileSystem.py41
1 files changed, 19 insertions, 22 deletions
diff --git a/pygnulib/GLFileSystem.py b/pygnulib/GLFileSystem.py
index 1f7a9f2343..a1d1520f7c 100644
--- a/pygnulib/GLFileSystem.py
+++ b/pygnulib/GLFileSystem.py
@@ -69,8 +69,8 @@ class GLFileSystem(object):
'''Create new GLFileSystem instance. The only argument is localpath,
which can be an empty list.'''
if type(config) is not GLConfig:
- raise TypeError('config must be a GLConfig, not %s' %
- type(config).__name__)
+ raise TypeError('config must be a GLConfig, not %s'
+ % type(config).__name__)
self.config = config
def __repr__(self):
@@ -87,8 +87,8 @@ class GLFileSystem(object):
indicates whether file is a temporary file.
GLConfig: localpath.'''
if type(name) is not str:
- raise TypeError(
- 'name must be a string, not %s' % type(module).__name__)
+ raise TypeError('name must be a string, not %s'
+ % type(module).__name__)
localpath = self.config['localpath']
# Each element in localpath is a directory whose contents overrides
# or amends the result of the lookup in the rest of localpath and
@@ -160,19 +160,19 @@ class GLFileAssistant(object):
def __init__(self, config, transformers=dict()):
'''Create GLFileAssistant instance.'''
if type(config) is not GLConfig:
- raise TypeError('config must be a GLConfig, not %s' %
- type(config).__name__)
+ raise TypeError('config must be a GLConfig, not %s'
+ % type(config).__name__)
if type(transformers) is not dict:
- raise TypeError('transformers must be a dict, not %s' %
- type(transformers).__name__)
+ raise TypeError('transformers must be a dict, not %s'
+ % type(transformers).__name__)
for key in ['lib', 'aux', 'main', 'tests']:
if key not in transformers:
transformers[key] = 's,x,x,'
else: # if key in transformers
value = transformers[key]
if type(value) is not str:
- raise TypeError('transformers[%s] must be a string, not %s' %
- (key, type(value).__name__))
+ raise TypeError('transformers[%s] must be a string, not %s'
+ % (key, type(value).__name__))
self.original = None
self.rewritten = None
self.added = list()
@@ -287,11 +287,11 @@ class GLFileAssistant(object):
if rewritten == None:
raise TypeError('rewritten must be set before applying the method')
if type(lookedup) is not str:
- raise TypeError('lookedup must be a string, not %s' %
- type(lookedup).__name__)
+ raise TypeError('lookedup must be a string, not %s'
+ % type(lookedup).__name__)
if type(already_present) is not bool:
- raise TypeError('already_present must be a bool, not %s' %
- type(already_present).__name__)
+ raise TypeError('already_present must be a bool, not %s'
+ % type(already_present).__name__)
basename = rewritten
backupname = '%s~' % basename
basepath = joinpath(destdir, basename)
@@ -299,8 +299,7 @@ class GLFileAssistant(object):
if not filecmp.cmp(basepath, tmpfile):
if not self.config['dryrun']:
if already_present:
- print('Updating file %s (backup in %s)' %
- (basename, backupname))
+ print('Updating file %s (backup in %s)' % (basename, backupname))
else: # if not already_present
message = 'Replacing file '
message += '%s (non-gnulib code backed up in ' % basename
@@ -324,11 +323,9 @@ class GLFileAssistant(object):
raise GLError(17, original)
else: # if self.config['dryrun']
if already_present:
- print('Update file %s (backup in %s)' %
- (rewritten, backup))
+ print('Update file %s (backup in %s)' % (rewritten, backup))
else: # if not already_present
- print('Replace file %s (backup in %s)' %
- (rewritten, backup))
+ print('Replace file %s (backup in %s)' % (rewritten, backup))
def add_or_update(self, already_present):
'''GLFileAssistant.add_or_update(already_present)
@@ -341,8 +338,8 @@ class GLFileAssistant(object):
elif rewritten == None:
raise TypeError('rewritten must be set before applying the method')
if type(already_present) is not bool:
- raise TypeError('already_present must be a bool, not %s' %
- type(already_present).__name__)
+ raise TypeError('already_present must be a bool, not %s'
+ % type(already_present).__name__)
xoriginal = original
if original.startswith('tests=lib/'):
xoriginal = constants.substart('tests=lib/', 'lib/', original)