Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Allow full path for library exceptions. #103

Open
Dreamsorcerer opened this issue Jun 22, 2020 · 2 comments
Open

Allow full path for library exceptions. #103

Dreamsorcerer opened this issue Jun 22, 2020 · 2 comments

Comments

@Dreamsorcerer
Copy link

It would be preferable to be able to use the full path e.g. aiohttp.web.HTTPException in an example such as:

from aiohttp import web
def foo():
    """
    Raises:
        aiohttp.web.HTTPException
    """
    raise web.HTTPException

Currently, it only allows web.HTTPException to appear in the docstring.

If it's too tricky to get the import name, how about allowing a partial match?

e.g. It's currently matching web.HTTPException, so it would be fine if it matched anything ending in that, i.e. docstring_exception.endswith("web.HTTPException").

I guess it wouldn't help with as imports, but probably good enough most of the time.

@jtpavlock
Copy link

jtpavlock commented Aug 28, 2020

This also occurs if just importing the base name

import mediafile

def foo():
    """
    Raises:
        mediafile.UnreadableFileError
    """
    raise mediafile.UnreadableFileError

Does not work. Instead you must specify the abbreviated exception name:

def foo():
    """
    Raises:
        UnreadableFileError
    """
    raise mediafile.UnreadableFileError

@pawamoy
Copy link
Contributor

pawamoy commented May 22, 2021

Related to #9

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants