Use six for python 2/3 compatibility
Replace usage of dict.keys() with six.iterkeys(dict) Change-Id: Ia7c99ea202fd0800c43a079b5b3fd094e7e66adb
This commit is contained in:
parent
58620a32b5
commit
fb410e168e
|
@ -25,6 +25,7 @@ import croniter
|
|||
from kombu import Exchange
|
||||
from kombu import Queue
|
||||
import pause
|
||||
import six
|
||||
|
||||
from entropy import utils
|
||||
import imp
|
||||
|
@ -110,7 +111,7 @@ class Engine(object):
|
|||
|
||||
new_additions = []
|
||||
|
||||
for key in schedules.keys():
|
||||
for key in six.iterkeys(schedules):
|
||||
sched = schedules[key]
|
||||
now = datetime.datetime.now()
|
||||
cron = croniter.croniter(sched, now)
|
||||
|
|
|
@ -19,6 +19,7 @@ import os
|
|||
import sys
|
||||
import time
|
||||
|
||||
import six
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
from watchdog.observers import Observer
|
||||
import yaml
|
||||
|
@ -97,7 +98,7 @@ class WatchdogHandler(FileSystemEventHandler):
|
|||
self.event_fn = event_fn
|
||||
|
||||
def on_modified(self, event):
|
||||
if event.src_path in self.event_fn.keys():
|
||||
if event.src_path in six.iterkeys(self.event_fn):
|
||||
self.event_fn[event.src_path]()
|
||||
else:
|
||||
LOG.error('no associated function for %s', event.src_path)
|
||||
|
@ -113,7 +114,7 @@ def watch_dir_for_change(dir_to_watch, event_fn):
|
|||
|
||||
def check_duplicate(name, cfg_file):
|
||||
scripts = load_yaml(cfg_file)
|
||||
return scripts and name in scripts.keys()
|
||||
return scripts and name in scripts
|
||||
|
||||
|
||||
def reset_logger(log):
|
||||
|
|
|
@ -8,3 +8,4 @@ pause==0.1.2
|
|||
stevedore>0.10
|
||||
watchdog>=0.7.1
|
||||
futures>=2.1.6
|
||||
six>=1.6.1
|
||||
|
|
Loading…
Reference in New Issue