Skip to content

Commit

Permalink
DROP --stdout-log-file OPTION
Browse files Browse the repository at this point in the history
  • Loading branch information
yzqzss committed Apr 16, 2024
1 parent ca667c4 commit 559bcdc
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
4 changes: 0 additions & 4 deletions wikiteam3/dumpgenerator/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ def getArgumentParser():
parser.add_argument(
"--verbose", action="store_true", help=""
)
parser.add_argument(
"--stdout-log-file", dest="stdout_log_path", default=None, help="Path to copy stdout to",
)
parser.add_argument(
"--api_chunksize", metavar="50", default=50, help="Chunk size for MediaWiki API (arvlimit, ailimit, etc.)"
)
Expand Down Expand Up @@ -542,7 +539,6 @@ def sleep(self, response=None):
resume = args.resume,
force = args.force,
session = session,
stdout_log_path = args.stdout_log_path,
bypass_cdn_image_compression = args.bypass_cdn_image_compression,
add_referer_header = args.add_referer_header,
image_timestamp_interval = args.image_timestamp_interval,
Expand Down
1 change: 0 additions & 1 deletion wikiteam3/dumpgenerator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class OtherConfig:
resume: bool
force: bool
session: requests.Session
stdout_log_path: Optional[str]
bypass_cdn_image_compression: bool
add_referer_header: Optional[str]
'''None, "auto", {URL}'''
Expand Down
24 changes: 1 addition & 23 deletions wikiteam3/dumpgenerator/dump/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,6 @@
from wikiteam3.utils.ia_checker import any_recent_ia_item_exists
from wikiteam3.utils.util import ALL_DUMPED_MARK, int_or_zero, mark_as_done, underscore

# From https://stackoverflow.com/a/57008707
class Tee(object):
def __init__(self, filename):
self.file = open(filename, 'w', encoding="utf-8")
self.stdout = sys.stdout

def __enter__(self):
sys.stdout = self

def __exit__(self, exc_type, exc_value, tb):
sys.stdout = self.stdout
if exc_type is not None:
self.file.write(traceback.format_exc())
self.file.close()

def write(self, data):
self.file.write(data)
self.stdout.write(data)

def flush(self):
self.file.flush()
self.stdout.flush()

class DumpGenerator:
configfilename = "config.json"
Expand All @@ -56,7 +34,7 @@ def __init__(params=None):
config, other = get_parameters(params=params)
avoid_WikiMedia_projects(config=config, other=other)

with (Tee(other.stdout_log_path) if other.stdout_log_path else contextlib.nullcontext()):
with contextlib.nullcontext():
print(welcome())
print("Analysing %s" % (config.api if config.api else config.index))

Expand Down

0 comments on commit 559bcdc

Please sign in to comment.