# Path: ayrton/castt.py
#     class NameConstant (_ast.Name):
# class CrazyASTTransformer (ast.NodeTransformer):
#         def __init__ (self, value, *args):
# def append_to_tuple (t, o):
# def pop_from_tuple (t, n=-1):
# def is_executable (node):
# def is_option (arg):
# def has_keyword (node, keyword):
# def update_keyword (node, keyword):
# def func_name2dotted_exec (node):
#     def __init__ (self, environ, file_name=None):
#     def modify (self, tree):
#     def bind (self, o):
#     def unbind (self, name, remove_from_stack=False):
#     def visit_Import (self, node):
#     def visit_ClassDef (self, node):
#     def visit_FunctionDef (self, node):
#     def visit_For (self, node):
#     def visit_ExceptHandler (self, node):
#     def visit_Assign (self, node):
#     def visit_Delete (self, node):
#     def visit_BinOp (self, node):
#     def visit_Compare (self, node):
#     def visit_Call (self, node):
#     def visit_With (self, node):
# 
# Path: ayrton/execute.py
# class o (object):
#     def __init__ (self, **kwargs):
#         option= list (kwargs.items ())[0]
#         self.key=   option[0]
#         self.value= option[1]
# 
# Path: ayrton/functions.py
# class cd (object):
#     def __init__ (self, dir):
#         self.old_dir= os.getcwd ()
#         os.chdir (dir)
# 
#     def __enter__ (self):
#         pass
# 
#     def __exit__ (self, *args):
#         os.chdir (self.old_dir)
# 
# def define(*varnames, **defaults):
#     # defaults have priority over simple names (because they provide a value)
#     for varname in varnames:
#         if varname not in defaults:
#             defaults[varname] = None
# 
#     for varname, value in defaults.items():
#         if not isinstance(varname, str):
#             raise ValueError('variable name cannot be non-string: %r' % varname)
# 
#         if varname not in ayrton.runner.globals:
#             ayrton.runner.globals[varname] = value


import unittest
import ast
import ayrton
from ast import Attribute, Name, Load, Subscript, Index, Num, With, Str
from ast import Break, Continue, Return, Raise, Yield
from ast import Del, Pass, Import, ImportFrom, Global, Assert
from ayrton import castt
from ayrton.execute import o
from ayrton.functions import cd, define
# ayrton is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ayrton is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ayrton.  If not, see <http://www.gnu.org/licenses/>.



flow_stmt= [ Break, Continue, Return, Raise, Yield, ]
expr_stmt= [  ]
small_stmt= expr_stmt + [ Del, Pass ] + flow_stmt + [ Import, ImportFrom, Global,
            Assert ]

def check_attrs (self, node):
    for n in ast.walk (node):
        if type (n) in small_stmt:
            self.assertTrue (hasattr(node, 'lineno'), "%s.lineno not present" % ast.dump (node))
            self.assertTrue (hasattr(node, 'col_offset'), "%s.col_offset not present" % ast.dump (node))


class TestBinding (unittest.TestCase):

    def setUp (self):

# Path: ayrton/castt.py
#     class NameConstant (_ast.Name):
# class CrazyASTTransformer (ast.NodeTransformer):
#         def __init__ (self, value, *args):
# def append_to_tuple (t, o):
# def pop_from_tuple (t, n=-1):
# def is_executable (node):
# def is_option (arg):
# def has_keyword (node, keyword):
# def update_keyword (node, keyword):
# def func_name2dotted_exec (node):
#     def __init__ (self, environ, file_name=None):
#     def modify (self, tree):
#     def bind (self, o):
#     def unbind (self, name, remove_from_stack=False):
#     def visit_Import (self, node):
#     def visit_ClassDef (self, node):
#     def visit_FunctionDef (self, node):
#     def visit_For (self, node):
#     def visit_ExceptHandler (self, node):
#     def visit_Assign (self, node):
#     def visit_Delete (self, node):
#     def visit_BinOp (self, node):
#     def visit_Compare (self, node):
#     def visit_Call (self, node):
#     def visit_With (self, node):
# 
# Path: ayrton/execute.py
# class o (object):
#     def __init__ (self, **kwargs):
#         option= list (kwargs.items ())[0]
#         self.key=   option[0]
#         self.value= option[1]
# 
# Path: ayrton/functions.py
# class cd (object):
#     def __init__ (self, dir):
#         self.old_dir= os.getcwd ()
#         os.chdir (dir)
# 
#     def __enter__ (self):
#         pass
# 
#     def __exit__ (self, *args):
#         os.chdir (self.old_dir)
# 
# def define(*varnames, **defaults):
#     # defaults have priority over simple names (because they provide a value)
#     for varname in varnames:
#         if varname not in defaults:
#             defaults[varname] = None
# 
#     for varname, value in defaults.items():
#         if not isinstance(varname, str):
#             raise ValueError('variable name cannot be non-string: %r' % varname)
# 
#         if varname not in ayrton.runner.globals:
#             ayrton.runner.globals[varname] = value


# Path: ayrton/tests/test_castt.py
import unittest
import ast
import ayrton
from ast import Attribute, Name, Load, Subscript, Index, Num, With, Str
from ast import Break, Continue, Return, Raise, Yield
from ast import Del, Pass, Import, ImportFrom, Global, Assert
from ayrton import castt
from ayrton.execute import o
from ayrton.functions import cd, define

# ayrton is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ayrton is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ayrton.  If not, see <http://www.gnu.org/licenses/>.



flow_stmt= [ Break, Continue, Return, Raise, Yield, ]
expr_stmt= [  ]
small_stmt= expr_stmt + [ Del, Pass ] + flow_stmt + [ Import, ImportFrom, Global,
            Assert ]

def check_attrs (self, node):
    for n in ast.walk (node):
        if type (n) in small_stmt:
            self.assertTrue (hasattr(node, 'lineno'), "%s.lineno not present" % ast.dump (node))
            self.assertTrue (hasattr(node, 'col_offset'), "%s.col_offset not present" % ast.dump (node))


class TestBinding (unittest.TestCase):

    def setUp (self):

        self.c= castt.CrazyASTTransformer ({})