starlette/schemas.py
def parse_docstring(self, func_or_method: typing.Callable) -> dict:
        """
        Given a function, parse the docstring as YAML and return a dictionary of info.
        """
        docstring = func_or_method.__doc__
        if not docstring:
            return {}

        # We support having regular docstrings before the schema
        # definition. Here we return just the schema part from
        # the docstring.
        docstring = docstring.split("---")[-1]

        parsed = yaml.safe_load(docstring)

        if not isinstance(parsed, dict):
            # A regular docstring (not yaml formatted) can return
            # a simple string here, which wouldn't follow the schema.
            return {}

        return parsed
def parse_docstring(self, func_or_method: typing.Callable) -> dict:
        """
        Given a function, parse the docstring as YAML and return a dictionary of info.
        """
        docstring = func_or_method.__doc__
        if not docstring:
            return {}

        # We support having regular docstrings before the schema
        # definition. Here we return just the schema part from
        # the docstring.
        docstring = docstring.split("---")[-1]

        parsed = yaml.safe_load(docstring)

        if not isinstance(parsed, dict):
            # A regular docstring (not yaml formatted) can return
            # a simple string here, which wouldn't follow the schema.
            return {}

        return parsed
def parse_docstring ( self , func_or_method : typing . Callable ) -> dict : docstring = func_or_method . __doc__ if not docstring : return { } # We support having regular docstrings before the schema # definition. Here we return just the schema part from # the docstring. docstring = docstring . split ( "---" ) [ - 1 ] parsed = yaml . safe_load ( docstring ) if not isinstance ( parsed , dict ) : # A regular docstring (not yaml formatted) can return # a simple string here, which wouldn't follow the schema. return { } return parsed
Given a function, parse the docstring as YAML and return a dictionary of info.
Given a function parse the docstring as YAML and return a dictionary of info .