Skip to content

Commit c2d2759

Browse files
author
Jim Bennett
committed
Removing libxml dependency and fixing dns issue
1 parent d15869d commit c2d2759

File tree

20 files changed

+704
-484
lines changed

20 files changed

+704
-484
lines changed

.devcontainer/devcontainer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
// Add the IDs of extensions you want installed when the container is created.
3939
"extensions": [
4040
"ms-python.python",
41-
"ms-python.vscode-pylance"
41+
"ms-python.vscode-pylance",
42+
"github.copilot"
4243
]
4344
}
4445
},

README.md

-20
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,6 @@ This project is seriously under construction! Please let me know if you want to
3131

3232
## Installing and running the app
3333

34-
* **Windows only**
35-
36-
On Windows you will need to manually download and install the wheel for libxml2.
37-
38-
From the [Unofficial Windows Binaries for Python Extension Packages page](https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml) download lxml 4.9 for your version of Python and OS version. For example, if you are using 64-bit Windows with Python 3.11, download `lxml‑4.9.0‑cp311‑cp311‑win_amd64.whl`.
39-
40-
Install this using `pip`:
41-
42-
```bash
43-
pip install <path to download>\<file name>
44-
```
45-
46-
For example, if you are using 64-bit Windows with Python 3.11 and downloaded it to `c:\temp`, you would run:
47-
48-
```bash
49-
pip install c:\temp\lxml‑4.9.0‑cp311‑cp311‑win_amd64.whl
50-
```
51-
52-
You do not need to do this step if you are on Linux or macOS.
53-
5434
* Install the CounterFit app:
5535

5636
```sh

counterfit-app/requirements.txt

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
flask
2-
flask-socketio
3-
eventlet
4-
setuptools
5-
twine
6-
wheel
7-
pytest
8-
pytest-runner
9-
beautifulsoup4
10-
lxml
1+
flask=2.1.2
2+
flask-socketio=5.2.0
3+
eventlet=0.33.3
4+
setuptools=65.5.0
5+
twine=4.0.2
6+
wheel=0.38.4
7+
pytest=7.2.2
8+
pytest-runner=6.0.0

counterfit-app/setup.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
install_requires=[
66
"Flask==2.1.2",
77
"Flask-SocketIO==5.2.0",
8-
"eventlet==0.33.1",
9-
"beautifulsoup4==4.9.3",
10-
"lxml==4.9.0"
8+
"eventlet==0.33.3"
119
],
12-
tests_require=['pytest==4.4.1'],
10+
tests_require=['pytest==7.2.2'],
1311
test_suite='tests',
1412
)

counterfit-app/src/CounterFit/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
from CounterFit.i2c_sensors import *
77
from CounterFit.actuators import *
88

9-
__version__ = "0.1.4.dev07"
9+
__version__ = "0.1.4.dev09"

counterfit-app/src/CounterFit/actuators.py

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
from abc import ABC, abstractmethod
22
from enum import Enum
33

4+
45
class ActuatorType(Enum):
56
FLOAT = 1
67
BOOLEAN = 2
78

9+
810
class ActuatorBase(ABC):
9-
def __init__(self, port:str):
11+
def __init__(self, port: str):
1012
self.__port = port
11-
13+
1214
@staticmethod
1315
@abstractmethod
1416
def actuator_name() -> str:
@@ -24,13 +26,13 @@ def port(self) -> str:
2426
return self.__port
2527

2628
@property
27-
#pylint: disable=invalid-name
29+
# pylint: disable=invalid-name
2830
def id(self) -> str:
2931
return self.__port
3032

31-
class FloatActuatorBase(ActuatorBase):
32-
def __init__(self, port:str):
3333

34+
class FloatActuatorBase(ActuatorBase):
35+
def __init__(self, port: str):
3436
super().__init__(port)
3537
self.__value = 0
3638

@@ -51,9 +53,9 @@ def value(self) -> float:
5153
def value(self, val: float):
5254
self.__value = val
5355

54-
class BooleanActuatorBase(ActuatorBase):
55-
def __init__(self, port:str):
5656

57+
class BooleanActuatorBase(ActuatorBase):
58+
def __init__(self, port: str):
5759
super().__init__(port)
5860

5961
self.__value = False
@@ -75,20 +77,22 @@ def value(self) -> bool:
7577
def value(self, val: bool):
7678
self.__value = val
7779

80+
7881
class RelayActuator(BooleanActuatorBase):
7982
@staticmethod
8083
def actuator_name() -> str:
81-
return 'Relay'
84+
return "Relay"
85+
8286

8387
class LedActuator(BooleanActuatorBase):
84-
def __init__(self, port:str):
88+
def __init__(self, port: str):
8589
super().__init__(port)
8690
self.__color = "#FF0000"
8791

8892
@staticmethod
8993
def actuator_name() -> str:
90-
return 'LED'
91-
94+
return "LED"
95+
9296
@property
9397
def color(self) -> str:
9498
return self.__color

counterfit-app/src/CounterFit/binary_sensors.py

+13-10
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
from CounterFit.sensors import SensorBase, SensorType
66

7+
78
class BinarySensorBase(SensorBase):
8-
def __init__(self, name:str):
9+
def __init__(self, name: str):
910
super().__init__(name)
1011
self.__value = io.BytesIO()
1112
self._next_repeat_time = None
1213
self._value_position = 0
13-
14+
1415
@staticmethod
1516
def sensor_type() -> SensorType:
1617
return SensorType.BINARY
@@ -22,30 +23,32 @@ def sensor_name() -> str:
2223

2324
@property
2425
def id(self) -> str:
25-
return self.port.replace('/', '').replace(' ', '')
26+
return self.port.replace("/", "").replace(" ", "")
2627

2728
@property
2829
def value(self) -> io.BytesIO:
2930
return self.__value
30-
31+
3132
@value.setter
32-
def value(self, val:io.BytesIO):
33+
def value(self, val: io.BytesIO):
3334
self.__value = val
3435

36+
3537
class CameraImageSource(Enum):
3638
FILE = 1
3739
WEBCAM = 2
3840

41+
3942
class CameraSensor(BinarySensorBase):
40-
def __init__(self, name:str):
43+
def __init__(self, name: str):
4144
super().__init__(name)
4245
self.__image_source = CameraImageSource.FILE
43-
self.__image_file_name = ''
44-
self.__web_cam_device_id = ''
45-
46+
self.__image_file_name = ""
47+
self.__web_cam_device_id = ""
48+
4649
@staticmethod
4750
def sensor_name() -> str:
48-
return 'Camera'
51+
return "Camera"
4952

5053
@property
5154
def image_source(self) -> CameraImageSource:

0 commit comments

Comments
 (0)