Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BioFlow-Insight
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
shareFAIR
BioFlow-Insight
Commits
eb2a0a40
Commit
eb2a0a40
authored
2 months ago
by
George Marchment
Browse files
Options
Downloads
Patches
Plain Diff
Added sort length of parameters before replacing
parent
14e6ee30
No related branches found
No related tags found
No related merge requests found
Pipeline
#14484
failed with stage
in 2 minutes and 23 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/call.py
+10
-0
10 additions, 0 deletions
src/call.py
with
10 additions
and
0 deletions
src/call.py
+
10
−
0
View file @
eb2a0a40
...
...
@@ -76,7 +76,16 @@ class Call(Executor):
tag_to_add
=
"
//AREA TO ADD PARAMS
"
code
=
f
"
{
tag_to_add
}
\n
{
code
}
"
index
=
1
#We do this so that the longest parameters are rewritten first in the code -> to avoid problems
parameters_2_length
=
{}
for
param
in
self
.
parameters
:
#TODO -> make sure of you change the parameters of the get_code -> you do the same below
temp_code
=
param
.
get_code
(
get_OG
=
True
)
parameters_2_length
[
param
]
=
len
(
temp_code
)
sorted_parameters_2_length
=
{
k
:
v
for
k
,
v
in
sorted
(
parameters_2_length
.
items
(),
key
=
lambda
item
:
item
[
1
],
reverse
=
True
)}
for
param
in
sorted_parameters_2_length
:
param_new_name
=
f
"
{
self
.
get_first_element_called
().
get_alias_and_id
()
}
_param_
{
index
}
"
#Case the param is a call
...
...
@@ -84,6 +93,7 @@ class Call(Executor):
#If it's not a function -> then we rewrite it
if
(
param
.
get_first_element_called
().
get_type
()
!=
"
Function
"
):
temp
=
code
#TODO -> make sure of you change the parameters of the get_code -> you do the same above
code
=
replace_group1
(
code
,
fr
"
[^\w](
{
re
.
escape
(
param
.
get_code
(
get_OG
=
True
))
}
)
"
,
param_new_name
)
if
(
temp
==
code
):
raise
Exception
(
"
This souldn
'
t happen
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment