qcodes/data/io.py
def list(self, location, maxdepth=1, include_dirs=False):
        """
        Return all files that match location.

        This is either files whose names match up to an arbitrary extension,
        or any files within an exactly matching directory name.

        Args:
            location (str): the location to match.
                May contain the usual path wildcards * and ?

            maxdepth (Optional[int]): maximum levels of directory nesting to
                recurse into looking for files. Default 1.

            include_dirs (Optional[bool]): whether to allow directories in
                the results or just files. Default False.

        Returns:
            A list of matching files and/or directories, as locations
            relative to our base_location.
        """
        location = self._normalize_slashes(location)
        search_dir, pattern = os.path.split(location)
        path = self.to_path(search_dir)

        if not os.path.isdir(path):
            return []

        matches = [fn for fn in os.listdir(path) if fnmatch(fn, pattern + '*')]
        out = []

        for match in matches:
            matchpath = self.join(path, match)
            if os.path.isdir(matchpath) and fnmatch(match, pattern):
                if maxdepth > 0:
                    # exact directory match - walk down to maxdepth
                    for root, dirs, files in os.walk(matchpath, topdown=True):
                        depth = root[len(path):].count(os.path.sep)
                        if depth == maxdepth:
                            dirs[:] = []  # don't recurse any further

                        for fn in files + (dirs if include_dirs else []):
                            out.append(self.to_location(self.join(root, fn)))

                elif include_dirs:
                    out.append(self.join(search_dir, match))

            elif (os.path.isfile(matchpath) and
                  (fnmatch(match, pattern) or
                   fnmatch(os.path.splitext(match)[0], pattern))):
                # exact filename match, or match up to an extension
                # note that we need fnmatch(match, pattern) in addition to the
                # splitext test to cover the case of the base filename itself
                # containing a dot.
                out.append(self.join(search_dir, match))

        return out

        Return all files that match location.

        This is either files whose names match up to an arbitrary extension,
        or any files within an exactly matching directory name.

        Args:
            location (str): the location to match.
                May contain the usual path wildcards * and ?

            maxdepth (Optional[int]): maximum levels of directory nesting to
                recurse into looking for files. Default 1.

            include_dirs (Optional[bool]): whether to allow directories in
                the results or just files. Default False.

        Returns:
            A list of matching files and/or directories, as locations
            relative to our base_location.
        
Return all files that match location.
This is either files whose names match up to an arbitrary extension,
or any files within an exactly matching directory name.
Return all files that match location . This is either files whose names match up to an arbitrary extension or any files within an exactly matching directory name .
def list(self, location, maxdepth=1, include_dirs=False):
        location = self._normalize_slashes(location)
        search_dir, pattern = os.path.split(location)
        path = self.to_path(search_dir)
        if not os.path.isdir(path):
            return []
        matches = [fn for fn in os.listdir(path) if fnmatch(fn, pattern + '*')]
        out = []
        for match in matches:
            matchpath = self.join(path, match)
            if os.path.isdir(matchpath) and fnmatch(match, pattern):
                if maxdepth > 0:
                    for root, dirs, files in os.walk(matchpath, topdown=True):
                        depth = root[len(path):].count(os.path.sep)
                        if depth == maxdepth:
                            dirs[:] = []  
                        for fn in files + (dirs if include_dirs else []):
                            out.append(self.to_location(self.join(root, fn)))
                elif include_dirs:
                    out.append(self.join(search_dir, match))
            elif (os.path.isfile(matchpath) and
                  (fnmatch(match, pattern) or
                   fnmatch(os.path.splitext(match)[0], pattern))):
                out.append(self.join(search_dir, match))
        return out
def list ( self , location , maxdepth = 1 , include_dirs = False ) : location = self . _normalize_slashes ( location ) search_dir , pattern = os . path . split ( location ) path = self . to_path ( search_dir ) if not os . path . isdir ( path ) : return [ ] matches = [ fn for fn in os . listdir ( path ) if fnmatch ( fn , pattern + '*' ) ] out = [ ] for match in matches : matchpath = self . join ( path , match ) if os . path . isdir ( matchpath ) and fnmatch ( match , pattern ) : if maxdepth > 0 : for root , dirs , files in os . walk ( matchpath , topdown = True ) : depth = root [ len ( path ) : ] . count ( os . path . sep ) if depth == maxdepth : dirs [ : ] = [ ] for fn in files + ( dirs if include_dirs else [ ] ) : out . append ( self . to_location ( self . join ( root , fn ) ) ) elif include_dirs : out . append ( self . join ( search_dir , match ) ) elif ( os . path . isfile ( matchpath ) and ( fnmatch ( match , pattern ) or fnmatch ( os . path . splitext ( match ) [ 0 ] , pattern ) ) ) : out . append ( self . join ( search_dir , match ) ) return out
Return all files that match location.
Return all files that match location .
"""
        Return all files that match location.

        This is either files whose names match up to an arbitrary extension,
        or any files within an exactly matching directory name.

        Args:
            location (str): the location to match.
                May contain the usual path wildcards * and ?

            maxdepth (Optional[int]): maximum levels of directory nesting to
                recurse into looking for files. Default 1.

            include_dirs (Optional[bool]): whether to allow directories in
                the results or just files. Default False.

        Returns:
            A list of matching files and/or directories, as locations
            relative to our base_location.
        """ # exact directory match - walk down to maxdepth # don't recurse any further # exact filename match, or match up to an extension # note that we need fnmatch(match, pattern) in addition to the # splitext test to cover the case of the base filename itself # containing a dot.
A list of matching files and/or directories, as locations
relative to our base_location.
A list of matching files and / or directories as locations relative to our base_location .
self
location
the location to match.
the location to match .
maxdepth
maximum levels of directory nesting to
recurse into looking for files. Default 1.
maximum levels of directory nesting to recurse into looking for files . Default 1 .
include_dirs
whether to allow directories in
the results or just files. Default False.
whether to allow directories in the results or just files . Default False .