File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -217,25 +217,20 @@ def to_string(kind: 'KIND'):
217217 return kind .value
218218
219219
220- class CONVENTION :
221- unknown = None
220+ @enum .unique
221+ class CONVENTION (str , enum .Enum ):
222+ unknown = 'unknown'
222223 fastcall = '__fastcall__'
223224 stdcall = '__stdcall__'
224225
225- _NAMES = {
226- unknown : '(unknown)' ,
227- fastcall : '__fastcall__' ,
228- stdcall : '__stdcall__'
229- }
230-
231- @classmethod
232- def is_valid (cls , convention ):
233- return cls ._NAMES .get (convention , None ) is not None
226+ @staticmethod
227+ def is_valid (convention : Union [str , 'CONVENTION' ]):
228+ return convention in set (CONVENTION )
234229
235- @classmethod
236- def to_string (cls , convention ):
237- assert cls .is_valid (convention )
238- return cls . _NAMES [ convention ]
230+ @staticmethod
231+ def to_string (convention : 'CONVENTION' ):
232+ assert CONVENTION .is_valid (convention )
233+ return convention . value
239234
240235
241236# ----------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments