(args=None)
| 1137 | |
| 1138 | |
| 1139 | def main(args=None): |
| 1140 | import argparse |
| 1141 | |
| 1142 | parser = argparse.ArgumentParser(color=True) |
| 1143 | parser.add_argument('-C', '--show-caches', action='store_true', |
| 1144 | help='show inline caches') |
| 1145 | parser.add_argument('-O', '--show-offsets', action='store_true', |
| 1146 | help='show instruction offsets') |
| 1147 | parser.add_argument('-P', '--show-positions', action='store_true', |
| 1148 | help='show instruction positions') |
| 1149 | parser.add_argument('-S', '--specialized', action='store_true', |
| 1150 | help='show specialized bytecode') |
| 1151 | parser.add_argument('infile', nargs='?', default='-') |
| 1152 | args = parser.parse_args(args=args) |
| 1153 | if args.infile == '-': |
| 1154 | name = '<stdin>' |
| 1155 | source = sys.stdin.buffer.read() |
| 1156 | else: |
| 1157 | name = args.infile |
| 1158 | with open(args.infile, 'rb') as infile: |
| 1159 | source = infile.read() |
| 1160 | code = compile(source, name, "exec") |
| 1161 | dis(code, show_caches=args.show_caches, adaptive=args.specialized, |
| 1162 | show_offsets=args.show_offsets, show_positions=args.show_positions) |
| 1163 | |
| 1164 | if __name__ == "__main__": |
| 1165 | main() |
no test coverage detected
searching dependent graphs…