/*!
\return a translated string describing the progress
173597
function progressText()
    {
        if ( $this->Progress == self::PROGRESS_UNKNOWN )
        {
            return ezpI18n::tr( 'ezscriptmonitor', 'Unknown' );
        }

        if ( $this->Progress < 0 )
        {
            return '0%';
        }

        if ( $this->Progress > 100 )
        {
            return '100%';
        }

        return $this->Progress . '%';
    }
60543
public function get_progress_bar() {
        global $PAGE;

        $stage = self::STAGE_COMPLETE;
        $currentstage = $this->stage->get_stage();
        $items = array();
        while ($stage > 0) {
            $classes = array('backup_stage');
            if (floor($stage / 2) == $currentstage) {
                $classes[] = 'backup_stage_next';
            } else if ($stage == $currentstage) {
                $classes[] = 'backup_stage_current';
            } else if ($stage < $currentstage) {
                $classes[] = 'backup_stage_complete';
            }
            $item = array('text' => strlen(decbin($stage)).'. '.get_string('restorestage'.$stage, 'backup'), 'class' => join(' ', $classes));
            if ($stage < $currentstage && $currentstage < self::STAGE_COMPLETE && $stage > self::STAGE_DESTINATION) {
                $item['link'] = new moodle_url($PAGE->url, array('restore' => $this->get_restoreid(), 'stage' => $stage));
            }
            array_unshift($items, $item);
            $stage = floor($stage / 2);
        }
        return $items;
    }
475702
def progress(self, value, new_status=None):
    
    space_fillers = 0

    if new_status is not None:
      # if new text is shorter, then we need fill previously used place
      space_fillers = len(self._status_msg) - len(new_status) if self._status_msg and len(self._status_msg) - len(new_status) > 0 else 0
      self._status_msg = new_status

    if not self._infinite_mode and value > self._max:
      self._infinite_mode = True
      self._fill_empty()

    self._timer.tick(value)

    if not self._infinite_mode:
      percent_done = self._calc_percent_done(value)
      filled = self._options.fill_char * int(self._calc_filled_space(percent_done))
      empty = self._options.blank_char * int(self._calc_empty_space(percent_done))
    else:
      percent_done = 100
      self._infinite_position = 1 if self._infinite_position + self._infinite_width >= self._width else self._infinite_position + 1
      filled = "%s%s" % (self._options.blank_char * (self._infinite_position - self._infinite_width), self._options.fill_char * self._infinite_width)
      empty = self._options.blank_char * int(self._width - self._infinite_position)

    kwargs = {
      "begin_line": self._begin_line_character,
      "text": self._text,
      "status": self._status_msg,
      "end_line": " " * space_fillers,
      "filled": filled,
      "reverse_filled": filled[::-1],
      "empty": empty,
      "value": int(value),
      "max": int(self._max),
      "items_per_sec": self._timer.unit_per_sec,
      "percents_done": percent_done
    }

    self.stdout.write(safe_format(self._options.progress_format.value, **kwargs))
    self.stdout.flush()
411070
def progress(self):
        
        return Progress(
            done=len(self._get_all_set_properties()),
            base=len(worker_mapping()),
        )
901052
function (e) {
			var $progress = $('.progress:first', this.$el),
					complete;

			if (e.lengthComputable) {
				complete = e.loaded / e.total * 100;
				complete = complete ? complete : 0;
				$progress.attr('value', complete);
				$progress.html(complete);
			}
		}
54084
function(onProgress) {
        onProgress = onProgress || function() {};
        library.autosave(false);
        let modules_urls = [
            'https://api.unfoldingword.org/ta/txt/1/en/audio_2.json',
            'https://api.unfoldingword.org/ta/txt/1/en/checking_1.json',
            'https://api.unfoldingword.org/ta/txt/1/en/checking_2.json',
            'https://api.unfoldingword.org/ta/txt/1/en/gateway_3.json',
            'https://api.unfoldingword.org/ta/txt/1/en/intro_1.json',
            'https://api.unfoldingword.org/ta/txt/1/en/process_1.json',
            'https://api.unfoldingword.org/ta/txt/1/en/translate_1.json',
            'https://api.unfoldingword.org/ta/txt/1/en/translate_2.json'
        ];
        return promiseUtils.chain(downloadTA, function(err, data) {
            if(err instanceof Error) return Promise.reject(err);
            console.log(err);
            return false;
        }, {compact: true, onProgress: onProgress.bind(null, 'ta')})(modules_urls)
            .then(function() {
                library.commit();
                library.autosave(true);
                return Promise.resolve();
            })
            .catch(function(err) {
                library.autosave(true);
                return Promise.reject(err);
            });
    }
73078
def format_progress(i, n):
    """"""
    if n == 0:
        fraction = 0
    else:
        fraction = float(i)/n
    LEN_BAR = 25
    num_plus = int(round(fraction*LEN_BAR))
    s_plus = '+'*num_plus
    s_point = '.'*(LEN_BAR-num_plus)
    return '[{0!s}{1!s}] {2:d}/{3:d} - {4:.1f}%'.format(s_plus, s_point, i, n, fraction*100)
549873
def progress(rest):
	""
	if rest:
		left, right, amount = [piece.strip() for piece in rest.split('|')]
		ticks = min(int(round(float(amount) / 10)), 10)
		bar = "=" * ticks
		return "%s [%-10s] %s" % (left, bar, right)
1241623
public static function progress(
        string $content = null, 
        array $attributes = []
    ) : string
    {
        return self::tag("progress", $content, $attributes);
    }
817035
protected function _extractTokens()
    {
        /** @var \Cake\Shell\Helper\ProgressHelper $progress */
        $progress = $this->helper('progress');
        $progress->init(['total' => count($this->_files)]);
        $isVerbose = $this->param('verbose');

        $functions = [
            '__' => ['singular'],
            '__n' => ['singular', 'plural'],
            '__d' => ['domain', 'singular'],
            '__dn' => ['domain', 'singular', 'plural'],
            '__x' => ['context', 'singular'],
            '__xn' => ['context', 'singular', 'plural'],
            '__dx' => ['domain', 'context', 'singular'],
            '__dxn' => ['domain', 'context', 'singular', 'plural'],
        ];
        $pattern = '/(' . implode('|', array_keys($functions)) . ')\s*\(/';

        foreach ($this->_files as $file) {
            $this->_file = $file;
            if ($isVerbose) {
                $this->out(sprintf('Processing %s...', $file), 1, Shell::VERBOSE);
            }

            $code = file_get_contents($file);

            if (preg_match($pattern, $code) === 1) {
                $allTokens = token_get_all($code);

                $this->_tokens = [];
                foreach ($allTokens as $token) {
                    if (!is_array($token) || ($token[0] !== T_WHITESPACE && $token[0] !== T_INLINE_HTML)) {
                        $this->_tokens[] = $token;
                    }
                }
                unset($allTokens);

                foreach ($functions as $functionName => $map) {
                    $this->_parse($functionName, $map);
                }
            }

            if (!$isVerbose) {
                $progress->increment(1);
                $progress->draw();
            }
        }
    }
