File geodescriber.py
has 1586 lines of code (exceeds 250 allowed). Consider refactoring. Open
import asyncio
import logging
import ee
from googletrans import Translator
Function analyze
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def analyze(geojson, area_ha=None, lang='en', app='gfw', template=False):
"""Recieve a geostore_id, language, and app argument and return a
json serialised dic object response.
"""
logging.info(f'[Geodescriber]: app={app}, lang={lang}, template={template}, for geojson={geojson}')
- 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_title
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def create_title(title_elements, land_sea):
tmp_config = {'items': {}, 'sentence': ""}
truth_dict = {
'country': 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 gen_area_sentence
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def gen_area_sentence(area_ha, app, mountain_sentence, title_elements, stats):
tmp_config = {'items': {}, 'sentence': ""}
if title_elements:
try:
title_ele = ' in ' + title_elements[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 gen_land_sea_sentence
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def gen_land_sea_sentence(stats):
tmp_config = {'items': {}, 'sentence': ""}
land = stats.get('seaLandFreshwater').get('0', 0)
sea = stats.get('seaLandFreshwater').get('1', 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 gen_intact_sentence
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def gen_intact_sentence(stats):
not_intact = stats.get('intact2016').get('0', 0)
is_intact = stats.get('intact2016').get('1', 0)
total_intact = not_intact + is_intact
intact_sentence = ""
- 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_title_elements
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_title_elements(s):
"""Take reverse geocoding results for upper and lower corners of a polygons bounds,
Extract the region, county, country, continent attributes of the locations.
Use the overlap to set an appropriate title.
"""
- 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 gen_mountain_sentence
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def gen_mountain_sentence(stats):
is_mountain = stats.get('isMountain').get('1', 0)
not_mountain = stats.get('isMountain').get('0', 0)
total_mountain = not_mountain + is_mountain
mountain_sentence = 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"