<commit_before>"""Asynchronous request."""
from .request import Request
from .response import ExceptionResponse, NotificationResponse, RequestResponse


class AsyncRequest(Request):
    """Asynchronous request"""

    async def call(self, methods):
        """Find the method from the passed list, and call it, returning a
        Response"""
        # Validation or parsing may have failed in __init__, in which case
        # there's no point calling. It would've already set the response.
        if not self.response:
            # call_context handles setting the result/exception of the call
            with self.handle_exceptions():
                # Get the method object from a list (raises MethodNotFound)
                callable_ = self._get_method(methods, self.method_name)
                # Ensure the arguments match the method's signature
                self._validate_arguments_against_signature(callable_)
                # Call the method
                result = await callable_(*(self.args or []),
                                         **(self.kwargs or {}))
                # Set the response
                if self.is_notification:
                    self.response = NotificationResponse()
                else:
                    self.response = RequestResponse(self.request_id, result)
        # Ensure the response has been set
        assert self.response, 'Call must set response'
        assert isinstance(self.response, (
            ExceptionResponse, NotificationResponse, RequestResponse)),
            'Invalid response type'
        return self.response<commit_msg>Fix syntax error<commit_after>"""Asynchronous request."""
from .request import Request
from .response import ExceptionResponse, NotificationResponse, RequestResponse


class AsyncRequest(Request):
    """Asynchronous request"""

    async def call(self, methods):
        """Find the method from the passed list, and call it, returning a
        Response"""
        # Validation or parsing may have failed in __init__, in which case
        # there's no point calling. It would've already set the response.
        if not self.response:
            # call_context handles setting the result/exception of the call
            with self.handle_exceptions():
                # Get the method object from a list (raises MethodNotFound)
                callable_ = self._get_method(methods, self.method_name)
                # Ensure the arguments match the method's signature
                self._validate_arguments_against_signature(callable_)
                # Call the method
                result = await callable_(*(self.args or []),
                                         **(self.kwargs or {}))
                # Set the response
                if self.is_notification:
                    self.response = NotificationResponse()
                else:
                    self.response = RequestResponse(self.request_id, result)
        # Ensure the response has been set
        assert self.response, 'Call must set response'
        assert isinstance(self.response, (
            ExceptionResponse, NotificationResponse, RequestResponse)), \
            'Invalid response type'
        return self.response
{'fraction_non_alphanumeric': 0.07043127520943221, 'fraction_numerical': 0.0, 'mean_word_length': 2.0910834132310643, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4015229', 'n_tokens_mistral': 726, 'n_tokens_neox': 683, 'n_words': 259}