python-pickle 0.1.0
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.
- checksums.yaml +7 -0
- data/.document +3 -0
- data/.github/workflows/ruby.yml +27 -0
- data/.gitignore +5 -0
- data/.rspec +1 -0
- data/.yardopts +1 -0
- data/ChangeLog.md +14 -0
- data/Gemfile +15 -0
- data/LICENSE.txt +20 -0
- data/README.md +149 -0
- data/Rakefile +13 -0
- data/gemspec.yml +25 -0
- data/lib/python/pickle/byte_array.rb +40 -0
- data/lib/python/pickle/deserializer.rb +595 -0
- data/lib/python/pickle/exceptions.rb +12 -0
- data/lib/python/pickle/instruction.rb +52 -0
- data/lib/python/pickle/instructions/add_items.rb +26 -0
- data/lib/python/pickle/instructions/append.rb +24 -0
- data/lib/python/pickle/instructions/appends.rb +26 -0
- data/lib/python/pickle/instructions/bin_bytes.rb +32 -0
- data/lib/python/pickle/instructions/bin_bytes8.rb +32 -0
- data/lib/python/pickle/instructions/bin_float.rb +29 -0
- data/lib/python/pickle/instructions/bin_get.rb +27 -0
- data/lib/python/pickle/instructions/bin_int1.rb +29 -0
- data/lib/python/pickle/instructions/bin_put.rb +29 -0
- data/lib/python/pickle/instructions/bin_string.rb +32 -0
- data/lib/python/pickle/instructions/bin_unicode.rb +32 -0
- data/lib/python/pickle/instructions/bin_unicode8.rb +32 -0
- data/lib/python/pickle/instructions/build.rb +24 -0
- data/lib/python/pickle/instructions/byte_array8.rb +32 -0
- data/lib/python/pickle/instructions/dict.rb +17 -0
- data/lib/python/pickle/instructions/dup.rb +24 -0
- data/lib/python/pickle/instructions/empty_dict.rb +26 -0
- data/lib/python/pickle/instructions/empty_list.rb +26 -0
- data/lib/python/pickle/instructions/empty_set.rb +26 -0
- data/lib/python/pickle/instructions/empty_tuple.rb +26 -0
- data/lib/python/pickle/instructions/ext1.rb +29 -0
- data/lib/python/pickle/instructions/ext2.rb +29 -0
- data/lib/python/pickle/instructions/ext4.rb +29 -0
- data/lib/python/pickle/instructions/float.rb +24 -0
- data/lib/python/pickle/instructions/frame.rb +29 -0
- data/lib/python/pickle/instructions/frozen_set.rb +26 -0
- data/lib/python/pickle/instructions/get.rb +27 -0
- data/lib/python/pickle/instructions/global.rb +62 -0
- data/lib/python/pickle/instructions/has_length_and_value.rb +58 -0
- data/lib/python/pickle/instructions/has_value.rb +50 -0
- data/lib/python/pickle/instructions/int.rb +24 -0
- data/lib/python/pickle/instructions/list.rb +24 -0
- data/lib/python/pickle/instructions/long.rb +24 -0
- data/lib/python/pickle/instructions/long1.rb +32 -0
- data/lib/python/pickle/instructions/long4.rb +32 -0
- data/lib/python/pickle/instructions/long_bin_get.rb +27 -0
- data/lib/python/pickle/instructions/mark.rb +24 -0
- data/lib/python/pickle/instructions/memoize.rb +26 -0
- data/lib/python/pickle/instructions/new_false.rb +24 -0
- data/lib/python/pickle/instructions/new_obj.rb +26 -0
- data/lib/python/pickle/instructions/new_obj_ex.rb +26 -0
- data/lib/python/pickle/instructions/new_true.rb +24 -0
- data/lib/python/pickle/instructions/next_buffer.rb +26 -0
- data/lib/python/pickle/instructions/none.rb +24 -0
- data/lib/python/pickle/instructions/pop.rb +24 -0
- data/lib/python/pickle/instructions/pop_mark.rb +24 -0
- data/lib/python/pickle/instructions/proto.rb +29 -0
- data/lib/python/pickle/instructions/put.rb +24 -0
- data/lib/python/pickle/instructions/readonly_buffer.rb +26 -0
- data/lib/python/pickle/instructions/reduce.rb +24 -0
- data/lib/python/pickle/instructions/set_item.rb +24 -0
- data/lib/python/pickle/instructions/set_items.rb +26 -0
- data/lib/python/pickle/instructions/short_bin_bytes.rb +32 -0
- data/lib/python/pickle/instructions/short_bin_string.rb +32 -0
- data/lib/python/pickle/instructions/short_bin_unicode.rb +32 -0
- data/lib/python/pickle/instructions/stack_global.rb +26 -0
- data/lib/python/pickle/instructions/stop.rb +24 -0
- data/lib/python/pickle/instructions/string.rb +24 -0
- data/lib/python/pickle/instructions/tuple.rb +24 -0
- data/lib/python/pickle/instructions/tuple1.rb +24 -0
- data/lib/python/pickle/instructions/tuple2.rb +24 -0
- data/lib/python/pickle/instructions/tuple3.rb +24 -0
- data/lib/python/pickle/protocol.rb +56 -0
- data/lib/python/pickle/protocol0.rb +399 -0
- data/lib/python/pickle/protocol1.rb +183 -0
- data/lib/python/pickle/protocol2.rb +229 -0
- data/lib/python/pickle/protocol3.rb +163 -0
- data/lib/python/pickle/protocol4.rb +285 -0
- data/lib/python/pickle/protocol5.rb +218 -0
- data/lib/python/pickle/py_class.rb +75 -0
- data/lib/python/pickle/py_object.rb +141 -0
- data/lib/python/pickle/tuple.rb +19 -0
- data/lib/python/pickle/version.rb +6 -0
- data/lib/python/pickle.rb +226 -0
- data/python-pickle.gemspec +62 -0
- data/spec/byte_array_spec.rb +54 -0
- data/spec/deserializer_spec.rb +1201 -0
- data/spec/fixtures/ascii_str_v3.pkl +0 -0
- data/spec/fixtures/ascii_str_v4.pkl +0 -0
- data/spec/fixtures/ascii_str_v5.pkl +0 -0
- data/spec/fixtures/bin_str_v0.pkl +3 -0
- data/spec/fixtures/bin_str_v1.pkl +0 -0
- data/spec/fixtures/bin_str_v2.pkl +0 -0
- data/spec/fixtures/bin_str_v3.pkl +0 -0
- data/spec/fixtures/bin_str_v4.pkl +0 -0
- data/spec/fixtures/bin_str_v5.pkl +0 -0
- data/spec/fixtures/bytearray_v0.pkl +10 -0
- data/spec/fixtures/bytearray_v1.pkl +0 -0
- data/spec/fixtures/bytearray_v2.pkl +0 -0
- data/spec/fixtures/bytearray_v3.pkl +0 -0
- data/spec/fixtures/bytearray_v4.pkl +0 -0
- data/spec/fixtures/bytearray_v5.pkl +0 -0
- data/spec/fixtures/class_v0.pkl +4 -0
- data/spec/fixtures/class_v1.pkl +0 -0
- data/spec/fixtures/class_v2.pkl +0 -0
- data/spec/fixtures/class_v3.pkl +0 -0
- data/spec/fixtures/class_v4.pkl +0 -0
- data/spec/fixtures/class_v5.pkl +0 -0
- data/spec/fixtures/dict_v0.pkl +6 -0
- data/spec/fixtures/dict_v1.pkl +0 -0
- data/spec/fixtures/dict_v2.pkl +0 -0
- data/spec/fixtures/dict_v3.pkl +0 -0
- data/spec/fixtures/dict_v4.pkl +0 -0
- data/spec/fixtures/dict_v5.pkl +0 -0
- data/spec/fixtures/escaped_str_v0.pkl +3 -0
- data/spec/fixtures/escaped_str_v1.pkl +0 -0
- data/spec/fixtures/escaped_str_v2.pkl +0 -0
- data/spec/fixtures/false_v0.pkl +2 -0
- data/spec/fixtures/false_v1.pkl +2 -0
- data/spec/fixtures/false_v2.pkl +1 -0
- data/spec/fixtures/false_v3.pkl +1 -0
- data/spec/fixtures/false_v4.pkl +1 -0
- data/spec/fixtures/false_v5.pkl +1 -0
- data/spec/fixtures/float_v0.pkl +2 -0
- data/spec/fixtures/float_v1.pkl +1 -0
- data/spec/fixtures/float_v2.pkl +1 -0
- data/spec/fixtures/float_v3.pkl +1 -0
- data/spec/fixtures/float_v4.pkl +0 -0
- data/spec/fixtures/float_v5.pkl +0 -0
- data/spec/fixtures/function_v0.pkl +4 -0
- data/spec/fixtures/function_v1.pkl +0 -0
- data/spec/fixtures/function_v2.pkl +0 -0
- data/spec/fixtures/function_v3.pkl +0 -0
- data/spec/fixtures/function_v4.pkl +0 -0
- data/spec/fixtures/function_v5.pkl +0 -0
- data/spec/fixtures/hex_str_v0.pkl +3 -0
- data/spec/fixtures/hex_str_v1.pkl +0 -0
- data/spec/fixtures/hex_str_v2.pkl +0 -0
- data/spec/fixtures/int_v0.pkl +2 -0
- data/spec/fixtures/int_v1.pkl +1 -0
- data/spec/fixtures/int_v2.pkl +1 -0
- data/spec/fixtures/int_v3.pkl +1 -0
- data/spec/fixtures/int_v4.pkl +1 -0
- data/spec/fixtures/int_v5.pkl +1 -0
- data/spec/fixtures/list_v0.pkl +7 -0
- data/spec/fixtures/list_v1.pkl +0 -0
- data/spec/fixtures/list_v2.pkl +0 -0
- data/spec/fixtures/list_v3.pkl +0 -0
- data/spec/fixtures/list_v4.pkl +0 -0
- data/spec/fixtures/list_v5.pkl +0 -0
- data/spec/fixtures/long_v0.pkl +2 -0
- data/spec/fixtures/long_v1.pkl +2 -0
- data/spec/fixtures/long_v2.pkl +0 -0
- data/spec/fixtures/long_v3.pkl +0 -0
- data/spec/fixtures/long_v4.pkl +0 -0
- data/spec/fixtures/long_v5.pkl +0 -0
- data/spec/fixtures/nested_dict_v0.pkl +12 -0
- data/spec/fixtures/nested_dict_v1.pkl +0 -0
- data/spec/fixtures/nested_dict_v2.pkl +0 -0
- data/spec/fixtures/nested_dict_v3.pkl +0 -0
- data/spec/fixtures/nested_dict_v4.pkl +0 -0
- data/spec/fixtures/nested_dict_v5.pkl +0 -0
- data/spec/fixtures/nested_list_v0.pkl +9 -0
- data/spec/fixtures/nested_list_v1.pkl +0 -0
- data/spec/fixtures/nested_list_v2.pkl +0 -0
- data/spec/fixtures/nested_list_v3.pkl +0 -0
- data/spec/fixtures/nested_list_v4.pkl +0 -0
- data/spec/fixtures/nested_list_v5.pkl +0 -0
- data/spec/fixtures/none_v0.pkl +1 -0
- data/spec/fixtures/none_v1.pkl +1 -0
- data/spec/fixtures/none_v2.pkl +1 -0
- data/spec/fixtures/none_v3.pkl +1 -0
- data/spec/fixtures/none_v4.pkl +1 -0
- data/spec/fixtures/none_v5.pkl +1 -0
- data/spec/fixtures/object_v0.pkl +19 -0
- data/spec/fixtures/object_v1.pkl +0 -0
- data/spec/fixtures/object_v2.pkl +0 -0
- data/spec/fixtures/object_v3.pkl +0 -0
- data/spec/fixtures/object_v4.pkl +0 -0
- data/spec/fixtures/object_v5.pkl +0 -0
- data/spec/fixtures/str_v0.pkl +3 -0
- data/spec/fixtures/str_v1.pkl +0 -0
- data/spec/fixtures/str_v2.pkl +0 -0
- data/spec/fixtures/str_v3.pkl +0 -0
- data/spec/fixtures/str_v4.pkl +0 -0
- data/spec/fixtures/str_v5.pkl +0 -0
- data/spec/fixtures/true_v0.pkl +2 -0
- data/spec/fixtures/true_v1.pkl +2 -0
- data/spec/fixtures/true_v2.pkl +1 -0
- data/spec/fixtures/true_v3.pkl +1 -0
- data/spec/fixtures/true_v4.pkl +1 -0
- data/spec/fixtures/true_v5.pkl +1 -0
- data/spec/fixtures/unicode_str_v0.pkl +3 -0
- data/spec/fixtures/unicode_str_v1.pkl +0 -0
- data/spec/fixtures/unicode_str_v2.pkl +0 -0
- data/spec/fixtures/unicode_str_v3.pkl +0 -0
- data/spec/fixtures/unicode_str_v4.pkl +0 -0
- data/spec/fixtures/unicode_str_v5.pkl +0 -0
- data/spec/generate_pickles2.py +41 -0
- data/spec/generate_pickles3.py +40 -0
- data/spec/integration/load/protocol0_spec.rb +258 -0
- data/spec/integration/load/protocol1_spec.rb +258 -0
- data/spec/integration/load/protocol2_spec.rb +258 -0
- data/spec/integration/load/protocol3_spec.rb +258 -0
- data/spec/integration/load/protocol4_spec.rb +258 -0
- data/spec/integration/load/protocol5_spec.rb +258 -0
- data/spec/integration/parse/protocol0_spec.rb +467 -0
- data/spec/integration/parse/protocol1_spec.rb +459 -0
- data/spec/integration/parse/protocol2_spec.rb +471 -0
- data/spec/integration/parse/protocol3_spec.rb +407 -0
- data/spec/integration/parse/protocol4_spec.rb +439 -0
- data/spec/integration/parse/protocol5_spec.rb +419 -0
- data/spec/pickle_spec.rb +163 -0
- data/spec/protocol0_read_instruction_examples.rb +211 -0
- data/spec/protocol0_spec.rb +445 -0
- data/spec/protocol1_read_instruction_examples.rb +156 -0
- data/spec/protocol1_spec.rb +59 -0
- data/spec/protocol2_read_instruction_examples.rb +135 -0
- data/spec/protocol2_spec.rb +128 -0
- data/spec/protocol3_read_instruction_examples.rb +29 -0
- data/spec/protocol3_spec.rb +32 -0
- data/spec/protocol4_read_instruction_examples.rb +142 -0
- data/spec/protocol4_spec.rb +58 -0
- data/spec/protocol5_spec.rb +68 -0
- data/spec/py_class_spec.rb +62 -0
- data/spec/py_object_spec.rb +149 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/tuple_spec.rb +18 -0
- metadata +325 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
|
3
|
+
module Python
|
4
|
+
module Pickle
|
5
|
+
module Instructions
|
6
|
+
#
|
7
|
+
# Represents a pickle `APPENDS` instruction.
|
8
|
+
#
|
9
|
+
# @note Introduced in protocol 1.
|
10
|
+
#
|
11
|
+
class Appends < Instruction
|
12
|
+
|
13
|
+
#
|
14
|
+
# Initializes the `APPENDS` instruction.
|
15
|
+
#
|
16
|
+
def initialize
|
17
|
+
super(:APPENDS)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
# The `APPENDS` instruction.
|
23
|
+
APPENDS = Appends.new
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_length_and_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents the `BINBYTES` instruction.
|
9
|
+
#
|
10
|
+
# @note introduces in protocol 3.
|
11
|
+
#
|
12
|
+
class BinBytes < Instruction
|
13
|
+
|
14
|
+
include HasLengthAndValue
|
15
|
+
|
16
|
+
#
|
17
|
+
# Initializes the `BINBYTES` instruction.
|
18
|
+
#
|
19
|
+
# @param [Integer] length
|
20
|
+
# The length of the `BINBYTES` value.
|
21
|
+
#
|
22
|
+
# @param [String] value
|
23
|
+
# The `BINBYTES` instruction's value.
|
24
|
+
#
|
25
|
+
def initialize(length,value)
|
26
|
+
super(:BINBYTES,length,value)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_length_and_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents the `BINBYTES8` instruction.
|
9
|
+
#
|
10
|
+
# @note introduces in protocol 4.
|
11
|
+
#
|
12
|
+
class BinBytes8 < Instruction
|
13
|
+
|
14
|
+
include HasLengthAndValue
|
15
|
+
|
16
|
+
#
|
17
|
+
# Initializes the `BINBYTES8` instruction.
|
18
|
+
#
|
19
|
+
# @param [Integer] length
|
20
|
+
# The length of the `BINBYTES8` value.
|
21
|
+
#
|
22
|
+
# @param [String] value
|
23
|
+
# The `BINBYTES8` instruction's value.
|
24
|
+
#
|
25
|
+
def initialize(length,value)
|
26
|
+
super(:BINBYTES8,length,value)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents the `BINFLOAT` instruction.
|
9
|
+
#
|
10
|
+
# @note introduces in protocol 1.
|
11
|
+
#
|
12
|
+
class BinFloat < Instruction
|
13
|
+
|
14
|
+
include HasValue
|
15
|
+
|
16
|
+
#
|
17
|
+
# Initializes the `BINFLOAT` instruction.
|
18
|
+
#
|
19
|
+
# @param [BinFloat] value
|
20
|
+
# The `BINFLOAT` instruction's value.
|
21
|
+
#
|
22
|
+
def initialize(value)
|
23
|
+
super(:BINFLOAT,value)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents the `BINGET` instruction.
|
9
|
+
#
|
10
|
+
class BinGet < Instruction
|
11
|
+
|
12
|
+
include HasValue
|
13
|
+
|
14
|
+
#
|
15
|
+
# Initializes the `BINGET` instruction.
|
16
|
+
#
|
17
|
+
# @param [Integer] value
|
18
|
+
# The `BINGET` instruction's value.
|
19
|
+
#
|
20
|
+
def initialize(value)
|
21
|
+
super(:BINGET,value)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents the `BININT1` instruction.
|
9
|
+
#
|
10
|
+
# @note introduces in protocol 1.
|
11
|
+
#
|
12
|
+
class BinInt1 < Instruction
|
13
|
+
|
14
|
+
include HasValue
|
15
|
+
|
16
|
+
#
|
17
|
+
# Initializes the `BININT1` instruction.
|
18
|
+
#
|
19
|
+
# @param [BinInt1] value
|
20
|
+
# The `BININT1` instruction's value.
|
21
|
+
#
|
22
|
+
def initialize(value)
|
23
|
+
super(:BININT1,value)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents the `BINPUT` instruction.
|
9
|
+
#
|
10
|
+
# @note introduced in protocol 1.
|
11
|
+
#
|
12
|
+
class BinPut < Instruction
|
13
|
+
|
14
|
+
include HasValue
|
15
|
+
|
16
|
+
#
|
17
|
+
# Initializes the `BINPUT` instruction.
|
18
|
+
#
|
19
|
+
# @param [Integer] value
|
20
|
+
# The `BINPUT` instruction's value.
|
21
|
+
#
|
22
|
+
def initialize(value)
|
23
|
+
super(:BINPUT,value)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_length_and_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents the `BINSTRING` instruction.
|
9
|
+
#
|
10
|
+
# @note introduces in protocol 1.
|
11
|
+
#
|
12
|
+
class BinString < Instruction
|
13
|
+
|
14
|
+
include HasLengthAndValue
|
15
|
+
|
16
|
+
#
|
17
|
+
# Initializes the `BINSTRING` instruction.
|
18
|
+
#
|
19
|
+
# @param [Integer] length
|
20
|
+
# The length of the `BINSTRING` value.
|
21
|
+
#
|
22
|
+
# @param [String] value
|
23
|
+
# The `BINSTRING` instruction's value.
|
24
|
+
#
|
25
|
+
def initialize(length,value)
|
26
|
+
super(:BINSTRING,length,value)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_length_and_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents the `BINUNICODE` instruction.
|
9
|
+
#
|
10
|
+
# @note introduces in protocol 1.
|
11
|
+
#
|
12
|
+
class BinUnicode < Instruction
|
13
|
+
|
14
|
+
include HasLengthAndValue
|
15
|
+
|
16
|
+
#
|
17
|
+
# Initializes the `BINUNICODE` instruction.
|
18
|
+
#
|
19
|
+
# @param [Integer] length
|
20
|
+
# The length of the `BINUNICODE` value.
|
21
|
+
#
|
22
|
+
# @param [String] value
|
23
|
+
# The `BINUNICODE` instruction's value.
|
24
|
+
#
|
25
|
+
def initialize(length,value)
|
26
|
+
super(:BINUNICODE,length,value)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_length_and_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents the `BINUNICODE8` instruction.
|
9
|
+
#
|
10
|
+
# @note introduces in protocol 4.
|
11
|
+
#
|
12
|
+
class BinUnicode8 < Instruction
|
13
|
+
|
14
|
+
include HasLengthAndValue
|
15
|
+
|
16
|
+
#
|
17
|
+
# Initializes the `BINUNICODE8` instruction.
|
18
|
+
#
|
19
|
+
# @param [Integer] length
|
20
|
+
# The length of the `BINUNICODE8` value.
|
21
|
+
#
|
22
|
+
# @param [String] value
|
23
|
+
# The `BINUNICODE8` instruction's value.
|
24
|
+
#
|
25
|
+
def initialize(length,value)
|
26
|
+
super(:BINUNICODE8,length,value)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
|
3
|
+
module Python
|
4
|
+
module Pickle
|
5
|
+
module Instructions
|
6
|
+
#
|
7
|
+
# Represents a pickle `BUILD` instruction.
|
8
|
+
#
|
9
|
+
class Build < Instruction
|
10
|
+
|
11
|
+
#
|
12
|
+
# Initializes the `BUILD` instruction.
|
13
|
+
#
|
14
|
+
def initialize
|
15
|
+
super(:BUILD)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
# The `BUILD` instruction.
|
21
|
+
BUILD = Build.new
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_length_and_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents the `BYTEARRAY8` instruction.
|
9
|
+
#
|
10
|
+
# @note introduces in protocol 5.
|
11
|
+
#
|
12
|
+
class ByteArray8 < Instruction
|
13
|
+
|
14
|
+
include HasLengthAndValue
|
15
|
+
|
16
|
+
#
|
17
|
+
# Initializes the `BYTEARRAY8` instruction.
|
18
|
+
#
|
19
|
+
# @param [Integer] length
|
20
|
+
# The length of the `BYTEARRAY8` value.
|
21
|
+
#
|
22
|
+
# @param [String] value
|
23
|
+
# The `BYTEARRAY8` instruction's value.
|
24
|
+
#
|
25
|
+
def initialize(length,value)
|
26
|
+
super(:BYTEARRAY8,length,value)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
|
3
|
+
module Python
|
4
|
+
module Pickle
|
5
|
+
module Instructions
|
6
|
+
#
|
7
|
+
# Represents a pickle `DUP` instruction.
|
8
|
+
#
|
9
|
+
class Dup < Instruction
|
10
|
+
|
11
|
+
#
|
12
|
+
# Initializes the `DUP` instruction.
|
13
|
+
#
|
14
|
+
def initialize
|
15
|
+
super(:DUP)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
# The `DUP` instruction.
|
21
|
+
DUP = Dup.new
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
|
3
|
+
module Python
|
4
|
+
module Pickle
|
5
|
+
module Instructions
|
6
|
+
#
|
7
|
+
# Represents the `EMPTY_DICT` instruction.
|
8
|
+
#
|
9
|
+
# @note introduced in protocol 1.
|
10
|
+
#
|
11
|
+
class EmptyDict < Instruction
|
12
|
+
|
13
|
+
#
|
14
|
+
# Initializes the `EMPTY_DICT` instruction.
|
15
|
+
#
|
16
|
+
def initialize
|
17
|
+
super(:EMPTY_DICT)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
# The `EMPTY_DICT` instruction.
|
23
|
+
EMPTY_DICT = EmptyDict.new
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
|
3
|
+
module Python
|
4
|
+
module Pickle
|
5
|
+
module Instructions
|
6
|
+
#
|
7
|
+
# Represents a pickle `EMPTY_LIST` instruction.
|
8
|
+
#
|
9
|
+
# @note introduced in protocol 1.
|
10
|
+
#
|
11
|
+
class EmptyList < Instruction
|
12
|
+
|
13
|
+
#
|
14
|
+
# Initializes the `EMPTY_LIST` instruction.
|
15
|
+
#
|
16
|
+
def initialize
|
17
|
+
super(:EMPTY_LIST)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
# The `EMPTY_LIST` instruction.
|
23
|
+
EMPTY_LIST = EmptyList.new
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
|
3
|
+
module Python
|
4
|
+
module Pickle
|
5
|
+
module Instructions
|
6
|
+
#
|
7
|
+
# Represents a pickle `EMPTY_SET` instruction.
|
8
|
+
#
|
9
|
+
# @note introduced in protocol 4.
|
10
|
+
#
|
11
|
+
class EmptySet < Instruction
|
12
|
+
|
13
|
+
#
|
14
|
+
# Initializes the `EMPTY_SET` instruction.
|
15
|
+
#
|
16
|
+
def initialize
|
17
|
+
super(:EMPTY_SET)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
# The `EMPTY_SET` instruction.
|
23
|
+
EMPTY_SET = EmptySet.new
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
|
3
|
+
module Python
|
4
|
+
module Pickle
|
5
|
+
module Instructions
|
6
|
+
#
|
7
|
+
# Represents a pickle `EMPTY_TUPLE` instruction.
|
8
|
+
#
|
9
|
+
# @note Introduced in protocol 1.
|
10
|
+
#
|
11
|
+
class EmptyTuple < Instruction
|
12
|
+
|
13
|
+
#
|
14
|
+
# Initializes the `EMPTY_TUPLE` instruction.
|
15
|
+
#
|
16
|
+
def initialize
|
17
|
+
super(:EMPTY_TUPLE)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
# The `EMPTY_TUPLE` instruction.
|
23
|
+
EMPTY_TUPLE = EmptyTuple.new
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents a pickle `EXT1` instruction.
|
9
|
+
#
|
10
|
+
# @note introduced in protocol 2.
|
11
|
+
#
|
12
|
+
class Ext1 < Instruction
|
13
|
+
|
14
|
+
include HasValue
|
15
|
+
|
16
|
+
#
|
17
|
+
# Initializes the `EXT1` instruction.
|
18
|
+
#
|
19
|
+
# @param [Integer] value
|
20
|
+
# The extension code.
|
21
|
+
#
|
22
|
+
def initialize(value)
|
23
|
+
super(:EXT1,value)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents a pickle `EXT2` instruction.
|
9
|
+
#
|
10
|
+
# @note introduced in protocol 2.
|
11
|
+
#
|
12
|
+
class Ext2 < Instruction
|
13
|
+
|
14
|
+
include HasValue
|
15
|
+
|
16
|
+
#
|
17
|
+
# Initializes the `EXT2` instruction.
|
18
|
+
#
|
19
|
+
# @param [Integer] value
|
20
|
+
# The extension code.
|
21
|
+
#
|
22
|
+
def initialize(value)
|
23
|
+
super(:EXT2,value)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents a pickle `EXT4` instruction.
|
9
|
+
#
|
10
|
+
# @note introduced in protocol 2.
|
11
|
+
#
|
12
|
+
class Ext4 < Instruction
|
13
|
+
|
14
|
+
include HasValue
|
15
|
+
|
16
|
+
#
|
17
|
+
# Initializes the `EXT4` instruction.
|
18
|
+
#
|
19
|
+
# @param [Integer] value
|
20
|
+
# The extension code.
|
21
|
+
#
|
22
|
+
def initialize(value)
|
23
|
+
super(:EXT4,value)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
class Float < Instruction
|
8
|
+
|
9
|
+
include HasValue
|
10
|
+
|
11
|
+
#
|
12
|
+
# Initializes the `FLOAT` instruction.
|
13
|
+
#
|
14
|
+
# @param [Float] value
|
15
|
+
# The `FLOAT` instruction's value.
|
16
|
+
#
|
17
|
+
def initialize(value)
|
18
|
+
super(:FLOAT,value)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
require 'python/pickle/instructions/has_value'
|
3
|
+
|
4
|
+
module Python
|
5
|
+
module Pickle
|
6
|
+
module Instructions
|
7
|
+
#
|
8
|
+
# Represents a pickle `FRAME` instruction.
|
9
|
+
#
|
10
|
+
# @note introduced in protocol 4.
|
11
|
+
#
|
12
|
+
class Frame < Instruction
|
13
|
+
|
14
|
+
include HasValue
|
15
|
+
|
16
|
+
#
|
17
|
+
# Initializes the `FRAME` instruction.
|
18
|
+
#
|
19
|
+
# @param [Integer] value
|
20
|
+
# The frame's length in bytes.
|
21
|
+
#
|
22
|
+
def initialize(value)
|
23
|
+
super(:FRAME,value)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'python/pickle/instruction'
|
2
|
+
|
3
|
+
module Python
|
4
|
+
module Pickle
|
5
|
+
module Instructions
|
6
|
+
#
|
7
|
+
# Represents a pickle `FROZENSET` instruction.
|
8
|
+
#
|
9
|
+
# @note introduced in protocol 4.
|
10
|
+
#
|
11
|
+
class FrozenSet < Instruction
|
12
|
+
|
13
|
+
#
|
14
|
+
# Initializes the `FROZENSET` instruction.
|
15
|
+
#
|
16
|
+
def initialize
|
17
|
+
super(:FROZENSET)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
# The `FROZENSET` instruction.
|
23
|
+
FROZENSET = FrozenSet.new
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|