MCPcopy Create free account
hub / github.com/ipython/traitlets / MyApp

Class MyApp

tests/config/test_application.py:57–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56
57class MyApp(Application):
58 name = Unicode("myapp")
59 running = Bool(False, help="Is the app running?").tag(config=True)
60 classes = List([Bar, Foo]) # type:ignore
61 config_file = Unicode("", help="Load this config file").tag(config=True)
62
63 warn_tpyo = Unicode(
64 "yes the name is wrong on purpose",
65 config=True,
66 help="Should print a warning if `MyApp.warn-typo=...` command is passed",
67 )
68
69 aliases: t.Dict[t.Any, t.Any] = {}
70 aliases.update(Application.aliases)
71 aliases.update(
72 {
73 ("fooi", "i"): "Foo.i",
74 ("j", "fooj"): ("Foo.j", "`j` terse help msg"),
75 "name": "Foo.name",
76 "la": "Foo.la",
77 "li": "Foo.li",
78 "tb": "Bar.tb",
79 "D": "Bar.bdict",
80 "enabled": "Bar.enabled",
81 "enable": "Bar.enabled",
82 "log-level": "Application.log_level",
83 }
84 )
85
86 flags: t.Dict[t.Any, t.Any] = {}
87 flags.update(Application.flags)
88 flags.update(
89 {
90 ("enable", "e"): ({"Bar": {"enabled": True}}, "Set Bar.enabled to True"),
91 ("d", "disable"): ({"Bar": {"enabled": False}}, "Set Bar.enabled to False"),
92 "crit": ({"Application": {"log_level": logging.CRITICAL}}, "set level=CRITICAL"),
93 }
94 )
95
96 def init_foo(self):
97 self.foo = Foo(parent=self)
98
99 def init_bar(self):
100 self.bar = Bar(parent=self)
101
102
103def class_to_names(classes):

Callers 15

test_logMethod · 0.70
test_no_eval_cli_textMethod · 0.70
test_basicMethod · 0.70
test_mro_discoveryMethod · 0.70
test_configMethod · 0.70
test_config_seq_argsMethod · 0.70
test_config_dict_argsMethod · 0.70
test_flagsMethod · 0.70
test_flags_help_msgMethod · 0.70
test_aliasesMethod · 0.70

Calls 5

UnicodeClass · 0.90
BoolClass · 0.90
ListClass · 0.90
tagMethod · 0.80
updateMethod · 0.45

Tested by 15

test_logMethod · 0.56
test_no_eval_cli_textMethod · 0.56
test_basicMethod · 0.56
test_mro_discoveryMethod · 0.56
test_configMethod · 0.56
test_config_seq_argsMethod · 0.56
test_config_dict_argsMethod · 0.56
test_flagsMethod · 0.56
test_flags_help_msgMethod · 0.56
test_aliasesMethod · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…