Perform all checks on the API's contained in `directory`.
197192
def main(directories):
    ''''''
    msg = 'Checking module "{}" from directory "{}" for coding errors.'
    api_checker = ApiChecker()
    resource_checker = ResourceChecker()
    errors = []
    modules = []
    for loader, mname, _ in pkgutil.walk_packages(directories):
        sys.path.append(os.path.abspath(loader.path))
        log.info(msg.format(mname, loader.path))
        modules.append(mname)
        import_module(mname)
    for api in Api:
        if api.__module__.split('.')[-1] not in modules:
            continue
        log.debug('Anlysing Api class: {}'.format(api.__name__))
        errors.extend(api_checker(api))
    for res in Resource:
        if res.__module__.split('.')[-1] not in modules:
            continue
        log.debug('Anlysing Resource class: {}'.format(res.__name__))
        errors.extend(resource_checker(res))
    else:
        log.info('All modules tested, no problem detected.')
    return errors
196879
def clean_all(ctx, dry_run=False):
    
    cleanup_dirs(ctx.clean_all.directories or [], dry_run=dry_run)
    cleanup_dirs(ctx.clean_all.extra_directories or [], dry_run=dry_run)
    cleanup_files(ctx.clean_all.files or [], dry_run=dry_run)
    cleanup_files(ctx.clean_all.extra_files or [], dry_run=dry_run)
    execute_cleanup_tasks(ctx, cleanup_all_tasks, dry_run=dry_run)
    clean(ctx, dry_run=dry_run)
390844
private void scanLibs(List<T> factories, String libDir) {
    LOG.info("Loading core jars from {}", libDir);
    List<File> files = new ArrayList<>();
    try (DirectoryStream<Path> stream =
        Files.newDirectoryStream(Paths.get(libDir), mExtensionPattern)) {
      for (Path entry : stream) {
        if (entry.toFile().isFile()) {
          files.add(entry.toFile());
        }
      }
    } catch (IOException e) {
      LOG.warn("Failed to load libs: {}", e.toString());
    }
    scan(files, factories);
  }
1161963
public static void checkValidDir(final File dir) {
        checkNotNull("dir", dir);
        if (!dir.exists()) {
            throw new IllegalArgumentException("The directory '" + dir + "' does not exist!");
        }
        if (!dir.isDirectory()) {
            throw new IllegalArgumentException("The name '" + dir + "' is not a directory!");
        }
    }
1005141
private function checkDir() : void
    {
        $dir = dirname($this->path);
        if (!is_dir($dir)) {
            if (file_exists($dir)) {
                throw new \RuntimeException($dir . ' exists and is not a directory.');
            }
            if (!@mkdir($dir, 0755, true)) {
                throw new \RuntimeException($dir . ' does not exist and could not be created.');
            }
        }
    }
1356187
def check_dirs():
    
    dirs = [MAIN_DIR, TEMP_DIR, DOWNLOAD_DIR, SAVESTAT_DIR]
    for directory in dirs:
        if directory.exists() and not directory.is_dir():
            raise FileExistsError(str(directory.resolve()) + " cannot be used as a directory.")
177671
def ensure_directory(path):
    """"""
    dirname = os.path.dirname(path)
    py31compat.makedirs(dirname, exist_ok=True)
951019
def _cli_check_data_dir(data_dir):
    ''''''

    if data_dir is None:
        return None

    data_dir = os.path.expanduser(data_dir)
    data_dir = os.path.expandvars(data_dir)
    if not os.path.isdir(data_dir):
        raise RuntimeError("Data directory '{}' does not exist or is not a directory".format(data_dir))
    if not os.path.isfile(os.path.join(data_dir, 'METADATA.json')):
        raise RuntimeError("Data directory '{}' does not contain a METADATA.json file".format(data_dir))

    return data_dir
535084
def ensure_dirs(filename):
    """"""
    dirname = os.path.dirname(filename)
    if dirname and not os.path.exists(dirname):
        os.makedirs(dirname)
896460
function mkdirs(dir) {
  return new Promise((resolve, reject) => {
    FS.ensureDir(dir, err => {
      err ? reject(err) : resolve(dir);
    })
  });
}
1367158
def enable_apis
      dir = "/app/apis/#{@project_name}/#{@scaffold_name}s/base_apis.rb"
      base_dir = "#{Dir.pwd}/app/apis/#{@project_name}/#{@scaffold_name}s"
      unless File.exists?(File.join(Dir.pwd,dir))
        FileUtils.mkdir base_dir unless File.exists?(base_dir)
        source = "#{@gem_path}/lib/modules/scaffold/base_apis.rb"
        FileUtils.cp(source,File.join(Dir.pwd,dir))
        config_apis
        $stdout.puts "\e[1;32m \tcreate\e[0m\t#{dir}"
        mount_apis
      end
    end
904616
function isValidDir(dir) {
    var fs = require("fs");
    try {
        return fs.statSync(dir).isDirectory();
    } catch (err) {
        return false;
    }
}
203563
function(dir, files){		
		fs.readdirSync(dir).forEach(function(file){
			try{
				var current = path.join(dir, file);
				var stat = fs.statSync(current);
				if (stat && stat.isDirectory()) {
					getAllFiles(current, files);
				}else {
				    files.push(current);
				}
			}catch(e){
				console.error(e);
			}
        });
	}
1297176
def run(self):
        """"""
        _check_directory(self.directory)

        with DirectoryContextManager(self.directory):
            process = subprocess.Popen(self.arguments, shell=self._shell, env=self.env)

            _, _ = process.communicate()

        returncode = process.returncode

        if returncode != 0 and not self._ignore_errors:
            raise CommandError(
                '"{0}" failed (err code {1})'.format(self.__repr__(), returncode)
            )
242205
public function checkFolders()
	{
		$dirHandle = opendir($this->getSourceFolder());

		if ($dirHandle === false)
		{
			$this->printTaskError('Can not open ' . $this->getSourceFolder() . ' for parsing');

			return false;
		}

		return true;
	}
587303
def _check_path(self):
        ""
        if not path.isdir(self._path or '/'):
            raise OSError('Path {!r} is not a directory'.format(self._path))
451561
private function checkDir($dir)
    {
        if (! $this->fs->exists($dir)) {
            $this->fs->mkdir($dir);
        }
    }