Gets an array (not necessarily ordered) of FileStatus objects currently available for the given Segment.
These must be in the format specified by NAME_FORMAT (see EXAMPLE_NAME_FORMAT).
762754
private FileStatus[] findAllRaw(String segmentName) throws IOException {
        assert segmentName != null && segmentName.length() > 0 : "segmentName must be non-null and non-empty";
        String pattern = String.format(NAME_FORMAT, getPathPrefix(segmentName), SUFFIX_GLOB_REGEX);
        FileStatus[] files = this.fileSystem.globStatus(new Path(pattern));

        if (files.length > 1) {
            throw new IllegalArgumentException("More than one file");
        }
        return files;
    }
348680
private Iterable<Segment> getCompactableSegments(Storage storage, SegmentManager manager) {
    List<Segment> segments = new ArrayList<>(manager.segments().size());
    Iterator<Segment> iterator = manager.segments().iterator();
    Segment segment = iterator.next();
    while (iterator.hasNext()) {
      Segment nextSegment = iterator.next();

      // Segments that have already been compacted are eligible for compaction. For uncompacted segments, the segment must be full, consist
      // of entries less than the minorIndex, and a later segment with at least one committed entry must exist in the log. This ensures that
      // a non-empty entry always remains at the end of the log.
      if (segment.isCompacted() || (segment.isFull() && segment.lastIndex() < compactor.minorIndex() && nextSegment.firstIndex() <= manager.commitIndex() && !nextSegment.isEmpty())) {
        // Calculate the percentage of entries that have been released in the segment.
        double compactablePercentage = segment.releaseCount() / (double) segment.count();

        // If the percentage of entries released times the segment version meets the compaction threshold,
        // add the segment to the segments list for compaction.
        if (compactablePercentage * segment.descriptor().version() >= storage.compactionThreshold()) {
          segments.add(segment);
        }
      }

      segment = nextSegment;
    }
    return segments;
  }
1162177
def _file_list(info_list) # :nodoc:
      files = Array.new
      info_list.each {|r|
        #p r.inspect
        # file is not modified, we don't want to see it (this is 'status')
        txt_stat = r[1].text_status
        next if ' ' == status_codes(txt_stat)
        f_rec = Hash.new
        f_rec[:path] = r[0]
        f_rec[:status] = status_codes(txt_stat)
        files.push f_rec
      }
      files
    end
199414
public static function getStatusesArray() : array
    {
        return [
            self::STATUS_BLOCKED => Yii::t('setrun/user', 'Blocked'),
            self::STATUS_ACTIVE  => Yii::t('setrun/user', 'Active'),
            self::STATUS_WAIT    => Yii::t('setrun/user', 'Wait')
        ];
    }
927019
protected function getFileSystem(): array
	{
		$fileSystem = [];

		$command = $this->readCommand('df -T');
		if ($command) {
			$bufe = preg_split("/\n/", $command, -1, PREG_SPLIT_NO_EMPTY);
			unset($bufe[0]);
			foreach ($bufe as $buf) {
				$data = preg_split('/\s+/', $buf);
				$mounted = new Obj;

				$mounted->partition = $data[0];
				$mounted->type = $data[1];
				$mounted->size = $data[2] * 1024;
				$mounted->used = $data[3] * 1024;
				$mounted->free = $data[4] * 1024;
				$mounted->usage = $data[5];
				$mounted->mountPoint = $data[6];

				$fileSystem[] = $mounted;
			}
		}

		return $fileSystem;
	}
109173
private function getArchiveFiles(): array {

        $list = [];

        for ( $i = 0; $i < $this->getArchive()->numFiles; $i++ ) {

            $file = $this->getArchive()->statIndex($i);
            if ( $file === false ) {
                continue;
            }

            $name = str_replace('\\', '/', $file['name']);
            if (
                (
                    $name[0] == "." &&
                    in_array($this->getSkipMode(), ["HIDDEN", "ALL"])
                ) ||
                (
                    $name[0] == "." &&
                    @$name[1] == "_" &&
                    in_array($this->getSkipMode(), ["COMODOJO", "ALL"])
                )
            ) {
                continue;
            }

            $list[] = $name;

        }

        return $list;

    }
941576
def get_export_files(cursor, id, version, types, exports_dirs, read_file=True):
    """"""
    request = get_current_request()
    type_info = dict(request.registry.settings['_type_info'])
    metadata = get_content_metadata(id, version, cursor)
    legacy_id = metadata['legacy_id']
    legacy_version = metadata['legacy_version']

    reachable_dirs = [dir for dir in exports_dirs if safe_stat(dir)]

    # 1 result per type, in the same order as the given types
    results = []

    for type in list(types):
        if type not in type_info:
            raise ExportError("invalid type '{}' requested.".format(type))
        file_extension = type_info[type]['file_extension']

        # skip module PDFs
        if metadata['mediaType'] == MODULE_MIMETYPE and \
                file_extension == 'pdf':
            continue

        mimetype = type_info[type]['mimetype']
        filename = '{}@{}.{}'.format(id, version, file_extension)
        legacy_filenames = [
            '{}-{}.{}'.format(legacy_id, legacy_version, ext)
            for ext in LEGACY_EXTENSION_MAP[file_extension]
        ]
        slugify_title_filename = u'{}-{}.{}'.format(slugify(metadata['title']),
                                                    version, file_extension)

        for dir in reachable_dirs:
            filepath = os.path.join(dir, filename)
            try:
                if read_file:
                    with open(filepath, 'r') as file:
                        stats = os.fstat(file.fileno())
                        contents = file.read()
                else:
                    stats = os.stat(filepath)
                    contents = None
                modtime = fromtimestamp(int(stats.st_mtime))
                results.append((slugify_title_filename, mimetype,
                                stats.st_size, modtime, 'good', contents))
                break
            except EnvironmentError:
                pass
        else:
            # Let's see if the legacy file's there and make the new link
            legacy_file_found = False
            for dir in reachable_dirs:
                filepath = os.path.join(dir, filename)
                legacy_filepaths = [os.path.join(dir, fn)
                                    for fn in legacy_filenames]
                for legacy_filepath in legacy_filepaths:
                    try:
                        if read_file:
                            with open(legacy_filepath, 'r') as file:
                                stats = os.fstat(file.fileno())
                                contents = file.read()
                        else:
                            stats = os.stat(legacy_filepath)
                            contents = None
                        modtime = fromtimestamp(stats.st_mtime)
                        os.link(legacy_filepath, filepath)
                        results.append((slugify_title_filename, mimetype,
                                        stats.st_size, modtime, 'good',
                                        contents))
                        legacy_file_found = True
                        break
                    except EnvironmentError:
                        pass
                if legacy_file_found:
                    break
            else:
                filenames = [filename] + legacy_filenames
                log_formatted_filenames = '\n'.join([' - {}'.format(x)
                                                     for x in filenames])
                logger.error("Could not find a file for '{}' at version '{}' "
                             "with any of the following file names:\n{}"
                             .format(id, version, log_formatted_filenames))
                # No file, return "missing" state
                results.append((slugify_title_filename, mimetype,
                                0, None, 'missing', None))

    return results
678106
public static disk_adapter[] get(nitro_service client) throws Exception
	{
		disk_adapter resource = new disk_adapter();
		resource.validate("get");
		return (disk_adapter[]) resource.get_resources(client);
	}
770334
private PersistedRecoveryPaxosData getPersistedPaxosData(long segmentTxId)
      throws IOException {
    File f = journalStorage.getPaxosFile(segmentTxId);
    if (!f.exists()) {
      // Default instance has no fields filled in (they're optional)
      return null;
    }
    
    InputStream in = new FileInputStream(f);
    try {
      PersistedRecoveryPaxosData ret = PersistedRecoveryPaxosData.parseDelimitedFrom(in);
      Preconditions.checkState(ret != null &&
          ret.getSegmentState().getStartTxId() == segmentTxId,
          "Bad persisted data for segment %s: %s",
          segmentTxId, ret);
      return ret;
    } finally {
      IOUtils.closeStream(in);
    }
  }
559087
def getcandsfile(d, segment=-1, domock=False):
    
    if domock:
        prefix = 'candsmock_'
    else:
        prefix= 'cands_'

    if d.has_key('segment'):
        return os.path.join(d['workdir'], prefix + d['fileroot'] + '_sc' + str(d['scan']) + 'seg' + str(d['segment']) + '.pkl')
    elif segment >= 0:
        return os.path.join(d['workdir'], prefix + d['fileroot'] + '_sc' + str(d['scan']) + 'seg' + str(segment) + '.pkl')
    else:
        return ''
258
def segment_pofiles(configuration, locale):
    
    files_written = set()
    for filename, segments in configuration.segment.items():
        filename = configuration.get_messages_dir(locale) / filename
        files_written.update(segment_pofile(filename, segments))
    return files_written
1072875
private FileStatus methodBasedGetFileInfo(String src) throws IOException {
    if (namenodeProtocolProxy.isMethodSupported(
        "getHdfsFileInfo", String.class)) {
      return HdfsFileStatus.toFileStatus(namenode.getHdfsFileInfo(src), src);
    } else {
      return namenode.getFileInfo(src);
    }
  }
122729
def get_file_systems(self):
        
        result = {}
        if os.access('/proc/mounts', os.R_OK):
            file = open('/proc/mounts')
            for line in file:
                try:
                    mount = line.split()
                    device = mount[0]
                    mount_point = mount[1]
                    fs_type = mount[2]
                except (IndexError, ValueError):
                    continue

                # Skip the filesystem if it is not in the list of valid
                # filesystems
                if fs_type not in self.filesystems:
                    self.log.debug("Ignoring %s since it is of type %s " +
                                   " which is not in the list of filesystems.",
                                   mount_point, fs_type)
                    continue

                # Process the filters
                if self.exclude_reg.search(mount_point):
                    self.log.debug("Ignoring %s since it is in the " +
                                   "exclude_filter list.", mount_point)
                    continue

                if ((('/' in device or device == 'tmpfs') and
                     mount_point.startswith('/'))):
                    try:
                        stat = os.stat(mount_point)
                    except OSError:
                        self.log.debug("Path %s is not mounted - skipping.",
                                       mount_point)
                        continue

                    if stat.st_dev in result:
                        continue

                    result[stat.st_dev] = {
                        'device': os.path.realpath(device),
                        'mount_point': mount_point,
                        'fs_type': fs_type
                    }

            file.close()

        else:
            if not psutil:
                self.log.error('Unable to import psutil')
                return None

            partitions = psutil.disk_partitions(False)
            for partition in partitions:
                result[len(result)] = {
                    'device': os.path.realpath(partition.device),
                    'mount_point': partition.mountpoint,
                    'fs_type': partition.fstype
                }
            pass

        return result
729591
def has_segment_tables(xmldoc, name = None):
	
	try:
		names = lsctables.SegmentDefTable.get_table(xmldoc).getColumnByName("name")
		lsctables.SegmentTable.get_table(xmldoc)
		lsctables.SegmentSumTable.get_table(xmldoc)
	except (ValueError, KeyError):
		return False
	return name is None or name in names
480435
def get(self, bucket=None, versions=missing, uploads=missing):
        
        if uploads is not missing:
            return self.multipart_listuploads(bucket)
        else:
            return self.listobjects(bucket, versions)
248887
public static String getHdfsStorageDir(DataSegment segment)
  {
    return JOINER.join(
        segment.getDataSource(),
        String.format(
            "%s_%s",
            segment.getInterval().getStart().toString(ISODateTimeFormat.basicDateTime()),
            segment.getInterval().getEnd().toString(ISODateTimeFormat.basicDateTime())
        ),
        segment.getVersion().replaceAll(":", "_"),
        segment.getShardSpec().getPartitionNum()
    );
  }
587435
function getFlagArrayFromObject(obj) {
  return Object.keys(obj).reduce((arr, key) => {
    const flag = `--${key.toLowerCase()}`;
    if (key === 'noUpdateNotifier' && typeof obj[key] === 'boolean') {
      return obj[key] ? [...arr, '--no-update-notifier'] : arr;
    } else if (key === 'noIgnore' && typeof obj[key] === 'boolean') {
      return obj[key] ? [...arr, '--no-ignore'] : arr;
    } else if (typeof obj[key] === 'boolean') {
      return obj[key] ? [...arr, flag] : arr;
    } else if (key === 'ignoredFile') {
      return [...arr, '--ignored-file', obj[key]];
    } else if (key === 'ignoredFiles') {
      const ignoredFiles = obj[key].reduce(
        (files, file) => [...files, '--ignored-file', file],
        []
      );
      return [...arr, ...ignoredFiles];
    } else if (key === 'files') {
      return [...arr, ...obj[key]];
    } else {
      return [...arr, flag, obj[key]];
    }
  }, []);
}