diff options
| author | 2018-03-14 02:56:04 +0100 | |
|---|---|---|
| committer | 2018-03-14 20:23:00 -0400 | |
| commit | 23ac25c0b388b5ffebf66154b12a3950b89b977a (patch) | |
| tree | 27ae214e393e6be2efc225d02ffc93135aaa2eb5 /minidinstall/Dnotify.py | |
| parent | 9883708468224628f9e0e577162fb5345fe20eb4 (diff) | |
Port to Python 3
Diffstat (limited to 'minidinstall/Dnotify.py')
| -rw-r--r-- | minidinstall/Dnotify.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/minidinstall/Dnotify.py b/minidinstall/Dnotify.py index e31080c..18606e1 100644 --- a/minidinstall/Dnotify.py +++ b/minidinstall/Dnotify.py @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -import os, re, sys, string, stat, threading, Queue, time +import os, re, sys, string, stat, threading, queue, time import logging from minidinstall import misc @@ -26,7 +26,7 @@ class DnotifyException(Exception): def __init__(self, value): self._value = value def __str__(self): - return `self._value` + return repr(self._value) class DirectoryNotifierFactory: def create(self, dirs, use_dnotify=1, poll_time=30, logger=None, cancel_event=None): @@ -101,7 +101,7 @@ class MtimeDirectoryNotifier(DirectoryNotifier): if timeout_time and time.time() > timeout_time: return None self._logger.debug('Polling...') - for dir in self._dirmap.keys(): + for dir in list(self._dirmap.keys()): oldtime = self._dirmap[dir] mtime = os.stat(os.path.join(self._cwd, dir))[stat.ST_MTIME] if oldtime < mtime: @@ -120,7 +120,7 @@ class MtimeDirectoryNotifier(DirectoryNotifier): class DnotifyDirectoryNotifier(DirectoryNotifier): def __init__(self, dirs, logger): DirectoryNotifier.__init__(self, dirs, logger) - self._queue = Queue.Queue() + self._queue = queue.Queue() dnotify = DnotifyThread(self._queue, self._dirs, self._logger) dnotify.start() @@ -134,12 +134,12 @@ class DnotifyDirectoryNotifier(DirectoryNotifier): if dir is None: # We shouldn't have to do this; no one else is reading # from the queue. But we do it just to be safe. - for key in set.keys(): + for key in list(set.keys()): self._queue.put(key) return None set[dir] = 1 i -= 1 - for key in set.keys(): + for key in list(set.keys()): self._queue.put(key) i = self._queue.qsize() self._logger.debug('Queue size (after duplicate filter): %d', (i,)) @@ -149,10 +149,10 @@ class DnotifyDirectoryNotifier(DirectoryNotifier): if timeout is None: return self._queue.get() timeout_time = time.time() + timeout - while 1: + while True: try: self._queue.get(0) - except Queue.Empty: + except queue.Empty: if time.time() > timeout_time: return None else: |
