本文整理汇总了Python中mypy.options.Options.cache_dir方法的典型用法代码示例。如果您正苦于以下问题:Python Options.cache_dir方法的具体用法?Python Options.cache_dir怎么用?Python Options.cache_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mypy.options.Options
的用法示例。
在下文中一共展示了Options.cache_dir方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mypy.options import Options [as 别名]
# 或者: from mypy.options.Options import cache_dir [as 别名]
def __init__(self, options: Options,
status_file: str,
timeout: Optional[int] = None) -> None:
"""Initialize the server with the desired mypy flags."""
self.options = options
# Snapshot the options info before we muck with it, to detect changes
self.options_snapshot = options.snapshot()
self.timeout = timeout
self.fine_grained_manager = None # type: Optional[FineGrainedBuildManager]
if os.path.isfile(status_file):
os.unlink(status_file)
self.fscache = FileSystemCache()
options.incremental = True
options.fine_grained_incremental = True
options.show_traceback = True
if options.use_fine_grained_cache:
# Using fine_grained_cache implies generating and caring
# about the fine grained cache
options.cache_fine_grained = True
else:
options.cache_dir = os.devnull
# Fine-grained incremental doesn't support general partial types
# (details in https://github.com/python/mypy/issues/4492)
options.local_partial_types = True
self.status_file = status_file
示例2: build
# 需要导入模块: from mypy.options import Options [as 别名]
# 或者: from mypy.options.Options import cache_dir [as 别名]
def build(self, source: str) -> Tuple[List[str], Optional[Dict[str, MypyFile]]]:
options = Options()
options.use_builtins_fixtures = True
options.show_traceback = True
options.cache_dir = os.devnull
try:
result = build.build(sources=[BuildSource('main', None, source)],
options=options,
alt_lib_path=test_temp_dir)
except CompileError as e:
# TODO: Is it okay to return None?
return e.messages, None
return result.errors, result.files
示例3: build_dir
# 需要导入模块: from mypy.options import Options [as 别名]
# 或者: from mypy.options.Options import cache_dir [as 别名]
def build_dir(target_dir: str) -> Tuple[List[str], BuildManager, Graph]:
sources = expand_dir(target_dir)
options = Options()
options.incremental = True
options.show_traceback = True
options.cache_dir = os.devnull
try:
result = build.build(sources=sources,
options=options)
except CompileError as e:
# TODO: We need a manager and a graph in this case as well
assert False, str('\n'.join(e.messages))
return e.messages, None, None
return result.errors, result.manager, result.graph
示例4: build
# 需要导入模块: from mypy.options import Options [as 别名]
# 或者: from mypy.options.Options import cache_dir [as 别名]
def build(self,
source: str,
python_version: Tuple[int, int]) -> Tuple[List[str],
Optional[Dict[str, MypyFile]],
Optional[Dict[Expression, Type]]]:
options = Options()
options.use_builtins_fixtures = True
options.show_traceback = True
options.cache_dir = os.devnull
options.python_version = python_version
try:
result = build.build(sources=[BuildSource('main', None, source)],
options=options,
alt_lib_path=test_temp_dir)
except CompileError as e:
# TODO: Should perhaps not return None here.
return e.messages, None, None
return result.errors, result.files, result.types
示例5: __init__
# 需要导入模块: from mypy.options import Options [as 别名]
# 或者: from mypy.options.Options import cache_dir [as 别名]
def __init__(self, options: Options,
timeout: Optional[int] = None,
alt_lib_path: Optional[str] = None) -> None:
"""Initialize the server with the desired mypy flags."""
self.options = options
self.timeout = timeout
self.alt_lib_path = alt_lib_path
self.fine_grained_manager = None # type: Optional[FineGrainedBuildManager]
if os.path.isfile(STATUS_FILE):
os.unlink(STATUS_FILE)
options.incremental = True
options.fine_grained_incremental = True
options.show_traceback = True
if options.use_fine_grained_cache:
options.cache_fine_grained = True # set this so that cache options match
else:
options.cache_dir = os.devnull
# Fine-grained incremental doesn't support general partial types
# (details in https://github.com/python/mypy/issues/4492)
options.local_partial_types = True