Formats the Multple IdP certs.
192063
public function formatIdPCertMulti()
    {
        if (isset($this->_idp['x509certMulti'])) {
            if (isset($this->_idp['x509certMulti']['signing'])) {
                foreach ($this->_idp['x509certMulti']['signing'] as $i => $cert) {
                    $this->_idp['x509certMulti']['signing'][$i] = OneLogin_Saml2_Utils::formatCert($cert);
                }
            }
            if (isset($this->_idp['x509certMulti']['encryption'])) {
                foreach ($this->_idp['x509certMulti']['encryption'] as $i => $cert) {
                    $this->_idp['x509certMulti']['encryption'][$i] = OneLogin_Saml2_Utils::formatCert($cert);
                }
            }
        }
    }
1021682
def from_signed_raw(cls: Type[CertificationType], signed_raw: str) -> CertificationType:
        
        n = 0
        lines = signed_raw.splitlines(True)

        version = int(Identity.parse_field("Version", lines[n]))
        n += 1

        Certification.parse_field("Type", lines[n])
        n += 1

        currency = Certification.parse_field("Currency", lines[n])
        n += 1

        pubkey_from = Certification.parse_field("Issuer", lines[n])
        n += 1

        identity_pubkey = Certification.parse_field("IdtyIssuer", lines[n])
        n += 1

        identity_uid = Certification.parse_field("IdtyUniqueID", lines[n])
        n += 1

        identity_timestamp = BlockUID.from_str(Certification.parse_field("IdtyTimestamp", lines[n]))
        n += 1

        identity_signature = Certification.parse_field("IdtySignature", lines[n])
        n += 1

        timestamp = BlockUID.from_str(Certification.parse_field("CertTimestamp", lines[n]))
        n += 1

        signature = Certification.parse_field("Signature", lines[n])

        identity = Identity(version, currency, identity_pubkey, identity_uid, identity_timestamp, identity_signature)

        return cls(version, currency, pubkey_from, identity, timestamp, signature)
1148999
def MultiWritePathInfos(self, path_infos):
    """"""
    try:
      self._MultiWritePathInfos(path_infos)
    except MySQLdb.IntegrityError as error:
      client_ids = list(iterkeys(path_infos))
      raise db.AtLeastOneUnknownClientError(client_ids=client_ids, cause=error)
1212437
def _format_args():
        """"""
        if request and request.args.get('prettyprint'):
            return dict(
                indent=2,
                separators=(', ', ': '),
            )
        else:
            return dict(
                indent=None,
                separators=(',', ':'),
            )
908740
public void formatUnits(List<UnitValue> values, StringBuilder destination, UnitFormatOptions options) {
    int size = values.size();
    for (int i = 0; i < size; i++) {
      if (i > 0) {
        destination.append(' ');
      }
      formatUnit(values.get(i), destination, options);
    }
  }
906471
def _format_info(data):
    '''
    
    '''
    return {'gid': data.pw_gid,
            'groups': list_groups(data.pw_name),
            'home': data.pw_dir,
            'name': data.pw_name,
            'shell': data.pw_shell,
            'uid': data.pw_uid,
            'fullname': data.pw_gecos}
830844
def combine_sig(
    global_R: Ed25519PublicPoint, sigs: Iterable[Ed25519Signature]
) -> Ed25519Signature:
    """"""
    S = [_ed25519.decodeint(si) for si in sigs]
    s = sum(S) % _ed25519.l
    sig = global_R + _ed25519.encodeint(s)
    return Ed25519Signature(sig)
899344
def process_json_rec(self, data, name, idx, sub_idx):
        
        ret = []
        if isinstance(data, list):
            for kidx, rec in enumerate(data):
                sub = self.process_json_rec(rec, name, idx, list(sub_idx + [kidx]))
                ret.append(sub)
            return ret

        if isinstance(data, dict):
            for key in data:
                rec = data[key]
                sub = self.process_json_rec(rec, name, idx, list(sub_idx + [rec]))
                ret.append(sub)

            if 'n' in data:
                ret.append(self.process_js_mod(data['n'], name, idx, sub_idx))
            if 'mod' in data:
                ret.append(self.process_js_mod(data['mod'], name, idx, sub_idx))
            if 'cert' in data:
                ret.append(self.process_js_certs([data['cert']], name, idx, sub_idx))
            if 'certs' in data:
                ret.append(self.process_js_certs(data['certs'], name, idx, sub_idx))
        return ret
914750
function formats () {
        var pub = {};

        pub.email = function (val) {
            if (!revalidator.validate.formats.email.test(val)) {
                return getResult(getError('format', 'email', val));
            }

            return getResult(null);
        };
        pub.ipAddress = function (val) {
            if (!revalidator.validate.formats['ip-address'].test(val)) {
                return getResult(getError('format', 'ip-address', val));
            }

            return getResult(null);
        };
        pub.ipv6 = function (val) {
            if (!revalidator.validate.formats.ipv6.test(val)) {
                return getResult(getError('format', 'ipv6', val));
            }

            return getResult(null);
        };
        pub.dateTime = function (val) {
            if (!revalidator.validate.formats['date-time'].test(val)) {
                return getResult(getError('format', 'date-time', val));
            }

            return getResult(null);
        };
        pub.date = function (val) {
            if (!revalidator.validate.formats.date.test(val)) {
                return getResult(getError('format', 'date', val));
            }

            return getResult(null);
        };
        pub.time = function (val) {
            if (!revalidator.validate.formats.time.test(val)) {
                return getResult(getError('format', 'time', val));
            }

            return getResult(null);
        };
        pub.color = function (val) {
            if (!revalidator.validate.formats.color.test(val)) {
                return getResult(getError('format', 'color', val));
            }

            return getResult(null);
        };
        pub.hostName = function (val) {
            if (!revalidator.validate.formats['host-name'].test(val)) {
                return getResult(getError('format', 'host-name', val));
            }

            return getResult(null);
        };
        pub.utcMillisec = function (val) {
            if (!revalidator.validate.formats['utc-millisec'].test(val)) {
                return getResult(getError('format', 'utc-millisec', val));
            }

            return getResult(null);
        };
        pub.regex = function (val) {
            if (!(val instanceof RegExp)) {
                return getResult(getError('format', 'regex', val));
            }

            return getResult(null);
        };
        pub.url = function (val) {
            if (!revalidator.validate.formatExtensions.url.test(val)) {
                return getResult(getError('format', 'url', val));
            }

            return getResult(null);
        };
        pub.mongoId = function (val) {
            if (!revalidator.validate.formats['mongo-id'].test(val)) {
                return getResult(getError('format', 'mongoId', val));
            }

            return getResult(null);
        };
        pub.uuid = function (val) {
            if (!revalidator.validate.formats['uuid'].test(val)) {
                return getResult(getError('format', 'uuid', val));
            }

            return getResult(null);
        };
        pub.luuid = function (val) {
            if (!revalidator.validate.formats['luuid'].test(val)) {
                return getResult(getError('format', 'luuid', val));
            }

            return getResult(null);
        };
        pub.numberFloat = function (val) {
            if (typeof val !== 'string' || !revalidator.validate.formats['number-float'].test(val)) {
                return getResult(getError('format', 'float', val));
            }

            return getResult(null);
        };
        pub.float = function (val) {
            if (typeof val !== 'string' || !revalidator.validate.formats['float'].test(val)) {
                return getResult(getError('format', 'float', val));
            }

            return getResult(null);
        };
        pub.integer = function (val) {
            if (typeof val !== 'string' || !revalidator.validate.formats['integer'].test(val)) {
                return getResult(getError('format', 'integer', val));
            }

            return getResult(null);
        };
        pub.timestamp = function (val) {
            if (!revalidator.validate.formats['timestamp'].test(val)) {
                return getResult(getError('format', 'timestamp', val));
            }

            return getResult(null);
        };
        pub.empty = function (val) {
            if (!revalidator.validate.formats['empty'].test(val)) {
                return getResult(getError('format', 'empty', val));
            }

            return getResult(null);
        };

        return pub;
    }
133708
def _validate_cert_format(name):
    '''
    
    '''
    cert_formats = ['cer', 'pfx']

    if name not in cert_formats:
        message = ("Invalid certificate format '{0}' specified. Valid formats:"
                   ' {1}').format(name, cert_formats)
        raise SaltInvocationError(message)
489304
def split_interface(intf_name):
    """"""
    head = intf_name.rstrip(r"/\0123456789. ")
    tail = intf_name[len(head) :].lstrip()
    return (head, tail)
379877
public function formatData(string $interface, string $version, string $method, array $params): array
    {
        return [
            'interface' => $interface,
            'version' => $version,
            'method' => $method,
            'params' => $params,
            'logid' => RequestContext::getLogid(),
            'spanid' => RequestContext::getSpanid() + 1,
        ];
    }
259034
def _generate_id_maps(self, unique_stmts, poolsize=None,
                          size_cutoff=100, split_idx=None):
        """"""
        # Check arguments relating to multiprocessing
        if poolsize is None:
            logger.debug('combine_related: poolsize not set, '
                         'not using multiprocessing.')
            use_mp = False
        elif sys.version_info[0] >= 3 and sys.version_info[1] >= 4:
            use_mp = True
            logger.info('combine_related: Python >= 3.4 detected, '
                        'using multiprocessing with poolsize %d, '
                        'size_cutoff %d' % (poolsize, size_cutoff))
        else:
            use_mp = False
            logger.info('combine_related: Python < 3.4 detected, '
                        'not using multiprocessing.')
        eh = self.hierarchies['entity']
        # Make a list of Statement types
        stmts_by_type = collections.defaultdict(lambda: [])
        for idx, stmt in enumerate(unique_stmts):
            stmts_by_type[indra_stmt_type(stmt)].append((idx, stmt))

        child_proc_groups = []
        parent_proc_groups = []
        skipped_groups = 0
        # Each Statement type can be preassembled independently
        for stmt_type, stmts_this_type in stmts_by_type.items():
            logger.info('Grouping %s (%s)' %
                        (stmt_type.__name__, len(stmts_this_type)))
            stmt_by_group = self._get_stmt_by_group(stmt_type, stmts_this_type,
                                                    eh)

            # Divide statements by group size
            # If we're not using multiprocessing, then all groups are local
            for g_name, g in stmt_by_group.items():
                if len(g) < 2:
                    skipped_groups += 1
                    continue
                if use_mp and len(g) >= size_cutoff:
                    child_proc_groups.append(g)
                else:
                    parent_proc_groups.append(g)

        # Now run preassembly!
        logger.debug("Groups: %d parent, %d worker, %d skipped." %
                     (len(parent_proc_groups), len(child_proc_groups),
                      skipped_groups))

        supports_func = functools.partial(_set_supports_stmt_pairs,
                                          hierarchies=self.hierarchies,
                                          split_idx=split_idx,
                                          check_entities_match=False)

        # Check if we are running any groups in child processes; note that if
        # use_mp is False, child_proc_groups will be empty
        if child_proc_groups:
            # Get a multiprocessing context
            ctx = mp.get_context('spawn')
            pool = ctx.Pool(poolsize)
            # Run the large groups remotely
            logger.debug("Running %d groups in child processes" %
                         len(child_proc_groups))
            res = pool.map_async(supports_func, child_proc_groups)
            workers_ready = False
        else:
            workers_ready = True

        # Run the small groups locally
        logger.debug("Running %d groups in parent process" %
                     len(parent_proc_groups))
        stmt_ix_map = [supports_func(stmt_tuples)
                       for stmt_tuples in parent_proc_groups]
        logger.debug("Done running parent process groups")

        while not workers_ready:
            logger.debug("Checking child processes")
            if res.ready():
                workers_ready = True
                logger.debug('Child process group comparisons successful? %s' %
                             res.successful())
                if not res.successful():
                    raise Exception("Sorry, there was a problem with "
                                    "preassembly in the child processes.")
                else:
                    stmt_ix_map += res.get()
                logger.debug("Closing pool...")
                pool.close()
                logger.debug("Joining pool...")
                pool.join()
                logger.debug("Pool closed and joined.")
            time.sleep(1)
        logger.debug("Done.")
        # Combine all redundant map edges
        stmt_ix_map_set = set([])
        for group_ix_map in stmt_ix_map:
            for ix_pair in group_ix_map:
                stmt_ix_map_set.add(ix_pair)
        return stmt_ix_map_set