445539
public function get_progress_bar() {
        global $PAGE;
        $stage = restore_ui::STAGE_COMPLETE;
        $currentstage = $this->get_stage();
        $items = array();
        while ($stage > 0) {
            $classes = array('backup_stage');
            if (floor($stage / 2) == $currentstage) {
                $classes[] = 'backup_stage_next';
            } else if ($stage == $currentstage) {
                $classes[] = 'backup_stage_current';
            } else if ($stage < $currentstage) {
                $classes[] = 'backup_stage_complete';
            }
            $item = array('text' => strlen(decbin($stage)).'. '.get_string('restorestage'.$stage, 'backup'), 'class' => join(' ', $classes));
            if ($stage < $currentstage && $currentstage < restore_ui::STAGE_COMPLETE) {
                // By default you can't go back to independent stages, if that changes in the future uncomment the next line.
                // $item['link'] = new moodle_url($PAGE->url, array('restore' => $this->get_restoreid(), 'stage' => $stage));
            }
            array_unshift($items, $item);
            $stage = floor($stage / 2);
        }
        return $items;
    }
736097
function(promise, result, output, isProgress) {
				var element = document.createElement("div"); //$NON-NLS-0$

				var waitCount = 0;
				var successFn = function(file) {
					this.callback = function() {
						var string = i18nUtil.formatMessage(
							messages["WroteMsg"],
							typeof(file) === "string" ? file : this.shellPageFileService.computePathString(file)); //$NON-NLS-0$
						var writer = new mResultWriters.ShellStringWriter(element);
						writer.write(string + "\n"); //$NON-NLS-0$
						if (--waitCount !== 0 || isProgress) {
							promise.progress(element);
						} else {
							promise.resolve(element);
						}
					}.bind(this);
					return this;
				}.bind(this);
				var errorFn = function(file) {
					this.callback = function(error) {
						var string = i18nUtil.formatMessage(
							messages["WriteFailMsg"],
							typeof(file) === "string" ? file : this.shellPageFileService.computePathString(file)); //$NON-NLS-0$
						string += " [" + error + "]"; //$NON-NLS-1$ //$NON-NLS-0$
						var writer = new mResultWriters.ShellStringWriter(element);
						writer.write(string + "\n"); //$NON-NLS-0$
						if (--waitCount !== 0 || isProgress) {
							promise.progress(element);
						} else {
							promise.resolve(element);
						}
					}.bind(this);
					return this;
				}.bind(this);

				var destination = output || this.shellPageFileService.getCurrentDirectory();
				waitCount++;
				this.shellPageFileService.ensureDirectory(null, destination).then(
					function(directory) {
						waitCount--;

						var files = result.getValue();
						if (!result.isArray()) {
							files = [files];
						}
						files.forEach(function(file) {
							waitCount++;
							var pathSegments = file.path.split(this.shellPageFileService.SEPARATOR);

							/* normalize instances of '.' and '..' in the path */
							var index = 0;
							while (index < pathSegments.length) {
								var segment = pathSegments[index];
								if (segment === ".") { //$NON-NLS-0$
									pathSegments.splice(index, 1);
								} else if (segment === "..") { //$NON-NLS-0$
									if (index === 0) {
										/* invalid, destination must be a descendent of the cwd */
										errorFn(i18nUtil.formatMessage(messages["WriteFailNotDescendentOfOutputDir"], file.path));
										return;
									}
									pathSegments.splice(index-- - 1, 2);
								} else {
									index++;
								}
							}

							var writeFile = function(parentNode, fileToWrite, pathSegments) {
								var segment = pathSegments[0];
								pathSegments.splice(0,1);
								var nodeString = this.shellPageFileService.computePathString(parentNode) + this.shellPageFileService.SEPARATOR + segment;
								if (pathSegments.length === 0) {
									/* attempt to write the new resource */
									if (fileToWrite.isDirectory) {
										this.shellPageFileService.ensureDirectory(parentNode, segment).then(successFn(nodeString).callback, errorFn(nodeString).callback);
									} else {
										this.shellPageFileService.ensureFile(parentNode, segment).then(
											function(file) {
												var writer = new mResultWriters.FileBlobWriter(file, this.shellPageFileService);
												writer.addBlob(fileToWrite.blob);
												writer.write().then(successFn(file).callback, errorFn(file).callback);
											}.bind(this),
											errorFn(nodeString).callback
										);
									}
									return;
								}
								/* more lead-up path segments to go */
								this.shellPageFileService.ensureDirectory(parentNode, segment).then(
									function(newNode) {
										writeFile(newNode, fileToWrite, pathSegments);
									},
									errorFn(this.shellPageFileService.computePathString(parentNode) + this.shellPageFileService.SEPARATOR + segment).callback
								);
							}.bind(this);
							writeFile(directory, file, pathSegments);
						}.bind(this));
					}.bind(this),
					errorFn(destination).callback
				);
			}
428092
function uploadTranslationKit($fileName, $data){
		$result = "";
		$resourceInfo = new ResourceInfo();
		$resourceInfo->name = $fileName;
		$resourceInfo->size = strlen ( $data );
		
		// Upload file
		$workflowRequestTicket = $this->workflowService->upload($resourceInfo, $data)->return;
		
		// Wait until upload is done, or print error message if it failed
		$uploadFinished = false;
		while (!$uploadFinished) {
			// Create delay between two checkUploadAction calls
			sleep(DELAY_TIME);

			$uploadActionResult = $this->workflowService->checkUploadAction($workflowRequestTicket);

			$uploadFinished = $uploadActionResult->processingFinished->booleanValue;
			if ($uploadFinished && isset($uploadActionResult->messages)) {
				foreach($uploadActionResult->messages as &$message){
					$result = $result + $message+";";
				}
			}
		}
		
		return $result;
	}
522204
public static function progress()
    {
        static $filesize = null;

        $args           = func_get_args();
        $isCurlResource = is_resource($args[0]) && get_resource_type($args[0]) === 'curl';

        $notification_code = !$isCurlResource ? $args[0] : false;
        $bytes_transferred = $isCurlResource ? $args[2] : $args[4];

        if ($isCurlResource) {
            $filesize = $args[1];
        } elseif ($notification_code == STREAM_NOTIFY_FILE_SIZE_IS) {
            $filesize = $args[5];
        }

        if ($bytes_transferred > 0) {
            if ($notification_code == STREAM_NOTIFY_PROGRESS | STREAM_NOTIFY_COMPLETED || $isCurlResource) {

                $progress = [
                    'code'        => $notification_code,
                    'filesize'    => $filesize,
                    'transferred' => $bytes_transferred,
                    'percent'     => $filesize <= 0 ? '-' : round(($bytes_transferred * 100) / $filesize, 1)
                ];

                if (self::$callback !== null) {
                    call_user_func(self::$callback, $progress);
                }
            }
        }
    }
