File provider.py
has 1656 lines of code (exceeds 250 allowed). Consider refactoring. Open
import copy
import datetime
import logging
import os
from collections import defaultdict
S3Provider
has 67 functions (exceeds 20 allowed). Consider refactoring. Open
class S3Provider(S3Api, ServiceLifecycleHook):
@staticmethod
def get_store(account_id: Optional[str] = None, region: Optional[str] = None) -> S3Store:
return s3_stores[account_id or DEFAULT_AWS_ACCOUNT_ID][region or AWS_REGION_US_EAST_1]
Function apply_moto_patches
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def apply_moto_patches():
# importing here in case we need InvalidObjectState from `localstack.aws.api.s3`
import moto.s3.models as moto_s3_models
import moto.s3.responses as moto_s3_responses
from moto.iam.access_control import PermissionResult
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function put_object
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def put_object(
self,
context: RequestContext,
request: PutObjectRequest,
) -> PutObjectOutput:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_object
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def get_object(self, context: RequestContext, request: GetObjectRequest) -> GetObjectOutput:
key = request["Key"]
bucket = request["Bucket"]
version_id = request.get("VersionId")
moto_backend = get_moto_s3_backend(context)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function put_bucket_acl
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def put_bucket_acl(
self,
context: RequestContext,
request: PutBucketAclRequest,
) -> None:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function copy_object
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def copy_object(
self,
context: RequestContext,
request: CopyObjectRequest,
) -> CopyObjectOutput:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function select_object_content
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
def select_object_content(
Function upload_part
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def upload_part(self, context: RequestContext, request: UploadPartRequest) -> UploadPartOutput:
bucket_name = request["Bucket"]
moto_backend = get_moto_s3_backend(context)
moto_bucket = get_bucket_from_moto(moto_backend, bucket=bucket_name)
upload_id = request.get("UploadId")
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function head_object
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def head_object(
self,
context: RequestContext,
request: HeadObjectRequest,
) -> HeadObjectOutput:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function put_object_retention
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_object_retention(
Function delete_objects
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def delete_objects(
Function post_object
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def post_object(
self, context: RequestContext, bucket: BucketName, body: IO[Body] = None, **kwargs
) -> PostResponse:
# see https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html
# TODO: signature validation is not implemented for pre-signed POST
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function put_bucket_replication
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def put_bucket_replication(
self,
context: RequestContext,
bucket: BucketName,
replication_configuration: ReplicationConfiguration,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function put_bucket_replication
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_bucket_replication(
Function put_bucket_cors
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_bucket_cors(
Function put_bucket_website
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_bucket_website(
Function get_object_acl
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_object_acl(
Function put_bucket_logging
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_bucket_logging(
Function get_object_retention
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_object_retention(
Function _fix_key_response_post
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _fix_key_response_post(fn, self, request, body, bucket_name, *args, **kwargs):
Function put_bucket_inventory_configuration
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_bucket_inventory_configuration(
Function put_bucket_analytics_configuration
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_bucket_analytics_configuration(
Function delete_objects
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def delete_objects(
self,
context: RequestContext,
bucket: BucketName,
delete: Delete,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function list_objects
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list_objects(
self,
context: RequestContext,
request: ListObjectsRequest,
) -> ListObjectsOutput:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function put_bucket_notification_configuration
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_bucket_notification_configuration(
Consider simplifying this complex logical expression. Open
if not (canned_acl or present_headers or is_acp_in_body):
raise MissingSecurityHeader(
"Your request was missing a required header", MissingHeaderName="x-amz-acl"
)
Function list_bucket_analytics_configurations
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_bucket_analytics_configurations(
Function list_bucket_inventory_configurations
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_bucket_inventory_configurations(
Function delete_bucket_inventory_configuration
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def delete_bucket_inventory_configuration(
Function put_bucket_intelligent_tiering_configuration
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_bucket_intelligent_tiering_configuration(
Function _fix_bucket_response_head
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _fix_bucket_response_head(fn, self, bucket_name, *args, **kwargs):
Function delete_bucket_analytics_configuration
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def delete_bucket_analytics_configuration(
Function get_bucket_inventory_configuration
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_bucket_inventory_configuration(
Function get_bucket_analytics_configuration
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_bucket_analytics_configuration(
Function get_object_attributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_object_attributes(
self,
context: RequestContext,
request: GetObjectAttributesRequest,
) -> GetObjectAttributesOutput:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function put_bucket_logging
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def put_bucket_logging(
self,
context: RequestContext,
bucket: BucketName,
bucket_logging_status: BucketLoggingStatus,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function create_bucket
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_bucket(
self,
context: RequestContext,
request: CreateBucketRequest,
) -> CreateBucketOutput:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"