コード例 #1
0
 def load_file(self,
               match: FilePath,
               *,
               set_contents: bool = False) -> SourceFile:
     if match.seed_too_large():
         # We don't want to calculate a hash of this file. Use the path.
         return SourceFile.big_seed(match)
     else:
         # We want to calculate a hash, but we don't need the contents
         return super().load_file(match, set_contents=set_contents)
コード例 #2
0
ファイル: read_files.py プロジェクト: chrisp-data/all_data
def load_seed_source_file(match: FilePath, project_name) -> SourceFile:
    if match.seed_too_large():
        # We don't want to calculate a hash of this file. Use the path.
        source_file = SourceFile.big_seed(match)
    else:
        file_contents = load_file_contents(match.absolute_path, strip=False)
        checksum = FileHash.from_contents(file_contents)
        source_file = SourceFile(path=match, checksum=checksum)
        source_file.contents = ''
    source_file.parse_file_type = ParseFileType.Seed
    source_file.project_name = project_name
    return source_file