Print any command sent in raw format

        :param msg: arbitrary code to be printed
        :type msg: bytes
548672
def _raw(self, msg):
        
        self.device.write(msg)
        if self.auto_flush:
            self.flush()
1070166
def logMsg(self, msg, printMsg=True):
        
        time = datetime.datetime.now().strftime('%I:%M %p')
        self.log = '{0}\n{1} | {2}'.format(self.log, time, msg)
        if printMsg:
            print msg

        if self.addLogsToArcpyMessages:
            from arcpy import AddMessage
            AddMessage(msg)
365556
def process_message(self,msg,sock):
    ""
    command=msg[0]
    try: f={'GET':self.get,'SET':self.set,'SUBSCRIBE':self.sub,'PUBLISH':self.pub,
      'PING':self.ping,'GETSET':self.getset,'EXPIRE':self.expire,'DEL':self.delete}[command]
    except KeyError: print msg; raise
    args=msg[1:]
    try: return f(sock,*args) if command in self.SOCK_COMMANDS else f(*args)
    except Exception as e:
      print e
      print msg
      return '-ERROR\r\n'
651732
def getraw(self, msgid, stream=sys.stdout):
        
        foldername, msgkey = msgid.split(SEPERATOR)
        folder = self.folder if foldername == "INBOX" else self._getfolder(foldername)
        msg = folder[msgkey]
        print(msg.content)
470218
def _print(self, msg=None, always=False):
        """"""
        if always or not self.commons['cmdlineopts'].quiet:
            if msg:
                print_(msg)
            else:
                print_()
198584
def print_message(self, message="heya!"):
        
        if self.log == None: print(message)
        else:                self.log.append_text(message)
347633
def _raw(self, msg):
        
        if len(msg) != self.device.write(self.out_ep, msg, self.interface):
            self.device.write(self.out_ep, self.errorText, self.interface)
            raise TicketNotPrinted()
801060
def command_generic_msg(hostname, result, oneline, caption):
    '''  '''

    rc     = result.get('rc', '0')
    stdout = result.get('stdout','')
    stderr = result.get('stderr', '')
    msg    = result.get('msg', '')

    hostname = hostname.encode('utf-8')
    caption  = caption.encode('utf-8')

    if not oneline:
        buf = "%s | %s | rc=%s >>\n" % (hostname, caption, result.get('rc',0))
        if stdout:
            buf += stdout
        if stderr:
            buf += stderr
        if msg:
            buf += msg
        return buf + "\n"
    else:
        if stderr:
            return "%s | %s | rc=%s | (stdout) %s (stderr) %s" % (hostname, caption, rc, stdout, stderr)
        else:
            return "%s | %s | rc=%s | (stdout) %s" % (hostname, caption, rc, stdout)
1168283
def dump(self, msg):
        '''
        
        '''
        msg_size = len(msg)

        # We start a new batch if the resulting batch file is larger than the
        # max batch file size. However, if the current batch file size is zero
        # then that means the message alone is larger than the max batch file
        # size. In this case instead of splitting up the message across files
        # which would greatly increase complexity we simply dump that message
        # into a file of its own even though it will be larger than the max
        # batch file size.
        if self._batch_size + msg_size > self._max_batch_file_size \
                and self._batch_size > 0:
            self._startNewBatch()

        # Write the time stamp and information on how to retrieve the message
        # from the batch files (batch filename, byte offset, and byte size)
        global getTime
        index_file_entry = '{:},{:09d},{:},{:}\n'.format(
            getTime(), self._batch_index, self._batch_size, msg_size)
        if sys.version_info >= (3,):
            self._index_file.write(index_file_entry.encode('utf-8'))
        else:
            self._index_file.write(index_file_entry)

        # Dump the message itself to the current batch file
        self._batch_file.write(msg)
        self._batch_size += msg_size

        # Increment message count
        self._message_count += 1
463359
def debug_msg(message):
        
        message = message or ""
        if Console.color:
            Console.cprint('RED', 'DEBUG: ', message)
        else:
            print(Console.msg('DEBUG: ' + message))
618162
def tracker_print(msg):
    
    if not isinstance(msg, STRING_TYPES):
        msg = str(msg)
    is_dist = _LIB.RabitIsDistributed()
    if is_dist != 0:
        _LIB.RabitTrackerPrint(c_str(msg))
    else:
        sys.stdout.write(msg)
        sys.stdout.flush()
