mirror of
https://github.com/9001/copyparty.git
synced 2025-10-03 09:49:29 +02:00
add safety profiles + improve helptext + speed
This commit is contained in:
parent
438384425a
commit
eb3fa5aa6b
5 changed files with 225 additions and 26 deletions
|
@ -3,6 +3,7 @@
|
|||
from __future__ import print_function, unicode_literals
|
||||
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
import tokenize
|
||||
|
||||
|
@ -10,6 +11,7 @@ import tokenize
|
|||
def uncomment(fpath):
|
||||
"""modified https://stackoverflow.com/a/62074206"""
|
||||
|
||||
print(".", end="", flush=True)
|
||||
with open(fpath, "rb") as f:
|
||||
orig = f.read().decode("utf-8")
|
||||
|
||||
|
@ -66,9 +68,15 @@ def uncomment(fpath):
|
|||
|
||||
def main():
|
||||
print("uncommenting", end="", flush=True)
|
||||
for f in sys.argv[1:]:
|
||||
print(".", end="", flush=True)
|
||||
uncomment(f)
|
||||
try:
|
||||
import multiprocessing as mp
|
||||
|
||||
with mp.Pool(os.cpu_count()) as pool:
|
||||
pool.map(uncomment, sys.argv[1:])
|
||||
except Exception as ex:
|
||||
print("\nnon-mp fallback due to {}\n".format(ex))
|
||||
for f in sys.argv[1:]:
|
||||
uncomment(f)
|
||||
|
||||
print("k")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue