do_with_file_dups changed to more appropriate iter_file_dups.
This commit is contained in:
		
					parent
					
						
							
								e1c31080b5
							
						
					
				
			
			
				commit
				
					
						912678e835
					
				
			
		
					 3 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -26,7 +26,7 @@ Perform custom action
 | 
				
			||||||
.. code:: python
 | 
					.. code:: python
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    from sweeper import file_dups
 | 
					    from sweeper import file_dups
 | 
				
			||||||
    for files in do_with_file_dups(['images']):
 | 
					    for files in iter_file_dups(['images']):
 | 
				
			||||||
        for fname in files:
 | 
					        for fname in files:
 | 
				
			||||||
            print('found duplicte file with name: %s' % fname)
 | 
					            print('found duplicte file with name: %s' % fname)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
from __future__ import absolute_import
 | 
					from __future__ import absolute_import
 | 
				
			||||||
from .sweeper import file_dups
 | 
					from .sweeper import file_dups
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__all__ = ['file_dups', 'mv_file_dups', 'rm_file_dups', 'do_with_file_dups']
 | 
					__all__ = ['file_dups', 'mv_file_dups', 'rm_file_dups', 'iter_file_dups']
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,7 +25,7 @@ __version__ = '0.1.0'
 | 
				
			||||||
__license__ = 'GPLv3'
 | 
					__license__ = 'GPLv3'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__all__ = [
 | 
					__all__ = [
 | 
				
			||||||
    'file_dups', 'rm_file_dups', 'mv_file_dups', 'do_with_file_dups'
 | 
					    'file_dups', 'rm_file_dups', 'mv_file_dups', 'iter_file_dups'
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
| 
						 | 
					@ -101,7 +101,7 @@ def mv_file_dups(topdirs=['./'], hashalg='md5', block_size=4096, dest_dir='dups'
 | 
				
			||||||
                shutil.move(f, dest_dir)
 | 
					                shutil.move(f, dest_dir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def do_with_file_dups(topdirs=['./'], hashalg='md5', block_size=4096):
 | 
					def iter_file_dups(topdirs=['./'], hashalg='md5', block_size=4096):
 | 
				
			||||||
    """Yield list of duplicate files when found in specified directory list.
 | 
					    """Yield list of duplicate files when found in specified directory list.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    dups = file_dups(topdirs, hashalg, block_size)
 | 
					    dups = file_dups(topdirs, hashalg, block_size)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue