Skip to content

Commit 01edc0c

Browse files
ruff: PLW1514 fix
1 parent 57b1855 commit 01edc0c

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

data/regenerate_test_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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:

docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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}" ;;

jsnac/utils/jsnac_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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")

tests/test_schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
# Load our example JSON data and schema
99
test_json_file = Path("data/example.json")
1010
test_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

0 commit comments

Comments
 (0)