From 33305839032579cd54c57496c0ab9777e6ad2439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20Gim=C3=A9nez?= Date: Mon, 3 Aug 2020 19:32:43 -0300 Subject: [PATCH] migrate to Flask 1.1 and Python 3.8 --- Dockerfile | 2 +- modules/base_plugins/gpio_actor/__init__.py | 6 ++-- modules/core/core.py | 4 +-- modules/notification/__init__.py | 2 +- requirements.txt | 37 +++++++++++++-------- 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index 455b74c..dd18886 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Dockerfile for development on a pc/mac -FROM python:3.5 +FROM python:3.8 EXPOSE 5000 diff --git a/modules/base_plugins/gpio_actor/__init__.py b/modules/base_plugins/gpio_actor/__init__.py index cedf43f..e7726b4 100644 --- a/modules/base_plugins/gpio_actor/__init__.py +++ b/modules/base_plugins/gpio_actor/__init__.py @@ -116,12 +116,12 @@ class DummyPWM(ActorBase): :return: ''' 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): self.power = 100 - print "OFF" + print("OFF") def set_power(self, power): self.power = int(power) - print "DummyPWM POWER %s" % self.power + print("DummyPWM POWER %s" % self.power) diff --git a/modules/core/core.py b/modules/core/core.py index 66fb0e0..479c61f 100644 --- a/modules/core/core.py +++ b/modules/core/core.py @@ -378,12 +378,12 @@ class CraftBeerPi(ActorAPI, SensorAPI): # Event Bus - def event(self, name, async=False): + def event(self, name, use_async=False): def real_decorator(function): if self.eventbus.get(name) is None: self.eventbus[name] = [] - self.eventbus[name].append({"function": function, "async": async}) + self.eventbus[name].append({"function": function, "async": use_async}) def wrapper(*args, **kwargs): return function(*args, **kwargs) return wrapper diff --git a/modules/notification/__init__.py b/modules/notification/__init__.py index 2f440cb..97e06ec 100644 --- a/modules/notification/__init__.py +++ b/modules/notification/__init__.py @@ -24,7 +24,7 @@ class NotificationView(FlaskView): cbpi.cache["messages"].pop(idx) return ('', 204) -@cbpi.event("MESSAGE", async=True) +@cbpi.event("MESSAGE", use_async=True) def messageEvent(message, **kwargs): """ React on message event. add the message to the cache and push the message to the clients diff --git a/requirements.txt b/requirements.txt index f28fffb..91b52cf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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