File tree Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ def write_json(file: str) -> None: # noqa: D103
3232 input_file = Path (file )
3333 output_file = input_file .with_suffix (".json" )
3434 try :
35- with input_file .open () as f :
35+ with input_file .open (encoding = "utf-8" ) as f :
3636 example_yaml_data = yaml .safe_load (f .read ())
3737 f .close ()
3838 except yaml .YAMLError as e :
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ while getopts 'bcr' flag; do
3131 sudo docker rm $( sudo docker ps -qaf name=jsnac)
3232 sudo docker build -t jsnac .
3333 sudo docker image rm $( sudo docker image list -qf dangling=true)
34- sudo docker run -d --name jsnac jsnac
34+ sudo docker run -it --name jsnac jsnac
3535 exit 0
3636 ;;
3737 * ) error " Unexpected option ${flag} " ;;
Original file line number Diff line number Diff line change @@ -128,12 +128,12 @@ def main(args: str | None = None) -> None:
128128 jsnac = SchemaBuilder ()
129129 if flags .json :
130130 log .debug ("Using JSON file: %s" , flags .file )
131- with input_file .open () as f :
131+ with input_file .open (encoding = "utf-8" ) as f :
132132 jsnac .add_json (f .read ())
133133 f .close ()
134134 else :
135135 log .debug ("Using YAML file: %s" , flags .file )
136- with input_file .open () as f :
136+ with input_file .open (encoding = "utf-8" ) as f :
137137 jsnac .add_yaml (f .read ())
138138 f .close ()
139139 # Build the schema and record the time taken
@@ -144,7 +144,7 @@ def main(args: str | None = None) -> None:
144144 log .info ("Schema built in %.4f seconds" , duration )
145145 # Write the schema to a file
146146 schema_file = Path (flags .output )
147- with schema_file .open (mode = "w" ) as f :
147+ with schema_file .open (mode = "w" , encoding = "utf-8" ) as f :
148148 f .write (schema )
149149 log .info ("Schema written to: %s" , schema_file )
150150 log .info ("JSNAC CLI complete" )
Original file line number Diff line number Diff line change 88# Load our example JSON data and schema
99test_json_file = Path ("data/example.json" )
1010test_schema_file = Path ("data/example.schema.json" )
11- with test_json_file .open () as f :
11+ with test_json_file .open (encoding = "utf-8" ) as f :
1212 test_json_data = json .loads (f .read ())
1313 f .close ()
14- with test_schema_file .open () as f :
14+ with test_schema_file .open (encoding = "utf-8" ) as f :
1515 test_json_schema = json .loads (f .read ())
1616 f .close ()
1717
You can’t perform that action at this time.
0 commit comments