<commit_before>import json
from requests import Session

from lib.base import SaltAction


class SaltLocal(SaltAction):
    __explicit__ = [
        'cmdmod',
        'event',
        'file',
        'grains',
        'pillar',
        'pkg',
        'saltcloudmod',
        'schedule',
        'service',
        'state',
        'status'
    ]

    def run(self, module, target, expr_form, *args, **kwargs):
        self.verify_ssl = self.config.get('verify_ssl', True)
        '''
        CLI Examples:

            st2 run salt.local module=test.ping matches='web*'
            st2 run salt.local module=test.ping expr_form=grain target='os:Ubuntu'
        '''
        self.generate_package('local',
                              cmd=module,
                              args=args,
                              target=target,
                              expr_form=expr_form,
                              data=kwargs)
        request = self.generate_request()
        self.logger.info('[salt] Request generated')
        request.prepare_body(json.dumps(self.data), None)
        self.logger.info('[salt] Preparing to send')
        resp = Session().send(request, verify=self.verify_ssl)
        return resp.json()<commit_msg>Force args as list<commit_after>import json
from requests import Session

from lib.base import SaltAction


class SaltLocal(SaltAction):
    __explicit__ = [
        'cmdmod',
        'event',
        'file',
        'grains',
        'pillar',
        'pkg',
        'saltcloudmod',
        'schedule',
        'service',
        'state',
        'status'
    ]

    def run(self, module, target, expr_form, args, **kwargs):
        self.verify_ssl = self.config.get('verify_ssl', True)
        '''
        CLI Examples:

            st2 run salt.local module=test.ping matches='web*'
            st2 run salt.local module=test.ping expr_form=grain target='os:Ubuntu'
        '''
        self.generate_package('local',
                              cmd=module,
                              args=list(args),
                              target=target,
                              expr_form=expr_form,
                              data=kwargs)
        request = self.generate_request()
        self.logger.info('[salt] Request generated')
        request.prepare_body(json.dumps(self.data), None)
        self.logger.info('[salt] Preparing to send')
        resp = Session().send(request, verify=self.verify_ssl)
        return resp.json()
{'fraction_non_alphanumeric': 0.11268174474959612, 'fraction_numerical': 0.0016155088852988692, 'mean_word_length': 1.6634408602150537, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3487379', 'n_tokens_mistral': 695, 'n_tokens_neox': 676, 'n_words': 140}