worked through a couple todos, removed usage of eval within parsing xml files
This commit is contained in:
parent
e4b280196b
commit
8612c73d49
8 changed files with 76 additions and 58 deletions
|
@ -6,8 +6,6 @@ import heapq
|
|||
import threading
|
||||
import time
|
||||
|
||||
from core import logger
|
||||
|
||||
|
||||
class Timer(threading.Thread):
|
||||
"""
|
||||
|
@ -245,40 +243,3 @@ class EventLoop(object):
|
|||
if self.running and self.timer is None:
|
||||
self.__schedule_event()
|
||||
return event
|
||||
|
||||
|
||||
# TODO: move example to documentation
|
||||
def example():
|
||||
loop = EventLoop()
|
||||
|
||||
def msg(arg):
|
||||
delta = time.time() - loop.start
|
||||
logger.debug("%s arg: %s", delta, arg)
|
||||
|
||||
def repeat(interval, count):
|
||||
count -= 1
|
||||
msg("repeat: interval: %s; remaining: %s" % (interval, count))
|
||||
if count > 0:
|
||||
loop.add_event(interval, repeat, interval, count)
|
||||
|
||||
def sleep(delay):
|
||||
msg("sleep %s" % delay)
|
||||
time.sleep(delay)
|
||||
msg("sleep done")
|
||||
|
||||
def stop(arg):
|
||||
msg(arg)
|
||||
loop.stop()
|
||||
|
||||
loop.add_event(0, msg, "start")
|
||||
loop.add_event(0, msg, "time zero")
|
||||
|
||||
for delay in 5, 4, 10, -1, 0, 9, 3, 7, 3.14:
|
||||
loop.add_event(delay, msg, "time %s" % delay)
|
||||
|
||||
loop.run()
|
||||
|
||||
loop.add_event(0, repeat, 1, 5)
|
||||
loop.add_event(12, sleep, 10)
|
||||
|
||||
loop.add_event(15.75, stop, "stop time: 15.75")
|
||||
|
|
|
@ -49,6 +49,8 @@ class Conf(object):
|
|||
Provides a configuration object.
|
||||
"""
|
||||
|
||||
template = Template("")
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
"""
|
||||
Create a Conf instance.
|
||||
|
@ -64,7 +66,6 @@ class Conf(object):
|
|||
:return: string representation
|
||||
:rtype: str
|
||||
"""
|
||||
# TODO: seems like an error here
|
||||
tmp = self.template.substitute(**self.kwargs)
|
||||
if tmp[-1] == "\n":
|
||||
tmp = tmp[:-1]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue