@@ -448,14 +448,8 @@ pub(crate) mod module {
448448 #[ pyfunction]
449449 fn listvolumes ( vm : & VirtualMachine ) -> PyResult < PyListRef > {
450450 let mut volumes = vec ! [ ] ;
451- let find;
452451 let mut buffer = [ 0u16 ; 257 ] ;
453- find = unsafe {
454- FileSystem :: FindFirstVolumeW (
455- buffer. as_mut_ptr ( ) ,
456- buffer. len ( ) as _ ,
457- )
458- } ;
452+ let find = unsafe { FileSystem :: FindFirstVolumeW ( buffer. as_mut_ptr ( ) , buffer. len ( ) as _ ) } ;
459453 if find == windows_sys:: Win32 :: Foundation :: INVALID_HANDLE_VALUE {
460454 return Err ( errno_err ( vm) ) ;
461455 }
@@ -468,11 +462,7 @@ pub(crate) mod module {
468462 }
469463 volumes. push ( s. to_string ( ) ) ;
470464 let ret = unsafe {
471- FileSystem :: FindNextVolumeW (
472- find,
473- buffer. as_mut_ptr ( ) ,
474- buffer. len ( ) as _ ,
475- )
465+ FileSystem :: FindNextVolumeW ( find, buffer. as_mut_ptr ( ) , buffer. len ( ) as _ )
476466 } ;
477467 if ret == 0 {
478468 err = std:: io:: Error :: last_os_error ( ) . raw_os_error ( ) . unwrap_or ( 0 ) ;
@@ -484,69 +474,10 @@ pub(crate) mod module {
484474 if err != 0 && err != windows_sys:: Win32 :: Foundation :: ERROR_NO_MORE_FILES as i32 {
485475 return Err ( std:: io:: Error :: from_raw_os_error ( err) . to_pyexception ( vm) ) ;
486476 }
487- let volumes: Vec < _ > = volumes
488- . into_iter ( )
489- . map ( |v| vm. new_pyobj ( v) )
490- . collect ( ) ;
477+ let volumes: Vec < _ > = volumes. into_iter ( ) . map ( |v| vm. new_pyobj ( v) ) . collect ( ) ;
491478 Ok ( vm. ctx . new_list ( volumes) )
492479 }
493480
494- // TOOD: these functions are not fully compataible with CPython
495- // they exist for some compatibility
496- #[ pyfunction]
497- fn _path_exists ( path : OsPath , vm : & VirtualMachine ) -> PyResult < bool > {
498- let path = path. as_ref ( ) ;
499- if path. exists ( ) {
500- return Ok ( true ) ;
501- }
502- if path. is_dir ( ) {
503- return Ok ( false ) ;
504- }
505- let metadata = fs:: metadata ( path) . map_err ( |err| err. to_pyexception ( vm) ) ?;
506- Ok ( metadata. is_file ( ) )
507- }
508-
509- #[ pyfunction]
510- fn _path_isdir ( path : OsPath , vm : & VirtualMachine ) -> PyResult < bool > {
511- let path = path. as_ref ( ) ;
512- if path. is_dir ( ) {
513- return Ok ( true ) ;
514- }
515- if path. exists ( ) {
516- return Ok ( false ) ;
517- }
518- let metadata = fs:: metadata ( path) . map_err ( |err| err. to_pyexception ( vm) ) ?;
519- Ok ( metadata. is_dir ( ) )
520- }
521-
522- #[ pyfunction]
523- fn _path_isfile ( path : OsPath , vm : & VirtualMachine ) -> PyResult < bool > {
524- let path = path. as_ref ( ) ;
525- if path. is_file ( ) {
526- return Ok ( true ) ;
527- }
528- if path. exists ( ) {
529- return Ok ( false ) ;
530- }
531- let metadata = fs:: metadata ( path) . map_err ( |err| err. to_pyexception ( vm) ) ?;
532- Ok ( metadata. is_file ( ) )
533- }
534-
535- #[ pyfunction]
536- fn _path_islink ( path : OsPath , vm : & VirtualMachine ) -> PyResult < bool > {
537- let path = path. as_ref ( ) ;
538- if path. is_symlink ( ) {
539- return Ok ( true ) ;
540- }
541- if path. exists ( ) {
542- return Ok ( false ) ;
543- }
544- let metadata = fs:: symlink_metadata ( path) . map_err ( |err| err. to_pyexception ( vm) ) ?;
545- Ok ( metadata. file_type ( ) . is_symlink ( ) )
546- }
547-
548- // End of functions that are not fully compatible with CPython
549-
550481 #[ pyfunction]
551482 fn set_handle_inheritable (
552483 handle : intptr_t ,
0 commit comments