Skip to content
This repository was archived by the owner on Oct 16, 2023. It is now read-only.
This repository was archived by the owner on Oct 16, 2023. It is now read-only.

Gafferpy tidy up operation parameter handling #896

@t92549

Description

@t92549

Currently in the Gafferpy codebase there is a non-pythonic pattern of processing operation parameters by doing something like this:

if conditional is not None:
if not isinstance(conditional, Conditional):
self.conditional = JsonConverter.from_json(conditional,
Conditional)
else:
self.conditional = conditional
else:
self.conditional = None

Not only is this over-complicated, but it causes bugs when one of those cases is missed (#870).
Fishbowl does not have this issue due to the nature of it having no error checking and presuming everything is json.

@sw96411 suggested an improvement on #890 (comment) which is more pythonic, easier to read and less bug prone.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions