Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork944
Commitf83b056
committed
Revise assert_never
This revises the docstring of git.types.assert_never to moreclearly express its semantics and usage, to use the type names usedin the typing module, typing_extensions package, and mypy. Thisexpands some parts when doing so seemed to benefit clarity.The docstring had previously said AssertionError was raised, butthe code raised ValueError. For now I've adjusted the docstring tobe accurate to the code's behavior, but maybe this should change.I also removed the part about the mypy error being on variablecreation, since I am not clear on what that was referring to, andif it means the first name binding operation for a variable in itsscope, then I am not sure why that would be where an error messagewould be expected when using assert_never.Finally, this slightly adjusts the message:- "Literal" is decapitalized, to decrease confusion if the default message is used when matching on something not a typing.Literal.- The exception message prints the unexpected value's repr rather than its str, since the repr, when different from the str, is usually the representation more useful for debugging.1 parentb2c3d8b commitf83b056
1 file changed
+14
-6
lines changedLines changed: 14 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
72 | 72 |
| |
73 | 73 |
| |
74 | 74 |
| |
75 |
| - | |
| 75 | + | |
76 | 76 |
| |
77 |
| - | |
| 77 | + | |
| 78 | + | |
78 | 79 |
| |
79 |
| - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
80 | 84 |
| |
81 |
| - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
82 | 88 |
| |
83 |
| - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
84 | 92 |
| |
85 | 93 |
| |
86 | 94 |
| |
87 |
| - | |
| 95 | + | |
88 | 96 |
| |
89 | 97 |
| |
90 | 98 |
| |
|
0 commit comments
Comments
(0)