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

Slow indexing of folder tree #200

Open
RichieHakim opened this issue Oct 3, 2022 · 1 comment
Open

Slow indexing of folder tree #200

RichieHakim opened this issue Oct 3, 2022 · 1 comment

Comments

@RichieHakim
Copy link

RichieHakim commented Oct 3, 2022

Using the iPython OSF object, it is very slow to walk through a tree structure of folders in order to index the data repo.

import osfclient
client = osfclient.OSF()
proj = client.project('url_id')

def build_folder_tree(folder):
    subfolders = list(folder.folders)
    tree = {}
    for sub in subfolders:
        tree_sub = build_folder_tree(sub)
        tree[sub.name] = tree_sub
    if tree == {}:
        tree = (f for f in folder.files)
    return tree

tree = build_folder_tree(proj.storage())

Is there an easier way to build a hierarchical index of a project repo so that one can quickly

@RichieHakim
Copy link
Author

RichieHakim commented Oct 3, 2022

Also finding that the files that are listed from folder.files are incorrect. It skips some files and makes redundant other files. This is a serious issue and makes the tool somewhat useless.

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

No branches or pull requests

1 participant