diff options
author | Bruno Wagner <bwgpro@gmail.com> | 2015-07-21 19:56:43 -0300 |
---|---|---|
committer | Bruno Wagner <bwgpro@gmail.com> | 2015-07-21 19:56:43 -0300 |
commit | 939a618de67ab685deb30d7f21ad796b3276059d (patch) | |
tree | 10e540defe455138d136551339307a8df34f0c02 /mail/src | |
parent | ac6502194114a0e20c17c1801204b318731fece8 (diff) |
Transformed assigned lambdas to functions in models and test_models because of pep8
Diffstat (limited to 'mail/src')
-rw-r--r-- | mail/src/leap/mail/adaptors/models.py | 6 | ||||
-rw-r--r-- | mail/src/leap/mail/adaptors/tests/test_models.py | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/mail/src/leap/mail/adaptors/models.py b/mail/src/leap/mail/adaptors/models.py index 88e0e4e..c5b838a 100644 --- a/mail/src/leap/mail/adaptors/models.py +++ b/mail/src/leap/mail/adaptors/models.py @@ -115,10 +115,8 @@ class DocumentWrapper(object): def _normalize_dict(_dict): items = _dict.items() - not_callable = lambda (k, v): not callable(v) - not_private = lambda(k, v): not k.startswith('_') - for cond in not_callable, not_private: - items = filter(cond, items) + items = filter(lambda k, v: not callable(v), items) + items = filter(lambda k, v: not k.startswith('_')) items = [(k, v) if not k.endswith('_') else (k[:-1], v) for (k, v) in items] items = [(k.replace('-', '_'), v) for (k, v) in items] diff --git a/mail/src/leap/mail/adaptors/tests/test_models.py b/mail/src/leap/mail/adaptors/tests/test_models.py index efe0bf2..b82cfad 100644 --- a/mail/src/leap/mail/adaptors/tests/test_models.py +++ b/mail/src/leap/mail/adaptors/tests/test_models.py @@ -39,7 +39,8 @@ class SerializableModelsTestCase(unittest.TestCase): class IgnoreMe(object): pass - killmeplease = lambda x: x + def killmeplease(x): + return x serialized = M.serialize() expected = {'foo': 42, 'bar': 33, 'baaz': None} @@ -88,7 +89,9 @@ class DocumentWrapperTestCase(unittest.TestCase): class Wrapper(models.DocumentWrapper): class model(models.SerializableModel): foo = 42 - getwrapper = lambda: Wrapper(bar=1) + + def getwrapper(): + return Wrapper(bar=1) self.assertRaises(RuntimeError, getwrapper) def test_no_model_wrapper(self): |