Change directory. It behaves like "cd directory".
2347
def cd(cls, directory):
        """"""
        Log.debug('CMD: cd {0}'.format(directory))
        os.chdir(directory)
1187667
def _ensure_directory(path):
    """"""
    dirname = os.path.dirname(path)
    if not os.path.isdir(dirname):
        os.makedirs(dirname)
714198
def select_directory(self):
        """"""
        basedir = to_text_string(self.wd_edit.text())
        if not osp.isdir(basedir):
            basedir = getcwd_or_home()
        directory = getexistingdirectory(self, _(""), basedir)
        if directory:
            self.wd_edit.setText(directory)
            self.dir = directory
1128488
public void setDir(String dir)
    {
        _spanState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, HtmlConstants.DIR, dir);
    }
177671
def ensure_directory(path):
    """"""
    dirname = os.path.dirname(path)
    py31compat.makedirs(dirname, exist_ok=True)
64176
def ensure_dir(path):
    """"""
    if not (os.path.exists(path) and
            os.path.isdir(path)):
        os.mkdir(path)
1237638
def make_directory(directory):
    
    if not os.path.isdir(directory):
        os.mkdir(directory)
        logger.info('Path {} not found, I will create it.'
                    .format(directory))
913509
def make_dir(self):
        """"""
        if not os.path.exists(self.dirname):
            os.makedirs(self.dirname)
1042261
def create_directory(self, filename):
        """"""
        path = os.path.join(self.path, filename)
        makedirs(path)
        return path
918864
def replace_in_dirs(version):
    """"""
    print(color(
        "Upgrading directory-components dependency in all repos...",
        fg='blue', style='bold'))
    for dirname in Utils.dirs:
        replace = "directory-components=={}".format(version)
        replace_in_files(dirname, replace)
    done(version)
794525
def cd(path, on=os):
    
    
    original = on.getcwd()
    on.chdir(path)
    
    yield
    
    on.chdir(original)
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)
1094726
def cd(path):
    ''''''
    old_dir = os.getcwd()
    try:
        os.makedirs(path)
    except OSError:
        pass
    os.chdir(path)
    try:
        yield
    finally:
        os.chdir(old_dir)
974990
def setup_dir(self):
        """"""
        cd = self.opts.cd or self.config['crony'].get('directory')
        if cd:
            self.logger.debug(f'Adding cd to {cd}')
            self.cmd = f'cd {cd} && {self.cmd}'
1097332
def mkdir(path, recursive=True, **kwargs):
    """"""
    import os
    if recursive:
        os.makedirs(path, **kwargs)
    else:
        os.mkdir(path, **kwargs)
1038163
def replace_folder(path):
    """"""
    if os.path.exists(path):
        shutil.rmtree(path)
        os.makedirs(path)
    else:
        os.makedirs(path)
386961
def set_outdir(self):
        """"""
        dirname = self.w.outdir.get_text()
        if os.path.isdir(dirname):
            self.outdir = dirname
            self.logger.debug('Output directory set to {0}'.format(self.outdir))
        else:
            self.w.outdir.set_text(self.outdir)
            self.logger.error('{0} is not a directory'.format(dirname))