Skip to content

Commit a645222

Browse files
author
Kairo de Araujo
committed
Document the cache logic in tern_report
The logic is easy, but add some quick reference. Signed-off-by: Kairo de Araujo <[email protected]>
1 parent f8e5267 commit a645222

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tern_api/reports.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,17 @@ def tern_report(
8181
"""
8282

8383
if cache:
84+
# If a API user is using the cache, first try to load the cached
85+
# instead doing a new call to the tern.
8486
try:
8587
with open(cache_file, "r") as f:
8688
report = json.load(f)
8789
return report
88-
8990
except FileNotFoundError:
91+
# call the tern and dump it to the cache
9092
report = tern(command)
9193
with open(cache_file, "w") as f:
9294
json.dump(report, f, indent=2)
93-
9495
else:
9596
report = tern(command)
9697

0 commit comments

Comments
 (0)