From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (unknown [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id B71E11381FA for ; Wed, 14 May 2014 18:44:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 05040E09E7; Wed, 14 May 2014 18:44:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 76B25E09E7 for ; Wed, 14 May 2014 18:44:25 +0000 (UTC) Received: from spoonbill.gentoo.org (unknown [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2C5C533FF86 for ; Wed, 14 May 2014 18:44:24 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id AC1561818D for ; Wed, 14 May 2014 18:44:22 +0000 (UTC) From: "Devan Franchini" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Devan Franchini" Message-ID: <1400092785.2eee92a7ba3a6d1a13d29abb6ff7c57aa30bed6a.twitch153@gentoo> Subject: [gentoo-commits] proj/layman:gsoc2014 commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/api.py layman/argsparser.py layman/cli.py layman/db.py layman/dbbase.py layman/makeconf.py X-VCS-Directories: layman/ X-VCS-Committer: twitch153 X-VCS-Committer-Name: Devan Franchini X-VCS-Revision: 2eee92a7ba3a6d1a13d29abb6ff7c57aa30bed6a X-VCS-Branch: gsoc2014 Date: Wed, 14 May 2014 18:44:22 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 34f8903d-8fc8-419e-8f74-70b80d5bc3be X-Archives-Hash: dd80667270f4b0506928a841e3042917 commit: 2eee92a7ba3a6d1a13d29abb6ff7c57aa30bed6a Author: Devan Franchini gentoo org> AuthorDate: Wed May 14 18:39:45 2014 +0000 Commit: Devan Franchini gentoo org> CommitDate: Wed May 14 18:39:45 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=2eee92a7 layman/*.py: converts keys() to lists For py2/py3 compatibility variables such as self.overlays.keys() or self.overlays.items() need to be implicitly converted into lists. --- layman/api.py | 2 +- layman/argsparser.py | 12 ++++++------ layman/cli.py | 10 +++++----- layman/db.py | 6 +++--- layman/dbbase.py | 10 +++++----- layman/makeconf.py | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/layman/api.py b/layman/api.py index cbf3f76..f36be0a 100755 --- a/layman/api.py +++ b/layman/api.py @@ -534,7 +534,7 @@ class LaymanAPI(object): def supported_types(self): """returns a dictionary of all repository types, with boolean values""" - cmds = [x for x in self.config.keys() if '_command' in x] + cmds = [x for x in list(self.config.keys()) if '_command' in x] supported = {} for cmd in cmds: type_key = cmd.split('_')[0] diff --git a/layman/argsparser.py b/layman/argsparser.py index 3e3d6f6..dd1cc85 100644 --- a/layman/argsparser.py +++ b/layman/argsparser.py @@ -307,7 +307,7 @@ class ArgsParser(BareConfig): if key == 'overlays': overlays = '' - if (key in self.options.__dict__.keys() + if (key in list(self.options.__dict__.keys()) and not self.options.__dict__[key] is None): overlays = '\n'.join(self.options.__dict__[key]) if self.config.has_option('MAIN', 'overlays'): @@ -317,7 +317,7 @@ class ArgsParser(BareConfig): self.output.debug('ARGSPARSER: Retrieving options option: %s' % key, 9) - if (key in self.options.__dict__.keys() + if (key in list(self.options.__dict__.keys()) and not self.options.__dict__[key] is None): return self.options.__dict__[key] @@ -330,10 +330,10 @@ class ArgsParser(BareConfig): self.output.debug('ARGSPARSER: Retrieving option: %s' % key, 9) - if key in self._options.keys(): + if key in list(self._options.keys()): return self._options[key] - if key in self.defaults.keys(): + if key in list(self.defaults.keys()): return self.defaults[key] self.output.debug('ARGSPARSER: Retrieving option failed. returning None', 9) @@ -346,7 +346,7 @@ class ArgsParser(BareConfig): self.output.debug('ARGSPARSER: Retrieving keys', 9) - keys = [i for i in self.options.__dict__.keys() + keys = [i for i in list(self.options.__dict__.keys()) if not self.options.__dict__[i] is None] self.output.debug('ARGSPARSER: Retrieving keys 2', 9) @@ -356,7 +356,7 @@ class ArgsParser(BareConfig): self.output.debug('ARGSPARSER: Retrieving keys 3', 9) - keys += [i for i in self.defaults.keys() + keys += [i for i in list(self.defaults.keys()) if not i in keys] self.output.debug('ARGSPARSER: Returning keys', 9) diff --git a/layman/cli.py b/layman/cli.py index 258e3b9..cccddc6 100644 --- a/layman/cli.py +++ b/layman/cli.py @@ -146,7 +146,7 @@ class Main(object): def __call__(self): self.output.debug("CLI.__call__(): self.config.keys()" - " %s" % str(self.config.keys()), 6) + " %s" % str(list(self.config.keys())), 6) # blank newline -- no " *" self.output.notice('') @@ -157,11 +157,11 @@ class Main(object): updater.print_instructions() # Make fetching the overlay list a default action - if not 'nofetch' in self.config.keys(): + if not 'nofetch' in list(self.config.keys()): # Actions that implicitely call the fetch operation before fetch_actions = ['sync', 'sync_all', 'list'] for i in fetch_actions: - if i in self.config.keys(): + if i in list(self.config.keys()): # Implicitely call fetch, break loop self.Fetch() break @@ -180,14 +180,14 @@ class Main(object): action_errors = [] results = [] act=set([x[0] for x in self.actions]) - k=set([x for x in self.config.keys()]) + k=set([x for x in list(self.config.keys())]) a=act.intersection(k) self.output.debug('Actions = %s' % str(a), 4) for action in self.actions: self.output.debug('Checking for action %s' % action[0], 4) - if action[0] in self.config.keys(): + if action[0] in list(self.config.keys()): result += getattr(self, action[1])() _errors = self.api.get_errors() if _errors: diff --git a/layman/db.py b/layman/db.py index ce03e13..6a8d5ed 100644 --- a/layman/db.py +++ b/layman/db.py @@ -124,10 +124,10 @@ class DB(DbBase): >>> shutil.rmtree(tmpdir) ''' - if overlay.name not in self.overlays.keys(): + if overlay.name not in list(self.overlays.keys()): result = overlay.add(self.config['storage']) if result == 0: - if 'priority' in self.config.keys(): + if 'priority' in list(self.config.keys()): overlay.set_priority(self.config['priority']) self.overlays[overlay.name] = overlay self.write(self.path) @@ -213,7 +213,7 @@ class DB(DbBase): >>> shutil.rmtree(tmpdir) ''' - if overlay.name in self.overlays.keys(): + if overlay.name in list(self.overlays.keys()): make_conf = MakeConf(self.config, self.overlays) overlay.delete(self.config['storage']) del self.overlays[overlay.name] diff --git a/layman/dbbase.py b/layman/dbbase.py index 8fa3ba8..ff99965 100644 --- a/layman/dbbase.py +++ b/layman/dbbase.py @@ -107,7 +107,7 @@ class DbBase(object): def __eq__(self, other): - for key in set(self.overlays.keys() + other.overlays.keys()): + for key in set(list(self.overlays.keys()) + list(other.overlays.keys())): if self.overlays[key] != other.overlays[key]: return False return True @@ -221,7 +221,7 @@ class DbBase(object): ''' tree = ET.Element('repositories', version="1.0") - tree[:] = [e.to_xml() for e in self.overlays.values()] + tree[:] = [e.to_xml() for e in list(self.overlays.values())] indent(tree) tree = ET.ElementTree(tree) try: @@ -248,11 +248,11 @@ class DbBase(object): ['rsync://gunnarwrobel.de/wrobel-stable'] ''' self.output.debug("DbBase.select(), overlay = %s" % overlay, 5) - if not overlay in self.overlays.keys(): + if not overlay in list(self.overlays.keys()): self.output.debug("DbBase.select(), unknown overlay = %s" % overlay, 4) self.output.debug("DbBase.select(), known overlays = %s" - % ', '.join(self.overlays.keys()), 4) + % ', '.join(list(self.overlays.keys())), 4) raise UnknownOverlayException(overlay) return self.overlays[overlay] @@ -295,7 +295,7 @@ class DbBase(object): ''' result = [] - selection = [overlay for (a, overlay) in self.overlays.items()] + selection = [overlay for (a, overlay) in list(self.overlays.items())] if repos is not None: selection = [overlay for overlay in selection if overlay.name in repos] diff --git a/layman/makeconf.py b/layman/makeconf.py index 52762a2..b592fc0 100644 --- a/layman/makeconf.py +++ b/layman/makeconf.py @@ -189,7 +189,7 @@ class MakeConf: for i in overlays: if i[:len(self.storage)] == self.storage: oname = os.path.basename(i) - if oname in self.db.keys(): + if oname in list(self.db.keys()): self.overlays.append(self.db[oname]) else: # These are additional overlays that we dont know