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

cleanup clobber/mode #661

Open
Carreau opened this issue Nov 30, 2020 · 0 comments
Open

cleanup clobber/mode #661

Carreau opened this issue Nov 30, 2020 · 0 comments

Comments

@Carreau
Copy link
Contributor

Carreau commented Nov 30, 2020

It looks like there is a redundancy between a clobber/mode keyword arguments that can be simplified; my guess is it used to be a boolean, and has been changed for mode that allow 3 states (r,w,a):

$ rg clobber
zarr/convenience.py
75:    clobber = mode == 'w'
78:    store = normalize_store_arg(store, clobber=clobber,
135:    store = normalize_store_arg(store, clobber=True)
206:    store = normalize_store_arg(store, clobber=True)

zarr/hierarchy.py
1038:def _normalize_store_arg(store, *, clobber=False, storage_options=None, mode=None):
1041:    return normalize_store_arg(store, clobber=clobber,
1151:    clobber = mode != "r"
1153:        store, clobber=clobber, storage_options=storage_options, mode=mode
1156:        chunk_store = _normalize_store_arg(chunk_store, clobber=clobber,

zarr/storage.py
1398:        # get clobbered
1701:            flag = 'c' + flag[1:]  # don't clobber an existing database
1721:                        flag = 'c' + flag[1:]  # don't clobber an existing database

zarr/creation.py
132:def normalize_store_arg(store, clobber=False, storage_options=None, mode='w'):
136:        mode = mode if clobber else "r"
453:    clobber = (mode == 'w')
454:    store = normalize_store_arg(store, clobber=clobber, storage_options=storage_options, mode=mode)
456:        chunk_store = normalize_store_arg(chunk_store, clobber=clobber,

Clobber also does not seem to be exposed to any external API so can likely be removed.

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