black-formatting

This commit is contained in:
Sander Jonkers 2021-01-08 13:21:45 +01:00 committed by Thomas Bernard
parent 207d1849e4
commit f1ba1a6adb
1 changed files with 10 additions and 2 deletions

View File

@ -4,6 +4,7 @@
# Python 3 : code sample # Python 3 : code sample
import socket import socket
def codelength(s): def codelength(s):
l = len(s) l = len(s)
if l == 0: if l == 0:
@ -15,7 +16,8 @@ def codelength(s):
encodedlen = c.to_bytes(1, 'little') + encodedlen encodedlen = c.to_bytes(1, 'little') + encodedlen
return encodedlen + s return encodedlen + s
def SubmitServicesToMiniSSDPD(st, usn, server, url, sockpath = "/var/run/minissdpd.sock"):
def SubmitServicesToMiniSSDPD(st, usn, server, url, sockpath="/var/run/minissdpd.sock"):
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try: try:
sock.connect(sockpath) sock.connect(sockpath)
@ -27,4 +29,10 @@ def SubmitServicesToMiniSSDPD(st, usn, server, url, sockpath = "/var/run/minissd
sock.close() sock.close()
return 0 return 0
SubmitServicesToMiniSSDPD(b'urn:schemas-upnp-org:device:InternetGatewayDevice:1', b'uuid:73616d61-6a6b-7a74-650a-0d24d4a5d636::urn:schemas-upnp-org:device:InternetGatewayDevice:1', b'MyServer/0.0', b'http://192.168.0.1:1234/rootDesc.xml')
SubmitServicesToMiniSSDPD(
b'urn:schemas-upnp-org:device:InternetGatewayDevice:1',
b'uuid:73616d61-6a6b-7a74-650a-0d24d4a5d636::urn:schemas-upnp-org:device:InternetGatewayDevice:1',
b'MyServer/0.0',
b'http://192.168.0.1:1234/rootDesc.xml',
)