fetch items under a folder
323716
function renderItemsByFolderId(id) {
        resourceDetail.hide();
        resourcesList.show();
        folderId = id;
        urls["getResources"] = urls["getResources"] || getURL("getResources");
        var options = {
            url: urls["getResources"] + '/' + id,
            data: {mode: "exclusive"},
            success: function (data) {
                resourcesList.html(data);

                renderActionButtons();
                var items = resourcesList.find("li");
                items.click(handleItemClick);
            }
        };
        Rocket.ajax(options);
    }
1162938
def fetch(self):
        
        if self.data.type == self._manager.FOLDER_TYPE:
            raise YagocdException("Can't fetch folder <{}>, only file!".format(self._path))

        response = self._session.get(self.data.url)
        return response.content
408773
function getFiles(dir) {
    var files = [];

    var traverse = function (dir) {
        var dirList = dir.listFiles();
        dirList.forEach(function (file) {
            if (/\.css$/.test(file)) {
                files.push(file);
            } else if (file.isDirectory()) {
                traverse(file);
            }
        });
    };

    traverse(dir);

    return files;
}
1197019
private function getContent(): void
    {
        foreach ($this->files as $item) {

            if (is_file($item)) {
                $this->readFileContent($item);
            }

            if (is_dir($item)) {
                $this->readDirectoryContent($item);
            }
        }
    }
1314598
def get_folder_list(folder='.'):
    
    dir_list = get_content_list(folder)
    return [f for f in dir_list if not os.path.isfile(os.path.join(folder, f))]
323444
function getDirectories (basePath, includeFiles, userSuppliedFilterFn) {

  var items;
  try {
    items = fs.readdirSync(basePath);
  }
  catch (err) {

    // probably a file not a dir, but let's check error message to be sure
    if (includeFiles && String(err.stack).match(/ENOTDIR/)) {
      return [ basePath ];
    }

    // something is wrong, perhaps directory read permissions problem
    // maybe throw err instead
    console.error(err.stack);
    return [];
  }

  return items.filter(function (file) {

    var absPath = path.join(basePath, file);

    var stats = fs.lstatSync(absPath);
    if (stats.isSymbolicLink()) {
      return false;
    }

    var isDir = includeFiles ? true : stats.isDirectory();
    var isNotDotFile = path.basename(file).indexOf('.') !== 0;
    return isDir && isNotDotFile && (userSuppliedFilterFn || allOK)(absPath);

  })
  .map(function (item) {
    // return path.join(basePath, item);
    return item;
  })
  .sort();
}
495715
def _get_sub_dirs(parent):
    """"""
    return [child for child in os.listdir(parent) if os.path.isdir(os.path.join(parent, child))]
88915
def _list(self, foldername="INBOX", reverse=False, since=None):
        
        folder = self.folder \
            if foldername == "INBOX" \
            else self._getfolder(foldername)

        def sortcmp(d):
            try:
                return d[1].date
            except:
                return -1

        lst = folder.items() if not since else folder.items_since(since)
        sorted_lst = sorted(lst, key=sortcmp, reverse=1 if reverse else 0)
        itemlist = [(folder, key, msg) for key,msg in sorted_lst]
        return itemlist
792239
def collect_results(working_folder):
    
    results = {} 
    working_folder = Path(working_folder)
    output_folders = working_folder/'output_folders'

    for rec_name in os.listdir(output_folders):
        if not os.path.isdir(output_folders / rec_name):
            continue
        # print(rec_name)
        results[rec_name] = {}
        for sorter_name in os.listdir(output_folders / rec_name):
            # print('  ', sorter_name)
            output_folder = output_folders / rec_name / sorter_name
            #~ print(output_folder)
            if not os.path.isdir(output_folder):
                continue
            SorterClass = sorter_dict[sorter_name]
            results[rec_name][sorter_name] = SorterClass.get_result_from_folder(output_folder)

    return results
689351
private function load_folder_items( $uid, $path ) {
		$items = array();
		while ( true ) {
			$item = readdir( $uid );
			if ( false === $item ) {
				break;
			}
			if ( substr( $item, 0, 1 ) !== '.' ) {
				$items[ $item ] = $path . $item;
			}
		}
		closedir( $uid );
		return $items;
	}
590931
def get_item_data(self, item):
        """"""
        filename, line_number_str = get_item_user_text(item).split(self.SEP)
        return filename, int(line_number_str)
813558
function getItemsFromList(list, itemsToGet) {
    var result = [];

    _.each(list, function (item) {
        for (var i = 0; i < itemsToGet.length; i++) {
            if (item.indexOf(itemsToGet[i]) === 0) {
                result.push(item);
            }
        }
    });

    return result;
}
1094427
def folderitem(self, obj, item, index):
        
        url = item.get("url")
        title = item.get("Title")

        item["getDownFrom"] = self.localize_date(obj.getDownFrom())
        item["getDownTo"] = self.localize_date(obj.getDownTo())
        item["getValidator"] = obj.getValidator()
        item["replace"]["Title"] = get_link(url, value=title)

        # validation with the most remaining days
        if obj == self.latest_validation:
            item["state_class"] = "state-published"
        # running validations
        elif obj in self.active_validations:
            item["state_class"] = "state-active"
        # inactive validations
        else:
            item["state_class"] = "state-inactive"

        return item
703664
function filteredFiles(folder, pattern) {
  var files = [];
    
  if (fs.existsSync(folder)){
    fs.readdirSync(folder).forEach(function(file) {
      if (file.match(pattern) != null)
        files.push(file);
    });
  }
  return files;
}
1069305
def _get_things(self, method, thing, thing_type, params=None, cacheable=True):
        """"""

        limit = params.get("limit", 1)
        seq = []
        for node in _collect_nodes(
            limit, self, self.ws_prefix + "." + method, cacheable, params
        ):
            title = _extract(node, "name")
            artist = _extract(node, "name", 1)
            playcount = _number(_extract(node, "playcount"))

            seq.append(TopItem(thing_type(artist, title, self.network), playcount))

        return seq
211572
def _fetch_templates(src):
    '''
    
    '''
    templates = []
    log.debug('Listing contents of %s', src)
    for item in os.listdir(src):
        s = os.path.join(src, item)
        if os.path.isdir(s):
            template_path = os.path.join(s, TEMPLATE_FILE_NAME)
            if os.path.isfile(template_path):
                templates.append(_get_template(template_path, item))
            else:
                log.debug("Directory does not contain %s %s", template_path,
                          TEMPLATE_FILE_NAME)
    return templates
212448
def fetch_items(self):
        
        offset = self.per_page * (self.page - 1)
        items = self._query.limit(self.per_page).offset(offset).all()
        return items