mypy [files] |
Command line to check syntax
|
-v |
Be Verbose
|
-any-exprs-report PATH |
Provide a path to generate a
coverage report |
verbose is off and the command returns nothing, the code is OK.
from typing import Dict, List, Tuple |
Import types definition
|
var: str = "" |
Define
str a variable |
var: Dict[str, int] = {} |
Define
Dict a variable |
var: Tuple[str, float, int] = () |
Define
Tuple a variable |
MyType = Dict[str, int] |
Define a custom 'Type`
|
var: MyType = {} |
Define
MyType a variable |
def function(arg: str) -> int: |
Define a function that takes an
strand returns an int |
var: Any |
The
Any type accepts all types |
var: Union[str, int] |
This
Union type accepts either a str or an int |
pip install mypypip install typing
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.