Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
Unpickler Class Reference

Public Member Functions

def __init__
 
def load
 
def marker
 
def load_eof
 
def load_persid
 
def load_binpersid
 
def load_none
 
def load_int
 
def load_binint
 
def load_binint1
 
def load_binint2
 
def load_long
 
def load_float
 
def load_binfloat
 
def load_string
 
def load_binstring
 
def load_unicode
 
def load_binunicode
 
def load_short_binstring
 
def load_tuple
 
def load_empty_tuple
 
def load_empty_list
 
def load_empty_dictionary
 
def load_list
 
def load_dict
 
def load_inst
 
def load_obj
 
def load_global
 
def find_class
 
def load_reduce
 
def load_pop
 
def load_pop_mark
 
def load_dup
 
def load_get
 
def load_binget
 
def load_long_binget
 
def load_put
 
def load_binput
 
def load_long_binput
 
def load_append
 
def load_appends
 
def load_setitem
 
def load_setitems
 
def load_build
 
def load_mark
 
def load_stop
 

Data Fields

 readline
 
 read
 
 memo
 
 mark
 
 stack
 
 append
 

Static Public Attributes

dictionary dispatch = {}
 

Detailed Description

Definition at line 580 of file pickle.py.

Constructor & Destructor Documentation

def __init__ (   self,
  file 
)

Definition at line 582 of file pickle.py.

583  def __init__(self, file):
584  self.readline = file.readline
585  self.read = file.read
586  self.memo = {}

Member Function Documentation

def find_class (   self,
  module,
  name 
)

Definition at line 820 of file pickle.py.

821  def find_class(self, module, name):
822  __import__(module)
823  mod = sys.modules[module]
824  klass = getattr(mod, name)
825  return klass
def load (   self)

Definition at line 587 of file pickle.py.

588  def load(self):
589  self.mark = object() # any new unique object
590  self.stack = []
591  self.append = self.stack.append
592  read = self.read
593  dispatch = self.dispatch
594  try:
595  while 1:
596  key = read(1)
597  dispatch[key](self)
598  except _Stop, stopinst:
599  return stopinst.value
def load_append (   self)

Definition at line 892 of file pickle.py.

References MultiFile.stack, Pdb.stack, and Unpickler.stack.

893  def load_append(self):
894  stack = self.stack
895  value = stack[-1]
896  del stack[-1]
897  list = stack[-1]
list.append(value)
def load_appends (   self)

Definition at line 900 of file pickle.py.

References Unpickler.marker(), MultiFile.stack, Pdb.stack, and Unpickler.stack.

901  def load_appends(self):
902  stack = self.stack
903  mark = self.marker()
904  list = stack[mark - 1]
905  for i in range(mark + 1, len(stack)):
906  list.append(stack[i])
907 
del stack[mark:]
def load_binfloat (   self,
  unpack = struct.unpack 
)

Definition at line 659 of file pickle.py.

References Unpickler.append, file_wrapper.read, and Unpickler.read.

660  def load_binfloat(self, unpack=struct.unpack):
self.append(unpack('>d', self.read(8))[0])
def load_binget (   self)

Definition at line 868 of file pickle.py.

References Unpickler.append, Pickler.memo, Unpickler.memo, pickle.mloads, file_wrapper.read, and Unpickler.read.

869  def load_binget(self):
870  i = mloads('i' + self.read(1) + '\000\000\000')
self.append(self.memo[`i`])
def load_binint (   self)

Definition at line 639 of file pickle.py.

References Unpickler.append, pickle.mloads, file_wrapper.read, and Unpickler.read.

640  def load_binint(self):
self.append(mloads('i' + self.read(4)))
def load_binint1 (   self)

Definition at line 643 of file pickle.py.

References Unpickler.append, pickle.mloads, file_wrapper.read, and Unpickler.read.

644  def load_binint1(self):
self.append(mloads('i' + self.read(1) + '\000\000\000'))
def load_binint2 (   self)

Definition at line 647 of file pickle.py.

References Unpickler.append, pickle.mloads, file_wrapper.read, and Unpickler.read.

648  def load_binint2(self):
self.append(mloads('i' + self.read(2) + '\000\000'))
def load_binpersid (   self)

