mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Fixed wrong nethash creation with Python 3
This commit is contained in:
parent
f5de59451a
commit
75f854584d
|
@ -1,6 +1,6 @@
|
|||
import hashlib, sys, re
|
||||
|
||||
alphanum = "0123456789abcdefghijklmnopqrstuvwzyxABCDEFGHIJKLMNOPQRSTUVWXYZ_"
|
||||
alphanum = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_".encode()
|
||||
|
||||
def cstrip(lines):
|
||||
d = "".encode()
|
||||
|
@ -12,15 +12,15 @@ def cstrip(lines):
|
|||
d = d.replace("\t".encode(), " ".encode()) # tab to space
|
||||
d = re.sub(" *".encode(), " ".encode(), d) # remove double spaces
|
||||
d = re.sub("".encode(), "".encode(), d) # remove /* */ comments
|
||||
|
||||
|
||||
d = d.strip()
|
||||
|
||||
|
||||
# this eats up cases like 'n {'
|
||||
i = 1
|
||||
while i < len(d)-2:
|
||||
if d[i:i + 1] == " ":
|
||||
if not (d[i-1:i] in alphanum and d[i+1:i + 2] in alphanum):
|
||||
d = d[:i] + d[i+1:]
|
||||
if d[i:i + 1] == " ".encode():
|
||||
if not (d[i - 1:i] in alphanum and d[i+1:i + 2] in alphanum):
|
||||
d = d[:i] + d[i + 1:]
|
||||
i += 1
|
||||
return d
|
||||
|
||||
|
|
Loading…
Reference in a new issue