一个flake8插件,用于检查类型模块对实际运行时类型(尤其是集合模块)的类型替代项的使用情况。
flake8-typing-collections的Python项目详细描述
flake8打字集
一个flake8插件,用于检查
实际运行时类型上的typing
模块,尤其是
collections
模块。在
选项
该插件提供以下标志来选择要启用的错误。 不会报告所有未显式启用的错误。在
--tyco_generic_alt
:启用TYCO101
,TYCO102
,TYCO103
,TYCO106
,TYCO107
,TYCO108
,TYCO109
,TYCO110
,TYCO111
,TYCO112
,TYCO114
,TYCO115
,TYCO116
,TYCO117
,TYCO118
,TYCO119
,TYCO120
,TYCO121
,TYCO122
,TYCO123
,TYCO124
,TYCO125
,TYCO126
,TYCO127
,TYCO128
,TYCO129
、TYCO130
、TYCO131
、和{}。在 --tyco_alias_alt
:启用TYCO104
、TYCO105
和{}。在 --tyco_general_args
:启用TYCO200
、TYCO201
和{}。在
如果没有给出这些标志,则使用默认选择,
即--tyco_generic_alt
和{
错误代码
泰科1xx级
typing
模块定义了内置的几个通用版本
类,例如typing.List[T]
而不是{
# Gooddefsum_list(x:List[SupportsFloat])->float:...# Baddefsum_list(x:list)->float:...
泰科100
对类型注释使用typing.Iterable
而不是{
泰科101
对类型注释使用typing.Iterator
,而不是{
泰科102
对类型注释使用typing.Reversible
而不是collections.abc.Reversible
。在
泰科103
对类型注释使用typing.Container
而不是collections.abc.Container
。在
泰科104
对类型注释使用typing.Hashable
而不是collections.abc.Hashable
。在
泰科105
对类型注释使用typing.Sized
而不是collections.abc.Sized
。在
泰科106
对类型注释使用typing.Collection
而不是collections.abc.Collection
。在
泰科107
对类型注释使用typing.AbstractSet
而不是collections.abc.Set
。在
泰科108
对类型注释使用typing.MutableSet
而不是collections.abc.MutableSet
。在
泰科109
对类型注释使用typing.Mapping
而不是collections.abc.Mapping
。在
泰科110
对类型注释使用typing.MutableMapping
而不是collections.abc.MutableMapping
。在
泰科111
{{ofannotations 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 对类型注释使用 {cd1>推荐模块的文档使用
更一般的类型,如 使用 使用 使用 标签:泰科112
typing.MutableSequence
而不是collections.abc.MutableSequence
。在泰科113
typing.ByteString
而不是bytes
。在泰科114
typing.Deque
而不是collections.Deque
。在泰科115
typing.List
而不是list
。在泰科116
typing.Set
而不是set
。在泰科117
typing.FrozenSet
而不是frozenset
。在泰科118
typing.MappingView
而不是collections.abc.MappingView
。在泰科119
typing.KeysView
而不是collections.abc.KeysView
。在泰科120
typing.ItemsView
,而不是collections.abc.ItemsView
。在泰科121
typing.ValuesView
而不是collections.abc.ValuesView
。在泰科122
typing.Awaitable
而不是collections.abc.Awaitable
。在泰科123
typing.Coroutine
而不是collections.abc.Coroutine
。在泰科124
typing.AsyncIterable
而不是collections.abc.AsyncIterable
。在泰科125
typing.AsyncIterator
而不是collections.abc.AsyncIterator
。在泰科126
typing.ContextManager
而不是contextlib.AbstractContextManager
。在泰科127
typing.AsyncContextManager
而不是contextlib.AbstractAsyncContextManager
。在泰科128
typing.Dict
而不是dict
。在泰科129
typing.DefaultDict
而不是collections.defaultdict
。在泰科130
typing.OrderedDict
而不是collections.OrderedDict
。在泰科131
typing.Counter
而不是collections.Counter
。在泰科132
typing.ChainMap
而不是collections.ChainMap
。在泰科2XX级
typing.Sequence
过于专业化
函数参数中的类型,如typing.List
。在泰科200
typing.Sequence
或{typing.List
。在泰科201
typing.AbstractSet
或{typing.Set
。在泰科201
typing.Mapping
或{typing.Dict
。在推荐PyPI第三方库