Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Use ConvertResult for FTs #741

Merged
merged 5 commits into from
Jul 2, 2024
Merged

Use ConvertResult for FTs #741

merged 5 commits into from
Jul 2, 2024

Conversation

jpkrajewski
Copy link
Collaborator

@jpkrajewski jpkrajewski commented Jun 26, 2024

Pull Request summary:

  • Return ConvertResult from FT transformation
  • Refactor all converters

Description of changes:

[Add more in depth analysis of what changed, provide logs, examples of usage]

Checklist:

  • Make sure to run pre-commit before committing changes
  • Make sure all checks have passed
  • PR description is clear and comprehensive
  • Mentioned the issue that this PR solves (if applicable)
  • Make sure you test the changes

@jpkrajewski jpkrajewski requested a review from sbasan June 26, 2024 13:59
@jpkrajewski jpkrajewski requested a review from radkrawczyk June 27, 2024 12:12
@jpkrajewski jpkrajewski marked this pull request as ready for review June 27, 2024 12:13
supported_template_types: Tuple = tuple()

def __init__(self) -> None:
if not self.supported_template_types:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think about returning the "unsupported" conversion_result instead of raising the exception?

Copy link
Collaborator Author

@jpkrajewski jpkrajewski Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure good idea 👍

raise ValueError("supported_template_types must be defined in the subclass")
self._convert_result = ConvertResult[AnyParcel]()

def create_parcel(self, name: str, description: str, template_values: dict) -> Optional[AnyParcel]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

@jpkrajewski jpkrajewski Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed FTConverter to abstract class and used abstractmethod

@jpkrajewski jpkrajewski requested a review from radkrawczyk June 28, 2024 12:24
@jpkrajewski jpkrajewski merged commit 12d21df into dev-uxmt Jul 2, 2024
10 checks passed
@jpkrajewski jpkrajewski deleted the kuba/convert-result-ft branch July 2, 2024 13:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants