mirror of
https://gitlab.com/scemama/irpf90.git
synced 2025-01-03 01:55:42 +01:00
Fix pertinant children in graph
This commit is contained in:
parent
0e60db07ff
commit
590a1ceef5
@ -691,6 +691,11 @@ class Entity(object):
|
|||||||
#Set by parsed_text.build_needs(...)
|
#Set by parsed_text.build_needs(...)
|
||||||
raise AttributeError
|
raise AttributeError
|
||||||
|
|
||||||
|
@irpy.lazy_property_mutable
|
||||||
|
def needed_by(self):
|
||||||
|
#Set by parsed_text.build_needs(...)
|
||||||
|
return []
|
||||||
|
|
||||||
@irpy.lazy_property
|
@irpy.lazy_property
|
||||||
def children(self):
|
def children(self):
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ class Irpy_comm_world(object):
|
|||||||
Ent_part = partial(Entity,buf,icount,comm_world=self)
|
Ent_part = partial(Entity,buf,icount,comm_world=self)
|
||||||
|
|
||||||
ent = Ent_part()
|
ent = Ent_part()
|
||||||
l_ent += [ent] + [Ent_part(other) for other in ent.others_entity_name]
|
l_ent += [ent] + [Ent_part(name) for name in ent.others_entity_name]
|
||||||
|
|
||||||
# O(2) but who care
|
# O(2) but who care
|
||||||
l_duplicate = [x for x in l_ent if l_ent.count(x) > 1]
|
l_duplicate = [x for x in l_ent if l_ent.count(x) > 1]
|
||||||
@ -227,7 +227,7 @@ class Irpy_comm_world(object):
|
|||||||
d_routine = self.d_routine
|
d_routine = self.d_routine
|
||||||
|
|
||||||
import parsed_text
|
import parsed_text
|
||||||
vtuple = [(v, s.same_as, s.regexp) for v, s in d_entity.iteritems()]
|
vtuple = [(v, s.regexp) for v, s in d_entity.iteritems()]
|
||||||
def worker_parsed(filename_text):
|
def worker_parsed(filename_text):
|
||||||
filename, text = filename_text
|
filename, text = filename_text
|
||||||
return parsed_text.get_parsed_text(filename, text, d_entity, d_routine, vtuple)
|
return parsed_text.get_parsed_text(filename, text, d_entity, d_routine, vtuple)
|
||||||
|
@ -34,7 +34,7 @@ regexps_re_string_sub = regexps.re_string.sub
|
|||||||
|
|
||||||
def find_variables_in_line(line, vtuple):
|
def find_variables_in_line(line, vtuple):
|
||||||
line_lower = regexps_re_string_sub('', line.lower)
|
line_lower = regexps_re_string_sub('', line.lower)
|
||||||
return [same_as for v, same_as, regexp in vtuple if v in line_lower and regexp(line_lower)]
|
return [v for v, regexp in vtuple if v in line_lower and regexp(line_lower)]
|
||||||
|
|
||||||
|
|
||||||
def find_funcs_in_line(line, stuple):
|
def find_funcs_in_line(line, stuple):
|
||||||
@ -96,7 +96,7 @@ def get_parsed_text(filename, text, variables, subroutines, vtuple):
|
|||||||
varlist.append(v)
|
varlist.append(v)
|
||||||
|
|
||||||
variable_list = find_variables_in_line(line, vtuple)
|
variable_list = find_variables_in_line(line, vtuple)
|
||||||
variable_list.remove(variables[v].same_as)
|
variable_list.remove(v)
|
||||||
|
|
||||||
append(Parsed_text(variable_list, line))
|
append(Parsed_text(variable_list, line))
|
||||||
|
|
||||||
@ -459,6 +459,7 @@ def build_needs(parsed_text, subroutines, stuple, variables):
|
|||||||
# Needs and to_provide
|
# Needs and to_provide
|
||||||
# ~#~#~#~#~#
|
# ~#~#~#~#~#
|
||||||
|
|
||||||
|
# Loop of the main Entity
|
||||||
for filename, text in parsed_text:
|
for filename, text in parsed_text:
|
||||||
|
|
||||||
l_begin = [i for i, (_, line) in enumerate(text) if isinstance(line, Begin_provider)]
|
l_begin = [i for i, (_, line) in enumerate(text) if isinstance(line, Begin_provider)]
|
||||||
@ -485,6 +486,8 @@ def build_needs(parsed_text, subroutines, stuple, variables):
|
|||||||
|
|
||||||
entity.needs = uniquify(l_needs)
|
entity.needs = uniquify(l_needs)
|
||||||
|
|
||||||
|
|
||||||
|
# Now do the Other entity
|
||||||
for v in variables:
|
for v in variables:
|
||||||
main = variables[v].same_as
|
main = variables[v].same_as
|
||||||
if main != v:
|
if main != v:
|
||||||
@ -492,11 +495,15 @@ def build_needs(parsed_text, subroutines, stuple, variables):
|
|||||||
variables[v].to_provide = variables[main].to_provide
|
variables[v].to_provide = variables[main].to_provide
|
||||||
|
|
||||||
# ~#~#~#~#~#
|
# ~#~#~#~#~#
|
||||||
# Needs and to_provide
|
# Needs_by
|
||||||
# ~#~#~#~#~#
|
# ~#~#~#~#~#
|
||||||
|
|
||||||
for v in variables:
|
# This a some dark vodou magic.
|
||||||
variables[v].needed_by = []
|
# The algo is:
|
||||||
|
# - Initialise needed_by
|
||||||
|
# - Create the pointer copy
|
||||||
|
# - Add the value (so it add also to the pointer reference...)
|
||||||
|
|
||||||
for v in variables:
|
for v in variables:
|
||||||
main = variables[v].same_as
|
main = variables[v].same_as
|
||||||
if main != v:
|
if main != v:
|
||||||
@ -508,8 +515,7 @@ def build_needs(parsed_text, subroutines, stuple, variables):
|
|||||||
for x in var.needs:
|
for x in var.needs:
|
||||||
variables[x].needed_by.append(var.same_as)
|
variables[x].needed_by.append(var.same_as)
|
||||||
|
|
||||||
for v in variables:
|
for var in variables.values():
|
||||||
var = variables[v]
|
|
||||||
var.needed_by = uniquify(var.needed_by)
|
var.needed_by = uniquify(var.needed_by)
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user