4242log = logging .getLogger (__name__ )
4343pyfuse3 .asyncio .enable ()
4444
45+
4546class TestFs (pyfuse3 .Operations ):
4647 def __init__ (self ):
4748 super (TestFs , self ).__init__ ()
4849 self .hello_name = b"message"
49- self .hello_inode = pyfuse3 .ROOT_INODE + 1
50+ self .hello_inode = pyfuse3 .ROOT_INODE + 1
5051 self .hello_data = b"hello world\n "
5152
5253 async def getattr (self , inode , ctx = None ):
5354 entry = pyfuse3 .EntryAttributes ()
5455 if inode == pyfuse3 .ROOT_INODE :
55- entry .st_mode = ( stat .S_IFDIR | 0o755 )
56+ entry .st_mode = stat .S_IFDIR | 0o755
5657 entry .st_size = 0
5758 elif inode == self .hello_inode :
58- entry .st_mode = ( stat .S_IFREG | 0o644 )
59+ entry .st_mode = stat .S_IFREG | 0o644
5960 entry .st_size = len (self .hello_data )
6061 else :
6162 raise pyfuse3 .FUSEError (errno .ENOENT )
@@ -86,7 +87,11 @@ async def readdir(self, fh, start_id, token):
8687 # only one entry
8788 if start_id == 0 :
8889 pyfuse3 .readdir_reply (
89- token , self .hello_name , await self .getattr (pyfuse3 .InodeT (self .hello_inode )), 1 )
90+ token ,
91+ self .hello_name ,
92+ await self .getattr (pyfuse3 .InodeT (self .hello_inode )),
93+ 1 ,
94+ )
9095 return
9196
9297 async def setxattr (self , inode , name , value , ctx ):
@@ -107,11 +112,14 @@ async def open(self, inode, flags, ctx):
107112
108113 async def read (self , fh , off , size ):
109114 assert fh == self .hello_inode
110- return self .hello_data [off :off + size ]
115+ return self .hello_data [off : off + size ]
116+
111117
112118def init_logging (debug = False ):
113- formatter = logging .Formatter ('%(asctime)s.%(msecs)03d %(threadName)s: '
114- '[%(name)s] %(message)s' , datefmt = "%Y-%m-%d %H:%M:%S" )
119+ formatter = logging .Formatter (
120+ '%(asctime)s.%(msecs)03d %(threadName)s: [%(name)s] %(message)s' ,
121+ datefmt = "%Y-%m-%d %H:%M:%S" ,
122+ )
115123 handler = logging .StreamHandler ()
116124 handler .setFormatter (formatter )
117125 root_logger = logging .getLogger ()
@@ -123,17 +131,22 @@ def init_logging(debug=False):
123131 root_logger .setLevel (logging .INFO )
124132 root_logger .addHandler (handler )
125133
134+
126135def parse_args ():
127136 '''Parse command line'''
128137
129138 parser = ArgumentParser ()
130139
131- parser .add_argument ('mountpoint' , type = str ,
132- help = 'Where to mount the file system' )
133- parser .add_argument ('--debug' , action = 'store_true' , default = False ,
134- help = 'Enable debugging output' )
135- parser .add_argument ('--debug-fuse' , action = 'store_true' , default = False ,
136- help = 'Enable FUSE debugging output' )
140+ parser .add_argument ('mountpoint' , type = str , help = 'Where to mount the file system' )
141+ parser .add_argument (
142+ '--debug' , action = 'store_true' , default = False , help = 'Enable debugging output'
143+ )
144+ parser .add_argument (
145+ '--debug-fuse' ,
146+ action = 'store_true' ,
147+ default = False ,
148+ help = 'Enable FUSE debugging output' ,
149+ )
137150 return parser .parse_args ()
138151
139152
0 commit comments