From d9a7cd1da64da57bea05e5b234b9d9c6fea7f911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 11 Apr 2010 01:39:31 +0200 Subject: applied 2to3 and fixed the result --- portato/db/__init__.py | 4 +--- portato/db/database.py | 4 ++-- portato/db/eix_sql.py | 2 +- portato/db/hash.py | 8 ++++---- portato/db/sql.py | 4 +--- 5 files changed, 9 insertions(+), 13 deletions(-) (limited to 'portato/db') diff --git a/portato/db/__init__.py b/portato/db/__init__.py index 850a84e..4e18bdd 100644 --- a/portato/db/__init__.py +++ b/portato/db/__init__.py @@ -10,8 +10,6 @@ # # Written by René 'Necoro' Neumann -from __future__ import absolute_import - from . import database as db from .exceptions import UnknownDatabaseTypeError, DatabaseInstantiationError from ..session import Session, SectionDict @@ -70,7 +68,7 @@ class Database(db.Database): else: error(_("Unknown database type: %s"), type) - raise UnknownDatabaseTypeError, type + raise UnknownDatabaseTypeError(type) @classmethod def _get_session(cls): diff --git a/portato/db/database.py b/portato/db/database.py index c679d06..9ab431c 100644 --- a/portato/db/database.py +++ b/portato/db/database.py @@ -10,7 +10,7 @@ # # Written by René 'Necoro' Neumann -from __future__ import absolute_import, with_statement + from threading import RLock from functools import wraps @@ -77,7 +77,7 @@ class Database (object): def set_type (self, type): if type & self.search_types() != type: - raise UnsupportedSearchTypeError, type + raise UnsupportedSearchTypeError(type) self._type = type diff --git a/portato/db/eix_sql.py b/portato/db/eix_sql.py index 75bcb1e..9ba75ff 100644 --- a/portato/db/eix_sql.py +++ b/portato/db/eix_sql.py @@ -10,7 +10,7 @@ # # Written by René 'Necoro' Neumann -from __future__ import absolute_import, with_statement + try: import sqlite3 as sql diff --git a/portato/db/hash.py b/portato/db/hash.py index 4a6958b..f52f4dd 100644 --- a/portato/db/hash.py +++ b/portato/db/hash.py @@ -10,7 +10,7 @@ # # Written by René 'Necoro' Neumann -from __future__ import absolute_import, with_statement + import re from collections import defaultdict @@ -102,7 +102,7 @@ class HashDatabase (Database): if installed: cats = self.inst_cats else: - cats = self._db.iterkeys() + cats = iter(self._db.keys()) else: if installed: @@ -124,7 +124,7 @@ class HashDatabase (Database): except KeyError: # not in inst_cats - can be ignored pass - self._db[self.ALL] = filter(lambda x: x.cat != cat, self._db[self.ALL]) + self._db[self.ALL] = [x for x in self._db[self.ALL] if x.cat != cat] self.populate(cat+"/*") else: self.__initialize() @@ -148,7 +148,7 @@ class HashDatabase (Database): else: try: regex = re.compile(restrict, re.I) - except re.error, e: + except re.error as e: info(_("Error while compiling search expression: '%s'."), str(e)) else: # only set self._restrict if no error occurred self._restrict = regex diff --git a/portato/db/sql.py b/portato/db/sql.py index f5dc257..c248c9a 100644 --- a/portato/db/sql.py +++ b/portato/db/sql.py @@ -10,8 +10,6 @@ # # Written by René 'Necoro' Neumann -from __future__ import absolute_import, with_statement - try: import sqlite3 as sql except ImportError: @@ -136,7 +134,7 @@ class SQLDatabase (Database): debug("Overlay '%s' has been removed", key) changed = True - for key in hashes.iterkeys(): + for key in hashes.keys(): if key not in db: debug("Overlay '%s' has been added.", key) -- cgit v1.2.3