Skip to content

Commit

Permalink
Add from_script classmethod to get ScriptExpression by name
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff S committed Mar 5, 2022
1 parent 17f4b45 commit ac53811
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/urtypes/crypto/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ def __init__(self, tag, expression):
def __eq__(self, o):
return self.tag == o.tag and self.expression == o.expression

@classmethod
def from_script(cls, script):
for script_expression in SCRIPT_EXPRESSION_TAG_MAP.values():
if script == script_expression.expression:
return script_expression
raise ValueError("unknown script")


SCRIPT_EXPRESSION_TAG_MAP = {
307: ScriptExpression(307, "addr"),
Expand Down

0 comments on commit ac53811

Please sign in to comment.