diff options
Diffstat (limited to '')
-rw-r--r-- | portato/db/__init__.py | 4 | ||||
-rw-r--r-- | portato/db/database.py | 4 | ||||
-rw-r--r-- | portato/db/eix_sql.py | 2 | ||||
-rw-r--r-- | portato/db/hash.py | 8 | ||||
-rw-r--r-- | portato/db/sql.py | 4 |
5 files changed, 9 insertions, 13 deletions
diff --git a/portato/db/__init__.py b/portato/db/__init__.py index 21d8f80..74479e6 100644 --- a/portato/db/__init__.py +++ b/portato/db/__init__.py @@ -10,8 +10,6 @@ # # Written by René 'Necoro' Neumann <necoro@necoro.net> -from __future__ import absolute_import - from . import database as db from .exceptions import UnknownDatabaseTypeError, DatabaseInstantiationError from ..session import Session, SectionDict @@ -71,7 +69,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 <necoro@necoro.net> -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 758f42c..2a693e9 100644 --- a/portato/db/eix_sql.py +++ b/portato/db/eix_sql.py @@ -10,7 +10,7 @@ # # Written by René 'Necoro' Neumann <necoro@necoro.net> -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 <necoro@necoro.net> -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 581ebc4..f3b93f0 100644 --- a/portato/db/sql.py +++ b/portato/db/sql.py @@ -10,8 +10,6 @@ # # Written by René 'Necoro' Neumann <necoro@necoro.net> -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) |