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

reizql: META(filename=...) matcher #35

Open
isidentical opened this issue Mar 6, 2021 · 2 comments
Open

reizql: META(filename=...) matcher #35

isidentical opened this issue Mar 6, 2021 · 2 comments
Labels
good first issue Good for newcomers

Comments

@isidentical
Copy link
Member

Currently, there is no way to search in a specific project while using Reiz. Considering the intended dataset size (thousands of packages) it might be a cool idea to somehow add META() matcher for searching custom filenames. Here is an example;

Call(
    Name('something'),
    __metadata__ = META(
        filename=f'requests/%'
    )
)

this would match files only under requests/ prefix, which internally means only the requests/ repo.

@isidentical
Copy link
Member Author

isidentical commented Mar 6, 2021

Here is an example about how to search a specific filename;

query.filters = IR.combine_filters(
query.filters,
IR.filter(
IR.attribute(IR.attribute(None, "_module"), "filename"),
IR.literal(self.expected_filename),
"=",
),
)

@isidentical
Copy link
Member Author

isidentical commented Mar 6, 2021

And this is the place where you could add new metadata matchers;

@Signature.register("META", ["parent"], {"parent": None})
def convert_meta(node, state, arguments):
state.ensure(node, state.pointer == "__metadata__")
filters = None
if arguments.parent:
filters = IR.combine_filters(
filters, metadata_parent(arguments.parent, state)
)
return filters

@isidentical isidentical added the good first issue Good for newcomers label Jun 5, 2021
@isidentical isidentical changed the title reiz.reizql: META(filename=...) matcher reizql: META(filename=...) matcher Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant