<commit_before># -*- coding: utf-8 -*-
"""
    pyads.pyads
    ~~~~~~~~~~~

    Contains ADS functions.

    :copyright: (c) 2013 by <NAME>
    :license: MIT, see LICENSE for details

"""
import ctypes
from ctypes import c_long, sizeof, pointer, c_int, \
    c_ulong, c_char_p, create_string_buffer, memmove, addressof, c_void_p, \
    POINTER
from functools import wraps

from .constants import PLCTYPE_STRING, PLCTYPE_UDINT, ADSIGRP_SYM_HNDBYNAME, \
    ADSIGRP_SYM_VALBYHND, ADSIGRP_SYM_RELEASEHND, STRING_BUFFER
from .structs import AdsVersion, SAdsVersion, SAmsAddr, AmsAddr, \
    SAdsNotificationAttrib, SAdsNotificationHeader
from .errorcodes import ERROR_CODES
from .utils import platform_is_windows


# load dynamic ADS library
if platform_is_windows():
    _adsDLL = ctypes.windll.TcAdsDll  #: ADS-DLL (Beckhoff TwinCAT)


class ADSError(Exception):
    def __init__(self, err_code):
        self.err_code = err_code
        self.msg = "{} ({})".format(ERROR_CODES[self.err_code], self.err_code)

    def __str__(self):
        return "ADSError: " + self.msg


def win32_only(fn):
    @wraps(fn)
    def wrapper(*args, **kwargs):<commit_msg>Allow unknown errors<commit_after># -*- coding: utf-8 -*-
"""
    pyads.pyads
    ~~~~~~~~~~~

    Contains ADS functions.

    :copyright: (c) 2013 by <NAME>
    :license: MIT, see LICENSE for details

"""
import ctypes
from ctypes import c_long, sizeof, pointer, c_int, \
    c_ulong, c_char_p, create_string_buffer, memmove, addressof, c_void_p, \
    POINTER
from functools import wraps

from .constants import PLCTYPE_STRING, PLCTYPE_UDINT, ADSIGRP_SYM_HNDBYNAME, \
    ADSIGRP_SYM_VALBYHND, ADSIGRP_SYM_RELEASEHND, STRING_BUFFER
from .structs import AdsVersion, SAdsVersion, SAmsAddr, AmsAddr, \
    SAdsNotificationAttrib, SAdsNotificationHeader
from .errorcodes import ERROR_CODES
from .utils import platform_is_windows


# load dynamic ADS library
if platform_is_windows():
    _adsDLL = ctypes.windll.TcAdsDll  #: ADS-DLL (Beckhoff TwinCAT)


class ADSError(Exception):
    def __init__(self, err_code):
        self.err_code = err_code
        try:
            self.msg = "{} ({})".format(ERROR_CODES[self.err_code],
                                        self.err_code)
        except KeyError:
            self.msg = 'Unknown Error ({0})'.format(self.err_code)

    def __str__(self):
        return "ADSError: " + self.msg


def win32_only(fn):
    @wraps(fn)
    def wrapper(*args, **kwargs):
{'fraction_non_alphanumeric': 0.10975609756097561, 'fraction_numerical': 0.006097560975609756, 'mean_word_length': 3.540590405904059, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5725120', 'n_tokens_mistral': 897, 'n_tokens_neox': 838, 'n_words': 200}