Browse Source

migrate to Flask 1.1 and Python 3.8

pull/259/head
Juan Pablo Giménez 5 years ago
parent
commit
3330583903
5 changed files with 30 additions and 21 deletions
  1. +1
    -1
      Dockerfile
  2. +3
    -3
      modules/base_plugins/gpio_actor/__init__.py
  3. +2
    -2
      modules/core/core.py
  4. +1
    -1
      modules/notification/__init__.py
  5. +23
    -14
      requirements.txt

+ 1
- 1
Dockerfile View File

@@ -1,5 +1,5 @@
# Dockerfile for development on a pc/mac # Dockerfile for development on a pc/mac
FROM python:3.5
FROM python:3.8


EXPOSE 5000 EXPOSE 5000




+ 3
- 3
modules/base_plugins/gpio_actor/__init__.py View File

@@ -116,12 +116,12 @@ class DummyPWM(ActorBase):
:return: :return:
''' '''
self.power = int(power) if power is not None else 100 self.power = int(power) if power is not None else 100
print "DummyPWM ON %s" % self.power
print("DummyPWM ON %s" % self.power)


def off(self): def off(self):
self.power = 100 self.power = 100
print "OFF"
print("OFF")


def set_power(self, power): def set_power(self, power):
self.power = int(power) self.power = int(power)
print "DummyPWM POWER %s" % self.power
print("DummyPWM POWER %s" % self.power)

+ 2
- 2
modules/core/core.py View File

@@ -378,12 +378,12 @@ class CraftBeerPi(ActorAPI, SensorAPI):




# Event Bus # Event Bus
def event(self, name, async=False):
def event(self, name, use_async=False):


def real_decorator(function): def real_decorator(function):
if self.eventbus.get(name) is None: if self.eventbus.get(name) is None:
self.eventbus[name] = [] self.eventbus[name] = []
self.eventbus[name].append({"function": function, "async": async})
self.eventbus[name].append({"function": function, "async": use_async})
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
return function(*args, **kwargs) return function(*args, **kwargs)
return wrapper return wrapper


+ 1
- 1
modules/notification/__init__.py View File

@@ -24,7 +24,7 @@ class NotificationView(FlaskView):
cbpi.cache["messages"].pop(idx) cbpi.cache["messages"].pop(idx)
return ('', 204) return ('', 204)


@cbpi.event("MESSAGE", async=True)
@cbpi.event("MESSAGE", use_async=True)
def messageEvent(message, **kwargs): def messageEvent(message, **kwargs):
""" """
React on message event. add the message to the cache and push the message to the clients React on message event. add the message to the cache and push the message to the clients


+ 23
- 14
requirements.txt View File

@@ -1,14 +1,23 @@
Flask==1.0
Flask-SocketIO==2.6.2
eventlet==0.19.0
greenlet==0.4.10
python-dateutil==2.5.3
python-engineio==3.8.2.post1
python-mimeparse==1.5.2
python-socketio==1.4.4
PyYAML==4.2b1
requests==2.20.0
Werkzeug==0.15.3
httplib2==0.18.0
flask-classy==0.6.10
GitPython
attrs==19.3.0
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
coverage==5.2.1
Flask==1.1.2
Flask-Classy==0.6.10
Flask-SocketIO==2.6.2
gitdb==4.0.5
GitPython==3.1.7
greenlet==0.4.16
idna==2.10
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
python-engineio==3.8.2.post1
python-socketio==1.4.4
PyYAML==5.3.1
requests==2.24.0
six==1.15.0
smmap==3.0.4
urllib3==1.25.10
Werkzeug==1.0.1

Loading…
Cancel
Save