Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt Epydoc's DottedName class #416

Closed
tristanlatr opened this issue Jun 30, 2021 · 0 comments
Closed

Adopt Epydoc's DottedName class #416

tristanlatr opened this issue Jun 30, 2021 · 0 comments

Comments

@tristanlatr
Copy link
Contributor

tristanlatr commented Jun 30, 2021

Probably it would be good to have this level of abstraction for name handling.

This is the test code of the DottedName class.

The attractiveness comes from the contextualize() method:

>>> DottedName('foo.bar.baz.qux').contextualize(DottedName('foo.bar'))
    DottedName('baz', 'qux')

This would help contextualize the names when we need, to avoid stuff like this (This is in #414):
Screen Shot 2021-06-30 at 12 34 22 AM

It could also help figure a standard way of showing the names and solve #280

What I propose here is to edit some stuff a follow:

  • The core of the change: Documentable.expandName(name:Union[str, DottedName]) -> DottedName
  • Create Documentable.fullDottedName() -> DottedName
  • Refactoring:
    • node2dottedname(node:Optional[ast.expr]) -> Optional[DottedName].
    • node2fullname(node:Optional[ast.expr], ctx: model.Documentable) -> Optional[DottedName]
    • System.objForFullName(fullName: Union[str, DottedName]) -> Optional[Documentable]
    • System.find_object(full_name: Union[str, DottedName]) -> Optional[Documentable]
    • CanContainImportsDocumentable._localNameToFullName_map: Dict[str, DottedName]
    • CanContainImportsDocumentable._localNameToFullName(name: str) -> DottedName
    • All code that use those objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant