本文整理汇总了Python中common_py.system.filesystem.FileSystem.files_under方法的典型用法代码示例。如果您正苦于以下问题:Python FileSystem.files_under方法的具体用法?Python FileSystem.files_under怎么用?Python FileSystem.files_under使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common_py.system.filesystem.FileSystem
的用法示例。
在下文中一共展示了FileSystem.files_under方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_tidy
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import files_under [as 别名]
def check_tidy(src_dir, options=None):
allowed_exts = ['.c', '.h', '.js', '.py', '.sh', '.cmake']
allowed_files = ['CMakeLists.txt']
clang_format_exts = ['.c', '.h']
skip_dirs = ['deps', 'build', '.git']
skip_files = ['check_signed_off.sh', '__init__.py',
'iotjs_js.c', 'iotjs_js.h', 'iotjs_string_ext.inl.h',
'ble.js',
'ble_hci_socket_acl_stream.js',
'ble_hci_socket_smp.js',
'ble_hci_socket_hci.js',
'ble_hci_socket_gap.js',
'ble_hci_socket_gatt.js',
'ble_hci_socket_mgmt.js',
'ble_hci_socket_bindings.js',
'ble_characteristic.js',
'test_ble_setservices.js',
]
style = StyleChecker()
clang = ClangFormat(clang_format_exts, skip_files, options)
file_filter = FileFilter(allowed_exts, allowed_files, skip_files)
files = fs.files_under(src_dir, skip_dirs, file_filter)
clang.check(files)
style.check(files)
if clang.error_count:
print("Detected clang-format problems:")
print("".join(clang.diffs))
print()
if style.error_count:
print("Detected style problems:")
print("\n".join(style.errors))
print()
total_errors = style.error_count + clang.error_count
print("* total lines of code: %d" % style.count_lines)
print("* total non-blank lines of code: %d" % style.count_valid_lines)
print("* style errors: %d" % style.error_count)
print("* clang-format errors: %d" % clang.error_count)
msg_color = ex._TERM_RED if total_errors > 0 else ex._TERM_GREEN
print("%s* total errors: %d%s" % (msg_color, total_errors, ex._TERM_EMPTY))
print()
return total_errors == 0
示例2: check_tidy
# 需要导入模块: from common_py.system.filesystem import FileSystem [as 别名]
# 或者: from common_py.system.filesystem.FileSystem import files_under [as 别名]
def check_tidy(src_dir, options=None):
allowed_exts = ['.c', '.h', '.js', '.py', '.sh', '.cmake']
allowed_files = ['CMakeLists.txt']
clang_format_exts = ['.c', '.h']
skip_dirs = ['deps', 'build', '.git', 'node_modules', 'coverage',
'iotjs_modules', 'IoTjsApp']
skip_files = ['check_license.py', 'check_signed_off.sh', '__init__.py',
'iotjs_js.c', 'iotjs_js.h', 'iotjs_string_ext.inl.h',
"iotjs_module_inl.h",
'ble.js',
'ble_hci_socket_acl_stream.js',
'ble_hci_socket_smp.js',
'ble_hci_socket_hci.js',
'ble_hci_socket_gap.js',
'ble_hci_socket_gatt.js',
'ble_hci_socket_mgmt.js',
'ble_hci_socket_bindings.js',
'ble_characteristic.js',
'node_api.h',
'node_api_types.h',
'test_ble_setservices.js',
'.eslintrc.js',
'c_source_templates.py',
'cpp_source_templates.py'
]
style = StyleChecker()
style.set_rules()
clang = ClangFormat(clang_format_exts, skip_files, options)
eslint = EslintChecker(options)
file_filter = FileFilter(allowed_exts, allowed_files, skip_files)
files = fs.files_under(src_dir, skip_dirs, file_filter)
clang.check(files)
style.check(files)
eslint.check()
if clang.error_count:
print("Detected clang-format problems:")
print("".join(clang.diffs))
print()
if style.error_count:
print("Detected style problems:")
print("\n".join(style.errors))
print()
if eslint.error_count:
print("Detected eslint problems:")
print("\n".join(eslint.errors))
print()
total_errors = style.error_count + clang.error_count + eslint.error_count
print("* total lines of code: %d" % style.count_lines)
print("* total non-blank lines of code: %d" % style.count_valid_lines)
print("* style errors: %d" % style.error_count)
print("* clang-format errors: %d" % clang.error_count)
print("* eslint errors: %d" % eslint.error_count)
msg_color = Terminal.red if total_errors > 0 else Terminal.green
Terminal.pprint("* total errors: %d" % (total_errors), msg_color)
print()
if total_errors:
ex.fail("Failed tidy check")