-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
875ec99
commit 098e830
Showing
8 changed files
with
83 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
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 |
---|---|---|
@@ -1,17 +1,26 @@ | ||
from Core.Code_Formatter import format_code | ||
def script(eq_expression:str,true_return,false_return='',**kwargs): | ||
card = kwargs['card'] | ||
eq_expression.replace(' ','') | ||
return true_return if iseq(eq_expression,card) else false_return | ||
|
||
def script(card,args,res): | ||
args[1].replace(' ','') | ||
if '=' in args[1]: | ||
eqs = args[1].split('=',1) | ||
if eqs[0] in card and card[eqs[0]] == eqs[1]: | ||
return args[2] | ||
def iseq(eq_expression,card) -> bool: | ||
if '=' in eq_expression: | ||
eqexp_left, eqexp_right = eq_expression.split('=',1) | ||
eqexp_left = format_eq(eqexp_left,card) | ||
eqexp_right = format_eq(eqexp_right,card) | ||
if eqexp_left == eqexp_right: | ||
return True | ||
else: | ||
if args[1].startswith('!'): | ||
if args[1][1:] not in card or args[1][1:].lower() in ['false','null']: | ||
return args[2] | ||
if args[1] in card and args[1].lower() not in ['false','null']: | ||
return args[2] | ||
if len(args) > 3: | ||
return args[3] | ||
return '' | ||
if eq_expression.startswith('!'): | ||
if format_eq(eq_expression[1:],card) in ['false','null','none', None]: | ||
return True | ||
else: | ||
if format_eq(eq_expression,card) not in ['false','null','none', None]: | ||
return True | ||
return False | ||
|
||
def format_eq(expression:str,card): | ||
if(expression.startswith('$')): | ||
return card.get(expression[1:]) | ||
else: | ||
return expression |
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