<commit_before># -*- coding: utf-8 -*-
'''
The client libs to communicate with the salt master when running raet
'''

# Import python libs
import os
import time
import logging

# Import Salt libs
from salt.transport.road.raet import stacking
from salt.transport.road.raet import raeting
from salt.transport.road.raet import yarding
import salt.config
import salt.client
import salt.utils
import salt.syspaths as syspaths

log = logging.getLogger(__name__)


class LocalClient(salt.client.LocalClient):
    '''
    The RAET LocalClient
    '''
    def __init__(self,
                 c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),
                 mopts=None):
        salt.client.LocalClient.__init__(self, c_path, mopts)

    def pub(self,
            tgt,
            fun,
            arg=(),
            expr_form='glob',
            ret='',
            jid='',
            timeout=5,
            **kwargs):
        '''
        Publish the command!
        '''
        payload_kwargs = self._prep_pub(
                tgt,
                fun,
                arg=(),
                expr_form='glob',
                ret='',
                jid='',
                timeout=5,
                **kwargs)
        yid = salt.utils.gen_jid()
        stack = stacking.StackUxd(
                yid=yid,
                lanename='master',
                dirpath=self.opts['sock_dir'])
        stack.Pk = raeting.packKinds.pack
        router_yard = yarding.Yard(
                prefix='master',
                yid=0,
                dirpath=self.opts['sock_dir'])
        stack.addRemoteYard(router_yard)
        route = {'dst': (None, router_yard.name, 'local_cmd'),
                 'src': (None, stack.yard.name, None)}
        msg = {'route': route, 'load': payload_kwargs}
        stack.transmit(msg)
        stack.serviceAll()
        while True:
            time.sleep(0.001)
            stack.serviceAll()
            for msg in stack.rxMsgs:
                print msg
                return msg<commit_msg>return the right data from pub<commit_after># -*- coding: utf-8 -*-
'''
The client libs to communicate with the salt master when running raet
'''

# Import python libs
import os
import time
import logging

# Import Salt libs
from salt.transport.road.raet import stacking
from salt.transport.road.raet import raeting
from salt.transport.road.raet import yarding
import salt.config
import salt.client
import salt.utils
import salt.syspaths as syspaths

log = logging.getLogger(__name__)


class LocalClient(salt.client.LocalClient):
    '''
    The RAET LocalClient
    '''
    def __init__(self,
                 c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),
                 mopts=None):
        salt.client.LocalClient.__init__(self, c_path, mopts)

    def pub(self,
            tgt,
            fun,
            arg=(),
            expr_form='glob',
            ret='',
            jid='',
            timeout=5,
            **kwargs):
        '''
        Publish the command!
        '''
        payload_kwargs = self._prep_pub(
                tgt,
                fun,
                arg=(),
                expr_form='glob',
                ret='',
                jid='',
                timeout=5,
                **kwargs)
        yid = salt.utils.gen_jid()
        stack = stacking.StackUxd(
                yid=yid,
                lanename='master',
                dirpath=self.opts['sock_dir'])
        stack.Pk = raeting.packKinds.pack
        router_yard = yarding.Yard(
                prefix='master',
                yid=0,
                dirpath=self.opts['sock_dir'])
        stack.addRemoteYard(router_yard)
        route = {'dst': (None, router_yard.name, 'local_cmd'),
                 'src': (None, stack.yard.name, None)}
        msg = {'route': route, 'load': payload_kwargs}
        stack.transmit(msg)
        stack.serviceAll()
        while True:
            time.sleep(0.001)
            stack.serviceAll()
            for msg in stack.rxMsgs:
                return msg.get('return', {}).get('ret', {})
{'fraction_non_alphanumeric': 0.11318897637795275, 'fraction_numerical': 0.003937007874015748, 'mean_word_length': 1.6225806451612903, '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': '5280078', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1138, 'n_words': 263}