mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 03:56:54 +00:00
21 lines
491 B
Python
21 lines
491 B
Python
from __future__ import annotations
|
|
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
def __optim_args_from_interpreter_flags():
|
|
"""Return a list of command-line arguments reproducing the current
|
|
optimization settings in sys.flags."""
|
|
args = []
|
|
value = sys.flags.optimize
|
|
if value > 0:
|
|
args.append('-' + 'O' * value)
|
|
return args
|
|
|
|
|
|
_optim_args_from_interpreter_flags = getattr(
|
|
subprocess,
|
|
'_optim_args_from_interpreter_flags',
|
|
__optim_args_from_interpreter_flags,
|
|
)
|