Context handler to temporarily switch directories.

    Args:
        __path: Directory to change to

    Yields:
        Execution context in ``path``
338978
def chdir(__path: str) -> ContextManager:
    
    old = os.getcwd()
    try:
        os.chdir(__path)
        yield
    finally:
        os.chdir(old)
823286
function (pluginName, env, path) {
    var self = this;
    var context = {
      status: this.status.bind(this),
      out: this.out.bind(this),

      comment: function (text) {
        self.comment(text, pluginName);
      },

      cmd: function (cmd, next) {
        if (typeof(cmd) === 'string' || cmd.command) {
          cmd = {cmd: cmd};
        }

        cmd.env = _.extend({}, env, {
          PATH: getPath(path),
          HOME: process.env.HOME || (process.env.HOMEDRIVE + process.env.HOMEPATH),
          LANG: process.env.LANG,
          SSH_AUTH_SOCK: process.env.SSH_AUTH_SOCK,
          PAAS_NAME: 'strider'
        }, cmd.env || {});

        return self.cmd(cmd, pluginName, next);
      },

      // update pluginData
      data: function (data, method, path) {
        self.status('plugin-data', {
          plugin: pluginName,
          data: data,
          method: method,
          path: path
        });
      },

      dataDir: this.config.dataDir,
      baseDir: this.config.baseDir,
      cacheDir: this.config.cacheDir,
      cachier: this.config.cachier(pluginName),
      io: this.io,

      plugin: pluginName,
      phase: this.phase,
      job: this.job,
      branch: this.job.ref.branch,
      project: this.project,

      runnerId: (
        this.config.branchConfig
        && this.config.branchConfig.runner
        && this.config.branchConfig.runner.id || 'unkown'
      )
    };

    return context;
  }
792153
def isdir(self, path):
        
        try:
            self.remote_context.check_output(["test", "-d", path])
        except subprocess.CalledProcessError as e:
            if e.returncode == 1:
                return False
            else:
                raise
        return True
641527
def mkdir_parents(path):
    

    try:
        os.makedirs(path)
    except OSError as exc:
        if exc.errno == errno.EEXIST:
            pass
        else:
            raise
417324
def create_directory(self, path):
        
        _complain_ifclosed(self.closed)
        return self.fs.create_directory(path)
303568
def ensure_dir(path):
    
    os.makedirs(os.path.abspath(os.path.dirname(path)), exist_ok=True)
781630
def walk_up_dirs(path):
    """"""
    prev_path = None
    current_path = os.path.abspath(path)
    while current_path != prev_path:
        yield current_path
        prev_path = current_path
        current_path = os.path.dirname(prev_path)
793866
def with_path(self, path):
        
        new_command = copy.deepcopy(self)
        new_command._paths.append(str(path))
        return new_command
1264401
def mkdir(name, path):
    '''
    '''
    with Session() as session:
        try:
            session.VFolder(name).mkdir(path)
            print_done('Done.')
        except Exception as e:
            print_error(e)
            sys.exit(1)
664331
def mkdir_p(path_to_dir):
    
    try:
        os.makedirs(path_to_dir)
    except OSError as e:  # Python >2.5
        if e.errno == EEXIST and os.path.isdir(path_to_dir):
            logger.debug(
                "Directory %s already exists. Skipping." % path_to_dir)
        else:
            raise e
144069
def mkdir(path, recursive=True):
    
    if os.path.exists(path):
        return True
    try:
        if recursive:
            os.makedirs(path)
        else:
            os.mkdir(path)
    except OSError as error:
        log.error('mkdir: execute failed: %s (%s)' % (path, error))
        return False
    return True
633322
def mkdir(*args):
    
    path = ''
    for chunk in args:
        path = os.path.join(path, chunk)
        if not os.path.isdir(path):
            os.mkdir(path)
    return path
956508
def chdir(path: str) -> Iterator[None]:
    
    curdir = os.getcwd()
    os.chdir(path)
    try:
        yield
    finally:
        os.chdir(curdir)
605171
def chdir(self,
	          path,
	          timeout=shutit_global.shutit_global_object.default_timeout,
	          note=None,
	          loglevel=logging.DEBUG):
		
		shutit = self.shutit
		shutit.handle_note(note, 'Changing to path: ' + path)
		shutit.log('Changing directory to path: "' + path + '"', level=logging.DEBUG)
		if shutit.build['delivery'] in ('bash','dockerfile'):
			self.send(ShutItSendSpec(self,
			                         send=' command cd "' + path + '"',
			                         timeout=timeout,
			                         echo=False,
			                         loglevel=loglevel))
		elif shutit.build['delivery'] in ('docker',):
			os.chdir(path)
		else:
			shutit.fail('chdir not supported for delivery method: ' + str(shutit.build['delivery'])) # pragma: no cover
		shutit.handle_note_after(note=note)
		return True
985741
def make_dirs(path):
        
        try:
            os.makedirs(os.path.dirname(path))
        except OSError as err:
            if err.errno != errno.EEXIST:
                LOGGER.error('Failed to create directory %s with error: %s' % (path, str(err)))
                raise
869089
public static String adjustToRelativeDirectoryContext(final String path) {
        // Return nulls
        if (path == null) {
            return path;
        }

        // Strip absolute form
        final String removedPrefix = optionallyRemovePrecedingSlash(path);
        // Add end of context slash
        final String addedPostfix = optionallyAppendSlash(removedPrefix);

        // Return
        return addedPostfix;
    }
22439
def mkdir(path):
    
    try:
        os.makedirs(path)
        # sanity check
        if not os.path.isdir(path):  # pragma: no cover
            raise IOError('path is not a directory')
    except OSError as e:
        # EEXIST
        if e.errno == 17 and os.path.isdir(path):
            return
        raise