Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tealish/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ def assemble_with_goal(teal: str) -> Tuple[bytes, SourceMap]:
raise Exception("goal not found in path")
except subprocess.CalledProcessError as e:
raise Exception(e.output)
bytecode = open(tmp_out_filename, "rb").read()
algod_sourcemap = json.load(open(tmp_out_filename + ".map"))
with open(tmp_out_filename, "rb") as f:
bytecode = f.read()
with open(tmp_out_filename + ".map", "r") as f:
algod_sourcemap = json.load(f)
return bytecode, SourceMap(algod_sourcemap)


Expand Down
3 changes: 2 additions & 1 deletion tealish/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def _build(
teal_filename = output_path / f"{base_filename}.teal"
if not quiet:
click.echo(f"Compiling {path} to {teal_filename}")
teal, tealish_map = _compile_program(open(path).read())
with open(path, "r") as f:
teal, tealish_map = _compile_program(f.read())
teal_string = "\n".join(teal + [""])
with open(teal_filename, "w") as f:
f.write("\n".join(teal + [""]))
Expand Down
3 changes: 2 additions & 1 deletion tealish/langspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ def get_field_type(self, namespace: str, name: str) -> str:

local_lang_spec: Optional[LangSpec] = None
if os.path.exists("langspec.json"):
local_lang_spec = LangSpec(json.load(open("langspec.json")))
with open("langspec.json", "r") as f:
local_lang_spec = LangSpec(json.load(f))


def get_active_langspec() -> LangSpec:
Expand Down