Created
February 2, 2016 09:38
-
-
Save aisk/05f9a9e39383785e8da0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ast | |
def menu(*args, **kwargs): | |
def inner(f): | |
pass | |
return inner | |
a = ast.parse(''' | |
@menu('xxx', parent='xxx') | |
class Xxx(object): | |
pass | |
''') | |
for node in ast.walk(a): | |
if type(node) == ast.ClassDef: | |
for decorator in node.decorator_list: | |
if d.func.id == 'menu': | |
# do some thing with d | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment