Fix remaining flake8 issues
Disabling W504 and W605 for now as there are too many instances.
This commit is contained in:
parent
18173a5951
commit
84fb52d0a2
@ -1,5 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
import logging
|
||||
# import logging
|
||||
# logging.getLogger('boto').setLevel(logging.CRITICAL)
|
||||
|
||||
__title__ = 'moto'
|
||||
|
@ -96,11 +96,11 @@ class CloudWatchResponse(BaseResponse):
|
||||
extended_statistics = self._get_param('ExtendedStatistics')
|
||||
dimensions = self._get_param('Dimensions')
|
||||
if unit or extended_statistics or dimensions:
|
||||
raise NotImplemented()
|
||||
raise NotImplementedError()
|
||||
|
||||
# TODO: this should instead throw InvalidParameterCombination
|
||||
if not statistics:
|
||||
raise NotImplemented("Must specify either Statistics or ExtendedStatistics")
|
||||
raise NotImplementedError("Must specify either Statistics or ExtendedStatistics")
|
||||
|
||||
datapoints = self.cloudwatch_backend.get_metric_statistics(namespace, metric_name, start_time, end_time, period, statistics)
|
||||
template = self.response_template(GET_METRIC_STATISTICS_TEMPLATE)
|
||||
|
@ -1,7 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
import re
|
||||
import six
|
||||
import re
|
||||
from collections import deque
|
||||
from collections import namedtuple
|
||||
|
||||
@ -48,11 +46,11 @@ def get_expected(expected):
|
||||
path = AttributePath([key])
|
||||
if 'Exists' in cond:
|
||||
if cond['Exists']:
|
||||
conditions.append(FuncAttrExists(path))
|
||||
conditions.append(FuncAttrExists(path))
|
||||
else:
|
||||
conditions.append(FuncAttrNotExists(path))
|
||||
conditions.append(FuncAttrNotExists(path))
|
||||
elif 'Value' in cond:
|
||||
conditions.append(OpEqual(path, AttributeValue(cond['Value'])))
|
||||
conditions.append(OpEqual(path, AttributeValue(cond['Value'])))
|
||||
elif 'ComparisonOperator' in cond:
|
||||
operator_name = cond['ComparisonOperator']
|
||||
values = [
|
||||
@ -221,7 +219,6 @@ class ConditionExpressionParser:
|
||||
# --------------
|
||||
LITERAL = 'LITERAL'
|
||||
|
||||
|
||||
class Nonterminal:
|
||||
"""Enum defining nonterminals for productions."""
|
||||
|
||||
@ -240,7 +237,6 @@ class ConditionExpressionParser:
|
||||
RIGHT_PAREN = 'RIGHT_PAREN'
|
||||
WHITESPACE = 'WHITESPACE'
|
||||
|
||||
|
||||
Node = namedtuple('Node', ['nonterminal', 'kind', 'text', 'value', 'children'])
|
||||
|
||||
def _lex_condition_expression(self):
|
||||
@ -286,11 +282,10 @@ class ConditionExpressionParser:
|
||||
if match:
|
||||
match_text = match.group()
|
||||
break
|
||||
else: # pragma: no cover
|
||||
else: # pragma: no cover
|
||||
raise ValueError("Cannot parse condition starting at: " +
|
||||
remaining_expression)
|
||||
remaining_expression)
|
||||
|
||||
value = match_text
|
||||
node = self.Node(
|
||||
nonterminal=nonterminal,
|
||||
kind=self.Kind.LITERAL,
|
||||
@ -351,7 +346,6 @@ class ConditionExpressionParser:
|
||||
'size',
|
||||
}
|
||||
|
||||
|
||||
if name.lower() in reserved:
|
||||
# e.g. AND
|
||||
nonterminal = reserved[name.lower()]
|
||||
@ -748,14 +742,13 @@ class ConditionExpressionParser:
|
||||
elif node.kind == self.Kind.FUNCTION:
|
||||
# size()
|
||||
function_node = node.children[0]
|
||||
arguments = node.children[1:]
|
||||
arguments = node.children[1:]
|
||||
function_name = function_node.value
|
||||
arguments = [self._make_operand(arg) for arg in arguments]
|
||||
return FUNC_CLASS[function_name](*arguments)
|
||||
else: # pragma: no cover
|
||||
else: # pragma: no cover
|
||||
raise ValueError("Unknown operand: %r" % node)
|
||||
|
||||
|
||||
def _make_op_condition(self, node):
|
||||
if node.kind == self.Kind.OR:
|
||||
lhs, rhs = node.children
|
||||
@ -796,7 +789,7 @@ class ConditionExpressionParser:
|
||||
return COMPARATOR_CLASS[comparator.value](
|
||||
self._make_operand(lhs),
|
||||
self._make_operand(rhs))
|
||||
else: # pragma: no cover
|
||||
else: # pragma: no cover
|
||||
raise ValueError("Unknown expression node kind %r" % node.kind)
|
||||
|
||||
def _assert(self, condition, message, nodes):
|
||||
|
@ -1229,7 +1229,7 @@ class AmiBackend(object):
|
||||
|
||||
images = [ami for ami in images if ami.id in ami_ids]
|
||||
if len(images) == 0:
|
||||
raise InvalidAMIIdError(ami_ids)
|
||||
raise InvalidAMIIdError(ami_ids)
|
||||
else:
|
||||
# Limit images by launch permissions
|
||||
if exec_users:
|
||||
@ -3720,8 +3720,8 @@ class VPNConnection(TaggedEC2Resource):
|
||||
self.static_routes = None
|
||||
|
||||
def get_filter_value(self, filter_name):
|
||||
return super(VPNConnection, self).get_filter_value(
|
||||
filter_name, 'DescribeVpnConnections')
|
||||
return super(VPNConnection, self).get_filter_value(
|
||||
filter_name, 'DescribeVpnConnections')
|
||||
|
||||
|
||||
class VPNConnectionBackend(object):
|
||||
@ -3950,8 +3950,8 @@ class VpnGateway(TaggedEC2Resource):
|
||||
super(VpnGateway, self).__init__()
|
||||
|
||||
def get_filter_value(self, filter_name):
|
||||
return super(VpnGateway, self).get_filter_value(
|
||||
filter_name, 'DescribeVpnGateways')
|
||||
return super(VpnGateway, self).get_filter_value(
|
||||
filter_name, 'DescribeVpnGateways')
|
||||
|
||||
|
||||
class VpnGatewayAttachment(object):
|
||||
@ -4015,8 +4015,8 @@ class CustomerGateway(TaggedEC2Resource):
|
||||
super(CustomerGateway, self).__init__()
|
||||
|
||||
def get_filter_value(self, filter_name):
|
||||
return super(CustomerGateway, self).get_filter_value(
|
||||
filter_name, 'DescribeCustomerGateways')
|
||||
return super(CustomerGateway, self).get_filter_value(
|
||||
filter_name, 'DescribeCustomerGateways')
|
||||
|
||||
|
||||
class CustomerGatewayBackend(object):
|
||||
|
@ -158,8 +158,8 @@ class TaskDefinition(BaseObject):
|
||||
if (original_resource.family != family or
|
||||
original_resource.container_definitions != container_definitions or
|
||||
original_resource.volumes != volumes):
|
||||
# currently TaskRoleArn isn't stored at TaskDefinition
|
||||
# instances
|
||||
# currently TaskRoleArn isn't stored at TaskDefinition
|
||||
# instances
|
||||
ecs_backend = ecs_backends[region_name]
|
||||
ecs_backend.deregister_task_definition(original_resource.arn)
|
||||
return ecs_backend.register_task_definition(
|
||||
|
@ -163,7 +163,7 @@ class IoTDataPlaneBackend(BaseBackend):
|
||||
raise InvalidRequestException('State contains an invalid node')
|
||||
|
||||
if 'version' in payload and thing.thing_shadow.version != payload['version']:
|
||||
raise ConflictException('Version conflict')
|
||||
raise ConflictException('Version conflict')
|
||||
new_shadow = FakeShadow.create_from_previous_version(thing.thing_shadow, payload)
|
||||
thing.thing_shadow = new_shadow
|
||||
return thing.thing_shadow
|
||||
|
@ -875,8 +875,8 @@ class RDS2Backend(BaseBackend):
|
||||
database = self.describe_databases(db_instance_identifier)[0]
|
||||
# todo: certain rds types not allowed to be stopped at this time.
|
||||
if database.is_replica or database.multi_az:
|
||||
# todo: more db types not supported by stop/start instance api
|
||||
raise InvalidDBClusterStateFaultError(db_instance_identifier)
|
||||
# todo: more db types not supported by stop/start instance api
|
||||
raise InvalidDBClusterStateFaultError(db_instance_identifier)
|
||||
if database.status != 'available':
|
||||
raise InvalidDBInstanceStateError(db_instance_identifier, 'stop')
|
||||
if db_snapshot_identifier:
|
||||
|
@ -244,7 +244,7 @@ class ResourceGroupsTaggingAPIBackend(BaseBackend):
|
||||
def get_kms_tags(kms_key_id):
|
||||
result = []
|
||||
for tag in self.kms_backend.list_resource_tags(kms_key_id):
|
||||
result.append({'Key': tag['TagKey'], 'Value': tag['TagValue']})
|
||||
result.append({'Key': tag['TagKey'], 'Value': tag['TagValue']})
|
||||
return result
|
||||
|
||||
if not resource_type_filters or 'kms' in resource_type_filters:
|
||||
|
@ -210,9 +210,9 @@ class Command(BaseModel):
|
||||
'An error occurred (InvocationDoesNotExist) when calling the GetCommandInvocation operation')
|
||||
|
||||
if plugin_name is not None and invocation['PluginName'] != plugin_name:
|
||||
raise RESTError(
|
||||
'InvocationDoesNotExist',
|
||||
'An error occurred (InvocationDoesNotExist) when calling the GetCommandInvocation operation')
|
||||
raise RESTError(
|
||||
'InvocationDoesNotExist',
|
||||
'An error occurred (InvocationDoesNotExist) when calling the GetCommandInvocation operation')
|
||||
|
||||
return invocation
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user