-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow use of entry-points like strings in mypy.ini to register plugins (
- Loading branch information
1 parent
223d104
commit f8d5abb
Showing
4 changed files
with
100 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from mypy.plugin import Plugin | ||
|
||
class MyPlugin(Plugin): | ||
def get_function_hook(self, fullname): | ||
if fullname == '__main__.f': | ||
return my_hook | ||
assert fullname is not None | ||
return None | ||
|
||
def my_hook(ctx): | ||
return ctx.api.named_generic_type('builtins.int', []) | ||
|
||
def register(version): | ||
return MyPlugin |