From c07022ce788713d923034659ad71088bf48b53ce Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 20 Mar 2019 12:02:09 +1300 Subject: [PATCH 1/4] py/graph: use 2.6 compatible check for set membership It is better this way anyway. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13837 Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Wed Mar 20 06:36:05 UTC 2019 on sn-devel-144 (cherry picked from commit c0aca17a4c9ec06f0127d5c972f3fa979a87a77f) --- python/samba/graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/samba/graph.py b/python/samba/graph.py index 0a0aecd6631..c8d5f9230d0 100644 --- a/python/samba/graph.py +++ b/python/samba/graph.py @@ -88,7 +88,7 @@ def shorten_vertex_names(vertices, suffix=',...', aggressive=False): try: while True: c = set(x[i] for x in vlist) - if len(c) > 1 or c == {'*'}: + if len(c) > 1 or '*' in c: break i -= 1 except IndexError: -- 2.17.1 From bc0ad6f4c2973500fc43e98aed8bfb8239648d18 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Fri, 22 Mar 2019 15:24:47 +1300 Subject: [PATCH 2/4] py/kcc_utils: py2.6 compatibility BUG: https://bugzilla.samba.org/show_bug.cgi?id=13837 Signed-off-by: Douglas Bagnall --- python/samba/kcc/kcc_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/samba/kcc/kcc_utils.py b/python/samba/kcc/kcc_utils.py index 81d381abd99..ef4d706c8e2 100644 --- a/python/samba/kcc/kcc_utils.py +++ b/python/samba/kcc/kcc_utils.py @@ -31,7 +31,7 @@ from samba.dcerpc import ( ) from samba.common import dsdb_Dn from samba.ndr import ndr_unpack, ndr_pack -from collections import Counter +from collections import defaultdict class KCCError(Exception): @@ -2288,7 +2288,7 @@ def uncovered_sites_to_cover(samdb, site_name): scope=ldb.SCOPE_SUBTREE, expression="(objectClass=site)") - sites_in_use = Counter() + sites_in_use = defaultdict(int) dc_count = 0 # Assume server is of form DC,Servers,Site-ABCD because of schema -- 2.17.1 From a08e0e12892624675c245f63643da797115228ca Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 20 Mar 2019 12:12:34 +1300 Subject: [PATCH 3/4] py/uptodateness: use 2.6 compatible dictionary construction BUG: https://bugzilla.samba.org/show_bug.cgi?id=13837 Signed-off-by: Douglas Bagnall --- python/samba/uptodateness.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/samba/uptodateness.py b/python/samba/uptodateness.py index 3964bd7d6db..ced902bb3e4 100644 --- a/python/samba/uptodateness.py +++ b/python/samba/uptodateness.py @@ -194,6 +194,6 @@ def get_utdv_summary(distances, filters=None): } if filters: - return {key: summary[key] for key in filters} + return dict((key, summary[key]) for key in filters) else: return summary -- 2.17.1 From 43357890cc2c7fe148e5b334ee756ab07ab5b30c Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 27 Mar 2019 09:47:56 +1300 Subject: [PATCH 4/4] py/logger: use python 2.6 compatible arguments In 2.6 stream is a positional argument; 2.7+ it is also a keyword argument. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13837 Signed-off-by: Douglas Bagnall --- python/samba/logger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/samba/logger.py b/python/samba/logger.py index 667c6487a51..b54268a628c 100644 --- a/python/samba/logger.py +++ b/python/samba/logger.py @@ -62,7 +62,7 @@ def get_samba_logger( Formatter = logging.Formatter formatter = Formatter(fmt=fmt, datefmt=datefmt) - handler = logging.StreamHandler(stream=stream) + handler = logging.StreamHandler(stream) handler.setFormatter(formatter) logger.addHandler(handler) -- 2.17.1