Repository navigation
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Codec
contextargument, additive tokey#1556New 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
Uh oh!
There was an error while loading. Please reload this page.
Codec
contextargument, additive tokey#1556Changes from 1 commit
f264d41a4028f665b54974f157efFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
contextargument, additive tokey`encode`/`decode` overloaded a single `key` dict with two unrelated things: primary key values, and connection context (`_schema`, `_table`, `_field`, `_config`). The underscore convention separating them is unenforced, and `_config` -- functionally required for correct store resolution in any multi-connection process -- arrived as an optional dict key a codec author had to remember to read out and thread through by hand. Forgetting did not fail loudly: it fell back to the global config and resolved a different store silently. That happened twice independently, in dj-figpack-codecs#6 and dj-canvasxpress-codecs#3, both following the SchemaCodec docstring. Adds `context` as a separate keyword carrying schema, table, field and config, leaving `key` to mean what it means everywhere else in DataJoint. Nothing breaks: - DataJoint passes `context` only to codecs whose signature declares it, reusing the introspection already used for `store_name`. A codec written before this keeps its old signature and is called exactly as before. - The underscore keys stay in `key` and are still populated, so a codec reading `key["_config"]` directly keeps working. - `_extract_context(key)` still accepts one argument. It warns only when it has to fall back to underscore keys, so a codec passing context is quiet and one that never needed context is never nagged. Verified against all four third-party codecs in the ecosystem (dj-figpack, dj-canvasxpress, dj-zarr, dj-photon): every one declares the old signature, so none is passed `context` and none needs changing. `Codec._codec_config(key, context)` replaces the hand-rolled `(key or {}).get("_config")` at eleven sites across the built-ins, preferring context and falling back to the legacy key. The breaking half of #1550 -- `key` reverting to primary-key-only and `config` becoming a required parameter on `_build_path`/`_get_backend` -- is deliberately not done here. It belongs in 2.4, after the deprecation window this opens.Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
Uh oh!
There was an error while loading. Please reload this page.