Skip to content

Conversation

@7576457
Copy link

@7576457 7576457 commented Sep 18, 2025

Hi.

This addresses issue #500.

This issue was opened in July, and I suspect the whitespace issue mentioned by the issue author has already been resolved. When I ran the test code, it was already returning a single space template for plotting (and the plots were plotted without errors).

Another point is the escaping of "<>".

I added an _escape function that uses regex to remove <class 'str'> from strings, leaving only str.
The result is this output (I marked the changes with <---):

classDiagram
direction LR
namespace Scope.REQUEST {
class factory3["📥 Container"]{
 
}
class factory4["🏭 User"]{
    User()
    int
    Callable[[str], str] <---
}
class factory5["🏭 Callable__str___str_"]{ <---
    MyProvider.make_stringify()
}
class factory6["📥 int"]{
 
}
}

This line Callable__str___str_ is escaped using another [escape function](https://github.com/reagento/dishka/blob/develop/src/dishka/plotter/mermaid.py#L45C1-L46C47). If we hypothetically skip this function, it would be uniform like Callable[[str], str].

So I have these questions:
Why is it escaped this way specifically? (Callable__str___str_ - here it's unclear what is an argument and what is a return value)
Based on the answer to the first question, can we get by with only the function proposed in this PR?

@sonarqubecloud
Copy link

@github-actions
Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/dishka/text_rendering
  name.py
Project Total  

This report was generated by python-coverage-comment-action

@Tishka17
Copy link
Member

Thank you for your PR, looking at it I've found a better solution. Please review #559

@Tishka17 Tishka17 closed this Sep 19, 2025
@github-project-automation github-project-automation bot moved this to To be released in Dishka kanban Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To be released

Development

Successfully merging this pull request may close these issues.

2 participants