MCPcopy Index your code
hub / github.com/python/cpython / _update

Method _update

Lib/dbm/dumb.py:91–107  ·  view source on GitHub ↗
(self, flag)

Source from the content-addressed store, hash-verified

89
90 # Read directory file into the in-memory index dict.
91 def _update(self, flag):
92 self._modified = False
93 self._index = {}
94 try:
95 f = _io.open(self._dirfile, 'r', encoding="Latin-1")
96 except OSError:
97 if flag not in ('c', 'n'):
98 raise
99 with self._io.open(self._dirfile, 'w', encoding="Latin-1") as f:
100 self._chmod(self._dirfile)
101 else:
102 with f:
103 for line in f:
104 line = line.rstrip()
105 key, pos_and_siz_pair = _ast.literal_eval(line)
106 key = key.encode('Latin-1')
107 self._index[key] = pos_and_siz_pair
108
109 # Write the index dict to the directory file. The original directory
110 # file (if any) is renamed with a .bak extension first. If a .bak

Callers 1

__init__Method · 0.95

Calls 4

_chmodMethod · 0.95
openMethod · 0.45
rstripMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected