Skip to content

Commit

Permalink
silence some warnings about globals
Browse files Browse the repository at this point in the history
  • Loading branch information
amakelov committed Aug 21, 2024
1 parent 7267001 commit 7ac3f99
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mandala/deps/tracers/dec_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ class TrackedDict(dict):
"""
A dictionary that tracks global variable accesses.
"""
def __init__(self, original: dict):
def __init__(self, original: dict, verbose: bool = False):
self.__original__ = original
self.verbose = verbose

def __repr__(self) -> str:
return f"TrackedDict({self.__original__})"
Expand Down Expand Up @@ -82,9 +83,11 @@ def __getitem__(self, __key: str) -> Any:
)
else:
# we failed to classify this value
logger.warning(
f"Accessing global value {result} of type {type(result)} is not tracked"
)
msg = f"Accessing global value {result} of type {type(result)} is not tracked, because it couldn't be classified."
if self.verbose:
logger.warning(msg)
else:
logger.debug(msg)
return result


Expand Down

0 comments on commit 7ac3f99

Please sign in to comment.