def parse_output(self, s):
        '''
        Example output:

        AVR Memory Usage
        ----------------
        Device: atmega2561

        Program:    4168 bytes (1.6% Full)
        (.text + .data + .bootloader)

        Data:         72 bytes (0.9% Full)
        (.data + .bss + .noinit)
        '''

        for x in s.splitlines():
            if '%' in x:
                name = x.split(':')[0].strip().lower()
                nbytes = x.split(':')[1].split('b')[0].strip()
                nbytes = int(nbytes)
                perc = x.split('(')[1].split('%')[0].strip()
                perc = float(perc)
                if name == 'program':
                    self.program_bytes = nbytes
                    self.program_percentage = perc
                else:
                    self.data_bytes = nbytes
                    self.data_percentage = perc
def parse_output ( self , s ) : for x in s . splitlines ( ) : if '%' in x : name = x . split ( ':' ) [ 0 ] . strip ( ) . lower ( ) nbytes = x . split ( ':' ) [ 1 ] . split ( 'b' ) [ 0 ] . strip ( ) nbytes = int ( nbytes ) perc = x . split ( '(' ) [ 1 ] . split ( '%' ) [ 0 ] . strip ( ) perc = float ( perc ) if name == 'program' : self . program_bytes = nbytes self . program_percentage = perc else : self . data_bytes = nbytes self . data_percentage = perc
Example output:

        AVR Memory Usage
        ----------------
        Device: atmega2561

        Program:    4168 bytes (1.6% Full)
        (.text + .data + .bootloader)

        Data:         72 bytes (0.9% Full)
        (.data + .bss + .noinit)