MCPcopy Index your code
hub / github.com/python/cpython / get_group

Method get_group

Tools/c-analyzer/c_parser/info.py:77–97  ·  view source on GitHub ↗
(cls, kind, *, groups=None)

Source from the content-addressed store, hash-verified

75
76 @classonly
77 def get_group(cls, kind, *, groups=None):
78 if not isinstance(kind, cls):
79 raise TypeError(f'expected KIND, got {kind!r}')
80 if groups is None:
81 groups = ['type']
82 elif not groups:
83 groups = ()
84 elif isinstance(groups, str):
85 group = groups
86 if group not in cls._GROUPS:
87 raise ValueError(f'unsupported group {group!r}')
88 groups = [group]
89 else:
90 unsupported = [g for g in groups if g not in cls._GROUPS]
91 if unsupported:
92 raise ValueError(f'unsupported groups {", ".join(repr(unsupported))}')
93 for group in groups:
94 if kind in cls._GROUPS[group]:
95 return group
96 else:
97 return kind.value
98
99 @classonly
100 def resolve_group(cls, group):

Callers 2

get_kind_groupFunction · 0.80
group_by_kindsFunction · 0.80

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected