Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function of dependency level of data_types #896

Merged
merged 5 commits into from
Oct 7, 2024

Conversation

dachengx
Copy link
Collaborator

@dachengx dachengx commented Oct 5, 2024

What is the problem / what does the code in this PR do

Sometimes we want to know which plugin is higher in the dependency tree than another. This PR adds the tree_levels function of Context, which returns the dictionary containing relative information.

For Example, for a given class with Records, Peaks registered, the tree_levels will return:

{'records': {'level': 0, 'class': 'Records', 'index': 0, 'order': 0}, 'peaks': {'level': 1, 'class': 'Peaks', 'index': 0, 'order': 1}}

Can you briefly describe how it works?

Go through the dependency tree and assign level for the data_types first. The level of a data_type will be higher by at least 1 than its dependencies.

Then the data_types will be sorted by level, class, and index. Where the index is the index of this data_type in provides.

Can you give a minimal working example (or illustrate with a figure)?

Please include the following if applicable:

  • Update the docstring(s)
  • Update the documentation
  • Tests to check the (new) code is working as desired.
  • Does it solve one of the open issues on github?

Please make sure that all automated tests have passed before asking for a review (you can save the PR as a draft otherwise).

@coveralls
Copy link

coveralls commented Oct 5, 2024

Coverage Status

coverage: 90.302% (-0.03%) from 90.331%
when pulling 4a92b0d on level_in_dependency_tree
into ef2861e on master.

@dachengx dachengx marked this pull request as ready for review October 6, 2024 23:45
@dachengx dachengx requested a review from yuema137 October 7, 2024 06:57
@dachengx dachengx merged commit ad1c13e into master Oct 7, 2024
8 checks passed
@dachengx dachengx deleted the level_in_dependency_tree branch October 7, 2024 18:35
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