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
=== modified file 'surveilr/api/server.py'
--- surveilr/api/server.py 2011-11-19 22:01:55 +0000
+++ surveilr/api/server.py 2011-11-20 00:24:23 +0000
@@ -38,6 +38,7 @@
38from surveilr import models38from surveilr import models
39from surveilr import utils39from surveilr import utils
4040
41
41class ServiceController(object):42class ServiceController(object):
42 """Routes style controller for actions related to services"""43 """Routes style controller for actions related to services"""
4344
@@ -49,7 +50,7 @@
49 data = json.loads(req.body)50 data = json.loads(req.body)
50 service = models.Service(**data)51 service = models.Service(**data)
51 service.save()52 service.save()
52 response = {'id':service.key}53 response = {'id': service.key}
53 return Response(json.dumps(response))54 return Response(json.dumps(response))
5455
55 def show(self, req, id):56 def show(self, req, id):
@@ -95,6 +96,7 @@
95 retval += [{'metrics': x.metrics, 'timestamp': x.timestamp}]96 retval += [{'metrics': x.metrics, 'timestamp': x.timestamp}]
96 return Response(json.dumps(retval))97 return Response(json.dumps(retval))
9798
99
98class SurveilrApplication(object):100class SurveilrApplication(object):
99 """The core Surveilr Monitoring WSGI application"""101 """The core Surveilr Monitoring WSGI application"""
100 controllers = {}102 controllers = {}
@@ -126,9 +128,11 @@
126128
127application = SurveilrApplication()129application = SurveilrApplication()
128130
131
129def main():132def main():
130 socket = eventlet.listen(('', 9877))133 socket = eventlet.listen(('', 9877))
131 eventlet.wsgi.server(socket, application)134 eventlet.wsgi.server(socket, application)
132135
133if __name__ == '__main__': # pragma: nocover136
137if __name__ == '__main__': # pragma: nocover
134 main()138 main()
135139
=== modified file 'surveilr/models.py'
--- surveilr/models.py 2011-11-19 22:01:55 +0000
+++ surveilr/models.py 2011-11-20 00:24:23 +0000
@@ -22,6 +22,7 @@
22from riakalchemy import RiakObject22from riakalchemy import RiakObject
23from riakalchemy.types import Integer, String, Dict, RelatedObjects23from riakalchemy.types import Integer, String, Dict, RelatedObjects
2424
25
25class Service(RiakObject):26class Service(RiakObject):
26 """A service that is referenced by many LogEntry's27 """A service that is referenced by many LogEntry's
2728
@@ -35,6 +36,7 @@
35 name = String()36 name = String()
36 most_recent_log_entry = RelatedObjects()37 most_recent_log_entry = RelatedObjects()
3738
39
38class LogEntry(RiakObject):40class LogEntry(RiakObject):
39 """A log entry holding one or more metrics41 """A log entry holding one or more metrics
4042
4143
=== modified file 'surveilr/tests/test_api_server.py'
--- surveilr/tests/test_api_server.py 2011-11-19 22:01:55 +0000
+++ surveilr/tests/test_api_server.py 2011-11-20 00:24:23 +0000
@@ -27,7 +27,7 @@
2727
28from surveilr.api import server28from surveilr.api import server
29from surveilr.api.server import application29from surveilr.api.server import application
30from surveilr.api.server import main as server_main30
3131
32class APIServerTests(unittest.TestCase):32class APIServerTests(unittest.TestCase):
33 def setUp(self):33 def setUp(self):
@@ -57,7 +57,9 @@
57 self.assertEquals(resp.status_int, 404)57 self.assertEquals(resp.status_int, 404)
5858
59 def test_create_retrieve_metric(self):59 def test_create_retrieve_metric(self):
60 req = Request.blank('/services', method='POST', POST='{"name": "this_or_the_other"}')60 req = Request.blank('/services',
61 method='POST',
62 POST='{"name": "this_or_the_other"}')
61 resp = application(req)63 resp = application(req)
62 self.assertEquals(resp.status_int, 200)64 self.assertEquals(resp.status_int, 200)
6365
@@ -85,6 +87,7 @@
85 socket_sentinel = mock.sentinel.return_value87 socket_sentinel = mock.sentinel.return_value
86 eventlet.listen.return_value = socket_sentinel88 eventlet.listen.return_value = socket_sentinel
87 server.main()89 server.main()
88 90
89 eventlet.listen.assert_called_with(('', 9877))91 eventlet.listen.assert_called_with(('', 9877))
90 eventlet.wsgi.server.assert_called_with(socket_sentinel, application)92 eventlet.wsgi.server.assert_called_with(socket_sentinel,
93 application)
9194
=== modified file 'surveilr/utils.py'
--- surveilr/utils.py 2011-11-19 22:01:55 +0000
+++ surveilr/utils.py 2011-11-20 00:24:23 +0000
@@ -20,6 +20,7 @@
20 Utility functions20 Utility functions
21"""21"""
2222
23
23def truncate(number, rounding_factor):24def truncate(number, rounding_factor):
24 """Truncate to nearest arbitrary multiple25 """Truncate to nearest arbitrary multiple
2526

Subscribers

People subscribed via source and target branches

to all changes: