Skip to content

Commit 4fa7eca

Browse files
author
patrick
committed
change dict to model dump
1 parent 33ebee9 commit 4fa7eca

File tree

8 files changed

+6
-6
lines changed

8 files changed

+6
-6
lines changed

pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ classifiers = [
66
"Development Status :: 3 - Alpha",
77
"License :: OSI Approved :: MIT License",
88
"Operating System :: OS Independent",
9-
"Programming Language :: Python :: 3.10",
109
"Programming Language :: Python :: 3.11",
1110
"Programming Language :: Python :: 3.12",
12-
"Programming Language :: Python :: 3.8",
13-
"Programming Language :: Python :: 3.9",
1411
]
1512
description = "A Python boilet template for different types of projects."
1613
dynamic = ["version"]

src/qpystructs/cli/__init__.py

Whitespace-only changes.

src/qpystructs/differ.py

Whitespace-only changes.

src/qpystructs/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def to_json(self, by_alias=True):
3333
return self.model_dump_json(by_alias=by_alias, exclude_none=True)
3434

3535
def to_dict(self, by_alias=True):
36-
return self.dict(by_alias=by_alias, exclude_none=True)
36+
return self.model_dump(by_alias=by_alias, exclude_none=True)
3737

3838

3939
class GenericDataModel(CamelModel, BaseModel):

src/qpystructs/operations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ def differ(expected_data: Union[str, dict], actual_data: Union[str, dict]):
159159
return extract_obj_diff(DeepDiff(v1, v2, verbose_level=2))
160160

161161

162-
def json_file_to_excel(json_file, excel_file):
162+
def json_file_to_excel(json_file, excel_file,record_path=None):
163163
"""
164164
json file to excel
165165
"""
166166
json_data = load_from_file(json_file)
167-
json_data_df = pd.json_normalize(json_data)
167+
json_data_df = pd.json_normalize(json_data,record_path=record_path)
168168
json_data_df.to_excel(excel_file)
169169

170170

src/qpystructs/server/__init__.py

Whitespace-only changes.

src/qpystructs/ui/__init__.py

Whitespace-only changes.

tests/test_operations.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,6 @@ def test_merged_cell():
7474
json_file_to_excel("tmp.json", 'tmp-json.xlsx')
7575
result = read_merged_excel("merged_cell.xlsx")
7676
print(result)
77+
78+
# def test_json_to_excel():
79+
# json_file_to_excel("test.json", 'test.xlsx',record_path="data")

0 commit comments

Comments
 (0)