Skip to content

Commit

Permalink
Merge 900a46f into d234f6e
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro-Meireles committed May 7, 2021
2 parents d234f6e + 900a46f commit c6567d1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 27 deletions.
2 changes: 1 addition & 1 deletion bothub/api/v2/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
from .nlp.views import RepositoryAuthorizationEvaluateViewSet
from .nlp.views import RepositoryAuthorizationInfoViewSet
from .nlp.views import RepositoryAuthorizationParseViewSet
from .nlp.views import RepositoryAuthorizationTrainLanguagesViewSet
from .nlp.views import (
RepositoryAuthorizationTrainViewSet,
RepositoryNLPLogsViewSet,
RepositoryAuthorizationKnowledgeBaseViewSet,
RepositoryAuthorizationExamplesViewSet,
RepositoryAuthorizationAutomaticEvaluateViewSet,
RepositoryAuthorizationTrainLanguagesViewSet,
)
from .nlp.views import RepositoryUpdateInterpretersViewSet
from .organization.views import (
Expand Down
17 changes: 10 additions & 7 deletions bothub/authentication/migrations/0009_auto_20210506_1453.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@

class Migration(migrations.Migration):

dependencies = [
('authentication', '0008_user_language'),
]
dependencies = [("authentication", "0008_user_language")]

operations = [
migrations.AlterField(
model_name='user',
name='language',
field=models.CharField(blank=True, choices=[('en-us', 'English'), ('pt-br', 'Brazilian Portuguese')], max_length=5, null=True),
),
model_name="user",
name="language",
field=models.CharField(
blank=True,
choices=[("en-us", "English"), ("pt-br", "Brazilian Portuguese")],
max_length=5,
null=True,
),
)
]
25 changes: 6 additions & 19 deletions bothub/common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,7 @@ def request_nlp_analyze(self, user_authorization, data):

def request_nlp_debug_parse(self, user_authorization, data):
try: # pragma: no cover
payload = {
"text": data.get("text"),
"language": data.get("language"),
}
payload = {"text": data.get("text"), "language": data.get("language")}

repository_version = data.get("repository_version")

Expand All @@ -483,9 +480,7 @@ def request_nlp_debug_parse(self, user_authorization, data):
r = requests.post( # pragma: no cover
"{}v2/debug_parse/".format(self.nlp_base_url),
json=payload,
headers={
"Authorization": "Bearer {}".format(user_authorization.uuid)
}
headers={"Authorization": "Bearer {}".format(user_authorization.uuid)},
)

return r # pragma: no cover
Expand All @@ -497,9 +492,7 @@ def request_nlp_debug_parse(self, user_authorization, data):

def request_nlp_words_distribution(self, user_authorization, data):
try: # pragma: no cover
payload = {
"language": data.get("language"),
}
payload = {"language": data.get("language")}

repository_version = data.get("repository_version")

Expand All @@ -509,9 +502,7 @@ def request_nlp_words_distribution(self, user_authorization, data):
r = requests.post( # pragma: no cover
"{}v2/words_distribution/".format(self.nlp_base_url),
json=payload,
headers={
"Authorization": "Bearer {}".format(user_authorization.uuid)
},
headers={"Authorization": "Bearer {}".format(user_authorization.uuid)},
)
return r # pragma: no cover

Expand All @@ -533,9 +524,7 @@ def request_nlp_manual_evaluate(self, user_authorization, data):
r = requests.post(
"{}v2/evaluate/".format(self.nlp_base_url),
json=payload,
headers={
"Authorization": f"Bearer {user_authorization.uuid}"
},
headers={"Authorization": f"Bearer {user_authorization.uuid}"},
)

return r # pragma: no cover
Expand All @@ -557,9 +546,7 @@ def request_nlp_automatic_evaluate(self, user_authorization, data):
r = requests.post(
"{}v2/evaluate/".format(self.nlp_base_url),
json=payload,
headers={
"Authorization": f"Bearer {user_authorization.uuid}"
},
headers={"Authorization": f"Bearer {user_authorization.uuid}"},
)

return r # pragma: no cover
Expand Down

0 comments on commit c6567d1

Please sign in to comment.