Make sha256 private to avoid confusion for the end user.

This commit is contained in:
Dave Halter
2017-05-21 17:35:32 -04:00
parent 4ca92861c6
commit 3a0cd6d377
2 changed files with 2 additions and 2 deletions

View File

@@ -155,7 +155,7 @@ def _get_hashed_path(grammar, path, cache_path=None):
directory = _get_cache_directory_path(cache_path=cache_path)
file_hash = hashlib.sha256(path.encode("utf-8")).hexdigest()
return os.path.join(directory, '%s-%s.pkl' % (grammar.sha256, file_hash))
return os.path.join(directory, '%s-%s.pkl' % (grammar._sha256, file_hash))
def _get_cache_directory_path(cache_path=None):

View File

@@ -9,7 +9,7 @@ class Grammar(object):
self._parser = parser
self._tokenizer = tokenizer
self._diff_parser = diff_parser
self.sha256 = hashlib.sha256(bnf_text.encode("utf-8")).hexdigest()
self._sha256 = hashlib.sha256(bnf_text.encode("utf-8")).hexdigest()
def __repr__(self):
labels = self._pgen_grammar.symbol2number.values()