From 958b12dec88538d54ca3e35bb78e1ea960c5e2b2 Mon Sep 17 00:00:00 2001 From: ines Date: Sat, 15 Apr 2017 12:13:00 +0200 Subject: [PATCH] Use pathlib instead of os.path --- spacy/gold.pyx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spacy/gold.pyx b/spacy/gold.pyx index 8edf68aab..a33ca69a4 100644 --- a/spacy/gold.pyx +++ b/spacy/gold.pyx @@ -139,9 +139,10 @@ def _min_edit_path(cand_words, gold_words): def read_json_file(loc, docs_filter=None): - if path.isdir(loc): - for filename in os.listdir(loc): - yield from read_json_file(path.join(loc, filename)) + loc = Path(loc) + if loc.is_dir(): + for filename in loc.iterdir(): + yield from read_json_file(loc / filename) else: with io.open(loc, 'r', encoding='utf8') as file_: docs = json.load(file_)