1036724
private function get_translation_string($num) {
        $length = $this->table_translations[$num * 2 + 1];
        $offset = $this->table_translations[$num * 2 + 2];
        if (!$length)
            return '';
        fseek($this->STREAM, $offset);
        $data = fread($this->STREAM, $length);
        return (string)$data;
    }
568227
protected function get_progress_trace_instance() {
        if ($this->progress === null) {
            if (!$this->table->is_downloading()) {
                $this->progress = new \core\progress\display_if_slow(get_string('calculatingallstats', 'quiz_statistics'));
                $this->progress->set_display_names();
            } else {
                $this->progress = new \core\progress\none();
            }
        }
        return $this->progress;
    }
159374
private void updateTranslationProgressMap(String appid, String langCode, int value) {
		if (dao == null || getDefaultLanguageCode().equals(langCode)) {
			return;
		}

		double defsize = getDefaultLanguage(appid).size();
		double approved = value;

		Map<String, Integer> progress = getTranslationProgressMap(appid);
		Integer percent = progress.get(langCode);
		if (value == PLUS) {
			approved = Math.round(percent * (defsize / 100) + 1);
		} else if (value == MINUS) {
			approved = Math.round(percent * (defsize / 100) - 1);
		}
		int allowedUntranslated = defsize > 10 ? 5 : 0;
		// allow 3 identical words per language (i.e. Email, etc)
		if (approved >= defsize - allowedUntranslated) {
			approved = defsize;
		}

		if (((int) defsize) == 0) {
			progress.put(langCode, 0);
		} else {
			progress.put(langCode, (int) ((approved / defsize) * 100));
		}
		Sysprop updatedProgress = new Sysprop(progressKey);
		for (Map.Entry<String, Integer> entry : progress.entrySet()) {
			updatedProgress.addProperty(entry.getKey(), entry.getValue());
		}
		langProgressCache = updatedProgress;
		if (percent < 100 && !percent.equals(progress.get(langCode))) {
			dao.create(appid, updatedProgress);
		}
	}