Skip to content

Commit

Permalink
update clang-format and remove tqdm dependeny
Browse files Browse the repository at this point in the history
  • Loading branch information
ichisadashioko committed Jul 30, 2020
1 parent f524bce commit a76e913
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
12 changes: 7 additions & 5 deletions clang-format.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
# encoding=utf-8

import os
import subprocess
import posixpath
Expand Down Expand Up @@ -60,17 +59,20 @@ def decode(cls, bs: bytes):
return None, bs


C_SOURCE_EXTENSIONS = [
SUPPORTED_EXTENSIONS = [
'.h',
'.c',
'.cc',
'.cpp',
'.c++',
'.java',
]


def is_c_source_file(path: str):
def is_supported_file(path: str):
_, ext = posixpath.splitext(path)
ext = ext.lower()
if ext in C_SOURCE_EXTENSIONS:
if ext in SUPPORTED_EXTENSIONS:
return True
else:
return False
Expand Down Expand Up @@ -144,7 +146,7 @@ def run(self, timeout=5, raise_on_error=True):
lines = completed_process.stdout.decode('utf-8').split('\n')

filepaths = filter(lambda x: len(x) > 0, lines)
filepaths = filter(is_c_source_file, filepaths)
filepaths = filter(is_supported_file, filepaths)
filepaths = list(filepaths)

print(filepaths)
Expand Down
11 changes: 2 additions & 9 deletions lf-utf8.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import subprocess
from subprocess import PIPE

from tqdm import tqdm


class Encoding:
UTF8 = 'utf-8'
Expand Down Expand Up @@ -109,10 +107,6 @@ def find_all_files(infile):
return retval


def check_clang_format():
pass


if __name__ == '__main__':
# all files
# file_list = find_all_files('.')
Expand All @@ -128,9 +122,8 @@ def check_clang_format():

file_list = list(filter(lambda x: len(x) > 0, lines))

pbar = tqdm(file_list)
for fpath in pbar:
pbar.set_description(fpath)
for fpath in file_list:
print('>', fpath)
# mime = mimetypes.guess_type(fpath)
# print(mime, fpath)

Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pep8]
max-line-length=512

0 comments on commit a76e913

Please sign in to comment.