Skip to content

Commit f3404b7

Browse files
committed
add utf-8
1 parent 8355ebe commit f3404b7

File tree

10 files changed

+13
-13
lines changed

10 files changed

+13
-13
lines changed

autointent/_dataset/_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,5 @@ def _read(self, filepath: str | Path) -> DatasetReader:
9595
Returns:
9696
DatasetReader: A validated dataset representation.
9797
"""
98-
with Path(filepath).open() as file:
98+
with Path(filepath).open(encoding="utf-8") as file:
9999
return DatasetReader.model_validate(json.load(file))

autointent/_dump_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def load( # noqa: C901, PLR0912, PLR0915
179179
if child.name == Dumper.tags:
180180
tags = {tags_dump.name: TagsList.load(tags_dump) for tags_dump in child.iterdir()}
181181
elif child.name == Dumper.simple_attrs:
182-
with child.open() as file:
182+
with child.open(encoding="utf-8") as file:
183183
simple_attrs = json.load(file)
184184
elif child.name == Dumper.arrays:
185185
arrays = dict(np.load(child))

autointent/_embedder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def load(cls, path: Path | str, override_config: EmbedderConfig | None = None) -
164164
path: Path to the directory where the model is stored.
165165
override_config: one can override presaved settings
166166
"""
167-
with (Path(path) / cls._metadata_dict_name).open() as file:
167+
with (Path(path) / cls._metadata_dict_name).open(encoding="utf-8") as file:
168168
metadata: EmbedderDumpMetadata = json.load(file)
169169

170170
if override_config is not None:

autointent/_logging/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def setup_logging(level: LogLevel | str, log_filename: Path | str | None = None)
2020
log_filename: specify location of logfile, omit extension as suffix ``.log.jsonl`` will be appended.
2121
"""
2222
config_file = ires.files("autointent._logging").joinpath("config.yaml")
23-
with config_file.open() as f_in:
23+
with config_file.open(encoding="utf-8") as f_in:
2424
config = yaml.safe_load(f_in)
2525

2626
level = LogLevel(level)

autointent/_pipeline/_pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def from_optimization_config(cls, config: dict[str, Any] | Path | str | Optimiza
123123
if isinstance(config, dict):
124124
dict_params = config
125125
else:
126-
with Path(config).open() as file:
126+
with Path(config).open(encoding="utf-8") as file:
127127
dict_params = yaml.safe_load(file)
128128
optimization_config = OptimizationConfig(**dict_params)
129129

@@ -330,7 +330,7 @@ def load(
330330
embedder_config: one can override presaved settings
331331
cross_encoder_config: one can override presaved settings
332332
"""
333-
with (Path(path) / "inference_config.yaml").open() as file:
333+
with (Path(path) / "inference_config.yaml").open(encoding="utf-8") as file:
334334
inference_nodes_configs: list[dict[str, Any]] = yaml.safe_load(file)
335335

336336
inference_config = [

autointent/_ranker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def load(cls, path: Path, override_config: CrossEncoderConfig | None = None) ->
280280
"""
281281
clf = joblib.load(path / cls._classifier_file_name)
282282

283-
with (path / cls._metadata_file_name).open() as file:
283+
with (path / cls._metadata_file_name).open(encoding="utf-8") as file:
284284
metadata: CrossEncoderMetadata = json.load(file)
285285

286286
if override_config is not None:

autointent/_vector_index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def load(
221221
embedder_batch_size: Batch size for the embedding model.
222222
embedder_use_cache: Whether to use caching for the embedding model.
223223
"""
224-
with (dir_path / cls._meta_data_file).open() as file:
224+
with (dir_path / cls._meta_data_file).open(encoding="utf-8") as file:
225225
metadata: VectorIndexMetadata = json.load(file)
226226

227227
instance = cls(
@@ -234,7 +234,7 @@ def load(
234234
)
235235
)
236236

237-
with (dir_path / cls._data_file).open() as file:
237+
with (dir_path / cls._data_file).open(encoding="utf-8") as file:
238238
data: VectorIndexData = json.load(file)
239239

240240
instance.add(**data)

autointent/modules/regex/_simple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def load(
262262
) -> "SimpleRegex":
263263
instance = cls()
264264

265-
with (Path(path) / "regex_patterns.json").open() as file:
265+
with (Path(path) / "regex_patterns.json").open(encoding="utf-8") as file:
266266
serialized: list[dict[str, Any]] = json.load(file)
267267

268268
instance._compile_regex_patterns(serialized) # noqa: SLF001

autointent/schemas/_schemas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def dump(self, path: Path) -> None:
3838
@classmethod
3939
def load(cls, path: Path) -> "TagsList":
4040
"""Load pydantic model from file system."""
41-
with path.open() as file:
41+
with path.open(encoding="utf-8") as file:
4242
serialized: list[dict[str, Any]] = json.load(file)
4343
parsed = [Tag(**t) for t in serialized]
4444
return cls(parsed)

autointent/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def load_search_space(path_or_str: Path | str) -> list[dict[str, Any]]:
1919
List of dictionaries representing the search space.
2020
"""
2121
if isinstance(path_or_str, Path):
22-
with path_or_str.open() as file:
22+
with path_or_str.open(encoding="utf-8") as file:
2323
return yaml.safe_load(file) # type: ignore[no-any-return]
2424
else:
2525
# string representation of the search space
@@ -36,5 +36,5 @@ def load_preset(name: SearchSpacePreset) -> dict[str, Any]:
3636
Dictionary representing the preset search space.
3737
"""
3838
path = ires.files("autointent._presets").joinpath(name + ".yaml")
39-
with path.open() as file:
39+
with path.open(encoding="utf-8") as file:
4040
return yaml.safe_load(file) # type: ignore[no-any-return]

0 commit comments

Comments
 (0)