Apparently forgot how docstrings worked

This commit is contained in:
Alve Svarén committed 2020-10-09 18:53:50 +02:00
1 parent f8c17bb20d
commit ba31b7241c
1 file changed
+7 -2
+7 -2
View File
@@ -3,10 +3,12 @@ from sys import argv
# Currently the only possible value # Currently the only possible value
SERVER_SUFFIX = "-Master-1" SERVER_SUFFIX = "-Master-1"
def gen_file(region_name: str, ip_address: str = "127.0.0.1", port: int = 22023) -> bytearray:
""" """
Generates the bytearray with the specified values Generates the bytearray with the specified values
""" """
def gen_file(region_name: str, ip_address: str = "127.0.0.1", port: int = 22023) -> bytearray:
# Make sure all variables are within the correct length range # Make sure all variables are within the correct length range
if (len(region_name + SERVER_SUFFIX) > 0xff): if (len(region_name + SERVER_SUFFIX) > 0xff):
raise ValueError("Region name too long") raise ValueError("Region name too long")
@@ -39,6 +41,8 @@ def gen_file(region_name: str, ip_address: str = "127.0.0.1", port: int = 22023)
return data return data
def write_file(region_name: str, ip_address: str = "127.0.0.1", file_name: str = "regionInfo.dat", port: int = 22023):
""" """
Creates and writes the among us regionInfo.dat file Creates and writes the among us regionInfo.dat file
Example: Example:
@@ -51,12 +55,13 @@ except Exception as error:
``` ```
Port should currently always be 22023 for it to work Port should currently always be 22023 for it to work
""" """
def write_file(region_name: str, ip_address: str = "127.0.0.1", file_name: str = "regionInfo.dat", port: int = 22023):
# Generate the file and save to the specified file_name # Generate the file and save to the specified file_name
data = gen_file(region_name, ip_address, port) data = gen_file(region_name, ip_address, port)
with open(file_name, "wb") as file: with open(file_name, "wb") as file:
file.write(data) file.write(data)
if __name__ == "__main__": if __name__ == "__main__":
print(f"Creating file using {argv[1:]}") print(f"Creating file using {argv[1:]}")
write_file(*argv[1:]) write_file(*argv[1:])