當前位置: 首頁>>代碼示例>>Python>>正文


Python msgpack.version方法代碼示例

本文整理匯總了Python中msgpack.version方法的典型用法代碼示例。如果您正苦於以下問題:Python msgpack.version方法的具體用法?Python msgpack.version怎麽用?Python msgpack.version使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在msgpack的用法示例。


在下文中一共展示了msgpack.version方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __load_symbols

# 需要導入模塊: import msgpack [as 別名]
# 或者: from msgpack import version [as 別名]
def __load_symbols(self, data):
        self.symbols = data["symbols"]

        if self.version >= 1.9:
            self.demangled = data["demangled"]

            for name, ad in self.demangled.items():
                self.reverse_demangled[ad] = name

        if self.version <= 1.4 and self.version != -1:
            for name, a in self.symbols.items():
                self.reverse_symbols[a[0]] = name
                self.symbols[name] = a[0]
                self.mem.add(a[0], 1, a[1])
            return

        for name, ad in self.symbols.items():
            self.reverse_symbols[ad] = name
            self.symbols[name] = ad 
開發者ID:plasma-disassembler,項目名稱:plasma,代碼行數:21,代碼來源:database.py

示例2: items_to_csv

# 需要導入模塊: import msgpack [as 別名]
# 或者: from msgpack import version [as 別名]
def items_to_csv(source, output):
    struct_fmt = 'IIII'
    struct_len = struct.calcsize(struct_fmt)
    struct_unpack = struct.Struct(struct_fmt).unpack_from

    writer = csv.writer(output)
    writer.writerow(("item_id", "coverage_id", "model_data", "group_id"))

    while True:
        data = source.read(struct_len)
        if not data:
            break
        item_id, coverage_id, group_id, model_data_len = struct_unpack(data)

        # https://github.com/msgpack/msgpack-python#major-breaking-changes-in-msgpack-10
        if msgpack.version >= (1,0,0):
            model_data = msgpack.unpackb(source.read(model_data_len), raw=False)
            writer.writerow((item_id, coverage_id, model_data, group_id))
        else:
            model_data = msgpack.unpackb(source.read(model_data_len))
            writer.writerow((item_id, coverage_id, model_data.decode('utf-8'), group_id)) 
開發者ID:OasisLMF,項目名稱:OasisLMF,代碼行數:23,代碼來源:complex_items_to_csv.py

示例3: __init__

# 需要導入模塊: import msgpack [as 別名]
# 或者: from msgpack import version [as 別名]
def __init__(self):
        self.__init_vars()

        if msgpack.version < (0, 4, 6):
            warning("your version of msgpack is less than 0.4.6") 
開發者ID:plasma-disassembler,項目名稱:plasma,代碼行數:7,代碼來源:database.py

示例4: __init_vars

# 需要導入模塊: import msgpack [as 別名]
# 或者: from msgpack import version [as 別名]
def __init_vars(self):
        self.history = []
        self.symbols = {} # name -> addr
        self.demangled = {} # name -> addr
        self.user_inline_comments = {}
        self.internal_inline_comments = {}
        self.user_previous_comments = {}
        self.internal_previous_comments = {}
        self.jmptables = {}
        self.mips_gp = 0
        self.modified = False
        self.loaded = False
        self.mem = None # see lib.memory
        # func address ->
        #  [ end addr,
        #    flags,
        #    dict vars_off -> [type, name],
        #    func_id,
        #    dict inst.address -> vars_off,
        #    frame_size,
        #    args_restore,
        #  ]
        self.functions = {}
        self.func_id = {} # id -> func address
        self.xrefs = {} # addr -> list addr
        # For big data (arrays/strings) we save all addresses with an xrefs
        self.data_sub_xrefs = {} # data_address -> {addresses_with_xrefs: True}
        self.imports = {} # ad -> flags
        self.immediates = {} # insn_ad -> immediate result
        self.inverted_cond = {} # addr -> arbitrary_value

        self.raw_base = 0
        self.raw_type = None
        self.raw_is_big_endian = None

        # Computed variables
        self.func_id_counter = 0
        self.end_functions = {}
        self.reverse_symbols = {} # addr -> name
        self.reverse_demangled = {} # addr -> name
        self.version = VERSION 
