docs: def _glob_dir(self, curdir, matcher, dir_only=False, deep=False):
          """Non recursive directory glob."""
  
          scandir = self.current if not curdir else curdir
  
          # Python will never return . or .., so fake it.
          if os.path.isdir(scandir) and matcher is not None:
              for special in self.specials:
                  if matcher(special):
                      yield os.path.join(curdir, special)
  
          try:
              if NO_SCANDIR_WORKAROUND:
                  # Our current directory can be empty if the path starts with magic,
                  # But we don't want to return paths with '.', so just use it to list
                  # files, but use '' when constructing the path.
                  with os.scandir(scandir) as scan:
                      for f in scan:
                          try:
                              # Quicker to just test this way than to run through `fnmatch`.
                              if deep and self._is_hidden(f.name):
                                  continue
                              path = os.path.join(curdir, f.name)
                              is_dir = f.is_dir()
                              if is_dir:
                                  is_link = f.is_symlink()
                                  self.symlinks[path] = is_link
                              else:
                                  # We don't care if a file is a link
                                  is_link = False
                              if deep and not self.follow_links and is_link:
                                  continue
                              if (not dir_only or is_dir) and (matcher is None or matcher(f.name)):
                                  yield path
                              if deep and is_dir:
                                  yield from self._glob_dir(path, matcher, dir_only, deep)
                          except OSError:  # pragma: no cover
                              pass
              else:
                  for f in os.listdir(scandir):
                      # Quicker to just test this way than to run through `fnmatch`.
                      if deep and self._is_hidden(f):
                          continue
                      path = os.path.join(curdir, f)
                      is_dir = os.path.isdir(path)
                      if is_dir:
                          is_link = os.path.islink(path)
                          self.symlinks[path] = is_link
                      else:
                          is_link = False
                      if deep and not self.follow_links and is_link:
                          continue
                      if (not dir_only or is_dir) and (matcher is None or matcher(f)):
                          yield path
                      if deep and is_dir:
                          yield from self._glob_dir(path, matcher, dir_only, deep)
          except OSError:  # pragma: no cover
              pass