How to use sns method in pact-foundation-pact

Best JavaScript code snippet using pact-foundation-pact

config.js

Source:config.js Github

copy

Full Screen

1import {ClassFeatures} from "./classFeatures.js"2// Namespace Configuration Values3export const SNS = {};4// ASCII Artwork5SNS.ASCII = `_______________________________6______ ______ _____ _____7| _ \\___ | _ \\ ___| ___|8| | | ( _ ) | | | |___ \\| |__9| | | / _ \\/\\ | | | \\ \\ __|10| |/ / (_> < |/ //\\__/ / |___11|___/ \\___/\\/___/ \\____/\\____/12_______________________________`;13/**14 * The set of Ability Scores used within the system15 * @type {Object}16 */17SNS.abilities = {18 "str": "SNS.AbilityStr",19 "dex": "SNS.AbilityDex",20 "con": "SNS.AbilityCon",21 "int": "SNS.AbilityInt",22 "wis": "SNS.AbilityWis",23 "cha": "SNS.AbilityCha"24};25SNS.abilityAbbreviations = {26 "str": "SNS.AbilityStrAbbr",27 "dex": "SNS.AbilityDexAbbr",28 "con": "SNS.AbilityConAbbr",29 "int": "SNS.AbilityIntAbbr",30 "wis": "SNS.AbilityWisAbbr",31 "cha": "SNS.AbilityChaAbbr"32};33/* -------------------------------------------- */34/**35 * Character alignment options36 * @type {Object}37 */38SNS.alignments = {39 'lg': "SNS.AlignmentLG",40 'ng': "SNS.AlignmentNG",41 'cg': "SNS.AlignmentCG",42 'ln': "SNS.AlignmentLN",43 'tn': "SNS.AlignmentTN",44 'cn': "SNS.AlignmentCN",45 'le': "SNS.AlignmentLE",46 'ne': "SNS.AlignmentNE",47 'ce': "SNS.AlignmentCE"48};49/* -------------------------------------------- */50/**51 * An enumeration of item attunement types52 * @enum {number}53 */54SNS.attunementTypes = {55 NONE: 0,56 REQUIRED: 1,57 ATTUNED: 2,58}59/**60 * An enumeration of item attunement states61 * @type {{"0": string, "1": string, "2": string}}62 */63SNS.attunements = {64 0: "SNS.AttunementNone",65 1: "SNS.AttunementRequired",66 2: "SNS.AttunementAttuned"67};68/* -------------------------------------------- */69SNS.weaponProficiencies = {70 "sim": "SNS.WeaponSimpleProficiency",71 "mar": "SNS.WeaponMartialProficiency"72};73/**74 * A map of weapon item proficiency to actor item proficiency75 * Used when a new player owned item is created76 * @type {Object}77 */78SNS.weaponProficienciesMap = {79 "natural": true,80 "simpleM": "sim",81 "simpleR": "sim",82 "martialM": "mar",83 "martialR": "mar"84}85/**86 * The basic weapon types in sns. This enables specific weapon proficiencies or87 * starting equipment provided by classes and backgrounds.88 *89 * @enum {string}90 */91SNS.weaponIds = {92 "battleaxe": "I0WocDSuNpGJayPb",93 "blowgun": "wNWK6yJMHG9ANqQV",94 "club": "nfIRTECQIG81CvM4",95 "dagger": "0E565kQUBmndJ1a2",96 "dart": "3rCO8MTIdPGSW6IJ",97 "flail": "UrH3sMdnUDckIHJ6",98 "glaive": "rOG1OM2ihgPjOvFW",99 "greataxe": "1Lxk6kmoRhG8qQ0u",100 "greatclub": "QRCsxkCwWNwswL9o",101 "greatsword": "xMkP8BmFzElcsMaR",102 "halberd": "DMejWAc8r8YvDPP1",103 "handaxe": "eO7Fbv5WBk5zvGOc",104 "handcrossbow": "qaSro7kFhxD6INbZ",105 "heavycrossbow": "RmP0mYRn2J7K26rX",106 "javelin": "DWLMnODrnHn8IbAG",107 "lance": "RnuxdHUAIgxccVwj",108 "lightcrossbow": "ddWvQRLmnnIS0eLF",109 "lighthammer": "XVK6TOL4sGItssAE",110 "longbow": "3cymOVja8jXbzrdT",111 "longsword": "10ZP2Bu3vnCuYMIB",112 "mace": "Ajyq6nGwF7FtLhDQ",113 "maul": "DizirD7eqjh8n95A",114 "morningstar": "dX8AxCh9o0A9CkT3",115 "net": "aEiM49V8vWpWw7rU",116 "pike": "tC0kcqZT9HHAO0PD",117 "quarterstaff": "g2dWN7PQiMRYWzyk",118 "rapier": "Tobce1hexTnDk4sV",119 "scimitar": "fbC0Mg1a73wdFbqO",120 "shortsword": "osLzOwQdPtrK3rQH",121 "sickle": "i4NeNZ30ycwPDHMx",122 "spear": "OG4nBBydvmfWYXIk",123 "shortbow": "GJv6WkD7D2J6rP6M",124 "sling": "3gynWO9sN4OLGMWD",125 "trident": "F65ANO66ckP8FDMa",126 "warpick": "2YdfjN1PIIrSHZii",127 "warhammer": "F0Df164Xv1gWcYt0",128 "whip": "QKTyxoO0YDnAsbYe"129};130/* -------------------------------------------- */131SNS.toolProficiencies = {132 "art": "SNS.ToolArtisans",133 "disg": "SNS.ToolDisguiseKit",134 "forg": "SNS.ToolForgeryKit",135 "game": "SNS.ToolGamingSet",136 "herb": "SNS.ToolHerbalismKit",137 "music": "SNS.ToolMusicalInstrument",138 "navg": "SNS.ToolNavigators",139 "pois": "SNS.ToolPoisonersKit",140 "thief": "SNS.ToolThieves",141 "vehicle": "SNS.ToolVehicle"142};143/**144 * The basic tool types in sns. This enables specific tool proficiencies or145 * starting equipment provided by classes and backgrounds.146 *147 * @enum {string}148 */149SNS.toolIds = {150 "alchemist": "SztwZhbhZeCqyAes",151 "bagpipes": "yxHi57T5mmVt0oDr",152 "brewer": "Y9S75go1hLMXUD48",153 "calligrapher": "jhjo20QoiD5exf09",154 "card": "YwlHI3BVJapz4a3E",155 "carpenter": "8NS6MSOdXtUqD7Ib",156 "cartographer": "fC0lFK8P4RuhpfaU",157 "cobbler": "hM84pZnpCqKfi8XH",158 "cook": "Gflnp29aEv5Lc1ZM",159 "dice": "iBuTM09KD9IoM5L8",160 "disg": "IBhDAr7WkhWPYLVn",161 "drum": "69Dpr25pf4BjkHKb",162 "dulcimer": "NtdDkjmpdIMiX7I2",163 "flute": "eJOrPcAz9EcquyRQ",164 "forg": "cG3m4YlHfbQlLEOx",165 "glassblower": "rTbVrNcwApnuTz5E",166 "herb": "i89okN7GFTWHsvPy",167 "horn": "aa9KuBy4dst7WIW9",168 "jeweler": "YfBwELTgPFHmQdHh",169 "leatherworker": "PUMfwyVUbtyxgYbD",170 "lute": "qBydtUUIkv520DT7",171 "lyre": "EwG1EtmbgR3bM68U",172 "mason": "skUih6tBvcBbORzA",173 "navg": "YHCmjsiXxZ9UdUhU",174 "painter": "ccm5xlWhx74d6lsK",175 "panflute": "G5m5gYIx9VAUWC3J",176 "pois": "il2GNi8C0DvGLL9P",177 "potter": "hJS8yEVkqgJjwfWa",178 "shawm": "G3cqbejJpfB91VhP",179 "smith": "KndVe2insuctjIaj",180 "thief": "woWZ1sO5IUVGzo58",181 "tinker": "0d08g1i5WXnNrCNA",182 "viol": "baoe3U5BfMMMxhCU",183 "weaver": "ap9prThUB2y9lDyj",184 "woodcarver": "xKErqkLo4ASYr5EP",185};186/* -------------------------------------------- */187/**188 * This Object defines the various lengths of time which can occur189 * @type {Object}190 */191SNS.timePeriods = {192 "inst": "SNS.TimeInst",193 "turn": "SNS.TimeTurn",194 "round": "SNS.TimeRound",195 "minute": "SNS.TimeMinute",196 "hour": "SNS.TimeHour",197 "day": "SNS.TimeDay",198 "month": "SNS.TimeMonth",199 "year": "SNS.TimeYear",200 "perm": "SNS.TimePerm",201 "spec": "SNS.Special"202};203/* -------------------------------------------- */204/**205 * This describes the ways that an ability can be activated206 * @type {Object}207 */208SNS.abilityActivationTypes = {209 "none": "SNS.None",210 "action": "SNS.Action",211 "bonus": "SNS.BonusAction",212 "reaction": "SNS.Reaction",213 "minute": SNS.timePeriods.minute,214 "hour": SNS.timePeriods.hour,215 "day": SNS.timePeriods.day,216 "special": SNS.timePeriods.spec,217 "legendary": "SNS.LegAct",218 "shipact": "SNS.ShipAct",219 "lair": "SNS.LairAct",220 "crew": "SNS.VehicleCrewAction"221};222/* -------------------------------------------- */223SNS.abilityConsumptionTypes = {224 "ammo": "SNS.ConsumeAmmunition",225 "attribute": "SNS.ConsumeAttribute",226 "material": "SNS.ConsumeMaterial",227 "charges": "SNS.ConsumeCharges"228};229/* -------------------------------------------- */230// Creature Sizes231SNS.actorSizes = {232 "tiny": "SNS.SizeTiny",233 "sm": "SNS.SizeSmall",234 "med": "SNS.SizeMedium",235 "lg": "SNS.SizeLarge",236 "huge": "SNS.SizeHuge",237 "grg": "SNS.SizeGargantuan"238};239SNS.tokenSizes = {240 "tiny": 0.6,241 "sm": 0.8,242 "med": 1,243 "lg": 2,244 "huge": 3,245 "grg": 4246};247/**248 * Colors used to visualize temporary and temporary maximum HP in token health bars249 * @enum {number}250 */251SNS.tokenHPColors = {252 temp: 0x66CCFF,253 tempmax: 0x440066,254 negmax: 0x550000255}256/* -------------------------------------------- */257/**258 * Creature types259 * @type {Object}260 */261SNS.creatureTypes = {262 "aberration": "SNS.CreatureAberration",263 "beast": "SNS.CreatureBeast",264 "celestial": "SNS.CreatureCelestial",265 "construct": "SNS.CreatureConstruct",266 "dragon": "SNS.CreatureDragon",267 "elemental": "SNS.CreatureElemental",268 "fey": "SNS.CreatureFey",269 "fiend": "SNS.CreatureFiend",270 "giant": "SNS.CreatureGiant",271 "humanoid": "SNS.CreatureHumanoid",272 "monstrosity": "SNS.CreatureMonstrosity",273 "ooze": "SNS.CreatureOoze",274 "plant": "SNS.CreaturePlant",275 "undead": "SNS.CreatureUndead"276};277/* -------------------------------------------- */278/* -------------------------------------------- */279// Vehicle Classifications280SNS.actorVehicleClasses = {281 "terClass": "SNS.VehicleClassificationTerrestrial",282 "shipClass": "SNS.VehicleClassificationSpaceship"283};284/* -------------------------------------------- */285/**286 * Classification types for item action types287 * @type {Object}288 */289SNS.itemActionTypes = {290 "mwak": "SNS.ActionMWAK",291 "rwak": "SNS.ActionRWAK",292 "msak": "SNS.ActionMSAK",293 "rsak": "SNS.ActionRSAK",294 "save": "SNS.ActionSave",295 "heal": "SNS.ActionHeal",296 "abil": "SNS.ActionAbil",297 "util": "SNS.ActionUtil",298 "other": "SNS.ActionOther"299};300/* -------------------------------------------- */301SNS.itemCapacityTypes = {302 "items": "SNS.ItemContainerCapacityItems",303 "weight": "SNS.ItemContainerCapacityWeight"304};305/* -------------------------------------------- */306/**307 * Enumerate the lengths of time over which an item can have limited use ability308 * @type {Object}309 */310SNS.limitedUsePeriods = {311 "sr": "SNS.ShortRest",312 "lr": "SNS.LongRest",313 "day": "SNS.Day",314 "charges": "SNS.Charges"315};316/* -------------------------------------------- */317/**318 * The set of equipment types for armor, clothing, and other objects which can ber worn by the character319 * @type {Object}320 */321SNS.equipmentTypes = {322 "light": "SNS.EquipmentLight",323 "medium": "SNS.EquipmentMedium",324 "heavy": "SNS.EquipmentHeavy",325 "bonus": "SNS.EquipmentBonus",326 "natural": "SNS.EquipmentNatural",327 "shield": "SNS.EquipmentShield",328 "clothing": "SNS.EquipmentClothing",329 "modification": "SNS.EquipmentModification",330 "cyberware": "SNS.EquipmentCyberware",331 "bioware": "SNS.EquipmentBioware",332 "mageware": "SNS.EquipmentMageware",333 "computer": "SNS.EquipmentComputer",334 "software": "SNS.EquipmentSoftware",335 "trinket": "SNS.EquipmentTrinket",336 "vehicle": "SNS.EquipmentVehicle"337};338/* -------------------------------------------- */339/**340 * The set of Armor Proficiencies which a character may have341 * @type {Object}342 */343SNS.armorProficiencies = {344 "lgt": SNS.equipmentTypes.light,345 "med": SNS.equipmentTypes.medium,346 "hvy": SNS.equipmentTypes.heavy,347 "shl": "SNS.EquipmentShieldProficiency"348};349/**350 * A map of armor item proficiency to actor item proficiency351 * Used when a new player owned item is created352 * @type {Object}353 */354SNS.armorProficienciesMap = {355 "natural": true,356 "clothing": true,357 "light": "lgt",358 "medium": "med",359 "heavy": "hvy",360 "shield": "shl"361}362/* -------------------------------------------- */363/**364 * Enumerate the valid consumable types which are recognized by the system365 * @type {Object}366 */367SNS.consumableTypes = {368 "ammo": "SNS.ConsumableAmmunition",369 "explosive": "SNS.ConsumableExplosive",370 "potion": "SNS.ConsumablePotion",371 "poison": "SNS.ConsumablePoison",372 "drug": "SNS.ConsumableDrug",373 "food": "SNS.ConsumableFood",374 "scroll": "SNS.ConsumableScroll",375 "wand": "SNS.ConsumableWand",376 "rod": "SNS.ConsumableRod",377 "trinket": "SNS.ConsumableTrinket"378};379/* -------------------------------------------- */380/**381 * The valid currency denominations supported by the SnS system382 * @type {Object}383 */384SNS.currencies = {385 "gp": "SNS.CurrencyGP",386 "cc": "SNS.CurrencyCC"387};388/* -------------------------------------------- */389// Damage Types390SNS.damageTypes = {391 "acid": "SNS.DamageAcid",392 "ballistic": "SNS.DamageBallistic",393 "bludgeoning": "SNS.DamageBludgeoning",394 "cold": "SNS.DamageCold",395 "fire": "SNS.DamageFire",396 "force": "SNS.DamageForce",397 "lightning": "SNS.DamageLightning",398 "necrotic": "SNS.DamageNecrotic",399 "piercing": "SNS.DamagePiercing",400 "plasma": "SNS.DamagePlasma",401 "poison": "SNS.DamagePoison",402 "psychic": "SNS.DamagePsychic",403 "radiant": "SNS.DamageRadiant",404 "slashing": "SNS.DamageSlashing",405 "thunder": "SNS.DamageThunder"406};407// Damage Resistance Types408SNS.damageResistanceTypes = mergeObject(foundry.utils.deepClone(SNS.damageTypes), {409 "physical": "SNS.DamagePhysical"410});411/* -------------------------------------------- */412/**413 * The valid units of measure for movement distances in the game system.414 * By default this uses the imperial units of feet and miles.415 * @type {Object<string,string>}416 */417SNS.movementTypes = {418 "burrow": "SNS.MovementBurrow",419 "climb": "SNS.MovementClimb",420 "fly": "SNS.MovementFly",421 "swim": "SNS.MovementSwim",422 "zerog": "SNS.MovementZeroG",423 "walk": "SNS.MovementWalk",424 "maxspeed": "SNS.MovementMaxSpeed",425 "mph": "SNS.MovementMPH",426}427/**428 * The valid units of measure for movement distances in the game system.429 * By default this uses the imperial units of feet and miles.430 * @type {Object<string,string>}431 */432SNS.movementUnits = {433 "ft": "SNS.DistFt",434 "mi": "SNS.DistMi",435 "arc": "SNS.DistArc"436}437/**438 * The valid units of measure for the range of an action or effect.439 * This object automatically includes the movement units from SNS.movementUnits440 * @type {Object<string,string>}441 */442SNS.distanceUnits = {443 "none": "SNS.None",444 "self": "SNS.DistSelf",445 "touch": "SNS.DistTouch",446 "spec": "SNS.Special",447 "any": "SNS.DistAny"448};449for ( let [k, v] of Object.entries(SNS.movementUnits) ) {450 SNS.distanceUnits[k] = v;451}452/* -------------------------------------------- */453/**454 * Configure aspects of encumbrance calculation so that it could be configured by modules455 * @type {Object}456 */457SNS.encumbrance = {458 currencyPerWeight: 1000000000,459 strMultiplier: 15,460 vehicleWeightMultiplier: 2000 // 2000 lbs in a ton461};462/* -------------------------------------------- */463/**464 * This Object defines the types of single or area targets which can be applied465 * @type {Object}466 */467SNS.targetTypes = {468 "none": "SNS.None",469 "self": "SNS.TargetSelf",470 "creature": "SNS.TargetCreature",471 "ally": "SNS.TargetAlly",472 "enemy": "SNS.TargetEnemy",473 "object": "SNS.TargetObject",474 "space": "SNS.TargetSpace",475 "radius": "SNS.TargetRadius",476 "sphere": "SNS.TargetSphere",477 "cylinder": "SNS.TargetCylinder",478 "cone": "SNS.TargetCone",479 "square": "SNS.TargetSquare",480 "cube": "SNS.TargetCube",481 "line": "SNS.TargetLine",482 "wall": "SNS.TargetWall"483};484/* -------------------------------------------- */485/**486 * Map the subset of target types which produce a template area of effect487 * The keys are SNS target types and the values are MeasuredTemplate shape types488 * @type {Object}489 */490SNS.areaTargetTypes = {491 cone: "cone",492 cube: "rect",493 cylinder: "circle",494 line: "ray",495 radius: "circle",496 sphere: "circle",497 square: "rect",498 wall: "ray"499};500/* -------------------------------------------- */501// Healing Types502SNS.healingTypes = {503 "healing": "SNS.Healing",504 "temphp": "SNS.HealingTemp"505};506/* -------------------------------------------- */507/**508 * Enumerate the denominations of hit dice which can apply to classes509 * @type {Array.<string>}510 */511SNS.hitDieTypes = ["d6", "d8", "d10", "d12"];512/* -------------------------------------------- */513/**514 * The set of possible sensory perception types which an Actor may have515 * @type {object}516 */517SNS.senses = {518 "blindsight": "SNS.SenseBlindsight",519 "darkvision": "SNS.SenseDarkvision",520 "ultraviolet": "SNS.SenseUltraviolet",521 "infrared": "SNS.SenseInfrared",522 "tremorsense": "SNS.SenseTremorsense",523 "truesight": "SNS.SenseTruesight"524};525/* -------------------------------------------- */526/**527 * The set of skill which can be trained528 * @type {Object}529 */530SNS.skills = {531 "acr": "SNS.SkillAcr",532 "arc": "SNS.SkillArc",533 "com": "SNS.SkillCom",534 "ath": "SNS.SkillAth",535 "dec": "SNS.SkillDec",536 "eti": "SNS.SkillEti",537 "his": "SNS.SkillHis",538 "ins": "SNS.SkillIns",539 "itm": "SNS.SkillItm",540 "inv": "SNS.SkillInv",541 "mec": "SNS.SkillMec",542 "med": "SNS.SkillMed",543 "prc": "SNS.SkillPrc",544 "per": "SNS.SkillPer",545 "pil": "SNS.SkillPil",546 "sci": "SNS.SkillSci",547 "ste": "SNS.SkillSte",548 "sur": "SNS.SkillSur"549};550/* -------------------------------------------- */551SNS.spellPreparationModes = {552 "prepared": "SNS.SpellPrepPrepared",553 "pact": "SNS.PactMagic",554 "always": "SNS.SpellPrepAlways",555 "atwill": "SNS.SpellPrepAtWill",556 "innate": "SNS.SpellPrepInnate",557 "invention": "SNS.Invention",558 "battery": "SNS.Battery"559};560SNS.spellUpcastModes = ["always", "pact", "prepared", "battery"];561SNS.spellProgression = {562 "none": "SNS.SpellNone",563 "full": "SNS.SpellProgFull",564 "half": "SNS.SpellProgHalf",565 "third": "SNS.SpellProgThird",566 "pact": "SNS.SpellProgPact",567 "artificer": "SNS.SpellProgArt",568 "psion": "SNS.SpellProgPsion",569 "battery": "SNS.SpellProgBattery"570};571/* -------------------------------------------- */572/**573 * The available choices for how spell damage scaling may be computed574 * @type {Object}575 */576SNS.spellScalingModes = {577 "none": "SNS.SpellNone",578 "cantrip": "SNS.SpellCantrip",579 "level": "SNS.SpellLevel"580};581/* -------------------------------------------- */582/**583 * Define the set of types which a weapon item can take584 * @type {Object}585 */586SNS.weaponTypes = {587 "simpleM": "SNS.WeaponSimpleM",588 "simpleR": "SNS.WeaponSimpleR",589 "martialM": "SNS.WeaponMartialM",590 "martialR": "SNS.WeaponMartialR",591 "natural": "SNS.WeaponNatural",592 "improv": "SNS.WeaponImprov",593 "siege": "SNS.WeaponSiege"594};595/* -------------------------------------------- */596/**597 * Define the set of weapon property flags which can exist on a weapon598 * @type {Object}599 */600SNS.weaponProperties = {601 "ada": "SNS.WeaponPropertiesAda",602 "aut": "SNS.WeaponPropertiesAut",603 "amm": "SNS.WeaponPropertiesAmm",604 "bul": "SNS.WeaponPropertiesBul",605 "blin": "SNS.WeaponPropertiesBlin",606 "dst": "SNS.WeaponPropertiesDst",607 "deaf": "SNS.WeaponPropertiesDeaf",608 "deto": "SNS.WeaponPropertiesDeto",609 "fin": "SNS.WeaponPropertiesFin",610 "fir": "SNS.WeaponPropertiesFir",611 "foc": "SNS.WeaponPropertiesFoc",612 "hvy": "SNS.WeaponPropertiesHvy",613 "lgt": "SNS.WeaponPropertiesLgt",614 "lod": "SNS.WeaponPropertiesLod",615 "mgc": "SNS.WeaponPropertiesMgc",616 "ram": "SNS.WeaponPropertiesRam",617 "radi": "SNS.WeaponPropertiesRadi",618 "rch": "SNS.WeaponPropertiesRch",619 "rech": "SNS.WeaponPropertiesRech",620 "rel": "SNS.WeaponPropertiesRel",621 "ret": "SNS.WeaponPropertiesRet",622 "scp": "SNS.WeaponPropertiesScp",623 "shk": "SNS.WeaponPropertiesShk",624 "sic": "SNS.WeaponPropertiesSic",625 "sil": "SNS.WeaponPropertiesSil",626 "slow": "SNS.WeaponPropertiesSlow",627 "spc": "SNS.WeaponPropertiesSpc",628 "stk": "SNS.WeaponPropertiesStk",629 "crf": "SNS.WeaponPropertiesCrf",630 "cone": "SNS.WeaponPropertiesCone",631 "thr": "SNS.WeaponPropertiesThr",632 "tmr": "SNS.WeaponPropertiesTmr",633 "two": "SNS.WeaponPropertiesTwo",634 "ver": "SNS.WeaponPropertiesVer",635 "vhc": "SNS.WeaponPropertiesVhc"636};637// Spell Components638SNS.spellComponents = {639 "V": "SNS.ComponentVerbal",640 "S": "SNS.ComponentSomatic",641 "M": "SNS.ComponentMaterial"642};643// Spell Schools644SNS.spellSchools = {645 "abj": "SNS.SchoolAbj",646 "con": "SNS.SchoolCon",647 "div": "SNS.SchoolDiv",648 "enc": "SNS.SchoolEnc",649 "evo": "SNS.SchoolEvo",650 "ill": "SNS.SchoolIll",651 "nec": "SNS.SchoolNec",652 "trs": "SNS.SchoolTrs"653};654// Spell Levels655SNS.spellLevels = {656 0: "SNS.SpellLevel0",657 1: "SNS.SpellLevel1",658 2: "SNS.SpellLevel2",659 3: "SNS.SpellLevel3",660 4: "SNS.SpellLevel4",661 5: "SNS.SpellLevel5",662 6: "SNS.SpellLevel6",663 7: "SNS.SpellLevel7",664 8: "SNS.SpellLevel8",665 9: "SNS.SpellLevel9"666};667// Spell Scroll Compendium UUIDs668SNS.spellScrollIds = {669 0: 'Compendium.sns.items.rQ6sO7HDWzqMhSI3',670 1: 'Compendium.sns.items.9GSfMg0VOA2b4uFN',671 2: 'Compendium.sns.items.XdDp6CKh9qEvPTuS',672 3: 'Compendium.sns.items.hqVKZie7x9w3Kqds',673 4: 'Compendium.sns.items.DM7hzgL836ZyUFB1',674 5: 'Compendium.sns.items.wa1VF8TXHmkrrR35',675 6: 'Compendium.sns.items.tI3rWx4bxefNCexS',676 7: 'Compendium.sns.items.mtyw4NS1s7j2EJaD',677 8: 'Compendium.sns.items.aOrinPg7yuDZEuWr',678 9: 'Compendium.sns.items.O4YbkJkLlnsgUszZ'679};680/**681 * Define the standard slot progression by character level.682 * The entries of this array represent the spell slot progression for a full spell-caster.683 * @type {Array[]}684 */685SNS.SPELL_SLOT_TABLE = [686 [2],687 [3],688 [4, 2],689 [4, 3],690 [4, 3, 2],691 [4, 3, 3],692 [4, 3, 3, 1],693 [4, 3, 3, 2],694 [4, 3, 3, 3, 1],695 [4, 3, 3, 3, 2],696 [4, 3, 3, 3, 2, 1],697 [4, 3, 3, 3, 2, 1],698 [4, 3, 3, 3, 2, 1, 1],699 [4, 3, 3, 3, 2, 1, 1],700 [4, 3, 3, 3, 2, 1, 1, 1],701 [4, 3, 3, 3, 2, 1, 1, 1],702 [4, 3, 3, 3, 2, 1, 1, 1, 1],703 [4, 3, 3, 3, 3, 1, 1, 1, 1],704 [4, 3, 3, 3, 3, 2, 1, 1, 1],705 [4, 3, 3, 3, 3, 2, 2, 1, 1]706];707/* -------------------------------------------- */708/**709 * Define the psion slot progression by character level.710 * The entries of this array represent the spell slot progression for a Psion-type spell-caster.711 * @type {Array[]}712 */713SNS.PSION_SPELL_SLOT_TABLE = [714 [2],715 [3],716 [3],717 [4, 2],718 [4, 2],719 [4, 3],720 [4, 3, 2],721 [4, 3, 2],722 [4, 3, 2],723 [4, 3, 3, 2],724 [4, 3, 3, 2],725 [4, 3, 3, 2],726 [4, 3, 3, 2, 2],727 [4, 3, 3, 3, 2],728 [4, 3, 3, 3, 2],729 [4, 3, 3, 3, 2],730 [4, 3, 3, 3, 2],731 [4, 4, 3, 3, 3],732 [4, 4, 3, 3, 3],733 [4, 4, 3, 3, 3]734];735/* -------------------------------------------- */736// Polymorph options.737SNS.polymorphSettings = {738 keepPhysical: 'SNS.PolymorphKeepPhysical',739 keepMental: 'SNS.PolymorphKeepMental',740 keepSaves: 'SNS.PolymorphKeepSaves',741 keepSkills: 'SNS.PolymorphKeepSkills',742 mergeSaves: 'SNS.PolymorphMergeSaves',743 mergeSkills: 'SNS.PolymorphMergeSkills',744 keepClass: 'SNS.PolymorphKeepClass',745 keepFeats: 'SNS.PolymorphKeepFeats',746 keepSpells: 'SNS.PolymorphKeepSpells',747 keepItems: 'SNS.PolymorphKeepItems',748 keepBio: 'SNS.PolymorphKeepBio',749 keepVision: 'SNS.PolymorphKeepVision'750};751/* -------------------------------------------- */752/**753 * Skill, ability, and tool proficiency levels754 * Each level provides a proficiency multiplier755 * @type {Object}756 */757SNS.proficiencyLevels = {758 0: "SNS.NotProficient",759 1: "SNS.Proficient",760 0.5: "SNS.HalfProficient",761 2: "SNS.Expertise"762};763/* -------------------------------------------- */764/**765 * The amount of cover provided by an object.766 * In cases where multiple pieces of cover are767 * in play, we take the highest value.768 */769SNS.cover = {770 0: 'SNS.None',771 .5: 'SNS.CoverHalf',772 .75: 'SNS.CoverThreeQuarters',773 1: 'SNS.CoverTotal'774};775/* -------------------------------------------- */776// Condition Types777SNS.conditionTypes = {778 "blinded": "SNS.ConBlinded",779 "charmed": "SNS.ConCharmed",780 "deafened": "SNS.ConDeafened",781 "diseased": "SNS.ConDiseased",782 "exhaustion": "SNS.ConExhaustion",783 "frightened": "SNS.ConFrightened",784 "grappled": "SNS.ConGrappled",785 "incapacitated": "SNS.ConIncapacitated",786 "invisible": "SNS.ConInvisible",787 "paralyzed": "SNS.ConParalyzed",788 "petrified": "SNS.ConPetrified",789 "poisoned": "SNS.ConPoisoned",790 "prone": "SNS.ConProne",791 "restrained": "SNS.ConRestrained",792 "stunned": "SNS.ConStunned",793 "unconscious": "SNS.ConUnconscious"794};795// Languages796SNS.languages = {797 "binary": "SNS.LanguagesBinary",798 "brahvish": "SNS.LanguagesBrahvish",799 "celestial": "SNS.LanguagesCelestial",800 "domosian": "SNS.LanguagesDomosian",801 "eezonese": "SNS.LanguagesEezonese",802 "eldritch": "SNS.LanguagesEldritch",803 "galactic": "SNS.LanguagesGalactic",804 "galacticsign": "SNS.LanguagesGalacticSign",805 "glabraunish": "SNS.LanguagesGlabraunish",806 "hanadarian": "SNS.LanguagesHanadarian",807 "infernal": "SNS.LanguagesInfernal",808 "ixian": "SNS.LanguagesIxian",809 "kygoran": "SNS.LanguagesKygoran",810 "luminescentsign": "SNS.LanguagesLuminescentSign",811 "maeshar": "SNS.LanguagesMaeshar",812 "moiccaran": "SNS.LanguagesMoiccaran",813 "olaran": "SNS.LanguagesOlaran",814 "piranthese": "SNS.LanguagesPiranthese",815 "primordial": "SNS.LanguagesPrimordial",816 "sylvan": "SNS.LanguagesSylvan",817 "cant": "SNS.LanguagesThievesCant",818 "veeruxian": "SNS.LanguagesVeeruxian",819 "vresnish": "SNS.LanguagesVresnish"820};821// Character Level XP Requirements822SNS.CHARACTER_EXP_LEVELS = [823 0, 300, 900, 2700, 6500, 14000, 23000, 34000, 48000, 64000, 85000, 100000,824 120000, 140000, 165000, 195000, 225000, 265000, 305000, 355000]825;826// Challenge Rating XP Levels827SNS.CR_EXP_LEVELS = [828 10, 200, 450, 700, 1100, 1800, 2300, 2900, 3900, 5000, 5900, 7200, 8400, 10000, 11500, 13000, 15000, 18000,829 20000, 22000, 25000, 33000, 41000, 50000, 62000, 75000, 90000, 105000, 120000, 135000, 155000830];831// Tier XP Levels832SNS.TIER_EXP_LEVELS = [833 10, 1100, 3900, 8400, 15000, 25000, 62000, 93000834];835// Character Features Per Class And Level836SNS.classFeatures = ClassFeatures;837// Configure Optional Character Flags838SNS.characterFlags = {839 "diamondSoul": {840 name: "SNS.FlagsDiamondSoul",841 hint: "SNS.FlagsDiamondSoulHint",842 section: "SNS.Feats",843 type: Boolean844 },845 "elvenAccuracy": {846 name: "SNS.FlagsElvenAccuracy",847 hint: "SNS.FlagsElvenAccuracyHint",848 section: "SNS.RacialTraits",849 type: Boolean850 },851 "halflingLucky": {852 name: "SNS.FlagsHalflingLucky",853 hint: "SNS.FlagsHalflingLuckyHint",854 section: "SNS.RacialTraits",855 type: Boolean856 },857 "initiativeAdv": {858 name: "SNS.FlagsInitiativeAdv",859 hint: "SNS.FlagsInitiativeAdvHint",860 section: "SNS.Feats",861 type: Boolean862 },863 "initiativeAlert": {864 name: "SNS.FlagsAlert",865 hint: "SNS.FlagsAlertHint",866 section: "SNS.Feats",867 type: Boolean868 },869 "jackOfAllTrades": {870 name: "SNS.FlagsJOAT",871 hint: "SNS.FlagsJOATHint",872 section: "SNS.Feats",873 type: Boolean874 },875 "observantFeat": {876 name: "SNS.FlagsObservant",877 hint: "SNS.FlagsObservantHint",878 skills: ['prc','inv'],879 section: "SNS.Feats",880 type: Boolean881 },882 "powerfulBuild": {883 name: "SNS.FlagsPowerfulBuild",884 hint: "SNS.FlagsPowerfulBuildHint",885 section: "SNS.RacialTraits",886 type: Boolean887 },888 "reliableTalent": {889 name: "SNS.FlagsReliableTalent",890 hint: "SNS.FlagsReliableTalentHint",891 section: "SNS.Feats",892 type: Boolean893 },894 "remarkableAthlete": {895 name: "SNS.FlagsRemarkableAthlete",896 hint: "SNS.FlagsRemarkableAthleteHint",897 abilities: ['str','dex','con'],898 section: "SNS.Feats",899 type: Boolean900 },901 "weaponCriticalThreshold": {902 name: "SNS.FlagsWeaponCritThreshold",903 hint: "SNS.FlagsWeaponCritThresholdHint",904 section: "SNS.Feats",905 type: Number,906 placeholder: 20907 },908 "spellCriticalThreshold": {909 name: "SNS.FlagsSpellCritThreshold",910 hint: "SNS.FlagsSpellCritThresholdHint",911 section: "SNS.Feats",912 type: Number,913 placeholder: 20914 },915 "meleeCriticalDamageDice": {916 name: "SNS.FlagsMeleeCriticalDice",917 hint: "SNS.FlagsMeleeCriticalDiceHint",918 section: "SNS.Feats",919 type: Number,920 placeholder: 0921 },922};923// Configure allowed status flags...

