python-3.x - 在 mypy 中为 jsonschema_typed 设置插件
问题描述
我想jsonschema_typed
用 mypy 检查类型。我jsonschema_typed
从 pip 安装:
pip install jsonschema-typed
我有所有依赖项(jsonschema,mypy)。
并尝试了示例:
from jsonschema_typed.types import JSONSchema
data: JSONSchema['path/to/schema.json'] = dict(title='baz')
data['description'] = 'there is no description' # TypedDict "FooSchema" has no key 'description'
data['awesome'] = 42
data['awesome'] = None # Argument 2 has incompatible type "None"; expected "Union[int, float]"
但什么也没发生。我试图将插件写入 setup.cfg 文件:
plugins = jsonschema_typed.plugin.JSONSchemaPlugin.get_type_analyze_hook
但 mypy 显示该错误:
setup.cfg:10:1: error: Error importing plugin 'jsonschema_typed.plugin.JSONSchemaPlugin.get_type_analyze_hook'
你能帮助我吗?
解决方案
推荐阅读
- python - 仅从美丽的汤中提取特定 div 的任何方法
- jenkins - 如何获取删除了几个 Jenkins 作业版本的用户的详细信息?
- java - Apache Tomcat:源服务器没有找到目标资源的当前表示或不愿意透露
- blazor - Blazor 服务器端和单独项目中的模块
- jasny-bootstrap - Jasny 文件上传postedfile 始终为空
- jquery - 在codeigniter中计算jquery ajax中的值
- python - 为什么正则表达式带有“|” (或/替代)顺序切换时匹配不同?
- javascript - Open a different URL in the same window
- ios - 通过 hockey(App Center)或 Fabric 共享时,分布式构建的有效期是多久?
- pdf - 我需要在我的谷歌驱动器中显示一个 pdf 作为缩略图,在谷歌表中..如何使用谷歌脚本?