Test whether the directory cwd is contained in a bazaar repository.
965736
def using_bzr(cwd):
    """"""
    try:
        bzr_log = shell_out(["bzr", "log"], cwd=cwd)
        return True
    except (CalledProcessError, OSError):
        return False
615192
def is_dir(self):
        
        try:
            return S_ISDIR(self.stat().st_mode)
        except OSError as e:
            if e.errno not in (ENOENT, ENOTDIR):
                raise
            # Path doesn't exist or is a broken symlink
            # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
            return False
1275216
def is_train_dir(dir_: str) -> bool:
    """"""
    return path.exists(path.join(dir_, CXF_CONFIG_FILE)) and \
           path.exists(path.join(dir_, CXF_TRACE_FILE)) and \
           path.exists(path.join(dir_, CXF_LOG_FILE))
309992
def in_project_directory() -> bool:
    
    current_directory = os.path.realpath(os.curdir)
    project_path = os.path.join(current_directory, 'cauldron.json')
    return os.path.exists(project_path) and os.path.isfile(project_path)
157494
public function setCwd($cwd)
    {
        $this->hasCheckout = false;
        $this->hasClone = false;
        $this->isTemporary = false;

        if (is_null($cwd)) {
            $this->cwd = sys_get_temp_dir() . '/' . uniqid('git');

            // ensure the working directory exists (needed on windows)
            if (!is_dir($this->cwd)) {
                mkdir($this->cwd);
            }

            $this->isTemporary = true;
        } else {
            if (is_dir($cwd)) {
                if (is_dir($cwd . '/.git')) {
                    $this->hasClone = true;
                }
            }
            $this->cwd = $cwd;
        }

        return $this;
    }
243850
def is_path_creatable(pathname: str) -> bool:
    
    # Parent directory of the passed path. If empty, we substitute the current
    # working directory (CWD) instead.
    dirname = os.path.dirname(pathname) or os.getcwd()
    return os.access(dirname, os.W_OK)
1240851
def is_directory(self):
        
        if self.cid is None:
            msg = 'Cannot determine whether this task is a directory.'
            if not self.is_transferred:
                msg += ' This task has not been transferred.'
            raise TaskError(msg)
        return self.api.downloads_directory.cid != self.cid
701327
def verify_directory(dir):
    """"""

    tries = 0

    while not os.path.exists(dir):
        try:
            tries += 1
            os.makedirs(dir, compat.octal("0775"))
        except:
            if tries > 5:
                raise
1298620
def dir_is_glotk(path):
    """"""
    test_set = set(["gloTK_info", "gloTK_assemblies",
                    "gloTK_configs", "gloTK_reads",
                    "gloTK_fastqc", "gloTK_kmer",
                    "gloTK_reports"])
    #http://stackoverflow.com/questions/11968976/
    files = set([f for f in os.listdir('.') if os.path.isdir(f)])
    intersection = test_set.intersection(files)
    if len(intersection) > 0:
        return True
    else:
        return False
209184
def is_dir_url(link):
    # type: (Link) -> bool
    
    link_path = url_to_path(link.url_without_fragment)
    return os.path.isdir(link_path)
800227
def is_in_pythonpath(self, dirname):
        """"""
        return fixpath(dirname) in [fixpath(_p) for _p in self.pythonpath]
850292
def isproject(path):
    

    try:
        if os.path.basename(path)[0] in (".", "_"):
            return False
        if not os.path.isdir(path):
            return False
        if not any(fname in os.listdir(path)
                   for fname in ("templates.yaml",
                                 "inventory.yaml")):
            return False
    except:
        return False

    return True
709640
def groot(path=''):
    ""

    def check_filelist(l):
        if ('README.md' in l) or ('README' in l):
            return True
        else:
            return False

    import os, copy
    cwd = os.getcwd()  # initial dir
    cwd0 = copy.copy(cwd)
    cwd_init = copy.copy(cwd)

    found = False
    sysroot = False

    while not found and not sysroot:
        found = check_filelist(os.listdir())
        if not found:
            os.chdir(os.path.join(cwd, os.pardir))
            cwd = os.getcwd()
            if cwd == cwd0:
                sysroot = True
            else:
                cwd0 = cwd
        else:
            os.chdir(os.path.join(cwd0, path))

    if sysroot:
        os.chdir(cwd_init)
        raise Exception("Root directory not found.")
890375
function(directory) {
    if (!this.packageJSONFinder) {
      this.packageJSONFinder = new FileFinder(PACKAGE_FILENAME);
    }

    return this.packageJSONFinder.findInDirectoryOrParentsSync(directory || process.cwd());
  }
1288831
def directory_is_present(self, directory_path):
        
        p = self.p(directory_path)
        if not os.path.exists(p):
            return False
        if not os.path.isdir(p):
            raise IOError("%s is not a directory" % directory_path)
        return True
707023
def contains(bank, key, cachedir):
    '''
    
    '''
    if key is None:
        base = os.path.join(cachedir, os.path.normpath(bank))
        return os.path.isdir(base)
    else:
        keyfile = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key))
        return os.path.isfile(keyfile)
873062
def chdir(self, directory_path, make=False):
        """"""
        if os.sep in directory_path:
            for directory in directory_path.split(os.sep):
                if make and not self.directory_exists(directory):
                    try:
                        self.session.mkd(directory)
                    except ftplib.error_perm:
                        # Directory already exists
                        pass
                self.session.cwd(directory)
        else:
            self.session.cwd(directory_path)