Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-pipeline
csst_common
Commits
8ef667d1
Commit
8ef667d1
authored
Sep 22, 2023
by
BO ZHANG
🏀
Browse files
refactor CsstResult
parent
29c0f9f6
Pipeline
#1223
passed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_common/status.py
View file @
8ef667d1
...
...
@@ -10,6 +10,7 @@ Modified-History:
2022-10-07, Bo Zhang, added Numpydoc docstring
"""
from
enum
import
IntEnum
from
typing
import
Optional
class
CsstStatus
(
IntEnum
):
...
...
@@ -26,6 +27,7 @@ class CsstStatus(IntEnum):
>>> return CsstStatus.PERFECT
>>> return CsstStatus.ERROR
"""
PERFECT
=
0
WARNING
=
1
ERROR
=
2
...
...
@@ -38,17 +40,23 @@ class CsstResult:
--------
>>> CsstResult(CsstStatus.PERFECT, ["file1.fits", "file2.fits"])
"""
def
__init__
(
self
,
status
:
CsstStatus
=
CsstStatus
.
ERROR
,
file_list
=
[],
**
additional_output
):
def
__init__
(
self
,
status
:
CsstStatus
=
CsstStatus
.
ERROR
,
file_list
:
Optional
=
None
,
**
output
,
):
if
file_list
is
None
:
file_list
=
[]
assert
isinstance
(
status
,
CsstStatus
)
assert
type
(
file_list
)
is
list
self
.
status
=
status
self
.
file_list
=
file_list
self
.
additional_output
=
additional_
output
self
.
output
=
output
def
__repr__
(
self
):
return
f
""" <CsstResult status=
{
self
.
status
}
>
- file_list:
{
self
.
file_list
}
-
addtional_
output:
{
self
.
additional_
output
}
\n
- output:
{
self
.
output
}
\n
"""
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment