import argparse import ast import builtins import collections import contextlib import os import re import time import types from typing import Dict, FrozenSet, TextIO, Tuple import umarshal from generate_global_objects import get_identifiers_and_strings verbose = False identifiers, strings = get_identifiers_and_strings() def isprintable(b: bytes) -> bool: return all(0x20 <= c < 0x7f for c in b) def make_string_literal(b: bytes) -> str: res = ['"'] if isprintable(b): res.append( b.decode("ascii").replace("\\", "\\\\").replace("\"", "\\\"")) else: for i in b: res.append(f"\\x{i:02x}") res.append('"')
import argparse import ast import builtins import collections import contextlib import os import re import time import types from typing import Dict, FrozenSet, TextIO, Tuple import umarshal from generate_global_objects import get_identifiers_and_strings verbose = False identifiers = get_identifiers_and_strings()[0] def isprintable(b: bytes) -> bool: return all(0x20 <= c < 0x7f for c in b) def make_string_literal(b: bytes) -> str: res = ['"'] if isprintable(b): res.append( b.decode("ascii").replace("\\", "\\\\").replace("\"", "\\\"")) else: for i in b: res.append(f"\\x{i:02x}") res.append('"')