File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/python3
22
3- import os
43from optparse import OptionParser
4+ from pathlib import PurePath
55
66
7- def basename (opts , names : list [str ]):
8- for name in names :
7+ def basename (opts , paths : list [PurePath ]):
8+ for path in paths :
99 print (
10- os . path .basename ( name .removesuffix (opts .suffix ) ),
10+ path .name .removesuffix (opts .suffix ),
1111 end = "\0 " if opts .zero else "\n " ,
1212 )
1313
@@ -52,4 +52,4 @@ def basename(opts, names: list[str]):
5252 else :
5353 opts .suffix = ""
5454
55- basename (opts , args )
55+ basename (opts , map ( PurePath , args ) )
Original file line number Diff line number Diff line change 11#!/usr/bin/python3
22
3- import os
43from optparse import OptionParser
4+ from pathlib import PurePath
55
66
7- def dirname (opts , names : list [str ]):
8- for name in names :
9- print (os . path .dirname ( name ) or "." , end = "\0 " if opts .zero else "\n " )
7+ def dirname (opts , paths : list [PurePath ]):
8+ for path in paths :
9+ print (path .parent , end = "\0 " if opts .zero else "\n " )
1010
1111
1212if __name__ == "__main__" :
@@ -32,4 +32,4 @@ def dirname(opts, names: list[str]):
3232 if not args :
3333 parser .error ("missing operand" )
3434
35- dirname (opts , args )
35+ dirname (opts , map ( PurePath , args ) )
You can’t perform that action at this time.
0 commit comments