Code formating.

This commit is contained in:
Romain Dorgueil
2017-05-01 15:57:03 +02:00
parent ffa9ab6bc8
commit 8f38237658
6 changed files with 5 additions and 9 deletions

View File

@ -5,6 +5,7 @@ __all__ = [
'Option', 'Option',
] ]
class ConfigurableMeta(type): class ConfigurableMeta(type):
""" """
Metaclass for Configurables that will add options to a special __options__ dict. Metaclass for Configurables that will add options to a special __options__ dict.

View File

@ -26,5 +26,3 @@ class Option:
def __set__(self, inst, value): def __set__(self, inst, value):
inst.__options_values__[self.name] = self.type(value) if self.type else value inst.__options_values__[self.name] = self.type(value) if self.type else value

View File

@ -55,7 +55,7 @@ class CsvReader(CsvHandler, FileReader):
for row in reader: for row in reader:
if len(row) != field_count: if len(row) != field_count:
raise ValueError('Got a line with %d fields, expecting %d.' % (len(row), field_count,)) raise ValueError('Got a line with %d fields, expecting %d.' % (len(row), field_count, ))
yield dict(zip(headers.value, row)) yield dict(zip(headers.value, row))

View File

@ -129,10 +129,10 @@ class ValueHolder:
return divmod(other, self.value) return divmod(other, self.value)
def __pow__(self, other): def __pow__(self, other):
return self.value ** other return self.value**other
def __rpow__(self, other): def __rpow__(self, other):
return other ** self.value return other**self.value
def __ipow__(self, other): def __ipow__(self, other):
self.value **= other self.value **= other

View File

@ -18,6 +18,7 @@ class MyHarderConfigurable(MyConfigurable):
class MyBetterConfigurable(MyConfigurable): class MyBetterConfigurable(MyConfigurable):
required_str = Option(str, required=False, default='kaboom') required_str = Option(str, required=False, default='kaboom')
class MyConfigurableUsingPositionalOptions(MyConfigurable): class MyConfigurableUsingPositionalOptions(MyConfigurable):
first = Option(str, required=True, positional=True) first = Option(str, required=True, positional=True)
second = Option(str, required=True, positional=True) second = Option(str, required=True, positional=True)
@ -142,4 +143,3 @@ def test_service_dependency_unavailable():
def test_option_positional(): def test_option_positional():
o = MyConfigurableUsingPositionalOptions('1', '2', '3', required_str='hello') o = MyConfigurableUsingPositionalOptions('1', '2', '3', required_str='hello')

View File

@ -51,6 +51,3 @@ def test_valueholder():
assert y == x assert y == x
assert y is not x assert y is not x
assert repr(x) == repr(y) == repr(43) assert repr(x) == repr(y) == repr(43)