PokaInc / arnparse

Parse ARNs using Python
MIT License
36 stars 7 forks source link

Directory structure prevents importing MalformedArn exceptioin #11

Open Quidge opened 3 years ago

Quidge commented 3 years ago

Because the module arnparse shadows the package name + the module is imported in the init, it's not possible to import the MalformedArnError.

I want to do this but can't at the moment:

from arnparse import arnparse, MalformedArnException

...

try:
    arn = arnparse(<bad arn str>)
except MalformedArnException as e:
    print(e.arn_str)

Nor is this possible:

import arnparse

...

try:
    arn = arnparse.arnparse.arnparse(<bad arn str>)
except arnparse.arnparse.MalformedArnException as e:
    print(e.arn_str)

Ideas? Like the lib and like the tests to outsource tricky string parsing stuff.

SteggyLeggy commented 2 years ago

I think this should work....

from arnparse.arnparse import MalformedArnError