-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add enabled flag to main Enforcer function and update docs accordingly.
- Loading branch information
1 parent
8003db3
commit 67ecd6c
Showing
11 changed files
with
123 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ def __init__(self): | |
self.a = 10 | ||
|
||
def my_fn(self, b: int): | ||
print(self.a, b) | ||
pass | ||
|
||
|
||
mc = my_class() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type_enforced | ||
|
||
@type_enforced.Enforcer() | ||
def my_fn(a: int): | ||
return None | ||
|
||
@type_enforced.Enforcer(enabled = False) | ||
def my_fn2(a: int): | ||
return None | ||
|
||
success = True | ||
|
||
try: | ||
my_fn(a=1) | ||
my_fn2(a=1) | ||
my_fn2(a='1') | ||
except: | ||
success = False | ||
|
||
try: | ||
my_fn(a='1') | ||
success = False | ||
except: | ||
pass | ||
|
||
if success: | ||
print("test_fn_15.py passed") | ||
else: | ||
print("test_fn_15.py failed") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import sys | ||
|
||
from .enforcer import Enforcer, FunctionMethodEnforcer, EnforcerIgnore | ||
from .enforcer import Enforcer, FunctionMethodEnforcer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters