[PATCH 2/8] Re: Improve repo.Base.py:syncfoldersto parameter/var names

Nicolas Sebrecht nicolas.s-dev at laposte.net
Sat Sep 3 13:42:46 BST 2011


On Mon, Aug 29, 2011 at 04:00:11PM +0200, Sebastian Spaeth wrote:

> diff --git a/offlineimap/repository/Base.py b/offlineimap/repository/Base.py
> index f96a33d..184bc9a 100644
> --- a/offlineimap/repository/Base.py
> +++ b/offlineimap/repository/Base.py
> @@ -114,36 +114,32 @@ class BaseRepository(object, CustomConfig.ConfigHelperMixin):
>      def getfolder(self, foldername):
>          raise NotImplementedError
>      
> -    def syncfoldersto(self, dest, status):
> +    def syncfoldersto(self, dst_repo, status_repo):
>          """Syncs the folders in this repository to those in dest.
> -        It does NOT sync the contents of those folders.
>  
> -        Whenever makefolder() is called, also call makefolder() on status
> -        folder."""
> -        src = self
> -        srcfolders = src.getfolders()
> -        destfolders = dest.getfolders()
> +        It does NOT sync the contents of those folders."""
> +        src_repo = self
> +        src_folders = src_repo.getfolders()
> +        dst_folders = dst_repo.getfolders()
>  
>          # Create hashes with the names, but convert the source folders
>          # to the dest folder's sep.
> -
> -        srchash = {}
> -        for folder in srcfolders:
> -            srchash[folder.getvisiblename().replace(src.getsep(), dest.getsep())] = \
> -                                                           folder
> -        desthash = {}
> -        for folder in destfolders:
> -            desthash[folder.getvisiblename()] = folder
> +        src_hash = {}
> +        for folder in src_folders:
> +            src_hash[folder.getvisiblename().replace(
> +                    src_repo.getsep(), dst_repo.getsep())] = folder
> +        dst_hash = {}
> +        for folder in dst_folders:
> +            dst_hash[folder.getvisiblename()] = folder

Nitpick : the pythonic name for a hash is more dict. It should be
'dst_dict' and 'src_dict', I think. Anyway, looks good to me. Will
merge.

-- 
Nicolas Sebrecht




More information about the OfflineIMAP-project mailing list