<commit_before>"""
Utility to generate terminology.py from PITerminology.h and
PIStringTerminology.h in the Photoshop SDK. Use with Python 3.

Usage:

    python3 tools/extract_terminology.py \
        photoshopsdk/PITerminology.h \
        src/psd_tools/terminology.py

.. note:: Adobe explicitly prohibits Photoshop SDK to be used for Open source
    software. Therefore, psd-tools does not bundle the official header files.
    https://www.adobe.com/devnet/photoshop/sdk/eula.html
"""
import re
import sys


FILE_HEADER = '''"""
Constants for descriptor.

This file is automaticaly generated by tools/extract_terminology.py
"""
from enum import Enum as _Enum'''


TERM_DEF = '''class {0}(_Enum):
    """
    {0} definitions extracted from PITerminology.h.

    See https://www.adobe.com/devnet/photoshop/sdk.html
    """'''


TERM_PATTERN = re.compile(
    r"^#define\s+(?P<key>\w+)\s+'(?P<value>....)'(\s+//\s(?P<comment>.*))?$"
)

<commit_msg>fix py27 compatibility<commit_after>"""
Utility to generate terminology.py from PITerminology.h and
PIStringTerminology.h in the Photoshop SDK. Use with Python 3.

Usage:

    python3 tools/extract_terminology.py \
        photoshopsdk/PITerminology.h \
        src/psd_tools/terminology.py

.. note:: Adobe explicitly prohibits Photoshop SDK to be used for Open source
    software. Therefore, psd-tools does not bundle the official header files.
    https://www.adobe.com/devnet/photoshop/sdk/eula.html
"""
from __future__ import print_function
import re
import sys


FILE_HEADER = '''"""
Constants for descriptor.

This file is automaticaly generated by tools/extract_terminology.py
"""
from enum import Enum as _Enum'''


TERM_DEF = '''class {0}(_Enum):
    """
    {0} definitions extracted from PITerminology.h.

    See https://www.adobe.com/devnet/photoshop/sdk.html
    """'''


TERM_PATTERN = re.compile(
    r"^#define\s+(?P<key>\w+)\s+'(?P<value>....)'(\s+//\s(?P<comment>.*))?$"
)


{'fraction_non_alphanumeric': 0.13896037056098817, 'fraction_numerical': 0.0051466803911477095, 'mean_word_length': 3.661870503597122, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2202499', 'n_tokens_mistral': 686, 'n_tokens_neox': 641, 'n_words': 164}