本文整理汇总了Python中mypy.options.Options.semantic_analysis_only方法的典型用法代码示例。如果您正苦于以下问题:Python Options.semantic_analysis_only方法的具体用法?Python Options.semantic_analysis_only怎么用?Python Options.semantic_analysis_only使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mypy.options.Options
的用法示例。
在下文中一共展示了Options.semantic_analysis_only方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_semanal_options
# 需要导入模块: from mypy.options import Options [as 别名]
# 或者: from mypy.options.Options import semantic_analysis_only [as 别名]
def get_semanal_options() -> Options:
options = Options()
options.use_builtins_fixtures = True
options.semantic_analysis_only = True
options.show_traceback = True
options.python_version = PYTHON3_VERSION
return options
示例2: mypy_options
# 需要导入模块: from mypy.options import Options [as 别名]
# 或者: from mypy.options.Options import semantic_analysis_only [as 别名]
def mypy_options(stubgen_options: Options) -> MypyOptions:
"""Generate mypy options using the flag passed by user."""
options = MypyOptions()
options.follow_imports = 'skip'
options.incremental = False
options.ignore_errors = True
options.semantic_analysis_only = True
options.python_version = stubgen_options.pyversion
return options
示例3: test_transform
# 需要导入模块: from mypy.options import Options [as 别名]
# 或者: from mypy.options.Options import semantic_analysis_only [as 别名]
def test_transform(testcase: DataDrivenTestCase) -> None:
"""Perform an identity transform test case."""
try:
src = '\n'.join(testcase.input)
options = Options()
options.use_builtins_fixtures = True
options.semantic_analysis_only = True
options.show_traceback = True
options.python_version = testfile_pyversion(testcase.file)
result = build.build(sources=[BuildSource('main', None, src)],
options=options,
alt_lib_path=test_temp_dir)
a = result.errors
if a:
raise CompileError(a)
# Include string representations of the source files in the actual
# output.
for fnam in sorted(result.files.keys()):
f = result.files[fnam]
# Omit the builtins module and files with a special marker in the
# path.
# TODO the test is not reliable
if (not f.path.endswith((os.sep + 'builtins.pyi',
'typing.pyi',
'abc.pyi'))
and not os.path.basename(f.path).startswith('_')
and not os.path.splitext(
os.path.basename(f.path))[0].endswith('_')):
t = TypeAssertTransformVisitor()
f = t.mypyfile(f)
a += str(f).split('\n')
except CompileError as e:
a = e.messages
if testcase.normalize_output:
a = normalize_error_messages(a)
assert_string_arrays_equal(
testcase.output, a,
'Invalid semantic analyzer output ({}, line {})'.format(testcase.file,
testcase.line))
示例4: get_semanal_options
# 需要导入模块: from mypy.options import Options [as 别名]
# 或者: from mypy.options.Options import semantic_analysis_only [as 别名]
def get_semanal_options():
options = Options()
options.use_builtins_fixtures = True
options.semantic_analysis_only = True
return options
示例5: get_semanal_options
# 需要导入模块: from mypy.options import Options [as 别名]
# 或者: from mypy.options.Options import semantic_analysis_only [as 别名]
def get_semanal_options() -> Options:
options = Options()
options.use_builtins_fixtures = True
options.semantic_analysis_only = True
options.show_traceback = True
return options