# 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
from __future__ import annotations




def filter_lfs_files(filenames: set[str]) -> None:  # pragma: no cover (lfs)
    """Remove files tracked by git-lfs from the set."""
    if not filenames:
        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),
    )

# 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

from __future__ import annotations




def filter_lfs_files(filenames: set[str]) -> None:  # pragma: no cover (lfs)
    """Remove files tracked by git-lfs from the set."""
    if not filenames:
        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)