4
4
import json
5
5
import logging
6
6
import os
7
- import subprocess
8
7
import shutil
8
+ import subprocess
9
9
from pathlib import Path
10
10
from typing import TYPE_CHECKING , Dict , List , Optional
11
11
15
15
from crytic_compile .platform .exceptions import InvalidCompilation
16
16
from crytic_compile .platform .types import Type
17
17
from crytic_compile .utils .naming import convert_filename
18
- from crytic_compile .utils .subprocess import run
19
18
20
19
# Handle cycle
21
20
from crytic_compile .utils .natspec import Natspec
@@ -112,8 +111,18 @@ def compile(self, crytic_compile: "CryticCompile", **kwargs: str) -> None:
112
111
source_unit .ast = ast
113
112
114
113
def add_source_files (self , file_paths : List [str ]) -> None :
114
+ """
115
+ Append files
116
+
117
+ Args:
118
+ file_paths (List[str]): files to append
119
+
120
+ Returns:
121
+
122
+ """
123
+
115
124
for file_path in file_paths :
116
- with open (file_path , "r" ) as f :
125
+ with open (file_path , "r" , encoding = "utf8" ) as f :
117
126
self .standard_json_input ["sources" ][file_path ] = {
118
127
"content" : f .read (),
119
128
}
@@ -163,18 +172,14 @@ def _guessed_tests(self) -> List[str]:
163
172
164
173
165
174
def _run_vyper_standard_json (
166
- standard_json_input : Dict ,
167
- vyper : str ,
168
- env : Optional [Dict ] = None ,
169
- working_dir : Optional [str ] = None ,
175
+ standard_json_input : Dict , vyper : str , env : Optional [Dict ] = None
170
176
) -> Dict :
171
177
"""Run vyper and write compilation output to a file
172
178
173
179
Args:
174
180
standard_json_input (Dict): Dict containing the vyper standard json input
175
181
vyper (str): vyper binary
176
182
env (Optional[Dict], optional): Environment variables. Defaults to None.
177
- working_dir (Optional[str], optional): Working directory. Defaults to None.
178
183
179
184
Raises:
180
185
InvalidCompilation: If vyper failed to run
@@ -194,7 +199,7 @@ def _run_vyper_standard_json(
194
199
) as process :
195
200
196
201
stdout_b , stderr_b = process .communicate (json .dumps (standard_json_input ).encode ("utf-8" ))
197
- stdout , stderr = (
202
+ stdout , _stderr = (
198
203
stdout_b .decode (),
199
204
stderr_b .decode (errors = "backslashreplace" ),
200
205
) # convert bytestrings to unicode strings
0 commit comments