# Path: pre_commit_hooks/util.py
# def added_files() -> set[str]:
#     cmd = ('git', 'diff', '--staged', '--name-only', '--diff-filter=A')
#     return set(cmd_output(*cmd).splitlines())
# 
# Path: pre_commit_hooks/util.py
# def zsplit(s: str) -> list[str]:
#     s = s.strip('\0')
#     if s:
#         return s.split('\0')
#     else:
#         return []


import argparse
import math
import os
import subprocess
from typing import Sequence
from pre_commit_hooks.util import added_files
from pre_commit_hooks.util import zsplit
        return

    check_attr = subprocess.run(
        ('git', 'check-attr', 'filter', '-z', '--stdin'),
        stdout=subprocess.PIPE,
        stderr=subprocess.DEVNULL,
        encoding='utf-8',
        check=True,
        input='\0'.join(filenames),
    )
    stdout = zsplit(check_attr.stdout)
    for i in range(0, len(stdout), 3):
        filename, filter_tag = stdout[i], stdout[i + 2]
        if filter_tag == 'lfs':
            filenames.remove(filename)


def find_large_added_files(
        filenames: Sequence[str],
        maxkb: int,
        *,
        enforce_all: bool = False,
) -> int:
    # Find all added files that are also in the list of files pre-commit tells
    # us about
    retv = 0
    filenames_filtered = set(filenames)
    filter_lfs_files(filenames_filtered)

    if not enforce_all:

# Path: pre_commit_hooks/util.py
# def added_files() -> set[str]:
#     cmd = ('git', 'diff', '--staged', '--name-only', '--diff-filter=A')
#     return set(cmd_output(*cmd).splitlines())
# 
# Path: pre_commit_hooks/util.py
# def zsplit(s: str) -> list[str]:
#     s = s.strip('\0')
#     if s:
#         return s.split('\0')
#     else:
#         return []


# Path: pre_commit_hooks/check_added_large_files.py
import argparse
import math
import os
import subprocess
from typing import Sequence
from pre_commit_hooks.util import added_files
from pre_commit_hooks.util import zsplit

        return

    check_attr = subprocess.run(
        ('git', 'check-attr', 'filter', '-z', '--stdin'),
        stdout=subprocess.PIPE,
        stderr=subprocess.DEVNULL,
        encoding='utf-8',
        check=True,
        input='\0'.join(filenames),
    )
    stdout = zsplit(check_attr.stdout)
    for i in range(0, len(stdout), 3):
        filename, filter_tag = stdout[i], stdout[i + 2]
        if filter_tag == 'lfs':
            filenames.remove(filename)


def find_large_added_files(
        filenames: Sequence[str],
        maxkb: int,
        *,
        enforce_all: bool = False,
) -> int:
    # Find all added files that are also in the list of files pre-commit tells
    # us about
    retv = 0
    filenames_filtered = set(filenames)
    filter_lfs_files(filenames_filtered)

    if not enforce_all:

        filenames_filtered &= added_files()