Definition at line 618 of file pickle.py.

References Unpickler.append, MultiFile.stack, Pdb.stack, and Unpickler.stack.

619  def load_binpersid(self):
620  stack = self.stack
621 
622  pid = stack[-1]
623  del stack[-1]
624 
self.append(self.persistent_load(pid))
def load_binput (   self)

Definition at line 882 of file pickle.py.

References Pickler.memo, Unpickler.memo, pickle.mloads, file_wrapper.read, Unpickler.read, MultiFile.stack, Pdb.stack, and Unpickler.stack.

883  def load_binput(self):
884  i = mloads('i' + self.read(1) + '\000\000\000')
self.memo[`i`] = self.stack[-1]
def load_binstring (   self)

Definition at line 708 of file pickle.py.

References Unpickler.append, pickle.mloads, file_wrapper.read, and Unpickler.read.

709  def load_binstring(self):
710  len = mloads('i' + self.read(4))
self.append(self.read(len))
def load_binunicode (   self)

Definition at line 717 of file pickle.py.

References Unpickler.append, pickle.mloads, file_wrapper.read, Unpickler.read, and xmlrpclib.unicode.

718  def load_binunicode(self):
719  len = mloads('i' + self.read(4))
self.append(unicode(self.read(len),'utf-8'))
def load_build (   self)

Definition at line 929 of file pickle.py.

References random.setstate, MultiFile.stack, Pdb.stack, and Unpickler.stack.

930  def load_build(self):
931  stack = self.stack
932  value = stack[-1]
933  del stack[-1]
934  inst = stack[-1]
935  try:
936  setstate = inst.__setstate__
937  except AttributeError:
938  try:
939  inst.__dict__.update(value)
940  except RuntimeError:
941  # XXX In restricted execution, the instance's __dict__ is not
942  # accessible. Use the old way of unpickling the instance
943  # variables. This is a semantic different when unpickling in
944  # restricted vs. unrestricted modes.
945  for k, v in value.items():
946  setattr(inst, k, v)
947  else:
setstate(value)
def load_dict (   self)

Definition at line 749 of file pickle.py.

References Unpickler.marker(), MultiFile.stack, Pdb.stack, and Unpickler.stack.

750  def load_dict(self):
751  k = self.marker()
752  d = {}
753  items = self.stack[k+1:]
754  for i in range(0, len(items), 2):
755  key = items[i]
756  value = items[i+1]
757  d[key] = value
self.stack[k:] = [d]
def load_dup (   self)

Definition at line 860 of file pickle.py.

References Unpickler.append, MultiFile.stack, Pdb.stack, and Unpickler.stack.

861  def load_dup(self):
self.append(self.stack[-1])
def load_empty_dictionary (   self)

Definition at line 740 of file pickle.py.

741  def load_empty_dictionary(self):
self.stack.append({})
def load_empty_list (   self)

Definition at line 736 of file pickle.py.

737  def load_empty_list(self):
self.stack.append([])
def load_empty_tuple (   self)

Definition at line 732 of file pickle.py.

733  def load_empty_tuple(self):
self.stack.append(())
def load_eof (   self)

Definition at line 609 of file pickle.py.

610  def load_eof(self):
raise EOFError
def load_float (   self)

Definition at line 655 of file pickle.py.

References Unpickler.append, and Unpickler.readline.

656  def load_float(self):
self.append(float(self.readline()[:-1]))
def load_get (   self)

Definition at line 864 of file pickle.py.

References Unpickler.append, Pickler.memo, Unpickler.memo, and Unpickler.readline.

865  def load_get(self):
self.append(self.memo[self.readline()[:-1]])
def load_global (   self)

Definition at line 813 of file pickle.py.

References Unpickler.append, Unpickler.find_class(), and Unpickler.readline.

814  def load_global(self):
815  module = self.readline()[:-1]
816  name = self.readline()[:-1]
817  klass = self.find_class(module, name)
self.append(klass)
def load_inst (   self)

Definition at line 760 of file pickle.py.

References Unpickler.append, Unpickler.find_class(), Unpickler.marker(), Unpickler.readline, MultiFile.stack, Pdb.stack, Unpickler.stack, locale.str(), and log_faction_ships.tuple.

