Skip to content

Implement a search by comment function #982

Description

@MicahGale

Is your feature request related to a problem? Please describe.

Many times MCNP objects are identifiable by their comments, and less so their number. It's desirable to be able to find objects by what their comments contain.

Describe the solution you'd like

I was thinking in NumberedOjbectCollection (also it may be time to make MCNP_Problem.data_inputs its own class) of implementing something like:

import re

def get_by_comment(self, searcher: str | re.Pattern): -> Generator[MCNP_Object, None, None]
     pass

Or also possible following montepy.Materials.get_containing_(all|any) where you can search by multiple strings.

Describe alternatives you've considered

For now users can just do this manually (after #i972).

Additional context

This is a follow-on to #185.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestAn issue that improves the user interface.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions