From fa86a04e8adbd9fcf19e573d309537a7881d0457 Mon Sep 17 00:00:00 2001
From: "i.nueske" <i.nueske@indiscale.com>
Date: Mon, 16 Dec 2024 17:17:54 +0100
Subject: [PATCH] MNT: Ignore errors in unused files soon to be deprecated

---
 src/caosadvancedtools/cfood.py             | 15 ++++++++----
 src/caosadvancedtools/crawler.py           | 27 +++++++++++++---------
 src/caosadvancedtools/structure_mapping.py |  5 ++++
 3 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/src/caosadvancedtools/cfood.py b/src/caosadvancedtools/cfood.py
index 4647a576..9424134e 100644
--- a/src/caosadvancedtools/cfood.py
+++ b/src/caosadvancedtools/cfood.py
@@ -52,6 +52,11 @@ from linkahead.exceptions import (BadQueryError, EmptyUniqueQueryError,
 from .datamodel_problems import DataModelProblems
 from .guard import global_guard as guard
 
+# The pylint warnings triggered in this file are ignored, as this code is
+# assumed to be deprecated in the near future. Should this change, they need
+# to be reevaluated.
+
+
 ENTITIES = {}
 PROPERTIES = {}
 RECORDS = {}
@@ -183,7 +188,7 @@ class AbstractCFood(object, metaclass=ABCMeta):
         """
 
     @classmethod
-    def match_item(cls, item):
+    def match_item(cls, item):                # pylint: disable=unused-argument
         """ Matches an item found by the crawler against this class. Returns
         True if the item shall be treated by this class, i.e. if this class
         matches the item.
@@ -215,7 +220,7 @@ class AbstractCFood(object, metaclass=ABCMeta):
     # TODO looking for should `attach` the files itsself. This would allow to
     # group them right away and makes it unnecessary to check matches later
     # again.
-    def looking_for(self, item):
+    def looking_for(self, item):              # pylint: disable=unused-argument
         """
         returns True if item can be added to this CFood.
 
@@ -351,7 +356,7 @@ class AbstractFileCFood(AbstractCFood):
         raise NotImplementedError()
 
     @classmethod
-    def match_item(cls, path):
+    def match_item(cls, path):              # pylint: disable=arguments-renamed
         """ Matches the regular expression of this class against file names
 
         Parameters
@@ -365,7 +370,7 @@ class AbstractFileCFood(AbstractCFood):
     # TODO looking for should `attach` the files itsself. This would allow to
     # group them right away and makes it unnecessary to check matches later
     # again.
-    def looking_for(self, crawled_file):
+    def looking_for(self, crawled_file):    # pylint: disable=arguments-renamed
         """
         returns True if crawled_file can be added to this CFood.
 
@@ -744,7 +749,7 @@ def assure_has_property(entity, name, value, to_be_updated=None,
 
 
 def assure_property_is(entity, name, value, datatype=None, to_be_updated=None,
-                       force=False):
+                       force=False):     # pylint: disable=unused-argument
     """
     Checks whether `entity` has a Property `name` with the given value.
 
diff --git a/src/caosadvancedtools/crawler.py b/src/caosadvancedtools/crawler.py
index ad2536c2..7b66440f 100644
--- a/src/caosadvancedtools/crawler.py
+++ b/src/caosadvancedtools/crawler.py
@@ -59,6 +59,11 @@ from .serverside.helper import send_mail as main_send_mail
 from .suppressKnown import SuppressKnown
 from .utils import create_entity_link
 
+# The pylint warnings triggered in this file are ignored, as this code is
+# assumed to be deprecated in the near future. Should this change, they need
+# to be reevaluated.
+
+
 logger = logging.getLogger(__name__)
 
 
@@ -133,7 +138,7 @@ def apply_list_of_updates(to_be_updated, update_flags=None,
             )
             logger.debug(traceback.format_exc())
             logger.debug(e)
-    except Exception as e:
+    except Exception as e:             # pylint: disable=broad-exception-caught
         DataModelProblems.evaluate_exception(e)
 
 
@@ -222,7 +227,7 @@ class Crawler(object):
             new_cont = db.Container.from_xml(new)
             ids = []
             tmp = db.Container()
-            update_incomplete = False
+            update_incomplete = False         # pylint: disable=unused-variable
             # remove duplicate entities
             for el in new_cont:
                 if el.id not in ids:
@@ -231,13 +236,13 @@ class Crawler(object):
                 else:
                     update_incomplete = True
             new_cont = tmp
-            if new_cont[0].version:
+            if new_cont[0].version:                 # pylint: disable=no-member
                 valids = db.Container()
                 nonvalids = db.Container()
 
                 for ent in new_cont:
                     remote_ent = db.Entity(id=ent.id).retrieve()
-                    if ent.version == remote_ent.version:
+                    if ent.version == remote_ent.version:       # pylint: disable=no-member
                         valids.append(ent)
                     else:
                         update_incomplete = True
@@ -319,10 +324,10 @@ class Crawler(object):
                         logger.debug(e)
                         # TODO: Generally: in which cases should exceptions be raised? When is
                         # errors_occured set to True? The expected behavior must be documented.
-                    except Exception as e:
+                    except Exception as e:      # pylint: disable=broad-exception-caught
                         try:
                             DataModelProblems.evaluate_exception(e)
-                        except Exception:
+                        except Exception:       # pylint: disable=broad-exception-caught
                             pass
                         logger.debug("Failed during execution of {}!".format(
                             Cfood.__name__))
@@ -351,10 +356,10 @@ class Crawler(object):
                 logger.info("Cannot access {}. However, it might be needed for"
                             " the correct execution".format(e.filename))
                 remove_cfoods.append(cfood)
-            except Exception as e:
+            except Exception as e:     # pylint: disable=broad-exception-caught
                 try:
                     DataModelProblems.evaluate_exception(e)
-                except Exception:
+                except Exception:      # pylint: disable=broad-exception-caught
                     pass
                 logger.debug("Failed during execution of {}!".format(
                     cfood.__name__))
@@ -444,10 +449,10 @@ class Crawler(object):
             except DataInconsistencyError as e:
                 logger.debug(traceback.format_exc())
                 logger.debug(e)
-            except Exception as e:
+            except Exception as e:     # pylint: disable=broad-exception-caught
                 try:
                     DataModelProblems.evaluate_exception(e)
-                except Exception:
+                except Exception:      # pylint: disable=broad-exception-caught
                     pass
                 logger.info("Failed during execution of {}!".format(
                     cfood.__class__.__name__))
@@ -682,7 +687,7 @@ carefully and if the changes are ok, click on the following link:
                     guard.safe_insert(missing, unique=False,
                                       flags={"force-missing-obligatory": "ignore"})
                     inserted.append(ent)
-                except Exception as e:
+                except Exception as e:       # pylint: disable=broad-exception-caught
                     DataModelProblems.evaluate_exception(e)
         if len(existing) > 0:
             info = "Identified the following existing entities:\n"
diff --git a/src/caosadvancedtools/structure_mapping.py b/src/caosadvancedtools/structure_mapping.py
index bf446c2a..aac051a1 100644
--- a/src/caosadvancedtools/structure_mapping.py
+++ b/src/caosadvancedtools/structure_mapping.py
@@ -25,6 +25,10 @@ from linkahead.common.utils import uuid
 from .cfood import (assure_has_description, assure_has_parent,
                     assure_property_is)
 
+# The pylint warnings triggered in this file are ignored, as this code is
+# assumed to be deprecated in the near future. Should this change, they need
+# to be reevaluated.
+
 
 class EntityMapping(object):
     """
@@ -42,6 +46,7 @@ class EntityMapping(object):
         if target._cuid is None:
             target._cuid = str(uuid())
         self.to_existing[str(target._cuid)] = existing
+            target._cuid = str(uuid())       # pylint: disable=protected-access
         self.to_target[existing.id] = target
 
 
-- 
GitLab