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
aedd4608
Commit
aedd4608
authored
Dec 16, 2023
by
BO ZHANG
🏀
Browse files
remove File.replace_ext()
parent
061bf13a
Pipeline
#2433
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_common/file.py
View file @
aedd4608
...
...
@@ -99,18 +99,5 @@ class File:
def
derive2
(
self
,
*
args
,
**
kwargs
):
return
self
.
derive
(
*
args
,
**
kwargs
,
level
=
2
)
def
replace_ext
(
self
,
new_ext
:
Optional
[
str
]
=
"img.fits"
,
new_dir
:
Optional
[
str
]
=
None
)
->
str
:
if
new_dir
is
None
:
new_dir
=
self
.
new_dir
if
new_ext
is
None
:
new_ext
=
self
.
ext
if
new_ext
.
startswith
(
"."
):
return
os
.
path
.
join
(
new_dir
,
self
.
prefix
+
new_ext
)
else
:
return
os
.
path
.
join
(
new_dir
,
self
.
prefix
+
"_"
+
new_ext
)
def
__repr__
(
self
):
return
f
"<File
{
self
.
file_path
}
>"
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