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

Two for the price #40

Open
Maxim-MDProjects opened this issue Jul 11, 2023 · 0 comments
Open

Two for the price #40

Maxim-MDProjects opened this issue Jul 11, 2023 · 0 comments

Comments

@Maxim-MDProjects
Copy link

Maxim-MDProjects commented Jul 11, 2023

Hello.
I need to load several files from disk into one, how should I do it?
None of the options below worked

def load_bloom_filter(directory):
    bloom_filter = None
    for filename in sorted(os.listdir(directory)):
        file_path = os.path.join(directory, filename)
        if bloom_filter is None:
            bloom_filter = BloomFilter.fromfile(open(file_path, 'rb'))
            print("len1:", len(bloom_filter))
        else:
            bloom_filter_new = BloomFilter.fromfile(open(file_path, 'rb'))
            print("len2:", len(bloom_filter_new))
            bloom_filter = bloom_filter_new.copy() #v1
            bloom_filter |= bloom_filter_new       #v2
    return bloom_filter

.add does not fit because there are many elements

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