Merge lp:~soren/surveilr/pep8-clean into lp:surveilr

Proposed by Soren Hansen
Status: Merged
Approved by: Soren Hansen
Approved revision: 5
Merged at revision: 5
Proposed branch: lp:~soren/surveilr/pep8-clean
Merge into: lp:surveilr
Diff against target: 106 lines (+16/-6)
4 files modified
surveilr/api/server.py (+6/-2)
surveilr/models.py (+2/-0)
surveilr/tests/test_api_server.py (+7/-4)
surveilr/utils.py (+1/-0)
To merge this branch: bzr merge lp:~soren/surveilr/pep8-clean
Reviewer Review Type Date Requested Status
Soren Hansen Pending
Review via email: mp+82803@code.launchpad.net

Commit message

PEP-8 and pyflakes clean

To post a comment you must log in.
Revision history for this message
Linux2Go Jenkins (linux2go-jenkins) wrote :

No approved revision specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'surveilr/api/server.py'
2--- surveilr/api/server.py 2011-11-19 22:01:55 +0000
3+++ surveilr/api/server.py 2011-11-20 00:24:23 +0000
4@@ -38,6 +38,7 @@
5 from surveilr import models
6 from surveilr import utils
7
8+
9 class ServiceController(object):
10 """Routes style controller for actions related to services"""
11
12@@ -49,7 +50,7 @@
13 data = json.loads(req.body)
14 service = models.Service(**data)
15 service.save()
16- response = {'id':service.key}
17+ response = {'id': service.key}
18 return Response(json.dumps(response))
19
20 def show(self, req, id):
21@@ -95,6 +96,7 @@
22 retval += [{'metrics': x.metrics, 'timestamp': x.timestamp}]
23 return Response(json.dumps(retval))
24
25+
26 class SurveilrApplication(object):
27 """The core Surveilr Monitoring WSGI application"""
28 controllers = {}
29@@ -126,9 +128,11 @@
30
31 application = SurveilrApplication()
32
33+
34 def main():
35 socket = eventlet.listen(('', 9877))
36 eventlet.wsgi.server(socket, application)
37
38-if __name__ == '__main__': # pragma: nocover
39+
40+if __name__ == '__main__': # pragma: nocover
41 main()
42
43=== modified file 'surveilr/models.py'
44--- surveilr/models.py 2011-11-19 22:01:55 +0000
45+++ surveilr/models.py 2011-11-20 00:24:23 +0000
46@@ -22,6 +22,7 @@
47 from riakalchemy import RiakObject
48 from riakalchemy.types import Integer, String, Dict, RelatedObjects
49
50+
51 class Service(RiakObject):
52 """A service that is referenced by many LogEntry's
53
54@@ -35,6 +36,7 @@
55 name = String()
56 most_recent_log_entry = RelatedObjects()
57
58+
59 class LogEntry(RiakObject):
60 """A log entry holding one or more metrics
61
62
63=== modified file 'surveilr/tests/test_api_server.py'
64--- surveilr/tests/test_api_server.py 2011-11-19 22:01:55 +0000
65+++ surveilr/tests/test_api_server.py 2011-11-20 00:24:23 +0000
66@@ -27,7 +27,7 @@
67
68 from surveilr.api import server
69 from surveilr.api.server import application
70-from surveilr.api.server import main as server_main
71+
72
73 class APIServerTests(unittest.TestCase):
74 def setUp(self):
75@@ -57,7 +57,9 @@
76 self.assertEquals(resp.status_int, 404)
77
78 def test_create_retrieve_metric(self):
79- req = Request.blank('/services', method='POST', POST='{"name": "this_or_the_other"}')
80+ req = Request.blank('/services',
81+ method='POST',
82+ POST='{"name": "this_or_the_other"}')
83 resp = application(req)
84 self.assertEquals(resp.status_int, 200)
85
86@@ -85,6 +87,7 @@
87 socket_sentinel = mock.sentinel.return_value
88 eventlet.listen.return_value = socket_sentinel
89 server.main()
90-
91+
92 eventlet.listen.assert_called_with(('', 9877))
93- eventlet.wsgi.server.assert_called_with(socket_sentinel, application)
94+ eventlet.wsgi.server.assert_called_with(socket_sentinel,
95+ application)
96
97=== modified file 'surveilr/utils.py'
98--- surveilr/utils.py 2011-11-19 22:01:55 +0000
99+++ surveilr/utils.py 2011-11-20 00:24:23 +0000
100@@ -20,6 +20,7 @@
101 Utility functions
102 """
103
104+
105 def truncate(number, rounding_factor):
106 """Truncate to nearest arbitrary multiple
107

Subscribers

People subscribed via source and target branches

to all changes: