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

Function parser

tests/unit/test_discussions_cli.py:46–77  ·  view source on GitHub ↗

Build the full argument parser tree for testing argparse dispatch.

(monkeypatch, api)

Source from the content-addressed store, hash-verified

44
45@pytest.fixture
46def parser(monkeypatch, api):
47 """Build the full argument parser tree for testing argparse dispatch."""
48 import kaggle
49
50 monkeypatch.setattr(kaggle, "api", api)
51
52 from kaggle.cli import (
53 Help,
54 parse_benchmarks,
55 parse_competitions,
56 parse_datasets,
57 parse_forums,
58 parse_kernels,
59 parse_models,
60 )
61 import kaggle.cli
62
63 monkeypatch.setattr(kaggle.cli, "api", api)
64
65 root = argparse.ArgumentParser()
66 root.add_argument("-W", "--no-warn", dest="disable_version_warning", action="store_true")
67 subparsers = root.add_subparsers(title="commands", dest="command")
68 subparsers.required = True
69 subparsers.choices = Help.kaggle_choices
70
71 parse_competitions(subparsers)
72 parse_datasets(subparsers)
73 parse_kernels(subparsers)
74 parse_models(subparsers)
75 parse_benchmarks(subparsers)
76 parse_forums(subparsers)
77 return root
78
79
80def _dispatch(parser, argv):

Callers

nothing calls this directly

Calls 6

parse_competitionsFunction · 0.90
parse_datasetsFunction · 0.90
parse_kernelsFunction · 0.90
parse_modelsFunction · 0.90
parse_benchmarksFunction · 0.90
parse_forumsFunction · 0.90

Tested by

no test coverage detected