開發者ID:plasma-disassembler,項目名稱:plasma,代碼行數:43,代碼來源:database.py

示例5: load

# 需要導入模塊: import msgpack [as 別名]
# 或者: from msgpack import version [as 別名]
def load(self, filename):
        gc.disable()

        self.path = filename

        if os.path.exists(self.path):
            info("open database %s" % self.path)

            fd = open(self.path, "rb")

            data = fd.read()
            if data.startswith(b"ZLIB"):
                data = zlib.decompress(data[4:])
            data = msgpack.unpackb(data, encoding="utf-8")
            fd.close()

            self.__load_meta(data)

            if self.version == LAST_COMPATIBLE:
                warning("the database version is old, some information may be missing")
            elif self.version < LAST_COMPATIBLE:
                die("the database is too old")

            self.__load_memory(data)
            self.__load_symbols(data)
            self.__load_jmptables(data)
            self.__load_comments(data)
            self.__load_functions(data)
            self.__load_history(data)
            self.__load_xrefs(data)
            self.__load_imports(data)
            self.__load_immediates(data)
            self.__load_inverted_cond(data)

            self.loaded = True

        gc.enable() 
開發者ID:plasma-disassembler,項目名稱:plasma,代碼行數:39,代碼來源:database.py

示例6: save

# 需要導入模塊: import msgpack [as 別名]
# 或者: from msgpack import version [as 別名]
def save(self, history):
        data = {
            "version": VERSION,
            "symbols": self.symbols,
            "demangled": self.demangled,
            "history": history,
            "user_inline_comments": self.user_inline_comments,
            "internal_inline_comments": self.internal_inline_comments,
            "user_previous_comments": self.user_previous_comments,
            "internal_previous_comments": self.internal_previous_comments,
            "jmptables": [],
            "mips_gp": self.mips_gp,
            "mem": self.mem.mm,
            "functions": self.functions,
            "func_id_counter": self.func_id_counter,
            "func_id": self.func_id,
            "xrefs": self.xrefs,
            "data_sub_xrefs": self.data_sub_xrefs,
            "raw_base": self.raw_base,
            "raw_type": self.raw_type,
            "raw_is_big_endian": self.raw_is_big_endian,
            "imports": self.imports,
            "immediates": self.immediates,
            "inverted_cond": self.inverted_cond,
        }

        for j in self.jmptables.values():
            o = {
                "inst_addr": j.inst_addr,
                "table_addr": j.table_addr,
                "table": j.table,
                "name": j.name,
            }
            data["jmptables"].append(o)

        fd = open(self.path, "wb+")
        fd.write(b"ZLIB")
        fd.write(zlib.compress(msgpack.packb(data, use_bin_type=True)))
        fd.close() 
開發者ID:plasma-disassembler,項目名稱:plasma,代碼行數:41,代碼來源:database.py

示例7: __load_imports

# 需要導入模塊: import msgpack [as 別名]
# 或者: from msgpack import version [as 別名]
def __load_imports(self, data):
        self.imports = data["imports"]
        if self.version <= 2.7:
            for ad in self.imports:
                # TODO ?? check separatly pe/elf
                name = self.reverse_symbols[ad]
                if name in NORETURN_ELF or name in NORETURN_PE:
                    self.imports[ad] = FUNC_FLAG_NORETURN 
開發者ID:plasma-disassembler,項目名稱:plasma,代碼行數:10,代碼來源:database.py

示例8: get_tf_version_tuple

# 需要導入模塊: import msgpack [as 別名]
# 或者: from msgpack import version [as 別名]
def get_tf_version_tuple():
    """
    Return TensorFlow version as a 2-element tuple (for comparison).
    """
    return tuple(map(int, tf.__version__.split('.')[:2])) 
開發者ID:junsukchoe,項目名稱:ADL,代碼行數:7,代碼來源:common.py


注:本文中的msgpack.version方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。