Skip to content

ChromaUris is defined twice (uris-scoped class is shadowed by the metadata-scoped one) #4

Description

@thorwhalen

chromadol/base.py defines two different classes both named ChromaUris at module scope:

@appendable(item2kv=uuid_key)
@ValueCodecs.single_nested_value("uris")
class ChromaUris(ChromaCollection):
    """ChromaCollection but reading and writing only the 'uris' field."""


@appendable(item2kv=uuid_key)
@ValueCodecs.single_nested_value("metadata")
class ChromaUris(ChromaCollection):
    """ChromaCollection but reading and writing only the 'uris' field."""

The second definition (metadata-scoped) silently shadows the first (uris-scoped) at module scope, so chromadol.base.ChromaUris currently always resolves to the metadata-field class, and the uris-field class is unreachable by name from outside the module (only reachable if something captured a reference before the second class statement executed, e.g. within the same module body). The metadata-scoped class's docstring is also copy-pasted from the uris one ("...only the 'uris' field").

Likely fix: rename the second class to ChromaMetadata and fix its docstring. Worth a quick audit of chromadol/__init__.py's __all__/exports and any docs referencing ChromaUris for the metadata use case, since they may currently be describing the wrong name.

Noticed while landing #2 (#3) — unrelated to that fix, left untouched there.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions