コード例 #1
0
    def load(path):
        """
        Call `load` to load a Python file to be compiled but not to write to .avm

        :param path: the path of the Python file to compile
        :return: The instance of the compiler

        Usage:
        The following returns the compiler object for inspection.

        .. code-block:: python

            from boa.compiler import Compiler
        
            compiler = Compiler.load('path/to/your/file.py')
        """

        Compiler.__instance = None

        compiler = Compiler.instance()

        module = Module(path)
        compiler.modules.append(module)

        return compiler
コード例 #2
0
    def build(self):
        # here is where we will check imports
        """

        """
        from boa.code.module import Module

        module = importlib.import_module(self.module_path, self.module_path)

        filename = module.__file__

        if self.NEO_SC_FRAMEWORK in self.module_path:
            self.is_system_module = True

        self.imported_module = Module(
            filename,
            module_name=self.module_path,
            is_sys_module=self.is_system_module,
            items_to_import=self.module_items_to_import)
コード例 #3
0
ファイル: compiler.py プロジェクト: wanglongfei88/neo-boa
    def load(path, use_nep8=True):
        """
        Call `load` to load a Python file to be compiled but not to write to .avm

        :param path: the path of the Python file to compile
        :return: The instance of the compiler

        The following returns the compiler object for inspection.

        .. code-block:: python

            from boa.compiler import Compiler

            compiler = Compiler.load('path/to/your/file.py')
        """

        Compiler.__instance = None

        compiler = Compiler.instance()
        compiler.nep8 = use_nep8
        compiler.entry_module = Module(path)

        return compiler