@@ -427,14 +427,8 @@ pub(crate) mod module {
427427 #[ pyfunction]
428428 fn listvolumes ( vm : & VirtualMachine ) -> PyResult < PyListRef > {
429429 let mut volumes = vec ! [ ] ;
430- let find;
431430 let mut buffer = [ 0u16 ; 257 ] ;
432- find = unsafe {
433- FileSystem :: FindFirstVolumeW (
434- buffer. as_mut_ptr ( ) ,
435- buffer. len ( ) as _ ,
436- )
437- } ;
431+ let find = unsafe { FileSystem :: FindFirstVolumeW ( buffer. as_mut_ptr ( ) , buffer. len ( ) as _ ) } ;
438432 if find == windows_sys:: Win32 :: Foundation :: INVALID_HANDLE_VALUE {
439433 return Err ( errno_err ( vm) ) ;
440434 }
@@ -447,11 +441,7 @@ pub(crate) mod module {
447441 }
448442 volumes. push ( s. to_string ( ) ) ;
449443 let ret = unsafe {
450- FileSystem :: FindNextVolumeW (
451- find,
452- buffer. as_mut_ptr ( ) ,
453- buffer. len ( ) as _ ,
454- )
444+ FileSystem :: FindNextVolumeW ( find, buffer. as_mut_ptr ( ) , buffer. len ( ) as _ )
455445 } ;
456446 if ret == 0 {
457447 err = std:: io:: Error :: last_os_error ( ) . raw_os_error ( ) . unwrap_or ( 0 ) ;
@@ -463,69 +453,10 @@ pub(crate) mod module {
463453 if err != 0 && err != windows_sys:: Win32 :: Foundation :: ERROR_NO_MORE_FILES as i32 {
464454 return Err ( std:: io:: Error :: from_raw_os_error ( err) . to_pyexception ( vm) ) ;
465455 }
466- let volumes: Vec < _ > = volumes
467- . into_iter ( )
468- . map ( |v| vm. new_pyobj ( v) )
469- . collect ( ) ;
456+ let volumes: Vec < _ > = volumes. into_iter ( ) . map ( |v| vm. new_pyobj ( v) ) . collect ( ) ;
470457 Ok ( vm. ctx . new_list ( volumes) )
471458 }
472459
473- // TOOD: these functions are not fully compataible with CPython
474- // they exist for some compatibility
475- #[ pyfunction]
476- fn _path_exists ( path : OsPath , vm : & VirtualMachine ) -> PyResult < bool > {
477- let path = path. as_ref ( ) ;
478- if path. exists ( ) {
479- return Ok ( true ) ;
480- }
481- if path. is_dir ( ) {
482- return Ok ( false ) ;
483- }
484- let metadata = fs:: metadata ( path) . map_err ( |err| err. to_pyexception ( vm) ) ?;
485- Ok ( metadata. is_file ( ) )
486- }
487-
488- #[ pyfunction]
489- fn _path_isdir ( path : OsPath , vm : & VirtualMachine ) -> PyResult < bool > {
490- let path = path. as_ref ( ) ;
491- if path. is_dir ( ) {
492- return Ok ( true ) ;
493- }
494- if path. exists ( ) {
495- return Ok ( false ) ;
496- }
497- let metadata = fs:: metadata ( path) . map_err ( |err| err. to_pyexception ( vm) ) ?;
498- Ok ( metadata. is_dir ( ) )
499- }
500-
501- #[ pyfunction]
502- fn _path_isfile ( path : OsPath , vm : & VirtualMachine ) -> PyResult < bool > {
503- let path = path. as_ref ( ) ;
504- if path. is_file ( ) {
505- return Ok ( true ) ;
506- }
507- if path. exists ( ) {
508- return Ok ( false ) ;
509- }
510- let metadata = fs:: metadata ( path) . map_err ( |err| err. to_pyexception ( vm) ) ?;
511- Ok ( metadata. is_file ( ) )
512- }
513-
514- #[ pyfunction]
515- fn _path_islink ( path : OsPath , vm : & VirtualMachine ) -> PyResult < bool > {
516- let path = path. as_ref ( ) ;
517- if path. is_symlink ( ) {
518- return Ok ( true ) ;
519- }
520- if path. exists ( ) {
521- return Ok ( false ) ;
522- }
523- let metadata = fs:: symlink_metadata ( path) . map_err ( |err| err. to_pyexception ( vm) ) ?;
524- Ok ( metadata. file_type ( ) . is_symlink ( ) )
525- }
526-
527- // End of functions that are not fully compatible with CPython
528-
529460 #[ pyfunction]
530461 fn set_handle_inheritable (
531462 handle : intptr_t ,
0 commit comments