summaryrefslogtreecommitdiff
path: root/opendc
diff options
context:
space:
mode:
Diffstat (limited to 'opendc')
-rw-r--r--opendc/api/v1/datacenters/datacenterId/rooms/endpoint.py4
-rw-r--r--opendc/models/datacenter.py2
-rw-r--r--opendc/models/model.py4
-rw-r--r--opendc/util/database.py4
-rw-r--r--opendc/util/parameter_checker.py2
-rw-r--r--opendc/util/path_parser.py2
-rw-r--r--opendc/util/rest.py8
7 files changed, 13 insertions, 13 deletions
diff --git a/opendc/api/v1/datacenters/datacenterId/rooms/endpoint.py b/opendc/api/v1/datacenters/datacenterId/rooms/endpoint.py
index cd96f97f..e0155c7c 100644
--- a/opendc/api/v1/datacenters/datacenterId/rooms/endpoint.py
+++ b/opendc/api/v1/datacenters/datacenterId/rooms/endpoint.py
@@ -85,7 +85,7 @@ def POST(request):
# Add a name if not provided
- if not 'name' in request.params_body['room']:
+ if 'name' not in request.params_body['room']:
room_count = len(Room.query('datacenter_id', datacenter.id))
request.params_body['room']['name'] = 'Room {}'.format(room_count)
@@ -97,7 +97,7 @@ def POST(request):
try:
room.insert()
- except Exception as e:
+ except:
return Response(400, 'Invalid `roomType` or existing `name`.')
# Return this Room
diff --git a/opendc/models/datacenter.py b/opendc/models/datacenter.py
index aeb9b3ad..29f8367c 100644
--- a/opendc/models/datacenter.py
+++ b/opendc/models/datacenter.py
@@ -25,7 +25,7 @@ class Datacenter(Model):
try:
section = Section.query('datacenter_id', self.id)[0]
- except Exception as e:
+ except:
return False
# Check the Section's Authorization
diff --git a/opendc/models/model.py b/opendc/models/model.py
index 30da9c67..44e4faf8 100644
--- a/opendc/models/model.py
+++ b/opendc/models/model.py
@@ -121,7 +121,7 @@ class Model(object):
"""Generate a SQLite updatable columns string for this Model."""
return ', '.join(
- ['{} = %s'.format(x) for x in cls.COLUMNS if not x in cls.COLUMNS_PRIMARY_KEY]
+ ['{} = %s'.format(x) for x in cls.COLUMNS if x not in cls.COLUMNS_PRIMARY_KEY]
)
# SQL TUPLE GENERATION METHODS
@@ -151,7 +151,7 @@ class Model(object):
value_list = []
- for column in [x for x in self.COLUMNS if not x in self.COLUMNS_PRIMARY_KEY]:
+ for column in [x for x in self.COLUMNS if x not in self.COLUMNS_PRIMARY_KEY]:
value_list.append(getattr(self, column, None))
return tuple(value_list)
diff --git a/opendc/util/database.py b/opendc/util/database.py
index e4c257d5..ebb62bde 100644
--- a/opendc/util/database.py
+++ b/opendc/util/database.py
@@ -5,8 +5,8 @@ from datetime import datetime
from mysql.connector.pooling import MySQLConnectionPool
# Get keys from config file
-with open(sys.argv[1]) as file:
- KEYS = json.load(file)
+with open(sys.argv[1]) as f:
+ KEYS = json.load(f)
DATETIME_STRING_FORMAT = '%Y-%m-%dT%H:%M:%S'
CONNECTION_POOL = None
diff --git a/opendc/util/parameter_checker.py b/opendc/util/parameter_checker.py
index 5188e56a..c60d26d3 100644
--- a/opendc/util/parameter_checker.py
+++ b/opendc/util/parameter_checker.py
@@ -6,7 +6,7 @@ def _missing_parameter(params_required, params_actual, parent=''):
for param_name in params_required:
- if not param_name in params_actual:
+ if param_name not in params_actual:
return '{}.{}'.format(parent, param_name)
param_required = params_required.get(param_name)
diff --git a/opendc/util/path_parser.py b/opendc/util/path_parser.py
index 7948ee1b..a8bbdeba 100644
--- a/opendc/util/path_parser.py
+++ b/opendc/util/path_parser.py
@@ -36,4 +36,4 @@ def parse(version, endpoint_path):
except:
parameters[name.strip('{}')] = value
- return ('{}/{}'.format(version, '/'.join(path)), parameters)
+ return '{}/{}'.format(version, '/'.join(path)), parameters
diff --git a/opendc/util/rest.py b/opendc/util/rest.py
index 7cf2d0b3..85da4eaa 100644
--- a/opendc/util/rest.py
+++ b/opendc/util/rest.py
@@ -6,8 +6,8 @@ from oauth2client import client, crypt
from opendc.util import exceptions, parameter_checker
-with open(sys.argv[1]) as file:
- KEYS = json.load(file)
+with open(sys.argv[1]) as f:
+ KEYS = json.load(f)
class Request(object):
@@ -48,7 +48,7 @@ class Request(object):
self.module = importlib.import_module(module_base.format(module_path))
- except UnicodeError as e:
+ except UnicodeError:
raise exceptions.UnimplementedEndpointError('Non-ASCII path')
except ImportError:
@@ -58,7 +58,7 @@ class Request(object):
# Check the method
- if not self.method in ['POST', 'GET', 'PUT', 'PATCH', 'DELETE']:
+ if self.method not in ['POST', 'GET', 'PUT', 'PATCH', 'DELETE']:
raise exceptions.UnsupportedMethodError('Non-rest method: {}'.format(self.method))
if not hasattr(self.module, self.method):