Full Screen

Full Screen

rec.py

Source:rec.py Github

copy

Full Screen

1#explore ux2#utf8 unicoding3from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException4from thrift.protocol.TProtocol import TProtocolException5from thrift.TRecursive import fix_spec6import sys7import logging8from .ttypes import *9from thrift.Thrift import TProcessor10from thrift.transport import TTransport11all_structs = []12class Iface(object):13 def getSnsFriends(self, snsIdType, snsAccessToken, startIdx, limit):14 """15 Parameters:16 - snsIdType17 - snsAccessToken18 - startIdx19 - limit20 """21 pass22 def getSnsMyProfile(self, snsIdType, snsAccessToken):23 """24 Parameters:25 - snsIdType26 - snsAccessToken27 """28 pass29 def postSnsInvitationMessage(self, snsIdType, snsAccessToken, toSnsUserId):30 """31 Parameters:32 - snsIdType33 - snsAccessToken34 - toSnsUserId35 """36 pass37class Client(Iface):38 def __init__(self, iprot, oprot=None):39 self._iprot = self._oprot = iprot40 if oprot is not None:41 self._oprot = oprot42 self._seqid = 043 def getSnsFriends(self, snsIdType, snsAccessToken, startIdx, limit):44 """45 Parameters:46 - snsIdType47 - snsAccessToken48 - startIdx49 - limit50 """51 self.send_getSnsFriends(snsIdType, snsAccessToken, startIdx, limit)52 return self.recv_getSnsFriends()53 def send_getSnsFriends(self, snsIdType, snsAccessToken, startIdx, limit):54 self._oprot.writeMessageBegin('getSnsFriends', TMessageType.CALL, self._seqid)55 args = getSnsFriends_args()56 args.snsIdType = snsIdType57 args.snsAccessToken = snsAccessToken58 args.startIdx = startIdx59 args.limit = limit60 args.write(self._oprot)61 self._oprot.writeMessageEnd()62 self._oprot.trans.flush()63 def recv_getSnsFriends(self):64 iprot = self._iprot65 (fname, mtype, rseqid) = iprot.readMessageBegin()66 if mtype == TMessageType.EXCEPTION:67 x = TApplicationException()68 x.read(iprot)69 iprot.readMessageEnd()70 raise x71 result = getSnsFriends_result()72 result.read(iprot)73 iprot.readMessageEnd()74 if result.success is not None:75 return result.success76 if result.e is not None:77 raise result.e78 raise TApplicationException(TApplicationException.MISSING_RESULT, "getSnsFriends failed: unknown result")79 def getSnsMyProfile(self, snsIdType, snsAccessToken):80 """81 Parameters:82 - snsIdType83 - snsAccessToken84 """85 self.send_getSnsMyProfile(snsIdType, snsAccessToken)86 return self.recv_getSnsMyProfile()87 def send_getSnsMyProfile(self, snsIdType, snsAccessToken):88 self._oprot.writeMessageBegin('getSnsMyProfile', TMessageType.CALL, self._seqid)89 args = getSnsMyProfile_args()90 args.snsIdType = snsIdType91 args.snsAccessToken = snsAccessToken92 args.write(self._oprot)93 self._oprot.writeMessageEnd()94 self._oprot.trans.flush()95 def recv_getSnsMyProfile(self):96 iprot = self._iprot97 (fname, mtype, rseqid) = iprot.readMessageBegin()98 if mtype == TMessageType.EXCEPTION:99 x = TApplicationException()100 x.read(iprot)101 iprot.readMessageEnd()102 raise x103 result = getSnsMyProfile_result()104 result.read(iprot)105 iprot.readMessageEnd()106 if result.success is not None:107 return result.success108 if result.e is not None:109 raise result.e110 raise TApplicationException(TApplicationException.MISSING_RESULT, "getSnsMyProfile failed: unknown result")111 def postSnsInvitationMessage(self, snsIdType, snsAccessToken, toSnsUserId):112 """113 Parameters:114 - snsIdType115 - snsAccessToken116 - toSnsUserId117 """118 self.send_postSnsInvitationMessage(snsIdType, snsAccessToken, toSnsUserId)119 self.recv_postSnsInvitationMessage()120 def send_postSnsInvitationMessage(self, snsIdType, snsAccessToken, toSnsUserId):121 self._oprot.writeMessageBegin('postSnsInvitationMessage', TMessageType.CALL, self._seqid)122 args = postSnsInvitationMessage_args()123 args.snsIdType = snsIdType124 args.snsAccessToken = snsAccessToken125 args.toSnsUserId = toSnsUserId126 args.write(self._oprot)127 self._oprot.writeMessageEnd()128 self._oprot.trans.flush()129 def recv_postSnsInvitationMessage(self):130 iprot = self._iprot131 (fname, mtype, rseqid) = iprot.readMessageBegin()132 if mtype == TMessageType.EXCEPTION:133 x = TApplicationException()134 x.read(iprot)135 iprot.readMessageEnd()136 raise x137 result = postSnsInvitationMessage_result()138 result.read(iprot)139 iprot.readMessageEnd()140 if result.e is not None:141 raise result.e142 return143class Processor(Iface, TProcessor):144 def __init__(self, handler):145 self._handler = handler146 self._processMap = {}147 self._processMap["getSnsFriends"] = Processor.process_getSnsFriends148 self._processMap["getSnsMyProfile"] = Processor.process_getSnsMyProfile149 self._processMap["postSnsInvitationMessage"] = Processor.process_postSnsInvitationMessage150 def process(self, iprot, oprot):151 (name, type, seqid) = iprot.readMessageBegin()152 if name not in self._processMap:153 iprot.skip(TType.STRUCT)154 iprot.readMessageEnd()155 x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))156 oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)157 x.write(oprot)158 oprot.writeMessageEnd()159 oprot.trans.flush()160 return161 else:162 self._processMap[name](self, seqid, iprot, oprot)163 return True164 def process_getSnsFriends(self, seqid, iprot, oprot):165 args = getSnsFriends_args()166 args.read(iprot)167 iprot.readMessageEnd()168 result = getSnsFriends_result()169 try:170 result.success = self._handler.getSnsFriends(args.snsIdType, args.snsAccessToken, args.startIdx, args.limit)171 msg_type = TMessageType.REPLY172 except TTransport.TTransportException:173 raise174 except TalkException as e:175 msg_type = TMessageType.REPLY176 result.e = e177 except TApplicationException as ex:178 logging.exception('TApplication exception in handler')179 msg_type = TMessageType.EXCEPTION180 result = ex181 except Exception:182 logging.exception('Unexpected exception in handler')183 msg_type = TMessageType.EXCEPTION184 result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')185 oprot.writeMessageBegin("getSnsFriends", msg_type, seqid)186 result.write(oprot)187 oprot.writeMessageEnd()188 oprot.trans.flush()189 def process_getSnsMyProfile(self, seqid, iprot, oprot):190 args = getSnsMyProfile_args()191 args.read(iprot)192 iprot.readMessageEnd()193 result = getSnsMyProfile_result()194 try:195 result.success = self._handler.getSnsMyProfile(args.snsIdType, args.snsAccessToken)196 msg_type = TMessageType.REPLY197 except TTransport.TTransportException:198 raise199 except TalkException as e:200 msg_type = TMessageType.REPLY201 result.e = e202 except TApplicationException as ex:203 logging.exception('TApplication exception in handler')204 msg_type = TMessageType.EXCEPTION205 result = ex206 except Exception:207 logging.exception('Unexpected exception in handler')208 msg_type = TMessageType.EXCEPTION209 result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')210 oprot.writeMessageBegin("getSnsMyProfile", msg_type, seqid)211 result.write(oprot)212 oprot.writeMessageEnd()213 oprot.trans.flush()214 def process_postSnsInvitationMessage(self, seqid, iprot, oprot):215 args = postSnsInvitationMessage_args()216 args.read(iprot)217 iprot.readMessageEnd()218 result = postSnsInvitationMessage_result()219 try:220 self._handler.postSnsInvitationMessage(args.snsIdType, args.snsAccessToken, args.toSnsUserId)221 msg_type = TMessageType.REPLY222 except TTransport.TTransportException:223 raise224 except TalkException as e:225 msg_type = TMessageType.REPLY226 result.e = e227 except TApplicationException as ex:228 logging.exception('TApplication exception in handler')229 msg_type = TMessageType.EXCEPTION230 result = ex231 except Exception:232 logging.exception('Unexpected exception in handler')233 msg_type = TMessageType.EXCEPTION234 result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')235 oprot.writeMessageBegin("postSnsInvitationMessage", msg_type, seqid)236 result.write(oprot)237 oprot.writeMessageEnd()238 oprot.trans.flush()239# HELPER FUNCTIONS AND STRUCTURES240class getSnsFriends_args(object):241 """242 Attributes:243 - snsIdType244 - snsAccessToken245 - startIdx246 - limit247 """248 def __init__(self, snsIdType=None, snsAccessToken=None, startIdx=None, limit=None,):249 self.snsIdType = snsIdType250 self.snsAccessToken = snsAccessToken251 self.startIdx = startIdx252 self.limit = limit253 def read(self, iprot):254 if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:255 iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])256 return257 iprot.readStructBegin()258 while True:259 (fname, ftype, fid) = iprot.readFieldBegin()260 if ftype == TType.STOP:261 break262 if fid == 2:263 if ftype == TType.I32:264 self.snsIdType = iprot.readI32()265 else:266 iprot.skip(ftype)267 elif fid == 3:268 if ftype == TType.STRING:269 self.snsAccessToken = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()270 else:271 iprot.skip(ftype)272 elif fid == 4:273 if ftype == TType.I32:274 self.startIdx = iprot.readI32()275 else:276 iprot.skip(ftype)277 elif fid == 5:278 if ftype == TType.I32:279 self.limit = iprot.readI32()280 else:281 iprot.skip(ftype)282 else:283 iprot.skip(ftype)284 iprot.readFieldEnd()285 iprot.readStructEnd()286 def write(self, oprot):287 if oprot._fast_encode is not None and self.thrift_spec is not None:288 oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))289 return290 oprot.writeStructBegin('getSnsFriends_args')291 if self.snsIdType is not None:292 oprot.writeFieldBegin('snsIdType', TType.I32, 2)293 oprot.writeI32(self.snsIdType)294 oprot.writeFieldEnd()295 if self.snsAccessToken is not None:296 oprot.writeFieldBegin('snsAccessToken', TType.STRING, 3)297 oprot.writeString(self.snsAccessToken.encode('utf-8') if sys.version_info[0] == 2 else self.snsAccessToken)298 oprot.writeFieldEnd()299 if self.startIdx is not None:300 oprot.writeFieldBegin('startIdx', TType.I32, 4)301 oprot.writeI32(self.startIdx)302 oprot.writeFieldEnd()303 if self.limit is not None:304 oprot.writeFieldBegin('limit', TType.I32, 5)305 oprot.writeI32(self.limit)306 oprot.writeFieldEnd()307 oprot.writeFieldStop()308 oprot.writeStructEnd()309 def validate(self):310 return311 def __repr__(self):312 L = ['%s=%r' % (key, value)313 for key, value in self.__dict__.items()]314 return '%s(%s)' % (self.__class__.__name__, ', '.join(L))315 def __eq__(self, other):316 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__317 def __ne__(self, other):318 return not (self == other)319all_structs.append(getSnsFriends_args)320getSnsFriends_args.thrift_spec = (321 None, # 0322 None, # 1323 (2, TType.I32, 'snsIdType', None, None, ), # 2324 (3, TType.STRING, 'snsAccessToken', 'UTF8', None, ), # 3325 (4, TType.I32, 'startIdx', None, None, ), # 4326 (5, TType.I32, 'limit', None, None, ), # 5327)328class getSnsFriends_result(object):329 """330 Attributes:331 - success332 - e333 """334 def __init__(self, success=None, e=None,):335 self.success = success336 self.e = e337 def read(self, iprot):338 if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:339 iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])340 return341 iprot.readStructBegin()342 while True:343 (fname, ftype, fid) = iprot.readFieldBegin()344 if ftype == TType.STOP:345 break346 if fid == 0:347 if ftype == TType.STRUCT:348 self.success = SnsFriends()349 self.success.read(iprot)350 else:351 iprot.skip(ftype)352 elif fid == 1:353 if ftype == TType.STRUCT:354 self.e = TalkException()355 self.e.read(iprot)356 else:357 iprot.skip(ftype)358 else:359 iprot.skip(ftype)360 iprot.readFieldEnd()361 iprot.readStructEnd()362 def write(self, oprot):363 if oprot._fast_encode is not None and self.thrift_spec is not None:364 oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))365 return366 oprot.writeStructBegin('getSnsFriends_result')367 if self.success is not None:368 oprot.writeFieldBegin('success', TType.STRUCT, 0)369 self.success.write(oprot)370 oprot.writeFieldEnd()371 if self.e is not None:372 oprot.writeFieldBegin('e', TType.STRUCT, 1)373 self.e.write(oprot)374 oprot.writeFieldEnd()375 oprot.writeFieldStop()376 oprot.writeStructEnd()377 def validate(self):378 return379 def __repr__(self):380 L = ['%s=%r' % (key, value)381 for key, value in self.__dict__.items()]382 return '%s(%s)' % (self.__class__.__name__, ', '.join(L))383 def __eq__(self, other):384 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__385 def __ne__(self, other):386 return not (self == other)387all_structs.append(getSnsFriends_result)388getSnsFriends_result.thrift_spec = (389 (0, TType.STRUCT, 'success', [SnsFriends, None], None, ), # 0390 (1, TType.STRUCT, 'e', [TalkException, None], None, ), # 1391)392class getSnsMyProfile_args(object):393 """394 Attributes:395 - snsIdType396 - snsAccessToken397 """398 def __init__(self, snsIdType=None, snsAccessToken=None,):399 self.snsIdType = snsIdType400 self.snsAccessToken = snsAccessToken401 def read(self, iprot):402 if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:403 iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])404 return405 iprot.readStructBegin()406 while True:407 (fname, ftype, fid) = iprot.readFieldBegin()408 if ftype == TType.STOP:409 break410 if fid == 2:411 if ftype == TType.I32:412 self.snsIdType = iprot.readI32()413 else:414 iprot.skip(ftype)415 elif fid == 3:416 if ftype == TType.STRING:417 self.snsAccessToken = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()418 else:419 iprot.skip(ftype)420 else:421 iprot.skip(ftype)422 iprot.readFieldEnd()423 iprot.readStructEnd()424 def write(self, oprot):425 if oprot._fast_encode is not None and self.thrift_spec is not None:426 oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))427 return428 oprot.writeStructBegin('getSnsMyProfile_args')429 if self.snsIdType is not None:430 oprot.writeFieldBegin('snsIdType', TType.I32, 2)431 oprot.writeI32(self.snsIdType)432 oprot.writeFieldEnd()433 if self.snsAccessToken is not None:434 oprot.writeFieldBegin('snsAccessToken', TType.STRING, 3)435 oprot.writeString(self.snsAccessToken.encode('utf-8') if sys.version_info[0] == 2 else self.snsAccessToken)436 oprot.writeFieldEnd()437 oprot.writeFieldStop()438 oprot.writeStructEnd()439 def validate(self):440 return441 def __repr__(self):442 L = ['%s=%r' % (key, value)443 for key, value in self.__dict__.items()]444 return '%s(%s)' % (self.__class__.__name__, ', '.join(L))445 def __eq__(self, other):446 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__447 def __ne__(self, other):448 return not (self == other)449all_structs.append(getSnsMyProfile_args)450getSnsMyProfile_args.thrift_spec = (451 None, # 0452 None, # 1453 (2, TType.I32, 'snsIdType', None, None, ), # 2454 (3, TType.STRING, 'snsAccessToken', 'UTF8', None, ), # 3455)456class getSnsMyProfile_result(object):457 """458 Attributes:459 - success460 - e461 """462 def __init__(self, success=None, e=None,):463 self.success = success464 self.e = e465 def read(self, iprot):466 if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:467 iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])468 return469 iprot.readStructBegin()470 while True:471 (fname, ftype, fid) = iprot.readFieldBegin()472 if ftype == TType.STOP:473 break474 if fid == 0:475 if ftype == TType.STRUCT:476 self.success = SnsProfile()477 self.success.read(iprot)478 else:479 iprot.skip(ftype)480 elif fid == 1:481 if ftype == TType.STRUCT:482 self.e = TalkException()483 self.e.read(iprot)484 else:485 iprot.skip(ftype)486 else:487 iprot.skip(ftype)488 iprot.readFieldEnd()489 iprot.readStructEnd()490 def write(self, oprot):491 if oprot._fast_encode is not None and self.thrift_spec is not None:492 oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))493 return494 oprot.writeStructBegin('getSnsMyProfile_result')495 if self.success is not None:496 oprot.writeFieldBegin('success', TType.STRUCT, 0)497 self.success.write(oprot)498 oprot.writeFieldEnd()499 if self.e is not None:500 oprot.writeFieldBegin('e', TType.STRUCT, 1)501 self.e.write(oprot)502 oprot.writeFieldEnd()503 oprot.writeFieldStop()504 oprot.writeStructEnd()505 def validate(self):506 return507 def __repr__(self):508 L = ['%s=%r' % (key, value)509 for key, value in self.__dict__.items()]510 return '%s(%s)' % (self.__class__.__name__, ', '.join(L))511 def __eq__(self, other):512 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__513 def __ne__(self, other):514 return not (self == other)515all_structs.append(getSnsMyProfile_result)516getSnsMyProfile_result.thrift_spec = (517 (0, TType.STRUCT, 'success', [SnsProfile, None], None, ), # 0518 (1, TType.STRUCT, 'e', [TalkException, None], None, ), # 1519)520class postSnsInvitationMessage_args(object):521 """522 Attributes:523 - snsIdType524 - snsAccessToken525 - toSnsUserId526 """527 def __init__(self, snsIdType=None, snsAccessToken=None, toSnsUserId=None,):528 self.snsIdType = snsIdType529 self.snsAccessToken = snsAccessToken530 self.toSnsUserId = toSnsUserId531 def read(self, iprot):532 if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:533 iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])534 return535 iprot.readStructBegin()536 while True:537 (fname, ftype, fid) = iprot.readFieldBegin()538 if ftype == TType.STOP:539 break540 if fid == 2:541 if ftype == TType.I32:542 self.snsIdType = iprot.readI32()543 else:544 iprot.skip(ftype)545 elif fid == 3:546 if ftype == TType.STRING:547 self.snsAccessToken = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()548 else:549 iprot.skip(ftype)550 elif fid == 4:551 if ftype == TType.STRING:552 self.toSnsUserId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()553 else:554 iprot.skip(ftype)555 else:556 iprot.skip(ftype)557 iprot.readFieldEnd()558 iprot.readStructEnd()559 def write(self, oprot):560 if oprot._fast_encode is not None and self.thrift_spec is not None:561 oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))562 return563 oprot.writeStructBegin('postSnsInvitationMessage_args')564 if self.snsIdType is not None:565 oprot.writeFieldBegin('snsIdType', TType.I32, 2)566 oprot.writeI32(self.snsIdType)567 oprot.writeFieldEnd()568 if self.snsAccessToken is not None:569 oprot.writeFieldBegin('snsAccessToken', TType.STRING, 3)570 oprot.writeString(self.snsAccessToken.encode('utf-8') if sys.version_info[0] == 2 else self.snsAccessToken)571 oprot.writeFieldEnd()572 if self.toSnsUserId is not None:573 oprot.writeFieldBegin('toSnsUserId', TType.STRING, 4)574 oprot.writeString(self.toSnsUserId.encode('utf-8') if sys.version_info[0] == 2 else self.toSnsUserId)575 oprot.writeFieldEnd()576 oprot.writeFieldStop()577 oprot.writeStructEnd()578 def validate(self):579 return580 def __repr__(self):581 L = ['%s=%r' % (key, value)582 for key, value in self.__dict__.items()]583 return '%s(%s)' % (self.__class__.__name__, ', '.join(L))584 def __eq__(self, other):585 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__586 def __ne__(self, other):587 return not (self == other)588all_structs.append(postSnsInvitationMessage_args)589postSnsInvitationMessage_args.thrift_spec = (590 None, # 0591 None, # 1592 (2, TType.I32, 'snsIdType', None, None, ), # 2593 (3, TType.STRING, 'snsAccessToken', 'UTF8', None, ), # 3594 (4, TType.STRING, 'toSnsUserId', 'UTF8', None, ), # 4595)596class postSnsInvitationMessage_result(object):597 """598 Attributes:599 - e600 """601 def __init__(self, e=None,):602 self.e = e603 def read(self, iprot):604 if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:605 iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])606 return607 iprot.readStructBegin()608 while True:609 (fname, ftype, fid) = iprot.readFieldBegin()610 if ftype == TType.STOP:611 break612 if fid == 1:613 if ftype == TType.STRUCT:614 self.e = TalkException()615 self.e.read(iprot)616 else:617 iprot.skip(ftype)618 else:619 iprot.skip(ftype)620 iprot.readFieldEnd()621 iprot.readStructEnd()622 def write(self, oprot):623 if oprot._fast_encode is not None and self.thrift_spec is not None:624 oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))625 return626 oprot.writeStructBegin('postSnsInvitationMessage_result')627 if self.e is not None:628 oprot.writeFieldBegin('e', TType.STRUCT, 1)629 self.e.write(oprot)630 oprot.writeFieldEnd()631 oprot.writeFieldStop()632 oprot.writeStructEnd()633 def validate(self):634 return635 def __repr__(self):636 L = ['%s=%r' % (key, value)637 for key, value in self.__dict__.items()]638 return '%s(%s)' % (self.__class__.__name__, ', '.join(L))639 def __eq__(self, other):640 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__641 def __ne__(self, other):642 return not (self == other)643all_structs.append(postSnsInvitationMessage_result)644postSnsInvitationMessage_result.thrift_spec = (645 None, # 0646 (1, TType.STRUCT, 'e', [TalkException, None], None, ), # 1647)648fix_spec(all_structs)...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

