Merge "Fix [H405] pep rule in heat/db"

This commit is contained in:
Jenkins 2015-09-22 10:11:50 +00:00 committed by Gerrit Code Review
commit 498c66b8dd
4 changed files with 29 additions and 28 deletions

View File

@ -11,8 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
'''
Interface for database access.
"""Interface for database access.
Usage:
@ -22,7 +21,7 @@ Usage:
The underlying driver is loaded . SQLAlchemy is currently the only
supported backend.
'''
"""
from oslo_config import cfg
from oslo_db import api

View File

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
'''Implementation of SQLAlchemy backend.'''
"""Implementation of SQLAlchemy backend."""
import datetime
import sys
@ -178,9 +178,9 @@ def resource_update(context, resource_id, values, atomic_key,
def resource_data_get_all(resource, data=None):
"""
Looks up resource_data by resource.id. If data is encrypted,
this method will decrypt the results.
"""Looks up resource_data by resource.id.
If data is encrypted, this method will decrypt the results.
"""
if data is None:
data = (model_query(resource.context, models.ResourceData)
@ -200,8 +200,9 @@ def resource_data_get_all(resource, data=None):
def resource_data_get(resource, key):
"""Lookup value of resource's data by key. Decrypts resource data if
necessary.
"""Lookup value of resource's data by key.
Decrypts resource data if necessary.
"""
result = resource_data_get_by_key(resource.context,
resource.id,
@ -242,8 +243,9 @@ def stack_tags_get(context, stack_id):
def resource_data_get_by_key(context, resource_id, key):
"""Looks up resource_data by resource_id and key. Does not unencrypt
resource_data.
"""Looks up resource_data by resource_id and key.
Does not decrypt resource_data.
"""
result = (model_query(context, models.ResourceData)
.filter_by(resource_id=resource_id)
@ -361,12 +363,12 @@ def stack_get_all_by_owner_id(context, owner_id):
def _get_sort_keys(sort_keys, mapping):
'''Returns an array containing only whitelisted keys
"""Returns an array containing only whitelisted keys
:param sort_keys: an array of strings
:param mapping: a mapping from keys to DB column names
:returns: filtered list of sort keys
'''
"""
if isinstance(sort_keys, six.string_types):
sort_keys = [sort_keys]
return [mapping[key] for key in sort_keys or [] if key in mapping]

View File

@ -10,9 +10,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
SQLAlchemy models for heat data.
"""
"""SQLAlchemy models for heat data."""
import uuid
@ -119,6 +118,7 @@ class StackTag(BASE, HeatBase):
class SyncPoint(BASE, HeatBase):
"""Represents an syncpoint for an stack that is being worked on."""
__tablename__ = 'sync_point'
__table_args__ = (
sqlalchemy.PrimaryKeyConstraint('entity_id',
@ -198,9 +198,9 @@ class StackLock(BASE, HeatBase):
class UserCreds(BASE, HeatBase):
"""
Represents user credentials and mirrors the 'context'
handed in by wsgi.
"""Represents user credentials.
Also, mirrors the 'context' handed in by wsgi.
"""
__tablename__ = 'user_creds'
@ -348,9 +348,10 @@ class WatchData(BASE, HeatBase):
class SoftwareConfig(BASE, HeatBase):
"""
Represents a software configuration resource to be applied to
one or more servers.
"""Represents a software configuration resource.
Represents a software configuration resource to be applied to one or more
servers.
"""
__tablename__ = 'software_config'
@ -365,9 +366,10 @@ class SoftwareConfig(BASE, HeatBase):
class SoftwareDeployment(BASE, HeatBase, StateAware):
"""
Represents applying a software configuration resource to a
single server resource.
"""Represents a software deployment resource.
Represents applying a software configuration resource to a single server
resource.
"""
__tablename__ = 'software_deployment'

View File

@ -18,9 +18,7 @@ import sqlalchemy
def clone_table(name, parent, meta, newcols=[], ignorecols=[], swapcols={},
ignorecons=[]):
"""
helper function that clones parent table schema onto
new table.
"""Helper function that clones parent table schema onto new table.
:param name: new table name
:param parent: parent table to copy schema from