-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Pyreverse: Use dashed lines for type-checking imports #8824
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
Changes from 10 commits
bec61ff
1a2b998
614354e
95663f9
458a737
3701040
3bb5b2c
59b5ba1
611a353
dc30497
5dd3831
afb4632
b6d2cc5
94c99bc
49d5e25
20d47fe
4057067
abcfcc2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
digraph "classes_type_check_imports" { | ||
rankdir=BT | ||
charset="utf-8" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
digraph "packages_type_check_imports" { | ||
rankdir=BT | ||
charset="utf-8" | ||
"package_diagrams" [color="black", label=<package_diagrams>, shape="box", style="solid"]; | ||
"package_diagrams.type_check_imports" [color="black", label=<package_diagrams.type_check_imports>, shape="box", style="solid"]; | ||
"package_diagrams.type_check_imports.mod_a" [color="black", label=<package_diagrams.type_check_imports.mod_a>, shape="box", style="solid"]; | ||
"package_diagrams.type_check_imports.mod_b" [color="black", label=<package_diagrams.type_check_imports.mod_b>, shape="box", style="solid"]; | ||
"package_diagrams.type_check_imports.mod_c" [color="black", label=<package_diagrams.type_check_imports.mod_c>, shape="box", style="solid"]; | ||
"package_diagrams.type_check_imports.mod_d" [color="black", label=<package_diagrams.type_check_imports.mod_d>, shape="box", style="solid"]; | ||
"package_diagrams.type_check_imports.mod_b" -> "package_diagrams.type_check_imports.mod_a" [arrowhead="open", arrowtail="none"]; | ||
"package_diagrams.type_check_imports.mod_d" -> "package_diagrams.type_check_imports.mod_a" [arrowhead="open", arrowtail="none"]; | ||
"package_diagrams.type_check_imports.mod_c" -> "package_diagrams.type_check_imports.mod_a" [arrowhead="open", arrowtail="none", style="dashed"]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Int = int | ||
|
||
List = list |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from typing import Any | ||
|
||
from mod_a import Int | ||
|
||
|
||
def is_int(x) -> bool: | ||
return isinstance(x, Int) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from mod_a import Int | ||
|
||
def some_int() -> Int: | ||
return 5 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from typing import TYPE_CHECKING, Any | ||
|
||
from mod_a import Int | ||
|
||
if TYPE_CHECKING: | ||
from mod_a import List | ||
|
||
def list_int(x: Any) -> List[Int]: | ||
return [x] if isinstance(x, Int) else [] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
classDiagram | ||
class type_check_imports { | ||
} | ||
class mod_a { | ||
} | ||
class mod_b { | ||
} | ||
class mod_c { | ||
} | ||
class mod_d { | ||
} | ||
mod_b --> mod_a | ||
mod_d --> mod_a | ||
mod_c -.-> mod_a | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not valid mermaid. it should be: github renders mermaid files, and if we try to open this one we get an error, see: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two lines are uncovered, and I don't know how to cover them. Any ideas? They could also be cut, or just ignore the coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check is definitely required. But I can't figure out exactly what triggers it.