Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def correlate(self,project):
for i in range(len(self.variables)):
if self.variables[i] in self.parent.all_vars:
self.variables[i] = self.parent.all_vars[self.variables[i]]
try:
self.parent.variables.remove(self.variables[i])
except ValueError:
pass
else:
if self.variables[i][0].lower() in 'ijklmn':
vartype = 'integer'
else:
vartype = 'real'
self.variables[i] = FortranVariable(self.variables[i],vartype,self)
self.variables[i].doc = ''
if self.name in project.common:
self.other_uses = project.common[self.name]
self.other_uses.append(self)
else:
lst = [self,]
project.common[self.name] = lst
self.other_uses = lst
else:
vartype = 'real'
self.args[i] = FortranVariable(self.args[i],vartype,self)
self.args[i].doc = ''
if type(self.retvar) != FortranVariable:
for var in self.variables:
if var.name.lower() == self.retvar.lower():
self.retvar = var
self.variables.remove(var)
break
else:
if self.retvar[0].lower() in 'ijklmn':
vartype = 'integer'
else:
vartype = 'real'
self.retvar = FortranVariable(self.retvar,vartype,self)
self.process_attribs()
self.variables = [v for v in self.variables if 'external' not in v.attribs]
for intr in self.interfaces:
if not (intr.abstract or intr.generic):
proc = intr.procedure
if proc.name.lower() == self.args[i].lower():
self.args[i] = proc
self.interfaces.remove(intr)
self.args[i].parent = self
break
if type(self.args[i]) == str:
if self.args[i][0].lower() in 'ijklmn':
vartype = 'integer'
else:
vartype = 'real'
self.args[i] = FortranVariable(self.args[i],vartype,self)
self.args[i].doc = ''
if type(self.retvar) != FortranVariable:
for var in self.variables:
if var.name.lower() == self.retvar.lower():
self.retvar = var
self.variables.remove(var)
break
else:
if self.retvar[0].lower() in 'ijklmn':
vartype = 'integer'
else:
vartype = 'real'
self.retvar = FortranVariable(self.retvar,vartype,self)
self.process_attribs()
self.variables = [v for v in self.variables if 'external' not in v.attribs]
num = int(QUOTES_RE.search(initial[search_from:]).group()[1:-1])
old_string = NBSP_RE.sub(' ',parent.strings[num])
string = ''
for i in range(len(old_string)):
if old_string[i] == "\\" and (old_string[i+1] in '0123456789' or
old_string[i+1] == 'g'):
string += r'\\'
elif old_string[i] == '(' and old_string[i+1] =='?':
string += r'\('
else:
string += old_string[i]
initial = initial[0:search_from] + QUOTES_RE.sub(string,initial[search_from:],count=1)
search_from += QUOTES_RE.search(initial[search_from:]).end(0)
if proto:
varlist.append(FortranVariable(name,vartype,parent,copy.copy(attribs),intent,
optional,permission,parameter,kind,strlen,list(proto),
[],points,initial))
else:
varlist.append(FortranVariable(name,vartype,parent,copy.copy(attribs),intent,
optional,permission,parameter,kind,strlen,proto,
[],points,initial))
doc = []
docline = source.__next__()
while docline[0:2] == "!" + parent.settings['docmark']:
doc.append(docline[2:])
docline = source.__next__()
source.pass_back(docline)
for var in varlist: var.doc = doc
return varlist
def correlate(self,project):
for i in range(len(self.variables)):
if self.variables[i] in self.parent.all_vars:
self.variables[i] = self.parent.all_vars[self.variables[i]]
try:
self.parent.variables.remove(self.variables[i])
except ValueError:
pass
else:
if self.variables[i][0].lower() in 'ijklmn':
vartype = 'integer'
else:
vartype = 'real'
self.variables[i] = FortranVariable(self.variables[i],vartype,self)
self.variables[i].doc = ''
if self.name in project.common:
self.other_uses = project.common[self.name]
self.other_uses.append(self)
else:
lst = [self,]
project.common[self.name] = lst
self.other_uses = lst
# Sort content
self.sort()
break
if type(self.args[i]) == str:
for intr in self.interfaces:
if not (intr.abstract or intr.generic):
proc = intr.procedure
if proc.name.lower() == self.args[i].lower():
self.args[i] = proc
self.interfaces.remove(intr)
self.args[i].parent = self
break
if type(self.args[i]) == str:
if self.args[i][0].lower() in 'ijklmn':
vartype = 'integer'
else:
vartype = 'real'
self.args[i] = FortranVariable(self.args[i],vartype,self)
self.args[i].doc = ''
if type(self.retvar) != FortranVariable:
for var in self.variables:
if var.name.lower() == self.retvar.lower():
self.retvar = var
self.variables.remove(var)
break
else:
if self.retvar[0].lower() in 'ijklmn':
vartype = 'integer'
else:
vartype = 'real'
self.retvar = FortranVariable(self.retvar,vartype,self)
self.process_attribs()
self.variables = [v for v in self.variables if 'external' not in v.attribs]
num = int(QUOTES_RE.search(initial[search_from:]).group()[1:-1])
old_string = NBSP_RE.sub(' ',parent.strings[num])
string = ''
for i in range(len(old_string)):
if old_string[i] == "\\" and (old_string[i+1] in '0123456789' or
old_string[i+1] == 'g'):
string += r'\\'
elif old_string[i] == '(' and old_string[i+1] =='?':
string += r'\('
else:
string += old_string[i]
initial = initial[0:search_from] + QUOTES_RE.sub(string,initial[search_from:],count=1)
search_from += QUOTES_RE.search(initial[search_from:]).end(0)
if proto:
varlist.append(FortranVariable(name,vartype,parent,copy.copy(attribs),intent,
optional,permission,parameter,kind,strlen,list(proto),
[],points,initial))
else:
varlist.append(FortranVariable(name,vartype,parent,copy.copy(attribs),intent,
optional,permission,parameter,kind,strlen,proto,
[],points,initial))
doc = []
docline = source.__next__()
while docline[0:2] == "!" + parent.settings['docmark']:
doc.append(docline[2:])
docline = source.__next__()
source.pass_back(docline)
for var in varlist: var.doc = doc
return varlist
else:
vartype = 'real'
self.args[i] = FortranVariable(self.args[i],vartype,self)
self.args[i].doc = ''
if type(self.retvar) != FortranVariable:
for var in self.variables:
if var.name.lower() == self.retvar.lower():
self.retvar = var
self.variables.remove(var)
break
else:
if self.retvar[0].lower() in 'ijklmn':
vartype = 'integer'
else:
vartype = 'real'
self.retvar = FortranVariable(self.retvar,vartype,self)
self.process_attribs()
self.variables = [v for v in self.variables if 'external' not in v.attribs]
break
if type(self.args[i]) == str:
for intr in self.interfaces:
if not (intr.abstract or intr.generic):
proc = intr.procedure
if proc.name.lower() == self.args[i].lower():
self.args[i] = proc
self.interfaces.remove(intr)
self.args[i].parent = self
break
if type(self.args[i]) == str:
if self.args[i][0].lower() in 'ijklmn':
vartype = 'integer'
else:
vartype = 'real'
self.args[i] = FortranVariable(self.args[i],vartype,self)
self.args[i].doc = ''
self.process_attribs()
self.variables = [v for v in self.variables if 'external' not in v.attribs]