text
stringlengths
3
1.05M
'''URL routing for expense app.''' from django.conf.urls import url from . import views urlpatterns = [ url(r'^nova-verba/', views.new_budget, name='new_budget'), url(r'^novo-reembolso/', views.new_reimburse, name='new_reimburse'), url(r'^reembolsos/todos/', views.list_all_reimburses, name='list_all_reimburses'), url(r'^verbas/', views.list_budgets, name='list_budgets'), url(r'^reembolsos/', views.list_reimburses, name='list_reimburses'), url(r'^aprovacoes/verba/', views.list_budget_approvals, name='list_budget_approvals'), url(r'^aprovacoes/reembolso/', views.list_reimburse_approvals, name='list_reimburse_approvals'), url(r'^requisicao/(?P<request_id>[0-9]+)/(?P<approval>(aprovar|negar){1})/', views.set_approval, name='set_approval'), url(r'^requisicao/(?P<request_id>[0-9]+)/', views.show_request, name='show_request') ]
from ROOT import TH1D, TF1, TCanvas, TPad, TFile, TPaveLabel, TPaveText from ROOT import gROOT, gStyle from array import array import psrchive import sys import time import numpy as np from optparse import OptionParser full_usage = """ """ usage = "usage: %prog [options]" gStyle.SetOptFit() parser = OptionParser(usage) parser.add_option("-n", "--ncomp", type="int", dest="ncomp", default=1, help="Number of components") parser.add_option("-t", "--template", type="string", dest="template", help="Template of gaussians") parser.add_option("-s", "--save", action="store_true", dest="save", default=False, help="Save gaussians to file") parser.add_option("-r", "--rotate", action="store_true", dest="rotate", default=False, help="Rotate profile by 180deg for display and fit") parser.add_option("-c", "--bscr", type="int", dest="bscr", default=1, help="Bscrunch by this factor (power of 2)") (opts, args) = parser.parse_args() if len(sys.argv) <= 1: print usage sys.exit() if opts.template: gaussian_id, phase, heigth, width = np.loadtxt(opts.template, unpack=True, dtype=float, skiprows=3) print phase, heigth, width fn = args[0] ar = psrchive.Archive_load(fn) #ar.dedisperse() if opts.rotate: ar.rotate_phase(.5) ar.tscrunch() ar.fscrunch() if opts.bscr>1: print "Will scrunch the profile by ", opts.bscr, " bins" ar.bscrunch(opts.bscr) ar.pscrunch() ar.remove_baseline() # Get I #prof = ar.get_Profile(0,0,0) nbin = ar.get_nbin() #x = prof.get_amps() data = ar.get_data()[0][0][0] # NO scrunching for flux calibrated data #x = data / data.max() x = data #for a,b in enumerate(x): # print a,b #max_bin = prof.find_max_bin() #max_bin = nbin/2 #lowbin = max_bin-30 #hibin = max_bin+30 # For interpulse #lowbin = max_bin-40 #hibin = max_bin+40 #low_phase = 0.47 #hi_phase = 0.6 low_phase = 0.42 hi_phase = 0.6 lowbin = int(low_phase * nbin) hibin = int(hi_phase * nbin) gROOT.Reset() # Canvas c1 = TCanvas( 'c1', 'Histogram Drawing Options', 200, 10, 700, 900 ) pad1 = TPad( 'pad1', 'The pad with the function', 0.03, 0.62, 0.50, 0.92, 21 ) pad2 = TPad( 'pad2', 'The pad with the histogram', 0.51, 0.62, 0.98, 0.92, 21 ) pad3 = TPad( 'pad3', 'The pad with the histogram', 0.03, 0.02, 0.97, 0.57, 21 ) pad1.Draw() pad2.Draw() pad3.Draw() npts = len(x) h1 = TH1D( 'h1', 'Full pulse profile', npts, 0, npts) h2 = TH1D( 'h2', 'Diff with template', hibin-lowbin, lowbin, hibin) h3 = TH1D( 'h3', 'Fitted pulse profile', hibin-lowbin, lowbin, hibin) for i in xrange(npts): h1.SetBinContent( i+1, x[i] ) #h2.SetBinContent( i+1, x[i] ) for i,xx in enumerate(x[lowbin:hibin]): h2.SetBinContent( i+1, xx ) h3.SetBinContent( i+1, xx ) par = array( 'd', 3*[0.] ) total = TF1( 'total', 'gaus', lowbin, hibin ) # Set initial conditions par[0] = h2.GetMaximum() par[1] = h2.GetMaximumBin() + lowbin par[2] = 5 print "Initial conditions:", par[0], par[1], par[2] total.SetParameters( par ) #total.FixParameter(0, par[0]) #total.FixParameter(1, par[1]) #total.FixParameter(2, par[2]) #g2 = TF1( 'g2', 'gaus', 98, 108 ) #g3 = TF1( 'g3', 'gaus', 110, 121 ) #total = TF1( 'total', 'gaus(0)+gaus(3)+gaus(6)', 85, 125 ) #total.SetLineColor( 2 ) # Draw histogram hpx in first pad with the default option. pad1.cd() h1.Draw() pad3.cd() h3.Draw() #fit = h3.Fit( total, 'RS') fit = h3.Fit( total, 'RS' , '',lowbin, hibin) par1 = total.GetParameters() #print par1[0], par1[1], par1[2] icomp = 1 # residual plot for i in range(h3.GetNbinsX()): h2.SetBinContent( i+1, h3.GetBinContent(i) - total.Eval(h3.GetBinCenter(i)) ) #print i+1, h3.GetBinContent(i) - total.Eval(h3.GetBinCenter(i)) pad2.cd() h2.Draw() if opts.template: ncomp = len(gaussian_id) print "Ncomponents: ", ncomp # init the model to a single gaussian model = 'gaus(0)' for i in range(ncomp-1): model += '+gaus(%d)'%((i+1)*3) print model par = array( 'd', 3*ncomp*[0.] ) for i in range(ncomp): par[3*(i)] = heigth[i] par[3*(i)+1] = phase[i] /360. * nbin par[3*(i)+2] = width[i] print par total = TF1( 'total', model, lowbin, hibin ) total.SetParameters( par ) # fit and display pad3.Clear() h3.Fit(total, 'ER') par1 = total.GetParameters() # residual plot pad2.Clear() for i in range(h3.GetNbinsX()): h2.SetBinContent( i+1, h3.GetBinContent(i) - total.Eval(h3.GetBinCenter(i)) ) pad2.cd() h2.Draw() icomp = ncomp #if 1: else: # init the model to a single gaussian model = 'gaus(0)' ncomp = opts.ncomp while icomp < ncomp: par = array( 'd', 3*(icomp+1)*[0.] ) model += '+gaus(%d)'%(icomp*3) #print model total = TF1( 'total', model, lowbin, hibin ) # Set params print "Max residual bin: ", h2.GetMaximumBin() + lowbin, "Value: ", h2.GetMaximum() for i in range(icomp): par[3*i],par[3*i+1],par[3*i+2] = par1[3*i],par1[3*i+1],par1[3*i+2] par[3*(i+1)] = h2.GetMaximum() par[3*(i+1)+1] = h2.GetMaximumBin() + lowbin par[3*(i+1)+2] = 4. total.SetParameters( par ) # fit and display pad3.Clear() h3.Fit(total, 'RS') par1 = total.GetParameters() # residual plot pad2.Clear() for i in range(h3.GetNbinsX()): h2.SetBinContent( i+1, h3.GetBinContent(i) - total.Eval(h3.GetBinCenter(i)) ) #print i+1, h3.GetBinContent(i) - total.Eval(h3.GetBinCenter(i)) pad2.cd() h2.Draw() icomp +=1 #time.sleep(1) if opts.rotate: offset = 180. else: offset = 0. par = total.GetParameters() if opts.save: pfo = open(fn + '.gaussian', 'w') pfo.write('#### Gaussian Template #####\n') pfo.write('MJD: %s\n'%ar.start_time().strtempo()) pfo.write('Components: %d\n'%ncomp) for icomp in range(ncomp): pfo.write('%d %f %f %f\n'%(icomp, par[3*icomp+1]*360./float(ar.get_nbin()) - offset, par[3*icomp], par[3*icomp+2]*360./float(ar.get_nbin()))) pfo.close() print "\nSummary of fit" for icomp in range(ncomp): print par[3*icomp+1] print 'Component #%d %f %f %fi (%f)\n'%(icomp, par[3*icomp+1]*360/float(ar.get_nbin()) - offset, par[3*icomp], par[3*icomp+2]*360/float(ar.get_nbin()), par[3*icomp+1]/float(ar.get_nbin()) - offset/360.) raw_input("Press enter to continue...")
/**************************************************************************** * drivers/sensors/bh1750fvi.c * * 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. * ****************************************************************************/ /* Character driver for the Rohm Ambient Light Sensor BH1750FVI */ /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> #include <assert.h> #include <errno.h> #include <debug.h> #include <stdlib.h> #include <nuttx/kmalloc.h> #include <nuttx/fs/fs.h> #include <nuttx/i2c/i2c_master.h> #include <nuttx/sensors/bh1750fvi.h> #include <nuttx/random.h> #if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_BH1750FVI) /**************************************************************************** * Pre-process Definitions ****************************************************************************/ #ifndef CONFIG_BH1750FVI_I2C_FREQUENCY # define CONFIG_BH1750FVI_I2C_FREQUENCY 400000 #endif /**************************************************************************** * Private Types ****************************************************************************/ struct bh1750fvi_dev_s { FAR struct i2c_master_s *i2c; /* I2C interface */ uint8_t addr; /* I2C address */ }; /**************************************************************************** * Private Function Prototypes ****************************************************************************/ /* I2C Helpers */ static int bh1750fvi_read16(FAR struct bh1750fvi_dev_s *priv, FAR uint16_t *regval); static int bh1750fvi_write8(FAR struct bh1750fvi_dev_s *priv, uint8_t regval); /* Character driver methods */ static int bh1750fvi_open(FAR struct file *filep); static int bh1750fvi_close(FAR struct file *filep); static ssize_t bh1750fvi_read(FAR struct file *filep, FAR char *buffer, size_t buflen); static ssize_t bh1750fvi_write(FAR struct file *filep, FAR const char *buffer, size_t buflen); static int bh1750fvi_ioctl(FAR struct file *filep, int cmd, unsigned long arg); /**************************************************************************** * Private Data ****************************************************************************/ static const struct file_operations g_bh1750fvi_fops = { bh1750fvi_open, /* open */ bh1750fvi_close, /* close */ bh1750fvi_read, /* read */ bh1750fvi_write, /* write */ NULL, /* seek */ bh1750fvi_ioctl, /* ioctl */ NULL /* poll */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , NULL /* unlink */ #endif }; /**************************************************************************** * Private Functions ****************************************************************************/ /**************************************************************************** * Name: bh1750fvi_read16 * * Description: * Read 16-bit register * ****************************************************************************/ static int bh1750fvi_read16(FAR struct bh1750fvi_dev_s *priv, FAR uint16_t *regval) { struct i2c_config_s config; uint8_t buffer[2]; int ret = -1; /* Set up the I2C configuration */ config.frequency = CONFIG_BH1750FVI_I2C_FREQUENCY; config.address = priv->addr; config.addrlen = 7; /* Read 16-bits from the device */ ret = i2c_read(priv->i2c, &config, buffer, 2); if (ret < 0) { snerr ("i2c_read failed: %d\n", ret); return ret; } /* Copy the content of the buffer to the location of the uint16_t pointer */ *regval = (uint16_t)((buffer[0] << 8) | (buffer[1])); sninfo("value: %08x ret: %d\n", *regval, ret); return OK; } /**************************************************************************** * Name: bh1750fvi_write8 * * Description: * Write from an 8-bit register * ****************************************************************************/ static int bh1750fvi_write8(FAR struct bh1750fvi_dev_s *priv, uint8_t regval) { struct i2c_config_s config; int ret; sninfo("value: %02x\n", regval); /* Set up the I2C configuration */ config.frequency = CONFIG_BH1750FVI_I2C_FREQUENCY; config.address = priv->addr; config.addrlen = 7; /* Write 8 bits to device */ ret = i2c_write(priv->i2c, &config, &regval, 1); if (ret < 0) { snerr("ERROR: i2c_write failed: %d\n", ret); } return ret; } /**************************************************************************** * Name: bh1750fvi_open * * Description: * This function is called whenever the BH1750FVI device is opened. * ****************************************************************************/ static int bh1750fvi_open(FAR struct file *filep) { return OK; } /**************************************************************************** * Name: bh1750fvi_close * * Description: * This routine is called when the BH1750FVI device is closed. * ****************************************************************************/ static int bh1750fvi_close(FAR struct file *filep) { return OK; } /**************************************************************************** * Name: bh1750fvi_read ****************************************************************************/ static ssize_t bh1750fvi_read(FAR struct file *filep, FAR char *buffer, size_t buflen) { int ret; FAR struct inode *inode; FAR struct bh1750fvi_dev_s *priv; uint16_t lux = 0; DEBUGASSERT(filep); inode = filep->f_inode; DEBUGASSERT(inode && inode->i_private); priv = (FAR struct bh1750fvi_dev_s *)inode->i_private; /* Check if the user is reading the right size */ if (buflen != 2) { snerr("ERROR: You need to read 2 bytes from this sensor!\n"); return -EINVAL; } ret = bh1750fvi_read16(priv, &lux); if (ret < 0) { snerr("ERROR: Error reading light sensor!\n"); return ret; } buffer[0] = lux & 0xff; buffer[1] = (lux & 0xff00) >> 8; add_sensor_randomness(lux); return buflen; } /**************************************************************************** * Name: bh1750fvi_write ****************************************************************************/ static ssize_t bh1750fvi_write(FAR struct file *filep, FAR const char *buffer, size_t buflen) { return -ENOSYS; } /**************************************************************************** * Name: bh1750fvi_ioctl ****************************************************************************/ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { FAR struct inode *inode = filep->f_inode; FAR struct bh1750fvi_dev_s *priv = inode->i_private; int ret = OK; switch (cmd) { /* Set device to Continuously H-Resolution Mode */ case SNIOC_CHRM: { ret = bh1750fvi_write8(priv, BH1750FVI_CONTINUOUS_HRM); if (ret < 0) { snerr("ERROR:"); snerr(" Cannot change to Continuously H-Resolution Mode!\n"); } } break; /* Set device to Continuously H-Resolution Mode2 */ case SNIOC_CHRM2: { ret = bh1750fvi_write8(priv, BH1750FVI_CONTINUOUS_HRM2); if (ret < 0) { snerr("ERROR:"); snerr(" Cannot change to Continuously H-Resolution Mode2!\n"); } } break; /* Set device to Continuously L-Resolution Mode */ case SNIOC_CLRM: { ret = bh1750fvi_write8(priv, BH1750FVI_CONTINUOUS_LRM); if (ret < 0) { snerr("ERROR:"); snerr(" Cannot change to Continuously L-Resolution Mode!\n"); } } break; /* Set device to One Time H-Resolution Mode */ case SNIOC_OTHRM: { ret = bh1750fvi_write8(priv, BH1750FVI_ONETIME_HRM); if (ret < 0) { snerr("ERROR: Cannot change to One Time H-Resolution Mode!\n"); } } break; /* Set device to One Time H-Resolution Mode 2 */ case SNIOC_OTHRM2: { ret = bh1750fvi_write8(priv, BH1750FVI_ONETIME_HRM2); if (ret < 0) { snerr("ERROR:"); snerr(" Cannot change to One Time H-Resolution Mode2!\n"); } } break; /* Set device to One Time L-Resolution Mode */ case SNIOC_OTLRM: { ret = bh1750fvi_write8(priv, BH1750FVI_ONETIME_LRM); if (ret < 0) { snerr("ERROR: Cannot change to One Time L-Resolution Mode!\n"); } } break; /* Change the Measurement Time */ case SNIOC_CHMEATIME: { FAR uint8_t *ptr = (FAR uint8_t *)((uintptr_t)arg); uint8_t reg; DEBUGASSERT(ptr != NULL); reg = BH1750FVI_MEASURE_TIMEH | ((*ptr & 0xe0) >> 5); ret = bh1750fvi_write8(priv, reg); if (ret < 0) { snerr("ERROR: Cannot Change Measure Time at MEASURE_TIMEH!\n"); } reg = BH1750FVI_MEASURE_TIMEL | (*ptr & 0x1f); ret = bh1750fvi_write8(priv, reg); if (ret < 0) { snerr("ERROR: Cannot Change Measure Time at MEASURE_TIMEL!\n"); } } break; default: snerr("ERROR: Unrecognized cmd: %d\n", cmd); ret = -ENOTTY; break; } return ret; } /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * Name: bh1750fvi_register * * Description: * Register the BH1750FVI character device as 'devpath' * * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/light0" * i2c - An instance of the I2C interface to use to communicate with * BH1750FVI * addr - The I2C address of the BH1750FVI. * * Returned Value: * Zero (OK) on success; a negated errno value on failure. * ****************************************************************************/ int bh1750fvi_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, uint8_t addr) { int ret; /* Sanity check */ DEBUGASSERT(i2c != NULL); /* Initialize the BH1750FVI device structure */ FAR struct bh1750fvi_dev_s *priv = (FAR struct bh1750fvi_dev_s *)kmm_malloc(sizeof(struct bh1750fvi_dev_s)); if (priv == NULL) { snerr("ERROR: Failed to allocate instance\n"); return -ENOMEM; } priv->i2c = i2c; priv->addr = addr; /* Power on the device */ ret = bh1750fvi_write8(priv, BH1750FVI_POWERON); if (ret < 0) { snerr("ERROR: Failed to power-on the BH1750FVI!\n"); return ret; } /* Set Continuously H-Resolution Mode */ ret = bh1750fvi_write8(priv, BH1750FVI_CONTINUOUS_HRM); if (ret < 0) { snerr("ERROR: Failed to enable the Continuously H-Resolution Mode!\n"); return ret; } /* Register the character driver */ ret = register_driver(devpath, &g_bh1750fvi_fops, 0666, priv); if (ret < 0) { snerr("ERROR: Failed to register driver: %d\n", ret); kmm_free(priv); } return ret; } #endif /* CONFIG_I2C && CONFIG_SENSORS_BH1750FVI */
from sqlalchemy.testing import fixtures from sqlalchemy.engine.ddl import SchemaGenerator, SchemaDropper from sqlalchemy.engine import default from sqlalchemy import MetaData, Table, Column, Integer, Sequence from sqlalchemy import schema class EmitDDLTest(fixtures.TestBase): def _mock_connection(self, item_exists): _canary = [] class MockDialect(default.DefaultDialect): supports_sequences = True def has_table(self, connection, name, schema): return item_exists(name) def has_sequence(self, connection, name, schema): return item_exists(name) class MockConnection(object): dialect = MockDialect() canary = _canary def execute(self, item): _canary.append(item) return MockConnection() def _mock_create_fixture(self, checkfirst, tables, item_exists=lambda item: False): connection = self._mock_connection(item_exists) return SchemaGenerator(connection.dialect, connection, checkfirst=checkfirst, tables=tables) def _mock_drop_fixture(self, checkfirst, tables, item_exists=lambda item: True): connection = self._mock_connection(item_exists) return SchemaDropper(connection.dialect, connection, checkfirst=checkfirst, tables=tables) def _table_fixture(self): m = MetaData() return (m, ) + tuple( Table('t%d' % i, m, Column('x', Integer)) for i in range(1, 6) ) def _table_seq_fixture(self): m = MetaData() s1 = Sequence('s1') s2 = Sequence('s2') t1 = Table('t1', m, Column("x", Integer, s1, primary_key=True)) t2 = Table('t2', m, Column("x", Integer, s2, primary_key=True)) return m, t1, t2, s1, s2 def test_create_seq_checkfirst(self): m, t1, t2, s1, s2 = self._table_seq_fixture() generator = self._mock_create_fixture(True, [t1, t2], item_exists=lambda t: t not in ("t1", "s1") ) self._assert_create([t1, s1], generator, m) def test_drop_seq_checkfirst(self): m, t1, t2, s1, s2 = self._table_seq_fixture() generator = self._mock_drop_fixture(True, [t1, t2], item_exists=lambda t: t in ("t1", "s1") ) self._assert_drop([t1, s1], generator, m) def test_create_collection_checkfirst(self): m, t1, t2, t3, t4, t5 = self._table_fixture() generator = self._mock_create_fixture(True, [t2, t3, t4], item_exists=lambda t: t not in ("t2", "t4") ) self._assert_create_tables([t2, t4], generator, m) def test_drop_collection_checkfirst(self): m, t1, t2, t3, t4, t5 = self._table_fixture() generator = self._mock_drop_fixture(True, [t2, t3, t4], item_exists=lambda t: t in ("t2", "t4") ) self._assert_drop_tables([t2, t4], generator, m) def test_create_collection_nocheck(self): m, t1, t2, t3, t4, t5 = self._table_fixture() generator = self._mock_create_fixture(False, [t2, t3, t4], item_exists=lambda t: t not in ("t2", "t4") ) self._assert_create_tables([t2, t3, t4], generator, m) def test_create_empty_collection(self): m, t1, t2, t3, t4, t5 = self._table_fixture() generator = self._mock_create_fixture(True, [], item_exists=lambda t: t not in ("t2", "t4") ) self._assert_create_tables([], generator, m) def test_drop_empty_collection(self): m, t1, t2, t3, t4, t5 = self._table_fixture() generator = self._mock_drop_fixture(True, [], item_exists=lambda t: t in ("t2", "t4") ) self._assert_drop_tables([], generator, m) def test_drop_collection_nocheck(self): m, t1, t2, t3, t4, t5 = self._table_fixture() generator = self._mock_drop_fixture(False, [t2, t3, t4], item_exists=lambda t: t in ("t2", "t4") ) self._assert_drop_tables([t2, t3, t4], generator, m) def test_create_metadata_checkfirst(self): m, t1, t2, t3, t4, t5 = self._table_fixture() generator = self._mock_create_fixture(True, None, item_exists=lambda t: t not in ("t2", "t4") ) self._assert_create_tables([t2, t4], generator, m) def test_drop_metadata_checkfirst(self): m, t1, t2, t3, t4, t5 = self._table_fixture() generator = self._mock_drop_fixture(True, None, item_exists=lambda t: t in ("t2", "t4") ) self._assert_drop_tables([t2, t4], generator, m) def test_create_metadata_nocheck(self): m, t1, t2, t3, t4, t5 = self._table_fixture() generator = self._mock_create_fixture(False, None, item_exists=lambda t: t not in ("t2", "t4") ) self._assert_create_tables([t1, t2, t3, t4, t5], generator, m) def test_drop_metadata_nocheck(self): m, t1, t2, t3, t4, t5 = self._table_fixture() generator = self._mock_drop_fixture(False, None, item_exists=lambda t: t in ("t2", "t4") ) self._assert_drop_tables([t1, t2, t3, t4, t5], generator, m) def _assert_create_tables(self, elements, generator, argument): self._assert_ddl(schema.CreateTable, elements, generator, argument) def _assert_drop_tables(self, elements, generator, argument): self._assert_ddl(schema.DropTable, elements, generator, argument) def _assert_create(self, elements, generator, argument): self._assert_ddl( (schema.CreateTable, schema.CreateSequence), elements, generator, argument) def _assert_drop(self, elements, generator, argument): self._assert_ddl( (schema.DropTable, schema.DropSequence), elements, generator, argument) def _assert_ddl(self, ddl_cls, elements, generator, argument): generator.traverse_single(argument) for c in generator.connection.canary: assert isinstance(c, ddl_cls) assert c.element in elements, "element %r was not expected"\ % c.element elements.remove(c.element) assert not elements, "elements remain in list: %r" % elements
class Tau {          static TAU = 2 * Math.PI     static TAU_2 = this.TAU/2     static TAU_4 = this.TAU/4     static TAU_6 = this.TAU/6     static TAU_8 = this.TAU/8     static TAU_12 = this.TAU/12     constructor(){         // This consists solely of static methods and constants     }     // converts a revolution to degrees     static toDegrees(rev){return rev * 360}     // converts a revolution to radians     static toRadians(rev){return rev * this.TAU}     // converts from degrees to revolutions     static fromDegrees(deg){return deg / 360}     // converts from radians to revolutions     static fromRadians(rad){return rad / this.TAU}     // returns the sine value of the given revolution     static sin(rev){         return Math.sin(rev * this.TAU)     }     // returns the cosine value of the given revolution     static cos(rev){         return Math.cos(rev * this.TAU)     }     // returns the tangent value of the given revolution     static tan(rev){         return Math.tan(rev * this.TAU)     }     // returns the arcsine value of the given revolution     static asin(rev){         return this.fromRadians(Math.asin(rev))     }     // returns the arccosine value of the given revolution     static acos(rev){         return this.fromRadians(Math.acos(rev))     }     // For a given x,y value, returns the corresponding revolution from -0.5 to 0.5.     static atan(x,y){         return this.fromRadians(Math.atan2(y,x))    } } class TauComplex{     // Indicates the number of significant digits complex numbers are displayed using.     static SIGDIGITS = 5;     constructor(x,y){         this.x = x         this.y = y         return this     }     // toString() generates a complex number of the form "a+bi" for string output     toString(){         let minX = Math.abs(this.x)<1e-5?0:TauComplex.trim(this.x);         let minY = Math.abs(this.y)<1e-5?0:TauComplex.trim(this.y);         return `${minX} ${Math.sign(this.y)>=0?'+':'-'} ${Math.abs(minY)}i`     }     // generates the length of the complex number vector     get modulus(){         return Math.sqrt(this.x*this.x + this.y*this.y);     }     // generates the square of the length of the complex number vector. This avoids the need to take the square root     get modsquare(){         return this.x*this.x + this.y*this.y;     }     // retrieves the angle relative to the positive x axis of the complex number, in revolutions     get theta(){         let angle = Tau.atan(this.x,this.y);         let ySgn = Math.sign(this.y);         let adjAngle = ySgn<0?1+angle:angle;         return adjAngle;     }     // retrieves the complex conjugate (a-bi) of the complex number (a+bi)     get conjugate(){         return new TauComplex(this.x,-this.y)     }     // retrieves the complex inverse of the number (a+bi).     get inverse(){         return (this.conjugate).scale(1/this.modsquare)     }     // rotates the complex number through the angle, expressed in revolutions.     rotate(angle){         let newX = this.x * Tau.cos(angle) - this.y * Tau.sin(angle);         let newY = this.x * Tau.sin(angle) + this.y * Tau.cos(angle)         return new TauComplex(newX,newY)     }     // Multiplies the complex number by a scalar value (or values if two arguments are supplied)     scale(x,y=x){         let newX = this.x * x;         let newY = this.y * y;         return new TauComplex(newX,newY)     }     // translates the complex number by the given amount. Equivalent to adding two complex numbers     translate(x,y=x){         let newX = this.x + x;         let newY = this.y + y;         return new TauComplex(newX,newY)     }     // Adds two or more complex numbers together.     static sum(...c){         let reducer = (acc, cur) => new TauComplex(acc.x+cur.x,acc.y+cur.y)         return c.reduce(reducer)     }     // Multiples two or more complex numbers together.     static mult(...c){         let reducer = (acc, cur) => new TauComplex(acc.x*cur.x-acc.y*cur.y,acc.x*cur.y+acc.y*cur.x)         return c.reduce(reducer)     }     // Divides the first complex number by the second     static div(c1,c2){         return TauComplex.mult(c1,c2.inverse)     }     // Takes the complex number to the given power. Power MUST be a non-negative integer.     pow(power){         let arr = [];         for (var index=0;index!=power;index++){             arr.push(this);         }         if (arr.length>0) {             return TauComplex.mult(...arr)         }         else {             return new TauComplex(1,0);         }     }     // Returns the real portion of a complex number     get re(){         return this.x     }     // Returns the imaginary portion of a complex number     get im(){         return this.y     }     // Returns the complex number associated with a unit vector rotated by the revolution amount     static tau(rev){         return new TauComplex(Tau.cos(rev),Tau.sin(rev));     }     // Returns the complex exponent of the given complex number     get exp(){         return TauComplex.tau(this.y).scale(Math.exp(this.x))     }     // Creates a string representation of a number to the given significant digits, default being 5.     static trim(value,sigDigits=this.SIGDIGITS){         return value.toLocaleString("en-us",{maximumSignificantDigits:sigDigits})     }     static array(...arr){         return arr.map((subArr,index)=>new TauComplex(...subArr))     } } const _TauComplex = TauComplex; exports.TauComplex = _TauComplex; const _Tau = Tau; exports.Tau = _Tau;
// David Eberly, Geometric Tools, Redmond WA 98052 // Copyright (c) 1998-2021 // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt // https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt // Version: 4.0.2019.08.13 #pragma once #include <algorithm> #include <atomic> // Implementations of atomic minimum and atomic maximum computations. These // are based on std::atomic_compare_exchange_strong. namespace gte { template <typename T> T AtomicMin(std::atomic<T>& v0, T const& v1) { T vInitial, vMin; do { vInitial = v0; vMin = std::min(vInitial, v1); } while (!std::atomic_compare_exchange_strong(&v0, &vInitial, vMin)); return vInitial; } template <typename T> T AtomicMax(std::atomic<T>& v0, T const& v1) { T vInitial, vMax; do { vInitial = v0; vMax = std::max(vInitial, v1); } while (!std::atomic_compare_exchange_strong(&v0, &vInitial, vMax)); return vInitial; } }
define([ 'angularAMD' ], function(angularAMD) { 'use strict'; /** * @ngdoc directive * @name contextMenuApp.directive:contextMenu * @description * # contextMenu * Custom Context Menu Directive */ angular.module('contextMenuApp', []) .directive('ngRightClick', function($parse) { return function(scope, element, attrs) { var fn = $parse(attrs.ngRightClick); element.bind('contextmenu', function(event) { scope.$apply(function() { event.preventDefault(); fn(scope, {$event:event}); }); }); }; }); });
import os import random import stat import string import unittest import nvmet.nvme as nvme # Default test devices are ram disks, but allow user to specify different # block devices or files. NVMET_TEST_DEVICES = os.getenv("NVMET_TEST_DEVICES", "/dev/ram0,/dev/ram1").split(',') def test_devices_present(): return len([x for x in NVMET_TEST_DEVICES if os.path.exists(x) and (stat.S_ISBLK(os.stat(x).st_mode) or os.path.isfile(x))]) >= 2 class TestNvmet(unittest.TestCase): def test_subsystem(self): root = nvme.Root() root.clear_existing() for s in root.subsystems: self.assertTrue(False, 'Found Subsystem after clear') # create mode s1 = nvme.Subsystem(nqn='testnqn1', mode='create') self.assertIsNotNone(s1) self.assertEqual(len(list(root.subsystems)), 1) # any mode, should create s2 = nvme.Subsystem(nqn='testnqn2', mode='any') self.assertIsNotNone(s2) self.assertEqual(len(list(root.subsystems)), 2) # random name s3 = nvme.Subsystem(mode='create') self.assertIsNotNone(s3) self.assertEqual(len(list(root.subsystems)), 3) # duplicate self.assertRaises(nvme.CFSError, nvme.Subsystem, nqn='testnqn1', mode='create') self.assertEqual(len(list(root.subsystems)), 3) # lookup using any, should not create s = nvme.Subsystem(nqn='testnqn1', mode='any') self.assertEqual(s1, s) self.assertEqual(len(list(root.subsystems)), 3) # lookup only s = nvme.Subsystem(nqn='testnqn2', mode='lookup') self.assertEqual(s2, s) self.assertEqual(len(list(root.subsystems)), 3) # lookup without nqn self.assertRaises(nvme.CFSError, nvme.Subsystem, mode='lookup') # and delete them all for s in root.subsystems: s.delete() self.assertEqual(len(list(root.subsystems)), 0) def test_namespace(self): root = nvme.Root() root.clear_existing() s = nvme.Subsystem(nqn='testnqn', mode='create') for n in s.namespaces: self.assertTrue(False, 'Found Namespace in new Subsystem') # create mode n1 = nvme.Namespace(s, nsid=3, mode='create') self.assertIsNotNone(n1) self.assertEqual(len(list(s.namespaces)), 1) # any mode, should create n2 = nvme.Namespace(s, nsid=2, mode='any') self.assertIsNotNone(n2) self.assertEqual(len(list(s.namespaces)), 2) # create without nsid, should pick lowest available n3 = nvme.Namespace(s, mode='create') self.assertIsNotNone(n3) self.assertEqual(n3.nsid, 1) self.assertEqual(len(list(s.namespaces)), 3) n4 = nvme.Namespace(s, mode='create') self.assertIsNotNone(n4) self.assertEqual(n4.nsid, 4) self.assertEqual(len(list(s.namespaces)), 4) # duplicate self.assertRaises(nvme.CFSError, nvme.Namespace, 1, mode='create') self.assertEqual(len(list(s.namespaces)), 4) # lookup using any, should not create n = nvme.Namespace(s, nsid=3, mode='any') self.assertEqual(n1, n) self.assertEqual(len(list(s.namespaces)), 4) # lookup only n = nvme.Namespace(s, nsid=2, mode='lookup') self.assertEqual(n2, n) self.assertEqual(len(list(s.namespaces)), 4) # lookup without nsid self.assertRaises(nvme.CFSError, nvme.Namespace, None, mode='lookup') # and delete them all for n in s.namespaces: n.delete() self.assertEqual(len(list(s.namespaces)), 0) @unittest.skipUnless(test_devices_present(), "Devices %s not available or suitable" % ','.join(NVMET_TEST_DEVICES)) def test_namespace_attrs(self): root = nvme.Root() root.clear_existing() s = nvme.Subsystem(nqn='testnqn', mode='create') n = nvme.Namespace(s, mode='create') self.assertFalse(n.get_enable()) self.assertTrue('device' in n.attr_groups) self.assertTrue('path' in n.list_attrs('device')) # no device set yet, should fail self.assertRaises(nvme.CFSError, n.set_enable, 1) # now set a path and enable n.set_attr('device', 'path', NVMET_TEST_DEVICES[0]) n.set_enable(1) self.assertTrue(n.get_enable()) # test double enable n.set_enable(1) # test that we can't write to attrs while enabled self.assertRaises(nvme.CFSError, n.set_attr, 'device', 'path', NVMET_TEST_DEVICES[1]) self.assertRaises(nvme.CFSError, n.set_attr, 'device', 'nguid', '15f7767b-50e7-4441-949c-75b99153dea7') # disable: once and twice n.set_enable(0) n.set_enable(0) # enable again, and remove while enabled n.set_enable(1) n.delete() def test_recursive_delete(self): root = nvme.Root() root.clear_existing() s = nvme.Subsystem(nqn='testnqn', mode='create') n1 = nvme.Namespace(s, mode='create') n2 = nvme.Namespace(s, mode='create') s.delete() self.assertEqual(len(list(root.subsystems)), 0) def test_port(self): root = nvme.Root() root.clear_existing() for p in root.ports: self.assertTrue(False, 'Found Port after clear') # create mode p1 = nvme.Port(portid=0, mode='create') self.assertIsNotNone(p1) self.assertEqual(len(list(root.ports)), 1) # any mode, should create p2 = nvme.Port(portid=1, mode='any') self.assertIsNotNone(p2) self.assertEqual(len(list(root.ports)), 2) # duplicate self.assertRaises(nvme.CFSError, nvme.Port, portid=0, mode='create') self.assertEqual(len(list(root.ports)), 2) # lookup using any, should not create p = nvme.Port(portid=0, mode='any') self.assertEqual(p1, p) self.assertEqual(len(list(root.ports)), 2) # lookup only p = nvme.Port(portid=1, mode='lookup') self.assertEqual(p2, p) self.assertEqual(len(list(root.ports)), 2) # and delete them all for p in root.ports: p.delete() self.assertEqual(len(list(root.ports)), 0) def test_loop_port(self): root = nvme.Root() root.clear_existing() s = nvme.Subsystem(nqn='testnqn', mode='create') p = nvme.Port(portid=0, mode='create') # subsystem doesn't exists, should fail self.assertRaises(nvme.CFSError, p.add_subsystem, 'invalidnqn') self.assertTrue('addr' in p.attr_groups) # no trtype set yet, should fail self.assertRaises(nvme.CFSError, p.add_subsystem, 'testnqn') # now set trtype to loop and other attrs and enable p.set_attr('addr', 'trtype', 'loop') p.set_attr('addr', 'adrfam', 'ipv4') p.set_attr('addr', 'traddr', '192.168.0.1') p.set_attr('addr', 'treq', 'not required') p.set_attr('addr', 'trsvcid', '1023') p.add_subsystem('testnqn') # test double add self.assertRaises(nvme.CFSError, p.add_subsystem, 'testnqn') # test that we can't write to attrs while enabled self.assertRaises(nvme.CFSError, p.set_attr, 'addr', 'trtype', 'rdma') self.assertRaises(nvme.CFSError, p.set_attr, 'addr', 'adrfam', 'ipv6') self.assertRaises(nvme.CFSError, p.set_attr, 'addr', 'traddr', '10.0.0.1') self.assertRaises(nvme.CFSError, p.set_attr, 'addr', 'treq', 'required') self.assertRaises(nvme.CFSError, p.set_attr, 'addr', 'trsvcid', '21') # remove: once and twice p.remove_subsystem('testnqn') self.assertRaises(nvme.CFSError, p.remove_subsystem, 'testnqn') # check that the attrs haven't been tampered with self.assertEqual(p.get_attr('addr', 'trtype'), 'loop') self.assertEqual(p.get_attr('addr', 'adrfam'), 'ipv4') self.assertEqual(p.get_attr('addr', 'traddr'), '192.168.0.1') self.assertEqual(p.get_attr('addr', 'treq'), 'not required') self.assertEqual(p.get_attr('addr', 'trsvcid'), '1023') # add again, and try to remove while enabled p.add_subsystem('testnqn') p.delete() def test_host(self): root = nvme.Root() root.clear_existing() for p in root.hosts: self.assertTrue(False, 'Found Host after clear') # create mode h1 = nvme.Host(nqn='foo', mode='create') self.assertIsNotNone(h1) self.assertEqual(len(list(root.hosts)), 1) # any mode, should create h2 = nvme.Host(nqn='bar', mode='any') self.assertIsNotNone(h2) self.assertEqual(len(list(root.hosts)), 2) # duplicate self.assertRaises(nvme.CFSError, nvme.Host, 'foo', mode='create') self.assertEqual(len(list(root.hosts)), 2) # lookup using any, should not create h = nvme.Host('foo', mode='any') self.assertEqual(h1, h) self.assertEqual(len(list(root.hosts)), 2) # lookup only h = nvme.Host('bar', mode='lookup') self.assertEqual(h2, h) self.assertEqual(len(list(root.hosts)), 2) # and delete them all for h in root.hosts: h.delete() self.assertEqual(len(list(root.hosts)), 0) def test_referral(self): root = nvme.Root() root.clear_existing() # create port p = nvme.Port(portid=1, mode='create') self.assertEqual(len(list(p.referrals)), 0) # create mode r1 = nvme.Referral(p, name="1", mode='create') self.assertIsNotNone(r1) self.assertEqual(len(list(p.referrals)), 1) # any mode, should create r2 = nvme.Referral(p, name="2", mode='any') self.assertIsNotNone(r2) self.assertEqual(len(list(p.referrals)), 2) # duplicate self.assertRaises(nvme.CFSError, nvme.Referral, p, name="2", mode='create') self.assertEqual(len(list(p.referrals)), 2) # lookup using any, should not create r = nvme.Referral(p, name="1", mode='any') self.assertEqual(r1, r) self.assertEqual(len(list(p.referrals)), 2) # lookup only r = nvme.Referral(p, name="2", mode='lookup') self.assertEqual(r2, r) self.assertEqual(len(list(p.referrals)), 2) # non-existant lookup self.assertRaises(nvme.CFSError, nvme.Referral, p, name="foo", mode='lookup') # basic state self.assertTrue('addr' in r.attr_groups) self.assertFalse(r.get_enable()) # now set trtype to loop and other attrs and enable r.set_attr('addr', 'trtype', 'loop') r.set_attr('addr', 'adrfam', 'ipv4') r.set_attr('addr', 'traddr', '192.168.0.1') r.set_attr('addr', 'treq', 'not required') r.set_attr('addr', 'trsvcid', '1023') r.set_enable(1) # test double enable r.set_enable(1) # test that we can't write to attrs while enabled self.assertRaises(nvme.CFSError, r.set_attr, 'addr', 'trtype', 'rdma') self.assertRaises(nvme.CFSError, r.set_attr, 'addr', 'adrfam', 'ipv6') self.assertRaises(nvme.CFSError, r.set_attr, 'addr', 'traddr', '10.0.0.1') self.assertRaises(nvme.CFSError, r.set_attr, 'addr', 'treq', 'required') self.assertRaises(nvme.CFSError, r.set_attr, 'addr', 'trsvcid', '21') # disable: once and twice r.set_enable(0) r.set_enable(0) # check that the attrs haven't been tampered with self.assertEqual(r.get_attr('addr', 'trtype'), 'loop') self.assertEqual(r.get_attr('addr', 'adrfam'), 'ipv4') self.assertEqual(r.get_attr('addr', 'traddr'), '192.168.0.1') self.assertEqual(r.get_attr('addr', 'treq'), 'not required') self.assertEqual(r.get_attr('addr', 'trsvcid'), '1023') # enable again, and try to remove while enabled r.set_enable(1) r.delete() # remove the other one while disabled: r1.delete() self.assertEqual(len(list(p.referrals)), 0) def test_allowed_hosts(self): root = nvme.Root() h = nvme.Host(nqn='hostnqn', mode='create') s = nvme.Subsystem(nqn='testnqn', mode='create') # add allowed_host s.add_allowed_host(nqn='hostnqn') # duplicate self.assertRaises(nvme.CFSError, s.add_allowed_host, 'hostnqn') # invalid self.assertRaises(nvme.CFSError, s.add_allowed_host, 'invalid') # remove again s.remove_allowed_host('hostnqn') # duplicate removal self.assertRaises(nvme.CFSError, s.remove_allowed_host, 'hostnqn') # invalid removal self.assertRaises(nvme.CFSError, s.remove_allowed_host, 'foobar') def test_invalid_input(self): root = nvme.Root() root.clear_existing() self.assertRaises(nvme.CFSError, nvme.Subsystem, nqn='', mode='create') self.assertRaises(nvme.CFSError, nvme.Subsystem, nqn='/', mode='create') for l in [ 257, 512, 1024, 2048 ]: toolong = ''.join(random.choice(string.ascii_lowercase) for i in range(l)) self.assertRaises(nvme.CFSError, nvme.Subsystem, nqn=toolong, mode='create') discover_nqn = "nqn.2014-08.org.nvmexpress.discovery" self.assertRaises(nvme.CFSError, nvme.Subsystem, nqn=discover_nqn, mode='create') self.assertRaises(nvme.CFSError, nvme.Port, portid=1 << 17, mode='create') @unittest.skipUnless(test_devices_present(), "Devices %s not available or suitable" % ','.join( NVMET_TEST_DEVICES)) def test_save_restore(self): root = nvme.Root() root.clear_existing() h = nvme.Host(nqn='hostnqn', mode='create') s = nvme.Subsystem(nqn='testnqn', mode='create') s.add_allowed_host(nqn='hostnqn') s2 = nvme.Subsystem(nqn='testnqn2', mode='create') s2.set_attr('attr', 'allow_any_host', 1) n = nvme.Namespace(s, nsid=42, mode='create') n.set_attr('device', 'path', NVMET_TEST_DEVICES[0]) n.set_enable(1) nguid = n.get_attr('device', 'nguid') p = nvme.Port(portid=66, mode='create') p.set_attr('addr', 'trtype', 'loop') p.set_attr('addr', 'adrfam', 'ipv4') p.set_attr('addr', 'traddr', '192.168.0.1') p.set_attr('addr', 'treq', 'not required') p.set_attr('addr', 'trsvcid', '1023') p.add_subsystem('testnqn') # save, clear, and restore root.save_to_file('test.json') root.clear_existing() root.restore_from_file('test.json') # additional restores should fai self.assertRaises(nvme.CFSError, root.restore_from_file, 'test.json', False) # ... unless forced! root.restore_from_file('test.json', True) # rebuild our view of the world h = nvme.Host(nqn='hostnqn', mode='lookup') s = nvme.Subsystem(nqn='testnqn', mode='lookup') s2 = nvme.Subsystem(nqn='testnqn2', mode='lookup') n = nvme.Namespace(s, nsid=42, mode='lookup') p = nvme.Port(portid=66, mode='lookup') self.assertEqual(s.get_attr('attr', 'allow_any_host'), "0") self.assertEqual(s2.get_attr('attr', 'allow_any_host'), "1") self.assertIn('hostnqn', s.allowed_hosts) # and check everything is still the same self.assertTrue(n.get_enable()) self.assertEqual(n.get_attr('device', 'path'), NVMET_TEST_DEVICES[0]) self.assertEqual(n.get_attr('device', 'nguid'), nguid) self.assertEqual(p.get_attr('addr', 'trtype'), 'loop') self.assertEqual(p.get_attr('addr', 'adrfam'), 'ipv4') self.assertEqual(p.get_attr('addr', 'traddr'), '192.168.0.1') self.assertEqual(p.get_attr('addr', 'treq'), 'not required') self.assertEqual(p.get_attr('addr', 'trsvcid'), '1023') self.assertIn('testnqn', p.subsystems) self.assertNotIn('testtnqn2', p.subsystems)
$(function() { $(document).on('click', '[data-tab-track]', function() { var $this = $(this); var field = $this.data('tab-track'); var value = $this.data('tab-track-id'); $('#' + field).val(value); }); });
/**************************************************************************** * Copyright 2021 EPAM Systems * * 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 { RxnArrowMode, SimpleObjectMode } from 'ketcher-core' import { bond as bondSchema } from '../data/schema/struct-schema' import isHidden from './isHidden' import { toBondType } from '../data/convert/structconv' const toolActions = { 'select-lasso': { title: 'Lasso Selection', shortcut: 'Escape', action: { tool: 'select', opts: 'lasso' } }, 'select-rectangle': { title: 'Rectangle Selection', shortcut: 'Escape', action: { tool: 'select', opts: 'rectangle' } }, 'select-fragment': { title: 'Fragment Selection', shortcut: 'Escape', action: { tool: 'select', opts: 'fragment' } }, erase: { title: 'Erase', shortcut: ['Delete', 'Backspace'], action: { tool: 'eraser', opts: 1 } // TODO last selector mode is better }, chain: { title: 'Chain', action: { tool: 'chain' } }, 'enhanced-stereo': { shortcut: 'Alt+e', title: 'Stereochemistry', action: { tool: 'enhancedStereo' }, hidden: options => isHidden(options, 'enhanced-stereo') }, 'charge-plus': { shortcut: '5', title: 'Charge Plus', action: { tool: 'charge', opts: 1 } }, 'charge-minus': { shortcut: '5', title: 'Charge Minus', action: { tool: 'charge', opts: -1 } }, 'transform-rotate': { shortcut: 'Alt+r', title: 'Rotate Tool', action: { tool: 'rotate' } }, 'transform-flip-h': { shortcut: 'Alt+h', title: 'Horizontal Flip', action: { tool: 'rotate', opts: 'horizontal' } }, 'transform-flip-v': { shortcut: 'Alt+v', title: 'Vertical Flip', action: { tool: 'rotate', opts: 'vertical' } }, sgroup: { shortcut: 'Mod+g', title: 'S-Group', action: { tool: 'sgroup' }, hidden: options => isHidden(options, 'sgroup') }, 'sgroup-data': { shortcut: 'Mod+g', title: 'Data S-Group', action: { tool: 'sgroup', opts: 'DAT' }, hidden: options => isHidden(options, 'sgroup-data') }, 'reaction-arrows': { hidden: options => isHidden(options, 'reaction-arrows') }, 'reaction-arrow-open-angle': { title: 'Arrow Open Angle Tool', action: { tool: 'reactionarrow', opts: RxnArrowMode.OpenAngle }, hidden: options => isHidden(options, 'reaction-arrow-open-angle') }, 'reaction-arrow-filled-triangle': { title: 'Arrow Filled Triangle', action: { tool: 'reactionarrow', opts: RxnArrowMode.FilledTriangle }, hidden: options => isHidden(options, 'reaction-arrow-filled-triangle') }, 'reaction-arrow-filled-bow': { title: 'Arrow Filled Bow Tool', action: { tool: 'reactionarrow', opts: RxnArrowMode.FilledBow }, hidden: options => isHidden(options, 'reaction-arrow-filled-bow') }, 'reaction-arrow-dashed-open-angle': { title: 'Arrow Dashed Open Angle Tool', action: { tool: 'reactionarrow', opts: RxnArrowMode.DashedOpenAngle }, hidden: options => isHidden(options, 'reaction-arrow-dashed-open-angle') }, 'reaction-arrow-failed': { title: 'Failed Arrow Tool', action: { tool: 'reactionarrow', opts: RxnArrowMode.Failed }, hidden: options => isHidden(options, 'reaction-arrow-failed') }, 'reaction-arrow-both-ends-filled-triangle': { title: 'Arrow Both Ends Filled Triangle Tool', action: { tool: 'reactionarrow', opts: RxnArrowMode.BothEndsFilledTriangle }, hidden: options => isHidden(options, 'reaction-arrow-both-ends-filled-triangle') }, 'reaction-arrow-equilibrium-filled-half-bow': { title: 'Arrow Equilibrium Filled Half Bow Tool', action: { tool: 'reactionarrow', opts: RxnArrowMode.EquilibriumFilledHalfBow }, hidden: options => isHidden(options, 'reaction-arrow-equilibrium-filled-half-bow') }, 'reaction-arrow-equilibrium-filled-triangle': { title: 'Arrow Equilibrium Filled Triangle Tool', action: { tool: 'reactionarrow', opts: RxnArrowMode.EquilibriumFilledTriangle }, hidden: options => isHidden(options, 'reaction-arrow-equilibrium-filled-triangle') }, 'reaction-arrow-equilibrium-open-angle': { title: 'Arrow Equilibrium Open Angle Tool', action: { tool: 'reactionarrow', opts: RxnArrowMode.EquilibriumOpenAngle }, hidden: options => isHidden(options, 'reaction-arrow-equilibrium-open-angle') }, 'reaction-arrow-unbalanced-equilibrium-filled-half-bow': { title: 'Arrow Unbalanced Equilibrium Filled Half Bow Tool', action: { tool: 'reactionarrow', opts: RxnArrowMode.UnbalancedEquilibriumFilledHalfBow }, hidden: options => isHidden(options, 'reaction-arrow-unbalanced-equilibrium-filled-half-bow') }, 'reaction-arrow-unbalanced-equilibrium-open-half-angle': { title: 'Arrow Unbalanced Equilibrium Open Half Angle Tool', action: { tool: 'reactionarrow', opts: RxnArrowMode.UnbalancedEquilibriumOpenHalfAngle }, hidden: options => isHidden(options, 'reaction-arrow-unbalanced-equilibrium-open-half-angle') }, 'reaction-arrow-unbalanced-equilibrium-large-filled-half-bow': { title: 'Arrow Unbalanced Equilibrium Large Filled Half Bow Tool', action: { tool: 'reactionarrow', opts: RxnArrowMode.UnbalancedEquilibriumLargeFilledHalfBow }, hidden: options => isHidden( options, 'reaction-arrow-unbalanced-equilibrium-large-filled-half-bow' ) }, 'reaction-arrow-unbalanced-equilibrium-fille-half-triangle': { title: 'Arrow Unbalanced Equilibrium Filled Half Triangle Tool', action: { tool: 'reactionarrow', opts: RxnArrowMode.UnbalancedEquilibriumFilleHalfTriangle }, hidden: options => isHidden( options, 'reaction-arrow-unbalanced-equilibrium-fille-half-triangle' ) }, 'reaction-plus': { title: 'Reaction Plus Tool', action: { tool: 'reactionplus' }, hidden: options => isHidden(options, 'reaction-plus') }, 'reaction-mapping-tools': { hidden: options => isHidden(options, 'reaction-mapping-tools') }, 'reaction-map': { title: 'Reaction Mapping Tool', action: { tool: 'reactionmap' }, hidden: options => isHidden(options, 'reaction-map') }, 'reaction-unmap': { title: 'Reaction Unmapping Tool', action: { tool: 'reactionunmap' }, hidden: options => isHidden(options, 'reaction-unmap') }, rgroup: { hidden: options => isHidden(options, 'rgroup') }, 'rgroup-label': { shortcut: 'Mod+r', title: 'R-Group Label Tool', action: { tool: 'rgroupatom' }, hidden: options => isHidden(options, 'rgroup-label') }, 'rgroup-fragment': { shortcut: ['Mod+Shift+r', 'Mod+r'], title: 'R-Group Fragment Tool', action: { tool: 'rgroupfragment' }, hidden: options => isHidden(options, 'rgroup-fragment') }, 'rgroup-attpoints': { shortcut: 'Mod+r', title: 'Attachment Point Tool', action: { tool: 'apoint' }, hidden: options => isHidden(options, 'rgroup-attpoints') }, shape: { hidden: options => isHidden(options, 'shape') }, 'shape-ellipse': { title: 'Shape Ellipse', action: { tool: 'simpleobject', opts: SimpleObjectMode.ellipse }, hidden: options => isHidden(options, 'shape-ellipse') }, 'shape-rectangle': { title: 'Shape Rectangle', action: { tool: 'simpleobject', opts: SimpleObjectMode.rectangle }, hidden: options => isHidden(options, 'shape-rectangle') }, 'shape-line': { title: 'Shape Line', action: { tool: 'simpleobject', opts: SimpleObjectMode.line }, hidden: options => isHidden(options, 'shape-line') }, text: { title: 'Add text', action: { tool: 'text' }, hidden: options => isHidden(options, 'text') } } const bondCuts = { single: '1', double: '2', triple: '3', up: '1', down: '1', updown: '1', crossed: '2', any: '0', aromatic: '4' } const typeSchema = bondSchema.properties.type export default typeSchema.enum.reduce((res, type, i) => { res[`bond-${type}`] = { title: `${typeSchema.enumNames[i]} Bond`, shortcut: bondCuts[type], action: { tool: 'bond', opts: toBondType(type) } } return res }, toolActions)
joo.classLoader.prepare("package flashx.textLayout.formats",/* {*/ /** * Defines values for setting the <code>direction</code> property of the <code>TextLayoutFormat</code> class. Left-to-right reading order is used in Latin-style scripts. Right-to-left reading order is used with scripts such as Arabic or Hebrew. * @see TextLayoutFormat#direction * */ "public final class Direction",1,function($$private){;return[ /** * Specifies left-to-right direction for text. */ "public static const",{ LTR/*:String*/ : "ltr"}, /** * Specifies right-to-left direction for text. */ "public static const",{ RTL/*:String*/ : "rtl"}, ];},[],[], "0.8.0", "0.9.6" );
#!/usr/bin/env python my_name = 'Zed A. Shaw' my_age = 35 # not a lie my_height = 74 # inches my_weight = 180 # lbs my_eyes = 'Blue' my_teeth = 'White' my_hair = 'Brown' print "Let's talk about %s." % my_name print "He's %d inches tall." % my_height print "He's %d pounds heavy." % my_weight print "Actually that's not too heavy." print "He's got %s eyes and %s hair." % (my_eyes, my_hair) print "His teeth are usually %s depending on the coffee." % my_teeth # this line is tricky, try to get it exactly right print "If I add %d, %d, and %d I get %d." % (my_age, my_height, my_weight, my_age + my_height + my_weight)
/*eslint no-console: 0*/ import test from "ava"; import { post } from "../../build/browser/index.umd.js"; test("Creating a resource in jsonplaceholder. (Content-Type)", async t => { t.plan(2); try { const _post = { title: "foo", body: "bar", userId: Math.random(), }; const { response, data, } = await post`https://jsonplaceholder.typicode.com/posts Content-type: application/json ${JSON.stringify(_post)}`; t.is(response.status, 201); t.is(data.constructor, Object); } catch (err) { console.log(err); } }); test("Creating a resource in jsonplaceholder.", async t => { t.plan(2); try { const { response, data, } = await post`https://jsonplaceholder.typicode.com/posts ${{ title: "foo", body: "bar", userId: Math.random(), }}`; t.is(response.status, 201); t.is(data.constructor, Object); } catch (err) { console.log(err); } }); test("Creating a resource in jsonplaceholder with expression interpolations", async t => { t.plan(2); const sub = "jsonplaceholder"; try { const { response, data, } = await post`https://${sub}.${"typicode"}.com/${"posts"}/ ${{ title: "foo", body: "bar", userId: Math.random(), }}`; t.is(response.status, 201); t.is(data.constructor, Object); } catch (err) { console.log(err); } }); test("Creating a basic resource in jsonplaceholder", async t => { t.plan(2); try { const { response, data, } = await post`https://jsonplaceholder.typicode.com/posts/ ${{ title: "foo", body: "bar", userId: Math.random(), }}`; t.is(response.status, 201); t.is(data.constructor, Object); } catch (err) { console.log(err); } });
import { utilGetAllNodes } from '@id-sdk/util'; import { t } from '../core/localizer'; import { behaviorOperation } from '../behavior/operation'; import { prefs } from '../core/preferences'; import { modeMove } from '../modes/move'; import { utilTotalExtent } from '../util/util'; export function operationMove(context, selectedIDs) { var multi = (selectedIDs.length === 1 ? 'single' : 'multiple'); var nodes = utilGetAllNodes(selectedIDs, context.graph()); var coords = nodes.map(function(n) { return n.loc; }); var extent = utilTotalExtent(selectedIDs, context.graph()); var operation = function() { context.enter(modeMove(context, selectedIDs)); }; operation.available = function() { return selectedIDs.length > 0; }; operation.disabled = function() { const allowLargeEdits = prefs('rapid-internal-feature.allowLargeEdits') === 'true'; if (!allowLargeEdits && extent.percentContainedIn(context.map().extent()) < 0.8) { return 'too_large'; } else if (someMissing()) { return 'not_downloaded'; } else if (selectedIDs.some(context.hasHiddenConnections)) { return 'connected_to_hidden'; } else if (selectedIDs.some(incompleteRelation)) { return 'incomplete_relation'; } return false; function someMissing() { if (context.inIntro()) return false; var osm = context.connection(); if (osm) { var missing = coords.filter(function(loc) { return !osm.isDataLoaded(loc); }); if (missing.length) { missing.forEach(function(loc) { context.loadTileAtLoc(loc); }); return true; } } return false; } function incompleteRelation(id) { var entity = context.entity(id); return entity.type === 'relation' && !entity.isComplete(context.graph()); } }; operation.tooltip = function() { var disable = operation.disabled(); return disable ? t('operations.move.' + disable + '.' + multi) : t('operations.move.description.' + multi); }; operation.annotation = function() { return selectedIDs.length === 1 ? t('operations.move.annotation.' + context.graph().geometry(selectedIDs[0])) : t('operations.move.annotation.feature', { n: selectedIDs.length }); }; operation.id = 'move'; operation.keys = [t('operations.move.key')]; operation.title = t('operations.move.title'); operation.behavior = behaviorOperation(context).which(operation); operation.mouseOnly = true; return operation; }
from .fdio import * # yapf: disable # NOQA # version detector. Precedence: installed dist, git, 'UNKNOWN' try: from ._dist_ver import __version__ except ImportError: try: from setuptools_scm import get_version __version__ = get_version(root="..", relative_to=__file__) except (ImportError, LookupError): __version__ = "UNKNOWN"
import sqlite3 as sq import datetime as dt from contextlib import contextmanager from rapidfuzz import fuzz from rapidfuzz import process @contextmanager def cursor(): try: conn = sq.connect('bot.db') cur = conn.cursor() yield cur conn.commit() finally: conn.close() def addRip(type, rip, channel, creator): with cursor() as cur: date = dt.datetime.now().strftime("%Y-%m-%d %H:%M:%S") cur.execute('INSERT INTO Rip values(?, ?, ?, ?, ?)', (rip, type, date, channel, creator)) def delRip(delrip): with cursor() as cur: cur.execute('DELETE FROM Rip WHERE type = ? and rip = ?', (delrip)) def readRips(): with cursor() as cur: cur.execute('SELECT type, rip, channel from Rip') rows = cur.fetchall() data = {} for row in rows: type, rip, channel = row if channel not in data: data[channel] = set() data[channel].add((type, rip)) return data def readViisaudet(): with cursor() as cur: cur.execute('SELECT viisaus from Viisaus') rows = cur.fetchall() return set(rows) def readSanat(): with cursor() as cur: cur.execute('SELECT sana from Sana') rows = cur.fetchall() return set(rows) def upsertOppi(keyword, definition, channel, creator): with cursor() as cur: date = dt.datetime.now().strftime("%Y-%m-%d %H:%M:%S") cur.execute('INSERT OR REPLACE INTO Oppi values(?, ?, ?, ?, ?)', (keyword, definition, date, channel, creator)) def findOppi(keyword, channel): with cursor() as cur: cur.execute('SELECT definition FROM Oppi WHERE keyword=? and channel=?', (keyword, channel)) return cur.fetchone() def searchOppi(keyword, user, channels): search = '%' + keyword + '%' results = [] for channel in channels: with cursor() as cur: cur.execute('SELECT keyword, definition FROM Oppi WHERE (keyword LIKE ? OR definition LIKE ?) AND channel=? LIMIT 50', (search, search, channel)) results = results + [(item[0], item[1]) for item in cur.fetchall()] opis = {} keys = [] for item in results: opis[item[0]] = item[1] keys.append(item[0]) keys = list(set(keys)) fuzzed = process.extract(keyword, keys, limit=50) output = [] for item in fuzzed: output.append((item[0], opis[item[0]])) return output def getChannels(): with cursor() as cur: cur.execute('SELECT DISTINCT channel FROM Oppi') return [item[0] for item in cur.fetchall()] def countOpis(channel): with cursor() as cur: cur.execute('SELECT COUNT(*) AS count FROM Oppi WHERE channel=?', (channel,)) count = cur.fetchone() return count def randomOppi(channel): with cursor() as cur: cur.execute('SELECT keyword, definition FROM Oppi WHERE channel=? ORDER BY RANDOM() LIMIT 1', (channel,)) return cur.fetchone() def insertQuote(quote, quotee, channel, creator): with cursor() as cur: date = dt.datetime.now().strftime("%Y-%m-%d %H:%M:%S") cur.execute('INSERT INTO Quote values(?, ?, ?, ?, ?)', (quote, quotee, date, channel, creator)) def findQuotes(channel, quotee=None): with cursor() as cur: if quotee is not None: cur.execute('SELECT quote, quotee FROM Quote WHERE channel=? AND upper(quotee) = upper(?)', (channel, quotee)) return cur.fetchall() else: cur.execute('SELECT quote, quotee FROM Quote WHERE channel=?', (channel,)) return cur.fetchall() def countQuotes(channel): with cursor() as cur: cur.execute('SELECT count(quote) FROM Quote WHERE channel=?', (channel,)) return cur.fetchone()[0] def readDiagnoosit(): with cursor() as cur: cur.execute('SELECT diagnoosi from Diagnoosi') rows = cur.fetchall() return set(rows) def readMaidot(): with cursor() as cur: cur.execute('SELECT maito from Maito') rows = cur.fetchall() return set(rows) def readNimet(): with cursor() as cur: cur.execute('SELECT nimi from Nimi') rows = cur.fetchall() return set(rows) def readKalat(): with cursor() as cur: cur.execute('SELECT kala from Kalat') rows = cur.fetchall() return set(rows) def readVihanneet(): with cursor() as cur: cur.execute('SELECT nimi from Vihannes') rows = cur.fetchall() return set(rows) def readPlanetoidit(): with cursor() as cur: cur.execute('SELECT nimi from Planetoidi') rows = cur.fetchall() return set(rows) def readKulkuneuvot(): with cursor() as cur: cur.execute('SELECT nimi from Kulkuneuvo') rows = cur.fetchall() return set(rows) def readLinnut(): with cursor() as cur: cur.execute('SELECT nimi from Linnut') rows = cur.fetchall() return set(rows) def readSotilasarvot(): with cursor() as cur: cur.execute('SELECT nimi from Arvonimet') rows = cur.fetchall() return set(rows) def readSotilasnimet(): with cursor() as cur: cur.execute('SELECT nimi from Sotilasnimet') rows = cur.fetchall() return set(rows) def readKasvinimet(): with cursor() as cur: cur.execute('SELECT nimi from Kasvinimet') rows = cur.fetchall() return set(rows) def readEnnustukset(): with cursor() as cur: cur.execute('SELECT rivi from Ennustus') rows = cur.fetchall() return set(rows) def readNakutukset(): with cursor() as cur: cur.execute('SELECT nakutus from Nakutukset') rows = cur.fetchall() return set(rows) def readDefinitions(channel): with cursor() as cur: cur.execute('SELECT definition, keyword from Oppi where channel=?', (channel, )) rows = cur.fetchall() return rows def upsertTag(tag, target, channel, creator): with cursor() as cur: date = dt.datetime.now().strftime("%Y-%m-%d %H:%M:%S") cur.execute('INSERT OR REPLACE INTO Tagit values(?, ?, ?, ?, ?)', (tag, target, channel, creator, date)) def findTagged(tag, channel): with cursor() as cur: cur.execute('SELECT target FROM Tagit WHERE tag=? and channel=?', (tag, channel)) rows = cur.fetchall() return rows def findTargetTags(target, channel): with cursor() as cur: cur.execute('SELECT tag FROM Tagit WHERE target=? and channel=?', (target, channel)) rows = cur.fetchall() return rows def addUrheilu(uid, chatid, km, lajinnimi, date): with cursor() as cur: query = ("INSERT INTO Urheilut (uid, chatid, km, type, date) VALUES (?, ?, ?, " "(SELECT l.id FROM Urheilulajit AS l WHERE l.nimi = ?), ?)") params = (uid, chatid, km, lajinnimi, date) cur.execute(query, params) def getKayttajanUrheilut(uid, chatid, earliest_date): with cursor() as cur: query = ("SELECT up.lajinnimi AS lajinnimi, SUM(up.km) AS km, SUM(up.pisteet) AS pisteet " "FROM UrheilutPisteilla AS up " "WHERE up.uid = ? AND up.chatid = ? AND up.date >= ? " "GROUP BY up.lajinnimi, up.uid") params = (uid, chatid, earliest_date) cur.execute(query, params) return cur.fetchall() def getTopUrheilut(chatid, lajinnimi, earliest_date, limit): with cursor() as cur: query = ("SELECT uid, km from (SELECT up.uid AS uid, SUM(up.km) AS km " "FROM UrheilutPisteilla AS up " "WHERE up.chatid = ? AND up.date >= ? AND up.lajinnimi = ? " "GROUP BY up.lajinnimi, up.uid) " "ORDER BY km DESC LIMIT ?") params = (chatid, earliest_date, lajinnimi, limit) cur.execute(query, params) return cur.fetchall() def getPisteet(chatid, earliest_date, limit): with cursor() as cur: query = ("SELECT uid, pisteet from (SELECT up.uid AS uid, SUM(up.pisteet) AS pisteet " "FROM UrheilutPisteilla AS up " "WHERE up.chatid = ? AND up.date >= ? " "GROUP BY up.uid) " "ORDER BY pisteet DESC LIMIT ?") params = (chatid, earliest_date, limit) cur.execute(query, params) return cur.fetchall() def lisaaUrheilulaji(nimi, kerroin): with cursor() as cur: cur.execute("INSERT INTO Urheilulajit (nimi, kerroin) VALUES (?, ?) ON CONFLICT (nimi) DO UPDATE SET kerroin = ?", (nimi, kerroin, kerroin)) def readSelitykset(): with cursor() as cur: cur.execute('SELECT kortti, selitys, rev from Korttiselitykset') rows = cur.fetchall() return (rows)
import logging # Setup Basic Configuration logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S') logger = logging.getLogger(__name__)
# Copyright (c) 2016 Ansible, Inc. # All Rights Reserved. import json from django.utils.encoding import smart_text from django.core.mail.backends.base import BaseEmailBackend from django.utils.translation import ugettext_lazy as _ class AWXBaseEmailBackend(BaseEmailBackend): def format_body(self, body): if "body" in body: body_actual = body['body'] else: body_actual = smart_text(_("{} #{} had status {}, view details at {}\n\n").format( body['friendly_name'], body['id'], body['status'], body['url']) ) body_actual += json.dumps(body, indent=4) return body_actual
(window.webpackJsonp=window.webpackJsonp||[]).push([[27],{157:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return i})),n.d(t,"metadata",(function(){return c})),n.d(t,"rightToc",(function(){return l})),n.d(t,"default",(function(){return s}));var r=n(2),o=n(9),a=(n(0),n(323)),i={id:"login",title:"This should be the Login UI"},c={id:"version-v0.2/fallback/login",title:"This should be the Login UI",description:"You ended up here because you did not set the following configuration value:",source:"@site/versioned_docs/version-v0.2/fallback/login.mdx",permalink:"/kratos/docs/v0.2/fallback/login",editUrl:"https://github.com/ory/kratos/edit/master/docs/versioned_docs/version-v0.2/fallback/login.mdx",version:"v0.2",lastUpdatedBy:"aeneasr",lastUpdatedAt:1588605498},l=[],u={rightToc:l};function s(e){var t=e.components,n=Object(o.a)(e,["components"]);return Object(a.b)("wrapper",Object(r.a)({},u,n,{components:t,mdxType:"MDXLayout"}),Object(a.b)("p",null,"You ended up here because you did not set the following configuration value:"),Object(a.b)("pre",null,Object(a.b)("code",Object(r.a)({parentName:"pre"},{className:"language-yaml",metastring:'title="path/to/kratos/config.yml',title:'"path/to/kratos/config.yml'}),"urls:\n login_ui: http://my-app.com/login\n")),Object(a.b)("p",null,"You can set this configuration value using environment variable ",Object(a.b)("inlineCode",{parentName:"p"},"URLS_LOGIN_UI"),"\nas well!"),Object(a.b)("p",null,"If you don't know what that means, head over to\n",Object(a.b)("a",Object(r.a)({parentName:"p"},{href:"/kratos/docs/v0.2/self-service/flows/user-login-user-registration"}),"User Login and Registration"),"!"))}s.isMDXComponent=!0},323:function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return b}));var r=n(0),o=n.n(r);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=o.a.createContext({}),s=function(e){var t=o.a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},p=function(e){var t=s(e.components);return o.a.createElement(u.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},d=o.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),p=s(n),d=r,b=p["".concat(i,".").concat(d)]||p[d]||f[d]||a;return n?o.a.createElement(b,c(c({ref:t},u),{},{components:n})):o.a.createElement(b,c({ref:t},u))}));function b(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var u=2;u<a;u++)i[u]=n[u];return o.a.createElement.apply(null,i)}return o.a.createElement.apply(null,n)}d.displayName="MDXCreateElement"}}]);
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin Developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. // // Why base-58 instead of standard base-64 encoding? // - Don't want 0OIl characters that look the same in some fonts and // could be used to create visually identical looking account numbers. // - A string with non-alphanumeric characters is not as easily accepted as an account number. // - E-mail usually won't line-break if there's no punctuation to break at. // - Double-clicking selects the whole number as one word if it's all alphanumeric. // #ifndef BITCOIN_BASE58_H #define BITCOIN_BASE58_H #include <string> #include <vector> #include "bignum.h" #include "key.h" #include "script.h" static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; // Encode a byte sequence as a base58-encoded string inline std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend) { CAutoBN_CTX pctx; CBigNum bn58 = 58; CBigNum bn0 = 0; // Convert big endian data to little endian // Extra zero at the end make sure bignum will interpret as a positive number std::vector<unsigned char> vchTmp(pend-pbegin+1, 0); reverse_copy(pbegin, pend, vchTmp.begin()); // Convert little endian data to bignum CBigNum bn; bn.setvch(vchTmp); // Convert bignum to std::string std::string str; // Expected size increase from base58 conversion is approximately 137% // use 138% to be safe str.reserve((pend - pbegin) * 138 / 100 + 1); CBigNum dv; CBigNum rem; while (bn > bn0) { if (!BN_div(&dv, &rem, &bn, &bn58, pctx)) throw bignum_error("EncodeBase58 : BN_div failed"); bn = dv; unsigned int c = rem.getulong(); str += pszBase58[c]; } // Leading zeroes encoded as base58 zeros for (const unsigned char* p = pbegin; p < pend && *p == 0; p++) str += pszBase58[0]; // Convert little endian std::string to big endian reverse(str.begin(), str.end()); return str; } // Encode a byte vector as a base58-encoded string inline std::string EncodeBase58(const std::vector<unsigned char>& vch) { return EncodeBase58(&vch[0], &vch[0] + vch.size()); } // Decode a base58-encoded string psz into byte vector vchRet // returns true if decoding is successful inline bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet) { CAutoBN_CTX pctx; vchRet.clear(); CBigNum bn58 = 58; CBigNum bn = 0; CBigNum bnChar; while (isspace(*psz)) psz++; // Convert big endian string to bignum for (const char* p = psz; *p; p++) { const char* p1 = strchr(pszBase58, *p); if (p1 == NULL) { while (isspace(*p)) p++; if (*p != '\0') return false; break; } bnChar.setulong(p1 - pszBase58); if (!BN_mul(&bn, &bn, &bn58, pctx)) throw bignum_error("DecodeBase58 : BN_mul failed"); bn += bnChar; } // Get bignum as little endian data std::vector<unsigned char> vchTmp = bn.getvch(); // Trim off sign byte if present if (vchTmp.size() >= 2 && vchTmp.end()[-1] == 0 && vchTmp.end()[-2] >= 0x80) vchTmp.erase(vchTmp.end()-1); // Restore leading zeros int nLeadingZeros = 0; for (const char* p = psz; *p == pszBase58[0]; p++) nLeadingZeros++; vchRet.assign(nLeadingZeros + vchTmp.size(), 0); // Convert little endian data to big endian reverse_copy(vchTmp.begin(), vchTmp.end(), vchRet.end() - vchTmp.size()); return true; } // Decode a base58-encoded string str into byte vector vchRet // returns true if decoding is successful inline bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet) { return DecodeBase58(str.c_str(), vchRet); } // Encode a byte vector to a base58-encoded string, including checksum inline std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn) { // add 4-byte hash check to the end std::vector<unsigned char> vch(vchIn); uint256 hash = Hash(vch.begin(), vch.end()); vch.insert(vch.end(), (unsigned char*)&hash, (unsigned char*)&hash + 4); return EncodeBase58(vch); } // Decode a base58-encoded string psz that includes a checksum, into byte vector vchRet // returns true if decoding is successful inline bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet) { if (!DecodeBase58(psz, vchRet)) return false; if (vchRet.size() < 4) { vchRet.clear(); return false; } uint256 hash = Hash(vchRet.begin(), vchRet.end()-4); if (memcmp(&hash, &vchRet.end()[-4], 4) != 0) { vchRet.clear(); return false; } vchRet.resize(vchRet.size()-4); return true; } // Decode a base58-encoded string str that includes a checksum, into byte vector vchRet // returns true if decoding is successful inline bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet) { return DecodeBase58Check(str.c_str(), vchRet); } /** Base class for all base58-encoded data */ class CBase58Data { protected: // the version byte unsigned char nVersion; // the actually encoded data std::vector<unsigned char> vchData; CBase58Data() { nVersion = 0; vchData.clear(); } ~CBase58Data() { // zero the memory, as it may contain sensitive data if (!vchData.empty()) memset(&vchData[0], 0, vchData.size()); } void SetData(int nVersionIn, const void* pdata, size_t nSize) { nVersion = nVersionIn; vchData.resize(nSize); if (!vchData.empty()) memcpy(&vchData[0], pdata, nSize); } void SetData(int nVersionIn, const unsigned char *pbegin, const unsigned char *pend) { SetData(nVersionIn, (void*)pbegin, pend - pbegin); } public: bool SetString(const char* psz) { std::vector<unsigned char> vchTemp; DecodeBase58Check(psz, vchTemp); if (vchTemp.empty()) { vchData.clear(); nVersion = 0; return false; } nVersion = vchTemp[0]; vchData.resize(vchTemp.size() - 1); if (!vchData.empty()) memcpy(&vchData[0], &vchTemp[1], vchData.size()); memset(&vchTemp[0], 0, vchTemp.size()); return true; } bool SetString(const std::string& str) { return SetString(str.c_str()); } std::string ToString() const { std::vector<unsigned char> vch(1, nVersion); vch.insert(vch.end(), vchData.begin(), vchData.end()); return EncodeBase58Check(vch); } int CompareTo(const CBase58Data& b58) const { if (nVersion < b58.nVersion) return -1; if (nVersion > b58.nVersion) return 1; if (vchData < b58.vchData) return -1; if (vchData > b58.vchData) return 1; return 0; } bool operator==(const CBase58Data& b58) const { return CompareTo(b58) == 0; } bool operator<=(const CBase58Data& b58) const { return CompareTo(b58) <= 0; } bool operator>=(const CBase58Data& b58) const { return CompareTo(b58) >= 0; } bool operator< (const CBase58Data& b58) const { return CompareTo(b58) < 0; } bool operator> (const CBase58Data& b58) const { return CompareTo(b58) > 0; } }; /** base58-encoded addresses. * Public-key-hash-addresses have version 25 (or 111 testnet). * The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key. * Script-hash-addresses have version 85 (or 196 testnet). * The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script. */ class CBitcoinAddress; class CBitcoinAddressVisitor : public boost::static_visitor<bool> { private: CBitcoinAddress *addr; public: CBitcoinAddressVisitor(CBitcoinAddress *addrIn) : addr(addrIn) { } bool operator()(const CKeyID &id) const; bool operator()(const CScriptID &id) const; bool operator()(const CNoDestination &no) const; }; class CBitcoinAddress : public CBase58Data { public: enum { PUBKEY_ADDRESS = 63, // pskbank SCRIPT_ADDRESS = 85, // pskbank PUBKEY_ADDRESS_TEST = 111, SCRIPT_ADDRESS_TEST = 196, }; bool Set(const CKeyID &id) { SetData(fTestNet ? PUBKEY_ADDRESS_TEST : PUBKEY_ADDRESS, &id, 20); return true; } bool Set(const CScriptID &id) { SetData(fTestNet ? SCRIPT_ADDRESS_TEST : SCRIPT_ADDRESS, &id, 20); return true; } bool Set(const CTxDestination &dest) { return boost::apply_visitor(CBitcoinAddressVisitor(this), dest); } bool IsValid() const { unsigned int nExpectedSize = 20; bool fExpectTestNet = false; switch(nVersion) { case PUBKEY_ADDRESS: nExpectedSize = 20; // Hash of public key fExpectTestNet = false; break; case SCRIPT_ADDRESS: nExpectedSize = 20; // Hash of CScript fExpectTestNet = false; break; case PUBKEY_ADDRESS_TEST: nExpectedSize = 20; fExpectTestNet = true; break; case SCRIPT_ADDRESS_TEST: nExpectedSize = 20; fExpectTestNet = true; break; default: return false; } return fExpectTestNet == fTestNet && vchData.size() == nExpectedSize; } CBitcoinAddress() { } CBitcoinAddress(const CTxDestination &dest) { Set(dest); } CBitcoinAddress(const std::string& strAddress) { SetString(strAddress); } CBitcoinAddress(const char* pszAddress) { SetString(pszAddress); } CTxDestination Get() const { if (!IsValid()) return CNoDestination(); switch (nVersion) { case PUBKEY_ADDRESS: case PUBKEY_ADDRESS_TEST: { uint160 id; memcpy(&id, &vchData[0], 20); return CKeyID(id); } case SCRIPT_ADDRESS: case SCRIPT_ADDRESS_TEST: { uint160 id; memcpy(&id, &vchData[0], 20); return CScriptID(id); } } return CNoDestination(); } bool GetKeyID(CKeyID &keyID) const { if (!IsValid()) return false; switch (nVersion) { case PUBKEY_ADDRESS: case PUBKEY_ADDRESS_TEST: { uint160 id; memcpy(&id, &vchData[0], 20); keyID = CKeyID(id); return true; } default: return false; } } bool IsScript() const { if (!IsValid()) return false; switch (nVersion) { case SCRIPT_ADDRESS: case SCRIPT_ADDRESS_TEST: { return true; } default: return false; } } }; bool inline CBitcoinAddressVisitor::operator()(const CKeyID &id) const { return addr->Set(id); } bool inline CBitcoinAddressVisitor::operator()(const CScriptID &id) const { return addr->Set(id); } bool inline CBitcoinAddressVisitor::operator()(const CNoDestination &id) const { return false; } /** A base58-encoded secret key */ class CBitcoinSecret : public CBase58Data { public: void SetSecret(const CSecret& vchSecret, bool fCompressed) { assert(vchSecret.size() == 32); SetData(128 + (fTestNet ? CBitcoinAddress::PUBKEY_ADDRESS_TEST : CBitcoinAddress::PUBKEY_ADDRESS), &vchSecret[0], vchSecret.size()); if (fCompressed) vchData.push_back(1); } CSecret GetSecret(bool &fCompressedOut) { CSecret vchSecret; vchSecret.resize(32); memcpy(&vchSecret[0], &vchData[0], 32); fCompressedOut = vchData.size() == 33; return vchSecret; } bool IsValid() const { bool fExpectTestNet = false; switch(nVersion) { case (128 + CBitcoinAddress::PUBKEY_ADDRESS): break; case (128 + CBitcoinAddress::PUBKEY_ADDRESS_TEST): fExpectTestNet = true; break; default: return false; } return fExpectTestNet == fTestNet && (vchData.size() == 32 || (vchData.size() == 33 && vchData[32] == 1)); } bool SetString(const char* pszSecret) { return CBase58Data::SetString(pszSecret) && IsValid(); } bool SetString(const std::string& strSecret) { return SetString(strSecret.c_str()); } CBitcoinSecret(const CSecret& vchSecret, bool fCompressed) { SetSecret(vchSecret, fCompressed); } CBitcoinSecret() { } }; #endif
var express = require('express') var app = express() var path = require('path') var bodyParser = require('body-parser') var cookieSession = require('cookie-session') var apiRoute = require('./routes/api.js') // 设置静态路径 app.use(express.static(path.join(__dirname, 'public'))) // 配置body解析器 app.use(bodyParser.json()) app.use(bodyParser.urlencoded({extended: false})) // 使用服务器客户端数据通信的中间件 app.use(cookieSession({ name: 'session', secret: 'some random charactors', maxAge: 1000 * 60 * 60 * 24 })) // 使用路由 app.use('/api', apiRoute) // 监听端口号 app.listen(process.env.PORT || '8080')
/* eslint-disable @typescript-eslint/no-var-requires */ process.env.NODE_ENV = 'test'; module.exports = wallaby => ({ files: [ 'src/**/*.ts', 'jest.config.js', 'test/avatar.png', 'test/profile.jpg', ], tests: ['test/**/*.test.ts'], testFramework: 'jest', env: { type: 'node', runner: 'node', }, // setup: function(wallaby) { // const jestConfig = require('./backend/jest.config'); // wallaby.testFramework.configure(jestConfig); // }, setup: function(wallaby) { const jestConfig = require('./jest.config'); wallaby.testFramework.configure(jestConfig); }, workers: { initial: 1, regular: 1, }, });
export default { lang: { colorpicker: { confirm: 'OK', clear: 'Tøm' }, datepicker: { now: 'Nå', today: 'I dag', cancel: 'Avbryt', clear: 'Tøm', confirm: 'OK', selectDate: 'Velg dato', selectTime: 'Velg tidspunkt', startDate: 'Start Dato', startTime: 'Start Tidspunkt', endDate: 'Sluttdato', endTime: 'Sluttidspunkt', prevYear: 'Previous Year', // to be translated nextYear: 'Next Year', // to be translated prevMonth: 'Previous Month', // to be translated nextMonth: 'Next Month', // to be translated year: '', month1: 'Januar', month2: 'Februar', month3: 'Mars', month4: 'April', month5: 'Mai', month6: 'Juni', month7: 'Juli', month8: 'August', month9: 'September', month10: 'Oktober', month11: 'November', month12: 'Desember', // week: 'week', weeks: { sun: 'Søn', mon: 'Man', tue: 'Tir', wed: 'Ons', thu: 'Tor', fri: 'Fre', sat: 'Lør' }, months: { jan: 'Jan', feb: 'Feb', mar: 'Mar', apr: 'Apr', may: 'Mai', jun: 'Jun', jul: 'Jul', aug: 'Aug', sep: 'Sep', oct: 'Okt', nov: 'Nov', dec: 'Des' } }, select: { loading: 'Laster', noMatch: 'Ingen samsvarende data', noData: 'Ingen data', placeholder: 'Velg' }, cascader: { noMatch: 'Ingen samsvarende data', loading: 'Laster', placeholder: 'Velg', noData: 'Ingen data' }, pagination: { goto: 'Gå til', pagesize: '/side', total: 'Total {total}', pageClassifier: '' }, messagebox: { confirm: 'OK', cancel: 'Avbryt', error: 'Ugyldig input' }, upload: { deleteTip: 'press delete to remove', // to be translated delete: 'Slett', preview: 'Forhåndsvisning', continue: 'Fortsett' }, table: { emptyText: 'Ingen Data', confirmFilter: 'Bekreft', resetFilter: 'Tilbakestill', clearFilter: 'Alle', sumText: 'Sum' // to be translated }, tree: { emptyText: 'Ingen Data' }, transfer: { noMatch: 'Ingen samsvarende data', noData: 'Ingen data', titles: ['List 1', 'List 2'], // to be translated filterPlaceholder: 'Enter keyword', // to be translated noCheckedFormat: '{total} items', // to be translated hasCheckedFormat: '{checked}/{total} checked' // to be translated }, image: { error: 'FAILED' // to be translated }, pageHeader: { title: 'Back' // to be translated }, popconfirm: { confirmButtonText: 'Yes', // to be translated cancelButtonText: 'No' // to be translated }, empty: { description: 'Ingen Data' } } };
import { __rest } from "tslib"; import * as React from 'react'; import { css } from '@patternfly/react-styles'; import styles from '@patternfly/react-styles/css/components/Wizard/wizard'; export const WizardNavItem = (_a) => { var { children = null, content = '', isCurrent = false, isDisabled = false, step, onNavItemClick = () => undefined, navItemComponent = 'button', href = null } = _a, rest = __rest(_a, ["children", "content", "isCurrent", "isDisabled", "step", "onNavItemClick", "navItemComponent", "href"]); const NavItemComponent = navItemComponent; if (navItemComponent === 'a' && !href && process.env.NODE_ENV !== 'production') { // eslint-disable-next-line no-console console.error('WizardNavItem: When using an anchor, please provide an href'); } const btnProps = { disabled: isDisabled }; const linkProps = { tabIndex: isDisabled ? -1 : undefined, href }; return (React.createElement("li", { className: css(styles.wizardNavItem) }, React.createElement(NavItemComponent, Object.assign({}, rest, (navItemComponent === 'a' ? Object.assign({}, linkProps) : Object.assign({}, btnProps)), { onClick: () => onNavItemClick(step), className: css(styles.wizardNavLink, isCurrent && 'pf-m-current', isDisabled && 'pf-m-disabled'), "aria-disabled": isDisabled ? true : null, "aria-current": isCurrent && !children ? 'page' : false }), content), children)); }; WizardNavItem.displayName = 'WizardNavItem'; //# sourceMappingURL=WizardNavItem.js.map
""" General image database An image database creates a list of relative image path called image_set_index and transform index to absolute image path. As to training, it is necessary that ground truth and proposals are mixed together for training. roidb basic format [image_index] ['image', 'height', 'width', 'flipped', 'boxes', 'gt_classes', 'gt_overlaps', 'max_classes', 'max_overlaps', 'bbox_targets'] """ import os import cPickle import numpy as np from ..processing.bbox_transform import bbox_overlaps class IMDB(object): def __init__(self, name, image_set, root_path, dataset_path): """ basic information about an image database :param name: name of image database will be used for any output :param root_path: root path store cache and proposal data :param dataset_path: dataset path store images and image lists """ self.name = name + '_' + image_set self.image_set = image_set self.root_path = root_path self.data_path = dataset_path # abstract attributes self.classes = [] self.num_classes = 0 self.image_set_index = [] self.num_images = 0 self.config = {} def image_path_from_index(self, index): raise NotImplementedError def gt_roidb(self): raise NotImplementedError def evaluate_detections(self, detections): raise NotImplementedError @property def cache_path(self): """ make a directory to store all caches :return: cache path """ cache_path = os.path.join(self.root_path, 'cache_no_dff') if not os.path.exists(cache_path): os.mkdir(cache_path) return cache_path def image_path_at(self, index): """ access image at index in image database :param index: image index in image database :return: image path """ return self.image_path_from_index(self.image_set_index[index]) def load_rpn_data(self, full=False): if full: rpn_file = os.path.join(self.root_path, 'rpn_data', self.name + '_full_rpn.pkl') else: rpn_file = os.path.join(self.root_path, 'rpn_data', self.name + '_rpn.pkl') print 'loading {}'.format(rpn_file) assert os.path.exists(rpn_file), 'rpn data not found at {}'.format(rpn_file) with open(rpn_file, 'rb') as f: box_list = cPickle.load(f) return box_list def load_rpn_roidb(self, gt_roidb): """ turn rpn detection boxes into roidb :param gt_roidb: [image_index]['boxes', 'gt_classes', 'gt_overlaps', 'flipped'] :return: roidb: [image_index]['boxes', 'gt_classes', 'gt_overlaps', 'flipped'] """ box_list = self.load_rpn_data() return self.create_roidb_from_box_list(box_list, gt_roidb) def rpn_roidb(self, gt_roidb, append_gt=False): """ get rpn roidb and ground truth roidb :param gt_roidb: ground truth roidb :param append_gt: append ground truth :return: roidb of rpn """ if append_gt: print 'appending ground truth annotations' rpn_roidb = self.load_rpn_roidb(gt_roidb) roidb = IMDB.merge_roidbs(gt_roidb, rpn_roidb) else: roidb = self.load_rpn_roidb(gt_roidb) return roidb def create_roidb_from_box_list(self, box_list, gt_roidb): """ given ground truth, prepare roidb :param box_list: [image_index] ndarray of [box_index][x1, x2, y1, y2] :param gt_roidb: [image_index]['boxes', 'gt_classes', 'gt_overlaps', 'flipped'] :return: roidb: [image_index]['boxes', 'gt_classes', 'gt_overlaps', 'flipped'] """ assert len(box_list) == self.num_images, 'number of boxes matrix must match number of images' roidb = [] for i in range(self.num_images): roi_rec = dict() roi_rec['image'] = gt_roidb[i]['image'] roi_rec['height'] = gt_roidb[i]['height'] roi_rec['width'] = gt_roidb[i]['width'] boxes = box_list[i] if boxes.shape[1] == 5: boxes = boxes[:, :4] num_boxes = boxes.shape[0] overlaps = np.zeros((num_boxes, self.num_classes), dtype=np.float32) if gt_roidb is not None and gt_roidb[i]['boxes'].size > 0: gt_boxes = gt_roidb[i]['boxes'] gt_classes = gt_roidb[i]['gt_classes'] # n boxes and k gt_boxes => n * k overlap gt_overlaps = bbox_overlaps(boxes.astype(np.float), gt_boxes.astype(np.float)) # for each box in n boxes, select only maximum overlap (must be greater than zero) argmaxes = gt_overlaps.argmax(axis=1) maxes = gt_overlaps.max(axis=1) I = np.where(maxes > 0)[0] overlaps[I, gt_classes[argmaxes[I]]] = maxes[I] roi_rec.update({'boxes': boxes, 'gt_classes': np.zeros((num_boxes,), dtype=np.int32), 'gt_overlaps': overlaps, 'max_classes': overlaps.argmax(axis=1), 'max_overlaps': overlaps.max(axis=1), 'flipped': False}) # background roi => background class zero_indexes = np.where(roi_rec['max_overlaps'] == 0)[0] assert all(roi_rec['max_classes'][zero_indexes] == 0) # foreground roi => foreground class nonzero_indexes = np.where(roi_rec['max_overlaps'] > 0)[0] assert all(roi_rec['max_classes'][nonzero_indexes] != 0) roidb.append(roi_rec) return roidb def append_flipped_images(self, roidb): """ append flipped images to an roidb flip boxes coordinates, images will be actually flipped when loading into network :param roidb: [image_index]['boxes', 'gt_classes', 'gt_overlaps', 'flipped'] :return: roidb: [image_index]['boxes', 'gt_classes', 'gt_overlaps', 'flipped'] """ print 'append flipped images to roidb' assert self.num_images == len(roidb) for i in range(self.num_images): roi_rec = roidb[i] boxes = roi_rec['boxes'].copy() oldx1 = boxes[:, 0].copy() oldx2 = boxes[:, 2].copy() boxes[:, 0] = roi_rec['width'] - oldx2 - 1 boxes[:, 2] = roi_rec['width'] - oldx1 - 1 assert (boxes[:, 2] >= boxes[:, 0]).all(),\ 'img_name %s, width %d\n' % (roi_rec['image'], roi_rec['width']) + \ np.array_str(roi_rec['boxes'], precision=3, suppress_small=True) entry = {'image': roi_rec['image'], 'height': roi_rec['height'], 'width': roi_rec['width'], 'boxes': boxes, 'gt_classes': roidb[i]['gt_classes'], 'gt_overlaps': roidb[i]['gt_overlaps'], 'max_classes': roidb[i]['max_classes'], 'max_overlaps': roidb[i]['max_overlaps'], 'flipped': True} roidb.append(entry) self.image_set_index *= 2 return roidb def evaluate_recall(self, roidb, candidate_boxes=None, thresholds=None): """ evaluate detection proposal recall metrics record max overlap value for each gt box; return vector of overlap values :param roidb: used to evaluate :param candidate_boxes: if not given, use roidb's non-gt boxes :param thresholds: array-like recall threshold :return: None ar: average recall, recalls: vector recalls at each IoU overlap threshold thresholds: vector of IoU overlap threshold, gt_overlaps: vector of all ground-truth overlaps """ area_names = ['all', '0-25', '25-50', '50-100', '100-200', '200-300', '300-inf'] area_ranges = [[0**2, 1e5**2], [0**2, 25**2], [25**2, 50**2], [50**2, 100**2], [100**2, 200**2], [200**2, 300**2], [300**2, 1e5**2]] area_counts = [] for area_name, area_range in zip(area_names[1:], area_ranges[1:]): area_count = 0 for i in range(self.num_images): if candidate_boxes is None: # default is use the non-gt boxes from roidb non_gt_inds = np.where(roidb[i]['gt_classes'] == 0)[0] boxes = roidb[i]['boxes'][non_gt_inds, :] else: boxes = candidate_boxes[i] boxes_areas = (boxes[:, 2] - boxes[:, 0] + 1) * (boxes[:, 3] - boxes[:, 1] + 1) valid_range_inds = np.where((boxes_areas >= area_range[0]) & (boxes_areas < area_range[1]))[0] area_count += len(valid_range_inds) area_counts.append(area_count) total_counts = float(sum(area_counts)) for area_name, area_count in zip(area_names[1:], area_counts): print 'percentage of', area_name, area_count / total_counts print 'average number of proposal', total_counts / self.num_images for area_name, area_range in zip(area_names, area_ranges): gt_overlaps = np.zeros(0) num_pos = 0 for i in range(self.num_images): # check for max_overlaps == 1 avoids including crowd annotations max_gt_overlaps = roidb[i]['gt_overlaps'].max(axis=1) gt_inds = np.where((roidb[i]['gt_classes'] > 0) & (max_gt_overlaps == 1))[0] gt_boxes = roidb[i]['boxes'][gt_inds, :] gt_areas = (gt_boxes[:, 2] - gt_boxes[:, 0] + 1) * (gt_boxes[:, 3] - gt_boxes[:, 1] + 1) valid_gt_inds = np.where((gt_areas >= area_range[0]) & (gt_areas < area_range[1]))[0] gt_boxes = gt_boxes[valid_gt_inds, :] num_pos += len(valid_gt_inds) if candidate_boxes is None: # default is use the non-gt boxes from roidb non_gt_inds = np.where(roidb[i]['gt_classes'] == 0)[0] boxes = roidb[i]['boxes'][non_gt_inds, :] else: boxes = candidate_boxes[i] if boxes.shape[0] == 0: continue overlaps = bbox_overlaps(boxes.astype(np.float), gt_boxes.astype(np.float)) _gt_overlaps = np.zeros((gt_boxes.shape[0])) # choose whatever is smaller to iterate rounds = min(boxes.shape[0], gt_boxes.shape[0]) for j in range(rounds): # find which proposal maximally covers each gt box argmax_overlaps = overlaps.argmax(axis=0) # get the IoU amount of coverage for each gt box max_overlaps = overlaps.max(axis=0) # find which gt box is covered by most IoU gt_ind = max_overlaps.argmax() gt_ovr = max_overlaps.max() assert (gt_ovr >= 0), '%s\n%s\n%s' % (boxes, gt_boxes, overlaps) # find the proposal box that covers the best covered gt box box_ind = argmax_overlaps[gt_ind] # record the IoU coverage of this gt box _gt_overlaps[j] = overlaps[box_ind, gt_ind] assert (_gt_overlaps[j] == gt_ovr) # mark the proposal box and the gt box as used overlaps[box_ind, :] = -1 overlaps[:, gt_ind] = -1 # append recorded IoU coverage level gt_overlaps = np.hstack((gt_overlaps, _gt_overlaps)) gt_overlaps = np.sort(gt_overlaps) if thresholds is None: step = 0.05 thresholds = np.arange(0.5, 0.95 + 1e-5, step) recalls = np.zeros_like(thresholds) # compute recall for each IoU threshold for i, t in enumerate(thresholds): recalls[i] = (gt_overlaps >= t).sum() / float(num_pos) ar = recalls.mean() # print results print 'average recall for {}: {:.3f}'.format(area_name, ar) for threshold, recall in zip(thresholds, recalls): print 'recall @{:.2f}: {:.3f}'.format(threshold, recall) @staticmethod def merge_roidbs(a, b): """ merge roidbs into one :param a: roidb to be merged into :param b: roidb to be merged :return: merged imdb """ assert len(a) == len(b) for i in range(len(a)): a[i]['boxes'] = np.vstack((a[i]['boxes'], b[i]['boxes'])) a[i]['gt_classes'] = np.hstack((a[i]['gt_classes'], b[i]['gt_classes'])) a[i]['gt_overlaps'] = np.vstack((a[i]['gt_overlaps'], b[i]['gt_overlaps'])) a[i]['max_classes'] = np.hstack((a[i]['max_classes'], b[i]['max_classes'])) a[i]['max_overlaps'] = np.hstack((a[i]['max_overlaps'], b[i]['max_overlaps'])) return a
from typing import Dict from datetime import datetime from botocore.paginate import Paginator class ListDeviceEvents(Paginator): def paginate(self, DeviceId: str, FromTimeStamp: datetime, ToTimeStamp: datetime, PaginationConfig: Dict = None) -> Dict: """ Creates an iterator that will paginate through responses from :py:meth:`IoT1ClickDevicesService.Client.list_device_events`. See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/devices-2018-05-14/ListDeviceEvents>`_ **Request Syntax** :: response_iterator = paginator.paginate( DeviceId='string', FromTimeStamp=datetime(2015, 1, 1), ToTimeStamp=datetime(2015, 1, 1), PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) **Response Syntax** :: { 'Events': [ { 'Device': { 'Attributes': {}, 'DeviceId': 'string', 'Type': 'string' }, 'StdEvent': 'string' }, ], } **Response Structure** - *(dict) --* 200 response - **Events** *(list) --* An array of zero or more elements describing the event(s) associated with the device. - *(dict) --* - **Device** *(dict) --* An object representing the device associated with the event. - **Attributes** *(dict) --* The user specified attributes associated with the device for an event. - **DeviceId** *(string) --* The unique identifier of the device. - **Type** *(string) --* The device type, such as "button". - **StdEvent** *(string) --* A serialized JSON object representing the device-type specific event. :type DeviceId: string :param DeviceId: **[REQUIRED]** The unique identifier of the device. :type FromTimeStamp: datetime :param FromTimeStamp: **[REQUIRED]** The start date for the device event query, in ISO8061 format. For example, 2018-03-28T15:45:12.880Z :type ToTimeStamp: datetime :param ToTimeStamp: **[REQUIRED]** The end date for the device event query, in ISO8061 format. For example, 2018-03-28T15:45:12.880Z :type PaginationConfig: dict :param PaginationConfig: A dictionary that provides parameters to control pagination. - **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a ``NextToken`` will be provided in the output that you can use to resume pagination. - **PageSize** *(integer) --* The size of each page. - **StartingToken** *(string) --* A token to specify where to start paginating. This is the ``NextToken`` from a previous response. :rtype: dict :returns: """ pass class ListDevices(Paginator): def paginate(self, DeviceType: str = None, PaginationConfig: Dict = None) -> Dict: """ Creates an iterator that will paginate through responses from :py:meth:`IoT1ClickDevicesService.Client.list_devices`. See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/devices-2018-05-14/ListDevices>`_ **Request Syntax** :: response_iterator = paginator.paginate( DeviceType='string', PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) **Response Syntax** :: { 'Devices': [ { 'Arn': 'string', 'Attributes': { 'string': 'string' }, 'DeviceId': 'string', 'Enabled': True|False, 'RemainingLife': 123.0, 'Type': 'string', 'Tags': { 'string': 'string' } }, ], } **Response Structure** - *(dict) --* 200 response - **Devices** *(list) --* A list of devices. - *(dict) --* - **Arn** *(string) --* The ARN of the device. - **Attributes** *(dict) --* An array of zero or more elements of DeviceAttribute objects providing user specified device attributes. - *(string) --* - *(string) --* - **DeviceId** *(string) --* The unique identifier of the device. - **Enabled** *(boolean) --* A Boolean value indicating whether or not the device is enabled. - **RemainingLife** *(float) --* A value between 0 and 1 inclusive, representing the fraction of life remaining for the device. - **Type** *(string) --* The type of the device, such as "button". - **Tags** *(dict) --* The tags currently associated with the AWS IoT 1-Click device. - *(string) --* - *(string) --* :type DeviceType: string :param DeviceType: The type of the device, such as \"button\". :type PaginationConfig: dict :param PaginationConfig: A dictionary that provides parameters to control pagination. - **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a ``NextToken`` will be provided in the output that you can use to resume pagination. - **PageSize** *(integer) --* The size of each page. - **StartingToken** *(string) --* A token to specify where to start paginating. This is the ``NextToken`` from a previous response. :rtype: dict :returns: """ pass
// eslint-disable-next-line @typescript-eslint/no-var-requires const path = require('path') // If your port is set to 80, // use administrator privileges to execute the command line. // For example, on Mac: sudo npm run / sudo yarn const devServerPort = 9527 // TODO: get this variable from setting.ts const mockServerPort = 9528 // TODO: get this variable from setting.ts const name = '邻药优选后台' // TODO: get this variable from setting.ts module.exports = { publicPath: process.env.NODE_ENV === 'production' ? '/vue-typescript-admin-template/' : '/', lintOnSave: process.env.NODE_ENV === 'development', productionSourceMap: false, devServer: { port: devServerPort, open: true, overlay: { warnings: false, errors: true }, progress: false, proxy: { // change xxx-api/login => /mock-api/v1/login // detail: https://cli.vuejs.org/config/#devserver-proxy '/we-shop-mgmt': { target: 'http://test.ysbang.cn/', changeOrigin: true // needed for virtual hosted sites // ws: true // proxy websockets // pathRewrite: { // ['^' + process.env.VUE_APP_BASE_API]: '' // } } } }, configureWebpack: { // provide the app's title in webpack's name field, so that // it can be accessed in index.html to inject the correct title. name: name }, pwa: { name: name, workboxPluginMode: 'InjectManifest', workboxOptions: { swSrc: path.resolve(__dirname, 'src/pwa/service-worker.js') } }, pluginOptions: { 'style-resources-loader': { preProcessor: 'scss', patterns: [ path.resolve(__dirname, 'src/styles/_variables.scss'), path.resolve(__dirname, 'src/styles/_mixins.scss') ] } }, chainWebpack(config) { // provide the app's title in html-webpack-plugin's options list so that // it can be accessed in index.html to inject the correct title. // https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-plugin config.plugin('html').tap(args => { args[0].title = name return args }) // it can improve the speed of the first screen, it is recommended to turn on preload config.plugin('preload').tap(() => [ { rel: 'preload', // to ignore runtime.js // https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171 fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/], include: 'initial' } ]) // when there are many pages, it will cause too many meaningless requests config.plugins.delete('prefetch') // https://webpack.js.org/configuration/devtool/#development // Change development env source map if you want. // The default in vue-cli is 'eval-cheap-module-source-map'. // config // .when(process.env.NODE_ENV === 'development', // config => config.devtool('eval-cheap-source-map') // ) config .when(process.env.NODE_ENV !== 'development', config => { config .optimization.splitChunks({ chunks: 'all', cacheGroups: { libs: { name: 'chunk-libs', test: /[\\/]node_modules[\\/]/, priority: 10, chunks: 'initial' // only package third parties that are initially dependent }, elementUI: { name: 'chunk-elementUI', // split elementUI into a single package priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm }, commons: { name: 'chunk-commons', test: path.resolve(__dirname, 'src/components'), minChunks: 3, // minimum common number priority: 5, reuseExistingChunk: true } } }) // https://webpack.js.org/configuration/optimization/#optimizationruntimechunk config.optimization.runtimeChunk('single') } ) } }
# -*- coding: utf-8 -*- """@package Methods.Machine.SlotW21.comp_surface SlotW21 Computation of surface method @date Created on Mon Dec 08 17:34:45 2014 @copyright (C) 2014-2015 EOMYS ENGINEERING. @author pierre_b """ from numpy import sin, tan def comp_surface(self): """Compute the Slot total surface (by analytical computation). Caution, the bottom of the Slot is an Arc Parameters ---------- self : SlotW21 A SlotW21 object Returns ------- S: float Slot total surface [m**2] """ Rbo = self.get_Rbo() if self.H1_is_rad: # H1 in rad H1 = (self.W1 - self.W0) / 2.0 * tan(self.H1) # H1 in m else: # H1 in m H1 = self.H1 S2 = 0.5 * (self.W0 + self.W1) * H1 S1 = self.H0 * self.W0 Swind = self.comp_surface_wind() # The bottom is an arc alpha = self.comp_angle_opening() Sarc = (Rbo ** 2.0) / 2.0 * (alpha - sin(alpha)) # Because Slamination = S - Zs * Sslot if self.is_outwards(): return S1 + S2 + Swind - Sarc else: return S1 + S2 + Swind + Sarc
import { _ as __vue_normalize__, r as registerComponent, u as use } from './chunk-cca88db8.js'; import { T as Tag } from './chunk-3c2169d7.js'; export { T as BTag } from './chunk-3c2169d7.js'; // // // // // // var script = { name: 'BTaglist', props: { attached: Boolean } }; /* script */ const __vue_script__ = script; /* template */ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"tags",class:{ 'has-addons': _vm.attached }},[_vm._t("default")],2)}; var __vue_staticRenderFns__ = []; /* style */ const __vue_inject_styles__ = undefined; /* scoped */ const __vue_scope_id__ = undefined; /* module identifier */ const __vue_module_identifier__ = undefined; /* functional template */ const __vue_is_functional_template__ = false; /* style inject */ /* style inject SSR */ var Taglist = __vue_normalize__( { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined ); var Plugin = { install: function install(Vue) { registerComponent(Vue, Tag); registerComponent(Vue, Taglist); } }; use(Plugin); export default Plugin; export { Taglist as BTaglist };
// // File: rtGetInf.h // // Code generated for Simulink model 'est_estimator'. // // Model version : 1.1142 // Simulink Coder version : 8.11 (R2016b) 25-Aug-2016 // C/C++ source code generated on : Mon Dec 4 08:33:06 2017 // #ifndef RTW_HEADER_rtGetInf_h_ #define RTW_HEADER_rtGetInf_h_ #include <stddef.h> #include "rtwtypes.h" #include "rt_nonfinite.h" #ifdef __cplusplus extern "C" { #endif extern real_T rtGetInf(void); extern real32_T rtGetInfF(void); extern real_T rtGetMinusInf(void); extern real32_T rtGetMinusInfF(void); #ifdef __cplusplus } // extern "C" #endif #endif // RTW_HEADER_rtGetInf_h_ // // File trailer for generated code. // // [EOF] //
/* Copyright (c) 2001, Stanford University * All rights reserved * * See the file LICENSE.txt for information on redistributing this software. */ #include "cr_error.h" #include "cr_mem.h" #include "cr_string.h" #include "packspu.h" #include "packspu_proto.h" static void packspu_GetHostBufferSubDataARB( GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data ) { GET_THREAD(thread); int writeback = 1; crPackGetBufferSubDataARB(target, offset, size, data, &writeback); packspuFlush((void *) thread); CRPACKSPU_WRITEBACK_WAIT(thread, writeback); } void * PACKSPU_APIENTRY packspu_MapBufferARB( GLenum target, GLenum access ) { GET_CONTEXT(ctx); void *buffer; CRBufferObject *pBufObj; CRASSERT(GL_TRUE == ctx->clientState->bufferobject.retainBufferData); buffer = crStateMapBufferARB(target, access); #ifdef CR_ARB_pixel_buffer_object if (buffer) { pBufObj = crStateGetBoundBufferObject(target, &ctx->clientState->bufferobject); CRASSERT(pBufObj); if (pBufObj->bResyncOnRead && access != GL_WRITE_ONLY_ARB) { /*fetch data from host side*/ packspu_GetHostBufferSubDataARB(target, 0, pBufObj->size, buffer); } } #endif return buffer; } void PACKSPU_APIENTRY packspu_GetBufferSubDataARB( GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data ) { GET_CONTEXT(ctx); #ifdef CR_ARB_pixel_buffer_object CRBufferObject *pBufObj; pBufObj = crStateGetBoundBufferObject(target, &ctx->clientState->bufferobject); if (pBufObj && pBufObj->bResyncOnRead) { packspu_GetHostBufferSubDataARB(target, offset, size, data); return; } #endif crStateGetBufferSubDataARB(target, offset, size, data); } GLboolean PACKSPU_APIENTRY packspu_UnmapBufferARB( GLenum target ) { GET_CONTEXT(ctx); #if CR_ARB_vertex_buffer_object CRBufferObject *bufObj; bufObj = crStateGetBoundBufferObject(target, &ctx->clientState->bufferobject); /* send new buffer contents to server */ crPackBufferDataARB( target, bufObj->size, bufObj->pointer, bufObj->usage ); #endif CRASSERT(GL_TRUE == ctx->clientState->bufferobject.retainBufferData); crStateUnmapBufferARB( target ); return GL_TRUE; } void PACKSPU_APIENTRY packspu_BufferDataARB(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage) { /*crDebug("packspu_BufferDataARB size:%d", size);*/ crStateBufferDataARB(target, size, data, usage); crPackBufferDataARB(target, size, data, usage); } void PACKSPU_APIENTRY packspu_BufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data) { /*crDebug("packspu_BufferSubDataARB size:%d", size);*/ crStateBufferSubDataARB(target, offset, size, data); crPackBufferSubDataARB(target, offset, size, data); } void PACKSPU_APIENTRY packspu_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params) { crStateGetBufferPointervARB( target, pname, params ); } void PACKSPU_APIENTRY packspu_GetBufferParameterivARB( GLenum target, GLenum pname, GLint * params ) { crStateGetBufferParameterivARB( target, pname, params ); } /* * Need to update our local state for vertex arrays. */ void PACKSPU_APIENTRY packspu_BindBufferARB( GLenum target, GLuint buffer ) { crStateBindBufferARB(target, buffer); crPackBindBufferARB(target, buffer); } void PACKSPU_APIENTRY packspu_GenBuffersARB( GLsizei n, GLuint * buffer ) { GET_THREAD(thread); int writeback = 1; if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network)) { crError( "packspu_GenBuffersARB doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" ); } if (pack_spu.swap) { crPackGenBuffersARBSWAP( n, buffer, &writeback ); } else { crPackGenBuffersARB( n, buffer, &writeback ); } packspuFlush( (void *) thread ); CRPACKSPU_WRITEBACK_WAIT(thread, writeback); crStateRegBuffers(n, buffer); } void PACKSPU_APIENTRY packspu_DeleteBuffersARB( GLsizei n, const GLuint * buffer ) { crStateDeleteBuffersARB( n, buffer ); crPackDeleteBuffersARB(n, buffer); }
import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import axios from 'axios'; class Register extends Component { constructor(props){ super(props); this.state ={ username: "", password: "" } } //handleChange handleChange = (e) => { this.setState({[e.target.name]: e.target.value}) } //handleClick handleClick = (e) => { axios.post("http://localhost:25851/auth/register", this.state) .then(response => { localStorage.setItem("jwt", response.data.token); this.props.history.push("/notes"); }) } render() { console.log(this.state); return ( <div className="main-form-container"> <div className="form-wrapper"> <h1>New User? Register Here</h1> <div className="input-wrapper"> <label className="label">Username:</label> <input onChange={this.handleChange} name="username" type="text" value={this.state.username}/> </div> <div className="input-wrapper"> <label className="label">Password:</label> <input onChange={this.handleChange} name="password" type="password" value={this.state.password}/> </div> <div className="button login-button"onClick={this.handleClick}>Register</div> <Link to="/login"><div className="register-here">Already Have An Account? Login Here!</div></Link> </div> </div> ); } } export default Register;
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String Base = declarative_base() class SeatReservation(Base): __tablename__ = "seat_reservation" __table_args__ = {"sqlite_autoincrement": True} id = Column(Integer, primary_key=True) trainid = Column(String) seatid = Column(Integer) startstation = Column(String) endstation = Column(String) def __repr__(self): return "<SeatReservation(trainid='{}', seatid='{}', startstation={}, endstation={})>".format( self.trainid, self.seatid, self.startstation, self.endstation )
define(['angular'], function(angular) { var hello = angular.module('home', []); });
import React from 'react' import { Provider } from 'react-redux' import { render } from 'react-dom' import { configureStore } from 'redux-starter-kit' import App from './components/App' import rootReducer from './ducks' import * as serviceWorker from './serviceWorker' import './styles.scss' const store = configureStore({ reducer: rootReducer }) render( <Provider store={store}> <App /> </Provider>, document.getElementById('root') ) // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: https://bit.ly/CRA-PWA serviceWorker.unregister()
# flake8: noqa # import all models into this package # if you have many models here with many references from one model to another this may # raise a RecursionError # to avoid this, import only the models that you directly need like: # from from fds.sdk.ProcuretoPayProvisioning.model.pet import Pet # or import this package, but before doing it, use: # import sys # sys.setrecursionlimit(n) from fds.sdk.ProcuretoPayProvisioning.model.cancel_individual import CancelIndividual from fds.sdk.ProcuretoPayProvisioning.model.create_individual import CreateIndividual from fds.sdk.ProcuretoPayProvisioning.model.get_individual import GetIndividual from fds.sdk.ProcuretoPayProvisioning.model.inline_response202 import InlineResponse202 from fds.sdk.ProcuretoPayProvisioning.model.list_individuals import ListIndividuals from fds.sdk.ProcuretoPayProvisioning.model.manage_product_ids import ManageProductIds from fds.sdk.ProcuretoPayProvisioning.model.modify_individual import ModifyIndividual from fds.sdk.ProcuretoPayProvisioning.model.transaction_status import TransactionStatus
# -*- coding: utf-8 -*- # # This file is part of the pyFDA project hosted at https://github.com/chipmuenk/pyfda # # Copyright © pyFDA Project Contributors # Licensed under the terms of the MIT License # (see file LICENSE in root directory for details) """ Widget for plotting \|H(z)\| in 3D """ import logging logger = logging.getLogger(__name__) from ..compat import (QCheckBox, QWidget, QComboBox, QLabel, QLineEdit, QDial, QGridLayout, QFrame, pyqtSlot, pyqtSignal) import numpy as np from numpy import pi, ones, sin, cos, log10 import scipy.signal as sig import pyfda.filterbroker as fb from pyfda.pyfda_rc import params from pyfda.pyfda_lib import H_mag, mod_version, safe_eval from pyfda.pyfda_qt_lib import qget_cmb_box from pyfda.plot_widgets.mpl_widget import MplWidget from mpl_toolkits import mplot3d # import to register 3D projection from matplotlib import cm # Colormap from matplotlib.colors import LightSource classes = {'Plot_3D':'3D'} #: Dict containing class name : display name #http://docs.enthought.com/mayavi/mayavi/mlab_running_scripts.html#running-mlab-scripts #http://docs.enthought.com/mayavi/mayavi/auto/mlab_helper_functions.html #http://docs.enthought.com/mayavi/mayavi/mlab.html#simple-scripting-with-mlab if mod_version('mayavi'): from mayavi import mlab MLAB = True else: MLAB = False if mod_version('vispy'): from vispy import plot #(?) HAS_VISPY = True else: HAS_VISPY = False class Plot_3D(QWidget): """ Class for various 3D-plots: - lin / log line plot of H(f) - lin / log surf plot of H(z) - optional display of poles / zeros """ # incoming, connected in sender widget (locally connected to self.process_signals() ) sig_rx = pyqtSignal(object) # sig_tx = pyqtSignal(object) # outgoing from process_signals def __init__(self, parent): super(Plot_3D, self).__init__(parent) self.zmin = 0 self.zmax = 4 self.zmin_dB = -80 self.cmap_default = 'RdYlBu_r' self.data_changed = True # flag whether data has changed self.size_changed = True # flag whether widget has been resized self.tool_tip = "3D magnitude response |H(z)|" self.tab_label = "3D" self._construct_UI() #------------------------------------------------------------------------------ def process_signals(self, dict_sig=None): """ Process signals coming from the navigation toolbar and from ``sig_rx`` """ logger.debug("Processing {0} | data_changed = {1}, visible = {2}"\ .format(dict_sig, self.data_changed, self.isVisible())) if self.isVisible(): if 'data_changed' in dict_sig or 'home' in dict_sig or self.data_changed: self.draw() self.data_changed = False self.size_changed = False elif 'ui_changed' in dict_sig and dict_sig['ui_changed'] == 'resized'\ or self.size_changed: self.redraw() self.size_changed = False else: if 'data_changed' in dict_sig: self.data_changed = True if 'ui_changed' in dict_sig and dict_sig['ui_changed'] == 'resized': self.size_changed = True #------------------------------------------------------------------------------ def _construct_UI(self): self.chkLog = QCheckBox("Log.", self) self.chkLog.setObjectName("chkLog") self.chkLog.setToolTip("Logarithmic scale") self.chkLog.setChecked(False) self.chkPolar = QCheckBox("Polar", self) self.chkPolar.setObjectName("chkPolar") self.chkPolar.setToolTip("Polar coordinate range") self.chkPolar.setChecked(False) self.lblBottom = QLabel("Bottom:", self) self.ledBottom = QLineEdit(self) self.ledBottom.setObjectName("ledBottom") self.ledBottom.setText(str(self.zmin)) self.ledBottom.setToolTip("Minimum display value.") self.lblBottomdB = QLabel("dB", self) self.lblBottomdB.setVisible(self.chkLog.isChecked()) self.lblTop = QLabel("Top:", self) self.ledTop = QLineEdit(self) self.ledTop.setObjectName("ledTop") self.ledTop.setText(str(self.zmax)) self.ledTop.setToolTip("Maximum display value.") self.lblTopdB = QLabel("dB", self) self.lblTopdB.setVisible(self.chkLog.isChecked()) self.chkUC = QCheckBox("UC", self) self.chkUC.setObjectName("chkUC") self.chkUC.setToolTip("Plot unit circle") self.chkUC.setChecked(True) self.chkPZ = QCheckBox("P/Z", self) self.chkPZ.setObjectName("chkPZ") self.chkPZ.setToolTip("Plot poles and zeros") self.chkPZ.setChecked(True) self.chkHf = QCheckBox("H(f)", self) self.chkHf.setObjectName("chkHf") self.chkHf.setToolTip("Plot H(f) along the unit circle") self.chkHf.setChecked(True) modes = ['None', 'Mesh', 'Surf', 'Contour'] self.cmbMode3D = QComboBox(self) self.cmbMode3D.addItems(modes) self.cmbMode3D.setObjectName("cmbShow3D") self.cmbMode3D.setToolTip("Select 3D-plot mode.") self.cmbMode3D.setCurrentIndex(0) self.cmbMode3D.setSizeAdjustPolicy(QComboBox.AdjustToContents) self.chkColormap_r = QCheckBox("reverse", self) self.chkColormap_r.setToolTip("reverse colormap") self.chkColormap_r.setChecked(True) self.cmbColormap = QComboBox(self) self._init_cmb_colormap() self.cmbColormap.setToolTip("Select colormap") self.chkColBar = QCheckBox("Colorbar", self) self.chkColBar.setObjectName("chkColBar") self.chkColBar.setToolTip("Show colorbar") self.chkColBar.setChecked(False) self.chkLighting = QCheckBox("Lighting", self) self.chkLighting.setObjectName("chkLighting") self.chkLighting.setToolTip("Enable light source") self.chkLighting.setChecked(False) self.lblAlpha = QLabel("Alpha", self) self.diaAlpha = QDial(self) self.diaAlpha.setRange(0., 10.) self.diaAlpha.setValue(10) self.diaAlpha.setTracking(False) # produce less events when turning self.diaAlpha.setFixedHeight(30) self.diaAlpha.setFixedWidth(30) self.diaAlpha.setWrapping(False) self.diaAlpha.setToolTip("<span>Set transparency for surf and contour plots.</span>") self.lblHatch = QLabel("Stride", self) self.diaHatch = QDial(self) self.diaHatch.setRange(0., 9.) self.diaHatch.setValue(5) self.diaHatch.setTracking(False) # produce less events when turning self.diaHatch.setFixedHeight(30) self.diaHatch.setFixedWidth(30) self.diaHatch.setWrapping(False) self.diaHatch.setToolTip("Set line density for various plots.") self.chkContour2D = QCheckBox("Contour2D", self) self.chkContour2D.setObjectName("chkContour2D") self.chkContour2D.setToolTip("Plot 2D-contours at z =0") self.chkContour2D.setChecked(False) #---------------------------------------------------------------------- # LAYOUT for UI widgets #---------------------------------------------------------------------- layGControls = QGridLayout() layGControls.addWidget(self.chkLog, 0, 0) layGControls.addWidget(self.chkPolar, 1, 0) layGControls.addWidget(self.lblTop, 0, 2) layGControls.addWidget(self.ledTop, 0, 4) layGControls.addWidget(self.lblTopdB, 0, 5) layGControls.addWidget(self.lblBottom, 1, 2) layGControls.addWidget(self.ledBottom, 1, 4) layGControls.addWidget(self.lblBottomdB, 1, 5) layGControls.setColumnStretch(5,1) layGControls.addWidget(self.chkUC, 0, 6) layGControls.addWidget(self.chkHf, 1, 6) layGControls.addWidget(self.chkPZ, 0, 8) layGControls.addWidget(self.cmbMode3D, 0, 10) layGControls.addWidget(self.chkContour2D, 1, 10) layGControls.addWidget(self.cmbColormap, 0,12,1,1) layGControls.addWidget(self.chkColormap_r, 1,12) layGControls.addWidget(self.chkLighting, 0, 14) layGControls.addWidget(self.chkColBar, 1, 14) layGControls.addWidget(self.lblAlpha, 0, 15) layGControls.addWidget(self.diaAlpha, 0, 16) layGControls.addWidget(self.lblHatch, 1, 15) layGControls.addWidget(self.diaHatch, 1, 16) # This widget encompasses all control subwidgets self.frmControls = QFrame(self) self.frmControls.setObjectName("frmControls") self.frmControls.setLayout(layGControls) #---------------------------------------------------------------------- # mplwidget #---------------------------------------------------------------------- # This is the plot pane widget, encompassing the other widgets self.mplwidget = MplWidget(self) self.mplwidget.layVMainMpl.addWidget(self.frmControls) self.mplwidget.layVMainMpl.setContentsMargins(*params['wdg_margins']) self.setLayout(self.mplwidget.layVMainMpl) self._init_grid() # initialize grid and do initial plot #---------------------------------------------------------------------- # GLOBAL SIGNALS & SLOTs #---------------------------------------------------------------------- self.sig_rx.connect(self.process_signals) #---------------------------------------------------------------------- # LOCAL SIGNALS & SLOTs #---------------------------------------------------------------------- self.chkLog.clicked.connect(self._log_clicked) self.ledBottom.editingFinished.connect(self._log_clicked) self.ledTop.editingFinished.connect(self._log_clicked) self.chkPolar.clicked.connect(self._init_grid) self.chkUC.clicked.connect(self.draw) self.chkHf.clicked.connect(self.draw) self.chkPZ.clicked.connect(self.draw) self.cmbMode3D.currentIndexChanged.connect(self.draw) self.chkColBar.clicked.connect(self.draw) self.cmbColormap.currentIndexChanged.connect(self.draw) self.chkColormap_r.clicked.connect(self._init_cmb_colormap) self.chkLighting.clicked.connect(self.draw) self.diaAlpha.valueChanged.connect(self.draw) self.diaHatch.valueChanged.connect(self.draw) self.chkContour2D.clicked.connect(self.draw) self.mplwidget.mplToolbar.sig_tx.connect(self.process_signals) #self.mplwidget.mplToolbar.enable_plot(state = False) # disable initially #------------------------------------------------------------------------------ def _init_cmb_colormap(self): """ (Re-)Load combobox with available colormaps""" if self.chkColormap_r.isChecked(): cmap_list = [m for m in cm.datad if m.endswith("_r")] else: cmap_list = [m for m in cm.datad if not m.endswith("_r")] # *_r colormaps reverse the color order cmap_list.sort() self.cmbColormap.blockSignals(True) # don't send signal "indexChanged" self.cmbColormap.clear() self.cmbColormap.addItems(cmap_list) self.cmbColormap.blockSignals(False) idx = self.cmbColormap.findText(self.cmap_default) if idx == -1: idx = 0 self.cmbColormap.setCurrentIndex(idx) #------------------------------------------------------------------------------ def _init_grid(self): """ Initialize (x,y,z) coordinate grid + (re)draw plot.""" phi_UC = np.linspace(0, 2*pi, 400, endpoint=True) # angles for unit circle self.xy_UC = np.exp(1j * phi_UC) # x,y coordinates of unity circle steps = 100 # number of steps for x, y, r, phi # self.xmin = -1.5; self.xmax = 1.5 # cartesian range limits self.ymin = -1.5; self.ymax = 1.5 rmin = 0; rmax = self.xmin # polar range limits # Calculate grids for 3D-Plots dr = rmax / steps * 2 # grid size for polar range dx = (self.xmax - self.xmin) / steps dy = (self.ymax - self.ymin) / steps # grid size cartesian range if self.chkPolar.isChecked(): # # Plot circular range in 3D-Plot [r, phi] = np.meshgrid(np.arange(rmin, rmax, dr), np.linspace(0, 2 * pi, steps, endpoint=True)) self.x = r * cos(phi) self.y = r * sin(phi) else: # cartesian grid [self.x, self.y] = np.meshgrid(np.arange(self.xmin, self.xmax, dx), np.arange(self.ymin, self.ymax, dy)) self.z = self.x + 1j*self.y # create coordinate grid for complex plane self.draw() # initial plot #------------------------------------------------------------------------------ def init_axes(self): """ Initialize and clear the axes to get rid of colorbar The azimuth / elevation / distance settings of the camera are restored after clearing the axes. See http://stackoverflow.com/questions/4575588/matplotlib-3d-plot-with-pyqt4-in-qtabwidget-mplwidget """ self._save_axes() self.mplwidget.fig.clf() # needed to get rid of colorbar self.ax3d = self.mplwidget.fig.add_subplot(111, projection='3d') #self.ax3d = self.mplwidget.fig.subplots(nrows=1, ncols=1, projection='3d') self._restore_axes() #------------------------------------------------------------------------------ def _save_axes(self): """ Store x/y/z - limits and camera position """ try: self.azim = self.ax3d.azim self.elev = self.ax3d.elev self.dist = self.ax3d.dist self.xlim = self.ax3d.get_xlim3d() self.ylim = self.ax3d.get_ylim3d() self.zlim = self.ax3d.get_zlim3d() except AttributeError: # not yet initialized, set standard values self.azim = -65 self.elev = 30 self.dist = 10 self.xlim = (self.xmin, self.xmax) self.ylim = (self.ymin, self.ymax) self.zlim = (self.zmin, self.zmax) #------------------------------------------------------------------------------ def _restore_axes(self): """ Restore x/y/z - limits and camera position """ if self.mplwidget.mplToolbar.a_lk.isChecked(): self.ax3d.set_xlim3d(self.xlim) self.ax3d.set_ylim3d(self.ylim) self.ax3d.set_zlim3d(self.zlim) self.ax3d.azim = self.azim self.ax3d.elev = self.elev self.ax3d.dist = self.dist #------------------------------------------------------------------------------ def _log_clicked(self): """ Change scale and settings to log / lin when log setting is changed Update min / max settings when lineEdits have been edited """ self.log = self.chkLog.isChecked() if self.sender().objectName() == 'chkLog': # clicking chkLog triggered the slot if self.log: self.ledBottom.setText(str(self.zmin_dB)) self.zmax_dB = np.round(20 * log10(self.zmax), 2) self.ledTop.setText(str(self.zmax_dB)) self.lblTopdB.setVisible(True) self.lblBottomdB.setVisible(True) else: self.ledBottom.setText(str(self.zmin)) self.zmax = np.round(10**(self.zmax_dB / 20), 2) self.ledTop.setText(str(self.zmax)) self.lblTopdB.setVisible(False) self.lblBottomdB.setVisible(False) else: # finishing a lineEdit field triggered the slot if self.log: self.zmin_dB = safe_eval(self.ledBottom.text(), self.zmin_dB, return_type='float') self.ledBottom.setText(str(self.zmin_dB)) self.zmax_dB = safe_eval(self.ledTop.text(), self.zmax_dB, return_type='float') self.ledTop.setText(str(self.zmax_dB)) else: self.zmin = safe_eval(self.ledBottom.text(), self.zmin, return_type='float') self.ledBottom.setText(str(self.zmin)) self.zmax = safe_eval(self.ledTop.text(), self.zmax, return_type='float') self.ledTop.setText(str(self.zmax)) self.draw() #------------------------------------------------------------------------------ def draw(self): """ Main drawing entry point: perform the actual plot """ self.draw_3d() #------------------------------------------------------------------------------ def draw_3d(self): """ Draw various 3D plots """ self.init_axes() bb = fb.fil[0]['ba'][0] aa = fb.fil[0]['ba'][1] zz = np.array(fb.fil[0]['zpk'][0]) pp = np.array(fb.fil[0]['zpk'][1]) wholeF = fb.fil[0]['freqSpecsRangeType'] != 'half' # not used f_S = fb.fil[0]['f_S'] N_FFT = params['N_FFT'] alpha = self.diaAlpha.value()/10. cmap = cm.get_cmap(str(self.cmbColormap.currentText())) # Number of Lines /step size for H(f) stride, mesh, contour3d: stride = 10 - self.diaHatch.value() NL = 3 * self.diaHatch.value() + 5 surf_enabled = qget_cmb_box(self.cmbMode3D, data=False) in {'Surf', 'Contour'} self.cmbColormap.setEnabled(surf_enabled) self.chkColormap_r.setEnabled(surf_enabled) self.chkLighting.setEnabled(surf_enabled) self.chkColBar.setEnabled(surf_enabled) self.diaAlpha.setEnabled(surf_enabled or self.chkContour2D.isChecked()) #cNorm = colors.Normalize(vmin=0, vmax=values[-1]) #scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=jet) #----------------------------------------------------------------------------- # Calculate H(w) along the upper half of unity circle #----------------------------------------------------------------------------- [w, H] = sig.freqz(bb, aa, worN=N_FFT, whole=True) H = np.nan_to_num(H) # replace nans and inf by finite numbers H_abs = abs(H) H_max = max(H_abs) H_min = min(H_abs) #f = w / (2 * pi) * f_S # translate w to absolute frequencies #F_min = f[np.argmin(H_abs)] plevel_rel = 1.05 # height of plotted pole position relative to zmax zlevel_rel = 0.1 # height of plotted zero position relative to zmax if self.chkLog.isChecked(): # logarithmic scale bottom = np.floor(max(self.zmin_dB, 20*log10(H_min)) / 10) * 10 top = self.zmax_dB top_bottom = top - bottom zlevel = bottom - top_bottom * zlevel_rel if self.cmbMode3D.currentText() == 'None': # "Poleposition" for H(f) plot only plevel_top = 2 * bottom - zlevel # height of displayed pole position plevel_btm = bottom else: plevel_top = top + top_bottom * (plevel_rel - 1) plevel_btm = top else: # linear scale bottom = max(self.zmin, H_min) # min. display value top = self.zmax # max. display value top_bottom = top - bottom # top = zmax_rel * H_max # calculate display top from max. of H(f) zlevel = bottom + top_bottom * zlevel_rel # height of displayed zero position if self.cmbMode3D.currentText() == 'None': # "Poleposition" for H(f) plot only #H_max = np.clip(max(H_abs), 0, self.zmax) # make height of displayed poles same to zeros plevel_top = bottom + top_bottom * zlevel_rel plevel_btm = bottom else: plevel_top = plevel_rel * top plevel_btm = top # calculate H(jw)| along the unity circle and |H(z)|, each clipped # between bottom and top H_UC = H_mag(bb, aa, self.xy_UC, top, H_min=bottom, log=self.chkLog.isChecked()) Hmag = H_mag(bb, aa, self.z, top, H_min=bottom, log=self.chkLog.isChecked()) #=============================================================== ## plot Unit Circle (UC) #=============================================================== if self.chkUC.isChecked(): # Plot unit circle and marker at (1,0): self.ax3d.plot(self.xy_UC.real, self.xy_UC.imag, ones(len(self.xy_UC)) * bottom, lw=2, color='k') self.ax3d.plot([0.97, 1.03], [0, 0], [bottom, bottom], lw=2, color='k') #=============================================================== ## plot ||H(f)| along unit circle as 3D-lineplot #=============================================================== if self.chkHf.isChecked(): self.ax3d.plot(self.xy_UC.real, self.xy_UC.imag, H_UC, alpha = 0.5) # draw once more as dashed white line to improve visibility self.ax3d.plot(self.xy_UC.real, self.xy_UC.imag, H_UC, 'w--') if stride < 10: # plot thin vertical line every stride points on the UC for k in range(len(self.xy_UC[::stride])): self.ax3d.plot([self.xy_UC.real[::stride][k], self.xy_UC.real[::stride][k]], [self.xy_UC.imag[::stride][k], self.xy_UC.imag[::stride][k]], [np.ones(len(self.xy_UC[::stride]))[k]*bottom, H_UC[::stride][k]], linewidth=1, color=(0.5, 0.5, 0.5)) #=============================================================== ## plot Poles and Zeros #=============================================================== if self.chkPZ.isChecked(): PN_SIZE = 8 # size of P/N symbols # Plot zero markers at |H(z_i)| = zlevel with "stems": self.ax3d.plot(zz.real, zz.imag, ones(len(zz)) * zlevel, 'o', markersize=PN_SIZE, markeredgecolor='blue', markeredgewidth=2.0, markerfacecolor='none') for k in range(len(zz)): # plot zero "stems" self.ax3d.plot([zz[k].real, zz[k].real], [zz[k].imag, zz[k].imag], [bottom, zlevel], linewidth=1, color='b') # Plot the poles at |H(z_p)| = plevel with "stems": self.ax3d.plot(np.real(pp), np.imag(pp), plevel_top, 'x', markersize=PN_SIZE, markeredgewidth=2.0, markeredgecolor='red') for k in range(len(pp)): # plot pole "stems" self.ax3d.plot([pp[k].real, pp[k].real], [pp[k].imag, pp[k].imag], [plevel_btm, plevel_top], linewidth=1, color='r') #=============================================================== ## 3D-Plots of |H(z)| clipped between |H(z)| = top #=============================================================== m_cb = cm.ScalarMappable(cmap=cmap) # normalized proxy object that is mappable m_cb.set_array(Hmag) # for colorbar #--------------------------------------------------------------- ## 3D-mesh plot #--------------------------------------------------------------- if self.cmbMode3D.currentText() == 'Mesh': # fig_mlab = mlab.figure(fgcolor=(0., 0., 0.), bgcolor=(1, 1, 1)) # self.ax3d.set_zlim(0,2) self.ax3d.plot_wireframe(self.x, self.y, Hmag, rstride=5, cstride=stride, linewidth=1, color='gray') #--------------------------------------------------------------- ## 3D-surface plot #--------------------------------------------------------------- # http://stackoverflow.com/questions/28232879/phong-shading-for-shiny-python-3d-surface-plots elif self.cmbMode3D.currentText() == 'Surf': if MLAB: ## Mayavi surf = mlab.surf(self.x, self.y, H_mag, colormap='RdYlBu', warp_scale='auto') # Change the visualization parameters. surf.actor.property.interpolation = 'phong' surf.actor.property.specular = 0.1 surf.actor.property.specular_power = 5 # s = mlab.contour_surf(self.x, self.y, Hmag, contour_z=0) mlab.show() else: if self.chkLighting.isChecked(): ls = LightSource(azdeg=0, altdeg=65) # Create light source object rgb = ls.shade(Hmag, cmap=cmap) # Shade data, creating an rgb array cmap_surf = None else: rgb = None cmap_surf = cmap # s = self.ax3d.plot_surface(self.x, self.y, Hmag, # alpha=OPT_3D_ALPHA, rstride=1, cstride=1, cmap=cmap, # linewidth=0, antialiased=False, shade=True, facecolors = rgb) # s.set_edgecolor('gray') s = self.ax3d.plot_surface(self.x, self.y, Hmag, alpha=alpha, rstride=1, cstride=1, linewidth=0, antialiased=False, facecolors=rgb, cmap=cmap_surf, shade=True) s.set_edgecolor(None) #--------------------------------------------------------------- ## 3D-Contour plot #--------------------------------------------------------------- elif self.cmbMode3D.currentText() == 'Contour': s = self.ax3d.contourf3D(self.x, self.y, Hmag, NL, alpha=alpha, cmap=cmap) #--------------------------------------------------------------- ## 2D-Contour plot # TODO: 2D contour plots do not plot correctly together with 3D plots in # current matplotlib 1.4.3 -> disable them for now # TODO: zdir = x / y delivers unexpected results -> rather plot max(H) # along the other axis? # TODO: colormap is created depending on the zdir = 'z' contour plot # -> set limits of (all) other plots manually? if self.chkContour2D.isChecked(): # self.ax3d.contourf(x, y, Hmag, 20, zdir='x', offset=xmin, # cmap=cmap, alpha = alpha)#, vmin = bottom)#, vmax = top, vmin = bottom) # self.ax3d.contourf(x, y, Hmag, 20, zdir='y', offset=ymax, # cmap=cmap, alpha = alpha)#, vmin = bottom)#, vmax = top, vmin = bottom) s = self.ax3d.contourf(self.x, self.y, Hmag, NL, zdir='z', offset=bottom - (top - bottom) * 0.05, cmap=cmap, alpha=alpha) # plot colorbar for suitable plot modes if self.chkColBar.isChecked() and (self.chkContour2D.isChecked() or str(self.cmbMode3D.currentText()) in {'Contour', 'Surf'}): self.colb = self.mplwidget.fig.colorbar(m_cb, ax=self.ax3d, shrink=0.8, aspect=20, pad=0.02, fraction=0.08) #---------------------------------------------------------------------- ## Set view limits and labels #---------------------------------------------------------------------- if not self.mplwidget.mplToolbar.a_lk.isChecked(): self.ax3d.set_xlim3d(self.xmin, self.xmax) self.ax3d.set_ylim3d(self.ymin, self.ymax) self.ax3d.set_zlim3d(bottom, top) else: self._restore_axes() self.ax3d.set_xlabel('Re')#(fb.fil[0]['plt_fLabel']) self.ax3d.set_ylabel('Im') #(r'$ \tau_g(\mathrm{e}^{\mathrm{j} \Omega}) / T_S \; \rightarrow $') # self.ax3d.set_zlabel(r'$|H(z)|\; \rightarrow $') self.ax3d.set_title(r'3D-Plot of $|H(\mathrm{e}^{\mathrm{j} \Omega})|$ and $|H(z)|$') self.redraw() #------------------------------------------------------------------------------ def redraw(self): """ Redraw the canvas when e.g. the canvas size has changed """ self.mplwidget.redraw() #------------------------------------------------------------------------------ def main(): import sys from ..compat import QApplication app = QApplication(sys.argv) mainw = Plot_3D(None) app.setActiveWindow(mainw) mainw.show() sys.exit(app.exec_()) if __name__ == "__main__": main() # module test using python -m pyfda.plot_widgets.plot_3d
(self.webpackChunkgeonode_mapstore_client=self.webpackChunkgeonode_mapstore_client||[]).push([[4495,5110,9534,6287],{90079:(e,t,n)=>{"use strict";n.d(t,{Z:()=>E});var r=n(72500),o=n.n(r),i=n(86494),a=n(27418),l=n.n(a),c=n(45697),s=n.n(c),u=n(24852),p=n.n(u),f=n(33044),d=n(5346);function y(e){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e,t){return!t||"object"!==y(t)&&"function"!=typeof t?v(e):t}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(s,e);var t,n,r,a,c=(r=s,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=w(r);if(a){var n=w(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return g(this,e)});function s(){var e;m(this,s);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return O(v(e=c.call.apply(c,[this].concat(n))),"state",{error:!1}),O(v(e),"onImgError",(function(){e.setState((function(){return{error:!0}}))})),O(v(e),"getUrl",(function(e,t){if(e.layer&&"wms"===e.layer.type&&e.layer.url){var n=e.layer,r=t||(0,i.isArray)(n.url)&&Math.floor(Math.random()*n.url.length),a=(0,i.isArray)(n.url)?n.url[r]:n.url.replace(/[?].*$/g,""),c=o().parse(a),s=(0,f.clearNilValuesForParams)(n.params),u=l()({},{service:"WMS",request:"GetLegendGraphic",format:"image/png",height:e.legendHeight,width:e.legendWidth,layer:n.name,style:n.style||null,version:n.version||"1.3.0",SLD_VERSION:"1.1.0",LEGEND_OPTIONS:e.legendOptions},n.legendParams||{},e.language&&n.localizedLayerStyles?{LANGUAGE:e.language}:{},(0,f.addAuthenticationToSLD)(s||{},e.layer),s&&s.SLD_BODY?{SLD_BODY:s.SLD_BODY}:{},e.scales&&e.currentZoomLvl&&e.scaleDependent?{SCALE:Math.round(e.scales[e.currentZoomLvl])}:{});return(0,f.addAuthenticationParameter)(a,u),o().format({host:c.host,protocol:c.protocol,pathname:c.pathname,query:u})}return""})),O(v(e),"validateImg",(function(t){t.height<=1&&t.width<=2&&e.onImgError()})),e}return t=s,(n=[{key:"UNSAFE_componentWillReceiveProps",value:function(e){this.state.error&&this.getUrl(e,0)!==this.getUrl(this.props,0)&&this.setState((function(){return{error:!1}}))}},{key:"render",value:function(){var e=this;return!this.state.error&&this.props.layer&&"wms"===this.props.layer.type&&this.props.layer.url?p().createElement("img",{onError:this.onImgError,onLoad:function(t){return e.validateImg(t.target)},src:this.getUrl(this.props),style:this.props.style}):p().createElement(d.Z,{msgId:"layerProperties.legenderror"})}}])&&h(t.prototype,n),s}(p().Component);O(S,"propTypes",{layer:s().object,legendHeight:s().number,legendWidth:s().number,legendOptions:s().string,style:s().object,currentZoomLvl:s().number,scales:s().array,scaleDependent:s().bool,language:s().string}),O(S,"defaultProps",{legendHeight:12,legendWidth:12,legendOptions:"forceLabels:on",style:{maxWidth:"100%"},scaleDependent:!0});const E=S},99534:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(61365),o=n(56936);const i=(0,r.Z)(o.h_)},16919:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var r=n(24852),o=n.n(r),i=n(32833),a=n(65539),l=n(67076),c=n(30294),s=n(38560),u={bottom:{true:"chevron-down",false:"chevron-up"},top:{true:"chevron-up",false:"chevron-down"},right:{true:"chevron-right",false:"chevron-left"},left:{true:"chevron-left",false:"chevron-right"}};const p=function(e){var t=e.position,n=void 0===t?"right":t,r=e.onClose,i=e.bsStyle,a=void 0===i?"default":i,l=e.title,p=void 0===l?"":l,f=e.fullscreen,d=void 0!==f&&f,y=e.showFullscreen,m=void 0!==y&&y,h=e.glyph,b=void 0===h?"info-sign":h,g=e.additionalRows,v=e.onFullscreen,w=void 0===v?function(){}:v,O=r?o().createElement(s.Z,{key:"ms-header-close",className:"square-button ms-close",onClick:r,bsStyle:a},o().createElement(c.Glyphicon,{glyph:"1-close"})):null,S=m?o().createElement(s.Z,{key:"ms-header-glyph",className:"square-button",bsStyle:a,onClick:function(){return w(!d)}},o().createElement(c.Glyphicon,{glyph:u[n]&&u[n][d]||"resize-full"})):o().createElement("div",{key:"ms-header-glyph",className:"square-button ".concat("bg-"+a),style:{display:"flex"}},o().createElement(c.Glyphicon,{glyph:b,className:"".concat("default"===a?"text-primary":"")})),E="left"===n?[O,S]:[S,O];return o().createElement(c.Grid,{fluid:!0,style:{width:"100%"},className:"ms-header ms-"+a},o().createElement(c.Row,null,o().createElement(c.Col,{xs:2},E[0]),o().createElement(c.Col,{xs:8},o().createElement("h4",null,p)),o().createElement(c.Col,{xs:2},E[1])),g)},f=(0,l.withState)("fullscreen","onFullscreen",!1)((function(e){var t=e.fluid,n=e.className,r=void 0===n?"":n,l=e.fullscreen,c=void 0!==l&&l,s=e.position,u=e.open,f=e.size,d=void 0===f?550:f,y=e.style,m=void 0===y?{}:y,h=e.zIndex,b=void 0===h?1030:h,g=e.onClose,v=e.bsStyle,w=e.title,O=e.showFullscreen,S=void 0!==O&&O,E=e.glyph,P=e.header,j=e.footer,x=e.children,C=e.onFullscreen,A=void 0===C?function(){}:C,N=e.fixed,k=void 0!==N&&N,T=e.resizable,I=void 0!==T&&T,R=e.hideHeader;return o().createElement("div",{className:"ms-side-panel "+(k?"":"ms-absolute-dock ")+(I?"":"react-dock-no-resize ")+r},o().createElement(i.default,{fluid:t||c,position:s,dimMode:"none",isVisible:u,size:c?1:d,dockStyle:m,zIndex:b},o().createElement(a.Z,{header:!R&&u&&o().createElement(p,{position:s,onClose:g,bsStyle:v,title:w,fullscreen:c,showFullscreen:S,glyph:E,additionalRows:P,onFullscreen:A}),footer:u&&j},u&&x)))}))},32107:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(24852),o=n.n(r),i=n(67076),a=n(65539),l=n(16919),c=n(94745);var s=(0,i.renameProps)({open:"show"})((function(e){var t=e.children,n=e.header,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,["children","header"]);return o().createElement(c.Z,r,o().createElement(a.Z,{header:o().createElement("div",{className:"ms-header"},n)},t))}));const u=(0,i.branch)((function(e){return!e.dock}),(function(){return function(e){return o().createElement(s,e)}}))(l.Z)},25382:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(49977),o=n.n(r),i=n(86850),a=n(24262);const l=function(e){return e.distinctUntilChanged((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.layer,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.layer;return(0,a.getSearchUrl)(t)===(0,a.getSearchUrl)(r)&&t.loadingError===r.loadingError})).switchMap((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.layer;return(0,i.v$)({layer:t}).map((function(e){return{describeFeatureType:e.data,loading:!1,error:void 0}})).catch((function(e){return o().Observable.of({loading:!1,error:e})}))}))}},98678:(e,t,n)=>{"use strict";var r=n(28878);(0,(n(49977),n(67076)).setObservableConfig)(r.Z)},86850:(e,t,n)=>{"use strict";n.d(t,{Mc:()=>T,v$:()=>I,ED:()=>R});var r=n(72500),o=n.n(r),i=n(86494),a=n(49977),l=n.n(a),c=n(5055),s=n(7526),u=n(75875),p=n.n(u),f=n(47805),d=n(24262),y=n(10284),m=n(39156);function h(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=n.n(m)()({wfsVersion:"1.1.0"}),P=E.getFeature,j=E.query,x=E.sortBy,C=E.propertyName,A=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.totalFeatures,n=e.features,r=v(e,["totalFeatures","features"]),o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.startIndex,a=arguments.length>2?arguments[2]:void 0;return a>t&&a===i+n.length&&t===n.length?O(O({},r),{},{features:n,totalFeatures:a}):O(O({},r),{},{features:n,totalFeatures:t})},N=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.pagination||!(0,i.isNil)(t.startIndex)&&!(0,i.isNil)(t.maxFeatures)&&{startIndex:t.startIndex,maxFeatures:t.maxFeatures}},k=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(0,f.getWFSFilterData)(t,n),a=o().parse(e,!0),c=(0,i.isObject)(a.query)?a.query:{};c.service="WFS",c.outputFormat="json";var s=o().format({protocol:a.protocol,host:a.host,pathname:a.pathname,query:c});return l().Observable.defer((function(){return p().post(s,r,{timeout:6e4,headers:{Accept:"application/json","Content-Type":"application/json"}})})).let(y.oB).map((function(e){return A(e.data,N(t,n),n.totalFeatures)}))},T=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.search,n=void 0===t?{}:t,r=e.url,o=e.name,a=arguments.length>1?arguments[1]:void 0,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=l.sortOptions,s=l.propertyName,u=v(l,["sortOptions","propertyName"]);return k(n.url||r,a&&"object"===g(a)?O(O({},a),{},{typeName:o||a.typeName}):P(j(o,[].concat(h(c?[x(c.sortBy,c.sortOrder)]:[]),h(s?[C(s)]:[]),h(a?(0,i.castArray)(a):[]))),u),u).catch((function(e){if("OGCError"===e.name&&"NoApplicableCode"===e.code&&!c&&s&&s[0])return k(n.url||r,a&&"object"===g(a)?O(O({},a),{},{typeName:o||a.typeName}):P(j(o,[x(s[0])].concat(h(s?[C(s)]:[]),h(a?(0,i.castArray)(a):[]))),u),u);throw e}))},I=function(e){var t=e.layer;return l().Observable.defer((function(){return p().get(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.name,n=e.search,r=void 0===n?{}:n,i=e.url,a=e.describeFeatureTypeURL,l=o().parse(a||r.url||i,!0);return o().format(O(O({},l),{},{search:void 0,query:O(O({},l.query),{},{service:"WFS",version:"1.1.0",typeName:t,outputFormat:"application/json",request:"DescribeFeatureType"})}))}(t))})).let(y.oB)},R=function(e){var t=e.layer;return l().Observable.defer((function(){return p().get(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.name,n=e.search,r=void 0===n?{}:n,i=e.url,a=(0,d.getCapabilitiesUrl)({name:t,url:r&&r.url||i}),l=o().parse(a,!0);return o().format(O(O({},l),{},{search:void 0,query:O(O({},l.query),{},{service:"WFS",version:"1.1.1",request:"GetCapabilities"})}))}(t))})).let(y.oB).switchMap((function(e){return l().Observable.bindNodeCallback((function(e,t){return(0,c.parseString)(e,{tagNameProcessors:[s.stripPrefix],explicitArray:!1,mergeAttrs:!0},t)}))(e.data)}))}},7122:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>ur});var r=n(45697),o=n.n(r),i=n(71703),a=n(67076),l=n(22222),c=n(82904),s=n(90825),u=n(80416),p=n(96909),f=n(87427),d=n(24852),y=n.n(d),m=n(30294),h=n(32107),b=n(80717),g=n(15135),v=n(94745),w=n(99534),O=n(86494),S=n(5346);function E(){return(E=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function P(e){return function(e){if(Array.isArray(e))return j(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return j(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?j(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var x=(0,g.Z)(m.NavItem),C=function(e){var t=e.className,n=void 0===t?"":t,r=e.activeTab,o=void 0===r?"general":r,i=e.currentLocale,a=void 0===i?"en-US":i,l=e.currentLocaleLanguage,c=void 0===l?"en":l,s=e.width,u=void 0===s?500:s,p=e.groups,f=void 0===p?[]:p,d=e.element,g=void 0===d?{}:d,j=e.settings,C=void 0===j?{}:j,A=e.onSave,N=void 0===A?function(){}:A,k=e.onClose,T=void 0===k?function(){}:k,I=e.onHideSettings,R=void 0===I?function(){}:I,M=e.onSetTab,D=void 0===M?function(){}:M,L=e.onUpdateParams,F=void 0===L?function(){}:L,U=e.onRetrieveLayerData,B=void 0===U?function(){}:U,_=e.onShowAlertModal,z=void 0===_?function(){}:_,q=e.realtimeUpdate,Z=void 0===q||q,H=e.alertModal,G=void 0!==H&&H,W=e.dockStyle,V=void 0===W?{}:W,Y=e.dock,Q=void 0===Y||Y,K=e.showFullscreen,X=e.draggable,J=e.position,$=void 0===J?"left":J,ee=e.tabs,te=void 0===ee?[]:ee,ne=e.tabsConfig,re=void 0===ne?{}:ne,oe=e.isLocalizedLayerStylesEnabled,ie=void 0!==oe&&oe,ae=(0,O.head)(te.filter((function(e){return e.id===o&&e.toolbarComponent})).map((function(e){return e.toolbarComponent}))),le=te&&te.map((function(e){return e&&e.onClose})).filter((function(e){return e}))||[],ce=[{glyph:"floppy-disk",tooltipId:"save",visible:!!N,onClick:function(){return N(le)}}].concat(P((0,O.head)(te.filter((function(e){return e.id===o&&e.toolbar})).map((function(e){return e.toolbar})))||[]));return y().createElement("div",null,y().createElement(h.Z,{open:C.expanded,glyph:"wrench",title:g.title&&(0,O.isObject)(g.title)&&(g.title[a]||g.title.default)||(0,O.isString)(g.title)&&g.title||"",className:n,onClose:function(){T?T(!1,le):(le.forEach((function(e){e()})),R())},size:u,style:V,showFullscreen:K,dock:Q,draggable:X,position:$,header:[y().createElement(m.Row,{key:"ms-toc-settings-toolbar",className:"text-center"},y().createElement(m.Col,{xs:12},ae?y().createElement(ae,{buttons:ce}):y().createElement(b.Z,{btnDefaultProps:{bsStyle:"primary",className:"square-button-md"},buttons:ce})))].concat(P(te.length>1?[y().createElement(m.Row,{key:"ms-toc-settings-navbar",className:"ms-row-tab"},y().createElement(m.Col,{xs:12},y().createElement(m.Nav,{bsStyle:"tabs",activeKey:o,justified:!0},te.map((function(e){return y().createElement(x,{key:"ms-tab-settings-"+e.id,tooltip:y().createElement(S.Z,{msgId:e.tooltipId}),eventKey:e.id,onClick:function(){D(e.id),e.onClick&&e.onClick()}},y().createElement(m.Glyphicon,{glyph:e.glyph}))})))))]:[]))},te.filter((function(e){return e.id&&e.id===o})).filter((function(e){return e.Component})).map((function(t){return y().createElement(t.Component,E({},e,re[t.id],{key:"ms-tab-settings-body-"+t.id,containerWidth:u,element:g,groups:f,nodeType:C.nodeType,settings:C,retrieveLayerData:B,onChange:function(e,t){return(0,O.isObject)(e)?F(e,Z):F(function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},e,t),Z)},isLocalizedLayerStylesEnabled:ie,currentLocaleLanguage:c}))}))),y().createElement(w.Z,null,y().createElement(v.Z,{fade:!0,show:G,title:y().createElement(S.Z,{msgId:"layerProperties.changedSettings"}),size:"xs",onClose:function(){return z(!1)},buttons:[{bsStyle:"primary",text:y().createElement(S.Z,{msgId:"close"}),onClick:function(){return T(!0,le)}},{bsStyle:"primary",text:y().createElement(S.Z,{msgId:"save"}),onClick:function(){return N(le)}}]},y().createElement("div",{className:"ms-alert"},y().createElement("div",{className:"ms-alert-center"},y().createElement(S.Z,{msgId:"layerProperties.changedSettingsAlert"}))))))};C.contextTypes={plugins:o().object,pluginsConfig:o().array,loadedPlugins:o().object};const A=C;var N=n(7147),k=n(75110),T=n(8316),I=n(38842),R=n(55105),M=n(74621),D=n(24262),L=n(22843),F=n(39980),U=n(529),B=n(40562),_=n(21222),z=n(7412),q=n(63209),Z=n(10907),H=n(85552),G=n.n(H),W=n(80798);function V(e){return(V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Q(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function K(e,t){return(K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function X(e,t){return!t||"object"!==V(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function J(e){return(J=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var $,ee,te,ne=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&K(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=J(r);if(o){var n=J(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return X(this,e)});function a(){return Y(this,a),i.apply(this,arguments)}return t=a,(n=[{key:"render",value:function(){if(this.props.active){var e=this.props.payload;return y().createElement("div",{className:"custom-tooltip"},y().createElement("p",{className:"label"},Math.abs(e[0].value)))}return null}}])&&Q(t.prototype,n),a}(y().Component);$=ne,ee="propTypes",te={type:o().string,payload:o().array,label:o().string,active:o().bool},ee in $?Object.defineProperty($,ee,{value:te,enumerable:!0,configurable:!0,writable:!0}):$[ee]=te;const re=ne;function oe(e){return(oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ae(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function le(e,t){return(le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ce(e,t){return!t||"object"!==oe(t)&&"function"!=typeof t?se(e):t}function se(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ue(e){return(ue=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var fe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=ue(r);if(o){var n=ue(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return ce(this,e)});function a(){var e;ie(this,a);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return pe(se(e=i.call.apply(i,[this].concat(n))),"renderLineChart",(function(){return y().createElement(W.wW,{margin:e.props.chartStyle.margin,width:e.props.chartStyle.width,height:e.props.chartStyle.height,data:e.formatData(e.props.elevations.values)},y().createElement(W.Kc,{hide:!0,dataKey:"name"}),y().createElement(W.B2,{hide:!0}),y().createElement(W.u,{content:y().createElement(re,null)}),y().createElement(W.q3,{strokeDasharray:"3 3",horizontal:!1}),y().createElement(W.x1,{isAnimationActive:e.props.animated,type:"monotone",dataKey:"value",stroke:"#82ca9d",activeDot:{r:8}}))})),pe(se(e),"formatData",(function(t){var n=[];return t.map((function(e){n.push({name:this.props.elevations.name,value:parseFloat(this.props.elevations.positive?e:-e)})}),se(e)),n})),e}return t=a,(n=[{key:"render",value:function(){return y().createElement("div",null,this.renderLineChart())}}])&&ae(t.prototype,n),a}(y().Component);function de(e){return(de="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(n),!0).forEach((function(t){Se(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ye(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function he(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function be(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ge(e,t){return(ge=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ve(e,t){return!t||"object"!==de(t)&&"function"!=typeof t?we(e):t}function we(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Oe(e){return(Oe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}pe(fe,"propTypes",{elevations:o().object,chartStyle:o().object,animated:o().bool}),pe(fe,"defaultProps",{elevations:{},chartStyle:{margin:{top:5,right:5,left:5,bottom:45},width:600,height:200},animated:!1}),n(72717),n(57845);var Ee=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ge(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Oe(r);if(o){var n=Oe(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return ve(this,e)});function a(){var e;he(this,a);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Se(we(e=i.call.apply(i,[this].concat(n))),"renderElevationsChart",(function(t){return e.props.showElevationChart?y().createElement(fe,{elevations:t,chartStyle:me({height:200,width:e.props.containerWidth-30},e.props.chartStyle)}):null})),Se(we(e),"renderElevationsSlider",(function(t){var n=t.values,r=n.length-1,o=r-0,i=parseFloat(n[0]),a=parseFloat(n[n.length-1]),l=e.props.element&&e.props.element.params&&e.props.element.params[t.name]||n[0];return y().createElement("div",{id:"mapstore-elevation"},y().createElement(G(),{snap:!0,start:[parseFloat(l)]||0,range:e.calculateRange(n,0,r,o,i,a),behaviour:"tap",pips:{mode:"range",stepped:!0,density:10,format:{to:function(e){return parseFloat(e).toFixed(1)}}},tooltips:!e.props.showElevationChart,onChange:function(n){e.props.onChange("params",Object.assign({},Se({},t.name,n[0])))}}))})),Se(we(e),"calculateRange",(function(e,t,n,r,o,i){var a=[],l="",c={min:o,max:i};return e.forEach((function(e,n){a[n]=(n-t)/r*100,l=a[n]+"%",c[l]=parseFloat(e)})),c})),e}return t=a,(n=[{key:"shouldComponentUpdate",value:function(e){return this.props.element.id!==e.element.id}},{key:"render",value:function(){var e=this.props.getDimension(this.props.element.dimensions,"elevation");return y().createElement(m.Grid,{fluid:!0,style:{paddingTop:15,paddingBottom:15}},y().createElement("label",{id:"mapstore-elevation-label",key:"elevation-label",className:"control-label",style:this.props.showElevationChart?{marginBottom:"10px"}:{marginBottom:"90px"}},this.props.elevationText,": (",e.units,")"),this.renderElevationsChart(e),y().createElement("div",null,y().createElement("div",{key:"elevation"},this.renderElevationsSlider(e))))}}])&&be(t.prototype,n),a}(y().Component);Se(Ee,"propTypes",{elevationText:o().node,element:o().object,getDimension:o().func,onChange:o().func,chartStyle:o().object,showElevationChart:o().bool,containerWidth:o().number}),Se(Ee,"defaultProps",{onChange:function(){},showElevationChart:!0,containerWidth:500,elevationText:y().createElement(S.Z,{msgId:"elevation"}),getDimension:D.getDimension});var Pe=n(71167),je=n.n(Pe);function xe(e){return(xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ae(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(n),!0).forEach((function(t){Ue(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ne(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ke(e,t,n){return(ke="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Le(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}function Te(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ie(e,t)}function Ie(e,t){return(Ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Re(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Le(e);if(t){var o=Le(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Me(this,n)}}function Me(e,t){return!t||"object"!==xe(t)&&"function"!=typeof t?De(e):t}function De(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Le(e){return(Le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ue(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n(89531);var Be='<span class="glyphicon glyphicon-align-left" style="display: inline-block; margin-top: 4px;"></span>',_e='<span class="glyphicon glyphicon-align-center" style="display: inline-block; margin-top: 4px;"></span>',ze='<span class="glyphicon glyphicon-align-right" style="display: inline-block; margin-top: 4px;"></span>',qe='<span class="glyphicon glyphicon-remove" style="display: inline-block; margin-top: 4px;"></span>';function Ze(e){return(Ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function He(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ge(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?He(Object(n),!0).forEach((function(t){Je(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):He(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function We(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ye(e,t){return(Ye=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Qe(e,t){return!t||"object"!==Ze(t)&&"function"!=typeof t?Ke(e):t}function Ke(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xe(e){return(Xe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $e=je().Quill,et=function(e){var t=e.import("blots/embed"),n=e.import("formats/link"),r=e.imports.parchment,o=new r.Attributor.Style("float","float"),i=new r.Attributor.Style("margin","margin"),a=new r.Attributor.Style("display","display"),l=new r.Attributor.Style("width","width"),c={iframeIcon:!0,modules:["DisplaySize","Toolbar","Resize"],overlayStyles:{position:"absolute",boxSizing:"border-box",border:"1px dashed #444"},handleStyles:{position:"absolute",height:"12px",width:"12px",backgroundColor:"white",border:"1px solid #777",boxSizing:"border-box",opacity:"0.80"},displayStyles:{position:"absolute",font:"12px/1.0 Arial, Helvetica, sans-serif",padding:"4px 8px",textAlign:"center",backgroundColor:"white",color:"#333",border:"1px solid #777",boxSizing:"border-box",opacity:"0.80",cursor:"default"},toolbarStyles:{position:"absolute",top:"-12px",right:"0",left:"0",height:"0",minWidth:"100px",font:"12px/1.0 Arial, Helvetica, sans-serif",textAlign:"center",color:"#333",boxSizing:"border-box",cursor:"default"},toolbarButtonStyles:{display:"inline-block",width:"24px",height:"24px",background:"white",border:"1px solid #999",verticalAlign:"middle"},toolbarButtonSvgStyles:{fill:"#444",stroke:"#444",strokeWidth:"2"}},s=function e(t){Fe(this,e),Ue(this,"onCreate",(function(){})),Ue(this,"onDestroy",(function(){})),Ue(this,"onUpdate",(function(){})),this.overlay=t.overlay,this.domNode=t.domNode,this.options=t.options,this.requestUpdate=t.onUpdate},u=function(e){Te(n,e);var t=Re(n);function n(){var e;Fe(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return Ue(De(e=t.call.apply(t,[this].concat(o))),"onCreate",(function(){e.display=document.createElement("div"),Object.assign(e.display.style,e.options.displayStyles),e.overlay.appendChild(e.display)})),Ue(De(e),"onDestroy",(function(){})),Ue(De(e),"onUpdate",(function(){if(e.display&&e.domNode){var t=e.getCurrentSize();if(e.display.innerHTML=t.join(" &times; "),t[0]>120&&t[1]>30)Object.assign(e.display.style,{right:"4px",bottom:"4px",left:"auto"});else if("right"===e.domNode.style.float){var n=e.display.getBoundingClientRect();Object.assign(e.display.style,{right:"auto",bottom:"-".concat(n.height+4,"px"),left:"-".concat(n.width+4,"px")})}else{var r=e.display.getBoundingClientRect();Object.assign(e.display.style,{right:"-".concat(r.width+4,"px"),bottom:"-".concat(r.height+4,"px"),left:"auto"})}}})),Ue(De(e),"getCurrentSize",(function(){return"IMG"===e.domNode.tagName.toUpperCase()?[e.domNode.width,Math.round(e.domNode.width/e.domNode.naturalWidth*e.domNode.naturalHeight)]:[e.domNode.clientWidth,e.domNode.clientHeight]})),e}return n}(s),p=function(e){Te(n,e);var t=Re(n);function n(){var e;Fe(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return Ue(De(e=t.call.apply(t,[this].concat(o))),"onCreate",(function(){e.boxes=[],e.addBox("nwse-resize"),e.addBox("nesw-resize"),e.addBox("nwse-resize"),e.addBox("nesw-resize"),e.positionBoxes()})),Ue(De(e),"onDestroy",(function(){e.setCursor("")})),Ue(De(e),"positionBoxes",(function(){var t="".concat(-parseFloat(e.options.handleStyles.width)/2,"px"),n="".concat(-parseFloat(e.options.handleStyles.height)/2,"px");[{left:t,top:n},{right:t,top:n},{right:t,bottom:n},{left:t,bottom:n}].forEach((function(t,n){Object.assign(e.boxes[n].style,t)}))})),Ue(De(e),"addBox",(function(t){var n=document.createElement("div");Object.assign(n.style,e.options.handleStyles),n.style.cursor=t,n.style.width="".concat(e.options.handleStyles.width,"px"),n.style.height="".concat(e.options.handleStyles.height,"px"),n.addEventListener("mousedown",e.handleMousedown,!1),e.overlay.appendChild(n),e.boxes.push(n)})),Ue(De(e),"handleMousedown",(function(t){e.dragBox=t.target,e.dragStartX=t.clientX,e.dragStartY=t.clientY,e.preDragWidth=e.domNode.width||e.domNode.naturalWidth||e.domNode.clientWidth,e.preDragHeight=e.domNode.height||e.domNode.naturalHeight||e.domNode.clientHeight,e.setCursor(e.dragBox.style.cursor),document.addEventListener("mousemove",e.handleDrag,!1),document.addEventListener("mouseup",e.handleMouseup,!1)})),Ue(De(e),"handleMouseup",(function(){e.setCursor(""),document.removeEventListener("mousemove",e.handleDrag),document.removeEventListener("mouseup",e.handleMouseup)})),Ue(De(e),"handleDrag",(function(t){if(e.domNode){var n=t.clientX-e.dragStartX,r=t.clientY-e.dragStartY;if(e.dragBox===e.boxes[0]||e.dragBox===e.boxes[3]){if("IMG"===e.domNode.tagName.toUpperCase())e.domNode.width=Math.round(e.preDragWidth-n);else if("ms-quill-iframe"===e.domNode.getAttribute("class")){var o=e.domNode.parentNode&&e.domNode.parentNode.children&&e.domNode.parentNode.children[0]||null;o&&(e.domNode.parentNode.parentNode.style.width=Math.round(e.preDragWidth-n)+"px",o.setAttribute("width",e.domNode.parentNode.parentNode.clientWidth),e.domNode.style.width=e.domNode.parentNode.parentNode.clientWidth+"px")}}else if("IMG"===e.domNode.tagName.toUpperCase())e.domNode.width=Math.round(e.preDragWidth+n);else if("ms-quill-iframe"===e.domNode.getAttribute("class")){var i=e.domNode.parentNode&&e.domNode.parentNode.children&&e.domNode.parentNode.children[0]||null;i&&(e.domNode.parentNode.parentNode.style.width=Math.round(e.preDragWidth+n)+"px",i.setAttribute("width",e.domNode.parentNode.parentNode.clientWidth),e.domNode.style.width=e.domNode.parentNode.parentNode.clientWidth+"px")}if("ms-quill-iframe"===e.domNode.getAttribute("class")){var a=e.domNode.parentNode&&e.domNode.parentNode.children&&e.domNode.parentNode.children[0]||null;a&&(e.domNode.parentNode.parentNode.style.height=Math.round(e.preDragHeight+r)+"px",a.setAttribute("height",e.domNode.parentNode.parentNode.clientHeight),e.domNode.style.height=e.domNode.parentNode.parentNode.clientHeight+"px")}e.requestUpdate()}})),Ue(De(e),"setCursor",(function(t){[document.body,"IMG"===e.domNode.tagName.toUpperCase()?e.domNode:e.domNode.parentNode.parentNode].forEach((function(e){e.style.cursor=t}))})),e}return n}(s),f=function(e){Te(n,e);var t=Re(n);function n(){var e;Fe(this,n);for(var r=arguments.length,c=new Array(r),s=0;s<r;s++)c[s]=arguments[s];return Ue(De(e=t.call.apply(t,[this].concat(c))),"onCreate",(function(){e.toolbar=document.createElement("div"),Object.assign(e.toolbar.style,e.options.toolbarStyles),e.overlay.appendChild(e.toolbar),e._defineAlignments(),e._addToolbarButtons()})),Ue(De(e),"onDestroy",(function(){})),Ue(De(e),"onUpdate",(function(){})),Ue(De(e),"_defineAlignments",(function(){var t="IMG"===e.domNode.tagName.toUpperCase()?e.domNode:e.domNode.parentNode.parentNode;e.alignments=[{icon:Be,apply:function(){a.add(t,"inline"),o.add(t,"left"),i.add(t,"0 1em 1em 0")},isApplied:function(){return"left"===o.value(t)}},{icon:_e,apply:function(){a.add(t,"block"),o.remove(t),i.add(t,"auto")},isApplied:function(){return"auto"===i.value(t)}},{icon:ze,apply:function(){a.add(t,"inline"),o.add(t,"right"),i.add(t,"0 0 1em 1em")},isApplied:function(){return"right"===o.value(t)}},{icon:qe,apply:function(){if(a.add(t,"block"),o.add(t,"none"),i.add(t,"0"),l.add(t,"100%"),"ql-video"===t.getAttribute("class")){var e=t.querySelector("IFRAME")||null,n=t.querySelector(".ms-quill-iframe")||null;e&&n&&(t.style.width="100%",e.setAttribute("width","100%"),n.style.width="100%",t.style.height="200px",e.setAttribute("height",200),n.style.height="200px")}},isApplied:function(){return!1}}]})),Ue(De(e),"_addToolbarButtons",(function(){var t=[];e.alignments.forEach((function(n,r){var l=document.createElement("span");t.push(l),l.innerHTML=n.icon,l.addEventListener("click",(function(){t.forEach((function(e){e.style.filter=""})),n.isApplied()?(o.remove(e.domNode),i.remove(e.domNode),a.remove(e.domNode)):(e._selectButton(l),n.apply()),e.requestUpdate()})),Object.assign(l.style,e.options.toolbarButtonStyles),r>0&&(l.style.borderLeftWidth="0"),Object.assign(l.style,e.options.toolbarButtonSvgStyles),n.isApplied()&&e._selectButton(l),e.toolbar.appendChild(l)}))})),Ue(De(e),"_selectButton",(function(e){e.style.filter="invert(20%)"})),e}return n}(s),d={DisplaySize:u,Toolbar:f,Resize:p},y=["height","width"],m=function(e){Te(a,e);var t,r,o,i=Re(a);function a(){return Fe(this,a),i.apply(this,arguments)}return t=a,o=[{key:"create",value:function(e){var t="",n="100%",r=200;(0,O.isObject)(e)?(t=e.src||t,n=e.width||n,r=e.height||r):t=e||t;var o=ke(Le(a),"create",this).call(this,e);o.style.position="relative",e.domNodeStyle&&Object.assign(o.style,e.domNodeStyle),o.style.width=(0,O.isString)(n)&&-1!==n.indexOf("%")?n:n+"px",o.style.height=(0,O.isString)(r)&&-1!==r.indexOf("%")?r:r+"px";var i=document.createElement("IFRAME");i.setAttribute("frameborder","0"),i.setAttribute("allowfullscreen",!0),i.setAttribute("src",this.sanitize(t)),i.setAttribute("width",n),i.setAttribute("height",r);var l=document.createElement("DIV");return l.setAttribute("class","ms-quill-iframe"),l.style.overflow="hidden",l.style.position="absolute",l.style.left="0",l.style.top="0",l.style.width=(0,O.isString)(n)&&-1!==n.indexOf("%")?n:n+"px",l.style.height=(0,O.isString)(r)&&-1!==r.indexOf("%")?r:r+"px",l.style.border="1px solid #ddd",o.appendChild(i),o.appendChild(l),o}},{key:"formats",value:function(e){return y.reduce((function(t,n){return e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t}),{})}},{key:"sanitize",value:function(e){return n.sanitize(e)}},{key:"value",value:function(e){var t=e.children&&e.children[0]&&e.children[0].children&&e.children[0].children[0];return t?{src:t.getAttribute("src"),width:t.getAttribute("width"),height:t.getAttribute("height"),domNodeStyle:Ae({},e.style)}:""}}],(r=[{key:"format",value:function(e,t){y.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):ke(Le(a.prototype),"format",this).call(this,e,t)}}])&&Ne(t.prototype,r),o&&Ne(t,o),a}(t);return m.blotName="video",m.className="ql-video",m.tagName="DIV",{ResizeModule:function t(n){var r=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe(this,t),Ue(this,"initializeModules",(function(){r.removeModules(),r.modules=r.moduleClasses.map((function(e){return new(d[e]||e)(r)})),r.modules.forEach((function(e){e.onCreate()})),r.onUpdate()})),Ue(this,"onUpdate",(function(){r.repositionElements(),r.modules.forEach((function(e){e.onUpdate()}))})),Ue(this,"removeModules",(function(){r.modules.forEach((function(e){e.onDestroy()})),r.modules=[]})),Ue(this,"handleClick",(function(e){if(e.target&&e.target.tagName&&"IMG"===e.target.tagName.toUpperCase()||e.target&&e.target.tagName&&"DIV"===e.target.tagName.toUpperCase()&&"ms-quill-iframe"===e.target.getAttribute("class")){if(r.domNode===e.target)return;r.domNode&&r.hide(),r.show(e.target)}else r.domNode&&r.hide()})),Ue(this,"show",(function(e){r.domNode=e,r.showOverlay(),r.initializeModules()})),Ue(this,"showOverlay",(function(){r.overlay&&r.hideOverlay(),r.quill.setSelection(null),r.setUserSelect("none"),document.addEventListener("keyup",r.checkImage,!0),r.quill.root.addEventListener("input",r.checkImage,!0);var e=r.quill.root.parentNode.querySelector(".ql-editor");if(e&&(e.style.overflow="hidden"),r.overlay=document.createElement("div"),Object.assign(r.overlay.style,r.options.overlayStyles),r.domNode&&"ms-quill-iframe"===r.domNode.getAttribute("class")){r.input=document.createElement("input"),r.input.style.position="absolute",r.input.style.left="8px",r.input.style.top="16px",r.input.style.width="calc(100% - 16px)";var t=r.domNode.parentNode&&r.domNode.parentNode.children&&r.domNode.parentNode.children[0]&&r.domNode.parentNode.children[0].getAttribute("src")||"";r.input.setAttribute("value",t),r.overlay.appendChild(r.input),r.overlay.style.backgroundColor="rgba(0, 0, 0, 0.2)"}r.quill.root.parentNode.appendChild(r.overlay),r.repositionElements()})),Ue(this,"hideOverlay",(function(){if(r.overlay){r.input&&(r.domNode.parentNode&&r.domNode.parentNode.children&&r.domNode.parentNode.children[0]&&r.domNode.parentNode.children[0]&&r.domNode.parentNode.children[0].setAttribute("src",r.input.value),r.overlay.removeChild(r.input),r.input=void 0);var e=r.quill.root.parentNode.querySelector(".ql-editor");e&&(e.style.overflow="auto"),r.quill.root.parentNode.removeChild(r.overlay),r.overlay=void 0,document.removeEventListener("keyup",r.checkImage),r.quill.root.removeEventListener("input",r.checkImage),r.setUserSelect("")}})),Ue(this,"repositionElements",(function(){if(r.overlay&&r.domNode){var e=r.quill.root.parentNode,t="IMG"===r.domNode.tagName.toUpperCase()?r.domNode.getBoundingClientRect():r.domNode.parentNode.parentNode.getBoundingClientRect(),n=e.getBoundingClientRect();Object.assign(r.overlay.style,{left:"".concat(t.left-n.left-1+e.scrollLeft,"px"),top:"".concat(t.top-n.top+e.scrollTop,"px"),width:"".concat(t.width,"px"),height:"".concat(t.height,"px")})}})),Ue(this,"hide",(function(){r.hideOverlay(),r.removeModules(),r.domNode=void 0})),Ue(this,"setUserSelect",(function(e){["userSelect","mozUserSelect","webkitUserSelect","msUserSelect"].forEach((function(t){r.quill.root.style[t]=e,document.documentElement.style[t]=e}))})),Ue(this,"checkImage",(function(t){r.domNode&&r.input!==t.target&&(46!==t.keyCode&&8!==t.keyCode||"IMG"!==r.domNode.tagName.toUpperCase()||e.find(r.domNode).deleteAt(0),r.hide())})),this.quill=n;var i=!1;if(o.modules&&(i=o.modules.slice()),this.options=(0,O.defaultsDeep)({},o,c),!1!==i&&(this.options.modules=i),this.quill.theme&&this.quill.theme.modules&&this.quill.theme.modules.toolbar&&this.quill.theme.modules.toolbar.container&&this.options.iframeIcon){var a=this.quill.theme.modules.toolbar.container.querySelector(".ql-video");a&&(a.innerHTML='<svg viewbox="0 1022 18 18"><g transform="translate(0,0) scale(3.5)"><path d="m 0.20913578,292.52935 -0.0448461,0.0228 c -0.0522035,0.0266 -0.10514577,0.0764 -0.12730166,0.11985 -0.03898753,0.0764 -0.03689917898,-0.0334 -0.036985428654,1.94049 -5.91591201e-5,1.35972 0.00218847865,1.849 0.00864824865,1.87539 0.02503373,0.10227 0.09520806,0.17792 0.19668092,0.21203 0.0202072,0.007 0.54764317,0.009 2.18732434,0.008 l 2.1606966,-0.001 0.044846,-0.0228 c 0.079823,-0.0406 0.1345603,-0.10935 0.1556385,-0.19546 0.00646,-0.0264 0.00872,-0.51567 0.00866,-1.87539 -7.44e-5,-1.97386 0.002,-1.86407 -0.036985,-1.94049 -0.022155,-0.0434 -0.075113,-0.0933 -0.1273161,-0.11985 l -0.044846,-0.0228 H 2.381244 Z m 0.0798849,0.757 H 2.381244 4.4734673 v 1.57107 1.57107 H 2.381244 0.28902068 v -1.57107 z m 2.34957572,0.33607 c -0.028878,0 -0.055626,0.007 -0.080256,0.0204 -0.024631,0.0136 -0.045009,0.0323 -0.061147,0.056 -0.016138,0.0238 -0.025064,0.0501 -0.026762,0.079 -0.032275,0.14948 -0.1758133,0.82556 -0.4306147,2.02822 -0.00679,0.017 -0.010194,0.0348 -0.010194,0.0535 0,0.0306 0.00764,0.0586 0.022928,0.0841 0.015288,0.0255 0.035682,0.0459 0.061162,0.0612 0.025481,0.0153 0.053499,0.0229 0.084076,0.0229 0.022083,0 0.043319,-0.004 0.063703,-0.0127 0.020385,-0.008 0.038221,-0.0204 0.053509,-0.0357 0.015288,-0.0153 0.027184,-0.0331 0.035678,-0.0535 0.00849,-0.0204 0.013592,-0.0416 0.01529,-0.0637 l 0.4255178,-2.00274 c 0.00849,-0.0221 0.013592,-0.045 0.015291,-0.0688 0,-0.0459 -0.016566,-0.0854 -0.04969,-0.11847 -0.033125,-0.0331 -0.072626,-0.0497 -0.1184901,-0.0497 z m -0.1025608,0.30066 c 0.00234,0.002 0.00489,0.003 0.00701,0.005 0.00425,0.003 0.00892,0.006 0.014013,0.008 -0.0051,-0.002 -0.010194,-0.004 -0.01529,-0.008 -0.0017,-0.002 -0.00361,-0.003 -0.00574,-0.005 z m -0.7892346,0.20894 c -0.022083,0 -0.048417,0.008 -0.078993,0.0255 l -0.050968,0.0382 c -0.3295431,0.2599 -0.5461142,0.43063 -0.64973332,0.51217 -0.0441656,0.0187 -0.0764407,0.0514 -0.0968248,0.0981 -0.0203841,0.0467 -0.0246402,0.0947 -0.0127495,0.14398 0.0118908,0.0493 0.038225,0.0858 0.0789933,0.10956 0.057755,0.0408 0.13887122,0.10235 0.24333972,0.18473 0.1044687,0.0824 0.1643489,0.13037 0.179637,0.14396 0.022083,0.017 0.053501,0.0412 0.094269,0.0726 0.040768,0.0314 0.077299,0.0603 0.1095742,0.0866 0.032275,0.0263 0.06285,0.0514 0.091728,0.0752 0.047563,0.034 0.1006454,0.0412 0.1592497,0.0217 0.058604,-0.0195 0.097249,-0.0565 0.1159341,-0.11084 0.016987,-0.0442 0.015701,-0.0896 -0.00383,-0.13632 -0.018887,-0.0452 -0.049313,-0.0772 -0.091223,-0.0962 l -0.03489,-0.0274 c -0.018685,-0.0136 -0.029739,-0.0221 -0.033137,-0.0255 -0.056056,-0.0408 -0.1375864,-0.10108 -0.2446029,-0.18091 -0.1070166,-0.0798 -0.1843053,-0.13759 -0.2318683,-0.17327 0.030576,-0.0221 0.1108352,-0.082 0.240784,-0.17963 0.1299487,-0.0977 0.2297443,-0.17284 0.29939,-0.2255 0.057755,-0.0238 0.093001,-0.0697 0.1057405,-0.1376 0.01274,-0.0679 -0.00467,-0.12314 -0.052231,-0.16561 -0.035672,-0.0357 -0.078129,-0.0527 -0.1273908,-0.051 -0.0034,-0.002 -0.0068,-0.003 -0.010194,-0.003 z m 1.2689006,0 c -0.0034,0 -0.0068,8.5e-4 -0.010194,0.003 -0.049262,-0.002 -0.091718,0.0153 -0.1273909,0.051 -0.047563,0.0425 -0.064971,0.0977 -0.052231,0.16561 0.01274,0.0679 0.047986,0.11382 0.1057406,0.1376 0.069646,0.0527 0.1694416,0.12782 0.29939,0.2255 0.1299488,0.0977 0.210208,0.15755 0.2407841,0.17963 -0.047563,0.0357 -0.1248516,0.0934 -0.2318683,0.17327 -0.1070167,0.0798 -0.1885466,0.14014 -0.2446028,0.18091 l -0.033137,0.0255 c -0.015288,0.0102 -0.024628,0.017 -0.028025,0.0204 -0.00522,0.004 -0.00795,0.007 -0.00826,0.008 -0.041191,0.019 -0.071164,0.0509 -0.089841,0.0955 -0.019535,0.0467 -0.020806,0.0922 -0.00382,0.13632 0.018685,0.0544 0.05733,0.0913 0.1159342,0.11084 0.058604,0.0195 0.1116868,0.0123 0.1592499,-0.0217 0.028877,-0.0238 0.059453,-0.0488 0.091728,-0.0752 0.032275,-0.0263 0.068806,-0.0552 0.1095742,-0.0866 0.040768,-0.0314 0.072186,-0.0556 0.094269,-0.0726 0.032275,-0.0272 0.076018,-0.0629 0.1312245,-0.10702 0.055207,-0.0442 0.10659,-0.0845 0.1541529,-0.12103 0.047563,-0.0365 0.093434,-0.0701 0.1375999,-0.10064 0.040768,-0.0238 0.067102,-0.0603 0.078993,-0.10956 0.011891,-0.0493 0.00763,-0.0973 -0.012749,-0.14398 -0.020384,-0.0467 -0.052659,-0.0794 -0.096824,-0.0981 -0.07814,-0.0612 -0.2947259,-0.23189 -0.6497489,-0.51217 -0.045864,-0.0408 -0.089179,-0.062 -0.1299468,-0.0637 z m -1.4396219,0.15034 c -0.0017,0.008 -0.00256,0.0178 -0.00256,0.028 v -0.0102 -0.0102 z m 1.6103431,0 0.00254,0.008 v 0.0102 0.0102 c 0,-0.0102 -8.416e-4,-0.0195 -0.00254,-0.028 z m -1.6128989,0.051 0.00256,0.0178 0.00254,0.0179 0.00765,0.0178 0.00764,0.0153 h -0.00254 c -0.0017,-0.003 -0.0034,-0.008 -0.0051,-0.0153 l -0.00256,-0.003 -0.0051,-0.0153 c -0.0017,-0.008 -0.00254,-0.0145 -0.00254,-0.0179 -0.0017,-0.007 -0.00256,-0.0127 -0.00256,-0.0178 z m 1.6154252,2.3e-4 c -2.25e-5,0.005 -8.494e-4,0.0109 -0.00252,0.0176 0,0.003 -8.416e-4,0.009 -0.00254,0.0179 l -0.0051,0.0153 -0.00256,0.003 c -0.0017,0.007 -0.0034,0.0119 -0.0051,0.0153 h -0.00254 l 0.00764,-0.0153 0.00765,-0.0178 0.00254,-0.0179 z m -1.50331,0.1552 c 0.00849,0.003 0.01869,0.007 0.030581,0.0102 -0.00679,-0.002 -0.011036,-0.003 -0.012735,-0.003 -0.0051,-0.002 -0.011052,-0.004 -0.017846,-0.008 z m 1.3912246,0 c -0.00679,0.003 -0.01275,0.006 -0.017846,0.008 -0.0017,0 -0.00594,8.6e-4 -0.012735,0.003 0.011891,-0.003 0.022087,-0.007 0.030581,-0.0102 z m -0.7975265,1.2256 c 0.0051,0.002 0.00934,0.004 0.012734,0.008 -0.0051,-0.003 -0.00934,-0.006 -0.012734,-0.008 z"/></g></svg>')}this.quill.theme&&this.quill.theme.tooltip&&this.quill.theme.tooltip.root&&this.quill.theme.tooltip.root.classList&&this.quill.theme.tooltip.root.classList.add&&this.options.iframeIcon&&this.quill.theme.tooltip.root.classList.add("ms-ql-iframe-tooltip"),document.execCommand("enableObjectResizing",!1,"false"),this.quill.root.addEventListener("click",this.handleClick,!1),this.quill.root.parentNode.style.position=this.quill.root.parentNode.style.position||"relative",this.moduleClasses=this.options.modules,this.modules=[]},IFrame:m,toolbarConfig:{container:[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"],["video"]]},BaseModule:s,Toolbar:f,DisplaySize:u,Resize:p}}($e),tt=et.ResizeModule,nt=et.IFrame,rt=et.toolbarConfig;$e.register({"formats/video":nt,"modules/resizeModule":tt});var ot=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ye(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Xe(r);if(o){var n=Xe(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Qe(this,e)});function a(){var e;We(this,a);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Je(Ke(e=i.call.apply(i,[this].concat(n))),"state",{template:" "}),Je(Ke(e),"close",(function(){e.props.onShowEditor(!e.props.showEditor),e.props.onChange("featureInfo",Ge(Ge({},e.props.element&&e.props.element.featureInfo||{}),{},{template:e.state.template}))})),e}return t=a,(n=[{key:"UNSAFE_componentWillMount",value:function(){this.setState({template:this.props.element&&this.props.element.featureInfo&&this.props.element.featureInfo.template||" "})}},{key:"render",value:function(){var e=this,t=this.props,n=t.showEditor,r=t.enableIFrameModule,o=void 0===r||r;return y().createElement(w.Z,null,y().createElement(v.Z,{fade:!0,show:n,title:y().createElement(S.Z,{msgId:"layerProperties.editCustomFormat"}),size:"lg",showFullscreen:!0,clickOutEnabled:!1,onClose:function(){return e.close()},buttons:[{bsStyle:"primary",text:y().createElement(S.Z,{msgId:"close"}),onClick:function(){return e.close()}}]},y().createElement("div",{id:"ms-template-editor",className:"ms-editor"},y().createElement(je(),{bounds:"#ms-template-editor",ref:function(t){t&&(e.quill=t)},modules:o?{resizeModule:{},toolbar:rt}:{},defaultValue:this.state.template,onChange:function(t){return e.setState({template:t})}}))))}}])&&Ve(t.prototype,n),a}(y().Component);Je(ot,"propTypes",{showEditor:o().bool,element:o().object,onChange:o().func,onShowEditor:o().func,enableIFrameModule:o().bool}),Je(ot,"defaultProps",{showEditor:!1,element:{},enableIFrameModule:!1,onChange:function(){},onShowEditor:function(){}});const it=ot;var at=n(82110),lt=n(12485),ct=n.n(lt),st=n(20135),ut=n.n(st),pt=n(71062),ft=n.n(pt),dt=n(73014),yt=n(82030),mt=n(25382),ht=(n(98678),n(43143)),bt=n(57037),gt=n(3918),vt=n.n(gt),wt=n(66287);function Ot(e){return(Ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function St(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Et(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Pt(e,t){return(Pt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function jt(e,t){return!t||"object"!==Ot(t)&&"function"!=typeof t?xt(e):t}function xt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ct(e){return(Ct=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function At(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Nt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Pt(e,t)}(l,e);var t,r,o,i,a=(o=l,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Ct(o);if(i){var n=Ct(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return jt(this,e)});function l(){var e;St(this,l);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return At(xt(e=a.call.apply(a,[this].concat(r))),"paint",(function(t){t.save(),t.beginPath();var n=e.props.shapeStyle,r=n.color,o=n.fill;switch(t.fillStyle=o?(0,O.isString)(o)?o:"rgba(".concat(o.r,", ").concat(o.g,", ").concat(o.b,", ").concat(o.a,")"):null,t.strokeStyle=r?(0,O.isString)(r)?r:"rgba(".concat(r.r,", ").concat(r.g,", ").concat(r.b,", ").concat(r.a,")"):null,t.lineWidth=e.props.shapeStyle.width||e.props.shapeStyle.weight,e.props.shapeStyle.dashArray&&e.props.shapeStyle.dashArray.length&&t.setLineDash(e.props.shapeStyle.dashArray),e.props.geomType){case"Polygon":e.paintPolygon(t);break;case"Polyline":e.paintPolyline(t);break;case"Point":e.paintPoint(t,e.props.shapeStyle.markName);break;case"Circle":e.paintPoint(t,"circle");break;case"Marker":e.paintMarker(t);break;case"Text":e.paintText(t);break;case"Symbol":e.paintSymbol(t);break;default:return}t.restore()})),At(xt(e),"drawSymbol",(function(t,r){r.clearRect(0,0,600,600);var o=new Image,i=new Image;i.src=n(18845),o.src=t||e.props.shapeStyle.symbolUrl,o.onload=function(){try{r.drawImage(o,e.props.width/2-o.width/2,e.props.height/2-o.height/2)}catch(e){return}},o.onerror=function(){i.onload=function(){try{r.drawImage(i,e.props.width/2-i.width/2,e.props.height/2-i.height/2)}catch(e){return}}}})),At(xt(e),"paintSymbol",(function(t){(0,wt.isSymbolStyle)(e.props.originalStyle)?e.props.originalStyle.symbolUrlCustomized&&e.props.originalStyle.symbolUrl?e.drawSymbol(e.props.originalStyle.symbolUrlCustomized,t):(0,wt.createSvgUrl)(e.props.originalStyle,e.props.originalStyle.symbolUrlCustomized||e.props.originalStyle.symbolUrl).then((function(n){return e.drawSymbol(n,t)})):e.drawSymbol(null,t)})),At(xt(e),"paintText",(function(t){var n=e.props,r=n.width,o=n.height,i=e.props.shapeStyle,a=i.textAlign,l=void 0===a?"center":a,c=i.label,s=i.font,u=void 0===s?"14px Arial":s;return t.textAlign=l,t.font=u,"start"===l?(t.strokeText(c||"New",r/2.5,o/2),void t.fillText(c||"New",r/2.5,o/2)):"end"===l?(t.strokeText(c||"New",r/1.5,o/2),void t.fillText(c||"New",r/1.5,o/2)):(t.strokeText(c||"New",r/2,o/2),void t.fillText(c||"New",r/2,o/2))})),At(xt(e),"paintPolygon",(function(e){e.transform(1,0,0,1,-27.5,0),e.moveTo(55,8),e.lineTo(100,8),e.lineTo(117.5,40),e.lineTo(100,72),e.lineTo(55,72),e.lineTo(37.5,40),e.closePath(),e.fill(),e.stroke()})),At(xt(e),"paintPolyline",(function(e){e.transform(1,0,0,1,0,0),e.moveTo(10,20),e.bezierCurveTo(40,40,70,0,90,20),e.stroke()})),At(xt(e),"paintPoint",(function(t,n){var r=e.props.shapeStyle.radius,o=r/2;switch(n){case"square":t.rect(50-o,48.5-o,r,r);break;case"circle":t.arc(50,48.5,o,0,2*Math.PI);break;case"triangle":var i=Math.sqrt(3)*r/2/3;t.moveTo(50,48.5-2*i),t.lineTo(50+o,48.5+i),t.lineTo(50-o,48.5+i),t.closePath();break;case"star":e.paintStar(t,50,48.5,5,o,o/2);break;case"cross":e.paintCross(t,50,48.5,r,.23);break;case"x":t.translate(50,48.5),t.rotate(45*Math.PI/180),t.translate(-50,-48.5),e.paintCross(t,50,48.5,r,.23);break;default:t.arc(50,48.5,r,0,2*Math.PI)}t.fill(),t.stroke()})),At(xt(e),"paintMarker",(function(e){var t=new Image;t.src=vt();try{e.drawImage(t,42.5,24)}catch(e){return}})),At(xt(e),"paintStar",(function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,o=arguments.length>4?arguments[4]:void 0,i=arguments.length>5?arguments[5]:void 0,a=Math.PI/2*3,l=t,c=n,s=Math.PI/r;e.moveTo(t,n-o);for(var u=0;u<r;u++)l=t+Math.cos(a)*o,c=n+Math.sin(a)*o,e.lineTo(l,c),a+=s,l=t+Math.cos(a)*i,c=n+Math.sin(a)*i,e.lineTo(l,c),a+=s;e.lineTo(t,n-o),e.closePath()})),At(xt(e),"paintCross",(function(e,t,n,r,o){var i=r*o/2,a=r/2;e.moveTo(t-i,n-a),e.lineTo(t+i,n-a),e.lineTo(t+i,n-i),e.lineTo(t+a,n-i),e.lineTo(t+a,n+i),e.lineTo(t+i,n+i),e.lineTo(t+i,n+a),e.lineTo(t-i,n+a),e.lineTo(t-i,n+i),e.lineTo(t-a,n+i),e.lineTo(t-a,n-i),e.lineTo(t-i,n-i),e.closePath()})),e}return t=l,(r=[{key:"componentDidMount",value:function(){var e=this.refs.styleCanvas.getContext("2d");e.clearRect(0,0,this.props.width||500,this.props.height||500),this.paint(e)}},{key:"componentDidUpdate",value:function(){var e=this.refs.styleCanvas.getContext("2d");e.clearRect(0,0,this.props.width||500,this.props.height||500),this.paint(e)}},{key:"render",value:function(){return y().createElement("canvas",{ref:"styleCanvas",style:this.props.style,width:this.props.width,height:this.props.height})}}])&&Et(t.prototype,r),l}(y().Component);At(Nt,"propTypes",{originalStyle:o().object,style:o().object,shapeStyle:o().object,geomType:o().oneOf(["Polygon","Polyline","Point","Marker","Text","Symbol","Circle",void 0]),width:o().number,height:o().number}),At(Nt,"defaultProps",{originalStyle:{},style:{},shapeStyle:{},geomType:"Polygon",width:100,height:80});const kt=Nt;var Tt=n(20),It=n(86638);function Rt(e){return(Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Mt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Lt(e,t){return(Lt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ft(e,t){return!t||"object"!==Rt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Ut(e){return(Ut=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Bt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _t=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Lt(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Ut(r);if(o){var n=Ut(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Ft(this,e)});function a(){return Mt(this,a),i.apply(this,arguments)}return t=a,(n=[{key:"render",value:function(){var e=this;return y().createElement(Tt.DropdownList,{data:[{value:"circle",name:(0,It.S$)(this.context.messages,"markNameSelector.circle")||"Circle"},{value:"square",name:(0,It.S$)(this.context.messages,"markNameSelector.square")||"Square"},{value:"triangle",name:(0,It.S$)(this.context.messages,"markNameSelector.triangle")||"Triangle"},{value:"star",name:(0,It.S$)(this.context.messages,"markNameSelector.star")||"Star"},{value:"cross",name:(0,It.S$)(this.context.messages,"markNameSelector.cross")||"Cross"},{value:"x",name:(0,It.S$)(this.context.messages,"markNameSelector.x")||"X"}],valueField:"value",textField:"name",value:this.props.markName,onChange:function(t){return e.props.onChange("markName",t.value)}})}}])&&Dt(t.prototype,n),a}(y().Component);Bt(_t,"propTypes",{markName:o().string,onChange:o().func}),Bt(_t,"contextTypes",{messages:o().object}),Bt(_t,"defaultProps",{markName:"circle",onChange:function(){}});const zt=_t;var qt=n(9886),Zt=n.n(qt);function Ht(e){return(Ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Gt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Vt(e,t){return(Vt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Yt(e,t){return!t||"object"!==Ht(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Qt(e){return(Qt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Kt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Zt()();var Xt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Vt(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Qt(r);if(o){var n=Qt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Yt(this,e)});function a(){return Gt(this,a),i.apply(this,arguments)}return t=a,(n=[{key:"render",value:function(){var e=this;return y().createElement(m.Grid,{fluid:!0},y().createElement(m.Row,null,y().createElement(m.Col,{xs:4,style:{padding:0}},y().createElement(kt,{style:{padding:0,margin:"auto",display:"block"},height:97,shapeStyle:this.props.shapeStyle,geomType:this.props.shapeStyle.marker?"Marker":"Point"})),y().createElement(m.Col,{xs:7},this.props.showMarker?y().createElement(m.Row,null,y().createElement(m.Col,{xs:1},y().createElement("input",{"aria-label":"...",type:"checkbox",defaultChecked:this.props.shapeStyle.marker,onChange:function(t){e.props.setStyleParameter("marker",t.target.checked)}})),y().createElement(m.Col,{style:{paddingLeft:0,paddingTop:1},xs:4},y().createElement("label",null,"Marker"))):null,this.props.showMarkSelector?y().createElement(m.Row,{style:{marginBottom:4}},y().createElement(m.Col,{style:{paddingTop:7},xs:4},y().createElement("label",null,"Mark")),y().createElement(m.Col,{xs:8,style:{paddingRight:0,paddingLeft:30}},y().createElement(zt,{onChange:this.props.setStyleParameter,markName:this.props.shapeStyle.markName}))):null,y().createElement(m.Row,null,y().createElement(m.Col,{xs:4},y().createElement(bt.Z,{disabled:this.props.shapeStyle.marker,value:this.props.shapeStyle.color,line:!1,text:"Stroke",onChangeColor:function(t){t&&e.props.setStyleParameter("color",t)}})),y().createElement(m.Col,{xs:8,style:{paddingRight:0,paddingLeft:30}},y().createElement(Tt.NumberPicker,{disabled:this.props.shapeStyle.marker,min:1,max:15,step:1,value:this.props.shapeStyle.width,onChange:function(t){e.props.shapeStyle.width!==t&&e.props.setStyleParameter("width",t)}}))),y().createElement(m.Row,{style:{marginTop:4}},y().createElement(m.Col,{xs:4},y().createElement(bt.Z,{disabled:this.props.shapeStyle.marker,value:this.props.shapeStyle.fill,line:!1,text:"Fill",onChangeColor:function(t){t&&e.props.setStyleParameter("fill",t)}})),y().createElement(m.Col,{xs:8,style:{paddingRight:0,paddingLeft:30}},y().createElement(Tt.NumberPicker,{disabled:this.props.shapeStyle.marker,min:1,max:50,step:1,value:this.props.shapeStyle.radius,onChange:function(t){e.props.shapeStyle.radius!==t&&e.props.setStyleParameter("radius",t)}}))))))}}])&&Wt(t.prototype,n),a}(y().Component);Kt(Xt,"propTypes",{shapeStyle:o().object,setStyleParameter:o().func,showMarker:o().bool,showMarkSelector:o().bool}),Kt(Xt,"defaultProps",{shapeStyle:{},showMarker:!0,showMarkSelector:!1,setStyleParameter:function(){}});const Jt=Xt;function $t(e){return($t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function en(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function nn(e,t){return(nn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function rn(e,t){return!t||"object"!==$t(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function on(e){return(on=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function an(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Zt()();var ln=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&nn(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=on(r);if(o){var n=on(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return rn(this,e)});function a(){return en(this,a),i.apply(this,arguments)}return t=a,(n=[{key:"render",value:function(){var e=this;return y().createElement(m.Grid,{fluid:!0},y().createElement(m.Row,null,y().createElement(m.Col,{xs:4,style:{padding:0}},y().createElement(kt,{style:{padding:0,margin:"auto",display:"block"},shapeStyle:this.props.shapeStyle,geomType:"Polygon"})),y().createElement(m.Col,{xs:7},y().createElement(m.Row,{style:{marginTop:7}},y().createElement(m.Col,{xs:4},y().createElement(bt.Z,{value:this.props.shapeStyle.color,line:!1,text:"Stroke",onChangeColor:function(t){t&&e.props.setStyleParameter("color",t)}})),y().createElement(m.Col,{xs:8,style:{paddingRight:0,paddingLeft:30}},y().createElement(Tt.NumberPicker,{min:1,max:15,step:1,value:this.props.shapeStyle.width,onChange:function(t){t!==e.props.shapeStyle.width&&e.props.setStyleParameter("width",t)}}))),y().createElement(m.Row,{style:{marginTop:4}},y().createElement(m.Col,{xs:6},y().createElement(bt.Z,{value:this.props.shapeStyle.fill,line:!1,text:"Fill",onChangeColor:function(t){t&&e.props.setStyleParameter("fill",t)}}))))))}}])&&tn(t.prototype,n),a}(y().Component);an(ln,"propTypes",{shapeStyle:o().object,setStyleParameter:o().func}),an(ln,"defaultProps",{shapeStyle:{},setStyleParameter:function(){}});const cn=ln;function sn(e){return(sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function un(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function fn(e,t){return(fn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function dn(e,t){return!t||"object"!==sn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function yn(e){return(yn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function mn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Zt()();var hn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&fn(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=yn(r);if(o){var n=yn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return dn(this,e)});function a(){return un(this,a),i.apply(this,arguments)}return t=a,(n=[{key:"render",value:function(){var e=this;return y().createElement(m.Grid,{fluid:!0},y().createElement(m.Row,null,y().createElement(m.Col,{xs:4,style:{padding:0}},y().createElement(kt,{style:{padding:0,margin:"auto",display:"block"},shapeStyle:this.props.shapeStyle,geomType:"Polyline",height:40})),y().createElement(m.Col,{xs:7},y().createElement(m.Row,{style:{marginTop:7}},y().createElement(m.Col,{xs:4},y().createElement(bt.Z,{value:this.props.shapeStyle.color,line:!1,text:"Stroke",onChangeColor:function(t){t&&e.props.setStyleParameter("color",t)}})),y().createElement(m.Col,{xs:8,style:{paddingRight:0,paddingLeft:30}},y().createElement(Tt.NumberPicker,{onChange:function(t){e.props.setStyleParameter("width",t)},min:1,max:15,step:1,value:this.props.shapeStyle.width}))))))}}])&&pn(t.prototype,n),a}(y().Component);mn(hn,"propTypes",{shapeStyle:o().object,setStyleParameter:o().func}),mn(hn,"defaultProps",{shapeStyle:{},setStyleParameter:function(){}});const bn=hn;var gn=n(38848);function vn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vn(Object(n),!0).forEach((function(t){On(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function On(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Sn=(0,a.compose)((0,a.withProps)((function(e){var t=e.style,n=void 0===t?{}:t,r=e.styleName,o=n.fillColor,i=n.fillOpacity,a=n.color,l=n.opacity,c=n.shapeStyle,s=n.weight,u=n.radius;return{shapeStyle:wn(wn({},c),{},{marker:"marker"===r,radius:u,width:s,fill:(0,ht.qq)(o,i),color:(0,ht.qq)(a,l)})}})),(0,a.withHandlers)({setStyleParameter:function(e){var t=e.onChange,n=void 0===t?function(){}:t,r=e.style,o=void 0===r?{}:r;return function(e,t){switch(e){case"fill":var r=t.r,i=t.g,a=t.b,l=t.a;n("style",wn(wn({},o),{},{fillColor:"rgb(".concat(r,", ").concat(i,", ").concat(a,")"),fillOpacity:l}));break;case"color":var c=t.r,s=t.g,u=t.b,p=t.a;n("style",wn(wn({},o),{},{color:"rgb(".concat(c,", ").concat(s,", ").concat(u,")"),opacity:p}));break;case"width":n("style",wn(wn({},o),{},{weight:t}));break;case"marker":n("styleName",t?"marker":void 0);break;default:n("style",wn(wn({},o),{},On({},e,t)))}}}})),En={Polygon:Sn(cn),MultiPolygon:Sn(cn),GeometryCollection:Sn(cn),LineString:Sn(bn),MultiLineString:Sn(bn),MultiPoint:Sn(Jt),Point:Sn(Jt)},Pn=(0,a.branch)((function(e){var t=e.element;return"wfs"===(void 0===t?{}:t).type}),(0,a.mapPropsStream)((function(e){return e.combineLatest(e.map((function(e){return{layer:e.element}})).let(mt.Z).map((function(e){var t=e.error,n=e.loading,r=e.describeFeatureType;return{error:t,loading:n,geometryType:!t&&!n&&r&&(0,gn.extractGeometryType)(r)}})),(function(e,t){var n=t.geometryType,r=t.error,o=t.loading;return wn(wn({},e),{},{geometryType:n,error:r,loading:o})}))})),(0,a.withProps)((function(e){var t=e.element;return{geometryType:t&&t.features&&t.features[0].geometry&&t.features[0].geometry.type}})));const jn=(0,a.compose)(Pn,(0,dt.Z)(),(0,yt.Z)((function(e){return!e.geometryType})))((function(e){var t=e.geometryType,n=e.element,r=void 0===n?{}:n,o=e.onChange,i=void 0===o?function(){}:o,a=En[t];return y().createElement(y().Fragment,null,y().createElement("h4",null,"    ",y().createElement(S.Z,{msgId:"layerProperties.style"})),y().createElement(a,{styleName:r.styleName,style:r.style,onChange:i}))}));var xn=n(827),Cn=n(84342),An=n(76424);function Nn(){return(Nn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const kn=function(e){var t=e.activePanel,n=e.fillContainer,r=e.className,o=e.onSelect,i=e.panels,a=void 0===i?[]:i,l=n?"ms-fill-container ":"";return y().createElement(m.Accordion,{activeKey:t,className:"ms-accordion "+l+r},a.map((function(e,n){return y().createElement(m.Panel,{key:n,eventKey:e.id,className:t===e.id&&"HIDDEN"!==e.id?"ms-selected":"",header:e.head&&y().createElement("a",{role:"tab"},y().createElement(An.Z,Nn({},e.head,{selected:t===e.id,onClick:function(){o(e.id)}})))||null,collapsible:!0},e.body)})))};function Tn(e){return(Tn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function In(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Rn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?In(Object(n),!0).forEach((function(t){zn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):In(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Mn(){return(Mn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Dn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ln(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Fn(e,t){return(Fn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Un(e,t){return!t||"object"!==Tn(t)&&"function"!=typeof t?Bn(e):t}function Bn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _n(e){return(_n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function zn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var qn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Fn(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=_n(r);if(o){var n=_n(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Un(this,e)});function a(){var e;Dn(this,a);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return zn(Bn(e=i.call.apply(i,[this].concat(n))),"getInfoFormat",(function(t){return Object.keys(t).map((function(t){var n=e.props.formatCards[t]&&e.props.formatCards[t].body;return{id:t,head:{preview:y().createElement(m.Glyphicon,{glyph:e.props.formatCards[t]&&e.props.formatCards[t].glyph||"ext-empty"}),title:e.props.formatCards[t]&&e.props.formatCards[t].titleId&&y().createElement(S.Z,{msgId:e.props.formatCards[t].titleId})||"",description:e.props.formatCards[t]&&e.props.formatCards[t].descId&&y().createElement(S.Z,{msgId:e.props.formatCards[t].descId})||"",size:"sm"},body:n&&y().createElement(n,Mn({template:e.props.element.featureInfo&&e.props.element.featureInfo.template||""},e.props))||null}}))})),e}return t=a,(n=[{key:"render",value:function(){var e=this,t=this.getInfoFormat(this.props.defaultInfoFormat);return y().createElement("span",null,y().createElement(kn,{fillContainer:!0,activePanel:this.props.element.featureInfo&&this.props.element.featureInfo.format,panels:t,onSelect:function(t){var n=e.props.element.featureInfo&&e.props.element.featureInfo.format&&t===e.props.element.featureInfo.format;e.props.onChange("featureInfo",Rn(Rn({},e.props.element&&e.props.element.featureInfo||{}),{},{format:n?"":t,viewer:e.props.element.featureInfo?e.props.element.featureInfo.viewer:void 0}))}}))}}])&&Ln(t.prototype,n),a}(y().Component);function Zn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zn(Object(n),!0).forEach((function(t){Gn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Vn(){return(Vn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Yn(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}zn(qn,"propTypes",{element:o().object,defaultInfoFormat:o().object,onChange:o().func,formatCards:o().object}),zn(qn,"defaultProps",{element:{},defaultInfoFormat:[],onChange:function(){},formatCards:{}});var Qn={html:ct(),json:JSON.parse(ut()),text:ft()},Kn=(0,a.defaultProps)({readOnly:!0})(Cn.tM),Xn=(0,i.connect)((0,l.P1)([xn.Od],(function(e){return{zoom:e.zoom,projection:e.projection}})))(Z.Z),Jn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.settings,n=void 0===t?{}:t;return"layers"===n.nodeType},$n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.element,n=void 0===t?{}:t;return"wfs"===n.type||"vector"===n.type&&"annotations"!==n.id},er=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.element,n=void 0===t?{}:t;return"wms"===n.type},tr=function(e){return Jn(e)&&(er(e)||$n(e))},nr={HIDDEN:{titleId:"layerProperties.hideFormatTitle",descId:"layerProperties.hideFormatDescription",glyph:"hide-marker"},TEXT:{titleId:"layerProperties.textFormatTitle",descId:"layerProperties.textFormatDescription",glyph:"ext-txt",body:function(){return y().createElement("div",null,y().createElement("div",null,y().createElement(S.Z,{msgId:"layerProperties.exampleOfResponse"})),y().createElement("br",null),y().createElement(U.Z,{response:Qn.text}))}},HTML:{titleId:"layerProperties.htmlFormatTitle",descId:"layerProperties.htmlFormatDescription",glyph:"ext-html",body:function(){return y().createElement("div",null,y().createElement("div",null,y().createElement(S.Z,{msgId:"layerProperties.exampleOfResponse"})),y().createElement("br",null),y().createElement(F.Z,{response:Qn.html}))}},PROPERTIES:{titleId:"layerProperties.propertiesFormatTitle",descId:"layerProperties.propertiesFormatDescription",glyph:"ext-json",body:function(){return y().createElement("div",null,y().createElement("div",null,y().createElement(S.Z,{msgId:"layerProperties.exampleOfResponse"})),y().createElement("br",null),y().createElement(B.Z,{response:Qn.json}))}},TEMPLATE:{titleId:"layerProperties.templateFormatTitle",descId:"layerProperties.templateFormatDescription",glyph:"ext-empty",body:function(e){var t=e.template,n=void 0===t?"":t,r=Yn(e,["template"]);return y().createElement("div",null,y().createElement("div",null,n&&"<p><br></p>"!==n?y().createElement(S.Z,{msgId:"layerProperties.templatePreview"}):null),y().createElement("br",null),y().createElement("div",null,n&&"<p><br></p>"!==n?y().createElement(_.Z,{html:n}):y().createElement("span",null,y().createElement("p",null,y().createElement(S.Z,{msgId:"layerProperties.templateFormatInfoAlert2",msgParams:{attribute:"{ }"}})),y().createElement("pre",null,y().createElement(S.Z,{msgId:"layerProperties.templateFormatInfoAlertExample",msgParams:{properties:"{ properties.id }"}})),y().createElement("p",null,y().createElement("small",null,y().createElement(S.Z,{msgId:"layerProperties.templateFormatInfoAlert1"}))," ( ",y().createElement(m.Glyphicon,{glyph:"pencil"})," )")),y().createElement(it,Vn({template:n},r))))}}},rr=(0,a.defaultProps)({formatCards:nr,defaultInfoFormat:Object.assign({HIDDEN:"text/html"},(0,z.eq)())})(qn),or={},ir=function(e,t,n){if(e){var r=or[e.name];return r||(r=(0,L.KB)(e,t,n))&&r.loaded&&(or[e.name]=r),r}return e},ar=function(e){var t=e.settings,n=e.items,r=void 0===n?[]:n,o=e.loadedPlugins,i=e.onToggleStyleEditor,l=void 0===i?function(){}:i,c=e.onUpdateParams,s=void 0===c?function(){}:c,u=e.element,p=Yn(e,["settings","items","loadedPlugins","onToggleStyleEditor","onUpdateParams","element"]);if($n({element:u}))return{Component:jn};var f,d=(0,O.sortBy)((0,O.filter)((f=r,function(e){if(Array.isArray(e))return Wn(e)}(f)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(f)||function(e,t){if(e){if("string"==typeof e)return Wn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wn(e,t):void 0}}(f)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),{target:"style"}),["priority"]).filter((function(e){var t=e.selector;return!t||t(Hn(Hn({},p),{},{element:u}))})),m=(0,O.head)((0,O.filter)(d,{name:"ThematicLayer"}));if(m){var h=t&&t.options&&t.options.thematic,b=[{glyph:"list",tooltipId:"toc.thematic.classify",visible:p.isAdmin&&!h||!1,onClick:function(){return s({thematic:{unconfigured:!0}})}},{glyph:"trash",tooltipId:"toc.thematic.remove_thematic",visible:p.isAdmin&&h||!1,onClick:function(){return s({thematic:null})}}];return h?{Component:"style"===p.activeTab&&m.plugin&&ir(m,o,y().createElement(at.Z,{width:100,height:100})),toolbar:b}:{toolbar:b}}var g=(0,O.head)(d);if(g&&g.plugin){var v=g.cfg||g.plugin.cfg;return{onClose:function(){return l(null,!1)},Component:ir(Hn(Hn({},g),{},{cfg:Hn(Hn({},v||{}),{},{active:!0})}),o,y().createElement(at.Z,{width:100,height:100})),toolbarComponent:g.ToolbarComponent&&(v&&(0,a.defaultProps)(v)(g.ToolbarComponent)||g.ToolbarComponent)}}return{}};const lr=function(e){var t=e.showFeatureInfoTab,n=void 0===t||t,r=e.loadedPlugins,o=e.items,i=e.onToggleStyleEditor,a=Yn(e,["showFeatureInfoTab","loadedPlugins","items","onToggleStyleEditor"]);return[{id:"general",titleId:"layerProperties.general",tooltipId:"layerProperties.general",glyph:"wrench",visible:!0,Component:q.Z},{id:"display",titleId:"layerProperties.display",tooltipId:"layerProperties.display",glyph:"eye-open",visible:Jn(a),Component:Xn},Hn({id:"style",titleId:"layerProperties.style",tooltipId:"layerProperties.style",glyph:"dropper",visible:tr(a),Component:Kn},ar(Hn({items:o,loadedPlugins:r,onToggleStyleEditor:i},a))),{id:"feature",titleId:"layerProperties.featureInfo",tooltipId:"layerProperties.featureInfo",glyph:"map-marker",visible:n&&Jn(a)&&er(a)&&!(a.element.featureInfo&&a.element.featureInfo.viewer),Component:rr,toolbar:[{glyph:"pencil",tooltipId:"layerProperties.editCustomFormat",visible:!a.showEditor&&a.element&&a.element.featureInfo&&"TEMPLATE"===a.element.featureInfo.format||!1,onClick:function(){return a.onShowEditor&&a.onShowEditor(!a.showEditor)}}]},{id:"elevation",titleId:"layerProperties.elevation",tooltipId:"layerProperties.elevation",glyph:"1-vector",visible:Jn(a)&&er(a)&&a.element.dimensions&&a.getDimension&&a.getDimension(a.element.dimensions,"elevation"),Component:Ee}].filter((function(e){return e.visible}))};var cr=(0,l.P1)([k.jN,k.l2,k.Bt,T.Pz,T.KV,function(e){return(0,R.ic)(e,{height:!0})},M.qg,N.Gd,N.tL,N.R4,k.Ci,I.wk],(function(e,t,n,r,o,i,a,l,c,s,u,p){return{settings:e,element:u,groups:n,currentLocale:r,currentLocaleLanguage:o,dockStyle:i,isAdmin:a,initialSettings:l,originalSettings:c,activeTab:s,isLocalizedLayerStylesEnabled:p}})),sr=(0,a.compose)((0,i.connect)(cr,{onHideSettings:u.sF,onUpdateSettings:u.VP,onUpdateNode:u.tV,onRetrieveLayerData:s.k,onUpdateOriginalSettings:c.Xg.bind(null,"layersettings","originalSettings"),onUpdateInitialSettings:c.Xg.bind(null,"layersettings","initialSettings"),onSetTab:c.Xg.bind(null,"layersettings","activeTab"),onUpdateParams:u.Xy,onToggleStyleEditor:p.Wv}),f.bR,(0,a.defaultProps)({getDimension:D.getDimension,enableLayerNameEditFeedback:!0}),(0,a.getContext)({loadedPlugins:o().object}),(0,a.withPropsOnChange)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.items,n=void 0===t?[]:t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.items;return n!==o}),(function(e){return{tabs:lr(e)}})))(A);const ur=(0,L.rx)("TOCItemsSettings",{component:sr,containers:{TOC:{doNotHide:!0,name:"TOCItemsSettings"}}})},75110:(e,t,n)=>{"use strict";n.d(t,{l2:()=>h,x:()=>b,CA:()=>g,dT:()=>v,pV:()=>w,_$:()=>O,Hi:()=>S,W6:()=>E,Bt:()=>P,NP:()=>j,Iz:()=>C,wA:()=>A,jN:()=>N,yj:()=>k,lI:()=>T,X_:()=>I,DP:()=>R,qh:()=>M,Rt:()=>D,Ci:()=>L,OX:()=>U,P_:()=>B,$z:()=>_});var r=n(22222),o=n(52259),i=n(7412),a=n(24262),l=n(18412),c=n(90183),s=n(7877),u=n(86494),p=n(59112),f=n(827);function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.layers,n=e.config;return t&&(0,u.isArray)(t)?t:t&&t.flat||n&&n.layers||[]},b=function(e){return(0,u.head)(h(e).filter((function(e){return e&&e.visibility&&"background"===e.group})))},g=function(e,t){return(0,u.head)(h(e).filter((function(e){return e.id===t})))},v=function(e,t){return(0,u.head)(h(e).filter((function(e){return e.name===t})))},w=function(e){return h(e).filter((function(e){return"background"===e.group}))},O=function(e){return(0,u.get)(e,"mapInfo.centerToMarker","")},S=(0,r.P1)([h,s.Dg,function(e){return e.search&&e.search},O,function(e){return(0,u.get)(e,"additionallayers",[])},function(e){return e.annotations&&e.annotations.showMarker&&e.annotations.clickPoint}],(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,s=o.filter((function(e){return"override"===e.actionType})),p=o.filter((function(e){return"overlay"===e.actionType})).map((function(e){return e.options})),f=e.map((function(e){var t=((0,u.head)(s.filter((function(t){return t.id===e.id})))||{}).options;return t?y(y({},e),t):y({},e)}));if(f=f.concat(p),t){f.push((0,i.su)("GetFeatureInfoHighLight",{features:t.features},void 0,{overrideOLStyle:!0,featuresCrs:t.featuresCrs,style:y(y({},l.be),{color:"#3388ff",weight:4,dashArray:"",fillColor:"#3388ff",fillOpacity:.2})}));var d="enabled"===r?(0,c.getNormalizedLatLon)(t.latlng):t.latlng;f.push((0,i.su)("GetFeatureInfo",d))}if(a){var m="enabled"===r?(0,c.getNormalizedLatLon)(a.latlng):a.latlng;f.push((0,i.su)("Annotations",m)),f.push((0,i.su)("GetFeatureInfo",y({},m)))}if(n&&n.markerPosition){var h=(0,u.isObject)(n.style)&&n.style||{};f.push((0,i.su)("GeoCoder",n.markerPosition,"marker",{overrideOLStyle:!0,style:y(y({},l.be),h)},n.markerLabel))}return f})),E=function(e){return e.layers&&e.layers.flat&&e.layers.groups||[]},P=function(e){return e.layers&&e.layers.flat&&e.layers.groups&&(0,a.denormalizeGroups)(e.layers.flat,e.layers.groups).groups||[]},j=function(e){return e.layers&&e.layers.selected||[]},x=function(e){return j(e).map((function(t){return(0,u.find)(h(e),{id:t})}))},C=function(e){var t=x(e)||[];return t&&t[0]},A=function(e){return e.layers&&e.layers.filter||""},N=function(e){return e.layers&&e.layers.settings||{expanded:!1,options:{opacity:1}}},k=function(e){return e.layers&&e.layers.layerMetadata||{expanded:!1,metadataRecord:{},maskLoading:!1}},T=function(e){return e.controls&&e.controls.layerdownload?{expanded:e.controls.layerdownload.enabled}:{expanded:!1}},I=function(e){return e.controls&&e.controls.backgroundSelector||{}},R=function(e){var t=I(e),n=w(e)||[];return t.currentLayer&&!(0,u.isEmpty)(t.currentLayer)?t.currentLayer:(0,u.head)(n.filter((function(e){return e.visibility})))||{}},M=function(e){var t=I(e),n=w(e)||[];return t.tempLayer&&!(0,u.isEmpty)(t.tempLayer)?t.tempLayer:(0,u.head)(n.filter((function(e){return e.visibility})))||{}},D=function(e,t){return(h(e)||[]).filter((function(e){return e&&e.dimensions&&(0,u.find)((0,u.castArray)(e.dimensions),{name:t})}))},L=function(e){var t=N(e),n=h(e),r=P(e);return"layers"===t.nodeType&&(0,u.isArray)(n)&&(0,u.head)(n.filter((function(e){return e.id===t.node})))||"groups"===t.nodeType&&(0,u.isArray)(r)&&(0,u.head)((0,p.yQ)(r,0,!0).filter((function(e){return e.id===t.node})))||{}},F=function(e,t){var n=(0,f.Od)(e)||{},r=(0,u.isNil)(n.resolution)?(0,o.getCurrentResolution)(Math.round(n.zoom),0,21,96):n.resolution;return(0,a.isInsideResolutionsLimits)(t,r)&&(0,i.y_)(t)},U=function(e){return h(e).filter((function(t){return F(e,t)}))},B=function(e){return"Error"===(C(e)||{}).loadingError},_=function(e){return x(e).filter((function(t){return F(e,t)}))}},38842:(e,t,n)=>{"use strict";n.d(t,{wk:()=>a,Yf:()=>l,c3:()=>c,fY:()=>s});var r=n(86494),o=n(22222),i=n(8316),a=function(e){return(0,r.has)(e,"localConfig.localizedLayerStyles")},l=function(e){var t=(0,r.get)(e,"localConfig.plugins.dashboard",[]),n=(0,r.find)(t,(function(e){return"DashboardEditor"===e.name}))||{};return(0,r.get)(n,"cfg.catalog.localizedLayerStyles",!1)},c=function(e){return(0,r.get)(e,"localConfig.localizedLayerStyles.name","mapstore_language")},s=(0,o.P1)(a,c,i.KV,(function(e,t,n){var r=[];return e&&r.push({name:t,value:n}),r}))},55105:(e,t,n)=>{"use strict";n.d(t,{Nr:()=>u,ic:()=>p,Jz:()=>d,VM:()=>y,CF:()=>m});var r=n(86494),o=n(827),i=n(52259);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=function(e){return e.maplayout&&e.maplayout.layout||{}},u=function(e){return e.maplayout&&e.maplayout.boundingMapRect||{}},p=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=s(e);return n&&Object.keys(n).filter((function(e){return t[e]})).reduce((function(e,t){return l(l({},e),{},c({},t,n[t]))}),{})||{}},f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=s(e),o=!!(0,r.head)(t.filter((function(e){return n[e.key]})).map((function(e){return"not"===e.type?n[e.key]!==e.value&&n[e.key]:n[e.key]===e.value})));return o},d=function(e){return f(e,[{key:"right",value:658}])},y=function(e){return f(e,[{key:"bottom",value:30,type:"not"}])},m=function(e){var t=(0,o.Od)(e),n=u(e);return n&&t&&t.size&&{left:(0,i.parseLayoutValue)(n.left,t.size.width),bottom:(0,i.parseLayoutValue)(n.bottom,t.size.height),right:(0,i.parseLayoutValue)(n.right,t.size.width),top:(0,i.parseLayoutValue)(n.top,t.size.height)}}},43143:(e,t,n)=>{"use strict";n.d(t,{qH:()=>l,qj:()=>c,qq:()=>s});var r,o=n(17621),i=n.n(o),a=n(86494),l=function(e,t,n,o){var i=e;isNaN(parseFloat(e))&&(i=r.hexToHsv(e)[0]);var a=.5/(n-1),l=t/(n-1),c=[];1===n&&(a=.5,l=t/2);for(var s=0;s<n;s++){var u=i+s*l-t/2,p=a*s+.3,f=p;o&&(u=o.h||u,p=o.s||p,f=o.v||f),c.push(r.hsvToHex(u,p,f,s))}return c},c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"red";return i()(e).toHexString()},s=function(e,t,n){var r=i()(e);return e&&r.setAlpha((0,a.toNumber)(void 0!==t?t:r.getAlpha())).toRgbString()||n};r={decToHex:function(e){var t="0123456789ABCDEF",n=parseInt(e,10);return n=isNaN(n)?0:n,t.charAt(((n=n>255||n<0?0:n)-n%16)/16)+t.charAt(n%16)},rgbToHex:function(e,t,n){return e instanceof Array?r.rgbToHex(e[0],e[1],e[2]):"#"+r.decToHex(e)+r.decToHex(t)+r.decToHex(n)},realToDec:function(e){return Math.min(255,Math.round(256*e))},rgbToHsv:function(e,t,n){if(e instanceof Array)return r.rgbToHsv(e[0],e[1],e[2]);var o,i,a,l,c,s=e/255,u=t/255,p=n/255;switch(o=Math.min(Math.min(s,u),p),a=(i=Math.max(Math.max(s,u),p))-o,i){case o:l=0;break;case s:l=60*(u-p)/a,u<p&&(l+=360);break;case u:l=60*(p-s)/a+120;break;case p:l=60*(s-u)/a+240}return c=0===i?0:1-o/i,[Math.round(l),c,i]},distributedColorsHEX:function(e){for(var t=360/(e-1),n=[],o=function e(t,n,o){var i=e(t,n,o);return r.rgbToHex(i)},i=0;i<e;i++)n.push(o(t*i,.57,.63));return n},sameToneRangeColors:l,hsvToRgb:function(e,t,n){if(e instanceof Array)return r.hsvToRgb(e[0],e[1],e[2]);var o,i,a,l=Math.floor(e/60%6),c=e/60-l,s=n*(1-t),u=n*(1-c*t),p=n*(1-(1-c)*t);switch(l){case 0:o=n,i=p,a=s;break;case 1:o=u,i=n,a=s;break;case 2:o=s,i=n,a=p;break;case 3:o=s,i=u,a=n;break;case 4:o=p,i=s,a=n;break;case 5:o=n,i=s,a=u}return[r.realToDec(o),r.realToDec(i),r.realToDec(a)]},hsvToHex:function(e,t,n){var o=r.hsvToRgb(e,t,n);return r.rgbToHex(o)},hexToHsv:function(e){var t=e;if(t.length>0){"#"===t[0]&&(t=e.substring(1));var n=r.hexToRgb(t);return r.rgbToHsv(n)}return null},hexToRgb:function(e){var t,n,r,o=e;return"#"===o.charAt(0)&&(o=e.substring(1)),t=o.charAt(0)+o.charAt(1),n=o.charAt(2)+o.charAt(3),r=o.charAt(4)+o.charAt(5),[parseInt(t,16),parseInt(n,16),parseInt(r,16)]},colorToHexStr:c,colorToRgbaStr:s}},18412:(e,t,n)=>{"use strict";n.d(t,{be:()=>l,zA:()=>c,Tv:()=>s});var r=n(70290),o=n.n(r),i=n(45507),a=n.n(i),l={iconUrl:o(),shadowUrl:a(),iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]},c=function(e){return"single_layer"===(null==e?void 0:e.launchInfoPanel)&&!(null==e||!e.openFeatureInfoButtonEnabled)},s=function(e,t){return!!e&&((null==t?void 0:t.forceSearchLayerVisibility)||!!e.visibility)}},59112:(e,t,n)=>{"use strict";n.d(t,{LT:()=>a,BC:()=>c,yQ:()=>s,fu:()=>u});var r=n(86494),o=n(24262),i=n(86638),a=function(e,t){var n=RegExp("^/|/$|/{2,}");if(0===t.length||e.map((function(e){return e.label})).indexOf(t)>-1||n.test(t))return null;var r=t.replace(/\./g,"${dot}").replace(/\//g,".");return{label:t,value:r}},l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"title",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:" - ";switch(e){case"title":var i=(0,r.isObject)(t.title)?t.title[n]||t.title.default:t.title,a=i||t.name||"";return a;case"description":var l=t.description||"";return l;case"both":var c=(0,r.isObject)(t.title)?t.title[n]||t.title.default:t.title,s=c||t.nam||"",u=t.description||"";return"".concat(s).concat(o&&u?o:"").concat(u);default:return t[e]}},c=function(e){var t=e.node,n=e.currentLocale,r=e.tooltipOptions,o=void 0===r?{separator:" - ",maxLength:807}:r,i=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" - ";return l(e.tooltipOptions,e,t,n)}(t,n,o.separator)||"";return(i=i&&i.substring(0,o.maxLength)).length===o.maxLength&&(i+="..."),{title:l("title",t,n,o.separator),tooltipText:i}},s=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t.filter((function(e){return e.nodes})).reduce((function(t,o){return t.push(r?o:{label:o.id.replace(/\./g,"/").replace(/\${dot}/g,"."),value:o.id}),o.nodes.length>0?t.concat(e(o.nodes,n+1,r)):t}),[])},u=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.replace(/[^\.\/]+/g,(function(e){var n=(0,r.get)((0,o.getGroupByName)(e,t),"title");return(0,r.isObject)(n)?n[(0,i.Kd)()]||n.default:t&&n||e}));return(n=n.replace(/\./g,"/")).replace(/\${dot}/g,".")}},66287:(e,t,n)=>{"use strict";n.r(t),n.d(t,{isAttrPresent:()=>h,isStrokeStyle:()=>b,isFillStyle:()=>g,isTextStyle:()=>v,isCircleStyle:()=>w,isMarkerStyle:()=>O,isSymbolStyle:()=>S,getStylerTitle:()=>E,geometryFunctions:()=>P,getGeometryFunction:()=>j,registerGeometryFunctions:()=>x,addOpacityToColor:()=>C,hashCode:()=>A,registerStyle:()=>k,setSymbolsStyles:()=>T,fetchStyle:()=>I,getSymbolsStyles:()=>R,hashAndStringify:()=>M,domNodeToString:()=>D,createSvgUrl:()=>L,createStylesAsync:()=>F,getStyleParser:()=>U});var r=n(86494),o=n(61868),i=n(43143),a=n(9669),l=n.n(a),c=n(42757),s=n.n(c),u=n(50436),p=n.n(u);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){y(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var m={sld:new(s()),css:new(p())},h=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return t.filter((function(t){return!(0,r.isNil)(e[t])})).length>0},b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["color","opacity","dashArray","dashOffset","lineCap","lineJoin","weight"];return h(e,t)},g=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["fillColor","fillOpacity"];return h(e,t)},v=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["label","font","fontFamily","fontSize","fontStyle","fontWeight","textAlign","textRotationDeg"];return h(e,t)},w=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["radius"];return h(e,t)},O=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["iconGlyph","iconShape","iconUrl"];return h(e,t)},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["symbolUrl"];return h(e,t)},E=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O(e)?"Marker":S(e)?"Symbol":v(e)?"Text":w(e)||"Circle Style"===e.title?"Circle":g(e)?"Polygon":b(e)?"Polyline":""},P={centerPoint:{type:"Point",func:function(){}},lineToArc:{type:"LineString",func:function(){}},startPoint:{type:"Point",func:function(){}},endPoint:{type:"Point",func:function(){}}},j=function(e,t){return P[e]&&P[e][t]},x=function(e,t,n){if(!(e&&t&&n))throw new Error("specify all the params: functionName, func, type");P[e]={func:t,type:n}},C=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#FFCC33",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2;return(0,o.t8)("a",t,e)},A=function(e){var t,n=0;if(0===e.length)return n;for(t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return n},N={},k=function(e,t){if(!e||!t)throw new Error("specify all the params: sha, style");N[e]=t},T=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};N=e},I=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"style";return N[e]&&N[e][t]},R=function(){return N},M=function(e){if(e)return A(JSON.stringify(e));throw new Error("hashAndStringify: specify mandatory params: style")},D=function(e){var t=document.createElement("div");return t.appendChild(e),t.innerHTML},L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return S(e)&&e.symbolUrl?l().get(t,{"Content-Type":"image/svg+xml;charset=utf-8"}).then((function(t){var n=window.URL||window.webkitURL||window,o=(new DOMParser).parseFromString(t.data,"image/svg+xml").firstElementChild;o.setAttribute("fill",e.fillColor||"#FFCC33"),o.setAttribute("fill-opacity",(0,r.isNil)(e.fillOpacity)?.2:e.fillOpacity),o.setAttribute("stroke",(0,i.qq)(e.color||"#FFCC33",(0,r.isNil)(e.opacity)?1:e.opacity)),o.setAttribute("stroke-opacity",(0,r.isNil)(e.opacity)?1:e.opacity),o.setAttribute("stroke-width",e.weight||1),o.setAttribute("width",e.size||32),o.setAttribute("height",e.size||32),o.setAttribute("stroke-dasharray",e.dashArray||"none");var a=new Blob([D(o)],{type:"image/svg+xml;charset=utf-8"}),l=n.createObjectURL(a),c=document.createElement("canvas");c.width=e.size,c.height=e.size;var s=c.getContext("2d"),u=new Image;u.src=l;var p="",f=M(e);return u.onload=function(){try{s.drawImage(u,c.width/2-u.width/2,c.height/2-u.height/2),p=c.toDataURL("image/png"),c=null,k(f,{style:d(d({},e),{},{symbolUrlCustomized:l}),base64:p})}catch(e){return}},k(f,{style:d(d({},e),{},{symbolUrlCustomized:l}),svg:o,base64:p}),l})).catch((function(){return n(70898)})):new Promise((function(e){e(null)}))},F=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map((function(e){return S(e)&&!I(M(e))?L(e,e.symbolUrl||e.symbolUrlCustomized).then((function(t){return t?d(d({},e),{},{symbolUrlCustomized:t}):I(M(e))})).catch((function(){return d(d({},e),{},{symbolUrlCustomized:n(70898)})})):new Promise((function(t){t(S(e)?I(M(e)):e)}))}))},U=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"sld";return m[e]}},39156:(e,t,n)=>{function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=n(2245),l=n(86494).castArray,c=n(78889).wfsToGmlVersion,s=function(e){return'service="WFS" version="'+e+'" '+("1.0.0"===e?'outputFormat="GML2" ':"")+'xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs '+"http://schemas.opengis.net/wfs/".concat(e,"1.0.0"===e?'/WFS-basic.xsd"':'/wfs.xsd"')},u=function(e){return'service="WFS" version="'+e+'" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd"'};e.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.wfsVersion,n=void 0===t?"1.1.0":t,r=e.gmlVersion,i=e.filterNS,p=e.wfsNS,f=void 0===p?"wfs":p,d=r;!d&&n?d=c(n):d||(d="3.1.1");var y=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.viewParams,r=e.resultType,o=e.outputFormat,i=e.startIndex,a=e.maxFeatures,l=function(e){return 0===n.indexOf("2.")?'count="'.concat(e,'"'):'maxFeatures="'.concat(e,'"')};return(0===n.indexOf("1.")?s(n):u(n))+(r?' resultType="'.concat(r,'"'):"")+(o?' outputFormat="'.concat(o,'"'):"")+(i||0===i?' startIndex="'.concat(i,'"'):"")+(a||0===a?" ".concat(l(a)):"")+(t?' viewParams="'.concat(t,'"'):"")},m=function(e){return l(e).map((function(e){return"<".concat("2.0"===n?"fes":"ogc",":PropertyName>").concat(e,"</").concat("2.0"===n?"fes":"ogc",":PropertyName>")})).join("")};return o(o({propertyName:m},a({gmlVersion:d,wfsVersion:n,filterNS:i||"2.0"===n?"fes":"ogc"})),{},{getFeature:function(e,t){return"<".concat(f,":GetFeature ").concat(y(t),">").concat(Array.isArray(e)?e.join(""):e,"</").concat(f,":GetFeature>")},sortBy:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ASC";return"<".concat(f,":SortBy><").concat(f,":SortProperty>").concat(m(e),"<").concat(f,":SortOrder>").concat(t,"</").concat(f,":SortOrder></").concat(f,":SortProperty></").concat(f,":SortBy>")},query:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.srsName,i=void 0===o?"EPSG:4326":o;return"<".concat(f,":Query ").concat("2.0"===n?"typeNames":"typeName",'="').concat(e,'" srsName="').concat(i,'">')+"".concat(Array.isArray(t)?t.join(""):t)+"</".concat(f,":Query>")}})}},83775:(e,t,n)=>{(e.exports=n(9252)()).push([e.id,".msgapi #mapstore-elevation {\n width: 100%;\n /*margin-top: -46px;*/\n height: 80px;\n padding: 0 5px;\n}\n\n.msgapi label#mapstore-elevation-label {\n margin-top: 10px;\n}\n\n.msgapi .custom-tooltip {\n width: auto;\n margin: 0;\n line-height: 24px;\n border: 1px solid #C1C1C1;\n background-color: rgba(255, 255, 255, 0.8);\n padding: 5px;\n}\n.msgapi .custom-tooltip .label {\n margin: 0;\n color: #82CA9D;\n font-weight: bold;\n font-size: 16px;\n}\n",""])},85323:(e,t,n)=>{(e.exports=n(9252)()).push([e.id,'\n\n.msgapi .ql-snow .ms-ql-iframe-tooltip[data-mode=video]::before {\n content: "Enter iframe url:";\n}\n\n\n',""])},70898:(e,t,n)=>{e.exports=n.p+"symbolMissing.svg"},12485:e=>{e.exports='<html>\n <head>\n <title>Geoserver GetFeatureInfo output</title>\n </head>\n <style type="text/css">\n \ttable.featureInfo, table.featureInfo td, table.featureInfo th {\n \t\tborder:1px solid #ddd;\n \t\tborder-collapse:collapse;\n \t\tmargin:0;\n \t\tpadding:0;\n \t\tfont-size: 90%;\n \t\tpadding:.2em .1em;\n \t}\n \ttable.featureInfo th {\n \t padding:.2em .2em;\n \t\tfont-weight:bold;\n \t\tbackground:#eee;\n \t}\n \ttable.featureInfo td{\n \t\tbackground:#fff;\n \t}\n \ttable.featureInfo tr.odd td{\n \t\tbackground:#eee;\n \t}\n \ttable.featureInfo caption{\n \t\ttext-align:left;\n \t\tfont-size:100%;\n \t\tfont-weight:bold;\n \t\tpadding:.2em .2em;\n \t}\n </style>\n <body>\n <table class="featureInfo">\n <caption class="featureInfo">states</caption>\n <tr>\n <th>fid</th>\n <th >STATE_NAME</th>\n <th >STATE_FIPS</th>\n <th >SUB_REGION</th>\n <th >STATE_ABBR</th>\n <th >LAND_KM</th>\n </tr>\n <tr>\n <td>states.29</td>\n <td>Wyoming</td>\n <td>56</td>\n <td>Mtn</td>\n <td>WY</td>\n <td>251500.801</td>\n </tr>\n </table>\n <br/>\n </body>\n</html>'},20135:e=>{e.exports='{\n "type": "FeatureCollection",\n "totalFeatures": "unknown",\n "features": [\n {\n "type": "Feature",\n "id": "states.29",\n "geometry": {\n "type": "MultiPolygon",\n "coordinates": [\n [\n [\n [-1.15831389980175E7, 5115884.78673627],\n [-1.158334883525764E7, 5095927.61163692],\n [-1.158318319185534E7, 5069757.00399456],\n [-1.158292671174856E7, 5012817.65726345],\n [-1.168119588467766E7, 5011501.68893432],\n [-1.171952218348237E7, 5011805.51696107],\n [-1.182245230349099E7, 5012358.03633596],\n [-1.183643948618967E7, 5012535.77548496],\n [-1.189613934986567E7, 5012118.79424704],\n [-1.194496385588862E7, 5012366.44384074],\n [-1.201338092624966E7, 5012844.6510808],\n [-1.213912753436923E7, 5012116.58180143],\n [-1.224530617975818E7, 5011994.45558498],\n [-1.225209889508638E7, 5012037.8190659],\n [-1.23620611786479E7, 5011845.33978484],\n [-1.236213086464914E7, 5050542.48847943],\n [-1.236206540878855E7, 5098070.44035716],\n [-1.236180135895639E7, 5160419.97558219],\n [-1.23615872915756E7, 5236675.5279452],\n [-1.236185657342383E7, 5315010.76063796],\n [-1.236166543785814E7, 5355424.25785557],\n [-1.236158395199088E7, 5390784.55533999],\n [-1.236198815306194E7, 5462754.83859328],\n [-1.236211728367126E7, 5538995.97145504],\n [-1.236212318360428E7, 5568867.31982516],\n [-1.236232444924363E7, 5620854.95417318],\n [-1.229288824894438E7, 5620316.91583206],\n [-1.2288781895568E7, 5621314.94100872],\n [-1.224456390139357E7, 5621970.64383454],\n [-1.222273014174734E7, 5621455.36603028],\n [-1.209203215399677E7, 5621150.43241323],\n [-1.205128866376898E7, 5621546.67495262],\n [-1.201067341359458E7, 5621492.04691732],\n [-1.182865814246373E7, 5620919.18090556],\n [-1.180215653392956E7, 5621084.9446589],\n [-1.169794913408358E7, 5621495.03806919],\n [-1.169313957548385E7, 5621693.24344854],\n [-1.158383374295954E7, 5621104.15015297],\n [-1.158379210946998E7, 5554761.48947335],\n [-1.158396710370951E7, 5493626.06569343],\n [-1.158382183177402E7, 5488039.68771347],\n [-1.158379377926234E7, 5442710.58976854],\n [-1.158361967557875E7, 5388962.94229949],\n [-1.158375815702529E7, 5385191.61647555],\n [-1.158342865133254E7, 5312442.79715209],\n [-1.15834303211249E7, 5253508.54391938],\n [-1.158312797738791E7, 5160957.12459852],\n [-1.15831389980175E7, 5115884.78673627]\n ]\n ]\n ]\n },\n "geometry_name": "the_geom",\n "properties": {\n "STATE_NAME": "Wyoming",\n "STATE_FIPS": "56",\n "SUB_REGION": "Mtn",\n "STATE_ABBR": "WY",\n "LAND_KM": 251500.801,\n "WATER_KM": 1848.149,\n "PERSONS": 453588,\n "FAMILIES": 119825,\n "HOUSHOLD": 168839,\n "MALE": 227007,\n "FEMALE": 226581,\n "WORKERS": 164561,\n "DRVALONE": 153679,\n "CARPOOL": 28109,\n "PUBTRANS": 2963,\n "EMPLOYED": 207868,\n "UNEMPLOY": 13112,\n "SERVICE": 71419,\n "MANUAL": 29157,\n "P_MALE": 0.5,\n "P_FEMALE": 0.5,\n "SAMP_POP": 83202,\n "bbox": [-1.236232444924363E7, 5011501.68893432, -1.158292671174856E7, 5621970.64383454]\n }\n }],\n "crs": {\n "type": "name",\n "properties": {\n "name": "urn:ogc:def:crs:EPSG::3857"\n }\n },\n "bbox": [-1.236232444924363E7, 5011501.68893432, -1.158292671174856E7, 5621970.64383454]\n}'},71062:e=>{e.exports="Results for FeatureType 'http://www.openplans.org/topp:states':\n--------------------------------------------\nthe_geom = [GEOMETRY (Polygon) with 48 points]\nSTATE_NAME = Wyoming\nSTATE_FIPS = 56\nSUB_REGION = Mtn\nSTATE_ABBR = WY\nLAND_KM = 251500.801\nWATER_KM = 1848.149\nPERSONS = 453588.0\nFAMILIES = 119825.0\nHOUSHOLD = 168839.0\nMALE = 227007.0\nFEMALE = 226581.0\nWORKERS = 164561.0\nDRVALONE = 153679.0\nCARPOOL = 28109.0\nPUBTRANS = 2963.0\nEMPLOYED = 207868.0\nUNEMPLOY = 13112.0\nSERVICE = 71419.0\nMANUAL = 29157.0\nP_MALE = 0.5\nP_FEMALE = 0.5\nSAMP_POP = 83202.0\n--------------------------------------------"},57845:(e,t,n)=>{var r=n(83775);"string"==typeof r&&(r=[[e.id,r,""]]),n(14246)(r,{}),r.locals&&(e.exports=r.locals)},89531:(e,t,n)=>{var r=n(85323);"string"==typeof r&&(r=[[e.id,r,""]]),n(14246)(r,{}),r.locals&&(e.exports=r.locals)},18845:(e,t,n)=>{e.exports=n.p+"MapStore2/web/client/components/style/vector/iconNotFound.png"},70290:e=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QwKDiknI+uvvgAABttJREFUWMOll2uMVVcVx/9773PuPY/7mBcUZ4q1JmbiF6nQwtSY2pSYtobCB2yMrxhrHGOrfioEjQYlMWikH7TxUWNbjTFWU6gComm1UEgMAi20kFCrIMPMFIZ53Xvn3vPYZ++1/HBh6GVmmDu6k/+Xk/1fv7Mfa61zBDOjnfHihzZ1Gcg+YcUyCZrkvPf2A4efG2/HK24G+cuHN/cLS59nIT7DzH1Syli5jrGZUUTkKyGuAPa3RPTsA0f3vbEkyHfEBrlunbMVUn47LBYRhkE+7/uQORdCCDAzyAA6mkEURbpWqQpm/l4Q0I57X95rFoUcWLvxvazk71039/5b+noDVymQzsCZAWcZ2BKEkhCuC+E6kDkXmbUYv3QpylJ9zhj58EPHd/9zQcgf1228Xwnxh3Jnp+rq6XE5TmAb8aJ7rnwPIvQxPTlppicnLQGf3PSPvS/Mgey/c1OPVfzv3t7ecuj7MJUZsLVodwil4JQKiHSKS6OjDaFs/4a//2kUAOS1SVbxLwulkhd4HvTENMgYMPMcQcp5n5Mx0FMV+Pk8iuWyY6369bXYEgCeX7vh06zk+lu6O/O2WgeIWiQdB25nAbmeLsiOInI9XXA7y5A5d85cW62jp6s7L5Qa2LP2oS8CgNi3ZmOQCjP+7t6+wIOEnWm0bINT8kGej/FqBY1GAyZJoVwHQamE5YUSlCWYWgUgef2MiiESEIYuvZ14pLqdBOlq5eRF6Oehr0wAdP0iqDBAKhSGRoax8v6P4M5PbULxtlvRGB3Dud0HcG7Pn7Gyuwee77W8nJ2pIlzeA6UUJZSuVpv7+jcHfmF9yVGujTIAAoCAUA5URwEj01Po/8InsOprj8Dr6oCQEvmOElbcvQb+imV462+H0VXsAGcWbLnpZwHpKjQMmyTL3pSC+Z4w7/qkM4CuS7gOalECUS6g/7Ob571R7/nYfQhvX4npRh0yl2vxk84Q5l1fMN8jCRjwXQVOdXOrrko6AnGaYtldqyCEWPDqrhhYjcSkEIpb/Jxq+K4CAQOOIRs0SwWBmWbNzAzLBKdQWDQRzdVMaPUThBAgIl8COBUlCYRSrW+SZcgrB2Ovvn5TyNjJM8iznbMTQilESQICn5RE4nAjzTKhVIuZkhTlvIvKW+cxfOTYvIDx02dx+ehr6PQDkM7mVIAo0dqyfEUaaY5X01gLpcDWzoqSFCJO0Vcs4OCWHXjz+f0g0yywRITzL76Cl778dbyrWIbKLGwjavELpVBNG9rAHBdPf/DeXmZ3eE3frZKmKuDsHZVaSridZTTY4kK9jjiOUVqxHPUr41Cui9uLJZScHMzEOJivJ6NwHciuDrw6Omxh0CeYGc/c8dFjt5XLd/VIF7Y607JsFhaqWG4mJlskWiPv5uBJBYpmYGp1CG7dalUuYoIyHqpWjz1y6qUBBwA0xK6Rev3Z5cuXBaZmm3VolgLY6jSoVoHMuSg4Dqheh87M7DwGtaxeeg5Gx6ZiDfH92QIpnfgFbYyu6QzSC5t16AaxFeDYwM4k4NgABvPOk16ISqKRWlvvfrBz7yxk8MSRjMA/uVyvxcp3wJy1XMe2BUCFPkYb9dgyPfHwzt/Z1n5i7ZMTSaoispCBD+ZsyZKBi7qOUE0TYTN6uqWfAMCjZw5dBvDk0EwUK99rNqgbesVNBUAGPi7W6zGAJx47e2hyDgQAjLY7KzpB3WRQoT9vB1xIMvAxk2nMZJaEq3/wzrgtkMfOHppkIXZdjKJYhcHV1G9vFSr0MdRoRATeOXjiSHVBCAAYL7erZqyt6RQqDCAYi8ophKjpFI3MGGvtD2+MOQfylaMHaoL5u0NxGsvAB4FBRAuKBSB8DxeiKCLJOx49c6i+KAQAkMt+FFubVrMUTiGEYF5QquihohPElhK/OvHj+cLNCxk8cSQi8PahNItl4Deb1jxnIYSA9EIMpVnMQnzrc/85nbQNAQAd0VOptfUpnUAW8vPeKFEMMaUTpNbUum3wi4ViLQj56r8Oppbpm8OZjYUfAlK2ZreUkF4ew1kWk5Tf+PiZfXrJEAAY637fM5poekqnUGEOID0rp5DHlE6RWprofrD7VzeLc1PI9oNPGSuw7SJx82xU8xNVKAkEHoZslhCw7VqN+p8gADD2uvebzJrL45mBLIQAEVSxgCvawBBGx04Hzy0WY1HIdt5PLMTWEUKCwIfwPbDvYYQ4gZRbt/N++r8hAPCluw/uNmQvjFtit7OMK8YyEZ0fPPXXPe3424LgZ8RWyceHGVoTYQQiA7Cl7X+Xdv9+AeDnH7jvtbzAHSnj5OAbL69p1yexhMFCPJ5ACBZiC5ZkXELPYGb8dNX6bUv1/Bd7pfPVmVDtrAAAAABJRU5ErkJggg=="},45507:e=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC"}}]);
class Solution: def canVisitAllRooms(self, rooms: List[List[int]]) -> bool: # we use this below list for checking whether all list have been visited or not visited=[False]*len(rooms) # per condition room 0 is always unlocked visited[0]=True #we use stack for acquiring key to next room so as to visit that room # we have initialised stack with room 0 stack=[0] #we then start visiting other rooms while stack: # imagine rooms as nodes of graphs and keys as edge? node=stack.pop() # we at any given time stack will contain the next room number for key in rooms[node]: # we check whether the current room was already visited or not if not visited[key]: # we set the flag true since it was not previously visited visited[key]=True #we add the key to stack stack.append(key) return all(visited)
# -*- coding: utf-8 -*- from datetime import datetime import numpy as np import pytest from pandas.core.dtypes.common import is_float_dtype, is_integer_dtype from pandas.core.dtypes.dtypes import CategoricalDtype import pandas as pd from pandas import ( Categorical, CategoricalIndex, DatetimeIndex, Index, Interval, IntervalIndex, NaT, Series, Timestamp, date_range, period_range, timedelta_range) import pandas.util.testing as tm class TestCategoricalConstructors(object): def test_validate_ordered(self): # see gh-14058 exp_msg = "'ordered' must either be 'True' or 'False'" exp_err = TypeError # This should be a boolean. ordered = np.array([0, 1, 2]) with pytest.raises(exp_err, match=exp_msg): Categorical([1, 2, 3], ordered=ordered) with pytest.raises(exp_err, match=exp_msg): Categorical.from_codes([0, 0, 1], categories=['a', 'b', 'c'], ordered=ordered) def test_constructor_empty(self): # GH 17248 c = Categorical([]) expected = Index([]) tm.assert_index_equal(c.categories, expected) c = Categorical([], categories=[1, 2, 3]) expected = pd.Int64Index([1, 2, 3]) tm.assert_index_equal(c.categories, expected) def test_constructor_empty_boolean(self): # see gh-22702 cat = pd.Categorical([], categories=[True, False]) categories = sorted(cat.categories.tolist()) assert categories == [False, True] def test_constructor_tuples(self): values = np.array([(1,), (1, 2), (1,), (1, 2)], dtype=object) result = Categorical(values) expected = Index([(1,), (1, 2)], tupleize_cols=False) tm.assert_index_equal(result.categories, expected) assert result.ordered is False def test_constructor_tuples_datetimes(self): # numpy will auto reshape when all of the tuples are the # same len, so add an extra one with 2 items and slice it off values = np.array([(Timestamp('2010-01-01'),), (Timestamp('2010-01-02'),), (Timestamp('2010-01-01'),), (Timestamp('2010-01-02'),), ('a', 'b')], dtype=object)[:-1] result = Categorical(values) expected = Index([(Timestamp('2010-01-01'),), (Timestamp('2010-01-02'),)], tupleize_cols=False) tm.assert_index_equal(result.categories, expected) def test_constructor_unsortable(self): # it works! arr = np.array([1, 2, 3, datetime.now()], dtype='O') factor = Categorical(arr, ordered=False) assert not factor.ordered # this however will raise as cannot be sorted with pytest.raises(TypeError): Categorical(arr, ordered=True) def test_constructor_interval(self): result = Categorical([Interval(1, 2), Interval(2, 3), Interval(3, 6)], ordered=True) ii = IntervalIndex([Interval(1, 2), Interval(2, 3), Interval(3, 6)]) exp = Categorical(ii, ordered=True) tm.assert_categorical_equal(result, exp) tm.assert_index_equal(result.categories, ii) def test_constructor(self): exp_arr = np.array(["a", "b", "c", "a", "b", "c"], dtype=np.object_) c1 = Categorical(exp_arr) tm.assert_numpy_array_equal(c1.__array__(), exp_arr) c2 = Categorical(exp_arr, categories=["a", "b", "c"]) tm.assert_numpy_array_equal(c2.__array__(), exp_arr) c2 = Categorical(exp_arr, categories=["c", "b", "a"]) tm.assert_numpy_array_equal(c2.__array__(), exp_arr) # categories must be unique with pytest.raises(ValueError): Categorical([1, 2], [1, 2, 2]) with pytest.raises(ValueError): Categorical(["a", "b"], ["a", "b", "b"]) # The default should be unordered c1 = Categorical(["a", "b", "c", "a"]) assert not c1.ordered # Categorical as input c1 = Categorical(["a", "b", "c", "a"]) c2 = Categorical(c1) tm.assert_categorical_equal(c1, c2) c1 = Categorical(["a", "b", "c", "a"], categories=["a", "b", "c", "d"]) c2 = Categorical(c1) tm.assert_categorical_equal(c1, c2) c1 = Categorical(["a", "b", "c", "a"], categories=["a", "c", "b"]) c2 = Categorical(c1) tm.assert_categorical_equal(c1, c2) c1 = Categorical(["a", "b", "c", "a"], categories=["a", "c", "b"]) c2 = Categorical(c1, categories=["a", "b", "c"]) tm.assert_numpy_array_equal(c1.__array__(), c2.__array__()) tm.assert_index_equal(c2.categories, Index(["a", "b", "c"])) # Series of dtype category c1 = Categorical(["a", "b", "c", "a"], categories=["a", "b", "c", "d"]) c2 = Categorical(Series(c1)) tm.assert_categorical_equal(c1, c2) c1 = Categorical(["a", "b", "c", "a"], categories=["a", "c", "b"]) c2 = Categorical(Series(c1)) tm.assert_categorical_equal(c1, c2) # Series c1 = Categorical(["a", "b", "c", "a"]) c2 = Categorical(Series(["a", "b", "c", "a"])) tm.assert_categorical_equal(c1, c2) c1 = Categorical(["a", "b", "c", "a"], categories=["a", "b", "c", "d"]) c2 = Categorical(Series(["a", "b", "c", "a"]), categories=["a", "b", "c", "d"]) tm.assert_categorical_equal(c1, c2) # This should result in integer categories, not float! cat = Categorical([1, 2, 3, np.nan], categories=[1, 2, 3]) assert is_integer_dtype(cat.categories) # https://github.com/pandas-dev/pandas/issues/3678 cat = Categorical([np.nan, 1, 2, 3]) assert is_integer_dtype(cat.categories) # this should result in floats cat = Categorical([np.nan, 1, 2., 3]) assert is_float_dtype(cat.categories) cat = Categorical([np.nan, 1., 2., 3.]) assert is_float_dtype(cat.categories) # This doesn't work -> this would probably need some kind of "remember # the original type" feature to try to cast the array interface result # to... # vals = np.asarray(cat[cat.notna()]) # assert is_integer_dtype(vals) # corner cases cat = Categorical([1]) assert len(cat.categories) == 1 assert cat.categories[0] == 1 assert len(cat.codes) == 1 assert cat.codes[0] == 0 cat = Categorical(["a"]) assert len(cat.categories) == 1 assert cat.categories[0] == "a" assert len(cat.codes) == 1 assert cat.codes[0] == 0 # Scalars should be converted to lists cat = Categorical(1) assert len(cat.categories) == 1 assert cat.categories[0] == 1 assert len(cat.codes) == 1 assert cat.codes[0] == 0 # two arrays # - when the first is an integer dtype and the second is not # - when the resulting codes are all -1/NaN with tm.assert_produces_warning(None): c_old = Categorical([0, 1, 2, 0, 1, 2], categories=["a", "b", "c"]) # noqa with tm.assert_produces_warning(None): c_old = Categorical([0, 1, 2, 0, 1, 2], # noqa categories=[3, 4, 5]) # the next one are from the old docs with tm.assert_produces_warning(None): c_old2 = Categorical([0, 1, 2, 0, 1, 2], [1, 2, 3]) # noqa cat = Categorical([1, 2], categories=[1, 2, 3]) # this is a legitimate constructor with tm.assert_produces_warning(None): c = Categorical(np.array([], dtype='int64'), # noqa categories=[3, 2, 1], ordered=True) def test_constructor_not_sequence(self): # https://github.com/pandas-dev/pandas/issues/16022 with pytest.raises(TypeError): Categorical(['a', 'b'], categories='a') def test_constructor_with_null(self): # Cannot have NaN in categories with pytest.raises(ValueError): Categorical([np.nan, "a", "b", "c"], categories=[np.nan, "a", "b", "c"]) with pytest.raises(ValueError): Categorical([None, "a", "b", "c"], categories=[None, "a", "b", "c"]) with pytest.raises(ValueError): Categorical(DatetimeIndex(['nat', '20160101']), categories=[NaT, Timestamp('20160101')]) def test_constructor_with_index(self): ci = CategoricalIndex(list('aabbca'), categories=list('cab')) tm.assert_categorical_equal(ci.values, Categorical(ci)) ci = CategoricalIndex(list('aabbca'), categories=list('cab')) tm.assert_categorical_equal(ci.values, Categorical(ci.astype(object), categories=ci.categories)) def test_constructor_with_generator(self): # This was raising an Error in isna(single_val).any() because isna # returned a scalar for a generator xrange = range exp = Categorical([0, 1, 2]) cat = Categorical((x for x in [0, 1, 2])) tm.assert_categorical_equal(cat, exp) cat = Categorical(xrange(3)) tm.assert_categorical_equal(cat, exp) # This uses xrange internally from pandas.core.index import MultiIndex MultiIndex.from_product([range(5), ['a', 'b', 'c']]) # check that categories accept generators and sequences cat = Categorical([0, 1, 2], categories=(x for x in [0, 1, 2])) tm.assert_categorical_equal(cat, exp) cat = Categorical([0, 1, 2], categories=xrange(3)) tm.assert_categorical_equal(cat, exp) @pytest.mark.parametrize("dtl", [ date_range("1995-01-01 00:00:00", periods=5, freq="s"), date_range("1995-01-01 00:00:00", periods=5, freq="s", tz="US/Eastern"), timedelta_range("1 day", periods=5, freq="s") ]) def test_constructor_with_datetimelike(self, dtl): # see gh-12077 # constructor with a datetimelike and NaT s = Series(dtl) c = Categorical(s) expected = type(dtl)(s) expected.freq = None tm.assert_index_equal(c.categories, expected) tm.assert_numpy_array_equal(c.codes, np.arange(5, dtype="int8")) # with NaT s2 = s.copy() s2.iloc[-1] = NaT c = Categorical(s2) expected = type(dtl)(s2.dropna()) expected.freq = None tm.assert_index_equal(c.categories, expected) exp = np.array([0, 1, 2, 3, -1], dtype=np.int8) tm.assert_numpy_array_equal(c.codes, exp) result = repr(c) assert "NaT" in result def test_constructor_from_index_series_datetimetz(self): idx = date_range('2015-01-01 10:00', freq='D', periods=3, tz='US/Eastern') result = Categorical(idx) tm.assert_index_equal(result.categories, idx) result = Categorical(Series(idx)) tm.assert_index_equal(result.categories, idx) def test_constructor_from_index_series_timedelta(self): idx = timedelta_range('1 days', freq='D', periods=3) result = Categorical(idx) tm.assert_index_equal(result.categories, idx) result = Categorical(Series(idx)) tm.assert_index_equal(result.categories, idx) def test_constructor_from_index_series_period(self): idx = period_range('2015-01-01', freq='D', periods=3) result = Categorical(idx) tm.assert_index_equal(result.categories, idx) result = Categorical(Series(idx)) tm.assert_index_equal(result.categories, idx) def test_constructor_invariant(self): # GH 14190 vals = [ np.array([1., 1.2, 1.8, np.nan]), np.array([1, 2, 3], dtype='int64'), ['a', 'b', 'c', np.nan], [pd.Period('2014-01'), pd.Period('2014-02'), NaT], [Timestamp('2014-01-01'), Timestamp('2014-01-02'), NaT], [Timestamp('2014-01-01', tz='US/Eastern'), Timestamp('2014-01-02', tz='US/Eastern'), NaT], ] for val in vals: c = Categorical(val) c2 = Categorical(c) tm.assert_categorical_equal(c, c2) @pytest.mark.parametrize('ordered', [True, False]) def test_constructor_with_dtype(self, ordered): categories = ['b', 'a', 'c'] dtype = CategoricalDtype(categories, ordered=ordered) result = Categorical(['a', 'b', 'a', 'c'], dtype=dtype) expected = Categorical(['a', 'b', 'a', 'c'], categories=categories, ordered=ordered) tm.assert_categorical_equal(result, expected) assert result.ordered is ordered def test_constructor_dtype_and_others_raises(self): dtype = CategoricalDtype(['a', 'b'], ordered=True) with pytest.raises(ValueError, match="Cannot"): Categorical(['a', 'b'], categories=['a', 'b'], dtype=dtype) with pytest.raises(ValueError, match="Cannot"): Categorical(['a', 'b'], ordered=True, dtype=dtype) with pytest.raises(ValueError, match="Cannot"): Categorical(['a', 'b'], ordered=False, dtype=dtype) @pytest.mark.parametrize('categories', [ None, ['a', 'b'], ['a', 'c'], ]) @pytest.mark.parametrize('ordered', [True, False]) def test_constructor_str_category(self, categories, ordered): result = Categorical(['a', 'b'], categories=categories, ordered=ordered, dtype='category') expected = Categorical(['a', 'b'], categories=categories, ordered=ordered) tm.assert_categorical_equal(result, expected) def test_constructor_str_unknown(self): with pytest.raises(ValueError, match="Unknown dtype"): Categorical([1, 2], dtype="foo") def test_constructor_from_categorical_with_dtype(self): dtype = CategoricalDtype(['a', 'b', 'c'], ordered=True) values = Categorical(['a', 'b', 'd']) result = Categorical(values, dtype=dtype) # We use dtype.categories, not values.categories expected = Categorical(['a', 'b', 'd'], categories=['a', 'b', 'c'], ordered=True) tm.assert_categorical_equal(result, expected) def test_constructor_from_categorical_with_unknown_dtype(self): dtype = CategoricalDtype(None, ordered=True) values = Categorical(['a', 'b', 'd']) result = Categorical(values, dtype=dtype) # We use values.categories, not dtype.categories expected = Categorical(['a', 'b', 'd'], categories=['a', 'b', 'd'], ordered=True) tm.assert_categorical_equal(result, expected) def test_constructor_from_categorical_string(self): values = Categorical(['a', 'b', 'd']) # use categories, ordered result = Categorical(values, categories=['a', 'b', 'c'], ordered=True, dtype='category') expected = Categorical(['a', 'b', 'd'], categories=['a', 'b', 'c'], ordered=True) tm.assert_categorical_equal(result, expected) # No string result = Categorical(values, categories=['a', 'b', 'c'], ordered=True) tm.assert_categorical_equal(result, expected) def test_constructor_with_categorical_categories(self): # GH17884 expected = Categorical(['a', 'b'], categories=['a', 'b', 'c']) result = Categorical( ['a', 'b'], categories=Categorical(['a', 'b', 'c'])) tm.assert_categorical_equal(result, expected) result = Categorical( ['a', 'b'], categories=CategoricalIndex(['a', 'b', 'c'])) tm.assert_categorical_equal(result, expected) def test_from_codes(self): # too few categories with pytest.raises(ValueError): Categorical.from_codes([1, 2], [1, 2]) # no int codes with pytest.raises(ValueError): Categorical.from_codes(["a"], [1, 2]) # no unique categories with pytest.raises(ValueError): Categorical.from_codes([0, 1, 2], ["a", "a", "b"]) # NaN categories included with pytest.raises(ValueError): Categorical.from_codes([0, 1, 2], ["a", "b", np.nan]) # too negative with pytest.raises(ValueError): Categorical.from_codes([-2, 1, 2], ["a", "b", "c"]) exp = Categorical(["a", "b", "c"], ordered=False) res = Categorical.from_codes([0, 1, 2], ["a", "b", "c"]) tm.assert_categorical_equal(exp, res) # Not available in earlier numpy versions if hasattr(np.random, "choice"): codes = np.random.choice([0, 1], 5, p=[0.9, 0.1]) Categorical.from_codes(codes, categories=["train", "test"]) def test_from_codes_with_categorical_categories(self): # GH17884 expected = Categorical(['a', 'b'], categories=['a', 'b', 'c']) result = Categorical.from_codes( [0, 1], categories=Categorical(['a', 'b', 'c'])) tm.assert_categorical_equal(result, expected) result = Categorical.from_codes( [0, 1], categories=CategoricalIndex(['a', 'b', 'c'])) tm.assert_categorical_equal(result, expected) # non-unique Categorical still raises with pytest.raises(ValueError): Categorical.from_codes([0, 1], Categorical(['a', 'b', 'a'])) def test_from_codes_with_nan_code(self): # GH21767 codes = [1, 2, np.nan] categories = ['a', 'b', 'c'] with pytest.raises(ValueError): Categorical.from_codes(codes, categories) def test_from_codes_with_float(self): # GH21767 codes = [1.0, 2.0, 0] # integer, but in float dtype categories = ['a', 'b', 'c'] with tm.assert_produces_warning(FutureWarning): cat = Categorical.from_codes(codes, categories) tm.assert_numpy_array_equal(cat.codes, np.array([1, 2, 0], dtype='i1')) codes = [1.1, 2.0, 0] # non-integer with pytest.raises(ValueError): Categorical.from_codes(codes, categories) @pytest.mark.parametrize('dtype', [None, 'category']) def test_from_inferred_categories(self, dtype): cats = ['a', 'b'] codes = np.array([0, 0, 1, 1], dtype='i8') result = Categorical._from_inferred_categories(cats, codes, dtype) expected = Categorical.from_codes(codes, cats) tm.assert_categorical_equal(result, expected) @pytest.mark.parametrize('dtype', [None, 'category']) def test_from_inferred_categories_sorts(self, dtype): cats = ['b', 'a'] codes = np.array([0, 1, 1, 1], dtype='i8') result = Categorical._from_inferred_categories(cats, codes, dtype) expected = Categorical.from_codes([1, 0, 0, 0], ['a', 'b']) tm.assert_categorical_equal(result, expected) def test_from_inferred_categories_dtype(self): cats = ['a', 'b', 'd'] codes = np.array([0, 1, 0, 2], dtype='i8') dtype = CategoricalDtype(['c', 'b', 'a'], ordered=True) result = Categorical._from_inferred_categories(cats, codes, dtype) expected = Categorical(['a', 'b', 'a', 'd'], categories=['c', 'b', 'a'], ordered=True) tm.assert_categorical_equal(result, expected) def test_from_inferred_categories_coerces(self): cats = ['1', '2', 'bad'] codes = np.array([0, 0, 1, 2], dtype='i8') dtype = CategoricalDtype([1, 2]) result = Categorical._from_inferred_categories(cats, codes, dtype) expected = Categorical([1, 1, 2, np.nan]) tm.assert_categorical_equal(result, expected) def test_construction_with_ordered(self): # GH 9347, 9190 cat = Categorical([0, 1, 2]) assert not cat.ordered cat = Categorical([0, 1, 2], ordered=False) assert not cat.ordered cat = Categorical([0, 1, 2], ordered=True) assert cat.ordered @pytest.mark.xfail(reason="Imaginary values not supported in Categorical") def test_constructor_imaginary(self): values = [1, 2, 3 + 1j] c1 = Categorical(values) tm.assert_index_equal(c1.categories, Index(values)) tm.assert_numpy_array_equal(np.array(c1), np.array(values))
from __future__ import absolute_import # Avoid importing `importlib` from this package. import copy import imp from importlib import import_module import os import sys import warnings from django.core.exceptions import ImproperlyConfigured from django.utils import six from django.utils.deprecation import RemovedInDjango19Warning def import_string(dotted_path): """ Import a dotted module path and return the attribute/class designated by the last name in the path. Raise ImportError if the import failed. """ try: module_path, class_name = dotted_path.rsplit('.', 1) except ValueError: msg = "%s doesn't look like a module path" % dotted_path six.reraise(ImportError, ImportError(msg), sys.exc_info()[2]) module = import_module(module_path) try: return getattr(module, class_name) except AttributeError: msg = 'Module "%s" does not define a "%s" attribute/class' % ( dotted_path, class_name) six.reraise(ImportError, ImportError(msg), sys.exc_info()[2]) def import_by_path(dotted_path, error_prefix=''): """ Import a dotted module path and return the attribute/class designated by the last name in the path. Raise ImproperlyConfigured if something goes wrong. """ warnings.warn( 'import_by_path() has been deprecated. Use import_string() instead.', RemovedInDjango19Warning, stacklevel=2) try: attr = import_string(dotted_path) except ImportError as e: msg = '%sError importing module %s: "%s"' % ( error_prefix, dotted_path, e) six.reraise(ImproperlyConfigured, ImproperlyConfigured(msg), sys.exc_info()[2]) return attr def autodiscover_modules(*args, **kwargs): """ Auto-discover INSTALLED_APPS modules and fail silently when not present. This forces an import on them to register any admin bits they may want. You may provide a register_to keyword parameter as a way to access a registry. This register_to object must have a _registry instance variable to access it. """ from django.apps import apps register_to = kwargs.get('register_to') for app_config in apps.get_app_configs(): # Attempt to import the app's module. try: if register_to: before_import_registry = copy.copy(register_to._registry) for module_to_search in args: import_module('%s.%s' % (app_config.name, module_to_search)) except: # Reset the model registry to the state before the last import as # this import will have to reoccur on the next request and this # could raise NotRegistered and AlreadyRegistered exceptions # (see #8245). if register_to: register_to._registry = before_import_registry # Decide whether to bubble up this error. If the app just # doesn't have an admin module, we can ignore the error # attempting to import it, otherwise we want it to bubble up. if module_has_submodule(app_config.module, module_to_search): raise def module_has_submodule(package, module_name): """See if 'module' is in 'package'.""" name = ".".join([package.__name__, module_name]) try: # None indicates a cached miss; see mark_miss() in Python/import.c. return sys.modules[name] is not None except KeyError: pass try: package_path = package.__path__ # No __path__, then not a package. except AttributeError: # Since the remainder of this function assumes that we're dealing with # a package (module with a __path__), so if it's not, then bail here. return False for finder in sys.meta_path: if finder.find_module(name, package_path): return True for entry in package_path: try: # Try the cached finder. finder = sys.path_importer_cache[entry] if finder is None: # Implicit import machinery should be used. try: file_, _, _ = imp.find_module(module_name, [entry]) if file_: file_.close() return True except ImportError: continue # Else see if the finder knows of a loader. elif finder.find_module(name): return True else: continue except KeyError: # No cached finder, so try and make one. for hook in sys.path_hooks: try: finder = hook(entry) # XXX Could cache in sys.path_importer_cache if finder.find_module(name): return True else: # Once a finder is found, stop the search. break except ImportError: # Continue the search for a finder. continue else: # No finder found. # Try the implicit import machinery if searching a directory. if os.path.isdir(entry): try: file_, _, _ = imp.find_module(module_name, [entry]) if file_: file_.close() return True except ImportError: pass # XXX Could insert None or NullImporter else: # Exhausted the search, so the module cannot be found. return False
#ifndef __MTKFB_H #define __MTKFB_H #define MTK_FB_OVERLAY_SUPPORT #define MTK_FB_SYNC_SUPPORT #define MTK_FB_ION_SUPPORT #define MTK_FB_NO_ION_FD ((int)(~0U>>1)) /* IOCTL commands. */ #define MTK_IOW(num, dtype) _IOW('O', num, dtype) #define MTK_IOR(num, dtype) _IOR('O', num, dtype) #define MTK_IOWR(num, dtype) _IOWR('O', num, dtype) #define MTK_IO(num) _IO('O', num) // -------------------------------------------------------------------------- #define MTKFB_SET_OVERLAY_LAYER MTK_IOW(45, struct fb_overlay_layer) #define MTKFB_TRIG_OVERLAY_OUT MTK_IO(46) #define MTKFB_SET_VIDEO_LAYERS MTK_IOW(51, struct fb_overlay_layer) #define MTKFB_CAPTURE_FRAMEBUFFER MTK_IOW(52, unsigned long) #define MTKFB_CONFIG_IMMEDIATE_UPDATE MTK_IOW(53, unsigned long) #define MTKFB_SET_MULTIPLE_LAYERS MTK_IOW(54, struct fb_overlay_layer) #define MTKFB_REGISTER_OVERLAYBUFFER MTK_IOW(55, struct fb_overlay_buffer_info) #define MTKFB_UNREGISTER_OVERLAYBUFFER MTK_IOW(56, unsigned int) #define MTKFB_SET_ORIENTATION MTK_IOW(57, unsigned long) #define MTKFB_FBLAYER_ENABLE MTK_IOW(58,unsigned int) #define MTKFB_LOCK_FRONT_BUFFER MTK_IO(59) #define MTKFB_UNLOCK_FRONT_BUFFER MTK_IO(60) #define MTKFB_POWERON MTK_IO(61) #define MTKFB_POWEROFF MTK_IO(62) // -------------------------------------------------Fence/Ion, OVL decoupling #define MTKFB_PREPARE_OVERLAY_BUFFER MTK_IOW(66, struct fb_overlay_buffer) #define MTKFB_SWITCH_DISPLAY_MODE MTK_IOW(67, struct fb_overlay_mode) // -----------------------------------------------------------------S3D control #define MTKFB_SET_COMPOSING3D MTK_IOW(70, unsigned long) #define MTKFB_SET_S3D_FTM MTK_IOW(71, unsigned long) //-------------------------------------------FM De-sense for EM and Normal mode #define MTKFB_GET_DEFAULT_UPDATESPEED MTK_IOR(72, unsigned long) #define MTKFB_GET_CURR_UPDATESPEED MTK_IOR(73, unsigned long) #define MTKFB_CHANGE_UPDATESPEED MTK_IOW(74, unsigned long) //for EM, not called change writecycle because DPI change pll ckl #define MTKFB_GET_INTERFACE_TYPE MTK_IOR(77, unsigned long) ///0 DBI, 1 DPI, 2 MIPI #define MTKFB_GET_POWERSTATE MTK_IOR(78, unsigned long) ///0: power off 1: power on #define MTKFB_GET_DISPLAY_IF_INFORMATION MTK_IOR(90, mtk_dispif_info_t) #define MTKFB_AEE_LAYER_EXIST MTK_IOR(92, unsigned long) //called before SET_OVERLAY each time, if true, hwc will not use FB_LAYER again #define MTKFB_GET_OVERLAY_LAYER_INFO MTK_IOR(93, struct fb_overlay_layer_info) #define MTKFB_FACTORY_AUTO_TEST MTK_IOR(94, unsigned long) #define MTKFB_GET_FRAMEBUFFER_MVA MTK_IOR(95, unsigned int) #define MTKFB_SLT_AUTO_CAPTURE MTK_IOWR(96, struct fb_slt_catpure) //---------------------------------------------------------------error handling #define MTKFB_META_RESTORE_SCREEN MTK_IOW(101, unsigned long) #define MTKFB_ERROR_INDEX_UPDATE_TIMEOUT MTK_IO(103) #define MTKFB_ERROR_INDEX_UPDATE_TIMEOUT_AEE MTK_IO(104) //---------------------------------------------------------------------- #define FBCAPS_GENERIC_MASK 0x00000fff #define FBCAPS_LCDC_MASK 0x00fff000 #define FBCAPS_PANEL_MASK 0xff000000 #define FBCAPS_MANUAL_UPDATE 0x00001000 #define FBCAPS_SET_BACKLIGHT 0x01000000 #define MAKE_MTK_FB_FORMAT_ID(id, bpp) (((id) << 8) | (bpp)) typedef enum { MTK_FB_FORMAT_UNKNOWN = 0, MTK_FB_FORMAT_RGB565 = MAKE_MTK_FB_FORMAT_ID(1, 2), MTK_FB_FORMAT_RGB888 = MAKE_MTK_FB_FORMAT_ID(2, 3), MTK_FB_FORMAT_BGR888 = MAKE_MTK_FB_FORMAT_ID(3, 3), MTK_FB_FORMAT_ARGB8888 = MAKE_MTK_FB_FORMAT_ID(4, 4), MTK_FB_FORMAT_ABGR8888 = MAKE_MTK_FB_FORMAT_ID(5, 4), MTK_FB_FORMAT_YUV422 = MAKE_MTK_FB_FORMAT_ID(6, 2), MTK_FB_FORMAT_XRGB8888 = MAKE_MTK_FB_FORMAT_ID(7, 4), MTK_FB_FORMAT_XBGR8888 = MAKE_MTK_FB_FORMAT_ID(8, 4), MTK_FB_FORMAT_UYVY = MAKE_MTK_FB_FORMAT_ID(9, 2), MTK_FB_FORMAT_YUV420_P = MAKE_MTK_FB_FORMAT_ID(10, 2), MTK_FB_FORMAT_BPP_MASK = 0xFF, } MTK_FB_FORMAT; #define GET_MTK_FB_FORMAT_BPP(f) ((f) & MTK_FB_FORMAT_BPP_MASK) // -------------------------------------------------------------------------- typedef enum { MTK_FB_ORIENTATION_0 = 0, MTK_FB_ORIENTATION_90 = 1, MTK_FB_ORIENTATION_180 = 2, MTK_FB_ORIENTATION_270 = 3, } MTK_FB_ORIENTATION; typedef enum { MTK_FB_TV_SYSTEM_NTSC = 0, MTK_FB_TV_SYSTEM_PAL = 1, } MTK_FB_TV_SYSTEM; typedef enum { MTK_FB_TV_FMT_RGB565 = 0, MTK_FB_TV_FMT_YUV420_SEQ = 1, MTK_FB_TV_FMT_UYUV422 = 2, MTK_FB_TV_FMT_YUV420_BLK = 3, } MTK_FB_TV_SRC_FORMAT; typedef struct _disp_dfo_item { char name[32]; int value; }disp_dfo_item_t; // -------------------------------------------------------------------------- struct fb_slt_catpure { MTK_FB_FORMAT format; volatile char* outputBuffer; unsigned int wdma_width; unsigned int wdma_height; }; struct fb_scale { unsigned int xscale, yscale; }; struct fb_frame_offset { unsigned int idx; unsigned long offset; }; struct fb_update_window { unsigned int x, y; unsigned int width, height; }; typedef enum { LAYER_2D = 0, LAYER_3D_SBS_0 = 0x1, LAYER_3D_SBS_90 = 0x2, LAYER_3D_SBS_180 = 0x3, LAYER_3D_SBS_270 = 0x4, LAYER_3D_TAB_0 = 0x10, LAYER_3D_TAB_90 = 0x20, LAYER_3D_TAB_180 = 0x30, LAYER_3D_TAB_270 = 0x40, } MTK_FB_LAYER_TYPE; typedef enum { DISP_DIRECT_LINK_MODE, DISP_DECOUPLE_MODE }MTK_DISP_MODE; struct fb_overlay_mode { MTK_DISP_MODE mode; }; struct fb_overlay_buffer{ // Input int layer_id; unsigned int layer_en; int ion_fd; unsigned int cache_sync; // Output unsigned int index; int fence_fd; }; struct fb_overlay_layer { unsigned int layer_id; unsigned int layer_enable; void* src_base_addr; void* src_phy_addr; unsigned int src_direct_link; MTK_FB_FORMAT src_fmt; unsigned int src_use_color_key; unsigned int src_color_key; unsigned int src_pitch; unsigned int src_offset_x, src_offset_y; unsigned int src_width, src_height; unsigned int tgt_offset_x, tgt_offset_y; unsigned int tgt_width, tgt_height; MTK_FB_ORIENTATION layer_rotation; MTK_FB_LAYER_TYPE layer_type; MTK_FB_ORIENTATION video_rotation; unsigned int isTdshp; // set to 1, will go through tdshp first, then layer blending, then to color int next_buff_idx; int identity; int connected_type; unsigned int security; }; struct fb_overlay_buffer_info{ unsigned int src_vir_addr; unsigned int size; }; struct fb_overlay_layer_info { unsigned int layer_id; unsigned int layer_enabled; // TO BE DEL unsigned int curr_en; unsigned int next_en; unsigned int hw_en; int curr_idx; int next_idx; int hw_idx; int curr_identity; int next_identity; int hw_identity; int curr_conn_type; int next_conn_type; int hw_conn_type; }; #define MTKFB_ERROR_IS_EARLY_SUSPEND 0x12000000 // -------------------------------------------------------------------------- struct fb_post_video_buffer { void* phy_addr; void* vir_addr; MTK_FB_TV_SRC_FORMAT format; unsigned int width, height; }; // -------------------------------------------------------------------------- #define HW_OVERLAY_COUNT (4) // Top layer is assigned to Debug Layer // Second layer is assigned to UI #define RESERVED_LAYER_COUNT (2) #define VIDEO_LAYER_COUNT (HW_OVERLAY_COUNT - RESERVED_LAYER_COUNT) #ifdef __KERNEL__ #include <linux/completion.h> #include <linux/interrupt.h> #define MTKFB_DRIVER "mtkfb" enum mtkfb_state { MTKFB_DISABLED = 0, MTKFB_SUSPENDED = 99, MTKFB_ACTIVE = 100 }; typedef enum { MTKFB_LAYER_ENABLE_DIRTY = (1 << 0), MTKFB_LAYER_FORMAT_DIRTY = (1 << 1), MTKFB_LAYER_SET_DIRTY = (1 << 2), } MTKFB_LAYER_CONFIG_DIRTY; struct mtkfb_device { int state; void *fb_va_base; /* MPU virtual address */ dma_addr_t fb_pa_base; /* Bus physical address */ unsigned long fb_size_in_byte; unsigned long layer_enable; MTK_FB_FORMAT layer_format[HW_OVERLAY_COUNT]; unsigned int layer_config_dirty; int xscale, yscale, mirror; /* transformations. rotate is stored in fb_info->var */ u32 pseudo_palette[17]; struct fb_info *fb_info; /* Linux fbdev framework data */ struct device *dev; }; #endif /* __KERNEL__ */ #endif /* __MTKFB_H */
$(document).ready(function (){ toasterOptions(); initialLoad(); setDateRangePicker(); function toasterOptions() { toastr.options = { "closeButton": true, "debug": false, "newestOnTop": true, "progressBar": true, "positionClass": "toast-center-center", "preventDuplicates": false, "onclick": null, "showDuration": "300", "hideDuration": "1000", "timeOut": "5000", "extendedTimeOut": "1000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut", "preventDuplicates":true, } } function initialLoad() { var date = new Date(); var start = new Date(date.getFullYear(), date.getMonth(), 1); var end = new Date(date.getFullYear(), date.getMonth() + 1, 0); start = moment(start).format('YYYY-MM-DD'); end = moment(end).format('YYYY-MM-DD'); fetch(start,end) } //calculate Gross pay function grossPay() { } function fetch(start,end) { start = moment(start).format('YYYY-MM-DD'); end = moment(end).format('YYYY-MM-DD'); $.ajax({ type: "POST", url: baseurl + "PayrollControl/fetch" , cache:false, data:{ StartDate:start, EndDate:end, }, dataType: "JSON", success: function (data) { if(data.response == "success"){ var table; setters = data.posts; console.log(setters) if($.fn.dataTable.isDataTable('#payrollRecords')) { console.log("drew it!"); table = $('#payrollRecords').DataTable(); table.clear().draw(); table.rows.add(setters); // Add new data table.columns.adjust().draw(); } else{ console.log("generate it!"); table = $('#payrollRecords').DataTable({ "destroy": true, responsive:true, dom: //'Blfrtip', // if you remove this line you will see the show entries dropdown 'B'+ "<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>>"+ "rtip", buttons: [ // 'copy', 'csv', 'excel', 'pdf', 'print', { text:'Copy Table to Clipboard', className: "copy spaceButtons", extend:'copy', }, { text:'Export Table To Excel', extend:'excel', className:"excel spaceButtons" }, { text:'Export Table To CSV', extend:'csv', className:"csv spaceButtons" }, { text:'Export Table To PDF', extend:'pdf', className:"pdf spaceButtons", orientation : 'landscape', pageSize : 'LEGAL', }, ], data:data.posts, columns:[ { title:"Image", "data": "Image", "render": function ( data, type, row, meta ) { return '<img src="'+baseurl+data+"?time"+new Date().getTime()+'"alt="Error load" class="img-fluid"></img>' } }, { title:"Employee Name", data:null, render:function(data,type,row,meta){ return row.FirstName + " " + row.LastName; } }, { title:"Employee Number", data:"EmployeeNumber" }, { title:"Position", data:"Position" }, { title:"Total Days Worked", data:"DaysWorked" }, { title:"Base Salary", data:"BaseSalary", }, { title:"Dental Commissions", data:"TotalCommissions", render:function(data,type,row,meta){ if(data == null){ return ""; } else{ return data; } } }, { title:"Gross pay", data:null, render:function(data,type,row,meta){ let daysWorked = Number(row.DaysWorked); let dailyRate = Number(row.BaseSalary); let overTime = Number(row.OverTime); let commissions = Number(row.TotalCommissions); let baseRate = Number((daysWorked * dailyRate) + commissions); let overTimeRate = Number(((dailyRate/8/60) * overTime)); let grossPay = Number(baseRate + overTimeRate); grossPay = grossPay.toFixed(2); return grossPay; }, }, { title:"Net Pay", data:null, render: function(data,type,row,meta){ let daysWorked = Number(row.DaysWorked); let dailyRate = Number(row.BaseSalary); let overTime = Number(row.OverTime); let commissions = Number(row.TotalCommissions); let deductions = Number(row.SSS) + Number(row.PagIbig) + Number(row.PhilHealth) + Number(row.CashAdvance); let baseRate = Number((daysWorked * dailyRate) + commissions); let overTimeRate = Number(((dailyRate/8/60) * overTime)); let grossPay = Number(baseRate + overTimeRate); let netPay = Number(grossPay - deductions); netPay = netPay.toFixed(2) return netPay; }, }, /* { title:"Actions", data:null, render:function(data,type,row,meta){ let viewButton = '<a href="#" value = "'+'" class = "btn btn-outline-info viewButton"><i class="far fa-eye"></i></a>' return viewButton; }, }, */ ], columnDefs: [ { "targets": 0, "width":"6%", }, ], }) } } else if(data.response == "none"){ toastr["info"]("Alert",data.message); console.log("no records"); } else if (data.resposne == "failed"){ toastr["error"]("Alert",data.message); console.log("Failed to retrieve"); } } }); } //Initialize Date Range Picker function setDateRangePicker() { var date = new Date(); var start = new Date(date.getFullYear(), date.getMonth(), 1); var end = new Date(date.getFullYear(), date.getMonth() + 1, 0); $('#dateRangePicker').val(date); $('#dateRangePicker').daterangepicker({ startDate:start, endDate:end, "applyButtonClasses": "btn-success", "cancelClass": "btn-danger", locale: { cancelLabel: 'Clear' } }); } // When apply button is hit $('#dateRangePicker').on('apply.daterangepicker', function(ev, picker) { var startDate = picker.startDate.format('YYYY-MM-DD'); var endDate = picker.endDate.format('YYYY-MM-DD'); fetch(startDate,endDate) }); // when Clear/Cancel button is hit $('#dateRangePicker').on('cancel.daterangepicker', function(ev, picker) { $(this).val(''); }); $('#applyDate').on('click', function (e,picker) { e.preventDefault(); var start = $('#dateRangePicker').data('daterangepicker').startDate; var end = $('#dateRangePicker').data('daterangepicker').endDate; start = moment(start).format('YYYY-MM-DD'); end = moment(end).format('YYYY-MM-DD'); fetch(start,end); }); //View More info $(document).on('click','tbody .viewButton', function () { alert("Clicked View Button") }); });
export { default } from "./FilterSelector";
const DeedCard = require('../../deedcard.js'); const GameActions = require('../../GameActions/index.js'); class RedRiverRoulette extends DeedCard { setupCardAbilities(ability) { this.action({ title: 'Red River Roulette', playType: ['resolution'], cost: ability.costs.bootSelf(), handler: context => { if(!context.player.isCheatin()) { context.ability.selectAnotherTarget(context.player, context, { activePromptTitle: 'Choose a dude', waitingPromptTitle: 'Waiting for opponent to select dude', cardCondition: card => card.location === 'play area' && card.controller === context.player && card.gamelocation === this.gamelocation, cardType: 'dude', gameAction: 'boot', onSelect: (player, card) => { this.game.resolveGameAction(GameActions.bootCard({ card }), context).thenExecute(() => { this.game.getPlayers().forEach(player => player.modifyCasualties(-999)); this.game.addMessage('{0} uses {1} and boots {2} to prevent all casualties', player, this, card); }); return true; } }); } else { this.game.addMessage('{0} uses {1} but it does not have any effect because they do not have a legal hand', context.player, this); } this.lastingEffect(context.ability, ability => ({ until: { onShootoutRoundFinished: () => true }, condition: () => true, match: card => card.getType() === 'dude' && card.isParticipating(), effect: ability.effects.cannotFlee() })); const eventHandler = () => { this.game.getPlayers().forEach(player => player.modifyCasualties(player.casualties)); }; const currentShootoutRound = this.game.shootout.round; this.game.onceConditional('onShootoutCasualtiesStepStarted', { until: 'onShootoutPhaseFinished', condition: event => event.shootoutRound === currentShootoutRound + 1 }, eventHandler); } }); } } RedRiverRoulette.code = '22032'; module.exports = RedRiverRoulette;
import io import sys """ Normalize the input text to output ascii-only text by removing any line that contains non-ascii Also lowercase all text """ printable_chars = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~' def main(): with io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') as f: for line in f: line = line.rstrip() skip = False for c in line: if c not in printable_chars: skip = True continue if not skip: print(line.lower()) if __name__ == '__main__': main()
'''LastPass Vault search''' import subprocess import re import os from shutil import which from albertv0 import * __iid__ = 'PythonInterface/v0.1' __prettyname__ = 'LastPass' __version__ = '1.0' __trigger__ = 'lp ' __author__ = 'David Piçarra' __dependencies__ = ['lpass'] if not which('lpass'): raise Exception("`lpass` is not in $PATH.") ICON_PATH = os.path.dirname(__file__)+"/lastpass.svg" def handleQuery(query): """ Handle query :param str query: Query :return list """ if not query.isTriggered: return None stripped = query.string.strip() try: lpass = subprocess.check_output(['lpass', 'status']) except Exception as e: return Item( id=__prettyname__, icon=ICON_PATH, text=f'Not logged in.', subtext=f'Please enter your lastpass email address', completion=query.rawString, actions=[ ProcAction("lpass login with given email", ["lpass", "login", stripped]), ] ) if stripped: try: lpass = subprocess.Popen(['lpass', 'ls', '--long'], stdout=subprocess.PIPE) try: output = subprocess.check_output(['grep', '-i', stripped], stdin=lpass.stdout) except subprocess.CalledProcessError as e: return Item( id=__prettyname__, icon=ICON_PATH, text=__prettyname__, subtext=f'No results found for {stripped}', completion=query.rawString ) items = [] for line in output.splitlines(): match = re.match(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2} (.*) \[id: (\d*)\] \[username: (.*)\]', line.decode("utf-8")) items.append(Item( id=__prettyname__, icon=ICON_PATH, text=match.group(1), subtext=match.group(3), completion=query.rawString, actions=[ ProcAction("Copy password to clipboard", ["lpass", "show", "-cp", match.group(2)]), ProcAction("Copy username to clipboard", ["lpass", "show", "-cu", match.group(2)]), ProcAction("Copy notes to clipboard", ["lpass", "show", "-c", "--notes", match.group(2)]) ] )) return items except subprocess.CalledProcessError as e: return Item( id=__prettyname__, icon=ICON_PATH, text=f'Error: {str(e.output)}', subtext=str(e), completion=query.rawString, actions=[ClipAction('Copy CalledProcessError to clipboard', str(e))] ) except Exception as e: return Item( id=__prettyname__, icon=ICON_PATH, text=f'Generic Exception: {str(e)}', subtext=str(e), completion=query.rawString, actions=[ClipAction('Copy Exception to clipboard', str(e))] ) else: return Item( id=__prettyname__, icon=ICON_PATH, text=__prettyname__, subtext='Search the LastPass vault', completion=query.rawString, )
""" Quantiphyse - widget which allows a data sets view metadata to be changed The widget automatically switches to show the 'current' data, whether it is currently visible or not. Copyright (c) 2013-2020 University of Oxford 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. """ from __future__ import division, unicode_literals, absolute_import, print_function import logging from PySide2 import QtGui, QtCore, QtWidgets from quantiphyse.utils import get_icon, sf from quantiphyse.utils.enums import Visibility from quantiphyse.gui.widgets import RoiCombo, OverlayCombo from quantiphyse.gui.options import OptionBox, DataOption, ChoiceOption, NumericOption, TextOption from quantiphyse.gui.colors import CMAPS, DEFAULT_CMAP LOG = logging.getLogger(__name__) def no_update(f): def wrapper(self, *args, **kwargs): try: self._no_update = True f(self, *args, **kwargs) finally: self._no_update = False return wrapper class ViewParamsWidget(OptionBox): def __init__(self, ivl, rois=True, data=True): OptionBox.__init__(self, border=True) self.ivl = ivl self.ivm = ivl.ivm self._qpdata = None self._no_update = False self.grid.setVerticalSpacing(2) self._view_btn = QtWidgets.QPushButton() self._view_btn.setIcon(QtGui.QIcon(get_icon("visible.png"))) self._view_btn.setFixedSize(16, 16) self._view_btn.setToolTip("Visibility") self._view_btn.clicked.connect(self._view_btn_clicked) self._data = self.add("Data" if data else "ROI", DataOption(self.ivm, data=data, rois=rois, follow_current=True), self._view_btn, key="data") self._view_roi = self.add("View ROI", DataOption(self.ivm, data=False, rois=True), checked=True, key="view_roi") self._levels_btn = QtWidgets.QPushButton() self._levels_btn.setIcon(QtGui.QIcon(get_icon("levels.png"))) self._levels_btn.setFixedSize(16, 16) self._levels_btn.setToolTip("Adjust colour map levels") self._levels_btn.clicked.connect(self._levels_clicked) self._cmap = self.add("Colour map", ChoiceOption(CMAPS, default=DEFAULT_CMAP), self._levels_btn, key="cmap") self._alpha = self.add("Alpha", NumericOption(minval=0, maxval=255, default=255, edit=False, intonly=True), key="alpha") self._value_label = QtWidgets.QLabel() self.add("Value", self._value_label) self.add("", stretch=2) self._data.sig_changed.connect(self._data_changed) self._view_roi.sig_changed.connect(self._view_roi_changed) self._cmap.sig_changed.connect(self._cmap_changed) self._alpha.sig_changed.connect(self._alpha_changed) self.ivl.sig_focus_changed.connect(self._focus_changed) self.qpdata = None @property def qpdata(self): return self._qpdata @qpdata.setter def qpdata(self, qpdata): if self._qpdata is not None: self._qpdata.view.sig_changed.disconnect(self._view_md_changed) self._qpdata = qpdata self.option("alpha").setEnabled(qpdata is not None) self._view_btn.setEnabled(qpdata is not None) self.set_visible("cmap", qpdata is not None and not qpdata.roi) self._levels_btn.setVisible(qpdata is not None and not qpdata.roi) self.set_visible("view_roi", qpdata is not None and not qpdata.roi) if self._qpdata is not None: self._qpdata.view.sig_changed.connect(self._view_md_changed) self._view_md_changed() self.option("data").value = self._qpdata.name def _view_md_changed(self, _key=None, _value=None): if not self._no_update: try: self.blockSignals(True) if self._qpdata is not None: self.option("alpha").value = self._qpdata.view.alpha if not self._qpdata.roi: self.set_checked("view_roi", bool(self._qpdata.view.roi)) if self._qpdata.view.roi: self.option("view_roi").value = self._qpdata.view.roi self.option("cmap").value = self._qpdata.view.cmap self._view_btn.setIcon(self._get_visibility_icon()) finally: self.blockSignals(False) def _data_changed(self): self.qpdata = self.ivm.data.get(self.option("data").value, None) if self.qpdata is not None: self.ivm.set_current(self.qpdata.name) @no_update def _view_roi_changed(self): if self._qpdata is not None: self._qpdata.view.roi = None if not self.option("view_roi").isEnabled() else self.option("view_roi").value @no_update def _cmap_changed(self): if self._qpdata is not None: self._qpdata.view.cmap = self.option("cmap").value @no_update def _alpha_changed(self): if self._qpdata is not None: self._qpdata.view.alpha = self.option("alpha").value def _levels_clicked(self): dlg = LevelsDialog(self, self.ivm, self.ivl, self._qpdata) dlg.exec_() def _focus_changed(self, focus): if self._qpdata is not None: value = self._qpdata.value(focus, self.ivl.grid) if self._qpdata.roi: region = int(value) if region == 0: text = "(outside ROI)" else: text = self._qpdata.regions.get(region, "") if text == "": text = "1" else: text = sf(value, 4) self._value_label.setText(text) def _view_btn_clicked(self): if self._qpdata.roi: if self._qpdata.view.visible == Visibility.HIDE: vis, shade, contour = Visibility.SHOW, True, False elif self._qpdata.view.shade and not self._qpdata.view.contour: vis, shade, contour = Visibility.SHOW, True, True elif self._qpdata.view.shade and self._qpdata.view.contour: vis, shade, contour = Visibility.SHOW, False, True else: vis, shade, contour = Visibility.HIDE, True, False self._qpdata.view.visible = vis self._qpdata.view.shade = shade self._qpdata.view.contour = contour else: currently_visible = self._qpdata.view.visible == Visibility.SHOW self._qpdata.view.visible = Visibility.SHOW if not currently_visible else Visibility.HIDE def _get_visibility_icon(self): if self._qpdata.view.visible == Visibility.HIDE: icon = "invisible.png" elif self._qpdata.roi: if self._qpdata.view.contour and self._qpdata.view.shade: icon = "shade_contour.png" elif self._qpdata.view.contour: icon = "contour.png" elif self._qpdata.view.shade: icon = "shade.png" else: icon = "invisible.png" else: icon = "visible.png" return QtGui.QIcon(get_icon(icon)) class LevelsDialog(QtWidgets.QDialog): """ Dialog box used to set the colourmap max/min for a data view """ def __init__(self, parent, ivm, ivl, qpdata): super(LevelsDialog, self).__init__(parent) self.ivm = ivm self.ivl = ivl self._qpdata = qpdata self.setWindowTitle("Levels for %s" % self._qpdata.name) vbox = QtWidgets.QVBoxLayout() grid = QtWidgets.QGridLayout() self.min_spin = self._add_spin(grid, "Minimum", 0) self.max_spin = self._add_spin(grid, "Maximum", 1) grid.addWidget(QtWidgets.QLabel("Percentage of data range"), 2, 0) hbox = QtWidgets.QHBoxLayout() self.percentile_spin = QtWidgets.QSpinBox() self.percentile_spin.setMaximum(100) self.percentile_spin.setMinimum(1) self.percentile_spin.setValue(100) hbox.addWidget(self.percentile_spin) btn = QtWidgets.QPushButton("Reset") btn.clicked.connect(self._reset) hbox.addWidget(btn) grid.addLayout(hbox, 2, 1) grid.addWidget(QtWidgets.QLabel("Values outside range are"), 4, 0) self.combo = QtWidgets.QComboBox() self.combo.addItem("Transparent") self.combo.addItem("Clamped to max/min colour") self.combo.addItem("Transparent at lower, clamped at upper") self.combo.addItem("Clamped at lower, transparent at upper") self.combo.setCurrentIndex(self._qpdata.view.boundary) self.combo.currentIndexChanged.connect(self._bound_changed) grid.addWidget(self.combo, 4, 1) vbox.addLayout(grid) bbox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok) bbox.accepted.connect(self.close) vbox.addWidget(bbox) self.setLayout(vbox) def _add_spin(self, grid, label, row): grid.addWidget(QtWidgets.QLabel(label), row, 0) spin = QtWidgets.QDoubleSpinBox() spin.setMaximum(1e20) spin.setMinimum(-1e20) spin.setValue(self._qpdata.view.cmap_range[row]) spin.valueChanged.connect(self._val_changed(row)) grid.addWidget(spin, row, 1) return spin def _val_changed(self, row): def _changed(val): cmap_range = list(self._qpdata.view.cmap_range) cmap_range[row] = val self._qpdata.view.cmap_range = cmap_range return _changed def _bound_changed(self, idx): self._qpdata.view.boundary = idx def _reset(self): percentile = self.percentile_spin.value() if self._qpdata.view.roi: roi = self.ivm.data[self._qpdata.view.roi] else: roi = None cmin, cmax = self._qpdata.suggest_cmap_range(vol=self.ivl.focus()[3], percentile=percentile, roi=roi) self.min_spin.setValue(cmin) self.max_spin.setValue(cmax) self._qpdata.view.cmap_range = [cmin, cmax]
import './index.css'; import 'bootstrap/dist/css/bootstrap.min.css'; import React, { useEffect } from 'react'; import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; import Footer from './components/layout/Footer'; import Register from './components/auth/Register'; import SubscribePlan from './components/layout/SubscribePlan'; import ClientNavbar from './components/Dashboard/User/ClientNavbar'; import Login from './components/auth/Login'; import Welcome from './components/layout/Welcome'; import AdminHeader from './components/Dashboard/Admin/AdminHeader'; import AdminMain from './components/layout/AdminMain'; import PrivateRoute from './components/routing/PrivateRoute'; import Profile from './components/layout/Profile'; import UserDashboard from '../src/components/page/user/UserDashboard'; import UserLearning from '../src/components/page/user/UserLearning'; import Landing from './components/layout/Landing'; import About from './components/layout/About'; import Courses from './components/courses/Courses'; import Course from './components/course/Course'; import Navbar from './components/layout/Navbar'; // Redux import { Provider } from 'react-redux'; import store from './store'; import { loadUser } from './actions/auth'; import setAuthToken from './utils/setAuthToken'; import FileUpload from './components/page/course/FileUpload'; import ViewCoursePage from './components/layout/ViewCoursePage'; import VideoStream from './components/layout/VideoStream'; if (localStorage.token) { setAuthToken(localStorage.token); } // Parent component const App = () => { // useEffect Hook useEffect(() => { window.scrollTo(0, 0); store.dispatch(loadUser()); }, []); return ( <Provider store={store}> <Router> <div className='landing'> <div> <Switch> <Route exact path='/'> <Landing /> </Route> <PrivateRoute path='/profile' component={Profile} /> <PrivateRoute path='/upload-course' component={FileUpload} /> <PrivateRoute path='/course/:id' component={Course} /> <PrivateRoute path='/stream' component={VideoStream} /> <Route exact path='/about'> <ClientNavbar /> <About /> </Route> <Route path='/register'> <ClientNavbar /> <Welcome /> <Register /> </Route> <Route path='/login'> <ClientNavbar /> <Welcome /> <Login /> </Route> <Route path='/Admin'> <AdminHeader /> <AdminMain /> </Route> <Route path='/subscribe'> <ClientNavbar /> <Welcome /> <SubscribePlan /> </Route> <Route exact path='/learning'> <Navbar /> <UserDashboard /> <Courses /> </Route> <Route exact path='/user'> <ClientNavbar /> <UserDashboard /> <UserLearning /> </Route> {/* Added a route to View Course page */} <Route exact path='/courses'> <ClientNavbar /> <AdminMain /> </Route> </Switch> </div> <Footer /> </div> </Router> </Provider> ); }; export default App;
from chainer.backends import cuda from chainer.backends import intel64 from chainer import function_node from chainer.utils import type_check _kern = None def _get_kern(): global _kern if _kern is None: _kern = cuda.elementwise( 'T cond, T x, T slope', 'T y', 'y = cond <= 0 ? (T)(slope * x) : x', 'lrelu') return _kern class LeakyReLU(function_node.FunctionNode): """Leaky rectifier unit.""" def __init__(self, slope=0.2): self.slope = slope def check_type_forward(self, in_types): type_check._argname(in_types, ('x',)) x_type, = in_types type_check.expect(x_type.dtype.kind == 'f') def forward_cpu(self, inputs): if (intel64.should_use_ideep('>=auto') and intel64.inputs_all_ready(inputs)): return self.forward_ideep(inputs) x, = inputs y = x.copy() y[x <= 0] *= self.slope if self.slope >= 0: self.retain_outputs((0,)) else: self.retain_inputs((0,)) return y, def forward_ideep(self, inputs): x, = inputs y = intel64.ideep.relu.Forward( intel64.ideep.array(x), self.slope) if self.slope >= 0: self.retain_outputs((0,)) else: self.retain_inputs((0,)) return y, def forward_gpu(self, inputs): x, = inputs y = _get_kern()(x, x, self.slope) if self.slope >= 0: self.retain_outputs((0,)) else: self.retain_inputs((0,)) return y, def backward(self, indexes, grad_outputs): if self.slope >= 0: cond = self.get_retained_outputs()[0].array else: cond = self.get_retained_inputs()[0].array return _LeakyReLUGrad(cond, self.slope).apply(grad_outputs) class _LeakyReLUGrad(function_node.FunctionNode): def __init__(self, cond, slope): self.cond = cond self.slope = slope def forward_cpu(self, inputs): if (intel64.should_use_ideep('>=auto') and intel64.inputs_all_ready(inputs)): return self.forward_ideep(inputs) gy, = inputs gy = gy.copy() gy[self.cond <= 0] *= self.slope return gy, def forward_ideep(self, inputs): gy, = inputs gy = intel64.ideep.relu.Backward( intel64.ideep.array(self.cond), intel64.ideep.array(gy), self.slope) return gy, def forward_gpu(self, inputs): gy, = inputs gy = _get_kern()(self.cond, gy, self.slope) return gy, def backward(self, indexes, grad_outputs): return _LeakyReLUGrad(self.cond, self.slope).apply(grad_outputs) def leaky_relu(x, slope=0.2): """Leaky Rectified Linear Unit function. This function is expressed as .. math:: f(x) = \\left \\{ \\begin{array}{ll} x & {\\rm if}~ x \\ge 0 \\\\ ax & {\\rm if}~ x < 0, \\end{array} \\right. where :math:`a` is a configurable slope value. Args: x (:class:`~chainer.Variable` or :ref:`ndarray`): Input variable. A :math:`(s_1, s_2, ..., s_N)`-shaped float array. slope (float): Slope value :math:`a`. Returns: ~chainer.Variable: Output variable. A :math:`(s_1, s_2, ..., s_N)`-shaped float array. .. admonition:: Example >>> x = np.array([[-1, 0], [2, -3], [-2, 1]], np.float32) >>> x array([[-1., 0.], [ 2., -3.], [-2., 1.]], dtype=float32) >>> F.leaky_relu(x, slope=0.2).data array([[-0.2, 0. ], [ 2. , -0.6], [-0.4, 1. ]], dtype=float32) """ return LeakyReLU(slope).apply((x,))[0]
/* HLSL shader compiler implementation */ #pragma once #include "backend.h" #include <string> #include <tscore/system/memory.h> ///////////////////////////////////////////////////////////////////////////////////////////////// namespace ts { class HLSLCompiler : public IShaderBackend { private: void* m_module = nullptr; public: HLSLCompiler(); ~HLSLCompiler(); EShaderBackend getId() const override { return eBackendHLSL_SM5; } bool compile(const std::string& code, ts::MemoryBuffer& codebuffer, const char* entrypoint, EShaderStage stage, std::string& errors, const char* sourcePath) override; }; } /////////////////////////////////////////////////////////////////////////////////////////////////
import math def pairs(k, arr): arr=set(arr) brr=set(x+k for x in arr) count=arr.intersection(brr) return count.__len__()
import faulthandler faulthandler.enable() from tensor2tensor.data_generators import problem from tensor2tensor.data_generators import text_problems from tensor2tensor.data_generators import translate from tensor2tensor.utils import registry from tensor2tensor import problems import tensorflow as tf import os import logging logger = logging.getLogger() tf.logging.set_verbosity(tf.logging.DEBUG) import sentencepiece as spm vocab = 'sp10m.cased.t5.model' sp = spm.SentencePieceProcessor() sp.Load(vocab) class Encoder: def __init__(self, sp): self.sp = sp self.vocab_size = sp.GetPieceSize() + 100 def encode(self, s): return self.sp.EncodeAsIds(s) def decode(self, ids, strip_extraneous = False): return self.sp.DecodeIds(list(ids)) encoder = Encoder(sp) from tqdm import tqdm from glob import glob @registry.register_problem class Seq2Seq(text_problems.Text2TextProblem): @property def approx_vocab_size(self): return 32100 @property def is_generate_per_split(self): return False @property def dataset_splits(self): return [ {'split': problem.DatasetSplit.TRAIN, 'shards': 100}, {'split': problem.DatasetSplit.EVAL, 'shards': 1}, ] def feature_encoders(self, data_dir): encoder = Encoder(sp) return {'inputs': encoder, 'targets': encoder} DATA_DIR = 'gs://mesolitica-tpu-general/t2t/data' TRAIN_DIR = 'gs://mesolitica-tpu-general/t2t-small' PROBLEM = 'seq2_seq' t2t_problem = problems.problem(PROBLEM) train_steps = 500000 eval_steps = 10 batch_size = 32 save_checkpoints_steps = 25000 ALPHA = 0.003 schedule = 'continuous_train_and_eval' MODEL = 'transformer' HPARAMS = 'transformer_base' from tensor2tensor.utils.trainer_lib import create_run_config, create_experiment from tensor2tensor.utils.trainer_lib import create_hparams from tensor2tensor.utils import registry from tensor2tensor import models from tensor2tensor import problems hparams = create_hparams(HPARAMS) hparams.batch_size = batch_size hparams.learning_rate = ALPHA hparams.train_batch_size = batch_size hparams.filter_size = 3072 hparams.hidden_size = 768 hparams.num_heads = 12 hparams.num_hidden_layers = 8 hparams.vocab_divisor = 128 hparams.dropout = 0.1 # LM hparams.label_smoothing = 0.0 hparams.shared_embedding_and_softmax_weights = False hparams.eval_drop_long_sequences = True hparams.max_length = 1024 hparams.multiproblem_mixing_schedule = 'pretrain' hparams.use_fixed_batch_size = True # tpu hparams.symbol_modality_num_shards = 1 hparams.attention_dropout_broadcast_dims = '0,1' hparams.relu_dropout_broadcast_dims = '1' hparams.layer_prepostprocess_dropout_broadcast_dims = '1' hparams.optimizer = 'Adafactor' hparams.learning_rate_warmup_steps = 10000 hparams.learning_rate_schedule = 'rsqrt_decay' print(hparams) RUN_CONFIG = create_run_config( model_dir = TRAIN_DIR, model_name = MODEL, save_checkpoints_steps = save_checkpoints_steps, use_tpu = True, cloud_tpu_name = 'node-6', iterations_per_loop = 100, schedule = 'train', ) tensorflow_exp_fn = create_experiment( run_config = RUN_CONFIG, hparams = hparams, model_name = MODEL, problem_name = PROBLEM, data_dir = DATA_DIR, train_steps = train_steps, eval_steps = eval_steps, use_tpu = True, use_tpu_estimator = False, schedule = 'train', # use_xla=True # For acceleration ) tensorflow_exp_fn.train()
/** * Copyright 2017 IBM Corp. All Rights Reserved. * * 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. */ const parseData = data => ({ topics: data.result.aggregations[0].results, rawData: data }); const topicStory = item => item.aggregations[0].hits.hits[0]; const objectWithoutProperties = (object, properties) => { 'use strict'; var obj = {}; var keys = Object.keys(object); keys.forEach(key => { if (!~properties.indexOf(key)) { obj[key] = object[key]; } }); return obj; }; module.exports = { parseData, topicStory, objectWithoutProperties };
# Copyrights. All rights reserved. # ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, # Space Center (eSpace), 2018 # See the LICENSE.TXT file for more details. import os import time import torch as th from practical_deep_stereo import visualization def get_learning_rate(optimizer): for param_group in optimizer.param_groups: return param_group['lr'] def _is_on_cuda(network): return next(network.parameters()).is_cuda def _is_logging_required(example_index, number_of_examples): """Returns True only if logging is required. Logging is performed after 10%, 20%, ... 100% percents of examples is processed. """ return (example_index + 1) % max(1, number_of_examples // 10) == 0 def _set_fastest_cuda_mode(): th.backends.cudnn.fastest = True th.backends.cudnn.benchmark = True def _move_tensors_to_cuda(dictionary_of_tensors): if isinstance(dictionary_of_tensors, dict): return { key: _move_tensors_to_cuda(value) for key, value in dictionary_of_tensors.items() } return dictionary_of_tensors.cuda() class Trainer(object): def __init__(self, parameters): """Returns initialized trainer object. Args: parameters: dictionary with parameters, that should have the same names as attributes of the class (but without underscore). """ if th.cuda.is_available(): _set_fastest_cuda_mode() self._experiment_folder = None self._current_epoch = 0 self._end_epoch = None self._learning_rate_scheduler = None self._network = None self._training_set_loader = None self._test_set_loader = None self._optimizer = None self._criterion = None self._current_losses = [] self._current_errors = [] self._current_processing_times = [] self._training_losses = [] self._test_errors = [] self._number_of_examples_to_visualize = 3 self.from_dictionary(parameters) def from_dictionary(self, parameters): attributes = vars(self) for key, value in parameters.items(): _key = '_{0}'.format(key) attributes[_key] = value def _initialize_filenames(self): self._log_filename = os.path.join(self._experiment_folder, 'log.txt') self._plot_filename = os.path.join(self._experiment_folder, 'plot.png') self._checkpoint_template = os.path.join(self._experiment_folder, '{0:03d}_checkpoint.bin') def load_checkpoint(self, filename, load_only_network=False): """Initilizes trainer from checkpoint. Args: filename: file with the checkpoint. load_only_network: if the flag is set, the function only loads the network (can be usefull for fine-tuning). """ checkpoint = th.load(filename) self._network.load_state_dict(checkpoint['network']) if load_only_network: return parameters = { 'current_epoch': len(checkpoint['training_losses']), 'training_losses': checkpoint['training_losses'], 'test_errors': checkpoint['test_errors'] } self.from_dictionary(parameters) self._optimizer.load_state_dict(checkpoint['optimizer']) self._learning_rate_scheduler.load_state_dict( checkpoint['learning_rate_scheduler']) def _save_checkpoint(self): th.save({ 'training_losses': self._training_losses, 'test_errors': self._test_errors, 'network': self._network.state_dict(), 'optimizer': self._optimizer.state_dict(), 'learning_rate_scheduler': self._learning_rate_scheduler.state_dict() }, self._checkpoint_template.format(self._current_epoch + 1)) def train(self): """Trains network and returns validation error of last epoch.""" self._initialize_filenames() self._logger = visualization.Logger(self._log_filename) start_epoch = self._current_epoch if start_epoch == self._end_epoch: return None self._logger.log("Training started.") for self._current_epoch in range(start_epoch, self._end_epoch): self._training_losses.append(self._train_for_epoch()) self._test_errors.append(self._test()[0]) self._report_training_progress() self._learning_rate_scheduler.step() self._save_checkpoint() self._current_epoch = self._end_epoch return self._test_errors[-1] def _run_network_and_measure_time(self, example): if th.cuda.is_available(): th.cuda.synchronize() start_time = time.time() self._run_network(example) if th.cuda.is_available(): th.cuda.synchronize() example['processing_time'] = float(time.time() - start_time) def _report_test_results(self, error, processing_time): """Reports test results.""" raise NotImplementedError('"_report_test_results" method should ' 'be implemented in a child class.') def _run_network(self, batch_or_example): """Runs network and adds output to "batch_or_example".""" raise NotImplementedError('"_run_network" method should ' 'be implemented in a child class.') def _compute_gradients_wrt_loss(self, batch): """Computes loss, gradients w.r.t loss and saves loss. The loss should be saved to "loss" item of "batch". """ raise NotImplementedError('"_compute_loss" method should ' 'be implemented in a child class.') def _compute_error(self, example): """Computes error and adds it to "example" as an "error" item.""" raise NotImplementedError('"_compute_error" method should ' 'be implemented in a child class.') def _visualize_example(self, example, example_index): """Visualize result for the example during validation and test. Args: example: should include network input and output necessary for the visualization. example_index: index of the example. """ raise NotImplementedError('"_visualize_example" method should ' 'be implemented in a child class.') def _average_errors(self, errors): """Returns average error.""" raise NotImplementedError('"_average_errors" method should ' 'be implemented in a child class.') def _average_losses(self, losses): """Returns average loss.""" raise NotImplementedError('"_average_losses" method should ' 'be implemented in a child class.') def _average_processing_time(self, processing_times): """Returns average processing time.""" raise NotImplementedError('"_average_processing_time" method should ' 'be implemented in a child class.') def _report_training_progress(self): """Report current training progress after current epoch. The report, for example, may include training plot and log update. """ raise NotImplementedError('"_report_training_progress" method should ' 'be implemented in a child class.') def _train_for_epoch(self): """Returns training set losses.""" self._network.train() self._current_losses = [] number_of_batches = len(self._training_set_loader) for batch_index, batch in enumerate(self._training_set_loader): if _is_logging_required(batch_index, number_of_batches): self._logger.log('epoch {0:02d} ({1:02d}) : ' 'training: {2:05d} ({3:05d})'.format( self._current_epoch + 1, self._end_epoch, batch_index + 1, number_of_batches)) self._optimizer.zero_grad() if _is_on_cuda(self._network): batch = _move_tensors_to_cuda(batch) self._run_network(batch) self._compute_gradients_wrt_loss(batch) self._optimizer.step() self._current_losses.append(batch['loss']) del batch th.cuda.empty_cache() return self._average_losses(self._current_losses) def _test(self): """Returns test set errors.""" self._network.eval() self._current_errors = [] self._current_processing_times = [] number_of_examples = len(self._test_set_loader) for example_index, example in enumerate(self._test_set_loader): if _is_logging_required(example_index, number_of_examples): self._logger.log('epoch: {0:02d} ({1:02d}) : ' 'validation: {2:05d} ({3:05d})'.format( self._current_epoch + 1, self._end_epoch, example_index + 1, number_of_examples)) if _is_on_cuda(self._network): example = _move_tensors_to_cuda(example) with th.no_grad(): self._run_network_and_measure_time(example) self._compute_error(example) self._current_errors.append(example['error']) self._current_processing_times.append(example['processing_time']) self._visualize_example(example, example_index) del example th.cuda.empty_cache() return (self._average_errors(self._current_errors), self._average_processing_time(self._current_processing_times)) def test(self): """Test network and reports average errors and execution time.""" self._initialize_filenames() self._logger = visualization.Logger(self._log_filename) average_errors, average_processing_time = self._test() self._report_test_results(average_errors, average_processing_time) return average_errors, average_processing_time
import os import time import torch import numpy as np """[ElegantRL](https://github.com/AI4Finance-LLC/ElegantRL)""" class Evaluator: def __init__(self, cwd, agent_id, device, env, eval_times1, eval_times2, eval_gap, ): self.recorder = list() # total_step, r_avg, r_std, obj_c, ... self.recorder_path = f'{cwd}/recorder.npy' self.env = env self.cwd = cwd self.device = device self.agent_id = agent_id self.eval_gap = eval_gap self.eval_times1 = eval_times1 self.eval_times2 = eval_times2 self.target_return = env.target_return self.used_time = None self.start_time = time.time() self.eval_time = 0 self.total_step = 0 self.r_max = -np.inf print(f"{'#' * 80}\n" f"{'ID':<3}{'Step':>8}{'maxR':>8} |" f"{'avgR':>8}{'stdR':>7}{'avgS':>7}{'stdS':>6} |" f"{'expR':>8}{'objC':>7}{'etc.':>7}") def evaluate_and_save(self, act, steps, r_exp, log_tuple) -> bool: self.total_step += steps # update total training steps if time.time() - self.eval_time < self.eval_gap: return False # if_reach_goal self.eval_time = time.time() '''evaluate first time''' rewards_steps_list = [get_episode_return_and_step(self.env, act, self.device) for _ in range(self.eval_times1)] r_avg, r_std, s_avg, s_std = self.get_r_avg_std_s_avg_std(rewards_steps_list) '''evaluate second time''' if r_avg > self.r_max: # evaluate actor twice to save CPU Usage and keep precision rewards_steps_list += [get_episode_return_and_step(self.env, act, self.device) for _ in range(self.eval_times2 - self.eval_times1)] r_avg, r_std, s_avg, s_std = self.get_r_avg_std_s_avg_std(rewards_steps_list) '''save the policy network''' if r_avg > self.r_max: # save checkpoint with highest episode return self.r_max = r_avg # update max reward (episode return) act_save_path = f'{self.cwd}/actor.pth' torch.save(act.state_dict(), act_save_path) # save policy network in *.pth print(f"{self.agent_id:<3}{self.total_step:8.2e}{self.r_max:8.2f} |") # save policy and print self.recorder.append((self.total_step, r_avg, r_std, r_exp, *log_tuple)) # update recorder '''print some information to Terminal''' if_reach_goal = bool(self.r_max > self.target_return) # check if_reach_goal if if_reach_goal and self.used_time is None: self.used_time = int(time.time() - self.start_time) print(f"{'ID':<3}{'Step':>8}{'TargetR':>8} |" f"{'avgR':>8}{'stdR':>7}{'avgS':>7}{'stdS':>6} |" f"{'UsedTime':>8} ########\n" f"{self.agent_id:<3}{self.total_step:8.2e}{self.target_return:8.2f} |" f"{r_avg:8.2f}{r_std:7.1f}{s_avg:7.0f}{s_std:6.0f} |" f"{self.used_time:>8} ########") print(f"{self.agent_id:<3}{self.total_step:8.2e}{self.r_max:8.2f} |" f"{r_avg:8.2f}{r_std:7.1f}{s_avg:7.0f}{s_std:6.0f} |" f"{r_exp:8.2f}{''.join(f'{n:7.2f}' for n in log_tuple)}") self.draw_plot() return if_reach_goal @staticmethod def get_r_avg_std_s_avg_std(rewards_steps_list): rewards_steps_ary = np.array(rewards_steps_list, dtype=np.float32) r_avg, s_avg = rewards_steps_ary.mean(axis=0) # average of episode return and episode step r_std, s_std = rewards_steps_ary.std(axis=0) # standard dev. of episode return and episode step return r_avg, r_std, s_avg, s_std def save_or_load_recoder(self, if_save): if if_save: np.save(self.recorder_path, self.recorder) elif os.path.exists(self.recorder_path): recorder = np.load(self.recorder_path) self.recorder = [tuple(i) for i in recorder] # convert numpy to list self.total_step = self.recorder[-1][0] def draw_plot(self): if len(self.recorder) == 0: print("| save_npy_draw_plot() WARNNING: len(self.recorder)==0") return None np.save(self.recorder_path, self.recorder) '''draw plot and save as png''' train_time = int(time.time() - self.start_time) total_step = int(self.recorder[-1][0]) save_title = f"step_time_maxR_{int(total_step)}_{int(train_time)}_{self.r_max:.3f}" save_learning_curve(self.recorder, self.cwd, save_title) def get_episode_return_and_step(env, act, device) -> (float, int): episode_return = 0.0 # sum of rewards in an episode episode_step = 1 max_step = env.max_step if_discrete = env.if_discrete state = env.reset() for episode_step in range(max_step): s_tensor = torch.as_tensor((state,), device=device) a_tensor = act(s_tensor) if if_discrete: a_tensor = a_tensor.argmax(dim=1) action = a_tensor.detach().cpu().numpy()[0] # not need detach(), because with torch.no_grad() outside state, reward, done, _ = env.step(action) episode_return += reward if done: break episode_return = getattr(env, 'episode_return', episode_return) return episode_return, episode_step def save_learning_curve(recorder=None, cwd='.', save_title='learning curve', fig_name='plot_learning_curve.jpg'): if recorder is None: recorder = np.load(f"{cwd}/recorder.npy") recorder = np.array(recorder) steps = recorder[:, 0] # x-axis is training steps r_avg = recorder[:, 1] r_std = recorder[:, 2] r_exp = recorder[:, 3] obj_c = recorder[:, 4] obj_a = recorder[:, 5] '''plot subplots''' import matplotlib as mpl mpl.use('Agg') """Generating matplotlib graphs without a running X server [duplicate] write `mpl.use('Agg')` before `import matplotlib.pyplot as plt` https://stackoverflow.com/a/4935945/9293137 """ import matplotlib.pyplot as plt fig, axs = plt.subplots(2) '''axs[0]''' ax00 = axs[0] ax00.cla() ax01 = axs[0].twinx() color01 = 'darkcyan' ax01.set_ylabel('Explore AvgReward', color=color01) ax01.plot(steps, r_exp, color=color01, alpha=0.5, ) ax01.tick_params(axis='y', labelcolor=color01) color0 = 'lightcoral' ax00.set_ylabel('Episode Return') ax00.plot(steps, r_avg, label='Episode Return', color=color0) ax00.fill_between(steps, r_avg - r_std, r_avg + r_std, facecolor=color0, alpha=0.3) ax00.grid() '''axs[1]''' ax10 = axs[1] ax10.cla() ax11 = axs[1].twinx() color11 = 'darkcyan' ax11.set_ylabel('objC', color=color11) ax11.fill_between(steps, obj_c, facecolor=color11, alpha=0.2, ) ax11.tick_params(axis='y', labelcolor=color11) color10 = 'royalblue' ax10.set_xlabel('Total Steps') ax10.set_ylabel('objA', color=color10) ax10.plot(steps, obj_a, label='objA', color=color10) ax10.tick_params(axis='y', labelcolor=color10) for plot_i in range(6, recorder.shape[1]): other = recorder[:, plot_i] ax10.plot(steps, other, label=f'{plot_i}', color='grey', alpha=0.5) ax10.legend() ax10.grid() '''plot save''' plt.title(save_title, y=2.3) plt.savefig(f"{cwd}/{fig_name}") plt.close('all') # avoiding warning about too many open figures, rcParam `figure.max_open_warning` # plt.show() # if use `mpl.use('Agg')` to draw figures without GUI, then plt can't plt.show() def check_save_learning_curve(): cwd = './AgentPPO_Pendulum-v0_0' save_learning_curve(recorder=None, cwd=cwd) if __name__ == '__main__': check_save_learning_curve()
const initialState = { data: null, userLogin: false }; const userAccountReducer = (state = initialState, action) => { switch(action.type) { case 'USER_ACCOUNT' : return { ...state, data : action.payload, userLogin : action.status }; case 'USER_LOGOUT' : return { data: null, userLogin: false } default : return state; } } export default userAccountReducer;
/*************************************************************************** *cr *cr (C) Copyright 2007 The Board of Trustees of the *cr University of Illinois *cr All Rights Reserved *cr ***************************************************************************/ #ifndef __FILEH__ #define __FILEH__ void inputData(char* fName, int* len, int* depth, int* dim,int *nzcnt_len,int *pad, float** h_data, int** h_indices, int** h_ptr, int** h_perm, int** h_nzcnt); void input_vec(char* fNanme, float *h_vec,int dim); void outputData(char* fName, float *h_Ax_vector,int dim); #endif
import unittest from concurrent.futures import ThreadPoolExecutor from unittest.mock import mock_open from dirhunt import __version__ from dirhunt.tests._compat import Mock, patch from dirhunt.crawler import Crawler from dirhunt.crawler_url import CrawlerUrl from dirhunt.processors import GenericProcessor from dirhunt.tests.base import CrawlerTestBase REPORT_DATA = { "version": __version__, "processed": [ { "crawler_url": { "depth": 3, "exists": None, "flags": [ "302", "redirect" ], "type": "directory", "url": { "address": "https://site.com/", "domain": "site.com" } }, "line": "", "processor_class": "ProcessRedirect", "status_code": 302 }, ], "processing": [ "https://site.com/path/", ] } class TestCrawler(CrawlerTestBase, unittest.TestCase): def test_print_results(self): crawler = self.get_crawler() crawler_url = CrawlerUrl(crawler, self.url) crawler.results.put(GenericProcessor(None, crawler_url)) crawler.print_results() @patch('dirhunt.crawler.json.dump') @patch('builtins.open') def test_create_report(self, _, mock_dump): crawler = self.get_crawler() crawler.results.put(GenericProcessor(None, CrawlerUrl(crawler, self.url))) crawler.create_report(crawler.get_resume_file()) mock_dump.assert_called_once() @patch('dirhunt.crawler.json.load', return_value=REPORT_DATA) @patch('dirhunt.crawler.Crawler.echo', return_value=REPORT_DATA) @patch('dirhunt.crawler.Crawler.add_url', return_value=REPORT_DATA) @patch('builtins.open') def test_resume(self, _, m1, m2, m3): crawler = self.get_crawler() crawler.resume(crawler.get_resume_file()) m3.assert_called_once() m2.assert_called_once() m1.assert_called_once_with(REPORT_DATA['processing'][0], lock=False) def test_print_results_limit(self): crawler = self.get_crawler(limit=1) crawler.current_processed_count = 1 crawler_url = CrawlerUrl(crawler, self.url) crawler.results.put(GenericProcessor(None, crawler_url)) crawler.print_results() self.assertTrue(crawler.closing) def test_add_url(self): crawler = self.get_crawler() crawler.domains.add('domain.com') crawler_url = CrawlerUrl(crawler, self.url) with patch.object(ThreadPoolExecutor, 'submit') as mock_method: crawler.add_url(crawler_url) def test_add_init_urls(self): crawler = self.get_crawler() with patch.object(Crawler, 'add_url') as m: crawler.add_init_urls(self.url) m.assert_called_once() self.assertEqual(crawler.domains, {'domain.com'}) def test_erase_tty(self): crawler = self.get_crawler() crawler.std = Mock(**{'isatty.return_value': True}) crawler.erase() @patch('dirhunt.crawler.Crawler.create_report') @patch('dirhunt.crawler.unregister') def test_close(self, m1, m2): crawler = self.get_crawler() crawler.close(True) m2.assert_called_once() m1.assert_called_once()
# -*- coding: utf-8 -*- ''' Error generator to enable integration testing of salt runner error handling ''' # Import python libs # Import salt libs import salt.utils.error def error(name=None, message=''): ''' If name is None Then return empty dict Otherwise raise an exception with __name__ from name, message from message CLI Example: .. code-block:: bash salt-run error salt-run error.error name="Exception" message="This is an error." ''' ret = {} if name is not None: salt.utils.error.raise_error(name=name, message=message) return ret
// @flow type O = {}; type F = () => void; type T = [boolean, ?number]; type ObjMapAlias = $ObjMap<O, F>; type ObjMapAliasLiteral = $ObjMap<{}, () => number>; type ObjMapiAlias = $ObjMapi<O, F>; type TupleMapAliasTuple = $ObjMapi<T, F>; type TupleMapAliasObj = $ObjMapi<O, F>; let ObjMapTypeAnnotation: $ObjMap<O, F>;
# -*- encoding: utf-8 -*- import functools as ft from inspect import getdoc import re import h2o from h2o.automl._base import H2OAutoMLBaseMixin from h2o.automl._h2o_automl_output import H2OAutoMLOutput from h2o.base import Keyed from h2o.estimators import H2OEstimator from h2o.exceptions import H2OResponseError, H2OValueError from h2o.frame import H2OFrame from h2o.job import H2OJob from h2o.utils.shared_utils import check_id from h2o.utils.typechecks import assert_is_type, is_type, numeric _params_doc_ = dict() # holds the doc per param extracted from H2OAutoML constructor def _extract_params_doc(docstr): pat = re.compile(r"^:param (\w+ )?(?P<name>\w+):\s?(?P<doc>.*)") # match param doc-start in Sphinx format ":param type name: description" lines = docstr.splitlines() param, doc = None, None for l in lines: m = pat.match(l) if m: if param: _params_doc_[param] = "\n".join(doc) param = m.group('name') doc = [m.group('doc')] elif param: doc.append(l) def _aml_property(param_path, name=None, types=None, validate_fn=None, freezable=False, set_input=True): path = param_path.split('.') name = name or path[-1] def attr_name(self, attr): return ("_"+self.__class__.__name__+attr) if attr.startswith('__') and not attr.endswith('__') else attr def _fget(self): _input = getattr(self, attr_name(self, '__input')) return _input.get(name) def _fset(self, value): if freezable and getattr(self, attr_name(self, '__frozen'), False): raise H2OValueError("Param ``%s`` can not be modified after the first call to ``train``." % name, name) if types is not None: assert_is_type(value, *types) input_val = value if validate_fn: value = validate_fn(self, value) _input = getattr(self, attr_name(self, '__input')) _input[name] = input_val if set_input else value group = getattr(self, attr_name(self, path[0])) if group is None: group = {} setattr(self, attr_name(self, path[0]), group) obj = group for t in path[1:-1]: tmp = obj.get(t) if tmp is None: tmp = obj[t] = {} obj = tmp obj[path[-1]] = value return property(fget=_fget, fset=_fset, doc=_params_doc_.get(name, None)) class H2OAutoML(H2OAutoMLBaseMixin, Keyed): """ Automatic Machine Learning The Automatic Machine Learning (AutoML) function automates the supervised machine learning model training process. The current version of AutoML trains and cross-validates the following algorithms (in the following order): three pre-specified XGBoost GBM (Gradient Boosting Machine) models, a fixed grid of GLMs, a default Random Forest (DRF), five pre-specified H2O GBMs, a near-default Deep Neural Net, an Extremely Randomized Forest (XRT), a random grid of XGBoost GBMs, a random grid of H2O GBMs, and a random grid of Deep Neural Nets. In some cases, there will not be enough time to complete all the algorithms, so some may be missing from the leaderboard. AutoML then trains two Stacked Ensemble models, one of all the models, and one of only the best models of each kind. :examples: >>> import h2o >>> from h2o.automl import H2OAutoML >>> h2o.init() >>> # Import a sample binary outcome train/test set into H2O >>> train = h2o.import_file("https://s3.amazonaws.com/erin-data/higgs/higgs_train_10k.csv") >>> test = h2o.import_file("https://s3.amazonaws.com/erin-data/higgs/higgs_test_5k.csv") >>> # Identify the response and set of predictors >>> y = "response" >>> x = list(train.columns) #if x is defined as all columns except the response, then x is not required >>> x.remove(y) >>> # For binary classification, response should be a factor >>> train[y] = train[y].asfactor() >>> test[y] = test[y].asfactor() >>> # Run AutoML for 30 seconds >>> aml = H2OAutoML(max_runtime_secs = 30) >>> aml.train(x = x, y = y, training_frame = train) >>> # Print Leaderboard (ranked by xval metrics) >>> aml.leaderboard >>> # (Optional) Evaluate performance on a test set >>> perf = aml.leader.model_performance(test) >>> perf.auc() """ def __init__(self, nfolds=5, balance_classes=False, class_sampling_factors=None, max_after_balance_size=5.0, max_runtime_secs=None, max_runtime_secs_per_model=None, max_models=None, stopping_metric="AUTO", stopping_tolerance=None, stopping_rounds=3, seed=None, project_name=None, exclude_algos=None, include_algos=None, exploitation_ratio=0, modeling_plan=None, preprocessing=None, monotone_constraints=None, keep_cross_validation_predictions=False, keep_cross_validation_models=False, keep_cross_validation_fold_assignment=False, sort_metric="AUTO", export_checkpoints_dir=None, verbosity="warn", **kwargs): """ Create a new H2OAutoML instance. :param int nfolds: Number of folds for k-fold cross-validation. Use ``0`` to disable cross-validation; this will also disable Stacked Ensemble (thus decreasing the overall model performance). Defaults to ``5``. :param bool balance_classes: Balance training data class counts via over/under-sampling (for imbalanced data). Defaults to ``False``. :param class_sampling_factors: Desired over/under-sampling ratios per class (in lexicographic order). If not specified, sampling factors will be automatically computed to obtain class balance during training. :param float max_after_balance_size: Maximum relative size of the training data after balancing class counts (can be less than 1.0). Requires ``balance_classes``. Defaults to ``5.0``. :param int max_runtime_secs: Specify the maximum time that the AutoML process will run for, prior to training the final Stacked Ensemble models. If neither ``max_runtime_secs`` nor ``max_models`` are specified by the user, then ``max_runtime_secs``. Defaults to 3600 seconds (1 hour). :param int max_runtime_secs_per_model: Controls the max time the AutoML run will dedicate to each individual model. Defaults to ``0`` (disabled: no time limit). :param int max_models: Specify the maximum number of models to build in an AutoML run, excluding the Stacked Ensemble models. Defaults to ``0`` (disabled: no limitation). :param str stopping_metric: Specifies the metric to use for early stopping. The available options are: ``"AUTO"`` (This defaults to ``"logloss"`` for classification, ``"deviance"`` for regression), ``"deviance"``, ``"logloss"``, ``"mse"``, ``"rmse"``, ``"mae"``, ``"rmsle"``, ``"auc"``, ``aucpr``, ``"lift_top_group"``, ``"misclassification"``, ``"mean_per_class_error"``, ``"r2"``. Defaults to ``"AUTO"``. :param float stopping_tolerance: Specify the relative tolerance for the metric-based stopping to stop the AutoML run if the improvement is less than this value. Defaults to ``0.001`` if the dataset is at least 1 million rows; otherwise it defaults to a value determined by the size of the dataset and the non-NA-rate, in which case the value is computed as 1/sqrt(nrows * non-NA-rate). :param int stopping_rounds: Stop training new models in the AutoML run when the option selected for stopping_metric doesn't improve for the specified number of models, based on a simple moving average. To disable this feature, set it to ``0``. Defaults to ``3`` and must be an non-negative integer. :param int seed: Set a seed for reproducibility. AutoML can only guarantee reproducibility if ``max_models`` or early stopping is used because ``max_runtime_secs`` is resource limited, meaning that if the resources are not the same between runs, AutoML may be able to train more models on one run vs another. Defaults to ``None``. :param str project_name: Character string to identify an AutoML project. Defaults to ``None``, which means a project name will be auto-generated based on the training frame ID. More models can be trained on an existing AutoML project by specifying the same project name in multiple calls to the AutoML function (as long as the same training frame, or a sample, is used in subsequent runs). :param exclude_algos: List the algorithms to skip during the model-building phase. The full list of options is: ``"DRF"`` (Random Forest and Extremely-Randomized Trees), ``"GLM"``, ``"XGBoost"``, ``"GBM"``, ``"DeepLearning"``, ``"StackedEnsemble"``. Defaults to ``None``, which means that all appropriate H2O algorithms will be used, if the search stopping criteria allow. Optional. Usage example: ``exclude_algos = ["GLM", "DeepLearning", "DRF"]``. :param include_algos: List the algorithms to restrict to during the model-building phase. This can't be used in combination with `exclude_algos` param. Defaults to ``None``, which means that all appropriate H2O algorithms will be used, if the search stopping criteria allow. Optional. :param exploitation_ratio: The budget ratio (between 0 and 1) dedicated to the exploitation (vs exploration) phase. By default, the exploitation phase is disabled (exploitation_ratio=0) as this is still experimental; to activate it, it is recommended to try a ratio around 0.1. Note that the current exploitation phase only tries to fine-tune the best XGBoost and the best GBM found during exploration. :param modeling_plan: List of modeling steps to be used by the AutoML engine (they may not all get executed, depending on other constraints). Defaults to None (Expert usage only). :param preprocessing: List of preprocessing steps to run. Only 'target_encoding' is currently supported. :param monotone_constraints: Dict representing monotonic constraints. Use +1 to enforce an increasing constraint and -1 to specify a decreasing constraint. :param keep_cross_validation_predictions: Whether to keep the predictions of the cross-validation predictions. This needs to be set to ``True`` if running the same AutoML object for repeated runs because CV predictions are required to build additional Stacked Ensemble models in AutoML. Defaults to ``False``. :param keep_cross_validation_models: Whether to keep the cross-validated models. Keeping cross-validation models may consume significantly more memory in the H2O cluster. Defaults to ``False``. :param keep_cross_validation_fold_assignment: Whether to keep fold assignments in the models. Deleting them will save memory in the H2O cluster. Defaults to ``False``. :param sort_metric: Metric to sort the leaderboard by. For binomial classification choose between ``"auc"``, ``"aucpr"``, ``"logloss"``, ``"mean_per_class_error"``, ``"rmse"``, ``"mse"``. For multinomial classification choose between ``"mean_per_class_error"``, ``"logloss"``, ``"rmse"``, ``"mse"``. For regression choose between ``"deviance"``, ``"rmse"``, ``"mse"``, ``"mae"``, ``"rmlse"``. Defaults to ``"AUTO"`` (This translates to ``"auc"`` for binomial classification, ``"mean_per_class_error"`` for multinomial classification, ``"deviance"`` for regression). :param export_checkpoints_dir: Path to a directory where every model will be stored in binary form. :param verbosity: Verbosity of the backend messages printed during training. Available options are None (live log disabled), ``"debug"``, ``"info"`` or ``"warn"``. Defaults to ``"warn"``. """ # early validate kwargs, extracting hidden parameters: algo_parameters = {} for k in kwargs: if k == 'algo_parameters': algo_parameters = kwargs[k] or {} else: raise TypeError("H2OAutoML got an unexpected keyword argument '%s'" % k) # Check if H2O jar contains AutoML try: h2o.api("GET /3/Metadata/schemas/AutoMLV99") except h2o.exceptions.H2OResponseError as e: print(e) print("*******************************************************************\n" \ "*Please verify that your H2O jar has the proper AutoML extensions.*\n" \ "*******************************************************************\n" \ "\nVerbose Error Message:") self._job = None self._leader_id = None self._leaderboard = None self._verbosity = verbosity self._event_log = None self._training_info = None self._state_json = None self._build_resp = None # contains all the actual parameters used on backend self.__frozen = False self.__input = dict() # contains all the input params as entered by the user # Make bare minimum params containers self.build_control = dict() self.build_models = dict() self.input_spec = dict() self.project_name = project_name self.nfolds = nfolds self.balance_classes = balance_classes self.class_sampling_factors = class_sampling_factors self.max_after_balance_size = max_after_balance_size self.keep_cross_validation_models = keep_cross_validation_models self.keep_cross_validation_fold_assignment = keep_cross_validation_fold_assignment self.keep_cross_validation_predictions = keep_cross_validation_predictions self.export_checkpoints_dir = export_checkpoints_dir self.max_runtime_secs = max_runtime_secs self.max_runtime_secs_per_model = max_runtime_secs_per_model self.max_models = max_models self.stopping_metric = stopping_metric self.stopping_tolerance = stopping_tolerance self.stopping_rounds = stopping_rounds self.seed = seed self.exclude_algos = exclude_algos self.include_algos = include_algos self.exploitation_ratio = exploitation_ratio self.modeling_plan = modeling_plan self.preprocessing = preprocessing if monotone_constraints is not None: algo_parameters['monotone_constraints'] = monotone_constraints self._algo_parameters = algo_parameters self.sort_metric = sort_metric #--------------------------------------------------------------------------- # AutoML params #--------------------------------------------------------------------------- def __validate_not_set(self, val, prop=None, message=None): assert val is None or getattr(self, prop, None) is None, message return val def __validate_project_name(self, project_name): check_id(project_name, "H2OAutoML") return project_name def __validate_nfolds(self, nfolds): assert nfolds == 0 or nfolds > 1, "nfolds set to %s; use nfolds >=2 if you want cross-validated metrics and Stacked Ensembles or use nfolds = 0 to disable." % nfolds return nfolds def __validate_modeling_plan(self, modeling_plan): if modeling_plan is None: return None supported_aliases = ['all', 'defaults', 'grids'] def assert_is_step_def(sd): assert 'name' in sd, "each definition must have a 'name' key" assert 0 < len(sd) < 3, "each definition must have only 1 or 2 keys: name, name+alias or name+steps" assert len(sd) == 1 or 'alias' in sd or 'steps' in sd, "steps definitions support only the following keys: name, alias, steps" assert 'alias' not in sd or sd['alias'] in supported_aliases, "alias must be one of %s" % supported_aliases assert 'steps' not in sd or (is_type(sd['steps'], list) and all(assert_is_step(s) for s in sd['steps'])) def assert_is_step(s): assert is_type(s, dict), "each step must be a dict with an 'id' key and an optional 'weight' key" assert 'id' in s, "each step must have an 'id' key" assert len(s) == 1 or ('weight' in s and is_type(s['weight'], int)), "weight must be an integer" return True plan = [] for step_def in modeling_plan: assert_is_type(step_def, dict, tuple, str) if is_type(step_def, dict): assert_is_step_def(step_def) plan.append(step_def) elif is_type(step_def, str): plan.append(dict(name=step_def)) else: assert 0 < len(step_def) < 3 assert_is_type(step_def[0], str) name = step_def[0] if len(step_def) == 1: plan.append(dict(name=name)) else: assert_is_type(step_def[1], str, list) ids = step_def[1] if is_type(ids, str): assert_is_type(ids, *supported_aliases) plan.append(dict(name=name, alias=ids)) else: plan.append(dict(name=name, steps=[dict(id=i) for i in ids])) return plan def __validate_preprocessing(self, preprocessing): if preprocessing is None: return assert all(p in ['target_encoding'] for p in preprocessing) return [dict(type=p.replace("_", "")) for p in preprocessing] def __validate_monotone_constraints(self, monotone_constraints): if monotone_constraints is None: self._algo_parameters.pop('monotone_constraints', None) else: self._algo_parameters['monotone_constraints'] = monotone_constraints return self.__validate_algo_parameters(self._algo_parameters) def __validate_algo_parameters(self, algo_parameters): if algo_parameters is None: return None algo_parameters_json = [] for k, v in algo_parameters.items(): scope, __, name = k.partition('__') if len(name) == 0: name, scope = scope, 'any' value = [dict(key=k, value=v) for k, v in v.items()] if isinstance(v, dict) else v # we can't use stringify_dict here as this will be converted into a JSON string algo_parameters_json.append(dict(scope=scope, name=name, value=value)) return algo_parameters_json def __validate_frame(self, fr, name=None, required=False): return H2OFrame._validate(fr, name, required=required) _extract_params_doc(getdoc(__init__)) project_name = _aml_property('build_control.project_name', types=(None, str), freezable=True, validate_fn=__validate_project_name) nfolds = _aml_property('build_control.nfolds', types=(int,), freezable=True, validate_fn=__validate_nfolds) balance_classes = _aml_property('build_control.balance_classes', types=(bool,), freezable=True) class_sampling_factors = _aml_property('build_control.class_sampling_factors', types=(None, [numeric]), freezable=True) max_after_balance_size = _aml_property('build_control.max_after_balance_size', types=(None, numeric), freezable=True) keep_cross_validation_models = _aml_property('build_control.keep_cross_validation_models', types=(bool,), freezable=True) keep_cross_validation_fold_assignment = _aml_property('build_control.keep_cross_validation_fold_assignment', types=(bool,), freezable=True) keep_cross_validation_predictions = _aml_property('build_control.keep_cross_validation_predictions', types=(bool,), freezable=True) export_checkpoints_dir = _aml_property('build_control.export_checkpoints_dir', types=(None, str), freezable=True) max_runtime_secs = _aml_property('build_control.stopping_criteria.max_runtime_secs', types=(None, int), freezable=True) max_runtime_secs_per_model = _aml_property('build_control.stopping_criteria.max_runtime_secs_per_model', types=(None, int), freezable=True) max_models = _aml_property('build_control.stopping_criteria.max_models', types=(None, int), freezable=True) stopping_metric = _aml_property('build_control.stopping_criteria.stopping_metric', types=(None, str), freezable=True) stopping_tolerance = _aml_property('build_control.stopping_criteria.stopping_tolerance', types=(None, numeric), freezable=True) stopping_rounds = _aml_property('build_control.stopping_criteria.stopping_rounds', types=(None, int), freezable=True) seed = _aml_property('build_control.stopping_criteria.seed', types=(None, int), freezable=True) exclude_algos = _aml_property('build_models.exclude_algos', types=(None, [str]), freezable=True, validate_fn=ft.partial(__validate_not_set, prop='include_algos', message="Use either `exclude_algos` or `include_algos`, not both.")) include_algos = _aml_property('build_models.include_algos', types=(None, [str]), freezable=True, validate_fn=ft.partial(__validate_not_set, prop='exclude_algos', message="Use either `exclude_algos` or `include_algos`, not both.")) exploitation_ratio = _aml_property('build_models.exploitation_ratio', types=(None, numeric), freezable=True) modeling_plan = _aml_property('build_models.modeling_plan', types=(None, list), freezable=True, validate_fn=__validate_modeling_plan) preprocessing = _aml_property('build_models.preprocessing', types=(None, [str]), freezable=True, validate_fn=__validate_preprocessing) monotone_constraints = _aml_property('build_models.algo_parameters', name='monotone_constraints', types=(None, dict), freezable=True, validate_fn=__validate_monotone_constraints) _algo_parameters = _aml_property('build_models.algo_parameters', types=(None, dict), freezable=True, validate_fn=__validate_algo_parameters) sort_metric = _aml_property('input_spec.sort_metric', types=(None, str)) fold_column = _aml_property('input_spec.fold_column', types=(None, int, str)) weights_column = _aml_property('input_spec.weights_column', types=(None, int, str)) training_frame = _aml_property('input_spec.training_frame', set_input=False, validate_fn=ft.partial(__validate_frame, name='training_frame', required=True)) validation_frame = _aml_property('input_spec.validation_frame', set_input=False, validate_fn=ft.partial(__validate_frame, name='validation_frame')) leaderboard_frame = _aml_property('input_spec.leaderboard_frame', set_input=False, validate_fn=ft.partial(__validate_frame, name='leaderboard_frame')) blending_frame = _aml_property('input_spec.blending_frame', set_input=False, validate_fn=ft.partial(__validate_frame, name='blending_frame')) response_column = _aml_property('input_spec.response_column', types=(str,)) #--------------------------------------------------------------------------- # Basic properties #--------------------------------------------------------------------------- @property def key(self): return self._job.dest_key if self._job else self.project_name @property def leader(self): return None if self._leader_id is None else h2o.get_model(self._leader_id) @property def leaderboard(self): return H2OFrame([]) if self._leaderboard is None else self._leaderboard @property def event_log(self): return H2OFrame([]) if self._event_log is None else self._event_log @property def training_info(self): return dict() if self._training_info is None else self._training_info @property def modeling_steps(self): """ expose the modeling steps effectively used by the AutoML run. This executed plan can be directly reinjected as the `modeling_plan` property of a new AutoML instance to improve reproducibility across AutoML versions. :return: a list of dictionaries representing the effective modeling plan. """ # removing alias key to be able to reinject result to a new AutoML instance return list(map(lambda sdef: dict(name=sdef['name'], steps=sdef['steps']), self._state_json['modeling_steps'])) #--------------------------------------------------------------------------- # Training AutoML #--------------------------------------------------------------------------- def train(self, x=None, y=None, training_frame=None, fold_column=None, weights_column=None, validation_frame=None, leaderboard_frame=None, blending_frame=None): """ Begins an AutoML task, a background task that automatically builds a number of models with various algorithms and tracks their performance in a leaderboard. At any point in the process you may use H2O's performance or prediction functions on the resulting models. :param x: A list of column names or indices indicating the predictor columns. :param y: An index or a column name indicating the response column. :param fold_column: The name or index of the column in training_frame that holds per-row fold assignments. :param weights_column: The name or index of the column in training_frame that holds per-row weights. :param training_frame: The H2OFrame having the columns indicated by x and y (as well as any additional columns specified by fold_column or weights_column). :param validation_frame: H2OFrame with validation data. This argument is ignored unless the user sets nfolds = 0. If cross-validation is turned off, then a validation frame can be specified and used for early stopping of individual models and early stopping of the grid searches. By default and when nfolds > 1, cross-validation metrics will be used for early stopping and thus validation_frame will be ignored. :param leaderboard_frame: H2OFrame with test data for scoring the leaderboard. This is optional and if this is set to None (the default), then cross-validation metrics will be used to generate the leaderboard rankings instead. :param blending_frame: H2OFrame used to train the the metalearning algorithm in Stacked Ensembles (instead of relying on cross-validated predicted values). This is optional, but when provided, it is also recommended to disable cross validation by setting `nfolds=0` and to provide a leaderboard frame for scoring purposes. :returns: An H2OAutoML object. :examples: >>> # Set up an H2OAutoML object >>> aml = H2OAutoML(max_runtime_secs=30) >>> # Launch an AutoML run >>> aml.train(y=y, training_frame=train) """ # Minimal required arguments are training_frame and y (response) self.training_frame = training_frame ncols = self.training_frame.ncols names = self.training_frame.names if y is None and self.response_column is None: raise H2OValueError('The response column (y) is not set; please set it to the name of the column that you are trying to predict in your data.') elif y is not None: assert_is_type(y, int, str) if is_type(y, int): if not (-ncols <= y < ncols): raise H2OValueError("Column %d does not exist in the training frame" % y) y = names[y] else: if y not in names: raise H2OValueError("Column %s does not exist in the training frame" % y) self.response_column = y self.fold_column = fold_column self.weights_column = weights_column self.validation_frame = validation_frame self.leaderboard_frame = leaderboard_frame self.blending_frame = blending_frame if x is not None: assert_is_type(x, list) xset = set() if is_type(x, int, str): x = [x] for xi in x: if is_type(xi, int): if not (-ncols <= xi < ncols): raise H2OValueError("Column %d does not exist in the training frame" % xi) xset.add(names[xi]) else: if xi not in names: raise H2OValueError("Column %s not in the training frame" % xi) xset.add(xi) ignored_columns = set(names) - xset for col in [y, fold_column, weights_column]: if col is not None and col in ignored_columns: ignored_columns.remove(col) if ignored_columns is not None: self.input_spec['ignored_columns'] = list(ignored_columns) def clean_params(params): return ({k: clean_params(v) for k, v in params.items() if v is not None} if isinstance(params, dict) else H2OEstimator._keyify(params)) automl_build_params = clean_params(dict( build_control=self.build_control, build_models=self.build_models, input_spec=self.input_spec, )) resp = self._build_resp = h2o.api('POST /99/AutoMLBuilder', json=automl_build_params) if 'job' not in resp: raise H2OResponseError("Backend failed to build the AutoML job: {}".format(resp)) if not self.project_name: self.project_name = resp['build_control']['project_name'] self.__frozen = True self._job = H2OJob(resp['job'], "AutoML") poll_updates = ft.partial(self._poll_training_updates, verbosity=self._verbosity, state={}) try: self._job.poll(poll_updates=poll_updates) finally: poll_updates(self._job, 1) self._fetch() #--------------------------------------------------------------------------- # Predict with AutoML #--------------------------------------------------------------------------- def predict(self, test_data): leader = self.leader if leader is None: self._fetch() leader = self.leader if leader is not None: return leader.predict(test_data) print("No model built yet...") #------------------------------------------------------------------------------------------------------------------- # Overrides #------------------------------------------------------------------------------------------------------------------- def detach(self): self.__frozen = False self.project_name = None h2o.remove(self.leaderboard) h2o.remove(self.event_log) #------------------------------------------------------------------------------------------------------------------- # Private #------------------------------------------------------------------------------------------------------------------- def _fetch(self): state = H2OAutoML._fetch_state(self.key) self._leader_id = state['leader_id'] self._leaderboard = state['leaderboard'] self._event_log = el = state['event_log'] self._training_info = { r[0]: r[1] for r in el[el['name'] != '', ['name', 'value']] .as_data_frame(use_pandas=False, header=False) } self._state_json = state['json'] return self._leader_id is not None def _poll_training_updates(self, job, bar_progress=0, verbosity=None, state=None): """ the callback function used to print verbose info when polling AutoML job. """ levels = ['Debug', 'Info', 'Warn'] if verbosity is None or verbosity.capitalize() not in levels: return levels = levels[levels.index(verbosity.capitalize()):] try: if job.progress > state.get('last_job_progress', 0): # print("\nbar_progress={}, job_progress={}".format(bar_progress, job.progress)) events = H2OAutoML._fetch_state(job.dest_key, properties=['event_log'])['event_log'] events = events[events['level'].isin(levels), :] last_nrows = state.get('last_events_nrows', 0) if events.nrows > last_nrows: fr = events[last_nrows:, ['timestamp', 'message']].as_data_frame(use_pandas=False, header=False) print('') for r in fr: print("{}: {}".format(r[0], r[1])) print('') state['last_events_nrows'] = events.nrows state['last_job_progress'] = job.progress except Exception as e: print("Failed polling AutoML progress log: {}".format(e)) @staticmethod def _fetch_leaderboard(aml_id, extensions=None): assert_is_type(extensions, None, str, [str]) extensions = ([] if extensions is None else [extensions] if is_type(extensions, str) else extensions) resp = h2o.api("GET /99/Leaderboards/%s" % aml_id, data=dict(extensions=extensions)) dest_key = resp['project_name'].split('@', 1)[0]+"_custom_leaderboard" lb = H2OAutoML._fetch_table(resp['table'], key=dest_key, progress_bar=False) return h2o.assign(lb[1:], dest_key) @staticmethod def _fetch_table(table, key=None, progress_bar=True): try: # Intentionally mask the progress bar here since showing multiple progress bars is confusing to users. # If any failure happens, revert back to user's original setting for progress and display the error message. ori_progress_state = H2OJob.__PROGRESS_BAR__ H2OJob.__PROGRESS_BAR__ = progress_bar # Parse leaderboard H2OTwoDimTable & return as an H2OFrame return h2o.H2OFrame(table.cell_values, destination_frame=key, column_names=table.col_header, column_types=table.col_types) finally: H2OJob.__PROGRESS_BAR__ = ori_progress_state @staticmethod def _fetch_state(aml_id, properties=None): state_json = h2o.api("GET /99/AutoML/%s" % aml_id) project_name = state_json["project_name"] if project_name is None: raise H2OValueError("No AutoML instance with id {}.".format(aml_id)) leaderboard_list = [key["name"] for key in state_json['leaderboard']['models']] leader_id = leaderboard_list[0] if (leaderboard_list is not None and len(leaderboard_list) > 0) else None should_fetch = lambda prop: properties is None or prop in properties leader = None if should_fetch('leader'): leader = h2o.get_model(leader_id) if leader_id is not None else None leaderboard = None if should_fetch('leaderboard'): leaderboard = H2OAutoML._fetch_table(state_json['leaderboard_table'], key=project_name+"_leaderboard", progress_bar=False) leaderboard = h2o.assign(leaderboard[1:], project_name+"_leaderboard") # removing index and reassign id to ensure persistence on backend event_log = None if should_fetch('event_log'): event_log = H2OAutoML._fetch_table(state_json['event_log_table'], key=project_name+"_eventlog", progress_bar=False) event_log = h2o.assign(event_log[1:], project_name+"_eventlog") # removing index and reassign id to ensure persistence on backend return dict( project_name=project_name, json=state_json, leader_id=leader_id, leader=leader, leaderboard=leaderboard, event_log=event_log, ) def get_automl(project_name): """ Retrieve information about an AutoML instance. :param str project_name: A string indicating the project_name of the automl instance to retrieve. :returns: A dictionary containing the project_name, leader model, leaderboard, event_log. """ state = H2OAutoML._fetch_state(project_name) return H2OAutoMLOutput(state) def get_leaderboard(aml, extra_columns=None): """ Retrieve the leaderboard from the AutoML instance. Contrary to the default leaderboard attached to the automl instance, this one can return columns other than the metrics. :param H2OAutoML aml: the instance for which to return the leaderboard. :param extra_columns: a string or a list of string specifying which optional columns should be added to the leaderboard. Defaults to None. Currently supported extensions are: - 'ALL': adds all columns below. - 'training_time_ms': column providing the training time of each model in milliseconds (doesn't include the training of cross validation models). - 'predict_time_per_row_ms`: column providing the average prediction time by the model for a single row. - 'algo': column providing the algorithm name for each model. :return: An H2OFrame representing the leaderboard. :examples: >>> aml = H2OAutoML(max_runtime_secs=30) >>> aml.train(y=y, training_frame=train) >>> lb_all = h2o.automl.get_leaderboard(aml, 'ALL') >>> lb_custom = h2o.automl.get_leaderboard(aml, ['predict_time_per_row_ms', 'training_time_ms']) >>> lb_custom_sorted = lb_custom.sort(by='predict_time_per_row_ms') """ assert_is_type(aml, H2OAutoML, H2OAutoMLOutput) return H2OAutoML._fetch_leaderboard(aml.key, extra_columns)
var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var compression = require('compression'); var routes = require('./routes/index'); var users = require('./routes/users'); var app = express(); var PORT = process.env.PORT || 3000; // view engine setup app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'ejs'); var options = { 'extended': 'true' }; app.use(favicon(__dirname + '/public/favicon.ico')); app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded(options)); app.use(compression()); app.use(cookieParser()); app.use(express.static(path.join(__dirname, 'public'))); app.use('/javascripts', express.static(__dirname + 'javascripts')); app.use('/bower_components', express.static(__dirname + '/bower_components')); app.use('/', routes); app.use('/users', users); /// catch 404 and forward to error handler app.use(function(req, res, next) { var err = new Error('Not Found'); err.status = 404; next(err); }); /// error handlers // development error handler // will print stacktrace if (app.get('env') === 'development') { app.use(function(err, req, res, next) { res.status(err.status || 500); res.render('error', { message: err.message, error: err }); }); } // production error handler // no stacktraces leaked to user app.use(function(err, req, res, next) { res.status(err.status || 500); res.render('error', { message: err.message, error: {} }); }); module.exports = app; var server = app.listen(PORT, function() { console.log('Express server listening on localhost:' + PORT); }); process.on('SIGINT', function onSigint() { console.info('Got SIGINT (aka ctrl-c in docker). Graceful shutdown ', new Date().toISOString()); shutdown(); }); // quit properly on docker stop process.on('SIGTERM', function onSigterm() { console.info('Got SIGTERM (docker container stop). Graceful shutdown ', new Date().toISOString()); shutdown(); }) // shut down server function shutdown() { server.close(function onServerClosed(err) { if (err) { console.error(err); process.exitCode = 1; } process.exit(); }) }
#ifndef _MMeshIntersector #define _MMeshIntersector //- // =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== //+ // // CLASS: MMeshIntersector // // **************************************************************************** #if defined __cplusplus // **************************************************************************** // INCLUDED HEADER FILES #include <float.h> #include <maya/MStatus.h> #include <maya/MPoint.h> #include <maya/MFloatPoint.h> #include <maya/MFloatVector.h> #include <maya/MMatrix.h> OPENMAYA_MAJOR_NAMESPACE_OPEN // **************************************************************************** // CLASS DECLARATION (MMeshIntersector) //! \ingroup OpenMaya //! \brief Mesh intersector. /*! The MMeshIntersector class contains methods for efficiently finding the closest point on a mesh. An octree algorithm is used to find the closest point. The create() method builds the internal data required for the algorithm. As a result, calls to it should be minimized as it is a heavy operation. This class allows multiple threads to evaluate closest points simultaneously as the method getClosestPoint is threadsafe. */ class OPENMAYA_EXPORT MMeshIntersector { public: MMeshIntersector(void); virtual ~MMeshIntersector(void); MStatus create( MObject &meshObject, const MMatrix& matrix = MMatrix::identity ); bool isCreated(void) const; MStatus getClosestPoint( const MPoint& point, MPointOnMesh& meshPoint, double maxDistance = DBL_MAX ) const; static const char* className(); protected: // No protected members private: void *instance; }; // Mesh point information. (OpenMaya) (OpenMaya.py) //! \ingroup OpenMaya //! \brief Mesh intersector result. /*! This class is used to return information about a point on a mesh: 3D position, normal, barycentric coordinates, etc. Note that this can be a point anywhere on the surface of the mesh, not just at vertices. */ class OPENMAYA_EXPORT MPointOnMesh { public: MPointOnMesh(); MFloatPoint & getPoint(); MFloatVector & getNormal(); void getBarycentricCoords(float& u, float& v) const; int faceIndex() const; int triangleIndex() const; protected: // No protected members private: friend class MMeshIntersector; MFloatPoint point; MFloatVector normal; int faceId; int triangleId; float baryU; float baryV; }; OPENMAYA_NAMESPACE_CLOSE #endif /* __cplusplus */ #endif /* _MMeshIntersector */
__all__ = ["GetNextPackage", "PackageDto"] from shipping.application.queries.package import GetNextPackage, PackageDto
/** * @license * Visual Blocks Language * * Copyright 2012 Google Inc. * https://developers.google.com/blockly/ * * 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. */ /** * @fileoverview Generating Python for list blocks. * @author q.neutron@gmail.com (Quynh Neutron) */ 'use strict'; goog.provide('Blockly.Python.lists'); goog.require('Blockly.Python'); Blockly.Python['lists_create_empty'] = function(block) { // Create an empty list. return ['[]', Blockly.Python.ORDER_ATOMIC]; }; Blockly.Python['lists_create_with'] = function(block) { // Create a list with any number of elements of any type. var code = new Array(block.itemCount_); for (var n = 0; n < block.itemCount_; n++) { code[n] = Blockly.Python.valueToCode(block, 'ADD' + n, Blockly.Python.ORDER_NONE) || 'None'; } code = '[' + code.join(', ') + ']'; return [code, Blockly.Python.ORDER_ATOMIC]; }; Blockly.Python['lists_repeat'] = function(block) { // Create a list with one element repeated. var argument0 = Blockly.Python.valueToCode(block, 'ITEM', Blockly.Python.ORDER_NONE) || 'None'; var argument1 = Blockly.Python.valueToCode(block, 'NUM', Blockly.Python.ORDER_MULTIPLICATIVE) || '0'; var code = '[' + argument0 + '] * ' + argument1; return [code, Blockly.Python.ORDER_MULTIPLICATIVE]; }; Blockly.Python['lists_length'] = function(block) { // List length. var argument0 = Blockly.Python.valueToCode(block, 'VALUE', Blockly.Python.ORDER_NONE) || '[]'; return ['len(' + argument0 + ')', Blockly.Python.ORDER_FUNCTION_CALL]; }; Blockly.Python['lists_isEmpty'] = function(block) { // Is the list empty? var argument0 = Blockly.Python.valueToCode(block, 'VALUE', Blockly.Python.ORDER_NONE) || '[]'; var code = 'not len(' + argument0 + ')'; return [code, Blockly.Python.ORDER_LOGICAL_NOT]; }; Blockly.Python['lists_indexOf'] = function(block) { // Find an item in the list. var argument0 = Blockly.Python.valueToCode(block, 'FIND', Blockly.Python.ORDER_NONE) || '[]'; var argument1 = Blockly.Python.valueToCode(block, 'VALUE', Blockly.Python.ORDER_MEMBER) || '\'\''; var code; if (block.getFieldValue('END') == 'FIRST') { var functionName = Blockly.Python.provideFunction_( 'first_index', ['def ' + Blockly.Python.FUNCTION_NAME_PLACEHOLDER_ + '(myList, elem):', ' try: theIndex = myList.index(elem) + 1', ' except: theIndex = 0', ' return theIndex']); code = functionName + '(' + argument1 + ', ' + argument0 + ')'; return [code, Blockly.Python.ORDER_FUNCTION_CALL]; } else { var functionName = Blockly.Python.provideFunction_( 'last_index', ['def ' + Blockly.Python.FUNCTION_NAME_PLACEHOLDER_ + '(myList, elem):', ' try: theIndex = len(myList) - myList[::-1].index(elem)', ' except: theIndex = 0', ' return theIndex']); code = functionName + '(' + argument1 + ', ' + argument0 + ')'; return [code, Blockly.Python.ORDER_FUNCTION_CALL]; } }; Blockly.Python['lists_getIndex'] = function(block) { // Get element at index. // Note: Until January 2013 this block did not have MODE or WHERE inputs. var mode = block.getFieldValue('MODE') || 'GET'; var where = block.getFieldValue('WHERE') || 'FROM_START'; var at = Blockly.Python.valueToCode(block, 'AT', Blockly.Python.ORDER_UNARY_SIGN) || '1'; var list = Blockly.Python.valueToCode(block, 'VALUE', Blockly.Python.ORDER_MEMBER) || '[]'; if (where == 'FIRST') { if (mode == 'GET') { var code = list + '[0]'; return [code, Blockly.Python.ORDER_MEMBER]; } else { var code = list + '.pop(0)'; if (mode == 'GET_REMOVE') { return [code, Blockly.Python.ORDER_FUNCTION_CALL]; } else if (mode == 'REMOVE') { return code + '\n'; } } } else if (where == 'LAST') { if (mode == 'GET') { var code = list + '[-1]'; return [code, Blockly.Python.ORDER_MEMBER]; } else { var code = list + '.pop()'; if (mode == 'GET_REMOVE') { return [code, Blockly.Python.ORDER_FUNCTION_CALL]; } else if (mode == 'REMOVE') { return code + '\n'; } } } else if (where == 'FROM_START') { // Blockly uses one-based indicies. if (Blockly.isNumber(at)) { // If the index is a naked number, decrement it right now. at = parseInt(at, 10) - 1; } else { // If the index is dynamic, decrement it in code. at = 'int(' + at + ' - 1)'; } if (mode == 'GET') { var code = list + '[' + at + ']'; return [code, Blockly.Python.ORDER_MEMBER]; } else { var code = list + '.pop(' + at + ')'; if (mode == 'GET_REMOVE') { return [code, Blockly.Python.ORDER_FUNCTION_CALL]; } else if (mode == 'REMOVE') { return code + '\n'; } } } else if (where == 'FROM_END') { if (mode == 'GET') { var code = list + '[-' + at + ']'; return [code, Blockly.Python.ORDER_MEMBER]; } else { var code = list + '.pop(-' + at + ')'; if (mode == 'GET_REMOVE') { return [code, Blockly.Python.ORDER_FUNCTION_CALL]; } else if (mode == 'REMOVE') { return code + '\n'; } } } else if (where == 'RANDOM') { Blockly.Python.definitions_['import_random'] = 'import random'; if (mode == 'GET') { code = 'random.choice(' + list + ')'; return [code, Blockly.Python.ORDER_FUNCTION_CALL]; } else { var functionName = Blockly.Python.provideFunction_( 'lists_remove_random_item', ['def ' + Blockly.Python.FUNCTION_NAME_PLACEHOLDER_ + '(myList):', ' x = int(random.random() * len(myList))', ' return myList.pop(x)']); code = functionName + '(' + list + ')'; if (mode == 'GET_REMOVE') { return [code, Blockly.Python.ORDER_FUNCTION_CALL]; } else if (mode == 'REMOVE') { return code + '\n'; } } } throw 'Unhandled combination (lists_getIndex).'; }; Blockly.Python['lists_setIndex'] = function(block) { // Set element at index. // Note: Until February 2013 this block did not have MODE or WHERE inputs. var list = Blockly.Python.valueToCode(block, 'LIST', Blockly.Python.ORDER_MEMBER) || '[]'; var mode = block.getFieldValue('MODE') || 'GET'; var where = block.getFieldValue('WHERE') || 'FROM_START'; var at = Blockly.Python.valueToCode(block, 'AT', Blockly.Python.ORDER_NONE) || '1'; var value = Blockly.Python.valueToCode(block, 'TO', Blockly.Python.ORDER_NONE) || 'None'; // Cache non-trivial values to variables to prevent repeated look-ups. // Closure, which accesses and modifies 'list'. function cacheList() { if (list.match(/^\w+$/)) { return ''; } var listVar = Blockly.Python.variableDB_.getDistinctName( 'tmp_list', Blockly.Variables.NAME_TYPE); var code = listVar + ' = ' + list + '\n'; list = listVar; return code; } if (where == 'FIRST') { if (mode == 'SET') { return list + '[0] = ' + value + '\n'; } else if (mode == 'INSERT') { return list + '.insert(0, ' + value + ')\n'; } } else if (where == 'LAST') { if (mode == 'SET') { return list + '[-1] = ' + value + '\n'; } else if (mode == 'INSERT') { return list + '.append(' + value + ')\n'; } } else if (where == 'FROM_START') { // Blockly uses one-based indicies. if (Blockly.isNumber(at)) { // If the index is a naked number, decrement it right now. at = parseInt(at, 10) - 1; } else { // If the index is dynamic, decrement it in code. at = 'int(' + at + ' - 1)'; } if (mode == 'SET') { return list + '[' + at + '] = ' + value + '\n'; } else if (mode == 'INSERT') { return list + '.insert(' + at + ', ' + value + ')\n'; } } else if (where == 'FROM_END') { if (mode == 'SET') { return list + '[-' + at + '] = ' + value + '\n'; } else if (mode == 'INSERT') { return list + '.insert(-' + at + ', ' + value + ')\n'; } } else if (where == 'RANDOM') { Blockly.Python.definitions_['import_random'] = 'import random'; var code = cacheList(); var xVar = Blockly.Python.variableDB_.getDistinctName( 'tmp_x', Blockly.Variables.NAME_TYPE); code += xVar + ' = int(random.random() * len(' + list + '))\n'; if (mode == 'SET') { code += list + '[' + xVar + '] = ' + value + '\n'; return code; } else if (mode == 'INSERT') { code += list + '.insert(' + xVar + ', ' + value + ')\n'; return code; } } throw 'Unhandled combination (lists_setIndex).'; }; Blockly.Python['lists_getSublist'] = function(block) { // Get sublist. var list = Blockly.Python.valueToCode(block, 'LIST', Blockly.Python.ORDER_MEMBER) || '[]'; var where1 = block.getFieldValue('WHERE1'); var where2 = block.getFieldValue('WHERE2'); var at1 = Blockly.Python.valueToCode(block, 'AT1', Blockly.Python.ORDER_ADDITIVE) || '1'; var at2 = Blockly.Python.valueToCode(block, 'AT2', Blockly.Python.ORDER_ADDITIVE) || '1'; if (where1 == 'FIRST' || (where1 == 'FROM_START' && at1 == '1')) { at1 = ''; } else if (where1 == 'FROM_START') { // Blockly uses one-based indicies. if (Blockly.isNumber(at1)) { // If the index is a naked number, decrement it right now. at1 = parseInt(at1, 10) - 1; } else { // If the index is dynamic, decrement it in code. at1 = 'int(' + at1 + ' - 1)'; } } else if (where1 == 'FROM_END') { if (Blockly.isNumber(at1)) { at1 = -parseInt(at1, 10); } else { at1 = '-int(' + at1 + ')'; } } if (where2 == 'LAST' || (where2 == 'FROM_END' && at2 == '1')) { at2 = ''; } else if (where1 == 'FROM_START') { if (Blockly.isNumber(at2)) { at2 = parseInt(at2, 10); } else { at2 = 'int(' + at2 + ')'; } } else if (where1 == 'FROM_END') { if (Blockly.isNumber(at2)) { // If the index is a naked number, increment it right now. // Add special case for -0. at2 = 1 - parseInt(at2, 10); if (at2 == 0) { at2 = ''; } } else { // If the index is dynamic, increment it in code. Blockly.Python.definitions_['import_sys'] = 'import sys'; at2 = 'int(1 - ' + at2 + ') or sys.maxsize'; } } var code = list + '[' + at1 + ' : ' + at2 + ']'; return [code, Blockly.Python.ORDER_MEMBER]; };
from rest_framework import serializers from hub.models import Project class ProjectSerializer(serializers.Serializer): project_name = serializers.CharField(max_length=30) duration = serializers.IntegerField() allocated_time = serializers.IntegerField()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # ----------------------------------------------------------------------------------------------------------- # Name: tinyserver.py # Purpose: Small server using threads that listens on a default port and returns a response # with echo of the same message received and additional information. # # Author: Gabriel Marti Fuentes # email: gabimarti at gmail dot com # GitHub: https://github.com/gabimarti # Created: 03/08/2019 v1.0 # Version: 1.0.1 # License: MIT License # ----------------------------------------------------------------------------------------------------------- import argparse import atexit import socket import sys import threading import time import traceback ######################################################## # CONSTANTS ######################################################## DESCRIPTION = 'Tiny Server' EPILOG = 'Listen and respond. Simply.' DEFAULT_MAXCLIENTS = 10 # Aka MAXTHREADS, every Client is a thread DEFAULT_VERBOSE_LEVEL = 1 # Default verbose level VERBOSE_LEVEL_DESCRIPTION = ['basic', 'a few', 'insane info'] # Verbose levels description DEFAULT_HOST_BIND = '' # Bind to all ports DEFAULT_PORT = 6666 # Default port DEFAULT_KILL_MESSAGE = 'kill' # If this message is received, the server will end. DEFAULT_MAX_BUFFER_SIZE = 4096 # Default max buffer size ENCODING = 'utf-8' # Encoding for message communication SHUTDOWN_RESPONSE = 'Shutting down the server' # Shutdown response to client ######################################################## # VARIABLES ######################################################## host_bind = DEFAULT_HOST_BIND max_clients = DEFAULT_MAXCLIENTS server_port = DEFAULT_PORT max_buffer_size = DEFAULT_MAX_BUFFER_SIZE kill_message = DEFAULT_KILL_MESSAGE verbose = DEFAULT_VERBOSE_LEVEL # Verbose level thread_counter = 0 # Total executed threads / clients thread_active_counter = 0 # active threads / clients thread_client_list = [] # List of active threads time_start = 0 # For Timer counter shutdown = False # It will be True when the server has to be closed. server = None # Global server socket ######################################################## # FUNCTIONS ######################################################## # Print the message if the verbose level allows def print_verbose(msg, verbose_level, established_verbose): if verbose_level <= established_verbose: print(msg) # Kill all client active sockets def kill_client_sockets(): global thread_client_list print_verbose('Killing clients ...', 1, verbose) for client in thread_client_list: try: client.shutdown(socket.SHUT_RDWR) client.close() except socket.error: pass # socket already closed. don't worry # Client input string processing def do_client_input_string_processing(input_string, verbose): print_verbose('Processing {}'.format(input_string), 1, verbose) # Reverse message input_processed = input_string[::-1] return input_processed # Client thread for each new connection def client_thread(conn, ip, port, buffer_size, verbose, kill_message): global shutdown, thread_active_counter, thread_client_list, server # Lock for shared counters operations lock = threading.Lock() lock.acquire() thread_active_counter += 1 thread_client_list.append(conn) lock.release() print_verbose('Total clients {} | Current active clients {}'.format(thread_counter, thread_active_counter), 1, verbose) # the input is in bytes, so decode it input_from_client_bytes = conn.recv(max_buffer_size) if not input_from_client_bytes: print_verbose('No data. from {}:{}'.format(ip, port), 1, verbose) # max_buffer_size indicates how big the message can be # this is test if it's sufficiently big siz = sys.getsizeof(input_from_client_bytes) if siz >= buffer_size: print_verbose('The length of input is probably too long: {}'.format(siz), 1, verbose) # decode input and strip the end of line input_from_client = input_from_client_bytes.decode(ENCODING).rstrip() # check if message is received to kill server if input_from_client == kill_message: print_verbose('Killing message received \'{}\''.format(input_from_client), 1, verbose) # response shutdown to client res = SHUTDOWN_RESPONSE res_encoded = res.encode(ENCODING) conn.sendall(res_encoded) shutdown = True try: print_verbose('Shutdown server from Client thread', 1, verbose) server.close() except Exception as e: print_verbose('Can\'t close Server from client thread', 1, verbose) print_verbose('Exception {}'.format(e), 1, verbose) kill_client_sockets() else: res = do_client_input_string_processing(input_from_client, verbose) print_verbose('Result of processing {} is: {}'.format(input_from_client, res), 1, verbose) res_encoded = res.encode(ENCODING) # encode the result string try: conn.sendall(res_encoded) # send it to client conn.close() # close connection except Exception as e: print_verbose('Socket Error: {:s} '.format(e), 1, verbose) # Lock for shared counters operations lock.acquire() thread_active_counter -= 1 thread_client_list.remove(conn) lock.release() print_verbose('Connection to {}:{} ended'.format(ip, port), 1, verbose) # Parse command line parameters def parse_params(): parser = argparse.ArgumentParser(description=DESCRIPTION, epilog=EPILOG) parser.add_argument('-i', '--interfacebind', type=str, default=DEFAULT_HOST_BIND, help='What interface is it linked to? Default (empty) to any of this host.') parser.add_argument('-c', '--maxclients', type=int, default=DEFAULT_MAXCLIENTS, help='Indicates the maximum number of clients/threads. Default value: {}' .format(DEFAULT_MAXCLIENTS)) parser.add_argument('-p', '--serverport', type=int, default=DEFAULT_PORT, help='Port to listen. Default value: {}'.format(DEFAULT_PORT)) parser.add_argument('-b', '--buffersize', type=int, default=DEFAULT_MAX_BUFFER_SIZE, help='Buffer size. Default value: {}'.format(DEFAULT_MAX_BUFFER_SIZE)) parser.add_argument('-k', '--killmessage', type=str, default=DEFAULT_KILL_MESSAGE, help='Message to kill server. Default value: \'{}\''.format(DEFAULT_KILL_MESSAGE)) parser.add_argument('-v', '--verbose', type=int, choices=[0, 1, 2], default=DEFAULT_VERBOSE_LEVEL, help='Increase output verbosity. Default value: {}'.format(DEFAULT_VERBOSE_LEVEL)) args = parser.parse_args() return args # Executes on program close def on_close_program(): global time_start totaltime = time.perf_counter() - time_start print('The server has been running for {} seconds.'.format(totaltime)) # Main - Start Server def start_server(): global host_bind, max_clients, server_port, max_buffer_size, kill_message, verbose, time_start global shutdown, thread_counter, server # Handler to do actions when application is closed atexit.register(on_close_program) # Check and parse parameters args = parse_params() host_bind = args.interfacebind max_clients = args.maxclients server_port = args.serverport max_buffer_size = args.buffersize kill_message = args.killmessage verbose = args.verbose if max_clients < 1: # avoid zero division max_clients = DEFAULT_MAXCLIENTS print('Verbose level {}'.format(VERBOSE_LEVEL_DESCRIPTION[verbose])) print('Host bind {}'.format(host_bind)) print('Max {} Clients / Threads'.format(max_clients)) print('Server Port {}'.format(server_port)) print('Buffer size {} bytes'.format(max_buffer_size)) print('Kill message \'{}\''.format(kill_message)) print('Starting Server ...') time_start = time.perf_counter() server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) print_verbose('Socket created', 1, verbose) # Bind socket to local host and port try: server.bind((host_bind, server_port)) print_verbose('Socket bind completed', 2, verbose) except socket.error as msg: print('Bind failed. Error Code: {} Message: {}'.format(msg[0], msg[1])) print('Sys Error Info: {}'.format(sys.exc_info())) sys.exit() # Start listening on socket server.listen(max_clients) print_verbose('Socket now listening', 2, verbose) # Now keep talking with the client while no shutdown message is received while not shutdown: # Wait to accept a connection - blocking call try: (conn, (ip, port)) = server.accept() except: break # Possibly closed server print('Accepting connection from {}:{}'.format(ip, port)) thread_counter += 1 try: client = threading.Thread(target=client_thread, args=(conn, ip, port, max_buffer_size, verbose, kill_message)) client.start() except Exception as e: print('WTF Error! {}'.format(e)) traceback.print_exc() # Shutting down server try: print("Shutdown server") server.shutdown(socket.SHUT_RDWR) server.close() except Exception as e: print_verbose('Server already closed from client thread', 1, verbose) print_verbose('Exception {}'.format(e), 2, verbose) print_verbose('At shutdown, total clients {} | Current active {}'.format(thread_counter, thread_active_counter), 1, verbose) sys.exit(1) if __name__ == '__main__': start_server()
const webpack = require('webpack') const { merge } = require('webpack-merge') const common = require('./webpack.common.js') const paths = require('./paths') module.exports = merge(common, { // Set the mode to development or production mode: 'development', // Control how source maps are generated devtool: 'inline-source-map', // Spin up a server for quick development devServer: { historyApiFallback: true, contentBase: paths.build, open: true, compress: true, hot: true, port: 8080, }, module: { rules: [ // Styles: Inject CSS into the head with source maps { test: /\.(scss|css)$/, use: [ 'style-loader', { loader: 'css-loader', options: { sourceMap: true, importLoaders: 1, modules: true }, }, { loader: 'postcss-loader', options: { sourceMap: true } }, { loader: 'sass-loader', options: { sourceMap: true } }, ], }, ], }, plugins: [ // Only update what has changed on hot reload new webpack.HotModuleReplacementPlugin(), ], })
//------------------------------------------------------------------------------ // GB_AxB: hard-coded C=A*B and C<M>=A*B //------------------------------------------------------------------------------ // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2018, All Rights Reserved. // http://suitesparse.com See GraphBLAS/Doc/License.txt for license. // If this filename has a double underscore in its name ("__") then it has been // automatically constructed from Generator/GB_AxB.c, via the Source/axb*.m // scripts, and should not be editted. Edit the original source file instead. //------------------------------------------------------------------------------ #include "GB.h" #ifndef GBCOMPACT #include "GB_heap.h" #include "GB_AxB__semirings.h" // The C=A*B semiring is defined by the following types and operators: // A*B function (Gustavon): GB_AgusB__plus_second_int64 // A'*B function (dot): GB_AdotB__plus_second_int64 // A*B function (heap): GB_AheapB__plus_second_int64 // Z type: int64_t (the type of C) // X type: int64_t (the type of x for z=mult(x,y)) // Y type: int64_t (the type of y for z=mult(x,y)) // handle flipxy: 0 (0 if mult(x,y) is commutative, 1 otherwise) // Identity: 0 (where cij += identity does not change cij) // Multiply: z = y // Add: cij += z #define GB_XTYPE \ int64_t #define GB_YTYPE \ int64_t #define GB_HANDLE_FLIPXY \ 0 #define GB_MULTOP(z,x,y) \ z = y //------------------------------------------------------------------------------ // C<M>=A*B and C=A*B: gather/scatter saxpy-based method (Gustavson) //------------------------------------------------------------------------------ #define GB_IDENTITY \ 0 // x [i] = y #define GB_COPY_SCALAR_TO_ARRAY(x,i,y,s) \ x [i] = y ; // x = y [i] #define GB_COPY_ARRAY_TO_SCALAR(x,y,i,s) \ GB_btype x = y [i] ; // x [i] = y [i] #define GB_COPY_ARRAY_TO_ARRAY(x,i,y,j,s) \ x [i] = y [j] ; // mult-add operation (no mask) #define GB_MULTADD_NOMASK \ { \ /* Sauna_Work [i] += A(i,k) * B(k,j) */ \ GB_atype aik = Ax [pA] ; \ int64_t t ; \ GB_MULTIPLY (t, aik, bkj) ; \ Sauna_Work [i] += t ; \ } // mult-add operation (with mask) #define GB_MULTADD_WITH_MASK \ { \ /* Sauna_Work [i] += A(i,k) * B(k,j) */ \ GB_atype aik = Ax [pA] ; \ int64_t t ; \ GB_MULTIPLY (t, aik, bkj) ; \ if (mark == hiwater) \ { \ /* first time C(i,j) seen */ \ Sauna_Mark [i] = hiwater + 1 ; \ Sauna_Work [i] = t ; \ } \ else \ { \ /* C(i,j) seen before, update it */ \ Sauna_Work [i] += t ; \ } \ } GrB_Info GB_AgusB__plus_second_int64 ( GrB_Matrix C, const GrB_Matrix M, const GrB_Matrix A, const GrB_Matrix B, bool flipxy, // if true, A and B have been swapped GB_Sauna Sauna, // sparse accumulator GB_Context Context ) { int64_t *restrict Sauna_Work = Sauna->Sauna_Work ; // size C->vlen*zsize int64_t *restrict Cx = C->x ; GrB_Info info = GrB_SUCCESS ; #include "GB_AxB_Gustavson_flipxy.c" return (info) ; } //------------------------------------------------------------------------------ // C<M>=A'*B or C=A'*B: dot product //------------------------------------------------------------------------------ // get A(k,i) #define GB_DOT_GETA(pA) \ GB_atype aki = Ax [pA] ; // get B(k,j) #define GB_DOT_GETB(pB) \ GB_btype bkj = Bx [pB] ; // t = aki*bkj #define GB_DOT_MULT(bkj) \ int64_t t ; \ GB_MULTIPLY (t, aki, bkj) ; // cij += t #define GB_DOT_ADD \ cij += t ; // cij = t #define GB_DOT_COPY \ cij = t ; // cij is not a pointer but a scalar; nothing to do #define GB_DOT_REACQUIRE ; // clear cij #define GB_DOT_CLEAR \ cij = 0 ; // save the value of C(i,j) #define GB_DOT_SAVE \ Cx [cnz] = cij ; #define GB_DOT_WORK_TYPE \ GB_btype #define GB_DOT_WORK(k) Work [k] // Work [k] = Bx [pB] #define GB_DOT_SCATTER \ Work [k] = Bx [pB] ; GrB_Info GB_AdotB__plus_second_int64 ( GrB_Matrix *Chandle, const GrB_Matrix M, const GrB_Matrix A, const GrB_Matrix B, bool flipxy, // if true, A and B have been swapped GB_Context Context ) { GrB_Matrix C = (*Chandle) ; int64_t *restrict Cx = C->x ; int64_t cij ; GrB_Info info = GrB_SUCCESS ; size_t bkj_size = B->type->size ; // no typecasting here #include "GB_AxB_dot_flipxy.c" return (info) ; } //------------------------------------------------------------------------------ // C<M>=A*B and C=A*B: heap saxpy-based method //------------------------------------------------------------------------------ #define GB_CIJ_GETB(pB) \ GB_btype bkj = Bx [pB] ; // C(i,j) = A(i,k) * bkj #define GB_CIJ_MULT(pA) \ { \ GB_atype aik = Ax [pA] ; \ GB_MULTIPLY (cij, aik, bkj) ; \ } // C(i,j) += A(i,k) * B(k,j) #define GB_CIJ_MULTADD(pA,pB) \ { \ GB_atype aik = Ax [pA] ; \ GB_btype bkj = Bx [pB] ; \ int64_t t ; \ GB_MULTIPLY (t, aik, bkj) ; \ cij += t ; \ } // cij is not a pointer but a scalar; nothing to do #define GB_CIJ_REACQUIRE ; // cij = identity #define GB_CIJ_CLEAR \ cij = 0 ; // save the value of C(i,j) #define GB_CIJ_SAVE \ Cx [cnz] = cij ; GrB_Info GB_AheapB__plus_second_int64 ( GrB_Matrix *Chandle, const GrB_Matrix M, const GrB_Matrix A, const GrB_Matrix B, bool flipxy, // if true, A and B have been swapped int64_t *restrict List, GB_pointer_pair *restrict pA_pair, GB_Element *restrict Heap, const int64_t bjnz_max, GB_Context Context ) { GrB_Matrix C = (*Chandle) ; int64_t *restrict Cx = C->x ; int64_t cij ; int64_t cvlen = C->vlen ; GrB_Info info = GrB_SUCCESS ; GB_CIJ_CLEAR ; #include "GB_AxB_heap_flipxy.c" return (info) ; } //------------------------------------------------------------------------------ // clear macro definitions //------------------------------------------------------------------------------ #undef GB_XTYPE #undef GB_YTYPE #undef GB_HANDLE_FLIPXY #undef GB_MULTOP #undef GB_IDENTITY #undef GB_COPY_SCALAR_TO_ARRAY #undef GB_COPY_ARRAY_TO_SCALAR #undef GB_COPY_ARRAY_TO_ARRAY #undef GB_MULTADD_NOMASK #undef GB_MULTADD_WITH_MASK #undef GB_DOT_GETA #undef GB_DOT_GETB #undef GB_DOT_MULT #undef GB_DOT_ADD #undef GB_DOT_COPY #undef GB_DOT_REACQUIRE #undef GB_DOT_CLEAR #undef GB_DOT_SAVE #undef GB_DOT_WORK_TYPE #undef GB_DOT_WORK #undef GB_DOT_SCATTER #undef GB_CIJ_GETB #undef GB_CIJ_MULT #undef GB_CIJ_MULTADD #undef GB_CIJ_REACQUIRE #undef GB_CIJ_CLEAR #undef GB_CIJ_SAVE #undef GB_MULTIPLY #endif
var searchData= [ ['container_20views_7128',['Container Views',['../group__containerviews.html',1,'']]], ['controls_7129',['Controls',['../group__controls.html',1,'']]] ];
# Importa as blibliotecas import pyautogui import time # Abre o executar do Windows e busca o servidor pyautogui.hotkey('win','r');pyautogui.typewrite('\\\srsdcsp01\\NETLOGON\\Bitdefender\\Setup');pyautogui.press('enter') time.sleep(2) # Abre o arquivo de instalação pyautogui.click(520,479);pyautogui.typewrite('epskit_x64');pyautogui.press('enter') # Mostra mensagem na tela pyautogui.alert(title='INFRA - BitDefender', text='Aguarde a instalacao, pode demorar um pouco', button='OK')
# Copyright (C) 2019 ZTE. All Rights Reserved. # # 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 json import mock from django.test import TestCase from rest_framework import status from rest_framework.test import APIClient from . import const from lcm.pub.database.models import NfInstModel, JobStatusModel, StorageInstModel, NetworkInstModel, \ SubNetworkInstModel, PortInstModel, FlavourInstModel, VmInstModel, VNFCInstModel from lcm.pub.utils import restcall from lcm.pub.vimapi import api from lcm.pub.utils.jobutil import JobUtil from lcm.nf.biz.scale_vnf_to_level import ScaleVnfToLevel class TestNfScaleToLevel(TestCase): def setUp(self): self.client = APIClient() self.req_data = { "instantiationLevelId": "instantiation_level_2", "scaleInfo": [] } NfInstModel(nfinstid='98765', nf_name='VNF1', nf_desc="VNF DESC", vnfdid="1", netype="XGW", vendor="ZTE", vnfSoftwareVersion="V1", version="V1", package_id="2", status='NOT_INSTANTIATED').save() def tearDown(self): NfInstModel.objects.filter(nfinstid='98765').delete() def assert_job_result(self, job_id, job_progress, job_detail): jobs = JobStatusModel.objects.filter( jobid=job_id, progress=job_progress, descp=job_detail ) self.assertEqual(1, len(jobs)) def test_scale_vnf_to_level_not_found(self): url = "/api/vnflcm/v1/vnf_instances/12/scale_to_level" response = self.client.post(url, data=self.req_data, format='json') self.assertEqual(status.HTTP_404_NOT_FOUND, response.status_code) def test_scale_vnf_conflict(self): url = "/api/vnflcm/v1/vnf_instances/98765/scale_to_level" response = self.client.post(url, data=self.req_data, format='json') self.assertEqual(status.HTTP_409_CONFLICT, response.status_code) def test_scale_to_level_badreq(self): NfInstModel(nfinstid='678', nf_name='VNF1', nf_desc="VNF DESC", vnfdid="1", netype="XGW", vendor="ZTE", vnfSoftwareVersion="V1", version="V1", package_id="2", status='INSTANTIATED').save() url = "/api/vnflcm/v1/vnf_instances/678/scale_to_level" response = self.client.post(url, data={}, format='json') NfInstModel.objects.filter(nfinstid='678').delete() self.assertEqual(status.HTTP_400_BAD_REQUEST, response.status_code) @mock.patch.object(restcall, 'call_req') @mock.patch.object(api, 'call') def test_scale_out_vnf_success(self, mock_call, mock_call_req): self.nf_inst_id = '6789' res_cache = {"volume": {}, "flavor": {}, "port": {}} res_cache["volume"]["test"] = "test" # res_cache["port"]["ext_cp"] = "port1" NfInstModel(nfinstid=self.nf_inst_id, nf_name='VNF1', nf_desc="VNF DESC", vnfdid="1", netype="XGW", vendor="ZTE", vnfSoftwareVersion="V1", version="V1", package_id="2", status='INSTANTIATED', vnfd_model=json.dumps(const.vnfd_for_scale), vimInfo=json.dumps({}), resInfo=json.dumps(res_cache)).save() StorageInstModel.objects.create( storageid="1", vimid="1", resourceid="11", insttype=0, instid=self.nf_inst_id, is_predefined=1 ) NetworkInstModel.objects.create( networkid='1', vimid='1', resourceid='1', name='pnet_network', is_predefined=1, tenant='admin', insttype=0, instid=self.nf_inst_id ) SubNetworkInstModel.objects.create( subnetworkid='1', vimid='1', resourceid='1', networkid='1', is_predefined=1, name='sub_pnet', tenant='admin', insttype=0, instid=self.nf_inst_id ) PortInstModel.objects.create( portid='1', networkid='1', subnetworkid='1', vimid='1', resourceid='1', is_predefined=1, name='ext_cp', tenant='admin', insttype=0, instid=self.nf_inst_id ) FlavourInstModel.objects.create( flavourid="1", vimid="1", resourceid="11", instid=self.nf_inst_id, is_predefined=1, name="Flavor_sunshine" ) VmInstModel.objects.create( vmid="1", vimid="1", resourceid="11", insttype=0, instid=self.nf_inst_id, vmname="test_01", is_predefined=1, operationalstate=1 ) r1_apply_grant_result = [ 0, json.JSONEncoder().encode(const.instantiate_grant_result), '200' ] mock_call_req.side_effect = [ r1_apply_grant_result, ] mock_call.side_effect = [ const.c1_data_get_tenant_id, const.c6_data_create_port, const.c7_data_create_flavor, const.c8_data_list_image, const.c9_data_create_vm, const.c10_data_get_vm ] self.job_id = JobUtil.create_job('NF', 'SCALE', self.nf_inst_id) JobUtil.add_job_status(self.job_id, 0, "VNF_SCALE_READY", ) ScaleVnfToLevel( {"instantiationLevelId": "instantiation_level_2"}, nf_inst_id=self.nf_inst_id, job_id=self.job_id ).run() NfInstModel.objects.filter(nfinstid=self.nf_inst_id).delete() self.assert_job_result( self.job_id, 100, 'Scale Vnf success.' ) @mock.patch.object(restcall, 'call_req') @mock.patch.object(api, 'call') def test_scale_to_inlevel_vnf_success(self, mock_call, mock_call_req): self.nf_inst_id = '6789' res_cache = {"volume": {}, "flavor": {}, "port": {}} res_cache["port"]["ext_cp"] = "port1" NfInstModel(nfinstid=self.nf_inst_id, nf_name='VNF1', nf_desc="VNF DESC", vnfdid="1", netype="XGW", vendor="ZTE", vnfSoftwareVersion="V1", version="V1", package_id="2", status='INSTANTIATED', vnfd_model=json.dumps(const.vnfd_for_scale), vimInfo=json.dumps({}), resInfo=json.dumps(res_cache)).save() StorageInstModel.objects.create( storageid="1", vimid="1", resourceid="11", insttype=0, instid=self.nf_inst_id, is_predefined=1 ) NetworkInstModel.objects.create( networkid='1', vimid='1', resourceid='1', name='pnet_network', is_predefined=1, tenant='admin', insttype=0, instid=self.nf_inst_id ) SubNetworkInstModel.objects.create( subnetworkid='1', vimid='1', resourceid='1', networkid='1', is_predefined=1, name='sub_pnet', tenant='admin', insttype=0, instid=self.nf_inst_id ) PortInstModel.objects.create( portid='1', networkid='1', subnetworkid='1', vimid='1', resourceid='1', is_predefined=1, name='ext_cp', tenant='admin', insttype=0, instid=self.nf_inst_id ) FlavourInstModel.objects.create( flavourid="1", vimid="1", resourceid="11", instid=self.nf_inst_id, is_predefined=1, name="Flavor_sunshine" ) VmInstModel.objects.create( vmid="1", vimid="1", resourceid="11", insttype=0, instid=self.nf_inst_id, vmname="test_01", is_predefined=1, operationalstate=1 ) VmInstModel.objects.create( vmid="2", vimid="1", resourceid="22", insttype=0, instid=self.nf_inst_id, vmname="test_02", is_predefined=1, operationalstate=1 ) VNFCInstModel.objects.create( vnfcinstanceid="1", instid=self.nf_inst_id, vmid="1" ) VNFCInstModel.objects.create( vnfcinstanceid="2", instid=self.nf_inst_id, vmid="2" ) r1_apply_grant_result = [ 0, json.JSONEncoder().encode(const.instantiate_grant_result), '200' ] mock_call_req.side_effect = [ r1_apply_grant_result, ] mock_call.side_effect = [ const.c1_data_get_tenant_id, const.c7_data_create_flavor, const.c8_data_list_image, const.c9_data_create_vm, const.c10_data_get_vm ] self.job_id = JobUtil.create_job('NF', 'SCALE', self.nf_inst_id) JobUtil.add_job_status(self.job_id, 0, "VNF_SCALE_READY", ) ScaleVnfToLevel( {"scaleInfo": {"aspectId": "sunshine_aspect", "scaleLevel": 0}}, nf_inst_id=self.nf_inst_id, job_id=self.job_id ).run() NfInstModel.objects.filter(nfinstid=self.nf_inst_id).delete() self.assert_job_result( self.job_id, 100, 'Scale Vnf success.' )
import torch import torch.nn as nn from torch.utils.model_zoo import load_url __all__ = [ 'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn', 'vgg19_bn', 'vgg19', ] model_urls = { 'vgg11': 'https://download.pytorch.org/models/vgg11-bbd30ac9.pth', 'vgg13': 'https://download.pytorch.org/models/vgg13-c768596a.pth', 'vgg16': 'https://download.pytorch.org/models/vgg16-397923af.pth', 'vgg19': 'https://download.pytorch.org/models/vgg19-dcbb9e9d.pth', 'vgg11_bn': 'https://download.pytorch.org/models/vgg11_bn-6002323d.pth', 'vgg13_bn': 'https://download.pytorch.org/models/vgg13_bn-abd245e5.pth', 'vgg16_bn': 'https://download.pytorch.org/models/vgg16_bn-6c64b313.pth', 'vgg19_bn': 'https://download.pytorch.org/models/vgg19_bn-c79401a0.pth', } class ADL(nn.Module): def __init__(self, drop_rate=0.75, drop_thr=0.8): super(ADL, self).__init__() assert 0 <= drop_rate <= 1 and 0 <= drop_thr <= 1 self.drop_rate = drop_rate self.drop_thr = drop_thr self.attention = None self.drop_mask = None def extra_repr(self): return 'drop_rate={}, drop_thr={}'.format( self.drop_rate, self.drop_thr ) def forward(self, x): if self.training: b = x.size(0) # Generate self-attention map attention = torch.mean(x, dim=1, keepdim=True) self.attention = attention # Generate importance map importance_map = torch.sigmoid(attention) # Generate drop mask max_val, _ = torch.max(attention.view(b, -1), dim=1, keepdim=True) thr_val = max_val * self.drop_thr thr_val = thr_val.view(b, 1, 1, 1).expand_as(attention) drop_mask = (attention < thr_val).float() self.drop_mask = drop_mask # Random selection random_tensor = torch.rand([], dtype=torch.float32) + self.drop_rate binary_tensor = random_tensor.floor() selected_map = (1. - binary_tensor) * importance_map + binary_tensor * drop_mask # Spatial multiplication to input feature map output = x.mul(selected_map) else: output = x return output def get_maps(self): return self.attention, self.drop_mask class VGG(nn.Module): def __init__(self, features, num_classes=1000, mode='base', init_weights=True, **kwargs): super(VGG, self).__init__() self.features = features self.mode = mode if self.mode == 'base': self.avgpool = nn.AdaptiveAvgPool2d((7,7)) self.classifier = make_classifier(mode = self.mode, num_classes=num_classes) elif self.mode == 'GAP' or self.mode == 'ADL': self.conv6 = nn.Conv2d(512, 1024, kernel_size=3, padding=1) self.relu = nn.ReLU(inplace=True) if self.mode == 'ADL' and kwargs['lst_ADL']: self.lst_adl = True self.adl = ADL(kwargs['drop_rate'], kwargs['drop_thr']) else: self.lst_adl = False self.avgpool = nn.AdaptiveAvgPool2d(1) self.fc = nn.Linear(1024, num_classes) self.feature_map = None self.pred = None if init_weights: self._initialize_weights() def forward(self, x): x = self.features(x) if self.mode == 'base': x = self.avgpool(x) x = x.view(x.size(0), -1) x = self.classifier(x) elif self.mode == 'GAP' or self.mode == 'ADL': x = self.conv6(x) x = self.relu(x) if self.lst_adl: x = self.adl(x) self.feature_map = x x = self.avgpool(x) x = x.view(x.size(0), -1) x = self.fc(x) self.pred = x else: raise Exception("No mode matching") return x def get_cam(self): return self.feature_map, self.pred def _initialize_weights(self): for m in self.modules(): if isinstance(m, nn.Conv2d): nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu') if m.bias is not None: nn.init.constant_(m.bias, 0) elif isinstance(m, nn.BatchNorm2d): nn.init.constant_(m.weight, 1) nn.init.constant_(m.bias, 0) elif isinstance(m, nn.Linear): nn.init.normal_(m.weight, 0, 0.01) nn.init.constant_(m.bias, 0) def make_layers(cfg, batch_norm=False, **kwargs): layers = [] in_channels = 3 for v in cfg: if v == 'M': layers += [nn.MaxPool2d(kernel_size=2, stride=2)] elif v == 'A': layers += [ADL(kwargs['drop_rate'], kwargs['drop_thr'])] else: conv2d = nn.Conv2d(in_channels, v, kernel_size=3, padding=1) if batch_norm: layers += [conv2d, nn.BatchNorm2d(v), nn.ReLU(inplace=True)] else: layers += [conv2d, nn.ReLU(inplace=True)] in_channels = v return nn.Sequential(*layers) def make_classifier(mode, num_classes): if mode == 'base': return nn.Sequential( nn.Linear(512 * 7 * 7, 4096), nn.ReLU(True), nn.Dropout(), nn.Linear(4096, 4096), nn.ReLU(), nn.Dropout(), nn.Linear(4096, num_classes) ) elif mode == 'GAP': pass else: raise Exception("No mode matching") cfgs = { 'A': [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'], 'B': [64, 64, 'M', 128, 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'], 'D': [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, 512, 'M'], 'E': [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 256, 'M', 512, 512, 512, 512, 'M', 512, 512, 512, 512, 'M'], 'D_GAP': [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, 512], } def make_cfg(cfg, targets): pos_list = list('0') block, element = 1, 1 for i in cfg: if isinstance(i, int): pos_list.append(str(block) + str(element)) element += 1 elif isinstance(i, str): pos_list.append(str(block) + 'M') block += 1 element = 1 pos_dict = dict() for i, key in enumerate(pos_list): pos_dict[key] = i target_list = [pos_dict[key] for key in targets] target_list = sorted(target_list, reverse=True) for key in target_list: cfg.insert(key, 'A') return cfg def remove_layer(state_dict, keyword): keys = [key for key in state_dict.keys()] for key in keys: if keyword in key: state_dict.pop(key) return state_dict def make_config_align(state_dict, base_cfg, target_cfg): base_list = [] replace_list = [] start = 0 for layer in base_cfg: if type(layer) is int: base_list.append(start) start += 2 elif type(layer) is str: start += 1 else: raise Exception("No state_dict match") start = 0 for layer in target_cfg: if type(layer) is int: replace_list.append(start) start += 2 elif type(layer) is str: start += 1 else: raise Exception("No state_dict match") target_list = {} for base, replace in zip(base_list, replace_list): target_list[str(base)] = str(replace) keys = [key for key in state_dict.keys()] for i, key in enumerate(reversed(keys)): key_ = key.split('.') new_key = key.replace('.'+key_[1]+'.', '.'+target_list[key_[1]]+'.') state_dict[new_key] = state_dict.pop(key) return state_dict def _vgg(arch, cfg, mode, batch_norm, pretrained, progress, **kwargs): kwargs['init_weights'] = True if mode == 'ADL': if '6' in kwargs['ADL_position']: kwargs['lst_ADL'] = True kwargs['ADL_position'].remove('6') else: kwargs['lst_ADL'] = False new_cfg = make_cfg(cfgs[cfg], kwargs['ADL_position']) else: new_cfg = cfgs[cfg] model = VGG(make_layers(new_cfg, batch_norm=batch_norm, **kwargs), mode=mode, **kwargs) if pretrained: state_dict = load_url(model_urls[arch], progress=progress) # remove classifier part if mode == 'ADL': state_dict = remove_layer(state_dict, 'classifier.') make_config_align(state_dict, cfgs[cfg[0]], cfgs[cfg]) strict_rule = False elif mode == 'GAP': state_dict = remove_layer(state_dict, 'classifier.') strict_rule = False else: strict_rule = True # If not ImageNet, remove pretrained dict. if kwargs['num_classes'] != 1000: remove_layer(state_dict, 'classifier.6') strict_rule = False model.load_state_dict(state_dict, strict=strict_rule) return model def vgg11(pretrained=False, progress=True, **kwargs): r"""VGG 11-layer model (configuration "A") from `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>'_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _vgg('vgg11', 'A', 'base', False, pretrained, progress, **kwargs) def vgg11_bn(pretrained=False, progress=True, **kwargs): r"""VGG 11-layer model (configuration "A") with batch normalization `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>'_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _vgg('vgg11_bn', 'A', 'base', True, pretrained, progress, **kwargs) def vgg13(pretrained=False, progress=True, **kwargs): r"""VGG 13-layer model (configuration "B") `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>'_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _vgg('vgg13', 'B', 'base', False, pretrained, progress, **kwargs) def vgg13_bn(pretrained=False, progress=True, **kwargs): r"""VGG 13-layer model (configuration "B") with batch normalization `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>'_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _vgg('vgg13_bn', 'B', 'base', True, pretrained, progress, **kwargs) def vgg16(pretrained=False, progress=True, **kwargs): r"""VGG 16-layer model (configuration "D") `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>'_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _vgg('vgg16', 'D', 'base', False, pretrained, progress, **kwargs) def vgg16_ADL(pretrained=False, progress=True, **kwargs): r"""VGG 16-layer model (configuration "D") `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>'_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _vgg('vgg16', 'D_GAP', 'ADL', False, pretrained, progress, **kwargs) def vgg16_bn(pretrained=False, progress=True, **kwargs): r"""VGG 16-layer model (configuration "D") with batch normalization `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>'_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _vgg('vgg16_bn', 'D', 'base', True, pretrained, progress, **kwargs) def vgg16_GAP(pretrained=False, progress=True, **kwargs): r"""VGG 16-layer model (configuration "D") `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>'_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _vgg('vgg16', 'D_GAP', 'GAP', False, pretrained, progress, **kwargs) def vgg19(pretrained=False, progress=True, **kwargs): r"""VGG 19-layer model (configuration "E") `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>'_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _vgg('vgg19', 'E', 'base', False, pretrained, progress, **kwargs) def vgg19_bn(pretrained=False, progress=True, **kwargs): r"""VGG 19-layer model (configuration 'E') with batch normalization `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>'_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _vgg('vgg19_bn', 'E', 'base', True, pretrained, progress, **kwargs)
/* * /MathJax-v2/jax/output/SVG/fonts/STIX-Web/Shapes/Regular/Main.js * * Copyright (c) 2009-2018 The MathJax Consortium * * 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. */ MathJax.OutputJax.SVG.FONTDATA.FONTS.STIXMathJax_Shapes={directory:"Shapes/Regular",family:"STIXMathJax_Shapes",id:"STIXWEBSHAPES",32:[0,0,250,0,0,""],160:[0,0,250,0,0,""],9251:[16,120,500,40,460,"460 -120h-420v136h30v-76h360v76h30v-136"],9472:[340,-267,708,-11,719,"719 267h-730v73h730v-73"],9474:[910,303,708,317,390,"390 -303h-73v1213h73v-1213"],9478:[910,303,708,317,390,"390 544h-73v366h73v-366zM390 121h-73v366h73v-366zM390 -303h-73v367h73v-367"],9480:[340,-267,708,-11,719,"719 267h-145v73h145v-73zM524 267h-145v73h145v-73zM329 267h-145v73h145v-73zM134 267h-145v73h145v-73"],9482:[910,303,708,317,390,"390 650h-73v260h73v-260zM390 333h-73v260h73v-260zM390 15h-73v260h73v-260zM390 -303h-73v260h73v-260"],9500:[910,303,708,317,719,"719 267h-329v-570h-73v1213h73v-570h329v-73"],9508:[910,303,708,-11,390,"390 -303h-73v570h-328v73h328v570h73v-1213"],9516:[340,303,708,-11,719,"719 267h-329v-570h-73v570h-328v73h730v-73"],9524:[910,-267,708,-11,719,"719 267h-730v73h328v570h73v-570h329v-73"],9532:[910,303,708,-11,719,"719 267h-329v-570h-73v570h-328v73h328v570h73v-570h329v-73"],9552:[433,-174,708,-11,719,"719 360h-730v73h730v-73zM719 174h-730v73h730v-73"],9553:[910,303,708,225,483,"483 -303h-73v1213h73v-1213zM298 -303h-73v1213h73v-1213"],9554:[433,303,708,317,720,"720 174h-330v-477h-73v736h403v-73h-330v-113h330v-73"],9555:[340,303,708,225,720,"720 267h-237v-570h-73v562h-112v-562h-73v643h495v-73"],9556:[433,303,708,225,719,"719 360h-421v-663h-73v736h494v-73zM719 174h-236v-477h-73v550h309v-73"],9557:[433,303,708,-11,390,"390 -303h-73v477h-328v73h328v113h-328v73h401v-736"],9558:[340,303,708,-11,483,"483 -303h-73v570h-112v-570h-73v570h-236v73h494v-643"],9559:[433,303,708,-11,483,"483 -303h-73v663h-421v73h494v-736zM298 -303h-73v477h-236v73h309v-550"],9560:[910,-174,708,317,720,"720 174h-403v736h73v-477h330v-73h-330v-113h330v-73"],9561:[910,-267,708,225,720,"720 267h-495v643h73v-570h112v570h73v-570h237v-73"],9562:[910,-174,708,225,719,"719 360h-309v550h73v-477h236v-73zM719 174h-494v736h73v-663h421v-73"],9563:[910,-174,708,-11,390,"390 174h-401v73h328v113h-328v73h328v477h73v-736"],9564:[910,-267,708,-11,483,"483 267h-494v73h236v570h73v-570h112v570h73v-643"],9565:[910,-174,708,-11,483,"298 360h-309v73h236v477h73v-550zM483 174h-494v73h421v663h73v-736"],9566:[910,303,708,317,720,"720 174h-330v-477h-73v1213h73v-477h330v-73h-330v-113h330v-73"],9567:[910,303,708,225,720,"720 267h-237v-570h-73v1213h73v-570h237v-73zM298 -303h-73v1213h73v-1213"],9568:[910,303,708,225,720,"720 360h-310v550h73v-477h237v-73zM298 -303h-73v1213h73v-1213zM720 174h-237v-477h-73v550h310v-73"],9569:[910,303,708,-11,390,"390 -303h-73v477h-328v73h328v113h-328v73h328v477h73v-1213"],9570:[910,303,708,-11,483,"483 -303h-73v1213h73v-1213zM298 -303h-73v570h-236v73h236v570h73v-1213"],9571:[910,303,708,-11,483,"298 360h-309v73h236v477h73v-550zM483 -303h-73v1213h73v-1213zM298 -303h-73v477h-236v73h309v-550"],9572:[433,303,708,-11,719,"719 360h-730v73h730v-73zM719 174h-329v-477h-73v477h-328v73h730v-73"],9573:[340,303,708,-11,719,"719 267h-236v-570h-73v570h-112v-570h-73v570h-236v73h730v-73"],9574:[433,303,708,-11,719,"719 360h-730v73h730v-73zM719 174h-236v-477h-73v550h309v-73zM298 -303h-73v477h-236v73h309v-550"],9575:[910,-174,708,-11,719,"719 360h-730v73h328v477h73v-477h329v-73zM719 174h-730v73h730v-73"],9576:[910,-267,708,-11,719,"719 267h-730v73h236v570h73v-570h112v570h73v-570h236v-73"],9577:[910,-174,708,-11,719,"719 360h-309v550h73v-477h236v-73zM298 360h-309v73h236v477h73v-550zM719 174h-730v73h730v-73"],9578:[910,303,708,-11,719,"719 174h-329v-477h-73v477h-328v73h328v113h-328v73h328v477h73v-477h329v-73h-329v-113h329v-73"],9579:[910,303,708,-11,719,"719 267h-236v-570h-73v570h-112v-570h-73v570h-236v73h236v570h73v-570h112v570h73v-570h236v-73"],9580:[910,303,708,-11,719,"719 360h-309v550h73v-477h236v-73zM298 360h-309v73h236v477h73v-550zM719 174h-236v-477h-73v550h309v-73zM298 -303h-73v477h-236v73h309v-550"],9600:[910,-304,1213,0,1213,"1213 304h-1213v606h1213v-606"],9604:[303,303,1213,0,1213,"1213 -303h-1213v606h1213v-606"],9608:[910,303,1213,0,1213,"1213 -303h-1213v1213h1213v-1213"],9612:[910,303,1212,0,606,"606 -303h-606v1213h606v-1213"],9616:[910,303,1212,606,1212,"1212 -303h-606v1213h606v-1213"],9617:[860,258,1200,0,1200,"1160 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1200 763c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1080 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1120 763c0 -11 -9 -20 -20 -20s-20 9 -20 20 s9 20 20 20s20 -9 20 -20zM1160 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1000 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1200 609c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1040 763 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1080 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM920 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1120 609c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM960 763c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1160 532c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1000 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM840 840c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1200 455c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1040 609c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM880 763c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1080 532 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM920 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM760 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1120 455c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM960 609c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM800 763c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1160 378c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1000 532c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM840 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM680 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1200 301c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1040 455 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM880 609c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM720 763c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1080 378c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM920 532c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM760 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM600 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1120 301c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM960 455c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM800 609c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM640 763c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1160 224 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1000 378c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM840 532c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM680 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM520 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1200 147c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1040 301c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM880 455c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM720 609c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM560 763c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1080 224c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM920 378 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM760 532c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM600 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM440 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM1120 147c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM960 301c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM800 455c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM640 609c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM480 763c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1160 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1000 224c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM840 378 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM680 532c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM520 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM360 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM1200 -7c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1040 147c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM880 301c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM720 455c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM560 609c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM400 763c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1080 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM920 224 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM760 378c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM600 532c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM440 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM280 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1120 -7c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM960 147c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM800 301c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM640 455c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM480 609c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM320 763c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1160 -84 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1000 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM840 224c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM680 378c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM520 532c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM360 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM200 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1200 -161c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1040 -7c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM880 147c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM720 301c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM560 455 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM400 609c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM240 763c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1080 -84c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM920 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM760 224c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM600 378c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM440 532c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM280 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM120 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1120 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM960 -7 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM800 147c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM640 301c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM480 455c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM320 609c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM160 763c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1160 -238c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1000 -84c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM840 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM680 224c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM520 378c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM360 532 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM200 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM40 840c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1040 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM880 -7c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM720 147c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM560 301c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM400 455c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM240 609c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM80 763c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1080 -238c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM920 -84 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM760 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM600 224c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM440 378c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM280 532c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM120 686c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM960 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM800 -7c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM640 147c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM480 301c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM320 455c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM160 609 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM1000 -238c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM840 -84c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM680 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM520 224c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM360 378c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM200 532c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM40 686c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM880 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM720 -7c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM560 147c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM400 301 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM240 455c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM80 609c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM920 -238c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM760 -84c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM600 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM440 224c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM280 378c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM120 532c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM800 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM640 -7c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM480 147 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM320 301c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM160 455c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM840 -238c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM680 -84c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM520 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM360 224c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM200 378c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM40 532c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM720 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM560 -7c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM400 147 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM240 301c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM80 455c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM760 -238c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM600 -84c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM440 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM280 224c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM120 378c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM640 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM480 -7c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM320 147c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM160 301 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM680 -238c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM520 -84c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM360 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM200 224c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM40 378c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM560 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM400 -7c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM240 147c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM80 301c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM600 -238c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM440 -84 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM280 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM120 224c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM480 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM320 -7c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM160 147c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM520 -238c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM360 -84c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM200 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM40 224c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM400 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM240 -7 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM80 147c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM440 -238c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM280 -84c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM120 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM320 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM160 -7c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM360 -238c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM200 -84c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM40 70c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM240 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM80 -7 c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM280 -238c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM120 -84c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM160 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20 s20 -9 20 -20zM200 -238c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM40 -84c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM80 -161c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM120 -238c0 -11 -9 -20 -20 -20 s-20 9 -20 20s9 20 20 20s20 -9 20 -20zM40 -238c0 -11 -9 -20 -20 -20s-20 9 -20 20s9 20 20 20s20 -9 20 -20"],9618:[874,273,1200,0,1200,"1200 -273h-1200v1147h1200v-1147zM1140 822c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1200 706c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1020 822c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30z M1080 706c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1140 590c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM900 822c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1200 474c0 17 -13 30 -30 30 s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM960 706c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1020 590c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM780 822c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30z M1080 474c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM840 706c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1140 358c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM900 590c0 17 -13 30 -30 30 s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM660 822c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1200 242c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM960 474c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30z M720 706c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1020 358c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM780 590c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM540 822c0 17 -13 30 -30 30s-30 -13 -30 -30 s13 -30 30 -30s30 13 30 30zM1080 242c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM840 474c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM600 706c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1140 126 c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM900 358c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM660 590c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM420 822c0 17 -13 30 -30 30s-30 -13 -30 -30 s13 -30 30 -30s30 13 30 30zM1200 10c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM960 242c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM720 474c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM480 706 c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1020 126c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM780 358c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM540 590c0 17 -13 30 -30 30s-30 -13 -30 -30 s13 -30 30 -30s30 13 30 30zM300 822c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1080 10c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM840 242c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM600 474 c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM360 706c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1140 -106c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM900 126c0 17 -13 30 -30 30s-30 -13 -30 -30 s13 -30 30 -30s30 13 30 30zM660 358c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM420 590c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM180 822c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1200 -222 c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM960 10c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM720 242c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM480 474c0 17 -13 30 -30 30s-30 -13 -30 -30 s13 -30 30 -30s30 13 30 30zM240 706c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1020 -106c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM780 126c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM540 358 c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM300 590c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM60 822c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM1080 -222c0 17 -13 30 -30 30s-30 -13 -30 -30 s13 -30 30 -30s30 13 30 30zM840 10c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM600 242c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM360 474c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM120 706 c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM900 -106c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM660 126c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM420 358c0 17 -13 30 -30 30s-30 -13 -30 -30 s13 -30 30 -30s30 13 30 30zM180 590c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM960 -222c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM720 10c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM480 242 c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM240 474c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM780 -106c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM540 126c0 17 -13 30 -30 30s-30 -13 -30 -30 s13 -30 30 -30s30 13 30 30zM300 358c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM60 590c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM840 -222c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM600 10 c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM360 242c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM120 474c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM660 -106c0 17 -13 30 -30 30s-30 -13 -30 -30 s13 -30 30 -30s30 13 30 30zM420 126c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM180 358c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM720 -222c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM480 10 c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM240 242c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM540 -106c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM300 126c0 17 -13 30 -30 30s-30 -13 -30 -30 s13 -30 30 -30s30 13 30 30zM60 358c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM600 -222c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM360 10c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM120 242 c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM420 -106c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM180 126c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM480 -222c0 17 -13 30 -30 30s-30 -13 -30 -30 s13 -30 30 -30s30 13 30 30zM240 10c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM300 -106c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM60 126c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM360 -222 c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM120 10c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM180 -106c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM240 -222c0 17 -13 30 -30 30s-30 -13 -30 -30 s13 -30 30 -30s30 13 30 30zM60 -106c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30zM120 -222c0 17 -13 30 -30 30s-30 -13 -30 -30s13 -30 30 -30s30 13 30 30"],9619:[874,273,1200,0,1200,"1200 -273h-1200v1147h1200v-1147zM1160 840c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1200 763c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1080 840c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1120 763 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1160 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1000 840c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1200 609c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM1040 763c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1080 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM920 840c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1120 609c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM960 763c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1160 532c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1000 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM840 840c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1200 455c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1040 609c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM880 763c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1080 532 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM920 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM760 840c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1120 455c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM960 609c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM800 763c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1160 378c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1000 532c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM840 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM680 840c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1200 301c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1040 455c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM880 609c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM720 763c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1080 378c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM920 532 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM760 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM600 840c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1120 301c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM960 455c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM800 609c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM640 763c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1160 224c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM1000 378c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM840 532c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM680 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM520 840c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1200 147c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1040 301c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM880 455c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM720 609 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM560 763c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1080 224c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM920 378c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM760 532c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM600 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM440 840c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1120 147c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM960 301c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM800 455c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM640 609c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM480 763c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1160 70c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1000 224c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM840 378c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM680 532 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM520 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM360 840c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1200 -7c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM1040 147c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM880 301c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM720 455c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM560 609c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM400 763c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1080 70c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM920 224c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM760 378c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM600 532c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM440 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM280 840c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1120 -7 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM960 147c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM800 301c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM640 455c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM480 609c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM320 763c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1160 -84c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1000 70c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM840 224c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM680 378c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM520 532c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM360 686c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM200 840c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1200 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1040 -7c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM880 147 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM720 301c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM560 455c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM400 609c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM240 763c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1080 -84c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM920 70c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM760 224c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM600 378c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM440 532c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM280 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM120 840c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1120 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM960 -7c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM800 147c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM640 301 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM480 455c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM320 609c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM160 763c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM1160 -238c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1000 -84c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM840 70c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM680 224c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM520 378c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM360 532c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM200 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM40 840c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1040 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM880 -7c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM720 147c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM560 301 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM400 455c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM240 609c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM80 763c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20 zM1080 -238c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM920 -84c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM760 70c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM600 224c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM440 378c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM280 532c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM120 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM960 -161c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM800 -7c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM640 147c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM480 301c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM320 455c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM160 609c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM1000 -238c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM840 -84c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM680 70 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM520 224c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM360 378c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM200 532c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM40 686c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM880 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM720 -7c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM560 147c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM400 301c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM240 455c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM80 609c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM920 -238c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM760 -84c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM600 70c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM440 224c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM280 378 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM120 532c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM800 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM640 -7c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM480 147c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM320 301c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM160 455c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM840 -238c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM680 -84c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM520 70c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM360 224c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM200 378c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM40 532c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM720 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM560 -7c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM400 147 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM240 301c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM80 455c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM760 -238c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM600 -84c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM440 70c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM280 224c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM120 378c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM640 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM480 -7c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM320 147c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM160 301c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM680 -238c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM520 -84c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM360 70c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM200 224 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM40 378c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM560 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM400 -7c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20 zM240 147c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM80 301c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM600 -238c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM440 -84c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM280 70c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM120 224c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM480 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM320 -7c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM160 147c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM520 -238c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM360 -84c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM200 70c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM40 224c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM400 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM240 -7c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM80 147 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM440 -238c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM280 -84c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM120 70c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20zM320 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM160 -7c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM360 -238c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM200 -84c0 11 -9 20 -20 20s-20 -9 -20 -20 s9 -20 20 -20s20 9 20 20zM40 70c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM240 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM80 -7c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM280 -238c0 11 -9 20 -20 20 s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM120 -84c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM160 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM200 -238c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM40 -84 c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM80 -161c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM120 -238c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20s20 9 20 20zM40 -238c0 11 -9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20 s20 9 20 20"],9634:[662,158,910,45,865,"865 422v-340c0 -132 -108 -240 -240 -240h-340c-132 0 -240 108 -240 240v340c0 132 108 240 240 240h340c132 0 240 -108 240 -240zM799 82v340c0 98 -76 174 -174 174h-340c-98 0 -174 -76 -174 -174v-340c0 -98 76 -174 174 -174h340c98 0 174 76 174 174"],9635:[662,158,910,45,865,"664 40h-420v420h420v-420zM865 -158h-820v820h820v-820zM798 -92v688h-687v-688h687"],9636:[662,158,910,45,865,"865 -158h-820v820h820v-820zM798 462v134h-687v-134h687zM798 277v133h-687v-133h687zM798 92v133h-687v-133h687zM798 -92v132h-687v-132h687"],9637:[662,158,910,45,865,"865 -158h-820v820h820v-820zM799 -91v687h-134v-687h134zM613 -91v687h-133v-687h133zM428 -91v687h-133v-687h133zM243 -91v687h-132v-687h132"],9638:[662,158,910,45,865,"865 -158h-820v820h820v-820zM798 462v134h-133v-134h133zM613 462v134h-133v-134h133zM798 277v133h-133v-133h133zM428 462v134h-133v-134h133zM613 277v133h-133v-133h133zM798 92v133h-133v-133h133zM243 462v134h-132v-134h132zM798 -91v131h-133v-131h133zM428 277 v133h-133v-133h133zM613 92v133h-133v-133h133zM613 -91v131h-133v-131h133zM243 277v133h-132v-133h132zM428 92v133h-133v-133h133zM428 -91v131h-133v-131h133zM243 92v133h-132v-133h132zM243 -91v131h-132v-131h132"],9639:[662,158,910,45,865,"865 -158h-820v820h820v-820zM799 465v130h-130zM799 291v100l-204 204h-100zM799 117v100l-378 378h-100zM799 -56v99l-552 552h-100zM761 -92l-650 650v-100l549 -550h101zM587 -92l-476 476v-102l373 -374h103zM411 -92l-300 300v-102l198 -198h102zM235 -92l-124 125 v-125h124"],9640:[662,158,910,45,865,"865 -158h-820v820h820v-820zM799 -92v125l-124 -125h124zM799 458v100l-650 -650h101zM799 282v102l-476 -476h103zM799 106v102l-300 -300h102zM763 595h-100l-552 -552v-99zM241 595h-130v-130zM415 595h-100l-204 -204v-100zM589 595h-100l-378 -378v-100"],9641:[662,158,910,45,865,"865 -158h-820v820h820v-820zM763 595h-94l46 -47zM799 465v93l-47 -47zM678 511l-49 50l-50 -50l49 -50zM765 424l-50 50l-50 -50l51 -50zM589 595h-94l47 -47zM799 291v93l-47 -47zM505 511l-50 50l-50 -50l50 -50zM591 424l-49 50l-50 -50l49 -50zM679 337l-51 50 l-50 -50l51 -50zM766 249l-51 51l-50 -50l51 -51zM415 595h-94l47 -47zM799 117v91l-46 -46zM331 511l-50 50l-50 -50l50 -50zM418 424l-50 50l-50 -50l50 -50zM504 337l-49 50l-50 -50l49 -50zM592 250l-51 50l-50 -50l51 -50zM679 162l-51 51l-50 -50l51 -51zM767 74 l-51 51l-50 -50l51 -51zM241 595h-94l47 -47zM799 -56v89l-45 -45zM761 -92l-43 43l-43 -43h86zM157 511l-46 47v-93zM418 251l-50 49l-50 -50l50 -49zM505 163l-50 51l-50 -50l50 -51zM593 76l-51 51l-50 -50l51 -52zM681 -12l-51 51l-51 -50l51 -51zM244 424l-50 50 l-50 -50l50 -50zM331 337l-50 50l-50 -50l50 -50zM587 -92l-44 44l-44 -44h88zM157 337l-46 47v-93zM331 164l-50 49l-51 -51l50 -49zM418 76l-50 51l-51 -51l50 -51zM244 250l-50 50l-51 -51l50 -50zM506 -11l-51 51l-52 -51l52 -52zM411 -92l-44 44l-44 -44h88zM156 162 l-45 46v-91zM330 -11l-50 50l-51 -51l50 -50zM243 76l-50 49l-51 -51l50 -49zM235 -92l-43 44l-43 -44h86zM155 -11l-44 44v-89"],9642:[460,-40,484,32,452,"452 40h-420v420h420v-420"],9643:[460,-40,484,32,452,"452 40h-420v420h420v-420zM386 106v288h-288v-288h288"],9644:[469,11,1020,38,982,"982 -11h-944v480h944v-480"],9645:[469,11,1020,38,982,"982 -11h-944v480h944v-480zM916 55v348h-812v-348h812"],9646:[724,220,560,40,520,"520 -220h-480v944h480v-944"],9647:[724,220,560,40,520,"520 -220h-480v944h480v-944zM454 -154v812h-348v-812h348"],9648:[514,11,1140,28,1112,"1112 514l-140 -525h-944l140 525h944"],9649:[514,11,1140,29,1111,"1111 514l-139 -525h-943l139 525h943zM1028 448h-813l-103 -393h812"],9652:[553,-28,660,27,632,"632 28h-605l303 525"],9653:[553,-28,660,27,632,"632 28h-605l303 525zM522 94l-192 326l-191 -326h383"],9655:[791,284,1043,70,1008,"1008 253l-938 -537v1075zM875 253l-739 424v-846"],9658:[555,50,930,65,885,"885 252l-820 -302v605"],9659:[555,50,930,65,885,"885 252l-820 -302v605zM697 252l-566 206v-412"],9662:[477,48,660,27,632,"632 477l-303 -525l-302 525h605"],9663:[477,48,660,27,632,"632 477l-303 -525l-302 525h605zM520 411h-383l192 -326"],9665:[791,284,1043,70,1008,"1008 -284l-938 537l938 538v-1075zM942 -169v846l-739 -424"],9668:[555,50,930,45,865,"865 -50l-820 302l820 303v-605"],9669:[555,50,930,45,865,"865 -50l-820 302l820 303v-605zM799 47v412l-566 -206"],9670:[744,242,1064,39,1025,"1025 251l-492 -493l-494 494l493 492"],9671:[744,242,1064,39,1025,"1025 251l-492 -493l-494 494l493 492zM932 251l-400 400l-400 -400l400 -400"],9672:[744,242,1064,39,1025,"769 251l-237 -237l-237 237l237 237zM1025 251l-492 -493l-494 494l493 492zM932 251l-400 400l-400 -400l400 -400"],9673:[623,119,842,50,792,"656 252c0 -132 -106 -238 -235 -238c-132 0 -238 106 -238 238c0 129 106 235 238 235c129 0 235 -106 235 -235zM792 252c0 -205 -166 -371 -371 -371s-371 166 -371 371s166 371 371 371s371 -166 371 -371zM726 252c0 168 -137 305 -305 305s-305 -137 -305 -305 s137 -305 305 -305s305 137 305 305"],9675:[623,119,842,50,792,"792 252c0 -205 -166 -371 -371 -371s-371 166 -371 371s166 371 371 371s371 -166 371 -371zM726 252c0 168 -137 305 -305 305s-305 -137 -305 -305s137 -305 305 -305s305 137 305 305"],9676:[680,176,910,29,881,"757 554l-48 -48c-14 15 -28 28 -47 41l38 55c21 -14 40 -31 57 -48zM842 433l-60 -29c-9 18 -20 37 -31 54l54 39c14 -20 27 -41 37 -64zM629 624l-22 -45c-17 9 -39 16 -58 22l17 64c24 -7 41 -31 63 -41zM881 290l-67 -6c-2 21 -6 40 -11 61l65 18 c7 -24 11 -48 13 -73zM493 678l-6 -65c-11 1 -22 1 -32 1s-21 -1 -32 -2l-6 66c13 2 25 2 38 2s25 0 38 -2zM814 220l67 -6c-2 -25 -6 -49 -13 -73l-65 18c5 21 9 41 11 61zM344 665l17 -64c-19 -6 -41 -13 -58 -22l-29 60c22 11 46 19 70 26zM782 101l61 -29 c-10 -23 -24 -45 -38 -65l-54 40c11 16 22 35 31 54zM210 603l38 -55c-17 -13 -34 -26 -47 -41l-48 48c18 17 36 33 57 48zM709 -2l48 -48c-18 -17 -36 -33 -57 -48l-38 55c17 13 33 26 47 41zM105 497l54 -38l-32 -55l-59 29c10 23 23 44 37 64zM607 -75l29 -60 c-22 -11 -46 -19 -70 -26l-17 65c19 6 41 13 58 21zM42 363l64 -18c-4 -21 -9 -40 -11 -61l-66 6c2 25 6 49 13 73zM487 -108l6 -66c-12 -1 -25 -2 -38 -2s-26 1 -38 2l6 65c11 -1 22 -1 32 -1s21 1 32 2zM106 159l-64 -18c-7 24 -11 48 -13 73l66 6c2 -20 7 -40 11 -61z M361 -96l-17 -65c-24 7 -48 15 -70 26l29 60c17 -8 39 -15 58 -21zM159 46l-54 -39c-14 20 -27 41 -37 64l59 29c10 -19 21 -38 32 -54zM248 -43l-38 -55c-21 15 -39 30 -57 47l48 49c13 -15 30 -28 47 -41"],9677:[680,176,910,27,884,"884 252c0 -236 -193 -428 -429 -428s-428 192 -428 428s192 428 428 428s429 -192 429 -428zM741 474v-444c48 61 77 138 77 222c0 83 -29 160 -77 222zM689 -24v552c-24 20 -50 37 -78 50v-652c28 13 54 30 78 50zM559 -94v692c-25 8 -51 14 -78 16v-724 c27 2 53 8 78 16zM429 -110v724c-27 -2 -53 -8 -78 -16v-692c25 -8 51 -14 78 -16zM299 -74v652c-29 -13 -55 -31 -78 -51v-550c23 -20 49 -38 78 -51zM169 30v443c-48 -61 -76 -138 -76 -221s28 -160 76 -222"],9678:[623,119,842,50,792,"656 252c0 -132 -106 -238 -235 -238c-132 0 -238 106 -238 238c0 129 106 235 238 235c129 0 235 -106 235 -235zM590 252c0 93 -76 169 -169 169c-96 0 -172 -77 -172 -169c0 -96 76 -172 172 -172c92 0 169 76 169 172zM792 252c0 -205 -166 -371 -371 -371 s-371 166 -371 371s166 371 371 371s371 -166 371 -371zM726 252c0 168 -137 305 -305 305s-305 -137 -305 -305s137 -305 305 -305s305 137 305 305"],9679:[623,119,842,50,792,"792 252c0 -205 -166 -371 -371 -371s-371 166 -371 371s166 371 371 371s371 -166 371 -371"],9680:[623,119,842,50,792,"792 252c0 -205 -166 -371 -371 -371s-371 166 -371 371s166 371 371 371s371 -166 371 -371zM421 557v-610c168 0 305 137 305 305s-137 305 -305 305"],9681:[623,119,842,50,792,"792 252c0 -205 -166 -371 -371 -371s-371 166 -371 371s166 371 371 371s371 -166 371 -371zM421 -53v610c-168 0 -305 -137 -305 -305s137 -305 305 -305"],9682:[623,119,842,50,792,"792 252c0 -205 -166 -371 -371 -371s-371 166 -371 371s166 371 371 371s371 -166 371 -371zM116 252h610c0 168 -137 305 -305 305s-305 -137 -305 -305"],9683:[623,119,842,50,792,"792 252c0 -205 -166 -371 -371 -371s-371 166 -371 371s166 371 371 371s371 -166 371 -371zM726 252h-610c0 -168 137 -305 305 -305s305 137 305 305"],9684:[623,119,842,50,792,"792 252c0 -205 -166 -371 -371 -371s-371 166 -371 371s166 371 371 371s371 -166 371 -371zM726 252h-305v305c-168 0 -305 -137 -305 -305s137 -305 305 -305s305 137 305 305"],9685:[623,119,842,50,792,"792 252c0 -205 -166 -371 -371 -371s-371 166 -371 371s166 371 371 371s371 -166 371 -371zM421 252v305c-168 0 -305 -137 -305 -305h305"],9686:[680,176,580,66,494,"494 680v-856c-236 0 -428 192 -428 428s192 428 428 428"],9687:[680,176,580,86,514,"86 -176v856c236 0 428 -192 428 -428s-192 -428 -428 -428"],9688:[662,158,910,45,865,"865 -158h-820v820h820v-820zM650 253c0 105 -79 192 -193 192c-106 0 -192 -88 -192 -192c0 -107 86 -193 192 -193c105 0 193 87 193 193"],9689:[662,158,910,45,865,"733 252c0 -154 -124 -278 -278 -278s-278 124 -278 278s124 278 278 278s278 -124 278 -278zM865 -158h-820v820h820v-820zM799 252c0 189 -155 344 -344 344s-344 -155 -344 -344s155 -344 344 -344s344 155 344 344"],9690:[662,-252,910,45,865,"865 252h-66c0 189 -155 344 -344 344s-344 -155 -344 -344h-66v410h820v-410zM733 252h-556c0 154 124 278 278 278s278 -124 278 -278"],9691:[252,158,910,45,865,"177 252h556c0 -154 -124 -278 -278 -278s-278 124 -278 278zM865 -158h-820v410h66c0 -189 155 -344 344 -344s344 155 344 344h66v-410"],9692:[680,-252,910,27,455,"455 680v-66c-199 0 -362 -163 -362 -362h-66c0 236 192 428 428 428"],9693:[680,-252,910,455,884,"884 252h-66c0 199 -164 362 -363 362v66c236 0 429 -192 429 -428"],9694:[252,176,910,455,884,"818 252h66c0 -236 -193 -428 -429 -428v66c199 0 363 163 363 362"],9695:[252,176,910,26,455,"455 -110v-66c-236 0 -429 192 -429 428h66c0 -199 164 -362 363 -362"],9696:[680,-251,910,27,884,"884 251h-66c0 199 -164 363 -363 363s-362 -164 -362 -363h-66c0 236 192 429 428 429s429 -193 429 -429"],9697:[252,176,910,27,884,"818 252h66c0 -236 -192 -428 -428 -428s-429 192 -429 428h66c0 -199 164 -362 363 -362s362 163 362 362"],9698:[662,158,911,45,865,"865 -158h-820l820 820v-820"],9699:[662,158,911,45,865,"865 -158h-820v820"],9700:[662,158,911,45,865,"865 662l-820 -820v820h820"],9701:[662,158,911,45,865,"865 -158l-820 820h820v-820"],9702:[444,-59,523,70,455,"455 252c0 -106 -88 -193 -193 -193c-106 0 -192 86 -192 193c0 104 86 192 192 192c114 0 193 -87 193 -192zM389 251c0 72 -55 127 -127 127s-126 -55 -126 -127s54 -126 126 -126s127 54 127 126"],9703:[662,157,910,45,865,"865 -157h-820v819h820v-819zM799 -91v687h-345v-687h345"],9704:[662,157,910,45,865,"865 -157h-820v819h820v-819zM456 -91v687h-345v-687h345"],9705:[662,157,910,45,865,"865 -157h-820v819h820v-819zM799 -91v687l-688 -687h688"],9706:[662,157,910,45,865,"865 -157h-820v819h820v-819zM799 596h-688v-687"],9707:[662,157,910,45,865,"865 -157h-820v819h820v-819zM799 -91v687h-318v-687h318zM429 -91v687h-318v-687h318"],9708:[811,127,1145,35,1110,"673 239c0 -55 -45 -100 -100 -100s-100 45 -100 100s45 100 100 100s100 -45 100 -100zM1110 -127h-1075l538 938zM995 -61l-422 739l-424 -739h846"],9709:[811,127,1145,35,1110,"1110 -127h-1075l537 938zM996 -61l-424 739v-739h424"],9710:[811,127,1145,35,1110,"1110 -127h-1075l538 938zM573 -61v739l-424 -739h424"],9712:[662,158,910,45,865,"865 -158h-820v820h820v-820zM799 -92v688h-318v-371h-370v-317h688zM429 277v319h-318v-319h318"],9713:[662,158,910,45,865,"865 -158h-820v820h820v-820zM798 -92v688h-687v-318h370v-370h317zM429 -92v318h-318v-318h318"],9714:[662,158,910,45,865,"865 -158h-820v820h820v-820zM799 278v318h-687v-688h317v370h370zM799 -92v318h-318v-318h318"],9715:[662,158,910,45,865,"865 -158h-820v820h820v-820zM799 277v319h-318v-319h318zM799 -92v317h-370v371h-318v-688h688"],9716:[623,119,842,50,792,"792 252c0 -205 -166 -371 -371 -371s-371 166 -371 371s166 371 371 371s371 -166 371 -371zM395 278v278c-148 -13 -265 -130 -278 -278h278zM447 226h-330c13 -156 144 -279 304 -279c168 0 305 137 305 305c0 160 -123 291 -279 304v-330"],9717:[623,119,842,50,792,"792 252c0 -205 -166 -371 -371 -371s-371 166 -371 371s166 371 371 371s371 -166 371 -371zM447 278v-330c156 13 279 144 279 304c0 168 -137 305 -305 305c-160 0 -291 -123 -304 -279h330zM395 -52v278h-278c13 -148 130 -265 278 -278"],9718:[623,119,842,50,792,"792 252c0 -205 -166 -371 -371 -371s-371 166 -371 371s166 371 371 371s371 -166 371 -371zM395 278h330c-13 156 -144 279 -304 279c-168 0 -305 -137 -305 -305c0 -160 123 -291 279 -304v330zM725 226h-278v-278c148 13 265 130 278 278"],9719:[623,119,842,50,792,"792 252c0 -205 -166 -371 -371 -371s-371 166 -371 371s166 371 371 371s371 -166 371 -371zM447 278h278c-13 148 -130 265 -278 278v-278zM725 226h-330v330c-156 -13 -279 -144 -279 -304c0 -168 137 -305 305 -305c160 0 291 123 304 279"],9720:[662,158,911,45,865,"865 662l-820 -820v820h820zM707 596h-596v-595"],9721:[662,158,911,45,865,"865 -158l-820 820h820v-820zM799 0v596h-595"],9722:[662,158,911,45,865,"865 -158h-820v820zM706 -92l-595 596v-596h595"],9723:[580,76,746,45,701,"701 -76h-656v656h656v-656zM635 -10v524h-524v-524h524"],9724:[580,76,746,45,701,"701 -76h-656v656h656v-656"],9725:[513,12,601,38,563,"563 -12h-525v525h525v-525zM497 54v393h-393v-393h393"],9726:[514,11,601,38,563,"563 -11h-525v525h525v-525"],9727:[662,158,911,45,865,"865 -158h-820l820 820v-820zM799 -92v595l-596 -595h596"],9733:[655,66,870,60,810,"810 382l-228 -176l82 -272l-229 162l-229 -162l82 272l-228 176h282l93 273l93 -273h282"],9734:[655,66,870,60,810,"810 382l-228 -176l82 -272l-229 162l-229 -162l82 272l-228 176h282l93 273l93 -273h282zM658 330h-167l-56 164l-56 -164h-167l136 -105l-49 -161l136 96l136 -96l-49 161"],9737:[583,79,762,50,712,"463 253c0 -44 -33 -83 -82 -83s-83 32 -83 83c0 49 41 82 83 82s82 -34 82 -82zM712 252c0 -183 -148 -331 -331 -331s-331 148 -331 331s148 331 331 331s331 -148 331 -331zM646 252c0 146 -119 265 -265 265s-265 -119 -265 -265s119 -265 265 -265s265 119 265 265"],9740:[634,131,581,54,553,"553 609l-131 -306c63 -43 105 -115 105 -196c0 -132 -106 -238 -235 -238c-132 0 -238 106 -238 238c0 129 106 235 238 235c26 0 52 -4 75 -13l131 305zM461 107c0 93 -76 169 -169 169c-96 0 -172 -77 -172 -169c0 -96 76 -172 172 -172c92 0 169 76 169 172"],9742:[676,0,1000,32,967,"300 436l-208 -101c-21 17 -60 45 -60 75c0 54 18 118 62 152c92 72 290 114 406 114c115 0 330 -44 416 -124c41 -38 51 -88 51 -157c0 -15 -37 -43 -59 -60l-208 101c0 10 1 23 1 36c0 38 -6 81 -51 81h-300c-45 0 -51 -43 -51 -81c0 -13 1 -26 1 -36zM650 362 c0 -83 -68 -148 -150 -148c-81 0 -149 70 -149 152c0 79 68 147 147 147c82 0 152 -67 152 -151zM805 0h-610v216l75 122h36c13 -104 104 -169 205 -169c87 0 178 82 185 169h34l75 -122v-216"],9746:[662,158,910,45,865,"719 24l-36 -36l-228 227l-228 -227l-36 36l227 228l-227 228l36 36l228 -227l228 227l36 -36l-227 -228zM865 -158h-820v820h820v-820zM799 -92v688h-688v-688h688"],9761:[630,35,619,70,549,"549 -35h-277c-87 0 -155 42 -155 133c0 51 27 100 71 137l225 188c24 20 35 52 35 77c0 51 -42 75 -95 75h-283v55h277c88 0 155 -45 155 -133c0 -47 -20 -87 -63 -124l-202 -173c-39 -34 -66 -71 -66 -104c0 -50 42 -76 95 -76h283v-55"],9785:[728,82,1150,170,980,"755 443c0 -28 -22 -50 -50 -50s-50 22 -50 50s22 50 50 50s50 -22 50 -50zM495 443c0 -28 -22 -50 -50 -50s-50 22 -50 50s22 50 50 50s50 -22 50 -50zM804 152l-19 -13c-72 80 -127 97 -209 97c-83 0 -136 -17 -208 -97l-19 13c47 84 108 150 227 150 c120 0 181 -66 228 -150zM980 323c0 -224 -181 -405 -405 -405s-405 181 -405 405s181 405 405 405s405 -181 405 -405zM928 323c0 194 -159 353 -353 353s-353 -159 -353 -353s159 -353 353 -353s353 159 353 353"],9786:[728,82,1150,170,980,"755 443c0 -28 -22 -50 -50 -50s-50 22 -50 50s22 50 50 50s50 -22 50 -50zM495 443c0 -28 -22 -50 -50 -50s-50 22 -50 50s22 50 50 50s50 -22 50 -50zM784 249l19 -13c-47 -84 -108 -150 -228 -150c-119 0 -180 66 -227 150l19 13c72 -80 125 -97 208 -97 c82 0 137 17 209 97zM980 323c0 -224 -181 -405 -405 -405s-405 181 -405 405s181 405 405 405s405 -181 405 -405zM928 323c0 194 -159 353 -353 353s-353 -159 -353 -353s159 -353 353 -353s353 159 353 353"],9787:[728,82,1150,170,980,"980 323c0 -224 -181 -405 -405 -405s-405 181 -405 405s181 405 405 405s405 -181 405 -405zM755 443c0 28 -22 50 -50 50s-50 -22 -50 -50s22 -50 50 -50s50 22 50 50zM495 443c0 28 -22 50 -50 50s-50 -22 -50 -50s22 -50 50 -50s50 22 50 50zM803 236l-19 13 c-72 -80 -127 -97 -209 -97c-83 0 -136 17 -208 97l-19 -13c47 -84 108 -150 227 -150c120 0 181 66 228 150"],9788:[623,122,837,46,791,"791 218h-140c-6 -41 -21 -78 -45 -109l99 -99l-46 -46l-99 98c-31 -24 -68 -40 -108 -46v-138h-66v138c-41 6 -79 22 -110 45l-98 -97l-46 46l97 98c-24 31 -40 69 -46 109h-137v66h137c5 41 22 79 46 111l-97 97l46 46l98 -97c31 23 69 39 109 45v138h66v-138 c41 -6 78 -22 109 -46l99 98l46 -46l-98 -99c23 -31 39 -68 44 -108h140v-66zM587 252h1c0 93 -77 169 -169 169c-97 0 -173 -77 -173 -169c0 -96 77 -172 172 -172c93 0 169 76 169 172"],9789:[728,82,641,40,601,"601 320c0 -223 -181 -402 -404 -402c-54 0 -109 16 -157 37c205 1 367 160 367 365c0 204 -162 371 -367 371c46 23 101 37 157 37c223 0 404 -185 404 -408zM198 -43v-2c205 0 366 159 366 365c0 198 -155 360 -351 371v-3c137 -64 231 -207 231 -368 c0 -169 -99 -302 -246 -363"],9790:[728,82,641,40,601,"601 -45c-46 -23 -101 -37 -157 -37c-223 0 -404 185 -404 408s181 402 404 402c54 0 109 -16 157 -37c-205 -1 -367 -160 -367 -365c0 -204 162 -371 367 -371zM443 689v2c-205 0 -366 -159 -366 -365c0 -198 155 -360 351 -371v3c-137 64 -231 207 -231 368 c0 169 99 302 246 363"],9791:[702,198,603,65,538,"466 702h68c-13 -68 -55 -126 -112 -160c69 -41 116 -116 116 -202c0 -121 -88 -220 -202 -236v-104h136v-66h-136v-132h-66v132h-139v66h139v104c-116 16 -205 115 -205 236c0 86 47 161 116 202c-57 34 -99 92 -112 160h68c20 -73 86 -127 166 -127 c77 0 143 53 163 127zM472 340c0 93 -76 169 -169 169c-96 0 -172 -77 -172 -169c0 -96 76 -172 172 -172c92 0 169 76 169 172"],9792:[638,135,603,65,538,"270 63v104c-116 16 -205 115 -205 236c0 129 106 235 238 235c129 0 235 -106 235 -235c0 -121 -88 -219 -202 -236v-104h136v-66h-136v-132h-66v132h-139v66h139zM472 403c0 93 -76 169 -169 169c-96 0 -172 -77 -172 -169c0 -96 76 -172 172 -172c92 0 169 76 169 172 "],9793:[638,135,603,65,538,"336 440v-104c114 -17 202 -115 202 -236c0 -129 -106 -235 -235 -235c-132 0 -238 106 -238 235c0 121 89 220 205 236v104h-139v66h139v132h66v-132h136v-66h-136zM472 100c0 96 -77 172 -169 172c-96 0 -172 -76 -172 -172c0 -92 76 -169 172 -169 c93 0 169 76 169 169"],9794:[634,131,660,54,620,"620 399l-13 -32c-37 41 -72 87 -99 137l-86 -201c63 -43 105 -115 105 -196c0 -132 -106 -238 -235 -238c-132 0 -238 106 -238 238c0 129 106 235 238 235c26 0 52 -4 75 -13l86 200c-55 -16 -112 -24 -168 -26l13 33c70 19 166 46 219 98l22 -9c0 -74 43 -165 81 -226 zM461 107c0 93 -76 169 -169 169c-96 0 -172 -77 -172 -169c0 -96 76 -172 172 -172c92 0 169 76 169 172"],9795:[732,176,970,66,904,"904 0h-172v-176h-56v176h-601v51c11 2 23 1 34 2c57 4 109 22 156 55c113 79 209 225 209 367c0 110 -67 199 -183 199c-84 0 -169 -55 -169 -146c0 -52 35 -95 73 -126c-8 -16 -17 -31 -27 -46c-63 37 -102 95 -102 170c0 120 108 206 223 206c142 0 244 -107 244 -248 c0 -170 -116 -335 -260 -430h403v662h56v-662h172v-54"],9796:[793,140,970,63,866,"809 -24h57c-12 -66 -77 -116 -143 -116c-87 0 -155 52 -155 143c0 98 82 256 82 337c0 79 -71 130 -145 130c-80 0 -184 -53 -231 -117v-353h-56v642h-155v55h155v96h56v-96h268v-55h-268v-211c63 49 147 94 229 94c106 0 201 -73 201 -184c0 -57 -50 -202 -68 -266 c-6 -22 -14 -45 -14 -69c0 -50 46 -91 95 -91c43 0 74 23 92 61"],9798:[760,110,840,60,780,"780 644h-60v-170c0 -154 -118 -284 -272 -299v-119h108v-56h-108v-110h-56v110h-108v56h108v119c-154 15 -272 145 -272 299v170h-60l88 116l88 -116h-60v-170c0 -124 93 -228 216 -242v412h-60l88 116l88 -116h-60v-412c123 14 216 118 216 242v170h-60l88 116"],9799:[730,110,632,76,576,"76 730h285c118 0 215 -82 215 -206s-97 -205 -215 -205h-229v-373h389v-56h-445v840zM132 375h232c81 0 156 62 156 149c0 88 -75 150 -156 150h-232v-299"],9800:[760,110,964,25,939,"510 -110h-56c-3 142 -33 815 -263 815c-44 0 -110 -33 -110 -129c0 -55 35 -98 73 -126c-8 -16 -17 -31 -27 -46c-63 37 -102 102 -102 177c0 115 82 179 167 179c205 0 269 -323 290 -534c22 211 86 534 290 534c85 0 167 -65 167 -179c0 -75 -39 -140 -102 -177 c-10 15 -19 30 -27 46c38 28 73 71 73 126c0 96 -66 129 -110 129c-230 0 -260 -673 -263 -815"],9801:[643,139,781,43,738,"738 643v-61c-9 0 -17 -3 -24 -8c-80 -56 -76 -224 -208 -272c72 -42 118 -119 118 -203c0 -130 -104 -238 -235 -238c-132 0 -238 106 -238 238c0 84 46 162 119 203c-130 47 -123 210 -200 270c-8 6 -17 10 -27 10v61c179 1 101 -308 345 -308s171 309 350 308zM558 99 c0 92 -77 169 -169 169c-93 0 -172 -75 -172 -169c0 -95 77 -172 172 -172c94 0 169 79 169 172"],9828:[609,99,685,34,651,"314 68h-10c-31 -45 -76 -63 -120 -63c-76 0 -150 60 -150 165c0 175 174 253 310 439c136 -186 307 -265 307 -440c0 -109 -73 -165 -147 -165c-45 0 -90 19 -119 64h-10c0 -60 20 -147 79 -152v-15h-222v15c60 5 82 91 82 152zM298 167h92c22 -65 71 -97 110 -97 c45 0 85 35 85 108c0 94 -98 197 -241 326c-143 -128 -244 -229 -244 -326c0 -75 44 -108 89 -108c46 0 95 29 109 97"],9829:[603,105,685,34,651,"651 413c0 -175 -173 -332 -309 -518c-127 186 -308 347 -308 517c0 120 79 191 157 191c49 0 117 -27 150 -143c43 116 97 143 154 143c90 0 156 -68 156 -190"],9830:[609,105,685,41,643,"643 252c-113 -114 -211 -232 -300 -357c-97 127 -199 244 -302 357c112 110 212 229 302 357c95 -127 195 -246 300 -357"],9831:[603,99,685,34,651,"472 340l6 -6c8 5 21 6 24 6c85 0 149 -82 149 -167c0 -110 -71 -169 -145 -169c-52 0 -102 28 -120 64h-11c0 -60 20 -147 79 -152v-15h-222v15c60 5 82 92 82 152h-11c-21 -36 -67 -64 -121 -64c-82 0 -148 66 -148 169c0 102 68 167 152 167c7 0 15 -3 24 -4l6 7 c-18 26 -29 55 -29 99c0 83 73 161 160 161c86 0 154 -76 154 -158c0 -46 -12 -78 -29 -105zM297 167h92c22 -65 62 -97 102 -97c48 0 94 31 94 99c0 59 -45 105 -108 105c-18 0 -37 -6 -58 -15l-35 74c34 32 51 73 51 98c0 58 -31 106 -89 106c-61 0 -93 -53 -93 -106 c0 -25 14 -68 50 -98l-35 -74c-24 10 -46 15 -65 15c-65 0 -103 -46 -103 -105c0 -68 47 -99 95 -99c40 0 88 29 102 97"],9833:[714,125,390,45,345,"345 714v-675c0 -88 -106 -164 -198 -164c-57 0 -102 35 -102 87c0 84 116 163 192 163c28 0 51 -2 68 -8v597h40"],9834:[714,125,560,50,510,"301 714h24c17 -89 122 -191 154 -255c22 -35 31 -70 31 -105c0 -47 -18 -119 -34 -144l-15 9c15 35 24 80 24 125c0 78 -70 155 -144 176v-473c0 -79 -68 -172 -191 -172c-59 0 -100 41 -100 83c0 88 110 167 200 167c25 0 34 -2 51 -12v601"],9835:[842,125,840,40,721,"721 842v-682c0 -92 -79 -179 -190 -179c-59 0 -100 42 -100 81c0 101 128 169 192 169c19 0 43 -2 58 -14v531l-349 -105v-604c0 -79 -87 -164 -190 -164c-44 0 -102 27 -102 83c0 91 115 167 195 167c25 0 32 -2 57 -10v599"],9854:[775,271,1186,70,1116,"903 249c0 -90 -51 -184 -151 -184c-75 0 -115 57 -151 114c-40 -61 -75 -114 -156 -114c-109 0 -161 91 -161 190c0 90 51 184 151 184c76 0 115 -56 151 -114c40 61 75 114 156 114c109 0 161 -91 161 -190zM870 260c0 61 -40 125 -106 125c-78 0 -115 -93 -139 -154 c26 -56 65 -88 129 -88c68 0 116 49 116 117zM562 278c-26 56 -65 88 -129 88c-68 0 -116 -49 -116 -117c0 -61 40 -125 106 -125c78 0 115 93 139 154zM1116 252c0 -288 -235 -523 -523 -523s-523 235 -523 523s235 523 523 523s523 -235 523 -523zM1050 252 c0 251 -206 457 -457 457s-457 -206 -457 -457s206 -457 457 -457s457 206 457 457"],9856:[669,23,1032,170,862,"571 323c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM862 -23h-692v692h692v-692zM819 20v606h-606v-606h606"],9857:[669,23,1032,170,862,"403 491c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM739 155c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM862 -23h-692v692h692v-692zM819 20v606h-606v-606h606"],9858:[669,23,1032,170,862,"403 491c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM571 323c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM739 155c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM862 -23h-692v692h692v-692zM819 20v606 h-606v-606h606"],9859:[669,23,1032,170,862,"739 491c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM403 491c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM739 155c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM403 155c0 -31 -24 -55 -55 -55 s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM862 -23h-692v692h692v-692zM819 20v606h-606v-606h606"],9860:[669,23,1032,170,862,"739 491c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM403 491c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM571 323c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM739 155c0 -31 -24 -55 -55 -55 s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM403 155c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM862 -23h-692v692h692v-692zM819 20v606h-606v-606h606"],9861:[669,23,1032,170,862,"739 491c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM739 323c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM403 491c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM739 155c0 -31 -24 -55 -55 -55 s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM403 323c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM403 155c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM862 -23h-692v692h692v-692zM819 20v606h-606v-606h606"],9862:[687,42,1032,152,881,"731 323c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM881 323c0 -202 -162 -365 -364 -365s-365 163 -365 365s163 364 365 364s364 -162 364 -364zM829 323c0 174 -138 312 -312 312s-313 -138 -313 -312s139 -313 313 -313s312 139 312 313"],9863:[687,42,1032,152,881,"731 323c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM412 323c0 -31 -24 -55 -55 -55s-55 24 -55 55s24 55 55 55s55 -24 55 -55zM881 323c0 -202 -162 -365 -364 -365s-365 163 -365 365s163 364 365 364s364 -162 364 -364zM829 323 c0 174 -138 312 -312 312s-313 -138 -313 -312s139 -313 313 -313s312 139 312 313"],9864:[687,42,1032,152,881,"881 323c0 -202 -162 -365 -364 -365s-365 163 -365 365s163 364 365 364s364 -162 364 -364zM731 323c0 31 -24 55 -55 55s-55 -24 -55 -55s24 -55 55 -55s55 24 55 55"],9865:[687,42,1032,152,881,"881 323c0 -202 -162 -365 -364 -365s-365 163 -365 365s163 364 365 364s364 -162 364 -364zM731 323c0 31 -24 55 -55 55s-55 -24 -55 -55s24 -55 55 -55s55 24 55 55zM412 323c0 31 -24 55 -55 55s-55 -24 -55 -55s24 -55 55 -55s55 24 55 55"],9888:[1023,155,1510,25,1485,"738 176l-42 381c-2 20 -3 32 -3 43c0 43 15 76 53 76c34 0 53 -32 53 -81c0 -12 -1 -27 -2 -38l-45 -381h-14zM799 42c0 -29 -23 -51 -54 -51c-30 0 -52 22 -52 52s23 54 53 54c29 0 53 -25 53 -55zM1485 -155h-1460l721 1178zM1354 -89l-608 964l-590 -964h1198"],9893:[784,281,660,54,620,"620 549l-13 -32c-37 41 -72 87 -99 137l-86 -201c63 -43 105 -115 105 -196c0 -121 -88 -219 -202 -236v-104h136v-66h-136v-132h-66v132h-139v66h139v104c-116 16 -205 115 -205 236c0 129 106 235 238 235c26 0 52 -4 75 -13l86 200c-55 -16 -112 -24 -168 -26l13 33 c70 19 166 46 219 98l22 -9c0 -74 43 -165 81 -226zM461 257c0 93 -76 169 -169 169c-96 0 -172 -77 -172 -169c0 -96 76 -172 172 -172c92 0 169 76 169 172"],9898:[583,79,762,50,712,"712 252c0 -183 -148 -331 -331 -331s-331 148 -331 331s148 331 331 331s331 -148 331 -331zM646 252c0 146 -119 265 -265 265s-265 -119 -265 -265s119 -265 265 -265s265 119 265 265"],9899:[583,79,762,50,712,"712 252c0 -183 -148 -331 -331 -331s-331 148 -331 331s148 331 331 331s331 -148 331 -331"],9900:[487,-14,565,46,519,"519 252c0 -132 -106 -238 -235 -238c-132 0 -238 106 -238 238c0 129 106 235 238 235c129 0 235 -106 235 -235zM453 252c0 93 -76 169 -169 169c-96 0 -172 -77 -172 -169c0 -96 76 -172 172 -172c92 0 169 76 169 172"],9906:[638,135,603,65,538,"270 -135v302c-118 16 -205 117 -205 236c0 131 108 235 238 235c129 0 235 -106 235 -235c0 -117 -85 -219 -202 -236v-302h-66zM472 403c0 92 -77 169 -169 169c-94 0 -172 -75 -172 -169c0 -95 77 -172 172 -172c94 0 169 78 169 172"],9954:[773,80,700,94,606,"420 176c0 -37 -31 -67 -68 -67s-67 30 -67 67c0 38 30 68 67 68s68 -30 68 -68zM383 631v-201c124 -15 223 -129 223 -251c0 -135 -112 -259 -255 -259c-140 0 -257 114 -257 256c0 123 99 242 233 255v199c-58 -45 -118 -80 -182 -108v41c67 53 160 127 196 210h25 c36 -84 127 -154 197 -209v-41c-62 29 -126 63 -180 108zM550 176c0 109 -91 200 -200 200s-200 -91 -200 -200c0 -108 91 -200 200 -200s200 92 200 200"],11026:[662,157,910,45,865,"865 -157h-820v819h820v-819zM799 -91v345h-688v-345h688"],11027:[662,157,910,45,865,"865 -157h-820v819h820v-819zM799 252v344h-688v-344h688"],11028:[662,157,910,45,865,"865 -157h-820v819h820v-819zM799 -91l-688 687v-687h688"],11029:[662,157,910,45,865,"865 -157h-820v819h820v-819zM799 -91v687h-688"],11030:[744,242,1064,39,1025,"1025 251l-492 -493l-494 494l493 492zM932 251l-400 400v-800"],11031:[744,242,1064,39,1025,"1025 251l-492 -493l-494 494l493 492zM532 -149v800l-400 -399"],11032:[744,242,1064,39,1025,"1025 251l-492 -493l-494 494l493 492zM932 252h-800l401 -401"],11033:[744,242,1064,39,1025,"1025 251l-492 -493l-494 494l493 492zM932 251l-400 400l-400 -399"],11034:[662,157,910,45,865,"865 562h-49v51h-51v49h100v-100zM721 613h-100v49h100v-49zM865 418h-49v100h49v-100zM577 613h-100v49h100v-49zM865 274h-49v100h49v-100zM433 613h-100v49h100v-49zM865 130h-49v100h49v-100zM289 613h-100v49h100v-49zM865 -14h-49v100h49v-100zM865 -157h-100v49 h51v51h49v-100zM145 613h-51v-51h-49v100h100v-49zM721 -157h-100v49h100v-49zM94 418h-49v100h49v-100zM577 -157h-100v49h100v-49zM94 274h-49v100h49v-100zM433 -157h-100v49h100v-49zM94 130h-49v100h49v-100zM289 -157h-100v49h100v-49zM94 -14h-49v100h49v-100z M145 -157h-100v100h49v-51h51v-49"],11035:[780,180,1040,40,1000,"1000 -180h-960v960h960v-960"],11036:[780,180,1040,40,1000,"1000 -180h-960v960h960v-960zM934 -114v828h-828v-828h828"],11037:[332,-172,240,50,190,"190 172h-140v160h140v-160"],11038:[332,-172,240,50,190,"190 172h-140v160h140v-160zM160 202v100h-80v-100h80"],11039:[690,105,910,36,874,"874 387l-160 -492h-518l-160 492l419 303"],11040:[690,105,910,36,874,"874 387l-160 -492h-518l-160 492l419 303zM794 363l-339 246l-339 -246l128 -402h422"],11041:[680,178,910,82,828,"828 36l-373 -214l-373 214v430l373 214l373 -214v-430zM762 73v353l-307 178l-307 -178v-353l308 -175"],11042:[680,178,910,82,828,"828 36l-373 -214l-373 214v430l373 214l373 -214v-430"],11043:[633,127,926,24,902,"902 253l-220 -380h-438l-220 380l220 380h438"],11044:[785,282,1207,70,1137,"1137 252c0 -294 -239 -534 -533 -534s-534 240 -534 534s240 533 534 533s533 -239 533 -533"],11045:[581,96,779,45,734,"734 251l-344 -347l-345 347l345 330"],11046:[581,96,779,45,734,"734 251l-344 -347l-345 347l345 330zM640 250l-250 240l-251 -240l251 -252"],11047:[609,105,544,40,504,"504 252l-231 -357l-233 357l232 357"],11048:[609,105,544,40,504,"504 252l-231 -357l-233 357l232 357zM425 252l-153 236l-153 -236l154 -236"],11049:[488,-16,523,26,497,"497 252l-236 -236l-235 236l235 236"],11050:[488,-16,357,26,331,"331 252l-153 -236l-152 236l152 236"],11051:[488,-16,357,26,331,"331 252l-153 -236l-152 236l152 236zM258 252l-80 123l-79 -123l79 -123"],11052:[500,-4,842,50,792,"792 252c0 -186 -220 -248 -371 -248s-371 62 -371 248s220 248 371 248s371 -62 371 -248"],11053:[500,-4,842,50,792,"792 252c0 -186 -220 -248 -371 -248s-371 62 -371 248s220 248 371 248s371 -62 371 -248zM726 252c0 142 -196 182 -305 182s-305 -40 -305 -182s196 -182 305 -182s305 40 305 182"],11054:[623,119,596,50,546,"546 252c0 -151 -62 -371 -248 -371s-248 220 -248 371s62 371 248 371s248 -220 248 -371"],11055:[623,119,596,50,546,"546 252c0 -151 -62 -371 -248 -371s-248 220 -248 371s62 371 248 371s248 -220 248 -371zM480 252c0 157 -64 305 -182 305c-119 0 -182 -148 -182 -305s63 -305 182 -305c118 0 182 148 182 305"],11056:[448,-57,926,70,856,"856 220h-170c-16 -69 -77 -120 -151 -120s-135 51 -150 120h-127c-18 0 -26 -10 -26 -20c0 -8 5 -19 14 -28c30 -31 59 -63 82 -96l-20 -19c-66 76 -142 150 -238 191v10c96 40 172 115 237 190l20 -19c-22 -33 -53 -68 -82 -96c-10 -10 -14 -16 -14 -25 c0 -10 16 -22 26 -22h127c15 70 76 122 151 122c74 0 137 -52 151 -122h170v-66zM436 286h198c-13 41 -53 72 -99 72s-85 -31 -99 -72zM634 220h-197c14 -41 53 -70 98 -70s85 29 99 70"],11057:[739,232,926,60,866,"866 -80h-614c-18 0 -25 -12 -25 -22c0 -9 4 -15 14 -25c29 -28 54 -53 76 -86l-20 -19c-65 75 -141 140 -237 180v10c84 36 152 88 213 145c-60 57 -128 109 -213 145v10c84 36 152 88 213 145c-60 57 -128 109 -213 145v10c96 41 172 105 238 181l20 -19 c-23 -33 -47 -55 -77 -86c-9 -9 -14 -20 -14 -28c0 -10 8 -20 26 -20h613v-66h-614c-10 0 -25 -12 -25 -22c0 -9 3 -13 13 -23l78 -72c-38 -36 -57 -52 -77 -73c-9 -9 -14 -16 -14 -24c0 -11 12 -20 26 -20h613v-66h-614c-12 0 -25 -12 -25 -22c0 -9 3 -13 13 -23l78 -72 c-38 -36 -57 -52 -77 -73c-9 -9 -14 -16 -14 -24c0 -10 8 -20 26 -20h613v-66"],11058:[569,61,1200,52,1147,"1147 220h-161c-15 -174 -143 -281 -317 -281c-169 0 -295 123 -310 281h-119c-18 0 -26 -10 -26 -20c0 -8 5 -19 14 -28c30 -31 59 -63 82 -96l-20 -19c-66 76 -142 150 -238 191v10c96 40 172 116 237 191l20 -19c-22 -33 -53 -69 -82 -97c-10 -10 -14 -16 -14 -25 c0 -10 16 -22 26 -22h120c15 166 146 283 310 283c176 0 301 -129 317 -283h161v-66zM697 286h223c-15 118 -107 205 -223 217v-217zM647 286v217c-124 -10 -209 -105 -223 -217h223zM920 220h-223v-215c120 11 209 99 223 215zM647 5v215h-223c15 -113 102 -205 223 -215"],11059:[449,-58,1574,55,1519,"1519 220h-69l-89 -106l-119 172l-124 -172l-119 172l-124 -172l-119 172l-124 -172l-119 172l-124 -172l-92 106h-57c-8 0 -24 -13 -24 -22s4 -15 14 -25c29 -28 60 -63 82 -96l-20 -19c-65 75 -141 150 -237 190v10c96 41 172 115 238 191l20 -19 c-23 -33 -52 -65 -82 -96c-9 -9 -14 -20 -14 -28c0 -10 8 -20 26 -20h86l60 -66l124 174l119 -174l124 174l119 -174l124 174l119 -174l124 174l119 -174l60 66h98v-66"],11060:[450,-57,926,56,871,"871 220h-266v-163h-50v163h-168c-10 -2 -24 -13 -24 -22s4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19c-52 60 -111 121 -181 163h-15c-10 0 -26 -12 -26 -22c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19c-65 75 -141 151 -237 191v10c96 41 172 116 238 192l20 -19 c-23 -33 -52 -66 -82 -97c-9 -9 -14 -20 -14 -28c0 -10 8 -20 26 -20h13c71 42 130 103 183 164l20 -19c-23 -33 -52 -66 -82 -97c-9 -9 -14 -20 -14 -28c0 -9 7 -20 22 -20h169v164h50v-164h266v-66"],11061:[450,-57,926,55,871,"871 220h-171v-163h-50v163h-79v-163h-50v163h-135c-10 -2 -24 -13 -24 -22s4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19c-52 60 -111 121 -181 163h-15c-10 0 -26 -12 -26 -22c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19c-65 75 -141 151 -237 191v10 c96 41 172 116 238 192l20 -19c-23 -33 -52 -66 -82 -97c-9 -9 -14 -20 -14 -28c0 -10 8 -20 26 -20h13c71 42 130 103 183 164l20 -19c-23 -33 -52 -66 -82 -97c-9 -9 -14 -20 -14 -28c0 -9 7 -20 22 -20h136v164h50v-164h79v164h50v-164h171v-66"],11062:[450,-57,926,55,871,"871 57h-50v163h-435c-10 -2 -24 -13 -24 -22s4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19c-52 60 -111 121 -181 163h-15c-10 0 -26 -12 -26 -22c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19c-65 75 -141 151 -237 191v10c96 41 172 116 238 192l20 -19 c-23 -33 -52 -66 -82 -97c-9 -9 -14 -20 -14 -28c0 -10 8 -20 26 -20h13c71 42 130 103 183 164l20 -19c-23 -33 -52 -66 -82 -97c-9 -9 -14 -20 -14 -28c0 -9 7 -20 22 -20h436v164h50v-393"],11063:[449,-57,1412,55,1357,"1337 449l20 -19c-23 -33 -55 -62 -82 -96c-13 -17 -29 -49 -29 -81c0 -44 18 -68 28 -80c27 -30 60 -64 82 -97l-20 -19c-52 60 -112 121 -182 163v66c71 43 130 102 183 163zM1070 220h-144v66h144v-66zM842 220h-144v66h144v-66zM614 220h-144v66h144v-66zM439 449 l20 -19c-23 -33 -52 -65 -82 -96c-9 -9 -14 -20 -14 -28c0 -9 6 -20 23 -20v-66c-9 0 -24 -14 -24 -22c0 -9 3 -14 13 -24c29 -28 61 -65 83 -98l-20 -19c-52 60 -111 121 -181 163h-15c-10 0 -26 -12 -26 -22c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19 c-65 75 -141 151 -237 191v10c96 41 172 115 238 191l20 -19c-23 -33 -52 -65 -82 -96c-9 -9 -14 -20 -14 -28c0 -10 8 -20 25 -20h14c71 42 130 102 183 163"],11064:[449,-57,926,55,873,"873 254c0 -21 -16 -37 -36 -37s-37 16 -37 37c0 20 17 36 37 36s36 -16 36 -36zM751 254c0 -21 -17 -37 -37 -37c-19 0 -36 16 -36 37c0 20 17 36 36 36c20 0 37 -16 37 -36zM628 253c0 -20 -16 -36 -36 -36s-36 16 -36 36s16 36 36 36s36 -16 36 -36zM506 254 c0 -21 -17 -37 -36 -37c-20 0 -37 16 -37 37c0 20 17 36 37 36c19 0 36 -16 36 -36zM385 254c0 -21 -17 -37 -37 -37s-36 16 -36 37c0 20 16 36 36 36s37 -16 37 -36zM312 76l-20 -19c-65 75 -141 151 -237 191v10c96 41 171 115 237 191l20 -19c-23 -33 -51 -65 -81 -96 c-9 -9 -14 -20 -14 -28c0 -10 4 -17 14 -17c20 0 31 -16 31 -36s-11 -36 -31 -36c-11 0 -15 -9 -15 -19c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97"],11065:[450,-57,926,55,871,"851 450l20 -19c-23 -33 -55 -62 -82 -97c-13 -17 -29 -49 -29 -81c0 -44 18 -68 28 -80c27 -30 60 -64 82 -97l-20 -19c-52 60 -111 121 -181 163h-146v-163h-50v163h-231c-10 0 -26 -12 -26 -22c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19 c-65 75 -141 151 -237 191v10c96 41 172 116 238 192l20 -19c-23 -33 -52 -66 -82 -97c-9 -9 -14 -20 -14 -28c0 -10 8 -20 26 -20h230v164h50v-164h145c71 43 130 103 183 164"],11066:[450,-57,926,55,871,"851 450l20 -19c-23 -33 -55 -62 -82 -97c-13 -17 -29 -49 -29 -81c0 -44 18 -68 28 -80c27 -30 60 -64 82 -97l-20 -19c-52 60 -111 121 -181 163h-95v-163h-50v163h-79v-163h-50v163h-153c-10 0 -26 -12 -26 -22c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19 c-65 75 -141 151 -237 191v10c96 41 172 116 238 192l20 -19c-23 -33 -52 -66 -82 -97c-9 -9 -14 -20 -14 -28c0 -10 8 -20 26 -20h152v164h50v-164h79v164h50v-164h94c71 43 130 103 183 164"],11067:[449,-57,926,55,871,"851 449l20 -19c-23 -33 -55 -62 -82 -96c-13 -17 -29 -49 -29 -81c0 -44 18 -68 28 -80c27 -30 60 -64 82 -97l-20 -19c-52 60 -111 121 -181 163h-282c-14 0 -24 -14 -24 -22c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19c-52 60 -111 121 -181 163h-16 c-10 0 -26 -12 -26 -22c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19c-65 75 -141 151 -237 191v10c96 41 172 115 238 191l20 -19c-23 -33 -52 -65 -82 -96c-9 -9 -14 -20 -14 -28c0 -10 8 -20 26 -20h14c71 42 130 102 183 163l20 -19c-23 -33 -52 -65 -82 -96 c-9 -9 -14 -20 -14 -28c0 -9 9 -20 23 -20h281c71 43 130 102 183 163"],11068:[450,-57,926,55,871,"851 450l20 -19c-23 -33 -55 -62 -82 -97c-13 -17 -29 -49 -29 -81c0 -44 18 -68 28 -80c27 -30 60 -64 82 -97l-20 -19c-52 60 -111 121 -181 163h-87v-163h-50v163h-145c-14 0 -24 -14 -24 -22c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19 c-52 60 -111 121 -181 163h-16c-10 0 -26 -12 -26 -22c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19c-65 75 -141 151 -237 191v10c96 41 172 116 238 192l20 -19c-23 -33 -52 -66 -82 -97c-9 -9 -14 -20 -14 -28c0 -10 8 -20 26 -20h14c71 42 130 103 183 164l20 -19 c-23 -33 -52 -66 -82 -97c-9 -9 -14 -20 -14 -28c0 -9 9 -20 23 -20h145v164h50v-164h86c71 43 130 103 183 164"],11069:[450,-57,926,50,876,"856 450l20 -19c-23 -33 -48 -62 -75 -97c-13 -17 -30 -49 -30 -81c0 -44 19 -71 29 -83c27 -30 53 -62 75 -94l-20 -19c-52 63 -100 121 -170 163h-51v-163h-50v163h-59v-163h-50v163h-121c-14 0 -24 -14 -24 -22c0 -9 4 -15 14 -25c29 -28 58 -64 80 -97l-20 -19 c-52 63 -100 121 -176 163c-10 0 -25 -12 -25 -22c0 -9 4 -15 14 -25c29 -28 58 -64 80 -97l-20 -19c-65 75 -131 151 -227 191v10c96 41 162 116 228 192l20 -19c-23 -33 -50 -66 -80 -97c-9 -9 -14 -20 -14 -28c0 -10 6 -20 24 -20c75 42 123 101 176 164l20 -19 c-23 -33 -49 -66 -79 -97c-9 -9 -14 -20 -14 -28c0 -9 9 -20 23 -20h121v164h50v-164h59v164h50v-164h50c71 43 119 101 172 164"],11070:[449,-57,926,55,871,"871 220h-225l108 -108l-35 -35l-142 142l-142 -142l-35 35l108 108h-265c-18 0 -26 -10 -26 -20c0 -8 5 -19 14 -28c30 -31 59 -63 82 -96l-20 -19c-66 76 -142 150 -238 191v10c96 40 172 116 237 191l20 -19c-22 -33 -53 -69 -82 -97c-10 -10 -14 -16 -14 -25 c0 -10 16 -22 26 -22h268l-110 110l35 35l142 -142l142 142l35 -35l-110 -110h227v-66"],11071:[449,-57,926,55,871,"871 256l-51 -34c-43 75 -102 152 -190 152c-108 0 -154 -154 -280 -154h-107c-18 0 -26 -10 -26 -20c0 -8 5 -19 14 -28c30 -31 59 -63 82 -96l-20 -19c-66 76 -142 150 -238 191v10c96 40 172 116 237 191l20 -19c-22 -33 -53 -69 -82 -97c-10 -10 -14 -16 -14 -25 c0 -10 16 -22 26 -22h108c78 0 138 154 280 154c104 0 188 -87 241 -184"],11072:[565,-57,926,55,871,"776 515h-369v50h369v-50zM776 370h-369v50h369v-50zM871 220h-628c-18 0 -26 -10 -26 -20c0 -8 5 -19 14 -28c30 -31 59 -63 82 -96l-20 -19c-66 76 -142 150 -238 191v10c96 40 172 116 237 191l20 -19c-22 -33 -53 -69 -82 -97c-10 -10 -14 -16 -14 -25 c0 -10 16 -22 26 -22h629v-66"],11073:[508,-57,926,55,871,"796 370h-20c-10 49 -43 88 -86 88c-46 0 -128 -88 -189 -88c-62 0 -110 80 -114 138h19c10 -49 40 -88 84 -88c45 0 128 88 189 88s114 -69 117 -138zM871 220h-628c-18 0 -26 -10 -26 -20c0 -8 5 -19 14 -28c30 -31 59 -63 82 -96l-20 -19c-66 76 -142 150 -238 191v10 c96 40 172 116 237 191l20 -19c-22 -33 -53 -69 -82 -97c-10 -10 -14 -16 -14 -25c0 -10 16 -22 26 -22h629v-66"],11074:[449,141,926,55,871,"871 220h-629c-10 0 -26 -12 -26 -22c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19c-65 75 -141 151 -237 191v10c96 41 172 115 238 191l20 -19c-23 -33 -52 -65 -82 -96c-9 -9 -14 -20 -14 -28c0 -10 8 -20 26 -20h628v-66zM796 -2h-19c-10 49 -40 88 -84 88 c-45 0 -128 -88 -189 -88s-114 69 -117 138h20c10 -49 43 -88 86 -88c46 0 128 88 189 88c62 0 110 -80 114 -138zM796 -141h-19c-10 49 -40 88 -84 88c-45 0 -128 -88 -189 -88s-114 69 -117 138h20c10 -49 43 -88 86 -88c46 0 128 88 189 88c62 0 110 -80 114 -138"],11075:[532,26,926,45,871,"871 258v-10c-96 -40 -172 -116 -237 -191l-20 19c22 33 53 69 82 97c10 10 14 16 14 25c0 10 -5 22 -26 22h-139l-500 -246v65l356 181h-316v66h315l-355 181v65l500 -246h138c18 0 26 10 26 20c0 8 -5 19 -14 28c-30 31 -59 63 -82 96l20 19c66 -76 142 -150 238 -191"],11076:[532,26,926,45,871,"871 258v-10c-96 -40 -162 -106 -227 -181l-20 19c22 33 43 59 72 87c10 10 14 16 14 25c0 10 -5 22 -26 22h-84c-14 -134 -118 -246 -265 -246h-290v66h286c103 0 187 85 203 180h-449v66h449c-16 94 -99 180 -202 180h-287v66h287c148 0 253 -113 268 -246h83 c18 0 26 10 26 20c0 8 -5 19 -14 28c-30 31 -49 53 -72 86l20 19c66 -76 132 -140 228 -181"],11077:[701,195,928,55,873,"873 -35h-512c35 -54 67 -108 81 -145l-24 -15c-70 137 -186 278 -363 443v13c152 136 279 273 364 440l24 -13c-15 -42 -47 -96 -81 -147h511v-66h-557c-36 -49 -69 -81 -88 -104h645v-66h-697c-13 -19 -23 -35 -23 -52c0 -20 10 -35 23 -52h697v-66h-642 c20 -25 51 -57 85 -104h557v-66"],11078:[701,195,928,55,873,"873 261v-13c-177 -165 -293 -306 -363 -443l-24 15c14 37 46 91 81 145h-512v66h557c34 47 65 79 85 104h-642v66h697c13 17 23 32 23 52c0 17 -10 33 -23 52h-697v66h645c-19 23 -52 55 -88 104h-557v66h511c-34 51 -66 105 -81 147l24 13c85 -167 212 -304 364 -440"],11079:[508,-57,926,55,871,"539 370h-20c-10 49 -43 88 -86 88c-46 0 -128 -88 -189 -88c-62 0 -110 80 -114 138h19c10 -49 40 -88 84 -88c45 0 128 88 189 88s114 -69 117 -138zM871 258v-10c-96 -41 -172 -115 -238 -191l-20 19c23 33 52 65 82 96c9 9 14 20 14 28c0 10 -8 20 -26 20h-628v66 h629c10 0 26 12 26 22c0 9 -4 15 -14 25c-29 28 -60 64 -82 97l20 19c65 -75 141 -151 237 -191"],11080:[449,141,926,55,871,"871 258v-10c-96 -40 -172 -116 -237 -191l-20 19c22 33 53 69 82 97c10 10 14 16 14 25c0 10 -16 22 -26 22h-629v66h628c18 0 26 10 26 20c0 8 -5 19 -14 28c-30 31 -59 63 -82 96l20 19c66 -76 142 -150 238 -191zM539 -2h-19c-10 49 -40 88 -84 88 c-45 0 -128 -88 -189 -88s-114 69 -117 138h20c10 -49 43 -88 86 -88c46 0 128 88 189 88c62 0 110 -80 114 -138zM539 -141h-19c-10 49 -40 88 -84 88c-45 0 -128 -88 -189 -88s-114 69 -117 138h20c10 -49 43 -88 86 -88c46 0 128 88 189 88c62 0 110 -80 114 -138"],11081:[508,-57,926,55,871,"777 508h19c-4 -58 -52 -138 -114 -138c-61 0 -143 88 -189 88c-43 0 -76 -39 -86 -88h-20c3 69 56 138 117 138s144 -88 189 -88c44 0 74 39 84 88zM871 220h-628c-18 0 -26 -10 -26 -20c0 -8 5 -19 14 -28c30 -31 59 -63 82 -96l-20 -19c-66 76 -142 150 -238 191v10 c96 40 172 116 237 191l20 -19c-22 -33 -53 -69 -82 -97c-10 -10 -14 -16 -14 -25c0 -10 16 -22 26 -22h629v-66"],11082:[449,141,926,55,871,"871 220h-629c-10 0 -26 -12 -26 -22c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19c-65 75 -141 151 -237 191v10c96 41 172 115 238 191l20 -19c-23 -33 -52 -65 -82 -96c-9 -9 -14 -20 -14 -28c0 -10 8 -20 26 -20h628v-66zM776 136h20c-3 -69 -56 -138 -117 -138 s-144 88 -189 88c-44 0 -74 -39 -84 -88h-19c4 58 52 138 114 138c61 0 143 -88 189 -88c43 0 76 39 86 88zM776 -3h20c-3 -69 -56 -138 -117 -138s-144 88 -189 88c-44 0 -74 -39 -84 -88h-19c4 58 52 138 114 138c61 0 143 -88 189 -88c43 0 76 39 86 88"],11083:[449,2,926,55,871,"871 220h-629c-10 0 -26 -12 -26 -22c0 -9 4 -15 14 -25c29 -28 60 -64 82 -97l-20 -19c-65 75 -141 151 -237 191v10c96 41 172 115 238 191l20 -19c-23 -33 -52 -65 -82 -96c-9 -9 -14 -20 -14 -28c0 -10 8 -20 26 -20h628v-66zM796 -2h-19c-10 49 -40 88 -84 88 c-45 0 -128 -88 -189 -88s-114 69 -117 138h20c10 -49 43 -88 86 -88c46 0 128 88 189 88c62 0 110 -80 114 -138"],11084:[449,2,926,55,871,"871 258v-10c-96 -40 -172 -116 -237 -191l-20 19c22 33 53 69 82 97c10 10 14 16 14 25c0 10 -16 22 -26 22h-629v66h628c18 0 26 10 26 20c0 8 -5 19 -14 28c-30 31 -59 63 -82 96l20 19c66 -76 142 -150 238 -191zM539 -2h-19c-10 49 -40 88 -84 88 c-45 0 -128 -88 -189 -88s-114 69 -117 138h20c10 -49 43 -88 86 -88c46 0 128 88 189 88c62 0 110 -80 114 -138"],11088:[619,30,794,60,734,"734 373l-205 -158l74 -245l-206 146l-206 -146l74 245l-205 158h253l84 246l84 -246h253zM658 347h-196l-65 192l-65 -192h-196l159 -122l-57 -190l159 113l159 -113l-57 190"],11089:[619,30,794,60,734,"734 373l-205 -158l74 -245l-206 146l-206 -146l74 245l-205 158h253l84 246l84 -246h253"],11090:[597,13,700,35,665,"665 365l-226 -137l107 -241l-196 179l-196 -179l107 241l-226 137l262 -30l53 262l53 -262zM550 326l-168 -20l-32 160l-32 -160l-168 20l144 -88l-66 -148l122 111l122 -111l-66 148"],11091:[712,126,865,45,840,"840 293l-303 -419l-492 160v518l492 160"],11092:[712,127,865,45,840,"840 293l-303 -420l-492 160v518l492 161zM759 293l-246 339l-402 -128v-422l402 -129"],57344:[610,25,1184,829,895,"895 -25h-66v635h66v-635"],57345:[667,-41,1184,829,1211,"1211 601h-316v-560h-66v626h382v-66"],57346:[1022,0,1192,30,1162,"1162 949h-198v-949h-73v949h-258v-949h-73v949h-259v-949h-73v949h-198v73h1132v-73"],57497:[567,183,612,25,587,"587 567l-562 -750v750h562zM456 501h-365v-487"],57511:[702,-506,376,30,346,"346 671l-115 -165h-201v54h172l100 142"],57512:[662,156,496,114,371,"371 -156h-55v737l-164 -234l-38 30l201 285h56v-818"],57513:[497,-167,647,49,619,"619 167h-54v138h-462v-138h-54v330h54v-138h462v138h54v-330"],57514:[702,-506,376,30,346,"346 506h-201l-115 165l44 31l100 -142h172v-54"],57515:[662,156,496,114,371,"371 -156h-55v240l-165 -236l-37 30l201 286l1 -1v499h55v-818"],57516:[702,-506,470,30,440,"440 547l-41 -41l-110 117l-109 -117l-150 158l41 38l109 -115l109 115"],57517:[662,156,638,35,513,"513 -156h-55v512l-184 219l-196 -233l-43 35l239 285l184 -220v220h55v-818"],57518:[662,0,423,55,345,"345 0h-55v500l-183 -500l-52 19l235 643h55v-662"],57519:[662,0,423,55,345,"345 0h-55l-235 643l52 19l183 -500v500h55v-662"],57520:[735,-531,0,100,400,"400 680h-245v-149h-55v204h300v-55"],57521:[-50,254,0,0,300,"300 -254h-300v55h245v149h55v-204"],57522:[-50,254,0,0,300,"300 -254h-300v204h55v-149h245v-55"],57559:[583,79,762,50,712,"712 252c0 -183 -148 -331 -331 -331s-331 148 -331 331s148 331 331 331s331 -148 331 -331zM575 250c0 107 -86 194 -192 194c-110 0 -196 -84 -196 -192c0 -110 85 -196 194 -196c108 0 194 86 194 194"],57571:[638,134,842,35,807,"807 603l-135 -135c50 -58 80 -134 80 -216c0 -183 -148 -331 -331 -331c-83 0 -158 30 -216 80l-135 -135l-35 35l135 135c-50 58 -80 133 -80 216c0 183 148 331 331 331c82 0 158 -30 216 -80l135 135zM686 252c0 146 -119 265 -265 265s-265 -119 -265 -265 s119 -265 265 -265s265 119 265 265"],57573:[690,189,523,72,450,"450 690l-52 -141h-57l50 141h59zM360 444l-52 -141h-57l50 141h59zM271 198l-52 -141h-57l50 141h59zM181 -48l-52 -141h-57l50 141h59"],57574:[690,189,523,72,450,"181 549h-57l-52 141h59zM271 303h-57l-52 141h59zM360 57h-57l-52 141h59zM450 -189h-57l-52 141h59"],57575:[811,127,772,35,737,"737 811l-351 -938l-351 938h702zM642 745h-512l256 -684"],57576:[532,26,1077,55,1022,"1022 220h-180v-180h-66v180h-180v66h180v180h66v-180h180v-66zM612 51v-77c-120 161 -354 230 -557 246v66c203 16 437 85 557 246v-77c-50 -86 -211 -167 -334 -202c123 -35 284 -116 334 -202"],57577:[547,41,685,48,636,"636 192h-233v-233h-122v233h-233v122h233v233h122v-233h233v-122zM598 230v46h-233v233h-46v-233h-233v-46h233v-233h46v233h233"],57578:[661,158,910,45,865,"865 220h-101l-276 -276v-102h-66v102l-275 276h-102v66h102l275 273v102h66v-102l275 -273h102v-66zM705 255l-250 240l-251 -240l251 -252"],57579:[567,58,716,45,671,"671 -12l-47 -46l-72 72h-388l-72 -72l-47 47l72 72v388l-72 72l47 46l72 -72h388l72 72l46 -47l-71 -71v-389zM534 79v351h-352v-351h352"],57581:[819,312,511,192,319,"319 756c0 -34 -25 -64 -63 -64s-64 25 -64 64c0 38 32 63 64 63s63 -26 63 -63zM319 505c0 -34 -25 -64 -63 -64s-64 25 -64 64c0 38 32 63 64 63s63 -26 63 -63zM319 254c0 -34 -25 -64 -63 -64s-64 25 -64 64c0 38 32 63 64 63s63 -26 63 -63zM319 3 c0 -34 -25 -64 -63 -64s-64 25 -64 64c0 38 32 63 64 63s63 -26 63 -63zM319 -248c0 -34 -25 -64 -63 -64s-64 25 -64 64c0 38 32 63 64 63s63 -26 63 -63"],57582:[751,156,926,85,841,"841 -156h-756v50h344v268c-61 15 -107 70 -107 136s46 121 107 136v267h-344v50h756v-50h-346v-267c61 -15 107 -70 107 -136s-46 -121 -107 -136v-268h346v-50"],57583:[547,41,686,49,637,"637 220h-156c-12 -52 -53 -94 -105 -106v-155h-66v156c-52 12 -93 53 -105 105h-156v66h157c12 51 52 91 104 103v158h66v-158c52 -12 92 -51 105 -103h156v-66"],57585:[66,0,390,48,342,"342 0h-294v66h294v-66"],57604:[409,-253,100,-64,164,"164 253h-228v156h228v-156"],57612:[384,-122,400,69,330,"330 169l-46 -47l-215 215l46 47"],57613:[384,-122,400,69,330,"330 337l-215 -215l-46 47l215 215"],57614:[405,-101,652,193,459,"459 101h-66v304h66v-304zM259 101h-66v304h66v-304"],57615:[386,-120,315,0,315,"315 320h-315v66h315v-66zM315 120h-315v66h315v-66"],57616:[432,-28,652,124,528,"528 217l-47 -47l-215 215l47 47zM386 75l-47 -47l-215 215l47 47"],57617:[432,-28,652,124,528,"386 385l-215 -215l-47 47l215 215zM528 243l-215 -215l-47 47l215 215"],57622:[214,-107,511,223,289,"289 107h-66v107h66v-107"],57623:[286,-220,229,61,168,"168 220h-107v66h107v-66"],57624:[271,-134,277,70,207,"207 180l-47 -46l-90 90l47 47"],57625:[271,-134,277,70,207,"207 224l-90 -90l-47 46l90 91"],57999:[135,0,325,-1,326,"326 0h-327v135h327v-135"],58000:[135,0,633,-1,634,"634 0h-635v135h635v-135"],58001:[955,-820,325,-1,326,"326 820h-327v135h327v-135"],58311:[662,156,902,0,863,"863 662l-128 -133h-77l128 133h77zM645 435l-128 -133h-77l128 133h77zM429 209l-128 -133h-77l128 133h77zM205 -23l-128 -133h-77l128 133h77"],58312:[662,156,902,0,863,"205 529h-77l-128 133h77zM423 302h-77l-128 133h77zM639 76h-77l-128 133h77zM863 -156h-77l-128 133h77"]};MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Shapes/Regular/Main.js");
import subprocess import sys import setup_util def start(args, logfile, errfile): setup_util.replace_text("wicket/src/main/webapp/WEB-INF/resin-web.xml", "mysql:\/\/.*:3306", "mysql://" + args.database_host + ":3306") try: subprocess.check_call("mvn clean compile war:war", shell=True, cwd="wicket", stderr=errfile, stdout=logfile) subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True, stderr=errfile, stdout=logfile) subprocess.check_call("cp wicket/target/hellowicket-1.0-SNAPSHOT.war $RESIN_HOME/webapps/wicket.war", shell=True, stderr=errfile, stdout=logfile) subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True, stderr=errfile, stdout=logfile) return 0 except subprocess.CalledProcessError: return 1 def stop(logfile, errfile): try: subprocess.check_call("$RESIN_HOME/bin/resinctl shutdown", shell=True, stderr=errfile, stdout=logfile) return 0 except subprocess.CalledProcessError: return 1
# Copyright 2011 Denali Systems, Inc. # All Rights Reserved. # # 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. """ Monitors interface (1.1 extension). """ import urllib from vsmclient import base class Monitor(base.Resource): def __repr__(self): try: return "<MON: %s>" % self.id except AttributeError: return "<MON: Summary>" def delete(self): """Delete this mon.""" self.manager.delete(self) def update(self, **kwargs): """Update the display_name or display_description for this mds.""" self.manager.update(self, **kwargs) class MonitorsManager(base.ManagerWithFind): """ Manage :class:`Monitor` resources. """ resource_class = Monitor def get(self, mon_id): """ Get a mon. :param mon_id: The ID of the monitor. :rtype: :class:`Monitor` """ return self._get("/monitors/%s" % mon_id, "monitor") def list(self, detailed=False, search_opts=None): """ Get a list of all mons. :rtype: list of :class:`Monitor` """ if search_opts is None: search_opts = {} qparams = {} for opt, val in search_opts.iteritems(): if val: qparams[opt] = val query_string = "?%s" % urllib.urlencode(qparams) if qparams else "" detail = "" if detailed: detail = "/detail" ret = self._list("/monitors%s%s" % (detail, query_string), "monitors") return ret def delete(self, mon): self._delete("/monitors/%s" % base.getid(mon)) def summary(self): """ summary """ url = "/monitors/summary" return self._get(url, 'monitor-summary')
import { h } from 'vue' export default { name: "CircleSlice2", vendor: "Mdi", type: "", tags: ["circle","slice","2"], render() { return h( "svg", {"xmlns":"http://www.w3.org/2000/svg","width":"24","height":"24","viewBox":"0 0 24 24","class":"v-icon","fill":"currentColor","data-name":"mdi-circle-slice-2","innerHTML":"<path d='M12 2C17.5 2 22 6.5 22 12C22 17.5 17.5 22 12 22C6.5 22 2 17.5 2 12C2 6.5 6.5 2 12 2M12 4C7.58 4 4 7.58 4 12C4 16.42 7.58 20 12 20C16.42 20 20 16.42 20 12C20 7.58 16.42 4 12 4M12 5C15.87 5 19 8.13 19 12H12V5Z' />"}, ) } }
'use strict'; // NOTE: any test that hits the pathfinder CTE should be considered for serialising. This is // because the rate limits on this environment are quite low, therefore parallel tests might cause // failures due to these rate limits, which could be misleading. At the time of writing, all are. // TODO: // - test module crashes fatally upon failed reconnect const test = require('ava'); const Config = require('../config'); const _conf = new Config(); const Pathfinder = require('../'); const mockSocket = require('./_mocksocket'); const Chance = require('chance'); const dnsPacket = require('dns-packet'); const nullLogger = () => {}; // Set l = consoleLogger to log output const l = nullLogger; const opts = { logger: { warn: l, info: l, debug: l, error: l } }; // eslint-disable-line no-console // const opts = { logger: console.log.bind(console) }; // eslint-disable-line no-console // TODO: considering the following note, tests using known good responses, and known bad responses // should probably be updated. Perhaps just to perform a more nuanced check on the result of the // pathfinder query. For example, checking that when the aa (authoritative answer) flag is set in // the response, we get an mcc and mnc in the response. // Note: at the time of writing these tests Neustar support was contacted for known good queries, // and known bad queries. Their response contained a set of numbers identified as known good, and a // set identified as known bad. When tested, numbers from the 'known good' set turned out to be bad, // and vice versa. I decided to ignore this and assume that the data changed frequently enough that // it couldn't be relied on. const knownGoodResponses = { // Authors phone numbers, and Orange, MTN test numbers '22507008181': dnsPacket.streamDecode(Buffer.from('00c760b784000001000100020001013101380131013801300130013701300135013201320865313634656e756d036e65740000230001c00c00230001000003840048000a003201750c4532552b7073746e3a74656c33215e282e2a29242174656c3a5c313b73706e3d32333538303b6d63633d3631323b6d6e633d30333b715f737461743d3130392100c0180002000100000384000e036e7332036e6574046770727300c0180002000100000384000e036e7331036e65740467707273000000291400000000000000', 'hex')), '22504004762': dnsPacket.streamDecode(Buffer.from('00c722a984000001000100020001013201360137013401300130013401300135013201320865313634656e756d036e65740000230001c00c00230001000003840048000a003201750c4532552b7073746e3a74656c33215e282e2a29242174656c3a5c313b73706e3d33373839353b6d63633d3631323b6d6e633d30353b715f737461743d3130392100c0180002000100000384000e036e7332036e6574046770727300c0180002000100000384000e036e7331036e65740467707273000000291400000000000000', 'hex')), '447455888660': dnsPacket.streamDecode(Buffer.from('00c9eeba840000010001000200010130013601360138013801380135013501340137013401340865313634656e756d036e65740000230001c00c00230001000003840048000a003201750c4532552b7073746e3a74656c33215e282e2a29242174656c3a5c313b73706e3d31353838383b6d63633d3233343b6d6e633d32303b715f737461743d3131322100c0160002000100000384000e036e7332036e6574046770727300c0160002000100000384000e036e7331036e65740467707273000000291400000000000000', 'hex')), '447710066017': dnsPacket.streamDecode(Buffer.from('00c97a61840000010001000200010137013101300136013601300130013101370137013401340865313634656e756d036e65740000230001c00c00230001000003840048000a003201750c4532552b7073746e3a74656c33215e282e2a29242174656c3a5c313b73706e3d34383334383b6d63633d3233343b6d6e633d30323b715f737461743d3131322100c0160002000100000384000e036e7332036e6574046770727300c0160002000100000384000e036e7331036e65740467707273000000291400000000000000', 'hex')), // Numbers from Neustar '14044560000': dnsPacket.streamDecode(Buffer.from('007a477a80000001000100000001013001310130013101340130013401380137013501310865313634656e756d036e65740000230001c00c0023000100000384002f000a003201750c4532552b7073746e3a74656c1a215e282e2a29242174656c3a5c313b715f737461743d31303321000000291400000000000000')), '14042186358': dnsPacket.streamDecode(Buffer.from('00dee48984000001000100010001013001300130013001360135013401340130013401310865313634656e756d036e65740000230001c00c0023000100000384004e000a003201750c4532552b7073746e3a74656c39215e282e2a29242174656c3a5c313b6e7064693b73706e3d32363536393b6d63633d3331303b6d6e633d3031323b715f737461743d3030322100c00c00060001000003840039036e7331036e65740467707273000561646d696e036e7331076e6575737461720362697a00776496600001518000001c200036ee800002a3000000291400000000000000')), '17062060133': dnsPacket.streamDecode(Buffer.from('00cd0e8a84000001000100020001013901350132013601380131013201340130013401310865313634656e756d036e65740000230001c00c0023000100000384004e000a003201750c4532552b7073746e3a74656c39215e282e2a29242174656c3a5c313b6e7064693b73706e3d32323039323b6d63633d3331303b6d6e633d3135303b715f737461743d3030312100c0140002000100000384000e036e7332036e6574046770727300c0140002000100000384000e036e7331036e65740467707273000000291400000000000000')), '14042186259': dnsPacket.streamDecode(Buffer.from('00dc03e684000001000100010001013101370137013401350136013701330137013701310865313634656e756d036e65740000230001c00c0023000100000384004c000a003201750c4532552b7073746e3a74656c37215e282e2a29242174656c3a5c313b6e7064693b73706e3d34333235363b616c745f73706e3d36363534393b715f737461743d3030312100c00c00060001000003840039036e7331036e65740467707273000561646d696e036e7331076e6575737461720362697a00776496600001518000001c200036ee800002a3000000291400000000000000')), '14042728246': dnsPacket.streamDecode(Buffer.from('00cecf1884000001000100010001013001350137013501340133013401310137013501310865313634656e756d036e65740000230001c00c0023000100000384003e000a003201750c4532552b7073746e3a74656c29215e282e2a29242174656c3a5c313b6e7064693b73706e3d35313538393b715f737461743d3030322100c00c00060001000003840039036e7331036e65740467707273000561646d696e036e7331076e6575737461720362697a00776496600001518000001c200036ee800002a3000000291400000000000000')), '16786628313': dnsPacket.streamDecode(Buffer.from('00deb3bf84000001000100010001013301310133013801320136013601380137013601310865313634656e756d036e65740000230001c00c0023000100000384004e000a003201750c4532552b7073746e3a74656c39215e282e2a29242174656c3a5c313b6e7064693b73706e3d34303635343b6d63633d3331303b6d6e633d3136303b715f737461743d3030322100c00c00060001000003840039036e7331036e65740467707273000561646d696e036e7331076e6575737461720362697a00776496600001518000001c200036ee800002a3000000291400000000000000')), '552177824301': dnsPacket.streamDecode(Buffer.from('00ce171584000001000100010001013101320133013201370133013501300137013701310865313634656e756d036e65740000230001c00c0023000100000384003e000a003201750c4532552b7073746e3a74656c29215e282e2a29242174656c3a5c313b6e7064693b73706e3d35363930313b715f737461743d3030322100c00c00060001000003840039036e7331036e65740467707273000561646d696e036e7331076e6575737461720362697a00776496600001518000001c200036ee800002a3000000291400000000000000')), '12012048415': dnsPacket.streamDecode(Buffer.from('00c8f58684000001000100020001013501310134013801340130013201310130013201310865313634656e756d036e65740000230001c00c00230001000003840049000a003201750c4532552b7073746e3a74656c34215e282e2a29242174656c3a5c313b73706e3d34303635343b6d63633d3331303b6d6e633d3136303b715f737461743d3131332100c0120002000100000384000e036e7332036e6574046770727300c0120002000100000384000e036e7331036e65740467707273000000291400000000000000')), '12012046732': dnsPacket.streamDecode(Buffer.from('00c8e85984000001000100020001013201330137013601340130013201310130013201310865313634656e756d036e65740000230001c00c00230001000003840049000a003201750c4532552b7073746e3a74656c34215e282e2a29242174656c3a5c313b73706e3d34373930353b6d63633d3331303b6d6e633d3132303b715f737461743d3131332100c0120002000100000384000e036e7332036e6574046770727300c0120002000100000384000e036e7331036e65740467707273000000291400000000000000')), '19414685653': dnsPacket.streamDecode(Buffer.from('00cd1a0784000001000100020001013301350136013501380136013401310134013901310865313634656e756d036e65740000230001c00c0023000100000384004e000a003201750c4532552b7073746e3a74656c39215e282e2a29242174656c3a5c313b6e7064693b73706e3d32363536393b6d63633d3331303b6d6e633d3031323b715f737461743d3030312100c0140002000100000384000e036e7332036e6574046770727300c0140002000100000384000e036e7331036e65740467707273000000291400000000000000')) }; const knownGoodNumbers = Object.keys(knownGoodResponses); function getResponseFromWriteBuf(buf) { const request = dnsPacket.streamDecode(buf); const requestNum = request.questions[0].name.split('.').reverse().slice(2).join(''); return dnsPacket.streamEncode({ ...knownGoodResponses[requestNum], id: request.id }); } async function setup({ connectFunc = undefined, conf = new Config() } = {}) { conf.tls.rejectUnauthorized = _conf.env === 'live'; const pf = new Pathfinder(conf, opts); await pf.connect(connectFunc); return pf; } test.serial('Test positive pathfinder sandbox query functional', async function(t) { // given const pf = await setup(); // when const results = await Promise.all(knownGoodNumbers.map(el => pf.query(el))); // then results.forEach(r => { t.not(r.mnc, undefined, 'result contains mobile network code field'); t.not(r.mcc, undefined, 'result contains mobile country code field'); }); }); test.serial('Test negative pathfinder sandbox query functional', async function(t) { // given const knownBadNumbers = [ '355456567567', '50945454545', '1650555010', '35555687678', '13055552444', '15784042020', '18744100215', '15784041010', '12482821111', '12162744004', '12162744003', '15714345750', '17737654771', '14795538218', '16788271794', '17705742609', '17705372321', '12177824301' ]; const pf = await setup(); // when const results = await Promise.all(knownBadNumbers.map(n => pf.query(n))); // then results.forEach(r => { // TODO: we could possibly also check whether the result contains the AA (authoritative // answer) field. t.is(r.mnc, undefined, 'result does not contain mobile network code field'); t.is(r.mcc, undefined, 'result does not contain mobile country code field'); }); t.pass(); }); test('Test pathfinder socket error during operation causes reconnect attempt', async function(t) { // given const { socket, connectFunc } = mockSocket.createSocket(opts); const pf = await setup({ connectFunc }); pf.query(knownGoodNumbers[0]); t.is(socket.destroyCallCount, 0, 'Expect socket to not have been destroyed before error occurs'); // when socket.emit('error', new Error('Test error')); // then t.true(socket.destroyCallCount > 0, 'Expect socket to have been destroyed on pathfinder timeout'); }); test('Test pathfinder timeout causes reconnect attempt', async function(t) { // given // Here we simulate timeout by having our mock socket never emit a 'data' event const { socket, connectFunc } = mockSocket.createSocket(opts); t.is(socket.destroyCallCount, 0, 'Expect socket to not have been destroyed before test runs'); const conf = new Config(); conf.tls.rejectUnauthorized = _conf.env === 'live'; conf.pathfinderTimeoutMs = 1; // Make this quite a bit bigger than pathfinder timeout, otherwise it might get called before // the pathfinder timeout is hit. This does raise the question: // TODO: test that all timeouts are cleared when any timeout occurs. // I.e., if the query timeout is called, it should clear the pathfinder timeout, and vice versa conf.queryTimeoutMs = 10000; const pf = new Pathfinder(conf, opts); await pf.connect(connectFunc); // when try { await pf.query(knownGoodNumbers[0]); } catch(err) { // ignore } // then t.true(socket.destroyCallCount > 0, 'Expect socket to have been destroyed on pathfinder timeout'); }); // pass test('Test queries are not rejected before the queue limit is reached', async function(t) { // given const { connectFunc } = mockSocket.createSocket({ ...opts, writeCb: (sock, buf) => sock.emit('data', getResponseFromWriteBuf(buf)) }); const conf = new Config(); // TODO: Parametrise some of this stuff with jsverify // TODO: maxQueueLength is limited to 5 numbers because this test was not consistently running // to completion when run in parallel with the other tests. Another way to make it successfully // run to completion was to make it serial. However, the root cause of this failure was never // analysed. Changing the following line to: `const maxQueueLength = knownGoodNumbers.length` // and running all the tests should reproduce the problem. const maxQueueLength = Math.min(5, knownGoodNumbers.length); const numQueries = maxQueueLength; const numbers = knownGoodNumbers.slice(0, numQueries); conf.maxQueriesPerSecond = 4; conf.queryTimeoutMs = Math.round(1000 / conf.maxQueriesPerSecond) * maxQueueLength; const pf = await setup({ conf, connectFunc }); // when const resultsP = Promise.all(numbers.map(el => pf.query(el))); //then await t.notThrowsAsync(resultsP, 'No error occurs'); }); //pass test('Test queries are rejected when the queue is full', async function(t) { // given const { socket, connectFunc } = mockSocket.createSocket(opts); socket.write = buf => socket.emit('data', getResponseFromWriteBuf(buf)); const conf = new Config(); // TODO: Parametrise some of this stuff with jsverify const maxQueueLength = knownGoodNumbers.length - 1; const numQueries = maxQueueLength; const numbers = knownGoodNumbers.slice(0, numQueries + 1); conf.maxQueriesPerSecond = 4; conf.queryTimeoutMs = Math.round(1000 / conf.maxQueriesPerSecond) * maxQueueLength; const pf = await setup({ conf, connectFunc }); // when const resultsP = Promise.all(numbers.map(el => pf.query(el))); // then const errMsg = `${maxQueueLength} messages queued. ` + `Handling ${conf.maxQueriesPerSecond} per second. ` + `Minimum queue processing duration ${conf.queryTimeoutMs}ms. ` + `Message timeout ${conf.queryTimeoutMs}ms. ` + 'Service at capacity, message could not succeed.'; await t.throwsAsync(resultsP, errMsg); }); // Note that this test is run serially to prevent timeouts induced by other tests const _test = new Config().env === 'live' ? test.skip : test; _test('Test the module can sustain the minimum query rate', async function(t) { // given // We're expecting 14 transactions per second, so we'll test for 30 pathfinder queries per // second, for now. const chance = new Chance(); let conf = new Config(); conf.maxQueriesPerSecond = 30; conf.queryTimeoutMs = 2000; const pf = await setup({ conf }); const opts = { mobile: true, formatted: false }; const prefix = { fr: '33', uk: '44', za: '27' }; // when const numbers = ['fr','uk','za'] .reduce((arr, c) => arr.concat(Array(5).fill(c)), []) .map(c => ({ prefix: prefix[c], num: chance.phone({ country: c, ...opts }).replace(/^0/, '') })); // then await t.notThrowsAsync(Promise.all(numbers.map(n => pf.query(n.prefix + n.num)))); }); test.serial('Test a set of random numbers, test returned country code is correct', async function(t) { // given const chance = new Chance(); const pf = await setup(); // Chance documentation is not caught up with chance source code. At the time of writing chance // phone supports mobile for 'uk', 'za', 'fr'. In GH master, 'br' is also supported, but this // doesn't appear to have been published to npm. const mccMap = { '33': '208', '44': '234', '27': '655'}; const opts = { mobile: true, formatted: false }; const prefix = { fr: '33', uk: '44', za: '27' }; const numbers = ['fr','uk','za'] .reduce((arr, c) => arr.concat(Array(20).fill(c)), []) .map(c => ({ prefix: prefix[c], num: chance.phone({ country: c, ...opts }).replace(/^0/, '') })); // when const results = await Promise.all(numbers.map(n => pf.query(n.prefix + n.num))); // then results.forEach((r, i) => { t.not(r, undefined, `Expect result received for ${numbers[i]}`); if (r.mcc) { const mcc = mccMap[numbers[i].prefix]; t.is(r.mcc, mcc, `Expect ${numbers[i]} to have mobile country code ${mcc}`); } }); });
/* Created by Andrew DeChristopher <drew@kiir.us> on 8/30/2016. */ // core libraries const io = require('socket.io').listen(27000); const ss = require('socket.io-stream'); const fs = require('fs'); const path = require('path'); const mime = require('mime'); const c = require('chalk'); // demo webservice libraries const express = require('express'); const app = express(); const server = require('http').Server(app); // custom libraries const log = require('../modules/log'); const sms = require('../modules/sms'); const cfg = require('../modules/cfg'); // Define ERRORS and other constants const KIWI = '[' + c.green('KIWI') + '] '; const DEMO = '[' + c.green('DEMO') + '] '; const DOWN = '[' + c.cyan('DOWN') + '] '; const NJ1 = '[' + c.magenta('NJ1') + '] '; const NJ2 = '[' + c.magenta('NJ2') + '] '; // Log startup log(KIWI + 'Demo Transit Server', '-demo-server'); // Demo upload socket handling and transit logistics io.sockets.on('connection', function (socket) { log(KIWI + 'Client connected', '-demo-server'); // For uploads from US-NJ1 ss(socket).on('us-nj1', function (stream, data) { let filename = path.basename(data.name).split('\\'); filename = filename[filename.length - 1]; let filesize = data.size; log(DEMO + NJ1 + 'Uploading: ' + filename + ' ~' + filesize + ' B', '-demo-server'); stream.pipe(fs.createWriteStream(cfg.demoDir + filename)); }); // For uploads from US-NJ2 ss(socket).on('us-nj2', function (stream, data) { let filename = path.basename(data.name).split('\\'); filename = filename[filename.length - 1]; log(DEMO + NJ2 + 'Uploading: ' + filename + ' ~' + filesize + ' B', '-demo-server'); stream.pipe(fs.createWriteStream(cfg.demoDir + filename)); }); }); // Log express server start server.listen(80, function () { log(KIWI + 'Demo download μSrvc started.', '-demo-server'); }); // Send no demo ID given and then go back app.get('/', function (req, res, next) { try { res.send('No demo ID provided. Returning to previous page.<script>setTimeout(function(){ window.history.back(); }, 3000);</script>'); // Disable logging for UptimeRobot requests to '/' if (res.ip != '::ffff:63.143.42.242') { log(DOWN + '[' + req.ip + '] GET /', '-demo-server'); } } catch (e) { next(e); } }); // Request for demo ID (ex. http://demo.kiir.us/15 OR http://demo.kiir.us/582) app.get('/:id', function (req, res, next) { try { let id = req.params.id; fs.exists(path.join(cfg.demoDir, 'kiwi-' + id + '.dem'), function (exists) { if (exists) { // res.download(path.join(cfg.demoDir, 'kiwi-' + id + '.dem')); log(DOWN + 'Found demo @ ' + path.join(cfg.demoDir, 'kiwi-' + id + '.dem'), '-demo-server'); let file = path.join(cfg.demoDir, 'kiwi-' + id + '.dem'); let filename = path.basename(file); let mimetype = mime.lookup(filename); let filestream = fs.createReadStream(file); res.setHeader('Content-disposition', 'attachment; filename=' + filename); res.setHeader('Content-type', mimetype); filestream.pipe(res); } else { log(DOWN + 'Invalid demo ID given: ' + id, '-demo-server'); res.send('Invalid demo ID. Returning to previous page.<script>setTimeout(function(){ window.history.back(); }, 3000);</script>'); } }); log(DOWN + '[' + req.ip + '] GET /' + id + ' ~ kiwi-' + id + '.dem', '-demo-server'); } catch (e) { next(e); } });
""" Example demonstrating Proof Verification. First Issuer creates Claim Definition for existing Schema. After that, it issues a Claim to Prover (as in issue_credential.py example) Once Prover has successfully stored its Claim, it uses Proof Request that he received, to get Claims which satisfy the Proof Request from his wallet. Prover uses the output to create Proof, using its Master Secret. After that, Proof is verified against the Proof Request """ import asyncio import json import pprint import sys import time from src.utils import run_coroutine, get_pool_genesis_txn_path, PROTOCOL_VERSION from indy import pool, ledger, wallet, did, anoncreds, crypto from indy.error import IndyError seq_no = 1 pool_name = 'pool' wallet_credentials = json.dumps({"key": "wallet_key"}) steward_wallet_config = json.dumps({"id": "steward_wallet"}) trust_anchor_wallet_config = json.dumps({"id": "issuer_wallet"}) pool_genesis_txn_path = get_pool_genesis_txn_path(pool_name) pool_config = json.dumps({"genesis_txn": str(pool_genesis_txn_path)}) def print_log(value_color="", value_noncolor=""): """set the colors for text.""" HEADER = '\033[92m' ENDC = '\033[0m' print(HEADER + value_color + ENDC + str(value_noncolor)) async def proof_negotiation(): try: # Set protocol version 2 to work with Indy Node 1.4 await pool.set_protocol_version(PROTOCOL_VERSION) # 1. print_log('\n1. Creates a new local pool ledger configuration that is used ' 'later when connecting to ledger.\n') await pool.create_pool_ledger_config(pool_name, pool_config) # 2. print_log('\n2. Open pool ledger and get handle from libindy\n') pool_handle = await pool.open_pool_ledger(pool_name, None) # 3. print_log('\n3. Creating new issuer, steward, and prover secure wallet\n') await wallet.create_wallet(trust_anchor_wallet_config, wallet_credentials) await wallet.create_wallet(steward_wallet_config, wallet_credentials) # 4. print_log('\n4. Open wallet and get handle from libindy\n') trust_anchor_wallet_handle = await wallet.open_wallet(trust_anchor_wallet_config, wallet_credentials) steward_wallet_handle = await wallet.open_wallet(steward_wallet_config, wallet_credentials) # 5. print_log('\n5. Generating and storing steward DID and verkey\n') steward_seed = '000000000000000000000000Steward1' did_json = json.dumps({'seed': steward_seed}) steward_did, steward_verkey = await did.create_and_store_my_did(steward_wallet_handle, did_json) print_log('Steward DID: ', steward_did) print_log('Steward Verkey: ', steward_verkey) # 6. print_log( '\n6. Generating and storing trust anchor (also issuer) DID and verkey\n') trust_anchor_did, trust_anchor_verkey = await did.create_and_store_my_did(trust_anchor_wallet_handle, "{}") print_log('Trust anchor DID: ', trust_anchor_did) print_log('Trust anchor Verkey: ', trust_anchor_verkey) # 7. print_log('\n7. Building NYM request to add Trust Anchor to the ledger\n') nym_transaction_request = await ledger.build_nym_request(submitter_did=steward_did, target_did=trust_anchor_did, ver_key=trust_anchor_verkey, alias=None, role='TRUST_ANCHOR') print_log('NYM transaction request: ') pprint.pprint(json.loads(nym_transaction_request)) # 8. print_log('\n8. Sending NYM request to the ledger\n') nym_transaction_response = await ledger.sign_and_submit_request(pool_handle=pool_handle, wallet_handle=steward_wallet_handle, submitter_did=steward_did, request_json=nym_transaction_request) print_log('NYM transaction response: ') pprint.pprint(json.loads(nym_transaction_response)) (gvt_schema_id, gvt_schema) = await anoncreds.issuer_create_schema(trust_anchor_did, 'gvt', '1.0', json.dumps(['age', 'sex', 'height', 'name'])) schema_request = await ledger.build_schema_request(trust_anchor_did, gvt_schema) await ledger.sign_and_submit_request(pool_handle, trust_anchor_wallet_handle, trust_anchor_did, schema_request) print_log('Create Schema and submiting to ledger') pprint.pprint(json.loads(schema_request)) time.sleep(1) get_schema_request = await ledger.build_get_schema_request(trust_anchor_did, gvt_schema_id) get_schema_response = await ledger.submit_request(pool_handle, get_schema_request) (schema_id, gvt_schema_json) = await ledger.parse_get_schema_response(get_schema_response) # 11. print_log( '\n11. Creating and storing CRED DEFINITION using anoncreds as Trust Anchor, for the given Schema\n') cred_def_tag = 'cred_def_tag' cred_def_type = 'CL' cred_def_config = json.dumps({"support_revocation": False}) (cred_def_id, cred_def_json) = await anoncreds.issuer_create_and_store_credential_def(trust_anchor_wallet_handle, trust_anchor_did, gvt_schema_json, cred_def_tag, cred_def_type, cred_def_config) cred_def_request = await ledger.build_cred_def_request(trust_anchor_did, cred_def_json) await ledger.sign_and_submit_request(pool_handle, trust_anchor_wallet_handle, trust_anchor_did, cred_def_request) print_log('Credential definition: ') pprint.pprint(json.loads(cred_def_json)) # 12. print_log('\n12. Creating Prover wallet and opening it to get the handle\n') prover_did = 'VsKV7grR1BUE29mG2Fm2kX' prover_wallet_config = json.dumps({"id": "prover_wallet"}) prover_wallet_credentials = json.dumps({"key": "prover_wallet_key"}) await wallet.create_wallet(prover_wallet_config, prover_wallet_credentials) prover_wallet_handle = await wallet.open_wallet(prover_wallet_config, prover_wallet_credentials) # 13. print_log('\n13. Prover is creating Master Secret\n') master_secret_name = 'master_secret' master_secret_id = await anoncreds.prover_create_master_secret(prover_wallet_handle, master_secret_name) # 14. print_log( '\n14. Issuer (Trust Anchor) is creating a Credential Offer for Prover\n') schema_json = json.dumps(gvt_schema) cred_offer_json = await anoncreds.issuer_create_credential_offer(trust_anchor_wallet_handle, cred_def_id) print_log('Credential Offer: ') pprint.pprint(json.loads(cred_offer_json)) # 15. print_log( '\n15. Prover creates Credential Request for the given credential offer\n') (cred_req_json, cred_req_metadata_json) = await anoncreds.prover_create_credential_req(prover_wallet_handle, prover_did, cred_offer_json, cred_def_json, master_secret_id) print_log('Credential Request: ') pprint.pprint(json.loads(cred_req_json)) # 16. print_log( '\n16. Issuer (Trust Anchor) creates Credential for Credential Request\n') cred_values_json = json.dumps({ 'sex': ['male', '5944657099558967239210949258394887428692050081607692519917050011144233115103'], 'name': ['Alex', '1139481716457488690172217916278103335'], 'height': ['175', '175'], 'age': ['28', '28'] }) (cred_json, _, _) = await anoncreds.issuer_create_credential(trust_anchor_wallet_handle, cred_offer_json, cred_req_json, cred_values_json, None, None) print_log('Credential: ') pprint.pprint(json.loads(cred_json)) # 17. print_log('\n17. Prover processes and stores Credential\n') await anoncreds.prover_store_credential(prover_wallet_handle, None, cred_req_metadata_json, cred_json, cred_def_json, None) # 18. print_log('\n18. Prover gets Claims for Proof Request\n') proof_request = { 'nonce': '123432421212', 'name': 'gvt', 'version': '0.1', 'requested_attributes': { 'attr1_referent': { 'name': 'name' } }, 'requested_predicates': { 'predicate1_referent': { 'name': 'age', 'p_type': '>=', 'p_value': 18, } } } #'restrictions': [{'issuer_did': trust_anchor_did}] print_log('Proof Request: ') pprint.pprint(proof_request) proof_req_json = json.dumps(proof_request) claims_for_proof_request_json = await anoncreds.prover_get_credentials_for_proof_req(prover_wallet_handle, \ proof_req_json) claims_for_proof_request = json.loads(claims_for_proof_request_json) print_log('Claims for Proof Request: ') pprint.pprint(claims_for_proof_request) # 19. print_log('\n19. Prover creates Proof for Proof Request\n') referent = claims_for_proof_request['attrs']['attr1_referent'][0]['cred_info']['referent'] print_log('Referent: ') pprint.pprint(referent) requested_credentials_json = json.dumps({ 'self_attested_attributes': {}, 'requested_attributes': { 'attr1_referent': {'cred_id': referent, 'revealed': True} }, 'requested_predicates': { 'predicate1_referent': {'cred_id': referent} } }) pprint.pprint(json.loads(requested_credentials_json)) schemas_json = {} get_schema_request = await ledger.build_get_schema_request(prover_did, schema_id) get_schema_response = await ledger.submit_request(pool_handle, get_schema_request) (received_schema_id, received_schema) = await ledger.parse_get_schema_response(get_schema_response) schemas_json[received_schema_id] = json.loads(received_schema) cred_defs_json = {} get_cred_def_request = await ledger.build_get_cred_def_request(prover_did, cred_def_id) get_cred_def_response = await ledger.submit_request(pool_handle, get_cred_def_request) (received_cred_def_id, received_cred_def) = await ledger.parse_get_cred_def_response(get_cred_def_response) cred_defs_json[received_cred_def_id] = json.loads(received_cred_def) revoc_regs_json = json.dumps({}) proof_json = await anoncreds.prover_create_proof(prover_wallet_handle, proof_req_json, requested_credentials_json, master_secret_id, json.dumps(schemas_json), json.dumps(cred_defs_json), revoc_regs_json) proof = json.loads(proof_json) #assert 'Alex' == proof['requested_proof']['revealed_attrs']['attr1_referent'][1] # 20. print_log('\n20.Verifier is verifying proof from Prover\n') assert await anoncreds.verifier_verify_proof(proof_req_json, proof_json, json.dumps(schemas_json), json.dumps(cred_defs_json), revoc_regs_json, "{}") # 21 print_log('\n21. Closing both wallet_handles\n') await wallet.close_wallet(steward_wallet_handle) await wallet.close_wallet(trust_anchor_wallet_handle) await wallet.close_wallet(prover_wallet_handle) # 22 print_log('\n22. Deleting created wallet_handles\n') await wallet.delete_wallet(steward_wallet_config, wallet_credentials) await wallet.delete_wallet(trust_anchor_wallet_config, wallet_credentials) await wallet.delete_wallet(prover_wallet_config, prover_wallet_credentials) except IndyError as e: print('Error occurred: %s' % e) def main(): loop = asyncio.get_event_loop() loop.run_until_complete(proof_negotiation()) loop.close() if __name__ == '__main__': main()
import chai from 'chai'; chai.should(); import merge from '../src/merge'; describe('merge', () => { it('two empty objects', () => { merge({}, {}).should.deep.equal({}); }); it('empty and plain objects', () => { const o = { id: 25994, name: 'Terra', visible: true }; const expected = o; merge({}, o).should.deep.equal(expected); merge(o, {}).should.deep.equal(expected); }); it('two plain objects', () => { merge({ id: 25994, name: 'Terra' }, { visible: true }).should.deep.equal({ id: 25994, name: 'Terra', visible: true }); }); it('two plain objects with dates', () => { const date = new Date('2016-10-01T15:00:00Z'); merge( { id: 25994, name: 'Terra' }, { visible: true, date: date } ).should.deep.equal({ id: 25994, name: 'Terra', visible: true, date: date }); }); it('two intersected plain objects', () => { merge({ id: 25994, name: 'Terra', visible: true }, { id: 27424, name: 'Aqua', group: 'Remote sensing' }).should.deep.equal({ id: 27424, name: 'Aqua', visible: true, group: 'Remote sensing' }); }); it('plain object and object with plain nested object', () => { merge({ language: 'ru', sidebarPanelId: 'satellite' }, { map: { name: 'Map', visible: true } }).should.deep.equal({ language: 'ru', sidebarPanelId: 'satellite', map: { name: 'Map', visible: true } }); }); it('intersected plain object and object with plain nested object', () => { merge({ language: 'ru', sidebarPanelId: 'satellite' }, { language: { en: 'English', ru: 'Russian' } }).should.deep.equal({ language: { en: 'English', ru: 'Russian' }, sidebarPanelId: 'satellite' }) }); it('two objects with nested intersected plain objects', () => { const o1 = { language: { en: 'English', ru: 'Русский' }, sidebarPanelId: 'satellite' }; const o2 = { language: { ru: 'Russian', de: 'German' }, sidebarPanelId: 'geocoding' }; merge(o1, o2).should.deep.equal({ language: { en: 'English', ru: 'Russian', de: 'German' }, sidebarPanelId: 'geocoding' }); merge(o2, o1).should.deep.equal({ language: { en: 'English', ru: 'Русский', de: 'German' }, sidebarPanelId: 'satellite' }); }); it('two empty arrays', () => { merge([], []).should.deep.equal([]); }); it('empty array and plain array', () => { const a = [1, 2, 3]; const expected = a; merge([], a).should.deep.equal(expected); merge(a, []).should.deep.equal(expected); }); it('two plain arrays', () => { merge([1, 2, 3], ['one', 'two', 'three']).should.deep.equal([1, 2, 3, 'one', 'two', 'three']); }); it('two mixed arrays', () => { merge( [1, 2, 3, { id: 25994, name: 'Terra', visible: true }], [{ id: 25994, visible: false }, 'one', 'two', 'three'], 'id' ).should.deep.equal([1, 2, 3, { id: 25994, name: 'Terra', visible: false }, 'one', 'two', 'three']); }); it('two arrays of objects with intersected identifiers', () => { const a1 = [ { id: 25994, name: 'Terra', visible: true }, { id: 27424, name: 'Aqua', visible: false } ]; const a2 = [ { id: 27424, name: 'AQUA' }, { id: 25994, visible: false } ]; merge(a1, a2, 'id').should.deep.equal([ { id: 25994, name: 'Terra', visible: false }, { id: 27424, name: 'AQUA', visible: false } ]); merge(a2, a1, 'id').should.deep.equal([ { id: 27424, name: 'Aqua', visible: false }, { id: 25994, name: 'Terra', visible: true }, ]); merge(a1, a2, 'name').should.deep.equal([ { id: 25994, name: 'Terra', visible: true }, { id: 27424, name: 'Aqua', visible: false }, { id: 27424, name: 'AQUA' }, { id: 25994, visible: false } ]); merge(a2, a1, 'name').should.deep.equal([ { id: 27424, name: 'AQUA' }, { id: 25994, visible: false }, { id: 25994, name: 'Terra', visible: true }, { id: 27424, name: 'Aqua', visible: false } ]); }); it('two objects with nested arrays', () => { const o1 = { satellites: [ { id: 25994, name: 'Terra', visible: true }, { id: 27424, name: 'Aqua', visible: false } ] }; const o2 = { satellites: [ { id: 27424, name: 'AQUA', visible: true }, { id: 40069, name: 'Terra' } ] }; merge(o1, o2, 'id').should.deep.equal({ satellites: [ { id: 25994, name: 'Terra', visible: true }, { id: 27424, name: 'AQUA', visible: true }, { id: 40069, name: 'Terra' } ] }); merge(o2, o1, 'id').should.deep.equal({ satellites: [ { id: 27424, name: 'Aqua', visible: false }, { id: 40069, name: 'Terra' }, { id: 25994, name: 'Terra', visible: true } ] }); merge(o1, o2, 'id', 'name').should.deep.equal({ satellites: [ { id: 40069, name: 'Terra', visible: true }, { id: 27424, name: 'AQUA', visible: true } ] }); merge(o1, o2, 'name', 'id').should.deep.equal({ satellites: [ { id: 40069, name: 'Terra', visible: true }, { id: 27424, name: 'AQUA', visible: true } ] }); merge(o2, o1, 'name', 'id').should.deep.equal({ satellites: [ { id: 27424, name: 'Aqua', visible: false }, { id: 25994, name: 'Terra', visible: true } ] }); }); it('two plain objects, overwriting existing only', () => { const o1 = { id: 25994, name: 'Terra', visible: false }; const o2 = { sidebarPanelId: 'satellite', visible: true }; merge(o1, o2, true).should.deep.equal({ id: 25994, name: 'Terra', visible: true }); merge(o2, o1, true).should.deep.equal({ sidebarPanelId: 'satellite', visible: false }); }); it('two objects with nested objects, overwriting existing only', () => { const o1 = { language: { en: 'English', ru: 'Русский' }, sidebarPanelId: 'satellite', user: { name: 'Alice', age: 30 } }; const o2 = { language: { ru: 'Russian', de: 'German' }, sidebarPanelId: 'geocoding' }; merge(o1, o2, true).should.deep.equal({ language: { en: 'English', ru: 'Russian' }, sidebarPanelId: 'geocoding', user: { name: 'Alice', age: 30 } }); merge(o2, o1, true).should.deep.equal({ language: { ru: 'Русский', de: 'German' }, sidebarPanelId: 'satellite' }); }); it('two objects with plain nested arrays, overwriting existing only', () => { const o1 = { language: ['en', 'ru'], sidebarPanelId: 'satellite' }; const o2 = { language: ['de'], sidebarPanelId: 'geocoding', user: ['Alice', 'Bob'] }; merge(o1, o2, true).should.deep.equal({ language: ['en', 'ru', 'de'], sidebarPanelId: 'geocoding' }); merge(o2, o1, true).should.deep.equal({ language: ['de', 'en', 'ru'], sidebarPanelId: 'satellite', user: ['Alice', 'Bob'] }); }); it('two objects with nested arrays, overwriting existing only', () => { const o1 = { satellites: [ { id: 25994, name: 'Terra', visible: true }, { id: 27424, name: 'Aqua', visible: false } ] }; const o2 = { satellites: [ { id: 25994, visible: false }, { id: 40069, name: 'Meteor-M №2', visible: true } ] }; merge(o1, o2, 'id', true).should.deep.equal({ satellites: [ { id: 25994, name: 'Terra', visible: false }, { id: 27424, name: 'Aqua', visible: false } ] }); merge(o2, o1, 'id', true).should.deep.equal({ satellites: [ { id: 25994, visible: true }, { id: 40069, name: 'Meteor-M №2', visible: true } ] }); }); });
import codecs import os import re class MovieCorpus: """A class to load cornel movie corpus data""" def __init__(self, data_path, input_paths, label_col, limit=None): self.paths = [os.path.join(data_path, input_path) for input_path in input_paths] self.label_col = label_col self.limit = limit def __call__(self): # Define path to new file # datafile = os.path.join(self.path, "formatted_movie_lines.txt") delimiter = "\t" # Unescape the delimiter delimiter = str(codecs.decode(delimiter, "unicode_escape")) # Initialize lines dict, conversations list, and field ids lines = {} conversations = [] MOVIE_LINES_FIELDS = ["lineID", "characterID", "movieID", "character", "text"] MOVIE_CONVERSATIONS_FIELDS = [ "character1ID", "character2ID", "movieID", "utteranceIDs", ] # Load lines and process conversations print("\nProcessing corpus...") lines = self.loadLines( os.path.join(self.paths[0], "movie_lines.txt"), MOVIE_LINES_FIELDS ) print("\nLoading conversations...") conversations = self.loadConversations( os.path.join(self.paths[0], "movie_conversations.txt"), lines, MOVIE_CONVERSATIONS_FIELDS, ) res = [] for pair in self.extractSentencePairs(conversations): res.append([pair[0], {self.label_col: pair[1]}]) print("Loading data from disk finished") if self.limit: return [res[: self.limit]] return [res] # Splits each line of the file into a dictionary of fields def loadLines(self, fileName, fields): lines = {} with open(fileName, "r", encoding="iso-8859-1") as f: for line in f: values = line.split(" +++$+++ ") # Extract fields lineObj = {} for i, field in enumerate(fields): lineObj[field] = values[i] lines[lineObj["lineID"]] = lineObj return lines # Groups fields of lines from `loadLines` into conversations based on *movie_conversations.txt* def loadConversations(self, fileName, lines, fields): conversations = [] with open(fileName, "r", encoding="iso-8859-1") as f: for line in f: values = line.split(" +++$+++ ") # Extract fields convObj = {} for i, field in enumerate(fields): convObj[field] = values[i] # Convert string to list (convObj["utteranceIDs"] == "['L598485', 'L598486', ...]") utterance_id_pattern = re.compile("L[0-9]+") lineIds = utterance_id_pattern.findall(convObj["utteranceIDs"]) # Reassemble lines convObj["lines"] = [] for lineId in lineIds: convObj["lines"].append(lines[lineId]) conversations.append(convObj) return conversations # Extracts pairs of sentences from conversations def extractSentencePairs(self, conversations): qa_pairs = [] for conversation in conversations: # Iterate over all the lines of the conversation for i in range( len(conversation["lines"]) - 1 ): # We ignore the last line (no answer for it) inputLine = conversation["lines"][i]["text"].strip() targetLine = conversation["lines"][i + 1]["text"].strip() # Filter wrong samples (if one of the lists is empty) if inputLine and targetLine: qa_pairs.append([inputLine, targetLine]) return qa_pairs
from gpiozero import MotionSensor from subprocess import call from time import sleep # Time to wait until display should turn off after last motion detected timeUntilDisplayOff = 1800 # The GPIO data pin to which the PIR sensor is connected pin = 14 pir = MotionSensor(pin) timer = timeUntilDisplayOff while True: if pir.motion_detected: timer = timeUntilDisplayOff print ("Motion detected! Setting timer to " + str(timer) + " seconds.") if timer > 0: if timer % 10 == 0: print ("Timer: " + str(timer) + " seconds") timer -= 1 elif timer == 0: call(['vcgencmd', 'display_power', '0']) print ("Timer is 0. Display turned off. Waiting for motion...") # display is now off. we wait for motion and turn it on pir.wait_for_motion() call(['vcgencmd', 'display_power', '1']) timer = timeUntilDisplayOff sleep(1)
/* * * Copyright (C) 2011, 2015 Cisco Systems, Inc. * Copyright (C) 2015 CBA research group, Technical University of Catalonia. * * 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. * */ #ifndef SOCKETS_H_ #define SOCKETS_H_ #include "../defs.h" #include "sockets-util.h" #include "packets.h" #include "../liblisp/lisp_address.h" #include "lbuf.h" typedef enum { SOCK_READ, SOCK_WRITE, } sock_type_e; /* * inspired by quagga thread.c * It might be a little bit of an overkill for now * but it could prove useful in the future */ typedef struct sock_list { struct sock *head; struct sock *tail; int count; int maxfd; }sock_list_t; typedef struct sock { sock_type_e type; int (*recv_cb)(struct sock *); void *arg; int fd; struct sock *next; struct sock *prev; }sock_t; typedef struct uconn { /* TODO: decide if la, ra should be IP */ lisp_addr_t la; /* local address */ lisp_addr_t ra; /* remote address */ uint16_t lp; /* local port */ uint16_t rp; /* remote port */ } uconn_t; typedef struct sockmstr { sock_list_t read; // struct sock_list *write; // struct sock_list *netlink; fd_set readfds; // fd_set *writefds; // fd_set *netlinkfds; } sockmstr_t; union sockunion { struct sockaddr_in s4; struct sockaddr_in6 s6; }; typedef struct fwd_entry { lisp_addr_t *srloc; lisp_addr_t *drloc; int *out_sock; } fwd_entry_t; inline fwd_entry_t *fwd_entry_new_init(lisp_addr_t *srloc, lisp_addr_t *drloc, int *out_socket); inline void fwd_entry_del(fwd_entry_t *fwd_entry); static inline void fwd_entry_set_srloc(fwd_entry_t *fwd_ent, lisp_addr_t * srloc); static inline void fwd_entry_set_drloc(fwd_entry_t *fwd_ent, lisp_addr_t * drloc); typedef struct iface iface_t; sockmstr_t *sockmstr_create(); void sockmstr_destroy(sockmstr_t *sm); struct sock *sockmstr_register_get_by_fd(sockmstr_t *m, int fd); struct sock *sockmstr_register_read_listener(sockmstr_t *m, int (*)(struct sock *), void *arg, int fd); int sockmstr_unregister_read_listenedr(sockmstr_t *m, struct sock *sock); void sockmstr_process_all(sockmstr_t *m); void sockmstr_wait_on_all_read(sockmstr_t *m); int open_data_raw_input_socket(int afi); int open_data_datagram_input_socket(int afi); int open_control_input_socket(int afi); int sock_recv(int, lbuf_t *); int sock_ctrl_recv(int, lbuf_t *, uconn_t *); int sock_data_recv(int sock, lbuf_t *b, int *afi, uint8_t *ttl, uint8_t *tos); inline int uconn_init(uconn_t *uc, int lp, int rp, lisp_addr_t *la, lisp_addr_t *ra); static inline void fwd_entry_set_srloc(fwd_entry_t *fwd_ent, lisp_addr_t * srloc) { fwd_ent->srloc = srloc; } static inline void fwd_entry_set_drloc(fwd_entry_t *fwd_ent, lisp_addr_t * drloc) { fwd_ent->drloc = drloc; } #endif /*SOCKETS_H_*/
# Copyright 2020 The T5 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. """Add Mixtures to the registry. This module contains different mixtures for training T5 models. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools import t5.data.tasks # pylint: disable=unused-import from t5.data.utils import MixtureRegistry from t5.data.utils import rate_num_examples from t5.data.utils import rate_unsupervised import tensorflow_datasets as tfds # We omit WNLI because we train on WSC/DPR simple instead _glue_tasks = [ "glue_%s_v002" % b.name for b in tfds.text.glue.Glue.builder_configs.values() if "wnli" not in b.name ] _wsc_dpr_tasks = [ "dpr_v001_simple", "super_glue_wsc_v102_simple_train", "super_glue_wsc_v102_simple_eval", ] _super_glue_tasks = _wsc_dpr_tasks + [ "super_glue_%s_v102" % b.name for b in tfds.text.super_glue.SuperGlue.builder_configs.values() if "wsc" not in b.name ] _supervised_tasks = ( _glue_tasks + _super_glue_tasks + ["cnn_dailymail_v002", "squad_v010_allanswers", "wmt_t2t_ende_v003", "wmt15_enfr_v003", "wmt16_enro_v003"] ) # Tasks is not the best description. For example, glue_v002_equal refers to a # mixture. Calling it "finetune tasks" because we consider all glue tasks as # a single dataset to train on. _finetune_tasks = [ "glue_v002_proportional", # mixture "super_glue_v102_proportional", # mixture "cnn_dailymail_v002", "squad_v010_allanswers", "wmt_t2t_ende_v003", "wmt15_enfr_v003", "wmt16_enro_v003" ] # ========================== GLUE and SuperGLUE ================================ MixtureRegistry.add( "glue_v002_proportional", _glue_tasks, default_rate=rate_num_examples) MixtureRegistry.add( "super_glue_v102_proportional", _super_glue_tasks, default_rate=rate_num_examples) # mnli and its associated dev sets: mnli_matched and mnli_mismatched MixtureRegistry.add( "glue_mnli_and_dev_v002", [t for t in _glue_tasks if "mnli" in t], default_rate=1.0) # ============================== Co-training =================================== # C4, glue, squad, superglue # The supervised tasks here are all small datasets # Mix them proportionally to their dataset sizes. # TODO(noam): This should be called "small_mix" or something, but we will # keep it as en_mix to avoid restarting experiments. # TODO(noam): some rates should be reduced - but not now to avoid restarting # experiments. They are: # - Tasks duplicated between glue and superglue (see _dedupe) # - squad and glue_qnli are duplicates # - glue_sst2 may contain overlapping phrases (related examples with itself) # - we seem to overtrain on super_glue_record - don't know why MixtureRegistry.add( "en_mix", [("c4_v020_unsupervised", rate_unsupervised)] + _glue_tasks + _super_glue_tasks + ["squad_v010_allanswers"], default_rate=rate_num_examples) MixtureRegistry.add( "all_equal", _supervised_tasks + ["c4_v020_unsupervised"], default_rate=1., ) def _dedupe(name): if "glue" in name and "rte" in name: return functools.partial(rate_num_examples, scale=0.5) return rate_num_examples MixtureRegistry.add( "all_proportional", [(t, _dedupe(t)) for t in _supervised_tasks + ["c4_v020_unsupervised"]], ) # all_mix is the same as all_proportional except it uses rate_unsupervised # for c4_v020_unsupervised. This is useful if you want to specify a specific # rate for the unsupervised task which is different from the global value for # rate_num_examples.maximum # If you use this task, you should set a maximum rate value via gin e.g. # --gin_param="dataset_utils.rate_num_examples.maximum = 1e6" MixtureRegistry.add( "all_mix", ([("c4_v020_unsupervised", rate_unsupervised)] + [(t, _dedupe(t)) for t in _supervised_tasks]), ) # ================== Leave-one-out cotrain then finetune ======================= for task_name in _finetune_tasks: task_names = set(_supervised_tasks + ["c4_v020_unsupervised"]) # Special case to treat all GLUE tasks as one task. if task_name == "glue_v002_proportional": task_names -= set(_glue_tasks) # No de-duping needed tasks = [(t, rate_num_examples) for t in task_names] # Special case to treat all Super GLUE tasks as one task. elif task_name == "super_glue_v102_proportional": task_names -= set(_super_glue_tasks) # No de-duping needed tasks = [(t, rate_num_examples) for t in task_names] else: task_names -= {task_name} # Use de-duping since we have GLUE and SuperGLUE tasks = [(t, _dedupe(t)) for t in task_names] MixtureRegistry.add("leave_one_out_{}".format(task_name), tasks) # ================= Pre-train on supervised tasks ============================== _large_translation_tasks = ["wmt_t2t_ende_v003", "wmt15_enfr_v003"] _large_supervised_tasks = _large_translation_tasks + ["cnn_dailymail_v002"] MixtureRegistry.add( "large_supervised_equal", _large_supervised_tasks, default_rate=1.0) MixtureRegistry.add( "large_supervised_proportional", _large_supervised_tasks, default_rate=rate_num_examples) MixtureRegistry.add( "large_translation_equal", _large_translation_tasks, default_rate=1.0) # =========================== Squad + Trivia QA ================================ MixtureRegistry.add( "squad_trivia_qa_equal", ["squad_v010_allanswers", "trivia_qa_v010"], default_rate=1.0) # ================================= WSC + DPR ================================== MixtureRegistry.add( "wsc_dpr_simple_proportional", _wsc_dpr_tasks, default_rate=rate_num_examples)
const { Joi } = require('../../../utils/validation'); module.exports = { tx_uid: Joi.object() .bignumber() .required(), id: Joi.string() .base58() .required(), height: Joi.number().required(), tx_type: Joi.number() .min(1) .max(16) .required(), tx_version: Joi.number() .required() .allow(null), fee: Joi.object() .bignumber() .required(), time_stamp: Joi.date().required(), signature: Joi.string() .base58() .required() .allow(null), proofs: Joi.array().required(), sender: Joi.string() .base58() .required(), sender_public_key: Joi.string() .base58() .required(), };
from __future__ import print_function import glob import itertools as it import numpy as np import os import sys import xgboost as xgb try: from sklearn import datasets from sklearn.preprocessing import scale except ImportError: None class Dataset: def __init__(self, name, get_dataset, objective, metric, use_external_memory=False): self.name = name self.objective = objective self.metric = metric self.X, self.y = get_dataset() self.use_external_memory = use_external_memory def get_boston(): data = datasets.load_boston() return data.data, data.target def get_digits(): data = datasets.load_digits() return data.data, data.target def get_cancer(): data = datasets.load_breast_cancer() return data.data, data.target def get_sparse(): rng = np.random.RandomState(199) n = 5000 sparsity = 0.75 X, y = datasets.make_regression(n, random_state=rng) X = np.array([[0.0 if rng.uniform(0, 1) < sparsity else x for x in x_row] for x_row in X]) from scipy import sparse X = sparse.csr_matrix(X) return X, y def train_dataset(dataset, param_in, num_rounds=10, scale_features=False): param = param_in.copy() param["objective"] = dataset.objective if dataset.objective == "multi:softmax": param["num_class"] = int(np.max(dataset.y) + 1) param["eval_metric"] = dataset.metric if scale_features: X = scale(dataset.X, with_mean=isinstance(dataset.X, np.ndarray)) else: X = dataset.X if dataset.use_external_memory: np.savetxt('tmptmp_1234.csv', np.hstack((dataset.y.reshape(len(dataset.y), 1), X)), delimiter=',') dtrain = xgb.DMatrix('tmptmp_1234.csv?format=csv&label_column=0#tmptmp_') else: dtrain = xgb.DMatrix(X, dataset.y) print("Training on dataset: " + dataset.name, file=sys.stderr) print("Using parameters: " + str(param), file=sys.stderr) res = {} bst = xgb.train(param, dtrain, num_rounds, [(dtrain, 'train')], evals_result=res, verbose_eval=False) # Free the booster and dmatrix so we can delete temporary files bst_copy = bst.copy() del bst del dtrain # Cleanup temporary files if dataset.use_external_memory: for f in glob.glob("tmptmp_*"): os.remove(f) return {"dataset": dataset, "bst": bst_copy, "param": param.copy(), "eval": res['train'][dataset.metric]} def parameter_combinations(variable_param): """ Enumerate all possible combinations of parameters """ result = [] names = sorted(variable_param) combinations = it.product(*(variable_param[Name] for Name in names)) for set in combinations: param = {} for i, name in enumerate(names): param[name] = set[i] result.append(param) return result def run_suite(param, num_rounds=10, select_datasets=None, scale_features=False): """ Run the given parameters on a range of datasets. Objective and eval metric will be automatically set """ datasets = [ Dataset("Boston", get_boston, "reg:linear", "rmse"), Dataset("Digits", get_digits, "multi:softmax", "merror"), Dataset("Cancer", get_cancer, "binary:logistic", "error"), Dataset("Sparse regression", get_sparse, "reg:linear", "rmse"), Dataset("Boston External Memory", get_boston, "reg:linear", "rmse", use_external_memory=True) ] results = [ ] for d in datasets: if select_datasets is None or d.name in select_datasets: results.append( train_dataset(d, param, num_rounds=num_rounds, scale_features=scale_features)) return results def non_increasing(L, tolerance): return all((y - x) < tolerance for x, y in zip(L, L[1:])) def assert_results_non_increasing(results, tolerance=1e-5): for r in results: assert non_increasing(r['eval'], tolerance), r
# -*- coding: utf-8 -*- from ogs5py import OGS model = OGS( task_root='diff_aniso_root', task_id='diff_aniso', output_dir='out', ) model.msh.read_file('diff_aniso.msh') model.gli.read_file('diff_aniso.gli') model.pcs.add_block( main_key='PROCESS', PCS_TYPE='LIQUID_FLOW', NUM_TYPE='NEW', ) model.pcs.add_block( main_key='PROCESS', PCS_TYPE='MASS_TRANSPORT', NUM_TYPE='NEW', ) model.bc.add_block( main_key='BOUNDARY_CONDITION', PCS_TYPE='MASS_TRANSPORT', PRIMARY_VARIABLE='Tracer', GEO_TYPE=['POLYLINE', 'PLY_0'], DIS_TYPE=['CONSTANT', 1], ) model.bc.add_block( main_key='BOUNDARY_CONDITION', PCS_TYPE='MASS_TRANSPORT', PRIMARY_VARIABLE='Tracer', GEO_TYPE=['POLYLINE', 'PLY_1'], DIS_TYPE=['CONSTANT', 1], ) model.bc.add_block( main_key='BOUNDARY_CONDITION', PCS_TYPE='LIQUID_FLOW', PRIMARY_VARIABLE='PRESSURE1', GEO_TYPE=['POLYLINE', 'PLY_2'], DIS_TYPE=['CONSTANT', 0], ) model.bc.add_block( main_key='BOUNDARY_CONDITION', PCS_TYPE='LIQUID_FLOW', PRIMARY_VARIABLE='PRESSURE1', GEO_TYPE=['POLYLINE', 'PLY_3'], DIS_TYPE=['CONSTANT', 0], ) model.ic.add_block( main_key='INITIAL_CONDITION', PCS_TYPE='LIQUID_FLOW', PRIMARY_VARIABLE='PRESSURE1', GEO_TYPE='DOMAIN', DIS_TYPE=['CONSTANT', 0], ) model.ic.add_block( main_key='INITIAL_CONDITION', PCS_TYPE='MASS_TRANSPORT', PRIMARY_VARIABLE='Tracer', GEO_TYPE='DOMAIN', DIS_TYPE=['CONSTANT', 0], ) model.ic.add_block( main_key='INITIAL_CONDITION', PCS_TYPE='MASS_TRANSPORT', PRIMARY_VARIABLE='Tracer', GEO_TYPE=['POLYLINE', 'PLY_0'], DIS_TYPE=['CONSTANT', 1], ) model.ic.add_block( main_key='INITIAL_CONDITION', PCS_TYPE='MASS_TRANSPORT', PRIMARY_VARIABLE='Tracer', GEO_TYPE=['POLYLINE', 'PLY_1'], DIS_TYPE=['CONSTANT', 1], ) model.st.add_block( main_key='SOURCE_TERM', ) model.mmp.add_block( main_key='MEDIUM_PROPERTIES', NAME='LAYER0', GEO_TYPE=['LAYER', 0], GEOMETRY_DIMENSION=2, GEOMETRY_AREA=1.0, POROSITY=[1, 0.4], TORTUOSITY=['ANISOTROPIC', 1.0, 0, 0, 0.1], PERMEABILITY_TENSOR=['ISOTROPIC', 1e-15], MASS_DISPERSION=[1, 10, 10], DENSITY=[1, 2000.0], ) model.msp.add_block( main_key='SOLID_PROPERTIES', DENSITY=[1, 2000.0], THERMAL=[ ['EXPANSION:'], [1e-05], ['CAPACITY:'], [1, 1605.064889], ['CONDUCTIVITY:'], [1, 0.00118799939], ], ) model.mfp.add_block( main_key='FLUID_PROPERTIES', FLUID_TYPE='LIQUID', PCS_TYPE='PRESSURE1', DENSITY=[1, 1000.0], VISCOSITY=[1, 0.001], ) model.mcp.add_block( main_key='COMPONENT_PROPERTIES', NAME='Tracer', MOBILE=1, TRANSPORT_PHASE=0, DIFFUSION=[1, 6e-10], ) model.num.add_block( main_key='NUMERICS', PCS_TYPE='PRESSURE1', ELE_UPWINDING=0.5, ELE_MASS_LUMPING=1, LINEAR_SOLVER=[3, 6, 1e-10, 1000, 1.0, 101, 4], NON_LINEAR_SOLVER=['PICARD', 0.001, 10, 0.0], ELE_GAUSS_POINTS=3, ) model.num.add_block( main_key='NUMERICS', PCS_TYPE='FLUID_MOMENTUM', ELE_GAUSS_POINTS=3, LINEAR_SOLVER=[2, 6, 1e-14, 1000, 1.0, 1, 2], ) model.num.add_block( main_key='NUMERICS', PCS_TYPE='MASS_TRANSPORT', LINEAR_SOLVER=[2, 6, 1e-14, 1000, 0.5, 1, 2], ELE_GAUSS_POINTS=3, ) model.tim.add_block( main_key='TIME_STEPPING', PCS_TYPE='LIQUID_FLOW', TIME_STEPS=[30, 10000000.0], TIME_START=0.0, TIME_END=300000000.0, ) model.tim.add_block( main_key='TIME_STEPPING', PCS_TYPE='MASS_TRANSPORT', TIME_STEPS=[30, 10000000.0], TIME_START=0.0, TIME_END=300000000.0, ) model.out.add_block( main_key='OUTPUT', NOD_VALUES=[ ['PRESSURE1'], ['Tracer'], ], GEO_TYPE='DOMAIN', TIM_TYPE=['STEPS', 1], DAT_TYPE='TECPLOT', ) model.out.add_block( main_key='OUTPUT', ELE_VALUES=[ ['VELOCITY1_X'], ['VELOCITY1_Y'], ['VELOCITY1_Z'], ], GEO_TYPE='DOMAIN', TIM_TYPE=['STEPS', 1], DAT_TYPE='TECPLOT', ) model.write_input() model.run_model()
#ifndef PrepareRawSpectra_H #define PrepareRawSpectra_H #include "AliUtilTOFParams.h" #include "RooPlot.h" #include "RooRealVar.h" #include "TCanvas.h" #include "TF1.h" #include "TFile.h" #include "TH1F.h" #include "TList.h" #include "TOFMacroUtils.h" #include "TROOT.h" #include "TString.h" #include "TStyle.h" #include "UtilFiles.h" #include "UtilHisto.h" #include "UtilMessages.h" #include "Utilities/UtilPlots.h" #include "iostream" #include "libs/TOFsignal.C" #include "AliTOFTemplateFitter.h" using std::cout; using std::endl; //////////////////////////////////////////////////////////////////////////// /// // /// // /// Include macro to compute the raw yields of pions, kaons and protons // /// Using the TOF signal // /// // /// Authors: // /// N. Jacazio, nicolo.jacazio[AROBASe]bo.infn.it // //////////////////////////////////////////////////////////////////////////// void SetColor(TH1* h, Int_t c, Int_t f); void PrepareRawSpectra(TString dirname = latestDir[0], TString dataname = "TOFDataHisto.root", TString fitprefix = "", UInt_t iCharge = 0, UInt_t iSpecies = 0, UInt_t iMult = 11, UInt_t fitmode = 0, TString prefix = "", const Bool_t fitsigma = kTRUE, const Bool_t save = kFALSE) { Infomsg("PrepareRawSpectra", Form("TString dirname %s, TString dataname %s, TString fitprefix %s, const UInt_t iCharge %i, const UInt_t iSpecies %i, const UInt_t iMult %i, UInt_t fitmode %i, TString prefix %s, const Bool_t fitsigma %i", dirname.Data(), dataname.Data(), fitprefix.Data(), iCharge, iSpecies, iMult, fitmode, prefix.Data(), fitsigma)); if (iCharge >= kCharges) Fatalmsg("PrepareRawSpectra", Form("Wrong charge: %i", iCharge)); // if (iSpecies >= kSpecies) Fatalmsg("PrepareRawSpectra", Form("Wrong particle: %i", iSpecies)); // if (fitmode >= kFModes) Fatalmsg("PrepareRawSpectra", Form("Wrong fitmode: %i", fitmode)); // if (iMult >= nMultBin) Fatalmsg("PrepareRawSpectra", Form("Multiplicity bin %i out of bounds", iMult)); // const Bool_t drawresult = kTRUE; //To draw the magenta histogram of the total fit result const Bool_t samemismatch = iMult == 11 || iMult < 2 ? kFALSE : kFALSE; //To use the mismatch template from the Centrality integrated case const Int_t mismatchindex = 0; //Which mismatch template to use in case we want to use the same one as for other multiplicity bins const Int_t useReduced = 0; //1: reduced 2: replaced To use the mismatch template reduced in the signal contribution const Bool_t geteventinfo = kFALSE; //Set to take the event wide information, this shall not be mandatory as it is more for checks on normalization const Bool_t drawlines = kTRUE; //Set to draw lines representing fitrange in the fitted distribution const Int_t filltemplates = 3001; //Set to fill the templates with shaded colors if negative nothing is done const Bool_t normfromlist = kFALSE; //Flag to normalize from the list const Bool_t showchi2 = kFALSE; //Flag to write the chi2 of the fit on each plot const Bool_t showratiomean = kFALSE; //Flag to write the mean and other parameters of the ratio between the fit and the data const Bool_t limitrange = kTRUE; //Flag to limit the plotting range of the th2 to the requested range const Bool_t showtemplateusage = kTRUE; //Flag to show the template usage for each pt bin const Bool_t T0fillOnly = dataname.Contains("0T0") || dataname.Contains("_T0") ? kTRUE : kFALSE; //Flag to check if the file has T0 fill only, in this case it should work as for peripheral Pb--Pb gROOT->SetStyle("Plain"); gStyle->SetOptTitle(0); gStyle->SetOptStat(0); // const TString speclab = pC[iCharge] + pS[iSpecies]; const TString speclabel = pCharge[iCharge] + pSpecies[iSpecies]; const TString spectitle = pCharge[iCharge] + " " + pSpecies[iSpecies]; // TString fNameDataMismatch = ""; if (dataname.Contains(" ")) { fNameDataMismatch = dataname; fNameDataMismatch.Replace(0, fNameDataMismatch.Index(" ") + 1, ""); fNameDataMismatch = dirname + Form("Processed/%s", fNameDataMismatch.Data()); while (dataname.Contains(" ") && dataname.Sizeof() > 2) dataname.Chop(); } TString fNameData = dirname + Form("Processed/%s", dataname.Data()); TString fNameDataEvt = dirname + "List/TListTOF.root"; TFile* finData = GetFile(fNameData, "READ"); TList* linData = 0x0; if (outputintolists) GetListFromFile(finData, Form("TOFList_%s", MultBinString[iMult].Data()), linData); TFile* finDataMismatch = 0x0; if (!fNameDataMismatch.EqualTo("")) finDataMismatch = GetFile(fNameDataMismatch, "READ"); //Common path for macro output const TString outpath = Form("./Spectra/%s/Yields/%s/", systemString[optpp].Data(), speclabel.Data()); TString fname = "Yield"; TString identifier = pCharge[iCharge]; identifier.Append(pSpecies[iSpecies]); identifier.Append("_"); identifier.Append(fitmodes[fitmode]); identifier.Append("_"); identifier.Append(MultBinString[iMult]); if (!prefix.IsNull() && !prefix.BeginsWith('_')) identifier.Append("_"); // identifier.Append(prefix); // fname.Append(identifier); fname.Append(".root"); fname.Prepend(outpath); // TFile* fout = nullptr; if (save) { fout = GetFile(fname, "RECREATE"); Infomsg("PrepareRawSpectra", Form("Saving output to file %s", fout->GetName())); } else Infomsg("PrepareRawSpectra", Form("NOT Saving output. Would like to save it in %s", fname.Data())); // TFile* foutfits = nullptr; if (save && !fitprefix.EqualTo("")) { foutfits = GetFile(Form("%sFits/Fits%s_%s.root", outpath.Data(), identifier.Data(), fitprefix.Data()), "RECREATE"); Infomsg("PrepareRawSpectra", Form("Saving fit results to file %s", foutfits->GetName())); } // if (fout) fout->cd(); // TList* lHistograms = new TList(); lHistograms->SetOwner(); TList* lCanvas = new TList(); lCanvas->SetOwner(); // //Define all needed histograms // TH1D* hNEvt = nullptr; TH1D* hEvtMult = nullptr; TH1D* hEvtMultAftEvSel = nullptr; TH1F* fEntries = nullptr; //Event information TH1F* hTOF[kPtBins] = { nullptr }; //TOF distribution (time or n-sigma) TH1F* hTOFMismatch[kPtBins] = { nullptr }; //TOF mismatch template TH1F* hTOFExpected[kPtBins][kExpSpecies]; //TOF signal/background templates //Fitted results TH1F* hFitted[kPtBins] = { nullptr }; //Total fitted result TH1F* hMismatchFitted[kPtBins] = { nullptr }; //Mismatch fitted TH1F* hExpectedFitted[kPtBins][kExpSpecies]; //signal/background fitted //Ratio to fitted TH1F* hRatioToFitted[kPtBins] = { nullptr }; //Total yield TH1F* hYield = nullptr; //Total yield residual in the +- 3 sigma range TH1F* hYieldResidual = nullptr; //Total background TH1F* hBackground[kExpSpecies + 1] = { nullptr }; TH1F* hBackgroundOverlap[kExpSpecies + 1] = { nullptr }; TH2F* hTOFPt = nullptr; TH2F* hTOFPtMismatch = nullptr; TH2F* hTOFPtSignal[kExpSpecies] = { nullptr }; TH2F* hTOFPtFittedMismatch = nullptr; TH2F* hTOFPtFittedSignal[kExpSpecies] = { nullptr }; TH2F* hTOFPtFitted = nullptr; //Functions TF1* fTOFsignal[kExpSpecies] = { nullptr }; TF1* fTOFsignalSum = nullptr; TF1* fTOFbackground = nullptr; // //Track information // //Get the histograms TString hname = ""; //Helper macro to get #define GetMyH(H, L, F) \ { \ if (outputintolists && L || !F) \ GetHistogram(static_cast<TList*>(L), hname, H); \ else \ GetHistogram(static_cast<TFile*>(F), hname, H); \ H->SetDirectory(0); \ lHistograms->Add(H); \ } hname = Form("fEntries_%s", MultBinString[iMult].Data()); GetMyH(fEntries, linData, finData); for (Int_t ptbin = 0; ptbin < kPtBins; ptbin++) { //Pt loop hname = "hTOF"; if (fitsigma) hname += "Sigma"; // hname += Form("%s_%i_%s", speclab.Data(), ptbin, MultBinString[iMult].Data()); GetMyH(hTOF[ptbin], linData, finData); // hname = "hTOFMismatch"; if (fitsigma) hname += "Sigma"; // hname += Form("%s_%i_%s", speclab.Data(), ptbin, MultBinString[samemismatch ? mismatchindex : iMult].Data()); if (fitsigma && (useReduced == 1 || useReduced == 2)) { //Take the coocked background TFile auxifile(Form("./TOFMismatch/SignalRemoved/%s/%s%i%s.root", pSpecies[iSpecies].Data(), pCharge[iCharge].Data(), ptbin, useReduced == 2 ? "Bkg" : "Sig"), "READ"); if (auxifile.IsOpen()) { GetHistogram(&auxifile, useReduced == 2 ? "FitReplaced" : "FitReduced", hTOFMismatch[ptbin]); hTOFMismatch[ptbin]->SetName(hname); hTOFMismatch[ptbin]->SetDirectory(0); auxifile.Close(); } } else { if (finDataMismatch) { //Get histogram for mismatch from other file GetMyH(hTOFMismatch[ptbin], 0x0, finDataMismatch); } else { //Get the mismacth from the same file GetMyH(hTOFMismatch[ptbin], linData, finData); } } //Templates for each species for (Int_t species = 0; species < kExpSpecies; species++) { //Species loop hname = "hTOF"; if (fitsigma) hname += "Sigma"; // hname += Form("Expected%s_%s_%i_%s", speclab.Data(), pS_all[species].Data(), ptbin, MultBinString[iMult].Data()); GetMyH(hTOFExpected[ptbin][species], linData, finData); } } // //Event wide information // //Get the histograms for the whole event if (geteventinfo) { TFile finDataEvt(fNameDataEvt, "READ"); TList* lin = 0x0; GetListFromFile(&finDataEvt, "cOutputList", lin); // hname = Form("hNEvt"); GetMyH(hNEvt, lin, 0x0); // hname = Form("hEvtMult"); GetMyH(hEvtMult, lin, 0x0); // hname = Form("hEvtMultAftEvSel"); GetMyH(hEvtMultAftEvSel, lin, 0x0); // delete lin; finDataEvt.Close(); } #undef GetMyH //Closing input files if (finDataMismatch) { finDataMismatch->Close(); delete finDataMismatch; } finData->Close(); delete finData; // //Define histogram to show which template is included in the fit // TH2I* husage = 0x0; if (showtemplateusage) { husage = new TH2I("husage", Form("TemplateUsage;Template;%s", ptstring.Data()), kExpSpecies + 1, -0.5, -0.5 + kExpSpecies + 1, kPtBins, -0.5, -0.5 + kPtBins); for (Int_t i = 0; i < kExpSpecies; i++) husage->GetXaxis()->SetBinLabel(i + 1, Form("Temp. %s", speciesRoot_all[3 * i + iCharge].Data())); husage->GetXaxis()->SetBinLabel(kExpSpecies + 1, "Temp. Mismatch"); for (Int_t i = 0; i < kPtBins; i++) husage->GetYaxis()->SetBinLabel(i + 1, Form("[%.2f,%.2f]", fBinPt[i], fBinPt[i + 1])); } // //Fitting section // Int_t FI = TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, kExpSpecies + 1); //Define the histograms hYield = new TH1F("hYield" + speclab, Form("Yield for %s;%s;Counts", spectitle.Data(), ptstring.Data()), kPtBins, fBinPt); lHistograms->AddFirst(hYield); hYieldResidual = new TH1F("hYieldResidual" + speclab, Form("Residual Yield for %s;%s;Counts", spectitle.Data(), ptstring.Data()), kPtBins, fBinPt); hYieldResidual->SetLineColor(kRed); hYieldResidual->SetMarkerColor(kRed); hYieldResidual->Sumw2(); lHistograms->AddFirst(hYieldResidual); for (Int_t i = 0; i < kExpSpecies + 1; i++) { hBackground[i] = new TH1F(Form("hBackground%s%i", speclab.Data(), i), Form("Background for %s %i;%s;%s Yield", spectitle.Data(), i, ptstring.Data(), i == 0 ? "Mismatch" : pSpecies_all[i - 1].Data()), kPtBins, fBinPt); lHistograms->Add(hBackground[i]); hBackgroundOverlap[i] = new TH1F(Form("hBackgroundOverlap%s%i", speclab.Data(), i), Form("Background Overlap for %s %i;%s;%s Overlap Yield", spectitle.Data(), i, ptstring.Data(), i == 0 ? "Mismatch" : pSpecies_all[i - 1].Data()), kPtBins, fBinPt); lHistograms->Add(hBackgroundOverlap[i]); } Int_t rows = 7, columns = 7; TCanvas* cTOF = new TCanvas("cTOF" + speclab, "Canvas with TOF distributions for " + spectitle, screendim[0], screendim[1]); cTOF->Divide(rows, columns); lCanvas->Add(cTOF); TCanvas* cFit = new TCanvas("cFit" + speclab, "Fitted distribution for " + spectitle, screendim[0], screendim[1]); lCanvas->Add(cFit); cFit->Divide(rows, columns); TCanvas* cFitOnly = new TCanvas("cFitOnly" + speclab, "Only Fitted distribution for " + spectitle, screendim[0], screendim[1]); lCanvas->Add(cFitOnly); cFitOnly->Divide(rows, columns); TCanvas* cFitRatio = new TCanvas("cFitRatio" + speclab, "Fitted distribution Ratio for " + spectitle, screendim[0], screendim[1]); lCanvas->Add(cFitRatio); cFitRatio->Divide(rows, columns); TCanvas* cTOFPt = new TCanvas("cTOFPt" + speclab, "Canvas with Pt TOF distributions for " + spectitle, screendim[0], screendim[1]); lCanvas->Add(cTOFPt); TCanvas* cYield = new TCanvas("cYield" + speclab, "Canvas with Yield for " + spectitle); cYield->Divide(3); lCanvas->Add(cYield); TCanvas* cYieldResidual = new TCanvas("cYieldResidual" + speclab, "Canvas with YieldResidual for " + spectitle); cYieldResidual->Divide(2, 2); lCanvas->Add(cYieldResidual); TCanvas* cBackground = new TCanvas("cBackground" + speclab, "Canvas with Background for " + spectitle); cBackground->Divide(4, 2); lCanvas->Add(cBackground); TCanvas* cBackgroundOverlap = new TCanvas("cBackgroundOverlap" + speclab, "Canvas with BackgroundOverlap for " + spectitle); cBackgroundOverlap->Divide(4, 2); lCanvas->Add(cBackgroundOverlap); TCanvas* cEvent = new TCanvas("cEvent", "Canvas with Events"); cEvent->Divide(2, 2); lCanvas->Add(cEvent); Int_t padcounter = 1; //Pt ranges where to fit //RooFit pt ranges const Int_t MinPtRoofit_PbPb[nSpecies] = { 10, 10, 12, 26 }; const Int_t MaxPtRoofit_PbPb[nSpecies] = { 43, 43, 43, 59 }; const Int_t MinPtRoofit_pp[nSpecies] = { 10, 10, 16, 26 }; const Int_t MaxPtRoofit_pp[nSpecies] = { 43, 43, 43, 59 }; //Functions pt ranges const Int_t MinPtFunctions[nSpecies] = { 10, 12, 21, 26 }; const Int_t MaxPtFunctions[nSpecies] = { 37, 40, 40, 59 }; // Int_t MinPtFit = optpp ? MinPtRoofit_pp[iSpecies] : MinPtRoofit_PbPb[iSpecies]; Int_t MaxPtFit = optpp ? MaxPtRoofit_pp[iSpecies] : MaxPtRoofit_PbPb[iSpecies]; for (Int_t ptbin = 0; ptbin < kPtBins; ptbin++) { //Pt loop Bool_t status = ptbin >= MinPtFit && ptbin <= MaxPtFit; Printf("###############################"); Printf("Pt bin %i/%i: [%.2f, %.2f]", ptbin + 1, kPtBins, fBinPt[ptbin], fBinPt[ptbin + 1]); Printf("###############################"); //Drawing Delta T Int_t colorcounter = 0; cTOF->cd(padcounter); gPad->SetLogy(); SetColor(hTOF[ptbin], kBlack, 0); hTOF[ptbin]->DrawCopy(); SetColor(hTOFMismatch[ptbin], FI + colorcounter, filltemplates); colorcounter++; hTOFMismatch[ptbin]->DrawCopy("same"); for (Int_t species = 0; species < kExpSpecies; species++) { //Species loop SetColor(hTOFExpected[ptbin][species], FI + colorcounter, filltemplates); colorcounter++; hTOFExpected[ptbin][species]->DrawCopy("same"); } DrawLabel(Form("pt %i [%.2f,%.2f]", ptbin, fBinPt[ptbin], fBinPt[ptbin + 1])); // //Define data and template histograms // TH1F* datahisto = hTOF[ptbin]; TH1F* mismatchhisto = hTOFMismatch[ptbin]; TH1F* templatehhisto[kExpSpecies] = { 0x0 }; for (Int_t species = 0; species < kExpSpecies; species++) templatehhisto[species] = hTOFExpected[ptbin][species]; // //Fit Parameters // const Double_t showrange[2] = { fitsigma ? -40. : -3000., fitsigma ? 40. : 3000. }; //Range where to show the actual fit in the saved figure const Bool_t setstart = optpp ? kTRUE : kTRUE; //Gets the first bin above zero as a fitrange const Bool_t setstop = optpp ? kFALSE : (iMult < 3 || iMult == nMultBin - 1) ? kFALSE : kTRUE; //Gets the last bin above zero as a fitrange Double_t range[2] = { fitsigma ? -300. : -10000., fitsigma ? 300. : 10000. }; //Integration range to extract yields only if using TFF Double_t fitrange[2] = { fitsigma ? -300. : -3000., fitsigma ? 300. : 6000. }; //Fit range const Int_t rebin = (fitmode == 3) ? -2 : -2; const Bool_t setzeroerrors = kFALSE; const Bool_t useMismatch = optpp ? kTRUE : kTRUE; const Bool_t fixMismatch = kFALSE; //If true Mismatch template is scaled before the fit and then fixed const Bool_t useOptions = kTRUE; //Using the pt/Centrality dependet options const Bool_t setTemplateWithRanges = kTRUE; //Using the fitranges to set if or not to use the templates Bool_t useit[kExpSpecies] = { 0, 0, 1, 1, 1, 0 }; //Choose if use or not the template for that particular particle species const Bool_t usefun[kExpSpecies] = { 0, 0, 0, 0, 0, 0 }; //Choose if use or not a full function instead of the template for fitting Int_t ntemplates = 0; Int_t indexoffset = 0; if (useOptions && status) { //Custom pt and mult dependent parameters if (fitsigma) { if (ptbin < 25) useit[0] = kTRUE; //Low pt electrons if (ptbin < 20) useit[1] = kTRUE; //Low pt muons if (ptbin < 5) useit[4] = kFALSE; //low pt protons if (ptbin > 30) useit[5] = kTRUE; //high pt Deuteron if (fitmode == 1) { //RooFit if (iSpecies == 0) { // rebin = 4; fitrange[0] = ptbin > 10 ? -10 : -25; if (ptbin >= 27) fitrange[0] = -5; if (ptbin > 40) fitrange[0] = -3; if (ptbin < 34) fitrange[1] = 200; else if (ptbin < 37) fitrange[1] = 100; else fitrange[1] = 40; if (0) { if (ptbin < 10) useit[4] = kFALSE; } else { fitrange[0] = -30; if (ptbin >= 29) fitrange[0] = -5; fitrange[1] = 50; if (ptbin < 12) useit[3] = kFALSE; // low pt Kaons if (ptbin < 24) useit[4] = kFALSE; // low pt Protons if (ptbin < 32) useit[5] = kFALSE; // low pt Deuterons if (ptbin > 39) { fitrange[1] = 10; useit[5] = kFALSE; // low pt Deuterons } } if (iMult >= 9 && iMult != nMultBin - 1 && ptbin >= 32) fitrange[1] = 20; if (iMult >= 9 && iMult != nMultBin - 1 && ptbin > 33) fitrange[1] = 15; if (iMult >= 9 && iMult != nMultBin - 1 && ptbin >= 35) fitrange[1] = 10; if (iMult >= 9 && iMult != nMultBin - 1 && ptbin >= 38) fitrange[1] = 8; if (iMult >= 8 && iMult != nMultBin - 1 && ptbin > 39) fitrange[1] = 5; if (iMult >= 8 && iMult != nMultBin - 1 && ptbin < 10) useit[3] = kFALSE; //peripheral Kaons if (iMult >= 9 && iMult != nMultBin - 1 && ptbin < 43) useit[5] = kFALSE; //peripheral Deuteron } else if (iSpecies == 1) { // rebin = 5; fitrange[0] = ptbin > 37 ? -5 : ptbin > 33 ? -8 : ptbin > 20 ? -10 : ptbin > 10 ? -25 : -40; if (iCharge == 1 && ptbin > 30) fitrange[0] = -7; if (iCharge == 1 && ptbin >= 37) fitrange[0] = -4; fitrange[1] = ptbin > 20 ? 100 : 200; if (ptbin >= 40) fitrange[1] = 40; if (iMult >= 7 && iMult != nMultBin - 1 && ptbin > 15) fitrange[1] = 10; if (iMult >= 7 && iMult != nMultBin - 1 && ptbin > 19) fitrange[1] = 5; if (optpp) { fitrange[0] = -70; fitrange[1] = 50; } useit[0] = kFALSE; //Low pt electrons useit[1] = kFALSE; //Low pt muons // if(ptbin < 15) useit[2] = kFALSE;//low pt pions if (ptbin < 5) useit[4] = kFALSE; //low pt protons if (ptbin <= 34) useit[5] = kFALSE; //high pt Deuteron if (iCharge == 1 && ptbin < 37) useit[5] = kFALSE; //high pt Deuteron if (iMult >= 8 && iMult != nMultBin - 1 && ptbin < 26) useit[4] = kFALSE; //peripheral Protons if (iMult >= 7 && iMult != nMultBin - 1 && ptbin > 15 && ptbin < 35) useit[4] = kFALSE; //peripheral Protons if (iMult >= 7 && iMult != nMultBin - 1 && ptbin < 43) useit[5] = kFALSE; //peripheral Deuteron if (iMult == 9 && ptbin < 15) { // useit[2] = kFALSE;//peripheral Deuteron fitrange[1] = 5; //peripheral Deuteron } if (optpp) useit[5] = kFALSE; //high pt Deuteron } else if (iSpecies == 2) { // rebin = 5; // //Setting fit range // if (0) { fitrange[0] = -50; if (ptbin >= 15) fitrange[0] = -40; if (ptbin >= 20) fitrange[0] = -30; if (ptbin >= 25) fitrange[0] = -25; if (ptbin >= 28) fitrange[0] = -10; if (ptbin >= 40) fitrange[0] = -5; } else { fitrange[0] = -30; fitrange[0] = templatehhisto[0]->GetXaxis()->GetBinCenter(templatehhisto[0]->GetMaximumBin()); } fitrange[1] = ptbin > 35 ? 30 : 150; // fitrange[0] = -15; // fitrange[1] = 15; fitrange[1] = 40; fitrange[0] = -20; fitrange[1] = 50; if (iMult >= 8 && iMult != nMultBin - 1 && ptbin >= 35) fitrange[1] = 6; if (iMult >= 9 && iMult != nMultBin - 1 && ptbin > 40) fitrange[1] = 4; // //Setting templates // //Unused templates useit[0] = kFALSE; //Low pt electrons useit[1] = kFALSE; //Low pt muons //Concurrent templates // // if(ptbin < 25) useit[3] = kFALSE; // if(ptbin < 30) useit[2] = kFALSE;//high pt Deuteron // if(ptbin < 30) useit[3] = kFALSE;//high pt Deuteron // if(ptbin > 40) useit[5] = kTRUE;//high pt Deuteron // else useit[5] = kFALSE;//high pt Deuteron // if(/*iCharge == 0 && */iMult >= 6 && iMult != nMultBin -1 && ptbin < 43) useit[5] = kFALSE;//peripheral Deuteron } else if (iSpecies == 3) { // rebin = 5; fitrange[0] = -50; if (ptbin >= 15) fitrange[0] = -40; if (ptbin >= 20) fitrange[0] = -30; if (ptbin >= 25) fitrange[0] = -25; if (ptbin >= 28) fitrange[0] = -10; if (ptbin >= 40) fitrange[0] = -5; fitrange[1] = ptbin > 35 ? 30 : 150; useit[5] = kTRUE; //Include Deuterons!! } } else if (fitmode == 3) { //Functions for (Int_t species = 0; species < kExpSpecies; species++) useit[species] = (species == kpi || species == kK || species == kp) ? kTRUE : kFALSE; if (ptbin < 20) useit[kp] = kFALSE; } } else { if (fitmode == 1) { //RooFit useit[kpi] = kTRUE; switch (iSpecies) { case 0: //Pions { if (ptbin < 12) useit[ke] = kFALSE; useit[kpi] = kTRUE; if (ptbin < 12) useit[kK] = kFALSE; if (ptbin < 15) useit[kp] = kFALSE; else useit[kp] = kTRUE; useit[4] = kFALSE; useit[kp] = kTRUE; break; } case 1: //Kaons { useit[kK] = kTRUE; useit[ke] = kFALSE; useit[kmu] = kFALSE; if (ptbin < 15) useit[kpi] = kFALSE; else useit[kpi] = kTRUE; if (ptbin < 20) useit[kp] = kFALSE; else useit[kp] = kTRUE; if (ptbin < 15) { fitrange[0] = -1000; fitrange[1] = 1000; } break; } case 2: //Protons { if (ptbin < 20) { useit[2] = kFALSE; useit[3] = kFALSE; } break; } } if (ptbin > 10) useit[3] = kTRUE; // if(ptbin > 12) useit[4] = kTRUE; } else if (fitmode == 3) { //Functions for (Int_t species = 0; species < kExpSpecies; species++) useit[species] = (species == kpi || species == kK || species == kp) ? kTRUE : kFALSE; if (ptbin < 16) useit[kK] = kFALSE; if (ptbin < 20) useit[kp] = kFALSE; } } } if (setTemplateWithRanges) { for (Int_t i = 0; i < kExpSpecies; i++) { if (useit[i] && !IsHistogramInRange(templatehhisto[i], fitrange[0], fitrange[1], /*threshold*/ 1., /*verbose*/ kFALSE)) { useit[i] = kFALSE; cout << "Template " << templatehhisto[i]->GetName() << " is not in range" << endl; } else if (useit[i]) cout << "Template " << templatehhisto[i]->GetName() << " is in range" << endl; } } // //Signal definition // if (fitmode == 3 && status) { //Fit with functions for (Int_t species = 0; species < kExpSpecies; species++) { fTOFsignal[species] = new TF1(Form("expTOFsignal%s%s", pCharge[iCharge].Data(), pSpecies_all[species].Data()), TOFsignal, range[0], range[1], 4); fTOFsignal[species]->SetLineColor(templatehhisto[species]->GetLineColor()); //Normalization fTOFsignal[species]->SetParameter(0, templatehhisto[species]->GetMaximum()); fTOFsignal[species]->SetParLimits(0, 0, (Double_t)datahisto->GetEntries()); //Mean fTOFsignal[species]->SetParameter(1, templatehhisto[species]->GetMean()); fTOFsignal[species]->SetParLimits(1, templatehhisto[species]->GetMean() - 2. * templatehhisto[species]->GetRMS(), templatehhisto[species]->GetMean() + 2. * templatehhisto[species]->GetRMS()); //Sigma fTOFsignal[species]->SetParameter(2, fitsigma ? 1. : tofReso); fTOFsignal[species]->SetParLimits(2, fitsigma ? 0.5 : 40., fitsigma ? 2.0 : 300.); //Tail fTOFsignal[species]->SetParameter(3, fitsigma ? 1. : tofTail); fTOFsignal[species]->SetParLimits(3, fitsigma ? 0.5 : 40., fitsigma ? 2.0 : 200.); fTOFsignal[species]->SetParNames("Norm", "Mean", "Sigma", "Tail"); } Int_t usable = 0; for (Int_t species = 0; species < kExpSpecies; species++) { cout << "Species " << species << " : " << useit[species] << endl; if (useit[species]) usable++; } if (useMismatch) { if (usable == 1) fTOFsignalSum = new TF1(Form("expTOFsignalSum"), TOFsignalBkg, range[0], range[1], 4 + 1); else if (usable == 2) fTOFsignalSum = new TF1(Form("expTOFsignalSum"), TOFsignalBkg_double, range[0], range[1], 8 + 1); else if (usable == 3) fTOFsignalSum = new TF1(Form("expTOFsignalSum"), TOFsignalBkg_triple, range[0], range[1], 12 + 1); else Fatalmsg("PrepareRawSpectra", Form("Too many (%i) requested functions!", usable)); fTOFbackground = new TF1(Form("expTOFbackground"), "pol0", range[0], range[1]); fTOFbackground->SetParameter(0, 0); fTOFbackground->SetParLimits(0, 0, datahisto->GetEffectiveEntries()); fTOFbackground->SetParName(0, "Bkg"); } else { if (usable == 1) fTOFsignalSum = new TF1(Form("expTOFsignalSum"), TOFsignal, range[0], range[1], 4); else if (usable == 2) fTOFsignalSum = new TF1(Form("expTOFsignalSum"), TOFsignal_double, range[0], range[1], 8); else if (usable == 3) fTOFsignalSum = new TF1(Form("expTOFsignalSum"), TOFsignal_triple, range[0], range[1], 12); else Fatalmsg("PrepareRawSpectra", Form("Too many (%i) requested functions!", usable)); } Int_t counter = 0; for (Int_t species = 0; species < kExpSpecies; species++) { if (!useit[species]) continue; for (Int_t i = 0; i < fTOFsignal[species]->GetNpar(); i++) { cout << "For parameter " << counter << " using " << species << endl; Double_t l[2]; fTOFsignal[species]->GetParLimits(i, l[0], l[1]); fTOFsignalSum->SetParameter(counter, fTOFsignal[species]->GetParameter(i)); fTOFsignalSum->SetParLimits(counter, l[0], l[1]); fTOFsignalSum->SetParName(counter, fTOFsignal[species]->GetParName(i)); counter++; } } if (useMismatch) { for (Int_t i = 0; i < fTOFbackground->GetNpar(); i++) { Double_t l[2]; fTOFbackground->GetParLimits(i, l[0], l[1]); fTOFsignalSum->SetParameter(counter, fTOFbackground->GetParameter(i)); fTOFsignalSum->SetParLimits(counter, l[0], l[1]); fTOFsignalSum->SetParName(counter, fTOFbackground->GetParName(i)); counter++; } } if (counter != fTOFsignalSum->GetNpar()) Fatalmsg("PrepareRawSpectra", "Problem in the initial conditions for conv. fit funct."); fTOFsignalSum->SetLineColor(kMagenta); } //Checking the templates before running the fit const Bool_t checkrange = kFALSE; Bool_t inrange[kExpSpecies] = { 0 }; //To choose the which templates are in range it is important that they all have the same bin limits, the selection is made with overflow and underflow fraction if (checkrange) { Double_t templateentries[kExpSpecies] = { -999 }; Double_t templateoverflow[kExpSpecies] = { -999 }; Double_t templateunderflow[kExpSpecies] = { -999 }; Double_t templatemean[kExpSpecies] = { -999 }; Double_t templatesigma[kExpSpecies] = { -999 }; for (Int_t species = 0; species < kExpSpecies; species++) { //Species loop templateentries[species] = templatehhisto[species]->GetEntries(); templateoverflow[species] = templatehhisto[species]->GetBinContent(templatehhisto[species]->GetNbinsX() + 1); templateunderflow[species] = templatehhisto[species]->GetBinContent(0); templatemean[species] = templatehhisto[species]->GetMean(); templatesigma[species] = templatehhisto[species]->GetRMS(); if (templateentries[species] == 0) continue; Double_t overflowfraction = templateoverflow[species] / templateentries[species]; Double_t underflowfraction = templateunderflow[species] / templateentries[species]; Double_t diffplus = templatemean[species] + templatesigma[species]; Double_t diffminus = templatemean[species] - templatesigma[species]; Printf("AliPID %i mean %f rms %f difference %f", species, templatemean[species], templatesigma[species], diffplus); Printf("\t\t entries %f overflow %f (frac. %f) underflow %f (frac. %f)", templateentries[species], templateoverflow[species], overflowfraction, templateunderflow[species], underflowfraction); if (overflowfraction < 0.99 && underflowfraction < 0.99) inrange[species] = kTRUE; else inrange[species] = kFALSE; if (useit[species] && !inrange[species]) useit[species] = kFALSE; } } // //Count the templates used // if (useMismatch) { //Mismatch if (husage) husage->Fill(kExpSpecies, ptbin); indexoffset++; ntemplates++; Printf("Using Mismatch template: %i/%i", indexoffset, ntemplates); } for (UInt_t species = 0; species < kExpSpecies; species++) { //Signal for particles if (useit[species]) { if (husage) husage->Fill(species, ptbin); ntemplates++; if (species < iSpecies + kpi) indexoffset++; Printf("Using template %i %s: %i/%i", species, pSpecies_all[species].Data(), indexoffset, ntemplates); } } if (rebin > 0) datahisto->Rebin(rebin); TObjArray* templates = new TObjArray(ntemplates); TObjArray* prediction = new TObjArray(ntemplates + 1); //Has also the total fitted template if (fitmode == 3) { //Fit with functions only for (Int_t species = 0; species < kExpSpecies; species++) { if (useit[species]) templates->Add(fTOFsignal[species]); } if (useMismatch) templates->Add(fTOFbackground); } else { //Fit with templates if (useMismatch) { if (rebin > 0) mismatchhisto->Rebin(rebin); if (setzeroerrors) for (Int_t i = 1; i <= mismatchhisto->GetNbinsX(); i++) mismatchhisto->SetBinError(i, 0); templates->Add(mismatchhisto); } for (Int_t species = 0; species < kExpSpecies; species++) { if (rebin > 0) templatehhisto[species]->Rebin(rebin); if (!useit[species]) continue; if (usefun[species]) { // TF1 *funct = new TF1(Form("signal%s%s", pC[iCharge].Data(), pS_all[species].Data()), TOFsignalNorm, range[0], range[1], 3); // funct->SetTitle(Form("%s", speciesRoot_all[3*species + iCharge].Data())); const Double_t m = templatehhisto[species]->GetXaxis()->GetBinCenter(templatehhisto[species]->GetMaximumBin()); //templatehhisto[species]->GetMean() > 0 ? templatehhisto[species]->GetMean() : 0; const Double_t mLow = fitsigma ? m - 3 : m - 1; const Double_t mUp = fitsigma ? m + 3 : m + 1; const Double_t s = fitsigma ? 1 : 56; const Double_t sLow = fitsigma ? s - .5 : s - 1; const Double_t sUp = fitsigma ? s + .5 : s + 1; const Double_t t = 1.25; const Double_t tLow = t - 1; const Double_t tUp = t + .01; // RooRealVar* x = new RooRealVar("x", "x" + speciesRoot_all[3 * species + iCharge], datahisto->GetXaxis()->GetBinLowEdge(1), datahisto->GetXaxis()->GetBinUpEdge(datahisto->GetNbinsX())); RooRealVar* mean = new RooRealVar( "mean" + speciesRoot_all[3 * species + iCharge], "mean" + speciesRoot_all[3 * species + iCharge], m); // m, mLow, mUp); RooRealVar* sigma = new RooRealVar( "sigma" + speciesRoot_all[3 * species + iCharge], "sigma" + speciesRoot_all[3 * species + iCharge], // s); s, s * .95, 400); // s, sLow, sUp); cout << "RMS IS " << templatehhisto[species]->GetRMS() << endl; RooRealVar* qL = new RooRealVar( "qL" + speciesRoot_all[3 * species + iCharge], "qL" + speciesRoot_all[3 * species + iCharge], 1.0); // 1.0, 0.9999, 1.0001); RooRealVar* qR = new RooRealVar( "qR" + speciesRoot_all[3 * species + iCharge], "qR" + speciesRoot_all[3 * species + iCharge], 1.667); // 1.667, 1.5, 1.7); RooqGaussian* funct = new RooqGaussian("qGaussian" + speciesRoot_all[3 * species + iCharge], speciesRoot_all[3 * species + iCharge], *x, *mean, *sigma, *qR, *qL); // funct->SetParameters(m, s, t); // funct->SetParLimits(0, mLow, mUp); // funct->SetParLimits(1, sLow, sUp); // funct->SetParLimits(2, tLow, tUp); // funct->SetParNames("Mean", "Sigma", "Tail"); templates->Add(funct); // new TCanvas(); // RooPlot *plot = x.frame(); // funct->plotOn(plot); // plot->Draw(); // lHistograms->Add(funct); // return; } else templates->Add(templatehhisto[species]); } } // //Set fit ranges // if (useOptions && status) { //Auto-Set start/stop for fit //Sets the first bin above a certain value as the start for the fit if (setstart) { const Double_t mincounts = 10; const Int_t shift = 0; const Int_t databin = GetHistoLowRange(datahisto, mincounts); if (fitmode == 3) { //With functions only data is important fitrange[0] = datahisto->GetXaxis()->GetBinLowEdge(databin); Printf("Autoset start for function fit to bin %i [%f, %f]", databin, datahisto->GetXaxis()->GetBinLowEdge(databin), datahisto->GetXaxis()->GetBinUpEdge(databin)); } else { const Int_t firstindex = GetFirstHistogram(templates, mincounts); //First template from the left with non zero values TH1F* firsthisto = dynamic_cast<TH1F*>(templates->At(firstindex)); const Int_t templatebin = GetHistoLowRange(firsthisto, mincounts); const Int_t templatebinAfter = GetHistoLowRangeAfter(firsthisto, mincounts, templatebin); const Int_t templatebinNoHoles = GetHistoNoHolesAfter(firsthisto, templatebin); if (templatebin > templatebinAfter) Fatalmsg("PrepareRawSpectra", "Wrongly defined bins"); if (!SameBinning(datahisto, firsthisto)) Fatalmsg("PrepareRawSpectra", Form("Histograms have different binning : datahisto %s (%i) and the %s (%i)", datahisto->GetName(), datahisto->GetNbinsX(), firsthisto->GetName(), firsthisto->GetNbinsX())); const Int_t binlimits[2] = { databin, templatebinNoHoles }; const TString bins[2] = { Form("databin %i [%f, %f] -> %f", binlimits[0], datahisto->GetXaxis()->GetBinLowEdge(binlimits[0]), datahisto->GetXaxis()->GetBinUpEdge(binlimits[0]), datahisto->GetBinContent(binlimits[0])), Form("templates %i [%f, %f] -> %f", binlimits[1], datahisto->GetXaxis()->GetBinLowEdge(binlimits[1]), datahisto->GetXaxis()->GetBinUpEdge(binlimits[1]), datahisto->GetBinContent(binlimits[1])) }; TString type = ""; cout << "First histogram with required counts is " << firstindex << " " << templates->At(firstindex)->GetName() << endl; cout << "Setting start to first bin above " << mincounts << " " << bins[0] << ", " << bins[1] << endl; Double_t x = -999; if (binlimits[0] > 0 && binlimits[1] < binlimits[0]) { x = datahisto->GetXaxis()->GetBinLowEdge(binlimits[0] + shift); type = "from templates"; } else if (binlimits[0] > 0) { x = datahisto->GetXaxis()->GetBinLowEdge(binlimits[1] + shift); type = "from data"; } Bool_t inrange = kTRUE; const Double_t min = iSpecies == 0 ? 2.2 : 2.; if (fitsigma) { if (x != -999 && x > -min) { inrange = kFALSE; fitrange[0] = -min; } } else { if (x != -999 && x > -min * 80) { inrange = kFALSE; fitrange[0] = -min * 80; } } if (inrange && x != -999 && fitrange[0] < x) fitrange[0] = x; // if(x != -999 && fitrange[0] < x) fitrange[0] = x; const Int_t bin = datahisto->GetXaxis()->FindBin(fitrange[0]); Infomsg("PrepareRawSpectra", Form("Required to autoset the start point %s for the fit from %f (%f) bin %i content %f", type.Data(), fitrange[0], x, bin, datahisto->GetBinContent(bin))); } } //Sets the last bin above a certain value as the stop for the fit if (setstop) { const Double_t mincounts = 5; const Int_t databin = datahisto->FindLastBinAbove(mincounts); Double_t x = datahisto->GetXaxis()->GetBinUpEdge(databin); x = GetHistoNoHolesBefore(datahisto, x); cout << "Setting stop to last bin above " << mincounts << endl; Bool_t inrange = kTRUE; if (fitsigma) { if (x > 0 && x < 5.) { inrange = kFALSE; fitrange[1] = 5.; } } else { if (x > 0 && x < 5. * 80) { inrange = kFALSE; fitrange[1] = 30. * 80; } } if (inrange && databin > 0 && fitrange[1] > x) fitrange[1] = x; const Int_t bin = datahisto->GetXaxis()->FindBin(fitrange[1]); Infomsg("PrepareRawSpectra", Form("Required to autoset the stop point for the fit to %f bin %i content %f", fitrange[1], bin, datahisto->GetBinContent(bin))); } //Check the definition of the fit ranges if (fitrange[1] < fitrange[0]) { TCanvas* RangeAttempt = new TCanvas("RangeAttempt", "Attempt"); datahisto->DrawCopy(); TLine* l[2]; for (Int_t counter = 0; counter < 2; counter++) { l[counter] = new TLine(fitrange[counter], 0, fitrange[counter], datahisto->GetMaximum()); l[counter]->Draw(); } DrawLabel(Form("Wrong range defined [%f,%f]", fitrange[0], fitrange[1])); RangeAttempt->SaveAs("./Images/RangeAttempt.pdf"); Fatalmsg("PrepareRawSpectra", Form("Fit range auto defined but wrongly.. %f < %f and should be the opposite", fitrange[1], fitrange[0])); } } TArrayD fraction(ntemplates); TArrayD fractionErr(ntemplates); for (Int_t i = 0; i < ntemplates; i++) { fraction[i] = 0; fractionErr[i] = 0; if (fitmode == 1) { //fraction are used to set the initial conditions if (useMismatch && i == 0) { fraction[i] = datahisto->GetEffectiveEntries() * 0.01; if (fixMismatch) { Int_t binlow = datahisto->GetXaxis()->FindBin(150); Int_t binup = datahisto->GetXaxis()->FindBin(210); Double_t tempintegral = mismatchhisto->Integral(fitrange[0], fitrange[1]); fraction[i] = -tempintegral * datahisto->Integral(binlow, binup) / (datahisto->GetXaxis()->GetBinUpEdge(210) - datahisto->GetXaxis()->GetBinLowEdge(150)); } } else fraction[i] = datahisto->GetEffectiveEntries(); } } cFit->cd(padcounter); // //Fitting // Double_t chi2 = showchi2 ? indexoffset : -10; // Double_t chi2 = -1; if (status == kTRUE) { switch (fitmode) { case 0: status = PerformFitWithTFF(datahisto, templates, range, fitrange, fraction, fractionErr, prediction); break; case 1: status = PerformFitWithRooFit(datahisto, templates, range, fitrange, fraction, fractionErr, prediction, chi2); break; case 2: status = PerformFitWithCD(datahisto, templates, range, fitrange, fraction, fractionErr, prediction); break; case 3: status = PerformFitWithFunctions(datahisto, templates, fTOFsignalSum, range, fitrange, fraction, fractionErr, prediction); break; default: Fatalmsg("PrepareRawSpectra", Form("The fitmode selected (%i) is not available", fitmode)); break; } } else Infomsg("PrepareRawSpectra", "Required not to fit!"); gPad->SetLogy(); //Drawing labels on the pad TString label = Form("%s %i [%.2f,%.2f]", ptstring.Data(), ptbin, fBinPt[ptbin], fBinPt[ptbin + 1]); if (!status) label += "Fit not performed!"; DrawLabel(label); if (showchi2) DrawLabel(Form("Chi2 = %f", chi2), 0.14, 0.82, 0.33, 0.92); //Saving pad to file SavePad(Form("%sFits/%i_%s%s.pdf", outpath.Data(), ptbin, MultBinString[iMult].Data(), fitmodes[fitmode].Data()), showrange[0], showrange[1], 1, -1, kTRUE); // //Get the yield from the fit // const Double_t ptmean = (fBinPt[ptbin + 1] + fBinPt[ptbin]) / 2.; const Int_t ptmeanindex = hYield->GetXaxis()->FindBin(ptmean); const Double_t Yield = ntemplates > 0 ? fraction[indexoffset] : 0; const Double_t YieldError = ntemplates > 0 ? fractionErr[indexoffset] : 0; const Double_t YieldResidual = status ? GetResidualYield(datahisto, (TH1*)prediction->At(0), -3, 3) : 0; //Yield histograms if (ptmeanindex != ptbin + 1) Fatalmsg("PrepareRawSpectra", Form("Wrong index %i compare to %i", ptmeanindex, ptbin + 1)); hYield->SetBinContent(ptmeanindex, status ? Yield : -10); hYield->SetBinError(ptmeanindex, status ? YieldError : 0); hYieldResidual->SetBinContent(ptmeanindex, YieldResidual); Int_t fractionindex = 0; for (Int_t index = 0; index < kExpSpecies + 1; index++) { hBackground[index]->SetBinContent(ptmeanindex, -10); hBackground[index]->SetBinError(ptmeanindex, 0); if (index == 0 && !useMismatch) continue; else if (index >= 1 && !useit[index - 1]) continue; hBackground[index]->SetBinContent(ptmeanindex, fraction[fractionindex]); hBackground[index]->SetBinError(ptmeanindex, fractionErr[fractionindex]); fractionindex++; } //Retrieve fit histograms if (status) { Infomsg("PrepareRawSpectra", Form("Fit went OK with %i templates", ntemplates)); cout << "In output:" << endl; prediction->ls(); cout << "In input:" << endl; templates->ls(); Int_t counter = 0; hFitted[ptbin] = (TH1F*)prediction->At(counter++); if (useMismatch) hMismatchFitted[ptbin] = (TH1F*)prediction->At(counter++); else { hMismatchFitted[ptbin] = (TH1F*)(mismatchhisto->Clone(Form("unfittedprediction%i", counter))); hMismatchFitted[ptbin]->Reset(); } for (Int_t species = 0; species < kExpSpecies; species++) { if (useit[species]) hExpectedFitted[ptbin][species] = (TH1F*)prediction->At(counter++); else { hExpectedFitted[ptbin][species] = (TH1F*)(templatehhisto[species]->Clone(Form("unfittedprediction%i", counter))); hExpectedFitted[ptbin][species]->Reset(); } } } else { Int_t counter = 0; hFitted[ptbin] = (TH1F*)datahisto->Clone("results"); hFitted[ptbin]->Reset(); hMismatchFitted[ptbin] = (TH1F*)(mismatchhisto->Clone(Form("prediction%i", counter++))); hMismatchFitted[ptbin]->Reset(); for (Int_t species = 0; species < kExpSpecies; species++) { hExpectedFitted[ptbin][species] = (TH1F*)(templatehhisto[species]->Clone(Form("prediction%i", counter++))); hExpectedFitted[ptbin][species]->Reset(); } } TH1F* hlines[2] = { 0x0 }; if (drawlines) { //Histograms with the fit range hlines[0] = (TH1F*)datahisto->Clone(Form("fitranges%i_%i_%i_%i", iCharge, iSpecies, iMult, ptbin)); hlines[0]->SetDirectory(0); hlines[0]->Reset(); hlines[0]->SetTitle("Fit range"); hlines[0]->SetLineColor(kCyan); hlines[0]->Fill(fitrange[0], datahisto->GetMaximum()); hlines[0]->Fill(fitrange[1], datahisto->GetMaximum()); hlines[1] = (TH1F*)hlines[0]->Clone(Form("ranges%i_%i_%i_%i", iCharge, iSpecies, iMult, ptbin)); hlines[1]->SetDirectory(0); hlines[1]->Reset(); hlines[1]->SetTitle("Integration range"); hlines[1]->SetLineColor(kOrange); hlines[1]->Fill(range[0], datahisto->GetMaximum()); hlines[1]->Fill(range[1], datahisto->GetMaximum()); } // //Finally drawing the result of the fit // cFitOnly->cd(padcounter); gPad->SetLogy(); datahisto->SetTitle("Data"); datahisto->DrawCopy()->GetXaxis()->SetRangeUser(showrange[0], showrange[1]); hFitted[ptbin]->SetLineColor(kMagenta); hFitted[ptbin]->SetMarkerColor(kMagenta); if (filltemplates > 0) { hFitted[ptbin]->SetFillStyle(filltemplates); hFitted[ptbin]->SetFillColor(kMagenta); } hFitted[ptbin]->DrawCopy("same"); hMismatchFitted[ptbin]->DrawCopy("same"); Double_t bkgerror = 0; hBackgroundOverlap[0]->SetBinContent(ptmeanindex, GetOverlapFraction(hExpectedFitted[ptbin][iSpecies + 2], hMismatchFitted[ptbin], bkgerror, ptbin == 20 ? kFALSE : kFALSE)); hBackgroundOverlap[0]->SetBinError(ptmeanindex, bkgerror); for (Int_t species = 0; species < kExpSpecies; species++) { hBackgroundOverlap[species + 1]->SetBinContent(ptmeanindex, GetOverlapFraction(hExpectedFitted[ptbin][iSpecies + 2], hExpectedFitted[ptbin][species], bkgerror)); hBackgroundOverlap[species + 1]->SetBinError(ptmeanindex, bkgerror); if (useit[species]) hExpectedFitted[ptbin][species]->DrawCopy("same"); } if (drawlines) { //Histograms with the fit range hlines[0]->DrawCopy("same"); hlines[1]->DrawCopy("same"); } DrawLabel(label); if (showchi2) DrawLabel(Form("Chi2 = %f", chi2), 0.14, 0.82, 0.33, 0.92); //Saving pads to figures SavePad(Form("%sFits/FITONLY_%i_%s%s.pdf", outpath.Data(), ptbin, MultBinString[iMult].Data(), fitmodes[fitmode].Data()), showrange[0], showrange[1], 1, -1, kTRUE, Form("Fit with %s", fitmodes[fitmode].Data()), kTRUE); gPad->SetLogy(kFALSE); SavePad(Form("%sFits/FITONLY_linear_%i_%s%s.pdf", outpath.Data(), ptbin, MultBinString[iMult].Data(), fitmodes[fitmode].Data()), showrange[0], showrange[1], 1, -1, kTRUE, Form("Fit with %s", fitmodes[fitmode].Data()), kTRUE); gPad->SetLogy(); //Drawing ratio between the fit and the data cFitRatio->cd(padcounter); hRatioToFitted[ptbin] = (TH1F*)hFitted[ptbin]->Clone(Form("RatioToFitted%s%s_%i", pS[iSpecies].Data(), pS[iSpecies].Data(), ptbin)); hRatioToFitted[ptbin]->SetTitle(Form("Ratio to Fit;%s;Fitted/Data", fitsigma ? nsigmastringSpecies[iSpecies + kpi].Data() : tofsignalstringSpecies[iSpecies + kpi].Data())); hRatioToFitted[ptbin]->Sumw2(); hRatioToFitted[ptbin]->Divide(hFitted[ptbin], datahisto, 1, 1); hRatioToFitted[ptbin]->DrawCopy()->GetXaxis()->SetRangeUser(fitrange[0], fitrange[1]); ; DrawLabel(label); if (showratiomean) { TF1* meanvalue = new TF1("fmean", "pol0", -100, 100); meanvalue->SetParameter(0, 0); meanvalue->SetParLimits(0, 0, 100); hRatioToFitted[ptbin]->Fit(meanvalue, "0 N R M S"); meanvalue->DrawCopy("same"); DrawLabel(Form("Mean = %f", meanvalue->GetParameter(0)), 0.14, 0.82, 0.33, 0.92); } padcounter++; } cTOFPt->cd(); //2D histograms TH1F* auxiarray[kPtBins]; for (Int_t ptbin = 0; ptbin < kPtBins; ptbin++) auxiarray[ptbin] = hTOF[ptbin]; hTOFPt = Form2DHisto(auxiarray, kPtBins, fBinPt, Form("hTOFPt%s%s", pC[iCharge].Data(), pS[iSpecies].Data()), Form("hTOFPt%s%s;%s;%s", pC[iCharge].Data(), pS[iSpecies].Data(), fitsigma ? nsigmastringSpecies[iSpecies + kpi].Data() : tofsignalstringSpecies[iSpecies + kpi].Data(), ptstring.Data())); CopyStyle(hTOFPt, auxiarray[0]); for (Int_t ptbin = 0; ptbin < kPtBins; ptbin++) auxiarray[ptbin] = hMismatchFitted[ptbin]; hTOFPtFittedMismatch = Form2DHisto(auxiarray, kPtBins, fBinPt, Form("hTOFPtFittedMismatch%s%s", pC[iCharge].Data(), pS[iSpecies].Data()), Form("hTOFPtFittedMismatch%s%s", pC[iCharge].Data(), pS[iSpecies].Data())); CopyStyle(hTOFPtFittedMismatch, auxiarray[0]); for (Int_t species = 0; species < kExpSpecies; species++) { for (Int_t ptbin = 0; ptbin < kPtBins; ptbin++) auxiarray[ptbin] = hExpectedFitted[ptbin][species]; hTOFPtFittedSignal[species] = Form2DHisto(auxiarray, kPtBins, fBinPt, Form("hTOFPtFittedSignal%s%s%s", pC[iCharge].Data(), pS[iSpecies].Data(), pS_all[species].Data()), Form("hTOFPtFittedSignal%s%s%s", pC[iCharge].Data(), pS[iSpecies].Data(), pS_all[species].Data())); CopyStyle(hTOFPtFittedSignal[species], auxiarray[0]); } for (Int_t ptbin = 0; ptbin < kPtBins; ptbin++) auxiarray[ptbin] = hFitted[ptbin]; hTOFPtFitted = Form2DHisto(auxiarray, kPtBins, fBinPt, Form("hTOFPtFitted%s%s", pC[iCharge].Data(), pS[iSpecies].Data()), Form("hTOFPtFitted%s%s", pC[iCharge].Data(), pS[iSpecies].Data())); CopyStyle(hTOFPtFitted, auxiarray[0]); if (limitrange) { hTOFPt->GetXaxis()->SetRangeUser(fitsigma ? -10 : -500, fitsigma ? 10 : 500); hTOFPt->GetYaxis()->SetRangeUser(PtRange[optpp][2 * iSpecies], PtRange[optpp][2 * iSpecies + 1]); } hTOFPt->DrawCopy(); hTOFPtFittedMismatch->DrawCopy("same"); for (Int_t species = 0; species < kExpSpecies; species++) hTOFPtFittedSignal[species]->DrawCopy("same"); if (drawresult) hTOFPtFitted->DrawCopy("same"); cTOFPt->AddExec("dynamic", "DynamicExec()"); // //Computing normalization factor // Double_t evtnorm = 1; if (geteventinfo) { //Compute the normalization from the list of events if (iMult != nMultBin - 1) { //MB case Double_t temp = hEvtMultAftEvSel->GetEffectiveEntries(); hEvtMultAftEvSel->GetXaxis()->SetRangeUser(MultBin[iMult] + 0.0001, MultBin[iMult + 1] - 0.0001); hEvtMult->GetXaxis()->SetRangeUser(MultBin[iMult] + 0.0001, MultBin[iMult + 1] - 0.0001); if (temp == hEvtMultAftEvSel->GetEffectiveEntries()) Fatalmsg("PrepareRawSpectra", "Normalization"); } else { //Centrality bin hEvtMultAftEvSel->GetXaxis()->SetRangeUser(-1, hEvtMultAftEvSel->GetNbinsX() + 1); hEvtMult->GetXaxis()->SetRangeUser(-1, hEvtMult->GetNbinsX() + 1); if (hEvtMultAftEvSel->GetSumOfWeights() != hEvtMultAftEvSel->GetEffectiveEntries()) Fatalmsg("PrepareRawSpectra", "Normalization"); } evtnorm = 1. / hEvtMultAftEvSel->GetEffectiveEntries(); // evtnorm = 1./hEvtMultAftEvSel->GetSumOfWeights() // evtnorm = 1./hEvtMult->GetEffectiveEntries() } //Compute the normalization from the list of analysed tracks const Double_t norm = 1. / fEntries->GetBinContent(1); if (geteventinfo && norm != evtnorm) { Warningmsg("PrepareRawSpectra", Form("The two Normalizations differ! (evt) %f (processed) %f evt/processed ratio %f%%\n\t The number of events in the multiplicity class is: (evt) %f (processed) %f", evtnorm, norm, norm > 0 ? evtnorm / norm : -1, hEvtMultAftEvSel->GetEffectiveEntries(), fEntries->GetBinContent(1))); } // //Draw the yield // cYield->cd(1); gPad->SetLogy(); hYield->SetTitle("Raw Yield Unbinned"); hYield->GetXaxis()->SetRangeUser(0, 5); hYield->DrawCopy()->GetYaxis()->SetTitle("Unscaled unbinned counts"); lHistograms->AddFirst(((TH1F*)hYield->Clone(Form("hUnscaledYieldUnbinned%s%s", pC[iCharge].Data(), pS[iSpecies].Data())))); DrawLabel("Raw Yield Unbinned"); cYield->cd(2); gPad->SetLogy(); hYield->Scale(1, "width"); //Scale to the bin width hYield->SetTitle("Raw Yield"); hYield->DrawCopy()->GetYaxis()->SetTitle("Unscaled counts"); lHistograms->AddFirst(((TH1F*)hYield->Clone(Form("hUnscaledYield%s%s", pC[iCharge].Data(), pS[iSpecies].Data())))); DrawLabel("Unscaled counts"); cYield->cd(3); gPad->SetLogy(); if (normfromlist) { hYield->Scale(evtnorm); hYieldResidual->Scale(evtnorm, "width"); hYield->SetTitle("Yield List Evt. Norm."); } else { hYield->Scale(norm); hYieldResidual->Scale(norm, "width"); hYield->SetTitle("Yield Evt. Norm."); } hYield->DrawCopy()->GetYaxis()->SetTitle("Evt. Scaled counts"); DrawLabel("Evt. Scaled counts"); cYield->SaveAs(Form("%s%s%s_%s.pdf", outpath.Data(), pCharge[iCharge].Data(), pSpecies[iSpecies].Data(), MultBinString[iMult].Data())); // //Draw the residual of the yield // TH1* H = 0x0; cYieldResidual->cd(1); H = hYieldResidual->DrawCopy(""); H->GetXaxis()->SetRangeUser(0, 5); H->SetLineColor(kRed); H->GetYaxis()->SetTitle("Residual"); DrawLabel("Residual yield"); cYieldResidual->cd(2); H->DrawCopy("")->Divide(hYield); DrawLabel("Ratio to yield"); cYieldResidual->cd(3); H = hYieldResidual->DrawCopy(""); H->SetLineColor(kRed); H->GetXaxis()->SetRangeUser(0, 5); hYield->DrawCopy("same"); H->Add(hYield); DrawLabel("Yield and Yield + Residual"); cYieldResidual->cd(4); H = H->DrawCopy(""); H->Divide(hYield); H->GetYaxis()->SetRangeUser(.9, 1.1); DrawLabel("Yield + Residual Ratio to Yield"); // //Draw the background // for (Int_t i = 0; i < kExpSpecies + 1; i++) { cBackground->cd(i + 1); hBackground[i]->SetMinimum(0); hBackground[i]->GetXaxis()->SetRangeUser(0, 5); hBackground[i]->DrawCopy()->Scale(1, "width"); DrawLabel(i == 0 ? "Mismatch" : pSpecies_all[i - 1].Data()); cBackgroundOverlap->cd(i + 1); hBackgroundOverlap[i]->SetMinimum(0); hBackgroundOverlap[i]->GetXaxis()->SetRangeUser(0, 5); hBackgroundOverlap[i]->DrawCopy()->Scale(1, "width"); DrawLabel(i == 0 ? "Mismatch" : pSpecies_all[i - 1].Data()); } // //Draw event info // cEvent->cd(1); if (geteventinfo) hNEvt->DrawCopy(); else DrawLabel("Required with no event info"); cEvent->cd(2); if (geteventinfo) { hEvtMult->GetXaxis()->SetRangeUser(0, 210); hEvtMult->DrawCopy(); } else DrawLabel("Required with no event info"); cEvent->cd(3); if (geteventinfo) { hEvtMultAftEvSel->GetXaxis()->SetRangeUser(0, 102); hEvtMultAftEvSel->DrawCopy(); } else DrawLabel("Required with no event info"); cEvent->cd(4); fEntries->DrawCopy(); //Draw used templates if (husage) { TCanvas* cUsage = new TCanvas("cUsage", "Templates"); husage->DrawCopy("COLZ"); if (productionmode) delete cUsage; } if (!fitprefix.EqualTo("")) { //Save fitted histos to file for fits if (foutfits) foutfits->cd(); for (Int_t ptbin = 0; ptbin < kPtBins; ptbin++) { TH1F* auxihisto = hTOF[ptbin]; auxihisto->SetName(Form("TOFData%s%s%s_pt%i", pC[iCharge].Data(), pS[iSpecies].Data(), MultBinString[iMult].Data(), ptbin)); auxihisto->SetTitle(Form("TOF for %s %s in %s ptbin %i [%.2f,%.2f]", pCharge[iCharge].Data(), pSpecies[iSpecies].Data(), MultBinString[iMult].Data(), ptbin, fBinPt[ptbin], fBinPt[ptbin + 1])); if (foutfits) auxihisto->Write(auxihisto->GetName()); hFitted[ptbin]->SetName(Form("TOFFitted%s%s%s_pt%i", pC[iCharge].Data(), pS[iSpecies].Data(), MultBinString[iMult].Data(), ptbin)); hFitted[ptbin]->SetTitle(Form("Fitted TOF for %s %s in %s ptbin %i [%.2f,%.2f]", pCharge[iCharge].Data(), pSpecies[iSpecies].Data(), MultBinString[iMult].Data(), ptbin, fBinPt[ptbin], fBinPt[ptbin + 1])); if (foutfits) hFitted[ptbin]->Write(hFitted[ptbin]->GetName()); hMismatchFitted[ptbin]->SetName(Form("TOFFitted_Mismatch_%s%s%s_pt%i", pC[iCharge].Data(), pS[iSpecies].Data(), MultBinString[iMult].Data(), ptbin)); hMismatchFitted[ptbin]->SetTitle(Form("Fitted TOF Mismatch for %s %s in %s ptbin %i [%.2f,%.2f]", pCharge[iCharge].Data(), pSpecies[iSpecies].Data(), MultBinString[iMult].Data(), ptbin, fBinPt[ptbin], fBinPt[ptbin + 1])); if (hMismatchFitted[ptbin]->GetEffectiveEntries() > 1 && foutfits) hMismatchFitted[ptbin]->Write(hMismatchFitted[ptbin]->GetName()); for (Int_t species = 0; species < kExpSpecies; species++) { hExpectedFitted[ptbin][species]->SetName(Form("TOFFitted_%s_%s%s%s_pt%i", pS_all[species].Data(), pC[iCharge].Data(), pS[iSpecies].Data(), MultBinString[iMult].Data(), ptbin)); hExpectedFitted[ptbin][species]->SetTitle(Form("Fitted TOF %s for %s %s in %s ptbin %i [%.2f,%.2f]", pSpecies[species].Data(), pCharge[iCharge].Data(), pSpecies[iSpecies].Data(), MultBinString[iMult].Data(), ptbin, fBinPt[ptbin], fBinPt[ptbin + 1])); if (hExpectedFitted[ptbin][species]->GetEffectiveEntries() <= 1) continue; if (foutfits) hExpectedFitted[ptbin][species]->Write(hExpectedFitted[ptbin][species]->GetName()); } hRatioToFitted[ptbin]->SetName(Form("TOFFitted_Ratio_%s%s%s_pt%i", pC[iCharge].Data(), pS[iSpecies].Data(), MultBinString[iMult].Data(), ptbin)); hRatioToFitted[ptbin]->SetTitle(Form("Fitted TOF Mismatch for %s %s in %s ptbin %i [%.2f,%.2f]", pCharge[iCharge].Data(), pSpecies[iSpecies].Data(), MultBinString[iMult].Data(), ptbin, fBinPt[ptbin], fBinPt[ptbin + 1])); if (foutfits) hRatioToFitted[ptbin]->Write(hRatioToFitted[ptbin]->GetName()); } if (foutfits) { foutfits->Close(); delete foutfits; } } if (fout) { fout->cd(); lCanvas->Write(Form("lCanvasRawSpectra%s%s", pCharge[iCharge].Data(), pSpecies[iSpecies].Data()), 1); lHistograms->Write(Form("lHistogramsRawSpectra%s%s", pCharge[iCharge].Data(), pSpecies[iSpecies].Data()), 1); } if (productionmode) { if (lHistograms) delete lHistograms; if (lCanvas) delete lCanvas; } if (linData) delete linData; if (fout) { fout->Close(); delete fout; } } void SetColor(TH1* h, Int_t c, Int_t f) { h->SetMarkerColor(c); h->SetLineColor(c); if (f > 0) { h->SetFillStyle(f); h->SetFillColor(c); } } #endif
from django.contrib import admin from user import models admin.site.register(models.UserPreferences, admin.ModelAdmin)
#ifndef __HELLOWORLD_SCENE_H__ #define __HELLOWORLD_SCENE_H__ #include "cocos2d.h" class HelloWorld : public cocos2d::Layer { public: // there's no 'id' in cpp, so we recommend returning the class instance pointer static cocos2d::Scene* createScene(); // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone virtual bool init(); void mouseDown(cocos2d::Event *event); // implement the "static create()" method manually CREATE_FUNC(HelloWorld); }; #endif // __HELLOWORLD_SCENE_H__
# Copyright 2020 The Magenta 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. """Tests for midi_hub.""" import collections import threading import time from magenta.common import concurrency from magenta.interfaces.midi import midi_hub from magenta.music import testing_lib from magenta.music.protobuf import music_pb2 import mido from six.moves import queue as Queue import tensorflow.compat.v1 as tf Note = collections.namedtuple('Note', ['pitch', 'velocity', 'start', 'end']) class MockMidiPort(mido.ports.BaseIOPort): def __init__(self): super(MockMidiPort, self).__init__() self.message_queue = Queue.Queue() def send(self, msg): msg.time = time.time() self.message_queue.put(msg) class MidiHubTest(tf.test.TestCase): def setUp(self): self.maxDiff = None # pylint:disable=invalid-name self.capture_messages = [ mido.Message(type='note_on', note=0, time=0.01), mido.Message(type='control_change', control=1, value=1, time=0.02), mido.Message(type='note_on', note=1, time=2.0), mido.Message(type='note_off', note=0, time=3.0), mido.Message(type='note_on', note=2, time=3.0), mido.Message(type='note_on', note=3, time=4.0), mido.Message(type='note_off', note=2, time=4.0), mido.Message(type='note_off', note=1, time=5.0), mido.Message(type='control_change', control=1, value=1, time=6.0), mido.Message(type='note_off', note=3, time=100)] self.port = MockMidiPort() self.midi_hub = midi_hub.MidiHub([self.port], [self.port], midi_hub.TextureType.POLYPHONIC) # Burn in Sleeper for calibration. for _ in range(5): concurrency.Sleeper().sleep(0.05) def tearDown(self): self.midi_hub.__del__() def send_capture_messages(self): for msg in self.capture_messages: self.port.callback(msg) def testMidiSignal_ValidityChecks(self): # Unsupported type. with self.assertRaises(midi_hub.MidiHubError): midi_hub.MidiSignal(type='sysex') with self.assertRaises(midi_hub.MidiHubError): midi_hub.MidiSignal(msg=mido.Message(type='sysex')) # Invalid arguments. with self.assertRaises(midi_hub.MidiHubError): midi_hub.MidiSignal() with self.assertRaises(midi_hub.MidiHubError): midi_hub.MidiSignal(type='note_on', value=1) with self.assertRaises(midi_hub.MidiHubError): midi_hub.MidiSignal(type='control', note=1) with self.assertRaises(midi_hub.MidiHubError): midi_hub.MidiSignal(msg=mido.Message(type='control_change'), value=1) # Non-inferrale type. with self.assertRaises(midi_hub.MidiHubError): midi_hub.MidiSignal(note=1, value=1) def testMidiSignal_Message(self): sig = midi_hub.MidiSignal(msg=mido.Message(type='note_on', note=1)) self.assertEqual( r'^note_on channel=0 note=1 velocity=64 time=\d+.\d+$', str(sig)) sig = midi_hub.MidiSignal(msg=mido.Message(type='note_off', velocity=127)) self.assertEqual(r'^note_off channel=0 note=0 velocity=127 time=\d+.\d+$', str(sig)) sig = midi_hub.MidiSignal( msg=mido.Message(type='control_change', control=1, value=2)) self.assertEqual( r'^control_change channel=0 control=1 value=2 time=\d+.\d+$', str(sig)) def testMidiSignal_Args(self): sig = midi_hub.MidiSignal(type='note_on', note=1) self.assertEqual( r'^note_on channel=\d+ note=1 velocity=\d+ time=\d+.\d+$', str(sig)) sig = midi_hub.MidiSignal(type='note_off', velocity=127) self.assertEqual( r'^note_off channel=\d+ note=\d+ velocity=127 time=\d+.\d+$', str(sig)) sig = midi_hub.MidiSignal(type='control_change', value=2) self.assertEqual( r'^control_change channel=\d+ control=\d+ value=2 time=\d+.\d+$', str(sig)) def testMidiSignal_Args_InferredType(self): sig = midi_hub.MidiSignal(note=1) self.assertEqual( r'^.* channel=\d+ note=1 velocity=\d+ time=\d+.\d+$', str(sig)) sig = midi_hub.MidiSignal(value=2) self.assertEqual( r'^control_change channel=\d+ control=\d+ value=2 time=\d+.\d+$', str(sig)) def testMetronome(self): start_time = time.time() + 0.1 qpm = 180 self.midi_hub.start_metronome(start_time=start_time, qpm=qpm) time.sleep(0.8) self.midi_hub.stop_metronome() self.assertEqual(7, self.port.message_queue.qsize()) msg = self.port.message_queue.get() self.assertEqual(msg.type, 'program_change') next_tick_time = start_time while not self.port.message_queue.empty(): msg = self.port.message_queue.get() if self.port.message_queue.qsize() % 2: self.assertEqual(msg.type, 'note_on') self.assertAlmostEqual(msg.time, next_tick_time, delta=0.01) next_tick_time += 60. / qpm else: self.assertEqual(msg.type, 'note_off') def testStartPlayback_NoUpdates(self): # Use a time in the past to test handling of past notes. start_time = time.time() - 0.05 seq = music_pb2.NoteSequence() notes = [Note(12, 100, 0.0, 1.0), Note(11, 55, 0.1, 0.5), Note(40, 45, 0.2, 0.6)] notes = [Note(note.pitch, note.velocity, note.start + start_time, note.end + start_time) for note in notes] testing_lib.add_track_to_sequence(seq, 0, notes) player = self.midi_hub.start_playback(seq, allow_updates=False) player.join() note_events = [] for note in notes: note_events.append((note.start, 'note_on', note.pitch)) note_events.append((note.end, 'note_off', note.pitch)) # The first note on will not be sent since it started before # `start_playback` is called. del note_events[0] note_events = collections.deque(sorted(note_events)) while not self.port.message_queue.empty(): msg = self.port.message_queue.get() note_event = note_events.popleft() self.assertEqual(msg.type, note_event[1]) self.assertEqual(msg.note, note_event[2]) self.assertAlmostEqual(msg.time, note_event[0], delta=0.01) self.assertTrue(not note_events) def testStartPlayback_NoUpdates_UpdateError(self): # Use a time in the past to test handling of past notes. start_time = time.time() seq = music_pb2.NoteSequence() notes = [Note(0, 100, start_time + 100, start_time + 101)] testing_lib.add_track_to_sequence(seq, 0, notes) player = self.midi_hub.start_playback(seq, allow_updates=False) with self.assertRaises(midi_hub.MidiHubError): player.update_sequence(seq) player.stop() def testStartPlayback_Updates(self): start_time = time.time() + 0.1 seq = music_pb2.NoteSequence() notes = [Note(0, 100, start_time, start_time + 101), Note(1, 100, start_time, start_time + 101)] testing_lib.add_track_to_sequence(seq, 0, notes) player = self.midi_hub.start_playback(seq, allow_updates=True) # Sleep past first note start. concurrency.Sleeper().sleep_until(start_time + 0.2) new_seq = music_pb2.NoteSequence() notes = [Note(1, 100, 0.0, 0.8), Note(2, 100, 0.0, 1.0), Note(11, 55, 0.3, 0.5), Note(40, 45, 0.4, 0.6)] notes = [Note(note.pitch, note.velocity, note.start + start_time, note.end + start_time) for note in notes] testing_lib.add_track_to_sequence(new_seq, 0, notes) player.update_sequence(new_seq) # Finish playing sequence. concurrency.Sleeper().sleep(0.8) # Start and end the unclosed note from the first sequence. note_events = [(start_time, 'note_on', 0), (start_time + 0.3, 'note_off', 0)] # The second note will not be played since it started before the update # and was not in the original sequence. del notes[1] for note in notes: note_events.append((note.start, 'note_on', note.pitch)) note_events.append((note.end, 'note_off', note.pitch)) note_events = collections.deque(sorted(note_events)) while not self.port.message_queue.empty(): msg = self.port.message_queue.get() note_event = note_events.popleft() self.assertEqual(msg.type, note_event[1]) self.assertEqual(msg.note, note_event[2]) self.assertAlmostEqual(msg.time, note_event[0], delta=0.01) self.assertTrue(not note_events) player.stop() def testCaptureSequence_StopSignal(self): start_time = 1.0 threading.Timer(0.1, self.send_capture_messages).start() captured_seq = self.midi_hub.capture_sequence( 120, start_time, stop_signal=midi_hub.MidiSignal(type='control_change', control=1)) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = 6.0 testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, 6)]) self.assertProtoEquals(captured_seq, expected_seq) def testCaptureSequence_StopTime(self): start_time = 1.0 stop_time = time.time() + 1.0 self.capture_messages[-1].time += time.time() threading.Timer(0.1, self.send_capture_messages).start() captured_seq = self.midi_hub.capture_sequence( 120, start_time, stop_time=stop_time) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = stop_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, stop_time)]) self.assertProtoEquals(captured_seq, expected_seq) def testCaptureSequence_Mono(self): start_time = 1.0 threading.Timer(0.1, self.send_capture_messages).start() self.midi_hub = midi_hub.MidiHub([self.port], [self.port], midi_hub.TextureType.MONOPHONIC) captured_seq = self.midi_hub.capture_sequence( 120, start_time, stop_signal=midi_hub.MidiSignal(type='control_change', control=1)) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = 6 testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 3), Note(2, 64, 3, 4), Note(3, 64, 4, 6)]) self.assertProtoEquals(captured_seq, expected_seq) def testStartCapture_StopMethod(self): start_time = 1.0 captor = self.midi_hub.start_capture(120, start_time) self.send_capture_messages() time.sleep(0.1) stop_time = 5.5 captor.stop(stop_time=stop_time) captured_seq = captor.captured_sequence() expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = stop_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, stop_time)]) self.assertProtoEquals(captured_seq, expected_seq) def testStartCapture_Multiple(self): captor_1 = self.midi_hub.start_capture( 120, 0.0, stop_signal=midi_hub.MidiSignal(note=3)) captor_2 = self.midi_hub.start_capture( 120, 1.0, stop_signal=midi_hub.MidiSignal(type='control_change', control=1)) self.send_capture_messages() captor_1.join() captor_2.join() captured_seq_1 = captor_1.captured_sequence() expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = 4.0 testing_lib.add_track_to_sequence( expected_seq, 0, [Note(0, 64, 0.01, 3), Note(1, 64, 2, 4), Note(2, 64, 3, 4)]) self.assertProtoEquals(captured_seq_1, expected_seq) captured_seq_2 = captor_2.captured_sequence() expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = 6.0 testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, 6)]) self.assertProtoEquals(captured_seq_2, expected_seq) def testStartCapture_IsDrum(self): start_time = 1.0 captor = self.midi_hub.start_capture(120, start_time) # Channels are 0-indexed in mido. self.capture_messages[2].channel = 9 self.send_capture_messages() time.sleep(0.1) stop_time = 5.5 captor.stop(stop_time=stop_time) captured_seq = captor.captured_sequence() expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = stop_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, stop_time)]) expected_seq.notes[0].is_drum = True self.assertProtoEquals(captured_seq, expected_seq) def testStartCapture_MidCapture(self): start_time = 1.0 captor = self.midi_hub.start_capture(120, start_time) # Receive the first 6 messages. for msg in self.capture_messages[0:6]: self.port.callback(msg) time.sleep(0.1) end_time = 3.5 captured_seq = captor.captured_sequence(end_time) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = end_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 3.5), Note(2, 64, 3, 3.5)]) self.assertProtoEquals(captured_seq, expected_seq) end_time = 4.5 captured_seq = captor.captured_sequence(end_time) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = end_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 4.5), Note(2, 64, 3, 4.5), Note(3, 64, 4, 4.5)]) self.assertProtoEquals(captured_seq, expected_seq) end_time = 6.0 captured_seq = captor.captured_sequence(end_time) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = end_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 6), Note(2, 64, 3, 6), Note(3, 64, 4, 6)]) self.assertProtoEquals(captured_seq, expected_seq) # Receive the rest of the messages. for msg in self.capture_messages[6:]: self.port.callback(msg) time.sleep(0.1) end_time = 6.0 captured_seq = captor.captured_sequence(end_time) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = end_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, 6)]) self.assertProtoEquals(captured_seq, expected_seq) captor.stop() def testStartCapture_Iterate_Signal(self): start_time = 1.0 captor = self.midi_hub.start_capture( 120, start_time, stop_signal=midi_hub.MidiSignal(type='control_change', control=1)) for msg in self.capture_messages[:-1]: threading.Timer(0.2 * msg.time, self.port.callback, args=[msg]).start() captured_seqs = [] for captured_seq in captor.iterate( signal=midi_hub.MidiSignal(type='note_off')): captured_seqs.append(captured_seq) self.assertEqual(4, len(captured_seqs)) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = 3 testing_lib.add_track_to_sequence(expected_seq, 0, [Note(1, 64, 2, 3)]) self.assertProtoEquals(captured_seqs[0], expected_seq) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = 4 testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 4), Note(2, 64, 3, 4)]) self.assertProtoEquals(captured_seqs[1], expected_seq) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = 5 testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, 5)]) self.assertProtoEquals(captured_seqs[2], expected_seq) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = 6 testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, 6)]) self.assertProtoEquals(captured_seqs[3], expected_seq) def testStartCapture_Iterate_Period(self): start_time = 1.0 captor = self.midi_hub.start_capture( 120, start_time, stop_signal=midi_hub.MidiSignal(type='control_change', control=1)) for msg in self.capture_messages[:-1]: threading.Timer(0.1 * msg.time, self.port.callback, args=[msg]).start() period = 0.26 captured_seqs = [] wall_start_time = time.time() for captured_seq in captor.iterate(period=period): if len(captured_seqs) < 2: self.assertAlmostEqual(0, (time.time() - wall_start_time) % period, delta=0.01) time.sleep(0.1) captured_seqs.append(captured_seq) self.assertEqual(3, len(captured_seqs)) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) end_time = captured_seqs[0].total_time self.assertAlmostEqual(wall_start_time + period, end_time, delta=0.005) expected_seq.total_time = end_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, end_time)]) self.assertProtoEquals(captured_seqs[0], expected_seq) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) end_time = captured_seqs[1].total_time self.assertAlmostEqual(wall_start_time + 2 * period, end_time, delta=0.005) expected_seq.total_time = end_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, end_time)]) self.assertProtoEquals(captured_seqs[1], expected_seq) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = 6 testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, 6)]) self.assertProtoEquals(captured_seqs[2], expected_seq) def testStartCapture_Iterate_Period_Overrun(self): start_time = 1.0 captor = self.midi_hub.start_capture( 120, start_time, stop_signal=midi_hub.MidiSignal(type='control_change', control=1)) for msg in self.capture_messages[:-1]: threading.Timer(0.1 * msg.time, self.port.callback, args=[msg]).start() period = 0.26 captured_seqs = [] wall_start_time = time.time() for captured_seq in captor.iterate(period=period): time.sleep(0.5) captured_seqs.append(captured_seq) self.assertEqual(2, len(captured_seqs)) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) end_time = captured_seqs[0].total_time self.assertAlmostEqual(wall_start_time + period, end_time, delta=0.005) expected_seq.total_time = end_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, end_time)]) self.assertProtoEquals(captured_seqs[0], expected_seq) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) expected_seq.total_time = 6 testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, 6)]) self.assertProtoEquals(captured_seqs[1], expected_seq) def testStartCapture_Callback_Period(self): start_time = 1.0 captor = self.midi_hub.start_capture(120, start_time) for msg in self.capture_messages[:-1]: threading.Timer(0.1 * msg.time, self.port.callback, args=[msg]).start() period = 0.26 wall_start_time = time.time() captured_seqs = [] def fn(captured_seq): self.assertAlmostEqual(0, (time.time() - wall_start_time) % period, delta=0.01) captured_seqs.append(captured_seq) name = captor.register_callback(fn, period=period) time.sleep(1.0) captor.cancel_callback(name) self.assertEqual(3, len(captured_seqs)) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) end_time = captured_seqs[0].total_time self.assertAlmostEqual(wall_start_time + period, end_time, delta=0.005) expected_seq.total_time = end_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, end_time)]) self.assertProtoEquals(captured_seqs[0], expected_seq) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) end_time = captured_seqs[1].total_time self.assertAlmostEqual(wall_start_time + 2 * period, end_time, delta=0.005) expected_seq.total_time = end_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, end_time)]) self.assertProtoEquals(captured_seqs[1], expected_seq) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) end_time = captured_seqs[2].total_time self.assertAlmostEqual(wall_start_time + 3 * period, end_time, delta=0.005) expected_seq.total_time = end_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, end_time)]) self.assertProtoEquals(captured_seqs[2], expected_seq) def testStartCapture_Callback_Period_Overrun(self): start_time = 1.0 captor = self.midi_hub.start_capture( 120, start_time) for msg in self.capture_messages[:-1]: threading.Timer(0.1 * msg.time, self.port.callback, args=[msg]).start() period = 0.26 wall_start_time = time.time() captured_seqs = [] def fn(captured_seq): time.sleep(0.5) captured_seqs.append(captured_seq) name = captor.register_callback(fn, period=period) time.sleep(1.3) captor.cancel_callback(name) self.assertEqual(2, len(captured_seqs)) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) end_time = captured_seqs[0].total_time self.assertAlmostEqual(wall_start_time + period, end_time, delta=0.005) expected_seq.total_time = end_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, end_time)]) self.assertProtoEquals(captured_seqs[0], expected_seq) expected_seq = music_pb2.NoteSequence() expected_seq.tempos.add(qpm=120) end_time = captured_seqs[1].total_time self.assertAlmostEqual(wall_start_time + 2 * period, end_time, delta=0.005) expected_seq.total_time = end_time testing_lib.add_track_to_sequence( expected_seq, 0, [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, end_time)]) self.assertProtoEquals(captured_seqs[1], expected_seq) def testPassThrough_Poly(self): self.midi_hub.passthrough = False self.send_capture_messages() self.assertTrue(self.port.message_queue.empty()) self.midi_hub.passthrough = True self.send_capture_messages() passed_messages = [] while not self.port.message_queue.empty(): passed_messages.append(self.port.message_queue.get().bytes()) self.assertListEqual( passed_messages, [m.bytes() for m in self.capture_messages]) def testPassThrough_Mono(self): self.midi_hub = midi_hub.MidiHub([self.port], [self.port], midi_hub.TextureType.MONOPHONIC) self.midi_hub.passthrough = False self.send_capture_messages() self.assertTrue(self.port.message_queue.empty()) self.midi_hub.passthrough = True self.send_capture_messages() passed_messages = [] while not self.port.message_queue.empty(): passed_messages.append(self.port.message_queue.get()) passed_messages[-1].time = 0 expected_messages = [ mido.Message(type='note_on', note=0), mido.Message(type='control_change', control=1, value=1), mido.Message(type='note_off', note=0), mido.Message(type='note_on', note=1), mido.Message(type='note_off', note=1), mido.Message(type='note_on', note=2), mido.Message(type='note_off', note=2), mido.Message(type='note_on', note=3), mido.Message(type='control_change', control=1, value=1), mido.Message(type='note_off', note=3)] self.assertListEqual(passed_messages, expected_messages) def testWaitForEvent_Signal(self): for msg in self.capture_messages[3:-1]: threading.Timer(0.2 * msg.time, self.port.callback, args=[msg]).start() wait_start = time.time() self.midi_hub.wait_for_event( signal=midi_hub.MidiSignal(type='control_change', value=1)) self.assertAlmostEqual(time.time() - wait_start, 1.2, delta=0.01) def testWaitForEvent_Time(self): for msg in self.capture_messages[3:-1]: threading.Timer(0.1 * msg.time, self.port.callback, args=[msg]).start() wait_start = time.time() self.midi_hub.wait_for_event(timeout=0.3) self.assertAlmostEqual(time.time() - wait_start, 0.3, delta=0.01) def testSendControlChange(self): self.midi_hub.send_control_change(0, 1) sent_messages = [] while not self.port.message_queue.empty(): sent_messages.append(self.port.message_queue.get()) self.assertListEqual( sent_messages, [mido.Message(type='control_change', control=0, value=1, time=sent_messages[0].time)]) if __name__ == '__main__': tf.test.main()
# 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. from aliyunsdkcore.request import RpcRequest from aliyunsdkgpdb.endpoint import endpoint_data class DescribeParametersRequest(RpcRequest): def __init__(self): RpcRequest.__init__(self, 'gpdb', '2016-05-03', 'DescribeParameters') self.set_method('POST') if hasattr(self, "endpoint_map"): setattr(self, "endpoint_map", endpoint_data.getEndpointMap()) if hasattr(self, "endpoint_regional"): setattr(self, "endpoint_regional", endpoint_data.getEndpointRegional()) def get_DBInstanceId(self): # String return self.get_query_params().get('DBInstanceId') def set_DBInstanceId(self, DBInstanceId): # String self.add_query_param('DBInstanceId', DBInstanceId)
#ifndef DASH__ITERATOR_INTERNAL_CONTIGUOUSRANGE_H__ #define DASH__ITERATOR_INTERNAL_CONTIGUOUSRANGE_H__ #include <dash/GlobPtr.h> #include <dash/internal/Macro.h> #include <dash/Exception.h> namespace dash { namespace internal { /** * Iterator used to find consecutive memory ranges across a global memory range. */ template<typename IteratorT> struct ContiguousRangeIterator { public: /// Iterator Traits using iterator_category = std::forward_iterator_tag; using pattern_type = typename IteratorT::pattern_type; using index_type = typename pattern_type::index_type; using size_type = typename pattern_type::size_type; using value_type = std::pair<IteratorT, size_type>; using Self_t = ContiguousRangeIterator<IteratorT>; DASH_CONSTEXPR ContiguousRangeIterator() = default; ContiguousRangeIterator(IteratorT begin, IteratorT end) : m_pos(begin), m_end(end) { m_num_copy_elems = next_range().second; } Self_t& operator++() { auto range = next_range(); m_pos = range.first; m_num_copy_elems = range.second; return *this; } std::pair<IteratorT, size_type> operator*() noexcept { return std::make_pair(m_pos, m_num_copy_elems); } DASH_CONSTEXPR bool operator<(const Self_t& other) const DASH_NOEXCEPT { return (m_pos < other.m_pos); } DASH_CONSTEXPR bool operator<=(const Self_t& other) const DASH_NOEXCEPT { return (m_pos <= other.m_pos); } DASH_CONSTEXPR bool operator>(const Self_t& other) const DASH_NOEXCEPT { return (m_pos > other.m_pos); } DASH_CONSTEXPR bool operator>=(const Self_t& other) const DASH_NOEXCEPT { return (m_pos >= other.m_pos); } DASH_CONSTEXPR bool operator==(const Self_t& other) const DASH_NOEXCEPT { return m_pos == other.m_pos; } DASH_CONSTEXPR bool operator!=(const Self_t& other) const DASH_NOEXCEPT { return m_pos != other.m_pos; } private: std::pair<IteratorT, size_type> next_range() const { auto cur_first = m_pos + m_num_copy_elems; if (cur_first == m_end) { return std::make_pair(m_end, 0); } auto cur_last = cur_first; size_type num_copy_elem = 0; constexpr const int ndim = pattern_type::ndim(); const auto& pattern = m_pos.pattern(); const int fast_dim = (pattern.memory_order() == dash::ROW_MAJOR) ? ndim - 1 : 0; auto lpos = m_pos.lpos(); auto prev_lpos = lpos; do { /* Determine coords and offset in first block */ auto global_coords = pattern.coords(cur_last.gpos()); auto block_idx = pattern.block_at(global_coords); auto block_viewspec = pattern.block(block_idx); auto phase_d = global_coords[fast_dim] - block_viewspec.offset(fast_dim); auto blocksize_d = block_viewspec.extent(fast_dim); // the number of elements to copy is the blocksize minus the offset in the block size_type num_copy_block_elem = blocksize_d - phase_d; // don't try to copy too many elements size_type elems_left = dash::distance(cur_last, m_end); if (num_copy_block_elem > elems_left) { num_copy_block_elem = elems_left; // nothing more to do here num_copy_elem += num_copy_block_elem; break; } cur_last += num_copy_block_elem; auto next_lpos = cur_last.lpos(); num_copy_elem += num_copy_block_elem; // check whether the contiguous range is over at the end of the block if (cur_last == m_end || next_lpos.unit != lpos.unit || next_lpos.index != (prev_lpos.index + 1)) { break; } prev_lpos = next_lpos; } while (1); DASH_LOG_TRACE("next_range<GlobIter>", "cur_first", cur_first, "num_copy_elem", num_copy_elem); return std::make_pair(cur_first, num_copy_elem); } private: /// Start of the current contiguous range IteratorT m_pos; /// End position of the total range const IteratorT m_end; /// Number of elements in current contiguous range size_type m_num_copy_elems = 0; }; /** * Specialization for GlobPtr. */ template<typename ValueType, typename GlobMemT> struct ContiguousRangeIterator<dash::GlobPtr<ValueType, GlobMemT>> { public: /// Iterator Traits using iterator_category = std::forward_iterator_tag; using pointer_type = typename dash::GlobPtr<ValueType, GlobMemT>; using index_type = typename pointer_type::index_type; using size_type = typename pointer_type::size_type; using value_type = std::pair<pointer_type, size_type>; using Self_t = ContiguousRangeIterator<pointer_type>; DASH_CONSTEXPR ContiguousRangeIterator() = default; ContiguousRangeIterator(pointer_type begin, pointer_type end) : m_pos(begin), m_end(end) { m_num_copy_elems = next_range().second; } Self_t& operator++() { auto range = next_range(); m_pos = range.first; m_num_copy_elems = range.second; return *this; } std::pair<pointer_type, size_type> operator*() noexcept { return std::make_pair(m_pos, m_num_copy_elems); } DASH_CONSTEXPR bool operator<(const Self_t& other) const DASH_NOEXCEPT { return (m_pos < other.m_pos); } DASH_CONSTEXPR bool operator<=(const Self_t& other) const DASH_NOEXCEPT { return (m_pos <= other.m_pos); } DASH_CONSTEXPR bool operator>(const Self_t& other) const DASH_NOEXCEPT { return (m_pos > other.m_pos); } DASH_CONSTEXPR bool operator>=(const Self_t& other) const DASH_NOEXCEPT { return (m_pos >= other.m_pos); } DASH_CONSTEXPR bool operator==(const Self_t& other) const DASH_NOEXCEPT { return m_pos == other.m_pos; } DASH_CONSTEXPR bool operator!=(const Self_t& other) const DASH_NOEXCEPT { return m_pos != other.m_pos; } private: std::pair<pointer_type, size_type> next_range() const { using element_type = typename pointer_type::value_type; auto cur_first = m_pos + m_num_copy_elems; if (cur_first == m_end) { return std::make_pair(m_end, 0); } auto cur_last = cur_first; size_type num_copy_elem = 0; dart_gptr_t gptr = cur_first.dart_gptr(); auto& reg = dash::internal::MemorySpaceRegistry::GetInstance(); auto const * mem_space = static_cast<const GlobMemT *>(reg.lookup(gptr)); if (mem_space == nullptr) { // TODO: how to handle this? } // treat offsets and sizes in Bytes, convert as late as possible size_type offs = gptr.addr_or_offs.offset; dash::team_unit_t current_uid{gptr.unitid}; size_type size_at_unit = mem_space->capacity(current_uid); DASH_ASSERT_LT(offs*sizeof(element_type), size_at_unit, "Global pointer points beyond local unit!"); size_type size_left_at_unit = (size_at_unit - offs) / sizeof(element_type); if (size_left_at_unit == 0) { DASH_LOG_TRACE("next_range<GlobPtr>", "No space left at unit ", current_uid.id, ", size_at_unit ", size_at_unit, ", offs ", offs); } size_type elems_left = dash::distance(cur_first, m_end); DASH_LOG_TRACE("next_range<GlobPtr>", "size_left_at_unit ", size_left_at_unit, ", elems_left ", elems_left); // check if there is enough space at the current unit if (elems_left <= size_left_at_unit) { num_copy_elem = elems_left; } else { // go to end of current unit num_copy_elem = size_left_at_unit; } DASH_LOG_TRACE("next_range<GlobPtr>", "cur_first ", cur_first, "num_copy_elem ", num_copy_elem); return std::make_pair(cur_first, num_copy_elem); } private: /// Start of the current contiguous range pointer_type m_pos; /// End position of the total range const pointer_type m_end; /// Number of elements in current contiguous range size_type m_num_copy_elems = 0; }; template<typename IteratorT> struct ContiguousRangeSet { using iterator_type = ContiguousRangeIterator<IteratorT>; ContiguousRangeSet(IteratorT begin, IteratorT end) : m_range_begin(begin), m_range_end(end), m_end(end, end) { } iterator_type begin() const { return iterator_type(m_range_begin, m_range_end); } iterator_type end() const { return m_end; } private: const IteratorT m_range_begin; const IteratorT m_range_end; const iterator_type m_end; }; } // namespace internal } // namespace dash #endif // DASH__ITERATOR_INTERNAL_CONTIGUOUSRANGE_H__
import psycopg2 from datetime import datetime import binascii import _thread import time import socket PORT1 = 8802 def serverX(): with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s1: s1.bind(('',PORT1)) s1.listen() conn1, addr = s1.accept() with conn1: print('Server Substation 2 from:',addr) conn = psycopg2.connect(host="131.180.165.7",database="CRoF",user="postgres", password="crpg") cursor = conn.cursor() #Value id 7-15 cursor.execute('''SELECT value from objects WHERE id=7''') result = cursor.fetchone() record1 = result[0] cursor.execute('''SELECT value from objects WHERE id=8''') result = cursor.fetchone() record2 = result[0] cursor.execute('''SELECT value from objects WHERE id=9''') result = cursor.fetchone() record3 = result[0] cursor.execute('''SELECT value from objects WHERE id=10''') result = cursor.fetchone() record4 = result[0] cursor.execute('''SELECT value from objects WHERE id=11''') result = cursor.fetchone() record5 = result[0] cursor.execute('''SELECT value from objects WHERE id=12''') result = cursor.fetchone() record6 = result[0] cursor.execute('''SELECT value from objects WHERE id=13''') result = cursor.fetchone() record7 = result[0] cursor.execute('''SELECT value from objects WHERE id=14''') result = cursor.fetchone() record8 = result[0] cursor.execute('''SELECT value from objects WHERE id=15''') result = cursor.fetchone() record9 = result[0] #Value code cursor.execute('''SELECT code from objects WHERE id=7''') result = cursor.fetchone() r1 = result[0] cursor.execute('''SELECT code from objects WHERE id=8''') result = cursor.fetchone() r2 = result[0] cursor.execute('''SELECT code from objects WHERE id=9''') result = cursor.fetchone() r3 = result[0] cursor.execute('''SELECT code from objects WHERE id=10''') result = cursor.fetchone() r4 = result[0] cursor.execute('''SELECT code from objects WHERE id=11''') result = cursor.fetchone() r5 = result[0] cursor.execute('''SELECT code from objects WHERE id=12''') result = cursor.fetchone() r6 = result[0] cursor.execute('''SELECT code from objects WHERE id=13''') result = cursor.fetchone() r7 = result[0] cursor.execute('''SELECT code from objects WHERE id=14''') result = cursor.fetchone() r8 = result[0] cursor.execute('''SELECT code from objects WHERE id=15''') result = cursor.fetchone() r9 = result[0] while True: data = "a" dataxy = data.encode() try: #Format: mu01_id+value cursor.execute('''SELECT value from objects WHERE id=7''') result = cursor.fetchone() if record1 != result[0]: print(result[0]) string = "mu01_"+str(r1)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record1 = result[0] cursor.execute('''SELECT value from objects WHERE id=8''') result = cursor.fetchone() if record2 != result[0]: print(result[0]) string = "mu02_"+str(r2)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record2 = result[0] cursor.execute('''SELECT value from objects WHERE id=9''') result = cursor.fetchone() if record3 != result[0]: print(result[0]) string = "mu03_"+str(r3)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record3 = result[0] cursor.execute('''SELECT value from objects WHERE id=10''') result = cursor.fetchone() if record4 != result[0]: print(result[0]) string = "mu04_"+str(r4)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record4 = result[0] cursor.execute('''SELECT value from objects WHERE id=11''') result = cursor.fetchone() if record5 != result[0]: print(result[0]) string = "mu04_"+str(r5)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record5 = result[0] cursor.execute('''SELECT value from objects WHERE id=12''') result = cursor.fetchone() if record6 != result[0]: print(result[0]) string = "mu05_"+str(r6)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record6 = result[0] cursor.execute('''SELECT value from objects WHERE id=13''') result = cursor.fetchone() if record7 != result[0]: print(result[0]) string = "mu06_"+str(r7)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record7 = result[0] cursor.execute('''SELECT value from objects WHERE id=14''') result = cursor.fetchone() if record8 != result[0]: print(result[0]) string = "mu06_"+str(r8)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record8 = result[0] cursor.execute('''SELECT value from objects WHERE id=15''') result = cursor.fetchone() if record9 != result[0]: print(result[0]) string = "mu06_"+str(r9)+"+"+str(result[0]) datax = string.encode() conn1.sendall(datax) print(string) record9 = result[0] conn1.sendall(dataxy) #print(record1) time.sleep(1) except: conn1.close() conn.close() print("Connection Close Substation 2") break conn1.close() print("Restart Server Substation 2") conn.close() s1.close() time.sleep(1) serverX() serverX()
import Vue from 'vue'; import App from '@modules/Demo'; new Vue({ el: '#app', render: h => h(App), });
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putstr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: flklein <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/09/18 11:56:08 by flklein #+# #+# */ /* Updated: 2018/09/19 10:36:53 by flklein ### ########.fr */ /* */ /* ************************************************************************** */ #include "bsq.h" void ft_putstr(char *str) { write(1, str, ft_strlen(str)); }
'use strict'; const admin = require('firebase-admin'); /* eslint-disable import/no-unresolved */ const serviceAccount = require('./../fb.json'); admin.initializeApp({ credential: admin.credential.cert(serviceAccount), databaseURL: process.env.FIREBASE_URL, }); module.exports = admin;
export { default, initialize } from 'nullbase-core/initializers/nb-textarea-theme-init';