diff --git a/codespell_lib/_codespell.py b/codespell_lib/_codespell.py index 7198e99e9e..8e9165ff95 100644 --- a/codespell_lib/_codespell.py +++ b/codespell_lib/_codespell.py @@ -25,7 +25,6 @@ import re import sys import textwrap -from ctypes import wintypes from typing import ( Any, Dict, @@ -40,6 +39,12 @@ Tuple, ) +if sys.platform == "win32": + from ctypes import wintypes + + ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 + STD_OUTPUT_HANDLE = wintypes.HANDLE(-11) + from ._spellchecker import Misspelling, build_dict from ._text_util import fix_case @@ -138,10 +143,6 @@ EX_DATAERR = 65 EX_CONFIG = 78 -# Windows specific constants -ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 -STD_OUTPUT_HANDLE = wintypes.HANDLE(-11) - # OPTIONS: # # ARGUMENTS: