mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-08 05:34:51 +08:00
Start working with mypy
This commit is contained in:
@@ -7,10 +7,6 @@ import shutil
|
|||||||
import platform
|
import platform
|
||||||
import logging
|
import logging
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
try:
|
|
||||||
import cPickle as pickle
|
|
||||||
except:
|
|
||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
from parso.file_io import FileIO
|
from parso.file_io import FileIO
|
||||||
|
|||||||
@@ -149,8 +149,8 @@ class Issue(object):
|
|||||||
|
|
||||||
|
|
||||||
class Rule(object):
|
class Rule(object):
|
||||||
code = None
|
code: int
|
||||||
message = None
|
message: str
|
||||||
|
|
||||||
def __init__(self, normalizer):
|
def __init__(self, normalizer):
|
||||||
self._normalizer = normalizer
|
self._normalizer = normalizer
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class NodeOrLeaf(object):
|
|||||||
The base class for nodes and leaves.
|
The base class for nodes and leaves.
|
||||||
"""
|
"""
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
type = None
|
type: str
|
||||||
'''
|
'''
|
||||||
The type is a string that typically matches the types of the grammar file.
|
The type is a string that typically matches the types of the grammar file.
|
||||||
'''
|
'''
|
||||||
@@ -257,7 +257,6 @@ class BaseNode(NodeOrLeaf):
|
|||||||
A node has children, a type and possibly a parent node.
|
A node has children, a type and possibly a parent node.
|
||||||
"""
|
"""
|
||||||
__slots__ = ('children', 'parent')
|
__slots__ = ('children', 'parent')
|
||||||
type = None
|
|
||||||
|
|
||||||
def __init__(self, children):
|
def __init__(self, children):
|
||||||
self.children = children
|
self.children = children
|
||||||
|
|||||||
13
setup.cfg
13
setup.cfg
@@ -10,3 +10,16 @@ ignore =
|
|||||||
E226,
|
E226,
|
||||||
# line break before binary operator
|
# line break before binary operator
|
||||||
W503,
|
W503,
|
||||||
|
|
||||||
|
|
||||||
|
[mypy]
|
||||||
|
disallow_subclassing_any = True
|
||||||
|
|
||||||
|
# Avoid creating future gotchas emerging from bad typing
|
||||||
|
warn_redundant_casts = True
|
||||||
|
warn_unused_ignores = True
|
||||||
|
warn_return_any = True
|
||||||
|
warn_unused_configs = True
|
||||||
|
warn_unreachable = True
|
||||||
|
|
||||||
|
strict_equality = True
|
||||||
|
|||||||
7
setup.py
7
setup.py
@@ -12,7 +12,8 @@ __AUTHOR_EMAIL__ = 'davidhalter88@gmail.com'
|
|||||||
|
|
||||||
readme = open('README.rst').read() + '\n\n' + open('CHANGELOG.rst').read()
|
readme = open('README.rst').read() + '\n\n' + open('CHANGELOG.rst').read()
|
||||||
|
|
||||||
setup(name='parso',
|
setup(
|
||||||
|
name='parso',
|
||||||
version=parso.__version__,
|
version=parso.__version__,
|
||||||
description='A Python Parser',
|
description='A Python Parser',
|
||||||
author=__AUTHOR__,
|
author=__AUTHOR__,
|
||||||
@@ -49,5 +50,9 @@ setup(name='parso',
|
|||||||
'pytest<6.0.0',
|
'pytest<6.0.0',
|
||||||
'docopt',
|
'docopt',
|
||||||
],
|
],
|
||||||
|
'qa': [
|
||||||
|
'flake8==3.8.3',
|
||||||
|
'mypy==0.782',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user