Parse the output of 'df', building a list of results per FS volume.

@param string $dfOutput
@param string $appDir
@param array  $mountPaths

@return array
3636
private function parseDf($dfOutput, $appDir, array $mountPaths)
    {
        $results = [];
        foreach (explode("\n", $dfOutput) as $i => $line) {
            if ($i === 0) {
                continue;
            }
            try {
                $path = $this->getDfColumn($line, 'path');
            } catch (\RuntimeException $e) {
                $this->debug($e->getMessage());
                continue;
            }
            if (strpos($path, $appDir . '/') !== 0) {
                continue;
            }
            $mountPath = ltrim(substr($path, strlen($appDir)), '/');
            if (!in_array($mountPath, $mountPaths)) {
                continue;
            }
            $filesystem = $this->getDfColumn($line, 'filesystem');
            if (isset($results[$filesystem])) {
                $results[$filesystem]['mounts'][] = $mountPath;
                continue;
            }
            $results[$filesystem] = [
                'total' => $this->getDfColumn($line, 'total'),
                'used' => $this->getDfColumn($line, 'used'),
                'available' => $this->getDfColumn($line, 'available'),
                'mounts' => [$mountPath],
            ];
            $results[$filesystem]['percent_used'] = $results[$filesystem]['used'] / $results[$filesystem]['total'] * 100;
        }

        return $results;
    }
394934
public static function init($appDir, array $configFiles)
    {
        self::$loaders = [
            new JsonLoader(),
            new YamlLoader(),
            new PhpLoader()
        ];
        
        self::$appDir = $appDir;
        self::$configFiles = $configFiles;
    }
1024769
function listApps() {

        // combine directories from pancakes-recipe with dirs from source project
        var dirs = [].concat(fs.readdirSync(__dirname), fs.readdirSync(process.cwd() + '/batch'));

        // list them out in sorted order
        dirs.sort();
        for (var i = 0; i < dirs.length; i++) {
            if (dirs[i] !== 'batch.manager.js') {
                /* eslint no-console:0 */
                console.log(dirs[i]);
            }
        }
    }
73724
def dirinfo(path, opts=None):
    '''
    
    '''
    cmd = 'mfsdirinfo'
    ret = {}
    if opts:
        cmd += ' -' + opts
    cmd += ' ' + path
    out = __salt__['cmd.run_all'](cmd, python_shell=False)

    output = out['stdout'].splitlines()
    for line in output:
        if not line:
            continue
        comps = line.split(':')
        ret[comps[0].strip()] = comps[1].strip()
    return ret
113281
public function dump($inputDirectory, $outputDirectory, $dumpVendorModules = true)
    {
        $modulesList = [];

        //extracts list of modules from module directory
        $directoryIterator = new \DirectoryIterator($inputDirectory);
        foreach ($directoryIterator as $moduleDir) {
            if ($moduleDir->isDot()) {
                continue;
            }

            $moduleSettingsFile = $moduleDir->getPathname()
                                        . DIRECTORY_SEPARATOR
                                        . self::MODULE_SETTINGS_FILE;
            if (!file_exists($moduleSettingsFile)) {
                continue;
            }
            $modulesList[$moduleDir->getBasename()] = [
                'className' =>  $moduleDir->getBasename()
                                        . '\\'
                                        . pathinfo(self::MODULE_SETTINGS_FILE, PATHINFO_FILENAME),
                'path'  =>  $moduleSettingsFile
            ];
        }

        if ($dumpVendorModules) {
            $this->dumpModulesFromVendor($modulesList);
        }

        //saves generated array to php source file
        FileWriter::writeObject(
            $outputDirectory . self::MODULE_STATIC_FILE,
            $modulesList,
            true
        );

        return $modulesList;
    }
899702
public static function parseStations($filePath)
    {
        if (DIRECTORY_SEPARATOR == '\\')
            $filePath = str_replace('/', '\\', $filePath);
        ini_set('display_errors', 1);
        error_reporting(E_ALL);
        $stationConf = DWDConfiguration::getStationConfiguration();
        $stations = array();

        if (file_exists($filePath)) {
            $handle = fopen($filePath, "r");
            if ($handle) {
                //skips the first N lines of input, requires the file handle.
                self::skipDescriptionLines($stationConf->skipLines, $handle);
                while (($line = fgets($handle)) !== false) {
                    $line = mb_convert_encoding($line, "UTF-8", "iso-8859-1");

                    // eliminate multiple spaces, replace by single space
                    $output = preg_replace('!\s+!', ' ', $line);
                    //remove trailing and leading spaces.
                    $output = trim($output, ' ');

                    // process the line read - split by spaces
                    // stationId, from, until, stationHeight, lat, long, station name, state
                    // Station name can contain spaces and needs further processing, thus we limit to keep station name + state
                    // in one field
                    $split = explode(" ", $output, 7);
                    $name = explode(" ", $split[count($split) - 1]);
                    //last cell contains the county name.
                    $county = $name[count($name) - 1];
                    // merge all other contents of the name, glue them together with spaces.
                    $nameSlice = array_slice($name, 0, count($name) - 1);
                    $name = implode(" ", $nameSlice);

                    //evtl. array_filter
                    $from = Carbon::createFromFormat($stationConf->dateFormat, $split[1], 'UTC');
                    $until = Carbon::createFromFormat($stationConf->dateFormat, $split[2], 'UTC');

                    $station = new DWDStation($split[0], $from, $until,
                        $split[3], $split[4], $split[5], $name, $county,
                        $stationConf->activeRequirementDays);
                    $stations[] = $station;

                }

                fclose($handle);
            } else {
                throw new DWDLibException("Error opening the file: " . $filePath);
            }
        } else
            throw new DWDLibException("File does not exist - path: " . $filePath);

        return $stations;
    }
