Skip to content

Commit

Permalink
for andy
Browse files Browse the repository at this point in the history
  • Loading branch information
SCHREIBER Martin committed Jan 10, 2025
1 parent 623028b commit 7bb9aa3
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 79 deletions.
15 changes: 7 additions & 8 deletions src/psyclone/parse/file_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,13 @@ def get_source_code(self, verbose: bool = False) -> str:
f"FileInfo: No such file or directory '{self._filename}'."
) from err

# Compute hash sum which will be used to check cache of fparser tree
self._source_code_hash_sum = hashlib.md5(
self._source_code.encode()
).hexdigest()
if self._use_caching:
# Only update if caching is used.
# Compute hash sum which will be used to
# check cache of fparser tree
self._source_code_hash_sum = hashlib.md5(
self._source_code.encode()
).hexdigest()

return self._source_code

Expand Down Expand Up @@ -392,10 +395,6 @@ def get_fparser_tree(
raise FileInfoFParserError(
f"File '{self._filename}' not found:\n{str(err)}")

if self._source_code_hash_sum is None:
raise PSycloneError(
"Hash sum should be set after loading the source")

# Check for cache
self._cache_load(verbose=verbose)

Expand Down
Loading

0 comments on commit 7bb9aa3

Please sign in to comment.