<commit_before>'''
audit_files
===========

The following methods allow for interaction into the Tenable.sc
:sc-api:`Audit File <AuditFile.html>` API and the
:sc-api:`Audit File Template <AuditFile-Template.html>` API.  These items are
typically seen under the **Scans: Audit Files** section of Tenable.sc.

Methods available on ``sc.audit_files``:

.. rst-class:: hide-signature
.. autoclass:: AuditFileAPI

    .. automethod:: create
    .. automethod:: delete
    .. automethod:: details
    .. automethod:: edit
    .. automethod:: list
    .. automethod:: template_categories
    .. automethod:: template_details
    .. automethod:: template_list
'''
from .base import SCEndpoint
from os.path import basename

class AuditFileAPI(SCEndpoint):
    def _constructor(self, **kw):
        '''
        Handles parsing the keywords and returns a audit file definition document
        '''
        if 'name' in kw:
            # Validate that the name parameter is a string.
            self._check('name', kw['name'], str)

        if 'description' in kw:
            # Validate that the description parameter is a string,
            self._check('description', kw['description'], str)

        if 'type' in kw:
            # Validate that the type is one of the 3 possible audit file types:
            # "", "scapWindows", or "scapLinux".
            self._check('type', kw['type'], str,
                choices=['', 'scapWindows', 'scapLinux'])
<commit_msg>Added BytesIO import #197<commit_after>'''
audit_files
===========

The following methods allow for interaction into the Tenable.sc
:sc-api:`Audit File <AuditFile.html>` API and the
:sc-api:`Audit File Template <AuditFile-Template.html>` API.  These items are
typically seen under the **Scans: Audit Files** section of Tenable.sc.

Methods available on ``sc.audit_files``:

.. rst-class:: hide-signature
.. autoclass:: AuditFileAPI

    .. automethod:: create
    .. automethod:: delete
    .. automethod:: details
    .. automethod:: edit
    .. automethod:: list
    .. automethod:: template_categories
    .. automethod:: template_details
    .. automethod:: template_list
'''
from .base import SCEndpoint
from io import BytesIO
from os.path import basename

class AuditFileAPI(SCEndpoint):
    def _constructor(self, **kw):
        '''
        Handles parsing the keywords and returns a audit file definition document
        '''
        if 'name' in kw:
            # Validate that the name parameter is a string.
            self._check('name', kw['name'], str)

        if 'description' in kw:
            # Validate that the description parameter is a string,
            self._check('description', kw['description'], str)

        if 'type' in kw:
            # Validate that the type is one of the 3 possible audit file types:
            # "", "scapWindows", or "scapLinux".
            self._check('type', kw['type'], str,
                choices=['', 'scapWindows', 'scapLinux'])

{'fraction_non_alphanumeric': 0.12300914944086751, 'fraction_numerical': 0.0016943409013893595, 'mean_word_length': 2.7557251908396947, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1749375', 'n_tokens_mistral': 832, 'n_tokens_neox': 807, 'n_words': 285}