Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Black #458

Merged
merged 7 commits into from
Jun 29, 2023
Merged

Black #458

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/actinia_core/cli/actinia_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@


def main():

parser = argparse.ArgumentParser(
description="Start actinia server. A running redis server"
+ " is required."
Expand Down
6 changes: 0 additions & 6 deletions src/actinia_core/cli/actinia_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ def main():

# CREATE ############################
if args.action == "create":

if args.user_id is None:
sys.stderr.write("You need to provide a user id\n")
return
Expand Down Expand Up @@ -333,7 +332,6 @@ def main():
or args.action == "update_rm"
or args.action == "update_rm_location"
):

if args.user_id is None:
sys.stderr.write("You need to provide a user id\n")
return
Expand Down Expand Up @@ -362,7 +360,6 @@ def main():

# DELETE ############################
elif args.action == "delete":

user = ActiniaUser(args.user_id)

if user.exists() == 1:
Expand All @@ -377,7 +374,6 @@ def main():

# SHOW ##############################
elif args.action == "show":

user = ActiniaUser(args.user_id)

if user.exists() == 1:
Expand All @@ -387,13 +383,11 @@ def main():

# LIST ##############################
elif args.action == "list":

user = ActiniaUser(args.user_id)
pprint.pprint(user.list_all_users())

# PWCHECK ###########################
elif args.action == "pwcheck":

if args.user_id is None:
sys.stderr.write("You need to provide a user id\n")
return
Expand Down
1 change: 0 additions & 1 deletion src/actinia_core/cli/rq_custom_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def main():
password=conf.REDIS_QUEUE_SERVER_PASSWORD,
)
):

logger = logging.getLogger("rq.worker")
logger.setLevel(logging.ERROR)

Expand Down
2 changes: 0 additions & 2 deletions src/actinia_core/cli/webhook_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

@flask_app.route("/webhook/finished", methods=["GET", "POST"])
def finished():

try:
pprint(json.loads(request.get_json()))
except BadRequest:
Expand Down Expand Up @@ -88,7 +87,6 @@ def shutdown():


def main():

