Skip to content

Commit

Permalink
run black on settings
Browse files Browse the repository at this point in the history
  • Loading branch information
helllllllder committed Jan 20, 2022
1 parent c37e2b5 commit b484537
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions bothub/common/documents/repositorybasicexample.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from django.conf import settings
from django_elasticsearch_dsl import Document, Index, fields

from bothub.common.models import RepositoryExample, RepositoryExampleEntity, RepositoryIntent, RepositoryVersionLanguage
from bothub.common.models import (
RepositoryExample,
RepositoryExampleEntity,
RepositoryIntent,
RepositoryVersionLanguage,
)

REPOSITORYBASICEXAMPLE_INDEX = Index(settings.ELASTICSEARCH_INDEX_NAMES[__name__])

Expand All @@ -11,15 +16,11 @@ class RepositoryExampleDocument(Document):
repository_version_language = fields.ObjectField(
properties={
"pk": fields.IntegerField(),
"language": fields.TextField(fields={"raw": fields.KeywordField()})
"language": fields.TextField(fields={"raw": fields.KeywordField()}),
}
)
intent = fields.ObjectField(
properties={
"text": fields.TextField(
fields={"raw": fields.KeywordField()}
)
}
properties={"text": fields.TextField(fields={"raw": fields.KeywordField()})}
)
entities = fields.NestedField(
properties={
Expand All @@ -38,15 +39,24 @@ class Django:
"id",
"text",
]
related_models = [RepositoryVersionLanguage, RepositoryIntent, RepositoryExampleEntity]
related_models = [
RepositoryVersionLanguage,
RepositoryIntent,
RepositoryExampleEntity,
]

def get_queryset(self):
return super(RepositoryExampleDocument, self).get_queryset().select_related(
"repository_version_language",
"intent",
).prefetch_related(
"entities",
"translations",
return (
super(RepositoryExampleDocument, self)
.get_queryset()
.select_related(
"repository_version_language",
"intent",
)
.prefetch_related(
"entities",
"translations",
)
)

def get_instances_from_related(self, related_instance):
Expand Down

0 comments on commit b484537

Please sign in to comment.