Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Tawakalt committed Jul 27, 2023
1 parent 329dd4e commit 38fc2b4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
12 changes: 9 additions & 3 deletions rasa_sdk/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,11 @@ async def webhook(request: Request) -> HTTPResponse:
span.set_attribute("next_action", action_call.get("next_action"))
span.set_attribute("version", action_call.get("version"))
span.set_attribute("sender_id", action_call.get("tracker")["sender_id"])
span.set_attribute("message_id", action_call.get("tracker")["latest_message"]["message_id"])

span.set_attribute(
"message_id",
action_call.get("tracker")["latest_message"]["message_id"],
)

return response.json(result, status=200)

@app.get("/actions")
Expand Down Expand Up @@ -176,7 +179,10 @@ def run(
"""Starts the action endpoint server with given config values."""
logger.info("Starting action endpoint server...")
app = create_app(
action_package_name, cors_origins=cors_origins, auto_reload=auto_reload, tracer_provider=tracer_provider,
action_package_name,
cors_origins=cors_origins,
auto_reload=auto_reload,
tracer_provider=tracer_provider,
)
## Attach additional sanic extensions: listeners, middleware and routing
logger.info("Starting plugins...")
Expand Down
7 changes: 3 additions & 4 deletions rasa_sdk/tracing/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def read_endpoint_config(

try:
content = rasa_sdk.utils.read_file(filename)
content = rasa_sdk.utils.read_yaml(content)
content = rasa_sdk.utils.read_yaml(content)

if content.get(endpoint_type) is None:
return None
Expand All @@ -32,7 +32,7 @@ def read_endpoint_config(
"from {}. No such file.".format(os.path.abspath(filename))
)
return None


class EndpointConfig:
"""Configuration for an external HTTP endpoint."""
Expand All @@ -59,7 +59,6 @@ def __init__(
self.cafile = cafile
self.kwargs = kwargs


@classmethod
def from_dict(cls, data: Dict[Text, Any]) -> "EndpointConfig":
return EndpointConfig(**data)
return EndpointConfig(**data)
4 changes: 3 additions & 1 deletion rasa_sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ def read_yaml_file(filename: Union[Text, Path]) -> Dict[Text, Any]:
raise YamlSyntaxException(filename, e)


def get_tracer_provider(cmdline_arguments: argparse.Namespace) -> Optional[TracerProvider]:
def get_tracer_provider(
cmdline_arguments: argparse.Namespace,
) -> Optional[TracerProvider]:
tracer_provider = None
if "endpoints" in cmdline_arguments:
endpoints_file = cmdline_arguments.endpoints
Expand Down

0 comments on commit 38fc2b4

Please sign in to comment.