Skip to content

Commit c308418

Browse files
committed
Merge pull request #437 from opdemand/more-docstrings
More docstrings, FAQ update.
2 parents c1e60ee + 8d8daef commit c308418

10 files changed

Lines changed: 38 additions & 31 deletions

File tree

api/admin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/python
21
# -*- coding: utf-8 -*-
32

43
"""

api/exceptions.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Deis exception classes.
2+
Deis API exception classes.
33
"""
44

55
from __future__ import unicode_literals
@@ -9,7 +9,12 @@
99

1010

1111
class BuildNodeError(APIException):
12-
"""Indicates a problem in building or bootstrapping a node."""
12+
"""
13+
Indicates a problem in building or bootstrapping a node.
14+
15+
This exception is subclassed from rest_framework's APIException so it
16+
isn't reported as "500 SERVER ERROR."
17+
"""
1318

1419
status_code = status.HTTP_401_UNAUTHORIZED
1520

api/fields.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111

1212
class UuidField(models.CharField):
13-
1413
"""A univerally unique ID field."""
15-
# pylint: disable=R0904
1614

1715
description = __doc__
1816

@@ -24,13 +22,11 @@ def __init__(self, *args, **kwargs):
2422
super(UuidField, self).__init__(*args, **kwargs)
2523

2624
def db_type(self, connection=None):
27-
"""Return the database type for a UuidField."""
28-
db_type = None
25+
"""Return the database column type for a UuidField."""
2926
if connection and 'postgres' in connection.vendor:
30-
db_type = 'uuid'
27+
return 'uuid'
3128
else:
32-
db_type = "char({})".format(self.max_length)
33-
return db_type
29+
return "char({})".format(self.max_length)
3430

3531
def pre_save(self, model_instance, add):
3632
"""Initialize an empty field with a new UUID before it is saved."""
@@ -55,12 +51,5 @@ def formfield(self, **kwargs):
5551
from south.modelsinspector import add_introspection_rules
5652
# Tell the South schema migration tool to handle our custom fields.
5753
add_introspection_rules([], [r'^api\.fields\.UuidField'])
58-
add_introspection_rules([], [r'^api\.fields\.EnvVarsField'])
59-
add_introspection_rules([], [r'^api\.fields\.DataBagField'])
60-
add_introspection_rules([], [r'^api\.fields\.ProcfileField'])
61-
add_introspection_rules([], [r'^api\.fields\.CredentialsField'])
62-
add_introspection_rules([], [r'^api\.fields\.ParamsField'])
63-
add_introspection_rules([], [r'^api\.fields\.CloudInitField'])
64-
add_introspection_rules([], [r'^api\.fields\.NodeStatusField'])
6554
except ImportError: # pragma: no cover
6655
pass

api/models.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
#!/usr/bin/python
21
# -*- coding: utf-8 -*-
32

43
"""
54
Data models for the Deis API.
65
"""
7-
# pylint: disable=R0903,W0232
86

97
from __future__ import unicode_literals
108
import importlib
@@ -36,7 +34,6 @@
3634

3735
# base models
3836

39-
4037
class AuditedModel(models.Model):
4138
"""Add created and updated fields to a model."""
4239

@@ -57,8 +54,8 @@ class Meta:
5754
"""Mark :class:`UuidAuditedModel` as abstract."""
5855
abstract = True
5956

60-
# deis core models
6157

58+
# deis core models
6259

6360
@python_2_unicode_compatible
6461
class Key(UuidAuditedModel):
@@ -127,7 +124,7 @@ def __str__(self):
127124

128125

129126
class FlavorManager(models.Manager):
130-
"""Manage database interactions for :class:`Flavor`."""
127+
"""Manage database interactions for :class:`Flavor`\s."""
131128

132129
def seed(self, user, **kwargs):
133130
"""Seed the database with default Flavors for each cloud region."""
@@ -164,7 +161,6 @@ def __str__(self):
164161

165162
@python_2_unicode_compatible
166163
class Formation(UuidAuditedModel):
167-
168164
"""
169165
Formation of nodes used to host applications
170166
"""
@@ -250,7 +246,6 @@ def calculate(self):
250246

251247
@python_2_unicode_compatible
252248
class Layer(UuidAuditedModel):
253-
254249
"""
255250
Layer of nodes used by the formation
256251
@@ -763,7 +758,7 @@ class Release(UuidAuditedModel):
763758
"""
764759
Software release deployed by the application platform
765760
766-
Releases contain a Build and a Config.
761+
Releases contain a :class:`Build` and a :class:`Config`.
767762
"""
768763

769764
owner = models.ForeignKey(settings.AUTH_USER_MODEL)
@@ -844,10 +839,10 @@ def _user_purge(self):
844839
User.publish = _user_publish
845840
User.purge = _user_purge
846841

842+
847843
# define update/delete callbacks for synchronizing
848844
# models with the configuration management backend
849845

850-
851846
def _publish_to_cm(**kwargs):
852847
kwargs['instance'].publish()
853848

api/serializers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""
22
Classes to serialize the RESTful representation of Deis API models.
33
"""
4-
# pylint: disable=R0903,W0232
54

65
from __future__ import unicode_literals
76

client/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
KWARGS = {'scripts': ['deis']}
3131

3232

33-
# pylint: disable=W0142
3433
setup(name='deis',
3534
version='0.4.0',
3635
license=APACHE_LICENSE,

deis/urls.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
admin.autodiscover()
1515

1616

17-
# pylint: disable=C0103
1817
urlpatterns = patterns(
1918
'',
2019
url(r'^accounts/', include('allauth.urls')),

deis/wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# file. This includes Django's development server, if the WSGI_APPLICATION
2828
# setting points here.
2929
from django.core.wsgi import get_wsgi_application
30-
application = get_wsgi_application() # pylint: disable=C0103
30+
application = get_wsgi_application()
3131

3232
# Apply WSGI middleware here.
3333
# from helloworld.wsgi import HelloWorldApplication

docs/faq.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
:title: FAQ
22
:description: Frequently asked questions about the Deis project. Deis FAQ.
3-
:keywords: deis, PaaS, cloud, faq
3+
:keywords: deis, PaaS, cloud, faq, custom buildpack
44

55
.. _faq:
66

@@ -16,3 +16,13 @@ FAQ
1616
DAY-iss
1717

1818
.. _dais: https://en.wiktionary.org/wiki/dais
19+
20+
- How can I use custom buildpacks with Deis?
21+
22+
1. Clone the `deis-cookbook`_ repository.
23+
2. Change the *buildpacks* definition in *recipes/build.rb*.
24+
3. Upload the changed cookbook to the Chef server
25+
with ``berks upload --force``.
26+
4. SSH into your Deis controller and run ``sudo chef-client``.
27+
28+
.. _`deis-cookbook`: https://github.com/opdemand/deis-cookbook.git

web/static/css/deis-docs.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,15 @@ h6:hover > a.headerlink,
1414
dt:hover > a.headerlink {
1515
visibility: visible;
1616
}
17+
18+
span.viewcode-link {
19+
font-size: 10px;
20+
margin-left: 6px;
21+
vertical-align: super;
22+
}
23+
24+
a.viewcode-back {
25+
font-size: 10px;
26+
margin-right: 6px;
27+
vertical-align: super;
28+
}

0 commit comments

Comments
 (0)