max_stars_count
int64
301
224k
text
stringlengths
6
1.05M
token_count
int64
3
727k
681
<filename>FeatureFlagsCo.Experiments/redismq/redis_health_check.py import logging from azure_service_bus.insight_utils import get_insight_logger from config.config_handling import get_config_value from experiment.health_check import HealthCheck engine = get_config_value('general', 'engine') if engine == 'azure' or engine == 'redis': trace_health_check_logger = get_insight_logger('trace_redis_health_check') else: trace_health_check_logger = logging.getLogger('trace_redis_health_check') trace_health_check_logger.setLevel(logging.INFO) debug_health_check_logger = logging.getLogger('debug_redis_health_check') debug_health_check_logger.setLevel(logging.INFO) class RedisHealthCheck(HealthCheck): def __init__(self, redis_host='localhost', redis_port=6379, redis_passwd='', redis_ssl=False, wait_timeout=180): super().__init__(redis_host=redis_host, redis_port=redis_port, redis_passwd=<PASSWORD>_passwd, ssl=redis_ssl, wait_timeout=wait_timeout, trace_health_check_logger=trace_health_check_logger, debug_health_check_logger=debug_health_check_logger, engine='redis')
649
594
<reponame>Skycoder42/QtAutoUpdater #include "qmlupdateinfomodel.h" using namespace QtAutoUpdater; QmlUpdateInfoModel::QmlUpdateInfoModel(QObject *parent) : QAbstractListModel{parent} {} int QmlUpdateInfoModel::rowCount(const QModelIndex &parent) const { Q_ASSERT(checkIndex(parent, CheckIndexOption::DoNotUseParent)); if (parent.isValid()) return 0; else return _updateInfos.size(); } QVariant QmlUpdateInfoModel::data(const QModelIndex &index, int role) const { Q_ASSERT(checkIndex(index, CheckIndexOption::IndexIsValid)); switch (role) { case NameRole: return _updateInfos[index.row()].name(); case VersionRole: return _updateInfos[index.row()].version().toString(); case SecondaryInfoRole: return _updateInfos[index.row()].data().value(_secondaryInfo); case IdentifierRole: return _updateInfos[index.row()].identifier(); case GadgetRole: return QVariant::fromValue(_updateInfos[index.row()]); default: return {}; } } QHash<int, QByteArray> QmlUpdateInfoModel::roleNames() const { static const QHash<int, QByteArray> roleNames { {NameRole, "name"}, {VersionRole, "version"}, {SecondaryInfoRole, "secondaryInfo"}, {IdentifierRole, "identifier"}, {GadgetRole, "gadget"} }; return roleNames; } void QmlUpdateInfoModel::setUpdateInfos(QList<QtAutoUpdater::UpdateInfo> updateInfos) { if (_updateInfos == updateInfos) return; beginResetModel(); _updateInfos = std::move(updateInfos); emit updateInfosChanged(_updateInfos); endResetModel(); }
542
1,454
#!/usr/bin/env python3 import os import sys import unittest import unittest.mock sys.path.insert( 0, os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)), "..")) ) import core.python.utils from core.python.utils import ( extract_cgid_from_dir_name, ip_address_or_range_is_valid, normalize_scenario_name, find_scenario_instance_dir, ) class TestUtilityFunctions(unittest.TestCase): def test_extract_cgid_from_dir_name(self): self.assertEqual(extract_cgid_from_dir_name("codebuild_secrets"), None) self.assertEqual(extract_cgid_from_dir_name("/codebuild_secrets"), None) self.assertEqual(extract_cgid_from_dir_name("scenarios/ec2_ssrf"), None) self.assertEqual(extract_cgid_from_dir_name("/scenarios/ec2_ssrf"), None) self.assertEqual( extract_cgid_from_dir_name("long/path/iam_privesc_by_attachment"), None ) self.assertEqual( extract_cgid_from_dir_name("/long/path/iam_privesc_by_attachment"), None ) self.assertEqual( extract_cgid_from_dir_name("long/path/rce_web_app/even/longer/path"), None ) self.assertEqual( extract_cgid_from_dir_name("/long/path/rce_web_app/even/longer/path"), None ) self.assertEqual( extract_cgid_from_dir_name("codebuild_secrets_cgid0123456789"), "cgid0123456789", ) self.assertEqual( extract_cgid_from_dir_name("/codebuild_secrets_cgid0123456789"), "cgid0123456789", ) self.assertEqual( extract_cgid_from_dir_name("scenarios/ec2_ssrf_cgid0123456789"), "cgid0123456789", ) self.assertEqual( extract_cgid_from_dir_name("/scenarios/ec2_ssrf_cgid0123456789"), "cgid0123456789", ) self.assertEqual( extract_cgid_from_dir_name( "long/path/iam_privesc_by_attachment_cgid0123456789" ), "cgid0123456789", ) self.assertEqual( extract_cgid_from_dir_name( "/long/path/iam_privesc_by_attachment_cgid0123456789" ), "cgid0123456789", ) self.assertEqual( extract_cgid_from_dir_name( "long/path/rce_web_app_cgid0123456789/even/longer/path" ), "cgid0123456789", ) self.assertEqual( extract_cgid_from_dir_name( "/long/path/rce_web_app_cgid0123456789/even/longer/path" ), "cgid0123456789", ) def test_ip_address_or_range_is_valid(self): # IPv4 CIDR notation is required. self.assertEqual(ip_address_or_range_is_valid("127.0.0.1"), False) self.assertEqual(ip_address_or_range_is_valid("127.0.0.1/"), False) self.assertEqual(ip_address_or_range_is_valid("127.0.0.1//32"), False) self.assertEqual(ip_address_or_range_is_valid("127.0.0.1\\32"), False) # Octets must be valid. self.assertEqual(ip_address_or_range_is_valid(".0.0.1/32"), False) self.assertEqual(ip_address_or_range_is_valid("127.0.0./32"), False) self.assertEqual(ip_address_or_range_is_valid("127..0.1/32"), False) self.assertEqual(ip_address_or_range_is_valid("127.0..1/32"), False) self.assertEqual(ip_address_or_range_is_valid("127...1/32"), False) self.assertEqual(ip_address_or_range_is_valid("..0.1/32"), False) self.assertEqual(ip_address_or_range_is_valid("127..0./32"), False) self.assertEqual(ip_address_or_range_is_valid(".0..1/32"), False) self.assertEqual(ip_address_or_range_is_valid("127.0../32"), False) self.assertEqual(ip_address_or_range_is_valid("...1/32"), False) self.assertEqual(ip_address_or_range_is_valid("127.../32"), False) self.assertEqual(ip_address_or_range_is_valid("127.0.0.0.1/32"), False) self.assertEqual(ip_address_or_range_is_valid("127.0.1/32"), False) self.assertEqual(ip_address_or_range_is_valid("127.1/32"), False) self.assertEqual(ip_address_or_range_is_valid("127/32"), False) self.assertEqual(ip_address_or_range_is_valid("/32"), False) self.assertEqual(ip_address_or_range_is_valid("255.255.255.256/32"), False) self.assertEqual(ip_address_or_range_is_valid("255.255.256.255/32"), False) self.assertEqual(ip_address_or_range_is_valid("255.256.255.255/32"), False) self.assertEqual(ip_address_or_range_is_valid("256.255.255.255/32"), False) self.assertEqual(ip_address_or_range_is_valid("255.255.255.-1/32"), False) self.assertEqual(ip_address_or_range_is_valid("255.255.-1.255/32"), False) self.assertEqual(ip_address_or_range_is_valid("255.-1.255.255/32"), False) self.assertEqual(ip_address_or_range_is_valid("-1.255.255.255/32"), False) self.assertEqual(ip_address_or_range_is_valid("127.0.0.I/32"), False) self.assertEqual(ip_address_or_range_is_valid("127.0.O.1/32"), False) self.assertEqual(ip_address_or_range_is_valid("127.O.0.1/32"), False) self.assertEqual(ip_address_or_range_is_valid("I27.0.0.1/32"), False) self.assertEqual(ip_address_or_range_is_valid("0.0.0.0/32"), True) self.assertEqual(ip_address_or_range_is_valid("255.255.255.255/32"), True) # Subnets must be valid. self.assertEqual(ip_address_or_range_is_valid("127.0.0.1/-33"), False) self.assertEqual(ip_address_or_range_is_valid("127.0.0.1/-32"), False) self.assertEqual(ip_address_or_range_is_valid("127.0.0.1/-1"), False) self.assertEqual(ip_address_or_range_is_valid("127.0.0.1/0"), True) self.assertEqual(ip_address_or_range_is_valid("127.0.0.1/O"), False) self.assertEqual(ip_address_or_range_is_valid("127.0.0.1/1"), True) self.assertEqual(ip_address_or_range_is_valid("127.0.0.1/32"), True) self.assertEqual(ip_address_or_range_is_valid("127.0.0.1/33"), False) def test_normalize_scenario_name(self): # Edge cases self.assertEqual(normalize_scenario_name(""), "") self.assertEqual(normalize_scenario_name("/"), "") self.assertEqual(normalize_scenario_name("/////"), "") # Simple cases, fake scenario names self.assertEqual(normalize_scenario_name("test_a/"), "test_a") self.assertEqual(normalize_scenario_name("/test_b"), "test_b") self.assertEqual(normalize_scenario_name("test_a/test_b"), "test_b") self.assertEqual(normalize_scenario_name("/test_a/test_b"), "test_b") # "scenarios" directory self.assertEqual(normalize_scenario_name("scenarios"), "scenarios") self.assertEqual(normalize_scenario_name("scenarios/"), "scenarios") self.assertEqual(normalize_scenario_name("/scenarios"), "scenarios") self.assertEqual(normalize_scenario_name("test_a/scenarios"), "scenarios") self.assertEqual(normalize_scenario_name("scenarios/test_b"), "test_b") self.assertEqual(normalize_scenario_name("test_a/scenarios/test_b"), "test_b") # Real scenario names self.assertEqual(normalize_scenario_name("rce_web_app/"), "rce_web_app") self.assertEqual(normalize_scenario_name("/rce_web_app"), "rce_web_app") self.assertEqual( normalize_scenario_name("scenarios/rce_web_app"), "rce_web_app" ) self.assertEqual( normalize_scenario_name("/scenarios/rce_web_app"), "rce_web_app" ) # Long paths self.assertEqual( normalize_scenario_name("/long/path/scenarios/rce_web_app"), "rce_web_app" ) self.assertEqual( normalize_scenario_name("scenarios/rce_web_app/even/longer/path"), "rce_web_app", ) self.assertEqual( normalize_scenario_name( "/long/path/scenarios/rce_web_app/even/longer/path" ), "rce_web_app", ) self.assertEqual( normalize_scenario_name("/long/path/scenarios/not-a-real-scenario"), "not-a-real-scenario", ) self.assertEqual( normalize_scenario_name("scenarios/not-a-real-scenario/even/longer/path"), "not-a-real-scenario", ) self.assertEqual( normalize_scenario_name( "/long/path/scenarios/not-a-real-scenario/even/longer/path" ), "not-a-real-scenario", ) # Scenario instance paths self.assertEqual( normalize_scenario_name("codebuild_secrets_cgid0123456789"), "codebuild_secrets", ) self.assertEqual( normalize_scenario_name("scenarios/codebuild_secrets_cgid0123456789"), "codebuild_secrets", ) self.assertEqual( normalize_scenario_name("codebuild_secrets_cgid0123456789/scenarios"), "codebuild_secrets", ) self.assertEqual( normalize_scenario_name( "/long/path/scenarios/codebuild_secrets_cgid0123456789" ), "codebuild_secrets", ) self.assertEqual( normalize_scenario_name( "scenarios/codebuild_secrets_cgid0123456789/even/longer/path" ), "codebuild_secrets", ) self.assertEqual( normalize_scenario_name( "/long/path/scenarios/codebuild_secrets_cgid0123456789/even/longer/path" ), "codebuild_secrets", ) class TestCloudGoatClass(unittest.TestCase): def test_find_scenario_instance_dir(self): core.python.utils.dirs_at_location = unittest.mock.Mock(return_value=[ '/tmp/other_scenario_takeover_cgid5o8kwrb5ir', '/tmp/ecs_takeover_cgidkcjqvxvjh8', ]) self.assertEqual( find_scenario_instance_dir('/tmp', 'ecs_takeover'), '/tmp/ecs_takeover_cgidkcjqvxvjh8', ) core.python.utils.dirs_at_location.assert_called_with('/tmp') if __name__ == "__main__": unittest.main()
5,204
780
package com.codeborne.selenide; import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; /** * Authentication schemes. * * @see <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#Authentication_schemes">Web HTTP reference</a> */ @ParametersAreNonnullByDefault public enum AuthenticationType { BASIC("Basic"), BEARER("Bearer"), DIGEST("Digest"), HOBA("HOBA"), MUTUAL("Mutual"), AWS4_HMAC_SHA256("AWS4-HMAC-SHA256"); private final String value; AuthenticationType(String value) { this.value = value; } @CheckReturnValue @Nonnull public String getValue() { return value; } }
246
930
# -*- coding: utf-8 -*- # Generated by Django 1.11.10 on 2018-03-23 16:30 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('humans', '0010_auto_20170526_1326'), ] operations = [ migrations.CreateModel( name='KeyChangeRecord', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('prev_fingerprint', models.CharField(blank=True, max_length=50, null=True, verbose_name='Previous Fingerprint')), ('to_fingerprint', models.CharField(blank=True, max_length=50, null=True, verbose_name='To Fingerprint')), ('ip_address', models.GenericIPAddressField(blank=True, null=True)), ('agent', models.TextField(blank=True)), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='keychanges', to=settings.AUTH_USER_MODEL, verbose_name='User')), ], options={ 'verbose_name': 'KeyChangeRecord', 'verbose_name_plural': 'KeyChangeRecords', }, ), ]
618
716
<gh_stars>100-1000 /* * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. * See https://llvm.org/LICENSE.txt for license information. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * */ /******************************************************** FIXME: get rid of this "important notice" and proliferating copies. I M P O R T A N T N O T I C E Do not modify this file if it resides in the directory src -- modify the copy which is in ../utils/symtab and then run copy.sh ********************************************************/ /** \file \brief Generic access module. Used by all compilers and initialization utility. */ /* FIXME: This file is compiled with different gbldefs.h included depending on in which part of the build it is recompiled. */ #include "symacc.h" #include "error.h" #include <stdarg.h> #ifndef STANDARD_MAXIDLEN #define STANDARD_MAXIDLEN MAXIDLEN #endif extern STB stb; extern GBL gbl; void sym_init_first(void) { int i; int sizeof_SYM = sizeof(SYM) / sizeof(INT); /* Disable checking SYM size on Windows. * https://github.com/flang-compiler/flang/issues/1043 */ #ifndef _WIN64 assert(sizeof_SYM == 36, "bad SYM size", sizeof_SYM, ERR_Fatal); #endif if (stb.stg_base == NULL) { STG_ALLOC(stb, 1000); assert(stb.stg_base, "sym_init: no room for symtab", stb.stg_size, ERR_Fatal); stb.n_size = 5024; NEW(stb.n_base, char, stb.n_size); assert(stb.n_base, "sym_init: no room for namtab", stb.n_size, ERR_Fatal); stb.n_base[0] = 0; STG_ALLOC(stb.dt, 400); assert(stb.dt.stg_base, "sym_init: no room for dtypes", stb.dt.stg_size, ERR_Fatal); /* basically, this is sidecar of dt_base */ stb.w_size = 32; NEW(stb.w_base, INT, stb.w_size); assert(stb.w_base, "sym_init: no room for wtab", stb.w_size, ERR_Fatal); } /* allocate deepcopy info */ stb.namavl = 1; stb.wrdavl = 0; for (i = 0; i <= HASHSIZE; i++) stb.hashtb[i] = SPTR_NULL; } /** \brief Expand symbol storage area when NEWSYM runs out of area. It is assumed that stb.stg_avail is 1 more than the index of the current symbol being created. */ void realloc_sym_storage() { DEBUG_ASSERT(stb.stg_avail > stb.stg_size, "realloc_sym_storage: call only if necessary"); if (stb.stg_avail > SPTR_MAX + 1 || stb.stg_base == NULL) symini_errfatal(7); /* Use unsigned arithmetic to avoid risk of overflow. */ DEBUG_ASSERT(stb.stg_size > 0, "realloc_sym_storage: symbol storage not initialized?"); STG_NEED(stb); DEBUG_ASSERT(stb.stg_avail <= stb.stg_size, "realloc_sym_storage: internal error"); } /** \brief Look up symbol with indicated name. \return If there is already such a symbol, the pointer to the existing symbol table entry; or 0 if a symbol doesn't exist. \param name is a symbol name. \param olength is the number of characters in the symbol name. */ SPTR lookupsym(const char *name, int olength) { int length; SPTR sptr; /* pointer to symbol table entry */ INT hashval; /* index into hashtb. */ /* * Loop thru the appropriate hash link list to see if symbol is * already in the table: */ length = olength; if (length > MAXIDLEN) { length = MAXIDLEN; } HASH_ID(hashval, name, length); for (sptr = stb.hashtb[hashval]; sptr != 0; sptr = HASHLKG(sptr)) { if (strncmp(name, SYMNAME(sptr), length) != 0 || *(SYMNAME(sptr) + length) != '\0') continue; /* matching entry has been found in symbol table. return it: */ return sptr; } return SPTR_NULL; } /* lookupsym */ /** \brief Issue diagnostic for identifer that is too long. \param name - identifier (without terminating njull) \param olength - length of identifier \param max_idlen - maximum allowed length Though this routine has only one lexical call site, it is factored out to not clutter the common path in installsym_ex. */ static void report_too_long_identifier(const char *name, int olength, int max_idlen) { static char *ebuf; static int ebuf_sz = 0; char len_buf[12]; if (ebuf_sz == 0) { ebuf_sz = olength + 1; NEW(ebuf, char, ebuf_sz); } else { int ii; NEED(olength + 1, ebuf, char, ebuf_sz, olength + 1); ii = strlen(ebuf); if (ii < olength) strcpy(ebuf + (ii - 2), "..."); /* there's room for at least 1 '.'*/ } memcpy(ebuf, name, olength); ebuf[olength] = '\0'; sprintf(len_buf, "%d", max_idlen); symini_error(16, 2, gbl.lineno, ebuf, len_buf); } /** \brief Get the symbol table index for a NUL-terminated name. */ SPTR lookupsymbol(const char *name) { return lookupsym(name, strlen(name)); } /** \brief Construct a name via printf-style formatting and then look it up in the symbol table via lookupsymbol(). */ SPTR lookupsymf(const char *fmt, ...) { char buffer[MAXIDLEN + 1]; va_list ap; va_start(ap, fmt); vsnprintf(buffer, sizeof buffer - 1, fmt, ap); va_end(ap); buffer[sizeof buffer - 1] = '\0'; /* Windows workaround */ return lookupsymbol(buffer); } /** \brief Enter symbol with indicated name into symbol table, initialize the new entry, and return pointer to it. If there is already such a symbol, just return pointer to the existing symbol table entry. \param name is the symbol name. \param olength is the number of characters in the symbol name. */ SPTR installsym_ex(const char *name, int olength, IS_MODE mode) { int length; SPTR sptr; /* pointer to symbol table entry */ INT hashval; /* index into hashtb. */ bool toolong; int nmptr; static int max_idlen = MAXIDLEN; /* * Trim identifier if it is too long. */ toolong = false; length = olength; if (flg.standard) { max_idlen = 31; } if (length > max_idlen) { length = max_idlen; toolong = true; } nmptr = 0; if (mode != IS_QUICK) { /* * Loop thru the appropriate hash link list to see if symbol is * already in the table. */ HASH_ID(hashval, name, length); for (sptr = stb.hashtb[hashval]; sptr != 0; sptr = HASHLKG(sptr)) { const char *sname; int np = NMPTRG(sptr); if (np + length >= stb.namavl) continue; sname = stb.n_base + np; if (sname[0] != name[0] || sname[length] != '\0') continue; if (strncmp(name, sname, length) != 0) continue; nmptr = np; /* Matching entry has been found in symbol table. Return it. */ return sptr; } } /* Symbol not found. Create a new symbol table entry. */ NEWSYM(sptr); if (mode != IS_QUICK) { LINKSYM(sptr, hashval); } if (!nmptr) nmptr = putsname(name, length); NMPTRP(sptr, nmptr); SYMLKP(sptr, NOSYM); #ifdef LINENOP LINENOP(sptr, gbl.lineno); #endif if (toolong) { report_too_long_identifier(name, olength, max_idlen); } return sptr; } /** \brief Put a string of characters into the symbol names storage area and return pointer to the string (relative to stb.n_base). This routine is used to enter both symbol names and character string constants. \param name are the characters to be entered. \param length is the number of characters to be entered. */ int putsname(const char *name, int length) { int nptr; /* index into character storage area */ char *np; /* pointer into character storage area */ int i; /* counter */ nptr = stb.namavl; stb.namavl += (length + 1); while (stb.namavl > stb.n_size) { /* To avoid quadratic behavior, we increase the storage area size by a factor, not a constant. Use unsigned arithmetic here to avoid risk of overflow. */ unsigned n = 2u * stb.n_size; if (n > MAX_NMPTR) { n = MAX_NMPTR; if (stb.namavl > n) symini_errfatal(7); /* names table overflow */ } NEED(stb.namavl, stb.n_base, char, stb.n_size, n); } np = stb.n_base + nptr; for (i = 0; i < length; i++) *np++ = *name++; *np = '\0'; return nptr; } /** \brief Create a local copy of a name known to be stored in the 'stb.n_base' area. Used when a symbol needs to be created from a name stored in the area; a purify umr error could occur if the area is realloc'd. The char pointer to the copy is returned. */ char * local_sname(char *name) { static char *safe_p; static int safe_sz = 0; int length; length = strlen(name) + 2 + 6; /* MW: add one more character, needed in semfunc2 */ /* Hongyon: add 6 more for _cr and _nm for cref,nomixed */ if (safe_sz == 0) { safe_sz = length + 100; NEW(safe_p, char, safe_sz); } else { NEED(length, safe_p, char, safe_sz, length + 100); } strcpy(safe_p, name); return safe_p; } void add_fp_constants(void) { INT tmp[4]; INT res[4]; tmp[0] = 0; atoxf("0.0", &tmp[1], 3); /***** the f90 backend *****/ stb.flt0 = getcon(tmp, DT_REAL); atoxf("1.0", &tmp[1], 3); stb.flt1 = getcon(tmp, DT_REAL); atoxf("2.0", &tmp[1], 3); stb.flt2 = getcon(tmp, DT_REAL); atoxf("0.5", &tmp[1], 3); stb.flthalf = getcon(tmp, DT_REAL); atoxd("0.0", &tmp[0], 3); stb.dbl0 = getcon(tmp, DT_DBLE); atoxd("1.0", &tmp[0], 3); stb.dbl1 = getcon(tmp, DT_DBLE); atoxd("2.0", &tmp[0], 3); stb.dbl2 = getcon(tmp, DT_DBLE); atoxd("0.5", &tmp[0], 3); stb.dblhalf = getcon(tmp, DT_DBLE); tmp[0] = 0; res[0] = 0; tmp[1] = CONVAL2G(stb.flt0); xfneg(tmp[1], &res[1]); stb.fltm0 = getcon(res, DT_REAL); tmp[0] = CONVAL1G(stb.dbl0); tmp[1] = CONVAL2G(stb.dbl0); xdneg(tmp, res); stb.dblm0 = getcon(res, DT_DBLE); tmp[0] = 0x80000000; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0; stb.quadm0 = getcon(tmp, DT_QUAD); xqneg(tmp, res); stb.quad0 = getcon(res, DT_QUAD); tmp[0] = 0x3fff0000; stb.quad1 = getcon(tmp, DT_QUAD); tmp[0] = 0x40000000; stb.quad2 = getcon(tmp, DT_QUAD); tmp[0] = 0x3ffe0000; stb.quadhalf = getcon(tmp, DT_QUAD); #ifdef LONG_DOUBLE_FLOAT128 atoxq("0.0", &tmp[0], 4); stb.float128_0 = getcon(tmp, DT_FLOAT128); xqneg(tmp, res); stb.float128_m0 = getcon(res, DT_FLOAT128); atoxq("1.0", &tmp[0], 4); stb.float128_1 = getcon(tmp, DT_FLOAT128); atoxq("0.5", &tmp[0], 4); stb.float128_half = getcon(tmp, DT_FLOAT128); atoxq("2.0", &tmp[0], 4); stb.float128_2 = getcon(tmp, DT_FLOAT128); #endif } bool is_flt0(SPTR sptr) { if (sptr == stb.flt0 || sptr == stb.fltm0) return true; return false; } bool is_dbl0(SPTR sptr) { if (sptr == stb.dbl0 || sptr == stb.dblm0) return true; return false; } bool is_quad0(SPTR sptr) { if (sptr == stb.quad0 || sptr == stb.quadm0) return true; return false; } #ifdef LONG_DOUBLE_FLOAT128 bool is_float128_0(SPTR sptr) { return sptr == stb.float128_0 || sptr == stb.float128_m0; } #endif /* LONG_DOUBLE_FLOAT128 */ bool is_cmplx_flt0(SPTR sptr) { if (CONVAL1G(sptr) == CONVAL2G(stb.flt0) || CONVAL1G(sptr) == CONVAL2G(stb.fltm0)) { if (CONVAL2G(sptr) == CONVAL2G(stb.flt0) || CONVAL2G(sptr) == CONVAL2G(stb.fltm0)) { return true; } } return false; } bool is_creal_flt0(SPTR sptr) { if (CONVAL1G(sptr) == CONVAL2G(stb.flt0) || CONVAL1G(sptr) == CONVAL2G(stb.fltm0)) return true; return false; } bool is_cimag_flt0(SPTR sptr) { if (CONVAL2G(sptr) == CONVAL2G(stb.flt0) || CONVAL2G(sptr) == CONVAL2G(stb.fltm0)) return true; return false; } bool is_cmplx_dbl0(SPTR sptr) { return is_dbl0(SymConval1(sptr)) && is_dbl0(SymConval2(sptr)); } bool is_cmplx_quad0(SPTR sptr) { return is_quad0(SymConval1(sptr)) && is_quad0(SymConval2(sptr)); } void symini_errfatal(int n) { errfatal((error_code_t)n); } void symini_error(int n, int s, int l, const char *c1, const char *c2) { error((error_code_t)n, (enum error_severity)s, l, c1, c2); } void symini_interr(const char *txt, int val, int sev) { char buff[8]; sprintf(buff, "%7d", val); symini_error(0, sev, gbl.lineno, txt, buff); }
5,225
8,323
from sympy.physics.units.systems.mks import MKS from sympy.physics.units.systems.mksa import MKSA from sympy.physics.units.systems.natural import natural from sympy.physics.units.systems.si import SI __all__ = ['MKS', 'MKSA', 'natural', 'SI']
89
501
<reponame>mortenwh/django-userena from django.utils import translation from django.core.exceptions import ObjectDoesNotExist from django.conf import settings from userena import settings as userena_settings from userena.compat import SiteProfileNotAvailable from userena.utils import get_user_profile class UserenaLocaleMiddleware(object): """ Set the language by looking at the language setting in the profile. It doesn't override the cookie that is set by Django so a user can still switch languages depending if the cookie is set. """ def process_request(self, request): lang_cookie = request.session.get(settings.LANGUAGE_COOKIE_NAME) if not lang_cookie: if request.user.is_authenticated(): try: profile = get_user_profile(user=request.user) except (ObjectDoesNotExist, SiteProfileNotAvailable): profile = False if profile: try: lang = getattr(profile, userena_settings.USERENA_LANGUAGE_FIELD) translation.activate(lang) request.LANGUAGE_CODE = translation.get_language() except AttributeError: pass
528
379
<reponame>oimchat/oim-fx package com.oim.core.common.box; import java.util.HashMap; import java.util.Map; /** * @author: XiaHui * @date: 2017年5月26日 下午3:05:58 */ public class DictionaryBox { static Map<String,Map<String,String>> map=new HashMap<String,Map<String,String>>(); static{ } // public static String getValueByName(String property,String name){ // String value=null; // Map<String,String> vm=map.get(property); // if(null!=vm){ // } // } }
192
9,866
<reponame>hzhangse/codis<gh_stars>1000+ #define REDIS_GIT_SHA1 "0a557843" #define REDIS_GIT_DIRTY "0" #define REDIS_BUILD_ID "spinlock.bej.corp.google.com-1508934765"
81
348
<gh_stars>100-1000 {"nom":"Saint-Florent","circ":"1ère circonscription","dpt":"Haute-Corse","inscrits":1500,"abs":560,"votants":940,"blancs":47,"nuls":8,"exp":885,"res":[{"nuance":"REG","nom":"<NAME>","voix":565},{"nuance":"LR","nom":"<NAME>","voix":320}]}
101
650
import time t_start = time.time() import os import sys import tempfile import shutil from argparse import Namespace from pathlib import Path import cog import dlib import numpy as np import torch import torchvision.transforms as transforms from torchvision import utils from PIL import Image sys.path.insert(0, "/content") sys.path.insert(0, "encoder4editing") sys.path.insert(0, "ZSSGAN") from model.sg2_model import Generator from generate_videos import generate_frames, video_from_interpolations, vid_to_gif from encoder4editing.models.psp import pSp from encoder4editing.utils.alignment import align_face from encoder4editing.utils.common import tensor2im model_list = ['base'] + [Path(model_ckpt).stem for model_ckpt in os.listdir("models") if not 'base' in model_ckpt] class Predictor(cog.Predictor): def setup(self): print("starting setup") t_start_setup = time.time() self.device = "cuda" if torch.cuda.is_available() else "cpu" latent_size = 512 n_mlp = 8 channel_mult = 2 model_size = 1024 self.generators = {} for model in model_list: g_ema = Generator( model_size, latent_size, n_mlp, channel_multiplier=channel_mult ).to(self.device) checkpoint = torch.load(f"models/{model}.pt") g_ema.load_state_dict(checkpoint['g_ema']) self.generators[model] = g_ema self.experiment_args = {"model_path": "e4e_ffhq_encode.pt"} self.experiment_args["transform"] = transforms.Compose( [ transforms.Resize((256, 256)), transforms.ToTensor(), transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5]), ] ) self.resize_dims = (256, 256) model_path = self.experiment_args["model_path"] ckpt = torch.load(model_path, map_location="cpu") opts = ckpt["opts"] # pprint.pprint(opts) # Display full options used # update the training options opts["checkpoint_path"] = model_path opts = Namespace(**opts) self.e4e_net = pSp(opts) self.e4e_net.eval() self.e4e_net.cuda() self.shape_predictor = dlib.shape_predictor( "/content/shape_predictor_68_face_landmarks.dat" ) t_end = time.time() self.time_gap = t_end - t_start self.time_gap_setup = t_end - t_start_setup print("setup complete") @cog.input("input", type=Path, help="Input image") @cog.input("output_style", type=str, help=f"Which output style do you want to use? Select 'all' to generate a collage.", options=model_list + ['all'] + ['list - enter below'], default='all') @cog.input("style_list", type=str, default='joker,anime,modigliani', help="Comma seperated list of models to use. Only accepts models from the output_style list. Will only be used if the chosen output_style is list") @cog.input("generate_video", type=bool, default=False, help="Generate a video instead of an output image. If more than one style is used, will interpolate between styles.") @cog.input("with_editing", type=bool, default=True, help="Apply latent space editing to the generated video") @cog.input("video_format", type=str, help="Choose gif to display in browser, mp4 for a higher-quality downloadable video", options=['gif', 'mp4'], default='mp4') def predict( self, input, output_style, style_list, generate_video, with_editing, video_format ): if output_style == 'all': styles = model_list elif output_style == 'list - enter below': styles = style_list.split(",") for style in styles: if style not in model_list: raise ValueError(f"Encountered style '{style}' in the style_list which is not an available option.") else: styles = [output_style] # @title Align image input_image = self.run_alignment(str(input)) input_image = input_image.resize(self.resize_dims) img_transforms = self.experiment_args["transform"] transformed_image = img_transforms(input_image) with torch.no_grad(): images, latents = self.run_on_batch(transformed_image.unsqueeze(0)) result_image, latent = images[0], latents[0] inverted_latent = latent.unsqueeze(0).unsqueeze(1) out_dir = Path(tempfile.mkdtemp()) out_path = out_dir / "out.jpg" generators = [self.generators[style] for style in styles] if not generate_video: with torch.no_grad(): img_list = [] for g_ema in generators: img, _ = g_ema(inverted_latent, input_is_latent=True, truncation=1, randomize_noise=False) img_list.append(img) out_img = torch.cat(img_list, axis=0) utils.save_image(out_img, out_path, nrow=int(np.sqrt(out_img.size(0))), normalize=True, scale_each=True, range=(-1, 1)) return Path(out_path) return self.generate_vid(generators, inverted_latent, out_dir, video_format, with_editing) def generate_vid(self, generators, latent, out_dir, video_format, with_editing): np_latent = latent.squeeze(0).cpu().detach().numpy() args = { 'fps': 24, 'target_latents': None, 'edit_directions': None, 'unedited_frames': 0 if with_editing else 40 * (len(generators) - 1) } args = Namespace(**args) with tempfile.TemporaryDirectory() as dirpath: generate_frames(args, np_latent, generators, dirpath) video_from_interpolations(args.fps, dirpath) gen_path = Path(dirpath) / "out.mp4" out_path = out_dir / f"out.{video_format}" if video_format == 'gif': vid_to_gif(gen_path, out_dir, scale=256, fps=args.fps) else: shutil.copy2(gen_path, out_path) return out_path def run_alignment(self, image_path): aligned_image = align_face(filepath=image_path, predictor=self.shape_predictor) print("Aligned image has shape: {}".format(aligned_image.size)) return aligned_image def run_on_batch(self, inputs): images, latents = self.e4e_net( inputs.to("cuda").float(), randomize_noise=False, return_latents=True ) return images, latents
3,044
1,587
/** * */ package io.pratik.healthcheck.usersignup; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** * @author <NAME> * */ @Data @Builder @Entity @NoArgsConstructor @Table(name="USERS") public class User { @Id private String firstName; private String lastName; private String mobile; private String email; private String status; private String profileURL; public User(String firstName, String lastName, String mobile, String email, String status, String profileURL) { super(); this.firstName = firstName; this.lastName = lastName; this.mobile = mobile; this.email = email; this.status = status; this.profileURL = profileURL==null?null:URLHelper.shortenURL(profileURL); } }
288
878
<filename>src/wtf/socket.h // Axel '0vercl0k' Souchet - November 6 2020 #pragma once #include "backend.h" #include "globals.h" #include "platform.h" #include "tsl/robin_set.h" #include "yas/serialize.hpp" #include "yas/std_types.hpp" #include <fmt/format.h> #include <optional> #include <span> #include <string> #ifdef WINDOWS #include <winsock2.h> #include <ws2tcpip.h> #pragma comment(lib, "ws2_32.lib") struct WSAInitializer_t { WSADATA Wsa; explicit WSAInitializer_t() { if (WSAStartup(MAKEWORD(2, 2), &Wsa) != 0) { std::abort(); } } ~WSAInitializer_t() { WSACleanup(); } }; static WSAInitializer_t WSAInitializer; using SocketFd_t = SOCKET; static void CloseSocket(const SocketFd_t Fd) { closesocket(Fd); } static int SocketError() { return WSAGetLastError(); } #else #include <arpa/inet.h> #include <netdb.h> #include <sys/socket.h> #include <sys/types.h> using SocketFd_t = int; constexpr int INVALID_SOCKET = -1; static void CloseSocket(const SocketFd_t Fd) { close(Fd); } static int SocketError() { return errno; } #endif // // Set up a listening socket bound to Address. // [[nodiscard]] std::optional<SocketFd_t> Listen(const std::string &Address); // // Set up a connecting socket. // [[nodiscard]] std::optional<SocketFd_t> Dial(const std::string &Address); // // Send a buffer. // [[nodiscard]] bool Send(const SocketFd_t Fd, const uint8_t *Buffer, const size_t Size); // // Receive a buffer. // [[nodiscard]] std::optional<uint32_t> Receive(const SocketFd_t Fd, const std::span<uint8_t> ScratchBuffer); [[nodiscard]] std::optional<uint32_t> Receive(const SocketFd_t Fd, const uint8_t *ScratchBuffer, const size_t ScratchBufferSize); template <typename Ar> void serialize(Ar &ar, Ok_t &) {} template <typename Ar> void serialize(Ar &ar, Timedout_t &) {} template <typename Ar> void serialize(Ar &ar, Cr3Change_t &) {} template <typename Ar> void serialize(Ar &ar, Crash_t &Crash) { ar &Crash.CrashName; } namespace yas::detail { template <std::size_t F> struct serializer<type_prop::not_a_fundamental, ser_case::use_internal_serializer, F, Gva_t> { template <typename Archive> static Archive &save(Archive &ar, const Gva_t &gva) { ar &gva.U64(); return ar; } template <typename Archive> static Archive &load(Archive &ar, Gva_t &gva) { uint64_t G; ar &G; gva = Gva_t(G); return ar; } }; template <std::size_t F> struct serializer<type_prop::not_a_fundamental, ser_case::use_internal_serializer, F, tsl::robin_set<Gva_t>> { template <typename Archive> static Archive &save(Archive &ar, const tsl::robin_set<Gva_t> &set) { return concepts::set::save<F>(ar, set); } template <typename Archive> static Archive &load(Archive &ar, tsl::robin_set<Gva_t> &set) { return concepts::set::load<F>(ar, set); } }; } // namespace yas::detail constexpr size_t YasFlags = yas::mem | yas::binary | yas::no_header;
1,323
5,169
<filename>Specs/7/e/3/OguryAds/2.3.4/OguryAds.podspec.json { "description": "Ogury Ads SDK.", "vendored_frameworks": "OguryAds/OguryAds.xcframework", "frameworks": [ "AdSupport", "SystemConfiguration", "UIKit" ], "version": "2.3.4", "default_subspecs": [ "OMID" ], "weak_frameworks": "CoreTelephony", "authors": { "Ogury Ltd.": "<EMAIL>" }, "license": { "type": "COMMERCIAL", "text": "\tCopyright (c) Ogury Ltd. All rights reserved.\n" }, "source": { "http": "https://ads-ios-sdk.ogury.co/OguryAds_2.3.4.zip" }, "requires_arc": true, "homepage": "https://www.ogury.com", "summary": "Ogury Ads SDK", "libraries": "z", "platforms": { "ios": "10.0" }, "name": "OguryAds", "pod_target_xcconfig": { "EXCLUDED_ARCHS[sdk=iphonesimulator*]": "arm64" }, "user_target_xcconfig": { "EXCLUDED_ARCHS[sdk=iphonesimulator*]": "arm64" }, "subspecs": [ { "name": "OMID", "vendored_frameworks": "OguryAds/OMSDK_Oguryco.framework" } ] }
504
785
<filename>servicetalk-concurrent-api/src/test/java/io/servicetalk/concurrent/api/publisher/PubCompletableOrErrorTest.java /* * Copyright © 2020-2021 Apple Inc. and the ServiceTalk project authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.servicetalk.concurrent.api.publisher; import io.servicetalk.concurrent.api.TestPublisher; import io.servicetalk.concurrent.test.internal.TestCompletableSubscriber; import org.junit.jupiter.api.Test; import static io.servicetalk.concurrent.api.Publisher.empty; import static io.servicetalk.concurrent.api.Publisher.failed; import static io.servicetalk.concurrent.api.Publisher.from; import static io.servicetalk.concurrent.api.SourceAdapters.toSource; import static io.servicetalk.concurrent.internal.DeliberateException.DELIBERATE_EXCEPTION; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.instanceOf; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; class PubCompletableOrErrorTest { private final TestCompletableSubscriber subscriber = new TestCompletableSubscriber(); @Test void noElementsCompleted() { toSource(empty().completableOrError()).subscribe(subscriber); subscriber.awaitOnComplete(); } @Test void noElementsError() { toSource(failed(DELIBERATE_EXCEPTION).completableOrError()).subscribe(subscriber); assertSame(DELIBERATE_EXCEPTION, subscriber.awaitOnError()); } @Test void oneElementsAlwaysFails() { toSource(from("foo").completableOrError()).subscribe(subscriber); assertThat(subscriber.awaitOnError(), instanceOf(IllegalArgumentException.class)); } @Test void twoElementsAlwaysFails() { // Use TestPublisher to force deliver two items, and verify the operator doesn't duplicate terminate. TestPublisher<String> publisher = new TestPublisher<>(); toSource(publisher.completableOrError()).subscribe(subscriber); assertTrue(publisher.isSubscribed()); publisher.onNext("foo", "bar"); assertThat(subscriber.awaitOnError(), instanceOf(IllegalArgumentException.class)); } }
900
370
<filename>datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/key/PeriodAsKeyTest.java package com.fasterxml.jackson.datatype.jsr310.key; import java.time.Period; import java.util.Map; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectReader; import com.fasterxml.jackson.datatype.jsr310.ModuleTestBase; import org.junit.Assert; import org.junit.Test; public class PeriodAsKeyTest extends ModuleTestBase { private static final TypeReference<Map<Period, String>> TYPE_REF = new TypeReference<Map<Period, String>>() { }; private static final Period PERIOD_0 = Period.of(0, 0, 0); private static final String PERIOD_0_STRING = "P0D"; private static final Period PERIOD = Period.of(3, 1, 4); private static final String PERIOD_STRING = "P3Y1M4D"; private final ObjectMapper MAPPER = newMapper(); private final ObjectReader READER = MAPPER.readerFor(TYPE_REF); @Test public void testSerialization0() throws Exception { Assert.assertEquals("Value is incorrect", mapAsString(PERIOD_0_STRING, "test"), MAPPER.writeValueAsString(asMap(PERIOD_0, "test"))); } @Test public void testSerialization1() throws Exception { Assert.assertEquals("Value is incorrect", mapAsString(PERIOD_STRING, "test"), MAPPER.writeValueAsString(asMap(PERIOD, "test"))); } @Test public void testDeserialization0() throws Exception { Assert.assertEquals("Value is incorrect", asMap(PERIOD_0, "test"), READER.readValue(mapAsString(PERIOD_0_STRING, "test"))); } @Test public void testDeserialization1() throws Exception { Assert.assertEquals("Value is incorrect", asMap(PERIOD, "test"), READER.readValue(mapAsString(PERIOD_STRING, "test"))); } }
739
3,083
// Copyright 2011-2016 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.security.zynamics.reil.algorithms.mono; import java.util.List; import java.util.stream.Collectors; import com.google.common.base.Preconditions; import com.google.security.zynamics.reil.algorithms.mono.interfaces.IGraphWalker; /** * InstructionGraph walker that can be used to walk upwards through InstructionGraph nodes. */ public final class UpWalker implements IGraphWalker<InstructionGraphNode, WalkInformation> { @Override public List<InstructionGraphNode> getInfluenced(final InstructionGraphNode node) { Preconditions.checkNotNull(node, "Error: node argument can not be null"); // When walking upwards, the influenced nodes of a node // are the parents of the node. return node.getIncomingEdges() .stream() .map(InstructionGraphEdge::getSource) .collect(Collectors.toList()); } @Override public List<InfluencingInstructionNode> getInfluencing(final InstructionGraphNode node) { Preconditions.checkNotNull(node, "Error: node argument can not be null"); // When walking upwards, the influencing nodes of a node // are the children of the node. return node.getOutgoingEdges() .stream() .map(edge -> new InfluencingInstructionNode(edge.getTarget(), new WalkInformation(edge))) .collect(Collectors.toList()); } }
596
348
{"nom":"Baliros","circ":"2ème circonscription","dpt":"Pyrénées-Atlantiques","inscrits":371,"abs":196,"votants":175,"blancs":11,"nuls":5,"exp":159,"res":[{"nuance":"MDM","nom":"<NAME>","voix":86},{"nuance":"SOC","nom":"<NAME>","voix":73}]}
97
3,799
<filename>camera/camera-core/src/main/java/androidx/camera/core/DisplayOrientedMeteringPointFactory.java /* * Copyright 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package androidx.camera.core; import android.graphics.PointF; import android.view.Display; import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; import androidx.annotation.RestrictTo; import androidx.camera.core.impl.CameraInfoInternal; /** * A {@link MeteringPointFactory} that can convert a {@link View} (x, y) into a * {@link MeteringPoint} which can then be used to construct a {@link FocusMeteringAction} to * start a focus and metering action. * * <p>For apps showing full camera preview in a View without any scaling, cropping or * rotating applied, they can simply use view width and height to create the * {@link DisplayOrientedMeteringPointFactory} and then pass {@link View} (x, y) to create a * {@link MeteringPoint}. This factory will convert the (x, y) into the sensor (x, y) based on * display rotation and lensFacing. * * <p>If camera preview is scaled, cropped or rotated in the {@link View}, it is applications' * duty to transform the coordinates properly so that the width and height of this * factory represents the full Preview FOV and also the (x,y) passed to create * {@link MeteringPoint} needs to be adjusted by apps to the coordinates left-top (0,0) - * right-bottom (width, height). For example, if the preview is scaled to 2X from the center and * is cropped in a {@link View}. Assuming that the dimension of View is (240, 320), then the * width/height of this {@link DisplayOrientedMeteringPointFactory} should be (480, 640). And * the (x, y) from the {@link View} should be converted to (x + (480-240)/2, y + (640 - 320)/2) * first. * * @see MeteringPoint */ @RequiresApi(21) // TODO(b/200306659): Remove and replace with annotation on package-info.java public final class DisplayOrientedMeteringPointFactory extends MeteringPointFactory { /** The logical width of FoV in current display orientation */ private final float mWidth; /** The logical height of FoV in current display orientation */ private final float mHeight; /** {@link Display} used for detecting display orientation */ @NonNull private final Display mDisplay; @NonNull private final CameraInfo mCameraInfo; /** * Creates a {@link DisplayOrientedMeteringPointFactory} for converting View (x, y) into a * {@link MeteringPoint} based on the current display's rotation and {@link CameraInfo}. * * <p>The width/height of this factory forms a coordinate left-top (0, 0) - right-bottom * (width, height) which represents the full camera preview FOV in the display's * orientation. For apps showing full camera preview in a {@link View}, it is as simple as * passing View's width/height and passing View (x, y) directly to create a * {@link MeteringPoint}. Otherwise the (x, y) passed to * {@link MeteringPointFactory#createPoint(float, float)} should be adjusted to this * coordinate system first. * * @param display {@link Display} to get the orientation from. This should be the * current display where camera preview is showing. * @param cameraInfo the information for the {@link Camera} to generate the metering * point for * @param width the width of the coordinate which are mapped to the full camera preview * FOV in given display's orientation. * @param height the height of the coordinate which are mapped to the full camera * preview * FOV in given display's orientation. */ public DisplayOrientedMeteringPointFactory(@NonNull Display display, @NonNull CameraInfo cameraInfo, float width, float height) { mWidth = width; mHeight = height; mDisplay = display; mCameraInfo = cameraInfo; } @Nullable private Integer getLensFacing() { // This assumes CameraInfo is an instance of CameraInfoInternal which contains lens // facing information. A Camera may not be simply of a single lens facing type so that is // why it isn't exposed directly through CameraInfo. if (mCameraInfo instanceof CameraInfoInternal) { return ((CameraInfoInternal) mCameraInfo).getLensFacing(); } return null; } /** * {@inheritDoc} * * @hide */ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @NonNull @Override protected PointF convertPoint(float x, float y) { float width = mWidth; float height = mHeight; final Integer lensFacing = getLensFacing(); boolean compensateForMirroring = (lensFacing != null && lensFacing == CameraSelector.LENS_FACING_FRONT); int relativeCameraOrientation = getRelativeCameraOrientation(compensateForMirroring); float outputX = x; float outputY = y; float outputWidth = width; float outputHeight = height; if (relativeCameraOrientation == 90 || relativeCameraOrientation == 270) { // We're horizontal. Swap width/height. Swap x/y. outputX = y; outputY = x; outputWidth = height; outputHeight = width; } switch (relativeCameraOrientation) { // Map to correct coordinates according to relativeCameraOrientation case 90: outputY = outputHeight - outputY; break; case 180: outputX = outputWidth - outputX; outputY = outputHeight - outputY; break; case 270: outputX = outputWidth - outputX; break; default: break; } // Swap x if it's a mirrored preview if (compensateForMirroring) { outputX = outputWidth - outputX; } // Normalized it to [0, 1] outputX = outputX / outputWidth; outputY = outputY / outputHeight; return new PointF(outputX, outputY); } private int getRelativeCameraOrientation(boolean compensateForMirroring) { int rotationDegrees; try { int displayRotation = mDisplay.getRotation(); rotationDegrees = mCameraInfo.getSensorRotationDegrees(displayRotation); if (compensateForMirroring) { rotationDegrees = (360 - rotationDegrees) % 360; } } catch (Exception e) { rotationDegrees = 0; } return rotationDegrees; } }
2,700
2,577
<reponame>mdsarfarazalam840/camunda-bpm-platform<filename>model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/impl/instance/CriterionImpl.java<gh_stars>1000+ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH * under one or more contributor license agreements. See the NOTICE file * distributed with this work for additional information regarding copyright * ownership. Camunda licenses this file to you under the Apache License, * Version 2.0; you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.camunda.bpm.model.cmmn.impl.instance; import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CMMN11_NS; import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CMMN_ATTRIBUTE_NAME; import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CMMN_ATTRIBUTE_SENTRY_REF; import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CMMN_ELEMENT_CRITERION; import org.camunda.bpm.model.cmmn.instance.CmmnElement; import org.camunda.bpm.model.cmmn.instance.Criterion; import org.camunda.bpm.model.cmmn.instance.Sentry; import org.camunda.bpm.model.xml.ModelBuilder; import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; import org.camunda.bpm.model.xml.type.attribute.Attribute; import org.camunda.bpm.model.xml.type.reference.AttributeReference; /** * @author <NAME> * */ public abstract class CriterionImpl extends CmmnElementImpl implements Criterion { protected static Attribute<String> nameAttribute; protected static AttributeReference<Sentry> sentryRefAttribute; public CriterionImpl(ModelTypeInstanceContext instanceContext) { super(instanceContext); } public String getName() { return nameAttribute.getValue(this); } public void setName(String name) { nameAttribute.setValue(this, name); } public Sentry getSentry() { return sentryRefAttribute.getReferenceTargetElement(this); } public void setSentry(Sentry sentry) { sentryRefAttribute.setReferenceTargetElement(this, sentry); } public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Criterion.class, CMMN_ELEMENT_CRITERION) .extendsType(CmmnElement.class) .namespaceUri(CMMN11_NS) .abstractType(); nameAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_NAME) .build(); sentryRefAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_SENTRY_REF) .idAttributeReference(Sentry.class) .build(); typeBuilder.build(); } }
1,018
361
<gh_stars>100-1000 from .E_tracker import EssTracker from .pnp_tracker import PnpTracker
30
1,660
package com.zcy.ghost.vivideo.model.http.api; import com.zcy.ghost.vivideo.model.bean.GankHttpResponse; import com.zcy.ghost.vivideo.model.bean.GankItemBean; import java.util.List; import retrofit2.http.FormUrlEncoded; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.Path; import retrofit2.http.Url; import rx.Observable; /** * Created by codeest on 16/8/19. */ public interface GankApis { String HOST = "https://gank.io/api/"; /** * 福利列表 */ @GET("data/{path}/{num}/{page}") Observable<GankHttpResponse<List<GankItemBean>>> getGirlList(@Path(value = "path", encoded = false) String path, @Path("num") int num, @Path("page") int page); }
288
2,863
<reponame>vjlamp/spock<filename>spock-core/src/main/java/org/spockframework/util/SpockReleaseInfo.java /* * Copyright 2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.spockframework.util; import java.io.*; import java.util.Properties; public class SpockReleaseInfo { private static final VersionNumber version; private static final VersionNumber minGroovyVersion; private static final VersionNumber maxGroovyVersion; static { Properties properties = new Properties(); try (InputStream stream = SpockReleaseInfo.class.getResourceAsStream("SpockReleaseInfo.properties")){ properties.load(stream); } catch (IOException e) { throw new InternalSpockError("Failed to load `SpockReleaseInfo.properties`", e); } version = VersionNumber.parse(properties.getProperty("version")); minGroovyVersion = VersionNumber.parse(properties.getProperty("minGroovyVersion")); maxGroovyVersion = VersionNumber.parse(properties.getProperty("maxGroovyVersion")); } public static VersionNumber getVersion() { return version; } public static VersionNumber getMinGroovyVersion() { return minGroovyVersion; } public static VersionNumber getMaxGroovyVersion() { return maxGroovyVersion; } public static boolean isCompatibleGroovyVersion(VersionNumber groovyVersion) { if ( // happens when running tests from IDE as the latter doesn't have processed properties file minGroovyVersion.equals(VersionNumber.UNKNOWN) || maxGroovyVersion.equals(VersionNumber.UNKNOWN) || // may happen if (future) Groovy version cannot be parsed groovyVersion.equals(VersionNumber.UNKNOWN)) { return true; // be optimistic } return minGroovyVersion.compareTo(groovyVersion) <= 0 && maxGroovyVersion.compareTo(groovyVersion) >= 0; } public static String getArtifactPath() { return SpockReleaseInfo.class.getProtectionDomain().getCodeSource().getLocation().toString(); } }
754
400
package org.ofdrw.core.basicType; /** * 点坐标,以格分割,前者为 x值,后者为 y值,可以是整数或浮点数 * <p> * 示例: * <code>0 0</code> * <p> * ————《GB/T 33190-2016》 表 2 基本数据类型 */ public class ST_Pos extends STBase { /** * X坐标 * <p> * 从左 到 右 */ private Double x = 0d; /** * y坐标 * <p> * 从上 到 下 */ private Double y = 0d; public ST_Pos(double x, double y) { this.x = x; this.y = y; } public static ST_Pos getInstance(double x, double y) { return new ST_Pos(x,y); } /** * 获取 ST_Pos 实例如果参数非法则返还null * * @param arrStr 数字字符串 * @return 实例 或 null */ public static ST_Pos getInstance(String arrStr) { if (arrStr == null || arrStr.trim().length() == 0) { return null; } String[] values = arrStr.trim().split(" "); if (values.length != 2) { return null; } return new ST_Pos(Double.parseDouble(values[0]), Double.parseDouble(values[1])); } public Double getX() { return x; } public ST_Pos setX(Double x) { this.x = x; return this; } public Double getY() { return y; } public ST_Pos setY(Double y) { this.y = y; return this; } @Override public String toString() { return (fmt(x) + " " + fmt(y)); } }
827
429
<filename>klinelib/src/main/java/com/vinsonguo/klinelib/model/MACD.java package com.vinsonguo.klinelib.model; import java.util.ArrayList; import java.util.List; public class MACD { private List<Double> DEAs; private List<Double> DIFs; private List<Double> MACDs; /** * 得到MACD数据 * * @param kLineBeen */ public MACD(List<HisData> kLineBeen) { DEAs = new ArrayList<>(); DIFs = new ArrayList<>(); MACDs = new ArrayList<>(); List<Double> dEAs = new ArrayList<>(); List<Double> dIFs = new ArrayList<>(); List<Double> mACDs = new ArrayList<>(); double eMA12 = 0.0f; double eMA26 = 0.0f; double close = 0f; double dIF = 0.0f; double dEA = 0.0f; double mACD = 0.0f; if (kLineBeen != null && kLineBeen.size() > 0) { for (int i = 0; i < kLineBeen.size(); i++) { close = kLineBeen.get(i).getClose(); if (i == 0) { eMA12 = close; eMA26 = close; } else { eMA12 = eMA12 * 11 / 13 + close * 2 / 13; eMA26 = eMA26 * 25 / 27 + close * 2 / 27; } dIF = eMA12 - eMA26; dEA = dEA * 8 / 10 + dIF * 2 / 10; mACD = dIF - dEA; dEAs.add(dEA); dIFs.add(dIF); mACDs.add(mACD); } for (int i = 0; i < dEAs.size(); i++) { DEAs.add(dEAs.get(i)); DIFs.add(dIFs.get(i)); MACDs.add(mACDs.get(i)); } } } public List<Double> getDEA() { return DEAs; } public List<Double> getDIF() { return DIFs; } public List<Double> getMACD() { return MACDs; } }
1,090
326
<reponame>bihell/Dice package com.bihell.dice.framework.core.validator; import com.bihell.dice.framework.core.validator.constraints.Phone; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; import java.util.regex.Pattern; /** * 自定义手机号码验证注解实现类 todo */ public class PhoneValidator implements ConstraintValidator<Phone, String> { private static final String REG_EX = "^1[3,4,5,6,7,8,9]\\d{9}$"; private static final Pattern PATTERN = Pattern.compile(REG_EX); @Override public void initialize(Phone parameters) { } @Override public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) { if (value ==null){ return true; } return PATTERN.matcher(value).matches(); } }
292
382
/* * Copyright 2014 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.spinnaker.clouddriver.model; import com.netflix.spinnaker.clouddriver.documentation.Empty; import java.util.Map; import java.util.Set; /** * An application is a top-level construct that provides an association to {@link Cluster} objects. */ public interface Application { /** * The name of the application * * @return name */ String getName(); /** * Arbitrary metadata that may be associated with an application. * * @return map of key->value pairs, or an empty map */ @Empty Map<String, String> getAttributes(); /** * A set of cluster names that are associated with this application * * @return names */ @Empty Map<String, Set<String>> getClusterNames(); }
385
1,590
{ "parameters": { "api-version": "2018-02-01" }, "responses": { "200": { "headers": {}, "body": { "value": [ { "name": "Microsoft.DomainRegistration/domains/Read", "display": { "provider": "Microsoft Domains", "resource": "Domain", "operation": "Get Domains", "description": "Get the list of domains" }, "origin": "user,system" }, { "name": "Microsoft.DomainRegistration/domains/Write", "display": { "provider": "Microsoft Domains", "resource": "Domain", "operation": "Add or Update Domain", "description": "Add a new Domain or update an existing one" }, "origin": "user,system" }, { "name": "Microsoft.DomainRegistration/domains/Delete", "display": { "provider": "Microsoft Domains", "resource": "Domain", "operation": "Delete Domain", "description": "Delete an existing domain." }, "origin": "user,system" }, { "name": "Microsoft.DomainRegistration/domains/operationresults/Read", "display": { "provider": "Microsoft Domains", "resource": "Domain operation", "operation": "Get Domain Operation", "description": "Get a domain operation" }, "origin": "user,system" }, { "name": "Microsoft.DomainRegistration/generateSsoRequest/Action", "display": { "provider": "Microsoft Domains", "resource": "Domain Control Center Single Sign On Request", "operation": "Generate Domain Control Center Single Sign On Request", "description": "Generate a request for signing into domain control center." }, "origin": "user,system" }, { "name": "Microsoft.DomainRegistration/validateDomainRegistrationInformation/Action", "display": { "provider": "Microsoft Domains", "resource": "Domain Validation", "operation": "Domain Purchase Info Validation", "description": "Validate domain purchase object without submitting it" }, "origin": "user,system" }, { "name": "Microsoft.DomainRegistration/checkDomainAvailability/Action", "display": { "provider": "Microsoft Domains", "resource": "Domain Availability Result", "operation": "Check Domain Availability", "description": "Check if a domain is available for purchase" }, "origin": "user,system" }, { "name": "Microsoft.DomainRegistration/listDomainRecommendations/Action", "display": { "provider": "Microsoft Domains", "resource": "Domain Recommendations", "operation": "Retrieve Domain Recommendations", "description": "Retrieve the list domain recommendations based on keywords" }, "origin": "user,system" }, { "name": "Microsoft.DomainRegistration/register/action", "display": { "provider": "Microsoft Domains", "resource": "Microsoft Domains resource provider", "operation": "Register Microsoft Domains resource provider", "description": "Register the Microsoft Domains resource provider for the subscription" }, "origin": "user,system" } ] } } } }
1,839
1,162
package io.digdag.standards.command; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.inject.Inject; import io.digdag.commons.ThrowablesUtil; import io.digdag.spi.CommandExecutor; import io.digdag.spi.CommandContext; import io.digdag.spi.CommandRequest; import io.digdag.spi.CommandLogger; import io.digdag.spi.CommandStatus; import java.io.IOException; import java.nio.file.Path; public class SimpleCommandExecutor implements CommandExecutor { private final CommandLogger clog; @Inject public SimpleCommandExecutor(final CommandLogger clog) { this.clog = clog; } @Override public CommandStatus run(final CommandContext context, final CommandRequest request) throws IOException { final ProcessBuilder pb = new ProcessBuilder(request.getCommandLine()); final Path workingDirectory = context.getLocalProjectPath().resolve(request.getWorkingDirectory()).normalize(); pb.directory(workingDirectory.toFile()); pb.redirectErrorStream(true); pb.environment().putAll(request.getEnvironments()); // TODO set TZ environment variable final Process p = pb.start(); // copy stdout to System.out and logger clog.copyStdout(p, System.out); // Need waiting and blocking. Because the process is running on a single instance. // The command task could not be taken by other digdag-servers on other instances. try { p.waitFor(); } catch (InterruptedException e) { throw ThrowablesUtil.propagate(e); } return SimpleCommandStatus.of(p, request.getIoDirectory()); } /** * This method is never called. The status of the task that is executed by the executor cannot be * polled by non-blocking. */ @Override public CommandStatus poll(final CommandContext context, final ObjectNode previousStatusJson) throws IOException { throw new UnsupportedOperationException("This method should not be called."); } }
764
909
<reponame>Kukulin13013/navigation package com.dji.sdk.sample.internal.audiohandler; public class MediaRecorderOptions { private Builder mBuilder; private MediaRecorderOptions(Builder builder) { mBuilder = builder; } public int getAudioSamplingRate() { return mBuilder.mAudioSamplingRate; } public int getAudioEncodingBitRate() { return mBuilder.mAudioEncodingBitRate; } public int getAudioChannels() { return mBuilder.mAudioChannels; } public static class Builder { int mAudioSamplingRate; int mAudioEncodingBitRate; int mAudioChannels; public Builder() { mAudioSamplingRate = 44100; mAudioEncodingBitRate = 16000; mAudioChannels = 1; } public Builder audioSamplingRate(int rate) { mAudioSamplingRate = rate; return this; } public Builder audioEncodingBitRate(int audioEncodingBitRate) { mAudioEncodingBitRate = audioEncodingBitRate; return this; } public Builder audioChannels(int audioChannels) { mAudioChannels = audioChannels; return this; } public MediaRecorderOptions build() { return new MediaRecorderOptions(this); } } }
580
3,705
<reponame>zjzh/chainer<filename>examples/text_classification/run_text_classifier.py #!/usr/bin/env python import argparse import json import sys import chainer import numpy import nets import nlp_utils def setup_model(device, model_setup): sys.stderr.write(json.dumps(args.__dict__, indent=2) + '\n') setup = json.load(open(model_setup)) sys.stderr.write(json.dumps(setup, indent=2) + '\n') vocab = json.load(open(setup['vocab_path'])) n_class = setup['n_class'] # Setup a model if setup['model'] == 'rnn': Encoder = nets.RNNEncoder elif setup['model'] == 'cnn': Encoder = nets.CNNEncoder elif setup['model'] == 'bow': Encoder = nets.BOWMLPEncoder encoder = Encoder(n_layers=setup['layer'], n_vocab=len(vocab), n_units=setup['unit'], dropout=setup['dropout']) model = nets.TextClassifier(encoder, n_class) chainer.serializers.load_npz(setup['model_path'], model) model.to_device(device) # Copy the model to the device return model, vocab, setup def run_online(device): # predict labels online print('Enter inputs for Online Predictions') for l in sys.stdin: l = l.strip() if not l: print('# blank line') continue text = nlp_utils.normalize_text(l) words = nlp_utils.split_text(text, char_based=setup['char_based']) xs = nlp_utils.transform_to_array([words], vocab, with_label=False) xs = nlp_utils.convert_seq(xs, device=device, with_label=False) with chainer.using_config('train', False), chainer.no_backprop_mode(): prob = model.predict(xs, softmax=True)[0] answer = int(model.xp.argmax(prob)) score = float(prob[answer]) print('{}\t{:.4f}\t{}'.format(answer, score, ' '.join(words))) def run_batch(device, batchsize=64): # predict labels by batch def predict_batch(words_batch): xs = nlp_utils.transform_to_array(words_batch, vocab, with_label=False) xs = nlp_utils.convert_seq(xs, device=device, with_label=False) with chainer.using_config('train', False), chainer.no_backprop_mode(): probs = model.predict(xs, softmax=True) answers = model.xp.argmax(probs, axis=1) scores = probs[model.xp.arange(answers.size), answers].tolist() for words, answer, score in zip(words_batch, answers, scores): print('{}\t{:.4f}\t{}'.format(answer, score, ' '.join(words))) batch = [] print('Enter inputs for Batch Predictions') for l in sys.stdin: l = l.strip() if not l: if batch: predict_batch(batch) batch = [] print('# blank line') continue text = nlp_utils.normalize_text(l) words = nlp_utils.split_text(text, char_based=setup['char_based']) batch.append(words) if len(batch) >= batchsize: predict_batch(batch) batch = [] if batch: predict_batch(batch) if __name__ == '__main__': parser = argparse.ArgumentParser( description='Chainer example: Text Classification') parser.add_argument('--device', '-d', type=str, default='-1', help='Device specifier. Either ChainerX device ' 'specifier or an integer. If non-negative integer, ' 'CuPy arrays with specified device id are used. If ' 'negative integer, NumPy arrays are used') parser.add_argument('--model-setup', required=True, help='Model setup dictionary.') group = parser.add_argument_group('deprecated arguments') group.add_argument('--gpu', '-g', dest='device', type=int, nargs='?', const=0, help='GPU ID (negative value indicates CPU)') args = parser.parse_args() device = chainer.get_device(args.device) device.use() model, vocab, setup = setup_model(device, args.model_setup) if device.xp is numpy: run_online(device) else: run_batch(device)
1,835
1,224
/* Copyright (C) 2018 <NAME>. - All Rights Reserved * You may use, distribute and modify this code under the * terms of the MIT license. * You should have received a copy of the MIT license with * this file. If not visit https://opensource.org/licenses/MIT */ #include "local_optimizer.hpp" #include <cmath> #include <algorithm> #include <limits> using namespace ags; #define MAX_LOCAL_ITERATIONS_NUMBER 20 void HookeJeevesOptimizer::SetParameters(double eps, double step, double stepMult) { NLP_SOLVER_ASSERT(eps > 0 && step > 0 && stepMult > 0, "Wrong papameters of the local optimizer"); mEps = eps; mStep = step; mStepMultiplier = stepMult; } Trial HookeJeevesOptimizer::Optimize(std::shared_ptr<IGOProblem<double>> problem, const Trial& startPoint, std::vector<unsigned>& trialsCounters) { mProblem = problem; mStartPoint = startPoint; mTrialsCounters = std::vector<unsigned>(mProblem->GetConstraintsNumber() + 1, 0); int k = 0, i=0; bool needRestart = true; /* currentFvalue will be initialized below, init here to avoid maybe-uninitialized warning */ double currentFValue = 0.0, nextFValue; while (i < MAX_LOCAL_ITERATIONS_NUMBER) { i++; if (needRestart) { k = 0; mCurrentPoint = mStartPoint; mCurrentResearchDirection = mStartPoint; currentFValue = ComputeObjective(mCurrentPoint.y); needRestart = false; } std::swap(mPreviousResearchDirection, mCurrentResearchDirection); mCurrentResearchDirection = mCurrentPoint; nextFValue = MakeResearch(mCurrentResearchDirection.y); if (currentFValue > nextFValue) { DoStep(); k++; currentFValue = nextFValue; } else if (mStep > mEps) { if (k != 0) std::swap(mStartPoint, mPreviousResearchDirection); else mStep /= mStepMultiplier; needRestart = true; } else break; } mPreviousResearchDirection.idx = 0; while (mPreviousResearchDirection.idx < mProblem->GetConstraintsNumber()) { mTrialsCounters[mPreviousResearchDirection.idx]++; mPreviousResearchDirection.g[mPreviousResearchDirection.idx] = mProblem->Calculate(mPreviousResearchDirection.y, mPreviousResearchDirection.idx); if (mPreviousResearchDirection.g[mPreviousResearchDirection.idx] > 0) break; mPreviousResearchDirection.idx++; } if (mPreviousResearchDirection.idx == mProblem->GetConstraintsNumber()) { mPreviousResearchDirection.g[mPreviousResearchDirection.idx] = mProblem->Calculate(mPreviousResearchDirection.y, mPreviousResearchDirection.idx); mTrialsCounters[mPreviousResearchDirection.idx]++; } for(size_t i = 0; i < mTrialsCounters.size(); i++) trialsCounters[i] += mTrialsCounters[i]; return mPreviousResearchDirection; } void HookeJeevesOptimizer::DoStep() { for (int i = 0; i < mProblem->GetDimension(); i++) mCurrentPoint.y[i] = (1 + mStepMultiplier)*mCurrentResearchDirection.y[i] - mStepMultiplier*mPreviousResearchDirection.y[i]; } double HookeJeevesOptimizer::ComputeObjective(const double* x) const { for (int i = 0; i <= mProblem->GetConstraintsNumber(); i++) { double value = mProblem->Calculate(x, i); mTrialsCounters[i]++; if (i < mProblem->GetConstraintsNumber() && value > 0) return std::numeric_limits<double>::max(); else if (i == mProblem->GetConstraintsNumber()) return value; } return std::numeric_limits<double>::max(); } double HookeJeevesOptimizer::MakeResearch(double* startPoint) { double bestValue = ComputeObjective(startPoint); for (int i = 0; i < mProblem->GetDimension(); i++) { startPoint[i] += mStep; double rightFvalue = ComputeObjective(startPoint); if (rightFvalue > bestValue) { startPoint[i] -= 2 * mStep; double leftFValue = ComputeObjective(startPoint); if (leftFValue > bestValue) startPoint[i] += mStep; else bestValue = leftFValue; } else bestValue = rightFvalue; } return bestValue; }
1,543
11,356
<gh_stars>1000+ /////////////////////////////////////////////////////////////////////////////// // rolling_mean.hpp // Copyright (C) 2008 <NAME>. // Copyright (C) 2012 <NAME> (Integricom). // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_ACCUMULATORS_STATISTICS_ROLLING_MEAN_HPP_EAN_26_12_2008 #define BOOST_ACCUMULATORS_STATISTICS_ROLLING_MEAN_HPP_EAN_26_12_2008 #include <boost/mpl/placeholders.hpp> #include <boost/accumulators/framework/accumulator_base.hpp> #include <boost/accumulators/framework/extractor.hpp> #include <boost/accumulators/numeric/functional.hpp> #include <boost/accumulators/framework/parameters/sample.hpp> #include <boost/accumulators/framework/depends_on.hpp> #include <boost/accumulators/statistics_fwd.hpp> #include <boost/accumulators/statistics/rolling_sum.hpp> #include <boost/accumulators/statistics/rolling_count.hpp> namespace boost { namespace accumulators { namespace impl { /////////////////////////////////////////////////////////////////////////////// // lazy_rolling_mean_impl // returns the mean over the rolling window and is calculated only // when the result is requested template<typename Sample> struct lazy_rolling_mean_impl : accumulator_base { // for boost::result_of typedef typename numeric::functional::fdiv<Sample, std::size_t, void, void>::result_type result_type; lazy_rolling_mean_impl(dont_care) { } template<typename Args> result_type result(Args const &args) const { return numeric::fdiv(rolling_sum(args), rolling_count(args)); } }; /////////////////////////////////////////////////////////////////////////////// // immediate_rolling_mean_impl // The non-lazy version computes the rolling mean recursively when a new // sample is added template<typename Sample> struct immediate_rolling_mean_impl : accumulator_base { // for boost::result_of typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type result_type; template<typename Args> immediate_rolling_mean_impl(Args const &args) : mean_(numeric::fdiv(args[sample | Sample()],numeric::one<std::size_t>::value)) { } template<typename Args> void operator()(Args const &args) { if(is_rolling_window_plus1_full(args)) { mean_ += numeric::fdiv(args[sample]-rolling_window_plus1(args).front(),rolling_count(args)); } else { result_type prev_mean = mean_; mean_ += numeric::fdiv(args[sample]-prev_mean,rolling_count(args)); } } template<typename Args> result_type result(Args const &) const { return mean_; } private: result_type mean_; }; } // namespace impl /////////////////////////////////////////////////////////////////////////////// // tag::lazy_rolling_mean // tag::immediate_rolling_mean // tag::rolling_mean // namespace tag { struct lazy_rolling_mean : depends_on< rolling_sum, rolling_count > { /// INTERNAL ONLY /// typedef accumulators::impl::lazy_rolling_mean_impl< mpl::_1 > impl; #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED /// tag::rolling_window::window_size named parameter static boost::parameter::keyword<tag::rolling_window_size> const window_size; #endif }; struct immediate_rolling_mean : depends_on< rolling_window_plus1, rolling_count> { /// INTERNAL ONLY /// typedef accumulators::impl::immediate_rolling_mean_impl< mpl::_1> impl; #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED /// tag::rolling_window::window_size named parameter static boost::parameter::keyword<tag::rolling_window_size> const window_size; #endif }; // make immediate_rolling_mean the default implementation struct rolling_mean : immediate_rolling_mean {}; } // namespace tag /////////////////////////////////////////////////////////////////////////////// // extract::lazy_rolling_mean // extract::immediate_rolling_mean // extract::rolling_mean // namespace extract { extractor<tag::lazy_rolling_mean> const lazy_rolling_mean = {}; extractor<tag::immediate_rolling_mean> const immediate_rolling_mean = {}; extractor<tag::rolling_mean> const rolling_mean = {}; BOOST_ACCUMULATORS_IGNORE_GLOBAL(lazy_rolling_mean) BOOST_ACCUMULATORS_IGNORE_GLOBAL(immediate_rolling_mean) BOOST_ACCUMULATORS_IGNORE_GLOBAL(rolling_mean) } using extract::lazy_rolling_mean; using extract::immediate_rolling_mean; using extract::rolling_mean; // rolling_mean(lazy) -> lazy_rolling_mean template<> struct as_feature<tag::rolling_mean(lazy)> { typedef tag::lazy_rolling_mean type; }; // rolling_mean(immediate) -> immediate_rolling_mean template<> struct as_feature<tag::rolling_mean(immediate)> { typedef tag::immediate_rolling_mean type; }; // for the purposes of feature-based dependency resolution, // immediate_rolling_mean provides the same feature as rolling_mean template<> struct feature_of<tag::immediate_rolling_mean> : feature_of<tag::rolling_mean> { }; // for the purposes of feature-based dependency resolution, // lazy_rolling_mean provides the same feature as rolling_mean template<> struct feature_of<tag::lazy_rolling_mean> : feature_of<tag::rolling_mean> { }; }} // namespace boost::accumulators #endif
2,330
451
// // MKBDoubleInvocationHandler.h // MockingbirdFramework // // Created by typealias on 7/19/21. // #import "MKBInvocationHandler.h" NS_ASSUME_NONNULL_BEGIN @interface MKBDoubleInvocationHandler : MKBInvocationHandler @end NS_ASSUME_NONNULL_END
97
1,480
{ "name": "TypeScript Website codespace", "dockerFile": "Dockerfile", // Set *default* container specific settings.json values on container create. "settings": { "terminal.integrated.shell.linux": "/bin/bash" }, "forwardPorts": [8000], // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "sudo yarn install && sudo yarn bootstrap && yarn start" }
121
325
#include "LostModification.hpp" // #include "LostModification2.hpp" // <jet_tag: lost_mod:2> int lostModificationGetValue() { return 12; // <jet_tag: lost_mod:1> // return lostModificationGetAnotherValue(); // <jet_tag: lost_mod:2> }
94
2,151
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <algorithm> #include <sstream> #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "tools/gn/ninja_action_target_writer.h" #include "tools/gn/pool.h" #include "tools/gn/substitution_list.h" #include "tools/gn/target.h" #include "tools/gn/test_with_scope.h" TEST(NinjaActionTargetWriter, WriteOutputFilesForBuildLine) { Err err; TestWithScope setup; Target target(setup.settings(), Label(SourceDir("//foo/"), "bar")); target.set_output_type(Target::ACTION_FOREACH); target.action_values().outputs() = SubstitutionList::MakeForTest( "//out/Debug/gen/a b{{source_name_part}}.h", "//out/Debug/gen/{{source_name_part}}.cc"); target.SetToolchain(setup.toolchain()); ASSERT_TRUE(target.OnResolved(&err)); std::ostringstream out; NinjaActionTargetWriter writer(&target, out); SourceFile source("//foo/bar.in"); std::vector<OutputFile> output_files; writer.WriteOutputFilesForBuildLine(source, &output_files); EXPECT_EQ(" gen/a$ bbar.h gen/bar.cc", out.str()); } // Tests an action with no sources. TEST(NinjaActionTargetWriter, ActionNoSources) { Err err; TestWithScope setup; Target target(setup.settings(), Label(SourceDir("//foo/"), "bar")); target.set_output_type(Target::ACTION); target.action_values().set_script(SourceFile("//foo/script.py")); target.config_values().inputs().push_back(SourceFile("//foo/included.txt")); target.action_values().outputs() = SubstitutionList::MakeForTest("//out/Debug/foo.out"); target.SetToolchain(setup.toolchain()); ASSERT_TRUE(target.OnResolved(&err)); setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL( "/usr/bin/python"))); std::ostringstream out; NinjaActionTargetWriter writer(&target, out); writer.Run(); const char* expected = 1 /* skip initial newline */ + R"( rule __foo_bar___rule command = /usr/bin/python ../../foo/script.py description = ACTION //foo:bar() restat = 1 build foo.out: __foo_bar___rule | ../../foo/script.py ../../foo/included.txt build obj/foo/bar.stamp: stamp foo.out )"; EXPECT_EQ(expected, out.str()); } // Tests an action with no sources and pool TEST(NinjaActionTargetWriter, ActionNoSourcesConsole) { Err err; TestWithScope setup; Target target(setup.settings(), Label(SourceDir("//foo/"), "bar")); target.set_output_type(Target::ACTION); target.action_values().set_script(SourceFile("//foo/script.py")); target.config_values().inputs().push_back(SourceFile("//foo/included.txt")); target.action_values().outputs() = SubstitutionList::MakeForTest("//out/Debug/foo.out"); Pool pool(setup.settings(), Label(SourceDir("//"), "console", setup.toolchain()->label().dir(), setup.toolchain()->label().name())); pool.set_depth(1); target.action_values().set_pool(LabelPtrPair<Pool>(&pool)); target.SetToolchain(setup.toolchain()); ASSERT_TRUE(target.OnResolved(&err)); setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL( "/usr/bin/python"))); std::ostringstream out; NinjaActionTargetWriter writer(&target, out); writer.Run(); // The console pool's name must be mapped exactly to the string "console" // which is a special pre-defined pool name in ninja. const char* expected = 1 /* skip initial newline */ + R"( rule __foo_bar___rule command = /usr/bin/python ../../foo/script.py description = ACTION //foo:bar() restat = 1 build foo.out: __foo_bar___rule | ../../foo/script.py ../../foo/included.txt pool = console build obj/foo/bar.stamp: stamp foo.out )"; EXPECT_EQ(expected, out.str()); } // Makes sure that we write sources as input dependencies for actions with // both sources and inputs (ACTION_FOREACH treats the sources differently). TEST(NinjaActionTargetWriter, ActionWithSources) { Err err; TestWithScope setup; Target target(setup.settings(), Label(SourceDir("//foo/"), "bar")); target.set_output_type(Target::ACTION); target.action_values().set_script(SourceFile("//foo/script.py")); target.sources().push_back(SourceFile("//foo/source.txt")); target.config_values().inputs().push_back(SourceFile("//foo/included.txt")); target.action_values().outputs() = SubstitutionList::MakeForTest("//out/Debug/foo.out"); target.SetToolchain(setup.toolchain()); ASSERT_TRUE(target.OnResolved(&err)); setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL( "/usr/bin/python"))); std::ostringstream out; NinjaActionTargetWriter writer(&target, out); writer.Run(); const char expected_linux[] = "rule __foo_bar___rule\n" " command = /usr/bin/python ../../foo/script.py\n" " description = ACTION //foo:bar()\n" " restat = 1\n" "\n" "build foo.out: __foo_bar___rule | ../../foo/script.py " "../../foo/included.txt ../../foo/source.txt\n" "\n" "build obj/foo/bar.stamp: stamp foo.out\n"; EXPECT_EQ(expected_linux, out.str()); } TEST(NinjaActionTargetWriter, ForEach) { Err err; TestWithScope setup; // Some dependencies that the action can depend on. Use actions for these // so they have a nice platform-independent stamp file that can appear in the // output (rather than having to worry about how the current platform names // binaries). Target dep(setup.settings(), Label(SourceDir("//foo/"), "dep")); dep.set_output_type(Target::ACTION); dep.visibility().SetPublic(); dep.SetToolchain(setup.toolchain()); ASSERT_TRUE(dep.OnResolved(&err)); Target datadep(setup.settings(), Label(SourceDir("//foo/"), "datadep")); datadep.set_output_type(Target::ACTION); datadep.visibility().SetPublic(); datadep.SetToolchain(setup.toolchain()); ASSERT_TRUE(datadep.OnResolved(&err)); Target target(setup.settings(), Label(SourceDir("//foo/"), "bar")); target.set_output_type(Target::ACTION_FOREACH); target.private_deps().push_back(LabelTargetPair(&dep)); target.data_deps().push_back(LabelTargetPair(&datadep)); target.sources().push_back(SourceFile("//foo/input1.txt")); target.sources().push_back(SourceFile("//foo/input2.txt")); target.action_values().set_script(SourceFile("//foo/script.py")); target.action_values().args() = SubstitutionList::MakeForTest( "-i", "{{source}}", "--out=foo bar{{source_name_part}}.o"); target.action_values().outputs() = SubstitutionList::MakeForTest( "//out/Debug/{{source_name_part}}.out"); target.config_values().inputs().push_back(SourceFile("//foo/included.txt")); target.SetToolchain(setup.toolchain()); ASSERT_TRUE(target.OnResolved(&err)); setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL( "/usr/bin/python"))); std::ostringstream out; NinjaActionTargetWriter writer(&target, out); writer.Run(); const char expected_linux[] = "rule __foo_bar___rule\n" " command = /usr/bin/python ../../foo/script.py -i ${in} " // Escaping is different between Windows and Posix. #if defined(OS_WIN) "\"--out=foo$ bar${source_name_part}.o\"\n" #else "--out=foo\\$ bar${source_name_part}.o\n" #endif " description = ACTION //foo:bar()\n" " restat = 1\n" "build obj/foo/bar.inputdeps.stamp: stamp ../../foo/script.py " "../../foo/included.txt obj/foo/dep.stamp\n" "\n" "build input1.out: __foo_bar___rule ../../foo/input1.txt | " "obj/foo/bar.inputdeps.stamp\n" " source_name_part = input1\n" "build input2.out: __foo_bar___rule ../../foo/input2.txt | " "obj/foo/bar.inputdeps.stamp\n" " source_name_part = input2\n" "\n" "build obj/foo/bar.stamp: " "stamp input1.out input2.out || obj/foo/datadep.stamp\n"; std::string out_str = out.str(); #if defined(OS_WIN) std::replace(out_str.begin(), out_str.end(), '\\', '/'); #endif EXPECT_EQ(expected_linux, out_str); } TEST(NinjaActionTargetWriter, ForEachWithDepfile) { Err err; TestWithScope setup; Target target(setup.settings(), Label(SourceDir("//foo/"), "bar")); target.set_output_type(Target::ACTION_FOREACH); target.sources().push_back(SourceFile("//foo/input1.txt")); target.sources().push_back(SourceFile("//foo/input2.txt")); target.action_values().set_script(SourceFile("//foo/script.py")); target.SetToolchain(setup.toolchain()); ASSERT_TRUE(target.OnResolved(&err)); SubstitutionPattern depfile; ASSERT_TRUE( depfile.Parse("//out/Debug/gen/{{source_name_part}}.d", nullptr, &err)); target.action_values().set_depfile(depfile); target.action_values().args() = SubstitutionList::MakeForTest( "-i", "{{source}}", "--out=foo bar{{source_name_part}}.o"); target.action_values().outputs() = SubstitutionList::MakeForTest( "//out/Debug/{{source_name_part}}.out"); target.config_values().inputs().push_back(SourceFile("//foo/included.txt")); setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL( "/usr/bin/python"))); std::ostringstream out; NinjaActionTargetWriter writer(&target, out); writer.Run(); const char expected_linux[] = "rule __foo_bar___rule\n" " command = /usr/bin/python ../../foo/script.py -i ${in} " #if defined(OS_WIN) "\"--out=foo$ bar${source_name_part}.o\"\n" #else "--out=foo\\$ bar${source_name_part}.o\n" #endif " description = ACTION //foo:bar()\n" " restat = 1\n" "build obj/foo/bar.inputdeps.stamp: stamp ../../foo/script.py " "../../foo/included.txt\n" "\n" "build input1.out: __foo_bar___rule ../../foo/input1.txt" " | obj/foo/bar.inputdeps.stamp\n" " source_name_part = input1\n" " depfile = gen/input1.d\n" "build input2.out: __foo_bar___rule ../../foo/input2.txt" " | obj/foo/bar.inputdeps.stamp\n" " source_name_part = input2\n" " depfile = gen/input2.d\n" "\n" "build obj/foo/bar.stamp: stamp input1.out input2.out\n"; EXPECT_EQ(expected_linux, out.str()); } TEST(NinjaActionTargetWriter, ForEachWithResponseFile) { Err err; TestWithScope setup; Target target(setup.settings(), Label(SourceDir("//foo/"), "bar")); target.set_output_type(Target::ACTION_FOREACH); target.sources().push_back(SourceFile("//foo/input1.txt")); target.action_values().set_script(SourceFile("//foo/script.py")); target.SetToolchain(setup.toolchain()); ASSERT_TRUE(target.OnResolved(&err)); // Make sure we get interesting substitutions for both the args and the // response file contents. target.action_values().args() = SubstitutionList::MakeForTest( "{{source}}", "{{source_file_part}}", "{{response_file_name}}"); target.action_values().rsp_file_contents() = SubstitutionList::MakeForTest( "-j", "{{source_name_part}}"); target.action_values().outputs() = SubstitutionList::MakeForTest( "//out/Debug/{{source_name_part}}.out"); setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL( "/usr/bin/python"))); std::ostringstream out; NinjaActionTargetWriter writer(&target, out); writer.Run(); const char expected_linux[] = "rule __foo_bar___rule\n" // This name is autogenerated from the target rule name. " rspfile = __foo_bar___rule.$unique_name.rsp\n" // These come from rsp_file_contents above. " rspfile_content = -j ${source_name_part}\n" // These come from the args. " command = /usr/bin/python ../../foo/script.py ${in} " "${source_file_part} ${rspfile}\n" " description = ACTION //foo:bar()\n" " restat = 1\n" "\n" "build input1.out: __foo_bar___rule ../../foo/input1.txt" " | ../../foo/script.py\n" // Necessary for the rspfile defined in the rule. " unique_name = 0\n" // Substitution for the args. " source_file_part = input1.txt\n" // Substitution for the rspfile contents. " source_name_part = input1\n" "\n" "build obj/foo/bar.stamp: stamp input1.out\n"; EXPECT_EQ(expected_linux, out.str()); } TEST(NinjaActionTargetWriter, ForEachWithPool) { Err err; TestWithScope setup; Target target(setup.settings(), Label(SourceDir("//foo/"), "bar")); target.set_output_type(Target::ACTION_FOREACH); target.sources().push_back(SourceFile("//foo/input1.txt")); target.action_values().set_script(SourceFile("//foo/script.py")); Pool pool(setup.settings(), Label(SourceDir("//foo/"), "pool", setup.toolchain()->label().dir(), setup.toolchain()->label().name())); pool.set_depth(5); target.action_values().set_pool(LabelPtrPair<Pool>(&pool)); target.SetToolchain(setup.toolchain()); ASSERT_TRUE(target.OnResolved(&err)); // Make sure we get interesting substitutions for both the args and the // response file contents. target.action_values().args() = SubstitutionList::MakeForTest("{{source}}", "{{source_file_part}}"); target.action_values().outputs() = SubstitutionList::MakeForTest("//out/Debug/{{source_name_part}}.out"); setup.build_settings()->set_python_path( base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); std::ostringstream out; NinjaActionTargetWriter writer(&target, out); writer.Run(); const char expected_linux[] = "rule __foo_bar___rule\n" // These come from the args. " command = /usr/bin/python ../../foo/script.py ${in} " "${source_file_part}\n" " description = ACTION //foo:bar()\n" " restat = 1\n" "\n" "build input1.out: __foo_bar___rule ../../foo/input1.txt" " | ../../foo/script.py\n" // Substitution for the args. " source_file_part = input1.txt\n" " pool = foo_pool\n" "\n" "build obj/foo/bar.stamp: stamp input1.out\n"; EXPECT_EQ(expected_linux, out.str()); } TEST(NinjaActionTargetWriter, NoTransitiveHardDeps) { Err err; TestWithScope setup; setup.build_settings()->set_python_path( base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); Target dep(setup.settings(), Label(SourceDir("//foo/"), "dep")); dep.set_output_type(Target::ACTION); dep.visibility().SetPublic(); dep.SetToolchain(setup.toolchain()); ASSERT_TRUE(dep.OnResolved(&err)); Target foo(setup.settings(), Label(SourceDir("//foo/"), "foo")); foo.set_output_type(Target::ACTION); foo.visibility().SetPublic(); foo.sources().push_back(SourceFile("//foo/input1.txt")); foo.action_values().set_script(SourceFile("//foo/script.py")); foo.private_deps().push_back(LabelTargetPair(&dep)); foo.SetToolchain(setup.toolchain()); foo.action_values().outputs() = SubstitutionList::MakeForTest("//out/Debug/foo.out"); ASSERT_TRUE(foo.OnResolved(&err)); { std::ostringstream out; NinjaActionTargetWriter writer(&foo, out); writer.Run(); const char expected_linux[] = "rule __foo_foo___rule\n" // These come from the args. " command = /usr/bin/python ../../foo/script.py\n" " description = ACTION //foo:foo()\n" " restat = 1\n" "\n" "build foo.out: __foo_foo___rule | ../../foo/script.py" " ../../foo/input1.txt obj/foo/dep.stamp\n" "\n" "build obj/foo/foo.stamp: stamp foo.out\n"; EXPECT_EQ(expected_linux, out.str()); } Target bar(setup.settings(), Label(SourceDir("//bar/"), "bar")); bar.set_output_type(Target::ACTION); bar.sources().push_back(SourceFile("//bar/input1.txt")); bar.action_values().set_script(SourceFile("//bar/script.py")); bar.private_deps().push_back(LabelTargetPair(&foo)); bar.SetToolchain(setup.toolchain()); bar.action_values().outputs() = SubstitutionList::MakeForTest("//out/Debug/bar.out"); ASSERT_TRUE(bar.OnResolved(&err)) << err.message(); { std::ostringstream out; NinjaActionTargetWriter writer(&bar, out); writer.Run(); const char expected_linux[] = "rule __bar_bar___rule\n" // These come from the args. " command = /usr/bin/python ../../bar/script.py\n" " description = ACTION //bar:bar()\n" " restat = 1\n" "\n" // Do not have obj/foo/dep.stamp as dependency. "build bar.out: __bar_bar___rule | ../../bar/script.py" " ../../bar/input1.txt obj/foo/foo.stamp\n" "\n" "build obj/bar/bar.stamp: stamp bar.out\n"; EXPECT_EQ(expected_linux, out.str()); } }
6,458
971
package com.ucar.datalink.biz.dal; import com.ucar.datalink.domain.worker.WorkerJvmStateInfo; import org.apache.ibatis.annotations.Param; import java.util.Date; import java.util.List; /** * Created by sqq on 2018/1/19. */ public interface WorkerJvmStateDAO { Integer insert(WorkerJvmStateInfo jvmMonitorInfo); List<WorkerJvmStateInfo> getLatestList(); WorkerJvmStateInfo getLatestByWorkerId(Long workerId); List<WorkerJvmStateInfo> getListByWorkerIdForQuery(@Param("workerId") Long workerId, @Param("startTime") Date startTime, @Param("endTime") Date endTime); }
206
2,073
<gh_stars>1000+ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.bugs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.Deque; import java.util.LinkedList; import java.util.List; import javax.jms.Connection; import javax.jms.DeliveryMode; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.openmbean.CompositeData; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.jmx.QueueViewMBean; import org.apache.activemq.broker.region.policy.PolicyEntry; import org.apache.activemq.broker.region.policy.PolicyMap; import org.apache.activemq.util.Wait; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * */ public class AMQ6117Test { private static final Logger LOG = LoggerFactory.getLogger(AMQ6117Test.class); private BrokerService broker; @Test public void testViewIsStale() throws Exception { final int MSG_COUNT = 10; ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(broker.getVmConnectorURI()); Connection connection = cf.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue("Test-Queue"); Queue dlq = session.createQueue("ActiveMQ.DLQ"); MessageProducer producer = session.createProducer(queue); // Ensure there is a DLQ in existence to start. session.createProducer(dlq); for (int i = 0; i < MSG_COUNT; ++i) { producer.send(session.createMessage(), DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, 1000); } final QueueViewMBean queueView = getProxyToQueue(dlq.getQueueName()); assertTrue("Message should be DLQ'd", Wait.waitFor(new Wait.Condition() { @Override public boolean isSatisified() throws Exception { return queueView.getQueueSize() == MSG_COUNT; } })); LOG.info("DLQ has captured all expired messages"); Deque<String> browsed = new LinkedList<String>(); CompositeData[] elements = queueView.browse(); assertEquals(MSG_COUNT, elements.length); for (CompositeData element : elements) { String messageID = (String) element.get("JMSMessageID"); LOG.debug("MessageID: {}", messageID); browsed.add(messageID); } String removedMsgId = browsed.removeFirst(); assertTrue(queueView.removeMessage(removedMsgId)); assertEquals(MSG_COUNT - 1, queueView.getQueueSize()); elements = queueView.browse(); assertEquals(MSG_COUNT - 1, elements.length); for (CompositeData element : elements) { String messageID = (String) element.get("JMSMessageID"); LOG.debug("MessageID: {}", messageID); assertFalse(messageID.equals(removedMsgId)); } } @Before public void setup() throws Exception { PolicyMap policyMap = new PolicyMap(); List<PolicyEntry> entries = new ArrayList<PolicyEntry>(); PolicyEntry pe = new PolicyEntry(); pe.setExpireMessagesPeriod(1500); pe.setQueue(">"); entries.add(pe); policyMap.setPolicyEntries(entries); broker = new BrokerService(); broker.setDeleteAllMessagesOnStartup(true); broker.setPersistent(true); broker.setUseJmx(true); broker.setDestinationPolicy(policyMap); broker.start(); broker.waitUntilStarted(); } @After public void tearDown() throws Exception { broker.stop(); } protected QueueViewMBean getProxyToQueue(String name) throws MalformedObjectNameException, JMSException { ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName="+name); QueueViewMBean proxy = (QueueViewMBean) broker.getManagementContext() .newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true); return proxy; } }
1,939
1,711
# Copyright 2015-2016 Yelp Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import contextlib import asynctest import mock import pytest from paasta_tools import drain_lib def test_register_drain_method(): with mock.patch.dict(drain_lib._drain_methods): @drain_lib.register_drain_method("FAKEDRAINMETHOD") class FakeDrainMethod(drain_lib.DrainMethod): pass assert ( type(drain_lib.get_drain_method("FAKEDRAINMETHOD", "srv", "inst", "ns")) == FakeDrainMethod ) @contextlib.contextmanager def mock_ClientSession(**fake_session_kwargs): fake_session = asynctest.MagicMock(name="session", **fake_session_kwargs) class FakeClientSession: def __init__(self, *args, **kwargs): ... async def __aenter__(*args): return fake_session async def __aexit__(*args): pass with mock.patch("aiohttp.ClientSession", new=FakeClientSession, autospec=False): yield class TestHacheckDrainMethod: drain_method = drain_lib.HacheckDrainMethod( service="srv", instance="inst", registrations=["ns_one", "ns_two"], hacheck_port=12345, ) async def _async_id(self, x): return x def test_spool_urls(self): fake_task = mock.Mock(host="fake_host", ports=[54321]) actual = self.drain_method.spool_urls(fake_task) # Nerve hits /{mode}/{service}.{namespace}/{port}/status expected = [ f"http://fake_host:12345/spool/{ns}/54321/status" for ns in self.drain_method.registrations ] assert actual == expected @pytest.mark.asyncio async def test_for_each_registration_with_no_ports(self): fake_task = mock.Mock(host="fake_host", ports=[]) actual = await self.drain_method.for_each_registration( task=fake_task, func=self._async_id ) assert actual is None @pytest.mark.asyncio async def test_for_each_registration(self): fake_task = mock.Mock(host="fake_host", ports=[54321]) actual = await self.drain_method.for_each_registration( task=fake_task, func=self._async_id ) assert actual == self.drain_method.spool_urls(fake_task) @pytest.mark.asyncio async def test_is_draining_yes(self): fake_response = mock.Mock( status=503, text=asynctest.CoroutineMock( return_value="Service service in down state since 1435694078.778886 " "until 1435694178.780000: Drained by Paasta" ), ) fake_task = mock.Mock(host="fake_host", ports=[54321]) with mock_ClientSession( get=mock.Mock( return_value=asynctest.MagicMock( __aenter__=asynctest.CoroutineMock(return_value=fake_response) ) ) ): assert await self.drain_method.is_draining(fake_task) is True @pytest.mark.asyncio async def test_is_draining_no(self): fake_response = mock.Mock( status=200, text=asynctest.CoroutineMock(return_value="") ) fake_task = mock.Mock(host="fake_host", ports=[54321]) with mock_ClientSession( get=mock.Mock( return_value=asynctest.MagicMock( __aenter__=asynctest.CoroutineMock(return_value=fake_response) ) ) ): assert await self.drain_method.is_draining(fake_task) is False class TestHTTPDrainMethod: def test_get_format_params(self): fake_task = mock.Mock(host="fake_host", ports=[54321]) drain_method = drain_lib.HTTPDrainMethod( "fake_service", "fake_instance", ["fake_nerve_ns"], {}, {}, {}, {} ) assert drain_method.get_format_params(fake_task) == [ { "host": "fake_host", "port": 54321, "service": "fake_service", "instance": "fake_instance", "nerve_ns": "fake_nerve_ns", } ] def test_format_url(self): drain_method = drain_lib.HTTPDrainMethod( "fake_service", "fake_instance", ["fake_nerve_ns"], {}, {}, {}, {} ) url_format = "foo_{host}" format_params = {"host": "fake_host"} assert drain_method.format_url(url_format, format_params) == "foo_fake_host" def test_parse_success_codes(self): drain_method = drain_lib.HTTPDrainMethod( "fake_service", "fake_instance", ["fake_nerve_ns"], {}, {}, {}, {} ) assert drain_method.parse_success_codes("200") == {200} assert drain_method.parse_success_codes("200-203") == {200, 201, 202, 203} assert drain_method.parse_success_codes("200-202,302,305-306") == { 200, 201, 202, 302, 305, 305, 306, } assert drain_method.parse_success_codes(200) == {200} def test_check_response_code(self): drain_method = drain_lib.HTTPDrainMethod( "fake_service", "fake_instance", ["fake_nerve_ns"], {}, {}, {}, {} ) # Happy case assert drain_method.check_response_code(200, "200-299") is True # Sad case assert drain_method.check_response_code(500, "200-299") is False @pytest.mark.asyncio async def test_issue_request(self): drain_method = drain_lib.HTTPDrainMethod( "fake_service", "fake_instance", ["fake_nerve_ns"], {}, {}, {}, {} ) fake_task = mock.Mock(host="fake_host", ports=[54321]) url_spec = { "url_format": "http://localhost:654321/fake/{host}", "method": "get", "success_codes": "1234", } fake_resp = mock.Mock(status=1234) mock_request = mock.Mock( return_value=asynctest.CoroutineMock(return_value=fake_resp)() ) with mock_ClientSession(request=mock_request): await drain_method.issue_request(url_spec=url_spec, task=fake_task) mock_request.assert_called_once_with( method="GET", url="http://localhost:654321/fake/fake_host", headers=mock.ANY, timeout=15, )
3,215
3,731
<reponame>cclauss/lux import pytest import pandas as pd import psycopg2 import lux @pytest.fixture(scope="session") def global_var(): connection = psycopg2.connect("host=localhost dbname=postgres user=postgres password=<PASSWORD>") lux.config.set_SQL_connection(connection) url = "https://github.com/lux-org/lux-datasets/blob/master/data/olympic.csv?raw=true" pytest.olympic = pd.read_csv(url) pytest.car_df = pd.read_csv("lux/data/car.csv") pytest.college_df = pd.read_csv("lux/data/college.csv") pytest.metadata = [ "_intent", "_inferred_intent", "_data_type", "unique_values", "cardinality", "_rec_info", "_min_max", "plotting_style", "_current_vis", "_widget", "_recommendation", "_prev", "_history", "_saved_export", "name", "_sampled", "_toggle_pandas_display", "_message", "_pandas_only", "pre_aggregated", "_type_override", ]
498
3,371
<gh_stars>1000+ package com.beloo.widget.chipslayoutmanager.layouter.criteria; import com.beloo.widget.chipslayoutmanager.layouter.AbstractLayouter; abstract class FinishingCriteriaDecorator implements IFinishingCriteria { private IFinishingCriteria finishingCriteria; FinishingCriteriaDecorator(IFinishingCriteria finishingCriteria) { this.finishingCriteria = finishingCriteria; } @Override public boolean isFinishedLayouting(AbstractLayouter abstractLayouter) { return finishingCriteria.isFinishedLayouting(abstractLayouter); } }
186
1,444
<gh_stars>1000+ package mage.cards.m; import java.util.UUID; import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.target.common.TargetOpponent; /** * * @author North */ public final class MindSculpt extends CardImpl { public MindSculpt(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{U}"); // Target opponent puts the top seven cards of their library into their graveyard. this.getSpellAbility().addEffect(new PutLibraryIntoGraveTargetEffect(7)); this.getSpellAbility().addTarget(new TargetOpponent()); } private MindSculpt(final MindSculpt card) { super(card); } @Override public MindSculpt copy() { return new MindSculpt(this); } }
325
428
<reponame>cping/LGame /** * Copyright 2008 - 2019 The Loon Game Engine Authors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. * * @project loon * @author cping * @email:<EMAIL> * @version 0.5 */ package loon.utils.parse; import loon.LSysException; import loon.utils.ObjectMap; import loon.utils.StrBuilder; import loon.utils.StringUtils; public class ParserReader { private char[] _context = null; private int _currentIndex = 0; private int _currentChar = 0; private final StrBuilder _tempBuffer; private int _tempIndex = 0; private int _level = 0; private int _eofIndex = 0; private final ObjectMap<Integer, Integer> _markMap; public ParserReader(String context) { if (context != null) { this._context = context.toCharArray(); } else { this._context = new char[0]; } this._tempBuffer = new StrBuilder(); this._currentIndex = 0; this._tempIndex = 0; this._level = 0; this._eofIndex = -1; this._markMap = new ObjectMap<Integer, Integer>(); } public String getString() { int begin = _markMap.get(_level - 1); int end = _tempIndex; if (begin > end) { throw new LSysException(StringUtils.format("begin:{0} > end:{1}", begin, end)); } else { return _tempBuffer.substring(begin, end); } } public ParserReader positionChar(int idx) { this._currentIndex = idx; return this; } public int nextChar() { if (_currentIndex < 0) { this._currentIndex = 0; } final int len = this._context.length - 1; if (_currentIndex >= len) { return -1; } return _context[_currentIndex++]; } public int read() { if (_tempIndex == _eofIndex) { _tempIndex++; return -1; } if (_tempIndex < _tempBuffer.length()) { _currentChar = (int) _tempBuffer.charAt(_tempIndex); } else { if (_eofIndex != -1) { return -1; } _currentChar = nextChar(); if (_currentChar == -1) { _eofIndex = _tempIndex; } _tempBuffer.append((char) _currentChar); } _tempIndex++; return _currentChar; } public int currentChar() { read(); unread(); return _currentChar; } public int previous() { return _tempIndex <= 1 || _tempIndex >= _tempBuffer.length() ? -1 : _tempBuffer.charAt(_tempIndex - 2); } public ParserReader mark() { _markMap.put(_level, _tempIndex); _level++; return this; } public ParserReader unmark() { _level--; if (_level < 0) { throw new LSysException("no more mark() is to unmark()"); } return this; } public ParserReader reset() { unmark(); this._tempIndex = _markMap.get(_level); return this; } public ParserReader unread() { _tempIndex--; if (_tempIndex < 0) { _tempIndex = 0; } return this; } @Override public String toString() { return getString(); } }
1,183
623
/* * Copyright 2018 The StartupOS Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.startupos.examples.docker; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; import java.io.IOException; import java.io.OutputStream; import java.net.InetSocketAddress; import java.nio.file.Files; import java.nio.file.Paths; public class HelloServer { public static String DOCKERENV_FILE = "/.dockerenv"; static class SayHelloHandler implements HttpHandler { @Override public void handle(HttpExchange t) throws IOException { String response; if (Files.exists(Paths.get(DOCKERENV_FILE))) { response = String.format("Hello, I am *inside* the container! (%s exists)", DOCKERENV_FILE); } else { response = String.format("Hello from outside of container (%s does not exist)", DOCKERENV_FILE); } t.sendResponseHeaders(200, response.length()); try (OutputStream os = t.getResponseBody()) { os.write(response.getBytes()); } } } public static void main(String[] args) throws Exception { HttpServer server = HttpServer.create(new InetSocketAddress(8000), 0); server.createContext("/test", new SayHelloHandler()); server.setExecutor(null); // creates a default executor server.start(); } }
618
32,544
package com.baeldung.boot.services.impl; import com.baeldung.boot.daos.IBarCrudRepository; import com.baeldung.boot.domain.Bar; import com.baeldung.boot.services.IBarService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.repository.CrudRepository; import java.io.Serializable; public class BarSpringDataJpaService extends AbstractSpringDataJpaService<Bar> implements IBarService { @Autowired private IBarCrudRepository dao; public BarSpringDataJpaService() { super(); } @Override protected CrudRepository<Bar, Serializable> getDao() { return dao; } @Override public Page<Bar> findPaginated(int page, int size) { throw new UnsupportedOperationException("Not implemented yet"); } }
301
1,204
/* * Copyright 2015 <NAME>. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.gs.collections.impl.block.function; import com.gs.collections.impl.factory.Maps; import com.gs.collections.impl.list.mutable.FastList; import org.junit.Assert; import org.junit.Test; /** * Junit test for {@link MinSizeFunction}. */ public class MinSizeFunctionTest { @Test public void minSizeCollection() { Assert.assertEquals(Integer.valueOf(2), MinSizeFunction.COLLECTION.value(2, FastList.newListWith(1, 2, 3))); Assert.assertEquals(Integer.valueOf(2), MinSizeFunction.COLLECTION.value(3, FastList.newListWith(1, 2))); } @Test public void minSizeMap() { Assert.assertEquals(Integer.valueOf(2), MinSizeFunction.MAP.value(2, Maps.mutable.of(1, 1, 2, 2, 3, 3))); Assert.assertEquals(Integer.valueOf(2), MinSizeFunction.MAP.value(3, Maps.mutable.of(1, 1, 2, 2))); } }
542
1,056
<filename>java/java.navigation/src/org/netbeans/modules/java/navigation/ClassMemberNavigatorJavaSourceFactory.java /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.netbeans.modules.java.navigation; import java.util.Collections; import java.util.List; import org.netbeans.api.java.source.CancellableTask; import org.netbeans.api.java.source.CompilationInfo; import org.netbeans.api.java.source.JavaSource.Phase; import org.netbeans.api.java.source.JavaSource.Priority; import org.netbeans.api.java.source.JavaSourceTaskFactory; import org.netbeans.api.java.source.support.LookupBasedJavaSourceTaskFactory; import org.netbeans.modules.parsing.spi.TaskIndexingMode; import org.openide.filesystems.FileObject; import org.openide.util.Lookup; /** * * @author <NAME>, <NAME> */ @org.openide.util.lookup.ServiceProvider(service=org.netbeans.api.java.source.JavaSourceTaskFactory.class) public final class ClassMemberNavigatorJavaSourceFactory extends LookupBasedJavaSourceTaskFactory { private ClassMemberPanelUI ui; private static final CancellableTask<CompilationInfo> EMPTY_TASK = new CancellableTask<CompilationInfo>() { public void cancel() {} public void run(CompilationInfo parameter) throws Exception {} }; static ClassMemberNavigatorJavaSourceFactory getInstance() { for(JavaSourceTaskFactory t : Lookup.getDefault().lookupAll(JavaSourceTaskFactory.class)) { if (t instanceof ClassMemberNavigatorJavaSourceFactory) { return (ClassMemberNavigatorJavaSourceFactory) t; } } return null; } public ClassMemberNavigatorJavaSourceFactory() { super( Phase.ELEMENTS_RESOLVED, Priority.NORMAL, TaskIndexingMode.ALLOWED_DURING_SCAN, "text/x-java", "application/x-class-file"); } public synchronized CancellableTask<CompilationInfo> createTask(FileObject file) { // System.out.println("CREATE TASK FOR " + file.getNameExt() ); if ( ui == null) { return EMPTY_TASK; } else { ui.showWaitNode(); return ui.getTask(); } } public List<FileObject> getFileObjects() { List<FileObject> result = super.getFileObjects(); if (result.size() == 1) return result; // System.out.println("Nothing to show"); return Collections.emptyList(); } public synchronized void setLookup(Lookup l, ClassMemberPanelUI ui) { this.ui = ui; super.setLookup(l); } }
1,231
763
<gh_stars>100-1000 package org.batfish.specifier; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.hasItem; import java.util.Collection; import java.util.Set; import org.batfish.datamodel.IpSpace; import org.batfish.specifier.IpSpaceAssignment.Entry; import org.batfish.specifier.IpSpaceAssignmentMatchersImpl.HasIpSpace; import org.batfish.specifier.IpSpaceAssignmentMatchersImpl.HasLocations; import org.hamcrest.Matcher; public final class IpSpaceAssignmentMatchers { public static Matcher<IpSpaceAssignment> hasEntries( Matcher<? super Collection<Entry>> entriesMatcher) { return new IpSpaceAssignmentMatchersImpl.HasEntries(entriesMatcher); } public static Matcher<IpSpaceAssignment> hasEntry(Matcher<? super Entry> entryMatcher) { return hasEntries(hasItem(entryMatcher)); } public static Matcher<Entry> hasIpSpace(Matcher<? super IpSpace> ipSpaceMatcher) { return new HasIpSpace(ipSpaceMatcher); } public static Matcher<Entry> hasLocations(Matcher<? super Set<Location>> locationsMatcher) { return new HasLocations(locationsMatcher); } public static Matcher<IpSpaceAssignment> hasEntry( Matcher<? super IpSpace> ipSpaceMatcher, Matcher<? super Set<Location>> locationsMatcher) { return hasEntry(allOf(hasIpSpace(ipSpaceMatcher), hasLocations(locationsMatcher))); } }
456
703
#pragma once #include <RendererCore/Pipeline/Renderer.h> class ezMeshRenderData; struct ezPerInstanceData; /// \brief Implements rendering of static meshes class EZ_RENDERERCORE_DLL ezMeshRenderer : public ezRenderer { EZ_ADD_DYNAMIC_REFLECTION(ezMeshRenderer, ezRenderer); EZ_DISALLOW_COPY_AND_ASSIGN(ezMeshRenderer); public: ezMeshRenderer(); ~ezMeshRenderer(); // ezRenderer implementation virtual void GetSupportedRenderDataTypes(ezHybridArray<const ezRTTI*, 8>& types) const override; virtual void GetSupportedRenderDataCategories(ezHybridArray<ezRenderData::Category, 8>& categories) const override; virtual void RenderBatch( const ezRenderViewContext& renderContext, const ezRenderPipelinePass* pPass, const ezRenderDataBatch& batch) const override; protected: virtual void SetAdditionalData(const ezRenderViewContext& renderViewContext, const ezMeshRenderData* pRenderData) const; virtual void FillPerInstanceData( ezArrayPtr<ezPerInstanceData> instanceData, const ezRenderDataBatch& batch, ezUInt32 uiStartIndex, ezUInt32& out_uiFilteredCount) const; };
372
2,151
// Copyright 2017 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "core/fxcodec/gif/cfx_gifcontext.h" #include "core/fxcrt/unowned_ptr.h" #include "testing/gtest/include/gtest/gtest.h" class CFX_GifContextForTest : public CFX_GifContext { public: CFX_GifContextForTest(CCodec_GifModule* gif_module, CCodec_GifModule::Delegate* delegate) : CFX_GifContext(gif_module, delegate) {} ~CFX_GifContextForTest() override {} using CFX_GifContext::ReadData; using CFX_GifContext::ReadGifSignature; using CFX_GifContext::ReadLogicalScreenDescriptor; CFX_MemoryStream* InputBuffer() const { return input_buffer_.Get(); } }; TEST(CFX_GifContext, SetInputBuffer) { CFX_GifContextForTest context(nullptr, nullptr); context.SetInputBuffer(nullptr, 0); EXPECT_EQ(nullptr, context.InputBuffer()->GetBuffer()); EXPECT_EQ(0, context.InputBuffer()->GetSize()); EXPECT_EQ(0, context.InputBuffer()->GetPosition()); context.SetInputBuffer(nullptr, 100); EXPECT_EQ(nullptr, context.InputBuffer()->GetBuffer()); EXPECT_EQ(100, context.InputBuffer()->GetSize()); EXPECT_EQ(0, context.InputBuffer()->GetPosition()); uint8_t buffer[] = {0x00, 0x01, 0x02}; context.SetInputBuffer(buffer, 0); EXPECT_EQ(buffer, context.InputBuffer()->GetBuffer()); EXPECT_EQ(0, context.InputBuffer()->GetSize()); EXPECT_EQ(0, context.InputBuffer()->GetPosition()); context.SetInputBuffer(buffer, 3); EXPECT_EQ(buffer, context.InputBuffer()->GetBuffer()); EXPECT_EQ(3, context.InputBuffer()->GetSize()); EXPECT_EQ(0, context.InputBuffer()->GetPosition()); context.SetInputBuffer(buffer, 100); EXPECT_EQ(buffer, context.InputBuffer()->GetBuffer()); EXPECT_EQ(100, context.InputBuffer()->GetSize()); EXPECT_EQ(0, context.InputBuffer()->GetPosition()); } TEST(CFX_GifContext, ReadData) { CFX_GifContextForTest context(nullptr, nullptr); context.SetInputBuffer(nullptr, 0); EXPECT_FALSE(context.ReadData(nullptr, 0)); EXPECT_FALSE(context.ReadData(nullptr, 10)); std::vector<uint8_t> dest_buffer; EXPECT_FALSE(context.ReadData(dest_buffer.data(), 0)); EXPECT_FALSE(context.ReadData(dest_buffer.data(), 10)); uint8_t src_buffer[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09}; context.SetInputBuffer(src_buffer, 0); dest_buffer.resize(sizeof(src_buffer)); EXPECT_FALSE(context.ReadData(dest_buffer.data(), sizeof(src_buffer))); context.SetInputBuffer(src_buffer, 1); EXPECT_FALSE(context.ReadData(dest_buffer.data(), sizeof(src_buffer))); EXPECT_EQ(0, context.InputBuffer()->GetPosition()); EXPECT_FALSE(context.ReadData(nullptr, sizeof(src_buffer))); EXPECT_FALSE(context.ReadData(nullptr, 1)); EXPECT_TRUE(context.ReadData(dest_buffer.data(), 1)); EXPECT_EQ(src_buffer[0], dest_buffer[0]); context.SetInputBuffer(src_buffer, sizeof(src_buffer)); EXPECT_FALSE(context.ReadData(nullptr, sizeof(src_buffer))); EXPECT_TRUE(context.ReadData(dest_buffer.data(), sizeof(src_buffer))); for (size_t i = 0; i < sizeof(src_buffer); i++) EXPECT_EQ(src_buffer[i], dest_buffer[i]); context.SetInputBuffer(src_buffer, sizeof(src_buffer)); for (size_t i = 0; i < sizeof(src_buffer); i++) { EXPECT_TRUE(context.ReadData(dest_buffer.data(), 1)); EXPECT_EQ(src_buffer[i], dest_buffer[0]); } } TEST(CFX_GifContext, ReadGifSignature) { CFX_GifContextForTest context(nullptr, nullptr); { uint8_t data[1]; context.SetInputBuffer(data, 0); EXPECT_EQ(CFX_GifDecodeStatus::Unfinished, context.ReadGifSignature()); EXPECT_EQ(0, context.InputBuffer()->GetPosition()); } // Make sure testing the entire signature { uint8_t data[] = {'G', 'I', 'F'}; context.SetInputBuffer(data, sizeof(data)); EXPECT_EQ(CFX_GifDecodeStatus::Unfinished, context.ReadGifSignature()); EXPECT_EQ(0, context.InputBuffer()->GetPosition()); } { uint8_t data[] = {'N', 'O', 'T', 'G', 'I', 'F'}; context.SetInputBuffer(data, sizeof(data)); EXPECT_EQ(CFX_GifDecodeStatus::Error, context.ReadGifSignature()); EXPECT_EQ(6, context.InputBuffer()->GetPosition()); } // Make sure not matching GIF8*a { uint8_t data[] = {'G', 'I', 'F', '8', '0', 'a'}; context.SetInputBuffer(data, sizeof(data)); EXPECT_EQ(CFX_GifDecodeStatus::Error, context.ReadGifSignature()); EXPECT_EQ(6, context.InputBuffer()->GetPosition()); } // Make sure not matching GIF**a { uint8_t data[] = {'G', 'I', 'F', '9', '2', 'a'}; context.SetInputBuffer(data, sizeof(data)); EXPECT_EQ(CFX_GifDecodeStatus::Error, context.ReadGifSignature()); EXPECT_EQ(6, context.InputBuffer()->GetPosition()); } // One valid signature { uint8_t data[] = {'G', 'I', 'F', '8', '7', 'a'}; context.SetInputBuffer(data, sizeof(data)); EXPECT_EQ(CFX_GifDecodeStatus::Success, context.ReadGifSignature()); EXPECT_EQ(6, context.InputBuffer()->GetPosition()); } // The other valid signature { uint8_t data[] = {'G', 'I', 'F', '8', '9', 'a'}; context.SetInputBuffer(data, sizeof(data)); EXPECT_EQ(CFX_GifDecodeStatus::Success, context.ReadGifSignature()); EXPECT_EQ(6, context.InputBuffer()->GetPosition()); } } TEST(CFX_GifContext, ReadLocalScreenDescriptor) { CFX_GifContextForTest context(nullptr, nullptr); { uint8_t data[1]; context.SetInputBuffer(data, 0); EXPECT_EQ(CFX_GifDecodeStatus::Unfinished, context.ReadLogicalScreenDescriptor()); } // LSD with all the values zero'd { uint8_t lsd[sizeof(CFX_GifLocalScreenDescriptor)]; memset(&lsd, 0, sizeof(CFX_GifLocalScreenDescriptor)); context.SetInputBuffer(lsd, sizeof(CFX_GifLocalScreenDescriptor)); EXPECT_EQ(CFX_GifDecodeStatus::Success, context.ReadLogicalScreenDescriptor()); EXPECT_EQ(sizeof(CFX_GifLocalScreenDescriptor), static_cast<size_t>(context.InputBuffer()->GetPosition())); EXPECT_EQ(0, context.width_); EXPECT_EQ(0, context.height_); EXPECT_EQ(0u, context.bc_index_); EXPECT_EQ(0u, context.pixel_aspect_); } // LSD with no global palette { uint8_t lsd[sizeof(CFX_GifLocalScreenDescriptor)] = {0x0A, 0x00, 0x00, 0x0F, 0x00, 0x01, 0x02}; context.SetInputBuffer(lsd, sizeof(CFX_GifLocalScreenDescriptor)); EXPECT_EQ(CFX_GifDecodeStatus::Success, context.ReadLogicalScreenDescriptor()); EXPECT_EQ(sizeof(CFX_GifLocalScreenDescriptor), static_cast<size_t>(context.InputBuffer()->GetPosition())); EXPECT_EQ(0x000A, context.width_); EXPECT_EQ(0x0F00, context.height_); EXPECT_EQ(0u, context.bc_index_); // bc_index_ is 0 if no global palette EXPECT_EQ(2u, context.pixel_aspect_); } // LSD with global palette bit set, but no global palette { uint8_t lsd[sizeof(CFX_GifLocalScreenDescriptor)] = {0x0A, 0x00, 0x00, 0x0F, 0x80, 0x01, 0x02}; context.SetInputBuffer(lsd, sizeof(CFX_GifLocalScreenDescriptor)); EXPECT_EQ(CFX_GifDecodeStatus::Unfinished, context.ReadLogicalScreenDescriptor()); EXPECT_EQ(0, context.InputBuffer()->GetPosition()); } // LSD with global palette { struct { uint8_t lsd[sizeof(CFX_GifLocalScreenDescriptor)]; uint8_t palette[4 * sizeof(CFX_GifPalette)]; } data = {{0x0A, 0x00, 0x00, 0x0F, 0xA9, 0x01, 0x02}, {0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1}}; context.SetInputBuffer(reinterpret_cast<uint8_t*>(&data), sizeof(data)); EXPECT_EQ(CFX_GifDecodeStatus::Success, context.ReadLogicalScreenDescriptor()); EXPECT_EQ(sizeof(data), static_cast<size_t>(context.InputBuffer()->GetPosition())); EXPECT_EQ(0x000A, context.width_); EXPECT_EQ(0x0F00, context.height_); EXPECT_EQ(1u, context.bc_index_); EXPECT_EQ(2u, context.pixel_aspect_); EXPECT_EQ(1u, context.global_pal_exp_); EXPECT_EQ(1, context.global_sort_flag_); EXPECT_EQ(2, context.global_color_resolution_); EXPECT_TRUE(0 == memcmp(data.palette, context.global_palette_.data(), sizeof(data.palette))); } } TEST(CFX_GifContext, ReadHeader) { CFX_GifContextForTest context(nullptr, nullptr); // Bad signature { struct { uint8_t signature[6]; uint8_t lsd[sizeof(CFX_GifLocalScreenDescriptor)]; } data = {{'N', 'O', 'T', 'G', 'I', 'F'}, {0x0A, 0x00, 0x00, 0x0F, 0x00, 0x01, 0x02}}; context.SetInputBuffer(reinterpret_cast<uint8_t*>(&data), sizeof(data)); EXPECT_EQ(CFX_GifDecodeStatus::Error, context.ReadHeader()); EXPECT_EQ(sizeof(data.signature), static_cast<size_t>(context.InputBuffer()->GetPosition())); } // Short after signature { uint8_t signature[] = {'G', 'I', 'F', '8', '7', 'a'}; context.SetInputBuffer(reinterpret_cast<uint8_t*>(&signature), sizeof(signature)); EXPECT_EQ(CFX_GifDecodeStatus::Unfinished, context.ReadHeader()); EXPECT_EQ(sizeof(signature), static_cast<size_t>(context.InputBuffer()->GetPosition())); } // Success without global palette { struct { uint8_t signature[6]; uint8_t lsd[sizeof(CFX_GifLocalScreenDescriptor)]; } data = {{'G', 'I', 'F', '8', '7', 'a'}, {0x0A, 0x00, 0x00, 0x0F, 0x00, 0x01, 0x02}}; context.SetInputBuffer(reinterpret_cast<uint8_t*>(&data), sizeof(data)); EXPECT_EQ(CFX_GifDecodeStatus::Success, context.ReadHeader()); EXPECT_EQ(sizeof(data), static_cast<size_t>(context.InputBuffer()->GetPosition())); EXPECT_EQ(0x000A, context.width_); EXPECT_EQ(0x0F00, context.height_); EXPECT_EQ(0u, context.bc_index_); // bc_index_ is 0 if no global palette EXPECT_EQ(2u, context.pixel_aspect_); } // Missing Global Palette { struct { uint8_t signature[6]; uint8_t lsd[sizeof(CFX_GifLocalScreenDescriptor)]; } data = {{'G', 'I', 'F', '8', '7', 'a'}, {0x0A, 0x00, 0x00, 0x0F, 0x80, 0x01, 0x02}}; context.SetInputBuffer(reinterpret_cast<uint8_t*>(&data), sizeof(data)); EXPECT_EQ(CFX_GifDecodeStatus::Unfinished, context.ReadHeader()); EXPECT_EQ(sizeof(data.signature), static_cast<size_t>(context.InputBuffer()->GetPosition())); } // Success with global palette { struct { uint8_t signature[6]; uint8_t lsd[sizeof(CFX_GifLocalScreenDescriptor)]; uint8_t palette[4 * sizeof(CFX_GifPalette)]; } data = {{'G', 'I', 'F', '8', '7', 'a'}, {0x0A, 0x00, 0x00, 0x0F, 0xA9, 0x01, 0x02}, {0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1}}; context.SetInputBuffer(reinterpret_cast<uint8_t*>(&data), sizeof(data)); EXPECT_EQ(CFX_GifDecodeStatus::Success, context.ReadHeader()); EXPECT_EQ(sizeof(data), static_cast<size_t>(context.InputBuffer()->GetPosition())); EXPECT_EQ(0x000A, context.width_); EXPECT_EQ(0x0F00, context.height_); EXPECT_EQ(1u, context.bc_index_); EXPECT_EQ(2u, context.pixel_aspect_); EXPECT_EQ(1u, context.global_pal_exp_); EXPECT_EQ(1, context.global_sort_flag_); EXPECT_EQ(2, context.global_color_resolution_); EXPECT_TRUE(0 == memcmp(data.palette, context.global_palette_.data(), sizeof(data.palette))); } }
5,055
354
#ifndef _GLSLONGSTRESSTESTUTIL_HPP #define _GLSLONGSTRESSTESTUTIL_HPP /*------------------------------------------------------------------------- * drawElements Quality Program OpenGL (ES) Module * ----------------------------------------------- * * Copyright 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *//*! * \file * \brief Utilities for tests with gls::LongStressCase. *//*--------------------------------------------------------------------*/ #include "glsLongStressCase.hpp" #include "gluShaderUtil.hpp" #include <map> #include <string> namespace deqp { namespace gls { namespace LongStressTestUtil { class ProgramLibrary { public: ProgramLibrary (glu::GLSLVersion glslVersion); gls::ProgramContext generateBufferContext (int numDummyAttributes) const; gls::ProgramContext generateTextureContext (int numTextureObjects, int texWid, int texHei, float positionFactor) const; gls::ProgramContext generateBufferAndTextureContext (int numTextures, int texWid, int texHei) const; gls::ProgramContext generateFragmentPointLightContext (int texWid, int texHei) const; gls::ProgramContext generateVertexUniformLoopLightContext (int texWid, int texHei) const; private: std::string substitute (const std::string&) const; std::string substitute (const std::string&, const std::map<std::string, std::string>&) const; glu::GLSLVersion m_glslVersion; }; } // StressTestUtil } // gls } // deqp #endif // _GLSLONGSTRESSTESTUTIL_HPP
671
2,757
/** @file Provides services for SMM Memory Operation. The SMM Mem Library provides function for checking if buffer is outside SMRAM and valid. It also provides functions for copy data from SMRAM to non-SMRAM, from non-SMRAM to SMRAM, from non-SMRAM to non-SMRAM, or set data in non-SMRAM. Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef _SMM_MEM_LIB_H_ #define _SMM_MEM_LIB_H_ /** This function check if the buffer is valid per processor architecture and not overlap with SMRAM. @param Buffer The buffer start address to be checked. @param Length The buffer length to be checked. @retval TRUE This buffer is valid per processor architecture and not overlap with SMRAM. @retval FALSE This buffer is not valid per processor architecture or overlap with SMRAM. **/ BOOLEAN EFIAPI SmmIsBufferOutsideSmmValid ( IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length ); /** Copies a source buffer (non-SMRAM) to a destination buffer (SMRAM). This function copies a source buffer (non-SMRAM) to a destination buffer (SMRAM). It checks if source buffer is valid per processor architecture and not overlap with SMRAM. If the check passes, it copies memory and returns EFI_SUCCESS. If the check fails, it return EFI_SECURITY_VIOLATION. The implementation must be reentrant. @param DestinationBuffer The pointer to the destination buffer of the memory copy. @param SourceBuffer The pointer to the source buffer of the memory copy. @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. @retval EFI_SECURITY_VIOLATION The SourceBuffer is invalid per processor architecture or overlap with SMRAM. @retval EFI_SUCCESS Memory is copied. **/ EFI_STATUS EFIAPI SmmCopyMemToSmram ( OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length ); /** Copies a source buffer (SMRAM) to a destination buffer (NON-SMRAM). This function copies a source buffer (non-SMRAM) to a destination buffer (SMRAM). It checks if destination buffer is valid per processor architecture and not overlap with SMRAM. If the check passes, it copies memory and returns EFI_SUCCESS. If the check fails, it returns EFI_SECURITY_VIOLATION. The implementation must be reentrant. @param DestinationBuffer The pointer to the destination buffer of the memory copy. @param SourceBuffer The pointer to the source buffer of the memory copy. @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. @retval EFI_SECURITY_VIOLATION The DesinationBuffer is invalid per processor architecture or overlap with SMRAM. @retval EFI_SUCCESS Memory is copied. **/ EFI_STATUS EFIAPI SmmCopyMemFromSmram ( OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length ); /** Copies a source buffer (NON-SMRAM) to a destination buffer (NON-SMRAM). This function copies a source buffer (non-SMRAM) to a destination buffer (SMRAM). It checks if source buffer and destination buffer are valid per processor architecture and not overlap with SMRAM. If the check passes, it copies memory and returns EFI_SUCCESS. If the check fails, it returns EFI_SECURITY_VIOLATION. The implementation must be reentrant, and it must handle the case where source buffer overlaps destination buffer. @param DestinationBuffer The pointer to the destination buffer of the memory copy. @param SourceBuffer The pointer to the source buffer of the memory copy. @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. @retval EFI_SECURITY_VIOLATION The DesinationBuffer is invalid per processor architecture or overlap with SMRAM. @retval EFI_SECURITY_VIOLATION The SourceBuffer is invalid per processor architecture or overlap with SMRAM. @retval EFI_SUCCESS Memory is copied. **/ EFI_STATUS EFIAPI SmmCopyMem ( OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length ); /** Fills a target buffer (NON-SMRAM) with a byte value. This function fills a target buffer (non-SMRAM) with a byte value. It checks if target buffer is valid per processor architecture and not overlap with SMRAM. If the check passes, it fills memory and returns EFI_SUCCESS. If the check fails, it returns EFI_SECURITY_VIOLATION. @param Buffer The memory to set. @param Length The number of bytes to set. @param Value The value with which to fill Length bytes of Buffer. @retval EFI_SECURITY_VIOLATION The Buffer is invalid per processor architecture or overlap with SMRAM. @retval EFI_SUCCESS Memory is set. **/ EFI_STATUS EFIAPI SmmSetMem ( OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value ); #endif
1,801
322
<reponame>Fostereee/Transformer-MM-Explainability #!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. import argparse import logging import random import typing import torch from VisualBERT.mmf.common.registry import registry from VisualBERT.mmf.utils.build import build_config, build_trainer from VisualBERT.mmf.utils.configuration import Configuration from VisualBERT.mmf.utils.distributed import distributed_init, get_rank, infer_init_method from VisualBERT.mmf.utils.env import set_seed, setup_imports from VisualBERT.mmf.utils.flags import flags from VisualBERT.mmf.utils.general import log_device_names from VisualBERT.mmf.utils.logger import setup_logger, setup_very_basic_config setup_very_basic_config() def main(configuration, init_distributed=False, predict=False): # A reload might be needed for imports setup_imports() configuration.import_user_dir() config = configuration.get_config() if torch.cuda.is_available(): torch.cuda.set_device(config.device_id) torch.cuda.init() if init_distributed: distributed_init(config) seed = config.training.seed config.training.seed = set_seed(seed if seed == -1 else seed + get_rank()) registry.register("seed", config.training.seed) config = build_config(configuration) setup_logger( color=config.training.colored_logs, disable=config.training.should_not_log ) logger = logging.getLogger("mmf_cli.run") # Log args for debugging purposes logger.info(configuration.args) logger.info(f"Torch version: {torch.__version__}") log_device_names() logger.info(f"Using seed {config.training.seed}") trainer = build_trainer(config) trainer.load() if predict: trainer.inference() else: trainer.train() def distributed_main(device_id, configuration, predict=False): config = configuration.get_config() config.device_id = device_id if config.distributed.rank is None: config.distributed.rank = config.start_rank + device_id main(configuration, init_distributed=True, predict=predict) def run(opts: typing.Optional[typing.List[str]] = None, predict: bool = False): """Run starts a job based on the command passed from the command line. You can optionally run the mmf job programmatically by passing an optlist as opts. Args: opts (typing.Optional[typing.List[str]], optional): Optlist which can be used. to override opts programmatically. For e.g. if you pass opts = ["training.batch_size=64", "checkpoint.resume=True"], this will set the batch size to 64 and resume from the checkpoint if present. Defaults to None. predict (bool, optional): If predict is passed True, then the program runs in prediction mode. Defaults to False. """ setup_imports() if opts is None: parser = flags.get_parser() args = parser.parse_args() else: args = argparse.Namespace(config_override=None) args.opts = opts configuration = Configuration(args) # Do set runtime args which can be changed by MMF configuration.args = args config = configuration.get_config() config.start_rank = 0 if config.distributed.init_method is None: infer_init_method(config) if config.distributed.init_method is not None: if torch.cuda.device_count() > 1 and not config.distributed.no_spawn: config.start_rank = config.distributed.rank config.distributed.rank = None torch.multiprocessing.spawn( fn=distributed_main, args=(configuration, predict), nprocs=torch.cuda.device_count(), ) else: distributed_main(0, configuration, predict) elif config.distributed.world_size > 1: assert config.distributed.world_size <= torch.cuda.device_count() port = random.randint(10000, 20000) config.distributed.init_method = f"tcp://localhost:{port}" config.distributed.rank = None torch.multiprocessing.spawn( fn=distributed_main, args=(configuration, predict), nprocs=config.distributed.world_size, ) else: config.device_id = 0 main(configuration, predict=predict) if __name__ == "__main__": run()
1,673
1,444
package org.mage.test.multiplayer; import mage.constants.PhaseStep; import mage.constants.Zone; import org.junit.Test; import org.mage.test.serverside.base.CardTestMultiPlayerBase; /** * * @author LevelX2 */ public class PrimordialTest extends CardTestMultiPlayerBase { /** * Tests Primordial cards with multiplayer effects * */ @Test public void SepulchralPrimordialTest() { // When Sepulchral Primordial enters the battlefield, for each opponent, you may put up to one // target creature card from that player's graveyard onto the battlefield under your control. addCard(Zone.HAND, playerA, "Sepulchral Primordial"); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 7); // Player order: A -> D -> C -> B addCard(Zone.GRAVEYARD, playerB, "Silvercoat Lion"); addCard(Zone.GRAVEYARD, playerC, "Walking Corpse"); addCard(Zone.GRAVEYARD, playerD, "Pillarfield Ox"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sepulchral Primordial"); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); assertPermanentCount(playerA, "Sepulchral Primordial", 1); assertPermanentCount(playerA, "Silvercoat Lion", 1); assertPermanentCount(playerA, "Walking Corpse", 0); assertPermanentCount(playerA, "Pillarfield Ox", 1); assertGraveyardCount(playerC, "Walking Corpse", 1); assertGraveyardCount(playerD, "Pillarfield Ox", 0); } /** * Sepulchral Primordial's "enter the battlefield" effect works correctly on * cast, but does not trigger if he is returned to the battlefield by other * means (e.g. summoned from the graveyard). I've encountered this in * 4-player commander games with other humans. */ @Test public void SepulchralPrimordialFromGraveyardTest() { // Return target creature card from your graveyard to the battlefield. Put a +1/+1 counter on it. addCard(Zone.HAND, playerA, "Miraculous Recovery", 1); // Instant {4}{W} // When Sepulchral Primordial enters the battlefield, for each opponent, you may put up to one // target creature card from that player's graveyard onto the battlefield under your control. addCard(Zone.GRAVEYARD, playerA, "Sepulchral Primordial"); addCard(Zone.BATTLEFIELD, playerA, "Plains", 5); // Player order: A -> D -> C -> B addCard(Zone.GRAVEYARD, playerB, "Silvercoat Lion"); addCard(Zone.GRAVEYARD, playerC, "Walking Corpse"); addCard(Zone.GRAVEYARD, playerD, "Pillarfield Ox"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Miraculous Recovery", "Sepulchral Primordial"); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); assertPermanentCount(playerA, "Sepulchral Primordial", 1); assertPermanentCount(playerA, "Silvercoat Lion", 1); assertPermanentCount(playerA, "Walking Corpse", 0); assertPermanentCount(playerA, "Pillarfield Ox", 1); assertGraveyardCount(playerC, "Walking Corpse", 1); assertGraveyardCount(playerD, "Pillarfield Ox", 0); } /** * I'm almost certain now about how this happens: when Sepulchral Primordial * enters the battlefield, and there's at least one opponent without a * creature in the graveyard, the ability doesn't trigger at all. It should * trigger at least for the players with creatures in the yard. */ @Test public void SepulchralPrimordialFromGraveyardEmptyGraveTest() { // When Sepulchral Primordial enters the battlefield, for each opponent, you may put up to one // target creature card from that player's graveyard onto the battlefield under your control. addCard(Zone.HAND, playerA, "Sepulchral Primordial"); // {5}{B}{B} addCard(Zone.BATTLEFIELD, playerA, "Swamp", 7); // Player order: A -> D -> C -> B addCard(Zone.GRAVEYARD, playerC, "Walking Corpse"); // Not in Range addCard(Zone.GRAVEYARD, playerD, "Pillarfield Ox"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sepulchral Primordial"); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); assertPermanentCount(playerA, "Sepulchral Primordial", 1); assertPermanentCount(playerA, "Walking Corpse", 0); assertPermanentCount(playerA, "Pillarfield Ox", 1); assertGraveyardCount(playerC, "Walking Corpse", 1); } /** * Diluvian Primordial ETB trigger never happened in a 3 player FFA * commander game. He just resolved, no ETB trigger occurred. */ @Test public void DiluvianPrimordialTest() { // Flying // When Diluvian Primordial enters the battlefield, for each opponent, you may cast up to one target instant or sorcery card from that player's graveyard without paying its mana cost. If a card cast this way would be put into a graveyard this turn, exile it instead. addCard(Zone.HAND, playerA, "Diluvian Primordial"); // {5}{U}{U} addCard(Zone.BATTLEFIELD, playerA, "Island", 7); addCard(Zone.GRAVEYARD, playerB, "Lightning Bolt"); addCard(Zone.GRAVEYARD, playerC, "Lightning Bolt"); addCard(Zone.GRAVEYARD, playerD, "Lightning Bolt"); // Player order: A -> D -> C -> B castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Diluvian Primordial"); addTarget(playerA, "Lightning Bolt"); addTarget(playerA, "Lightning Bolt"); addTarget(playerA, playerB); addTarget(playerA, playerD); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); assertPermanentCount(playerA, "Diluvian Primordial", 1); assertGraveyardCount(playerC, "Lightning Bolt", 1); assertExileCount("Lightning Bolt", 2); assertLife(playerA, 20); assertLife(playerB, 17); assertLife(playerC, 20); assertLife(playerD, 17); } }
2,220
348
<gh_stars>100-1000 {"nom":"Saint-Julien-de-Toursac","dpt":"Cantal","inscrits":120,"abs":18,"votants":102,"blancs":11,"nuls":5,"exp":86,"res":[{"panneau":"1","voix":73},{"panneau":"2","voix":13}]}
84
849
#!/usr/bin/env python3 """ Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ import argparse import re from collections import defaultdict from pathlib import Path class UserTrace(object): """Class for user_trace cli""" SESSIOND_ERRORS_LIST = [ { "log": "cause=99", "error": "IE is not implemented in Magma", "suggestion": "Identify the parameter not supported by Magma, verify with the UE/CPE vendor if you can disable it. If you can't disable, file a feature request", }, { "log": "No suitable APN found", "error": "Wrong APN configuration", "suggestion": "Verify the APN has been provisioned correctly in the phone/CPE and/or Orc8r/HSS", }, ] def __init__(self) -> None: """Initialize common parameters for user tracing""" # Parse the args parser = self.create_parser() self.args = parser.parse_args() with open(self.args.path, "r") as f: self.lines = f.readlines() self.pattern_time = r"(\d{1,}) \w* (\w* \w* \d{2}:\d{2}:\d{2} \d{4}) " def create_parser(self): """ Create the argparse parser with all the arguments. """ parser = argparse.ArgumentParser( description="CLI outputs user control signaling. for a \n" "supplied IMSI and mme user id", formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) parser.add_argument( "-p", "--path", type=Path, default=Path(__file__).absolute().parent / "/var/log/mme.log", help="Path to the data directory", ) subparsers = parser.add_subparsers(dest="subcmd") # list imsi and number of ocurrences in logs list_imsi = subparsers.add_parser( 'list_imsi', help="List imsi and number of ocurrences in logs", ) list_imsi.set_defaults(func=self.get_list_imsi) # list mme and enb user id pairs list_ue_id = subparsers.add_parser( 'list_ue_id', help="List mme and enb ue id pairs for a given imsi", ) list_ue_id.add_argument( "-i", "--imsi", required=True, help="IMSI of the subscriber", ) list_ue_id.set_defaults(func=self.get_list_ue_id) # output session trace based on imsi, mme id session_trace = subparsers.add_parser( 'session_trace', help="Dump session trace for given imsi and user id", ) session_trace.add_argument( "-m", "--mme_id", required=True, help="mme id of the user", type=int, ) session_trace.add_argument( "-i", "--imsi", required=True, help="IMSI of the subscriber", ) session_trace.set_defaults(func=self.get_session_trace) return parser def get_list_imsi(self, args): """List imsi and number of ocurrences in logs""" imsi_pattern = r"\b\d{15}\b" imsi_list = defaultdict(int) lines = self.lines for line in lines: match = re.findall(imsi_pattern, line) if not match: continue imsi = match[0] imsi_list[imsi] += 1 sorted_imsi_list = sorted(imsi_list.items(), key=lambda x: x[1], reverse=True) print("\n{0:<15} {1:<15} ".format('IMSI', 'Occurrences')) print('-' * 30) for v in sorted_imsi_list: imsi, number = v print("{0:<15} {1:<15}".format(imsi, number)) print("\nNumber of unique IMSI found in logs: " + str(len(imsi_list))) def get_list_ue_id(self, args): """ Provide list of mme id and enodeb id pairs from given an IMSI. Some sessions may not have the pair(missing enodeb id). Getting mme_id from Attach Req Args: args: Filtered logs for a given imsi and mme id Returns: ue_id_list: list of mme id and enodeb id pairs from given an IMSI """ hex_pattern = "0X.*" pattern_mme_enb_ue_id = r".*MME_UE_S1AP_ID = (\w+)\b eNB_UE_S1AP_ID = (\w+)\b" ue_id_list = [] mme_id_list = [] lines = self.lines imsi = self.args.imsi for line in lines: ue_id_dict = {} match = re.findall(imsi + pattern_mme_enb_ue_id, line, re.IGNORECASE) if not match: continue ue_id_dict["mme_ue_id"] = match[0][0] ue_id_dict["enb_ue_id"] = match[0][1] if re.search(hex_pattern, match[0][0], re.IGNORECASE) and re.search(hex_pattern, match[0][1], re.IGNORECASE): ue_id_dict["mme_ue_id"] = int(ue_id_dict["mme_ue_id"], 16) ue_id_dict["enb_ue_id"] = int(ue_id_dict["enb_ue_id"], 16) if ue_id_dict and ue_id_dict not in ue_id_list: ue_id_list.append(ue_id_dict) mme_id_list.append(ue_id_dict["mme_ue_id"]) # Some sessions may not have enodeb id, getting the mme_id from Attach request attach_pattern = r"ATTACH REQ \(ue_id = (\w+)\) \(IMSI = " + imsi + r"\)" for line in lines: match = re.findall(attach_pattern, line) if not match: continue mme_id = int(match[0], 16) if mme_id not in mme_id_list: mme_id_list.append(mme_id) ue_id_list.append({"mme_ue_id": mme_id}) print("\nIMSI: " + imsi + "\n") print("{0:<15} {1:<15} ".format('mme_id', 'enodeb_id')) print('-' * 25) for v in ue_id_list: mme_ue_id = v.get('mme_ue_id') enodeb_ue_id = v.get('enb_ue_id') if enodeb_ue_id: print("{0} 0x{1:<10} {2} 0x{3:<15}".format(mme_ue_id, format(int(mme_ue_id), 'x'), enodeb_ue_id, format(int(enodeb_ue_id), 'x'))) else: print("{0} 0x{1:<10} {2}".format(mme_ue_id, format(int(mme_ue_id), 'x'), enodeb_ue_id)) return ue_id_list def get_session_trace(self, args): """Provide a session trace given and IMSI and mme id(ue_id). 1. Get timestamps for ocurrences where the mme id (ue_id) was found. This will be "session_timestamps" 2. Filter out logs where the timestamp doesn't match the session_timestamps. This will be "time_filtered_logs" 3. Filter out logs where line doesn't match imsi or ue_id 4. From filtered logs, find and show if there are any known session errors. Args: args: args obtained from cli Returns: sorted_log: returned session trace sorted on timestamp """ imsi = self.args.imsi log_filter = {} session_timestamps = self.get_session_timestamp(args) time_filtered_logs = self.get_log_time_filtered(session_timestamps) self.set_ue_id_pattern(args) for line in time_filtered_logs: match = re.findall(self.pattern_str, line, re.IGNORECASE) match_imsi = re.findall(imsi, line) if match or match_imsi: match_time = re.findall(self.pattern_time, line) log_filter[match_time[0][0]] = line sorted_log = sorted(log_filter.items(), key=lambda kv: kv[1]) [print(value) for key, value in sorted_log] self.get_session_error(sorted_log) return sorted_log def get_session_error(self, session_trace): """ From the session trace, find if any of the logs match any know errors. Provide the error found and suggestion to fix it. Args: session_trace: Filtered logs for a given imsi and mme id """ for _key, value in session_trace: for error in self.SESSIOND_ERRORS_LIST: if re.search(error["log"], value, re.IGNORECASE): print('*' * 100) print("\nError: " + error["error"]) print("\nSuggestion: " + error["suggestion"]) print("\nLog: " + value) print('*' * 100) break def set_ue_id_pattern(self, args): """Generate regex pattern using provided user_id""" ue_id = args.mme_id pattern_list = [ r"\bUE id " + str(ue_id) + r"\b", r"\bue 0x0*" + format(ue_id, 'x') + r"\b", r"\b\(?ue(_|-)id ?(=|:) ? ?\(?(0x0*" + format(ue_id, 'x') + "|" + str(ue_id) + r")\b\)?", "MME_UE_S1AP_ID ?=? 0x0*" + format(ue_id, 'x') + r"\b", r"mme_ue_s1ap_id = \(" + str(ue_id) + r"\)", ] self.pattern_str = "|".join(pattern_list) def get_session_timestamp(self, args): """Get timestamps for ocurrences where the mme id (ue_id) was found. Args: args: args obtained from cli Returns: session_timestamps: List timestamps for ocurrences where the mme id (ue_id) was found. """ session_timestamps = [] lines = self.lines self.set_ue_id_pattern(args) for line in lines: match = re.findall(self.pattern_str, line, re.IGNORECASE) if match: match_time = re.findall(self.pattern_time, line) if match_time: session_timestamps.append(match_time[0][1]) return session_timestamps def get_log_time_filtered(self, timestamps): """Filter out logs where the timestamp doesn't match the session_timestamps Args: timestamps: session timestamps Returns: filtered_lines: List of logs where timestamp match session_timestamps. """ lines = self.lines pattern_timestamps = "|".join(timestamps) filtered_lines = [] for line in lines: if re.search(pattern_timestamps, line): filtered_lines.append(line) return filtered_lines def main(): """ Initialize user trace class and run subparses functions""" user_trace = UserTrace() if user_trace.args.subcmd: user_trace.args.func(user_trace.args) exit(1) if __name__ == "__main__": main()
5,182
6,931
#!/usr/bin/env python # coding: utf-8 # DO NOT EDIT # Autogenerated from the notebook stl_decomposition.ipynb. # Edit the notebook and then sync the output with this file. # # flake8: noqa # DO NOT EDIT # # Seasonal-Trend decomposition using LOESS (STL) # # This note book illustrates the use of `STL` to decompose a time series # into three components: trend, season(al) and residual. STL uses LOESS # (locally estimated scatterplot smoothing) to extract smooths estimates of # the three components. The key inputs into `STL` are: # # * `season` - The length of the seasonal smoother. Must be odd. # * `trend` - The length of the trend smoother, usually around 150% of # `season`. Must be odd and larger than `season`. # * `low_pass` - The length of the low-pass estimation window, usually the # smallest odd number larger than the periodicity of the data. # # First we import the required packages, prepare the graphics environment, # and prepare the data. import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() sns.set_style("darkgrid") plt.rc("figure", figsize=(16, 12)) plt.rc("font", size=13) # ## Atmospheric CO2 # # The example in Cleveland, Cleveland, McRae, and Terpenning (1990) uses # CO2 data, which is in the list below. This monthly data (January 1959 to # December 1987) has a clear trend and seasonality across the sample. co2 = [ 315.58, 316.39, 316.79, 317.82, 318.39, 318.22, 316.68, 315.01, 314.02, 313.55, 315.02, 315.75, 316.52, 317.10, 317.79, 319.22, 320.08, 319.70, 318.27, 315.99, 314.24, 314.05, 315.05, 316.23, 316.92, 317.76, 318.54, 319.49, 320.64, 319.85, 318.70, 316.96, 315.17, 315.47, 316.19, 317.17, 318.12, 318.72, 319.79, 320.68, 321.28, 320.89, 319.79, 317.56, 316.46, 315.59, 316.85, 317.87, 318.87, 319.25, 320.13, 321.49, 322.34, 321.62, 319.85, 317.87, 316.36, 316.24, 317.13, 318.46, 319.57, 320.23, 320.89, 321.54, 322.20, 321.90, 320.42, 318.60, 316.73, 317.15, 317.94, 318.91, 319.73, 320.78, 321.23, 322.49, 322.59, 322.35, 321.61, 319.24, 318.23, 317.76, 319.36, 319.50, 320.35, 321.40, 322.22, 323.45, 323.80, 323.50, 322.16, 320.09, 318.26, 317.66, 319.47, 320.70, 322.06, 322.23, 322.78, 324.10, 324.63, 323.79, 322.34, 320.73, 319.00, 318.99, 320.41, 321.68, 322.30, 322.89, 323.59, 324.65, 325.30, 325.15, 323.88, 321.80, 319.99, 319.86, 320.88, 322.36, 323.59, 324.23, 325.34, 326.33, 327.03, 326.24, 325.39, 323.16, 321.87, 321.31, 322.34, 323.74, 324.61, 325.58, 326.55, 327.81, 327.82, 327.53, 326.29, 324.66, 323.12, 323.09, 324.01, 325.10, 326.12, 326.62, 327.16, 327.94, 329.15, 328.79, 327.53, 325.65, 323.60, 323.78, 325.13, 326.26, 326.93, 327.84, 327.96, 329.93, 330.25, 329.24, 328.13, 326.42, 324.97, 325.29, 326.56, 327.73, 328.73, 329.70, 330.46, 331.70, 332.66, 332.22, 331.02, 329.39, 327.58, 327.27, 328.30, 328.81, 329.44, 330.89, 331.62, 332.85, 333.29, 332.44, 331.35, 329.58, 327.58, 327.55, 328.56, 329.73, 330.45, 330.98, 331.63, 332.88, 333.63, 333.53, 331.90, 330.08, 328.59, 328.31, 329.44, 330.64, 331.62, 332.45, 333.36, 334.46, 334.84, 334.29, 333.04, 330.88, 329.23, 328.83, 330.18, 331.50, 332.80, 333.22, 334.54, 335.82, 336.45, 335.97, 334.65, 332.40, 331.28, 330.73, 332.05, 333.54, 334.65, 335.06, 336.32, 337.39, 337.66, 337.56, 336.24, 334.39, 332.43, 332.22, 333.61, 334.78, 335.88, 336.43, 337.61, 338.53, 339.06, 338.92, 337.39, 335.72, 333.64, 333.65, 335.07, 336.53, 337.82, 338.19, 339.89, 340.56, 341.22, 340.92, 339.26, 337.27, 335.66, 335.54, 336.71, 337.79, 338.79, 340.06, 340.93, 342.02, 342.65, 341.80, 340.01, 337.94, 336.17, 336.28, 337.76, 339.05, 340.18, 341.04, 342.16, 343.01, 343.64, 342.91, 341.72, 339.52, 337.75, 337.68, 339.14, 340.37, 341.32, 342.45, 343.05, 344.91, 345.77, 345.30, 343.98, 342.41, 339.89, 340.03, 341.19, 342.87, 343.74, 344.55, 345.28, 347.00, 347.37, 346.74, 345.36, 343.19, 340.97, 341.20, 342.76, 343.96, 344.82, 345.82, 347.24, 348.09, 348.66, 347.90, 346.27, 344.21, 342.88, 342.58, 343.99, 345.31, 345.98, 346.72, 347.63, 349.24, 349.83, 349.10, 347.52, 345.43, 344.48, 343.89, 345.29, 346.54, 347.66, 348.07, 349.12, 350.55, 351.34, 350.80, 349.10, 347.54, 346.20, 346.20, 347.44, 348.67, ] co2 = pd.Series(co2, index=pd.date_range("1-1-1959", periods=len(co2), freq="M"), name="CO2") co2.describe() # The decomposition requires 1 input, the data series. If the data series # does not have a frequency, then you must also specify `period`. The # default value for `seasonal` is 7, and so should also be changed in most # applications. from statsmodels.tsa.seasonal import STL stl = STL(co2, seasonal=13) res = stl.fit() fig = res.plot() # ## Robust Fitting # Setting `robust` uses a data-dependent weighting function that re- # weights data when estimating the LOESS (and so is using LOWESS). Using # robust estimation allows the model to tolerate larger errors that are # visible on the bottom plot. # # Here we use a series the measures the production of electrical equipment # in the EU. from statsmodels.datasets import elec_equip as ds elec_equip = ds.load().data # Next, we estimate the model with and without robust weighting. The # difference is minor and is most pronounced during the financial crisis of # 2008. The non-robust estimate places equal weights on all observations and # so produces smaller errors, on average. The weights vary between 0 and 1. def add_stl_plot(fig, res, legend): """Add 3 plots from a second STL fit""" axs = fig.get_axes() comps = ["trend", "seasonal", "resid"] for ax, comp in zip(axs[1:], comps): series = getattr(res, comp) if comp == "resid": ax.plot(series, marker="o", linestyle="none") else: ax.plot(series) if comp == "trend": ax.legend(legend, frameon=False) stl = STL(elec_equip, period=12, robust=True) res_robust = stl.fit() fig = res_robust.plot() res_non_robust = STL(elec_equip, period=12, robust=False).fit() add_stl_plot(fig, res_non_robust, ["Robust", "Non-robust"]) fig = plt.figure(figsize=(16, 5)) lines = plt.plot(res_robust.weights, marker="o", linestyle="none") ax = plt.gca() xlim = ax.set_xlim(elec_equip.index[0], elec_equip.index[-1]) # ## LOESS degree # The default configuration estimates the LOESS model with both a constant # and a trend. This can be changed to only include a constant by setting # `COMPONENT_deg` to 0. Here the degree makes little difference except in # the trend around the financial crisis of 2008. stl = STL(elec_equip, period=12, seasonal_deg=0, trend_deg=0, low_pass_deg=0, robust=True) res_deg_0 = stl.fit() fig = res_robust.plot() add_stl_plot(fig, res_deg_0, ["Degree 1", "Degree 0"]) # ## Performance # Three options can be used to reduce the computational cost of the STL # decomposition: # # * `seasonal_jump` # * `trend_jump` # * `low_pass_jump` # # When these are non-zero, the LOESS for component `COMPONENT` is only # estimated ever `COMPONENT_jump` observations, and linear interpolation is # used between points. These values should not normally be more than 10-20% # of the size of `seasonal`, `trend` or `low_pass`, respectively. # # The example below shows how these can reduce the computational cost by a # factor of 15 using simulated data with both a low-frequency cosinusoidal # trend and a sinusoidal seasonal pattern. import numpy as np rs = np.random.RandomState(0xA4FD94BC) tau = 2000 t = np.arange(tau) period = int(0.05 * tau) seasonal = period + ((period % 2) == 0) # Ensure odd e = 0.25 * rs.standard_normal(tau) y = np.cos(t / tau * 2 * np.pi) + 0.25 * np.sin(t / period * 2 * np.pi) + e plt.plot(y) plt.title("Simulated Data") xlim = plt.gca().set_xlim(0, tau) # First, the base line model is estimated with all jumps equal to 1. mod = STL(y, period=period, seasonal=seasonal) res = mod.fit() fig = res.plot(observed=False, resid=False) # The jumps are all set to 15% of their window length. Limited linear # interpolation makes little difference to the fit of the model. low_pass_jump = seasonal_jump = int(0.15 * (period + 1)) trend_jump = int(0.15 * 1.5 * (period + 1)) mod = STL( y, period=period, seasonal=seasonal, seasonal_jump=seasonal_jump, trend_jump=trend_jump, low_pass_jump=low_pass_jump, ) res = mod.fit() fig = res.plot(observed=False, resid=False) # ## Forecasting with STL # # ``STLForecast`` simplifies the process of using STL to remove # seasonalities and then using a standard time-series model to forecast the # trend and cyclical components. # # Here we use STL to handle the seasonality and then an ARIMA(1,1,0) to # model the deseasonalized data. The seasonal component is forecast from the # find full cycle where # # $$E[S_{T+h}|\mathcal{F}_T]=\hat{S}_{T-k}$$ # # where $k= m - h + m \lfloor \frac{h-1}{m} \rfloor$. The forecast # automatically adds the seasonal component forecast to the ARIMA forecast. from statsmodels.tsa.arima.model import ARIMA from statsmodels.tsa.forecasting.stl import STLForecast elec_equip.index.freq = elec_equip.index.inferred_freq stlf = STLForecast(elec_equip, ARIMA, model_kwargs=dict(order=(1, 1, 0), trend="t")) stlf_res = stlf.fit() forecast = stlf_res.forecast(24) plt.plot(elec_equip) plt.plot(forecast) plt.show() # ``summary`` contains information about both the time-series model and # the STL decomposition. print(stlf_res.summary())
5,190
5,169
<reponame>Gantios/Specs { "name": "FollowApps", "version": "5.1.2-beta", "summary": "FollowApps SDK for analytics on iOS.", "description": "Transform your mobile presence into mobile profits by optimizing your mobile apps to acquire new customers and grow revenue.", "homepage": "http://www.followanalytics.com/", "license": { "type": "commercial", "text": "See XXXXXX" }, "authors": "FollowAnalytics", "platforms": { "ios": "5.1.1" }, "source": { "http": "https://s3-eu-west-1.amazonaws.com/fa-sdks/ios/5.1.2-beta/followapps_iOS_SDK_5.1.2-beta.zip" }, "preserve_paths": "followapps_iOS_SDK_5.1.2-beta/Pod/FollowApps/*.framework", "resources": [ "followapps_iOS_SDK_5.1.2-beta/Pod/FollowApps/Settings.bundle", "followapps_iOS_SDK_5.1.2-beta/Pod/FollowApps/FollowApps.framework/**/*.h" ], "ios": { "vendored_frameworks": "followapps_iOS_SDK_5.1.2-beta/Pod/FollowApps/FollowApps.framework" }, "frameworks": [ "FollowApps", "Security", "SystemConfiguration", "CoreTelephony", "CoreLocation", "WatchConnectivity", "UserNotifications", "MobileCoreServices" ], "xcconfig": { "OTHER_LDFLAGS": "-ObjC -lc++ -lsqlite3 -lz", "STRIP_STYLE": "debugging" }, "requires_arc": true, "dependencies": { "SSZipArchive": [ ] } }
552
4,812
<filename>llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.cpp //===-- LanaiMCExpr.cpp - Lanai specific MC expression classes ------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "LanaiMCExpr.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCStreamer.h" using namespace llvm; #define DEBUG_TYPE "lanaimcexpr" const LanaiMCExpr *LanaiMCExpr::create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx) { return new (Ctx) LanaiMCExpr(Kind, Expr); } void LanaiMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const { if (Kind == VK_Lanai_None) { Expr->print(OS, MAI); return; } switch (Kind) { default: llvm_unreachable("Invalid kind!"); case VK_Lanai_ABS_HI: OS << "hi"; break; case VK_Lanai_ABS_LO: OS << "lo"; break; } OS << '('; const MCExpr *Expr = getSubExpr(); Expr->print(OS, MAI); OS << ')'; } void LanaiMCExpr::visitUsedExpr(MCStreamer &Streamer) const { Streamer.visitUsedExpr(*getSubExpr()); } bool LanaiMCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const { if (!getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup)) return false; Res = MCValue::get(Res.getSymA(), Res.getSymB(), Res.getConstant(), getKind()); return true; }
738
553
{ "url": "/marker-locations?teamId=5bb51100585ada29401ee9c5&streamId=5c05ab736f6e2b29beae5942&commitHash=4c62fa5ba1431d5202e0aea30a37a7ed6075ade9", "response": { "markerLocations": {} } }
98
373
<reponame>linkingtd/UniAuth<gh_stars>100-1000 package com.dianrong.common.uniauth.server.support.tree; import com.dianrong.common.uniauth.common.cons.AppConstants; /** * 定义树结构的类型. */ public enum TreeType { /** * 普通的树关系. */ NORMAL(AppConstants.GRP_ROOT), /** * 组织关系树关系. */ ORGANIZATION(AppConstants.ORGANIZATION_ROOT); private String rootCode; private TreeType(String rootCode) { this.rootCode = rootCode; } public String getRootCode() { return rootCode; } }
242
5,169
<reponame>Gantios/Specs { "name": "SYImageColorTools", "version": "0.1.3", "license": "Custom", "summary": "It s always a hassle to get pixel information of an UIImage. Let s remedy that", "homepage": "https://github.com/dvkch/SYImageColorTools", "authors": { "<NAME>": "<EMAIL>" }, "source": { "git": "https://github.com/dvkch/SYImageColorTools.git", "tag": "0.1.3" }, "requires_arc": true, "xcconfig": { "CLANG_MODULES_AUTOLINK": "YES" }, "platforms": { "ios": "5.0" }, "source_files": "Classes/*.{h,m}", "subspecs": [ { "name": "GPUImage", "source_files": [ "Classes/*.{h,m}", "Classes/GPUImage/*.{h.m}" ] } ] }
338
783
#include "wave.h" int NUM_OF_CU = 0; ComputeUnit allCUs[MAX_NUM_OF_CU]; Wavefront lastSchldWavefront; Resources toSchedule[MAX_WFS_IN_TEST]; Resources workgroups[MAX_WFS_IN_TEST]; int maxWorkgroup = 0; int currWorkgroup = 0; int maxToSch = -1; int curToSch = 0; int lastStartCU = -1; int wg2cu[MAX_WFS_IN_TEST][2]; /************************************************************************/ /* Region: Initializing test (and helper functions) */ /************************************************************************/ // parse the config file int readConfigFile(int fno) { char fileName[40]; sprintf(fileName, "kernel_%d/config_%d.txt", fno, fno); // check if file exists struct stat buffer; if (stat (fileName, &buffer) != 0) return 0; FILE* fp = fopen(fileName, "r"); char inp[CONFIG_LINE_LEN]; char *tok = NULL; int i; // reading and discarding first line char *fline = fgets(inp, CONFIG_LINE_LEN, fp); while(1) { char *result = fgets(inp, CONFIG_LINE_LEN, fp); if(result == NULL) break; maxToSch = maxToSch + 1; tok = strtok(inp, ";"); toSchedule[maxToSch].wgId = atoi(tok); tok = strtok(NULL, ";"); toSchedule[maxToSch].wfId = atoi(tok); tok = strtok(NULL, ";"); toSchedule[maxToSch].wfCnt = atoi(tok); tok = strtok(NULL, ";"); toSchedule[maxToSch].numOfThrds = atoi(tok); tok = strtok(NULL, ";"); toSchedule[maxToSch].vregCnt = atoi(tok); if(toSchedule[maxToSch].vregCnt % 4 != 0) { toSchedule[maxToSch].vregCnt = (toSchedule[maxToSch].vregCnt/4 + 1) * 4; } tok = strtok(NULL, ";"); toSchedule[maxToSch].sregCnt = atoi(tok); if(toSchedule[maxToSch].sregCnt % 8 != 0) { toSchedule[maxToSch].sregCnt = (toSchedule[maxToSch].sregCnt/8 + 1) * 8; } tok = strtok(NULL, ";"); toSchedule[maxToSch].ldsCnt = atoi(tok); for(i=0; i<toSchedule[maxToSch].numOfThrds; i++) { tok = strtok(NULL, ";"); toSchedule[maxToSch].vregs[i] = strdup(tok); assert(toSchedule[maxToSch].vregs[i][0] == 'V'); } tok = strtok(NULL, ";"); toSchedule[maxToSch].sregs = strdup(tok); assert(toSchedule[maxToSch].sregs[0] == 'S'); tok = strtok(NULL, ";"); toSchedule[maxToSch].pc = atoi(tok); } fclose(fp); return 1; } void copyFile(char *src, char *dest) { FILE* fp1 = fopen(src, "r"); FILE* fp2 = fopen(dest, "w"); char inp[CONFIG_LINE_LEN]; while(1) { char *result = fgets(inp, CONFIG_LINE_LEN, fp1); if(result == NULL) break; fputs(inp, fp2); } fclose(fp1); fclose(fp2); } // Copy data and instr void copyDataAndInstr(int fno) { char fileName[40]; sprintf(fileName, "kernel_%d/data_%d.mem", fno, fno); copyFile(fileName, "data.mem"); sprintf(fileName, "kernel_%d/instr_%d.mem", fno, fno); copyFile(fileName, "instr.mem"); } int lookupWorkgroup(int wgId) { int i; for(i =0; i <maxWorkgroup; i++){ if(workgroups[i].wgId == wgId) return 1; } return 0; } // get workgroups void updateWorkgroups(void) { // For each item in toSchedule, lookup if the workgroup id is known // if not, add new workgroup int i; for(i =0; i<maxToSch+1; i++){ // we dont have this workgroup yet if(!lookupWorkgroup(toSchedule[i].wgId)){ workgroups[maxWorkgroup] = toSchedule[i]; maxWorkgroup++; } } } // initialize the system int Initialize(int num_of_cu, int iter) { int i; NUM_OF_CU = num_of_cu; assert(NUM_OF_CU <= MAX_NUM_OF_CU); maxToSch = -1; curToSch = 0; for(i = 0; i < MAX_WFS_IN_TEST; i++) { wg2cu[i][0] = -1; wg2cu[i][1] = -1; } for (i = 0; i < NUM_OF_CU ; i++ ) { allCUs[i].id = i; allCUs[i].numOfWfs = 0; // set all resources as free and size them allCUs[i].numVReg = 1; allCUs[i].vReg[0].base = 0; allCUs[i].vReg[0].size = MAX_VREG; allCUs[i].vReg[0].free = 1; allCUs[i].numSReg = 1; allCUs[i].sReg[0].base = 0; allCUs[i].sReg[0].size = MAX_SREG; allCUs[i].sReg[0].free = 1; allCUs[i].numLds = 1; allCUs[i].lds[0].base = 0; allCUs[i].lds[0].size = MAX_LDS; allCUs[i].lds[0].free = 1; } int ret = readConfigFile(iter); if (ret == 0) return 0; updateWorkgroups(); copyDataAndInstr(iter); return 1; } /************************************************************************/ /* Region: Scheduling wavefronts (and helper functions) */ /************************************************************************/ // check if resource allocation possible in a given ListElem array int checkInElementArray(ListElem *lst, int maxCnt, int reqCnt) { int match = -1, i; for(i = 0; i < maxCnt; i++) { if(lst[i].free == 1) { if(lst[i].size >= reqCnt) { match = 1; break; } } } return match; } int checkInArrayOrPresence(ListElem *lst, int maxCnt, int reqCnt, int wgId) { int i; for(i = 0; i < maxCnt; i++) { if(lst[i].free < 1 && lst[i].wgId == wgId) { return 1; } } return checkInElementArray(lst, maxCnt, reqCnt); } // checks if the CU can handle the resources required for the job // returns 1 if it can, -1 if it cannot int checkForResourceAvail(ComputeUnit cu, Resources res) { int match; // check for maximum wavefronts on CU if(cu.numOfWfs == MAX_WF_IN_CU) { return -1; } // check vreg avail match = checkInElementArray(cu.vReg, cu.numVReg, res.vregCnt); if(match == -1) return -1; // check sreg avail match = checkInElementArray(cu.sReg, cu.numSReg, res.sregCnt); if(match == -1) return -1; // check lds avail match = checkInArrayOrPresence(cu.lds, cu.numLds, res.ldsCnt, res.wgId); if(match == -1) return -1; return 1; } // allocate resource in a given ListElem array (currently using first fit allocation) int allocateInElemArrAndWf(ListElem *lst, int maxCnt, int reqCnt, int *resBase, int *resSize, int wgId) { int i, j; for(i = 0; i < maxCnt; i++) { if(lst[i].free == 1) { if(lst[i].size < reqCnt) { continue; } else if(lst[i].size == reqCnt) { // nothing to do, just allocate } else if(lst[i].size > reqCnt) { // move the rest of the array by one index for(j = maxCnt; j > i; j--) { lst[j+1] = lst[j]; } // split into 2 blocks lst[i+1].base = lst[i].base + reqCnt; lst[i+1].size = lst[i].size - reqCnt; lst[i+1].free = 1; lst[i].size = reqCnt; maxCnt = maxCnt + 1; } lst[i].free = 0; lst[i].wgId = wgId; *resBase = lst[i].base; *resSize = reqCnt; break; } } // assert that alloc has been found assert(i <= maxCnt); return maxCnt; } int checkIfNotAllocate(ListElem *lst, int maxCnt, int reqCnt, int *resBase, int *resSize, int wgId) { int i; for(i = 0; i < maxCnt; i++) { if(lst[i].free < 1 && lst[i].wgId == wgId) { *resBase = lst[i].base; *resSize = reqCnt; lst[i].free--; return maxCnt; } } return allocateInElemArrAndWf(lst, maxCnt, reqCnt, resBase, resSize, wgId); } // parse string of reg values and form RegValues int fillRegValues(RegValue *regvals, char *regstr, int base) { int i = 0; char *tok; //printf("%s\n", regstr); tok = strtok(regstr, ":"); tok = strtok(NULL, "="); for(i=0; (i < MAX_REGS_SET) && (tok != NULL); i++) { regvals[i].reg = base + atoi(tok); tok = strtok(NULL, ","); assert(tok != NULL); regvals[i].val = atoi(tok); tok = strtok(NULL, "="); } // make sure that all reg values were read assert(tok == NULL); return i; } // allocates and adds a wavefront to a CU and returns it Wavefront formAndAddWaveFrontOnCU(int cuId, Resources res) { int i; Wavefront wf; // set already known info wf.cuId = cuId; wf.wgId = res.wgId; wf.wfId = res.wfId; wf.wfCnt = res.wfCnt; wf.wfTag = (res.wgId * 16) + res.wfId; wf.numOfThrds = res.numOfThrds; ComputeUnit cu = allCUs[cuId]; // allocate vreg cu.numVReg = allocateInElemArrAndWf(cu.vReg, cu.numVReg, res.vregCnt, &(wf.vregBase), &(wf.vregSize), res.wgId); // allocate sreg cu.numSReg = allocateInElemArrAndWf(cu.sReg, cu.numSReg, res.sregCnt, &(wf.sregBase), &(wf.sregSize), res.wgId); // allocate lds cu.numLds = checkIfNotAllocate(cu.lds, cu.numLds, res.ldsCnt, &(wf.ldsBase), &(wf.ldsSize), res.wgId); // get set vreg values for(i=0; i<wf.numOfThrds; i++) { wf.setVregs = fillRegValues(wf.vregs[i], res.vregs[i], wf.vregBase); } // get set sreg values wf.setSregs = fillRegValues(wf.sregs, res.sregs, wf.sregBase); // set pc of the wavefront wf.pc = res.pc; // add wavefront to the CU cu.wfs[cu.numOfWfs] = wf; cu.numOfWfs = cu.numOfWfs + 1; allCUs[cuId] = cu; return wf; } int checkIfWavegroupSch(int wgId) { int i; for(i = 0; i < MAX_WFS_IN_TEST; i++) { if(wg2cu[i][0] == wgId) { return wg2cu[i][1]; } } return -1; } // called from the top level module to allocate a wavefront int ScheduleWavefront() { if(curToSch > maxToSch) { return -1; } int i, j; Resources res = toSchedule[curToSch]; // get amount of resource needed for new wavefront int cu = checkIfWavegroupSch(res.wgId); if(cu != -1) { int ret = checkForResourceAvail(allCUs[i], res); if(ret == 1) { // allocate on that CU and return the wavefront Wavefront wf = formAndAddWaveFrontOnCU(i, res); lastSchldWavefront = wf; curToSch = curToSch + 1; return 1; } //else { // fprintf(stderr, "Error scheduling wavegroup: %d\n", res.wgId); // exit(-1); //} } else { lastStartCU = (lastStartCU + 1) % NUM_OF_CU; for(j = 0; j < NUM_OF_CU; j++) { i = (lastStartCU + j) % NUM_OF_CU; // check if there is a CU which can accomodate int ret = checkForResourceAvail(allCUs[i], res); if(ret == 1) { // allocate on that CU and return the wavefront Wavefront wf = formAndAddWaveFrontOnCU(i, res); lastSchldWavefront = wf; wg2cu[curToSch][0] = res.wgId; wg2cu[curToSch][1] = i; curToSch = curToSch + 1; return 1; } } } // there are wavefronts to be scheduled // but cannot be scheduled now Wavefront wf; wf.cuId = -1; wf.wfId = -1; lastSchldWavefront = wf; return -2; } /************************************************************************/ /* Region: Descheduling wavefronts (and helper functions) */ /************************************************************************/ // free a resource on desheduling void releaseFromElemArray(ListElem *lst, int maxCnt, int resBase) { int i; for(i = 0; i < maxCnt; i++) { if(lst[i].base == resBase) { lst[i].free++; break; } } // assert that entry was found assert(i <= maxCnt); } // descheduling when a wavefront is done processing void DescheduleWavefront(int cuid, int wfTag) { int i; Wavefront wf; // search for wavefront entry in CU for(i = 0; i < allCUs[cuid].numOfWfs; i++) { if(allCUs[cuid].wfs[i].wfTag == wfTag) { wf = allCUs[cuid].wfs[i]; break; } } // confirm that the wavefront was found assert(i < allCUs[cuid].numOfWfs); // delete that entry of wavefront from the list for(; i < allCUs[cuid].numOfWfs - 1; i++) { allCUs[cuid].wfs[i] = allCUs[cuid].wfs[i+1]; } allCUs[cuid].numOfWfs = allCUs[cuid].numOfWfs - 1; // free the block of vregs allocated releaseFromElemArray(allCUs[cuid].vReg, allCUs[cuid].numVReg, wf.vregBase); // free the block of sregs allocated releaseFromElemArray(allCUs[cuid].sReg, allCUs[cuid].numSReg, wf.sregBase); // free the block of lds allocated releaseFromElemArray(allCUs[cuid].lds, allCUs[cuid].numLds, wf.ldsBase); } /************************************************************************/ /* Region: Get functions to access general config info */ /************************************************************************/ int getTotalWavefronts() { return (maxToSch + 1); } /************************************************************************/ /* Region: Get functions to for the hardaware dispatcher */ /************************************************************************/ #define VREG_ALLOC_UNIT 4 #define SREG_ALLOC_UNIT 8 #define LDS_ALLOC_UNIT 64 int checkWgAvailable(void){ return (currWorkgroup<maxWorkgroup)? 1:0; } void prepareNextWg(void){ currWorkgroup++; } int hardDisGetWgId() { return workgroups[currWorkgroup].wgId; } int hardDisGetWfCnt() { return workgroups[currWorkgroup].wfCnt; } int hardDisGetWfNumThrds() { return workgroups[currWorkgroup].numOfThrds; } int hardDisGetVregSize() { return (workgroups[currWorkgroup].vregCnt/VREG_ALLOC_UNIT)* workgroups[currWorkgroup].wfCnt; } int hardDisGetVregSizePerWf() { return workgroups[currWorkgroup].vregCnt/VREG_ALLOC_UNIT; } int hardDisGetSregSize() { return (workgroups[currWorkgroup].sregCnt/SREG_ALLOC_UNIT)* workgroups[currWorkgroup].wfCnt; } int hardDisGetSregSizePerWf() { return workgroups[currWorkgroup].sregCnt/SREG_ALLOC_UNIT; } int hardDisGetLdsSize() { return workgroups[currWorkgroup].ldsCnt/LDS_ALLOC_UNIT; } int hardDisGetGdsSize() { return 0; } int hardDisGetPc(){ return workgroups[currWorkgroup].pc; } /************************************************************************/ /* Region: Get functions to access the scheduled wavefront */ /************************************************************************/ int getCuId() { return lastSchldWavefront.cuId; } /* int getWgId() { return lastSchldWavefront.wgId; } int getWfId() { return lastSchldWavefront.wfId; } */ int getWfTag() { return lastSchldWavefront.wfTag; } int getWfCnt() { return lastSchldWavefront.wfCnt; } int getWfNumThrds() { return lastSchldWavefront.numOfThrds; } int getVregBase() { return lastSchldWavefront.vregBase; } int getVregSize() { return lastSchldWavefront.vregSize; } int getSregBase() { return lastSchldWavefront.sregBase; } int getSregSize() { return lastSchldWavefront.sregSize; } int getLdsBase() { return lastSchldWavefront.ldsBase; } int getLdsSize() { return lastSchldWavefront.ldsSize; } /********************************/ // Reading of set vreg /********************************/ int getSetVregs() { return lastSchldWavefront.setVregs; } int getVregKey(int index, int thrd) { if((index < lastSchldWavefront.setVregs) && (thrd < lastSchldWavefront.numOfThrds)) { return lastSchldWavefront.vregs[thrd][index].reg; } else { return -1; } } int getVregValue(int index, int thrd) { if((index < lastSchldWavefront.setVregs) && (thrd < lastSchldWavefront.numOfThrds)) { return lastSchldWavefront.vregs[thrd][index].val; } else { return -1; } } /********************************/ /********************************/ // Reading of set sreg /********************************/ int getSetSregs() { return lastSchldWavefront.setSregs; } int getSregKey(int index) { if(index < lastSchldWavefront.setSregs) { return lastSchldWavefront.sregs[index].reg; } else { return -1; } } int getSregValue(int index) { if(index < lastSchldWavefront.setSregs) { return lastSchldWavefront.sregs[index].val; } else { return -1; } } #ifndef __DEBUG_WAVE__ /********************************/ // Setting of set vreg /********************************/ void setVregValue(int cuid, int thrd, int vreg, int bitnum, int value) { vpiHandle h1; char str[80]; sprintf(str, "gpu_tb.DUT[%d].vgpr0.reg_file.page[%d].bank0.word[%d].bits[%d].flop_0.state", cuid, thrd, vreg, bitnum); h1 = vpi_handle_by_name (str, NULL); struct t_vpi_value argval; argval.format = vpiIntVal; argval.value.integer = value; vpi_put_value(h1, &argval, NULL, vpiNoDelay); } /********************************/ // Setting of set sreg /********************************/ void setSregValue(int cuid, int sreg, int bitnum, int value) { vpiHandle h1; char str[80]; int banknum; int wordnum; //Sgpr is organized as 4 banks banknum = sreg % 4; wordnum = sreg / 4; sprintf(str, "gpu_tb.DUT[%d].sgpr0.sgpr_reg_file.bank%d.word[%d].bits[%d].flop_0.state", cuid, banknum, wordnum, bitnum); h1 = vpi_handle_by_name (str, NULL); struct t_vpi_value argval; argval.format = vpiIntVal; argval.value.integer = value; vpi_put_value(h1, &argval, NULL, vpiNoDelay); } /********************************/ #endif int getPC() { return lastSchldWavefront.pc; } /************************************************************************/ /* Region: Code for debugging purposes */ /************************************************************************/ // set at the beginning of the file #ifdef __DEBUG_WAVE__ void printRegVals(RegValue *regvs, int size) { int i; printf("\t\tSetRegs = %d : ", size); for(i=0; i < size; i++) { printf("%d = %d, ", regvs[i].reg, regvs[i].val); } printf("\n"); } void printWavefront(Wavefront wf) { int i; printf("\n"); printf("WFID: %d : %d : %d -> %d threads\n", wf.cuId, wf.wgId , wf.wfId, wf.numOfThrds); printf("\tVREG: %d : %d\n", wf.vregBase, wf.vregSize); printf("\tSREG: %d : %d\n", wf.sregBase, wf.sregSize); printf("\tLDS : %d : %d\n", wf.ldsBase, wf.ldsSize); printf("\tVRegs: \n"); for(i=0; i<wf.numOfThrds; i++) { printRegVals(wf.vregs[i], wf.setVregs); } printf("\tSRegs: \n"); printRegVals(wf.sregs, wf.setSregs); printf("\tPC : %d\n", wf.pc); printf("\n"); } void printListElem(ListElem ls) { printf("\t%d : %d : %d\n", ls.base, ls.size, ls.free); } void printCU(ComputeUnit cu) { int i; printf("---------------------------------\n"); printf("CUId: %d\n", cu.id); for(i = 0; i < cu.numOfWfs; i++) { printWavefront(cu.wfs[i]); } printf("VREGS:\n"); for(i= 0; i < cu.numVReg; i++) { printListElem(cu.vReg[i]); } printf("SREGS:\n"); for(i= 0; i < cu.numSReg; i++) { printListElem(cu.sReg[i]); } printf("LDS:\n"); for(i= 0; i < cu.numLds; i++) { printListElem(cu.lds[i]); } printf("---------------------------------\n"); } int main() { int i, j; Initialize(1, 0); for(i = 0; i <= maxToSch; i++) { printf("%d, %d, %d, %d, %d, ", toSchedule[i].wgId, toSchedule[i].numOfThrds, toSchedule[i].vregCnt, toSchedule[i].sregCnt, toSchedule[i].ldsCnt); for(j = 0; j < toSchedule[i].numOfThrds; j++) printf("%s, ", toSchedule[i].vregs[j]); printf("%s, %d\n", toSchedule[i].sregs, toSchedule[i].pc); } int ret; ret = ScheduleWavefront(); assert(ret == 1); //printCU(allCUs[0]); ret = ScheduleWavefront(); printf("RET: %d\n", ret); assert(ret == 1); printCU(allCUs[0]); DescheduleWavefront(0, 17); //printCU(allCUs[0]); DescheduleWavefront(0, 18); //printCU(allCUs[1]); return 0; } /************************************************************************/ #endif
9,107
426
<filename>IfcPlusPlus/src/ifcpp/IFC4/lib/IfcDerivedUnitElement.cpp /* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */ #include <sstream> #include <limits> #include "ifcpp/model/AttributeObject.h" #include "ifcpp/model/BuildingException.h" #include "ifcpp/model/BuildingGuid.h" #include "ifcpp/reader/ReaderUtil.h" #include "ifcpp/writer/WriterUtil.h" #include "ifcpp/IFC4/include/IfcDerivedUnitElement.h" #include "ifcpp/IFC4/include/IfcNamedUnit.h" // ENTITY IfcDerivedUnitElement IfcDerivedUnitElement::IfcDerivedUnitElement( int id ) { m_entity_id = id; } shared_ptr<BuildingObject> IfcDerivedUnitElement::getDeepCopy( BuildingCopyOptions& options ) { shared_ptr<IfcDerivedUnitElement> copy_self( new IfcDerivedUnitElement() ); if( m_Unit ) { copy_self->m_Unit = dynamic_pointer_cast<IfcNamedUnit>( m_Unit->getDeepCopy(options) ); } copy_self->m_Exponent = m_Exponent; return copy_self; } void IfcDerivedUnitElement::getStepLine( std::stringstream& stream ) const { stream << "#" << m_entity_id << "= IFCDERIVEDUNITELEMENT" << "("; if( m_Unit ) { stream << "#" << m_Unit->m_entity_id; } else { stream << "$"; } stream << ","; stream << m_Exponent; stream << ");"; } void IfcDerivedUnitElement::getStepParameter( std::stringstream& stream, bool /*is_select_type*/ ) const { stream << "#" << m_entity_id; } const std::wstring IfcDerivedUnitElement::toString() const { return L"IfcDerivedUnitElement"; } void IfcDerivedUnitElement::readStepArguments( const std::vector<std::wstring>& args, const std::map<int,shared_ptr<BuildingEntity> >& map ) { const size_t num_args = args.size(); if( num_args != 2 ){ std::stringstream err; err << "Wrong parameter count for entity IfcDerivedUnitElement, expecting 2, having " << num_args << ". Entity ID: " << m_entity_id << std::endl; throw BuildingException( err.str().c_str() ); } readEntityReference( args[0], m_Unit, map ); readIntegerValue( args[1], m_Exponent ); } void IfcDerivedUnitElement::getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const { vec_attributes.emplace_back( std::make_pair( "Unit", m_Unit ) ); vec_attributes.emplace_back( std::make_pair( "Exponent", shared_ptr<IntegerAttribute>( new IntegerAttribute( m_Exponent ) ) ) ); } void IfcDerivedUnitElement::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes_inverse ) const { } void IfcDerivedUnitElement::setInverseCounterparts( shared_ptr<BuildingEntity> ) { } void IfcDerivedUnitElement::unlinkFromInverseCounterparts() { }
946
1,844
/* * Copyright 2010-2013 Ning, Inc. * * Ning licenses this file to you under the Apache License, version 2.0 * (the "License"); you may not use this file except in compliance with the * License. You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package org.killbill.billing.util.template.translation; import org.skife.config.Config; import org.skife.config.Default; import org.skife.config.Description; import org.killbill.billing.invoice.api.formatters.InvoiceFormatterFactory; public interface TranslatorConfig { // Common @Config("org.killbill.default.locale") @Default("en_US") @Description("Default Killbill locale") public String getDefaultLocale(); // Catalog @Config("org.killbill.catalog.bundlePath") @Default("org/killbill/billing/util/template/translation/CatalogTranslation") @Description("Path to the catalog translation bundle") String getCatalogBundlePath(); // Invoices @Config("org.killbill.template.bundlePath") @Default("org/killbill/billing/util/invoice/translation/InvoiceTranslation") @Description("Path to the invoice template translation bundle") public String getInvoiceTemplateBundlePath(); @Config("org.killbill.template.name") @Default("org/killbill/billing/util/invoice/templates/HtmlInvoiceTemplate.mustache") @Description("Path to the HTML invoice template") String getTemplateName(); @Config("org.killbill.manualPayTemplate.name") @Default("org/killbill/billing/util/email/templates/HtmlInvoiceTemplate.mustache") @Description("Path to the invoice template for accounts with MANUAL_PAY tag") String getManualPayTemplateName(); @Config("org.killbill.template.invoiceFormatterFactoryClass") @Default("org.killbill.billing.invoice.template.formatters.DefaultInvoiceFormatterFactory") @Description("Invoice formatter class") Class<? extends InvoiceFormatterFactory> getInvoiceFormatterFactoryClass(); }
701
7,886
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.facebook.samples.litho.java.onboarding; import com.facebook.litho.ClickEvent; import com.facebook.litho.Column; import com.facebook.litho.Component; import com.facebook.litho.ComponentContext; import com.facebook.litho.StateValue; import com.facebook.litho.annotations.LayoutSpec; import com.facebook.litho.annotations.OnCreateLayout; import com.facebook.litho.annotations.OnEvent; import com.facebook.litho.annotations.OnUpdateState; import com.facebook.litho.annotations.State; import com.facebook.litho.widget.Image; // start_example @LayoutSpec public class CheckboxComponentSpec { @OnCreateLayout static Component onCreateLayout(ComponentContext c, @State boolean isChecked) { return Column.create(c) .child( Image.create(c) .drawableRes( isChecked ? android.R.drawable.checkbox_on_background : android.R.drawable.checkbox_off_background)) .clickHandler(CheckboxComponent.onCheckboxClicked(c)) .build(); } @OnUpdateState static void updateCheckbox(StateValue<Boolean> isChecked) { isChecked.set(!isChecked.get()); } @OnEvent(ClickEvent.class) static void onCheckboxClicked(ComponentContext c) { CheckboxComponent.updateCheckbox(c); } } // end_example
677
5,250
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.flowable.compatibility.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntity; import org.flowable.engine.repository.DeploymentProperties; import org.flowable.engine.repository.ProcessDefinition; import org.flowable.engine.runtime.ProcessInstance; import org.junit.Test; public class StartProcessInstanceTest extends AbstractFlowable6CompatibilityTest { @Test public void testStartProcessInstance() { // There should be one task active for the process, from the v5 test data generator assertEquals(1, taskService.createTaskQuery().processInstanceBusinessKey("activitiv5-one-task-process").count()); assertEquals(1, runtimeService.createProcessInstanceQuery().processDefinitionKey("oneTaskProcess").count()); assertEquals(1, repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcess").count()); // Starting a new process instance will start it in v5 mode ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess"); assertEquals(2, runtimeService.createProcessInstanceQuery().processDefinitionKey("oneTaskProcess").count()); assertEquals(2, taskService.createTaskQuery().processDefinitionKey("oneTaskProcess").count()); // For v5, there should be only one execution assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(processInstance.getId()).count()); // Completing a task in v5 mode taskService.complete(taskService.createTaskQuery().processDefinitionKey("oneTaskProcess").list().get(0).getId()); assertEquals(1, taskService.createTaskQuery().processDefinitionKey("oneTaskProcess").count()); assertEquals(1, runtimeService.createProcessInstanceQuery().processDefinitionKey("oneTaskProcess").count()); // Deploying the process definition again. But not yet ready to migrate to v6... repositoryService.createDeployment() .addClasspathResource("oneTaskProcess.bpmn20.xml") .deploymentProperty(DeploymentProperties.DEPLOY_AS_FLOWABLE5_PROCESS_DEFINITION, Boolean.TRUE) .deploy(); assertEquals(2, repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcess").count()); for (ProcessDefinition processDefinition : repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcess").list()) { assertEquals("v5", ((ProcessDefinitionEntity) processDefinition).getEngineVersion()); } processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess"); assertEquals(2, runtimeService.createProcessInstanceQuery().processDefinitionKey("oneTaskProcess").count()); assertEquals(2, taskService.createTaskQuery().processDefinitionKey("oneTaskProcess").count()); // The process definition has been migrated to v6. Deploying it as a 6 process definition repositoryService.createDeployment() .addClasspathResource("oneTaskProcess.bpmn20.xml") .deploy(); assertEquals(3, repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcess").count()); assertNull(((ProcessDefinitionEntity) repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcess").latestVersion().singleResult()).getEngineVersion()); processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess"); assertEquals(3, taskService.createTaskQuery().processDefinitionKey("oneTaskProcess").count()); // For v6, we expect 2 execution (vs 1 in v5) assertEquals(2, runtimeService.createExecutionQuery().processInstanceId(processInstance.getId()).count()); assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(processInstance.getId()).onlyChildExecutions().count()); assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(processInstance.getId()).onlyProcessInstanceExecutions().count()); } }
1,421
369
<filename>FreeRTOSv10.4.1/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/Altera_Code/HardwareLibrary/include/alt_interrupt_common.h /****************************************************************************** * * Copyright 2013 Altera Corporation. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * ******************************************************************************/ #ifndef __ALT_INT_COMMON_H__ #define __ALT_INT_COMMON_H__ #include "hwlib.h" #include <stdbool.h> #include <stddef.h> #ifdef __cplusplus extern "C" { #endif /*! * \addtogroup INT_COMMON Interrupt Controller Common Definitions * * This module contains the definitions common to the Interrupt Controller * Low-Level API and Interrupt Controller Manager Interface. * * @{ */ /*! * This type definition enumerates all the interrupt identification types. */ typedef enum ALT_INT_INTERRUPT_e { ALT_INT_INTERRUPT_SGI0 = 0, /*!< # */ ALT_INT_INTERRUPT_SGI1 = 1, /*!< # */ ALT_INT_INTERRUPT_SGI2 = 2, /*!< # */ ALT_INT_INTERRUPT_SGI3 = 3, /*!< # */ ALT_INT_INTERRUPT_SGI4 = 4, /*!< # */ ALT_INT_INTERRUPT_SGI5 = 5, /*!< # */ ALT_INT_INTERRUPT_SGI6 = 6, /*!< # */ ALT_INT_INTERRUPT_SGI7 = 7, /*!< # */ ALT_INT_INTERRUPT_SGI8 = 8, /*!< # */ ALT_INT_INTERRUPT_SGI9 = 9, /*!< # */ ALT_INT_INTERRUPT_SGI10 = 10, /*!< # */ ALT_INT_INTERRUPT_SGI11 = 11, /*!< # */ ALT_INT_INTERRUPT_SGI12 = 12, /*!< # */ ALT_INT_INTERRUPT_SGI13 = 13, /*!< # */ ALT_INT_INTERRUPT_SGI14 = 14, /*!< # */ ALT_INT_INTERRUPT_SGI15 = 15, /*!< * Software Generated Interrupts (SGI), 0 - 15. * * All interrupts in this group are software triggered. */ ALT_INT_INTERRUPT_PPI_TIMER_GLOBAL = 27, /*!< # */ ALT_INT_INTERRUPT_PPI_TIMER_PRIVATE = 29, /*!< # */ ALT_INT_INTERRUPT_PPI_TIMER_WATCHDOG = 30, /*!< # */ /*!< * Private Peripheral Interrupts (PPI) for the Global Timer, per CPU * private timer, and watchdog timer. * * All interrupts in this group are edge triggered. */ ALT_INT_INTERRUPT_CPU0_PARITYFAIL = 32, /*!< # */ ALT_INT_INTERRUPT_CPU0_PARITYFAIL_BTAC = 33, /*!< # */ ALT_INT_INTERRUPT_CPU0_PARITYFAIL_GHB = 34, /*!< # */ ALT_INT_INTERRUPT_CPU0_PARITYFAIL_I_TAG = 35, /*!< # */ ALT_INT_INTERRUPT_CPU0_PARITYFAIL_I_DATA = 36, /*!< # */ ALT_INT_INTERRUPT_CPU0_PARITYFAIL_TLB = 37, /*!< # */ ALT_INT_INTERRUPT_CPU0_PARITYFAIL_D_OUTER = 38, /*!< # */ ALT_INT_INTERRUPT_CPU0_PARITYFAIL_D_TAG = 39, /*!< # */ ALT_INT_INTERRUPT_CPU0_PARITYFAIL_D_DATA = 40, /*!< # */ ALT_INT_INTERRUPT_CPU0_DEFLAGS0 = 41, /*!< # */ ALT_INT_INTERRUPT_CPU0_DEFLAGS1 = 42, /*!< # */ ALT_INT_INTERRUPT_CPU0_DEFLAGS2 = 43, /*!< # */ ALT_INT_INTERRUPT_CPU0_DEFLAGS3 = 44, /*!< # */ ALT_INT_INTERRUPT_CPU0_DEFLAGS4 = 45, /*!< # */ ALT_INT_INTERRUPT_CPU0_DEFLAGS5 = 46, /*!< # */ ALT_INT_INTERRUPT_CPU0_DEFLAGS6 = 47, /*!< * Interrupts sourced from CPU0. * * The ALT_INT_INTERRUPT_CPU0_PARITYFAIL interrupt combines the * BTAC, GHB, I_TAG, I_DATA, TLB, D_OUTER, D_TAG, and D_DATA interrupts * for CPU0. * * * PARITYFAIL interrupts in this group are edge triggered. * * DEFFLAGS interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_CPU1_PARITYFAIL = 48, /*!< # */ ALT_INT_INTERRUPT_CPU1_PARITYFAIL_BTAC = 49, /*!< # */ ALT_INT_INTERRUPT_CPU1_PARITYFAIL_GHB = 50, /*!< # */ ALT_INT_INTERRUPT_CPU1_PARITYFAIL_I_TAG = 51, /*!< # */ ALT_INT_INTERRUPT_CPU1_PARITYFAIL_I_DATA = 52, /*!< # */ ALT_INT_INTERRUPT_CPU1_PARITYFAIL_TLB = 53, /*!< # */ ALT_INT_INTERRUPT_CPU1_PARITYFAIL_D_OUTER = 54, /*!< # */ ALT_INT_INTERRUPT_CPU1_PARITYFAIL_D_TAG = 55, /*!< # */ ALT_INT_INTERRUPT_CPU1_PARITYFAIL_D_DATA = 56, /*!< # */ ALT_INT_INTERRUPT_CPU1_DEFLAGS0 = 57, /*!< # */ ALT_INT_INTERRUPT_CPU1_DEFLAGS1 = 58, /*!< # */ ALT_INT_INTERRUPT_CPU1_DEFLAGS2 = 59, /*!< # */ ALT_INT_INTERRUPT_CPU1_DEFLAGS3 = 60, /*!< # */ ALT_INT_INTERRUPT_CPU1_DEFLAGS4 = 61, /*!< # */ ALT_INT_INTERRUPT_CPU1_DEFLAGS5 = 62, /*!< # */ ALT_INT_INTERRUPT_CPU1_DEFLAGS6 = 63, /*!< * Interrupts sourced from CPU1. * * The ALT_INT_INTERRUPT_CPU1_PARITYFAIL interrupt combines the * BTAC, GHB, I_TAG, I_DATA, TLB, D_OUTER, D_TAG, and D_DATA interrupts * for CPU1. * * * PARITYFAIL interrupts in this group are edge triggered. * * DEFFLAGS interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_SCU_PARITYFAIL0 = 64, /*!< # */ ALT_INT_INTERRUPT_SCU_PARITYFAIL1 = 65, /*!< # */ ALT_INT_INTERRUPT_SCU_EV_ABORT = 66, /*!< * Interrupts sourced from the Snoop Control Unit (SCU). * * All interrupts in this group are edge triggered. */ ALT_INT_INTERRUPT_L2_ECC_BYTE_WR_IRQ = 67, /*!< # */ ALT_INT_INTERRUPT_L2_ECC_CORRECTED_IRQ = 68, /*!< # */ ALT_INT_INTERRUPT_L2_ECC_UNCORRECTED_IRQ = 69, /*!< # */ ALT_INT_INTERRUPT_L2_COMBINED_IRQ = 70, /*!< * Interrupts sourced from the L2 Cache Controller. * * The ALT_INT_INTERRUPT_L2_COMBINED_IRQ interrupt combines the cache * controller internal DECERRINTR, ECNTRINTR, ERRRDINTR, ERRRTINTR, * ERRWDINTR, ERRWTINTR, PARRDINTR, PARRTINTR, and SLVERRINTR interrupts. * Consult the L2C documentation for information on these interrupts. * * * ECC interrupts in this group are edge triggered. * * Other interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_DDR_ECC_ERROR_IRQ = 71, /*!< * Interrupts sourced from the SDRAM Controller. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ0 = 72, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ1 = 73, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ2 = 74, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ3 = 75, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ4 = 76, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ5 = 77, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ6 = 78, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ7 = 79, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ8 = 80, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ9 = 81, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ10 = 82, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ11 = 83, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ12 = 84, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ13 = 85, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ14 = 86, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ15 = 87, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ16 = 88, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ17 = 89, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ18 = 90, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ19 = 91, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ20 = 92, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ21 = 93, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ22 = 94, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ23 = 95, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ24 = 96, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ25 = 97, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ26 = 98, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ27 = 99, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ28 = 100, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ29 = 101, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ30 = 102, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ31 = 103, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ32 = 104, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ33 = 105, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ34 = 106, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ35 = 107, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ36 = 108, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ37 = 109, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ38 = 110, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ39 = 111, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ40 = 112, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ41 = 113, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ42 = 114, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ43 = 115, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ44 = 116, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ45 = 117, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ46 = 118, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ47 = 119, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ48 = 120, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ49 = 121, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ50 = 122, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ51 = 123, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ52 = 124, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ53 = 125, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ54 = 126, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ55 = 127, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ56 = 128, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ57 = 129, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ58 = 130, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ59 = 131, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ60 = 132, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ61 = 133, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ62 = 134, /*!< # */ ALT_INT_INTERRUPT_F2S_FPGA_IRQ63 = 135, /*!< * Interrupt request from the FPGA logic, 0 - 63. * * Trigger type depends on the implementation in the FPGA. */ ALT_INT_INTERRUPT_DMA_IRQ0 = 136, /*!< # */ ALT_INT_INTERRUPT_DMA_IRQ1 = 137, /*!< # */ ALT_INT_INTERRUPT_DMA_IRQ2 = 138, /*!< # */ ALT_INT_INTERRUPT_DMA_IRQ3 = 139, /*!< # */ ALT_INT_INTERRUPT_DMA_IRQ4 = 140, /*!< # */ ALT_INT_INTERRUPT_DMA_IRQ5 = 141, /*!< # */ ALT_INT_INTERRUPT_DMA_IRQ6 = 142, /*!< # */ ALT_INT_INTERRUPT_DMA_IRQ7 = 143, /*!< # */ ALT_INT_INTERRUPT_DMA_IRQ_ABORT = 144, /*!< # */ ALT_INT_INTERRUPT_DMA_ECC_CORRECTED_IRQ = 145, /*!< # */ ALT_INT_INTERRUPT_DMA_ECC_UNCORRECTED_IRQ = 146, /*!< * Interrupts sourced from the DMA Controller. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_EMAC0_IRQ = 147, /*!< # */ ALT_INT_INTERRUPT_EMAC0_TX_ECC_CORRECTED_IRQ = 148, /*!< # */ ALT_INT_INTERRUPT_EMAC0_TX_ECC_UNCORRECTED_IRQ = 149, /*!< # */ ALT_INT_INTERRUPT_EMAC0_RX_ECC_CORRECTED_IRQ = 150, /*!< # */ ALT_INT_INTERRUPT_EMAC0_RX_ECC_UNCORRECTED_IRQ = 151, /*!< * Interrupts sourced from the Ethernet MAC 0 (EMAC0). * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_EMAC1_IRQ = 152, /*!< # */ ALT_INT_INTERRUPT_EMAC1_TX_ECC_CORRECTED_IRQ = 153, /*!< # */ ALT_INT_INTERRUPT_EMAC1_TX_ECC_UNCORRECTED_IRQ = 154, /*!< # */ ALT_INT_INTERRUPT_EMAC1_RX_ECC_CORRECTED_IRQ = 155, /*!< # */ ALT_INT_INTERRUPT_EMAC1_RX_ECC_UNCORRECTED_IRQ = 156, /*!< * Interrupts sourced from the Ethernet MAC 1 (EMAC1). * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_USB0_IRQ = 157, /*!< # */ ALT_INT_INTERRUPT_USB0_ECC_CORRECTED = 158, /*!< # */ ALT_INT_INTERRUPT_USB0_ECC_UNCORRECTED = 159, /*!< * Interrupts sourced from the USB OTG 0. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_USB1_IRQ = 160, /*!< # */ ALT_INT_INTERRUPT_USB1_ECC_CORRECTED = 161, /*!< # */ ALT_INT_INTERRUPT_USB1_ECC_UNCORRECTED = 162, /*!< * Interrupts sourced from the USB OTG 1. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_CAN0_STS_IRQ = 163, /*!< # */ ALT_INT_INTERRUPT_CAN0_MO_IRQ = 164, /*!< # */ ALT_INT_INTERRUPT_CAN0_ECC_CORRECTED_IRQ = 165, /*!< # */ ALT_INT_INTERRUPT_CAN0_ECC_UNCORRECTED_IRQ = 166, /*!< * Interrupts sourced from the CAN Controller 0. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_CAN1_STS_IRQ = 167, /*!< # */ ALT_INT_INTERRUPT_CAN1_MO_IRQ = 168, /*!< # */ ALT_INT_INTERRUPT_CAN1_ECC_CORRECTED_IRQ = 169, /*!< # */ ALT_INT_INTERRUPT_CAN1_ECC_UNCORRECTED_IRQ = 170, /*!< * Interrupts sourced from the CAN Controller 1. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_SDMMC_IRQ = 171, /*!< # */ ALT_INT_INTERRUPT_SDMMC_PORTA_ECC_CORRECTED = 172, /*!< # */ ALT_INT_INTERRUPT_SDMMC_PORTA_ECC_UNCORRECTED = 173, /*!< # */ ALT_INT_INTERRUPT_SDMMC_PORTB_ECC_CORRECTED = 174, /*!< # */ ALT_INT_INTERRUPT_SDMMC_PORTB_ECC_UNCORRECTED = 175, /*!< * Interrupts sourced from the SDMMC Controller. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_NAND_IRQ = 176, /*!< # */ ALT_INT_INTERRUPT_NANDR_ECC_CORRECTED_IRQ = 177, /*!< # */ ALT_INT_INTERRUPT_NANDR_ECC_UNCORRECTED_IRQ = 178, /*!< # */ ALT_INT_INTERRUPT_NANDW_ECC_CORRECTED_IRQ = 179, /*!< # */ ALT_INT_INTERRUPT_NANDW_ECC_UNCORRECTED_IRQ = 180, /*!< # */ ALT_INT_INTERRUPT_NANDE_ECC_CORRECTED_IRQ = 181, /*!< # */ ALT_INT_INTERRUPT_NANDE_ECC_UNCORRECTED_IRQ = 182, /*!< * Interrupts sourced from the NAND Controller. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_QSPI_IRQ = 183, /*!< # */ ALT_INT_INTERRUPT_QSPI_ECC_CORRECTED_IRQ = 184, /*!< # */ ALT_INT_INTERRUPT_QSPI_ECC_UNCORRECTED_IRQ = 185, /*!< * Interrupts sourced from the QSPI Controller. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_SPI0_IRQ = 186, /*!< # */ ALT_INT_INTERRUPT_SPI1_IRQ = 187, /*!< # */ ALT_INT_INTERRUPT_SPI2_IRQ = 188, /*!< # */ ALT_INT_INTERRUPT_SPI3_IRQ = 189, /*!< * Interrupts sourced from the SPI Controllers 0 - 3. * SPI0_IRQ corresponds to SPIM0. SPI1_IRQ corresponds to SPIM1. * SPI2_IRQ corresponds to SPIS0. SPI3_IRQ corresponds to SPIS1. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_I2C0_IRQ = 190, /*!< # */ ALT_INT_INTERRUPT_I2C1_IRQ = 191, /*!< # */ ALT_INT_INTERRUPT_I2C2_IRQ = 192, /*!< # */ ALT_INT_INTERRUPT_I2C3_IRQ = 193, /*!< * Interrupts sourced from the I2C Controllers 0 - 3. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_UART0 = 194, /*!< # */ ALT_INT_INTERRUPT_UART1 = 195, /*!< * Interrupts sourced from the UARTs 0 - 1. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_GPIO0 = 196, /*!< # */ ALT_INT_INTERRUPT_GPIO1 = 197, /*!< # */ ALT_INT_INTERRUPT_GPIO2 = 198, /*!< * Interrupts sourced from the GPIO 0 - 2. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_TIMER_L4SP_0_IRQ = 199, /*!< # */ ALT_INT_INTERRUPT_TIMER_L4SP_1_IRQ = 200, /*!< # */ ALT_INT_INTERRUPT_TIMER_OSC1_0_IRQ = 201, /*!< # */ ALT_INT_INTERRUPT_TIMER_OSC1_1_IRQ = 202, /*!< * Interrupts sourced from the Timer controllers. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_WDOG0_IRQ = 203, /*!< # */ ALT_INT_INTERRUPT_WDOG1_IRQ = 204, /*!< * Interrupts sourced from the Watchdog Timers 0 - 1. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_CLKMGR_IRQ = 205, /*!< * Interrupts sourced from the Clock Manager. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_MPUWAKEUP_IRQ = 206, /*!< * Interrupts sourced from the Clock Manager MPU Wakeup. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_FPGA_MAN_IRQ = 207, /*!< * Interrupts sourced from the FPGA Manager. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_NCTIIRQ0 = 208, /*!< # */ ALT_INT_INTERRUPT_NCTIIRQ1 = 209, /*!< * Interrupts sourced from the CoreSight for CPU0 and CPU1's CTI. * * All interrupts in this group are level triggered. */ ALT_INT_INTERRUPT_RAM_ECC_CORRECTED_IRQ = 210, /*!< # */ ALT_INT_INTERRUPT_RAM_ECC_UNCORRECTED_IRQ = 211 /*!< * Interrupts sourced from the On-chip RAM. * * All interrupts in this group are level triggered. */ } ALT_INT_INTERRUPT_t; /*! * This is the CPU target type. It is used to specify a set of CPUs on the * system. If only bit 0 is set then it specifies a set of CPUs containing * only CPU 0. Multiple CPUs can be specified by setting the appropriate bit * up to the number of CPUs on the system. */ typedef uint32_t alt_int_cpu_target_t; /*! * This type definition enumerates all the interrupt trigger types. */ typedef enum ALT_INT_TRIGGER_e { /*! * Edge triggered interrupt. This applies to Private Peripheral Interrupts * (PPI) and Shared Peripheral Interrupts (SPI) only, with interrupt IDs * 16 - 1019. */ ALT_INT_TRIGGER_EDGE, /*! * Level triggered interrupt. This applies to Private Peripheral * Interrupts (PPI) and Shared Peripheral Interrupts (SPI) only, with * interrupt IDs 16 - 1019. */ ALT_INT_TRIGGER_LEVEL, /*! * Software triggered interrupt. This applies to Software Generated * Interrupts (SGI) only, with interrupt IDs 0 - 15. */ ALT_INT_TRIGGER_SOFTWARE, /*! * All triggering types except for those in the Shared Peripheral Interrupts * (SPI) F2S FPGA family interrupts can be determined by the system * automatically. In all functions which ask for the triggering type, the * ALT_INT_TRIGGER_AUTODETECT can be used to select the correct trigger * type for all non F2S interrupt types. */ ALT_INT_TRIGGER_AUTODETECT, /*! * The interrupt triggering information is not applicable. This is possibly * due to querying an invalid interrupt identifier. */ ALT_INT_TRIGGER_NA } ALT_INT_TRIGGER_t; /*! * This type definition enumerates all the target list filter options. This is * used by the trigger Software Generated Interrupt (SGI) feature to issue a * SGI to the specified processor(s) in the system. Depending on the target * list filter and the target list, interrupts can be routed to any * combinations of CPUs. */ typedef enum ALT_INT_SGI_TARGET_e { /*! * This filter list uses the target list parameter to specify which CPUs * to send the interrupt to. If target list is 0, no interrupts are sent. */ ALT_INT_SGI_TARGET_LIST, /*! * This filter list sends the interrupt all CPUs except the current CPU. * The target list parameter is ignored. */ ALT_INT_SGI_TARGET_ALL_EXCL_SENDER, /*! * This filter list sends the interrupt to the current CPU only. The * target list parameter is ignored. */ ALT_INT_SGI_TARGET_SENDER_ONLY } ALT_INT_SGI_TARGET_t; /*! * Extracts the CPUID field from the ICCIAR register. */ #define ALT_INT_ICCIAR_CPUID_GET(icciar) ((icciar >> 10) & 0x7) /*! * Extracts the ACKINTID field from the ICCIAR register. */ #define ALT_INT_ICCIAR_ACKINTID_GET(icciar) (icciar & 0x3FF) /*! * The callback to use when an interrupt needs to be serviced. * * \param icciar The Interrupt Controller CPU Interrupt * Acknowledgement Register value (ICCIAR) value * corresponding to the current interrupt. * * \param context The user provided context. */ typedef void (*alt_int_callback_t)(uint32_t icciar, void * context); /*! * @} */ #ifdef __cplusplus } #endif #endif /* __ALT_INT_COMMON_H__ */
10,351
5,169
<gh_stars>1000+ { "name": "SwiftNatsNueve", "version": "5.0.0", "swift_versions": "5.0", "summary": "A Swift client for the NATS messaging system.", "description": "Swift 5.0 client for NATS, the cloud native messaging system. https://nats.io", "homepage": "https://github.com/mrsnow-git/SwiftNats", "license": { "type": "MIT", "file": "LICENSE" }, "authors": { "mrsnow": "<EMAIL>" }, "social_media_url": "https://instagram.com/chocosnow", "platforms": { "ios": "11.0" }, "source": { "git": "https://github.com/mrsnow-git/SwiftNats.git", "tag": "5.0.0" }, "source_files": [ "Sources", "Sources/**/*.{h,m}" ], "requires_arc": true, "swift_version": "5.0" }
321
1,851
// // VROARAnchor.h // ViroKit // // Created by <NAME> on 6/6/17. // Copyright © 2017 Viro Media. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef VROARAnchor_h #define VROARAnchor_h #include "VROMatrix4f.h" #include "VROVector3f.h" #include "VROQuaternion.h" #include "VROARNode.h" /* Anchors are real world objects detected by the AR engine. Each time an anchor is detected, the VROARSessionDelegate is given an opportunity to create a VRONode with virtual content to attach to that anchor. The ARSession will thereafter ensure that the virtual content is fused with the real-world anchor, thereby enabling applications to 'augment' reality with virtual content. For example, if a plane anchor is detected, the can use its corresponding VRONode to place virtual objects for a table-top game. Anchors are regularly updated by the AR engine as the characteristics of the anchor are further refined: for example, the AR engine may start with an approximation of a surface, and later determine the surface's width and height. VROARAnchor is subclassed by specific anchor types; planes, image targets, etc. */ class VROARAnchor : public std::enable_shared_from_this<VROARAnchor> { public: /* Create a new anchor. */ VROARAnchor() {} virtual ~VROARAnchor() {} /* String representing the ID of the anchor in the underlying platform (ARKit/ARCore). */ std::string getId() const { return _id; } void setId(std::string id) { _id = id; } /* Transformation matrix encoding the position, orientation and scale of the anchor in world coordinates. */ VROMatrix4f getTransform() const { return _transform; }; void setTransform(VROMatrix4f transform) { _transform = transform; } /* The node associated with the anchor. Updated alongside the anchor. */ const std::shared_ptr<VROARNode> getARNode() const { return _node; } void setARNode(std::shared_ptr<VROARNode> node) { _node = node; updateNodeTransform(); } /* Get the anchor that's associated with the real-world object. On ARKit this is simply this anchor itself; while on ARCore the anchors have attached 'trackable' anchors. */ virtual std::shared_ptr<VROARAnchor> getAnchorForTrackable() { return shared_from_this(); } /* Update the anchor's node's transforms given the data in the anchor. */ void updateNodeTransform() { if (_node && !_node->shouldPauseUpdates()) { VROVector3f scale = getTransform().extractScale(); VROQuaternion rotation = getTransform().extractRotation(scale); VROVector3f position = getTransform().extractTranslation(); _node->setScale(scale); _node->setRotation(rotation); _node->setPosition(position); } } private: std::string _id; VROMatrix4f _transform; /* The node associated with this anchor. There is an *intentional* strong reference cycle between VROARNode and VROARAnchor. Anchors and ARNodes are managed in one of two ways: 1. By the AR subsystem (ARCore). When anchors are bound to trackables, and the bound trackable disappears, VROARSessionARCore will remove the corresponding VROARAnchor and its VROARNode. 2. Manually, by attaching anchors to hit results. In this case, anchors and nodes are removed together when the ARNode is detached from the system (see ARNode.detach() in Java). */ std::shared_ptr<VROARNode> _node; }; #endif /* VROARAnchor_h */
1,633
308
/* * Automatically generated by genbuiltins.py, do not edit! */ #include "duk_internal.h" #if defined(DUK_USE_ASSERTIONS) #define DUK__REFCINIT(refc) 0 /*h_assert_refcount*/, (refc) /*actual*/ #else #define DUK__REFCINIT(refc) (refc) /*actual*/ #endif #if defined(DUK_USE_ROM_STRINGS) #error ROM support not enabled, rerun configure.py with --rom-support #else /* DUK_USE_ROM_STRINGS */ DUK_INTERNAL const duk_uint8_t duk_strings_data[967] = { 79,40,209,144,168,105,6,78,54,139,89,185,44,48,46,90,120,8,154,140,35,103, 35,113,193,73,5,52,112,180,104,166,135,52,188,4,98,12,27,146,156,80,211,31, 129,115,150,64,52,220,109,24,18,68,156,24,38,67,114,36,55,9,119,151,132, 140,93,18,113,128,153,201,212,201,205,2,248,8,196,24,224,104,82,146,40,224, 193,48,114,168,37,147,196,54,123,28,4,98,12,43,148,67,103,177,192,70,32, 196,121,68,54,123,28,18,192,199,144,124,4,98,12,43,136,108,244,117,184,8, 196,24,95,40,134,207,71,91,128,140,65,133,113,13,158,158,151,1,24,131,11, 229,16,217,233,233,112,17,136,48,206,21,110,4,244,244,184,8,196,24,103,10, 183,2,122,218,156,4,98,12,24,203,112,64,179,113,193,79,8,218,155,131,32, 184,70,212,220,13,10,82,68,252,123,144,217,146,38,228,207,18,0,100,37,64, 178,212,11,161,17,104,162,96,10,200,193,57,165,65,169,16,5,100,81,27,70,18, 32,10,200,68,185,13,116,221,197,184,64,89,57,41,197,13,49,234,5,208,156, 113,87,55,118,147,20,187,56,161,166,92,221,212,73,210,236,226,134,153,115, 119,76,201,203,179,138,26,99,73,212,136,136,164,25,174,137,56,32,72,137, 101,23,52,45,13,34,86,9,79,136,104,201,114,149,96,52,138,134,140,151,75, 226,233,186,120,121,22,39,54,83,141,5,55,68,236,36,164,3,16,225,115,150,64, 52,205,163,2,72,154,83,138,26,99,75,12,11,150,103,5,36,20,211,70,140,133, 67,72,49,241,160,227,81,196,52,168,106,39,132,252,183,136,105,80,212,79,2, 249,110,128,126,88,95,133,109,237,237,237,151,235,127,46,249,119,203,190, 186,206,33,181,2,208,61,190,12,19,34,65,19,81,132,108,228,97,1,107,33,12, 32,45,100,137,64,247,175,9,19,155,41,198,130,155,134,69,146,100,227,226, 231,146,51,192,204,73,140,224,145,221,102,241,68,196,169,248,30,75,12,11, 151,242,233,187,143,138,24,137,162,164,255,253,63,3,201,97,129,114,254,92, 112,75,136,108,166,6,136,159,255,167,224,121,44,48,46,95,203,166,238,74, 113,67,77,201,128,223,255,223,224,121,44,48,46,95,203,145,46,9,205,16,39, 201,62,36,0,192,21,147,255,238,145,39,199,197,211,116,240,242,113,197,78, 214,211,226,233,187,107,105,19,119,37,56,161,166,52,221,212,201,205,36,240, 242,16,96,152,12,178,52,211,56,228,73,150,83,0,148,39,137,75,67,73,198,209, 129,36,85,185,201,196,2,32,193,48,17,160,97,16,84,44,156,104,24,67,189,200, 108,201,19,238,114,96,137,137,50,238,113,164,188,211,185,192,226,100,19, 134,68,110,112,174,139,0,185,31,115,149,4,88,7,159,115,146,117,34,34,35, 115,143,22,146,208,210,19,115,140,3,207,185,202,130,36,109,85,185,194,161, 160,90,50,72,155,115,149,2,232,67,137,204,122,22,66,161,175,164,210,72,199, 130,137,1,50,32,145,143,38,120,186,195,35,106,51,146,230,8,36,77,109,65,38, 226,72,159,191,189,181,70,140,133,222,249,212,227,66,125,245,187,251,219, 77,3,119,190,117,56,208,159,125,110,254,246,210,26,93,239,157,78,52,39,223, 93,191,189,180,212,52,187,223,58,156,104,79,190,187,127,123,104,180,104, 183,190,117,56,208,159,125,102,254,209,104,209,124,234,113,161,62,250,80, 196,128,81,4,9,16,162,4,196,116,9,205,154,27,66,32,100,13,12,98,68,227,33, 65,69,204,195,34,201,50,8,110,33,23,34,28,168,104,22,188,12,174,138,11,70, 138,104,115,68,130,137,13,82,27,41,129,162,35,138,54,146,198,137,39,72,180, 210,178,38,35,146,103,68,139,51,197,214,28,227,131,79,15,35,138,58,130,37, 19,155,41,146,174,64,203,99,161,100,37,145,51,148,75,4,164,66,54,140,49,46, 247,70,103,37,230,70,142,70,67,30,232,204,178,163,201,18,54,139,89,39,26, 16,165,2,228,69,33,143,89,24,70,206,73,67,102,72,148,2,32,214,73,157,224, 18,128,98,29,241,69,65,50,37,241,116,200,41,144,102,125,2,180,8,210,152,38, 129,23,8,34,198, }; #endif /* DUK_USE_ROM_STRINGS */ #if defined(DUK_USE_ROM_OBJECTS) #error ROM support not enabled, rerun configure.py with --rom-support #else /* DUK_USE_ROM_OBJECTS */ /* native functions: 183 */ DUK_INTERNAL const duk_c_function duk_bi_native_functions[183] = { NULL, duk_bi_array_constructor, duk_bi_array_constructor_is_array, duk_bi_array_prototype_concat, duk_bi_array_prototype_indexof_shared, duk_bi_array_prototype_iter_shared, duk_bi_array_prototype_join_shared, duk_bi_array_prototype_pop, duk_bi_array_prototype_push, duk_bi_array_prototype_reduce_shared, duk_bi_array_prototype_reverse, duk_bi_array_prototype_shift, duk_bi_array_prototype_slice, duk_bi_array_prototype_sort, duk_bi_array_prototype_splice, duk_bi_array_prototype_to_string, duk_bi_array_prototype_unshift, duk_bi_arraybuffer_constructor, duk_bi_arraybuffer_isview, duk_bi_boolean_constructor, duk_bi_boolean_prototype_tostring_shared, duk_bi_buffer_compare_shared, duk_bi_buffer_readfield, duk_bi_buffer_slice_shared, duk_bi_buffer_writefield, duk_bi_dataview_constructor, duk_bi_date_constructor, duk_bi_date_constructor_now, duk_bi_date_constructor_parse, duk_bi_date_constructor_utc, duk_bi_date_prototype_get_shared, duk_bi_date_prototype_get_timezone_offset, duk_bi_date_prototype_set_shared, duk_bi_date_prototype_set_time, duk_bi_date_prototype_to_json, duk_bi_date_prototype_toprimitive, duk_bi_date_prototype_tostring_shared, duk_bi_date_prototype_value_of, duk_bi_duktape_object_act, duk_bi_duktape_object_compact, duk_bi_duktape_object_dec, duk_bi_duktape_object_enc, duk_bi_duktape_object_fin, duk_bi_duktape_object_gc, duk_bi_duktape_object_info, duk_bi_error_constructor_shared, duk_bi_error_prototype_filename_getter, duk_bi_error_prototype_filename_setter, duk_bi_error_prototype_linenumber_getter, duk_bi_error_prototype_linenumber_setter, duk_bi_error_prototype_stack_getter, duk_bi_error_prototype_stack_setter, duk_bi_error_prototype_to_string, duk_bi_function_constructor, duk_bi_function_prototype, duk_bi_function_prototype_apply, duk_bi_function_prototype_bind, duk_bi_function_prototype_call, duk_bi_function_prototype_hasinstance, duk_bi_function_prototype_to_string, duk_bi_global_object_decode_uri, duk_bi_global_object_decode_uri_component, duk_bi_global_object_encode_uri, duk_bi_global_object_encode_uri_component, duk_bi_global_object_escape, duk_bi_global_object_eval, duk_bi_global_object_is_finite, duk_bi_global_object_is_nan, duk_bi_global_object_parse_float, duk_bi_global_object_parse_int, duk_bi_global_object_unescape, duk_bi_json_object_parse, duk_bi_json_object_stringify, duk_bi_math_object_clz32, duk_bi_math_object_hypot, duk_bi_math_object_imul, duk_bi_math_object_max, duk_bi_math_object_min, duk_bi_math_object_onearg_shared, duk_bi_math_object_random, duk_bi_math_object_sign, duk_bi_math_object_twoarg_shared, duk_bi_native_function_length, duk_bi_native_function_name, duk_bi_nodejs_buffer_byte_length, duk_bi_nodejs_buffer_concat, duk_bi_nodejs_buffer_constructor, duk_bi_nodejs_buffer_copy, duk_bi_nodejs_buffer_fill, duk_bi_nodejs_buffer_is_buffer, duk_bi_nodejs_buffer_is_encoding, duk_bi_nodejs_buffer_tojson, duk_bi_nodejs_buffer_tostring, duk_bi_nodejs_buffer_write, duk_bi_number_check_shared, duk_bi_number_constructor, duk_bi_number_prototype_to_exponential, duk_bi_number_prototype_to_fixed, duk_bi_number_prototype_to_locale_string, duk_bi_number_prototype_to_precision, duk_bi_number_prototype_to_string, duk_bi_number_prototype_value_of, duk_bi_object_constructor, duk_bi_object_constructor_assign, duk_bi_object_constructor_create, duk_bi_object_constructor_define_properties, duk_bi_object_constructor_define_property, duk_bi_object_constructor_get_own_property_descriptor, duk_bi_object_constructor_is, duk_bi_object_constructor_is_extensible, duk_bi_object_constructor_is_sealed_frozen_shared, duk_bi_object_constructor_keys_shared, duk_bi_object_constructor_prevent_extensions, duk_bi_object_constructor_seal_freeze_shared, duk_bi_object_getprototype_shared, duk_bi_object_prototype_defineaccessor, duk_bi_object_prototype_has_own_property, duk_bi_object_prototype_is_prototype_of, duk_bi_object_prototype_lookupaccessor, duk_bi_object_prototype_property_is_enumerable, duk_bi_object_prototype_to_locale_string, duk_bi_object_prototype_to_string, duk_bi_object_prototype_value_of, duk_bi_object_setprototype_shared, duk_bi_performance_now, duk_bi_pointer_constructor, duk_bi_pointer_prototype_tostring_shared, duk_bi_proxy_constructor, duk_bi_reflect_apply, duk_bi_reflect_construct, duk_bi_reflect_object_delete_property, duk_bi_reflect_object_get, duk_bi_reflect_object_has, duk_bi_reflect_object_set, duk_bi_regexp_constructor, duk_bi_regexp_prototype_exec, duk_bi_regexp_prototype_flags, duk_bi_regexp_prototype_shared_getter, duk_bi_regexp_prototype_test, duk_bi_regexp_prototype_tostring, duk_bi_string_constructor, duk_bi_string_constructor_from_char_code, duk_bi_string_constructor_from_code_point, duk_bi_string_prototype_caseconv_shared, duk_bi_string_prototype_char_at, duk_bi_string_prototype_char_code_at, duk_bi_string_prototype_concat, duk_bi_string_prototype_includes, duk_bi_string_prototype_indexof_shared, duk_bi_string_prototype_locale_compare, duk_bi_string_prototype_match, duk_bi_string_prototype_repeat, duk_bi_string_prototype_replace, duk_bi_string_prototype_search, duk_bi_string_prototype_slice, duk_bi_string_prototype_split, duk_bi_string_prototype_startswith_endswith, duk_bi_string_prototype_substr, duk_bi_string_prototype_substring, duk_bi_string_prototype_to_string, duk_bi_string_prototype_trim, duk_bi_symbol_constructor_shared, duk_bi_symbol_key_for, duk_bi_symbol_toprimitive, duk_bi_symbol_tostring_shared, duk_bi_textdecoder_constructor, duk_bi_textdecoder_prototype_decode, duk_bi_textdecoder_prototype_shared_getter, duk_bi_textencoder_constructor, duk_bi_textencoder_prototype_encode, duk_bi_textencoder_prototype_encoding_getter, duk_bi_thread_constructor, duk_bi_thread_current, duk_bi_thread_resume, duk_bi_thread_yield, duk_bi_type_error_thrower, duk_bi_typedarray_buffer_getter, duk_bi_typedarray_bytelength_getter, duk_bi_typedarray_byteoffset_getter, duk_bi_typedarray_constructor, duk_bi_typedarray_set, duk_bi_uint8array_allocplain, duk_bi_uint8array_plainof, }; #if defined(DUK_USE_DOUBLE_LE) DUK_INTERNAL const duk_uint8_t duk_builtins_data[4251] = { 144,148,105,225,32,68,52,228,126,12,104,201,37,132,52,167,194,138,105,244, 124,57,28,211,57,18,64,52,238,254,44,138,111,171,241,164,19,87,137,30,33, 167,18,145,159,8,211,137,9,225,42,5,240,145,139,163,163,8,211,137,10,228, 64,211,19,132,140,93,29,56,70,156,72,119,34,66,146,36,104,137,194,70,46, 142,172,35,78,36,47,146,195,102,11,240,145,139,163,175,8,211,137,9,228,240, 242,112,145,139,163,179,8,211,137,8,237,34,130,118,49,116,118,225,26,48,0, 1,94,29,201,158,46,183,39,135,147,132,140,93,16,132,76,66,33,8,66,16,132, 33,8,66,26,180,41,97,167,64,150,34,33,154,112,0,1,87,247,35,79,103,237,198, 174,216,47,31,23,95,17,13,31,217,96,211,49,50,53,212,77,141,24,0,0,179,10, 228,240,242,15,128,140,65,128,134,188,0,0,89,167,97,181,224,0,2,205,62,53, 224,0,2,205,66,237,120,0,0,179,81,204,107,192,0,5,154,150,67,94,0,0,44,212, 245,90,240,0,1,102,169,162,215,128,0,11,53,93,150,188,0,0,89,171,111,53, 108,150,163,70,0,0,42,2,249,50,94,124,35,68,225,146,49,13,24,0,0,165,161, 124,153,47,62,12,130,112,201,24,132,56,97,115,16,0,0,0,0,0,0,62,31,243,48, 0,0,0,0,0,0,60,31,242,241,32,26,193,55,132,112,161,156,72,135,26,41,200, 140,114,163,156,201,7,56,79,9,80,47,132,140,93,19,160,43,145,3,76,78,18,49, 116,78,144,238,68,133,36,72,209,19,132,140,93,19,168,47,146,195,102,11,240, 145,139,162,117,132,242,120,121,56,72,197,209,59,2,59,72,160,157,140,93,19, 181,36,242,50,143,36,31,131,162,166,7,144,238,133,227,226,235,224,242,161, 249,18,21,100,20,207,44,199,151,180,122,89,135,152,154,121,153,199,156,158, 121,218,7,158,162,121,250,71,160,166,122,26,135,162,170,122,58,199,164,16, 240,70,68,226,27,51,199,138,120,35,34,112,171,112,38,121,1,124,153,47,62, 17,162,112,201,19,211,11,228,201,121,240,100,19,134,72,158,160,91,201,18, 186,44,3,68,79,122,168,151,115,165,40,21,18,227,65,198,231,200,8,68,184,84, 53,19,38,120,128,145,144,78,25,59,72,163,48,64,144,200,39,12,157,164,80,46, 185,143,115,72,217,230,72,9,35,68,225,147,180,138,51,68,9,17,162,112,201, 218,69,2,235,152,247,52,141,158,108,128,98,72,64,121,51,132,4,81,164,144, 128,242,104,136,0,16,92,38,14,49,39,199,197,211,116,240,242,113,197,231,18, 53,189,116,65,131,18,124,117,155,199,197,207,36,103,142,12,146,20,80,249, 186,60,116,4,204,73,241,214,111,31,23,60,145,158,56,208,48,146,229,146,3,2, 82,65,155,195,94,3,10,36,4,201,196,64,56,100,42,26,78,62,46,121,35,60,113, 152,16,25,10,134,147,143,139,158,72,205,4,151,21,0,73,16,11,230,144,12,88, 144,153,39,52,144,69,241,37,72,217,240,151,153,27,36,57,178,230,16,16,137, 114,68,2,200,62,81,1,8,151,11,23,100,141,229,18,6,34,92,37,230,70,201,1,89, 57,36,2,40,152,151,44,129,83,18,124,117,155,199,197,207,36,103,142,75,12, 11,151,46,89,40,18,37,200,64,12,154,236,252,238,185,23,95,213,1,132,234,0, 194,245,128,14,56,37,199,89,188,124,92,242,70,120,232,16,26,137,113,241, 116,221,60,60,156,113,122,36,10,62,46,121,35,60,113,18,225,27,70,18,32,10, 201,211,32,67,107,104,100,42,26,78,24,147,153,35,181,181,207,64,67,107,104, 100,42,26,78,72,147,153,35,181,181,207,68,16,218,218,91,156,170,63,134,36, 230,72,237,109,116,136,16,218,218,91,156,170,63,146,36,230,72,237,109,116, 137,16,96,128,228,2,6,191,46,3,71,147,68,4,16,22,188,169,240,16,40,104,242, 135,198,171,44,68,65,5,217,231,215,6,231,62,188,8,49,1,3,162,92,4,98,12,41, 7,33,148,53,242,128,97,32,130,3,9,205,16,38,199,198,14,9,0,111,115,225,0,8, 250,72,240,207,128,241,37,73,25,18,40,0,178,58,11,56,192,2,201,104,17,35, 160,9,39,70,114,8,6,147,214,129,18,74,240,30,141,145,208,89,203,62,3,161, 163,37,248,226,185,244,11,88,37,62,33,163,37,248,226,185,252,0,127,255,130, 146,164,142,32,26,1,36,230,18,1,164,7,43,163,194,0,71,128,105,64,216,7,192, 52,192,197,66,230,72,192,52,224,209,32,232,34,68,62,129,113,32,232,34,114, 40,49,231,16,254,0,63,255,208,99,2,140,44,92,206,8,224,143,4,225,147,210, 124,13,44,92,206,9,195,39,30,228,54,126,163,225,200,169,198,133,42,166,191, 246,3,11,251,0,24,71,4,120,9,251,8,10,17,193,30,9,195,39,1,63,105,1,98,112, 201,199,185,13,159,1,63,105,32,48,156,209,2,126,227,224,58,26,50,95,142,47, 192,208,22,176,74,124,67,70,75,241,197,248,26,64,213,184,64,89,56,39,49, 224,137,62,36,2,176,19,17,254,68,3,196,143,88,4,79,162,0,210,32,34,35,253, 72,5,146,208,34,125,144,5,147,214,137,253,208,9,149,3,41,197,13,55,233,0, 185,187,139,117,137,30,8,18,39,172,1,25,187,139,112,128,178,113,110,177,35, 193,2,68,245,128,23,55,114,143,121,35,193,2,68,245,130,8,205,220,91,132,5, 147,148,123,201,30,8,18,39,172,16,18,113,67,63,128,3,68,143,32,39,243,32, 42,83,4,103,46,89,19,63,224,208,16,70,142,92,178,38,127,193,164,8,67,68, 186,12,146,247,154,1,165,64,202,113,252,160,131,32,7,35,167,26,50,235,231, 130,48,179,192,65,148,69,19,214,2,251,85,2,232,72,31,255,255,255,255,255, 253,239,226,122,196,55,106,160,93,9,0,4,0,0,0,0,0,0,3,49,0,0,0,0,0,0,3,225, 252,143,94,233,34,104,169,54,144,210,161,168,158,32,0,0,0,0,0,0,120,63,145, 235,72,96,77,21,38,210,26,84,53,19,196,0,0,0,0,0,0,15,15,240,253,35,228, 133,185,176,0,0,0,0,0,0,44,15,8,117,128,190,212,128,82,109,33,179,33,137, 24,31,255,255,255,255,255,231,232,100,58,196,55,106,64,41,54,144,217,144, 196,140,15,255,255,255,255,255,243,252,49,15,4,100,78,33,179,60,120,167, 130,50,39,10,183,2,103,144,113,8,151,10,134,162,100,221,16,18,137,113,13, 153,12,72,238,137,1,81,46,52,28,110,232,148,53,18,228,128,82,113,13,153,12, 72,238,137,142,73,78,52,0,0,0,0,0,0,0,0,8,58,254,1,12,38,248,134,23,130,0, 60,221,194,162,228,30,244,128,217,187,132,187,220,210,54,104,2,247,132,5, 205,220,124,72,36,73,14,110,252,132,25,128,193,94,8,200,149,200,3,237,38, 43,31,192,54,186,213,128,57,45,56,210,0,0,0,0,0,0,62,31,241,90,251,224,6, 77,220,24,38,78,74,113,67,77,124,16,50,110,228,208,194,114,83,138,26,107, 224,172,37,240,97,41,187,139,112,128,178,112,96,153,57,41,197,13,53,240, 113,41,187,139,112,128,178,114,104,97,57,41,197,13,53,240,128,195,95,8,44, 61,240,132,216,93,33,133,192,128,14,98,79,147,67,9,129,0,44,196,159,11,69, 175,152,32,35,100,33,135,24,147,237,38,34,246,139,95,48,64,70,200,68,8,49, 39,198,57,179,61,144,138,22,98,79,180,152,153,215,54,103,178,17,129,204,73, 240,96,153,44,132,112,163,18,125,164,196,62,130,100,178,18,1,140,73,240,96, 197,144,146,18,98,79,180,152,135,208,98,200,74,8,49,39,195,186,145,149,144, 150,22,98,79,180,152,143,215,82,50,178,19,2,140,73,241,136,109,38,73,89,9, 161,166,36,251,73,137,157,67,105,50,74,200,78,10,49,39,201,16,78,104,229, 100,39,134,152,147,237,38,41,116,130,115,71,43,33,64,60,196,159,24,133,173, 18,32,156,209,202,200,81,18,49,39,218,76,76,234,22,180,72,130,115,71,43,33, 72,68,196,159,38,134,19,46,105,56,226,150,68,157,160,1,228,73,242,104,97, 46,16,31,34,79,140,66,214,137,16,78,104,229,108,169,137,72,147,237,38,38, 117,11,90,36,65,57,163,149,178,168,21,34,79,146,32,156,209,202,218,250,161, 178,36,251,73,138,93,32,156,209,202,218,250,193,82,36,248,196,54,147,36, 173,191,174,27,34,79,180,152,153,212,54,147,36,173,191,176,17,34,79,135, 117,35,43,115,236,133,200,147,237,38,35,245,212,140,173,207,180,15,34,79, 131,4,201,108,173,133,72,147,237,38,33,244,19,37,178,184,17,34,79,140,115, 102,123,107,238,133,200,147,237,38,38,117,205,153,237,175,188,23,34,79,133, 162,215,204,16,17,182,254,248,116,137,62,210,98,47,104,181,243,4,4,109,191, 192,131,152,147,230,8,8,217,12,16,60,137,62,96,128,141,178,193,181,55,136, 200,51,128,114,108,28,100,128,0,0,0,0,0,0,0,12,110,127,32,98,115,249,73, 117,243,249,67,21,159,202,38,47,63,148,86,8,75,144,94,50,1,38,73,79,204,67, 95,231,1,6,128,14,79,129,185,40,249,18,149,181,207,142,199,155,172,248,172, 89,183,207,140,198,137,175,200,0,159,72,10,5,21,220,138,120,74,129,124,36, 98,232,228,74,81,62,160,20,10,107,185,21,114,32,105,137,194,70,46,142,68, 165,19,235,1,64,170,187,145,119,34,66,146,36,104,137,194,70,46,142,68,165, 19,236,1,64,174,187,145,95,37,134,204,23,225,35,23,71,34,82,137,246,128, 160,89,93,200,167,147,195,201,194,70,46,142,68,165,19,238,1,64,182,187,145, 71,105,20,19,177,139,163,145,41,68,16,7,6,15,82,70,72,115,96,0,0,0,0,0,118, 105,160,91,60,165,195,201,194,8,134,149,216,130,0,192,41,224,136,2,48,176, 228,1,149,13,195,15,0,200,209,97,71,128,99,32,176,131,192,113,57,143,0,167, 131,32,230,80,28,202,139,175,237,2,48,189,160,20,1,119,48,87,193,186,129, 89,56,72,197,209,200,193,185,35,23,71,109,13,219,36,98,232,237,156,13,26, 208,211,14,102,19,87,137,91,95,128,0,10,64,24,92,0,0,82,2,53,63,240,49,204, 202,10,14,38,78,44,141,52,207,31,0,0,22,32,129,100,180,8,148,145,78,102, 152,80,113,50,113,100,105,166,120,248,0,0,177,1,65,196,201,199,20,178,36, 227,224,0,2,200,3,6,133,41,35,31,0,0,22,1,44,57,137,62,33,179,216,162,152, 192,131,18,124,162,27,61,138,41,108,32,196,159,16,217,232,235,81,76,104,73, 137,62,81,13,158,142,181,20,184,16,98,79,136,108,244,244,168,166,56,36,196, 159,40,134,207,79,74,138,93,10,49,39,194,173,192,158,158,149,20,188,20,98, 79,133,91,129,61,109,74,41,124,30,68,159,16,217,236,83,108,96,68,137,62,81, 13,158,197,54,182,17,34,79,136,108,244,117,169,182,52,38,68,159,40,134,207, 71,90,155,92,8,145,39,196,54,122,122,84,219,28,19,34,79,148,67,103,167,165, 77,174,133,72,147,225,86,224,79,79,74,155,94,10,145,39,194,173,192,158,182, 165,54,190,206,25,212,35,208,226,100,150,211,201,29,162,44,140,35,103,0,0, 0,0,0,0,3,192,252,206,25,228,35,208,226,100,150,211,201,29,162,44,140,35, 103,0,0,0,0,0,0,3,192,252,206,25,244,35,208,226,100,150,211,201,29,162,44, 140,35,103,0,0,0,0,0,0,3,192,252,206,26,4,35,208,226,100,150,211,201,29, 162,44,140,35,103,0,0,0,0,0,0,0,1,0,206,26,20,35,208,226,100,150,211,201, 29,162,44,140,35,103,0,0,0,0,0,0,0,1,0,206,26,36,35,208,226,100,150,211, 201,29,162,44,140,35,103,0,0,0,0,0,0,0,65,0,206,26,52,35,208,226,100,150, 211,201,29,162,44,140,35,103,0,0,0,0,0,0,0,65,0,206,26,68,35,208,226,100, 150,211,201,29,162,44,140,35,103,0,0,0,0,0,0,0,65,0,206,26,84,35,208,226, 100,150,211,201,29,162,44,140,35,103,0,0,0,0,0,0,0,129,0,195,154,99,16,38, 36,0,251,68,117,179,216,162,128,68,72,1,241,13,158,197,20,150,25,18,0,125, 162,58,217,232,235,117,100,162,136,25,18,0,125,162,58,217,232,235,116,36, 162,145,2,226,64,15,136,108,244,117,186,178,81,73,129,113,32,7,196,54,122, 58,221,9,40,165,64,200,144,3,237,17,214,207,79,75,171,37,20,80,200,144,3, 237,17,214,207,79,75,161,37,20,138,23,18,0,124,67,103,167,165,213,146,138, 77,11,137,0,62,33,179,211,210,232,73,69,42,133,196,128,31,10,183,2,125,89, 40,163,5,196,128,31,10,183,2,125,9,40,164,96,200,144,3,224,221,64,172,157, 89,40,163,134,68,128,31,6,234,5,100,232,73,69,35,133,68,128,31,104,142,182, 125,89,40,180,0,168,144,3,237,17,214,207,161,37,22,144,19,18,0,124,67,103, 213,146,139,80,9,137,0,62,33,179,232,73,69,172,5,90,40,153,59,68,117,179, 216,166,192,77,162,137,147,136,108,246,41,180,176,219,69,19,39,104,142,182, 122,58,221,89,41,178,6,218,40,153,59,68,117,179,209,214,232,73,77,162,6,90, 40,153,56,134,207,71,91,171,37,54,152,25,104,162,100,226,27,61,29,110,132, 148,218,160,109,162,137,147,180,71,91,61,61,46,172,148,217,67,109,20,76, 157,162,58,217,233,233,116,36,166,209,67,45,20,76,156,67,103,167,165,213, 146,155,77,12,180,81,50,113,13,158,158,151,66,74,109,84,50,209,68,201,194, 173,192,159,86,74,108,193,150,138,38,78,21,110,4,250,18,83,104,193,182,138, 38,78,13,212,10,201,213,146,155,56,109,162,137,147,131,117,2,178,116,36, 166,209,194,237,20,76,157,162,58,217,245,100,167,16,2,237,20,76,157,162,58, 217,244,36,167,18,2,173,20,76,156,67,103,213,146,156,80,10,180,81,50,113, 13,159,66,74,113,97,175,220,48,216,109,192,4,42,22,189,163,0,196,133,0,185, 80,32,28,78,99,193,18,80,36,4,19,159,141,156,0,178,90,4,74,73,0,22,209,68, 201,185,129,4,2,8,3,132,64,60,36,6,149,113,72,176,171,240,84,0,157,91,116, 116,32,11,42,218,221,216,181,129,32,3,234,219,165,3,188,231,235,249,8,187, 152,252,47,86,227,105,18,7,244,17,91,42,56,175,185,248,110,173,198,209,208, 36,0,238,82,97,87,188,189,179,240,93,122,32,12,22,162,42,125,144,132,160,7, 236,161,25,232,237,105,64,205,59,127,102,158,160,230,63,11,217,66,51,210, 129,154,118,254,205,61,65,236,127,171,197,34,168,48,6,90,162,1,0,39,75,84, 72,8,9,33,186,162,80,64,76,13,213,19,2,130,96,110,150,181,0,65,6,51,213,20, 128,65,17,11,213,19,130,137,121,211,210,210,144,6,39,75,84,80,0,201,119, 234,138,8,41,86,231,71,84,80,129,79,135,186,122,101,224,34,25,69,233,208,3, 91,141,170,40,96,139,113,180,181,69,36,21,110,54,142,134,168,165,1,176,23, 212,47,0,216,134,234,87,128,111,117,181,168,128,209,3,70,230,106,192,5,139, 168,209,234,138,32,36,144,102,235,8,3,146,27,170,40,160,146,132,103,170,40, 192,115,3,117,69,28,22,113,163,69,170,41,103,1,66,188,17,145,52,104,4,202, 113,67,76,130,227,72,194,13,240,108,0,0,83,96,0,2,185,0,104,146,84,97,48,0, 1,90,192,56,169,24,145,179,192,0,5,96,8,56,16,32,128,56,18,52,125,198,86, 147,186,140,28,50,21,13,39,31,23,60,145,158,56,204,141,47,121,6,155,190, 188,24,49,39,199,89,188,124,92,242,70,120,224,201,33,69,15,155,163,199,68, 14,49,39,199,197,211,116,240,242,113,197,231,18,180,254,4,3,17,46,18,243, 35,100,128,172,156,146,70,163,150,76,34,248,146,164,108,248,75,204,141,146, 28,217,115,9,27,79,11,241,173,235,162,160,224,200,2,206,9,113,13,148,192, 209,18,22,164,146,37,193,57,162,4,249,39,196,128,24,2,178,66,213,136,68, 201,16,77,209,131,31,192,242,88,96,92,191,151,34,100,136,38,232,255,252,92, 221,199,197,12,68,209,82,66,212,11,155,185,41,197,13,55,38,3,66,213,47,131, 250,72,12,162,99,133,116,127,196,32,225,1,3,34,92,170,9,105,164,32,225,64, 131,156,1,193,133,7,19,39,22,70,154,103,143,128,0,11,16,20,28,76,156,113, 75,34,78,62,0,0,44,128,48,104,82,146,49,240,0,1,96,11,180,192,0,5,162,1,18, 160,65,24,131,20,145,25,188,48,132,122,28,76,146,218,121,35,180,69,145,132, 108,224,0,0,0,0,0,0,120,31,153,188,56,132,122,28,76,146,218,121,35,180,69, 145,132,108,224,0,0,0,0,0,0,120,31,168,160,45,110,23,30,176,33,184,0,0,181, 32,29,235,2,27,199,23,0,0,22,196,51,120,129,8,244,56,153,37,180,242,71,104, 139,35,8,217,192,0,0,0,0,0,0,240,63,51,120,145,8,244,56,153,37,180,242,71, 104,139,35,8,217,192,0,0,0,0,0,0,0,64,51,120,161,8,244,56,153,37,180,242, 71,104,139,35,8,217,192,0,0,0,0,0,0,0,64,51,120,177,8,244,56,153,37,180, 242,71,104,139,35,8,217,192,0,0,0,0,0,0,16,64,51,120,193,8,244,56,153,37, 180,242,71,104,139,35,8,217,192,0,0,0,0,0,0,16,64,51,120,209,8,244,56,153, 37,180,242,71,104,139,35,8,217,192,0,0,0,0,0,0,16,64,51,120,225,8,244,56, 153,37,180,242,71,104,139,35,8,217,192,0,0,0,0,0,0,32,64,32,227,194,0,97, 57,162,4,246,40,5,34,92,35,68,225,161,166,219,16,16,137,112,52,41,73,29, 169,1,65,196,201,197,145,166,153,246,8,3,137,204,120,34,74,8,200,58,128,28, 211,160,130,52,78,26,26,110,248,0,0,170,4,12,70,137,195,38,0,0,42,68,159,7, 84,3,154,150,16,70,137,195,67,77,223,0,0,20,224,20,160,152,23,223,0,0,20, 226,9,65,154,232,147,161,115,59,224,0,2,156,84,12,50,9,195,38,0,0,41,133, 30,224,32,54,186,221,128,60, }; #elif defined(DUK_USE_DOUBLE_BE) DUK_INTERNAL const duk_uint8_t duk_builtins_data[4251] = { 144,148,105,225,32,68,52,228,126,12,104,201,37,132,52,167,194,138,105,244, 124,57,28,211,57,18,64,52,238,254,44,138,111,171,241,164,19,87,137,30,33, 167,18,145,159,8,211,137,9,225,42,5,240,145,139,163,163,8,211,137,10,228, 64,211,19,132,140,93,29,56,70,156,72,119,34,66,146,36,104,137,194,70,46, 142,172,35,78,36,47,146,195,102,11,240,145,139,163,175,8,211,137,9,228,240, 242,112,145,139,163,179,8,211,137,8,237,34,130,118,49,116,118,225,26,48,0, 1,94,29,201,158,46,183,39,135,147,132,140,93,16,132,76,66,33,8,66,16,132, 33,8,66,26,180,41,97,167,64,150,34,33,154,112,0,1,87,247,35,79,103,237,198, 174,216,47,31,23,95,17,13,31,217,96,211,49,50,53,212,77,141,24,0,0,179,10, 228,240,242,15,128,140,65,128,134,188,0,0,89,167,97,181,224,0,2,205,62,53, 224,0,2,205,66,237,120,0,0,179,81,204,107,192,0,5,154,150,67,94,0,0,44,212, 245,90,240,0,1,102,169,162,215,128,0,11,53,93,150,188,0,0,89,171,111,53, 108,150,163,70,0,0,42,2,249,50,94,124,35,68,225,146,49,13,24,0,0,165,161, 124,153,47,62,12,130,112,201,24,132,56,97,115,16,31,254,0,0,0,0,0,0,51,48, 31,252,0,0,0,0,0,0,50,241,32,26,193,55,132,112,161,156,72,135,26,41,200, 140,114,163,156,201,7,56,79,9,80,47,132,140,93,19,160,43,145,3,76,78,18,49, 116,78,144,238,68,133,36,72,209,19,132,140,93,19,168,47,146,195,102,11,240, 145,139,162,117,132,242,120,121,56,72,197,209,59,2,59,72,160,157,140,93,19, 181,36,242,50,143,36,31,131,162,166,7,144,238,133,227,226,235,224,242,161, 249,18,21,100,20,207,44,199,151,180,122,89,135,152,154,121,153,199,156,158, 121,218,7,158,162,121,250,71,160,166,122,26,135,162,170,122,58,199,164,16, 240,70,68,226,27,51,199,138,120,35,34,112,171,112,38,121,1,124,153,47,62, 17,162,112,201,19,211,11,228,201,121,240,100,19,134,72,158,160,91,201,18, 186,44,3,68,79,122,168,151,115,165,40,21,18,227,65,198,231,200,8,68,184,84, 53,19,38,120,128,145,144,78,25,59,72,163,48,64,144,200,39,12,157,164,80,46, 185,143,115,72,217,230,72,9,35,68,225,147,180,138,51,68,9,17,162,112,201, 218,69,2,235,152,247,52,141,158,108,128,98,72,64,121,51,132,4,81,164,144, 128,242,104,136,0,16,92,38,14,49,39,199,197,211,116,240,242,113,197,231,18, 53,189,116,65,131,18,124,117,155,199,197,207,36,103,142,12,146,20,80,249, 186,60,116,4,204,73,241,214,111,31,23,60,145,158,56,208,48,146,229,146,3,2, 82,65,155,195,94,3,10,36,4,201,196,64,56,100,42,26,78,62,46,121,35,60,113, 152,16,25,10,134,147,143,139,158,72,205,4,151,21,0,73,16,11,230,144,12,88, 144,153,39,52,144,69,241,37,72,217,240,151,153,27,36,57,178,230,16,16,137, 114,68,2,200,62,81,1,8,151,11,23,100,141,229,18,6,34,92,37,230,70,201,1,89, 57,36,2,40,152,151,44,129,83,18,124,117,155,199,197,207,36,103,142,75,12, 11,151,46,89,40,18,37,200,64,12,154,236,252,238,185,23,95,213,1,132,234,0, 194,245,128,14,56,37,199,89,188,124,92,242,70,120,232,16,26,137,113,241, 116,221,60,60,156,113,122,36,10,62,46,121,35,60,113,18,225,27,70,18,32,10, 201,211,32,67,107,104,100,42,26,78,24,147,153,35,181,181,207,64,67,107,104, 100,42,26,78,72,147,153,35,181,181,207,68,16,218,218,91,156,170,63,134,36, 230,72,237,109,116,136,16,218,218,91,156,170,63,146,36,230,72,237,109,116, 137,16,96,128,228,2,6,191,46,3,71,147,68,4,16,22,188,169,240,16,40,104,242, 135,198,171,44,68,65,5,217,231,215,6,231,62,188,8,49,1,3,162,92,4,98,12,41, 7,33,148,53,242,128,97,32,130,3,9,205,16,38,199,198,14,9,0,111,115,225,0,8, 250,72,240,207,128,241,37,73,25,18,40,0,178,58,11,56,192,2,201,104,17,35, 160,9,39,70,114,8,6,147,214,129,18,74,240,30,141,145,208,89,203,62,3,161, 163,37,248,226,185,244,11,88,37,62,33,163,37,248,226,185,252,0,127,255,130, 146,164,142,32,26,1,36,230,18,1,164,7,43,163,194,0,71,128,105,64,216,7,192, 52,192,197,66,230,72,192,52,224,209,32,232,34,68,62,129,113,32,232,34,114, 40,49,231,16,254,0,63,255,208,99,2,140,44,92,206,8,224,143,4,225,147,210, 124,13,44,92,206,9,195,39,30,228,54,126,163,225,200,169,198,133,42,166,191, 246,3,11,251,0,24,71,4,120,9,251,8,10,17,193,30,9,195,39,1,63,105,1,98,112, 201,199,185,13,159,1,63,105,32,48,156,209,2,126,227,224,58,26,50,95,142,47, 192,208,22,176,74,124,67,70,75,241,197,248,26,64,213,184,64,89,56,39,49, 224,137,62,36,2,176,19,17,254,68,3,196,143,88,4,79,162,0,210,32,34,35,253, 72,5,146,208,34,125,144,5,147,214,137,253,208,9,149,3,41,197,13,55,233,0, 185,187,139,117,137,30,8,18,39,172,1,25,187,139,112,128,178,113,110,177,35, 193,2,68,245,128,23,55,114,143,121,35,193,2,68,245,130,8,205,220,91,132,5, 147,148,123,201,30,8,18,39,172,16,18,113,67,63,128,3,68,143,32,39,243,32, 42,83,4,103,46,89,19,63,224,208,16,70,142,92,178,38,127,193,164,8,67,68, 186,12,146,247,154,1,165,64,202,113,252,160,131,32,7,35,167,26,50,235,231, 130,48,179,192,65,148,69,19,214,2,251,85,2,232,72,15,253,255,255,255,255, 255,255,226,122,196,55,106,160,93,9,0,0,0,0,0,0,0,0,7,49,1,255,224,0,0,0,0, 0,0,143,94,233,34,104,169,54,144,210,161,168,158,32,63,248,0,0,0,0,0,0,17, 235,72,96,77,21,38,210,26,84,53,19,196,15,255,0,0,0,0,0,0,0,253,35,228,133, 185,176,15,44,0,0,0,0,0,0,8,117,128,190,212,128,82,109,33,179,33,137,24,8, 103,255,255,255,255,255,255,228,58,196,55,106,64,41,54,144,217,144,196,140, 12,51,255,255,255,255,255,255,241,15,4,100,78,33,179,60,120,167,130,50,39, 10,183,2,103,144,113,8,151,10,134,162,100,221,16,18,137,113,13,153,12,72, 238,137,1,81,46,52,28,110,232,148,53,18,228,128,82,113,13,153,12,72,238, 137,142,73,78,52,0,0,0,0,0,0,0,0,8,58,254,1,12,38,248,134,23,130,0,60,221, 194,162,228,30,244,128,217,187,132,187,220,210,54,104,2,247,132,5,205,220, 124,72,36,73,14,110,252,132,25,128,193,94,8,200,149,200,3,237,38,43,31,192, 54,186,213,128,57,45,56,210,31,254,0,0,0,0,0,0,49,90,251,224,6,77,220,24, 38,78,74,113,67,77,124,16,50,110,228,208,194,114,83,138,26,107,224,172,37, 240,97,41,187,139,112,128,178,112,96,153,57,41,197,13,53,240,113,41,187, 139,112,128,178,114,104,97,57,41,197,13,53,240,128,195,95,8,44,61,240,132, 216,93,33,133,192,128,14,98,79,147,67,9,129,0,44,196,159,11,69,175,152,32, 35,100,33,135,24,147,237,38,34,246,139,95,48,64,70,200,68,8,49,39,198,57, 179,61,144,138,22,98,79,180,152,153,215,54,103,178,17,129,204,73,240,96, 153,44,132,112,163,18,125,164,196,62,130,100,178,18,1,140,73,240,96,197, 144,146,18,98,79,180,152,135,208,98,200,74,8,49,39,195,186,145,149,144,150, 22,98,79,180,152,143,215,82,50,178,19,2,140,73,241,136,109,38,73,89,9,161, 166,36,251,73,137,157,67,105,50,74,200,78,10,49,39,201,16,78,104,229,100, 39,134,152,147,237,38,41,116,130,115,71,43,33,64,60,196,159,24,133,173,18, 32,156,209,202,200,81,18,49,39,218,76,76,234,22,180,72,130,115,71,43,33,72, 68,196,159,38,134,19,46,105,56,226,150,68,157,160,1,228,73,242,104,97,46, 16,31,34,79,140,66,214,137,16,78,104,229,108,169,137,72,147,237,38,38,117, 11,90,36,65,57,163,149,178,168,21,34,79,146,32,156,209,202,218,250,161,178, 36,251,73,138,93,32,156,209,202,218,250,193,82,36,248,196,54,147,36,173, 191,174,27,34,79,180,152,153,212,54,147,36,173,191,176,17,34,79,135,117,35, 43,115,236,133,200,147,237,38,35,245,212,140,173,207,180,15,34,79,131,4, 201,108,173,133,72,147,237,38,33,244,19,37,178,184,17,34,79,140,115,102, 123,107,238,133,200,147,237,38,38,117,205,153,237,175,188,23,34,79,133,162, 215,204,16,17,182,254,248,116,137,62,210,98,47,104,181,243,4,4,109,191,192, 131,152,147,230,8,8,217,12,16,60,137,62,96,128,141,178,193,181,55,136,200, 51,128,114,108,28,100,128,0,0,0,0,0,0,0,12,110,127,32,98,115,249,73,117, 243,249,67,21,159,202,38,47,63,148,86,8,75,144,94,50,1,38,73,79,204,67,95, 231,1,6,128,14,79,129,185,40,249,18,149,181,207,142,199,155,172,248,172,89, 183,207,140,198,137,175,200,0,159,72,10,5,21,220,138,120,74,129,124,36,98, 232,228,74,81,62,160,20,10,107,185,21,114,32,105,137,194,70,46,142,68,165, 19,235,1,64,170,187,145,119,34,66,146,36,104,137,194,70,46,142,68,165,19, 236,1,64,174,187,145,95,37,134,204,23,225,35,23,71,34,82,137,246,128,160, 89,93,200,167,147,195,201,194,70,46,142,68,165,19,238,1,64,182,187,145,71, 105,20,19,177,139,163,145,41,68,16,7,6,15,82,70,72,115,96,32,105,246,0,0,0, 0,0,91,60,165,195,201,194,8,134,149,216,130,0,192,41,224,136,2,48,176,228, 1,149,13,195,15,0,200,209,97,71,128,99,32,176,131,192,113,57,143,0,167,131, 32,230,80,28,202,139,175,237,2,48,189,160,20,1,119,48,87,193,186,129,89,56, 72,197,209,200,193,185,35,23,71,109,13,219,36,98,232,237,156,13,26,208,211, 14,102,19,87,137,91,95,128,0,10,64,24,92,0,0,82,2,53,63,240,49,204,202,10, 14,38,78,44,141,52,207,31,0,0,22,32,129,100,180,8,148,145,78,102,152,80, 113,50,113,100,105,166,120,248,0,0,177,1,65,196,201,199,20,178,36,227,224, 0,2,200,3,6,133,41,35,31,0,0,22,1,44,57,137,62,33,179,216,162,152,192,131, 18,124,162,27,61,138,41,108,32,196,159,16,217,232,235,81,76,104,73,137,62, 81,13,158,142,181,20,184,16,98,79,136,108,244,244,168,166,56,36,196,159,40, 134,207,79,74,138,93,10,49,39,194,173,192,158,158,149,20,188,20,98,79,133, 91,129,61,109,74,41,124,30,68,159,16,217,236,83,108,96,68,137,62,81,13,158, 197,54,182,17,34,79,136,108,244,117,169,182,52,38,68,159,40,134,207,71,90, 155,92,8,145,39,196,54,122,122,84,219,28,19,34,79,148,67,103,167,165,77, 174,133,72,147,225,86,224,79,79,74,155,94,10,145,39,194,173,192,158,182, 165,54,190,206,25,212,35,208,226,100,150,211,201,29,162,44,140,35,103,0, 255,192,0,0,0,0,0,0,206,25,228,35,208,226,100,150,211,201,29,162,44,140,35, 103,0,255,192,0,0,0,0,0,0,206,25,244,35,208,226,100,150,211,201,29,162,44, 140,35,103,0,255,192,0,0,0,0,0,0,206,26,4,35,208,226,100,150,211,201,29, 162,44,140,35,103,1,0,0,0,0,0,0,0,0,206,26,20,35,208,226,100,150,211,201, 29,162,44,140,35,103,1,0,0,0,0,0,0,0,0,206,26,36,35,208,226,100,150,211, 201,29,162,44,140,35,103,1,0,64,0,0,0,0,0,0,206,26,52,35,208,226,100,150, 211,201,29,162,44,140,35,103,1,0,64,0,0,0,0,0,0,206,26,68,35,208,226,100, 150,211,201,29,162,44,140,35,103,1,0,64,0,0,0,0,0,0,206,26,84,35,208,226, 100,150,211,201,29,162,44,140,35,103,1,0,128,0,0,0,0,0,0,195,154,99,16,38, 36,0,251,68,117,179,216,162,128,68,72,1,241,13,158,197,20,150,25,18,0,125, 162,58,217,232,235,117,100,162,136,25,18,0,125,162,58,217,232,235,116,36, 162,145,2,226,64,15,136,108,244,117,186,178,81,73,129,113,32,7,196,54,122, 58,221,9,40,165,64,200,144,3,237,17,214,207,79,75,171,37,20,80,200,144,3, 237,17,214,207,79,75,161,37,20,138,23,18,0,124,67,103,167,165,213,146,138, 77,11,137,0,62,33,179,211,210,232,73,69,42,133,196,128,31,10,183,2,125,89, 40,163,5,196,128,31,10,183,2,125,9,40,164,96,200,144,3,224,221,64,172,157, 89,40,163,134,68,128,31,6,234,5,100,232,73,69,35,133,68,128,31,104,142,182, 125,89,40,180,0,168,144,3,237,17,214,207,161,37,22,144,19,18,0,124,67,103, 213,146,139,80,9,137,0,62,33,179,232,73,69,172,5,90,40,153,59,68,117,179, 216,166,192,77,162,137,147,136,108,246,41,180,176,219,69,19,39,104,142,182, 122,58,221,89,41,178,6,218,40,153,59,68,117,179,209,214,232,73,77,162,6,90, 40,153,56,134,207,71,91,171,37,54,152,25,104,162,100,226,27,61,29,110,132, 148,218,160,109,162,137,147,180,71,91,61,61,46,172,148,217,67,109,20,76, 157,162,58,217,233,233,116,36,166,209,67,45,20,76,156,67,103,167,165,213, 146,155,77,12,180,81,50,113,13,158,158,151,66,74,109,84,50,209,68,201,194, 173,192,159,86,74,108,193,150,138,38,78,21,110,4,250,18,83,104,193,182,138, 38,78,13,212,10,201,213,146,155,56,109,162,137,147,131,117,2,178,116,36, 166,209,194,237,20,76,157,162,58,217,245,100,167,16,2,237,20,76,157,162,58, 217,244,36,167,18,2,173,20,76,156,67,103,213,146,156,80,10,180,81,50,113, 13,159,66,74,113,97,175,220,48,216,109,192,4,42,22,189,163,0,196,133,0,185, 80,32,28,78,99,193,18,80,36,4,19,159,141,156,0,178,90,4,74,73,0,22,209,68, 201,185,129,4,2,8,3,132,64,60,36,4,0,91,240,168,177,69,118,144,157,91,116, 116,32,32,1,53,216,221,218,170,139,3,234,219,165,0,255,152,185,11,251,232, 231,188,47,86,227,105,18,1,255,184,170,59,41,92,23,240,110,173,198,209,208, 36,3,253,188,183,177,82,110,80,224,93,122,32,32,4,144,253,170,34,22,140,7, 236,161,25,232,237,105,64,63,230,160,158,102,127,59,205,11,217,66,51,210, 128,127,237,65,60,204,254,119,155,171,197,34,168,48,6,90,162,1,0,39,75,84, 72,8,9,33,186,162,80,64,76,13,213,19,2,130,96,110,150,181,0,65,6,51,213,20, 128,65,17,11,213,19,130,137,121,211,210,210,144,6,39,75,84,80,0,201,119, 234,138,8,41,86,231,71,84,80,129,79,135,186,122,101,224,34,25,69,233,208,3, 91,141,170,40,96,139,113,180,181,69,36,21,110,54,142,134,168,165,1,176,23, 212,47,0,216,134,234,87,128,111,117,181,168,128,209,3,70,230,106,192,5,139, 168,209,234,138,32,36,144,102,235,8,3,146,27,170,40,160,146,132,103,170,40, 192,115,3,117,69,28,22,113,163,69,170,41,103,1,66,188,17,145,52,104,4,202, 113,67,76,130,227,72,194,13,240,108,0,0,83,96,0,2,185,0,104,146,84,97,48,0, 1,90,192,56,169,24,145,179,192,0,5,96,8,56,16,32,128,56,18,52,125,198,86, 147,186,140,28,50,21,13,39,31,23,60,145,158,56,204,141,47,121,6,155,190, 188,24,49,39,199,89,188,124,92,242,70,120,224,201,33,69,15,155,163,199,68, 14,49,39,199,197,211,116,240,242,113,197,231,18,180,254,4,3,17,46,18,243, 35,100,128,172,156,146,70,163,150,76,34,248,146,164,108,248,75,204,141,146, 28,217,115,9,27,79,11,241,173,235,162,160,224,200,2,206,9,113,13,148,192, 209,18,22,164,146,37,193,57,162,4,249,39,196,128,24,2,178,66,213,136,68, 201,16,77,209,131,31,192,242,88,96,92,191,151,34,100,136,38,232,255,252,92, 221,199,197,12,68,209,82,66,212,11,155,185,41,197,13,55,38,3,66,213,47,131, 250,72,12,162,99,133,116,127,196,32,225,1,3,34,92,170,9,105,164,32,225,64, 131,156,1,193,133,7,19,39,22,70,154,103,143,128,0,11,16,20,28,76,156,113, 75,34,78,62,0,0,44,128,48,104,82,146,49,240,0,1,96,11,180,192,0,5,162,1,18, 160,65,24,131,20,145,25,188,48,132,122,28,76,146,218,121,35,180,69,145,132, 108,224,31,248,0,0,0,0,0,0,25,188,56,132,122,28,76,146,218,121,35,180,69, 145,132,108,224,31,248,0,0,0,0,0,0,40,160,45,110,23,30,176,33,184,0,0,181, 32,29,235,2,27,199,23,0,0,22,196,51,120,129,8,244,56,153,37,180,242,71,104, 139,35,8,217,192,63,240,0,0,0,0,0,0,51,120,145,8,244,56,153,37,180,242,71, 104,139,35,8,217,192,64,0,0,0,0,0,0,0,51,120,161,8,244,56,153,37,180,242, 71,104,139,35,8,217,192,64,0,0,0,0,0,0,0,51,120,177,8,244,56,153,37,180, 242,71,104,139,35,8,217,192,64,16,0,0,0,0,0,0,51,120,193,8,244,56,153,37, 180,242,71,104,139,35,8,217,192,64,16,0,0,0,0,0,0,51,120,209,8,244,56,153, 37,180,242,71,104,139,35,8,217,192,64,16,0,0,0,0,0,0,51,120,225,8,244,56, 153,37,180,242,71,104,139,35,8,217,192,64,32,0,0,0,0,0,0,32,227,194,0,97, 57,162,4,246,40,5,34,92,35,68,225,161,166,219,16,16,137,112,52,41,73,29, 169,1,65,196,201,197,145,166,153,246,8,3,137,204,120,34,74,8,200,58,128,28, 211,160,130,52,78,26,26,110,248,0,0,170,4,12,70,137,195,38,0,0,42,68,159,7, 84,3,154,150,16,70,137,195,67,77,223,0,0,20,224,20,160,152,23,223,0,0,20, 226,9,65,154,232,147,161,115,59,224,0,2,156,84,12,50,9,195,38,0,0,41,133, 30,224,32,54,186,221,128,60, }; #elif defined(DUK_USE_DOUBLE_ME) DUK_INTERNAL const duk_uint8_t duk_builtins_data[4251] = { 144,148,105,225,32,68,52,228,126,12,104,201,37,132,52,167,194,138,105,244, 124,57,28,211,57,18,64,52,238,254,44,138,111,171,241,164,19,87,137,30,33, 167,18,145,159,8,211,137,9,225,42,5,240,145,139,163,163,8,211,137,10,228, 64,211,19,132,140,93,29,56,70,156,72,119,34,66,146,36,104,137,194,70,46, 142,172,35,78,36,47,146,195,102,11,240,145,139,163,175,8,211,137,9,228,240, 242,112,145,139,163,179,8,211,137,8,237,34,130,118,49,116,118,225,26,48,0, 1,94,29,201,158,46,183,39,135,147,132,140,93,16,132,76,66,33,8,66,16,132, 33,8,66,26,180,41,97,167,64,150,34,33,154,112,0,1,87,247,35,79,103,237,198, 174,216,47,31,23,95,17,13,31,217,96,211,49,50,53,212,77,141,24,0,0,179,10, 228,240,242,15,128,140,65,128,134,188,0,0,89,167,97,181,224,0,2,205,62,53, 224,0,2,205,66,237,120,0,0,179,81,204,107,192,0,5,154,150,67,94,0,0,44,212, 245,90,240,0,1,102,169,162,215,128,0,11,53,93,150,188,0,0,89,171,111,53, 108,150,163,70,0,0,42,2,249,50,94,124,35,68,225,146,49,13,24,0,0,165,161, 124,153,47,62,12,130,112,201,24,132,56,97,115,16,0,0,62,31,192,0,0,0,51,48, 0,0,60,31,192,0,0,0,50,241,32,26,193,55,132,112,161,156,72,135,26,41,200, 140,114,163,156,201,7,56,79,9,80,47,132,140,93,19,160,43,145,3,76,78,18,49, 116,78,144,238,68,133,36,72,209,19,132,140,93,19,168,47,146,195,102,11,240, 145,139,162,117,132,242,120,121,56,72,197,209,59,2,59,72,160,157,140,93,19, 181,36,242,50,143,36,31,131,162,166,7,144,238,133,227,226,235,224,242,161, 249,18,21,100,20,207,44,199,151,180,122,89,135,152,154,121,153,199,156,158, 121,218,7,158,162,121,250,71,160,166,122,26,135,162,170,122,58,199,164,16, 240,70,68,226,27,51,199,138,120,35,34,112,171,112,38,121,1,124,153,47,62, 17,162,112,201,19,211,11,228,201,121,240,100,19,134,72,158,160,91,201,18, 186,44,3,68,79,122,168,151,115,165,40,21,18,227,65,198,231,200,8,68,184,84, 53,19,38,120,128,145,144,78,25,59,72,163,48,64,144,200,39,12,157,164,80,46, 185,143,115,72,217,230,72,9,35,68,225,147,180,138,51,68,9,17,162,112,201, 218,69,2,235,152,247,52,141,158,108,128,98,72,64,121,51,132,4,81,164,144, 128,242,104,136,0,16,92,38,14,49,39,199,197,211,116,240,242,113,197,231,18, 53,189,116,65,131,18,124,117,155,199,197,207,36,103,142,12,146,20,80,249, 186,60,116,4,204,73,241,214,111,31,23,60,145,158,56,208,48,146,229,146,3,2, 82,65,155,195,94,3,10,36,4,201,196,64,56,100,42,26,78,62,46,121,35,60,113, 152,16,25,10,134,147,143,139,158,72,205,4,151,21,0,73,16,11,230,144,12,88, 144,153,39,52,144,69,241,37,72,217,240,151,153,27,36,57,178,230,16,16,137, 114,68,2,200,62,81,1,8,151,11,23,100,141,229,18,6,34,92,37,230,70,201,1,89, 57,36,2,40,152,151,44,129,83,18,124,117,155,199,197,207,36,103,142,75,12, 11,151,46,89,40,18,37,200,64,12,154,236,252,238,185,23,95,213,1,132,234,0, 194,245,128,14,56,37,199,89,188,124,92,242,70,120,232,16,26,137,113,241, 116,221,60,60,156,113,122,36,10,62,46,121,35,60,113,18,225,27,70,18,32,10, 201,211,32,67,107,104,100,42,26,78,24,147,153,35,181,181,207,64,67,107,104, 100,42,26,78,72,147,153,35,181,181,207,68,16,218,218,91,156,170,63,134,36, 230,72,237,109,116,136,16,218,218,91,156,170,63,146,36,230,72,237,109,116, 137,16,96,128,228,2,6,191,46,3,71,147,68,4,16,22,188,169,240,16,40,104,242, 135,198,171,44,68,65,5,217,231,215,6,231,62,188,8,49,1,3,162,92,4,98,12,41, 7,33,148,53,242,128,97,32,130,3,9,205,16,38,199,198,14,9,0,111,115,225,0,8, 250,72,240,207,128,241,37,73,25,18,40,0,178,58,11,56,192,2,201,104,17,35, 160,9,39,70,114,8,6,147,214,129,18,74,240,30,141,145,208,89,203,62,3,161, 163,37,248,226,185,244,11,88,37,62,33,163,37,248,226,185,252,0,127,255,130, 146,164,142,32,26,1,36,230,18,1,164,7,43,163,194,0,71,128,105,64,216,7,192, 52,192,197,66,230,72,192,52,224,209,32,232,34,68,62,129,113,32,232,34,114, 40,49,231,16,254,0,63,255,208,99,2,140,44,92,206,8,224,143,4,225,147,210, 124,13,44,92,206,9,195,39,30,228,54,126,163,225,200,169,198,133,42,166,191, 246,3,11,251,0,24,71,4,120,9,251,8,10,17,193,30,9,195,39,1,63,105,1,98,112, 201,199,185,13,159,1,63,105,32,48,156,209,2,126,227,224,58,26,50,95,142,47, 192,208,22,176,74,124,67,70,75,241,197,248,26,64,213,184,64,89,56,39,49, 224,137,62,36,2,176,19,17,254,68,3,196,143,88,4,79,162,0,210,32,34,35,253, 72,5,146,208,34,125,144,5,147,214,137,253,208,9,149,3,41,197,13,55,233,0, 185,187,139,117,137,30,8,18,39,172,1,25,187,139,112,128,178,113,110,177,35, 193,2,68,245,128,23,55,114,143,121,35,193,2,68,245,130,8,205,220,91,132,5, 147,148,123,201,30,8,18,39,172,16,18,113,67,63,128,3,68,143,32,39,243,32, 42,83,4,103,46,89,19,63,224,208,16,70,142,92,178,38,127,193,164,8,67,68, 186,12,146,247,154,1,165,64,202,113,252,160,131,32,7,35,167,26,50,235,231, 130,48,179,192,65,148,69,19,214,2,251,85,2,232,72,31,255,253,239,255,255, 255,255,226,122,196,55,106,160,93,9,0,0,0,0,0,4,0,0,3,49,0,0,3,225,252,0,0, 0,0,143,94,233,34,104,169,54,144,210,161,168,158,32,0,0,120,63,128,0,0,0, 17,235,72,96,77,21,38,210,26,84,53,19,196,0,0,15,15,240,0,0,0,0,253,35,228, 133,185,176,0,0,44,15,0,0,0,0,8,117,128,190,212,128,82,109,33,179,33,137, 24,31,255,231,232,127,255,255,255,228,58,196,55,106,64,41,54,144,217,144, 196,140,15,255,243,252,63,255,255,255,241,15,4,100,78,33,179,60,120,167, 130,50,39,10,183,2,103,144,113,8,151,10,134,162,100,221,16,18,137,113,13, 153,12,72,238,137,1,81,46,52,28,110,232,148,53,18,228,128,82,113,13,153,12, 72,238,137,142,73,78,52,0,0,0,0,0,0,0,0,8,58,254,1,12,38,248,134,23,130,0, 60,221,194,162,228,30,244,128,217,187,132,187,220,210,54,104,2,247,132,5, 205,220,124,72,36,73,14,110,252,132,25,128,193,94,8,200,149,200,3,237,38, 43,31,192,54,186,213,128,57,45,56,210,0,0,62,31,192,0,0,0,49,90,251,224,6, 77,220,24,38,78,74,113,67,77,124,16,50,110,228,208,194,114,83,138,26,107, 224,172,37,240,97,41,187,139,112,128,178,112,96,153,57,41,197,13,53,240, 113,41,187,139,112,128,178,114,104,97,57,41,197,13,53,240,128,195,95,8,44, 61,240,132,216,93,33,133,192,128,14,98,79,147,67,9,129,0,44,196,159,11,69, 175,152,32,35,100,33,135,24,147,237,38,34,246,139,95,48,64,70,200,68,8,49, 39,198,57,179,61,144,138,22,98,79,180,152,153,215,54,103,178,17,129,204,73, 240,96,153,44,132,112,163,18,125,164,196,62,130,100,178,18,1,140,73,240,96, 197,144,146,18,98,79,180,152,135,208,98,200,74,8,49,39,195,186,145,149,144, 150,22,98,79,180,152,143,215,82,50,178,19,2,140,73,241,136,109,38,73,89,9, 161,166,36,251,73,137,157,67,105,50,74,200,78,10,49,39,201,16,78,104,229, 100,39,134,152,147,237,38,41,116,130,115,71,43,33,64,60,196,159,24,133,173, 18,32,156,209,202,200,81,18,49,39,218,76,76,234,22,180,72,130,115,71,43,33, 72,68,196,159,38,134,19,46,105,56,226,150,68,157,160,1,228,73,242,104,97, 46,16,31,34,79,140,66,214,137,16,78,104,229,108,169,137,72,147,237,38,38, 117,11,90,36,65,57,163,149,178,168,21,34,79,146,32,156,209,202,218,250,161, 178,36,251,73,138,93,32,156,209,202,218,250,193,82,36,248,196,54,147,36, 173,191,174,27,34,79,180,152,153,212,54,147,36,173,191,176,17,34,79,135, 117,35,43,115,236,133,200,147,237,38,35,245,212,140,173,207,180,15,34,79, 131,4,201,108,173,133,72,147,237,38,33,244,19,37,178,184,17,34,79,140,115, 102,123,107,238,133,200,147,237,38,38,117,205,153,237,175,188,23,34,79,133, 162,215,204,16,17,182,254,248,116,137,62,210,98,47,104,181,243,4,4,109,191, 192,131,152,147,230,8,8,217,12,16,60,137,62,96,128,141,178,193,181,55,136, 200,51,128,114,108,28,100,128,0,0,0,0,0,0,0,12,110,127,32,98,115,249,73, 117,243,249,67,21,159,202,38,47,63,148,86,8,75,144,94,50,1,38,73,79,204,67, 95,231,1,6,128,14,79,129,185,40,249,18,149,181,207,142,199,155,172,248,172, 89,183,207,140,198,137,175,200,0,159,72,10,5,21,220,138,120,74,129,124,36, 98,232,228,74,81,62,160,20,10,107,185,21,114,32,105,137,194,70,46,142,68, 165,19,235,1,64,170,187,145,119,34,66,146,36,104,137,194,70,46,142,68,165, 19,236,1,64,174,187,145,95,37,134,204,23,225,35,23,71,34,82,137,246,128, 160,89,93,200,167,147,195,201,194,70,46,142,68,165,19,238,1,64,182,187,145, 71,105,20,19,177,139,163,145,41,68,16,7,6,15,82,70,72,115,96,0,118,105,160, 0,0,0,0,91,60,165,195,201,194,8,134,149,216,130,0,192,41,224,136,2,48,176, 228,1,149,13,195,15,0,200,209,97,71,128,99,32,176,131,192,113,57,143,0,167, 131,32,230,80,28,202,139,175,237,2,48,189,160,20,1,119,48,87,193,186,129, 89,56,72,197,209,200,193,185,35,23,71,109,13,219,36,98,232,237,156,13,26, 208,211,14,102,19,87,137,91,95,128,0,10,64,24,92,0,0,82,2,53,63,240,49,204, 202,10,14,38,78,44,141,52,207,31,0,0,22,32,129,100,180,8,148,145,78,102, 152,80,113,50,113,100,105,166,120,248,0,0,177,1,65,196,201,199,20,178,36, 227,224,0,2,200,3,6,133,41,35,31,0,0,22,1,44,57,137,62,33,179,216,162,152, 192,131,18,124,162,27,61,138,41,108,32,196,159,16,217,232,235,81,76,104,73, 137,62,81,13,158,142,181,20,184,16,98,79,136,108,244,244,168,166,56,36,196, 159,40,134,207,79,74,138,93,10,49,39,194,173,192,158,158,149,20,188,20,98, 79,133,91,129,61,109,74,41,124,30,68,159,16,217,236,83,108,96,68,137,62,81, 13,158,197,54,182,17,34,79,136,108,244,117,169,182,52,38,68,159,40,134,207, 71,90,155,92,8,145,39,196,54,122,122,84,219,28,19,34,79,148,67,103,167,165, 77,174,133,72,147,225,86,224,79,79,74,155,94,10,145,39,194,173,192,158,182, 165,54,190,206,25,212,35,208,226,100,150,211,201,29,162,44,140,35,103,0,0, 3,192,252,0,0,0,0,206,25,228,35,208,226,100,150,211,201,29,162,44,140,35, 103,0,0,3,192,252,0,0,0,0,206,25,244,35,208,226,100,150,211,201,29,162,44, 140,35,103,0,0,3,192,252,0,0,0,0,206,26,4,35,208,226,100,150,211,201,29, 162,44,140,35,103,0,0,0,1,0,0,0,0,0,206,26,20,35,208,226,100,150,211,201, 29,162,44,140,35,103,0,0,0,1,0,0,0,0,0,206,26,36,35,208,226,100,150,211, 201,29,162,44,140,35,103,0,0,0,65,0,0,0,0,0,206,26,52,35,208,226,100,150, 211,201,29,162,44,140,35,103,0,0,0,65,0,0,0,0,0,206,26,68,35,208,226,100, 150,211,201,29,162,44,140,35,103,0,0,0,65,0,0,0,0,0,206,26,84,35,208,226, 100,150,211,201,29,162,44,140,35,103,0,0,0,129,0,0,0,0,0,195,154,99,16,38, 36,0,251,68,117,179,216,162,128,68,72,1,241,13,158,197,20,150,25,18,0,125, 162,58,217,232,235,117,100,162,136,25,18,0,125,162,58,217,232,235,116,36, 162,145,2,226,64,15,136,108,244,117,186,178,81,73,129,113,32,7,196,54,122, 58,221,9,40,165,64,200,144,3,237,17,214,207,79,75,171,37,20,80,200,144,3, 237,17,214,207,79,75,161,37,20,138,23,18,0,124,67,103,167,165,213,146,138, 77,11,137,0,62,33,179,211,210,232,73,69,42,133,196,128,31,10,183,2,125,89, 40,163,5,196,128,31,10,183,2,125,9,40,164,96,200,144,3,224,221,64,172,157, 89,40,163,134,68,128,31,6,234,5,100,232,73,69,35,133,68,128,31,104,142,182, 125,89,40,180,0,168,144,3,237,17,214,207,161,37,22,144,19,18,0,124,67,103, 213,146,139,80,9,137,0,62,33,179,232,73,69,172,5,90,40,153,59,68,117,179, 216,166,192,77,162,137,147,136,108,246,41,180,176,219,69,19,39,104,142,182, 122,58,221,89,41,178,6,218,40,153,59,68,117,179,209,214,232,73,77,162,6,90, 40,153,56,134,207,71,91,171,37,54,152,25,104,162,100,226,27,61,29,110,132, 148,218,160,109,162,137,147,180,71,91,61,61,46,172,148,217,67,109,20,76, 157,162,58,217,233,233,116,36,166,209,67,45,20,76,156,67,103,167,165,213, 146,155,77,12,180,81,50,113,13,158,158,151,66,74,109,84,50,209,68,201,194, 173,192,159,86,74,108,193,150,138,38,78,21,110,4,250,18,83,104,193,182,138, 38,78,13,212,10,201,213,146,155,56,109,162,137,147,131,117,2,178,116,36, 166,209,194,237,20,76,157,162,58,217,245,100,167,16,2,237,20,76,157,162,58, 217,244,36,167,18,2,173,20,76,156,67,103,213,146,156,80,10,180,81,50,113, 13,159,66,74,113,97,175,220,48,216,109,192,4,42,22,189,163,0,196,133,0,185, 80,32,28,78,99,193,18,80,36,4,19,159,141,156,0,178,90,4,74,73,0,22,209,68, 201,185,129,4,2,8,3,132,64,60,36,0,171,240,84,6,149,113,72,176,157,91,116, 116,32,88,181,129,32,11,42,218,221,131,234,219,165,1,8,187,152,255,188,231, 235,248,47,86,227,105,18,2,56,175,185,255,244,17,91,40,110,173,198,209,208, 36,7,188,189,179,240,238,82,97,80,93,122,32,125,144,132,160,12,22,162,42,7, 236,161,25,232,237,105,64,158,160,230,63,205,59,127,102,11,217,66,51,210, 129,61,65,236,127,154,118,254,205,171,197,34,168,48,6,90,162,1,0,39,75,84, 72,8,9,33,186,162,80,64,76,13,213,19,2,130,96,110,150,181,0,65,6,51,213,20, 128,65,17,11,213,19,130,137,121,211,210,210,144,6,39,75,84,80,0,201,119, 234,138,8,41,86,231,71,84,80,129,79,135,186,122,101,224,34,25,69,233,208,3, 91,141,170,40,96,139,113,180,181,69,36,21,110,54,142,134,168,165,1,176,23, 212,47,0,216,134,234,87,128,111,117,181,168,128,209,3,70,230,106,192,5,139, 168,209,234,138,32,36,144,102,235,8,3,146,27,170,40,160,146,132,103,170,40, 192,115,3,117,69,28,22,113,163,69,170,41,103,1,66,188,17,145,52,104,4,202, 113,67,76,130,227,72,194,13,240,108,0,0,83,96,0,2,185,0,104,146,84,97,48,0, 1,90,192,56,169,24,145,179,192,0,5,96,8,56,16,32,128,56,18,52,125,198,86, 147,186,140,28,50,21,13,39,31,23,60,145,158,56,204,141,47,121,6,155,190, 188,24,49,39,199,89,188,124,92,242,70,120,224,201,33,69,15,155,163,199,68, 14,49,39,199,197,211,116,240,242,113,197,231,18,180,254,4,3,17,46,18,243, 35,100,128,172,156,146,70,163,150,76,34,248,146,164,108,248,75,204,141,146, 28,217,115,9,27,79,11,241,173,235,162,160,224,200,2,206,9,113,13,148,192, 209,18,22,164,146,37,193,57,162,4,249,39,196,128,24,2,178,66,213,136,68, 201,16,77,209,131,31,192,242,88,96,92,191,151,34,100,136,38,232,255,252,92, 221,199,197,12,68,209,82,66,212,11,155,185,41,197,13,55,38,3,66,213,47,131, 250,72,12,162,99,133,116,127,196,32,225,1,3,34,92,170,9,105,164,32,225,64, 131,156,1,193,133,7,19,39,22,70,154,103,143,128,0,11,16,20,28,76,156,113, 75,34,78,62,0,0,44,128,48,104,82,146,49,240,0,1,96,11,180,192,0,5,162,1,18, 160,65,24,131,20,145,25,188,48,132,122,28,76,146,218,121,35,180,69,145,132, 108,224,0,0,120,31,128,0,0,0,25,188,56,132,122,28,76,146,218,121,35,180,69, 145,132,108,224,0,0,120,31,128,0,0,0,40,160,45,110,23,30,176,33,184,0,0, 181,32,29,235,2,27,199,23,0,0,22,196,51,120,129,8,244,56,153,37,180,242,71, 104,139,35,8,217,192,0,0,240,63,0,0,0,0,51,120,145,8,244,56,153,37,180,242, 71,104,139,35,8,217,192,0,0,0,64,0,0,0,0,51,120,161,8,244,56,153,37,180, 242,71,104,139,35,8,217,192,0,0,0,64,0,0,0,0,51,120,177,8,244,56,153,37, 180,242,71,104,139,35,8,217,192,0,0,16,64,0,0,0,0,51,120,193,8,244,56,153, 37,180,242,71,104,139,35,8,217,192,0,0,16,64,0,0,0,0,51,120,209,8,244,56, 153,37,180,242,71,104,139,35,8,217,192,0,0,16,64,0,0,0,0,51,120,225,8,244, 56,153,37,180,242,71,104,139,35,8,217,192,0,0,32,64,0,0,0,0,32,227,194,0, 97,57,162,4,246,40,5,34,92,35,68,225,161,166,219,16,16,137,112,52,41,73,29, 169,1,65,196,201,197,145,166,153,246,8,3,137,204,120,34,74,8,200,58,128,28, 211,160,130,52,78,26,26,110,248,0,0,170,4,12,70,137,195,38,0,0,42,68,159,7, 84,3,154,150,16,70,137,195,67,77,223,0,0,20,224,20,160,152,23,223,0,0,20, 226,9,65,154,232,147,161,115,59,224,0,2,156,84,12,50,9,195,38,0,0,41,133, 30,224,32,54,186,221,128,60, }; #else #error invalid endianness defines #endif #endif /* DUK_USE_ROM_OBJECTS */
31,227
5,169
<reponame>Gantios/Specs { "name": "PHLCheckbox", "version": "1.0.1", "summary": "Checkbox para iOS criado a partir de um UIButton.", "description": "Checkbox desenvolvido a partir de um UIButton. Sem utilizar imagens ou frameworks de terceiros. Usando apenas uma fonte customizada.", "homepage": "https://github.com/phlourenco/PHLCheckbox", "screenshots": [ "https://i.imgur.com/x6qerWp.png", "https://i.imgur.com/mZAVfpn.gif" ], "license": { "type": "MIT", "text": "MIT License\n\nCopyright (c) 2019 <NAME>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" }, "authors": { "<NAME>": "<EMAIL>" }, "platforms": { "ios": "9.0" }, "swift_version": "4.2", "source": { "git": "https://github.com/phlourenco/PHLCheckbox.git", "tag": "1.0.1" }, "source_files": "**/*.{h,m,swift}", "exclude_files": "Classes/Exclude", "resources": "PHLCheckbox/**/*.ttf" }
669
1,502
<reponame>otreblan/libtree int c(); int b() { return c(); }
32
2,542
<gh_stars>1000+ // ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #pragma once namespace ServiceModel { class NodeHealthEvaluation : public HealthEvaluationWithChildrenBase { DENY_COPY(NodeHealthEvaluation) public: NodeHealthEvaluation(); NodeHealthEvaluation( std::wstring const & nodeName, FABRIC_HEALTH_STATE aggregatedHealthState, HealthEvaluationList && evaluations); NodeHealthEvaluation(NodeHealthEvaluation && other) = default; NodeHealthEvaluation & operator = (NodeHealthEvaluation && other) = default; virtual ~NodeHealthEvaluation(); __declspec(property(get=get_NodeName)) std::wstring const & NodeName; std::wstring const & get_NodeName() const { return nodeName_; } virtual void SetDescription() override; Common::ErrorCode ToPublicApi( __in Common::ScopedHeap & heap, __out FABRIC_HEALTH_EVALUATION & publicHealthEvaluation) const; Common::ErrorCode FromPublicApi( FABRIC_HEALTH_EVALUATION const & publicHealthEvaluation); FABRIC_FIELDS_05(kind_, description_, unhealthyEvaluations_, aggregatedHealthState_, nodeName_); BEGIN_JSON_SERIALIZABLE_PROPERTIES() SERIALIZABLE_PROPERTY_CHAIN() SERIALIZABLE_PROPERTY(Constants::NodeName, nodeName_); SERIALIZABLE_PROPERTY(Constants::UnhealthyEvaluations, unhealthyEvaluations_) END_JSON_SERIALIZABLE_PROPERTIES() BEGIN_DYNAMIC_SIZE_ESTIMATION() DYNAMIC_SIZE_ESTIMATION_CHAIN() DYNAMIC_SIZE_ESTIMATION_MEMBER(nodeName_) DYNAMIC_SIZE_ESTIMATION_MEMBER(unhealthyEvaluations_) END_DYNAMIC_SIZE_ESTIMATION() private: std::wstring nodeName_; }; DEFINE_HEALTH_EVALUATION_ACTIVATOR( NodeHealthEvaluation, FABRIC_HEALTH_EVALUATION_KIND_NODE ) }
892
945
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.iotdb.db.integration; import org.apache.iotdb.integration.env.EnvFactory; import org.apache.iotdb.itbase.category.ClusterTest; import org.apache.iotdb.itbase.category.LocalStandaloneTest; import org.apache.iotdb.itbase.category.RemoteTest; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import static org.apache.iotdb.db.constant.TestConstant.TIMESTAMP_STR; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; /** * Notice that, all test begins with "IoTDB" is integration test. All test which will start the * IoTDB server should be defined as integration test. * * <p>This test stores NaN Values and retrieves them via SQL Interface. */ @Category({LocalStandaloneTest.class, ClusterTest.class, RemoteTest.class}) public class IoTDBInsertNaNIT { private static final String CREATE_TEMPLATE_SQL = "CREATE TIMESERIES root.vehicle.%s.%s WITH DATATYPE=%s, ENCODING=%s, 'MAX_POINT_NUMBER'='%d'"; private static final String INSERT_TEMPLATE_SQL = "insert into root.vehicle.%s(timestamp,%s) values(%d,%s)"; private static final String INSERT_BRAND_NEW_TEMPLATE_SQL = "insert into root.cycle.%s(timestamp,%s) values(%d,%s)"; private static List<String> sqls = new ArrayList<>(); private static final int TIMESTAMP = 10; private static final String VALUE = "NaN"; private static final float DELTA_FLOAT = 0.0000001f; private static final double DELTA_DOUBLE = 0.0000001d; @BeforeClass public static void setUp() throws Exception { EnvFactory.getEnv().initBeforeClass(); initCreateSQLStatement(); insertData(); } @AfterClass public static void tearDown() throws Exception { EnvFactory.getEnv().cleanAfterClass(); } private static void initCreateSQLStatement() { sqls.add("SET STORAGE GROUP TO root.happy"); sqls.add("SET STORAGE GROUP TO root.cycle"); sqls.add("SET STORAGE GROUP TO root.vehicle.f0"); sqls.add("SET STORAGE GROUP TO root.vehicle.d0"); for (int i = 0; i < 10; i++) { sqls.add(String.format(CREATE_TEMPLATE_SQL, "f0", "s" + i + "rle", "FLOAT", "RLE", i)); sqls.add(String.format(CREATE_TEMPLATE_SQL, "f0", "s" + i + "2f", "FLOAT", "TS_2DIFF", i)); sqls.add(String.format(CREATE_TEMPLATE_SQL, "d0", "s" + i + "rle", "DOUBLE", "RLE", i)); sqls.add(String.format(CREATE_TEMPLATE_SQL, "d0", "s" + i + "2f", "DOUBLE", "TS_2DIFF", i)); } for (int i = 0; i < 10; i++) { sqls.add(String.format(INSERT_TEMPLATE_SQL, "f0", "s" + i + "rle", TIMESTAMP, VALUE)); sqls.add(String.format(INSERT_TEMPLATE_SQL, "f0", "s" + i + "2f", TIMESTAMP, VALUE)); sqls.add(String.format(INSERT_TEMPLATE_SQL, "d0", "s" + i + "rle", TIMESTAMP, VALUE)); sqls.add(String.format(INSERT_TEMPLATE_SQL, "d0", "s" + i + "2f", TIMESTAMP, VALUE)); } } private static void insertData() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (String sql : sqls) { statement.execute(sql); } } catch (Exception e) { e.printStackTrace(); } } @Test public void selectAllSQLTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { boolean hasResultSet = statement.execute("select * from root.vehicle.*"); Assert.assertTrue(hasResultSet); int cnt; try (ResultSet resultSet = statement.getResultSet()) { cnt = 0; while (resultSet.next()) { assertEquals(TIMESTAMP + "", resultSet.getString(TIMESTAMP_STR)); for (int i = 0; i < 10; i++) { Assert.assertEquals( Float.parseFloat(VALUE), resultSet.getFloat(String.format("root.vehicle.%s.%s", "f0", "s" + i + "rle")), DELTA_FLOAT); Assert.assertEquals( Float.parseFloat(VALUE), resultSet.getFloat(String.format("root.vehicle.%s.%s", "f0", "s" + i + "2f")), DELTA_FLOAT); Assert.assertEquals( Double.parseDouble(VALUE), resultSet.getDouble(String.format("root.vehicle.%s.%s", "d0", "s" + i + "rle")), DELTA_DOUBLE); Assert.assertEquals( Double.parseDouble(VALUE), resultSet.getDouble(String.format("root.vehicle.%s.%s", "d0", "s" + i + "2f")), DELTA_DOUBLE); } cnt++; } Assert.assertEquals(1, cnt); } } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } } @Test public void selectTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( "CREATE TIMESERIES root.happy.device1.sensor1.temperature WITH DATATYPE=DOUBLE, ENCODING=RLE"); statement.execute( "INSERT INTO root.happy.device1.sensor1(timestamp,temperature) values(7925, NaN)"); boolean hasResultSet = statement.execute("select * from root.happy.device1.sensor1"); Assert.assertTrue(hasResultSet); int cnt; try (ResultSet resultSet = statement.getResultSet()) { cnt = 0; while (resultSet.next()) { assertEquals(7925 + "", resultSet.getString(TIMESTAMP_STR)); assertEquals( Double.parseDouble(VALUE), resultSet.getDouble("root.happy.device1.sensor1.temperature"), DELTA_DOUBLE); cnt++; } Assert.assertEquals(1, cnt); } } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } } @Test public void testNaNValue() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( String.format(INSERT_BRAND_NEW_TEMPLATE_SQL, "d0", "s0" + "2f", TIMESTAMP, VALUE)); boolean hasResultSet = statement.execute("show timeseries"); Assert.assertTrue(hasResultSet); boolean exist = false; try (ResultSet resultSet = statement.getResultSet()) { while (resultSet.next()) { if ((resultSet.getString("timeseries")).contains("root.cycle.d0.s0")) { exist = true; } } } assertTrue(exist); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } } }
3,117
1,799
package io.cucumber.compatibility.minimal; import io.cucumber.java.en.Given; import static org.junit.jupiter.api.Assertions.assertEquals; public class Minimal { @Given("I have {int} cukes in my belly") public void I_have_int_cukes_in_my_belly(int cukeCount) { assertEquals(42, cukeCount); } }
130
365
""" Only works for 'basic type' properties (bool, int and float)! Multi-dimensional arrays (like array of vectors) will be flattened into seq. """ collection.foreach_get(attr, some_seq) # Python equivalent for i in range(len(seq)): some_seq[i] = getattr(collection[i], attr)
89
1,025
<filename>CodeXL/Components/GpuDebugging/AMDTProcessDebugger/src/pdLoadedModulesManager.cpp //================================================================================== // Copyright (c) 2016 , Advanced Micro Devices, Inc. All rights reserved. // /// \author AMD Developer Tools Team /// \file pdLoadedModulesManager.cpp /// //================================================================================== //------------------------------ pdLoadedModulesManager.cpp ------------------------------ // Infra: #include <AMDTBaseTools/Include/gtAssert.h> #include <AMDTOSWrappers/Include/osMutexLocker.h> #include <AMDTOSWrappers/Include/osDebugLog.h> // Local: #include <src/pdStringConstants.h> #include <src/pdLoadedModule.h> #include <src/pdLoadedModulesManager.h> // --------------------------------------------------------------------------- // Name: pdLoadedModulesManager::pdLoadedModulesManager // Description: Constructor // Author: <NAME> // Date: 30/6/2010 // --------------------------------------------------------------------------- pdLoadedModulesManager::pdLoadedModulesManager() { initialize(); } // --------------------------------------------------------------------------- // Name: pdLoadedModulesManager::~pdLoadedModulesManager // Description: Destructor // Author: <NAME> // Date: 30/6/2010 // --------------------------------------------------------------------------- pdLoadedModulesManager::~pdLoadedModulesManager() { } // --------------------------------------------------------------------------- // Name: pdLoadedModulesManager::initialize // Description: Clears the class held data and initializes it. // Author: <NAME> // Date: 30/6/2010 // --------------------------------------------------------------------------- void pdLoadedModulesManager::initialize() { // Clear loaded modules data: _loadedModulesTree.clear(); } // --------------------------------------------------------------------------- // Name: pdLoadedModulesManager::onDebuggedProcessCreation // Description: Is called when the debugged process is created. // Arguments: event - Contains process creation event details. // Author: <NAME> // Date: 30/6/2010 // --------------------------------------------------------------------------- void pdLoadedModulesManager::onDebuggedProcessCreation(const apDebuggedProcessCreatedEvent& event) { GT_UNREFERENCED_PARAMETER(&event); initialize(); } // --------------------------------------------------------------------------- // Name: pdLoadedModulesManager::onDebuggedProcessTermination // Description: Is called when the debugged process is terminated. // Author: <NAME> // Date: 30/6/2010 // --------------------------------------------------------------------------- void pdLoadedModulesManager::onDebuggedProcessTermination() { initialize(); } // --------------------------------------------------------------------------- // Name: pdLoadedModulesManager::onModuleLoaded // Description: Is called when a module is loaded. // Arguments: modulePath - The module file path. // moduleBaseAddress - The module loaded address. // Return Val: bool - Success / failure. // Author: <NAME> // Date: 9/10/2005 // --------------------------------------------------------------------------- bool pdLoadedModulesManager::onModuleLoaded(const osFilePath& modulePath, osInstructionPointer moduleBaseAddress) { bool retVal = false; // Lock the access to the loaded modules data: osMutexLocker mtxLocker(_loadedModulesAccessMutex); // If this module is already registered as a loaded module: gtRedBlackTreeNode* pTreeNodeRepresentingModule = _loadedModulesTree.search(gtUInt64(moduleBaseAddress)); if (pTreeNodeRepresentingModule != NULL) { // Nothing to be done: retVal = true; } else { // This is the first time we are notified about this module: // Create a structure that will hold the module data: pdLoadedModule* pLoadedModuleStruct = new pdLoadedModule; GT_IF_WITH_ASSERT(pLoadedModuleStruct != NULL) { pLoadedModuleStruct->_loadedModuleData._pModuleStartAddress = moduleBaseAddress; pLoadedModuleStruct->_loadedModuleData._moduleFilePath = modulePath; // Register the module in the loaded modules red-black tree: gtAutoPtr<gtRedBlackTreeValue> aptrTreeNodeValue(pLoadedModuleStruct); _loadedModulesTree.insert(aptrTreeNodeValue); // Notify sub-classes about the new loaded module: onNewLoadedModule(*pLoadedModuleStruct); if (OS_DEBUG_LOG_EXTENSIVE <= osDebugLog::instance().loggedSeverity()) { // Output the loaded module to the log file: gtString dbgMsg; dbgMsg.appendFormattedString(L"Module Loaded. Module path: %ls. Module base address: %lu ", modulePath.asString().asCharArray(), (gtUInt64)moduleBaseAddress); OS_OUTPUT_DEBUG_LOG(dbgMsg.asCharArray(), OS_DEBUG_LOG_EXTENSIVE); } retVal = true; } } // Unlock the access to the loaded modules data: mtxLocker.unlockMutex(); GT_RETURN_WITH_ASSERT(retVal); } // --------------------------------------------------------------------------- // Name: pdLoadedModulesManager::onModuleUnloaded // Description: Is called when a module is unloaded. // Arguments: moduleBaseAddress - The module loaded address. // unLoadedModulePath - Output parameter, will get the path of the module that was unloaded. // Return Val: bool - Success / failure. // Author: <NAME> // Date: 9/10/2005 // --------------------------------------------------------------------------- bool pdLoadedModulesManager::onModuleUnloaded(osInstructionPointer moduleBaseAddress, osFilePath& unLoadedModulePath) { bool retVal = false; unLoadedModulePath.clear(); // Lock the access to the loaded modules data: osMutexLocker mtxLocker(_loadedModulesAccessMutex); // If the module is NOT registered as a loaded module: gtRedBlackTreeNode* pTreeNodeRepresentingModule = _loadedModulesTree.search(gtUInt64(moduleBaseAddress)); if (pTreeNodeRepresentingModule == NULL) { // Yaki 4/2/2010: // We didn't get a module loaded notification about this unloaded module. This sometimes happens when debugging 32 bit // applications on top of Vista 64 bit (google for 'UNLOAD_DLL_DEBUG_EVENT vista 64' to see other people who complain about this). // Unfortunately, using moduleBaseAddress, pdWin32ProcessDebugger::getDebuggedProcessDLLName() does not manage to figure out // the path of the unloaded module. Therefore, we will return an empty module path. unLoadedModulePath.clear(); } else { // Get the tree node value: gtRedBlackTreeValue* pTreeNodeValue = pTreeNodeRepresentingModule->getValue(); GT_IF_WITH_ASSERT(pTreeNodeValue != NULL) { // Get the unloaded module path: unLoadedModulePath = ((pdLoadedModule*)pTreeNodeValue)->_loadedModuleData._moduleFilePath; } // Remove module info from the loaded modules tree and delete the representing tree item: _loadedModulesTree.deleteNode(pTreeNodeRepresentingModule); retVal = true; } // Unlock the access to the loaded modules data: mtxLocker.unlockMutex(); return retVal; } // --------------------------------------------------------------------------- // Name: pdLoadedModulesManager::loadedModuleDetails // Description: Inputs the base address of a loaded module and returns its details. // Arguments: moduleBaseAddress - The module's base address. // Return Val: const apLoadedModule* - The loaded module details, or NULL if a module // having the input base address was not loaded (or unloaded). // Author: <NAME> // Date: 7/7/2010 // --------------------------------------------------------------------------- const apLoadedModule* pdLoadedModulesManager::loadedModuleDetails(osInstructionPointer moduleBaseAddress) const { const apLoadedModule* retVal = NULL; // Lock the access to the loaded modules data: osMutexLocker mtxLocker((osMutex&)_loadedModulesAccessMutex); // If this module is registered as a loaded module: gtRedBlackTreeNode* pTreeNodeRepresentingModule = _loadedModulesTree.search(gtUInt64(moduleBaseAddress)); if (pTreeNodeRepresentingModule != NULL) { // Get the tree node value: gtRedBlackTreeValue* pTreeNodeValue = pTreeNodeRepresentingModule->getValue(); GT_IF_WITH_ASSERT(pTreeNodeValue != NULL) { // Get the loaded module details: retVal = &(((pdLoadedModule*)pTreeNodeValue)->_loadedModuleData); } } return retVal; } // --------------------------------------------------------------------------- // Name: pdLoadedModulesManager::moduleContainingAddress // Description: Inputs a virtual memory address and returns the details of a module who's loaded virtual // addresses range contain this address. // Arguments: address - The input address. // Return Val: const apLoadedModule* - Will get the details of a module, or NULL if no module // loaded virtual addresses range contains the input address. // Author: <NAME> // Date: 7/7/2010 // --------------------------------------------------------------------------- const pdLoadedModule* pdLoadedModulesManager::moduleContainingAddress(osInstructionPointer address) const { const pdLoadedModule* retVal = NULL; // Get the module who's base address is the highest address which is lower than the input address: gtUInt64 searchKey = address; gtRedBlackTreeNode* pTreeNode = _loadedModulesTree.searchEqualOrLowerThan(searchKey); if (pTreeNode != NULL) { // Get the tree node value: gtRedBlackTreeValue* pTreeNodeValue = pTreeNode->getValue(); GT_IF_WITH_ASSERT(pTreeNodeValue != NULL) { // Get the represented module details: const pdLoadedModule& loadedModuleInfo = *((pdLoadedModule*)pTreeNodeValue); osInstructionPointer moduleStartAddress = loadedModuleInfo._loadedModuleData._pModuleStartAddress; size_t moduleLoadedSize = loadedModuleInfo._loadedModuleData._pModuleLoadedSize; osInstructionPointer moduleEndAddress = moduleStartAddress + moduleLoadedSize - 1; // If the input address resides in this module: if ((moduleStartAddress <= address) && (address < moduleEndAddress)) { retVal = &loadedModuleInfo; } } } return retVal; } // --------------------------------------------------------------------------- // Name: pdLoadedModulesManager::onModuleLoaded // Description: Is called when a debugged module is loaded for the first time. // Arguments: loadedModuleStruct - The loaded module's details. // Author: <NAME> // Date: 13/7/2010 // --------------------------------------------------------------------------- void pdLoadedModulesManager::onNewLoadedModule(const pdLoadedModule& loadedModuleStruct) { GT_UNREFERENCED_PARAMETER(&loadedModuleStruct); }
3,697
790
from admin_scripts.complex_app.models.bar import Bar
15
4,392
<filename>l2param.h #ifndef GEMV_PARAM_H #define GEMV_PARAM_H #ifdef movsd #undef movsd #endif #undef movapd #define movapd movaps #ifdef ATHLON #define ALIGNED_ACCESS #define MOVUPS_A movaps #define MOVUPS_XL movaps #define MOVUPS_XS movaps #define MOVUPS_YL movaps #define MOVUPS_YS movaps #define PREFETCH prefetcht0 #define PREFETCHSIZE 64 * 3 #endif #ifdef PENTIUM4 #define ALIGNED_ACCESS #define MOVUPS_A movaps #define MOVUPS_XL movaps #define MOVUPS_XS movaps #define MOVUPS_YL movaps #define MOVUPS_YS movaps #define PREFETCH prefetcht0 #define PREFETCHSIZE 64 * 2 #endif #ifdef CORE2 #define ALIGNED_ACCESS #define MOVUPS_A movaps #define MOVUPS_XL movaps #define MOVUPS_XS movaps #define MOVUPS_YL movaps #define MOVUPS_YS movaps #define PREFETCH prefetcht0 #define PREFETCHSIZE 64 * 4 #endif #ifdef PENRYN #define ALIGNED_ACCESS #define MOVUPS_A movaps #define MOVUPS_XL movaps #define MOVUPS_XS movaps #define MOVUPS_YL movaps #define MOVUPS_YS movaps #define PREFETCH prefetcht0 #define PREFETCHSIZE 64 * 4 #endif #ifdef NEHALEM #define MOVUPS_A movups #define MOVUPS_XL movups #define MOVUPS_XS movups #define MOVUPS_YL movups #define MOVUPS_YS movups #define PREFETCH prefetcht0 #define PREFETCHW prefetcht0 #define PREFETCHSIZE 64 * 3 #endif #ifdef SANDYBRIDGE #define MOVUPS_A movups #define MOVUPS_XL movups #define MOVUPS_XS movups #define MOVUPS_YL movups #define MOVUPS_YS movups #define PREFETCH prefetcht0 #define PREFETCHW prefetcht0 #define PREFETCHSIZE 64 * 3 #endif #ifdef OPTERON #define PREFETCH prefetch #define PREFETCHW prefetchw #ifndef COMPLEX #define PREFETCHSIZE 64 * 1 #else #define PREFETCHSIZE 64 * 1 #endif #define movsd movlps #endif #if defined(BARCELONA) || defined(SHANGHAI) || defined(BOBCAT) || defined(BARCELONA_OPTIMIZATION) #define ALIGNED_ACCESS #define MOVUPS_A movaps #define MOVUPS_XL movaps #define MOVUPS_XS movaps #define MOVUPS_YL movaps #define MOVUPS_YS movaps #define PREFETCH prefetch #define PREFETCHW prefetchw #ifndef COMPLEX #define PREFETCHSIZE 64 * 2 #else #define PREFETCHSIZE 64 * 4 #endif #endif #ifdef NANO #define ALIGNED_ACCESS #define MOVUPS_A movaps #define MOVUPS_XL movaps #define MOVUPS_XS movaps #define MOVUPS_YL movaps #define MOVUPS_YS movaps #define PREFETCH prefetcht0 #ifndef COMPLEX #define PREFETCHSIZE 64 * 1 #else #define PREFETCHSIZE 64 * 2 #endif #endif #ifndef PREOFFSET #ifdef L1_DATA_LINESIZE #define PREOFFSET (L1_DATA_LINESIZE >> 1) #else #define PREOFFSET 32 #endif #endif #ifndef GEMV_UNROLL #define GEMV_UNROLL 4 #endif #ifndef ZGEMV_UNROLL #define ZGEMV_UNROLL 4 #endif /* #define COPY_FORCE */ /* Always copy X or Y to the buffer */ /* #define NOCOPY_UNALIGNED */ /* Not copy if X or Y is not aligned */ #ifdef MOVUPS_A #define MOVUPS_A1(OFF, ADDR, REGS) MOVUPS_A OFF(ADDR), REGS #define MOVUPS_A2(OFF, ADDR, BASE, SCALE, REGS) MOVUPS_A OFF(ADDR, BASE, SCALE), REGS #else #define MOVUPS_A1(OFF, ADDR, REGS) movsd OFF(ADDR), REGS; movhps OFF + 8(ADDR), REGS #define MOVUPS_A2(OFF, ADDR, BASE, SCALE, REGS) movsd OFF(ADDR, BASE, SCALE), REGS; movhps OFF + 8(ADDR, BASE, SCALE), REGS #endif #define MOVRPS_A1(OFF, ADDR, REGS) movsd OFF + 8(ADDR), REGS; movhps OFF(ADDR), REGS #define MOVRPS_A2(OFF, ADDR, BASE, SCALE, REGS) movsd OFF + 8(ADDR, BASE, SCALE), REGS; movhps OFF(ADDR, BASE, SCALE), REGS #ifdef MOVUPS_XL #define MOVUPS_XL1(OFF, ADDR, REGS) MOVUPS_XL OFF(ADDR), REGS #else #define MOVUPS_XL1(OFF, ADDR, REGS) movsd OFF(ADDR), REGS; movhps OFF + 8(ADDR), REGS #endif #ifdef MOVUPS_XS #define MOVUPS_XS1(OFF, ADDR, REGS) MOVUPS_XS REGS, OFF(ADDR) #else #define MOVUPS_XS1(OFF, ADDR, REGS) movsd REGS, OFF(ADDR); movhps REGS, OFF + 8(ADDR) #endif #ifdef MOVUPS_YL #define MOVUPS_YL1(OFF, ADDR, REGS) MOVUPS_YL OFF(ADDR), REGS #else #define MOVUPS_YL1(OFF, ADDR, REGS) movsd OFF(ADDR), REGS; movhps OFF + 8(ADDR), REGS #endif #ifdef MOVUPS_YS #define MOVUPS_YS1(OFF, ADDR, REGS) MOVUPS_YS REGS, OFF(ADDR) #else #define MOVUPS_YS1(OFF, ADDR, REGS) movsd REGS, OFF(ADDR); movhps REGS, OFF + 8(ADDR) #endif #endif
1,984
1,694
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by <NAME>. // #import <objc/NSObject.h> @class NSString; @interface WNFileInfo : NSObject { NSString *filePath; NSString *_fileTitle; } @property(retain, nonatomic) NSString *fileTitle; // @synthesize fileTitle=_fileTitle; @property(retain, nonatomic) NSString *filePath; // @synthesize filePath; - (void).cxx_destruct; - (id)copyWithZone:(struct _NSZone *)arg1; @end
209
5,937
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. /************************************************************************** * module: UTIL.C * * * utility module * **************************************************************************/ /* Inclusions ----------------------------------------------------------- */ #include <stdlib.h> #ifdef _DEBUG #include <stdio.h> #endif #include "typedefs.h" #include "util.h" /* ---------------------------------------------------------------------- */ /* stolen from ffconfig mtxcalc.c */ uint16 log2( uint16 arg ) { if ( arg < 2 ) return( 0 ); if ( arg < 4 ) return( 1 ); if ( arg < 8 ) return( 2 ); if ( arg < 16 ) return( 3 ); if ( arg < 32 ) return( 4 ); if ( arg < 64 ) return( 5 ); if ( arg < 128 ) return( 6 ); if ( arg < 256 ) return( 7 ); if ( arg < 512 ) return( 8 ); if ( arg < 1024 ) return( 9 ); if ( arg < 2048 ) return( 10 ); if ( arg < 4096 ) return( 11 ); if ( arg < 8192 ) return( 12 ); if ( arg < 16384 ) return( 13 ); if ( arg < 32768 ) return( 14 ); return( 15 ); } /* ---------------------------------------------------------------------- */ int16 ValueOKForShort(uint32 ulValue) { if (ulValue & 0xFFFF0000) /* any high bits turned on */ return(0); return(1); }
470
3,223
<reponame>kouvel/corert<filename>src/Native/ObjWriter/debugInfo/codeView/codeViewTypeBuilder.h<gh_stars>1000+ //===---- codeViewTypeBuilder.h ---------------------------------*- C++ -*-===// // // type builder is used to convert .Net types into CodeView descriptors. // // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // //===----------------------------------------------------------------------===// #pragma once #include "debugInfo/typeBuilder.h" #include "llvm/DebugInfo/CodeView/TypeTableBuilder.h" #include <vector> using namespace llvm::codeview; class ArrayDimensionsDescriptor { public: const char *GetLengthName(unsigned index); const char *GetBoundsName(unsigned index); private: void Resize(unsigned NewSize); std::vector<std::string> Lengths; std::vector<std::string> Bounds; }; class UserDefinedCodeViewTypesBuilder : public UserDefinedTypesBuilder { public: UserDefinedCodeViewTypesBuilder(); void EmitTypeInformation(MCSection *TypeSection, MCSection *StrSection = nullptr) override; unsigned GetEnumTypeIndex(const EnumTypeDescriptor &TypeDescriptor, const EnumRecordTypeDescriptor *TypeRecords) override; unsigned GetClassTypeIndex(const ClassTypeDescriptor &ClassDescriptor) override; unsigned GetCompleteClassTypeIndex( const ClassTypeDescriptor &ClassDescriptor, const ClassFieldsTypeDescriptior &ClassFieldsDescriptor, const DataFieldDescriptor *FieldsDescriptors, const StaticDataFieldDescriptor *StaticsDescriptors) override; unsigned GetArrayTypeIndex(const ClassTypeDescriptor &ClassDescriptor, const ArrayTypeDescriptor &ArrayDescriptor) override; unsigned GetPointerTypeIndex(const PointerTypeDescriptor& PointerDescriptor) override; unsigned GetMemberFunctionTypeIndex(const MemberFunctionTypeDescriptor& MemberDescriptor, uint32_t const *const ArgumentTypes) override; unsigned GetMemberFunctionId(const MemberFunctionIdTypeDescriptor& MemberIdDescriptor) override; unsigned GetPrimitiveTypeIndex(PrimitiveTypeFlags Type) override; private: void EmitCodeViewMagicVersion(); ClassOptions GetCommonClassOptions(); unsigned GetEnumFieldListType(uint64 Count, const EnumRecordTypeDescriptor *TypeRecords); void AddBaseClass(FieldListRecordBuilder &FLBR, unsigned BaseClassId); void AddClassVTShape(FieldListRecordBuilder &FLBR); BumpPtrAllocator Allocator; TypeTableBuilder TypeTable; ArrayDimensionsDescriptor ArrayDimentions; TypeIndex ClassVTableTypeIndex; TypeIndex VFuncTabTypeIndex; };
837
1,555
<gh_stars>1000+ MIR_item_t create_mir_func_with_loop (MIR_context_t ctx, MIR_module_t *m) { MIR_item_t func; MIR_label_t fin, cont; MIR_reg_t ARG1, R2; MIR_type_t res_type; if (m != NULL) *m = MIR_new_module (ctx, "m"); res_type = MIR_T_I64; func = MIR_new_func (ctx, "loop", 1, &res_type, 1, MIR_T_I64, "arg1"); R2 = MIR_new_func_reg (ctx, func->u.func, MIR_T_I64, "count"); ARG1 = MIR_reg (ctx, "arg1", func->u.func); fin = MIR_new_label (ctx); cont = MIR_new_label (ctx); MIR_append_insn (ctx, func, MIR_new_insn (ctx, MIR_MOV, MIR_new_reg_op (ctx, R2), MIR_new_int_op (ctx, 0))); MIR_append_insn (ctx, func, MIR_new_insn (ctx, MIR_BGE, MIR_new_label_op (ctx, fin), MIR_new_reg_op (ctx, R2), MIR_new_reg_op (ctx, ARG1))); MIR_append_insn (ctx, func, cont); MIR_append_insn (ctx, func, MIR_new_insn (ctx, MIR_ADD, MIR_new_reg_op (ctx, R2), MIR_new_reg_op (ctx, R2), MIR_new_int_op (ctx, 1))); MIR_append_insn (ctx, func, MIR_new_insn (ctx, MIR_BLT, MIR_new_label_op (ctx, cont), MIR_new_reg_op (ctx, R2), MIR_new_reg_op (ctx, ARG1))); MIR_append_insn (ctx, func, fin); MIR_append_insn (ctx, func, MIR_new_ret_insn (ctx, 1, MIR_new_reg_op (ctx, R2))); MIR_finish_func (ctx); if (m != NULL) MIR_finish_module (ctx); return func; }
811
335
<filename>H/Hubris_noun.json { "word": "Hubris", "definitions": [ "Excessive pride or self-confidence.", "(in Greek tragedy) excessive pride towards or defiance of the gods, leading to nemesis." ], "parts-of-speech": "Noun" }
100
985
<gh_stars>100-1000 package com.github.zxh.classpy.classfile.attribute; /* EnclosingMethod_attribute { u2 attribute_name_index; u4 attribute_length; u2 class_index; u2 method_index; } */ public class EnclosingMethodAttribute extends AttributeInfo { { u2cp("class_index"); u2cp("method_index"); } }
160
1,510
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.drill.exec.store.hive; import java.util.Map; import com.fasterxml.jackson.annotation.JsonAlias; import org.apache.drill.common.logical.StoragePluginConfig; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeName; @JsonTypeName(HiveStoragePluginConfig.NAME) public class HiveStoragePluginConfig extends StoragePluginConfig { public static final String NAME = "hive"; private final Map<String, String> configProps; @JsonCreator public HiveStoragePluginConfig(@JsonProperty("configProps") // previously two names were allowed due to incorrectly written ser / der logic // allowing to use both during deserialization for backward compatibility @JsonAlias("config") Map<String, String> configProps) { this.configProps = configProps; } @JsonProperty public Map<String, String> getConfigProps() { return configProps; } @Override public int hashCode() { return configProps != null ? configProps.hashCode() : 0; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } HiveStoragePluginConfig that = (HiveStoragePluginConfig) o; if (configProps != null ? !configProps.equals(that.configProps) : that.configProps != null) { return false; } return true; } }
772
678
/** * This header is generated by class-dump-z 0.2b. * * Source: /System/Library/PrivateFrameworks/ScreenReaderOutputServer.framework/ScreenReaderOutputServer */ #import <ScreenReaderOutputServer/XXUnknownSuperclass.h> @class NSMutableDictionary, NSMutableArray; // iOSOpenDev: wrapped with define check (since occurs in other dumped files) #ifndef __SCROEvent__ #define __SCROEvent__ 1 @interface SCROEvent : XXUnknownSuperclass { int _handlerType; // 4 = 0x4 NSMutableArray *_callbacks; // 8 = 0x8 NSMutableDictionary *_setDictionary; // 12 = 0xc NSMutableDictionary *_getDictionary; // 16 = 0x10 NSMutableArray *_actions; // 20 = 0x14 BOOL _readOnly; // 24 = 0x18 } @property(retain) id mainDictionary; // G=0x2ad1; S=0x14f91; converted property @property(retain) id claimDictionary; // G=0x14c65; S=0x15141; converted property @property(readonly, assign) int handlerType; // G=0x14c55; converted property + (id)brailleEvent; // 0x15191 - (id)initForHandlerType:(int)handlerType; // 0xea5 - (void)dealloc; // 0xed1 // converted property getter: - (int)handlerType; // 0x14c55 - (void)requestRegisterCallbackForKey:(int)key; // 0x14c75 - (void)requestSetValue:(id)value forKey:(int)key; // 0x29d5 - (void)requestValueForKey:(int)key; // 0x14d4d - (void)requestPerformActionForKey:(int)key; // 0x14e41 - (id)claimValueForKey:(int)key; // 0x14f19 // converted property setter: - (void)setMainDictionary:(id)dictionary; // 0x14f91 // converted property getter: - (id)mainDictionary; // 0x2ad1 // converted property setter: - (void)setClaimDictionary:(id)dictionary; // 0x15141 // converted property getter: - (id)claimDictionary; // 0x14c65 - (void)performWithHandler:(id)handler trusted:(BOOL)trusted; // 0x151dd @end #endif
638
32,544
<reponame>DBatOWL/tutorials<gh_stars>1000+ package com.baeldung.composite.repository; import com.baeldung.composite.BookApplication; import com.baeldung.composite.entity.Book; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.Arrays; import java.util.List; import static org.junit.Assert.assertEquals; @RunWith(SpringRunner.class) @SpringBootTest(classes = BookApplication.class) public class BookRepositoryIntegrationTest { public static final String JAVA_101 = "Java101"; public static final String JANE = "Jane"; public static final String TECH = "Tech"; @Autowired BookRepository repository; @Before public void setUp() { Book book1 = new Book("John", JAVA_101, TECH, 20); Book book2 = new Book(JANE, JAVA_101, "Arch", 25); Book book3 = new Book(JANE, "Scala101", TECH, 23); repository.saveAll(Arrays.asList(book1, book2, book3)); } @After public void tearDown() { repository.deleteAll(); } @Test public void testFindByName() { List<Book> books = repository.findByIdName(JAVA_101); assertEquals(2, books.size()); } @Test public void testFindByAuthor() { List<Book> books = repository.findByIdAuthor(JANE); assertEquals(2, books.size()); } @Test public void testFindByGenre() { List<Book> books = repository.findByGenre(TECH); assertEquals(2, books.size()); } }
689
3,861
/** @file This PPI is installed by the platform PEIM to designate that a recovery boot is in progress. Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @par Revision Reference: This PPI is introduced in PI Version 1.0. **/ #ifndef __BOOT_IN_RECOVERY_MODE_PPI_H__ #define __BOOT_IN_RECOVERY_MODE_PPI_H__ #define EFI_PEI_BOOT_IN_RECOVERY_MODE_PPI \ { \ 0x17ee496a, 0xd8e4, 0x4b9a, {0x94, 0xd1, 0xce, 0x82, 0x72, 0x30, 0x8, 0x50 } \ } extern EFI_GUID gEfiPeiBootInRecoveryModePpiGuid; #endif
282
743
/* * This file is part of Pebble. * * Copyright (c) 2014 by <NAME> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.mitchellbosecke.pebble; import com.mitchellbosecke.pebble.error.PebbleException; import com.mitchellbosecke.pebble.loader.StringLoader; import com.mitchellbosecke.pebble.template.PebbleTemplate; import org.junit.jupiter.api.Test; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import static org.junit.jupiter.api.Assertions.assertEquals; class AttributeSubscriptSyntaxTest { @SuppressWarnings("serial") @Test void testAccessingValueWithSubscript() throws PebbleException, IOException { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .strictVariables(false).build(); String source = "{{ person['first-name'] }}"; PebbleTemplate template = pebble.getTemplate(source); Map<String, Object> context = new HashMap<>(); context.put("person", new HashMap<String, Object>() { { this.put("first-name", "Bob"); } }); Writer writer = new StringWriter(); template.evaluate(writer, context); assertEquals("Bob", writer.toString()); } @SuppressWarnings("serial") @Test void testAccessingValueWithExpressionSubscript() throws PebbleException, IOException { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .strictVariables(false).build(); String source1 = "{% set var = 'apple' %}{{ colors[var] }}"; PebbleTemplate template1 = pebble.getTemplate(source1); String source2 = "{% set var = 'pear' %}{{ colors[var] }}"; PebbleTemplate template2 = pebble.getTemplate(source2); Map<String, Object> context = new HashMap<>(); context.put("colors", new HashMap<String, Object>() { { this.put("apple", "red"); this.put("pear", "green"); } }); Writer writer1 = new StringWriter(); template1.evaluate(writer1, context); assertEquals("red", writer1.toString()); Writer writer2 = new StringWriter(); template2.evaluate(writer2, context); assertEquals("green", writer2.toString()); } @SuppressWarnings("serial") @Test void testAccessingValueWithIntegerExpressionSubscript() throws PebbleException, IOException { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .strictVariables(false).build(); String source1 = "{{ colors[one] }}"; PebbleTemplate template1 = pebble.getTemplate(source1); String source2 = "{{ colors[two] }}"; PebbleTemplate template2 = pebble.getTemplate(source2); Map<String, Object> context = new HashMap<>(); context.put("colors", new HashMap<Long, Object>() { { this.put(1L, "red"); this.put(2L, "green"); } }); context.put("one", 1L); context.put("two", 2L); Writer writer1 = new StringWriter(); template1.evaluate(writer1, context); assertEquals("red", writer1.toString()); Writer writer2 = new StringWriter(); template2.evaluate(writer2, context); assertEquals("green", writer2.toString()); } @SuppressWarnings("serial") @Test void testAccessingNestedValuesWithSubscript() throws PebbleException, IOException { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .strictVariables(false).build(); String source = "{{ person['name']['first'] }}"; PebbleTemplate template = pebble.getTemplate(source); Map<String, Object> context = new HashMap<>(); context.put("person", new HashMap<String, Object>() { { this.put("name", new HashMap<String, Object>() { { this.put("first", "Bob"); } }); } }); Writer writer = new StringWriter(); template.evaluate(writer, context); assertEquals("Bob", writer.toString()); } @SuppressWarnings("serial") @Test void testMixAndMatchingAttributeSyntax() throws PebbleException, IOException { PebbleEngine pebble = new PebbleEngine.Builder().loader(new StringLoader()) .strictVariables(false).build(); String source = "{{ person['name'].first }}"; PebbleTemplate template = pebble.getTemplate(source); Map<String, Object> context = new HashMap<>(); context.put("person", new HashMap<String, Object>() { { this.put("name", new HashMap<String, Object>() { { this.put("first", "Bob"); } }); } }); Writer writer = new StringWriter(); template.evaluate(writer, context); assertEquals("Bob", writer.toString()); source = "{{ person.name['first'] }}"; template = pebble.getTemplate(source); writer = new StringWriter(); template.evaluate(writer, context); assertEquals("Bob", writer.toString()); } }
1,790
448
<gh_stars>100-1000 class Solution { public: // we will use kadane's algorithm int maxSubArray(vector<int>& nums) { int max_sum = INT_MIN; int current_sum = 0; for(int i=0;i<nums.size();i++){ current_sum += nums[i]; max_sum = max(max_sum, current_sum); current_sum = max(0,current_sum); } return max_sum; } };
203
852
// // This class provide the data structure for the // ROC DAC parameters // // At this point I do not see a reason to make an // abstract layer for this code. // #include "CalibFormats/SiPixelObjects/interface/PixelROCDACSettings.h" #include "CalibFormats/SiPixelObjects/interface/PixelDACNames.h" #include <fstream> #include <iostream> using namespace pos; using namespace std; PixelROCDACSettings::PixelROCDACSettings() {} void PixelROCDACSettings::getDACs(vector<unsigned int>& dacs) const { dacs.clear(); dacs.push_back(Vdd_); dacs.push_back(Vana_); dacs.push_back(Vsf_); dacs.push_back(Vcomp_); dacs.push_back(Vleak_); dacs.push_back(VrgPr_); dacs.push_back(VwllPr_); dacs.push_back(VrgSh_); dacs.push_back(VwllSh_); dacs.push_back(VHldDel_); dacs.push_back(Vtrim_); dacs.push_back(VcThr_); dacs.push_back(VIbias_bus_); dacs.push_back(VIbias_sf_); dacs.push_back(VOffsetOp_); dacs.push_back(VbiasOp_); dacs.push_back(VOffsetRO_); dacs.push_back(VIon_); dacs.push_back(VIbias_PH_); dacs.push_back(VIbias_DAC_); dacs.push_back(VIbias_roc_); dacs.push_back(VIColOr_); dacs.push_back(Vnpix_); dacs.push_back(VsumCol_); dacs.push_back(Vcal_); dacs.push_back(CalDel_); dacs.push_back(TempRange_); dacs.push_back(WBC_); dacs.push_back(ChipContReg_); } // Added by Dario void PixelROCDACSettings::getDACs(std::map<std::string, unsigned int>& dacs) const { dacs.clear(); dacs[k_DACName_Vdd] = Vdd_; dacs[k_DACName_Vana] = Vana_; dacs[k_DACName_Vsf] = Vsf_; dacs[k_DACName_Vcomp] = Vcomp_; dacs[k_DACName_Vleak] = Vleak_; dacs[k_DACName_VrgPr] = VrgPr_; dacs[k_DACName_VwllPr] = VwllPr_; dacs[k_DACName_VrgSh] = VrgSh_; dacs[k_DACName_VwllSh] = VwllSh_; dacs[k_DACName_VHldDel] = VHldDel_; dacs[k_DACName_Vtrim] = Vtrim_; dacs[k_DACName_VcThr] = VcThr_; dacs[k_DACName_VIbias_bus] = VIbias_bus_; dacs[k_DACName_VIbias_sf] = VIbias_sf_; dacs[k_DACName_VOffsetOp] = VOffsetOp_; dacs[k_DACName_VbiasOp] = VbiasOp_; dacs[k_DACName_VOffsetRO] = VOffsetRO_; dacs[k_DACName_VIon] = VIon_; dacs[k_DACName_VIbias_PH] = VIbias_PH_; dacs[k_DACName_VIbias_DAC] = VIbias_DAC_; dacs[k_DACName_VIbias_roc] = VIbias_roc_; dacs[k_DACName_VIColOr] = VIColOr_; dacs[k_DACName_Vnpix] = Vnpix_; dacs[k_DACName_VsumCol] = VsumCol_; dacs[k_DACName_Vcal] = Vcal_; dacs[k_DACName_CalDel] = CalDel_; dacs[k_DACName_TempRange] = TempRange_; dacs[k_DACName_WBC] = WBC_; dacs[k_DACName_ChipContReg] = ChipContReg_; } // Added by Dario void PixelROCDACSettings::setDACs(std::map<std::string, unsigned int>& dacs) { Vdd_ = dacs[k_DACName_Vdd]; Vana_ = dacs[k_DACName_Vana]; Vsf_ = dacs[k_DACName_Vsf]; Vcomp_ = dacs[k_DACName_Vcomp]; Vleak_ = dacs[k_DACName_Vleak]; VrgPr_ = dacs[k_DACName_VrgPr]; VwllPr_ = dacs[k_DACName_VwllPr]; VrgSh_ = dacs[k_DACName_VrgSh]; VwllSh_ = dacs[k_DACName_VwllSh]; VHldDel_ = dacs[k_DACName_VHldDel]; Vtrim_ = dacs[k_DACName_Vtrim]; VcThr_ = dacs[k_DACName_VcThr]; VIbias_bus_ = dacs[k_DACName_VIbias_bus]; VIbias_sf_ = dacs[k_DACName_VIbias_sf]; VOffsetOp_ = dacs[k_DACName_VOffsetOp]; VbiasOp_ = dacs[k_DACName_VbiasOp]; VOffsetRO_ = dacs[k_DACName_VOffsetRO]; VIon_ = dacs[k_DACName_VIon]; VIbias_PH_ = dacs[k_DACName_VIbias_PH]; VIbias_DAC_ = dacs[k_DACName_VIbias_DAC]; VIbias_roc_ = dacs[k_DACName_VIbias_roc]; VIColOr_ = dacs[k_DACName_VIColOr]; Vnpix_ = dacs[k_DACName_Vnpix]; VsumCol_ = dacs[k_DACName_VsumCol]; Vcal_ = dacs[k_DACName_Vcal]; CalDel_ = dacs[k_DACName_CalDel]; TempRange_ = dacs[k_DACName_TempRange]; WBC_ = dacs[k_DACName_WBC]; ChipContReg_ = dacs[k_DACName_ChipContReg]; } // Added by Dario void PixelROCDACSettings::compareDACs(std::map<std::string, unsigned int>& dacs, std::map<std::string, bool>& changes, std::map<std::string, unsigned int>& previous) { changes[k_DACName_Vdd] = false; changes[k_DACName_Vana] = false; changes[k_DACName_Vsf] = false; changes[k_DACName_Vcomp] = false; changes[k_DACName_Vleak] = false; changes[k_DACName_VrgPr] = false; changes[k_DACName_VwllPr] = false; changes[k_DACName_VrgSh] = false; changes[k_DACName_VwllSh] = false; changes[k_DACName_VHldDel] = false; changes[k_DACName_Vtrim] = false; changes[k_DACName_VcThr] = false; changes[k_DACName_VIbias_bus] = false; changes[k_DACName_VIbias_sf] = false; changes[k_DACName_VOffsetOp] = false; changes[k_DACName_VbiasOp] = false; changes[k_DACName_VOffsetRO] = false; changes[k_DACName_VIon] = false; changes[k_DACName_VIbias_PH] = false; changes[k_DACName_VIbias_DAC] = false; changes[k_DACName_VIbias_roc] = false; changes[k_DACName_VIColOr] = false; changes[k_DACName_Vnpix] = false; changes[k_DACName_VsumCol] = false; changes[k_DACName_Vcal] = false; changes[k_DACName_CalDel] = false; changes[k_DACName_TempRange] = false; changes[k_DACName_WBC] = false; changes[k_DACName_ChipContReg] = false; if (Vdd_ != dacs[k_DACName_Vdd]) { changes[k_DACName_Vdd] = true; previous[k_DACName_Vdd] = Vdd_; } if (Vana_ != dacs[k_DACName_Vana]) { changes[k_DACName_Vana] = true; previous[k_DACName_Vana] = Vana_; } if (Vsf_ != dacs[k_DACName_Vsf]) { changes[k_DACName_Vsf] = true; previous[k_DACName_Vsf] = Vsf_; } if (Vcomp_ != dacs[k_DACName_Vcomp]) { changes[k_DACName_Vcomp] = true; previous[k_DACName_Vcomp] = Vcomp_; } if (Vleak_ != dacs[k_DACName_Vleak]) { changes[k_DACName_Vleak] = true; previous[k_DACName_Vleak] = Vleak_; } if (VrgPr_ != dacs[k_DACName_VrgPr]) { changes[k_DACName_VrgPr] = true; previous[k_DACName_VrgPr] = VrgPr_; } if (VwllPr_ != dacs[k_DACName_VwllPr]) { changes[k_DACName_VwllPr] = true; previous[k_DACName_VwllPr] = VwllPr_; } if (VrgSh_ != dacs[k_DACName_VrgSh]) { changes[k_DACName_VrgSh] = true; previous[k_DACName_VrgSh] = VrgSh_; } if (VwllSh_ != dacs[k_DACName_VwllSh]) { changes[k_DACName_VwllSh] = true; previous[k_DACName_VwllSh] = VwllSh_; } if (VHldDel_ != dacs[k_DACName_VHldDel]) { changes[k_DACName_VHldDel] = true; previous[k_DACName_VHldDel] = VHldDel_; } if (Vtrim_ != dacs[k_DACName_Vtrim]) { changes[k_DACName_Vtrim] = true; previous[k_DACName_Vtrim] = Vtrim_; } if (VcThr_ != dacs[k_DACName_VcThr]) { changes[k_DACName_VcThr] = true; previous[k_DACName_VcThr] = VcThr_; } if (VIbias_bus_ != dacs[k_DACName_VIbias_bus]) { changes[k_DACName_VIbias_bus] = true; previous[k_DACName_VIbias_bus] = VIbias_bus_; } if (VIbias_sf_ != dacs[k_DACName_VIbias_sf]) { changes[k_DACName_VIbias_sf] = true; previous[k_DACName_VIbias_sf] = VIbias_sf_; } if (VOffsetOp_ != dacs[k_DACName_VOffsetOp]) { changes[k_DACName_VOffsetOp] = true; previous[k_DACName_VOffsetOp] = VOffsetOp_; } if (VbiasOp_ != dacs[k_DACName_VbiasOp]) { changes[k_DACName_VbiasOp] = true; previous[k_DACName_VbiasOp] = VbiasOp_; } if (VOffsetRO_ != dacs[k_DACName_VOffsetRO]) { changes[k_DACName_VOffsetRO] = true; previous[k_DACName_VOffsetRO] = VOffsetRO_; } if (VIon_ != dacs[k_DACName_VIon]) { changes[k_DACName_VIon] = true; previous[k_DACName_VIon] = VIon_; } if (VIbias_PH_ != dacs[k_DACName_VIbias_PH]) { changes[k_DACName_VIbias_PH] = true; previous[k_DACName_VIbias_PH] = VIbias_PH_; } if (VIbias_DAC_ != dacs[k_DACName_VIbias_DAC]) { changes[k_DACName_VIbias_DAC] = true; previous[k_DACName_VIbias_DAC] = VIbias_DAC_; } if (VIbias_roc_ != dacs[k_DACName_VIbias_roc]) { changes[k_DACName_VIbias_roc] = true; previous[k_DACName_VIbias_roc] = VIbias_roc_; } if (VIColOr_ != dacs[k_DACName_VIColOr]) { changes[k_DACName_VIColOr] = true; previous[k_DACName_VIColOr] = VIColOr_; } if (Vnpix_ != dacs[k_DACName_Vnpix]) { changes[k_DACName_Vnpix] = true; previous[k_DACName_Vnpix] = Vnpix_; } if (VsumCol_ != dacs[k_DACName_VsumCol]) { changes[k_DACName_VsumCol] = true; previous[k_DACName_VsumCol] = VsumCol_; } if (Vcal_ != dacs[k_DACName_Vcal]) { changes[k_DACName_Vcal] = true; previous[k_DACName_Vcal] = Vcal_; } if (CalDel_ != dacs[k_DACName_CalDel]) { changes[k_DACName_CalDel] = true; previous[k_DACName_CalDel] = CalDel_; } if (TempRange_ != dacs[k_DACName_TempRange]) { changes[k_DACName_TempRange] = true; previous[k_DACName_TempRange] = TempRange_; } if (WBC_ != dacs[k_DACName_WBC]) { changes[k_DACName_WBC] = true; previous[k_DACName_WBC] = WBC_; } if (ChipContReg_ != dacs[k_DACName_ChipContReg]) { changes[k_DACName_ChipContReg] = true; previous[k_DACName_ChipContReg] = ChipContReg_; } } void PixelROCDACSettings::setDAC(unsigned int dacaddress, unsigned int dacvalue) { std::string mthn = "[PixelROCDACSettings::setDAC()]\t\t\t\t "; switch (dacaddress) { case 1: Vdd_ = dacvalue; break; case 2: Vana_ = dacvalue; break; case 3: Vsf_ = dacvalue; break; case 4: Vcomp_ = dacvalue; break; case 5: Vleak_ = dacvalue; break; case 6: VrgPr_ = dacvalue; break; case 7: VwllPr_ = dacvalue; break; case 8: VrgSh_ = dacvalue; break; case 9: VwllSh_ = dacvalue; break; case 10: VHldDel_ = dacvalue; break; case 11: Vtrim_ = dacvalue; break; case 12: VcThr_ = dacvalue; break; case 13: VIbias_bus_ = dacvalue; break; case 14: VIbias_sf_ = dacvalue; break; case 15: VOffsetOp_ = dacvalue; break; case 16: VbiasOp_ = dacvalue; break; case 17: VOffsetRO_ = dacvalue; break; case 18: VIon_ = dacvalue; break; case 19: VIbias_PH_ = dacvalue; break; case 20: VIbias_DAC_ = dacvalue; break; case 21: VIbias_roc_ = dacvalue; break; case 22: VIColOr_ = dacvalue; break; case 23: Vnpix_ = dacvalue; break; case 24: VsumCol_ = dacvalue; break; case 25: Vcal_ = dacvalue; break; case 26: CalDel_ = dacvalue; break; case 27: TempRange_ = dacvalue; break; case 254: WBC_ = dacvalue; break; case 253: ChipContReg_ = dacvalue; break; default: cout << __LINE__ << "]\t" << mthn << "DAC Address " << dacaddress << " does not exist!" << endl; } } void PixelROCDACSettings::writeBinary(ofstream& out) const { out << (char)rocid_.rocname().size(); out.write(rocid_.rocname().c_str(), rocid_.rocname().size()); out << Vdd_; out << Vana_; out << Vsf_; out << Vcomp_; out << Vleak_; out << VrgPr_; out << VwllPr_; out << VrgSh_; out << VwllSh_; out << VHldDel_; out << Vtrim_; out << VcThr_; out << VIbias_bus_; out << VIbias_sf_; out << VOffsetOp_; out << VbiasOp_; out << VOffsetRO_; out << VIon_; out << VIbias_PH_; out << VIbias_DAC_; out << VIbias_roc_; out << VIColOr_; out << Vnpix_; out << VsumCol_; out << Vcal_; out << CalDel_; out << TempRange_; out << WBC_; out << ChipContReg_; } int PixelROCDACSettings::readBinary(ifstream& in, const PixelROCName& rocid) { rocid_ = rocid; in.read((char*)&Vdd_, 1); in.read((char*)&Vana_, 1); in.read((char*)&Vsf_, 1); in.read((char*)&Vcomp_, 1); in.read((char*)&Vleak_, 1); in.read((char*)&VrgPr_, 1); in.read((char*)&VwllPr_, 1); in.read((char*)&VrgSh_, 1); in.read((char*)&VwllSh_, 1); in.read((char*)&VHldDel_, 1); in.read((char*)&Vtrim_, 1); in.read((char*)&VcThr_, 1); in.read((char*)&VIbias_bus_, 1); in.read((char*)&VIbias_sf_, 1); in.read((char*)&VOffsetOp_, 1); in.read((char*)&VbiasOp_, 1); in.read((char*)&VOffsetRO_, 1); in.read((char*)&VIon_, 1); in.read((char*)&VIbias_PH_, 1); in.read((char*)&VIbias_DAC_, 1); in.read((char*)&VIbias_roc_, 1); in.read((char*)&VIColOr_, 1); in.read((char*)&Vnpix_, 1); in.read((char*)&VsumCol_, 1); in.read((char*)&Vcal_, 1); in.read((char*)&CalDel_, 1); in.read((char*)&TempRange_, 1); in.read((char*)&WBC_, 1); in.read((char*)&ChipContReg_, 1); return 1; } void PixelROCDACSettings::writeASCII(ostream& out) const { out << "ROC: " << rocid_.rocname() << endl; out << k_DACName_Vdd << ": " << (int)Vdd_ << endl; out << k_DACName_Vana << ": " << (int)Vana_ << endl; out << k_DACName_Vsf << ": " << (int)Vsf_ << endl; out << k_DACName_Vcomp << ": " << (int)Vcomp_ << endl; out << k_DACName_Vleak << ": " << (int)Vleak_ << endl; out << k_DACName_VrgPr << ": " << (int)VrgPr_ << endl; out << k_DACName_VwllPr << ": " << (int)VwllPr_ << endl; out << k_DACName_VrgSh << ": " << (int)VrgSh_ << endl; out << k_DACName_VwllSh << ": " << (int)VwllSh_ << endl; out << k_DACName_VHldDel << ": " << (int)VHldDel_ << endl; out << k_DACName_Vtrim << ": " << (int)Vtrim_ << endl; out << k_DACName_VcThr << ": " << (int)VcThr_ << endl; out << k_DACName_VIbias_bus << ": " << (int)VIbias_bus_ << endl; out << k_DACName_VIbias_sf << ": " << (int)VIbias_sf_ << endl; out << k_DACName_VOffsetOp << ": " << (int)VOffsetOp_ << endl; out << k_DACName_VbiasOp << ": " << (int)VbiasOp_ << endl; out << k_DACName_VOffsetRO << ": " << (int)VOffsetRO_ << endl; out << k_DACName_VIon << ": " << (int)VIon_ << endl; out << k_DACName_VIbias_PH << ": " << (int)VIbias_PH_ << endl; out << k_DACName_VIbias_DAC << ": " << (int)VIbias_DAC_ << endl; out << k_DACName_VIbias_roc << ": " << (int)VIbias_roc_ << endl; out << k_DACName_VIColOr << ": " << (int)VIColOr_ << endl; out << k_DACName_Vnpix << ": " << (int)Vnpix_ << endl; out << k_DACName_VsumCol << ": " << (int)VsumCol_ << endl; out << k_DACName_Vcal << ": " << (int)Vcal_ << endl; out << k_DACName_CalDel << ": " << (int)CalDel_ << endl; out << k_DACName_TempRange << ": " << (int)TempRange_ << endl; out << k_DACName_WBC << ": " << (int)WBC_ << endl; out << k_DACName_ChipContReg << ": " << (int)ChipContReg_ << endl; } //============================================================================================= void PixelROCDACSettings::writeXML(ofstream* out) const { std::string mthn = "[PixelROCDACSettings::writeXML()]\t\t\t "; *out << " <DATA>" << endl; *out << " <ROC_NAME>" << rocid_.rocname() << "</ROC_NAME>" << endl; *out << " <VDD>" << (int)Vdd_ << "</VDD>" << endl; *out << " <VANA>" << (int)Vana_ << "</VANA>" << endl; *out << " <VSF>" << (int)Vsf_ << "</VSF>" << endl; *out << " <VCOMP>" << (int)Vcomp_ << "</VCOMP>" << endl; *out << " <VLEAK>" << (int)Vleak_ << "</VLEAK>" << endl; *out << " <VRGPR>" << (int)VrgPr_ << "</VRGPR>" << endl; *out << " <VWLLPR>" << (int)VwllPr_ << "</VWLLPR>" << endl; *out << " <VRGSH>" << (int)VrgSh_ << "</VRGSH>" << endl; *out << " <VWLLSH>" << (int)VwllSh_ << "</VWLLSH>" << endl; *out << " <VHLDDEL>" << (int)VHldDel_ << "</VHLDDEL>" << endl; *out << " <VTRIM>" << (int)Vtrim_ << "</VTRIM>" << endl; *out << " <VCTHR>" << (int)VcThr_ << "</VCTHR>" << endl; *out << " <VIBIAS_BUS>" << (int)VIbias_bus_ << "</VIBIAS_BUS>" << endl; *out << " <VIBIAS_SF>" << (int)VIbias_sf_ << "</VIBIAS_SF>" << endl; *out << " <VOFFSETOP>" << (int)VOffsetOp_ << "</VOFFSETOP>" << endl; *out << " <VBIASOP>" << (int)VbiasOp_ << "</VBIASOP>" << endl; *out << " <VOFFSETRO>" << (int)VOffsetRO_ << "</VOFFSETRO>" << endl; *out << " <VION>" << (int)VIon_ << "</VION>" << endl; *out << " <VIBIAS_PH>" << (int)VIbias_PH_ << "</VIBIAS_PH>" << endl; *out << " <VIBIAS_DAC>" << (int)VIbias_DAC_ << "</VIBIAS_DAC>" << endl; *out << " <VIBIAS_ROC>" << (int)VIbias_roc_ << "</VIBIAS_ROC>" << endl; *out << " <VICOLOR>" << (int)VIColOr_ << "</VICOLOR>" << endl; *out << " <VNPIX>" << (int)Vnpix_ << "</VNPIX>" << endl; *out << " <VSUMCOL>" << (int)VsumCol_ << "</VSUMCOL>" << endl; *out << " <VCAL>" << (int)Vcal_ << "</VCAL>" << endl; *out << " <CALDEL>" << (int)CalDel_ << "</CALDEL>" << endl; *out << " <TEMPRANGE>" << (int)TempRange_ << "</TEMPRANGE>" << endl; *out << " <WBC>" << (int)WBC_ << "</WBC>" << endl; *out << " <CHIPCONTREG>" << (int)ChipContReg_ << "</CHIPCONTREG>" << endl; *out << " </DATA>" << endl; *out << " " << endl; } //============================================================================================= void PixelROCDACSettings::checkTag(string tag, string dacName, const PixelROCName& rocid) { std::string mthn = "[PixelROCDACSettings::checkTag()]\t\t\t\t "; dacName += ":"; if (tag != dacName) { cout << __LINE__ << "]\t" << mthn << "Read ROC name : " << tag << endl; cout << __LINE__ << "]\t" << mthn << "But expected to find: " << dacName << endl; cout << __LINE__ << "]\t" << mthn << "When reading DAC settings for ROC " << rocid << endl; assert(0); } } int PixelROCDACSettings::read(std::istringstream& in, const PixelROCName& rocid) { std::string mthn = "[PixelROCDACSettings::read()]\t\t\t\t "; rocid_ = rocid; unsigned int tmp; string tag; // cout << "[PixelROCDACSettings::read()] |" << in.str() << "|" << endl ; in >> tag; checkTag(tag, k_DACName_Vdd, rocid); in >> tmp; Vdd_ = tmp; in >> tag; checkTag(tag, k_DACName_Vana, rocid); in >> tmp; Vana_ = tmp; in >> tag; checkTag(tag, k_DACName_Vsf, rocid); in >> tmp; Vsf_ = tmp; in >> tag; checkTag(tag, k_DACName_Vcomp, rocid); in >> tmp; Vcomp_ = tmp; in >> tag; checkTag(tag, k_DACName_Vleak, rocid); in >> tmp; Vleak_ = tmp; in >> tag; checkTag(tag, k_DACName_VrgPr, rocid); in >> tmp; VrgPr_ = tmp; in >> tag; checkTag(tag, k_DACName_VwllPr, rocid); in >> tmp; VwllPr_ = tmp; in >> tag; checkTag(tag, k_DACName_VrgSh, rocid); in >> tmp; VrgSh_ = tmp; in >> tag; checkTag(tag, k_DACName_VwllSh, rocid); in >> tmp; VwllSh_ = tmp; in >> tag; checkTag(tag, k_DACName_VHldDel, rocid); in >> tmp; VHldDel_ = tmp; in >> tag; checkTag(tag, k_DACName_Vtrim, rocid); in >> tmp; Vtrim_ = tmp; in >> tag; checkTag(tag, k_DACName_VcThr, rocid); in >> tmp; VcThr_ = tmp; in >> tag; checkTag(tag, k_DACName_VIbias_bus, rocid); in >> tmp; VIbias_bus_ = tmp; in >> tag; checkTag(tag, k_DACName_VIbias_sf, rocid); in >> tmp; VIbias_sf_ = tmp; in >> tag; checkTag(tag, k_DACName_VOffsetOp, rocid); in >> tmp; VOffsetOp_ = tmp; in >> tag; checkTag(tag, k_DACName_VbiasOp, rocid); in >> tmp; VbiasOp_ = tmp; in >> tag; checkTag(tag, k_DACName_VOffsetRO, rocid); in >> tmp; VOffsetRO_ = tmp; in >> tag; checkTag(tag, k_DACName_VIon, rocid); in >> tmp; VIon_ = tmp; in >> tag; checkTag(tag, k_DACName_VIbias_PH, rocid); in >> tmp; VIbias_PH_ = tmp; in >> tag; checkTag(tag, k_DACName_VIbias_DAC, rocid); in >> tmp; VIbias_DAC_ = tmp; in >> tag; checkTag(tag, k_DACName_VIbias_roc, rocid); in >> tmp; VIbias_roc_ = tmp; in >> tag; checkTag(tag, k_DACName_VIColOr, rocid); in >> tmp; VIColOr_ = tmp; in >> tag; checkTag(tag, k_DACName_Vnpix, rocid); in >> tmp; Vnpix_ = tmp; in >> tag; checkTag(tag, k_DACName_VsumCol, rocid); in >> tmp; VsumCol_ = tmp; in >> tag; checkTag(tag, k_DACName_Vcal, rocid); in >> tmp; Vcal_ = tmp; in >> tag; checkTag(tag, k_DACName_CalDel, rocid); in >> tmp; CalDel_ = tmp; in >> tag; if (tag == k_DACName_WBC + ":") { static bool first = true; if (first) { cout << __LINE__ << "]\t" << mthn << "**********************************************" << endl; cout << __LINE__ << "]\t" << mthn << "Did not find TempRange setting in DAC settings" << endl; cout << __LINE__ << "]\t" << mthn << "Will use a default value of 4." << endl; cout << __LINE__ << "]\t" << mthn << "This message will only be printed out once" << endl; cout << __LINE__ << "]\t" << mthn << "**********************************************" << endl; TempRange_ = 4; first = false; } in >> tmp; WBC_ = tmp; } else { checkTag(tag, k_DACName_TempRange, rocid); in >> tmp; TempRange_ = tmp; in >> tag; checkTag(tag, k_DACName_WBC, rocid); in >> tmp; WBC_ = tmp; } in >> tag; checkTag(tag, k_DACName_ChipContReg, rocid); in >> tmp; ChipContReg_ = tmp; return 0; } int PixelROCDACSettings::read(ifstream& in, const PixelROCName& rocid) { std::string mthn = "[PixelROCDACSettings::read()]\t\t\t\t "; rocid_ = rocid; unsigned int tmp; string tag; in >> tag; checkTag(tag, k_DACName_Vdd, rocid); in >> tmp; Vdd_ = tmp; in >> tag; checkTag(tag, k_DACName_Vana, rocid); in >> tmp; Vana_ = tmp; in >> tag; checkTag(tag, k_DACName_Vsf, rocid); in >> tmp; Vsf_ = tmp; in >> tag; checkTag(tag, k_DACName_Vcomp, rocid); in >> tmp; Vcomp_ = tmp; in >> tag; checkTag(tag, k_DACName_Vleak, rocid); in >> tmp; Vleak_ = tmp; in >> tag; checkTag(tag, k_DACName_VrgPr, rocid); in >> tmp; VrgPr_ = tmp; in >> tag; checkTag(tag, k_DACName_VwllPr, rocid); in >> tmp; VwllPr_ = tmp; in >> tag; checkTag(tag, k_DACName_VrgSh, rocid); in >> tmp; VrgSh_ = tmp; in >> tag; checkTag(tag, k_DACName_VwllSh, rocid); in >> tmp; VwllSh_ = tmp; in >> tag; checkTag(tag, k_DACName_VHldDel, rocid); in >> tmp; VHldDel_ = tmp; in >> tag; checkTag(tag, k_DACName_Vtrim, rocid); in >> tmp; Vtrim_ = tmp; in >> tag; checkTag(tag, k_DACName_VcThr, rocid); in >> tmp; VcThr_ = tmp; in >> tag; checkTag(tag, k_DACName_VIbias_bus, rocid); in >> tmp; VIbias_bus_ = tmp; in >> tag; checkTag(tag, k_DACName_VIbias_sf, rocid); in >> tmp; VIbias_sf_ = tmp; in >> tag; checkTag(tag, k_DACName_VOffsetOp, rocid); in >> tmp; VOffsetOp_ = tmp; in >> tag; checkTag(tag, k_DACName_VbiasOp, rocid); in >> tmp; VbiasOp_ = tmp; in >> tag; checkTag(tag, k_DACName_VOffsetRO, rocid); in >> tmp; VOffsetRO_ = tmp; in >> tag; checkTag(tag, k_DACName_VIon, rocid); in >> tmp; VIon_ = tmp; in >> tag; checkTag(tag, k_DACName_VIbias_PH, rocid); in >> tmp; VIbias_PH_ = tmp; in >> tag; checkTag(tag, k_DACName_VIbias_DAC, rocid); in >> tmp; VIbias_DAC_ = tmp; in >> tag; checkTag(tag, k_DACName_VIbias_roc, rocid); in >> tmp; VIbias_roc_ = tmp; in >> tag; checkTag(tag, k_DACName_VIColOr, rocid); in >> tmp; VIColOr_ = tmp; in >> tag; checkTag(tag, k_DACName_Vnpix, rocid); in >> tmp; Vnpix_ = tmp; in >> tag; checkTag(tag, k_DACName_VsumCol, rocid); in >> tmp; VsumCol_ = tmp; in >> tag; checkTag(tag, k_DACName_Vcal, rocid); in >> tmp; Vcal_ = tmp; in >> tag; checkTag(tag, k_DACName_CalDel, rocid); in >> tmp; CalDel_ = tmp; in >> tag; if (tag == k_DACName_WBC + ":") { static bool first = true; if (first) { cout << __LINE__ << "]\t" << mthn << "**********************************************" << endl; cout << __LINE__ << "]\t" << mthn << "Did not find TempRange setting in DAC settings" << endl; cout << __LINE__ << "]\t" << mthn << "Will use a default value of 4." << endl; cout << __LINE__ << "]\t" << mthn << "This message will only be printed out once" << endl; cout << __LINE__ << "]\t" << mthn << "**********************************************" << endl; TempRange_ = 4; first = false; } in >> tmp; WBC_ = tmp; } else { checkTag(tag, k_DACName_TempRange, rocid); in >> tmp; TempRange_ = tmp; in >> tag; checkTag(tag, k_DACName_WBC, rocid); in >> tmp; WBC_ = tmp; } in >> tag; checkTag(tag, k_DACName_ChipContReg, rocid); in >> tmp; ChipContReg_ = tmp; return 0; } string PixelROCDACSettings::getConfigCommand() { string s; return s; } ostream& pos::operator<<(ostream& s, const PixelROCDACSettings& dacs) { s << k_DACName_Vdd << " :" << (unsigned int)dacs.Vdd_ << endl; s << k_DACName_Vana << " :" << (unsigned int)dacs.Vana_ << endl; s << k_DACName_Vsf << " :" << (unsigned int)dacs.Vsf_ << endl; s << k_DACName_Vcomp << " :" << (unsigned int)dacs.Vcomp_ << endl; s << k_DACName_Vleak << " :" << (unsigned int)dacs.Vleak_ << endl; s << k_DACName_VrgPr << " :" << (unsigned int)dacs.VrgPr_ << endl; s << k_DACName_VwllPr << " :" << (unsigned int)dacs.VwllPr_ << endl; s << k_DACName_VrgSh << " :" << (unsigned int)dacs.VrgSh_ << endl; s << k_DACName_VwllSh << " :" << (unsigned int)dacs.VwllSh_ << endl; s << k_DACName_VHldDel << " :" << (unsigned int)dacs.VHldDel_ << endl; s << k_DACName_Vtrim << " :" << (unsigned int)dacs.Vtrim_ << endl; s << k_DACName_VcThr << " :" << (unsigned int)dacs.VcThr_ << endl; s << k_DACName_VIbias_bus << " :" << (unsigned int)dacs.VIbias_bus_ << endl; s << k_DACName_VIbias_sf << " :" << (unsigned int)dacs.VIbias_sf_ << endl; s << k_DACName_VOffsetOp << " :" << (unsigned int)dacs.VOffsetOp_ << endl; s << k_DACName_VbiasOp << " :" << (unsigned int)dacs.VbiasOp_ << endl; s << k_DACName_VOffsetRO << " :" << (unsigned int)dacs.VOffsetRO_ << endl; s << k_DACName_VIon << " :" << (unsigned int)dacs.VIon_ << endl; s << k_DACName_VIbias_PH << " :" << (unsigned int)dacs.VIbias_PH_ << endl; s << k_DACName_VIbias_DAC << " :" << (unsigned int)dacs.VIbias_DAC_ << endl; s << k_DACName_VIbias_roc << " :" << (unsigned int)dacs.VIbias_roc_ << endl; s << k_DACName_VIColOr << " :" << (unsigned int)dacs.VIColOr_ << endl; s << k_DACName_Vnpix << " :" << (unsigned int)dacs.Vnpix_ << endl; s << k_DACName_VsumCol << " :" << (unsigned int)dacs.VsumCol_ << endl; s << k_DACName_Vcal << " :" << (unsigned int)dacs.Vcal_ << endl; s << k_DACName_CalDel << " :" << (unsigned int)dacs.CalDel_ << endl; s << k_DACName_TempRange << " :" << (unsigned int)dacs.TempRange_ << endl; s << k_DACName_WBC << " :" << (unsigned int)dacs.WBC_ << endl; s << k_DACName_ChipContReg << " :" << (unsigned int)dacs.ChipContReg_ << endl; return s; } //Added by Umesh void PixelROCDACSettings::setDac(string dacName, int dacValue) { if (ToLower(dacName) == ToLower(k_DACName_Vdd)) { Vdd_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_Vana)) { Vana_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_Vsf)) { Vsf_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_Vcomp)) { Vcomp_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_Vleak)) { Vleak_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VrgPr)) { VrgPr_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VwllPr)) { VwllPr_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VrgSh)) { VrgSh_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VwllSh)) { VwllSh_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VHldDel)) { VHldDel_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_Vtrim)) { Vtrim_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VcThr)) { VcThr_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VIbias_bus)) { VIbias_bus_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VIbias_sf)) { VIbias_sf_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VOffsetOp)) { VOffsetOp_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VbiasOp)) { VbiasOp_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VOffsetRO)) { VOffsetRO_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VIon)) { VIon_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VIbias_PH)) { VIbias_PH_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VIbias_DAC)) { VIbias_DAC_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VIbias_roc)) { VIbias_roc_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VIColOr)) { VIColOr_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_Vnpix)) { ; Vnpix_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_VsumCol)) { VsumCol_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_Vcal)) { Vcal_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_CalDel)) { CalDel_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_TempRange)) { TempRange_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_WBC)) { WBC_ = dacValue; } else if (ToLower(dacName) == ToLower(k_DACName_ChipContReg)) { ChipContReg_ = dacValue; } else { cout << "ERROR in PixelROCDACSettings::setDac: DAC name " << dacName << " does not exist." << endl; assert(0); } } unsigned int PixelROCDACSettings::getDac(string dacName) const { if (dacName == k_DACName_Vdd) { return Vdd_; } else if (dacName == k_DACName_Vana) { return Vana_; } else if (dacName == k_DACName_Vsf) { return Vsf_; } else if (dacName == k_DACName_Vcomp) { return Vcomp_; } else if (dacName == k_DACName_Vleak) { return Vleak_; } else if (dacName == k_DACName_VrgPr) { return VrgPr_; } else if (dacName == k_DACName_VwllPr) { return VwllPr_; } else if (dacName == k_DACName_VrgSh) { return VrgSh_; } else if (dacName == k_DACName_VwllSh) { return VwllSh_; } else if (dacName == k_DACName_VHldDel) { return VHldDel_; } else if (dacName == k_DACName_Vtrim) { return Vtrim_; } else if (dacName == k_DACName_VcThr) { return VcThr_; } else if (dacName == k_DACName_VIbias_bus) { return VIbias_bus_; } else if (dacName == k_DACName_VIbias_sf) { return VIbias_sf_; } else if (dacName == k_DACName_VOffsetOp) { return VOffsetOp_; } else if (dacName == k_DACName_VbiasOp) { return VbiasOp_; } else if (dacName == k_DACName_VOffsetRO) { return VOffsetRO_; } else if (dacName == k_DACName_VIon) { return VIon_; } else if (dacName == k_DACName_VIbias_PH) { return VIbias_PH_; } else if (dacName == k_DACName_VIbias_DAC) { return VIbias_DAC_; } else if (dacName == k_DACName_VIbias_roc) { return VIbias_roc_; } else if (dacName == k_DACName_VIColOr) { return VIColOr_; } else if (dacName == k_DACName_Vnpix) { return Vnpix_; } else if (dacName == k_DACName_VsumCol) { return VsumCol_; } else if (dacName == k_DACName_Vcal) { return Vcal_; } else if (dacName == k_DACName_CalDel) { return CalDel_; } else if (dacName == k_DACName_TempRange) { return TempRange_; } else if (dacName == k_DACName_WBC) { return WBC_; } else if (dacName == k_DACName_ChipContReg) { return ChipContReg_; } else { cout << "ERROR in PixelROCDACSettings::getDac: DAC name " << dacName << " does not exist." << endl; assert(0); } } string PixelROCDACSettings::ToLower(string generic) { string result; for (unsigned int i = 0; i < generic.length(); i++) { result.append(1, (char)tolower(generic[i])); } return result; }
15,571
14,668
<reponame>zealoussnow/chromium // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_COCOA_APPLESCRIPT_CONSTANTS_APPLESCRIPT_H_ #define CHROME_BROWSER_UI_COCOA_APPLESCRIPT_CONSTANTS_APPLESCRIPT_H_ #import <Cocoa/Cocoa.h> // This file contains the constant that are use to set the property of an // applescript scriptable item. namespace AppleScript { // Property to access windows. extern NSString* const kWindowsProperty; // Property to access tabs. extern NSString* const kTabsProperty; // Property to access bookmarks folders. extern NSString* const kBookmarkFoldersProperty; // Property to access bookmark items. extern NSString* const kBookmarkItemsProperty; // To indicate a window in normal mode. extern NSString* const kNormalWindowMode; // To indicate a window in incognito mode. extern NSString* const kIncognitoWindowMode; } #endif // CHROME_BROWSER_UI_COCOA_APPLESCRIPT_CONSTANTS_APPLESCRIPT_H_
350
2,118
// Copyright (c) 2006-2018 <NAME> // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt) #include "test_skiplist_hp.h" #include <cds/container/skip_list_map_hp.h> namespace { namespace cc = cds::container; typedef cds::gc::HP gc_type; class SkipListMap_HP : public cds_test::skiplist_map_hp { protected: typedef cds_test::skiplist_map_hp base_class; void SetUp() { typedef cc::SkipListMap< gc_type, key_type, value_type > map_type; // +1 - for guarded_ptr cds::gc::hp::GarbageCollector::Construct( map_type::c_nHazardPtrCount + 1, 1, 16 ); cds::threading::Manager::attachThread(); } void TearDown() { cds::threading::Manager::detachThread(); cds::gc::hp::GarbageCollector::Destruct( true ); } }; # define CDSTEST_FIXTURE_NAME SkipListMap_HP # include "skiplist_hp_inl.h" } // namespace
473
1,244
#ifndef sodium_utils_H #define sodium_utils_H #include <stddef.h> #include "export.h" #ifdef __cplusplus extern "C" { #endif #ifndef SODIUM_C99 # if defined(__cplusplus) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L # define SODIUM_C99(X) # else # define SODIUM_C99(X) X # endif #endif SODIUM_EXPORT void sodium_memzero(void * const pnt, const size_t len); /* * WARNING: sodium_memcmp() must be used to verify if two secret keys * are equal, in constant time. * It returns 0 if the keys are equal, and -1 if they differ. * This function is not designed for lexicographical comparisons. */ SODIUM_EXPORT int sodium_memcmp(const void * const b1_, const void * const b2_, size_t len) __attribute__ ((warn_unused_result)); /* * sodium_compare() returns -1 if b1_ < b2_, 1 if b1_ > b2_ and 0 if b1_ == b2_ * It is suitable for lexicographical comparisons, or to compare nonces * and counters stored in little-endian format. * However, it is slower than sodium_memcmp(). */ SODIUM_EXPORT int sodium_compare(const unsigned char *b1_, const unsigned char *b2_, size_t len) __attribute__ ((warn_unused_result)); SODIUM_EXPORT int sodium_is_zero(const unsigned char *n, const size_t nlen); SODIUM_EXPORT void sodium_increment(unsigned char *n, const size_t nlen); SODIUM_EXPORT void sodium_add(unsigned char *a, const unsigned char *b, const size_t len); SODIUM_EXPORT char *sodium_bin2hex(char * const hex, const size_t hex_maxlen, const unsigned char * const bin, const size_t bin_len); SODIUM_EXPORT int sodium_hex2bin(unsigned char * const bin, const size_t bin_maxlen, const char * const hex, const size_t hex_len, const char * const ignore, size_t * const bin_len, const char ** const hex_end); SODIUM_EXPORT int sodium_mlock(void * const addr, const size_t len); SODIUM_EXPORT int sodium_munlock(void * const addr, const size_t len); /* WARNING: sodium_malloc() and sodium_allocarray() are not general-purpose * allocation functions. * * They return a pointer to a region filled with 0xd0 bytes, immediately * followed by a guard page. * As a result, accessing a single byte after the requested allocation size * will intentionally trigger a segmentation fault. * * A canary and an additional guard page placed before the beginning of the * region may also kill the process if a buffer underflow is detected. * * The memory layout is: * [unprotected region size (read only)][guard page (no access)][unprotected pages (read/write)][guard page (no access)] * With the layout of the unprotected pages being: * [optional padding][16-bytes canary][user region] * * However: * - These functions are significantly slower than standard functions * - Each allocation requires 3 or 4 additional pages * - The returned address will not be aligned if the allocation size is not * a multiple of the required alignment. For this reason, these functions * are designed to store data, such as secret keys and messages. * * sodium_malloc() can be used to allocate any libsodium data structure, * with the exception of crypto_generichash_state. * * The crypto_generichash_state structure is packed and its length is * either 357 or 361 bytes. For this reason, when using sodium_malloc() to * allocate a crypto_generichash_state structure, padding must be added in * order to ensure proper alignment: * state = sodium_malloc((crypto_generichash_statebytes() + (size_t) 63U) * & ~(size_t) 63U); */ SODIUM_EXPORT void *sodium_malloc(const size_t size) __attribute__ ((malloc)); SODIUM_EXPORT void *sodium_allocarray(size_t count, size_t size) __attribute__ ((malloc)); SODIUM_EXPORT void sodium_free(void *ptr); SODIUM_EXPORT int sodium_mprotect_noaccess(void *ptr); SODIUM_EXPORT int sodium_mprotect_readonly(void *ptr); SODIUM_EXPORT int sodium_mprotect_readwrite(void *ptr); /* -------- */ int _sodium_alloc_init(void); #ifdef __cplusplus } #endif #endif
1,410
6,140
# encoding=utf-8 import warnings from collections import OrderedDict from airtest.core.android.touch_methods.minitouch import Minitouch from airtest.core.android.touch_methods.maxtouch import Maxtouch from airtest.core.android.constant import TOUCH_METHOD from airtest.utils.logger import get_logger LOGGING = get_logger(__name__) class TouchProxy(object): """ Perform touch operation according to the specified method """ TOUCH_METHODS = OrderedDict() def __init__(self, touch_method): self.touch_method = touch_method def __getattr__(self, name): if name == "method_name": return self.touch_method.METHOD_NAME method = getattr(self.touch_method, name, getattr(self.touch_method.base_touch, name, None)) if method: return method else: raise NotImplementedError("%s does not support %s method" % (getattr(self.touch_method, "METHOD_NAME", ""), name)) @classmethod def check_touch(cls, touch_impl): try: touch_impl.base_touch.install_and_setup() except Exception as e: LOGGING.error(e) LOGGING.warning("%s setup up failed!" % touch_impl.METHOD_NAME) return False else: return True @classmethod def auto_setup(cls, adb, default_method=None, ori_transformer=None, size_info=None, input_event=None): """ Args: adb: :py:mod:`airtest.core.android.adb.ADB` default_method: The default click method, such as "MINITOUCH" ori_transformer: dev._touch_point_by_orientation size_info: the result of dev.get_display_info() input_event: dev.input_event *args: **kwargs: Returns: TouchProxy object Examples: >>> dev = Android() >>> touch_proxy = TouchProxy.auto_setup(dev.adb, ori_transformer=dev._touch_point_by_orientation) >>> touch_proxy.touch((100, 100)) """ if default_method and default_method in cls.TOUCH_METHODS: touch_method = cls.TOUCH_METHODS[default_method].METHOD_CLASS(adb, size_info=size_info, input_event=input_event) impl = cls.TOUCH_METHODS[default_method](touch_method, ori_transformer) if cls.check_touch(impl): return TouchProxy(impl) # cls.TOUCH_METHODS中不包含ADBTOUCH,因此即使指定了default_method=ADBTOUCH,也优先尝试初始化其他点击方法 for name, touch_impl in cls.TOUCH_METHODS.items(): if default_method == name: continue touch_method = touch_impl.METHOD_CLASS(adb, size_info=size_info, input_event=input_event) impl = touch_impl(touch_method, ori_transformer) if cls.check_touch(impl): return TouchProxy(impl) # If both minitouch and maxtouch fail to initialize, use adbtouch # 如果minitouch和maxtouch都初始化失败,使用adbtouch adb_touch = AdbTouchImplementation(adb) warnings.warn("Currently using ADB touch, the efficiency may be very low.") return TouchProxy(adb_touch) def register_touch(cls): TouchProxy.TOUCH_METHODS[cls.METHOD_NAME] = cls return cls class AdbTouchImplementation(object): METHOD_NAME = TOUCH_METHOD.ADBTOUCH def __init__(self, base_touch): """ :param base_touch: :py:mod:`airtest.core.android.adb.ADB` """ self.base_touch = base_touch def touch(self, pos, duration=0.01): if duration <= 0.01: self.base_touch.touch(pos) else: self.swipe(pos, pos, duration=duration) def swipe(self, p1, p2, duration=0.5, *args, **kwargs): duration *= 1000 self.base_touch.swipe(p1, p2, duration=duration) @register_touch class MinitouchImplementation(AdbTouchImplementation): METHOD_NAME = TOUCH_METHOD.MINITOUCH METHOD_CLASS = Minitouch def __init__(self, minitouch, ori_transformer): """ :param minitouch: :py:mod:`airtest.core.android.touch_methods.minitouch.Minitouch` :param ori_transformer: Android._touch_point_by_orientation() """ super(MinitouchImplementation, self).__init__(minitouch) self.ori_transformer = ori_transformer def touch(self, pos, duration=0.01): pos = self.ori_transformer(pos) self.base_touch.touch(pos, duration=duration) def swipe(self, p1, p2, duration=0.5, steps=5, fingers=1): p1 = self.ori_transformer(p1) p2 = self.ori_transformer(p2) if fingers == 1: self.base_touch.swipe(p1, p2, duration=duration, steps=steps) elif fingers == 2: self.base_touch.two_finger_swipe(p1, p2, duration=duration, steps=steps) else: raise Exception("param fingers should be 1 or 2") def pinch(self, center=None, percent=0.5, duration=0.5, steps=5, in_or_out='in'): if center: center = self.ori_transformer(center) self.base_touch.pinch(center=center, percent=percent, duration=duration, steps=steps, in_or_out=in_or_out) def swipe_along(self, coordinates_list, duration=0.8, steps=5): pos_list = [self.ori_transformer(xy) for xy in coordinates_list] self.base_touch.swipe_along(pos_list, duration=duration, steps=steps) def two_finger_swipe(self, tuple_from_xy, tuple_to_xy, duration=0.8, steps=5, offset=(0, 50)): tuple_from_xy = self.ori_transformer(tuple_from_xy) tuple_to_xy = self.ori_transformer(tuple_to_xy) self.base_touch.two_finger_swipe(tuple_from_xy, tuple_to_xy, duration=duration, steps=steps, offset=offset) def perform(self, motion_events, interval=0.01): self.base_touch.perform(motion_events, interval) @register_touch class MaxtouchImplementation(MinitouchImplementation): METHOD_NAME = TOUCH_METHOD.MAXTOUCH METHOD_CLASS = Maxtouch def __init__(self, maxtouch, ori_transformer): """ New screen click scheme, support Android10 新的屏幕点击方案,支持Android10以上版本 :param maxtouch: :py:mod:`airtest.core.android.touch_methods.maxtouch.Maxtouch` :param ori_transformer: Android._touch_point_by_orientation() """ super(MaxtouchImplementation, self).__init__(maxtouch, ori_transformer) def perform(self, motion_events, interval=0.01): self.base_touch.perform(motion_events, interval)
2,993
799
from CommonServerPython import * ''' IMPORTS ''' import urllib.parse import urllib3 from typing import List, Dict, Any, Tuple, Union, Callable # Disable insecure warnings urllib3.disable_warnings() ''' CONSTANTS ''' MESSAGES: Dict[str, str] = { 'TEST_FAILED_ERROR': 'Test connectivity failed. Check the configuration parameters provided.', 'BOOLEAN_ERROR': 'The argument {} must be either true or false.', } HR_MESSAGES: Dict[str, str] = { 'ACL_ADD_SUCCESS': 'Giving an access control rule for calendar id "{}".', 'LIST_COMMAND_SUCCESS': 'Total Retrieved {}: {}', } URL_SUFFIX: Dict[str, str] = { 'TEST_MODULE': 'calendar/v3/users/me/calendarList', 'CALENDAR_ACL': 'calendar/v3/calendars/{}/acl' } SCOPES: Dict[str, List[str]] = { 'TEST_MODULE': ['https://www.googleapis.com/auth/userinfo.email'], 'CALENDAR': ['https://www.googleapis.com/auth/calendar'], } OUTPUT_PREFIX: Dict[str, str] = { 'ADD_ACL': 'GoogleCalendar.Acl', 'LIST_ACL': 'GoogleCalendar.Acl(val.id == obj.id && val.calendarId == obj.calendarId && val.userId == obj.userId)', 'LIST_ACL_PAGE_TOKEN': 'GoogleCalendar.PageToken.Acl(val.calendarId == obj.calendarId && val.userId == obj.userId)', } NEXT_PAGE_TOKEN: str = '### Next Page Token: {}\n' def prepare_acl_list_output(acl_records: Dict[str, Any], calendar_id: str, user_id: str) -> \ Tuple[Dict[str, Union[List[Dict[str, Union[str, Any]]], Dict[str, Union[str, Any]]]], List[dict]]: """ Prepares context output and human readable for gsuite-acl-list command. :param acl_records: Dict containing acl records. :param calendar_id: Calendar id. :param user_id: User id. :return: Tuple of prepared context output list and human readable. """ acl_context = [{'calendarId': calendar_id, 'userId': user_id, 'kind': record.get('kind', ''), 'etag': record.get('etag', ''), 'id': record.get('id', ''), 'scopeType': record.get('scope', {}).get('type', ''), 'scopeValue': record.get('scope', {}).get('value', ''), 'role': record.get('role', '') } for record in acl_records.get('items', [])] page_context = { 'calendarId': calendar_id, 'userId': user_id, 'nextPageToken': acl_records.get('nextPageToken', ''), 'nextSyncToken': acl_records.get('nextSyncToken', '') } outputs = { OUTPUT_PREFIX['LIST_ACL']: acl_context, OUTPUT_PREFIX['LIST_ACL_PAGE_TOKEN']: page_context } outputs = GSuiteClient.remove_empty_entities(outputs) acl_hr = acl_context acl_hr_list = [ {acl_key: acl_value for acl_key, acl_value in acl.items() if acl_key not in ['kind', 'etag', 'calendarId', 'userId']} for acl in acl_hr] acl_hr_list = GSuiteClient.remove_empty_entities(acl_hr_list) return outputs, acl_hr_list def prepare_output_acl_add(acl_records: Dict[str, Any], calendar_id: str, user_id: str) -> Tuple[Dict[str, Any], List[Dict[str, Any]]]: """ Prepares context output and human readable for gsuite-user-to-acl-add command. :param acl_records: List containing dictionaries of ACL records. :param calendar_id: Calendar id. :param user_id: User id. :return: prepared context output list. """ acl_id = acl_records.get('id', '') acl_scope_type = acl_records.get('scope', {}).get('type', '') acl_scope_value = acl_records.get('scope', {}).get('value', '') acl_role = acl_records.get('role', '') acl_add_output = { 'calendarId': calendar_id, 'userId': user_id, 'kind': acl_records.get('kind', ''), 'etag': acl_records.get('etag', ''), 'id': acl_id, 'scopeType': acl_scope_type, 'scopeValue': acl_scope_value, 'role': acl_role} acl_add_output = GSuiteClient.remove_empty_entities(acl_add_output) acl_add_hr = { 'id': acl_id, 'scopeType': acl_scope_type, 'scopeValue': acl_scope_value, 'role': acl_role } acl_add_hr = GSuiteClient.remove_empty_entities(acl_add_hr) return acl_add_hr, acl_add_output def prepare_body_gsuite_acl_add(args: Dict[str, str]) -> Dict[str, Any]: """ To prepare params for acl_add_command. :param args: Command arguments. :return: Dict of body. """ return GSuiteClient.remove_empty_entities({ 'role': args.get('role'), 'scope': { 'type': args.get('scope_type'), 'value': args.get('scope_value') } }) def prepare_params_for_acl_list(args: Dict[str, str]) -> Dict[str, Union[str, int]]: """ To prepare params for gsuite_acl_list. :param args: Command arguments. :return: Dict of arguments. """ max_result = args.get('max_results', 100) GSuiteClient.validate_set_boolean_arg(args, 'show_deleted', ) return GSuiteClient.remove_empty_entities({ 'maxResults': max_result, 'pageToken': args.get('page_token', ''), 'showDeleted': args.get('show_deleted', 'false'), 'syncToken': args.get('sync_token', '') }) ''' COMMAND FUNCTIONS ''' @logger def test_module(gsuite_client) -> str: """ Performs test connectivity by valid http response :param gsuite_client: client object which is used to get response from api. :return: raise ValueError if any error occurred during connection :raises DemistoException: If there is any other issues while making the http call. """ with GSuiteClient.http_exception_handler(): gsuite_client.set_authorized_http(scopes=SCOPES['CALENDAR']) gsuite_client.http_request(url_suffix=URL_SUFFIX['TEST_MODULE'], method='GET') return 'ok' @logger def acl_add_command(client, args: Dict[str, Any]) -> CommandResults: """ Creates an access control rule. :param client: client object which is used to get response from api :param args: command arguments. :return: CommandResults object with context and human-readable. """ calendar_id = args.get('calendar_id', '') calendar_id = urllib.parse.quote(calendar_id) # type: ignore user_id = args.get('user_id', '') body = prepare_body_gsuite_acl_add(args) send_notifications = args.get('send_notifications', 'true').lower() if send_notifications not in ['true', 'false']: raise ValueError(MESSAGES['BOOLEAN_ERROR'].format('send_notifications')) client.set_authorized_http(scopes=SCOPES['CALENDAR'], subject=user_id) response = client.http_request(url_suffix=URL_SUFFIX['CALENDAR_ACL'].format(calendar_id), body=body, method='POST', params={'sendNotifications': send_notifications}) acl_add_hr, acl_add_output = prepare_output_acl_add(response, args.get('calendar_id', ''), user_id) readable_output = tableToMarkdown( HR_MESSAGES['ACL_ADD_SUCCESS'].format(args.get('calendar_id'), acl_add_hr.get('scopeValue', '')), acl_add_hr, headerTransform=pascalToSpace, removeNull=True) return CommandResults( outputs_prefix=OUTPUT_PREFIX['ADD_ACL'], outputs_key_field=['calendarId', 'id', 'userId'], outputs=acl_add_output, readable_output=readable_output, raw_response=response ) @logger def acl_list_command(client, args: Dict[str, Any]) -> CommandResults: """ Shows the access control lists for the given calendar id. The ACL list will show who has access to the calendar and what level of access they have. :param client: client object which is used to get response from api :param args: command arguments. :return: CommandResults object with context and human-readable. """ user_id = args.get('user_id', '') calendar_id = urllib.parse.quote(args.get('calendar_id', '')) # type: ignore params = prepare_params_for_acl_list(args) client.set_authorized_http(scopes=SCOPES['CALENDAR'], subject=user_id) response = client.http_request(url_suffix=URL_SUFFIX['CALENDAR_ACL'].format(calendar_id), method='GET', params=params) outputs, acl_hr_list = prepare_acl_list_output(response, args.get('calendar_id', ''), user_id) readable_hr = '' if response.get('nextPageToken'): readable_hr += NEXT_PAGE_TOKEN.format(response.get('nextPageToken')) if response.get('nextSyncToken'): readable_hr += '### Next Sync Token: {}\n'.format(response.get('nextSyncToken')) readable_hr += tableToMarkdown(HR_MESSAGES['LIST_COMMAND_SUCCESS'].format('ACL', len(acl_hr_list)), acl_hr_list, headerTransform=pascalToSpace, removeNull=True) return CommandResults( outputs=outputs, readable_output=readable_hr, raw_response=response ) def main() -> None: """ PARSE AND VALIDATE INTEGRATION PARAMS """ # Commands dictionary commands: Dict[str, Callable] = { 'google-calendar-acl-add': acl_add_command, 'google-calendar-acl-list': acl_list_command, } command = demisto.command() demisto.info(f'Command being called is {command}') try: params = demisto.params() service_account_dict = GSuiteClient.safe_load_non_strict_json(params.get('user_service_account_json')) verify_certificate = not params.get('insecure', False) proxy = params.get('proxy', False) headers = { 'Content-Type': 'application/json' } # prepare client class object gsuite_client = GSuiteClient(service_account_dict, base_url='https://www.googleapis.com/', verify=verify_certificate, proxy=proxy, headers=headers) # Trim the arguments args = GSuiteClient.strip_dict(demisto.args()) # This is the call made when pressing the integration Test button. if demisto.command() == 'test-module': result = test_module(gsuite_client) demisto.results(result) elif command in commands: return_results(commands[command](gsuite_client, args)) # Log exceptions except Exception as e: demisto.error(traceback.format_exc()) return_error(f'Error: {str(e)}') from GSuiteApiModule import * # noqa: E402 if __name__ in ('__main__', '__builtin__', 'builtins'): main()
4,598