Generates the file view hierarchy, writing it to ``self.file_hierarchy_file``.
347077
def generateDirectoryView(self):
        '''
        
        '''
        file_view_stream = StringIO()

        for d in self.dirs:
            d.toHierarchy(False, 0, file_view_stream)

        # add potential missing files (not sure if this is possible though)
        missing = []
        for f in sorted(self.files):
            if not f.in_file_hierarchy:
                missing.append(f)

        found_missing = len(missing) > 0
        if found_missing:
            idx = 0
            last_missing_child = len(missing) - 1
            for m in missing:
                m.toHierarchy(False, 0, file_view_stream, idx == last_missing_child)
                idx += 1
        elif configs.createTreeView:
            # need to restart since there were no missing children found, otherwise the
            # last directory will not correctly have a lastChild
            file_view_stream.close()
            file_view_stream = StringIO()

            last_dir_index = len(self.dirs) - 1
            for idx in range(last_dir_index + 1):
                curr_d = self.dirs[idx]
                curr_d.toHierarchy(False, 0, file_view_stream, idx == last_dir_index)

        # extract the value from the stream and close it down
        file_view_string = file_view_stream.getvalue()
        file_view_stream.close()
        return file_view_string
148659
def generate_hiera_template
      ssh_key = Bebox::Project.public_ssh_key_from_file(self.project_root, self.name)
      project_name = Bebox::Project.shortname_from_file(self.project_root)
      Bebox::PROVISION_STEPS.each do |step|
        step_dir = Bebox::Provision.step_name(step)
        generate_file_from_template("#{templates_path}/puppet/#{step}/hiera/data/environment.yaml.erb", "#{self.project_root}/puppet/steps/#{step_dir}/hiera/data/#{self.name}.yaml", {step_dir: step_dir, ssh_key: ssh_key, project_name: project_name})
      end
    end
1191155
def loadedFilenames( self ):
        
        output = []
        for i in range(self.uiContentsTREE.topLevelItemCount()):
            item = self.uiContentsTREE.topLevelItem(i)
            output.append(nativestring(item.filepath()))
        return output
679749
def build_dir_tree(self, files):
        

        def helper(split_files):
            this_dir = {'files' : {}, 'dirs' : {}}
            dirs = defaultdict(list)

            for fle in split_files:
                index = fle[0]; fileinfo = fle[1]
                if len(index)  == 1:
                    fileinfo['path'] = index[0] # store only the file name instead of the whole path
                    this_dir['files'][fileinfo['path']] = fileinfo
                elif len(index) > 1:
                    dirs[index[0]].append((index[1:], fileinfo))

            for name,info in dirs.iteritems():
                this_dir['dirs'][name] = helper(info)
            return this_dir
        return helper([(name.split('/')[1:], file_info) for name, file_info in files.iteritems()])
1084116
def file_tree(start_path):
    
    nested_dirs = {}
    root_dir = start_path.rstrip(os.sep)
    start = root_dir.rfind(os.sep) + 1
    for path, dirs, files in os.walk(root_dir):
        folders = path[start:].split(os.sep)
        subdir = dict.fromkeys(files)
        parent = reduce(dict.get, folders[:-1], nested_dirs)
        parent[folders[-1]] = subdir
    return nested_dirs
958956
private void addViews(MpxjTreeNode parentNode, ProjectFile file)
   {
      for (View view : file.getViews())
      {
         final View v = view;
         MpxjTreeNode childNode = new MpxjTreeNode(view)
         {
            @Override public String toString()
            {
               return v.getName();
            }
         };
         parentNode.add(childNode);
      }
   }
66160
def _generator_file(self):
        """'"""
        for path in self.paths:
            if os.path.isfile(path):
                if isvalid(path, self.access, self.extensions,
                           minsize=self.minsize):
                    yield os.path.abspath(path)
            elif os.path.isdir(path):
                for root, _, fnames in self._walker(path):
                    yield from self._generator_rebase(fnames, root)
260111
def generate_model_file(filename, project, model, fields):
    """"""
    for field in fields:
        field.type = field.__class__.__name__

    content = open(os.path.join(os.path.dirname(__file__), 'templates/model_page.html'), 'r').read()

    engine = StatikTemplateEngine(project)
    template = engine.create_template(content)

    # create context and update from project.config
    context = {'model': model,
                'fields': fields}
    context.update(dict(project.config.context_static))
    string = template.render(context)

    with open(filename, 'w') as file:
        file.write(string)
1226633
def __generate_file(self, file_path):
        
        file_path = os.path.expanduser(file_path)
        if not os.path.exists(os.path.dirname(file_path)):
            self.logger.debug("Directories missing! Creating directories for %s..." % file_path)
            os.makedirs(os.path.dirname(file_path))
        if not os.path.exists(file_path):
            open(file_path, "w+").close()
        return file_path
269395
def make_file_system_tree(root_folder, _parent=None):
    
    root_node = Node(os.path.basename(root_folder), _parent)
    root_node.path = root_folder
    for item in os.listdir(root_folder):
        item_path = os.path.join(root_folder, item)
        if os.path.isfile(item_path):
            file_node = Node(os.path.basename(item), root_node)
            file_node.path = item_path
        elif os.path.isdir(item_path):
            #folder_path = os.path.join(root_folder, item)
            make_file_system_tree(item_path, _parent=root_node)
    return root_node
571045
def _next_file_gen(self, root):
    
    for e in root.getiterator(common._T_CONTENTS):
      st_ctime, size, etag, key = None, None, None, None
      for child in e.getiterator('*'):
        if child.tag == common._T_LAST_MODIFIED:
          st_ctime = common.dt_str_to_posix(child.text)
        elif child.tag == common._T_ETAG:
          etag = child.text
        elif child.tag == common._T_SIZE:
          size = child.text
        elif child.tag == common._T_KEY:
          key = child.text
      yield common.GCSFileStat(self._path + '/' + key,
                               size, etag, st_ctime)
      e.clear()
    yield None
1211301
def _view(self, filepath, format):
        """"""
        methodnames = [
            '_view_%s_%s' % (format, backend.PLATFORM),
            '_view_%s' % backend.PLATFORM,
        ]
        for name in methodnames:
            view_method = getattr(self, name, None)
            if view_method is not None:
                break
        else:
            raise RuntimeError('%r has no built-in viewer support for %r '
                'on %r platform' % (self.__class__, format, backend.PLATFORM))
        view_method(filepath)
1271578
protected function exportViews()
    {
        foreach ($this->views as $key => $value) {
            $path = base_path('resources/views/'.$value);

            $this->line('<info>Created View:</info> '.$path);

            copy(__DIR__.'/stubs/make/views/'.$key, $path);
        }
    }
404297
def display(self, filename=None):
        """"""

        if filename is None:
            filename = self.original_filename

        # write to a (by default temporary) file
        with open(filename, 'w') as output_svg:
            output_svg.write(etree.tostring(self.tree.getroot()))

        open_in_browser(filename)
1154874
def generate_files!
      # iterate through the templates in reverse, so files in the templates
      # loaded last override the previously templates.
      @templates.reverse_each do |template|
        # copy in the static files first
        template.each_file(@markup) do |dest,file|
          generate_file dest, file
        end

        # then render the templates
        template.each_template(@markup) do |dest,file|
          generate_file dest, file, template: true
        end
      end

      @generated_files.each_value do |path|
        dir = path.split(File::SEPARATOR,2).first

        if dir == 'bin'
          chmod path, 0755
        end
      end
    end
1259083
def __gen_struct_anno_files(self, top_level_layer):
        
        paula_id = '{0}.{1}.{2}_{3}_struct'.format(top_level_layer,
                                               self.corpus_name, self.name,
                                               top_level_layer)
        E, tree = gen_paula_etree(paula_id)

        base_paula_id = self.paulamap['hierarchy'][top_level_layer]
        mflist = E('multiFeatList',
                   {XMLBASE: base_paula_id+'.xml'})

        for node_id in select_nodes_by_layer(self.dg, top_level_layer):
            if not istoken(self.dg, node_id):
                mfeat = E('multiFeat',
                          {XLINKHREF: '#{0}'.format(node_id)})
                node_dict = self.dg.node[node_id]
                for attr in node_dict:
                    if attr not in IGNORED_NODE_ATTRIBS:
                        mfeat.append(
                            E('feat',
                              {'name': attr, 'value': node_dict[attr]}))
                if self.human_readable:  # adds node label as a <!--comment-->
                    mfeat.append(Comment(node_dict.get('label')))
                mflist.append(mfeat)
        tree.append(mflist)
        self.files[paula_id] = tree
        self.file2dtd[paula_id] = PaulaDTDs.multifeat
        return paula_id
1162396
def _to_textfile(self, file_generator):
        
        to_path = file_generator.to_path \
            if file_generator.to_path.endswith(file_generator.file_extension[file_generator.to_format]) \
            else file_generator.to_path + file_generator.file_extension[file_generator.to_format]

        with open(to_path, mode="w") as outfile:
            for f in file_generator:
                outfile.write(f.writestr(file_generator.to_format))