680631
def _encode_batched_op_msg(
        operation, command, docs, check_keys, ack, opts, ctx):
    
    buf = StringIO()

    to_send, _ = _batched_op_msg_impl(
        operation, command, docs, check_keys, ack, opts, ctx, buf)
    return buf.getvalue(), to_send
607963
def receive(self,arg_formats=None):
        

        # Read serial input until a command separator or empty character is
        # reached 
        msg = [[]]
        raw_msg = []
        escaped = False
        command_sep_found = False
        while True:

            tmp = self.board.read()
            raw_msg.append(tmp)

            if escaped:

                # Either drop the escape character or, if this wasn't really
                # an escape, keep previous escape character and new character
                if tmp in self._escaped_characters:
                    msg[-1].append(tmp)
                    escaped = False
                else:
                    msg[-1].append(self._byte_escape_sep)
                    msg[-1].append(tmp)
                    escaped = False
            else:

                # look for escape character
                if tmp == self._byte_escape_sep:
                    escaped = True

                # or field separator
                elif tmp == self._byte_field_sep:
                    msg.append([])

                # or command separator
                elif tmp == self._byte_command_sep:
                    command_sep_found = True
                    break

                # or any empty characater 
                elif tmp == b'':
                    break

                # okay, must be something
                else:
                    msg[-1].append(tmp)
  
        # No message received given timeouts
        if len(msg) == 1 and len(msg[0]) == 0:
            return None

        # Make sure the message terminated properly
        if not command_sep_found:
          
            # empty message (likely from line endings being included) 
            joined_raw = b''.join(raw_msg) 
            if joined_raw.strip() == b'':
                return  None
           
            err = "Incomplete message ({})".format(joined_raw.decode())
            raise EOFError(err)

        # Turn message into fields
        fields = [b''.join(m) for m in msg]

        # Get the command name.
        cmd = fields[0].strip().decode()
        try:
            cmd_name = self._int_to_cmd_name[int(cmd)]
        except (ValueError,IndexError):

            if self.give_warnings:
                cmd_name = "unknown"
                w = "Recieved unrecognized command ({}).".format(cmd)
                warnings.warn(w,Warning)
        
        # Figure out what formats to use for each argument.  
        arg_format_list = []
        if arg_formats != None:

            # The user specified formats
            arg_format_list = list(arg_formats)

        else:
            try:
                # See if class was initialized with a format for arguments to this
                # command
                arg_format_list = self._cmd_name_to_format[cmd_name]
            except KeyError:
                # if not, guess for all arguments
                arg_format_list = ["g" for i in range(len(fields[1:]))]

        # Deal with "*" format  
        arg_format_list = self._treat_star_format(arg_format_list,fields[1:])

        if len(fields[1:]) > 0:
            if len(arg_format_list) != len(fields[1:]):
                err = "Number of argument formats must match the number of recieved arguments."
                raise ValueError(err)

        received = []
        for i, f in enumerate(fields[1:]):
            received.append(self._recv_methods[arg_format_list[i]](f))
        
        # Record the time the message arrived
        message_time = time.time()

        return cmd_name, received, message_time
722022
def encode(msg):
    
    msg = bytes(msg)
    return END + msg.replace(ESC, ESC + ESC_ESC).replace(END, ESC + ESC_END) + END
297126
def printer(self, message, color_level='info'):
        

        if self.job_args.get('colorized'):
            print(cloud_utils.return_colorized(msg=message, color=color_level))
        else:
            print(message)
644478
def message(self_,msg,*args,**kw):
        
        self_.__db_print(INFO,msg,*args,**kw)
1190044
def printo(msg, encoding=None, errors='replace', std_type='stdout'):
    
    std = getattr(sys, std_type, sys.stdout)
    if encoding is None:
        try:
            encoding = std.encoding
        except AttributeError:
            encoding = None
    # Fallback to ascii if no encoding is found
    if encoding is None:
        encoding = 'ascii'
    # https://docs.python.org/3/library/sys.html#sys.stdout
    # write in the binary buffer directly in python3
    if hasattr(std, 'buffer'):
        std = std.buffer
    std.write(msg.encode(encoding, errors=errors))
    std.write(b'\n')
    std.flush()