441349
private function _filesystems()
    {
        if (CommonFunctions::executeProgram('df', '-k', $df, PSI_DEBUG)) {
            $df = preg_replace('/\n\s/m', ' ', $df);
            $mounts = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
            foreach ($mounts as $mount) {
                $ar_buf = preg_split('/\s+/', $mount, 6);
                if (!empty($ar_buf[0]) && $ar_buf[0] !== 'Filesystem') {
                    $dev = new DiskDevice();
                    $dev->setName($ar_buf[0]);
                    $dev->setTotal($ar_buf[1] * 1024);
                    $dev->setUsed($ar_buf[2] * 1024);
                    $dev->setFree($ar_buf[3] * 1024);
                    $dev->setMountPoint($ar_buf[5]);
                    if (CommonFunctions::executeProgram('df', '-n', $dftypes, PSI_DEBUG)) {
                        $mounttypes = preg_split("/\n/", $dftypes, -1, PREG_SPLIT_NO_EMPTY);
                        foreach ($mounttypes as $type) {
                            $ty_buf = preg_split('/:/', $type, 2);
                            if (trim($ty_buf[0]) == $dev->getMountPoint()) {
                                $dev->setFsType($ty_buf[1]);
                                break;
                            }
                        }
                    } elseif (CommonFunctions::executeProgram('df', '-T', $dftypes, PSI_DEBUG)) {
                        $dftypes = preg_replace('/\n\s/m', ' ', $dftypes);
                        $mounttypes = preg_split("/\n/", $dftypes, -1, PREG_SPLIT_NO_EMPTY);
                        foreach ($mounttypes as $type) {
                            $ty_buf = preg_split("/\s+/", $type, 3);
                            if ($ty_buf[0] == $dev->getName()) {
                                $dev->setFsType($ty_buf[1]);
                                break;
                            }
                        }
                    }
                    $this->sys->setDiskDevices($dev);
                }
            }
        }
    }
1260934
function readModuleDirectory() {
  return _fsExtra2.default.existsSync((0, _config2.default)().moduleDirectoryPath()) ? _fsExtra2.default.readdirSync((0, _config2.default)().moduleDirectoryPath(), function (err, files) {
    return files;
  }).filter(_isNotModulesImportFile) : [];
}
121728
public function resolveDirectoriesWithFnmatch(array $directories): array
    {
        $absoluteDirectories = [];
        foreach ($directories as $directory) {
            if (Strings::contains($directory, '*')) { // is fnmatch for directories
                $absoluteDirectories = array_merge($absoluteDirectories, glob($directory, GLOB_ONLYDIR));
            } else { // is classic directory
                $this->ensureDirectoryExists($directory);
                $absoluteDirectories[] = $directory;
            }
        }

        return $absoluteDirectories;
    }
818683
function ProcessExifDir($DirStart, $OffsetBase, $ExifLength)
    {

        $NumDirEntries = 0;
        $ValuePtr = array();

        $NumDirEntries = $this->Get16u($DirStart[0], $DirStart[1]);


        $this->debug("<br>Directory with $NumDirEntries entries\n");

        for ($de = 0; $de < $NumDirEntries; $de++)
        {
            //$DirEntry = array_slice($DirStart,2+12*$de);
            $DirEntry = substr($DirStart, 2 + 12 * $de);

            $Tag = $this->Get16u($DirEntry[0], $DirEntry[1]);
            $Format = $this->Get16u($DirEntry[2], $DirEntry[3]);
            $Components = $this->Get32u($DirEntry[4], $DirEntry[5], $DirEntry[6], $DirEntry[7]);

            /**
            if ((Format-1) >= NUM_FORMATS) {
            // (-1) catches illegal zero case as unsigned underflows to positive large.
            ErrNonfatal("Illegal number format %d for tag %04x", Format, Tag);
            continue;
            }
             */

            $ByteCount = $Components * $this->BytesPerFormat[$Format];

            if ($ByteCount > 4)
            {
                $OffsetVal = $this->Get32u($DirEntry[8], $DirEntry[9], $DirEntry[10], $DirEntry[11]);
                if ($OffsetVal + $ByteCount > $ExifLength)
                {
                    $this->debug("Illegal value pointer($OffsetVal) for tag $Tag", 1);
                }
                //$ValuePtr = array_slice($OffsetBase,$OffsetVal);
                $ValuePtr = substr($OffsetBase, $OffsetVal);
            }
            else
            {
                //$ValuePtr = array_slice($DirEntry,8);
                $ValuePtr = substr($DirEntry, 8);
            }

            switch ($Tag)
            {

                case TAG_MAKE:
                    $this->ImageInfo["h"]["make"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;

                case TAG_MODEL:
                    $this->ImageInfo["h"]["model"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;

                case TAG_DATETIME_ORIGINAL:
                    $this->ImageInfo[TAG_DATETIME_ORIGINAL] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    $this->ImageInfo["h"]["DateTime"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;

                case TAG_USERCOMMENT:
                    // Olympus has this padded with trailing spaces.  Remove these first.
                    for ($a = $ByteCount; ;)
                    {
                        $a--;
                        if ($ValuePtr[$a] == ' ')
                        {
                            //$ValuePtr[$a] = '\0';
                        }
                        else
                        {
                            break;
                        }
                        if ($a == 0)
                        {
                            break;
                        }
                    }

                    $tmp = '';
                    // Copy the comment
                    if (($ValuePtr[0] . $ValuePtr[1] . $ValuePtr[2] . $ValuePtr[3] . $ValuePtr[4]) == "ASCII")
                    {
                        for ($a = 5; $a < 10; $a++)
                        {
                            $c = $ValuePtr[$a];
                            if ($c != '\0' && $c != ' ')
                            {
                                $tmp = substr($ValuePtr, 0, $ByteCount);
                                break;
                            }
                        }
                    }
                    else
                    {
                        if (($ValuePtr[0] . $ValuePtr[1] . $ValuePtr[2] . $ValuePtr[3] . $ValuePtr[4] . $ValuePtr[5] . $ValuePtr[6]) == "Unicode")
                        {
                            $tmp = substr($ValuePtr, 0, $ByteCount);
                            //  * Handle Unicode characters here...
                        }
                        else
                        {
                            //$this->ImageInfo[TAG_USERCOMMENT] = implode("",array_slice($ValuePtr,0,$ByteCount));
                            $tmp = substr($ValuePtr, 0, $ByteCount);
                        }
                    }
                    $this->ImageInfo['h']["exifComment"] = $this->string_format($tmp);
                    break;

                case TAG_ARTIST:
                    $this->ImageInfo['h']["artist"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;

                case TAG_COPYRIGHT:
                    $this->ImageInfo['h']["copyright"] = htmlentities(substr($ValuePtr, 0, $ByteCount));
                    break;

                case TAG_FNUMBER:
                    // Simplest way of expressing aperture, so I trust it the most.
                    // (overwrite previously computd value if there is one)
                    $tmp = $this->ConvertAnyFormat(substr($ValuePtr, 0), $Format);
                    $this->ImageInfo['h']["fnumber"] = sprintf("f/%3.1f", (double)$tmp[0]);
                    break;

                case TAG_APERTURE:
                case TAG_MAXAPERTURE:
                    // More relevant info always comes earlier, so only use this field if we don't
                    // have appropriate aperture information yet.
                    if (!isset($this->ImageInfo['h']["aperture"]))
                    {
                        $tmpArr = $this->ConvertAnyFormat($ValuePtr, $Format);
                        $this->ImageInfo['h']["aperture"] = exp($tmpArr[0] * log(2) * 0.5);
                    }
                    break;

                case TAG_FOCALLENGTH:
                    // Nice digital cameras actually save the focal length as a function
                    // of how farthey are zoomed in.
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["focalLength"] = sprintf("%4.2f (%d/%d)", (double)$tmp[0], $tmp[1][0], $tmp[1][1]);
                    if (isset($this->ImageInfo['h']["CCDWidth"]))
                    {
                        $this->ImageInfo['h']["focalLength"] .= sprintf("(35mm equivalent: %dmm)", (int)($tmp[0] / $this->ImageInfo['h']["CCDWidth"] * 36 + 0.5));
                    }
                    break;

                case TAG_SUBJECT_DISTANCE:
                    // Inidcates the distacne the autofocus camera is focused to.
                    // Tends to be less accurate as distance increases.
                    //$this->ImageInfo["h"]["Distance"] =  $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["Distance"] = sprintf("%4.2f (%d/%d)", (double)$tmp[0], $tmp[1][0], $tmp[1][1]);
                    if ($this->ImageInfo['h']["Distance"] < 0)
                    {
                        $this->ImageInfo['h']["focusDistance"] = "Infinite";
                    }
                    else
                    {
                        $this->ImageInfo['h']["focusDistance"] = sprintf("%4.2fm", (double)$this->ImageInfo['h']["Distance"]);
                    }


                    break;

                case TAG_EXPOSURETIME:
                    // Simplest way of expressing exposure time, so I trust it most.
                    // (overwrite previously computd value if there is one)
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["exposureTime"] = sprintf("%6.3f s (%d/%d)", (double)$tmp[0], $tmp[1][0], $tmp[1][1]);
                    if ($tmp[0] <= 0.5)
                    {
                        $this->ImageInfo['h']["exposureTime"] .= sprintf(" (1/%d)", (int)(0.5 + 1 / $tmp[0]));
                    }
                    break;

                case TAG_SHUTTERSPEED:
                    // More complicated way of expressing exposure time, so only use
                    // this value if we don't already have it from somewhere else.
                    if (isset($this->ImageInfo['TAG_EXPOSURETIME']) && $this->ImageInfo['TAG_EXPOSURETIME'] == 0)
                    {
                        $sp = $this->ConvertAnyFormat($ValuePtr, $Format);
                        $this->ImageInfo[TAG_SHUTTERSPEED] = (1 / exp($sp[0] * log(2)));
                    }
                    break;

                case TAG_FLASH:
                    $this->ImageInfo["h"]["flashUsed"] = "No";
                    if ($this->ConvertAnyFormat($ValuePtr, $Format) & 7)
                    {
                        $this->ImageInfo["h"]["flashUsed"] = "Yes";
                    }
                    break;

                case TAG_ORIENTATION:
                    $this->ImageInfo[TAG_ORIENTATION] = $this->ConvertAnyFormat($ValuePtr, $Format);
                    if ($this->ImageInfo[TAG_ORIENTATION] < 1 || $this->ImageInfo[TAG_ORIENTATION] > 8)
                    {
                        $this->debug(sprintf("Undefined rotation value %d", $this->ImageInfo[TAG_ORIENTATION], 0), 1);
                        $this->ImageInfo[TAG_ORIENTATION] = 0;
                    }
                    break;

                case TAG_EXIF_IMAGELENGTH:
                    //       * Image height
                    $a = (int)$this->ConvertAnyFormat($ValuePtr, $Format);
                    if ($this->ExifImageLength < $a)
                    {
                        $this->ExifImageLength = $a;
                    }
                    $this->ImageInfo[TAG_EXIF_IMAGELENGTH] = $this->ExifImageLength;
                    $this->ImageInfo["h"]["Height"] = $this->ExifImageLength;
                    break;
                case TAG_EXIF_IMAGEWIDTH:
                    // Use largest of height and width to deal with images that have been
                    // rotated to portrait format.
                    $a = (int)$this->ConvertAnyFormat($ValuePtr, $Format);
                    if ($this->ExifImageWidth < $a)
                    {
                        $this->ExifImageWidth = $a;
                    }
                    $this->ImageInfo[TAG_EXIF_IMAGEWIDTH] = $this->ExifImageWidth;
                    $this->ImageInfo["h"]["Width"] = $this->ExifImageWidth;

                    break;

                case TAG_FOCALPLANEXRES:
                    $this->FocalplaneXRes = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->FocalplaneXRes = $this->FocalplaneXRes[0];
                    $this->ImageInfo[TAG_FOCALPLANEXRES] = $this->FocalplaneXRes[0];
                    break;

                case TAG_FOCALPLANEUNITS:
                    switch ($this->ConvertAnyFormat($ValuePtr, $Format))
                    {
                        case 1:
                            $this->FocalplaneUnits = 25.4;
                            break; // inch
                        case 2:
                            // According to the information I was using, 2 means meters.
                            // But looking at the Cannon powershot's files, inches is the only
                            // sensible value.
                            $this->FocalplaneUnits = 25.4;
                            break;

                        case 3:
                            $this->FocalplaneUnits = 10;
                            break; // centimeter
                        case 4:
                            $this->FocalplaneUnits = 1;
                            break; // milimeter
                        case 5:
                            $this->FocalplaneUnits = .001;
                            break; // micrometer
                    }
                    $this->ImageInfo[TAG_FOCALPLANEUNITS] = $this->FocalplaneUnits;
                    break;

                // Remaining cases contributed by: Volker C. Schoech (schoech@gmx.de)

                case TAG_EXPOSURE_BIAS:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["exposureBias"] = sprintf("%4.2f (%d/%d)", (double)$tmp[0], $tmp[1][0], $tmp[1][1]);
                    break;

                case TAG_WHITEBALANCE:
                    $tmp = (int)$this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("1" => "Sunny", "2" => "fluorescent", "3" => "incandescent");
                    $this->ImageInfo['h']["whiteBalance"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Cloudy");
                    break;

                case TAG_METERING_MODE:
                    $tmp = (int)$this->ConvertAnyFormat($ValuePtr, $Format);

                    $tmpArr = array("2" => "center weight", "3" => "spot", "5" => "matrix");
                    $this->ImageInfo['h']["meteringMode"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    break;

                case TAG_EXPOSURE_PROGRAM:
                    $tmp = (int)$this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("2" => "program (auto)", "3" => "aperture priority (semi-auto)", "4" => "shutter priority (semi-auto)");
                    $this->ImageInfo['h']["exposure"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");

                    break;

                case TAG_ISO_EQUIVALENT:
                    $tmp = (int)$this->ConvertAnyFormat($ValuePtr, $Format);
                    if ($tmp < 50)
                    {
                        $tmp *= 200;
                    }
                    $this->ImageInfo['h']["isoEquiv"] = sprintf("%2d", (int)$tmp);
                    break;

                case TAG_COMPRESSION_LEVEL:
                    $tmp = (int)$this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("1" => "Basic", "2" => "Normal", "4" => "Fine");
                    $this->ImageInfo['h']["jpegQuality"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    break;

                case TAG_THUMBNAIL_OFFSET:
                    //$this->ThumbnailOffset = $this->ConvertAnyFormat($ValuePtr, $Format);
                    //$this->DirWithThumbnailPtrs = $DirStart;
                    break;

                case TAG_THUMBNAIL_LENGTH:
                    //$this->ThumbnailSize = $this->ConvertAnyFormat($ValuePtr, $Format);
                    //$this->ImageInfo[TAG_THUMBNAIL_LENGTH] = $this->ThumbnailSize;
                    break;

                //----------------------------------------------
                case TAG_IMAGE_DESC:
                    $this->ImageInfo['h']["imageDesc"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_X_RESOLUTION:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["xResolution"] = sprintf("%4.2f (%d/%d) %s", (double)$tmp[0], $tmp[1][0], $tmp[1][1], $this->ImageInfo['h']["resolutionUnit"]);
                    break;
                case TAG_Y_RESOLUTION:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["yResolution"] = sprintf("%4.2f (%d/%d) %s", (double)$tmp[0], $tmp[1][0], $tmp[1][1], $this->ImageInfo['h']["resolutionUnit"]);
                    break;
                case TAG_RESOLUTION_UNIT:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("2" => "Inches", "3" => "Centimeters");

                    $this->ImageInfo['h']["resolutionUnit"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    break;
                case TAG_SOFTWARE:
                    $this->ImageInfo['h']["software"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_FILE_MODDATE;
                    $this->ImageInfo['h']["fileModifiedDate"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_YCBCR_POSITIONING:
                    $this->ImageInfo['h']["YCbCrPositioning"] = $this->ConvertAnyFormat($ValuePtr, $Format);
                    break;
                case TAG_EXIF_VERSION:
                    $this->ImageInfo['h']["exifVersion"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_DATE_TIME_DIGITIZED:
                    $this->ImageInfo['h']["dateTimeDigitized"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_COMPONENT_CONFIG: // need more tests for this
                    $tmp = (int)$this->ConvertAnyFormat($ValuePtr, $Format);

                    $tmpArr = array("0" => "Does Not Exists", "1" => "Y", "2" => "Cb", "3" => "Cr", "4" => "R", "5" => "G", "6" => "B");

                    if (strlen($tmp) < 4)
                    {
                        $this->ImageInfo['h']["componentConfig"] = $tmpArr["0"];
                    }
                    else
                    {
                        for ($i = 0; $i < strlen($tmp); $i++)
                        {
                            if ($tmp["$i"] != 0)
                            {
                                $this->ImageInfo['h']["componentConfig"] .= $tmpArr[$tmp["$i"]];
                            }
                        }
                    }
                    break;
                case TAG_MAKER_NOTE:
                    //$this->ImageInfo['h']["makerNote"] = substr($ValuePtr,0,$ByteCount);
                    $this->ImageInfo['h']["makerNote"] = "NOT IMPLEMENTED";
                    break;
                case TAG_SUB_SEC_TIME:
                    $this->ImageInfo['h']["subSectionTime"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_SUB_SEC_TIME_ORIG:
                    $this->ImageInfo['h']["subSectionTimeOriginal"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_SUB_SEC_TIME_DIGITIZED:
                    $this->ImageInfo['h']["subSectionTimeDigtized"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_FLASHPIX_VER:
                    $this->ImageInfo['h']["flashpixVersion"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_COLOR_SPACE:
                    $this->ImageInfo['h']["colorSpace"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_RELATED_SOUND_FILE:
                    $this->ImageInfo['h']["relatedSoundFile"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_GPS_LATITUDE_REF:
                    $this->ImageInfo['h']["GPSLatitudeRef"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    $this->ImageInfo['h']["GPSLatitudeRef"] = trim($this->ImageInfo['h']["GPSLatitudeRef"]);
                    $tmp = substr($this->ImageInfo['h']["GPSLatitudeRef"], 0, 1);
                    if ($tmp == "S")
                    {
                        $this->ImageInfo['h']["GPSLatitudeRef"] = "South latitude";
                    }
                    else
                    {
                        if ($tmp == "N")
                        {
                            $this->ImageInfo['h']["GPSLatitudeRef"] = "North latitude";
                        }
                        else
                        {
                            $this->ImageInfo['h']["GPSLatitudeRef"] = "Reserved";
                        }
                    }
                    break;
                case TAG_GPS_LATITUDE:
                    $tmp = substr($ValuePtr, 0, $ByteCount);

                    $this->ImageInfo['h']["GPSLatitude"]["Degrees"] = ord(substr($tmp, 0, 1));
                    $this->ImageInfo['h']["GPSLatitude"]["Minutes"] = ord(substr($tmp, 1, 1));
                    $this->ImageInfo['h']["GPSLatitude"]["Seconds"] = ord(substr($tmp, 2, 1));
                    break;

                case TAG_GPS_LONGITUDE:
                    $tmp = substr($ValuePtr, 0, $ByteCount);

                    $this->ImageInfo['h']["GPSLongitude"]["Degrees"] = ord(substr($tmp, 0, 1));
                    $this->ImageInfo['h']["GPSLongitude"]["Minutes"] = ord(substr($tmp, 1, 1));
                    $this->ImageInfo['h']["GPSLongitude"]["Seconds"] = ord(substr($tmp, 2, 1));

                    break;

                case TAG_GPS_LONGITUDE_REF:
                    $this->ImageInfo['h']["GPSLongitudeRef"] = substr($ValuePtr, 0, $ByteCount);
                    $this->ImageInfo['h']["GPSLongitudeRef"] = trim($this->ImageInfo['h']["GPSLongitudeRef"]);
                    $tmp = substr($this->ImageInfo['h']["GPSLongitudeRef"], 0, 1);
                    if ($tmp == "E")
                    {
                        $this->ImageInfo['h']["GPSLongitudeRef"] = "East Longitude";
                    }
                    else
                    {
                        if ($tmp == "W")
                        {
                            $this->ImageInfo['h']["GPSLongitudeRef"] = "West Longitude";
                        }
                        else
                        {
                            $this->ImageInfo['h']["GPSLongitudeRef"] = "Reserved";
                        }
                    }

                    break;


                case TAG_GPS_TrackRef: /* Reference for direction of movement    GPSTrackRef */
                    $this->ImageInfo['h']["GPSTrackRef"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;


                case TAG_GPS_GPSTrack: /* Direction of movement					GPSTrack */
                    $this->ImageInfo['h']["GPSTrack"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_GPS_GPSImgDirectionRef: /* Reference for direction of image       GPSImgDirectionRef */
                    $this->ImageInfo['h']["GPSImgDirectionRef"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_GPS_GPSImgDirection: /* Direction of image                     GPSImgDirection     */
                    $this->ImageInfo['h']["GPSImgDirection"] = $this->ConvertAnyFormat($ValuePtr, $Format);
                    break;
                case TAG_GPS_GPSMapDatum: /* Geodetic survey data used              GPSMapDatum         */
                    $this->ImageInfo['h']["GPSMapDatum"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_GPS_GPSDestLatitudeRef: /* Reference for latitude of destination  GPSDestLatitudeRef  */
                    $this->ImageInfo['h']["GPSDestLatitudeRef"] = substr($ValuePtr, 0, $ByteCount);
                    $this->ImageInfo['h']["GPSDestLatitudeRef"] = trim($this->ImageInfo['h']["GPSDestLatitudeRef"]);
                    $tmp = substr($this->ImageInfo['h']["GPSDestLatitudeRef"], 0, 1);
                    if ($tmp == "S")
                    {
                        $this->ImageInfo['h']["GPSDestLatitudeRef"] = "South latitude";
                    }
                    else
                    {
                        if ($tmp == "N")
                        {
                            $this->ImageInfo['h']["GPSDestLatitudeRef"] = "North latitude";
                        }
                        else
                        {
                            $this->ImageInfo['h']["GPSDestLatitudeRef"] = "Reserved";
                        }
                    }

                    break;
                case TAG_GPS_GPSDestLatitude: /* Latitude of destination                GPSDestLatitude     */
                    $tmp = substr($ValuePtr, 0, $ByteCount);

                    $this->ImageInfo['h']["GPSDestLatitude"]["Degrees"] = ord(substr($tmp, 0, 1));
                    $this->ImageInfo['h']["GPSDestLatitude"]["Minutes"] = ord(substr($tmp, 1, 1));
                    $this->ImageInfo['h']["GPSDestLatitude"]["Seconds"] = ord(substr($tmp, 2, 1));

                    break;
                case TAG_GPS_GPSDestLongitudeRef: /* Reference for longitude of destination GPSDestLongitudeRef 21     */
                    $this->ImageInfo['h']["GPSDestLongitudeRef"] = substr($ValuePtr, 0, $ByteCount);
                    $this->ImageInfo['h']["GPSDestLongitudeRef"] = trim($this->ImageInfo['h']["GPSDestLongitudeRef"]);
                    $tmp = substr($this->ImageInfo['h']["GPSDestLongitudeRef"], 0, 1);
                    if ($tmp == "E")
                    {
                        $this->ImageInfo['h']["GPSDestLongitudeRef"] = "East Longitude";
                    }
                    else
                    {
                        if ($tmp == "W")
                        {
                            $this->ImageInfo['h']["GPSDestLongitudeRef"] = "West Longitude";
                        }
                        else
                        {
                            $this->ImageInfo['h']["GPSDestLongitudeRef"] = "Reserved";
                        }
                    }

                    break;
                case TAG_GPS_GPSDestLongitude: /* Longitude of destination               GPSDestLongitude    22     */
                    $this->ImageInfo['h']["GPSDestLongitude"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_GPS_GPSDestBearingRef: /* Reference for bearing of destination   GPSDestBearingRef   23     */
                    $this->ImageInfo['h']["GPSDestBearingRef"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_GPS_GPSDestBearing: /* Bearing of destination                 GPSDestBearing      24     */
                    $this->ImageInfo['h']["GPSDestBearing"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_GPS_GPSDestDistanceRef: /* Reference for distance to destination  GPSDestDistanceRef  25     */
                    $this->ImageInfo['h']["GPSDestDistanceRef"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_GPS_GPSDestDistance: /* Distance to destination                GPSDestDistance     26     */
                    //$this->ImageInfo['h']["GPSDestDistance"] = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["GPSDestDistance"] = sprintf("%4.2f (%d/%d)", (double)$tmp[0], $tmp[1][0], $tmp[1][1]);;
                    break;
                case TAG_GPS_GPSProcessingMethod: /* Name of GPS processing method          GPSProcessingMethod 27     */
                    //$this->ImageInfo['h']["GPSProcessingMethod"] = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["GPSProcessingMethod"] = sprintf("%4.2f (%d/%d)", (double)$tmp[0], $tmp[1][0], $tmp[1][1]);;
                    break;
                case TAG_GPS_GPSAreaInformation: /* Name of GPS area                       GPSAreaInformation  28     */
                    $this->ImageInfo['h']["GPSAreaInformation"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_GPS_GPSDateStamp: /* GPS date                               GPSDateStamp        29     */
                    $this->ImageInfo['h']["GPSDateStamp"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_GPS_GPSDifferential: /* GPS differential correction            GPSDifferential     30     */
                    $this->ImageInfo['h']["GPSDifferential"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;

                case TAG_AUDIO_MU_LAW:
                    $this->ImageInfo['h']["AudioMuLaw"] = $this->ConvertAnyFormat($ValuePtr, $Format);
                    break;
                case TAG_AUDIO_IMA_ADPCM_DESC: //  IMA-ADPCM Audio File Description Example - 40
                    $this->ImageInfo['h']["AudioIMA-ADPCM-DESC"] = $this->ConvertAnyFormat($ValuePtr, $Format);
                    break;
                case TAG_AUDIO_MU_LAW_DESC: //  µ-Law Audio File Description Sample - 50
                    $this->ImageInfo['h']["AudioMuLawDesc"] = $this->ConvertAnyFormat($ValuePtr, $Format);
                    break;

                case TAG_EXPOSURE_INDEX:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["ExposureIndex"] = sprintf("%4.2f (%d/%d)", (double)$tmp[0], $tmp[1][0], $tmp[1][1]);;
                    break;

                case TAG_SENSING_METHOD:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("1" => "Not Defined", "2" => "One-chip color area sensor", "3" => "Two-chip color area sensor",
                        "4" => "Three -chip color area sensor", "5" => "Color sequential area sensor",
                        "6" => "Trilinear sensor", "7" => "Color sequential linear sensor"
                    );

                    $this->ImageInfo['h']["sensing"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    break;
                case TAG_SOUCE_TYPE:
                    $this->ImageInfo['h']["sourceType"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_SCENE_TYPE:
                    $this->ImageInfo['h']["sceneType"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_CFA_PATTERN:
                    $this->ImageInfo['h']["CFAPattern"] = $this->string_format(substr($ValuePtr, 0, $ByteCount));
                    break;
                case TAG_CUSTOM_RENDERED:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["customRendered"] = ($tmp == 0) ? 'Normal Process' : ($tmp == 1 ? 'Custom Process' : 'Reserved');
                    break;
                case TAG_EXPOSURE_MODE:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array('Auto Exposure', 'Manual Exposure', 'Auto Bracket');
                    $this->ImageInfo['h']["exposureMode"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    break;
                case TAG_WHITE_BALANCE:
                    $this->ImageInfo['h']["whiteBalance"] = $this->ConvertAnyFormat($ValuePtr, $Format);
                    break;
                case TAG_DIGITAL_ZOOM_RATIO:
                    $tmp = $this->ImageInfo['h']["zoomRatio"] = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["zoomRatio"] = sprintf("%4.2f (%d/%d)", (double)$tmp[0], $tmp[1][0], $tmp[1][1]);
                    break;
                case TAG_FLENGTH_IN35MM:
                    $this->ImageInfo['h']["flength35mm"] = $this->ConvertAnyFormat($ValuePtr, $Format);
                    break;
                case TAG_SCREEN_CAP_TYPE:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("Standard", "Landscape", "Portrait", "Night Scene");
                    $this->ImageInfo['h']["screenCaptureType"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    break;
                case TAG_GAIN_CONTROL:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("None", "Low Gain Up", "High Gain Up", "Low Gain Down", "High Gain Down");
                    $this->ImageInfo['h']["gainControl"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    break;
                case TAG_CONTRAST:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("Normal", "Soft", "Hard");
                    $this->ImageInfo['h']["contrast"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    break;
                case TAG_SATURATION:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("Normal", "Low Saturation", "High Saturation");
                    $this->ImageInfo['h']["saturation"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    break;
                case TAG_SHARPNESS:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("Normal", "Soft", "Hard");
                    $this->ImageInfo['h']["sharpness"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    break;
                case TAG_DIST_RANGE:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("Unknown", "Macro", "Close View", "Distant View");
                    $this->ImageInfo['h']["distanceRange"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    break;
                case TAG_DEVICE_SETTING_DESC:
                    /*
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("Unknown","Macro","Close View","Distant View");
                    $this->ImageInfo['h']["distanceRange"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    */
                    $this->ImageInfo['h']["deviceSettingDesc"] = "NOT IMPLEMENTED";
                    break;
                case TAG_COMPRESS_SCHEME:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("1" => "Uncompressed", "6" => "JPEG compression (thumbnails only)");
                    $this->ImageInfo['h']["compressScheme"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    break;
                case TAG_IMAGE_WD:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["jpegImageWidth"] = $tmp;
                    break;
                case TAG_IMAGE_HT:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["jpegImageHeight"] = $tmp;
                    break;
                case TAG_IMAGE_BPS:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["jpegBitsPerSample"] = $tmp;
                    break;
                case TAG_IMAGE_PHOTO_INT:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["jpegPhotometricInt"] = $tmp;
                    $tmpArr = array("2" => "RGB", "6" => "YCbCr");
                    $this->ImageInfo['h']["jpegPhotometricInt"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");

                    break;
                case TAG_IMAGE_SOFFSET:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["jpegStripOffsets"] = $tmp;
                    break;
                case TAG_IMAGE_SPP:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["jpegSamplesPerPixel"] = $tmp;
                    break;
                case TAG_IMAGE_RPS:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["jpegRowsPerStrip"] = $tmp;
                    break;
                case TAG_IMAGE_SBC:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["jpegStripByteCounts"] = $tmp;
                    break;
                case TAG_IMAGE_P_CONFIG:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $tmpArr = array("1" => "Chunky Format", "2" => "Planar Format");
                    $this->ImageInfo['h']["jpegPlanarConfig"] =
                        (isset($tmpArr["$tmp"]) ? $tmpArr["$tmp"] : "Reserved");
                    break;
                case TAG_FOCALPLANE_YRESOL:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["focalPlaneYResolution"] = sprintf("%4.2f (%d/%d)", (double)$tmp[0], $tmp[1][0], $tmp[1][1]);
                    break;
                case TAG_BRIGHTNESS:
                    $tmp = $this->ConvertAnyFormat($ValuePtr, $Format);
                    $this->ImageInfo['h']["brightness"] = sprintf("%4.2f (%d/%d)", (double)$tmp[0], $tmp[1][0], $tmp[1][1]);
                    break;
                //---------------------------------------------
                case TAG_EXIF_OFFSET:
                case TAG_INTEROP_OFFSET:
                {

                    $SubdirStart = substr($OffsetBase, $this->Get32u($ValuePtr[0], $ValuePtr[1], $ValuePtr[2], $ValuePtr[3]));
                    //if ($SubdirStart < $OffsetBase || $SubdirStart > $OffsetBase+$ExifLength){
                    //    debug("Illegal exif or interop ofset directory link",1);
                    //}else{
                    //echo "<h1>Calling sub-exif dir</h1>";
                    $this->ProcessExifDir($SubdirStart, $OffsetBase, $ExifLength);
                    //}
                    continue;
                }
                default:
                    {
                    $this->debug("UNKNOWN TAG: $Tag");
                    }
            }
        }

        {
            // In addition to linking to subdirectories via exif tags,
            // there's also a potential link to another directory at the end of each
            // directory.  this has got to be the result of a comitee!
            $tmpDirStart = substr($DirStart, 2 + 12 * $NumDirEntries);
            if (strlen($tmpDirStart) + 4 <= strlen($OffsetBase) + $ExifLength)
            {
                $Offset = $this->Get32u($tmpDirStart[0], $tmpDirStart[1], $tmpDirStart[2], $tmpDirStart[3]);
                if ($Offset)
                {
                    $SubdirStart = substr($OffsetBase, $Offset);
                    if (strlen($SubdirStart) > strlen($OffsetBase) + $ExifLength)
                    {
                        if (strlen($SubdirStart) < strlen($OffsetBase) + $ExifLength + 20)
                        {
                            // Jhead 1.3 or earlier would crop the whole directory!
                            // As Jhead produces this form of format incorrectness,
                            // I'll just let it pass silently
                        }
                        else
                        {
                            $this->errno = 51;
                            $this->errstr = "Illegal subdirectory link";
                            $this->debug($this->errstr, 1);
                        }
                    }
                    else
                    {
                        if (strlen($SubdirStart) <= strlen($OffsetBase) + $ExifLength)
                        {
                            $this->ProcessExifDir($SubdirStart, $OffsetBase, $ExifLength);
                        }
                    }
                }
            }
            else
            {
                // The exif header ends before the last next directory pointer.
            }
        }

        /**
         * Check if thumbnail has been cached or not.
         * If yes! then read the file.
         */
        /*
        if(file_exists($this->thumbnail) && $this->caching && (filemtime($this->thumbnail) == filemtime($this->file) )) {
            $this->ImageInfo["h"]["Thumbnail"] = $this->thumbnail;
            $this->ImageInfo["h"]["ThumbnailSize"] =  sprintf("%d bytes",filesize($this->thumbnail));
        } else{
            if ($this->ThumbnailSize && $this->ThumbnailOffset){
                if ($this->ThumbnailSize + $this->ThumbnailOffset <= $ExifLength){
                    // The thumbnail pointer appears to be valid.  Store it.
                    $this->ImageInfo["h"]["Thumbnail"] = substr($OffsetBase,$this->ThumbnailOffset);

                    // Save the thumbnail /
                    if($this->caching && is_dir($this->cacheDir)) {
                        $this->saveThumbnail($this->thumbnail);
                        $this->ImageInfo["h"]["Thumbnail"] = $this->thumbnail;
                    }
                    $this->ImageInfo["h"]["ThumbnailSize"] =  sprintf("%d bytes",strlen($this->ImageInfo["h"]["Thumbnail"]));
                }
            }
        }
        */
    }
473527
function setAppsFolderPaths() {
    if (this.applicationType) return;
    this.appsFolderPaths = [];
    for (let i = 0; i < this.appsFolders.length; i++) {
        const path = this.destinationPath(this.directoryPath + this.appsFolders[i]);
        this.appsFolderPaths.push(path);
    }
}
871758
function getOutputDir(output) {
  var arr = output.split(path.sep);
  arr.pop();
  return arr.join(path.sep);
}
467657
function getModulesByDir (dir, scope = '') {
  const nodeModulesDir = getNodeModulesDir()
  const results = []
  const modules = fs.readdirSync(dir)

  if (!modules.length) {
    return results
  }

  modules.forEach(module => {
    if (module.startsWith('.')) {

    } else if (module.startsWith('@')) {
      const subDir = path.join(nodeModulesDir, module)
      const subModules = getModulesByDir(subDir, module)
      Array.prototype.push.call(results, ...subModules)
    } else {
      results.push(scope ? `${scope}/${module}` : module)
    }
  })

  return results
}
370223
def _blkid_output(out, fs_type=None):
    '''
    
    '''
    flt = lambda data: [el for el in data if el.strip()]
    data = {}
    for dev_meta in flt(out.split('\n\n')):
        dev = {}
        for items in flt(dev_meta.strip().split('\n')):
            key, val = items.split('=', 1)
            dev[key.lower()] = val
        if fs_type and dev.get('type', '') == fs_type or not fs_type:
            if 'type' in dev and fs_type:
                dev.pop('type')
            data[dev.pop('devname')] = dev

    if fs_type:
        mounts = _get_mounts(fs_type)
        for device in six.iterkeys(mounts):
            if data.get(device):
                data[device]['mounts'] = mounts[device]

    return data
503957
def folders(self, mountPoint):
        
        if isinstance(mountPoint, six.string_types):
            # shortcut: pass a mountpoint name
            mountPoint = self.mountPoints[mountPoint]
        try:
            return [JFSFolder(f, self, parentpath='%s/%s' % (self.path, mountPoint.name)) for f in self.contents(mountPoint).folders.iterchildren()]
        except AttributeError as err:
            # no files at all
            return [x for x in []]
767366
def __d2f(disc_coords, v):
        
        return np.array([disc_coords[0] / v.shape[0],
                         disc_coords[1] / v.shape[1],
                         disc_coords[2] / v.shape[2]])
1144455
protected function parseFiles(array $dirs, $fileMatch, $cacheDir = null)
    {
        $files   = $this->filesystem->getFilesOfDirs($dirs, $fileMatch);
        $results = [];

        $tmpFile  = $cacheDir !== null ? $cacheDir . '/' . $this->getCacheFile() : null;
        $oldCache = [];

        if ($tmpFile !== null && file_exists($tmpFile)) {
            $oldCache = unserialize(file_get_contents($tmpFile));
        }

        foreach ($files as $file) {
            $realPath = $file->getRealPath();
            if (!$realPath) {
                return [];
            }

            $hash = $this->filesystem->getFileHash($realPath);

            if (isset($oldCache[$hash])) {
                $fileResult = $this->fromCache($oldCache[$hash], $file);
                unset($oldCache[$hash]);
            } else {
                $fileResult = $this->parseFile($realPath);
            }

            $results[$hash] = $fileResult;
        }

        if ($tmpFile !== null) {
            $this->filesystem->writeFile(
                $tmpFile,
                serialize($results)
            );
        }

        return $results;
    }