4444log = logging .getLogger (__name__ )
4545pyfuse3 .asyncio .enable ()
4646
47+
4748class TestFs (pyfuse3 .Operations ):
4849 def __init__ (self ):
4950 super (TestFs , self ).__init__ ()
5051 self .hello_name = b"message"
51- self .hello_inode = cast (InodeT , pyfuse3 .ROOT_INODE + 1 )
52+ self .hello_inode = cast (InodeT , pyfuse3 .ROOT_INODE + 1 )
5253 self .hello_data = b"hello world\n "
5354
5455 async def getattr (self , inode , ctx = None ):
5556 entry = pyfuse3 .EntryAttributes ()
5657 if inode == pyfuse3 .ROOT_INODE :
57- entry .st_mode = ( stat .S_IFDIR | 0o755 )
58+ entry .st_mode = stat .S_IFDIR | 0o755
5859 entry .st_size = 0
5960 elif inode == self .hello_inode :
60- entry .st_mode = ( stat .S_IFREG | 0o644 )
61+ entry .st_mode = stat .S_IFREG | 0o644
6162 entry .st_size = len (self .hello_data )
6263 else :
6364 raise pyfuse3 .FUSEError (errno .ENOENT )
@@ -88,8 +89,7 @@ async def readdir(self, fh, start_id, token):
8889
8990 # only one entry
9091 if start_id == 0 :
91- pyfuse3 .readdir_reply (
92- token , self .hello_name , await self .getattr (self .hello_inode ), 1 )
92+ pyfuse3 .readdir_reply (token , self .hello_name , await self .getattr (self .hello_inode ), 1 )
9393 return
9494
9595 async def setxattr (self , inode , name , value , ctx ):
@@ -111,11 +111,14 @@ async def open(self, inode, flags, ctx):
111111
112112 async def read (self , fh , off , size ):
113113 assert fh == self .hello_inode
114- return self .hello_data [off :off + size ]
114+ return self .hello_data [off : off + size ]
115+
115116
116117def init_logging (debug = False ):
117- formatter = logging .Formatter ('%(asctime)s.%(msecs)03d %(threadName)s: '
118- '[%(name)s] %(message)s' , datefmt = "%Y-%m-%d %H:%M:%S" )
118+ formatter = logging .Formatter (
119+ '%(asctime)s.%(msecs)03d %(threadName)s: [%(name)s] %(message)s' ,
120+ datefmt = "%Y-%m-%d %H:%M:%S" ,
121+ )
119122 handler = logging .StreamHandler ()
120123 handler .setFormatter (formatter )
121124 root_logger = logging .getLogger ()
@@ -127,17 +130,19 @@ def init_logging(debug=False):
127130 root_logger .setLevel (logging .INFO )
128131 root_logger .addHandler (handler )
129132
133+
130134def parse_args ():
131135 '''Parse command line'''
132136
133137 parser = ArgumentParser ()
134138
135- parser .add_argument ('mountpoint' , type = str ,
136- help = 'Where to mount the file system' )
137- parser .add_argument ('--debug' , action = 'store_true' , default = False ,
138- help = 'Enable debugging output' )
139- parser .add_argument ('--debug-fuse' , action = 'store_true' , default = False ,
140- help = 'Enable FUSE debugging output' )
139+ parser .add_argument ('mountpoint' , type = str , help = 'Where to mount the file system' )
140+ parser .add_argument (
141+ '--debug' , action = 'store_true' , default = False , help = 'Enable debugging output'
142+ )
143+ parser .add_argument (
144+ '--debug-fuse' , action = 'store_true' , default = False , help = 'Enable FUSE debugging output'
145+ )
141146 return parser .parse_args ()
142147
143148
0 commit comments