|
|
|
import os |
|
import sys |
|
from argparse import ArgumentParser |
|
|
|
sys.path.append(os.path.expanduser("~/.local/lib/python3.9/site-packages")) |
|
|
|
|
|
|
|
|
|
def parse_args(self, args=None, namespace=None): |
|
if args is not None: |
|
return self.parse_args_bak(args=args, namespace=namespace) |
|
try: |
|
idx = sys.argv.index("--") |
|
args = sys.argv[idx + 1:] |
|
except ValueError as e: |
|
args = [] |
|
return self.parse_args_bak(args=args, namespace=namespace) |
|
|
|
|
|
setattr(ArgumentParser, 'parse_args_bak', ArgumentParser.parse_args) |
|
setattr(ArgumentParser, 'parse_args', parse_args) |
|
|