summaryrefslogtreecommitdiff
path: root/opendc/util
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-26 22:50:27 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-26 22:50:27 +0200
commit4c6d68dd2e460095e20ba32007a35da4c5e6dae6 (patch)
tree13eeab79298913ee177e428519bc18fed5356efa /opendc/util
parent44f0bd378763f4c481fb8a87847ca84469b35a67 (diff)
Fix more PEP-8 violations
Diffstat (limited to 'opendc/util')
-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
4 files changed, 8 insertions, 8 deletions
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):