GitBucket
Toggle navigation
Pull requests
Issues
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Kanban
Fork
: 0
alex
/
pyenergenie
Browse code
Small fixes for Python 3
master
1 parent
6f7d49d
commit
b4ffc48e2cf156635d76bd212e47b5854ae75ba8
Alex Tucker
authored
on 19 Nov 2016
Patch
Unified
Split
Showing
2 changed files
+3
-2
■
■
■
■
■
src/energenie/OnAir.py
+1
-1
■
■
■■■
src/energenie/Registry.py
Ignore Space
Show notes
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
Ignore Space
Show notes
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
):
Show line notes below