本文整理汇总了Python中General.boolstr_to_bool方法的典型用法代码示例。如果您正苦于以下问题:Python General.boolstr_to_bool方法的具体用法?Python General.boolstr_to_bool怎么用?Python General.boolstr_to_bool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类General
的用法示例。
在下文中一共展示了General.boolstr_to_bool方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import General [as 别名]
# 或者: from General import boolstr_to_bool [as 别名]
def __init__(self, action_element):
"""Initialize file search"""
self.regex = action_element.getAttribute('regex')
assert(isinstance(self.regex, (str, unicode, types.NoneType)))
self.nregex = action_element.getAttribute('nregex')
assert(isinstance(self.nregex, (str, unicode, types.NoneType)))
self.wholeregex = action_element.getAttribute('wholeregex')
assert(isinstance(self.wholeregex, (str, unicode, types.NoneType)))
self.nwholeregex = action_element.getAttribute('nwholeregex')
assert(isinstance(self.nwholeregex, (str, unicode, types.NoneType)))
self.search = action_element.getAttribute('search')
self.object_type = action_element.getAttribute('type')
self.path = os.path.expanduser(FileUtilities.expandvars(
action_element.getAttribute('path')))
if 'nt' == os.name and self.path:
# convert forward slash to backslash for compatibility with getsize()
# and for display. Do not convert an empty path, or it will become
# the current directory (.).
self.path = os.path.normpath(self.path)
self.ds = {}
if 'deep' == self.search:
self.ds['regex'] = self.regex
self.ds['nregex'] = self.nregex
self.ds['cache'] = General.boolstr_to_bool(
action_element.getAttribute('cache'))
self.ds['command'] = action_element.getAttribute('command')
self.ds['path'] = self.path
if not any([self.object_type, self.regex, self.nregex, self.wholeregex, self.nwholeregex]):
# If the filter is not needed, bypass it for speed.
self.get_paths = self._get_paths
示例2: __init__
# 需要导入模块: import General [as 别名]
# 或者: from General import boolstr_to_bool [as 别名]
def __init__(self, action_element):
"""Initialize file search"""
self.regex = action_element.getAttribute('regex')
assert(isinstance(self.regex, (str, unicode, types.NoneType)))
self.nregex = action_element.getAttribute('nregex')
assert(isinstance(self.nregex, (str, unicode, types.NoneType)))
self.search = action_element.getAttribute('search')
self.object_type = action_element.getAttribute('type')
self.path = os.path.expanduser(os.path.expandvars(
action_element.getAttribute('path')))
if 'nt' == os.name and self.path:
# convert forward slash to backslash for compatibility with getsize()
# and for display. Do not convert an empty path, or it will become
# the current directory (.).
self.path = os.path.normpath(self.path)
self.ds = {}
if 'deep' == self.search:
self.ds['regex'] = self.regex
self.ds['nregex'] = self.nregex
self.ds['cache'] = General.boolstr_to_bool(
action_element.getAttribute('cache'))
self.ds['command'] = action_element.getAttribute('command')
self.ds['path'] = self.path
if self.object_type:
if 'f' == self.object_type:
self.object_filter = os.path.isfile
elif 'd' == self.object_type:
self.object_filter = os.path.isdir
else:
raise RuntimeError('unsupported type %s in %s' % \
(self.object_type, self.action_element))
else:
# faster to bypass
self.get_paths = self._get_paths
示例3: __init__
# 需要导入模块: import General [as 别名]
# 或者: from General import boolstr_to_bool [as 别名]
def __init__(self, action_element):
"""Initialize file search"""
self.regex = action_element.getAttribute('regex')
assert(isinstance(self.regex, (str, unicode, types.NoneType)))
self.search = action_element.getAttribute('search')
self.path = os.path.expanduser(os.path.expandvars( \
action_element.getAttribute('path')))
self.ds = {}
if 'deep' == self.search:
self.ds['regex'] = self.regex
self.ds['cache'] = General.boolstr_to_bool(action_element.getAttribute('cache'))
self.ds['command'] = action_element.getAttribute('command')
self.ds['path'] = self.path
示例4: __init__
# 需要导入模块: import General [as 别名]
# 或者: from General import boolstr_to_bool [as 别名]
def __init__(self, action_element):
"""Initialize file search"""
self.regex = action_element.getAttribute('regex')
assert(isinstance(self.regex, (str, unicode, types.NoneType)))
self.search = action_element.getAttribute('search')
self.path = os.path.expanduser(os.path.expandvars(
action_element.getAttribute('path')))
if 'nt' == os.name and self.path:
# convert forward slash to backslash for compatibility with getsize()
# and for display. Do not convert an empty path, or it will become
# the current directory (.).
self.path = os.path.normpath(self.path)
self.ds = {}
if 'deep' == self.search:
self.ds['regex'] = self.regex
self.ds['cache'] = General.boolstr_to_bool(
action_element.getAttribute('cache'))
self.ds['command'] = action_element.getAttribute('command')
self.ds['path'] = self.path
示例5: __init__
# 需要导入模块: import General [as 别名]
# 或者: from General import boolstr_to_bool [as 别名]
def __init__(self, action_element):
"""Initialize file search"""
self.regex = action_element.getAttribute("regex")
assert isinstance(self.regex, (str, unicode, types.NoneType))
self.nregex = action_element.getAttribute("nregex")
assert isinstance(self.nregex, (str, unicode, types.NoneType))
self.search = action_element.getAttribute("search")
self.path = os.path.expanduser(os.path.expandvars(action_element.getAttribute("path")))
if "nt" == os.name and self.path:
# convert forward slash to backslash for compatibility with getsize()
# and for display. Do not convert an empty path, or it will become
# the current directory (.).
self.path = os.path.normpath(self.path)
self.ds = {}
if "deep" == self.search:
self.ds["regex"] = self.regex
self.ds["nregex"] = self.nregex
self.ds["cache"] = General.boolstr_to_bool(action_element.getAttribute("cache"))
self.ds["command"] = action_element.getAttribute("command")
self.ds["path"] = self.path