Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
G
gracedb-client
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leo Pound Singer
gracedb-client
Commits
f3d84ef5
Verified
Commit
f3d84ef5
authored
Jul 11, 2018
by
Tanner Prestegard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating _getCode to be case-insensitive
parent
0cbe3e5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
ligo/gracedb/rest.py
ligo/gracedb/rest.py
+17
-11
No files found.
ligo/gracedb/rest.py
View file @
f3d84ef5
...
...
@@ -445,18 +445,24 @@ class GraceDb(GsiRest):
return
GsiRest
.
request
(
self
,
method
,
*
args
,
**
kwargs
)
def
_getCode
(
self
,
input_value
,
code_dict
):
"""Check if input is valid.
Return coded version if it is"""
# code_dict is dict of { code : descriptive_name }
if
input_value
in
list
(
code_dict
.
keys
()):
# Already coded
"""
Check if input is valid and return coded version if it is
code_dict is dict of { code : descriptive_name }
"""
# Quick check for simple case where it's already coded
if
input_value
in
code_dict
:
return
input_value
if
not
input_value
in
list
(
code_dict
.
values
()):
# Not valid
return
None
return
[
code
for
code
,
name
in
code_dict
.
items
()
if
name
==
input_value
][
0
]
# Loop over code_dict items, if we match either the key or
# value (case-insensitive), return the code.
input_lower
=
input_value
.
lower
()
for
code
,
display
in
six
.
iteritems
(
code_dict
):
if
(
input_lower
==
code
.
lower
()
or
input_lower
==
display
.
lower
()):
return
code
# Not found, return None
return
None
# Search and filecontents are optional when creating an event.
def
createEvent
(
self
,
group
,
pipeline
,
filename
,
search
=
None
,
labels
=
None
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment