Mercurial > touhou
comparison pytouhou/vm/common.py @ 590:e15672733c93
Switch to Python 3.x instead of 2.7.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 30 Sep 2014 17:14:24 +0200 |
parents | 69ec72b990a4 |
children |
comparison
equal
deleted
inserted
replaced
589:0768122da817 | 590:e15672733c93 |
---|---|
14 | 14 |
15 | 15 |
16 class MetaRegistry(type): | 16 class MetaRegistry(type): |
17 def __new__(mcs, name, bases, classdict): | 17 def __new__(mcs, name, bases, classdict): |
18 instruction_handlers = {} | 18 instruction_handlers = {} |
19 for item in classdict.itervalues(): | 19 for item in classdict.values(): |
20 if hasattr(item, '_instruction_ids'): | 20 if hasattr(item, '_instruction_ids'): |
21 for version, instruction_ids in item._instruction_ids.iteritems(): | 21 for version, instruction_ids in item._instruction_ids.items(): |
22 for id_ in instruction_ids: | 22 for id_ in instruction_ids: |
23 instruction_handlers.setdefault(version, {})[id_] = item | 23 instruction_handlers.setdefault(version, {})[id_] = item |
24 classdict['_handlers'] = instruction_handlers | 24 classdict['_handlers'] = instruction_handlers |
25 return type.__new__(mcs, name, bases, classdict) | 25 return type.__new__(mcs, name, bases, classdict) |
26 | 26 |