<s> """<STR_LIT>""" <EOL> import os <EOL> from nova import exception <EOL> ALPHA = "<STR_LIT>" <EOL> ARMV6 = "<STR_LIT>" <EOL> ARMV7 = "<STR_LIT>" <EOL> ARMV7B = "<STR_LIT>" <EOL> AARCH64 = "<STR_LIT>" <EOL> CRIS = "<STR_LIT>" <EOL> I686 = "<STR_LIT>" <EOL> IA64 = "<STR_LIT>" <EOL> LM32 = "<STR_LIT>" <EOL> M68K = "<STR_LIT>" <EOL> MICROBLAZE = "<STR_LIT>" <EOL> MICROBLAZEEL = "<STR_LIT>" <EOL> MIPS = "<STR_LIT>" <EOL> MIPSEL = "<STR_LIT>" <EOL> MIPS64 = "<STR_LIT>" <EOL> MIPS64EL = "<STR_LIT>" <EOL> OPENRISC = "<STR_LIT>" <EOL> PARISC = "<STR_LIT>" <EOL> PARISC64 = "<STR_LIT>" <EOL> PPC = "<STR_LIT>" <EOL> PPCLE = "<STR_LIT>" <EOL> PPC64 = "<STR_LIT>" <EOL> PPC64LE = "<STR_LIT>" <EOL> PPCEMB = "<STR_LIT>" <EOL> S390 = "<STR_LIT>" <EOL> S390X = "<STR_LIT>" <EOL> SH4 = "<STR_LIT>" <EOL> SH4EB = "<STR_LIT>" <EOL> SPARC = "<STR_LIT>" <EOL> SPARC64 = "<STR_LIT>" <EOL> UNICORE32 = "<STR_LIT>" <EOL> X86_64 = "<STR_LIT>" <EOL> XTENSA = "<STR_LIT>" <EOL> XTENSAEB = "<STR_LIT>" <EOL> ALL = [ <EOL> ALPHA , <EOL> ARMV6 , <EOL> ARMV7 , <EOL> ARMV7B , <EOL> AARCH64 , <EOL> CRIS , <EOL> I686 , <EOL> IA64 , <EOL> LM32 , <EOL> M68K , <EOL> MICROBLAZE , <EOL> MICROBLAZEEL , <EOL> MIPS , <EOL> MIPSEL , <EOL> MIPS64 , <EOL> MIPS64EL , <EOL> OPENRISC , <EOL> PARISC , <EOL> PARISC64 , <EOL> PPC , <EOL> PPCLE , <EOL> PPC64 , <EOL> PPC64LE , <EOL> PPCEMB , <EOL> S390 , <EOL> S390X , <EOL> SH4 , <EOL> SH4EB , <EOL> SPARC , <EOL> SPARC64 , <EOL> UNICORE32 , <EOL> X86_64 , <EOL> XTENSA , <EOL> XTENSAEB , <EOL> ] <EOL> def from_host ( ) : <EOL> """<STR_LIT>""" <EOL> return canonicalize ( os . uname ( ) [ <NUM_LIT:4> ] ) <EOL> def is_valid ( name ) : <EOL> """<STR_LIT>""" <EOL> return name in ALL <EOL> def canonicalize ( name ) : <EOL> """<STR_LIT>""" <EOL> if name is None : <EOL> return None <EOL> newname = name . lower ( ) <EOL> if newname in ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) : <EOL> newname = I686 <EOL> if newname in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> newname = I686 <EOL> if newname == "<STR_LIT>" : <EOL> newname = X86_64 <EOL> if not is_valid ( newname ) : <EOL> raise exception . InvalidArchitectureName ( arch = name ) <EOL> return newname </s>
