Git Product home page Git Product logo

rigel's Introduction


๐Ÿช Rigel - WIP

Python bytecode manipulation library and analysis framework.

Build Status Codecov License Python Version Linting


Example

import dis

from rigel import dump, make_code_object


def main():
    code_object = make_code_object(
        instructions=[
            dis.Instruction(opname='LOAD_NAME', opcode=101, arg=0, argval='print', argrepr='print', offset=0, starts_line=1, is_jump_target=False),
            dis.Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval='string 1', argrepr="'string 1'", offset=2, starts_line=None, is_jump_target=False),
            dis.Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=4, starts_line=None, is_jump_target=False),
            dis.Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=6, starts_line=None, is_jump_target=False),
            dis.Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=None, argrepr='None', offset=8, starts_line=None, is_jump_target=False),
            dis.Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=10, starts_line=None, is_jump_target=False),
        ]
    )
    
    with open('filename.pyc', 'wb') as fp:
        dump(code_object, fp, version=(3, 10))


if __name__ == '__main__':
    main()

Supported Python

  • 3.9
  • 3.10
  • 3.11

rigel's People

Contributors

prvrss avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.