bump-pydantic from 1.10.9 to 2.6.0 (#954)

* bump-pydantic
This commit is contained in:
Aayush Goel 2024-03-19 12:53:33 +05:30 committed by GitHub
parent b60b6098c0
commit 73020a427b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 15 additions and 11 deletions

View file

@ -8,6 +8,8 @@ from typing import Dict, List
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.
#
@ -16,7 +18,6 @@ from dataclasses import field
#
# 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
@ -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):

View file

@ -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",

View file

@ -25,6 +25,7 @@ import sys
import base64
import logging
import argparse
from pathlib import Path
from floss.results import AddressType, ResultDocument
@ -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

View file

@ -25,6 +25,7 @@ import sys
import base64
import logging
import argparse
from pathlib import Path
from floss.results import AddressType, ResultDocument
@ -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

View file

@ -24,6 +24,7 @@ import sys
import base64
import logging
import argparse
from pathlib import Path
from floss.results import AddressType, ResultDocument
@ -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

View file

@ -25,6 +25,7 @@ import sys
import base64
import logging
import argparse
from pathlib import Path
from floss.results import AddressType, ResultDocument
@ -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

View file

@ -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