<commit_before>import hashlib
import hmac

from settings import CHUNK_SIZE, DEFAULT_HMAC_PASSPHRASE

def sha256_file(path):
    """Calculate sha256 hex digest of a file."""
    h = hashlib.sha256()

    with open(path) as f:
        for chunk in iter(lambda: f.read(CHUNK_SIZE), b''):<commit_msg>Open file as binary<commit_after>import hashlib
import hmac

from settings import CHUNK_SIZE, DEFAULT_HMAC_PASSPHRASE

def sha256_file(path):
    """Calculate sha256 hex digest of a file."""
    h = hashlib.sha256()

    with open(path, 'rb') as f:
        for chunk in iter(lambda: f.read(CHUNK_SIZE), b''):
{'fraction_non_alphanumeric': 0.1076158940397351, 'fraction_numerical': 0.029801324503311258, 'mean_word_length': 4.170940170940171, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3845670', 'n_tokens_mistral': 217, 'n_tokens_neox': 206, 'n_words': 63}