Skip to content

Commit

Permalink
minor refactor: exnamespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
yzqzss committed Dec 4, 2024
1 parent 03cd7af commit 2af8803
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions wikiteam3/dumpgenerator/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,19 +501,13 @@ def sleep(self, response=None):

# Process namespace exclusions
if args.exnamespaces:
# if re.search(r"[^\d, \-]", args.exnamespaces):
if any([not i.isdigit() for i in args.exnamespaces.split(",")]):
try:
exnamespaces = [int(i) for i in ns.split(",")]
except ValueError:
print(
"Invalid namespace values.\nValid format is integer(s) separated by commas"
)
sys.exit(1)
else:
ns = args.exnamespaces.replace(" ", "")
if ns.lower() == "all":
print("You cannot exclude all namespaces.")
sys.exit(1)
else:
exnamespaces = [int(i) for i in ns.split(",")]


config = Config(
Expand Down

0 comments on commit 2af8803

Please sign in to comment.