dvc/fs/_callback.py
def wrap_and_branch(
        self, fn: "Callable", fs: "FileSystem" = None
    ) -> "Callable":
        """
        Wraps a function, and pass a new child callback to it.
        When the function completes, we increment the parent callback by 1.
        """
        from .local import localfs

        fs = fs or localfs
        wrapped = self.wrap_fn(fn)

        def make_callback(path1, path2):
            # pylint: disable=assignment-from-none
            child = self.branch(fs.path.name(path1), path2, {})
            return self.as_callback(child)

        @wraps(fn)
        def func(path1, path2, **kwargs):
            with make_callback(path1, path2) as callback:
                return wrapped(path1, path2, callback=callback, **kwargs)

        return func

        Wraps a function, and pass a new child callback to it.
        When the function completes, we increment the parent callback by 1.
        
Wraps a function, and pass a new child callback to it.
When the function completes, we increment the parent callback by 1.
Wraps a function and pass a new child callback to it . When the function completes we increment the parent callback by 1 .
def wrap_and_branch(
        self, fn: "Callable", fs: "FileSystem" = None
    ) -> "Callable":
        from .local import localfs
        fs = fs or localfs
        wrapped = self.wrap_fn(fn)
        def make_callback(path1, path2):
            child = self.branch(fs.path.name(path1), path2, {})
            return self.as_callback(child)
        @wraps(fn)
        def func(path1, path2, **kwargs):
            with make_callback(path1, path2) as callback:
                return wrapped(path1, path2, callback=callback, **kwargs)
        return func
def wrap_and_branch ( self , fn : "Callable" , fs : "FileSystem" = None ) -> "Callable" : from . local import localfs fs = fs or localfs wrapped = self . wrap_fn ( fn ) def make_callback ( path1 , path2 ) : child = self . branch ( fs . path . name ( path1 ) , path2 , { } ) return self . as_callback ( child ) @ wraps ( fn ) def func ( path1 , path2 , ** kwargs ) : with make_callback ( path1 , path2 ) as callback : return wrapped ( path1 , path2 , callback = callback , ** kwargs ) return func
Wraps a function, and pass a new child callback to it.
Wraps a function and pass a new child callback to it .
"""
        Wraps a function, and pass a new child callback to it.
        When the function completes, we increment the parent callback by 1.
        """ # pylint: disable=assignment-from-none
self
fn
"Callable"
fs
"FileSystem"