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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Use `open()` instead of `codecs.open()`, which is deprecated in Python 3.14

## [0.28.0] - 2026-04-19

### Fixed
Expand Down
9 changes: 4 additions & 5 deletions flattentool/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import codecs
import datetime
import json
import sys
Expand Down Expand Up @@ -373,7 +372,7 @@ def unflatten(
if output_name is None:
sys.stdout.buffer.write(xml_output)
else:
with codecs.open(output_name, "wb") as fp:
with open(output_name, "wb") as fp:
fp.write(xml_output)
else:
if output_name is None:
Expand All @@ -383,7 +382,7 @@ def unflatten(
)
)
else:
with codecs.open(output_name, "w", encoding="utf-8") as fp:
with open(output_name, "w", encoding="utf-8", newline="") as fp:
json.dump(
base,
fp,
Expand All @@ -392,7 +391,7 @@ def unflatten(
ensure_ascii=False,
)
if cell_source_map:
with codecs.open(cell_source_map, "w", encoding="utf-8") as fp:
with open(cell_source_map, "w", encoding="utf-8", newline="") as fp:
json.dump(
cell_source_map_data,
fp,
Expand All @@ -401,7 +400,7 @@ def unflatten(
ensure_ascii=False,
)
if heading_source_map:
with codecs.open(heading_source_map, "w", encoding="utf-8") as fp:
with open(heading_source_map, "w", encoding="utf-8", newline="") as fp:
json.dump(
heading_source_map_data,
fp,
Expand Down
5 changes: 2 additions & 3 deletions flattentool/json_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

"""

import codecs
import copy
import os
import tempfile
Expand Down Expand Up @@ -236,7 +235,7 @@ def __init__(
)

if self.xml:
with codecs.open(json_filename, "rb") as xml_file:
with open(json_filename, "rb") as xml_file:
top_dict = xmltodict.parse(
xml_file,
force_list=(root_list_path,),
Expand Down Expand Up @@ -306,7 +305,7 @@ def __init__(
else:
path = root_list_path.replace("/", ".") + ".item"

json_file = codecs.open(json_filename, "rb")
json_file = open(json_filename, "rb")

self.root_json_list = ijson.items(json_file, path, map_type=OrderedDict)

Expand Down
5 changes: 2 additions & 3 deletions flattentool/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import print_function, unicode_literals

import codecs
import os
import sys
from collections import OrderedDict, UserDict
Expand Down Expand Up @@ -163,7 +162,7 @@ def __init__(
)
else:
if disable_local_refs:
with codecs.open(schema_filename, encoding="utf-8") as schema_file:
with open(schema_filename, encoding="utf-8") as schema_file:
self.root_schema_dict = jsonref.load(
schema_file,
object_pairs_hook=OrderedDict,
Expand All @@ -179,7 +178,7 @@ def __init__(
"file:",
urllib.pathname2url(os.path.abspath(schema_filename)),
)
with codecs.open(schema_filename, encoding="utf-8") as schema_file:
with open(schema_filename, encoding="utf-8") as schema_file:
self.root_schema_dict = jsonref.load(
schema_file,
object_pairs_hook=OrderedDict,
Expand Down
Loading