Skip to content

Commit

Permalink
make the pre-commit happy, silence pylint when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Neradoc committed Feb 16, 2022
1 parent 8d1c63b commit 9425d46
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ persistent=yes
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no

disable=wrong-import-order,consider-using-f-string,raise-missing-from


[MESSAGES CONTROL]

Expand Down
3 changes: 3 additions & 0 deletions examples/server/README.md.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
SPDX-FileCopyrightText: Copyright (c) 2022 Neradoc
SPDX-License-Identifier: MIT
6 changes: 3 additions & 3 deletions examples/server/esp32s2_wsgiserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
print("ESP32-S2 simple web server test!")

print("Connect wifi")
wifi.radio.connect(secrets['ssid'],secrets['password'])
wifi.radio.connect(secrets["ssid"], secrets["password"])
HOST = repr(wifi.radio.ipv4_address)
PORT = 80 # Port to listen on
print(HOST,PORT)
PORT = 80 # Port to listen on
print(HOST, PORT)

# Use below for Most Boards
status_light = neopixel.NeoPixel(
Expand Down
22 changes: 12 additions & 10 deletions examples/wsgiserver_displaytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
# SPDX-License-Identifier: MIT

import board
import busio
from digitalio import DigitalInOut
import socketpool
import time
import wifi

import wsgiserver as server
from adafruit_wsgi.wsgi_app import WSGIApp
import wsgiserver as server

############################################################################
############################################################################
Expand All @@ -23,8 +19,12 @@
splash = displayio.Group()

main_label = Label(
text="Connecting...", font=terminalio.FONT, color=0xFFFFFF, scale=2,
anchored_position=(oled.width // 2, oled.height // 2), anchor_point=(0.5, 0.5),
text="Connecting...",
font=terminalio.FONT,
color=0xFFFFFF,
scale=2,
anchored_position=(oled.width // 2, oled.height // 2),
anchor_point=(0.5, 0.5),
)
splash.append(main_label)
oled.show(splash)
Expand Down Expand Up @@ -58,8 +58,9 @@

web_app = WSGIApp()


@web_app.route("/")
def led_off(request): # pylint: disable=unused-argument
def homepage(request): # pylint: disable=unused-argument
text = """
<h3>Text color</h3>
<p><a href="/led_off">White</a></p>
Expand All @@ -86,13 +87,14 @@ def led_on(request, r, g, b): # pylint: disable=unused-argument
@web_app.route("/led_off")
def led_off(request): # pylint: disable=unused-argument
print("led off!")
main_label.color = (255,255,255)
text = f"""
main_label.color = (255, 255, 255)
text = """
<p>Color is white.</p>
<p><a href="/">Go back</a></p>
"""
return ("200 OK", [], text)


############################################################################
############################################################################

Expand Down
19 changes: 14 additions & 5 deletions test/send_empty_line.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
# SPDX-FileCopyrightText: Copyright (c) 2022 Neradoc
# SPDX-License-Identifier: MIT
#
# pylint: skip-file
"""
Test sending an empty line to a server (issue #5)
"""
import click
import socket


@click.command()
@click.argument(
"address",
required=True,
"address",
required=True,
)
def main(address):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((address, 80))
s.send(b"\r\n")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((address, 80))
s.send(b"\r\n")


main()
3 changes: 0 additions & 3 deletions wsgiserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# SPDX-FileCopyrightText: Copyright (c) 2022 Neradoc
#
# SPDX-License-Identifier: MIT
#
# make pylint better
# pylint:disable=consider-using-f-string,raise-missing-from

"""
`wsgiserver`
Expand Down

0 comments on commit 9425d46

Please sign in to comment.