761  def load_inst(self):
762  k = self.marker()
763  args = tuple(self.stack[k+1:])
764  del self.stack[k:]
765  module = self.readline()[:-1]
766  name = self.readline()[:-1]
767  klass = self.find_class(module, name)
768  instantiated = 0
769  if (not args and type(klass) is ClassType and
770  not hasattr(klass, "__getinitargs__")):
771  try:
772  value = _EmptyClass()
773  value.__class__ = klass
774  instantiated = 1
775  except RuntimeError:
776  # In restricted execution, assignment to inst.__class__ is
777  # prohibited
778  pass
779  if not instantiated:
780  try:
781  if not hasattr(klass, '__safe_for_unpickling__'):
782  raise UnpicklingError('%s is not safe for unpickling' %
783  klass)
784  value = apply(klass, args)
785  except TypeError, err:
786  raise TypeError, "in constructor for %s: %s" % (
787  klass.__name__, str(err)), sys.exc_info()[2]
self.append(value)
def load_int (   self)

Definition at line 631 of file pickle.py.

References Unpickler.append, and Unpickler.readline.

632  def load_int(self):
633  data = self.readline()
634  try:
635  self.append(int(data))
636  except ValueError:
self.append(long(data))
def load_list (   self)

Definition at line 744 of file pickle.py.

References Unpickler.marker(), MultiFile.stack, Pdb.stack, and Unpickler.stack.

745  def load_list(self):
746  k = self.marker()
self.stack[k:] = [self.stack[k+1:]]
def load_long (   self)

Definition at line 651 of file pickle.py.

References Unpickler.append, and Unpickler.readline.

652  def load_long(self):
self.append(long(self.readline()[:-1], 0))
def load_long_binget (   self)

Definition at line 873 of file pickle.py.

References Unpickler.append, Pickler.memo, Unpickler.memo, pickle.mloads, file_wrapper.read, and Unpickler.read.

874  def load_long_binget(self):
875  i = mloads('i' + self.read(4))
self.append(self.memo[`i`])
def load_long_binput (   self)

Definition at line 887 of file pickle.py.

References Pickler.memo, Unpickler.memo, pickle.mloads, file_wrapper.read, Unpickler.read, MultiFile.stack, Pdb.stack, and Unpickler.stack.

888  def load_long_binput(self):
889  i = mloads('i' + self.read(4))
self.memo[`i`] = self.stack[-1]
def load_mark (   self)

Definition at line 950 of file pickle.py.

References Unpickler.append, and Unpickler.mark.

951  def load_mark(self):
self.append(self.mark)
def load_none (   self)

Definition at line 627 of file pickle.py.

References Unpickler.append.

628  def load_none(self):
self.append(None)
def load_obj (   self)

Definition at line 790 of file pickle.py.

References Unpickler.append, Unpickler.marker(), MultiFile.stack, Pdb.stack, Unpickler.stack, and log_faction_ships.tuple.

791  def load_obj(self):
792  stack = self.stack
793  k = self.marker()
794  klass = stack[k + 1]
795  del stack[k + 1]
796  args = tuple(stack[k + 1:])
797  del stack[k:]
798  instantiated = 0
799  if (not args and type(klass) is ClassType and
800  not hasattr(klass, "__getinitargs__")):
801  try:
802  value = _EmptyClass()
803  value.__class__ = klass
804  instantiated = 1
805  except RuntimeError:
806  # In restricted execution, assignment to inst.__class__ is
807  # prohibited
808  pass
809  if not instantiated:
810  value = apply(klass, args)
self.append(value)
def load_persid (   self)

Definition at line 613 of file pickle.py.

References Unpickler.append, and Unpickler.readline.

614  def load_persid(self):
615  pid = self.readline()[:-1]
self.append(self.persistent_load(pid))
def load_pop (   self)

Definition at line 851 of file pickle.py.

References MultiFile.stack, Pdb.stack, and Unpickler.stack.

852  def load_pop(self):
del self.stack[-1]
def load_pop_mark (   self)

Definition at line 855 of file pickle.py.

References Unpickler.marker(), MultiFile.stack, Pdb.stack, and Unpickler.stack.

