Skip to content

Commit

Permalink
Black fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
instification committed Oct 4, 2024
1 parent ee387a4 commit 41b9de0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/collective/elasticsearch/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
CUSTOM_INDEX_NAME_ATTR = "_elasticcustomindex"
INDEX_VERSION_ATTR = "_elasticindexversion"


# Custom serializer to handle cases where set() data is passed to an index
class PloneJSONSerializer(JSONSerializer):

Expand Down Expand Up @@ -296,7 +297,10 @@ def connection(self) -> Elasticsearch:
conn = local.get_local(self.connection_key)
if not conn:
hosts, params = utils.get_connection_settings()
local.set_local(self.connection_key, Elasticsearch(hosts, serializer=PloneJSONSerializer(), **params))
local.set_local(
self.connection_key,
Elasticsearch(hosts, serializer=PloneJSONSerializer(), **params),
)
conn = local.get_local(self.connection_key)
return conn

Expand Down
3 changes: 2 additions & 1 deletion src/collective/elasticsearch/redis/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def es_connection(hosts, **params):
connection = local.get_local(ElasticSearchManager.connection_key)
if not connection:
local.set_local(
ElasticSearchManager.connection_key, Elasticsearch(hosts, serializer=PloneJSONSerializer(), **params)
ElasticSearchManager.connection_key,
Elasticsearch(hosts, serializer=PloneJSONSerializer(), **params),
)
connection = local.get_local(ElasticSearchManager.connection_key)
return connection
Expand Down

0 comments on commit 41b9de0

Please sign in to comment.