Check if any directory arguments contain hdfs://
181754
def _read_config_cl(self):
        ''' '''
        dirs_to_check = self.__get_all_directories()
        hosts, ports = [], []
        for path in dirs_to_check:
            if path.startswith('hdfs://'):
                parse_result = urlparse(path)
                hosts.append(parse_result.hostname)
                ports.append(parse_result.port)

        # remove duplicates and None from (hosts + self.args.namenode)
        hosts = filter(lambda x: x != None, set(hosts + [self.args.namenode]))
        if len(hosts) > 1:
            print_error_exit('Conficiting namenode hosts in commandline arguments, hosts: %s' % str(hosts))

        ports = filter(lambda x: x != None, set(ports + [self.args.port]))
        if len(ports) > 1:
            print_error_exit('Conflicting namenode ports in commandline arguments, ports: %s' % str(ports))

        # Store port from CL in arguments - CL port has the highest priority
        if len(ports) == 1:
            self.args.port = ports[0]

        # do we agree on one namenode?
        if len(hosts) == 1 and len(ports) <= 1:
            self.args.namenode = hosts[0]
            self.args.port = ports[0] if len(ports) == 1 else Namenode.DEFAULT_PORT
            self.namenodes.append(Namenode(self.args.namenode, self.args.port))
            # we got the info from CL -> check if use_trash is set - if not use default policy:
            if self.__usetrash_unset():
                self.args.usetrash = self.configs['use_trash']
            return True
        else:
            return False
347707
def contains_glob(path_to_directory, pattern, wanted=None):
    """"""
    if not path_to_directory:
        return False
    needed = make_needed(pattern, path_to_directory, wanted)
    for name in _names_in_directory(path_to_directory):
        if needed(name):
            return True
    return False
117917
private boolean folderContainsFiles(File folder) {
        if (folder != null) {
            File[] files = folder.listFiles();
            for (File file : files)
                if (file.isFile())
                    return true;
            for (File file : files)
                if (file.isDirectory())
                    if (folderContainsFiles(file))
                        return true;
        }
        return false;
    }
649341
def exists(self, path):
        

        cmd = load_hadoop_cmd() + ['fs', '-stat', path]
        logger.debug('Running file existence check: %s', subprocess.list2cmdline(cmd))
        p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True, universal_newlines=True)
        stdout, stderr = p.communicate()
        if p.returncode == 0:
            return True
        else:
            not_found_pattern = "^.*No such file or directory$"
            not_found_re = re.compile(not_found_pattern)
            for line in stderr.split('\n'):
                if not_found_re.match(line):
                    return False
            raise hdfs_error.HDFSCliError(cmd, p.returncode, stdout, stderr)
922267
def contains_parent_dir(fpath, dirs):
    
    # Note: this function is used nowhere in pygccxml but is used
    # at least by pypluplus; so it should stay here.

    return bool([x for x in dirs if _f(fpath, x)])
1352440
def exists(self, path):
        
        import hdfs
        try:
            self.client.status(path)
            return True
        except hdfs.util.HdfsError as e:
            if str(e).startswith('File does not exist: '):
                return False
            else:
                raise e
1276332
function(stat)
{
	if(stat)
	{
		if(stat.isDirectory)
		{
			return stat.isDirectory()
		}
		if(stat.type)
		{
			if(stat.type=="dir")
			{
				return true
			}
		}
	}
	return false
}
21445
def is_tomodir(subdirectories):
    
    required = (
        'exe',
        'config',
        'rho',
        'mod',
        'inv'
    )
    is_tomodir = True
    for subdir in required:
        if subdir not in subdirectories:
            is_tomodir = False
    return is_tomodir
130981
function isExist(dir) {
  dir = path.normalize(dir);
  try {
    fs.accessSync(dir, fs.R_OK);
    return true;
  } catch (e) {
    return false;
  }
}
865095
def isempty(path):
    
    cmd = "hadoop fs -test -z %s"
    p = _hadoop_fs_command(cmd % (path))
    p.communicate()
    rcode = p.returncode
    return bool(int(rcode == 0))
1219763
def dfs_absent(path):
    '''
    
    '''
    cmd_return = _hadoop_cmd('dfs', 'stat', path)
    match = 'No such file or directory'
    return True if match in cmd_return else False
375555
function isDirectory(filePath) {
  if (!isExist(filePath)) return false;
  try {
    const stat = fs.statSync(filePath);
    return stat.isDirectory();
  } catch (e) {
    return false;
  }
}
732954
def dfs(args=None, properties=None, hadoop_conf_dir=None):
    
    # run FsShell directly (avoids "hadoop dfs" deprecation)
    return run_class(
        "org.apache.hadoop.fs.FsShell", args, properties,
        hadoop_conf_dir=hadoop_conf_dir, keep_streams=True
    )
841550
def validate_args(args):
    
    if not os.path.isdir(args.directory):
        print "Directory {} does not exist".format(args.directory)
        sys.exit(5)
    return args
428967
def is_dir(dirname):
    ''''''
    if not os.path.isdir(dirname):
        msg = "{0} is not a directory".format(dirname)
        raise argparse.ArgumentTypeError(msg)
    else:
        return dirname
983152
def is_directory (self):
        
        filename = self.get_os_filename()
        return os.path.isdir(filename) and not os.path.islink(filename)
623
def _check_open_dir(self, fs, path, info):
        # type: (FS, Text, Info) -> bool
        
        if self.exclude_dirs is not None and fs.match(self.exclude_dirs, info.name):
            return False
        if self.filter_dirs is not None and not fs.match(self.filter_dirs, info.name):
            return False
        return self.check_open_dir(fs, path, info)