Remove types
This commit is contained in:
parent
0e4d9a984f
commit
0a53d6c7ec
1 changed files with 3 additions and 3 deletions
6
build.py
6
build.py
|
@ -15,7 +15,7 @@ CONTEXT_FILE = CWD / 'context.yaml'
|
||||||
WORDCOUNT_TEMPLATE = BASE_DIR / 'wordcount.yaml'
|
WORDCOUNT_TEMPLATE = BASE_DIR / 'wordcount.yaml'
|
||||||
|
|
||||||
|
|
||||||
def build(input_file: pathlib.Path, additional_args=None):
|
def build(input_file, additional_args=None):
|
||||||
build_args = ['pandoc', str(input_file)]
|
build_args = ['pandoc', str(input_file)]
|
||||||
|
|
||||||
if CONTEXT_FILE.exists():
|
if CONTEXT_FILE.exists():
|
||||||
|
@ -33,14 +33,14 @@ def build(input_file: pathlib.Path, additional_args=None):
|
||||||
return subprocess.run(build_args, cwd=str(BASE_DIR), check=True)
|
return subprocess.run(build_args, cwd=str(BASE_DIR), check=True)
|
||||||
|
|
||||||
|
|
||||||
def get_word_count() -> int:
|
def get_word_count():
|
||||||
words = subprocess.check_output([
|
words = subprocess.check_output([
|
||||||
'pdftotext', str(OUTPUT_FILE), '-'
|
'pdftotext', str(OUTPUT_FILE), '-'
|
||||||
], cwd=str(BASE_DIR))
|
], cwd=str(BASE_DIR))
|
||||||
return len(re.findall(r'\w+', words.decode()))
|
return len(re.findall(r'\w+', words.decode()))
|
||||||
|
|
||||||
|
|
||||||
def write_wordcount() -> pathlib.Path:
|
def write_wordcount():
|
||||||
_, out_file_path = tempfile.mkstemp(suffix='.yaml')
|
_, out_file_path = tempfile.mkstemp(suffix='.yaml')
|
||||||
wordcount = get_word_count()
|
wordcount = get_word_count()
|
||||||
with open(out_file_path, 'w') as out_file:
|
with open(out_file_path, 'w') as out_file:
|
||||||
|
|
Reference in a new issue