flake8 fix

This commit is contained in:
Wyllys Ingersoll 2014-09-12 13:00:15 -04:00
parent e67f56ae56
commit 6752b700c9
1 changed files with 10 additions and 10 deletions

View File

@ -92,15 +92,15 @@ class Name(Struct):
not isinstance(self.name_value, str): not isinstance(self.name_value, str):
member = 'name_value' member = 'name_value'
raise TypeError(msg.format('{}.{}'.format(name, member), raise TypeError(msg.format('{}.{}'.format(name, member),
'name_value', type(Name.NameValue), 'name_value', type(Name.NameValue),
type(self.name_value))) type(self.name_value)))
if self.name_type and \ if self.name_type and \
not isinstance(self.name_type, Name.NameType) and \ not isinstance(self.name_type, Name.NameType) and \
not isinstance(self.name_type, str): not isinstance(self.name_type, str):
member = 'name_type' member = 'name_type'
raise TypeError(msg.format('{}.{}'.format(name, member), raise TypeError(msg.format('{}.{}'.format(name, member),
'name_type', type(Name.NameType), 'name_type', type(Name.NameType),
type(self.name_type))) type(self.name_type)))
@classmethod @classmethod
def create(cls, name_value, name_type): def create(cls, name_value, name_type):
@ -109,24 +109,24 @@ class Name(Struct):
elif isinstance(name_value, str): elif isinstance(name_value, str):
value = cls.NameValue(name_value) value = cls.NameValue(name_value)
else: else:
name = self.__class__.__name__ name = 'Name'
msg = ErrorStrings.BAD_EXP_RECV msg = ErrorStrings.BAD_EXP_RECV
member = 'name_value' member = 'name_value'
raise TypeError(msg.format('{}.{}'.format(name, member), raise TypeError(msg.format('{}.{}'.format(name, member),
'name_value', type(Name.NameValue), 'name_value', type(Name.NameValue),
type(self.name_value))) type(name_value)))
if isinstance(name_type, Name.NameType): if isinstance(name_type, Name.NameType):
n_type = name_type n_type = name_type
elif isinstance(name_type, Enum): elif isinstance(name_type, Enum):
n_type = cls.NameType(name_type) n_type = cls.NameType(name_type)
else: else:
name = self.__class__.__name__ name = 'Name'
msg = ErrorStrings.BAD_EXP_RECV msg = ErrorStrings.BAD_EXP_RECV
member = 'name_type' member = 'name_type'
raise TypeError(msg.format('{}.{}'.format(name, member), raise TypeError(msg.format('{}.{}'.format(name, member),
'name_type', type(Name.NameType), 'name_type', type(Name.NameType),
type(self.name_type))) type(name_type)))
return Name(name_value=value, return Name(name_value=value,
name_type=n_type) name_type=n_type)