MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / _command_length

Function _command_length

pre_commit/xargs.py:61–69  ·  view source on GitHub ↗
(*cmd: str)

Source from the content-addressed store, hash-verified

59
60
61def _command_length(*cmd: str) -> int:
62 full_cmd = ' '.join(cmd)
63
64 # win32 uses the amount of characters, more details at:
65 # https://github.com/pre-commit/pre-commit/pull/839
66 if sys.platform == 'win32':
67 return len(full_cmd.encode('utf-16le')) // 2
68 else:
69 return len(full_cmd.encode(sys.getfilesystemencoding()))
70
71
72class ArgumentTooLongError(RuntimeError):

Callers 1

partitionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected