Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LabelsTower
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Admin message
Gitlab has been updated. More info
here
.
Show more breadcrumbs
MaitresNageurs
README
LabelsTower
Commits
b716f1ab
Commit
b716f1ab
authored
5 years ago
by
erichard
Browse files
Options
Downloads
Patches
Plain Diff
Move function outside the routes module.
parent
7385dc01
No related branches found
No related tags found
2 merge requests
!61
Packager labelstower
,
!60
WIP: Implement sqlalchemy
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/labels_system/getter.py
+17
-0
17 additions, 0 deletions
app/labels_system/getter.py
app/labels_system/routes.py
+1
-17
1 addition, 17 deletions
app/labels_system/routes.py
with
18 additions
and
17 deletions
app/labels_system/getter.py
+
17
−
0
View file @
b716f1ab
...
...
@@ -192,6 +192,23 @@ def get_ids(objects: List[Dict[int, str]]) -> str :
#remove last extra comma
return
objects_ids
[
0
:
-
1
]
def
get_user_selection
(
number_of_mandatory_labels
:
int
,
optional1
:
str
,
optional2
:
str
)
->
tuple
:
'''
Return the right values of id_mandatory_labels and id_forbiden_labels when optional2 is missing.
It is necessary because optional1 could be id_mandatory_labels or id_forbiden_labels.
:param number_of_mandatory_labels: int
:param optional1: str
:param optional2: str
:return:
'''
if
int
(
number_of_mandatory_labels
):
id_mandatory_labels
=
optional1
id_forbiden_labels
=
optional2
else
:
id_mandatory_labels
=
optional2
id_forbiden_labels
=
optional1
return
id_mandatory_labels
,
id_forbiden_labels
def
send_query_to_db
(
query
:
str
)
->
List
[
Dict
[
int
,
str
]]
:
'''
Return the result of the query send to the database
...
...
This diff is collapsed.
Click to expand it.
app/labels_system/routes.py
+
1
−
17
View file @
b716f1ab
from
typing
import
Dict
,
List
import
json
from
app.labels_system.getter
import
get_selected_elements
,
get_discriminating_labels
,
get_high_discriminating_labels
from
app.labels_system.getter
import
get_selected_elements
,
get_discriminating_labels
,
get_high_discriminating_labels
,
get_user_selection
from
app.labels_system
import
bp
...
...
@@ -23,19 +23,3 @@ def search(number_of_mandatory_labels: int, optional1: str, optional2: str) -> L
result
=
[
selected_elements
,
high_discriminating_labels
]
return
json
.
dumps
(
result
)
def
get_user_selection
(
number_of_mandatory_labels
:
int
,
optional1
:
str
,
optional2
:
str
)
->
tuple
:
'''
Return the right values of id_mandatory_labels and id_forbiden_labels when optional2 is missing.
It is necessary because optional1 could be id_mandatory_labels or id_forbiden_labels.
:param number_of_mandatory_labels: int
:param optional1: str
:param optional2: str
:return:
'''
if
int
(
number_of_mandatory_labels
):
id_mandatory_labels
=
optional1
id_forbiden_labels
=
optional2
else
:
id_mandatory_labels
=
optional2
id_forbiden_labels
=
optional1
return
id_mandatory_labels
,
id_forbiden_labels
\ No newline at end of file
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