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

Refactor conditional logic in partition/auto.py to use a hash map instead of conditional statements #601

Closed
MthwRobinson opened this issue May 17, 2023 · 2 comments

Comments

@MthwRobinson
Copy link
Contributor

The goal of this issue is to refactor conditional logic in partition/auto.py to use a hash map instead of conditional statements. #591 implemented a similar refactor for file_utils/filetype.py.

@qued
Copy link
Contributor

qued commented May 17, 2023

So like a map from filetype to the function that processes that type?

@MthwRobinson
Copy link
Contributor Author

Yeah something like:

PARTITION_MAP = {
    FileType.EML: partial(partition_email(encoding=encoding))

}

...

partition_func = PARTITION_MAP.get(FileType.EML)
elements = partition_func(filename=filename, file=file)

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

3 participants