Repository navigation
Expand file tree
/
Copy pathstringstore.jade
More file actions
107 lines (79 loc) · 2.23 KB
/
Copy pathstringstore.jade
File metadata and controls
107 lines (79 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//- 💫 DOCS > API > STRINGSTORE
include ../../_includes/_mixins
p Map strings to and from integer IDs.
+h(2, "init") StringStore.__init__
+tag method
p Create the #[code StringStore].
+table(["Name", "Type", "Description"])
+row
+cell #[code strings]
+cell -
+cell A sequence of unicode strings to add to the store.
+footrow
+cell return
+cell #[code StringStore]
+cell The newly constructed object.
+h(2, "len") StringStore.__len__
+tag method
p Get the number of strings in the store.
+table(["Name", "Type", "Description"])
+footrow
+cell return
+cell int
+cell The number of strings in the store.
+h(2, "getitem") StringStore.__getitem__
+tag method
p Retrieve a string from a given integer ID, or vice versa.
+table(["Name", "Type", "Description"])
+row
+cell #[code string_or_id]
+cell bytes / unicode / int
+cell The value to encode.
+footrow
+cell return
+cell unicode / int
+cell The value to retrieved.
+h(2, "contains") StringStore.__contains__
+tag method
p Check whether a string is in the store.
+table(["Name", "Type", "Description"])
+row
+cell #[code string]
+cell unicode
+cell The string to check.
+footrow
+cell return
+cell bool
+cell Whether the store contains the string.
+h(2, "iter") StringStore.__iter__
+tag method
p Iterate over the strings in the store, in order.
+table(["Name", "Type", "Description"])
+footrow
+cell yield
+cell unicode
+cell A string in the store.
+h(2, "dump") StringStore.dump
+tag method
p Save the strings to a JSON file.
+table(["Name", "Type", "Description"])
+row
+cell #[code file]
+cell buffer
+cell The file to save the strings.
+footrow
+cell return
+cell #[code None]
+cell -
+h(2, "load") StringStore.load
+tag method
p Load the strings from a JSON file.
+table(["Name", "Type", "Description"])
+row
+cell #[code file]
+cell buffer
+cell The file from which to load the strings.
+footrow
+cell return
+cell #[code None]
+cell -