Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9349343
release.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
release.py
View Options
from
swh.graphql.backends
import
archive
from
.base_node
import
BaseSWHNode
class
BaseReleaseNode
(
BaseSWHNode
):
def
_get_release_by_id
(
self
,
release_id
):
return
(
archive
.
Archive
()
.
get_releases
([
release_id
])
or
None
)[
0
]
@property
def
targetId
(
self
):
# To support the schema naming convention
return
self
.
_node
.
target
@property
def
targetType
(
self
):
# To support the schema naming convention
return
self
.
_node
.
target_type
.
value
def
is_type_of
(
self
):
"""
is_type_of is required only when resolving
a UNION type
This is for ariadne to return the right type
"""
return
"Release"
class
ReleaseNode
(
BaseReleaseNode
):
"""
When the release is requested directly with an id
"""
def
_get_node_data
(
self
):
return
self
.
_get_release_by_id
(
self
.
kwargs
.
get
(
"SWHID"
)
.
object_id
)
class
TargetReleaseNode
(
BaseReleaseNode
):
"""
When a release is requested as a target
self.obj could be a snapshotbranch or a release
self.obj.target is the requested release id here
"""
def
_get_node_data
(
self
):
return
self
.
_get_release_by_id
(
self
.
obj
.
target
)
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Jul 4 2025, 7:18 PM (7 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3296298
Attached To
rDGQL GraphQL API
Event Timeline
Log In to Comment