Linting fixes

This commit is contained in:
p1c2u 2021-04-28 23:17:06 +01:00
parent bc4f0c7e40
commit c407e960ca
7 changed files with 8 additions and 11 deletions

View file

@ -16,7 +16,6 @@ class PrimitiveDeserializer(object):
self.style = get_style(self.param) self.style = get_style(self.param)
def __call__(self, value): def __call__(self, value):
style = get_style(self.param)
if (self.param['in'] == 'query' and value == "" and if (self.param['in'] == 'query' and value == "" and
not self.param.getkey('allowEmptyValue', False)): not self.param.getkey('allowEmptyValue', False)):
raise EmptyParameterValue( raise EmptyParameterValue(

View file

@ -19,6 +19,6 @@ def get_explode(param):
if 'explode' in param: if 'explode' in param:
return param['explode'] return param['explode']
#determine default # determine default
style = get_style(param) style = get_style(param)
return style == 'form' return style == 'form'

View file

@ -2,8 +2,6 @@
from __future__ import division from __future__ import division
import fnmatch import fnmatch
from six import iteritems
from openapi_core.templating.media_types.exceptions import MediaTypeNotFound from openapi_core.templating.media_types.exceptions import MediaTypeNotFound

View file

@ -2,7 +2,6 @@
from __future__ import division from __future__ import division
from more_itertools import peekable from more_itertools import peekable
from six import iteritems
from six.moves.urllib.parse import urljoin, urlparse from six.moves.urllib.parse import urljoin, urlparse
from openapi_core.schema.servers import is_absolute from openapi_core.schema.servers import is_absolute

View file

@ -213,7 +213,8 @@ class ObjectUnmarshaller(ComplexUnmarshaller):
extra_props = set(value_props_names) - set(all_props_names) extra_props = set(value_props_names) - set(all_props_names)
properties = {} properties = {}
additional_properties = self.schema.getkey('additionalProperties', True) additional_properties = self.schema.getkey(
'additionalProperties', True)
if isinstance(additional_properties, dict): if isinstance(additional_properties, dict):
additional_prop_schema = self.schema / 'additionalProperties' additional_prop_schema = self.schema / 'additionalProperties'
for prop_name in extra_props: for prop_name in extra_props:

View file

@ -1,7 +1,6 @@
"""OpenAPI core validation request validators module""" """OpenAPI core validation request validators module"""
from __future__ import division from __future__ import division
from itertools import chain from itertools import chain
from six import iteritems
from openapi_core.casting.schemas.exceptions import CastError from openapi_core.casting.schemas.exceptions import CastError
from openapi_core.deserializing.exceptions import DeserializeError from openapi_core.deserializing.exceptions import DeserializeError
@ -172,7 +171,7 @@ class RequestValidator(BaseValidator):
return RequestParameters(**locations), errors return RequestParameters(**locations), errors
def _get_body(self, request, operation): def _get_body(self, request, operation):
if not 'requestBody' in operation: if 'requestBody' not in operation:
return None, [] return None, []
request_body = operation / 'requestBody' request_body = operation / 'requestBody'

View file

@ -39,7 +39,7 @@ class BaseValidator(object):
def _cast(self, param_or_media_type, value): def _cast(self, param_or_media_type, value):
# return param_or_media_type.cast(value) # return param_or_media_type.cast(value)
if not 'schema' in param_or_media_type: if 'schema' not in param_or_media_type:
return value return value
from openapi_core.casting.schemas.factories import SchemaCastersFactory from openapi_core.casting.schemas.factories import SchemaCastersFactory
@ -49,13 +49,14 @@ class BaseValidator(object):
return caster(value) return caster(value)
def _unmarshal(self, param_or_media_type, value, context): def _unmarshal(self, param_or_media_type, value, context):
if not 'schema' in param_or_media_type: if 'schema' not in param_or_media_type:
return value return value
from openapi_core.unmarshalling.schemas.factories import ( from openapi_core.unmarshalling.schemas.factories import (
SchemaUnmarshallersFactory, SchemaUnmarshallersFactory,
) )
spec_resolver = self.spec.accessor.dereferencer.resolver_manager.resolver spec_resolver = self.spec.accessor.dereferencer.resolver_manager.\
resolver
unmarshallers_factory = SchemaUnmarshallersFactory( unmarshallers_factory = SchemaUnmarshallersFactory(
spec_resolver, self.format_checker, spec_resolver, self.format_checker,
self.custom_formatters, context=context, self.custom_formatters, context=context,