parser = argparse.ArgumentParser(
description="Start a REST webhook server that exposes a GET/POST "
"endpoint which returns HTTP code 200 if called. The endpoints are: "
Expand Down
1 change: 0 additions & 1 deletion src/actinia_core/cli/webhook_server_broken.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def shutdown():


def main():

parser = argparse.ArgumentParser(
description="Start a webhook server that exposes GET/POST endpoints "
"which returns HTTP code 200 if called. The endpoints are: "
Expand Down
1 change: 0 additions & 1 deletion src/actinia_core/core/common/aws_sentinel_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ def get_sentinel_urls(self, product_ids, bands=None):
bands = ["B04", "B08"]

try:

for band in bands:
if band not in self.sentinel_bands:
raise Exception("Unknown Sentinel-2 band name <%s>" % band)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ def _query_satellite_archive(
]
"""
try:

self._start_clients()
scene_id_query = None
spacecraft_id_query = None
Expand Down Expand Up @@ -572,7 +571,6 @@ def get_landsat_urls(self, scene_ids, bands=None):
bands = ["B1", "B2"]

try:

self._start_clients()

for scene_id in scene_ids:
Expand All @@ -595,7 +593,6 @@ def get_landsat_urls(self, scene_ids, bands=None):

if query_results.result():
for row in query_results.result():

scene_id, sensing_time, base_url = row
public_url = self.gcs_url + base_url[5:]
sensor_id = extract_sensor_id_from_scene_id(scene_id)
Expand Down Expand Up @@ -772,7 +769,6 @@ def get_sentinel_urls(self, product_ids, bands=None):
bands = ["B04", "B08"]

try:

self._start_clients()

for band in bands:
Expand All @@ -793,7 +789,6 @@ def get_sentinel_urls(self, product_ids, bands=None):

if rows:
for row in rows:

(
granule_id,
product_id,
Expand Down
4 changes: 0 additions & 4 deletions src/actinia_core/core/common/landsat_processing_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ def datetime_to_grass_datetime_string(dt):

# Check for time zone info in the datetime object
if dt.tzinfo is not None:

tz = dt.tzinfo.utcoffset(0)
if tz.seconds > 86400 / 2:
tz = (tz.seconds - 86400) / 60
Expand Down Expand Up @@ -319,7 +318,6 @@ def _setup(self):
count += 1

def get_import_process_list(self):

count = 0
import_commands = []

Expand All @@ -342,7 +340,6 @@ def get_import_process_list(self):
return import_commands

def get_i_landsat_toar_process_list(self, atcor_method):

option = "uncorrected"

if atcor_method == "DOS4":
Expand Down Expand Up @@ -374,7 +371,6 @@ def get_i_landsat_toar_process_list(self, atcor_method):
return toar_commands

def get_i_vi_process_list(self, atcor_method, processing_method):

self.ndvi_name = "%s_%s_%s" % (
self.scene_id,
atcor_method,
Expand Down
9 changes: 0 additions & 9 deletions src/actinia_core/core/common/process_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ def __init__(
self.webhook_auth = None

def process_chain_to_process_list(self, process_chain):

if not process_chain:
raise AsyncProcessError("Process chain is empty")

Expand Down Expand Up @@ -188,7 +187,6 @@ def _process_chain_to_process_list(self, process_chain):

# Check for the webhooks
if "webhooks" in process_chain:

if "finished" in process_chain["webhooks"]:
self.webhook_finished = process_chain["webhooks"]["finished"]
self._check_if_webhook_exists(
Expand All @@ -206,7 +204,6 @@ def _process_chain_to_process_list(self, process_chain):
)

for process_descr in process_chain["list"]:

if "module" in process_descr:
module = self._create_module_process(process_descr)
if module:
Expand Down Expand Up @@ -768,7 +765,6 @@ def _create_exec_process(self, module_descr):

if "params" in module_descr:
for search_string in module_descr["params"]:

# Search for file identifiers and generate the temporary file
# path
if "$file" in search_string and "::" in search_string:
Expand Down Expand Up @@ -833,7 +829,6 @@ def _create_download_process_list(self):
or entry["import_descr"]["type"].lower() == "vector"
or entry["import_descr"]["type"].lower() == "file"
):

rvf_downimport_commands = (
self._get_raster_vector_file_download_import_command(entry)
)
Expand Down Expand Up @@ -930,7 +925,6 @@ def _create_module_process_legacy(self, id, module_descr):

if "inputs" in module_descr:
for key in module_descr["inputs"]:

search_string = str(module_descr["inputs"][key])

# Search for file identifiers and generate the temporary file
Expand All @@ -949,7 +943,6 @@ def _create_module_process_legacy(self, id, module_descr):
# Check for mapset in input name and append it
# to the list of required mapsets
if "@" in str(module_descr["inputs"][key]):

# Mapset names are after an @ symbol
# Mapsets in expressions can be detected by replacing
# the symbols like *, +, :, /, {, (,},], ... by spaces
Expand Down Expand Up @@ -997,7 +990,6 @@ def _create_module_process_legacy(self, id, module_descr):
if "outputs" in module_descr:
for key in module_descr["outputs"]:
if "name" in module_descr["outputs"][key]:

search_string = module_descr["outputs"][key]["name"]

# Search for file identifiers and generate the temporary
Expand Down Expand Up @@ -1129,7 +1121,6 @@ def _create_exec_process_legacy(self, id, module_descr):
executable = module_descr["executable"]
if "parameters" in module_descr:
for search_string in module_descr["parameters"]:

# Search for file identifiers and generate the temporary file
# path
if "$file" in search_string and "::" in search_string:
Expand Down
2 changes: 0 additions & 2 deletions src/actinia_core/core/common/process_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ class EnqueuedProcess(object):
"""

def __init__(self, func, timeout, resource_logger, args):

self.process = Process(target=func, args=args)
self.timeout = timeout
self.config = args[0].config
Expand Down Expand Up @@ -242,7 +241,6 @@ def check_exit(self):

"""
if self.process.exitcode is not None and self.process.exitcode != 0:

# Check if the process noticed the error already
response_data = self.resource_logger.get(
self.user_id, self.resource_id, self.iteration
Expand Down
2 changes: 1 addition & 1 deletion src/actinia_core/core/common/redis_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def __enqueue_job_redis(queue, timeout, func, *args):
*args,
job_timeout=timeout,
ttl=global_config.REDIS_QUEUE_JOB_TTL,
result_ttl=global_config.REDIS_QUEUE_JOB_TTL
result_ttl=global_config.REDIS_QUEUE_JOB_TTL,
)
log.info(ret)

Expand Down
3 changes: 0 additions & 3 deletions src/actinia_core/core/common/sentinel_processing_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def datetime_to_grass_datetime_string(dt):

# Check for time zone info in the datetime object
if dt.tzinfo is not None:

tz = dt.tzinfo.utcoffset(0)
if tz.seconds > 86400 / 2:
tz = (tz.seconds - 86400) / 60
Expand Down Expand Up @@ -260,7 +259,6 @@ def _setup_download_import_google(self):

# Create file names, urls and check the download cache
for band in self.bands:

file_name = self.query_result[self.product_id][band]["file"]
tile_name = self.query_result[self.product_id][band]["tile"]
public_url = self.query_result[self.product_id][band]["public_url"]
Expand Down Expand Up @@ -380,7 +378,6 @@ def _setup_download_import_aws(self):

# Create file names, urls and check the download cache
for band in self.bands:

file_name = self.query_result[self.product_id][band]["file"]
tile_name = self.query_result[self.product_id][band]["tile"]
public_url = self.query_result[self.product_id][band]["public_url"]
Expand Down
1 change: 0 additions & 1 deletion src/actinia_core/core/common/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class ActiniaUser(ActiniaUserBase):
db = redis_user_interface

def read_from_db(self):

creds = self.db.get_credentials(self.user_id)
self.user_role = self.get_role()
self.user_group = self.get_group()
Expand Down
1 change: 0 additions & 1 deletion src/actinia_core/core/geodata_download_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ def get_download_process_list(self):

# Download file only if it does not exist in the download cache
if os.path.isfile(dest) is False:

p = get_wget_process(source, url)
download_commands.append(p)
if source != dest:
Expand Down
2 changes: 0 additions & 2 deletions src/actinia_core/core/grass_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class GrassEnvironment(ProcessLogging):
"""This class saves and sets grass environment variables"""

def __init__(self):

ProcessLogging.__init__(self)
self.env = {
"GISBASE": "",
Expand Down Expand Up @@ -301,7 +300,6 @@ def getFileName(self):

class GrassModuleRunner(ProcessLogging):
def __init__(self, grassbase, grass_addon_path):

ProcessLogging.__init__(self)

self.grassbase = grassbase
Expand Down
4 changes: 0 additions & 4 deletions src/actinia_core/core/list_grass_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class GrassModuleReader(object):
"""

def __init__(self, filename):

self.modules_keyword_dict = {}

file = QFile(filename)
Expand All @@ -74,13 +73,11 @@ def get(self):
return self.modules_keyword_dict

def parse_module(self):

module = None
keywords = None
description = None

while self.xml.readNextStartElement():

if self.xml.name() == "module":
module = self.xml.readElementText()
elif self.xml.name() == "description":
Expand Down Expand Up @@ -126,7 +123,6 @@ def test():


def main():

grass_modules_xml_path = global_config.GRASS_MODULES_XML_PATH
module_reader = GrassModuleReader(grass_modules_xml_path)

Expand Down
1 change: 0 additions & 1 deletion src/actinia_core/core/messages_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def __init__(self, config=None, user_id=None, fluent_sender=None):
)

def _log_message(self, log_level, message):

node = platform.node()
ctime = time.ctime()

Expand Down
4 changes: 2 additions & 2 deletions src/actinia_core/core/redis_api_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def __init__(self):
"""

def add(self, user_id, log_entry):
"""Add a API log entry to a user specific API log list in the Redis server
"""Add a API log entry to a user specific API log list in the Redis
server

Args:
user_id (str): The user id of the API log
Expand Down Expand Up @@ -154,7 +155,6 @@ def delete(self, user_id):


def test_api_logging(r):

user_id = "abcdefg"

# Remove the loglist
Expand Down
Loading