Small fixes for Python 3
1 parent 6f7d49d commit b4ffc48e2cf156635d76bd212e47b5854ae75ba8
@Alex Tucker Alex Tucker authored on 19 Nov 2016
Showing 2 changed files
View
5
src/energenie/OnAir.py
#
# NOTE: This also might include intelligent power level selection based
# on RSSI reports from different devices.
 
from lifecycle import *
import time
 
try:
# Python 2
import OpenThings
import TwoBit
import radio
from lifecycle import *
 
except ImportError:
# Python 3
from . import OpenThings
from . import TwoBit
from . import radio
 
from .lifecycle import *
 
class OpenThingsAirInterface():
def __init__(self):
self.radio = radio # aids mocking later
View
2
■■■
src/energenie/Registry.py
 
def names(self):
"""A generator/iterator that can be used to get a list of device names"""
# first get a list of all devices, in case the registry changes while iterating
devices = self.store.keys()
devices = list(self.store.keys())
 
# now 'generate' one per call
i = 0
while i < len(devices):