MCPcopy Index your code
hub / github.com/clips/pattern / get

Method get

pattern/web/cache/__init__.py:106–117  ·  view source on GitHub ↗

Returns the data stored with the given id. With unicode=True, returns a Unicode string.

(self, k, unicode=True)

Source from the content-addressed store, hash-verified

104 pass
105
106 def get(self, k, unicode=True):
107 """ Returns the data stored with the given id.
108 With unicode=True, returns a Unicode string.
109 """
110 if k in self:
111 f = open(self._hash(k), "rb"); v=f.read().lstrip(codecs.BOM_UTF8)
112 f.close()
113 if unicode is True:
114 return decode_utf8(v)
115 else:
116 return v
117 raise KeyError, k
118
119 def age(self, k):
120 """ Returns the age of the cached item, in days.

Callers 15

__getitem__Method · 0.95
downloadMethod · 0.45
replace_entityFunction · 0.45
__getattr__Method · 0.45
__getitem__Method · 0.45
searchMethod · 0.45
translateMethod · 0.45
identifyMethod · 0.45
searchMethod · 0.45
searchMethod · 0.45
searchMethod · 0.45
answerMethod · 0.45

Calls 4

_hashMethod · 0.95
decode_utf8Function · 0.85
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected