MCPcopy
hub / github.com/nltk/nltk / close

Method close

nltk/corpus/reader/util.py:217–228  ·  view source on GitHub ↗

Close the file stream associated with this corpus view. This can be useful if you are worried about running out of file handles (although the stream should automatically be closed upon garbage collection of the corpus view). If the corpus view is accessed a

(self)

Source from the content-addressed store, hash-verified

215 self._stream = open(self._fileid, "rb")
216
217 def close(self):
218 """
219 Close the file stream associated with this corpus view. This
220 can be useful if you are worried about running out of file
221 handles (although the stream should automatically be closed
222 upon garbage collection of the corpus view). If the corpus
223 view is accessed after it is closed, it will be automatically
224 re-opened.
225 """
226 if self._stream is not None:
227 self._stream.close()
228 self._stream = None
229
230 def __enter__(self):
231 return self

Callers 15

__exit__Method · 0.95
iterate_fromMethod · 0.95
_check_weka_versionFunction · 0.45
writeMethod · 0.45
trainMethod · 0.45
handle_queryMethod · 0.45
handle_queryMethod · 0.45
handle_queryMethod · 0.45
handle_queryMethod · 0.45
all_eng_synsetsMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected