mirror of
https://github.com/freedoom/freedoom.git
synced 2025-09-01 13:25:46 -04:00
Blacken all Python files
Using the black code reformatter, pass it over all our Python files. This allows for a consistent style across the code base. Exception: lumps/dmxgus/stats.py, for readability.
This commit is contained in:
parent
6b486b6332
commit
4701d8f351
30 changed files with 2528 additions and 2102 deletions
|
@ -4,29 +4,36 @@ from __future__ import print_function
|
|||
import sys
|
||||
import struct
|
||||
|
||||
|
||||
def read():
|
||||
try:
|
||||
return sys.stdin.buffer.read()
|
||||
except AttributeError:
|
||||
return sys.stdin.read()
|
||||
|
||||
|
||||
def write(out):
|
||||
try:
|
||||
sys.stdout.buffer.write(out)
|
||||
except AttributeError:
|
||||
sys.stdout.write(out)
|
||||
|
||||
|
||||
def main():
|
||||
# read PLAYPAL from stdin, write minimal doom2.wad to stdout
|
||||
if sys.stdin.isatty():
|
||||
print("Usage: %s < playpal.lmp > doom2.wad" % sys.argv[0],
|
||||
file=sys.stderr)
|
||||
print(
|
||||
"Usage: %s < playpal.lmp > doom2.wad" % sys.argv[0],
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
# three lumps needed - see bootstrap/README.txt
|
||||
lumps = [(b'PLAYPAL', read()),
|
||||
(b'TEXTURE1', struct.pack("i", 0)), # empty texture1
|
||||
(b'PNAMES', struct.pack("i8s", 1, b''))] # single pname
|
||||
lumps = [
|
||||
(b"PLAYPAL", read()),
|
||||
(b"TEXTURE1", struct.pack("i", 0)), # empty texture1
|
||||
(b"PNAMES", struct.pack("i8s", 1, b"")),
|
||||
] # single pname
|
||||
|
||||
# calculate wad directory (lump offsets etc.)
|
||||
pos = 12
|
||||
|
@ -36,7 +43,7 @@ def main():
|
|||
pos += len(data)
|
||||
|
||||
# write wad header
|
||||
write(struct.pack("4sii", b'IWAD', len(waddir), pos))
|
||||
write(struct.pack("4sii", b"IWAD", len(waddir), pos))
|
||||
|
||||
# write lump contents
|
||||
for name, data in lumps:
|
||||
|
@ -46,4 +53,6 @@ def main():
|
|||
for i in waddir:
|
||||
write(struct.pack("ii8s", *i))
|
||||
|
||||
if __name__ == "__main__": main()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue