From 566627ee7865af725a19dd75a4f2c3c42f421109 Mon Sep 17 00:00:00 2001
From: George Marchment <georgemarchment@yahoo.fr>
Date: Thu, 6 Feb 2025 14:57:27 +0100
Subject: [PATCH] Fixed the bug i mentionned

---
 src/executor.py                 | 11 +++++------
 src/main.py                     |  3 ---
 src/nextflow_building_blocks.py |  3 ---
 src/nextflow_file.py            |  4 +---
 src/subworkflow.py              |  9 +++------
 src/workflow.py                 |  4 ----
 6 files changed, 9 insertions(+), 25 deletions(-)

diff --git a/src/executor.py b/src/executor.py
index 6e54eb9..845b5ca 100644
--- a/src/executor.py
+++ b/src/executor.py
@@ -206,17 +206,16 @@ class Executor(Nextflow_Building_Blocks):
 
     #Method which returns the call which calls the element called 
     def get_call_by_name(self, name):
+        #This is an old comment:
         #We get the calls that have already been analysed or which are currently being analysed
         #for example "p(a.out)" -> the call for 'a' may not have been analysed yet
         #In that case when calling "get_calls" -> we don't want to reanalyse the "p(a.out)"
-        calls_that_have_been_analysed = self.get_calls_that_have_been_analysed()
+        
         if(self.origin.get_type() in ['Root', 'Block']):
             for c in self.origin.get_calls():
-                if(c not in calls_that_have_been_analysed):
-                    calls_that_have_been_analysed[c] = True
-                    #c.initialise()
-                    if(c.first_element_called.get_alias()==name):
-                        return c
+                #c.initialise()#Don't need to analyse the call cause the element called is already analysed when the call is created
+                if(c.first_element_called.get_alias()==name):
+                    return c
             return None
         
         else:
diff --git a/src/main.py b/src/main.py
index 5b80b7d..522bde7 100644
--- a/src/main.py
+++ b/src/main.py
@@ -15,9 +15,6 @@ class Main(Nextflow_Building_Blocks):
         self.initialised = False
         self.root = None 
 
-    def get_calls_that_have_been_analysed(self):
-        return self.nextflow_file.get_calls_that_have_been_analysed()
-
     def get_string_line(self, bit_of_code):
         return self.nextflow_file.get_string_line(bit_of_code)
 
diff --git a/src/nextflow_building_blocks.py b/src/nextflow_building_blocks.py
index c004e35..cf683ff 100644
--- a/src/nextflow_building_blocks.py
+++ b/src/nextflow_building_blocks.py
@@ -20,9 +20,6 @@ class Nextflow_Building_Blocks:
     #---------------------------------
     #AUXILIARY METHODS FOR ALL CLASSES
     #---------------------------------
-    
-    def get_calls_that_have_been_analysed(self):
-        return self.origin.get_calls_that_have_been_analysed()
 
     def get_code(self, get_OG = False):
         return self.code.get_code(get_OG = get_OG)
diff --git a/src/nextflow_file.py b/src/nextflow_file.py
index 48e1057..6095fd0 100644
--- a/src/nextflow_file.py
+++ b/src/nextflow_file.py
@@ -50,9 +50,7 @@ class Nextflow_File(Nextflow_Building_Blocks):
     def get_DSL(self):
         return self.workflow.get_DSL()
     
-    def get_calls_that_have_been_analysed(self):
-        return self.workflow.get_calls_that_have_been_analysed()
-    
+
     #Method which returns the DSL of the workflow -> by default it's DSL2
     #I use the presence of include, subworkflows and into/from in processes as a proxy
     def find_DSL(self):
diff --git a/src/subworkflow.py b/src/subworkflow.py
index 3ce064e..07fb61e 100644
--- a/src/subworkflow.py
+++ b/src/subworkflow.py
@@ -44,13 +44,10 @@ class Subworkflow(Main):
         return sub
     
     def get_call_by_name(self, name):
-        calls_that_have_been_analysed = self.get_calls_that_have_been_analysed()
         for c in self.root.get_calls():
-            if(c not in calls_that_have_been_analysed):
-                calls_that_have_been_analysed[c] = True
-                #c.initialise()
-                if(c.first_element_called.get_alias()==name):
-                    return c
+            #c.initialise()#Don't need to analyse the call cause the element called is already analysed when the call is created
+            if(c.first_element_called.get_alias()==name):
+                return c
         return None
         
 
diff --git a/src/workflow.py b/src/workflow.py
index a0ac31e..0070f2b 100644
--- a/src/workflow.py
+++ b/src/workflow.py
@@ -61,7 +61,6 @@ class Workflow:
         self.name = name
         self.graph = None
 
-        self.calls_that_have_been_analysed = {}
 
         OG_file = Nextflow_File(file, workflow = self, first_file = True)
         self.DSL = OG_file.find_DSL()
@@ -82,9 +81,6 @@ class Workflow:
         with open(self.output_dir / "debug" / "operations_in_call.nf",'w') as file:
             pass
 
-    def get_calls_that_have_been_analysed(self):
-        return self.calls_that_have_been_analysed
-
     def get_duplicate_status(self):
         return self.duplicate
 
-- 
GitLab