File helpers.py
has 354 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import unicode_literals
import re
import logging
import functools
Function seperate_provider_object_uris
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def seperate_provider_object_uris(identifiers):
object_uris = gather_object_uris(identifiers)
provider_uris = []
for item in identifiers:
- 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 format_tags
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def format_tags(all_tags, sep=','):
tags = []
if isinstance(all_tags, six.string_types):
tags = all_tags.split(sep)
elif isinstance(all_tags, list):
- 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 oai_get_records_and_token
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def oai_get_records_and_token(url, throttle, force, namespaces, verify):
Function oai_extract_dois
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def oai_extract_dois(*args):
identifiers = gather_identifiers(args)
dois = []
for item in identifiers:
if 'doi' in item.lower():
- 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 gather_identifiers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def gather_identifiers(args):
identifiers = []
for arg in args:
if isinstance(arg, list):
for identifier in arg:
- 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 oai_process_uris
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def oai_process_uris(*args, **kwargs):
use_doi = kwargs.get('use_doi', False)
identifiers = gather_identifiers(args)
provider_uris, object_uris = seperate_provider_object_uris(identifiers)
- 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 gather_object_uris
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def gather_object_uris(identifiers):
'''
Gathers object URIs if there are any
>>> gathered = gather_object_uris(['nopenope', 'doi:10.10.gettables', 'http://dx.doi.org/yep'])
>>> print(gathered[0])
- 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 updated_schema
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def updated_schema(old, new):
''' Creates a dictionary resulting from adding all keys/values of the second to the first
The second dictionary will overwrite the first.
>>> old, new = {'name': 'ric', 'job': None}, {'name': 'Rick'}
- 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"