/usr/lib/python2.7/dist-packages/foolscap/vocab.py is in python-foolscap 0.13.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | from hashlib import sha1
# here is the list of initial vocab tables. If the two ends negotiate to use
# initial-vocab-table-index N, then both sides will start with the words from
# INITIAL_VOCAB_TABLES[n] for their VOCABized tokens.
vocab_v0 = []
vocab_v1 = [ # all opentypes used in 0.0.6
"none", "boolean", "reference",
"dict", "list", "tuple", "set", "immutable-set",
"unicode", "set-vocab", "add-vocab",
"call", "arguments", "answer", "error",
"my-reference", "your-reference", "their-reference", "copyable",
# these are only used by storage.py
"instance", "module", "class", "method", "function",
# I'm not sure this one is actually used anywhere, but the first 127 of
# these are basically free.
"attrdict",
]
INITIAL_VOCAB_TABLES = { 0: vocab_v0, 1: vocab_v1 }
# to insure both sides agree on the actual words, we can hash the vocab table
# into a short string. This is included in the negotiation decision and
# compared by the receiving side.
def hashVocabTable(table_index):
data = "\x00".join(INITIAL_VOCAB_TABLES[table_index])
digest = sha1(data).hexdigest()
return digest[:4]
def getVocabRange():
keys = INITIAL_VOCAB_TABLES.keys()
return min(keys), max(keys)
|