File nexgddp_router.py
has 510 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""API ROUTER"""
import io
import logging
import os
Function query
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def query(dataset_id, bbox, dataset):
"""NEXGDDP QUERY ENDPOINT"""
logging.info('[ROUTER] Doing Query of dataset ' + dataset_id)
# Get and deserialize
table_name = dataset.get('tableName')
- 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_tile
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_tile(z, x, y, model, scenario, year, style, indicator, layer, compare_year=None, dset_b=None, no_data=None):
Function get_sql_select
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_sql_select(json_sql):
select_sql = json_sql.get('select')
logging.debug(f"select_sql: {select_sql}")
select_sql
select = 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 diff
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def diff(dset_a, date_a, date_b, lat, lon, varnames, dset_b=None):
Function get_tile
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_tile(z, x, y, model, scenario, year, style, indicator, layer, compare_year=None, dset_b=None, no_data=None):
logging.info(f'Getting tile for {z} {x} {y}')
logging.debug(compare_year)
bbox = TileService.get_bbox(x, y, z)
logging.debug(f"bbox: {bbox}")
- 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
Avoid too many return
statements within this function. Open
return error(status=400, detail=e.message)
Avoid too many return
statements within this function. Open
return error(status=400, detail=e.message)
Avoid too many return
statements within this function. Open
return error(status=400, detail='No coordinates provided. Include geostore or lat & lon')
Avoid too many return
statements within this function. Open
return error(status=400, detail=e.message)
Avoid too many return
statements within this function. Open
return error(status=400, detail=e.message)
Avoid too many return
statements within this function. Open
return jsonify(data=output), 200
Avoid too many return
statements within this function. Open
return error(status=404, detail='Table name not valid')
Avoid too many return
statements within this function. Open
return jsonify(data=query_results), 200
Avoid too many return
statements within this function. Open
return jsonify(data=[result]), 200
Avoid too many return
statements within this function. Open
return error(status=400, detail=e.message)