Merge "P4: Fix pep8 error in cyborg/api"

This commit is contained in:
Zuul 2019-09-04 07:58:00 +00:00 committed by Gerrit Code Review
commit 0f87dca124
5 changed files with 7 additions and 13 deletions

View File

@ -31,9 +31,8 @@ class APIBase(wtypes.Base):
def as_dict(self):
"""Render this object as a dict of its fields."""
return dict((k, getattr(self, k))
for k in self.fields
if hasattr(self, k) and getattr(self, k) != wsme.Unset)
return {k: getattr(self, k) for k in self.fields
if hasattr(self, k) and getattr(self, k) != wsme.Unset}
class CyborgController(rest.RestController):

View File

@ -14,7 +14,6 @@
# under the License.
from oslo_log import log
import pecan
from six.moves import http_client
import wsme
from wsme import types as wtypes
@ -23,11 +22,8 @@ from cyborg.api.controllers import base
from cyborg.api.controllers import link
from cyborg.api.controllers.v1 import deployables
from cyborg.api.controllers.v1 import types
from cyborg.api.controllers.v1 import utils as api_utils
from cyborg.api import expose
from cyborg.common import exception
from cyborg.common import policy
from cyborg import objects
LOG = log.getLogger(__name__)
@ -195,5 +191,4 @@ class AcceleratorsController(AcceleratorsControllerBase):
:param uuid: UUID of an accelerator.
"""
LOG.warning("v1 APIs for accelerator objects are deprecated.")
context = pecan.request.context
obj_acc = self._resource or self._get_resource(uuid)
pass

View File

@ -130,7 +130,7 @@ class DeployablesController(base.CyborgController):
obj_dep = objects.Deployable.get(pecan.request.context, uuid)
# Set attribute of the new bitstream/image information
obj_dep.add_attribute(pecan.request.context, 'image_uuid', image_uuid)
# TODO (Li Liu) Trigger the program api in Agnet.
# TODO(Li Liu) Trigger the program api in Agnet.
agent_api.program_fpga_with_bitstream(pecan.request.context,
uuid,
image_uuid)

View File

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import inspect
from oslo_serialization import jsonutils
from oslo_utils import strutils
from oslo_utils import uuidutils
import wsme
@ -90,7 +90,7 @@ class JsonType(wtypes.UserType):
@staticmethod
def validate(value):
try:
json.dumps(value)
jsonutils.dumps(value)
except TypeError:
raise exception.InvalidJsonType(value=value)
else:

View File

@ -107,7 +107,7 @@ show-source = True
ignore = E123,E125,H405
builtins = _
enable-extensions = H106,H203,H904
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,*sqlalchemy/alembic/versions/*,demo/,releasenotes,cyborg/accelerator/,cyborg/api,cyborg/agent/,cyborg/db,dyborg/hacking/,cyborg/tests/,cyborg/image,cyborg/objects
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,*sqlalchemy/alembic/versions/*,demo/,releasenotes,cyborg/accelerator/,cyborg/agent/,cyborg/db,dyborg/hacking/,cyborg/tests/,cyborg/image,cyborg/objects
[hacking]
local-check-factory = cyborg.hacking.checks.factory