Skip to content

Commit 26ade9a

Browse files
committed
try again
1 parent 5a6c0da commit 26ade9a

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

stac_validator/validate.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -533,31 +533,32 @@ def pydantic_validator(self, stac_type: str) -> Dict:
533533
dict: A dictionary containing validation results.
534534
"""
535535
message = self.create_message(stac_type, "pydantic")
536-
536+
537537
# Initialize schema as empty list to avoid None issues
538538
message["schema"] = [""]
539539

540540
try:
541541
# Import here to make stac-pydantic an optional dependency
542542
try:
543-
print(f"Attempting to import pydantic and stac_pydantic...")
543+
print("Attempting to import pydantic and stac_pydantic...")
544544
from pydantic import ValidationError # type: ignore
545545
from stac_pydantic.extensions import validate_extensions # type: ignore
546-
print(f"Successfully imported pydantic and stac_pydantic")
546+
547+
print("Successfully imported pydantic and stac_pydantic")
547548
except ImportError as ie:
548-
print(f"Import error: {str(ie)}")
549+
print("Import error: " + str(ie))
549550
raise ImportError(
550551
"stac-pydantic is not installed. Install with 'pip install stac-validator[pydantic]'"
551552
)
552553

553554
# Validate based on STAC type
554555
if stac_type == "ITEM":
555-
print(f"Validating ITEM with stac-pydantic")
556+
print("Validating ITEM with stac-pydantic")
556557
from stac_pydantic import Item # type: ignore
557558

558559
item_model = Item.model_validate(self.stac_content)
559560
message["schema"] = ["stac-pydantic Item model"]
560-
print(f"Set schema to: {message['schema']}")
561+
print("Set schema to: " + message["schema"])
561562

562563
# Validate extensions if present
563564
if (
@@ -571,12 +572,12 @@ def pydantic_validator(self, stac_type: str) -> Dict:
571572
message["extension_schemas"] = extension_schemas
572573

573574
elif stac_type == "COLLECTION":
574-
print(f"Validating COLLECTION with stac-pydantic")
575+
print("Validating COLLECTION with stac-pydantic")
575576
from stac_pydantic import Collection # type: ignore
576577

577578
collection_model = Collection.model_validate(self.stac_content)
578579
message["schema"] = ["stac-pydantic Collection model"]
579-
print(f"Set schema to: {message['schema']}")
580+
print("Set schema to: " + message["schema"])
580581

581582
# Validate extensions if present
582583
if (
@@ -590,12 +591,12 @@ def pydantic_validator(self, stac_type: str) -> Dict:
590591
message["extension_schemas"] = extension_schemas
591592

592593
elif stac_type == "CATALOG":
593-
print(f"Validating CATALOG with stac-pydantic")
594+
print("Validating CATALOG with stac-pydantic")
594595
from stac_pydantic import Catalog # type: ignore
595596

596597
catalog_model = Catalog.model_validate(self.stac_content)
597598
message["schema"] = ["stac-pydantic Catalog model"]
598-
print(f"Set schema to: {message['schema']}")
599+
print("Set schema to: " + message["schema"])
599600

600601
# For catalogs, we don't need to validate extensions, but we still need to use the model
601602
# to avoid flake8 warnings
@@ -608,11 +609,11 @@ def pydantic_validator(self, stac_type: str) -> Dict:
608609

609610
self.valid = True
610611
message["model_validation"] = "passed"
611-
print(f"Validation passed, final message: {message}")
612+
print("Validation passed, final message: " + str(message))
612613

613614
except ImportError as e:
614615
self.valid = False
615-
print(f"Import error in pydantic_validator: {str(e)}")
616+
print("Import error in pydantic_validator: " + str(e))
616617
message.update(self.create_err_msg("ImportError", str(e)))
617618
except ValidationError as e:
618619
self.valid = False

0 commit comments

Comments
 (0)