1var Sonoff;2var refreshtime = false;3var nightmode = false;4$( document ).on( "ready", function () {5 6 var $lang = $( "html" ).attr( "lang" );7 var i18nfile = _BASEURL_ + 'tmp/cache/i18n/json_i18n_' + $lang + '.cache.json';8 //console.log( i18nfile );9 10 $.ajax( {11 dataType: "json",12 url : i18nfile,13 async : false,14 success : function ( data ) {15 16 $.i18n().load( data );17 }18 } );19 20 21 checkNightmode( nightmodeconfig );22 checkForUpdate( true );23 24 25 $( '.double-scroll' ).doubleScroll(26 {27 contentElement : "#device-list", // Widest element, if not specified first child element will be used28 scrollCss : {29 'overflow-x': 'auto',30 'overflow-y': 'hidden'31 },32 contentCss : {33 'overflow-x': 'auto',34 'overflow-y': 'hidden'35 },36 onlyIfScroll : true, // top scrollbar is not shown if the bottom one is not present37 resetOnWindowResize: true, // recompute the top ScrollBar requirements when the window is resized38 timeToWaitForResize: 139 }40 );41 /**42 * Sonoff Handler43 * @type {Sonoff}44 */45 46 47 48 Sonoff = new Sonoff( { timeout: 15 } );49 50 $( '[title][title!=""]' ).tooltip( {51 html : true,52 delay: 30053 } );54 55 $( '.custom-file-input' ).on( 'change', function () {56 var filename = $( this ).val();57 filename = filename.replace( /^.*\\/, "" );58 filename = filename.match( /[^\\/]*$/ )[ 0 ];59 $( this ).next().html( filename );60 } );61 62 $( "a.reload" ).on( "click", function ( e ) {63 e.preventDefault();64 window.location.href = window.location.href;65 } );66 67 68 $( "#versionHolder" ).on( "click", function ( e ) {69 e.preventDefault();70 if ( $( this ).hasClass( "update-now" ) || $( "#versionHolder" ).data( "update-check" ) == "0" ) {71 window.location.href = _BASEURL_ + "selfupdate";72 } else {73 checkForUpdate( false );74 }75 } );76 77 78 //$( "select#language-switch" ).selectmenu( "option", "width", "80px" );79 80 var appendLoading = function ( elem, replace ) {81 var replace = replace || false;82 var loader = $( '<div>', { class: "loader" } ).append(83 $( 'img', { src: _RESOURCESURL_ + "img/loading.gif" } ) );84 85 if ( replace ) {86 $( elem ).html( loader );87 } else {88 $( elem ).append( loader );89 }90 };91 92 //$( '.hamburger' ).click( function () {93 // $( "#navi" ).toggleClass( "show" );94 // $( '.hamburger' ).toggleClass( "open" );95 //} );96 97 if ( $( "#content" ).data( "refreshtime" ) !== "none" ) {98 refreshtime = $( "#content" ).data( "refreshtime" ) * 1000;99 }100 101 $( "input[type=\"number\"]" ).keydown( function ( e ) {102 // Allow: backspace, delete, tab, escape, enter and .103 if ( $.inArray( e.keyCode, [ 46, 8, 9, 27, 13, 110, 190 ] ) !== -1 ||104 // Allow: Ctrl+A, Command+A105 (106 e.keyCode === 65 && (107 e.ctrlKey === true || e.metaKey === true108 )109 ) ||110 // Allow: home, end, left, right, down, up111 (112 e.keyCode >= 35 && e.keyCode <= 40113 ) ) {114 // var it happen, don't do anything115 return;116 }117 // Ensure that it is a number and stop the keypress118 if ( (119 e.shiftKey || (120 e.keyCode < 48 || e.keyCode > 57121 )122 ) && (123 e.keyCode < 96 || e.keyCode > 105124 ) ) {125 e.preventDefault();126 }127 } );128 129 $( "select#language-switch" ).on( "change", function ( event, ui ) {130 var optionSelected = $( "option:selected", this );131 var valueSelected = this.value;132 133 var curUrl = window.location.toString() + "/" + valueSelected + "/";134 curUrl = curUrl.replace( /([^:]\/)\/+/g, "$1" );135 window.location.href = curUrl;136 137 // var curUrl = window.location.toString();138 // curUrl = curUrl.replace( /[\?\&][a-z]2/g, "" );139 // console.log( curUrl );140 //141 // window.location.href = curUrl + (142 // curUrl.indexOf( "?" ) !== -1 ? "&" : "?"143 // ) + "lang=" + valueSelected;144 } );145 146} );147function notifyMe( msg, title ) {148 var title = title || "";149 if ( title != "" ) {150 title = " - " + title;151 }152 153 var icon = "./resources/img/favicons/apple-icon-180x180.png";154 155 // Let's check if the browser supports notifications156 if ( !(157 "Notification" in window158 ) ) {159 return;160 }161 162 163 // Let's check whether notification permissions have already been granted164 else if ( Notification.permission === "granted" ) {165 // If it's okay let's create a notification166 var notification = new Notification( "TasmoAdmin" + title, { body: msg, icon: icon } );167 setTimeout( notification.close.bind( notification ), 3000 );168 }169 170 // Otherwise, we need to ask the user for permission171 else if ( Notification.permission !== 'denied' ) {172 Notification.requestPermission( function ( permission ) {173 // If the user accepts, let's create a notification174 if ( permission === "granted" ) {175 var notification = new Notification( "TasmoAdmin" + title, { body: msg } );176 setTimeout( notification.close.bind( notification ), 3000 );177 }178 } );179 }180 181 // Finally, if the user has denied notifications and you182 // want to be respectful there is no need to bother them any more.183}184$.fn.attachDragger = function () {185 var attachment = false, lastPosition, position, difference;186 $( $( this ).selector ).on( "mousedown mouseup mousemove", function ( e ) {187 if ( e.type == "mousedown" && !$( e.target ).hasClass( "tablesaw-cell-content" ) ) {188 attachment = true, lastPosition = [ e.clientX, e.clientY ];189 $( ".tablesaw-cell-content" ).addClass( "dontselect" );190 }191 if ( e.type == "mouseup" ) {192 attachment = false;193 $( ".tablesaw-cell-content" ).removeClass( "dontselect" );194 }195 if ( e.type == "mousemove" && attachment == true ) {196 position = [ e.clientX, e.clientY ];197 difference = [198 (199 position[ 0 ] - lastPosition[ 0 ]200 ),201 (202 position[ 1 ] - lastPosition[ 1 ]203 )204 ];205 $( this ).scrollLeft( $( this ).scrollLeft() - difference[ 0 ] );206 $( this ).scrollTop( $( this ).scrollTop() - difference[ 1 ] );207 lastPosition = [ e.clientX, e.clientY ];208 }209 } );210 $( window ).on( "mouseup", function () {211 attachment = false;212 $( ".tablesaw-cell-content" ).removeClass( "dontselect" );213 } );214};215var parseVersion = function ( versionString ) {216 versionString = versionString.replace( "-minimal", "" ).replace( /\./g, "" );217 218 var last = versionString.slice( -1 );219 if ( isNaN( last ) ) {220 versionString = versionString.replace(221 last,222 (223 last.charCodeAt( 0 ) - 97 < 10224 ? "0" + (225 last.charCodeAt( 0 ) - 97226 )227 : last.charCodeAt( 0 ) - 97228 )229 );230 } else {231 versionString = versionString + "00";232 }233 234 return versionString;235};236function getTemp( data, joinString ) {237 var temp = [];238 var joinString = joinString || "<br/>";239 240 if ( data.StatusSNS.TempUnit == undefined ) {241 data.StatusSNS.TempUnit = "F";242 }243 244 if ( data.StatusSNS.DS18B20 !== undefined ) {245 temp.push( (246 data.StatusSNS.DS18B20.Temperature + "°" + data.StatusSNS.TempUnit247 ) );248 }249 if ( data.StatusSNS.DS18x20 !== undefined ) {250 if ( data.StatusSNS.DS18x20.DS1 !== undefined ) {251 temp.push( (252 data.StatusSNS.DS18x20.DS1.Temperature + "°" + data.StatusSNS.TempUnit253 ) );254 }255 if ( data.StatusSNS.DS18x20.DS2 !== undefined ) {256 temp.push( (257 data.StatusSNS.DS18x20.DS2.Temperature + "°" + data.StatusSNS.TempUnit258 ) );259 }260 if ( data.StatusSNS.DS18x20.DS3 !== undefined ) {261 temp.push( (262 data.StatusSNS.DS18x20.DS3.Temperature + "°" + data.StatusSNS.TempUnit263 ) );264 }265 if ( data.StatusSNS.DS18x20.DS4 !== undefined ) {266 temp.push( (267 data.StatusSNS.DS18x20.DS4.Temperature + "°" + data.StatusSNS.TempUnit268 ) );269 }270 if ( data.StatusSNS.DS18x20.DS5 !== undefined ) {271 temp.push( (272 data.StatusSNS.DS18x20.DS5.Temperature + "°" + data.StatusSNS.TempUnit273 ) );274 }275 }276 277 //6.1.1c 20180904278 if ( data.StatusSNS[ "DS18B20-1" ] !== undefined ) {279 temp.push( (280 data.StatusSNS[ "DS18B20-1" ].Temperature + "°" + data.StatusSNS.TempUnit281 ) );282 }283 if ( data.StatusSNS[ "DS18B20-2" ] !== undefined ) {284 temp.push( (285 data.StatusSNS[ "DS18B20-2" ].Temperature + "°" + data.StatusSNS.TempUnit286 ) );287 }288 if ( data.StatusSNS[ "DS18B20-3" ] !== undefined ) {289 temp.push( (290 data.StatusSNS[ "DS18B20-3" ].Temperature + "°" + data.StatusSNS.TempUnit291 ) );292 }293 if ( data.StatusSNS[ "DS18B20-4" ] !== undefined ) {294 temp.push( (295 data.StatusSNS[ "DS18B20-4" ].Temperature + "°" + data.StatusSNS.TempUnit296 ) );297 }298 if ( data.StatusSNS[ "DS18B20-5" ] !== undefined ) {299 temp.push( (300 data.StatusSNS[ "DS18B20-5" ].Temperature + "°" + data.StatusSNS.TempUnit301 ) );302 }303 304 305 if ( data.StatusSNS.DHT11 !== undefined ) {306 temp.push( (307 data.StatusSNS.DHT11.Temperature + "°" + data.StatusSNS.TempUnit308 ) );309 }310 if ( data.StatusSNS.AM2301 !== undefined ) {311 temp.push( (312 data.StatusSNS.AM2301.Temperature + "°" + data.StatusSNS.TempUnit313 ) );314 }315 if ( data.StatusSNS.SHT3X !== undefined ) {316 temp.push( (317 data.StatusSNS.SHT3X.Temperature + "°" + data.StatusSNS.TempUnit318 ) );319 }320 if ( data.StatusSNS[ "SHT3X-0x45" ] !== undefined ) {321 temp.push( (322 data.StatusSNS[ "SHT3X-0x45" ].Temperature + "°" + data.StatusSNS.TempUnit323 ) );324 }325 if ( data.StatusSNS.BMP280 !== undefined ) {326 temp.push( (327 data.StatusSNS.BMP280.Temperature + "°" + data.StatusSNS.TempUnit328 ) );329 330 }331 if ( data.StatusSNS.BME680 !== undefined ) {332 temp.push( (333 data.StatusSNS.BME680.Temperature + "°" + data.StatusSNS.TempUnit334 ) );335 }336 if ( data.StatusSNS.BME280 !== undefined ) {337 temp.push( (338 data.StatusSNS.BME280.Temperature + "°" + data.StatusSNS.TempUnit339 ) );340 }341 if ( data.StatusSNS[ "BME280-76" ] !== undefined ) {342 temp.push( data.StatusSNS[ "BME280-76" ].Temperature + "°" + data.StatusSNS.TempUnit );343 }344 if ( data.StatusSNS[ "BME280-77" ] !== undefined ) {345 temp.push( data.StatusSNS[ "BME280-77" ].Temperature + "°" + data.StatusSNS.TempUnit );346 }347 if ( data.StatusSNS.SI7021 !== undefined ) {348 temp.push( (349 data.StatusSNS.SI7021.Temperature + "°" + data.StatusSNS.TempUnit350 ) );351 }352 if ( data.StatusSNS.HTU21 !== undefined ) {353 temp.push( (354 data.StatusSNS.HTU21.Temperature + "°" + data.StatusSNS.TempUnit355 ) );356 }357 if ( data.StatusSNS.BMP180 !== undefined ) {358 temp.push( (359 data.StatusSNS.BMP180.Temperature + "°" + data.StatusSNS.TempUnit360 ) );361 }362 363 //console.log( temp );364 365 return temp.join( joinString );366}367function getHumidity( data, joinString ) {368 var humi = [];369 var joinString = joinString || "<br/>";370 371 if ( data.StatusSNS.AM2301 !== undefined ) {372 if ( data.StatusSNS.AM2301.Humidity !== undefined ) {373 humi.push( data.StatusSNS.AM2301.Humidity + "%" );374 }375 }376 if ( data.StatusSNS.BME280 !== undefined ) {377 if ( data.StatusSNS.BME280.Humidity !== undefined ) {378 humi.push( data.StatusSNS.BME280.Humidity + "%" );379 }380 }381 382 if ( data.StatusSNS[ "BME280-76" ] !== undefined ) {383 if ( data.StatusSNS[ "BME280-76" ].Humidity !== undefined ) {384 humi.push( data.StatusSNS[ "BME280-76" ].Humidity + "%" );385 }386 }387 if ( data.StatusSNS[ "BME280-77" ] !== undefined ) {388 if ( data.StatusSNS[ "BME280-77" ].Humidity !== undefined ) {389 humi.push( data.StatusSNS[ "BME280-77" ].Humidity + "%" );390 }391 }392 if ( data.StatusSNS.BME680 !== undefined ) {393 if ( data.StatusSNS.BME680.Humidity !== undefined ) {394 humi.push( data.StatusSNS.BME680.Humidity + "%" );395 }396 }397 if ( data.StatusSNS.DHT11 !== undefined ) {398 if ( data.StatusSNS.DHT11.Humidity !== undefined ) {399 humi.push( data.StatusSNS.DHT11.Humidity + "%" );400 }401 }402 if ( data.StatusSNS.SHT3X !== undefined ) {403 if ( data.StatusSNS.SHT3X.Humidity !== undefined ) {404 humi.push( data.StatusSNS.SHT3X.Humidity + "%" );405 }406 }407 if ( data.StatusSNS[ "SHT3X-0x45" ] !== undefined ) {408 if ( data.StatusSNS[ "SHT3X-0x45" ].Humidity !== undefined ) {409 humi.push( data.StatusSNS[ "SHT3X-0x45" ].Humidity + "%" );410 }411 }412 if ( data.StatusSNS.SI7021 !== undefined ) {413 if ( data.StatusSNS.SI7021.Humidity !== undefined ) {414 humi.push( data.StatusSNS.SI7021.Humidity + "%" );415 }416 }417 if ( data.StatusSNS.HTU21 !== undefined ) {418 if ( data.StatusSNS.HTU21.Humidity !== undefined ) {419 humi.push( data.StatusSNS.HTU21.Humidity + "%" );420 }421 }422 423 //console.log( humi );424 425 return humi.join( joinString );426}427function getPressure( data, joinString ) {428 var press = [];429 var joinString = joinString || "<br/>";430 431 if ( data.StatusSNS.BME280 !== undefined ) {432 if ( data.StatusSNS.BME280.Pressure !== undefined ) {433 press.push( data.StatusSNS.BME280.Pressure + "&nbsp;hPa" );434 }435 }436 if ( data.StatusSNS[ "BME280-76" ] !== undefined ) {437 if ( data.StatusSNS[ "BME280-76" ].Pressure !== undefined ) {438 press.push( data.StatusSNS[ "BME280-76" ].Pressure + "&nbsp;hPa" );439 }440 }441 if ( data.StatusSNS[ "BME280-77" ] !== undefined ) {442 if ( data.StatusSNS[ "BME280-77" ].Pressure !== undefined ) {443 press.push( data.StatusSNS[ "BME280-77" ].Pressure + "&nbsp;hPa" );444 }445 }446 if ( data.StatusSNS.BMP280 !== undefined ) {447 if ( data.StatusSNS.BMP280.Pressure !== undefined ) {448 press.push( data.StatusSNS.BMP280.Pressure + "&nbsp;hPa" );449 }450 }451 if ( data.StatusSNS.BME680 !== undefined ) {452 if ( data.StatusSNS.BME680.Pressure !== undefined ) {453 press.push( data.StatusSNS.BME680.Pressure + "&nbsp;hPa" );454 }455 }456 if ( data.StatusSNS.BMP180 !== undefined ) {457 if ( data.StatusSNS.BMP180.Pressure !== undefined ) {458 press.push( data.StatusSNS.BMP180.Pressure + "&nbsp;hPa" );459 }460 }461 462 //console.log( press );463 464 return press.join( joinString );465}466function getSeaPressure( data, joinString ) {467 var press = [];468 var joinString = joinString || "<br/>";469 470 if ( data.StatusSNS.BMP180 !== undefined ) {471 if ( data.StatusSNS.BMP180.SeaPressure !== undefined ) {472 press.push( data.StatusSNS.BMP180.SeaPressure + "&nbsp;hPa" );473 }474 }475 476 //console.log( press );477 478 return press.join( joinString );479}480function getDistance( data, joinString ) {481 var dist = [];482 var joinString = joinString || "<br/>";483 484 if ( data.StatusSNS.SR04 !== undefined ) {485 if ( data.StatusSNS.SR04.Distance !== undefined ) {486 dist.push( data.StatusSNS.SR04.Distance + "cm" );487 }488 }489 490 //console.log( press );491 492 return dist.join( joinString );493}494function getEnergyPower( data, joinString ) {495 var enerygPower = [];496 var joinString = joinString || "<br/>";497 498 if ( data.StatusSNS.ENERGY !== undefined ) {499 if ( data.StatusSNS.ENERGY.Power !== undefined ) {500 enerygPower.push( data.StatusSNS.ENERGY.Power + "W" );501 }502 503 if ( data.StatusSNS.ENERGY.Today !== undefined ) {504 var tmpString = data.StatusSNS.ENERGY.Today;505 if ( data.StatusSNS.ENERGY.Yesterday !== undefined ) {506 tmpString += "/" + data.StatusSNS.ENERGY.Yesterday;507 }508 enerygPower.push( tmpString + "kWh" );509 }510 511 if ( data.StatusSNS.ENERGY.Current !== undefined ) {512 enerygPower.push( data.StatusSNS.ENERGY.Current + "A" );513 }514 }515 //console.log( press );516 517 return enerygPower.join( joinString );518}519//function getEnergyTodayYesterday( data ) {520// var energyTodayYesterday = [];521//522// if ( data.StatusSNS.ENERGY !== undefined ) {523// if ( data.StatusSNS.ENERGY.Today !== undefined ) {524// var tmpString = data.StatusSNS.ENERGY.Today;525// if ( data.StatusSNS.ENERGY.Yesterday !== undefined ) {526// tmpString += "/" + data.StatusSNS.ENERGY.Today;527// }528// energyTodayYesterday.push( tmpString + "kWh" );529// }530// }531//532// //console.log( press );533//534// return energyTodayYesterday.join( joinString );535//}536Date.prototype.addHours = function ( h ) {537 this.setHours( this.getHours() + h );538 return this;539};540function getGas( data, joinString ) {541 var gas = [];542 var joinString = joinString || "<br/>";543 544 if ( data.StatusSNS.BME680 !== undefined ) {545 if ( data.StatusSNS.BME680.Gas !== undefined ) {546 gas.push( data.StatusSNS.BME680.Gas + "kOhm" );547 }548 }549 550 //console.log( press );551 552 return gas.join( joinString );553}554function checkNightmode( config ) {555 console.log( "[APP][checkNightmode] Start" );556 var config = config || "auto";557 558 var currentTime = new Date();559 var hour = currentTime.getHours();560 561 //console.log( "check Nightmode => " + hour + "h - " + config );562 563 564 if ( config === "disable" ) {565 $( "body" ).removeClass( "nightmode" );566 console.log( "[APP][checkNightmode] disabled" );567 } else {568 if ( config === "auto" ) {569 console.log( "[APP][checkNightmode] check time" );570 if ( hour >= 18 || hour <= 8 ) { //@TODO: get sunrise by geo571 $( "body" ).addClass( "nightmode" );572 console.log( "[APP][checkNightmode] its night" );573 } else {574 $( "body" ).removeClass( "nightmode" );575 console.log( "[APP][checkNightmode] its day" );576 }577 578 579 setTimeout( function () {580 checkNightmode( config );581 }, 15 * 60 * 1000 );582 583 } else if ( config === "always" ) {584 console.log( "[APP][checkNightmode] always" );585 $( "body" ).addClass( "nightmode" );586 }587 }588 if ( $( "body" ).hasClass( "nightmode" ) ) {589 nightmode = true;590 }591}592function checkForUpdate( timer ) {593 if ( $( "#versionHolder" ).data( "update-check" ) == "0" ) {594 console.log( "[APP][checkForUpdate] Update check is disabed" );595 $( "#update-icon" ).remove();596 return;597 }598 console.log( "[APP][checkForUpdate] Start" );599 var timer = timer || true;600 var icon = $( "#update-icon" );601 var currentGitTag = icon.data( "current_git_tag" );602 603 if ( icon.parent().hasClass( "update-now" ) ) {604 console.log( "[APP][checkForUpdate] NEW VERSION FOUND ALREADY" );605 return true;606 }607 608 if ( icon.hasClass( "fa-spin" ) ) {609 console.log( "[APP][checkForUpdate] Still searching" );610 return false;611 }612 613 icon.removeClass( "fa-check" )614 .removeClass( "fa-question" )615 .removeClass( "fa-times" )616 .addClass( "fa-sync" )617 .addClass( "fa-spin" );618 619 var action = "releases/latest";620 if ( currentGitTag.indexOf( "beta" ) !== false ) {621 action = "releases";622 }623 var githubApiRelease = "https://api.github.com/repos/reloxx13/TasmoAdmin/" + action;624 625 $.get( githubApiRelease, {}, function ( result ) {626 if ( result !== undefined ) {627 if ( Array.isArray( result ) ) {628 result = result[ 0 ];629 }630 if ( result.tag_name !== undefined ) {631 var latestTag = result.tag_name;632 console.log( "[APP][checkForUpdate] latestTag => " + latestTag );633 if ( latestTag != currentGitTag ) {634 console.log( "[APP][checkForUpdate] NEW VERSION FOUND" );635 if ( result.assets.length !== 3 ) {636 console.log( "[APP][checkForUpdate] Seems like Travis is not done yet" );637 icon.removeClass( "fa-sync" ).addClass( "fa-check" );638 if ( timer ) {639 setTimeout( checkForUpdate, 5 * 60 * 1000 );640 }641 } else {642 icon.removeClass( "fa-sync" )643 .removeClass( "fa-spin" )644 .addClass( "fa-cloud-download-alt" )645 .parent()646 .addClass(647 "update-now" );648 }649 } else {650 console.log( "[APP][checkForUpdate] No update found" );651 icon.removeClass( "fa-sync" ).addClass( "fa-check" );652 if ( timer ) {653 setTimeout( checkForUpdate, 15 * 60 * 1000 );654 }655 }656 } else {657 if ( result.message !== undefined ) {658 icon.removeClass( "fa-sync" ).removeClass( "fa-spin" ).addClass( "fa-times" );659 console.log( "[APP][checkForUpdate] Github Error => " + result.message );660 setTimeout( checkForUpdate, 30 * 60 * 1000 );661 }662 }663 }664 665 666 icon.removeClass( "fa-spin" );667 668 }, "json" ).fail( function ( result ) {669 icon.removeClass( "fa-sync" ).removeClass( "fa-spin" ).addClass( "fa-times" );670 //console.log( result );671 console.log( "[APP][checkForUpdate] Github Error => " + result.status + ": " + result.responseJSON.message );672 setTimeout( checkForUpdate, 30 * 60 * 1000 );673 } );674 675}676jQuery.fn.shake = function ( intShakes, intDistance, intDuration ) {677 this.each( function () {678 $( this ).css( "position", "relative" );679 for ( var x = 1; x <= intShakes; x++ ) {680 $( this ).animate(681 {682 left: (683 intDistance * -1684 )685 },686 (687 (688 (689 intDuration / intShakes690 ) / 4691 )692 )693 )694 .animate(695 { left: intDistance },696 (697 (698 intDuration / intShakes699 ) / 2700 )701 )702 .animate(703 { left: 0 },704 (705 (706 (707 intDuration / intShakes708 ) / 4709 )710 )711 );712 }713 } );714 return this;...

Full Screen

Full Screen

SensorPacket.js

Source:SensorPacket.js Github

copy

Full Screen

1// Auto-generated. Do not edit!2// (in-package tae_psoc.msg)3"use strict";4const _serializer = _ros_msg_utils.Serialize;5const _arraySerializer = _serializer.Array;6const _deserializer = _ros_msg_utils.Deserialize;7const _arrayDeserializer = _deserializer.Array;8const _finder = _ros_msg_utils.Find;9const _getByteLength = _ros_msg_utils.getByteLength;10//-----------------------------------------------------------11class SensorPacket {12 constructor(initObj={}) {13 if (initObj === null) {14 // initObj === null is a special case for deserialization where we don't initialize fields15 this.sns_1_FFT_NS = null;16 this.sns_1_FFT_WE = null;17 this.sns_1_4Ch = null;18 this.sns_1_F_M = null;19 this.sns_2_FFT_NS = null;20 this.sns_2_FFT_WE = null;21 this.sns_2_4Ch = null;22 this.sns_2_F_M = null;23 this.sns1_vorticity = null;24 this.sns2_vorticity = null;25 }26 else {27 if (initObj.hasOwnProperty('sns_1_FFT_NS')) {28 this.sns_1_FFT_NS = initObj.sns_1_FFT_NS29 }30 else {31 this.sns_1_FFT_NS = [];32 }33 if (initObj.hasOwnProperty('sns_1_FFT_WE')) {34 this.sns_1_FFT_WE = initObj.sns_1_FFT_WE35 }36 else {37 this.sns_1_FFT_WE = [];38 }39 if (initObj.hasOwnProperty('sns_1_4Ch')) {40 this.sns_1_4Ch = initObj.sns_1_4Ch41 }42 else {43 this.sns_1_4Ch = [];44 }45 if (initObj.hasOwnProperty('sns_1_F_M')) {46 this.sns_1_F_M = initObj.sns_1_F_M47 }48 else {49 this.sns_1_F_M = [];50 }51 if (initObj.hasOwnProperty('sns_2_FFT_NS')) {52 this.sns_2_FFT_NS = initObj.sns_2_FFT_NS53 }54 else {55 this.sns_2_FFT_NS = [];56 }57 if (initObj.hasOwnProperty('sns_2_FFT_WE')) {58 this.sns_2_FFT_WE = initObj.sns_2_FFT_WE59 }60 else {61 this.sns_2_FFT_WE = [];62 }63 if (initObj.hasOwnProperty('sns_2_4Ch')) {64 this.sns_2_4Ch = initObj.sns_2_4Ch65 }66 else {67 this.sns_2_4Ch = [];68 }69 if (initObj.hasOwnProperty('sns_2_F_M')) {70 this.sns_2_F_M = initObj.sns_2_F_M71 }72 else {73 this.sns_2_F_M = [];74 }75 if (initObj.hasOwnProperty('sns1_vorticity')) {76 this.sns1_vorticity = initObj.sns1_vorticity77 }78 else {79 this.sns1_vorticity = 0.0;80 }81 if (initObj.hasOwnProperty('sns2_vorticity')) {82 this.sns2_vorticity = initObj.sns2_vorticity83 }84 else {85 this.sns2_vorticity = 0.0;86 }87 }88 }89 static serialize(obj, buffer, bufferOffset) {90 // Serializes a message object of type SensorPacket91 // Serialize message field [sns_1_FFT_NS]92 bufferOffset = _arraySerializer.uint16(obj.sns_1_FFT_NS, buffer, bufferOffset, null);93 // Serialize message field [sns_1_FFT_WE]94 bufferOffset = _arraySerializer.uint16(obj.sns_1_FFT_WE, buffer, bufferOffset, null);95 // Serialize message field [sns_1_4Ch]96 bufferOffset = _arraySerializer.int16(obj.sns_1_4Ch, buffer, bufferOffset, null);97 // Serialize message field [sns_1_F_M]98 bufferOffset = _arraySerializer.float32(obj.sns_1_F_M, buffer, bufferOffset, null);99 // Serialize message field [sns_2_FFT_NS]100 bufferOffset = _arraySerializer.uint16(obj.sns_2_FFT_NS, buffer, bufferOffset, null);101 // Serialize message field [sns_2_FFT_WE]102 bufferOffset = _arraySerializer.uint16(obj.sns_2_FFT_WE, buffer, bufferOffset, null);103 // Serialize message field [sns_2_4Ch]104 bufferOffset = _arraySerializer.int16(obj.sns_2_4Ch, buffer, bufferOffset, null);105 // Serialize message field [sns_2_F_M]106 bufferOffset = _arraySerializer.float32(obj.sns_2_F_M, buffer, bufferOffset, null);107 // Serialize message field [sns1_vorticity]108 bufferOffset = _serializer.float32(obj.sns1_vorticity, buffer, bufferOffset);109 // Serialize message field [sns2_vorticity]110 bufferOffset = _serializer.float32(obj.sns2_vorticity, buffer, bufferOffset);111 return bufferOffset;112 }113 static deserialize(buffer, bufferOffset=[0]) {114 //deserializes a message object of type SensorPacket115 let len;116 let data = new SensorPacket(null);117 // Deserialize message field [sns_1_FFT_NS]118 data.sns_1_FFT_NS = _arrayDeserializer.uint16(buffer, bufferOffset, null)119 // Deserialize message field [sns_1_FFT_WE]120 data.sns_1_FFT_WE = _arrayDeserializer.uint16(buffer, bufferOffset, null)121 // Deserialize message field [sns_1_4Ch]122 data.sns_1_4Ch = _arrayDeserializer.int16(buffer, bufferOffset, null)123 // Deserialize message field [sns_1_F_M]124 data.sns_1_F_M = _arrayDeserializer.float32(buffer, bufferOffset, null)125 // Deserialize message field [sns_2_FFT_NS]126 data.sns_2_FFT_NS = _arrayDeserializer.uint16(buffer, bufferOffset, null)127 // Deserialize message field [sns_2_FFT_WE]128 data.sns_2_FFT_WE = _arrayDeserializer.uint16(buffer, bufferOffset, null)129 // Deserialize message field [sns_2_4Ch]130 data.sns_2_4Ch = _arrayDeserializer.int16(buffer, bufferOffset, null)131 // Deserialize message field [sns_2_F_M]132 data.sns_2_F_M = _arrayDeserializer.float32(buffer, bufferOffset, null)133 // Deserialize message field [sns1_vorticity]134 data.sns1_vorticity = _deserializer.float32(buffer, bufferOffset);135 // Deserialize message field [sns2_vorticity]136 data.sns2_vorticity = _deserializer.float32(buffer, bufferOffset);137 return data;138 }139 static getMessageSize(object) {140 let length = 0;141 length += 2 * object.sns_1_FFT_NS.length;142 length += 2 * object.sns_1_FFT_WE.length;143 length += 2 * object.sns_1_4Ch.length;144 length += 4 * object.sns_1_F_M.length;145 length += 2 * object.sns_2_FFT_NS.length;146 length += 2 * object.sns_2_FFT_WE.length;147 length += 2 * object.sns_2_4Ch.length;148 length += 4 * object.sns_2_F_M.length;149 return length + 40;150 }151 static datatype() {152 // Returns string type for a message object153 return 'tae_psoc/SensorPacket';154 }155 static md5sum() {156 //Returns md5sum for a message object157 return 'b42cd8856cf6ff4337fc1ed6207fb9c0';158 }159 static messageDefinition() {160 // Returns full string definition for message161 return `162 uint16[] sns_1_FFT_NS163 uint16[] sns_1_FFT_WE164 int16[] sns_1_4Ch165 float32[] sns_1_F_M166 uint16[] sns_2_FFT_NS167 uint16[] sns_2_FFT_WE168 int16[] sns_2_4Ch169 float32[] sns_2_F_M170 float32 sns1_vorticity171 float32 sns2_vorticity172 173 174 `;175 }176 static Resolve(msg) {177 // deep-construct a valid message object instance of whatever was passed in178 if (typeof msg !== 'object' || msg === null) {179 msg = {};180 }181 const resolved = new SensorPacket(null);182 if (msg.sns_1_FFT_NS !== undefined) {183 resolved.sns_1_FFT_NS = msg.sns_1_FFT_NS;184 }185 else {186 resolved.sns_1_FFT_NS = []187 }188 if (msg.sns_1_FFT_WE !== undefined) {189 resolved.sns_1_FFT_WE = msg.sns_1_FFT_WE;190 }191 else {192 resolved.sns_1_FFT_WE = []193 }194 if (msg.sns_1_4Ch !== undefined) {195 resolved.sns_1_4Ch = msg.sns_1_4Ch;196 }197 else {198 resolved.sns_1_4Ch = []199 }200 if (msg.sns_1_F_M !== undefined) {201 resolved.sns_1_F_M = msg.sns_1_F_M;202 }203 else {204 resolved.sns_1_F_M = []205 }206 if (msg.sns_2_FFT_NS !== undefined) {207 resolved.sns_2_FFT_NS = msg.sns_2_FFT_NS;208 }209 else {210 resolved.sns_2_FFT_NS = []211 }212 if (msg.sns_2_FFT_WE !== undefined) {213 resolved.sns_2_FFT_WE = msg.sns_2_FFT_WE;214 }215 else {216 resolved.sns_2_FFT_WE = []217 }218 if (msg.sns_2_4Ch !== undefined) {219 resolved.sns_2_4Ch = msg.sns_2_4Ch;220 }221 else {222 resolved.sns_2_4Ch = []223 }224 if (msg.sns_2_F_M !== undefined) {225 resolved.sns_2_F_M = msg.sns_2_F_M;226 }227 else {228 resolved.sns_2_F_M = []229 }230 if (msg.sns1_vorticity !== undefined) {231 resolved.sns1_vorticity = msg.sns1_vorticity;232 }233 else {234 resolved.sns1_vorticity = 0.0235 }236 if (msg.sns2_vorticity !== undefined) {237 resolved.sns2_vorticity = msg.sns2_vorticity;238 }239 else {240 resolved.sns2_vorticity = 0.0241 }242 return resolved;243 }244};...

Full Screen

Full Screen

multiplots.py

Source:multiplots.py Github

copy

Full Screen

1#!/usr/bin/env python2# -*- coding: utf-8 -*-3import numpy as np4import pandas as pd5pd.set_option("display.max_rows", 5)6pd.set_option("display.max_columns", 6)7pd.plotting.register_matplotlib_converters()8import matplotlib.pyplot as plt9plt.rcParams.update({'figure.max_open_warning': 0})10import seaborn as sns11sns.set_theme(color_codes=True)12from matplotlib.backends.backend_pdf import PdfPages13pp = PdfPages('multiplots.pdf')14print("Setup Complete")15tips = sns.load_dataset("tips")16g = sns.FacetGrid(tips, col="time")17pp.savefig()18g.figure.clear()19g = sns.FacetGrid(tips, col="time")20g.map(sns.histplot, "tip")21pp.savefig()22g.figure.clear()23g = sns.FacetGrid(tips, col="sex", hue="smoker")24g.map(sns.scatterplot, "total_bill", "tip", alpha=.7)25g.add_legend()26pp.savefig()27g.figure.clear()28g = sns.FacetGrid(tips, row="smoker", col="time", margin_titles=True)29g.map(sns.regplot, "size", "total_bill", color=".3", fit_reg=False, x_jitter=.1)30pp.savefig()31g.figure.clear()32g = sns.FacetGrid(tips, col="day", height=4, aspect=.5)33g.map(sns.barplot, "sex", "total_bill", order=["Male", "Female"])34pp.savefig()35g.figure.clear()36ordered_days = tips.day.value_counts().index37g = sns.FacetGrid(tips, row="day", row_order=ordered_days,38 height=1.7, aspect=4,)39g.map(sns.kdeplot, "total_bill")40pp.savefig()41g.figure.clear()42pal = dict(Lunch="seagreen", Dinner=".7")43g = sns.FacetGrid(tips, hue="time", palette=pal, height=5)44g.map(sns.scatterplot, "total_bill", "tip", s=100, alpha=.5)45g.add_legend()46pp.savefig()47g.figure.clear()48attend = sns.load_dataset("attention").query("subject <= 12")49g = sns.FacetGrid(attend, col="subject", col_wrap=4, height=2, ylim=(0, 10))50g.map(sns.pointplot, "solutions", "score", order=[1, 2, 3], color=".3", ci=None)51pp.savefig()52g.figure.clear()53with sns.axes_style("white"):54 g = sns.FacetGrid(tips, row="sex", col="smoker", margin_titles=True, height=2.5)55g.map(sns.scatterplot, "total_bill", "tip", color="#334488")56g.set_axis_labels("Total bill (US Dollars)", "Tip")57g.set(xticks=[10, 30, 50], yticks=[2, 6, 10])58g.figure.subplots_adjust(wspace=.02, hspace=.02)59pp.savefig()60g.figure.clear()61g = sns.FacetGrid(tips, col="smoker", margin_titles=True, height=4)62g.map(plt.scatter, "total_bill", "tip", color="#338844", edgecolor="white", s=50, lw=1)63for ax in g.axes_dict.values():64 ax.axline((0, 0), slope=.2, c=".2", ls="--", zorder=0)65g.set(xlim=(0, 60), ylim=(0, 14))66pp.savefig()67g.figure.clear()68from scipy import stats69def quantile_plot(x, **kwargs):70 quantiles, xr = stats.probplot(x, fit=False)71 plt.scatter(xr, quantiles, **kwargs)72g = sns.FacetGrid(tips, col="sex", height=4)73g.map(quantile_plot, "total_bill")74pp.savefig()75g.figure.clear()76def qqplot(x, y, **kwargs):77 _, xr = stats.probplot(x, fit=False)78 _, yr = stats.probplot(y, fit=False)79 plt.scatter(xr, yr, **kwargs)80g = sns.FacetGrid(tips, col="smoker", height=4)81g.map(qqplot, "total_bill", "tip")82pp.savefig()83g.figure.clear()84g = sns.FacetGrid(tips, hue="time", col="sex", height=4)85g.map(qqplot, "total_bill", "tip")86g.add_legend()87pp.savefig()88g.figure.clear()89def hexbin(x, y, color, **kwargs):90 cmap = sns.light_palette(color, as_cmap=True)91 plt.hexbin(x, y, gridsize=15, cmap=cmap, **kwargs)92with sns.axes_style("dark"):93 g = sns.FacetGrid(tips, hue="time", col="time", height=4)94g.map(hexbin, "total_bill", "tip", extent=[0, 50, 0, 10]);95pp.savefig()96g.figure.clear()97iris = sns.load_dataset("iris")98g = sns.PairGrid(iris)99g.map(sns.scatterplot)100pp.savefig()101g.figure.clear()102g = sns.PairGrid(iris)103g.map_diag(sns.histplot)104g.map_offdiag(sns.scatterplot)105pp.savefig()106g.figure.clear()107g = sns.PairGrid(iris, hue="species")108g.map_diag(sns.histplot)109g.map_offdiag(sns.scatterplot)110g.add_legend()111pp.savefig()112g.figure.clear()113g = sns.PairGrid(iris, vars=["sepal_length", "sepal_width"], hue="species")114g.map(sns.scatterplot)115pp.savefig()116g.figure.clear()117g = sns.PairGrid(iris)118g.map_upper(sns.scatterplot)119g.map_lower(sns.kdeplot)120g.map_diag(sns.kdeplot, lw=3, legend=False)121pp.savefig()122g.figure.clear()123g = sns.PairGrid(tips, y_vars=["tip"], x_vars=["total_bill", "size"], height=4)124g.map(sns.regplot, color=".3")125g.set(ylim=(-1, 11), yticks=[0, 5, 10])126pp.savefig()127g.figure.clear()128g = sns.PairGrid(tips, hue="size", palette="GnBu_d")129g.map(plt.scatter, s=50, edgecolor="white")130g.add_legend()131pp.savefig()132g.figure.clear()133g = sns.pairplot(iris, hue="species", height=2.5)134pp.savefig()135g.figure.clear()136g = sns.pairplot(iris, hue="species", palette="Set2", diag_kind="kde", height=2.5)137pp.savefig()138g.figure.clear()...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { Matchers, Pact } = require('@pact-foundation/pact');2const { like, term } = Matchers;3const { somethingLike } = require('@pact-foundation/pact/dsl/matchers');4const { eachLike } = require('@pact-foundation/pact/dsl/matchers');5const { term } = require('@pact-foundation/pact/dsl/matchers');6const { like } = require('@pact-foundation/pact/dsl/matchers');7const { eachLike } = require('@pact-foundation/pact/dsl/matchers');8const { somethingLike } = require('@pact-foundation/pact/dsl/matchers');9const { Matchers, Pact } = require('@pact-foundation/pact');10const { like, term } = Matchers;11const { somethingLike } = require('@pact-foundation/pact/dsl/matchers');12const { eachLike } = require('@pact-foundation/pact/dsl/matchers');13const { term } = require('@pact-foundation/pact/dsl/matchers');14const { like } = require('@pact-foundation/pact/dsl/matchers');15const { eachLike } = require('@pact-foundation/pact/dsl/matchers');16const { somethingLike } = require('@pact-foundation/pact/dsl/matchers');17const { Matchers, Pact } = require('@pact-foundation/pact');18const { like, term } = Matchers;19const { somethingLike } = require('@pact-foundation/pact/dsl/matchers');20const { eachLike } = require('@pact-foundation/pact/dsl/matchers');21const { term } = require('@pact-foundation/pact/dsl/matchers');22const { like } = require('@pact-foundation/pact/dsl/matchers');23const { eachLike } = require('@pact-foundation/pact/dsl/matchers');24const { somethingLike } = require('@pact-foundation/pact/dsl/matchers');25const { Matchers, Pact } = require('@pact-foundation/pact');26const { like, term } = Matchers;27const { somethingLike } = require('@pact-foundation/pact/dsl/matchers');28const { eachLike } = require('@pact-foundation/pact/dsl/matchers');29const {

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pact-foundation-pact automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful