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

Fix/pymongo new version #2462

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed default event.uuid
- Fixed atlas vector search
- Fix the bug where shared artifacts are deleted when removing a component.
- Fix compatibility issues with the latest version of pymongo.

#### New Features & Functionality

Expand Down
2 changes: 1 addition & 1 deletion plugins/mongodb/superduper_mongodb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .metadata import MongoMetaDataStore as MetaDataStore
from .query import MongoQuery

__version__ = "0.0.4"
__version__ = "0.0.5"

__all__ = [
"ArtifactStore",
Expand Down
1 change: 1 addition & 0 deletions plugins/mongodb/superduper_mongodb/data_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import click
import mongomock
import pymongo
import pymongo.collection
from superduper import CFG, logging
from superduper.backends.base.data_backend import BaseDataBackend
from superduper.backends.base.metadata import MetaDataStoreProxy
Expand Down
6 changes: 5 additions & 1 deletion superduper/base/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ def _replace_variables(x, **kwargs):
_replace_variables(k, **kwargs): _replace_variables(v, **kwargs)
for k, v in x.items()
}
if isinstance(x, str) and re.match(r'^<var:(.*?)>$', x) is not None and '<' not in x[1:-1]:
if (
isinstance(x, str)
and re.match(r'^<var:(.*?)>$', x) is not None
and '<' not in x[1:-1]
):
return kwargs.get(x[5:-1], x)
if isinstance(x, str):
variables = re.findall(r'<var:(.*?)>', x)
Expand Down
13 changes: 11 additions & 2 deletions superduper/components/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class _BaseTemplate(Component):
:param blobs: Blob identifiers in `Template.component`.
:param files: File identifiers in `Template.component`.
:param substitutions: Substitutions to be made to create variables.
:param default_values: Default values for the variables.
"""

literals: t.ClassVar[t.Tuple[str]] = ('template',)
Expand Down Expand Up @@ -61,7 +62,11 @@ def form_template(self):
return {
'identifier': '<enter-a-unique-identifier>',
'_variables': {
k: (f'<value-{i}>' if k not in self.default_values else self.default_values[k])
k: (
f'<value-{i}>'
if k not in self.default_values
else self.default_values[k]
)
for i, k in enumerate(self.template_variables)
},
**{k: v for k, v in self.template.items() if k != 'identifier'},
Expand Down Expand Up @@ -187,7 +192,11 @@ def form_template(self):
"""Form to be diplayed to user."""
return {
'_variables': {
k: (f'<value-{i}>' if k not in self.default_values else self.default_values[k])
k: (
f'<value-{i}>'
if k not in self.default_values
else self.default_values[k]
)
for i, k in enumerate(self.template_variables)
},
**{
Expand Down
Loading