Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-fuse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Antoine Lambert
swh-fuse
Commits
ee058855
Commit
ee058855
authored
4 years ago
by
Thibault Allançon
Browse files
Options
Downloads
Patches
Plain Diff
fs: move ArtifactEntry class to artifact.py
parent
3c79873a
No related branches found
Branches containing commit
Tags
debian/upstream/0.6.3
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
swh/fuse/fs/artifact.py
+22
-4
22 additions, 4 deletions
swh/fuse/fs/artifact.py
swh/fuse/fs/entry.py
+0
-19
0 additions, 19 deletions
swh/fuse/fs/entry.py
with
22 additions
and
23 deletions
swh/fuse/fs/artifact.py
+
22
−
4
View file @
ee058855
...
...
@@ -5,18 +5,36 @@
from
typing
import
Any
,
AsyncIterator
from
swh.fuse.fs.entry
import
ArtifactEntry
,
Entry
Mode
from
swh.fuse.fs.entry
import
EntryMode
,
Fuse
Entry
from
swh.model.identifiers
import
CONTENT
,
DIRECTORY
,
SWHID
# Avoid cycling import
Fuse
=
"
Fuse
"
def
typify
(
name
:
str
,
mode
:
int
,
fuse
:
Fuse
,
swhid
:
SWHID
,
prefetch
:
Any
=
None
)
->
Any
:
class
ArtifactEntry
(
FuseEntry
):
"""
FUSE virtual entry for a Software Heritage Artifact
Attributes:
swhid: Software Heritage persistent identifier
prefetch: optional prefetched metadata used to set entry attributes
"""
def
__init__
(
self
,
name
:
str
,
mode
:
int
,
fuse
:
Fuse
,
swhid
:
SWHID
,
prefetch
:
Any
=
None
):
super
().
__init__
(
name
,
mode
,
fuse
)
self
.
swhid
=
swhid
self
.
prefetch
=
prefetch
def
typify
(
name
:
str
,
mode
:
int
,
fuse
:
Fuse
,
swhid
:
SWHID
,
prefetch
:
Any
=
None
)
->
ArtifactEntry
:
"""
Create an artifact entry corresponding to the given artifact type
"""
constructor
=
{
CONTENT
:
Content
,
DIRECTORY
:
Directory
}
return
constructor
[
swhid
.
object_type
](
name
,
mode
,
fuse
,
swhid
,
prefetch
)
getters
=
{
CONTENT
:
Content
,
DIRECTORY
:
Directory
}
return
getters
[
swhid
.
object_type
](
name
,
mode
,
fuse
,
swhid
,
prefetch
)
class
Content
(
ArtifactEntry
):
...
...
This diff is collapsed.
Click to expand it.
swh/fuse/fs/entry.py
+
0
−
19
View file @
ee058855
...
...
@@ -5,9 +5,6 @@
from
enum
import
IntEnum
from
stat
import
S_IFDIR
,
S_IFREG
from
typing
import
Any
from
swh.model.identifiers
import
SWHID
# Avoid cycling import
Fuse
=
"
Fuse
"
...
...
@@ -49,19 +46,3 @@ class FuseEntry:
async
def
__aiter__
(
self
):
return
None
class
ArtifactEntry
(
FuseEntry
):
"""
FUSE virtual entry for a Software Heritage Artifact
Attributes:
swhid: Software Heritage persistent identifier
prefetch: optional prefetched metadata used to set entry attributes
"""
def
__init__
(
self
,
name
:
str
,
mode
:
int
,
fuse
:
Fuse
,
swhid
:
SWHID
,
prefetch
:
Any
=
None
):
super
().
__init__
(
name
,
mode
,
fuse
)
self
.
swhid
=
swhid
self
.
prefetch
=
prefetch
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