Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Coscine Python SDK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coscine
community features
Coscine Python SDK
Commits
efe88af8
Commit
efe88af8
authored
1 year ago
by
Romin
Browse files
Options
Downloads
Patches
Plain Diff
Fixed datetime format
parent
36434109
No related branches found
No related tags found
1 merge request
!15
Fixed datetime format
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/coscine/__about__.py
+1
-1
1 addition, 1 deletion
src/coscine/__about__.py
src/coscine/form.py
+17
-6
17 additions, 6 deletions
src/coscine/form.py
with
18 additions
and
7 deletions
src/coscine/__about__.py
+
1
−
1
View file @
efe88af8
...
...
@@ -30,7 +30,7 @@ __title__ = "coscine"
# Current package version
# Do not set version to 1.0.0 before update to Coscine API version 2
__version__
=
"
0.9.
3
"
__version__
=
"
0.9.
4
"
# Short package description
__summary__
=
(
...
...
This diff is collapsed.
Click to expand it.
src/coscine/form.py
+
17
−
6
View file @
efe88af8
...
...
@@ -580,21 +580,29 @@ class InputForm:
###############################################################################
def
xsd_type
(
self
,
key
:
str
)
->
str
:
"""
Returns the xsd type identifier for a given field.
"""
datatype
=
self
.
properties
(
key
).
datatype
if
datatype
and
datatype
.
startswith
(
"
http:
"
):
datatype
=
f
"
xsd:
{
urllib
.
parse
.
urlparse
(
datatype
)[
-
1
]
}
"
return
datatype
###############################################################################
def
datatype
(
self
,
key
:
str
)
->
type
:
"""
Returns the datatype for a given field (which may be None).
"""
datatype
=
self
.
properties
(
key
).
datatype
if
datatype
and
datatype
.
startswith
(
"
http:
"
):
datatype
=
f
"
xsd:
{
urllib
.
parse
.
urlparse
(
datatype
)[
-
1
]
}
"
if
self
.
is_controlled
(
key
):
return
str
else
:
datatype
:
str
=
self
.
xsd_type
(
key
)
return
self
.
_xsd_typeof
(
datatype
)
###############################################################################
# FIXME: Lots of xsd types still unhandled, especially datetime formats
def
type_format
(
self
,
key
:
str
)
->
str
:
"""
Returns the format for a datatype of a field.
...
...
@@ -608,6 +616,9 @@ class InputForm:
if
datatype
==
float
:
return
"
%f
"
if
datatype
==
datetime
:
if
self
.
xsd_type
(
key
)
==
"
xsd:dateTime
"
:
return
"
%Y-%m-%dT%H:%M:%S
"
else
:
return
"
%Y-%m-%d
"
return
"
Invalid Format
"
...
...
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