MCPcopy
hub / github.com/Kaggle/kaggle-cli / main

Function main

src/kaggle/cli.py:35–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33
34
35def main() -> None:
36 parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
37
38 parser.add_argument(
39 "-v",
40 "--version",
41 action="version",
42 help="Print the Kaggle CLI version",
43 version="Kaggle CLI " + kaggle.__version__,
44 )
45 parser.add_argument(
46 "-W",
47 "--no-warn",
48 dest="disable_version_warning",
49 action="store_true",
50 help="Disable out-of-date API version warning",
51 )
52
53 subparsers = parser.add_subparsers(title="commands", help=Help.kaggle, dest="command")
54 subparsers.required = True
55 subparsers.choices = Help.kaggle_choices # type: ignore[assignment]
56 parse_competitions(subparsers)
57 parse_datasets(subparsers)
58 parse_kernels(subparsers)
59 parse_models(subparsers)
60 parse_files(subparsers)
61 parse_forums(subparsers)
62 parse_benchmarks(subparsers)
63 parse_config(subparsers)
64 parse_auth(subparsers)
65 parse_quota(subparsers)
66 args = parser.parse_args()
67 command_args = {}
68 command_args.update(vars(args))
69 del command_args["func"]
70 del command_args["command"]
71 if command_args["disable_version_warning"]:
72 KaggleApi.already_printed_version_warning = True
73 del command_args["disable_version_warning"]
74 error = False
75 try:
76 out = args.func(**command_args)
77 except HTTPError as e:
78 if e.response is not None and e.response.status_code == 401:
79 print_auth_help()
80 else:
81 print(e, file=sys.stderr)
82 out = None
83 error = True
84 except ApiException as e:
85 print(e, file=sys.stderr)
86 out = None
87 error = True
88 except ValueError as e:
89 print(e, file=sys.stderr)
90 out = None
91 error = True
92 except KeyboardInterrupt:

Callers 2

__main__.pyFile · 0.90
cli.pyFile · 0.85

Calls 11

print_auth_helpFunction · 0.90
parse_competitionsFunction · 0.85
parse_datasetsFunction · 0.85
parse_kernelsFunction · 0.85
parse_modelsFunction · 0.85
parse_filesFunction · 0.85
parse_forumsFunction · 0.85
parse_benchmarksFunction · 0.85
parse_configFunction · 0.85
parse_authFunction · 0.85
parse_quotaFunction · 0.85

Tested by

no test coverage detected