G-Node / G-Node/nixpy

get_sections_by_value, get_blocks_by_value

Open
#87 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
22
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Id like to suggest methods which receive a value and return all sections/blocks/data_arrays that contain that value. Something like:

``` python
def get_sections_by_value(value, nix_file):
return nix_file.find_sections(lambda x:any([any([value in i for i in
e.values]) for e in
x._properties]))

def get_blocks_by_value(value, nix_file):
return filter(lambda x:len(get_sections_by_value(value, x.metadata))>0,
nix_file.blocks)

```

but with all the corner cases and type issues solved and of course, well not in python. I think "give me all recordings in which i wrote something like whatever" is quite a usual use case. (Yes i know that this is most probaly non trivial)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.