Skip to content

Support for python 3.8 positional only argument syntax. #183

@FasterSpeeding

Description

@FasterSpeeding

Expected Behavior

I'd expect the parameters for methods that use the positional only argument syntax that was introduced in python 3.8 (see what's new to python3.8 for more information) to include / as to indicate that arguments to the left of / are positional only (e.g. def compile (self, method: str, /, **kwargs: Any) -> CompiledRoute).

Actual Behavior

The / argument is ignored, resulting in there being no indication that some of the arguments can only be positional, as shown in the screenshot below.
image

Steps to Reproduce

Generate documentation for a method that uses python 3.8's positional only argument syntax (see what's new to python3.8 for more information). The following method was used to produce the example actual behavior given above.

def compile(self, method: str, /, **kwargs: typing.Any) -> CompiledRoute:
    """Generate a formatted `CompiledRoute` for this route template.

    This takes into account any URL parameters that have been passed, and extracting
    the `major_params` for bucket hash operations accordingly.

    Parameters
    ----------
    method : str
        The method to use.
    **kwargs : typing.Any
        Any parameters to interpolate into the route path.

    Returns
    -------
    CompiledRoute
        The compiled route.
    """
    major_hash_part = "-".join((str(kwargs[p]) for p in self.major_params))

    return CompiledRoute(method, self.path_template, self.path_template.format_map(kwargs), major_hash_part)

Additional info

  • pdoc version: 0.8.1
  • python version: 3.8.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wanted 🤷Extra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions