Create a tomodir subdirectory structure in the given directory
547757
def create_tomodir(self, directory):
        
        pwd = os.getcwd()
        if not os.path.isdir(directory):
            os.makedirs(directory)
        os.chdir(directory)

        directories = (
            'config',
            'exe',
            'grid',
            'mod',
            'mod/pot',
            'mod/sens',
            'rho',
        )
        for directory in directories:
            if not os.path.isdir(directory):
                os.makedirs(directory)

        os.chdir(pwd)
1237973
def create_fpath_dir(self, fpath: str):
        """"""
        os.makedirs(os.path.dirname(fpath), exist_ok=True)
913509
def make_dir(self):
        """"""
        if not os.path.exists(self.dirname):
            os.makedirs(self.dirname)
996117
def from_subdir(cls, container, info_obj):
        """"""
        return cls(container,
                   info_obj['subdir'],
                   obj_type=cls.type_cls.SUBDIR)
695088
def build(content_directory=None, out_directory=None):
    """"""
    content_directory = content_directory or '.'
    out_directory = os.path.abspath(out_directory or default_out_directory)
    repo = require_repo(content_directory)

    # Prevent user mistakes
    if out_directory == '.':
        raise ValueError('Output directory must be different than the source directory: ' + repr(out_directory))
    if os.path.basename(os.path.relpath(out_directory, content_directory)) == '..':
        raise ValueError('Output directory must not contain the source directory: ' + repr(out_directory))

    # TODO: read config
    # TODO: use virtualenv
    # TODO: init and run plugins
    # TODO: process with active theme

    # Collect and copy static files
    files = presentation_files(repo)
    remove_directory(out_directory)
    copy_files(files, out_directory, repo)

    return out_directory
49773
def setup(api=None):
    
    global tmp_dir_object

    tmp_dir_object = tempfile.TemporaryDirectory()

    dir_name = tmp_dir_object.name

    dir_a = os.path.join(dir_name, "a")
    os.mkdir(dir_a)
    dir_b = os.path.join(dir_name, "b")
    os.mkdir(dir_b)

    # populate directory a with text files
    file_list = [
            ["hi.txt", """Hi World!"""],
            ["hi.html", """<strong>Hi World!</strong>"""],
            ["hello.html", """
                <img src='/static/b/smile.png'</img>
                pop-up
                <script src='/static/a/hi.js'></script>"""],
            ["hi.js", """alert('Hi World')""" ]
    ]

    for f in file_list:
        with open(os.path.join(dir_a, f[0]), mode="wt") as fo:
            fo.write(f[1])

    # populate directory b with binary file
    image = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\n\x00\x00\x00\n\x08\x02\x00\x00\x00\x02PX\xea\x00\x00\x006IDAT\x18\xd3c\xfc\xff\xff?\x03n\xc0\xc4\x80\x170100022222\xc2\x85\x90\xb9\x04t3\x92`7\xb2\x15D\xeb\xc6\xe34\xa8n4c\xe1F\x120\x1c\x00\xc6z\x12\x1c\x8cT\xf2\x1e\x00\x00\x00\x00IEND\xaeB`\x82'

    with open(os.path.join(dir_b, "smile.png"), mode="wb") as fo:
            fo.write(image)
569701
def set_dump_directory(base=None, sub_dir=None):
    """"""
    # Set current timestamp
    timestamp = datetime.fromtimestamp(time()).strftime('%Y-%m-%d %H-%M-%S')

    # Clean sub_dir
    if sub_dir and '.' in sub_dir:
        sub_dir = sub_dir.rsplit('.', 1)[0]

    # Create a directory to save fail SQL scripts
    # TODO: Replace with function that recursively creates directories until path exists
    if not os.path.exists(base):
        os.mkdir(base)
    dump_dir = os.path.join(base, sub_dir) if sub_dir else base
    if not os.path.exists(dump_dir):
        os.mkdir(dump_dir)
    dump_dir = os.path.join(dump_dir, timestamp)
    if not os.path.exists(dump_dir):
        os.mkdir(dump_dir)
        return dump_dir
1097332
def mkdir(path, recursive=True, **kwargs):
    """"""
    import os
    if recursive:
        os.makedirs(path, **kwargs)
    else:
        os.mkdir(path, **kwargs)
652266
def make_directory(self, directory_name, *args, **kwargs):
		
		self.dav_client().mkdir(self.join_path(self.session_path(), directory_name))
746408
def create_dir(directory):
    
    if not os.access(directory, os.F_OK):
        os.makedirs(directory)
    return os.path.abspath(directory)
370191
def gen_sub_directories
        super
        File.makedirs(MODULE_DIR)
        File.makedirs(NODE_DIR)
        File.makedirs(PLUGIN_DIR)
    rescue
        $stderr.puts $ERROR_INFO.message
        exit 1
    end
1048657
def create_tmpdir
      td = tls[:tmpdir]
      if td.nil?
        td = ::Dir.mktmpdir
        tls[:tmpdir] = td
        created = true
      else
        created = false
      end
      return [td, created]
    end
1193536
def save_to_tomodir(self, directory):
        
        self.create_tomodir(directory)

        self.grid.save_elem_file(
            directory + os.sep + 'grid/elem.dat'
        )

        self.grid.save_elec_file(
            directory + os.sep + 'grid/elec.dat'
        )

        # modeling
        if self.configs.configs is not None:
            self.configs.write_crmod_config(
                directory + os.sep + 'config/config.dat'
            )

        if self.assignments['forward_model'] is not None:
            self.parman.save_to_rho_file(
                directory + os.sep + 'rho/rho.dat',
                self.assignments['forward_model'][0],
                self.assignments['forward_model'][1],
            )

        self.crmod_cfg.write_to_file(
            directory + os.sep + 'exe/crmod.cfg'
        )

        if self.assignments['measurements'] is not None:
            self.configs.write_crmod_volt(
                directory + os.sep + 'mod/volt.dat',
                self.assignments['measurements']
            )

        if self.assignments['sensitivities'] is not None:
            self._save_sensitivities(
                directory + os.sep + 'mod/sens',
            )

        if self.assignments['potentials'] is not None:
            self._save_potentials(
                directory + os.sep + 'mod/pot',
            )

        # inversion
        self.crtomo_cfg.write_to_file(
            directory + os.sep + 'exe/crtomo.cfg'
        )

        if self.noise_model is not None:
            self.noise_model.write_crt_noisemod(
                directory + os.sep + 'exe/crt.noisemod'
            )

        if not os.path.isdir(directory + os.sep + 'inv'):
            os.makedirs(directory + os.sep + 'inv')
205173
def makedirs(path, mode=0o777, exist_ok=False):
    """"""
    os.makedirs(path, mode, exist_ok)
1152996
def mkdir(dir_path):
        # type: (AnyStr) -> None
        """"""
        if not os.path.isdir(dir_path) or not os.path.exists(dir_path):
            os.makedirs(dir_path)
740872
function createDirectory(directory) {
  if (!directory) {
    throw new Error('A directory must be passed to be created.');
  }
  const statObject = getStatObject(directory);
  if (statObject && statObject.isFile()) {
    throw new Error(`The directory to create '${directory}' is a file.`);
  }
  fse.ensureDirSync(directory);
}
1203195
function loadDir(dir, db, callback) {
    callback = callback || function() {};
    
    //Get the absolute dir path if a relative path was given
    if (dir.substr(0, 1) !== '/') {
        var parentPath = module.parent.filename.split('/');
        parentPath.pop();
        dir = parentPath.join('/') + '/' + dir;
    }
    
    //Load each file in directory
    fs.readdir(dir, function(err, files){
        if (err) return callback(err);
        
        var iterator = function(file, next){
            loadFile(dir + '/' + file, db, next);
        };
        async.forEach(files, iterator, callback);
    });
}