File: pickleversion.py

package info (click to toggle)
diveintopython3 20110517%2B77958af-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,104 kB
  • sloc: python: 2,201; xml: 189; makefile: 45
file content (8 lines) | stat: -rw-r--r-- 210 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
import pickletools

def protocol_version(file_object):
    maxproto = -1
    for opcode, arg, pos in pickletools.genops(file_object):
        maxproto = max(maxproto, opcode.proto)
    return maxproto