1
Fork 0

Remove types

This commit is contained in:
Jake Howard 2018-03-28 20:17:10 +01:00
parent 0e4d9a984f
commit 0a53d6c7ec
Signed by: jake
GPG Key ID: 57AFB45680EDD477
1 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@ CONTEXT_FILE = CWD / 'context.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)]
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)
def get_word_count() -> int:
def get_word_count():
words = subprocess.check_output([
'pdftotext', str(OUTPUT_FILE), '-'
], cwd=str(BASE_DIR))
return len(re.findall(r'\w+', words.decode()))
def write_wordcount() -> pathlib.Path:
def write_wordcount():
_, out_file_path = tempfile.mkstemp(suffix='.yaml')
wordcount = get_word_count()
with open(out_file_path, 'w') as out_file: