소스 검색

refactor: pull out _read_json_from_file()

facilitates test mocking
main
Rob Hallam 2 달 전
부모
커밋
778483837c
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. +8
    -0
      pipeline/feature_extractors.py

+ 8
- 0
pipeline/feature_extractors.py 파일 보기

@@ -356,6 +356,14 @@ class JSONFeatureExtractor(FeatureExtractor):
def _source_from_dict(self, d):
return Source(d["source"], d["path"], d["provider"])

def _read_json_from_file(self, file):
"""Read a JSON file and return the contents

Method exists to allow for mocking in tests
"""
with open(file, "r") as f:
return json.load(f)

def run(self):

# only pipeline JSON format for now


불러오는 중...
취소
저장