本文整理汇总了Python中twitter.pants.base.ParseContext.path方法的典型用法代码示例。如果您正苦于以下问题:Python ParseContext.path方法的具体用法?Python ParseContext.path怎么用?Python ParseContext.path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twitter.pants.base.ParseContext
的用法示例。
在下文中一共展示了ParseContext.path方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from twitter.pants.base import ParseContext [as 别名]
# 或者: from twitter.pants.base.ParseContext import path [as 别名]
def __init__(self, base=None, mapper=None, relative_to=None):
"""
:param mapper: Function that takes a path string and returns a path string. Takes a path in
the source tree, returns a path to use in the resulting bundle. By default, an identity
mapper.
:param string relative_to: Set up a simple mapping from source path to bundle path.
E.g., ``relative_to='common'`` removes that prefix from all files in the application bundle.
"""
if mapper and relative_to:
raise ValueError("Must specify exactly one of 'mapper' or 'relative_to'")
if relative_to:
base = base or ParseContext.path(relative_to)
if not os.path.isdir(base):
raise ValueError('Could not find a directory to bundle relative to at %s' % base)
self.mapper = RelativeToMapper(base)
else:
self.mapper = mapper or RelativeToMapper(base or ParseContext.path())
self.filemap = {}