Skip to content

Commit 207d6eb

Browse files
committed
QA: Apply ruff suggestions.
1 parent 1f2df5a commit 207d6eb

File tree

6 files changed

+6
-13
lines changed

6 files changed

+6
-13
lines changed

examples/all-in-one-enviro-mini.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
from fonts.ttf import RobotoMedium as UserFont
2222
from PIL import Image, ImageDraw, ImageFont
2323

24-
from enviroplus import gas
25-
2624
logging.basicConfig(
2725
format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s',
2826
level=logging.INFO,

examples/luftdaten.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22

33
import time
4-
from subprocess import PIPE, Popen, check_output
4+
from subprocess import check_output
55

66
import requests
77
import ST7735

examples/luftdaten_combined.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import colorsys
22
import logging
3-
import sys
43
import time
54
from subprocess import PIPE, Popen, check_output
65

examples/mqtt-all.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from subprocess import PIPE, Popen, check_output
2828

2929
import paho.mqtt.client as mqtt
30-
import paho.mqtt.publish as publish
3130
from fonts.ttf import RobotoMedium as UserFont
3231
from PIL import Image, ImageDraw, ImageFont
3332

examples/weather-and-light.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
f"Sorry! This program requires Python >= 3.6 😅"
5-
64
import colorsys
75
import os
86
import time
@@ -17,7 +15,6 @@
1715
from fonts.ttf import RobotoMedium as UserFont
1816
from ltr559 import LTR559
1917
from PIL import Image, ImageDraw, ImageFilter, ImageFont
20-
from pytz import timezone
2118

2219
try:
2320
from smbus2 import SMBus

tests/test_setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def test_gas_unavailable(GPIO, mocksmbus):
1212
from enviroplus import gas
1313
mocksmbus.SMBus(1).read_i2c_block_data.side_effect = IOError("Oh noes!")
1414
gas._is_setup = False
15-
assert gas.available() == False
15+
assert gas.available() is False
1616

1717
with pytest.raises(RuntimeError):
1818
gas.read_all()
@@ -21,21 +21,21 @@ def test_gas_unavailable(GPIO, mocksmbus):
2121
def test_gas_available(GPIO, smbus_notimeout):
2222
from enviroplus import gas
2323
gas._is_setup = False
24-
assert gas.available() == True
24+
assert gas.available() is True
2525

2626

2727
def test_gas_read_all(GPIO, smbus):
2828
from enviroplus import gas
2929
gas._is_setup = False
3030
result = gas.read_all()
3131

32-
assert type(result.oxidising) == float
32+
assert isinstance(result.oxidising, float)
3333
assert int(result.oxidising) == 16641
3434

35-
assert type(result.reducing) == float
35+
assert isinstance(result.reducing, float)
3636
assert int(result.reducing) == 16727
3737

38-
assert type(result.nh3) == float
38+
assert isinstance(result.nh3, float)
3939
assert int(result.nh3) == 16813
4040

4141
assert "Oxidising" in str(result)

0 commit comments

Comments
 (0)