#NEWLINE# @ staticmethod #NEWLINE# def _parse_os_release_content( lines ) : #NEWLINE# #INDENT# '\n        Parse the lines of an os-release file.\n\n        Parameters:\n\n        * lines: Iterable through the lines in the os-release file.\n                 Each line must be a unicode string or a UTF-8 encoded byte\n                 string.\n\n        Returns:\n            A dictionary containing all information items.\n        ' #NEWLINE# props = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# lexer = shlex . shlex ( lines , posix = True ) #NEWLINE# lexer . whitespace_split = True #NEWLINE# if ( ( sys . version_info [ 0 ] == 2 ) and isinstance ( lexer . wordchars , str ) ) : #NEWLINE# #INDENT# lexer . wordchars = lexer . wordchars . decode ( 'iso-8859-1' ) #NEWLINE# #UNINDENT# tokens = list ( lexer ) #NEWLINE# for token in tokens : #NEWLINE# #INDENT# if ( '=' in token ) : #NEWLINE# #INDENT# ( k , v ) = token . split ( '=' , 1 ) #NEWLINE# if isinstance ( v , six . binary_type ) : #NEWLINE# #INDENT# v = v . decode ( 'utf-8' ) #NEWLINE# #UNINDENT# props [ k . lower ( ) ] = v #NEWLINE# if ( k == 'VERSION' ) : #NEWLINE# #INDENT# codename = re . search ( '(\\(\\D+\\))|,(\\s+)?\\D+' , v ) #NEWLINE# if codename : #NEWLINE# #INDENT# codename = codename . group ( ) #NEWLINE# codename = codename . strip ( '()' ) #NEWLINE# codename = codename . strip ( ',' ) #NEWLINE# codename = codename . strip ( ) #NEWLINE# props [ 'codename' ] = codename #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# props [ 'codename' ] = '' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# return props