1210827
public function formatSPCert()
    {
        if (isset($this->_sp['x509cert'])) {
            $this->_sp['x509cert'] = OneLogin_Saml2_Utils::formatCert($this->_sp['x509cert']);
        }
    }
655644
function format(err, options) {
    const error = { message: 'Internal Server Error' };

    options = options || {};

    if (options.exposeErrors || (err.httpStatusCode && err.httpStatusCode < 500)) {
        error.message = err.message;
        if (err.code) error.code = err.code;
        if (err.validation) error.validation = err.validation;
    }

    if (options.exposeErrors) {
        if (err.stack) error.stack = err.stack.split(/\r?\n/);

        if (err.info) {
            Object.keys(err.info).forEach(key => {
                if (!has(error, key) && has(err.info, key)) error[key] = err.info[key];
            });
        }
    }

    return error;
}
677351
def split_sig(params):
    
    result = []
    current = ''
    level = 0
    for char in params:
        if char in ('<', '{', '['):
            level += 1
        elif char in ('>', '}', ']'):
            level -= 1
        if char != ',' or level > 0:
            current += char
        elif char == ',' and level == 0:
            result.append(current)
            current = ''
    if current.strip() != '':
        result.append(current)
    return result
510983
private function formatGs1128() {
        $formatedText = '~F1';
        $formatedLabel = '';
        $c = count($this->identifiersId);

        for ($i = 0; $i < $c; $i++) {
            if ($i > 0) {
                $formatedLabel .= ' ';
            }

            if ($this->identifiersId[$i] !== null) {
                $formatedLabel .= '(' . $this->identifiersId[$i] . ')';
            }

            $formatedText .= $this->identifiersId[$i];

            $formatedLabel .= $this->identifiersContent[$i];
            $formatedText .= $this->identifiersContent[$i];

            if (isset($this->identifiersAi[$this->identifiersId[$i]])) {
                $ai_data = $this->identifiersAi[$this->identifiersId[$i]];
            } elseif (isset($this->identifiersId[$i][3])) {
                $identifierWithVar = substr($this->identifiersId[$i], 0, -1) . 'y';
                $ai_data = isset($this->identifiersAi[$identifierWithVar]) ? $this->identifiersAi[$identifierWithVar] : null;
            } else {
                $ai_data = null;
            }

            /* We'll check if we need to add a ~F1 (<GS>) char */
            /* If we use the legacy mode, we always add a ~F1 (<GS>) char between AIs */
            if ($ai_data !== null) {
                if ((strlen($this->identifiersContent[$i]) < $ai_data[self::MAXLENGTH] && ($i + 1) !== $c) || (!$this->strictMode && ($i + 1) !== $c)) {
                    $formatedText .= '~F1';
                }
            } elseif ($this->allowsUnknownIdentifier && $this->identifiersId[$i] === null && ($i + 1) !== $c) {
                /* If this id is unknown, we add a ~F1 (<GS>) char */
                $formatedText .= '~F1';
            }
        }

        if ($this->noLengthLimit === false && (strlen(str_replace('~F1', chr(29), $formatedText)) - 1) > self::MAX_GS1128_CHARS) {
            throw new CINParseException('gs1128', 'The barcode can\'t contain more than ' . self::MAX_GS1128_CHARS . ' characters.');
        }

        $this->label = $formatedLabel;
        return $formatedText;
    }