Skip to content

[WIP] openalea configuration#54

Open
pradal wants to merge 19 commits into
masterfrom
config
Open

[WIP] openalea configuration#54
pradal wants to merge 19 commits into
masterfrom
config

Conversation

@pradal

@pradal pradal commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@pradal pradal requested a review from baugetfa June 4, 2026 07:44
json.dump(data, f, indent=4)


class Parameter:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For Parameter, I would use a Data Class.
Look at it

self.uid = uid
self.uri = uri

def to_dict(self):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is also directly managed by dataclass
https://docs.python.org/3/library/dataclasses.html

def __str__(self):
return f"name={self.name}, value={self.value}, unit={self.unit}, param_type={self.param_type}, description={self.description}, uid={self.uid}, uri={self.uri}"

class MyModelUnit:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The My in MyModel is just for tutos.
Rename it!

Like ModelUnitConfig

return f"name={self.name}, value={self.value}, unit={self.unit}, param_type={self.param_type}, description={self.description}, uid={self.uid}, uri={self.uri}"

class MyModelUnit:
def __init__(self, name, parameters: list):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

name: str

def __str__(self):
return f"name={self.name}, value={self.value}, unit={self.unit}, param_type={self.param_type}, description={self.description}, uid={self.uid}, uri={self.uri}"

class MyModelUnit:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You can also inherit from dict, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants