Skip to content

Commit

Permalink
Implementt NUMBACLS_BYPASS envvar check #3
Browse files Browse the repository at this point in the history
  • Loading branch information
anvlobachev committed Mar 12, 2024
1 parent 588919a commit acd59ac
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions numbaclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ def numbaclass(_cls=None, cache=None, writeout=None):
"""

NUMBACLS_BYPASS = 0
if (_numbacls_bypass := os.getenv("NUMBACLS_BYPASS")) is not None:
NUMBACLS_BYPASS = int(_numbacls_bypass)

# Set defaults flags
if cache is None:
cache = True
cache = False

# TODO: File cache (?)
def cached_MakeNumbaClass(cls, cache):
Expand Down Expand Up @@ -65,11 +69,10 @@ def _initcall(*args, **kwargs):

return _initcall

# TODO: Set as envvar
NUMBACLS_BYPASS = 0

def deco_bypass(cls):
print("@numbaclass conversion bypassed, NUMBACLS_BYPASS =", NUMBACLS_BYPASS)
print(
f"@numbaclass conversion bypassed: {cls.__name__}, NUMBACLS_BYPASS = {NUMBACLS_BYPASS}"
)
return cls

if _cls is None:
Expand Down

0 comments on commit acd59ac

Please sign in to comment.