Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor 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
calibration
pycalibration
Commits
0a8f5b09
Commit
0a8f5b09
authored
9 months ago
by
Karim Ahmed
Committed by
Thomas Kluyver
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: format warning and fix after testing
parent
0aa29adf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1026
Feat[Jungfrau]: Inject CCVs using RESTful API
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cal_tools/constants.py
+18
-12
18 additions, 12 deletions
src/cal_tools/constants.py
with
18 additions
and
12 deletions
src/cal_tools/constants.py
+
18
−
12
View file @
0a8f5b09
<<<<<<<
HEAD
import
binascii
import
time
=======
import
binascii
import
time
import
warnings
from
datetime
import
datetime
,
timezone
>>>>>>>
055e516
a
(
fix
:
handle
CCVAlreadyInject
case
using
a
warning
)
from
hashlib
import
md5
from
pathlib
import
Path
from
shutil
import
copyfile
from
struct
import
pack
,
unpack
<<<<<<<
HEAD
from
typing
import
List
,
Optional
,
Union
=======
>>>>>>>
055e516
a
(
fix
:
handle
CCVAlreadyInject
case
using
a
warning
)
import
h5py
import
numpy
as
np
...
...
@@ -30,7 +19,16 @@ from cal_tools.tools import run_prop_seq_from_path
class
CCVAlreadyInjected
(
UserWarning
):
"""
Exception when same CCV was already injected.
"""
"""
Exception when same CCV was already injected.
expected response: {
'
success
'
: False,
'
status_code
'
: 422,
'
info
'
:
'
Error creating calibration_constant_version
'
,
'
app_info
'
: {
'
calibration_constant_id
'
: [
'
has already been taken
'
],
'
physical_detector_unit_id
'
: [
'
has already been taken
'
],
'
begin_at
'
: [
'
has already been taken
'
]
},
'
pagination
'
: {},
'
data
'
: {}}
"""
pass
CONDITION_NAME_MAX_LENGTH
=
60
...
...
@@ -44,6 +42,14 @@ class CCVAlreadyInjectedError(InjectAPIError):
...
def
custom_warning_formatter
(
message
,
category
,
filename
,
lineno
,
file
=
None
,
line
=
None
):
"""
Custom warning format to avoid display filename and lineno.
"""
return
f
"
{
category
.
__name__
}
:
{
message
}
\n
"
# Apply the custom warning formatter
warnings
.
formatwarning
=
custom_warning_formatter
def
write_ccv
(
const_path
,
pdu_name
,
pdu_uuid
,
detector_type
,
...
...
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