MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / main

Function main

17-it-generator/tree/classtree/classtree.py:53–65  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

51
52
53def main(name):
54 module_name, cls_name = parse(name)
55 try:
56 cls = getattr(import_module(module_name), cls_name)
57 except ModuleNotFoundError:
58 print(f'*** Could not import {module_name!r}.')
59 except AttributeError:
60 print(f'*** {cls_name!r} not found in {module_name!r}.')
61 else:
62 if isinstance(cls, type):
63 draw(cls)
64 else:
65 print(f'*** {cls_name!r} is not a class.')
66
67
68if __name__ == '__main__':

Callers 6

test_main_simpleFunction · 0.90
test_main_dottedFunction · 0.90
test_main_not_a_classFunction · 0.90
classtree.pyFile · 0.70

Calls 2

parseFunction · 0.70
drawFunction · 0.70

Tested by 5

test_main_simpleFunction · 0.72
test_main_dottedFunction · 0.72
test_main_not_a_classFunction · 0.72