Skip to content
#

typing

Here are 471 public repositories matching this topic...

vuryleo
vuryleo commented Nov 8, 2019

e.g.

# map.py
def func(a: int) -> float:
    return float(a)

map(func, ['str'])
$ pytype map.py
Computing dependencies
Analyzing 1 sources with 0 local dependencies
ninja: Entering directory `/[redacted]/.pytype'
ninja: no work to do.
Success: no errors found

while

$ mypy map.py
map.py:5: error: Argument 1 to "map" has incompatible type "Ca
mz8i
mz8i commented Mar 23, 2021

It might be useful to provide some kind of error classes as part of this package.
For example, I use code like this:

from argparse import ArgumentError, ArgumentParser

def file_path(x: str):
   d = Path(x)
   if d.is_dir:
      raise ArgumentError(f"{d} is a directory")
   return d

parser = ArgumentParser()
parser.add_argument('output_file', type=file_path, help="Path to 

Improve this page

Add a description, image, and links to the typing topic page so that developers can more easily learn about it.

Curate this topic

Add this topic to your repo

To associate your repository with the typing topic, visit your repo's landing page and select "manage topics."

Learn more