856  def load_pop_mark(self):
857  k = self.marker()
del self.stack[k:]
def load_put (   self)

Definition at line 878 of file pickle.py.

References Pickler.memo, Unpickler.memo, Unpickler.readline, MultiFile.stack, Pdb.stack, and Unpickler.stack.

879  def load_put(self):
self.memo[self.readline()[:-1]] = self.stack[-1]
def load_reduce (   self)

Definition at line 826 of file pickle.py.

References Unpickler.append, MultiFile.stack, Pdb.stack, and Unpickler.stack.

827  def load_reduce(self):
828  stack = self.stack
829 
830  callable = stack[-2]
831  arg_tup = stack[-1]
832  del stack[-2:]
833 
834  if type(callable) is not ClassType:
835  if not safe_constructors.has_key(callable):
836  try:
837  safe = callable.__safe_for_unpickling__
838  except AttributeError:
839  safe = None
840 
841  if not safe:
842  raise UnpicklingError, "%s is not safe for " \
843  "unpickling" % callable
844 
845  if arg_tup is None:
846  value = callable.__basicnew__()
847  else:
848  value = apply(callable, arg_tup)
self.append(value)
def load_setitem (   self)

Definition at line 910 of file pickle.py.

References MultiFile.stack, Pdb.stack, and Unpickler.stack.

911  def load_setitem(self):
912  stack = self.stack
913  value = stack[-1]
914  key = stack[-2]
915  del stack[-2:]
916  dict = stack[-1]
dict[key] = value
def load_setitems (   self)

Definition at line 919 of file pickle.py.

References Unpickler.marker(), MultiFile.stack, Pdb.stack, and Unpickler.stack.

920  def load_setitems(self):
921  stack = self.stack
922  mark = self.marker()
923  dict = stack[mark - 1]
924  for i in range(mark + 1, len(stack), 2):
925  dict[stack[i]] = stack[i + 1]
926 
del stack[mark:]
def load_short_binstring (   self)

Definition at line 722 of file pickle.py.

References Unpickler.append, pickle.mloads, file_wrapper.read, and Unpickler.read.

723  def load_short_binstring(self):
724  len = mloads('i' + self.read(1) + '\000\000\000')
self.append(self.read(len))
def load_stop (   self)

Definition at line 954 of file pickle.py.

References MultiFile.stack, Pdb.stack, and Unpickler.stack.

955  def load_stop(self):
956  value = self.stack[-1]
957  del self.stack[-1]
raise _Stop(value)
def load_string (   self)

Definition at line 663 of file pickle.py.

References Unpickler._is_string_secure(), Unpickler.append, and Unpickler.readline.

664  def load_string(self):
665  rep = self.readline()[:-1]
666  if not self._is_string_secure(rep):
667  raise ValueError, "insecure string pickle"
668  self.append(eval(rep,
{'__builtins__': {}})) # Let's be careful
def load_tuple (   self)

Definition at line 727 of file pickle.py.

References Unpickler.marker(), MultiFile.stack, Pdb.stack, Unpickler.stack, and log_faction_ships.tuple.

728  def load_tuple(self):
729  k = self.marker()
self.stack[k:] = [tuple(self.stack[k+1:])]
def load_unicode (   self)

Definition at line 713 of file pickle.py.

References Unpickler.append, Unpickler.readline, and xmlrpclib.unicode.

714  def load_unicode(self):
self.append(unicode(self.readline()[:-1],'raw-unicode-escape'))
def marker (   self)

Definition at line 600 of file pickle.py.

References Unpickler.mark, MultiFile.stack, Pdb.stack, and Unpickler.stack.

601  def marker(self):
602  stack = self.stack
603  mark = self.mark
604  k = len(stack)-1
605  while stack[k] is not mark: k = k-1
606  return k

Field Documentation

append

Definition at line 590 of file pickle.py.

dictionary dispatch = {}
static

Definition at line 607 of file pickle.py.

mark

Definition at line 588 of file pickle.py.

memo

Definition at line 585 of file pickle.py.

read

Definition at line 584 of file pickle.py.

readline

Definition at line 583 of file pickle.py.

stack

Definition at line 589 of file pickle.py.


The documentation for this class was generated from the following file: