unpickle 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/README.md +2 -5
  2. data/lib/unpickle.rb +12 -11
  3. data/test/test_unpickle.rb +2 -2
  4. metadata +1 -1
data/README.md CHANGED
@@ -7,9 +7,9 @@ This is a very limited tool to unpickle python 'pickle' objects.
7
7
  require 'unpickle'
8
8
 
9
9
  fh = File.open('some.pickle')
10
- o = unpickle(fh.read)
10
+ o = Unpickle.loads(fh.read)
11
11
 
12
- unpickle() will raise Unpickle::UnpickleException if it doesn't support an
12
+ loads() will raise Unpickle::UnpickleException if it doesn't support an
13
13
  opcode in the picklestream, or encounters some kind of problem or invalid
14
14
  sequence.
15
15
 
@@ -28,9 +28,6 @@ None will be returned as nil.
28
28
 
29
29
  * Support more of protocol 0.
30
30
  * Support newer protocols.
31
- * Test object identity mapping.
32
- * Package as a gem
33
- * fix namespace.
34
31
 
35
32
  # Author
36
33
 
@@ -1,17 +1,21 @@
1
- # unpickle.rb
2
- #
3
- # baby-unpickler to handle limited protocol 0 crap.
4
- #
5
- # vim:et sts=4 sw=4 ts=8:
1
+ # Library to handle a limited subset of python objects
2
+ # picked using protocol 0.
6
3
  #
4
+ # Author:: Chris Collins (mailto:kuroneko-rubygems@sysadninjas.net)
5
+ # Copyright:: Copyright (c) 2012 Chris Collins, Anchor Systems Pty Ltd
7
6
  module Unpickle
7
+ # UnpickleException is the superclass for all exceptions thrown by
8
+ # the unpickler.
9
+ #
10
+ # Currently this gets thrown directly, but future versions may
11
+ # subclass this to provide better granularity in error reporting.
8
12
  class UnpickleException < RuntimeError
9
13
  end
10
14
 
11
- class Mark
15
+ class Mark #:nodoc:
12
16
  end
13
17
 
14
- class PickleMachine
18
+ class PickleMachine #:nodoc: all
15
19
  def initialize(input)
16
20
  @stack = []
17
21
  @memo = {}
@@ -201,13 +205,10 @@ module Unpickle
201
205
  # (dicts, lists, tuples, strings, ints, bools, None) and only with
202
206
  # protocol 0.
203
207
  #
204
- # Object uniqueness should obey the python semantics but is largely
205
- # untested.
206
- #
207
208
  # Raises an UnpickleException if anything goes wrong.
208
209
  def Unpickle.loads(str)
209
210
  p = Unpickle::PickleMachine.new(str)
210
211
  return p.unpickle
211
212
  end
212
213
  end
213
-
214
+ # vim:et sts=4 sw=4 ts=8:
@@ -1,6 +1,5 @@
1
- # tests for Unpickle.loads.rb
1
+ # tests for lib/unpickle.rb
2
2
  #
3
- # vim:et sts=4 sw=4 ts=8:
4
3
  require 'test/unit'
5
4
  require 'unpickle'
6
5
 
@@ -97,3 +96,4 @@ class UnpickleTests < Test::Unit::TestCase
97
96
  assert(o.object_id == o['b']['a'].object_id)
98
97
  end
99
98
  end
99
+ # vim:et sts=4 sw=4 ts=8:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unpickle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: