summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorBjörn Jacke <bj@sernet.de>2019-08-25 23:06:19 +0200
committerBjoern Jacke <bjacke@samba.org>2019-09-24 12:22:44 +0000
commitcf51f73e02cab85f508bcbef362ff75a7ae18d7f (patch)
tree6f7c434e59d41ef772ec52dd6b9a90878f6cdfe3 /python
parentd2d8ebcca1cc4539a7a6b48fa364e03adda1db6c (diff)
downloadsamba-cf51f73e02cab85f508bcbef362ff75a7ae18d7f.tar.gz
schema.py: avoid inefficient string concatenations
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/schema.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/python/samba/schema.py b/python/samba/schema.py
index aedee82bb8f..caea7e358ae 100644
--- a/python/samba/schema.py
+++ b/python/samba/schema.py
@@ -111,9 +111,7 @@ class Schema(object):
setup_path('ad-schema/%s' % Schema.base_schemas[base_schema][1]))
if files is not None:
- for file in files:
- data = get_string(open(file, 'rb').read())
- self.schema_data += data
+ self.schema_data = "".join(get_string(open(file, 'rb').read()) for file in files)
self.schema_data = substitute_var(self.schema_data,
{"SCHEMADN": schemadn})
@@ -135,8 +133,7 @@ class Schema(object):
self.prefixmap_data = open(setup_path("prefixMap.txt"), 'rb').read()
if additional_prefixmap is not None:
- for map in additional_prefixmap:
- self.prefixmap_data += "%s\n" % map
+ self.prefixmap_data += "".join("%s\n" % map for map in additional_prefixmap)
self.prefixmap_data = b64encode(self.prefixmap_data).decode('utf8')