• Xavier Thompson's avatar
    Implement import hook to transform modules on load · c6d14bd0
    Xavier Thompson authored
    Apply an arbitrary transformation to module source code at load time
    before compiling it to bytecode and executing it, of the form:
    
      transform(source : str, name : str, filename : str) -> str | AST
    
    The result is passed to builtin compile() function wich accepts both
    str and AST objects.
    c6d14bd0
sample.py 46 Bytes