Skip to content

Commit

Permalink
bump-pydantic from 1.10.9 to 2.6.0 (#954)
Browse files Browse the repository at this point in the history
* bump-pydantic
  • Loading branch information
Aayush-Goel-04 authored Mar 19, 2024
1 parent b60b609 commit 73020a4
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
8 changes: 4 additions & 4 deletions floss/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from pathlib import Path
from dataclasses import field

from pydantic import TypeAdapter, ValidationError

# we use pydantic for dataclasses so that we can
# easily load and validate JSON reports.
#
Expand All @@ -16,7 +18,6 @@
#
# really, you should just pretend we're using stock dataclasses.
from pydantic.dataclasses import dataclass
from pydantic.error_wrappers import ValidationError

import floss.logging_
from floss.render import Verbosity
Expand Down Expand Up @@ -212,9 +213,8 @@ class ResultDocument:
strings: Strings = field(default_factory=Strings)

@classmethod
def parse_file(cls, path):
# We're ignoring the following mypy error since this field is guaranteed by the Pydantic dataclass.
return cls.__pydantic_model__.parse_file(path) # type: ignore
def parse_file(cls, path: Path) -> "ResultDocument":
return TypeAdapter(cls).validate_json(path.read_text(encoding="utf-8"))


def log_result(decoded_string, verbosity):
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ dependencies = [
"tabulate==0.9.0",
"vivisect==1.1.1",
"viv-utils[flirt]==0.7.9",
"pydantic==1.10.9",
"tqdm==4.65.0",
"pydantic==2.6.0",
"tqdm==4.66.2",
"networkx==3.1",
"halo==0.0.31",
"rich==13.4.2",
Expand Down
3 changes: 2 additions & 1 deletion scripts/render-binja-import-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import base64
import logging
import argparse
from pathlib import Path

from floss.results import AddressType, ResultDocument

Expand Down Expand Up @@ -147,7 +148,7 @@ def main():
logging.basicConfig(level=logging.INFO)
logging.getLogger().setLevel(logging.INFO)

result_document = ResultDocument.parse_file(args.report_path)
result_document = ResultDocument.parse_file(Path(args.report_path))

print(render_binja_script(result_document))
return 0
Expand Down
3 changes: 2 additions & 1 deletion scripts/render-ghidra-import-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import base64
import logging
import argparse
from pathlib import Path

from floss.results import AddressType, ResultDocument

Expand Down Expand Up @@ -135,7 +136,7 @@ def main():
logging.basicConfig(level=logging.INFO)
logging.getLogger().setLevel(logging.INFO)

result_document = ResultDocument.parse_file(args.report_path)
result_document = ResultDocument.parse_file(Path(args.report_path))

print(render_ghidra_script(result_document))
return 0
Expand Down
3 changes: 2 additions & 1 deletion scripts/render-ida-import-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import base64
import logging
import argparse
from pathlib import Path

from floss.results import AddressType, ResultDocument

Expand Down Expand Up @@ -141,7 +142,7 @@ def main():
logging.basicConfig(level=logging.INFO)
logging.getLogger().setLevel(logging.INFO)

result_document = ResultDocument.parse_file(args.report_path)
result_document = ResultDocument.parse_file(Path(args.report_path))

print(render_ida_script(result_document))
return 0
Expand Down
3 changes: 2 additions & 1 deletion scripts/render-r2-import-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import base64
import logging
import argparse
from pathlib import Path

from floss.results import AddressType, ResultDocument

Expand Down Expand Up @@ -90,7 +91,7 @@ def main():
logging.basicConfig(level=logging.INFO)
logging.getLogger().setLevel(logging.INFO)

result_document = ResultDocument.parse_file(args.report_path)
result_document = ResultDocument.parse_file(Path(args.report_path))

print(render_r2_script(result_document))
return 0
Expand Down
2 changes: 1 addition & 1 deletion scripts/render-x64dbg-database.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def main():
logging.basicConfig(level=logging.INFO)
logging.getLogger().setLevel(logging.INFO)

result_document = ResultDocument.parse_file(args.report_path)
result_document = ResultDocument.parse_file(Path(args.report_path))

print(render_x64dbg_database(result_document))
return 0
Expand Down

0 comments on commit 73020a4

Please sign in to comment.