content stringlengths 1 1.04M | input_ids listlengths 1 774k | ratio_char_token float64 0.38 22.9 | token_count int64 1 774k |
|---|---|---|---|
import torch
import numpy as np
import torch.nn.functional as F
import cv2
if __name__ == '__main__':
from bbox_model.kpda_parser import KPDA
import cv2
from bbox_model.config import Config
import numpy as np
config = Config('whale')
# db_path = '/home/storage/lsy/fashion/FashionAI_Keypoint_Detection/train/'
kpda = KPDA(config)
img_path = kpda.get_image_path(0)
kpts = kpda.get_keypoints(0)
kpts = torch.from_numpy(kpts)
img = cv2.imread(img_path,1)
image = np.zeros([2048, 2048, 3])
image[:img.shape[0], :img.shape[1], :] = img
cv2.imwrite('img.jpg', image)
ke = KeypointEncoder()
heatmaps, _ = ke.encode(kpts, image.shape[:2], config.hm_stride, config.hm_sigma, config.hm_sigma)
for i, heatmap in enumerate(heatmaps):
heatmap = np.expand_dims(heatmap.numpy() * 255, 2)
cv2.imwrite('map%d.jpg' % i, heatmap ) | [
11748,
28034,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
198,
11748,
269,
85,
17,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
422,
275,
3524,... | 2.219753 | 405 |
#if 0 /*
# -----------------------------------------------------------------------
# vcdinfo.py - parse vcd track informations
# -----------------------------------------------------------------------
# $Id: vcdinfo.py,v 1.8 2004/06/25 13:20:35 dischi Exp $
#
# $Log: vcdinfo.py,v $
# Revision 1.8 2004/06/25 13:20:35 dischi
# FreeBSD patches
#
# Revision 1.7 2003/06/30 13:17:19 the_krow
# o Refactored mediainfo into factory, synchronizedobject
# o Parsers now register directly at mmpython not at mmpython.mediainfo
# o use mmpython.Factory() instead of mmpython.mediainfo.get_singleton()
# o Bugfix in PNG parser
# o Renamed disc.AudioInfo into disc.AudioDiscInfo
# o Renamed disc.DataInfo into disc.DataDiscInfo
#
# Revision 1.6 2003/06/10 22:11:36 dischi
# some fixes
#
# Revision 1.5 2003/06/09 12:47:53 dischi
# more track info
#
#
# -----------------------------------------------------------------------
# Copyright (C) 2003 Thomas Schueppel, Dirk Meyer
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ----------------------------------------------------------------------- */
#endif
import mmpython
from mmpython import mediainfo
from discinfo import DiscInfo
import cdrom
mmpython.registertype( 'video/vcd', mediainfo.EXTENSION_DEVICE, mediainfo.TYPE_AV, VCDInfo )
| [
2,
361,
657,
11900,
198,
2,
16529,
26866,
198,
2,
410,
10210,
10951,
13,
9078,
532,
21136,
410,
10210,
2610,
4175,
602,
198,
2,
16529,
26866,
198,
2,
720,
7390,
25,
410,
10210,
10951,
13,
9078,
11,
85,
352,
13,
23,
5472,
14,
3312,... | 3.582721 | 544 |
import os
from typing import List
from fastapi import FastAPI, File, UploadFile
from fastapi.responses import HTMLResponse
from fastapi import Request
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates
app = FastAPI()
app.mount("/static", StaticFiles(directory="static"), name="static")
templates = Jinja2Templates(directory="templates")
UPLOAD_DIR = "uploaded"
os.makedirs(UPLOAD_DIR, exist_ok=True)
from fastapi_file_helper import save_upload_file
@app.post("/uploadfiles/")
@app.get("/")
| [
11748,
28686,
198,
6738,
19720,
1330,
7343,
198,
198,
6738,
3049,
15042,
1330,
12549,
17614,
11,
9220,
11,
36803,
8979,
198,
6738,
3049,
15042,
13,
16733,
274,
1330,
11532,
31077,
198,
198,
6738,
3049,
15042,
1330,
19390,
198,
6738,
3049,... | 3.156977 | 172 |
import certifi
import urllib3
import asyncio
import aiohttp
import ipaddress
import time
from connection import Connection
from bencode import Parser
from torrent import Torrent
from block import Piece, Block
if __name__ == "__main__":
path = './test/ubuntu-20.10-desktop-amd64.iso.torrent'
torrent = Torrent(path)
tracker = Tracker(torrent)
loop = asyncio.get_event_loop()
task = loop.create_task(tracker.download())
loop.run_until_complete(task)
| [
11748,
5051,
22238,
198,
11748,
2956,
297,
571,
18,
198,
11748,
30351,
952,
198,
11748,
257,
952,
4023,
198,
11748,
20966,
21975,
198,
11748,
640,
198,
6738,
4637,
1330,
26923,
198,
6738,
1888,
8189,
1330,
23042,
263,
198,
6738,
24458,
... | 2.927711 | 166 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tools import pycompat
from odoo.tools import mute_logger
from odoo.tools.translate import quote, unquote, xml_translate, html_translate
from odoo.tests.common import TransactionCase, BaseCase
from psycopg2 import IntegrityError
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2142,
286,
10529,
2238,
13,
4091,
38559,
24290,
2393,
329,
1336,
6634,
290,
15665,
3307,
13,
198,
6738,
16298,
2238,
13,
31391,
1330,
12972,
5589,
265,
198,
6738,
162... | 3.366337 | 101 |
import copy
import typing
from slender import List
KT = typing.TypeVar('KT')
VT = typing.TypeVar('VT')
| [
198,
11748,
4866,
198,
11748,
19720,
198,
198,
6738,
36808,
1330,
7343,
198,
198,
42176,
796,
19720,
13,
6030,
19852,
10786,
42176,
11537,
198,
36392,
796,
19720,
13,
6030,
19852,
10786,
36392,
11537,
198,
220,
220,
220,
220,
198,
220,
... | 2.537037 | 54 |
# uncompyle6 version 3.2.0
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
# Embedded file name: pirates.ship.ShipGlobals
from pandac.PandaModules import *
from direct.showbase.PythonUtil import Enum
from pirates.uberdog.UberDogGlobals import *
from pirates.uberdog.UberDogGlobals import InventoryType
from direct.actor import Actor
from direct.task import Task
from pirates.inventory import ItemGlobals
import random, copy, math
FORMATION_ARROW = 0
FORMATION_CIRCLE = 1
FORMATION_LINE = 2
FORMATION_WALL = 3
FORMATION_DEFAULT = FORMATION_ARROW
FORMATION_ICON_CHEST = 0
FORMATION_ICON_SKULL = 1
FORMATION_AVOID_SPHERE_RADIUS = 100
AI_SHIP = 0
PLAYER_SHIP = 1
CANNONDEFENSE_SHIP = 2
FISHING_SHIP = 3
SEIZEABLE_SHIP = 4
SEIZEABLE_SHIP_TIME = 60 * 30
SHIP_MOVIE_BOARD = 0
SHIP_MOVIE_UNBOARD = 1
SHIP_BOARD_FROM_SWIM = 0
SHIP_BOARD_FROM_WALK = 1
ARMOR_REAR = 0
ARMOR_LEFT = -1
ARMOR_RIGHT = 1
AVOID_SPHERE_RADIUS = 100
SUNK_REPAIR_COST_MULTIPLIER = 2
SHIP_REAR_DAMAGE_BONUS = 1.25
MAST_LOGO_PLACEMENT_LIST = [
Logos.Bounty_Hunter_Wasp, Logos.Bounty_Hunter_Spider]
INTERCEPTORL1 = 1
INTERCEPTORL2 = 2
INTERCEPTORL3 = 3
MERCHANTL1 = 11
MERCHANTL2 = 12
MERCHANTL3 = 13
WARSHIPL1 = 21
WARSHIPL2 = 22
WARSHIPL3 = 23
WARSHIPCOM = 24
BRIGL1 = 25
BRIGL2 = 26
BRIGL3 = 27
SHIP_OF_THE_LINE = 30
HMS_VICTORY = 31
HMS_NEWCASTLE = 32
HMS_INVINCIBLE = 33
EITC_INTREPID = 34
EITC_CONQUERER = 35
EITC_LEVIATHAN = 36
EL_PATRONS_SHIP = 37
P_SKEL_PHANTOM = 38
P_SKEL_REVENANT = 39
P_SKEL_CEREBUS = 40
P_NAVY_KINGFISHER = 41
P_EITC_WARLORD = 42
NAVY_KRAKEN_HUNTER = 43
BLACK_PEARL = 50
DAUNTLESS = 51
FLYING_DUTCHMAN = 52
GOLIATH = 53
JOLLY_ROGER = 54
QUEEN_ANNES_REVENGE = 55
SKEL_WARSHIPL3 = 60
SKEL_INTERCEPTORL3 = 61
NAVY_FERRET = 80
NAVY_GREYHOUND = 81
NAVY_KINGFISHER = 82
NAVY_PREDATOR = 83
NAVY_BULWARK = 84
NAVY_VANGUARD = 85
NAVY_MONARCH = 86
NAVY_COLOSSUS = 87
NAVY_PANTHER = 88
NAVY_CENTURION = 89
NAVY_MAN_O_WAR = 90
NAVY_DREADNOUGHT = 91
NAVY_ELITE = 92
NAVY_BASTION = 93
EITC_SEA_VIPER = 100
EITC_BLOODHOUND = 101
EITC_BARRACUDA = 102
EITC_CORSAIR = 103
EITC_SENTINEL = 104
EITC_IRONWALL = 105
EITC_OGRE = 106
EITC_BEHEMOTH = 107
EITC_CORVETTE = 108
EITC_MARAUDER = 109
EITC_WARLORD = 110
EITC_JUGGERNAUT = 111
EITC_TYRANT = 112
SKEL_PHANTOM = 120
SKEL_REVENANT = 121
SKEL_STORM_REAPER = 122
SKEL_BLACK_HARBINGER = 123
SKEL_DEATH_OMEN = 124
SKEL_SHADOW_CROW_FR = 125
SKEL_HELLHOUND_FR = 126
SKEL_BLOOD_SCOURGE_FR = 127
SKEL_SHADOW_CROW_SP = 128
SKEL_HELLHOUND_SP = 129
SKEL_BLOOD_SCOURGE_SP = 130
HUNTER_VENGEANCE = 160
HUNTER_CUTTER_SHARK = 161
HUNTER_FLYING_STORM = 162
HUNTER_KILLYADED = 163
HUNTER_RED_DERVISH = 164
HUNTER_CENTURY_HAWK = 165
HUNTER_SCORNED_SIREN = 166
HUNTER_TALLYHO = 180
HUNTER_BATTLEROYALE = 181
HUNTER_EN_GARDE = 182
STUMPY_SHIP = 255
PLAYER_SHIPS = (
INTERCEPTORL1, INTERCEPTORL2, INTERCEPTORL3, MERCHANTL1, MERCHANTL2, MERCHANTL3, WARSHIPL1, WARSHIPL2, WARSHIPL3, BRIGL1, BRIGL2, BRIGL3, SHIP_OF_THE_LINE, EL_PATRONS_SHIP, P_SKEL_PHANTOM, P_SKEL_REVENANT, P_SKEL_CEREBUS, P_NAVY_KINGFISHER, P_EITC_WARLORD, NAVY_KRAKEN_HUNTER)
UNPAID_SHIPS = (
INTERCEPTORL1, MERCHANTL1, WARSHIPL1, BRIGL1)
MAST_LOGO_PLACEMENT = {INTERCEPTORL1: [0], INTERCEPTORL2: [0], INTERCEPTORL3: [0], MERCHANTL1: [1], MERCHANTL2: [1], MERCHANTL3: [1], WARSHIPL1: [0], WARSHIPL2: [0], WARSHIPL3: [0], BRIGL1: [0], BRIGL2: [0], BRIGL3: [0], WARSHIPCOM: [0]}
SHIP_CLASS_LIST = [
'INTERCEPTORL1', 'INTERCEPTORL2', 'INTERCEPTORL3', 'MERCHANTL1', 'MERCHANTL2', 'MERCHANTL3', 'WARSHIPL1', 'WARSHIPL2', 'WARSHIPL3', 'BRIGL1', 'BRIGL2', 'BRIGL3', 'BLACK_PEARL', 'DAUNTLESS', 'FLYING_DUTCHMAN', 'GOLIATH', 'QUEEN_ANNES_REVENGE', 'SKEL_WARSHIPL3', 'SKEL_INTERCEPTORL3', 'STUMPY_SHIP', 'NAVY_FERRET', 'NAVY_GREYHOUND', 'NAVY_KINGFISHER', 'NAVY_PREDATOR', 'NAVY_BULWARK', 'NAVY_VANGUARD', 'NAVY_MONARCH', 'NAVY_COLOSSUS', 'NAVY_PANTHER', 'NAVY_CENTURION', 'NAVY_MAN_O_WAR', 'NAVY_DREADNOUGHT', 'EITC_SEA_VIPER', 'EITC_BLOODHOUND', 'EITC_BARRACUDA', 'EITC_CORSAIR', 'EITC_SENTINEL', 'EITC_IRONWALL', 'EITC_OGRE', 'EITC_BEHEMOTH', 'EITC_CORVETTE', 'EITC_MARAUDER', 'EITC_WARLORD', 'EITC_JUGGERNAUT', 'SKEL_PHANTOM', 'SKEL_REVENANT', 'SKEL_STORM_REAPER', 'SKEL_BLACK_HARBINGER', 'SKEL_DEATH_OMEN', 'SKEL_SHADOW_CROW_FR', 'SKEL_HELLHOUND_FR', 'SKEL_BLOOD_SCOURGE_FR', 'SKEL_SHADOW_CROW_SP', 'SKEL_HELLHOUND_SP', 'SKEL_BLOOD_SCOURGE_SP', 'HUNTER_VENGEANCE']
__hullArmor = {WARSHIPL1: [1000, 2000, 2000], WARSHIPL2: [1500, 3000, 3000], WARSHIPL3: [2500, 5000, 5000], MERCHANTL1: [1600, 1400, 1400], MERCHANTL2: [2200, 2400, 2400], MERCHANTL3: [3400, 4000, 4000], INTERCEPTORL1: [800, 1000, 1000], INTERCEPTORL2: [1200, 1800, 1800], INTERCEPTORL3: [2000, 3600, 3600], BRIGL1: [1300, 1500, 1500], BRIGL2: [1900, 2700, 2700], BRIGL3: [3000, 4500, 4500], SHIP_OF_THE_LINE: [50000, 100000, 100000], SKEL_WARSHIPL3: [2800, 5200, 5200], SKEL_INTERCEPTORL3: [2400, 4200, 4200], BLACK_PEARL: [3000, 5400, 5400], GOLIATH: [3200, 5600, 5600], QUEEN_ANNES_REVENGE: [3000, 4000, 4000]}
defaultAcceleration = 20
defaultMaxSpeed = 120
defaultMaxReverseSpeed = defaultMaxSpeed / 1.5
defaultReverseAcceleration = defaultAcceleration / 1.5
defaultMaxReverseAcceleration = 10
defaultTurn = 6
defaultMaxTurn = 20
defaultShipMass = 1.0
defaultWaterIntake = 0.05
__maxHullStats = {}
__shipConfigs = {WARSHIPL1: {'setShipClass': WARSHIPL1, 'modelClass': WARSHIPL1, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Square, 1), 'mastConfig2': (Masts.Main_Square, 2), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 8, 'leftBroadsides': [Cannons.L2] * 5, 'rightBroadsides': [Cannons.L2] * 5, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 4200, 'sp': 6000, 'maxCargo': 8, 'maxCrew': 8, 'maxCannons': 8, 'maxBroadsides': 10, 'rammingPower': 450, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, WARSHIPL2: {'setShipClass': WARSHIPL2, 'modelClass': WARSHIPL2, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 2), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 10, 'leftBroadsides': [Cannons.L2] * 7, 'rightBroadsides': [Cannons.L2] * 7, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 8400, 'sp': 9000, 'maxCargo': 12, 'maxCrew': 10, 'maxCannons': 10, 'maxBroadsides': 14, 'rammingPower': 900, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, WARSHIPL3: {'setShipClass': WARSHIPL3, 'modelClass': WARSHIPL3, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'rightBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 12600, 'sp': 12000, 'maxCargo': 16, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 20, 'rammingPower': 1800, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, BRIGL1: {'setShipClass': BRIGL1, 'modelClass': BRIGL1, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Square, 1), 'mastConfig2': (Masts.Main_Square, 2), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 6, 'leftBroadsides': [Cannons.L2] * 5, 'rightBroadsides': [Cannons.L2] * 5, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 3900, 'sp': 5500, 'maxCargo': 8, 'maxCrew': 8, 'maxCannons': 8, 'maxBroadsides': 10, 'rammingPower': 400, 'acceleration': 1.15 * defaultAcceleration, 'maxSpeed': 0.85 * defaultMaxSpeed, 'reverseAcceleration': 0.75 * defaultReverseAcceleration, 'maxReverseSpeed': 0.75 * defaultMaxReverseAcceleration, 'turn': 0.7 * defaultTurn, 'maxTurn': 0.7 * defaultMaxTurn}, BRIGL2: {'setShipClass': BRIGL2, 'modelClass': BRIGL2, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 2), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 10, 'leftBroadsides': [Cannons.L2] * 7, 'rightBroadsides': [Cannons.L2] * 7, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 7800, 'sp': 8000, 'maxCargo': 12, 'maxCrew': 10, 'maxCannons': 10, 'maxBroadsides': 16, 'rammingPower': 750, 'acceleration': 1.15 * defaultAcceleration, 'maxSpeed': 0.85 * defaultMaxSpeed, 'reverseAcceleration': 0.75 * defaultReverseAcceleration, 'maxReverseSpeed': 0.75 * defaultMaxReverseAcceleration, 'turn': 0.7 * defaultTurn, 'maxTurn': 0.7 * defaultMaxTurn}, BRIGL3: {'setShipClass': BRIGL3, 'modelClass': BRIGL3, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 12, 'leftBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2], 'rightBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2], 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 12000, 'sp': 11000, 'maxCargo': 16, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 22, 'rammingPower': 1400, 'acceleration': 1.15 * defaultAcceleration, 'maxSpeed': 0.85 * defaultMaxSpeed, 'reverseAcceleration': 0.75 * defaultReverseAcceleration, 'maxReverseSpeed': 0.75 * defaultMaxReverseAcceleration, 'turn': 0.7 * defaultTurn, 'maxTurn': 0.7 * defaultMaxTurn}, SHIP_OF_THE_LINE: {'setShipClass': SHIP_OF_THE_LINE, 'modelClass': SHIP_OF_THE_LINE, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2] * 12, 'rightBroadsides': [Cannons.L2] * 12, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 20000, 'sp': 15000, 'maxCargo': 24, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 12, 'rammingPower': 3600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.5 * defaultTurn, 'maxTurn': 0.5 * defaultMaxTurn}, EL_PATRONS_SHIP: {'setShipClass': EL_PATRONS_SHIP, 'modelClass': WARSHIPL3, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'rightBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'broadsideAmmo': InventoryType.CannonGrapeShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 12600, 'sp': 12000, 'maxCargo': 16, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 20, 'rammingPower': 1800, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, P_SKEL_PHANTOM: {'setShipClass': P_SKEL_PHANTOM, 'modelClass': SKEL_WARSHIPL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Main_A, 3), 'mastConfig2': (Masts.Skel_Main_B, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Skel_Fore, 2), 'aftmastConfig': (Masts.Skel_Aft, 2), 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 6, 'leftBroadsides': [0, Cannons.Skel_L2, Cannons.Skel_L2, Cannons.Skel_L2, Cannons.Skel_L2, Cannons.Skel_L2, 0], 'rightBroadsides': [0, Cannons.Skel_L2, Cannons.Skel_L2, Cannons.Skel_L2, Cannons.Skel_L2, Cannons.Skel_L2, 0], 'broadsideAmmo': InventoryType.CannonThunderbolt, 'cannonAmmo': InventoryType.CannonChainShot, 'prow': 0, 'hp': 2500, 'sp': 6000, 'maxCargo': 14, 'maxCrew': 8, 'maxCannons': 8, 'maxBroadsides': 14, 'rammingPower': 1600, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, P_SKEL_REVENANT: {'setShipClass': P_SKEL_REVENANT, 'modelClass': SKEL_WARSHIPL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Main_A, 3), 'mastConfig2': (Masts.Skel_Main_B, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Skel_Fore, 2), 'aftmastConfig': (Masts.Skel_Aft, 2), 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 6, 'leftBroadsides': [Cannons.Skel_L2] * 6, 'rightBroadsides': [Cannons.Skel_L2] * 6, 'broadsideAmmo': InventoryType.CannonFury, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 2500, 'sp': 6000, 'maxCargo': 14, 'maxCrew': 8, 'maxCannons': 8, 'maxBroadsides': 14, 'rammingPower': 1600, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, P_SKEL_CEREBUS: {'setShipClass': P_SKEL_CEREBUS, 'modelClass': SKEL_INTERCEPTORL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': 0, 'aftmastConfig': 0, 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 5, 'leftBroadsides': [Cannons.Skel_L2] * 5, 'rightBroadsides': [Cannons.Skel_L2] * 5, 'broadsideAmmo': InventoryType.CannonExplosive, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 3000, 'sp': 6000, 'maxCargo': 12, 'maxCrew': 8, 'maxCannons': 6, 'maxBroadsides': 14, 'rammingPower': 500, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, P_NAVY_KINGFISHER: {'setShipClass': P_NAVY_KINGFISHER, 'modelClass': INTERCEPTORL3, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 6, 'leftBroadsides': [Cannons.L1] * 5, 'rightBroadsides': [Cannons.L1] * 5, 'broadsideAmmo': InventoryType.CannonChainShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': Prows.Lady, 'hp': 1200, 'sp': 4000, 'maxCargo': 14, 'maxCrew': 3, 'maxCannons': 9, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, P_EITC_WARLORD: {'setShipClass': P_EITC_WARLORD, 'modelClass': WARSHIPL3, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.EITC, 'cannons': [Cannons.L3] * 12, 'leftBroadsides': [Cannons.L2] * 9, 'rightBroadsides': [Cannons.L2] * 9, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 2100, 'sp': 6000, 'maxCargo': 16, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 20, 'rammingPower': 2400, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, NAVY_KRAKEN_HUNTER: {'setShipClass': NAVY_KRAKEN_HUNTER, 'modelClass': SHIP_OF_THE_LINE, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2] * 12, 'rightBroadsides': [Cannons.L2] * 12, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonChainShot, 'prow': 0, 'hp': 20000, 'sp': 15000, 'maxCargo': 0, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 12, 'rammingPower': 3600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.5 * defaultTurn, 'maxTurn': 0.5 * defaultMaxTurn}, HMS_VICTORY: {'setShipClass': HMS_VICTORY, 'modelClass': SHIP_OF_THE_LINE, 'defaultStyle': Styles.Treasure_Navy, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Treasure_Navy, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2] * 12, 'rightBroadsides': [Cannons.L2] * 12, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 20000, 'sp': 15000, 'maxCargo': 8, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 12, 'rammingPower': 3600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.5 * defaultTurn, 'maxTurn': 0.5 * defaultMaxTurn}, HMS_NEWCASTLE: {'setShipClass': HMS_NEWCASTLE, 'modelClass': SHIP_OF_THE_LINE, 'defaultStyle': Styles.Treasure_Navy, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Treasure_Navy, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2] * 12, 'rightBroadsides': [Cannons.L2] * 12, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonChainShot, 'prow': 0, 'hp': 20000, 'sp': 15000, 'maxCargo': 8, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 12, 'rammingPower': 3600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.5 * defaultTurn, 'maxTurn': 0.5 * defaultMaxTurn}, HMS_INVINCIBLE: {'setShipClass': HMS_INVINCIBLE, 'modelClass': SHIP_OF_THE_LINE, 'defaultStyle': Styles.Treasure_Navy, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Treasure_Navy, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2] * 12, 'rightBroadsides': [Cannons.L2] * 12, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonExplosive, 'prow': 0, 'hp': 20000, 'sp': 15000, 'maxCargo': 8, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 12, 'rammingPower': 3600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.5 * defaultTurn, 'maxTurn': 0.5 * defaultMaxTurn}, EITC_INTREPID: {'setShipClass': EITC_INTREPID, 'modelClass': SHIP_OF_THE_LINE, 'defaultStyle': Styles.Treasure_EITC, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Treasure_EITC, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2] * 12, 'rightBroadsides': [Cannons.L2] * 12, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 20000, 'sp': 15000, 'maxCargo': 8, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 12, 'rammingPower': 3600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.5 * defaultTurn, 'maxTurn': 0.5 * defaultMaxTurn}, EITC_CONQUERER: {'setShipClass': EITC_CONQUERER, 'modelClass': SHIP_OF_THE_LINE, 'defaultStyle': Styles.Treasure_EITC, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Treasure_EITC, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2] * 12, 'rightBroadsides': [Cannons.L2] * 12, 'broadsideAmmo': InventoryType.CannonExplosive, 'cannonAmmo': InventoryType.CannonChainShot, 'prow': 0, 'hp': 20000, 'sp': 15000, 'maxCargo': 8, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 12, 'rammingPower': 3600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.5 * defaultTurn, 'maxTurn': 0.5 * defaultMaxTurn}, EITC_LEVIATHAN: {'setShipClass': EITC_LEVIATHAN, 'modelClass': SHIP_OF_THE_LINE, 'defaultStyle': Styles.Treasure_EITC, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Treasure_EITC, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2] * 12, 'rightBroadsides': [Cannons.L2] * 12, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonChainShot, 'prow': 0, 'hp': 20000, 'sp': 15000, 'maxCargo': 8, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 12, 'rammingPower': 3600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.5 * defaultTurn, 'maxTurn': 0.5 * defaultMaxTurn}, MERCHANTL1: {'setShipClass': MERCHANTL1, 'modelClass': MERCHANTL1, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 1), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 4, 'leftBroadsides': [Cannons.L2] * 5, 'rightBroadsides': [Cannons.L2] * 5, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': Prows.Skeleton, 'hp': 3600, 'sp': 5000, 'maxCargo': 10, 'maxCrew': 6, 'maxCannons': 4, 'maxBroadsides': 10, 'rammingPower': 300, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, MERCHANTL2: {'setShipClass': MERCHANTL2, 'modelClass': MERCHANTL2, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Square, 1), 'mastConfig2': (Masts.Main_Square, 2), 'mastConfig3': (Masts.Main_Square, 1), 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 8, 'leftBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, 0, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'rightBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, 0, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': Prows.Skeleton, 'hp': 7200, 'sp': 7000, 'maxCargo': 14, 'maxCrew': 8, 'maxCannons': 8, 'maxBroadsides': 18, 'rammingPower': 600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, MERCHANTL3: {'setShipClass': MERCHANTL3, 'modelClass': MERCHANTL3, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 10, 'leftBroadsides': [Cannons.L2] * 12, 'rightBroadsides': [Cannons.L2] * 12, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': Prows.Skeleton, 'hp': 10800, 'sp': 10000, 'maxCargo': 18, 'maxCrew': 10, 'maxCannons': 10, 'maxBroadsides': 24, 'rammingPower': 1200, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, INTERCEPTORL1: {'setShipClass': INTERCEPTORL1, 'modelClass': INTERCEPTORL1, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 2, 'leftBroadsides': [Cannons.L2] * 3, 'rightBroadsides': [Cannons.L2] * 3, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': Prows.Skeleton, 'hp': 2400, 'sp': 4000, 'maxCargo': 6, 'maxCrew': 3, 'maxCannons': 2, 'maxBroadsides': 6, 'rammingPower': 150, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, INTERCEPTORL2: {'setShipClass': INTERCEPTORL2, 'modelClass': INTERCEPTORL2, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 6, 'leftBroadsides': [Cannons.L1] * 5, 'rightBroadsides': [Cannons.L1] * 5, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': Prows.Skeleton, 'hp': 4800, 'sp': 6000, 'maxCargo': 10, 'maxCrew': 6, 'maxCannons': 6, 'maxBroadsides': 10, 'rammingPower': 300, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, INTERCEPTORL3: {'setShipClass': INTERCEPTORL3, 'modelClass': INTERCEPTORL3, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 8, 'leftBroadsides': [Cannons.L1] * 7, 'rightBroadsides': [Cannons.L1] * 7, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': Prows.Skeleton, 'hp': 7200, 'sp': 9000, 'maxCargo': 14, 'maxCrew': 9, 'maxCannons': 8, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, BLACK_PEARL: {'setShipClass': BLACK_PEARL, 'modelClass': BLACK_PEARL, 'defaultStyle': Styles.BP, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.BlackPearl, 'cannons': [Cannons.BP] * 14, 'leftBroadsides': [Cannons.BP] * 9, 'rightBroadsides': [Cannons.BP] * 9, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 6000, 'sp': 8000, 'maxCargo': 20, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 18, 'rammingPower': 2000, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.7 * defaultTurn, 'maxTurn': 0.7 * defaultMaxTurn}, STUMPY_SHIP: {'setShipClass': INTERCEPTORL1, 'modelClass': INTERCEPTORL1, 'defaultStyle': Styles.Player, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.Tutorial, 0], 'leftBroadsides': [], 'rightBroadsides': [], 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': Prows.Skeleton, 'hp': 2400, 'sp': 4000, 'maxCargo': 5, 'maxCrew': 2, 'maxCannons': 2, 'maxBroadsides': 0, 'rammingPower': 150, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.7 * defaultTurn, 'maxTurn': 0.7 * defaultMaxTurn}, GOLIATH: {'setShipClass': GOLIATH, 'modelClass': GOLIATH, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L4] * 9, 'rightBroadsides': [Cannons.L4] * 9, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 3500, 'sp': 6000, 'maxCargo': 3, 'maxCrew': 8, 'maxCannons': 18, 'maxBroadsides': 18, 'rammingPower': 900, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 1.2 * defaultMaxSpeed, 'reverseAcceleration': 0.9 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, QUEEN_ANNES_REVENGE: {'setShipClass': QUEEN_ANNES_REVENGE, 'modelClass': QUEEN_ANNES_REVENGE, 'defaultStyle': Styles.QueenAnnesRevenge, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 10, 'leftBroadsides': [Cannons.L2] * 12, 'rightBroadsides': [Cannons.L2] * 12, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': Prows.Skeleton, 'hp': 9000, 'sp': 10000, 'maxCargo': 16, 'maxCrew': 10, 'maxCannons': 12, 'maxBroadsides': 22, 'rammingPower': 1200, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, NAVY_PANTHER: {'setShipClass': NAVY_PANTHER, 'modelClass': WARSHIPL1, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Square, 1), 'mastConfig2': (Masts.Main_Square, 2), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 6, 'leftBroadsides': [Cannons.L2] * 4, 'rightBroadsides': [Cannons.L2] * 4, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 1700, 'sp': 4000, 'maxCargo': 2, 'maxCrew': 3, 'maxCannons': 8, 'maxBroadsides': 10, 'rammingPower': 150, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, NAVY_CENTURION: {'setShipClass': NAVY_CENTURION, 'modelClass': WARSHIPL2, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 2), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 8, 'leftBroadsides': [Cannons.L2] * 6, 'rightBroadsides': [Cannons.L2] * 6, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 2100, 'sp': 5000, 'maxCargo': 3, 'maxCrew': 6, 'maxCannons': 10, 'maxBroadsides': 14, 'rammingPower': 450, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, NAVY_MAN_O_WAR: {'setShipClass': NAVY_MAN_O_WAR, 'modelClass': WARSHIPL3, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 10, 'leftBroadsides': [Cannons.L2] * 8, 'rightBroadsides': [Cannons.L2] * 8, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 2100, 'sp': 6000, 'maxCargo': 3, 'maxCrew': 8, 'maxCannons': 14, 'maxBroadsides': 20, 'rammingPower': 900, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, NAVY_DREADNOUGHT: {'setShipClass': NAVY_DREADNOUGHT, 'modelClass': WARSHIPL3, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L4] * 9, 'rightBroadsides': [Cannons.L4] * 9, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 2100, 'sp': 6000, 'maxCargo': 3, 'maxCrew': 8, 'maxCannons': 14, 'maxBroadsides': 20, 'rammingPower': 900, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, NAVY_ELITE: {'setShipClass': NAVY_ELITE, 'modelClass': WARSHIPL3, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L4] * 9, 'rightBroadsides': [Cannons.L4] * 9, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 4200, 'sp': 6000, 'maxCargo': 5, 'maxCrew': 8, 'maxCannons': 14, 'maxBroadsides': 20, 'rammingPower': 900, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, NAVY_BULWARK: {'setShipClass': NAVY_BULWARK, 'modelClass': MERCHANTL1, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 1), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 4, 'leftBroadsides': [0, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'rightBroadsides': [0, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'broadsideAmmo': InventoryType.CannonChainShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': Prows.Lady, 'hp': 1400, 'sp': 4000, 'maxCargo': 2, 'maxCrew': 6, 'maxCannons': 4, 'maxBroadsides': 10, 'rammingPower': 150, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, NAVY_VANGUARD: {'setShipClass': NAVY_VANGUARD, 'modelClass': MERCHANTL2, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Square, 1), 'mastConfig2': (Masts.Main_Square, 2), 'mastConfig3': (Masts.Main_Square, 1), 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 6, 'leftBroadsides': [Cannons.L3] * 5, 'rightBroadsides': [Cannons.L3] * 5, 'broadsideAmmo': InventoryType.CannonChainShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': Prows.Lady, 'hp': 1800, 'sp': 5000, 'maxCargo': 3, 'maxCrew': 10, 'maxCannons': 8, 'maxBroadsides': 18, 'rammingPower': 300, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, NAVY_MONARCH: {'setShipClass': NAVY_MONARCH, 'modelClass': MERCHANTL3, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 2), 'mastConfig3': (Masts.Main_Square, 2), 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 8, 'leftBroadsides': [0, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, 0, 0, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'rightBroadsides': [0, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, 0, 0, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'broadsideAmmo': InventoryType.CannonChainShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': Prows.Lady, 'hp': 1800, 'sp': 5500, 'maxCargo': 3, 'maxCrew': 14, 'maxCannons': 10, 'maxBroadsides': 24, 'rammingPower': 600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, NAVY_COLOSSUS: {'setShipClass': NAVY_COLOSSUS, 'modelClass': MERCHANTL3, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 10, 'leftBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'rightBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'broadsideAmmo': InventoryType.CannonChainShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': Prows.Lady, 'hp': 1800, 'sp': 5500, 'maxCargo': 3, 'maxCrew': 14, 'maxCannons': 10, 'maxBroadsides': 24, 'rammingPower': 600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, NAVY_BASTION: {'setShipClass': NAVY_BASTION, 'modelClass': MERCHANTL3, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 10, 'leftBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'rightBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0], 'broadsideAmmo': InventoryType.CannonChainShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': Prows.Lady, 'hp': 3600, 'sp': 5500, 'maxCargo': 5, 'maxCrew': 14, 'maxCannons': 10, 'maxBroadsides': 24, 'rammingPower': 600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, NAVY_FERRET: {'setShipClass': NAVY_FERRET, 'modelClass': INTERCEPTORL1, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 2, 'leftBroadsides': [], 'rightBroadsides': [], 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': Prows.Lady, 'hp': 1000, 'sp': 3000, 'maxCargo': 1, 'maxCrew': 4, 'maxCannons': 2, 'maxBroadsides': 6, 'rammingPower': 75, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, NAVY_GREYHOUND: {'setShipClass': NAVY_GREYHOUND, 'modelClass': INTERCEPTORL2, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': 0, 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 4, 'leftBroadsides': [Cannons.L1] * 3, 'rightBroadsides': [Cannons.L1] * 3, 'broadsideAmmo': InventoryType.CannonChainShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': Prows.Lady, 'hp': 1200, 'sp': 3500, 'maxCargo': 2, 'maxCrew': 8, 'maxCannons': 6, 'maxBroadsides': 10, 'rammingPower': 225, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, NAVY_KINGFISHER: {'setShipClass': NAVY_KINGFISHER, 'modelClass': INTERCEPTORL3, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 6, 'leftBroadsides': [Cannons.L1] * 5, 'rightBroadsides': [Cannons.L1] * 5, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': Prows.Lady, 'hp': 1200, 'sp': 4000, 'maxCargo': 2, 'maxCrew': 3, 'maxCannons': 8, 'maxBroadsides': 14, 'rammingPower': 450, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, NAVY_PREDATOR: {'setShipClass': NAVY_PREDATOR, 'modelClass': INTERCEPTORL3, 'defaultStyle': Styles.Navy, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.NoLogo, 'cannons': [Cannons.L1] * 8, 'leftBroadsides': [Cannons.L1] * 7, 'rightBroadsides': [Cannons.L1] * 7, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': Prows.Lady, 'hp': 1200, 'sp': 4000, 'maxCargo': 2, 'maxCrew': 3, 'maxCannons': 8, 'maxBroadsides': 14, 'rammingPower': 450, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, EITC_CORVETTE: {'setShipClass': EITC_CORVETTE, 'modelClass': WARSHIPL1, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Square, 1), 'mastConfig2': (Masts.Main_Square, 2), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.EITC, 'cannons': [Cannons.L3] * 6, 'leftBroadsides': [Cannons.L2] * 5, 'rightBroadsides': [Cannons.L2] * 5, 'broadsideAmmo': InventoryType.CannonChainShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 1700, 'sp': 4000, 'maxCargo': 2, 'maxCrew': 3, 'maxCannons': 8, 'maxBroadsides': 10, 'rammingPower': 150, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, EITC_MARAUDER: {'setShipClass': EITC_MARAUDER, 'modelClass': WARSHIPL2, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 2), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.EITC, 'cannons': [Cannons.L3] * 8, 'leftBroadsides': [Cannons.L2] * 7, 'rightBroadsides': [Cannons.L2] * 7, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonChainShot, 'prow': 0, 'hp': 2100, 'sp': 5000, 'maxCargo': 3, 'maxCrew': 6, 'maxCannons': 10, 'maxBroadsides': 14, 'rammingPower': 450, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, EITC_WARLORD: {'setShipClass': EITC_WARLORD, 'modelClass': WARSHIPL3, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.EITC, 'cannons': [Cannons.L3] * 12, 'leftBroadsides': [Cannons.L2] * 9, 'rightBroadsides': [Cannons.L2] * 9, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 2100, 'sp': 6000, 'maxCargo': 3, 'maxCrew': 8, 'maxCannons': 14, 'maxBroadsides': 20, 'rammingPower': 900, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, EITC_JUGGERNAUT: {'setShipClass': EITC_JUGGERNAUT, 'modelClass': WARSHIPL3, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.EITC, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2] * 10, 'rightBroadsides': [Cannons.L2] * 10, 'broadsideAmmo': InventoryType.CannonExplosive, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 2100, 'sp': 6000, 'maxCargo': 3, 'maxCrew': 8, 'maxCannons': 14, 'maxBroadsides': 20, 'rammingPower': 900, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, EITC_TYRANT: {'setShipClass': EITC_TYRANT, 'modelClass': WARSHIPL3, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.EITC, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2] * 10, 'rightBroadsides': [Cannons.L2] * 10, 'broadsideAmmo': InventoryType.CannonExplosive, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 4200, 'sp': 6000, 'maxCargo': 5, 'maxCrew': 8, 'maxCannons': 14, 'maxBroadsides': 20, 'rammingPower': 900, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, EITC_SENTINEL: {'setShipClass': EITC_SENTINEL, 'modelClass': MERCHANTL1, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 1), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.EITC, 'cannons': [Cannons.L1] * 4, 'leftBroadsides': [Cannons.L2] * 5, 'rightBroadsides': [Cannons.L2] * 5, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonChainShot, 'prow': Prows.Lady, 'hp': 1400, 'sp': 4000, 'maxCargo': 2, 'maxCrew': 6, 'maxCannons': 4, 'maxBroadsides': 10, 'rammingPower': 150, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, EITC_IRONWALL: {'setShipClass': EITC_IRONWALL, 'modelClass': MERCHANTL2, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Square, 1), 'mastConfig2': (Masts.Main_Square, 2), 'mastConfig3': (Masts.Main_Square, 1), 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.EITC, 'cannons': [Cannons.L1] * 6, 'leftBroadsides': [Cannons.L3] * 7, 'rightBroadsides': [Cannons.L3] * 7, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': Prows.Lady, 'hp': 1800, 'sp': 5000, 'maxCargo': 3, 'maxCrew': 10, 'maxCannons': 8, 'maxBroadsides': 18, 'rammingPower': 300, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, EITC_OGRE: {'setShipClass': EITC_OGRE, 'modelClass': MERCHANTL3, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 2), 'mastConfig3': (Masts.Main_Square, 2), 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.EITC, 'cannons': [Cannons.L1] * 8, 'leftBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, 0, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2], 'rightBroadsides': [Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, 0, 0, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2, Cannons.L2], 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': Prows.Lady, 'hp': 1800, 'sp': 5500, 'maxCargo': 3, 'maxCrew': 14, 'maxCannons': 10, 'maxBroadsides': 24, 'rammingPower': 600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, EITC_BEHEMOTH: {'setShipClass': EITC_BEHEMOTH, 'modelClass': MERCHANTL3, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.EITC, 'cannons': [Cannons.L1] * 10, 'leftBroadsides': [Cannons.L2] * 12, 'rightBroadsides': [Cannons.L2] * 12, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonExplosive, 'prow': Prows.Lady, 'hp': 1800, 'sp': 6000, 'maxCargo': 3, 'maxCrew': 14, 'maxCannons': 10, 'maxBroadsides': 24, 'rammingPower': 600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, EITC_SEA_VIPER: {'setShipClass': EITC_SEA_VIPER, 'modelClass': INTERCEPTORL1, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': 0, 'sailLogo': Logos.EITC, 'cannons': [Cannons.L1] * 2, 'leftBroadsides': [Cannons.L1] * 3, 'rightBroadsides': [Cannons.L1] * 3, 'broadsideAmmo': InventoryType.CannonChainShot, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': Prows.Lady, 'hp': 1000, 'sp': 3000, 'maxCargo': 1, 'maxCrew': 4, 'maxCannons': 2, 'maxBroadsides': 6, 'rammingPower': 75, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, EITC_BLOODHOUND: {'setShipClass': EITC_BLOODHOUND, 'modelClass': INTERCEPTORL2, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': 0, 'sailLogo': Logos.EITC, 'cannons': [Cannons.L1] * 6, 'leftBroadsides': [Cannons.L1] * 5, 'rightBroadsides': [Cannons.L1] * 5, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonChainShot, 'prow': Prows.Lady, 'hp': 1200, 'sp': 3500, 'maxCargo': 2, 'maxCrew': 8, 'maxCannons': 6, 'maxBroadsides': 10, 'rammingPower': 225, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, EITC_BARRACUDA: {'setShipClass': EITC_BARRACUDA, 'modelClass': INTERCEPTORL3, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.EITC, 'cannons': [Cannons.L1] * 6, 'leftBroadsides': [Cannons.L1] * 7, 'rightBroadsides': [Cannons.L1] * 7, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonChainShot, 'prow': Prows.Lady, 'hp': 1200, 'sp': 4000, 'maxCargo': 2, 'maxCrew': 3, 'maxCannons': 8, 'maxBroadsides': 14, 'rammingPower': 450, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, EITC_CORSAIR: {'setShipClass': EITC_CORSAIR, 'modelClass': INTERCEPTORL3, 'defaultStyle': Styles.EITC, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.EITC, 'cannons': [Cannons.L1] * 8, 'leftBroadsides': [Cannons.L1] * 7, 'rightBroadsides': [Cannons.L1] * 7, 'broadsideAmmo': InventoryType.CannonExplosive, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': Prows.Lady, 'hp': 1200, 'sp': 4000, 'maxCargo': 2, 'maxCrew': 3, 'maxCannons': 8, 'maxBroadsides': 14, 'rammingPower': 450, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, SKEL_PHANTOM: {'setShipClass': SKEL_PHANTOM, 'modelClass': SKEL_WARSHIPL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Main_A, 3), 'mastConfig2': (Masts.Skel_Main_B, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Skel_Fore, 2), 'aftmastConfig': (Masts.Skel_Aft, 2), 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 6, 'leftBroadsides': [0, Cannons.Skel_L2, Cannons.Skel_L2, Cannons.Skel_L2, Cannons.Skel_L2, Cannons.Skel_L2, 0], 'rightBroadsides': [0, Cannons.Skel_L2, Cannons.Skel_L2, Cannons.Skel_L2, Cannons.Skel_L2, Cannons.Skel_L2, 0], 'broadsideAmmo': InventoryType.CannonThunderbolt, 'cannonAmmo': InventoryType.CannonChainShot, 'prow': 0, 'hp': 2500, 'sp': 6000, 'maxCargo': 2, 'maxCrew': 8, 'maxCannons': 8, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, SKEL_REVENANT: {'setShipClass': SKEL_REVENANT, 'modelClass': SKEL_WARSHIPL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Main_A, 3), 'mastConfig2': (Masts.Skel_Main_B, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Skel_Fore, 2), 'aftmastConfig': (Masts.Skel_Aft, 2), 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 6, 'leftBroadsides': [Cannons.Skel_L2] * 6, 'rightBroadsides': [Cannons.Skel_L2] * 6, 'broadsideAmmo': InventoryType.CannonFury, 'cannonAmmo': InventoryType.CannonRoundShot, 'prow': 0, 'hp': 2500, 'sp': 6000, 'maxCargo': 2, 'maxCrew': 8, 'maxCannons': 8, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, SKEL_STORM_REAPER: {'setShipClass': SKEL_STORM_REAPER, 'modelClass': SKEL_WARSHIPL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Main_A, 3), 'mastConfig2': (Masts.Skel_Main_B, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Skel_Fore, 2), 'aftmastConfig': (Masts.Skel_Aft, 2), 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 6, 'leftBroadsides': [Cannons.Skel_L2] * 7, 'rightBroadsides': [Cannons.Skel_L2] * 7, 'broadsideAmmo': InventoryType.CannonThunderbolt, 'cannonAmmo': InventoryType.CannonThunderbolt, 'prow': 0, 'hp': 2500, 'sp': 6000, 'maxCargo': 3, 'maxCrew': 8, 'maxCannons': 8, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, SKEL_BLACK_HARBINGER: {'setShipClass': SKEL_BLACK_HARBINGER, 'modelClass': SKEL_WARSHIPL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Main_A, 3), 'mastConfig2': (Masts.Skel_Main_B, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Skel_Fore, 2), 'aftmastConfig': (Masts.Skel_Aft, 2), 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 6, 'leftBroadsides': [Cannons.Skel_L2] * 7, 'rightBroadsides': [Cannons.Skel_L2] * 7, 'broadsideAmmo': InventoryType.CannonFury, 'cannonAmmo': InventoryType.CannonFury, 'prow': 0, 'hp': 2500, 'sp': 6000, 'maxCargo': 3, 'maxCrew': 8, 'maxCannons': 8, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, SKEL_DEATH_OMEN: {'setShipClass': SKEL_DEATH_OMEN, 'modelClass': SKEL_WARSHIPL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Main_A, 3), 'mastConfig2': (Masts.Skel_Main_B, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Skel_Fore, 2), 'aftmastConfig': (Masts.Skel_Aft, 2), 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 6, 'leftBroadsides': [Cannons.Skel_L2] * 7, 'rightBroadsides': [Cannons.Skel_L2] * 7, 'broadsideAmmo': InventoryType.CannonFury, 'cannonAmmo': InventoryType.CannonThunderbolt, 'prow': 0, 'hp': 2500, 'sp': 6000, 'maxCargo': 3, 'maxCrew': 8, 'maxCannons': 8, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, JOLLY_ROGER: {'setShipClass': JOLLY_ROGER, 'modelClass': SKEL_WARSHIPL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Main_A, 3), 'mastConfig2': (Masts.Skel_Main_B, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Skel_Fore, 2), 'aftmastConfig': (Masts.Skel_Aft, 2), 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 6, 'leftBroadsides': [Cannons.Skel_L2] * 7, 'rightBroadsides': [Cannons.Skel_L2] * 7, 'broadsideAmmo': InventoryType.CannonThunderbolt, 'cannonAmmo': InventoryType.CannonExplosive, 'prow': 0, 'hp': 20000, 'sp': 18000, 'maxCargo': 10, 'maxCrew': 8, 'maxCannons': 8, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, SKEL_SHADOW_CROW_FR: {'setShipClass': SKEL_SHADOW_CROW_FR, 'modelClass': SKEL_INTERCEPTORL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': 0, 'aftmastConfig': 0, 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 5, 'leftBroadsides': [Cannons.Skel_L2] * 5, 'rightBroadsides': [Cannons.Skel_L2] * 5, 'broadsideAmmo': InventoryType.CannonChainShot, 'cannonAmmo': InventoryType.CannonFury, 'prow': 0, 'hp': 2500, 'sp': 5000, 'maxCargo': 1, 'maxCrew': 8, 'maxCannons': 6, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, SKEL_HELLHOUND_FR: {'setShipClass': SKEL_HELLHOUND_FR, 'modelClass': SKEL_INTERCEPTORL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': 0, 'aftmastConfig': 0, 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 5, 'leftBroadsides': [Cannons.Skel_L2] * 5, 'rightBroadsides': [Cannons.Skel_L2] * 5, 'broadsideAmmo': InventoryType.CannonExplosive, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 3000, 'sp': 5000, 'maxCargo': 2, 'maxCrew': 8, 'maxCannons': 6, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, SKEL_BLOOD_SCOURGE_FR: {'setShipClass': SKEL_BLOOD_SCOURGE_FR, 'modelClass': SKEL_INTERCEPTORL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': 0, 'aftmastConfig': 0, 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 5, 'leftBroadsides': [Cannons.Skel_L2] * 5, 'rightBroadsides': [Cannons.Skel_L2] * 5, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonThunderbolt, 'prow': 0, 'hp': 4000, 'sp': 5000, 'maxCargo': 3, 'maxCrew': 8, 'maxCannons': 6, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, SKEL_SHADOW_CROW_SP: {'setShipClass': SKEL_SHADOW_CROW_SP, 'modelClass': SKEL_INTERCEPTORL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': 0, 'aftmastConfig': 0, 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 5, 'leftBroadsides': [Cannons.Skel_L2] * 5, 'rightBroadsides': [Cannons.Skel_L2] * 5, 'broadsideAmmo': InventoryType.CannonChainShot, 'cannonAmmo': InventoryType.CannonFury, 'prow': 0, 'hp': 2500, 'sp': 5000, 'maxCargo': 1, 'maxCrew': 8, 'maxCannons': 6, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, SKEL_HELLHOUND_SP: {'setShipClass': SKEL_HELLHOUND_SP, 'modelClass': SKEL_INTERCEPTORL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': 0, 'aftmastConfig': 0, 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 5, 'leftBroadsides': [Cannons.Skel_L2] * 5, 'rightBroadsides': [Cannons.Skel_L2] * 5, 'broadsideAmmo': InventoryType.CannonExplosive, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 3000, 'sp': 6000, 'maxCargo': 2, 'maxCrew': 8, 'maxCannons': 6, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, SKEL_BLOOD_SCOURGE_SP: {'setShipClass': SKEL_BLOOD_SCOURGE_SP, 'modelClass': SKEL_INTERCEPTORL3, 'defaultStyle': Styles.Undead, 'mastConfig1': (Masts.Skel_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': 0, 'aftmastConfig': 0, 'sailLogo': 0, 'cannons': [Cannons.Skel_L3] * 5, 'leftBroadsides': [Cannons.Skel_L2] * 5, 'rightBroadsides': [Cannons.Skel_L2] * 5, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonThunderbolt, 'prow': 0, 'hp': 4000, 'sp': 8000, 'maxCargo': 3, 'maxCrew': 8, 'maxCannons': 6, 'maxBroadsides': 14, 'rammingPower': 600, 'acceleration': 1.2 * defaultAcceleration, 'maxSpeed': 0.9 * defaultMaxSpeed, 'reverseAcceleration': 0.8 * defaultReverseAcceleration, 'maxReverseSpeed': 0.8 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, HUNTER_VENGEANCE: {'setShipClass': HUNTER_VENGEANCE, 'modelClass': WARSHIPL3, 'defaultStyle': Styles.BountyHunter_A, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Bounty_Hunter_Wasp, 'cannons': [Cannons.L3] * 12, 'leftBroadsides': [Cannons.L2] * 10, 'rightBroadsides': [Cannons.L2] * 10, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonExplosive, 'prow': 0, 'hp': 9000, 'sp': 30000, 'maxCargo': 3, 'maxCrew': 8, 'maxCannons': 14, 'maxBroadsides': 20, 'rammingPower': 900, 'acceleration': 1.5 * defaultAcceleration, 'maxSpeed': 1.2 * defaultMaxSpeed, 'reverseAcceleration': 1.0 * defaultReverseAcceleration, 'maxReverseSpeed': 1.0 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, HUNTER_CUTTER_SHARK: {'setShipClass': HUNTER_CUTTER_SHARK, 'modelClass': INTERCEPTORL3, 'defaultStyle': Styles.BountyHunter_B, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Bandit_Claw, 'cannons': [Cannons.L3] * 8, 'leftBroadsides': [Cannons.L2] * 7, 'rightBroadsides': [Cannons.L2] * 7, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 6400, 'sp': 24000, 'maxCargo': 2, 'maxCrew': 3, 'maxCannons': 12, 'maxBroadsides': 16, 'rammingPower': 450, 'acceleration': 2.0 * defaultAcceleration, 'maxSpeed': 2.0 * defaultMaxSpeed, 'reverseAcceleration': 1.0 * defaultReverseAcceleration, 'maxReverseSpeed': 1.0 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, HUNTER_FLYING_STORM: {'setShipClass': HUNTER_FLYING_STORM, 'modelClass': INTERCEPTORL3, 'defaultStyle': Styles.BountyHunter_C, 'mastConfig1': (Masts.Main_Tri, 2), 'mastConfig2': 0, 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Tri, 1), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Bounty_Hunter_Snake, 'cannons': [Cannons.L3] * 8, 'leftBroadsides': [Cannons.L2] * 7, 'rightBroadsides': [Cannons.L2] * 7, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonThunderbolt, 'prow': 0, 'hp': 6400, 'sp': 24000, 'maxCargo': 2, 'maxCrew': 3, 'maxCannons': 12, 'maxBroadsides': 16, 'rammingPower': 450, 'acceleration': 2.0 * defaultAcceleration, 'maxSpeed': 2.0 * defaultMaxSpeed, 'reverseAcceleration': 1.0 * defaultReverseAcceleration, 'maxReverseSpeed': 1.0 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, HUNTER_KILLYADED: {'setShipClass': HUNTER_KILLYADED, 'modelClass': MERCHANTL3, 'defaultStyle': Styles.BountyHunter_D, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.Bounty_Hunter_Spider, 'cannons': [Cannons.L3] * 10, 'leftBroadsides': [Cannons.L2] * 10, 'rightBroadsides': [Cannons.L2] * 10, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 9200, 'sp': 25500, 'maxCargo': 5, 'maxCrew': 14, 'maxCannons': 10, 'maxBroadsides': 24, 'rammingPower': 600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, HUNTER_RED_DERVISH: {'setShipClass': HUNTER_RED_DERVISH, 'modelClass': WARSHIPL3, 'defaultStyle': Styles.BountyHunter_E, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Bandit_Scorpion, 'cannons': [Cannons.L3] * 12, 'leftBroadsides': [Cannons.L2] * 10, 'rightBroadsides': [Cannons.L2] * 10, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonExplosive, 'prow': 0, 'hp': 9000, 'sp': 30000, 'maxCargo': 3, 'maxCrew': 8, 'maxCannons': 14, 'maxBroadsides': 20, 'rammingPower': 900, 'acceleration': 1.5 * defaultAcceleration, 'maxSpeed': 1.2 * defaultMaxSpeed, 'reverseAcceleration': 1.0 * defaultReverseAcceleration, 'maxReverseSpeed': 1.0 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, HUNTER_CENTURY_HAWK: {'setShipClass': HUNTER_CENTURY_HAWK, 'modelClass': MERCHANTL3, 'defaultStyle': Styles.BountyHunter_F, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 2), 'aftmastConfig': 0, 'sailLogo': Logos.Bandit_Dagger, 'cannons': [Cannons.L3] * 10, 'leftBroadsides': [Cannons.L2] * 10, 'rightBroadsides': [Cannons.L2] * 10, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 9200, 'sp': 25500, 'maxCargo': 5, 'maxCrew': 14, 'maxCannons': 10, 'maxBroadsides': 24, 'rammingPower': 600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}, HUNTER_SCORNED_SIREN: {'setShipClass': HUNTER_SCORNED_SIREN, 'modelClass': WARSHIPL3, 'defaultStyle': Styles.BountyHunter_G, 'mastConfig1': (Masts.Main_Square, 2), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Bandit_Claw, 'cannons': [Cannons.L3] * 12, 'leftBroadsides': [Cannons.L2] * 10, 'rightBroadsides': [Cannons.L2] * 10, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonExplosive, 'prow': 0, 'hp': 9000, 'sp': 10000, 'maxCargo': 3, 'maxCrew': 8, 'maxCannons': 14, 'maxBroadsides': 20, 'rammingPower': 900, 'acceleration': 1.5 * defaultAcceleration, 'maxSpeed': 1.2 * defaultMaxSpeed, 'reverseAcceleration': 1.0 * defaultReverseAcceleration, 'maxReverseSpeed': 1.0 * defaultMaxReverseAcceleration, 'turn': 0.8 * defaultTurn, 'maxTurn': 0.8 * defaultMaxTurn}, HUNTER_TALLYHO: {'setShipClass': HUNTER_TALLYHO, 'modelClass': SHIP_OF_THE_LINE, 'defaultStyle': Styles.NavyHunter, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Navy_Hunter_Unicorn, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2] * 12, 'rightBroadsides': [Cannons.L2] * 12, 'broadsideAmmo': InventoryType.CannonFirebrand, 'cannonAmmo': InventoryType.CannonExplosive, 'prow': 0, 'hp': 20000, 'sp': 45000, 'maxCargo': 8, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 12, 'rammingPower': 3600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.5 * defaultTurn, 'maxTurn': 0.5 * defaultMaxTurn}, HUNTER_BATTLEROYALE: {'setShipClass': HUNTER_BATTLEROYALE, 'modelClass': SHIP_OF_THE_LINE, 'defaultStyle': Styles.NavyHunter, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': (Masts.Main_Square, 3), 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Navy_Hunter_Lion, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L2] * 12, 'rightBroadsides': [Cannons.L2] * 12, 'broadsideAmmo': InventoryType.CannonExplosive, 'cannonAmmo': InventoryType.CannonFirebrand, 'prow': 0, 'hp': 20000, 'sp': 45000, 'maxCargo': 8, 'maxCrew': 12, 'maxCannons': 14, 'maxBroadsides': 12, 'rammingPower': 3600, 'acceleration': 1.0 * defaultAcceleration, 'maxSpeed': 0.7 * defaultMaxSpeed, 'reverseAcceleration': 0.6 * defaultReverseAcceleration, 'maxReverseSpeed': 0.6 * defaultMaxReverseAcceleration, 'turn': 0.5 * defaultTurn, 'maxTurn': 0.5 * defaultMaxTurn}, HUNTER_EN_GARDE: {'setShipClass': HUNTER_EN_GARDE, 'modelClass': WARSHIPL3, 'defaultStyle': Styles.NavyHunter, 'mastConfig1': (Masts.Main_Square, 3), 'mastConfig2': (Masts.Main_Square, 3), 'mastConfig3': 0, 'foremastConfig': (Masts.Fore_Multi, 3), 'aftmastConfig': (Masts.Aft_Tri, 1), 'sailLogo': Logos.Navy_Hunter_Unicorn, 'cannons': [Cannons.L3] * 14, 'leftBroadsides': [Cannons.L4] * 9, 'rightBroadsides': [Cannons.L4] * 9, 'broadsideAmmo': InventoryType.CannonRoundShot, 'cannonAmmo': InventoryType.CannonThunderbolt, 'prow': 0, 'hp': 10000, 'sp': 36000, 'maxCargo': 5, 'maxCrew': 8, 'maxCannons': 14, 'maxBroadsides': 20, 'rammingPower': 900, 'acceleration': 1.1 * defaultAcceleration, 'maxSpeed': 0.8 * defaultMaxSpeed, 'reverseAcceleration': 0.7 * defaultReverseAcceleration, 'maxReverseSpeed': 0.7 * defaultMaxReverseAcceleration, 'turn': 0.6 * defaultTurn, 'maxTurn': 0.6 * defaultMaxTurn}}
__shipRepairCostMultiplier = {INTERCEPTORL1: 0.15, MERCHANTL1: 0.2, WARSHIPL1: 0.25, INTERCEPTORL2: 0.15, MERCHANTL2: 0.2, WARSHIPL2: 0.25, INTERCEPTORL3: 0.15, MERCHANTL3: 0.2, WARSHIPL3: 0.25, SHIP_OF_THE_LINE: 0.5, GOLIATH: 0.25, BLACK_PEARL: 0.25, SKEL_WARSHIPL3: 0.25, SKEL_INTERCEPTORL3: 0.25, JOLLY_ROGER: 0.0}
__enemyAIShipSpeed = {WARSHIPL1: ([50, 100, 115, 135], [10, 10]), WARSHIPL2: ([50, 100, 115, 135], [10, 10]), WARSHIPL3: ([50, 100, 115, 135], [10, 10]), MERCHANTL1: ([45, 90, 105, 125], [6, 6]), MERCHANTL2: ([45, 90, 105, 125], [6, 6]), MERCHANTL3: ([45, 90, 105, 125], [6, 6]), INTERCEPTORL1: ([55, 110, 125, 145], [16, 16]), INTERCEPTORL2: ([55, 110, 125, 145], [16, 16]), INTERCEPTORL3: ([55, 110, 125, 145], [16, 16]), BRIGL1: ([55, 110, 125, 145], [16, 16]), BRIGL2: ([55, 110, 125, 145], [16, 16]), BRIGL3: ([55, 110, 125, 145], [16, 16]), QUEEN_ANNES_REVENGE: ([52, 105, 120, 140], [13, 13]), HUNTER_VENGEANCE: ([100, 150, 200, 250], [20, 20]), HUNTER_CUTTER_SHARK: ([100, 150, 200, 250], [20, 20]), HUNTER_FLYING_STORM: ([100, 150, 200, 250], [20, 20]), HUNTER_KILLYADED: ([100, 150, 200, 250], [20, 20]), HUNTER_RED_DERVISH: ([100, 150, 200, 250], [20, 20]), HUNTER_CENTURY_HAWK: ([100, 150, 200, 250], [20, 20]), HUNTER_SCORNED_SIREN: ([100, 150, 200, 250], [20, 20]), HUNTER_TALLYHO: ([100, 150, 200, 250], [20, 20]), HUNTER_BATTLEROYALE: ([100, 150, 200, 250], [20, 20]), HUNTER_EN_GARDE: ([100, 150, 200, 250], [20, 20]), HMS_VICTORY: ([50, 100, 150, 200], [14, 14]), HMS_NEWCASTLE: ([50, 100, 150, 200], [14, 14]), HMS_INVINCIBLE: ([50, 100, 150, 200], [14, 14]), EITC_INTREPID: ([50, 100, 150, 200], [14, 14]), EITC_CONQUERER: ([50, 100, 150, 200], [14, 14]), EITC_LEVIATHAN: ([50, 100, 150, 200], [14, 14]), NAVY_KRAKEN_HUNTER: ([50, 100, 150, 200], [14, 14]), STUMPY_SHIP: ([8, 8, 8, 8], [6, 6]), BLACK_PEARL: ([50, 100, 150, 200], [14, 14]), GOLIATH: ([50, 100, 150, 200], [14, 14]), JOLLY_ROGER: ([70, 130, 145, 165], [20, 20]), NAVY_PANTHER: ([25, 60, 105, 125], [7, 7]), NAVY_CENTURION: ([30, 65, 110, 130], [8, 8]), NAVY_MAN_O_WAR: ([35, 70, 115, 135], [9, 9]), NAVY_DREADNOUGHT: ([35, 70, 115, 135], [9, 9]), NAVY_ELITE: ([35, 70, 115, 135], [9, 9]), NAVY_BULWARK: ([20, 50, 95, 115], [5, 5]), NAVY_VANGUARD: ([25, 55, 100, 120], [6, 6]), NAVY_MONARCH: ([30, 60, 105, 125], [7, 7]), NAVY_COLOSSUS: ([30, 60, 105, 125], [7, 7]), NAVY_BASTION: ([30, 60, 105, 125], [7, 7]), NAVY_FERRET: ([30, 70, 115, 135], [10, 10]), NAVY_GREYHOUND: ([35, 75, 120, 140], [11, 11]), NAVY_KINGFISHER: ([40, 80, 125, 145], [12, 12]), NAVY_PREDATOR: ([40, 80, 125, 145], [12, 12]), EITC_CORVETTE: ([25, 60, 105, 125], [7, 7]), EITC_MARAUDER: ([30, 65, 110, 130], [8, 8]), EITC_WARLORD: ([35, 70, 115, 135], [9, 9]), EITC_JUGGERNAUT: ([35, 70, 115, 135], [9, 9]), EITC_TYRANT: ([35, 70, 115, 135], [9, 9]), EITC_SENTINEL: ([20, 50, 95, 115], [5, 5]), EITC_IRONWALL: ([25, 55, 100, 120], [6, 6]), EITC_OGRE: ([30, 60, 105, 125], [7, 7]), EITC_BEHEMOTH: ([30, 60, 105, 125], [7, 7]), EITC_SEA_VIPER: ([30, 70, 115, 135], [10, 10]), EITC_BLOODHOUND: ([35, 75, 120, 140], [11, 11]), EITC_BARRACUDA: ([40, 80, 125, 145], [12, 12]), EITC_CORSAIR: ([40, 80, 125, 145], [12, 12]), SKEL_PHANTOM: ([35, 70, 115, 135], [10, 10]), SKEL_REVENANT: ([35, 70, 115, 135], [11, 11]), SKEL_STORM_REAPER: ([40, 75, 120, 140], [11, 11]), SKEL_BLACK_HARBINGER: ([40, 75, 120, 140], [12, 12]), SKEL_DEATH_OMEN: ([45, 80, 125, 145], [12, 12]), SKEL_SHADOW_CROW_FR: ([40, 80, 125, 145], [12, 12]), SKEL_HELLHOUND_FR: ([40, 80, 125, 145], [13, 13]), SKEL_BLOOD_SCOURGE_FR: ([45, 85, 130, 150], [14, 14]), SKEL_SHADOW_CROW_SP: ([40, 80, 125, 145], [12, 12]), SKEL_HELLHOUND_SP: ([40, 80, 125, 145], [13, 13]), SKEL_BLOOD_SCOURGE_SP: ([45, 85, 130, 150], [14, 14])}
KrakenLocators = {INTERCEPTORL1: ((Point3(40, 20, -5), 0.5, Point3(0), 0.9), (Point3(40, -40, -5), 0.5, Point3(0), 0.9)), INTERCEPTORL2: ((Point3(50, 40, -5), 0.75, Point3(0), 0.9), (Point3(50, -70, -5), 0.75, Point3(0), 0.9)), INTERCEPTORL3: ((Point3(60, 80, 0), 0.8, Point3(0), 0.9), (Point3(60, -30, 0), 0.8, Point3(0), 0.9)), MERCHANTL1: ((Point3(30, 50, -5), 0.6, Point3(0), 0.9), (Point3(40, -10, -5), 0.6, Point3(0), 0.9), (Point3(40, -70, -5), 0.6, Point3(0), 0.9)), MERCHANTL2: ((Point3(50, 50, 0), 0.8, Point3(0), 0.9), (Point3(50, -10, 0), 0.8, Point3(0), 0.9), (Point3(50, -70, 0), 0.8, Point3(0), 0.9)), MERCHANTL3: ((Point3(60, 50, 0), 1, Point3(0), 0.9), (Point3(70, -10, 0), 1, Point3(0), 0.9), (Point3(70, -120, 0), 1, Point3(0), 0.9)), WARSHIPL1: ((Point3(30, 50, -15), 0.6, Point3(0, 22, 0), 0.7), (Point3(40, -10, -15), 0.6, Point3(0), 0.8), (Point3(40, -70, -15), 0.6, Point3(0), 0.8)), WARSHIPL2: ((Point3(40, 90, -15), 0.8, Point3(10, 25, 0), 0.8), (Point3(50, 10, -15), 0.8, Point3(0), 0.9), (Point3(50, -70, -15), 0.8, Point3(0), 0.9)), WARSHIPL3: ((Point3(50, 90, -15), 1, Point3(-20, 15, 0), 0.6), (Point3(60, 10, -15), 1, Point3(0), 0.8), (Point3(60, -120, -15), 1, Point3(0), 0.9)), SHIP_OF_THE_LINE: ((Point3(50, 90, -15), 1, Point3(-20, 15, 0), 0.6), (Point3(60, 10, -15), 1, Point3(0), 0.8), (Point3(60, -120, -15), 1, Point3(0), 0.9))}
__shipSplitOffsets = {INTERCEPTORL1: (10.0, 0), INTERCEPTORL2: (2.0, 0), INTERCEPTORL3: (5.0, 0), MERCHANTL1: (13.0, -1), MERCHANTL2: (0.0, 1), MERCHANTL3: (5.0, 0), WARSHIPL1: (5.0, -1), WARSHIPL2: (-5.0, -1), WARSHIPL3: (0.0, -1), SHIP_OF_THE_LINE: (0.0, -1), HMS_VICTORY: (0.0, -1), HMS_NEWCASTLE: (0.0, -1), HMS_INVINCIBLE: (0.0, -1), EITC_INTREPID: (0.0, -1), EITC_CONQUERER: (0.0, -1), EITC_LEVIATHAN: (0.0, -1), NAVY_KRAKEN_HUNTER: (0.0, -1), BLACK_PEARL: (0.0, -1), GOLIATH: (0.0, -1)}
INVALID_TEAM = -1
PLAYER_TEAM = 0
UNDEAD_TEAM = 1
NAVY_TEAM = 2
TRADING_CO_TEAM = 3
FRENCH_UNDEAD_TEAM = 7
SPANISH_UNDEAD_TEAM = 8
VOODOO_ZOMBIE_TEAM = 10
BOUNTY_HUNTER_TEAM = 11
LEVEL_INDEX = 0
TEAM_INDEX = 1
ENABLED_INDEX = 2
shipData = {HMS_VICTORY: [80, NAVY_TEAM, 1], HMS_NEWCASTLE: [80, NAVY_TEAM, 1], HMS_INVINCIBLE: [80, NAVY_TEAM, 1], EITC_INTREPID: [80, TRADING_CO_TEAM, 1], EITC_CONQUERER: [80, TRADING_CO_TEAM, 1], EITC_LEVIATHAN: [80, TRADING_CO_TEAM, 1], NAVY_KRAKEN_HUNTER: [80, NAVY_TEAM, 1], NAVY_FERRET: [2, NAVY_TEAM, 1], NAVY_BULWARK: [6, NAVY_TEAM, 1], NAVY_PANTHER: [9, NAVY_TEAM, 1], NAVY_GREYHOUND: [12, NAVY_TEAM, 1], NAVY_VANGUARD: [16, NAVY_TEAM, 1], NAVY_CENTURION: [19, NAVY_TEAM, 1], NAVY_KINGFISHER: [22, NAVY_TEAM, 1], NAVY_MONARCH: [26, NAVY_TEAM, 1], NAVY_MAN_O_WAR: [29, NAVY_TEAM, 1], NAVY_PREDATOR: [32, NAVY_TEAM, 1], NAVY_COLOSSUS: [36, NAVY_TEAM, 1], NAVY_DREADNOUGHT: [39, NAVY_TEAM, 1], NAVY_BASTION: [60, NAVY_TEAM, 1], NAVY_ELITE: [70, NAVY_TEAM, 1], GOLIATH: [40, NAVY_TEAM, 1], BLACK_PEARL: [30, PLAYER_TEAM, 1], QUEEN_ANNES_REVENGE: [40, VOODOO_ZOMBIE_TEAM, 1], HUNTER_VENGEANCE: [50, BOUNTY_HUNTER_TEAM, 1], HUNTER_CUTTER_SHARK: [50, BOUNTY_HUNTER_TEAM, 1], HUNTER_FLYING_STORM: [50, BOUNTY_HUNTER_TEAM, 1], HUNTER_KILLYADED: [50, BOUNTY_HUNTER_TEAM, 1], HUNTER_RED_DERVISH: [50, BOUNTY_HUNTER_TEAM, 1], HUNTER_CENTURY_HAWK: [50, BOUNTY_HUNTER_TEAM, 1], HUNTER_SCORNED_SIREN: [50, BOUNTY_HUNTER_TEAM, 1], HUNTER_TALLYHO: [60, NAVY_TEAM, 1], HUNTER_BATTLEROYALE: [60, NAVY_TEAM, 1], HUNTER_EN_GARDE: [60, NAVY_TEAM, 1], EITC_SEA_VIPER: [7, TRADING_CO_TEAM, 1], EITC_SENTINEL: [11, TRADING_CO_TEAM, 1], EITC_CORVETTE: [14, TRADING_CO_TEAM, 1], EITC_BLOODHOUND: [17, TRADING_CO_TEAM, 1], EITC_IRONWALL: [21, TRADING_CO_TEAM, 1], EITC_MARAUDER: [24, TRADING_CO_TEAM, 1], EITC_BARRACUDA: [27, TRADING_CO_TEAM, 1], EITC_OGRE: [31, TRADING_CO_TEAM, 1], EITC_WARLORD: [34, TRADING_CO_TEAM, 1], EITC_CORSAIR: [37, TRADING_CO_TEAM, 1], EITC_BEHEMOTH: [41, TRADING_CO_TEAM, 1], EITC_JUGGERNAUT: [44, TRADING_CO_TEAM, 1], EITC_TYRANT: [70, TRADING_CO_TEAM, 1], SKEL_PHANTOM: [18, UNDEAD_TEAM, 1], SKEL_REVENANT: [26, UNDEAD_TEAM, 1], SKEL_STORM_REAPER: [31, UNDEAD_TEAM, 1], SKEL_BLACK_HARBINGER: [36, UNDEAD_TEAM, 1], SKEL_DEATH_OMEN: [42, UNDEAD_TEAM, 1], JOLLY_ROGER: [60, UNDEAD_TEAM, 1], SKEL_SHADOW_CROW_FR: [18, FRENCH_UNDEAD_TEAM, 1], SKEL_HELLHOUND_FR: [21, FRENCH_UNDEAD_TEAM, 1], SKEL_BLOOD_SCOURGE_FR: [28, FRENCH_UNDEAD_TEAM, 1], SKEL_SHADOW_CROW_SP: [18, SPANISH_UNDEAD_TEAM, 1], SKEL_HELLHOUND_SP: [21, SPANISH_UNDEAD_TEAM, 1], SKEL_BLOOD_SCOURGE_SP: [28, SPANISH_UNDEAD_TEAM, 1]}
BaseLevel = {INTERCEPTORL1: 2, MERCHANTL1: 4, WARSHIPL1: 8, BRIGL1: 9, INTERCEPTORL2: 12, MERCHANTL2: 16, WARSHIPL2: 20, BRIGL2: 22, INTERCEPTORL3: 26, MERCHANTL3: 30, WARSHIPL3: 34, BRIGL3: 36, QUEEN_ANNES_REVENGE: 32, BLACK_PEARL: 40, SKEL_WARSHIPL3: 32, SKEL_INTERCEPTORL3: 26, JOLLY_ROGER: 60, GOLIATH: 50, SHIP_OF_THE_LINE: 80, QUEEN_ANNES_REVENGE: 40}
__shipLevelStatMultiplier = {0: (0.5, 0, 10), 1: (0.7, 0, 15), 2: (0.9, 0, 20), 3: (1.1, 0, 25), 4: (1.3, 0, 30), 5: (1.5, 0, 35), 6: (1.7, 0, 40), 7: (1.9, 0, 45), 8: (2.1, 0, 50), 9: (2.3, 0, 55), 10: (2.5, 0, 60), 11: (2.7, 0, 65), 12: (2.9, 0, 70), 13: (3.1, 0, 75), 14: (3.3, 0, 80), 15: (3.5, 0, 85), 16: (3.7, 0, 90), 17: (3.9, 0, 95), 18: (4.1, 0, 100), 19: (4.3, 0, 105), 20: (4.5, 0, 110), 21: (4.7, 0, 115), 22: (4.9, 0, 120), 23: (5.1, 0, 125), 24: (5.3, 0, 130), 25: (5.5, 0, 135), 26: (5.7, 0, 140), 27: (5.9, 0, 145), 28: (6.1, 0, 150), 29: (6.3, 0, 155), 30: (6.5, 0, 160), 31: (6.7, 0, 165), 32: (6.9, 0, 170), 33: (7.1, 0, 175), 34: (7.3, 0, 180), 35: (7.5, 0, 185), 36: (7.7, 0, 190), 37: (7.9, 0, 195), 38: (8.1, 0, 200), 39: (8.3, 0, 205), 40: (8.5, 0, 210), 41: (8.7, 0, 215), 42: (8.9, 0, 220), 43: (9.1, 0, 225), 44: (9.3, 0, 230), 45: (9.5, 0, 235), 46: (9.7, 0, 240), 47: (9.9, 0, 245), 48: (10.1, 0, 250), 49: (10.3, 0, 255), 50: (10.5, 0, 260), 51: (10.7, 0, 265), 52: (10.9, 0, 270), 53: (11.1, 0, 275), 54: (11.3, 0, 280), 55: (11.5, 0, 285), 56: (11.7, 0, 290), 57: (11.9, 0, 295), 58: (12.1, 0, 300), 59: (12.3, 0, 305), 60: (12.5, 0, 310), 61: (12.7, 0, 315), 62: (12.9, 0, 320), 63: (13.1, 0, 325), 64: (13.3, 0, 330), 65: (13.5, 0, 335), 66: (13.7, 0, 340), 67: (13.9, 0, 345), 68: (14.1, 0, 350), 69: (14.3, 0, 355), 70: (14.5, 0, 360), 71: (14.7, 0, 365), 72: (14.9, 0, 370), 73: (15.1, 0, 375), 74: (15.3, 0, 380), 75: (15.5, 0, 385), 76: (15.7, 0, 390), 77: (15.9, 0, 395), 78: (16.1, 0, 400), 79: (16.3, 0, 405), 80: (16.5, 0, 410), 81: (16.7, 0, 415), 82: (16.9, 0, 420), 83: (17.1, 0, 425), 84: (17.3, 0, 430), 85: (17.5, 0, 435), 86: (17.7, 0, 440), 87: (17.9, 0, 445), 88: (18.1, 0, 450), 89: (18.3, 0, 455), 90: (18.5, 0, 460), 91: (18.7, 0, 465), 92: (18.9, 0, 470), 93: (19.1, 0, 475), 94: (19.3, 0, 480), 95: (19.5, 0, 485), 96: (19.7, 0, 490), 97: (19.9, 0, 495), 98: (20.1, 0, 505), 99: (20.3, 0, 500), 100: (20.5, 0, 515)}
WaterlineOffsets = {INTERCEPTORL1: -4, INTERCEPTORL2: -4, INTERCEPTORL3: -4, MERCHANTL1: -4, MERCHANTL2: -4, MERCHANTL3: -4, WARSHIPL1: -4, WARSHIPL2: -4, WARSHIPL3: -4, BRIGL1: -100, BRIGL2: -100, BRIGL3: -100, QUEEN_ANNES_REVENGE: -4, BLACK_PEARL: -10, GOLIATH: -10, SKEL_WARSHIPL3: -4, SKEL_INTERCEPTORL3: -4, SHIP_OF_THE_LINE: -10}
TiltFakeMass = {INTERCEPTORL1: 1.0, INTERCEPTORL2: 1.4, INTERCEPTORL3: 1.7, MERCHANTL1: 2.5, MERCHANTL2: 3.0, MERCHANTL3: 3.5, WARSHIPL1: 2.5, WARSHIPL2: 3.0, WARSHIPL3: 4.0, BRIGL1: 2.5, BRIGL2: 3.0, BRIGL3: 4.0, QUEEN_ANNES_REVENGE: 1.7, SHIP_OF_THE_LINE: 4.5, BLACK_PEARL: 4.5, GOLIATH: 4.5, SKEL_INTERCEPTORL3: 1.7, SKEL_WARSHIPL3: 4.0}
SamplePoints = Enum('\n FL, F, FR,\n L, C, R,\n BL, B, BR,\n ')
SamplePointOffsets = {INTERCEPTORL1: [(0, -11), {SamplePoints.FL: (-13, 29), SamplePoints.F: (0, 29), SamplePoints.FR: (13, 29), SamplePoints.L: (-13, 0), SamplePoints.C: (0, 0), SamplePoints.R: (13, 0), SamplePoints.BL: (-13, -29), SamplePoints.B: (0, -29), SamplePoints.BR: (13, -29)}], INTERCEPTORL2: [(0, -8), {SamplePoints.FL: (-20, 50), SamplePoints.F: (0, 50), SamplePoints.FR: (20, 50), SamplePoints.L: (-20, 0), SamplePoints.C: (0, 0), SamplePoints.R: (20, 0), SamplePoints.BL: (-20, -50), SamplePoints.B: (0, -50), SamplePoints.BR: (20, -50)}, -5], INTERCEPTORL3: [(0, 0), {SamplePoints.FL: (-26, 50), SamplePoints.F: (0, 50), SamplePoints.FR: (26, 50), SamplePoints.L: (-26, 0), SamplePoints.C: (0, 0), SamplePoints.R: (26, 0), SamplePoints.BL: (-26, -50), SamplePoints.B: (0, -50), SamplePoints.BR: (26, -50)}, -5], MERCHANTL1: [(0, 0), {SamplePoints.FL: (-23, 33), SamplePoints.F: (0, 33), SamplePoints.FR: (23, 33), SamplePoints.L: (-23, 0), SamplePoints.C: (0, 0), SamplePoints.R: (23, 0), SamplePoints.BL: (-23, -33), SamplePoints.B: (0, -33), SamplePoints.BR: (23, -33)}], MERCHANTL2: [(0, 0), {SamplePoints.FL: (-35, 60), SamplePoints.F: (0, 60), SamplePoints.FR: (35, 60), SamplePoints.L: (-35, 0), SamplePoints.C: (0, 0), SamplePoints.R: (35, 0), SamplePoints.BL: (-35, -60), SamplePoints.B: (0, -60), SamplePoints.BR: (35, -60)}], MERCHANTL3: [(0, 0), {SamplePoints.FL: (-38, 68), SamplePoints.F: (0, 68), SamplePoints.FR: (38, 68), SamplePoints.L: (-38, 0), SamplePoints.C: (0, 0), SamplePoints.R: (38, 0), SamplePoints.BL: (-38, -68), SamplePoints.B: (0, -68), SamplePoints.BR: (38, -68)}], WARSHIPL1: [(0, -5), {SamplePoints.FL: (-22, 45), SamplePoints.F: (0, 45), SamplePoints.FR: (22, 45), SamplePoints.L: (-22, 0), SamplePoints.C: (0, 0), SamplePoints.R: (22, 0), SamplePoints.BL: (-22, -45), SamplePoints.B: (0, -45), SamplePoints.BR: (22, -45)}], WARSHIPL2: [(0, 0), {SamplePoints.FL: (-28, 64), SamplePoints.F: (0, 64), SamplePoints.FR: (28, 64), SamplePoints.L: (-28, 0), SamplePoints.C: (0, 0), SamplePoints.R: (28, 0), SamplePoints.BL: (-28, -64), SamplePoints.B: (0, -64), SamplePoints.BR: (28, -64)}], WARSHIPL3: [(0, -5), {SamplePoints.FL: (-42, 84), SamplePoints.F: (0, 84), SamplePoints.FR: (42, 84), SamplePoints.L: (-42, 0), SamplePoints.C: (0, 0), SamplePoints.R: (42, 0), SamplePoints.BL: (-42, -84), SamplePoints.B: (0, -84), SamplePoints.BR: (42, -84)}], BRIGL1: [(0, -5), {SamplePoints.FL: (-22, 45), SamplePoints.F: (0, 45), SamplePoints.FR: (22, 45), SamplePoints.L: (-22, 0), SamplePoints.C: (0, 0), SamplePoints.R: (22, 0), SamplePoints.BL: (-22, -45), SamplePoints.B: (0, -45), SamplePoints.BR: (22, -45)}], BRIGL2: [(0, 0), {SamplePoints.FL: (-28, 64), SamplePoints.F: (0, 64), SamplePoints.FR: (28, 64), SamplePoints.L: (-28, 0), SamplePoints.C: (0, 0), SamplePoints.R: (28, 0), SamplePoints.BL: (-28, -64), SamplePoints.B: (0, -64), SamplePoints.BR: (28, -64)}], BRIGL3: [(0, -5), {SamplePoints.FL: (-42, 84), SamplePoints.F: (0, 84), SamplePoints.FR: (42, 84), SamplePoints.L: (-42, 0), SamplePoints.C: (0, 0), SamplePoints.R: (42, 0), SamplePoints.BL: (-42, -84), SamplePoints.B: (0, -84), SamplePoints.BR: (42, -84)}], QUEEN_ANNES_REVENGE: [(0, 0), {SamplePoints.FL: (-26, 50), SamplePoints.F: (0, 50), SamplePoints.FR: (26, 50), SamplePoints.L: (-26, 0), SamplePoints.C: (0, 0), SamplePoints.R: (26, 0), SamplePoints.BL: (-26, -50), SamplePoints.B: (0, -50), SamplePoints.BR: (26, -50)}, -5], SHIP_OF_THE_LINE: [(0, -5), {SamplePoints.FL: (-32, 94), SamplePoints.F: (0, 94), SamplePoints.FR: (32, 94), SamplePoints.L: (-32, 0), SamplePoints.C: (0, 0), SamplePoints.R: (32, 0), SamplePoints.BL: (-32, -94), SamplePoints.B: (0, -94), SamplePoints.BR: (32, -94)}], BLACK_PEARL: [(0, -5), {SamplePoints.FL: (-32, 94), SamplePoints.F: (0, 94), SamplePoints.FR: (32, 94), SamplePoints.L: (-32, 0), SamplePoints.C: (0, 0), SamplePoints.R: (32, 0), SamplePoints.BL: (-32, -94), SamplePoints.B: (0, -94), SamplePoints.BR: (32, -94)}], GOLIATH: [(0, -5), {SamplePoints.FL: (-32, 94), SamplePoints.F: (0, 94), SamplePoints.FR: (32, 94), SamplePoints.L: (-32, 0), SamplePoints.C: (0, 0), SamplePoints.R: (32, 0), SamplePoints.BL: (-32, -94), SamplePoints.B: (0, -94), SamplePoints.BR: (32, -94)}], SKEL_INTERCEPTORL3: [(0, 0), {SamplePoints.FL: (-26, 50), SamplePoints.F: (0, 50), SamplePoints.FR: (26, 50), SamplePoints.L: (-26, 0), SamplePoints.C: (0, 0), SamplePoints.R: (26, 0), SamplePoints.BL: (-26, -50), SamplePoints.B: (0, -50), SamplePoints.BR: (26, -50)}], SKEL_WARSHIPL3: [(0, -5), {SamplePoints.FL: (-42, 84), SamplePoints.F: (0, 84), SamplePoints.FR: (42, 84), SamplePoints.L: (-42, 0), SamplePoints.C: (0, 0), SamplePoints.R: (42, 0), SamplePoints.BL: (-42, -84), SamplePoints.B: (0, -84), SamplePoints.BR: (42, -84)}], JOLLY_ROGER: [(0, -5), {SamplePoints.FL: (-42, 84), SamplePoints.F: (0, 84), SamplePoints.FR: (42, 84), SamplePoints.L: (-42, 0), SamplePoints.C: (0, 0), SamplePoints.R: (42, 0), SamplePoints.BL: (-42, -84), SamplePoints.B: (0, -84), SamplePoints.BR: (42, -84)}]}
__boardingSphere = {WARSHIPL1: ((Vec3(0, 0, 100), 90), 25), WARSHIPL2: ((Vec3(0, 0, 100), 90), 45), WARSHIPL3: ((Vec3(-6.0, 13.0, 21.9), -90), 60), MERCHANTL1: ((Vec3(0, 0, 100), 90), 25), MERCHANTL2: ((Vec3(8, -11, 33), 90), 40), MERCHANTL3: ((Vec3(0, 0, 100), 90), 55), INTERCEPTORL1: ((Vec3(2.74993, 23.197, 9.27622), 90), 25), INTERCEPTORL2: ((Vec3(0, 0, 100), 90), 35), INTERCEPTORL3: ((Vec3(11.899, -1.7117, 21.8932), -29), 45), BRIGL1: ((Vec3(0, 0, 100), 90), 25), BRIGL2: ((Vec3(0, 0, 100), 90), 45), BRIGL3: ((Vec3(-6.0, 13.0, 21.9), -90), 60), QUEEN_ANNES_REVENGE: ((Vec3(11.899, -1.7117, 21.8932), -29), 45), SHIP_OF_THE_LINE: ((Vec3(-6.0, 13.0, 21.9), -90), 60), BLACK_PEARL: ((Vec3(-6.0, 13.0, 21.9), -90), 60), GOLIATH: ((Vec3(-6.0, 13.0, 21.9), -90), 60), STUMPY_SHIP: ((Vec3(2.74993, 23.197, 9.27622), 90), 25), SKEL_WARSHIPL3: ((Vec3(-6.0, 13.0, 21.9), -90), 60), SKEL_INTERCEPTORL3: ((Vec3(11.899, -1.7117, 21.8932), -29), 45)}
__exitSphere = {WARSHIPL1: (21.26, 13.44, 21.93), WARSHIPL2: (21.26, 13.44, 21.93), WARSHIPL3: (21.26, 13.44, 21.93), MERCHANTL1: (-5.44, 6.735, 12.278), MERCHANTL2: (-5.44, 6.735, 12.278), MERCHANTL3: (-5.44, 6.735, 12.278), INTERCEPTORL1: (2.354, -15.201, 5.493), INTERCEPTORL2: (2.354, -15.201, 5.493), INTERCEPTORL3: (2.354, -15.201, 5.493), BRIGL1: (21.26, 13.44, 21.93), BRIGL2: (21.26, 13.44, 21.93), BRIGL3: (21.26, 13.44, 21.93), QUEEN_ANNES_REVENGE: (2.354, -15.201, 5.493), SHIP_OF_THE_LINE: (21.26, 13.44, 21.93), BLACK_PEARL: (21.26, 13.44, 21.93), GOLIATH: (21.26, 13.44, 21.93), SKEL_WARSHIPL3: (21.26, 13.44, 21.93), SKEL_INTERCEPTORL3: (2.354, -15.201, 5.493)}
BOARDING_POS_H_INDEX = 0
BOARDING_SCALE_INDEX = 1
__boardingRopeHeight = {WARSHIPL1: 0.6, WARSHIPL2: 0.8, WARSHIPL3: 1.0, MERCHANTL1: 0.6, MERCHANTL2: 0.8, MERCHANTL3: 1.0, INTERCEPTORL1: 0.5, INTERCEPTORL2: 0.7, INTERCEPTORL3: 1.0, BRIGL1: 0.6, BRIGL2: 0.8, BRIGL3: 1.0, QUEEN_ANNES_REVENGE: 1.0, SHIP_OF_THE_LINE: 1.0, BLACK_PEARL: 1.0, GOLIATH: 1.0, SKEL_WARSHIPL3: 1.0, SKEL_INTERCEPTORL3: 0.8}
AI_RAM_LATENCY_BUFFER = 500
__rammingSphereValues = {WARSHIPL1: (0, 140, 10, 30), WARSHIPL2: (0, 160, 15, 40), WARSHIPL3: (0, 180, 20, 50), MERCHANTL1: (0, 120, 10, 30), MERCHANTL2: (0, 140, 15, 40), MERCHANTL3: (0, 160, 20, 50), INTERCEPTORL1: (0, 110, 10, 30), INTERCEPTORL2: (0, 130, 15, 40), INTERCEPTORL3: (0, 150, 20, 50), BRIGL1: (0, 140, 10, 30), BRIGL2: (0, 160, 15, 40), BRIGL3: (0, 180, 20, 50), QUEEN_ANNES_REVENGE: (0, 150, 20, 50), SHIP_OF_THE_LINE: (0, 190, 20, 50), BLACK_PEARL: (0, 190, 20, 50), GOLIATH: (0, 190, 20, 50), SKEL_WARSHIPL3: (0, 180, 20, 50), SKEL_INTERCEPTORL3: (0, 150, 20, 50)}
BROADSIDE_MAX_AUTOAIM_DIST = 2000
BROADSIDE_LEFT = 0
BROADSIDE_RIGHT = 1
__broadsideMaxDelay = {WARSHIPL1: 0.6, WARSHIPL2: 1.0, WARSHIPL3: 1.5, MERCHANTL1: 0.8, MERCHANTL2: 1.6, MERCHANTL3: 1.75, INTERCEPTORL1: 0.3, INTERCEPTORL2: 0.5, INTERCEPTORL3: 0.75, BRIGL1: 0.6, BRIGL2: 1.0, BRIGL3: 1.5, SHIP_OF_THE_LINE: 1.2, BLACK_PEARL: 1.25, GOLIATH: 1.2, QUEEN_ANNES_REVENGE: 1.2, SKEL_WARSHIPL3: 1.25, SKEL_INTERCEPTORL3: 1.0}
CustomShipRewards = {QUEEN_ANNES_REVENGE: [{100.0: [ItemGlobals.MUTINEERS_CHARM]}, {0.02: [ItemGlobals.POTION_SUMMON_CHICKEN], 100.0: [ItemGlobals.POTION_CANNON_3, ItemGlobals.POTION_PISTOL_3, ItemGlobals.POTION_FACECOLOR, ItemGlobals.POTION_ACC_3, ItemGlobals.POTION_SPEED_3]}]} | [
2,
34318,
2349,
21,
2196,
513,
13,
17,
13,
15,
198,
2,
11361,
18022,
8189,
362,
13,
19,
357,
38850,
5333,
8,
198,
2,
4280,
3361,
3902,
422,
25,
11361,
362,
13,
22,
13,
1415,
357,
85,
17,
13,
22,
13,
1415,
25,
23,
34825,
1129,
... | 2.395889 | 40,231 |
import pytest
from nadypy.api.system import get_sysinfo
from nadypy.api.webserver import post_chat_web
from nadypy.client import BasicAuthClient, SignedAuthClient
from nadypy.models.system_information import SystemInformation
@pytest.fixture
@pytest.fixture
@pytest.mark.asyncio
@pytest.mark.asyncio
| [
11748,
12972,
9288,
198,
198,
6738,
299,
324,
4464,
88,
13,
15042,
13,
10057,
1330,
651,
62,
17597,
10951,
198,
6738,
299,
324,
4464,
88,
13,
15042,
13,
732,
1443,
18497,
1330,
1281,
62,
17006,
62,
12384,
198,
6738,
299,
324,
4464,
... | 2.897196 | 107 |
price = [100, 180, 260, 310, 40, 535, 695]
stockAndBySell(price) | [
198,
198,
20888,
796,
685,
3064,
11,
11546,
11,
21148,
11,
28947,
11,
2319,
11,
642,
2327,
11,
718,
3865,
60,
198,
13578,
1870,
3886,
50,
695,
7,
20888,
8
] | 2.2 | 30 |
from flask import Flask, render_template, Blueprint, flash
from flask_bootstrap import Bootstrap
from flask_moment import Moment
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, SelectField
from wtforms.validators import DataRequired
from workshops_model import *
from users_model import *
app = Flask(__name__)
app.config.from_object('config.Config')
db = {'host':app.config['HDB_URI'],'user':app.config['HDB_USER'],'pwd':app.config['HDB_PWD'],'port':app.config['HDB_PORT']}
bootstrap = Bootstrap(app)
moment = Moment(app)
register = Blueprint('register', __name__)
@register.route('/register/<moderator>', methods = [ 'GET', 'POST'])
if __name__ == '__main__':
app.run('0.0.0.0', port=8080)
| [
6738,
42903,
1330,
46947,
11,
8543,
62,
28243,
11,
39932,
11,
7644,
198,
6738,
42903,
62,
18769,
26418,
1330,
18892,
26418,
198,
6738,
42903,
62,
32542,
298,
1330,
29278,
198,
6738,
42903,
62,
86,
27110,
1330,
46947,
8479,
198,
6738,
26... | 2.975709 | 247 |
from asyncio import Event, get_event_loop
| [
6738,
30351,
952,
1330,
8558,
11,
651,
62,
15596,
62,
26268,
628
] | 3.583333 | 12 |
#!/usr/bin/python
import cwiid
import sys
import gevent
import time
import json
import datetime
import atexit
from collections import OrderedDict
import random
from dotstar import Adafruit_DotStar
import socket
import alsaaudio
import wave
import sys
import struct
import math
WHOAMI = socket.gethostname()
import RPi.GPIO as GPIO
#GPIO Mode (BOARD / BCM)
GPIO.setmode(GPIO.BCM)
#set GPIO Pins
GPIO_AIR = 16
GPIO_LIGHTS = 13
#set GPIO direction (IN / OUT)
GPIO.setup(GPIO_AIR, GPIO.OUT)
GPIO.setup(GPIO_LIGHTS, GPIO.OUT)
mesg = False
rpt_mode = 0
wiimote = None
connected = False
turbo = False
rumble = 0
numpixels = 144 # Number of LEDs in strip
lasthb = 0
hbinterval = 30
defaultColor = 0xF0F0FF
defaultBright = 255
flashColor = 0x00FF00
flashBright = 255
# Here's how to control the strip from any two GPIO pins:
datapin = 23
clockpin = 24
strip = Adafruit_DotStar(numpixels, datapin, clockpin)
hi_thres = 10
low_thres = 4
strip.begin() # Initialize pins for output
strip.setBrightness(255) # Limit brightness to ~1/4 duty cycle
#Setting color to: 0xFF0000 # Green
#Setting color to: 0xCC00CC # Bright Teal
#Setting color to: 0x66CC00 # Orange
#Setting color to: 0x33FFFF # Magenta
#Setting color to: 0xFF00 # Red
#Setting color to: 0x330099 # Lightish Blue
#Setting color to: 0xFFFF00 # YEllow
#Setting color to: 0xFF # Bright Blue
#Setting color to: 0xFF9900 # YEllower Gren
#Setting color to: 0x33 # Dark BLue
#BTN_1', 'BTN_2', 'BTN_A', 'BTN_B', 'BTN_DOWN', 'BTN_HOME', 'BTN_LEFT', 'BTN_MINUS', 'BTN_PLUS', 'BTN_RIGHT', 'BTN_UP',
def color_dict(gradient):
''' Takes in a list of RGB sub-lists and returns dictionary of
colors in RGB and hex form for use in a graphing function
defined later on '''
return {"hex":[RGB_to_hex(RGB) for RGB in gradient],
"r":[RGB[0] for RGB in gradient],
"g":[RGB[1] for RGB in gradient],
"b":[RGB[2] for RGB in gradient]}
def linear_gradient(start_hex, finish_hex="#FFFFFF", n=10):
''' returns a gradient list of (n) colors between
two hex colors. start_hex and finish_hex
should be the full six-digit color string,
inlcuding the number sign ("#FFFFFF") '''
# Starting and ending colors in RGB form
s = hex_to_RGB(start_hex)
f = hex_to_RGB(finish_hex)
# Initilize a list of the output colors with the starting color
RGB_list = [s]
# Calcuate a color at each evenly spaced value of t from 1 to n
for t in range(1, n):
# Interpolate RGB vector for color at the current value of t
curr_vector = [ int(s[j] + (float(t)/(n-1))*(f[j]-s[j])) for j in range(3)]
# Add it to our list of output colors
RGB_list.append(curr_vector)
return color_dict(RGB_list)
def hex_to_RGB(hex):
''' "#FFFFFF" -> [255,255,255] '''
# Pass 16 to the integer function for change of base
return [int(hex[i:i+2], 16) for i in range(1,6,2)]
def RGB_to_hex(RGB):
''' [255,255,255] -> "#FFFFFF" '''
# Components need to be integers for hex to make sense
RGB = [int(x) for x in RGB]
return "#"+"".join(["0{0:x}".format(v) if v < 16 else
"{0:x}".format(v) for v in RGB])
if __name__ == "__main__":
main()
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
11748,
269,
37686,
312,
198,
11748,
25064,
198,
11748,
4903,
1151,
198,
11748,
640,
198,
11748,
33918,
198,
11748,
4818,
8079,
198,
11748,
379,
37023,
198,
6738,
17268,
1330,
14230,
1068,
35,
7... | 2.539546 | 1,277 |
#!/usr/bin/env python
import unittest
from binomial_heap import Node
from binomial_heap import Tree, insert
from binomial_heap import Heap
unittest.main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
11748,
555,
715,
395,
198,
6738,
9874,
49070,
62,
258,
499,
1330,
19081,
198,
6738,
9874,
49070,
62,
258,
499,
1330,
12200,
11,
7550,
198,
6738,
9874,
49070,
62,
258,
499,
1330,
679,
... | 2.929825 | 57 |
from battalion_processor import BattalionProcessor
from battalion_types import BattalionType
from battle_planner import BattlePlanner
from army import Army
from copy import deepcopy
| [
6738,
36328,
62,
41341,
1330,
29887,
18709,
273,
198,
6738,
36328,
62,
19199,
1330,
29887,
6030,
198,
6738,
3344,
62,
11578,
1008,
1330,
5838,
20854,
1008,
198,
6738,
5428,
1330,
5407,
198,
6738,
4866,
1330,
2769,
30073,
628,
220,
220,
... | 2.959459 | 74 |
import os
import uuid
from server.utils import get_colors_colortheif
def get_colors_gen_css(filename: str, joiner: str, ex_colors=[], ex_uid=None):
"""
Pass filename, joiner, existing_colors, existing_uid
"""
temp_dir = os.path.abspath('server/tmp/')
file = os.path.abspath(f"server/img/{filename}")
colors = []
if not ex_colors:
colors = get_colors_colortheif(file)
else:
# to convert it to the format gen_css uses
colors = (ex_colors[0], ex_colors)
dataS = gen_css(colors)
uid = ex_uid
if not ex_uid:
uid = uuid.uuid1()
temp_file = os.path.join(temp_dir, f"{filename}{joiner}{uid}.css")
with open(temp_file, "w+") as cssfile:
cssfile.write(dataS)
css_file = temp_file
return uid, colors, css_file
| [
11748,
28686,
198,
11748,
334,
27112,
198,
198,
6738,
4382,
13,
26791,
1330,
651,
62,
4033,
669,
62,
4033,
419,
258,
361,
198,
198,
4299,
651,
62,
4033,
669,
62,
5235,
62,
25471,
7,
34345,
25,
965,
11,
4654,
263,
25,
965,
11,
409,... | 2.229282 | 362 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from faker import Faker # pour créer de faux noms, adresses,...
from random import * # pour des générateurs de nombres pseudo-aléatoires
import csv # pour parcourir des fichiers csv
from pathlib import Path # pour déterminer si un fichier existe
listlogin = []
generer_csv_lycee(listlogin)
generer_csv_superieur(listlogin)
generer_csv_eleves(listlogin)
generer_csv_admin(listlogin)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
6738,
277,
3110,
1330,
376,
3110,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22... | 2.116935 | 248 |
from .model import Model, load
from .model_base import Optimizer
__all__ = [
"Model",
"Optimizer",
"load",
]
| [
6738,
764,
19849,
1330,
9104,
11,
3440,
198,
6738,
764,
19849,
62,
8692,
1330,
30011,
7509,
198,
198,
834,
439,
834,
796,
685,
198,
220,
220,
220,
366,
17633,
1600,
198,
220,
220,
220,
366,
27871,
320,
7509,
1600,
198,
220,
220,
220... | 2.489796 | 49 |
from ryven.NENV import *
widgets = import_widgets(__file__)
import numpy as np
class ShowMatrix(MatrixNodeBase):
"""Displays a matrix"""
title = 'Show Matrix'
# ------------------------------------------------------------------------------
class Matrix_Node(Node):
"""Evaluates a matrix"""
title = 'Matrix'
init_inputs = []
init_outputs = [
NodeOutputBP()
]
main_widget_class = widgets.MatrixNode_MainWidget
main_widget_pos = 'below ports'
color = '#3344ff'
class Conjugate(MatrixNodeBase):
"""Conjugates a matrix"""
title = 'Conjugate'
class Transpose(MatrixNodeBase):
"""Transposes a matrix"""
title = 'Transpose'
class DetOfMatrix(MatrixNodeBase):
"""Computes the determinant of a matrix."""
title = 'Determinant'
class DotProduct(MatrixNodeBase):
"""Computes the dot product of a matrix."""
title = 'Dot Product'
init_inputs = [
NodeInputBP(),
NodeInputBP(),
]
class HermMatrix(MatrixNodeBase):
"""Computes the hermetian matrix."""
title = 'Herm'
class IDMatrix(MatrixNodeBase):
"""Creates an identity matrix."""
title = 'ID Matrix'
class ImagMatrix(MatrixNodeBase):
"""Extracts the imaginary parts of the matrix."""
title = 'Imag'
class RealMatrix(MatrixNodeBase):
"""Extracts the real parts of the matrix."""
title = 'Real'
class InnerProduct(MatrixNodeBase):
"""Computes the inner product of the input matrices."""
title = 'Inner'
init_inputs = [
NodeInputBP(),
NodeInputBP(),
]
class OuterProduct(MatrixNodeBase):
"""Creates the outer product of two matrices."""
title = 'Outer'
init_inputs = [
NodeInputBP(),
NodeInputBP(),
]
class InverseMatrix(MatrixNodeBase):
"""Computes the inverse matrix"""
title = 'Inverse'
class KronMatrix(MatrixNodeBase):
""""""
title = 'Kron'
class MaskLower(MatrixNodeBase):
""""""
title = 'Mask Lower'
class MaskUpper(MatrixNodeBase):
""""""
title = 'Mask Upper'
class MatMul(MatrixNodeBase):
"""Performs a matrix multiplication."""
title = 'Mult'
init_inputs = [
NodeInputBP(),
NodeInputBP(),
]
class MatPower(MatrixNodeBase):
"""Powers a matrix."""
title = 'Power'
init_inputs = [
NodeInputBP(),
NodeInputBP(),
]
class NullMatrix(MatrixNodeBase):
"""Creates a matrix of zeros."""
title = 'Null'
class OnesMatrix(MatrixNodeBase):
"""Creates a matrix of ones."""
title = 'Ones'
class RandomMatrix(MatrixNodeBase):
"""Creates a matrix with random values between 0 and 1."""
title = 'Rand'
init_inputs = [
NodeInputBP(),
NodeInputBP(),
]
class SolveLEq(MatrixNodeBase):
"""Solves a linear equation system."""
title = 'Solve'
init_inputs = [
NodeInputBP(),
NodeInputBP(),
]
export_nodes(
Matrix_Node,
ShowMatrix,
Conjugate,
Transpose,
DetOfMatrix,
DotProduct,
HermMatrix,
IDMatrix,
ImagMatrix,
RealMatrix,
InnerProduct,
OuterProduct,
InverseMatrix,
KronMatrix,
MaskLower,
MaskUpper,
MatMul,
MatPower,
NullMatrix,
OnesMatrix,
RandomMatrix,
SolveLEq,
)
| [
6738,
374,
88,
574,
13,
45,
1677,
53,
1330,
1635,
198,
28029,
11407,
796,
1330,
62,
28029,
11407,
7,
834,
7753,
834,
8,
198,
198,
11748,
299,
32152,
355,
45941,
628,
198,
198,
4871,
5438,
46912,
7,
46912,
19667,
14881,
2599,
198,
22... | 2.580923 | 1,279 |
from django.db import models
# Create your models here. | [
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
198,
2,
13610,
534,
4981,
994,
13
] | 3.733333 | 15 |
import re
f = open('input.txt')
east = 0
north = 0
waypoint = {'east': 10, 'north': 1}
for line in f:
m = re.match(r'([S|W|E|N|F|R|L]{1})(\d+)', line[:-1])
instruction = (m.group(1), int(m.group(2)))
if instruction[0] == 'F':
update_location(instruction[1])
elif instruction[0] == 'R':
times = int(instruction[1] / 90)
for time in range(times):
turn_right()
elif instruction[0] == 'L':
times = int(instruction[1] / 90)
for time in range(times):
turn_left()
elif instruction[0] == 'E':
waypoint['east'] += instruction[1]
elif instruction[0] == 'W':
waypoint['east'] -= instruction[1]
elif instruction[0] == 'S':
waypoint['north'] -= instruction[1]
else: waypoint['north'] += instruction[1]
print(abs(north) + abs(east))
| [
11748,
302,
198,
198,
69,
796,
1280,
10786,
15414,
13,
14116,
11537,
198,
198,
23316,
796,
657,
198,
43588,
796,
657,
198,
1014,
4122,
796,
1391,
6,
23316,
10354,
838,
11,
220,
705,
43588,
10354,
352,
92,
198,
198,
1640,
1627,
287,
... | 2.15404 | 396 |
from __future__ import print_function
if __name__ == '__main__':
xs = [1, 2, 3]
if 2 in xs:
print("YES")
else:
print("NO")
if cond1() and cond2():
print("YES")
else:
print("NO")
| [
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
2124,
82,
796,
685,
16,
11,
362,
11,
513,
60,
198,
220,
220,
220,
611,
362,
287,
2124,
82,... | 1.991525 | 118 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Project: Fable Input Output
# https://github.com/silx-kit/fabio
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
# Unit tests
Jerome Kieffer, 04/12/2014
"""
from __future__ import print_function, with_statement, division, absolute_import
import unittest
import logging
logger = logging.getLogger(__name__)
from fabio.openimage import openheader
from .utilstest import UtilsTest
class Test1(unittest.TestCase):
"""openheader opening edf"""
def testcase(self):
""" check openheader can read edf headers"""
for ext in ["", ".bz2", ".gz"]:
name = self.name + ext
obj = openheader(name)
logger.debug(" %s obj = %s" % (name, obj.header))
self.assertEqual(obj.header["title"],
"ESPIA FRELON Image",
"Error on file %s" % name)
if __name__ == '__main__':
runner = unittest.TextTestRunner()
runner.run(suite)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
198,
2,
220,
220,
220,
4935,
25,
376,
540,
23412,
25235,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
... | 2.608187 | 684 |
num = cont = soma = igual = maior = menor = 0
r = 'a'
while r != 'N':
num = int(input('Digite um número: '))
igual = num
soma += num
cont += 1
if cont == 1:
maior = menor = num
else:
if num > maior:
maior = num
elif num < menor:
menor = num
r = str(input('Quer continuar? ')).strip().upper()
media = soma / cont
print('FIM, {}'.format(media))
print('O maior numero lido foi {} e o menor foi {}!'.format(maior, menor))
| [
22510,
796,
542,
796,
3870,
64,
796,
45329,
723,
796,
17266,
1504,
796,
1450,
273,
796,
657,
198,
81,
796,
705,
64,
6,
198,
4514,
374,
14512,
705,
45,
10354,
198,
220,
220,
220,
997,
796,
493,
7,
15414,
10786,
19511,
578,
23781,
2... | 2.102128 | 235 |
from src.creator.creator import Creator
from src.creator.luogu_creator import LuoguProblemCreator
problem_map = {
"luogu": LuoguProblemCreator
}
| [
6738,
12351,
13,
45382,
13,
45382,
1330,
21038,
198,
6738,
12351,
13,
45382,
13,
2290,
519,
84,
62,
45382,
1330,
6026,
519,
84,
40781,
16719,
273,
198,
198,
45573,
62,
8899,
796,
1391,
198,
220,
220,
220,
366,
2290,
519,
84,
1298,
6... | 2.941176 | 51 |
import inspect
from typing import Optional
from solo.server.definitions import HttpMethod
from . import predicates as default_predicates
from ..util import viewdefaults
from .routes import ViewMeta
from .util import PredicateList
from ..exceptions import ConfigurationError
from solo.server.app import App
| [
11748,
10104,
198,
6738,
19720,
1330,
32233,
198,
198,
6738,
12199,
13,
15388,
13,
4299,
50101,
1330,
367,
29281,
17410,
198,
6738,
764,
1330,
2747,
16856,
355,
4277,
62,
28764,
16856,
198,
6738,
11485,
22602,
1330,
1570,
12286,
82,
198,
... | 4.148649 | 74 |
import base64
import json
from typing import Any, ByteString, Iterable, Optional, Tuple
import aiowamp
from aiowamp import SerializerABC, build_message_from_list
__all__ = ["JSONSerializer", "JSONDecoder", "JSONEncoder"]
class JSONSerializer(SerializerABC):
"""Serializer for the JSON format.
Provides a custom `json.JSONDecoder` and `json.JSONEncoder` which handle
the special WAMP string format for binary data.
"""
__slots__ = ("decoder", "encoder")
decoder: json.JSONDecoder
"""JSON decoder used to decode incoming messages."""
encoder: json.JSONEncoder
"""JSON encoder used to encode outgoing messages."""
def __init__(self, *,
decoder: json.JSONDecoder = None,
encoder: json.JSONEncoder = None) -> None:
"""
Args:
decoder: Decoder to be used. Defaults to `JSONDecoder` which supports
binary data in strings.
encoder: Encoder to be used. Defaults to `JSONEncoder` which supports
binary data in strings.
"""
self.decoder = decoder or JSONDecoder()
self.encoder = encoder or JSONEncoder(check_circular=False)
def is_encoded_bytes(s: str) -> bool:
"""Check if the given string contains encoded binary data.
Args:
s: String to check.
Returns:
Whether the given string holds encoded binary data.
"""
return s.startswith("\0")
def encode_bytes(b: ByteString) -> str:
"""Encode the binary data to a string.
Args:
b: Binary data to encode.
Returns:
WAMP JSON string representation of the binary data.
"""
e = b"\0" + base64.b64encode(b)
return e.decode()
def decode_bytes(s: str) -> bytes:
"""Decode the bytes.
Args:
s: Encoded binary content.
Returns:
Decoded binary data.
Raises:
binascii.Error: If the data isn't valid.
"""
return base64.b64decode(s[1:])
def _get_item_iter(v: Any) -> Optional[Iterable[Tuple[Any, Any]]]:
"""Get a key-value iterable for the given object.
Args:
v: Any JSON object.
Returns:
An iterable which yields 2-tuples where the first element is the index
value and the second element is the value. `None`, if the given object
isn't a container.
"""
if isinstance(v, list):
return enumerate(v)
if isinstance(v, dict):
return v.items()
return None
def decode_bytes_in_json_obj(v: Any) -> Any:
"""Decode nested bytes in the given object.
If the given object is a container type it WILL BE MUTATED DIRECTLY.
Args:
v: Any JSON object.
Returns:
Same object with binary data decoded.
"""
if isinstance(v, str):
if is_encoded_bytes(v):
return decode_bytes(v)
return v
item_iter = _get_item_iter(v)
if not item_iter:
return v
stack = [(v, item_iter)]
while stack:
container, item_iter = stack.pop()
for key, value in item_iter:
if isinstance(value, str):
if is_encoded_bytes(value):
container[key] = decode_bytes(value)
continue
sub_item_iter = _get_item_iter(value)
if sub_item_iter:
stack.append((value, sub_item_iter))
return v
class JSONDecoder(json.JSONDecoder):
"""JSONDecoder with support for binary data."""
__slots__ = ()
class JSONEncoder(json.JSONEncoder):
"""JSONEncoder with support for binary data.
Treats all `ByteString` types as binary data.
"""
__slots__ = ()
| [
11748,
2779,
2414,
198,
11748,
33918,
198,
6738,
19720,
1330,
4377,
11,
30589,
10100,
11,
40806,
540,
11,
32233,
11,
309,
29291,
198,
198,
11748,
257,
72,
322,
696,
198,
6738,
257,
72,
322,
696,
1330,
23283,
7509,
24694,
11,
1382,
62,... | 2.430667 | 1,500 |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class RSessioninfo(RPackage):
"""R Session Information.
Query and print information about the current R session. It is similar to
'utils::sessionInfo()', but includes more information about packages, and
where they were installed from."""
cran = "sessioninfo"
version('1.2.2', sha256='f56283857c53ac8691e3747ed48fe03e893d8ff348235bff7364658bcfb0c7cb')
version('1.1.1', sha256='166b04678448a7decd50f24afabe5e2ad613e3c55b180ef6e8dd7a870a1dae48')
depends_on('r@2.10:', type=('build', 'run'), when='@1.2.2:')
depends_on('r-cli', type=('build', 'run'))
depends_on('r-cli@3.1.0:', type=('build', 'run'), when='@1.2.2:')
depends_on('r-withr', type=('build', 'run'), when='@:1.1.1')
| [
2,
15069,
2211,
12,
1238,
1828,
13914,
45036,
3549,
2351,
4765,
11,
11419,
290,
584,
198,
2,
1338,
441,
4935,
34152,
13,
4091,
262,
1353,
12,
5715,
27975,
38162,
9947,
2393,
329,
3307,
13,
198,
2,
198,
2,
30628,
55,
12,
34156,
12,
... | 2.552279 | 373 |
"""Interface for the Database updater thread."""
# Local imports
import crawler.communication as communication
def shutdown() -> None:
"""Shutdown the database updater thread."""
command = communication.Command(
command=communication.DATABASE_UPDATER_SHUTDOWN,
data=None
)
communication.database_updater_input.put(command)
| [
37811,
39317,
329,
262,
24047,
2325,
729,
4704,
526,
15931,
628,
198,
2,
10714,
17944,
198,
11748,
27784,
1754,
13,
32560,
355,
6946,
628,
198,
4299,
18325,
3419,
4613,
6045,
25,
198,
220,
220,
220,
37227,
39079,
2902,
262,
6831,
2325,
... | 3.121739 | 115 |
from core.advbase import *
from module.template import SigilAdv
variants = {None: Pinon}
| [
6738,
4755,
13,
32225,
8692,
1330,
1635,
198,
6738,
8265,
13,
28243,
1330,
21984,
346,
22856,
198,
198,
25641,
1187,
796,
1391,
14202,
25,
13727,
261,
92,
198
] | 3.214286 | 28 |
# coding=utf-8
| [
2,
19617,
28,
40477,
12,
23,
198
] | 2.142857 | 7 |
import datetime
import requests
import re
import json
class Buro(metaclass=Meta):
"""
Base interface-like class for all departments providing appointments on ...muenchen.de/termin/index.php... page
"""
appointment_types = None
appointment_type_date = None
@classmethod
def get_available_appointment_types(cls):
"""
:return: list of available appointment types
"""
# Cache appointment type results for one day
if cls.appointment_types and (datetime.datetime.now() - cls.appointment_type_date).days < 1:
return cls.appointment_types
response = requests.get(cls.get_frame_url())
# Cut not needed content making search more complicated, we need only part in (after) WEB_APPOINT_CASETYPELIST div
inner_div = \
re.findall('WEB_APPOINT_CASETYPELIST.*', response.content.decode("utf-8"), re.MULTILINE | re.DOTALL)[0]
# Search for text CASETYPES. So far the only issue was in "+" sign for CityHall in some service variable,
# that's why exclude it from the name
cls.appointment_types = re.findall('CASETYPES\[([^+]*?)\]', inner_div)
cls.appointment_type_date = datetime.datetime.now()
return cls.appointment_types
@staticmethod
def get_frame_url():
"""
:return: URL with appointments form
"""
raise NotImplementedError
@staticmethod
def _get_base_page():
"""
:return: actual external web-page containing the frame. Not really needed for implementation, but may be useful
for testing or debugging
"""
raise NotImplementedError
@staticmethod
def get_name():
"""
:return: human-readable name of the buro
"""
raise NotImplementedError
@staticmethod
def get_id():
"""
:return: machine-readable unique ID of the buro
"""
return 'baseburo'
@staticmethod
def get_typical_appointments() -> list:
"""
:return: list of tuples (<Name of appointment>, <index>)
"""
return []
@staticmethod
def get_termins(buro, termin_type):
"""
Get available appointments in the given buro for the given appointment type.
:param buro: Buro to search in
:param termin_type: what type of appointment do you want to find?
:return: dictionary of appointments, keys are possible dates, values are lists of available times
"""
# Session is required to keep cookies between requests
s = requests.Session()
# First request to get and save cookies
first_page = s.post(buro.get_frame_url())
try:
token = re.search('FRM_CASETYPES_token" value="(.*?)"', first_page.text).group(1)
except AttributeError:
token = None
termin_data = {
'CASETYPES[%s]' % termin_type: 1,
'step': 'WEB_APPOINT_SEARCH_BY_CASETYPES',
'FRM_CASETYPES_token': token,
}
response = s.post(buro.get_frame_url(), termin_data)
txt = response.text
try:
json_str = re.search('jsonAppoints = \'(.*?)\'', txt).group(1)
except AttributeError:
print('ERROR: cannot find termins data in server\'s response. See log.txt for raw text')
write_response_to_log(txt)
return None
appointments = json.loads(json_str)
# We expect structure of this JSON should be like this:
# {
# 'Place ID 1': {
# # Address
# 'caption': 'F\u00fchrerscheinstelle Garmischer Str. 19/21',
# # Some internal ID
# 'id': 'a6a84abc3c8666ca80a3655eef15bade',
# # Dictionary containing data about appointments
# 'appoints': {
# '2019-01-25': ['09:05', '09:30'],
# '2019-01-26': []
# # ...
# }
# }
# }
# So there can be several Buros located in different places in the city
return appointments
if __name__ == '__main__':
# Example for exchanging driver license
appointments = get_termins(DMV, 'FS Umschreibung Ausländischer FS')
# # Example for Anmeldung
# appointments = get_termins(CityHall, 'An- oder Ummeldung - Einzelperson')
# # Example for NE with Blue Card
# appointments = get_termins(ForeignLabor, 'Werkverträge')
# # Example for KFZ and car registration
# appointments = get_termins(KFZ, 'ZUL Fabrikneues Fahrzeug')
if appointments:
print(json.dumps(appointments, sort_keys=True, indent=4, separators=(',', ': ')))
| [
11748,
4818,
8079,
198,
198,
11748,
7007,
198,
11748,
302,
198,
11748,
33918,
628,
198,
198,
4871,
347,
1434,
7,
4164,
330,
31172,
28,
48526,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
7308,
7071,
12,
2339,
1398,
329,
477,
... | 2.441413 | 1,869 |
###############################################################################################################################
# This script implements our Prior-guided Bayesian Optimization method, presented in: https://arxiv.org/abs/1805.12168. #
###############################################################################################################################
import sys
import os
import space
import models
import numpy as np
import csv
import random
import json
import datetime
from jsonschema import Draft4Validator, validators, exceptions
from utility_functions import *
from local_search import local_search
from random_scalarizations import sample_weight_flat, compute_data_array_scalarization
from scipy import stats
from sklearn.ensemble import ExtraTreesRegressor
def compute_probability_from_prior(configurations, param_space, objective_weights):
"""
Compute the probability of configurations being good according to the prior.
:param configurations: list of configurations to compute probability.
:param param_space: Space object for the optimization problem
:param objective_weights: Objective weights for multi-objective optimization. Not implemented yet.
:return: list with the probability of each configuration being good according to the prior.
"""
probabilities = []
objectives = param_space.get_optimization_parameters()
input_param_objects = param_space.get_input_parameters_objects()
prior_estimation_flag = param_space.get_estimate_prior_flags()[0]
# We have to update this for multiple objectives
if prior_estimation_flag:
for configuration in configurations:
probability = param_space.get_configuration_probability(configuration)
probabilities.append(probability)
else:
for configuration in configurations:
probability = 1
for parameter_name in configuration.keys():
for objective in objectives:
parameter_value = configuration[parameter_name]
p = input_param_objects[parameter_name].get_x_probability(parameter_value)
probability *= p**objective_weights[objective]
probabilities.append(probability)
return probabilities
def estimate_prior_limits(param_space, prior_limit_estimation_points, objective_weights):
"""
Estimate the limits for the priors provided. Limits are used to normalize the priors, if prior normalization is required.
:param param_space: Space object for the optimization problem
:param prior_limit_estimation_points: number of points to sample to estimate the limits
:param objective_weights: Objective weights for multi-objective optimization. Not implemented yet.
:return: list with the estimated lower and upper limits found for the prior.
"""
uniform_configurations = param_space.random_sample_configurations_without_repetitions({}, prior_limit_estimation_points, use_priors=False)
prior_configurations = param_space.random_sample_configurations_without_repetitions({}, prior_limit_estimation_points, use_priors=True) # will be uniform random if no prior
configurations = uniform_configurations + prior_configurations
prior = compute_probability_from_prior(configurations, param_space, objective_weights)
return [min(prior), max(prior)]
def compute_probability_from_model(
model_means,
model_stds,
param_space,
objective_weights,
threshold,
compute_bad=True):
"""
Compute the probability of a configuration being good or bad according to the model.
:param model_means: predicted means of the model for each configuration.
:param model_means: predicted std of the model for each configuration.
:param param_space: Space object for the optimization problem.
:param objective_weights: objective weights for multi-objective optimization. Not implemented yet.
:param threshold: threshold on objective values separating good points and bad points.
:param compute_bad: whether to compute the probability of being good or bad.
"""
optimization_parameters = param_space.get_optimization_parameters()
probabilities = np.ones(len(model_means[optimization_parameters[0]]))
for parameter in optimization_parameters:
parameter_means = model_means[parameter]
parameter_stds = model_stds[parameter]
if compute_bad:
p = 1 - stats.norm.cdf((threshold[parameter] - parameter_means)/parameter_stds)
else:
p = stats.norm.cdf((threshold[parameter] - parameter_means)/parameter_stds)
probabilities *= p**objective_weights[parameter]
return probabilities
def compute_EI_from_posteriors(
configurations,
param_space,
objective_weights,
objective_limits,
threshold,
iteration_number,
model_weight,
regression_models,
classification_model,
model_type,
good_prior_normalization_limits,
posterior_floor=10**-8,
posterior_normalization_limits=None,
debug=False):
"""
Compute EI acquisition function for a list of configurations based on the priors provided by the user and the BO model.
:param configurations: list of configurations to compute EI.
:param param_space: Space object for the optimization problem
:param objective_weights: objective weights for multi-objective optimization. Not implemented yet.
:param objective_limits: objective limits for multi-objective optimization. Not implemented yet.
:param threshold: threshold that separates configurations into good or bad for the model.
:param iteration_number: current optimization iteration.
:param model_weight: weight hyperparameter given to the model during posterior computation.
:param regression_models: regression models to compute the probability of a configuration being good according to BO's model.
:param classification_model: classification model to compute the probability of feasibility.
:param model_type: type of the regression model, either GP or RF for now.
:param good_prior_normalization_limits: lower and upper limits to normalize the prior. Will be updated if any value exceeds the limits.
:param posterior_floor: lower limit for posterior computation. Used when normalizing the priors and in the probability of feasibility.
:param posterior_normalization_limits:
:param debug: whether to run in debug mode.
"""
user_prior_t0 = datetime.datetime.now()
prior_good = compute_probability_from_prior(configurations, param_space, objective_weights)
# if prior is non-normalized, we have to normalize it
if good_prior_normalization_limits is not None:
good_prior_normalization_limits[0] = min(good_prior_normalization_limits[0], min(prior_good))
good_prior_normalization_limits[1] = max(good_prior_normalization_limits[1], max(prior_good))
# limits will be equal if all values are the same, in this case, just set the prior to 1 everywhere
if good_prior_normalization_limits[0] == good_prior_normalization_limits[1]:
prior_good = [1]*len(prior_good)
else:
prior_good = [posterior_floor + ((1-posterior_floor)*(x - good_prior_normalization_limits[0]))/(good_prior_normalization_limits[1] - good_prior_normalization_limits[0]) \
for x in prior_good]
prior_good = np.array(prior_good, dtype=np.float64)
prior_bad = np.array(1 - prior_good, dtype=np.float64)
prior_bad[prior_bad < posterior_floor] = posterior_floor
discrete_space = True
for parameter in param_space.get_input_parameters():
if param_space.get_type(parameter) == "real":
discrete_space = False
if discrete_space:
prior_bad = prior_bad/(param_space.get_discrete_space_size() - 1)
sys.stdout.write_to_logfile(("EI: user prior time %10.4f sec\n" % ((datetime.datetime.now() - user_prior_t0).total_seconds())))
model_t0 = datetime.datetime.now()
bufferx = dict_list_to_matrix(configurations) # prediction methods require a matrix instead of list of dictionaries
number_of_predictions = len(bufferx)
model_stds = {}
model_means, model_stds = models.compute_model_mean_and_uncertainty(bufferx, regression_models, model_type, param_space, var=False)
# If classification model is trained, there are feasibility constraints
if classification_model != None:
classification_prediction_results = models.model_probabilities(bufferx, classification_model, param_space)
feasible_parameter = param_space.get_feasible_parameter()[0]
true_value_index = classification_model[feasible_parameter].classes_.tolist().index(True) # predictor gives both probabilities (feasible and infeasible), find the index of feasible probabilities
feasibility_indicator = classification_prediction_results[feasible_parameter][:,true_value_index]
feasibility_indicator[feasibility_indicator == 0] = posterior_floor
feasibility_indicator = np.log(feasibility_indicator)
# Normalize the feasibility indicator to 0, 1.
feasibility_indicator = [posterior_floor + ((1-posterior_floor)*(x - np.log(posterior_floor)))/(np.log(1) - np.log(posterior_floor)) \
for x in feasibility_indicator]
feasibility_indicator = np.array(feasibility_indicator)
else:
feasibility_indicator = [1]*number_of_predictions # if classification model is not trained, all points are feasible
model_good = compute_probability_from_model(
model_means,
model_stds,
param_space,
objective_weights,
threshold,
compute_bad=False)
model_good = np.array(model_good, dtype=np.float64)
model_bad = compute_probability_from_model(
model_means,
model_stds,
param_space,
objective_weights,
threshold,
compute_bad=True)
sys.stdout.write_to_logfile(("EI: model time %10.4f sec\n" % ((datetime.datetime.now() - model_t0).total_seconds())))
posterior_t0 = datetime.datetime.now()
good_bad_ratios = np.zeros(len(configurations), dtype=np.float64)
with np.errstate(divide='ignore'):
log_posterior_good = np.log(prior_good) + (iteration_number/model_weight)*np.log(model_good)
log_posterior_bad = np.log(prior_bad) + (iteration_number/model_weight)*np.log(model_bad)
good_bad_ratios = log_posterior_good - log_posterior_bad
# If we have feasibility constraints, normalize good_bad_ratios to 0, 1
if posterior_normalization_limits is not None:
tmp_gbr = copy.deepcopy(good_bad_ratios)
tmp_gbr = np.array(tmp_gbr)
# Do not consider -inf and +inf when computing the limits
tmp_gbr[tmp_gbr == float("-inf")] = float("inf")
posterior_normalization_limits[0] = min(posterior_normalization_limits[0], min(tmp_gbr))
tmp_gbr[tmp_gbr == float("inf")] = float("-inf")
posterior_normalization_limits[1] = max(posterior_normalization_limits[1], max(tmp_gbr))
# limits will be equal if all values are the same, in this case, just set the prior to 1 everywhere
if posterior_normalization_limits[0] == posterior_normalization_limits[1]:
good_bad_ratios = [1]*len(good_bad_ratios)
else:
new_gbr = []
for x in good_bad_ratios:
new_x = posterior_floor + ((1-posterior_floor)*(x - posterior_normalization_limits[0]))/(posterior_normalization_limits[1] - posterior_normalization_limits[0])
new_gbr.append(new_x)
good_bad_ratios = new_gbr
good_bad_ratios = np.array(good_bad_ratios)
good_bad_ratios = good_bad_ratios + feasibility_indicator
good_bad_ratios = -1*good_bad_ratios
good_bad_ratios = list(good_bad_ratios)
sys.stdout.write_to_logfile(("EI: posterior time %10.4f sec\n" % ((datetime.datetime.now() - posterior_t0).total_seconds())))
sys.stdout.write_to_logfile(("EI: total time %10.4f sec\n" % ((datetime.datetime.now() - user_prior_t0).total_seconds())))
# local search expects the optimized function to return the values and a feasibility indicator
return good_bad_ratios, feasibility_indicator
def prior_guided_optimization(
config,
data_array,
param_space,
fast_addressing_of_data_array,
regression_models,
iteration_number,
objective_weights,
objective_limits,
classification_model=None):
"""
Run a prior-guided bayesian optimization iteration.
:param config: dictionary containing all the configuration parameters of this optimization.
:param data_array: a dictionary containing previously explored points and their function values.
:param param_space: parameter space object for the current application.
:param fast_addressing_of_data_array: dictionary for quick-access to previously explored configurations.
:param regression_models: the surrogate models used to evaluate points.
:param iteration_number: the current iteration number.
:param objective_weights: objective weights for multi-objective optimization. Not implemented yet.
:param objective_limits: estimated minimum and maximum limits for each objective.
:param classification_model: feasibility classifier for constrained optimization.
"""
local_search_starting_points = config["local_search_starting_points"]
local_search_random_points = config["local_search_random_points"]
scalarization_key = config["scalarization_key"]
function_parameters = {}
function_parameters["param_space"] = param_space
function_parameters["iteration_number"] = iteration_number
function_parameters["regression_models"] = regression_models
function_parameters['classification_model'] = classification_model
function_parameters["objective_weights"] = objective_weights
function_parameters["objective_limits"] = objective_limits
function_parameters['model_type'] = config["models"]["model"]
function_parameters["model_weight"] = config["model_posterior_weight"]
function_parameters["posterior_floor"] = config["posterior_computation_lower_limit"]
model_good_quantile = config["model_good_quantile"]
function_parameters["threshold"] = {}
optimization_metrics = param_space.get_optimization_parameters()
for objective in optimization_metrics:
function_parameters["threshold"][objective] = np.quantile(data_array[objective], model_good_quantile)
if param_space.get_prior_normalization_flag() is True:
prior_limit_estimation_points = config["prior_limit_estimation_points"]
good_prior_normalization_limits = estimate_prior_limits(param_space, prior_limit_estimation_points, objective_weights)
else:
good_prior_normalization_limits = None
function_parameters["good_prior_normalization_limits"] = good_prior_normalization_limits
if classification_model is not None:
function_parameters["posterior_normalization_limits"] = [float("inf"), float("-inf")]
_, best_configuration = local_search(
local_search_starting_points,
local_search_random_points,
param_space,
fast_addressing_of_data_array,
False, # set feasibility to false, we handle it inside the acquisition function
compute_EI_from_posteriors,
function_parameters,
scalarization_key,
previous_points=data_array)
return best_configuration
| [
29113,
29113,
29113,
14468,
7804,
4242,
21017,
198,
2,
770,
4226,
23986,
674,
14481,
12,
23657,
4696,
35610,
30011,
1634,
2446,
11,
5545,
287,
25,
3740,
1378,
283,
87,
452,
13,
2398,
14,
8937,
14,
1507,
2713,
13,
1065,
14656,
13,
220,... | 2.536888 | 6,696 |
# Generated by Django 2.1.11 on 2019-08-15 06:58
import ct.models
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
362,
13,
16,
13,
1157,
319,
13130,
12,
2919,
12,
1314,
9130,
25,
3365,
198,
198,
11748,
269,
83,
13,
27530,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.868421 | 38 |
import unittest
| [
11748,
555,
715,
395,
628
] | 3.4 | 5 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 10 14:30:07 2018
@author: Nzix
"""
with open('member.txt', 'r', encoding = 'utf-8') as f: data = f.readlines()
sql = ''
for line in data:
line = line.replace('\n', '')
if not line: continue
if line.startswith('#'): continue
id, name, furigana, romaji = line.split('\t')
sql += 'insert into member values({}, "{}", "{}", "{}", "{}", {}, {});\n'.format(id, romaji, name, furigana, '', 0, 0)
with open('member.sql', 'w', encoding = 'utf-8') as f: f.write(sql) | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
41972,
319,
3300,
2365,
838,
1478,
25,
1270,
25,
2998,
2864,
198,
198,
31,
9800,
25,
399,
89,
844,
198,
37811,
198,
198,
4480,
1280,
10786,
19522,
13,
1411... | 2.426606 | 218 |
from PyQt5 import QtGui
from pathlib import Path
import datetime | [
6738,
9485,
48,
83,
20,
1330,
33734,
8205,
72,
198,
6738,
3108,
8019,
1330,
10644,
198,
11748,
4818,
8079
] | 3.368421 | 19 |
#!usr/bin/env python
# coding=utf-8
# Author: zhezhiyong@163.com
# Created: 2016-03-09 09:11:10
# Python version:2.7.10
"""
# TODO(purpose):
"""
import uuid
import time
# 操作 etf代码 成份股代码
print uuid.uuid1(01510300000001)
print uuid.uuid1(01510300000001)
print uuid.uuid1(01510300000001)
# 10 1000 5 1000 6 1000
# 9.5 900 4.9 1000 5.8 1000
print list([1])
if __name__ == "__main__":
a = A()
a.excute(a.curr_stage)
a.excute(a.curr_stage)
a.excute(a.curr_stage)
# a.excute(a.curr_stage)
# a.excute(a.curr_stage)
# print (9.5 * 900 + 4.9 * 1000 + 5.8 * 1000) / (10 * 1000 + 5 * 1000 + 6 * 1000)
# print ((9.5 * 900) / (10 * 1000) + (4.9 * 1000) / (5 * 1000) + (5.8 * 1000) / (6 * 1000)) / 3
pass
| [
2,
0,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
19617,
28,
40477,
12,
23,
198,
2,
6434,
25,
1976,
258,
89,
5303,
88,
506,
31,
24136,
13,
785,
198,
2,
15622,
25,
1584,
12,
3070,
12,
2931,
7769,
25,
1157,
25,
940,
198,
2,
11361... | 1.994565 | 368 |
"""Plot capacity factors."""
import os
from operator import itemgetter
import textwrap
import datetime
import yaml
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.dates import date2num
import matplotlib.dates as mdates
import matplotlib.patches as mpatches
from matplotlib.collections import PatchCollection
ISOFMT = "%Y-%M-%d"
def dt(date):
"""convert date to datetime at midnight for easier plotting"""
return date2num(datetime.datetime(date.year, date.month, date.day))
colors = {
"BWR": "blue"
}
DOTWIDTH= 130
LINEHEIGHT = 0.1
STARTYEAR = 1951
ENDYEAR=1977
if __name__ == '__main__':
data = load()
plot(data)
| [
37811,
43328,
5339,
5087,
526,
15931,
198,
198,
11748,
28686,
198,
6738,
10088,
1330,
2378,
1136,
353,
198,
11748,
2420,
37150,
198,
11748,
4818,
8079,
198,
198,
11748,
331,
43695,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
294... | 2.726563 | 256 |
# -*- coding: ascii -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from itertools import groupby
from lxml import etree
from odoo import api, fields, models
from odoo import tools
from odoo.addons.website.models import website
from odoo.http import request
_logger = logging.getLogger(__name__)
| [
2,
532,
9,
12,
19617,
25,
355,
979,
72,
532,
9,
12,
198,
2,
2142,
286,
10529,
2238,
13,
4091,
38559,
24290,
2393,
329,
1336,
6634,
290,
15665,
3307,
13,
198,
198,
11748,
18931,
198,
6738,
340,
861,
10141,
1330,
1448,
1525,
198,
67... | 3.304762 | 105 |
#☆𝒐𝒎𝒂𝒋𝒊𝒏𝒂𝒊☆#
import sys
import math
from math import ceil, floor
import itertools
from functools import lru_cache
from collections import deque
inf=10**20
sys.setrecursionlimit(10000000)
input=lambda : sys.stdin.readline().rstrip()
'''''✂'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
a,b,c=map(int,input().split())
k=int(input())
count=0
while a>=b:
b*=2
count+=1
while b>=c:
c*=2
count+=1
print('Yes' if count<=k else 'No') | [
2,
35283,
47728,
240,
238,
47728,
240,
236,
47728,
240,
224,
47728,
240,
233,
47728,
240,
232,
47728,
240,
237,
47728,
240,
224,
47728,
240,
232,
35283,
2,
198,
11748,
25064,
198,
11748,
10688,
198,
6738,
10688,
1330,
2906,
346,
11,
4... | 2.247525 | 202 |
import pickle
import numpy as np
from keras.preprocessing.sequence import pad_sequences
from keras import Sequential
from keras_contrib.layers import CRF
from keras.layers import Embedding ,Bidirectional,LSTM
from keras.models import load_model
BATCH_SIZE = 32
MODEL_PATH = "./model/crf.h5"
# 训练后保存模型 | [
11748,
2298,
293,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
41927,
292,
13,
3866,
36948,
13,
43167,
1330,
14841,
62,
3107,
3007,
198,
6738,
41927,
292,
1330,
24604,
1843,
198,
6738,
41927,
292,
62,
3642,
822,
13,
75,
6962,
1330,
... | 2.55 | 120 |
from __future__ import annotations
import asyncio
from typing import Protocol
from fastapi import APIRouter, status
from fastapi.responses import JSONResponse, Response
class Healther(Protocol):
"""Any object implementing ^ can be checked for health status"""
class HealthCheckService(Protocol):
"""
Defines a healthcheck service interface.
Any service with this interface can be a healthcheck service.
"""
healthers: dict[str, Healther] = {}
class ConcurrentHealthCheck(HealthCheckService):
"""
Implements an asyncio healtcheck service.
Requesting health status should be as slow as the slowest health provider.
"""
router = APIRouter(tags=["healthcheck"])
healthcheck: HealthCheckService = ConcurrentHealthCheck()
@router.get("/live")
async def live() -> Response:
"""
The Kubernetes liveness probe detects that the service is no longer serving
requests and restarts the offending pod.
"""
not_live = await healthcheck.live()
if len(not_live.keys()) > 0:
return JSONResponse(not_live, status.HTTP_503_SERVICE_UNAVAILABLE)
return JSONResponse(None, status.HTTP_200_OK)
@router.get("/ready")
async def ready() -> Response:
"""
The Kubernetes readiness probe waits until the app is fully started
before it allows the to send traffic to the service.
"""
not_ready = await healthcheck.ready()
if len(not_ready.keys()) > 0:
return JSONResponse(not_ready, status.HTTP_503_SERVICE_UNAVAILABLE)
return JSONResponse(None, status.HTTP_200_OK)
| [
6738,
11593,
37443,
834,
1330,
37647,
198,
198,
11748,
30351,
952,
198,
6738,
19720,
1330,
20497,
198,
198,
6738,
3049,
15042,
1330,
3486,
4663,
39605,
11,
3722,
198,
6738,
3049,
15042,
13,
16733,
274,
1330,
19449,
31077,
11,
18261,
628,
... | 3.138554 | 498 |
# Standard lib imports
from sys import argv
import os
from time import sleep
import re
import pdb
import logging
import datetime
import csv
import json
from collections import defaultdict
# Third-party imports
import pandas as pd
import requests
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
# Constants
DIR = os.path.dirname(os.path.abspath(__file__))
BASE_DIR = os.path.dirname(os.path.dirname(DIR)) # Root directory of the project
# Alter for any given race on a clarityelection.com site
CONTEST_URL = 'http://results.enr.clarityelections.com/GA/63991/182895/en/md_data.html?cid=5000&'
COUNTIES = ['CLAYTON', 'FULTON', 'GWINNETT', 'DEKALB', 'COBB']
LAST_COUNTY = 'Worth' # Used to check that all counties on the main page have loaded from AJAX request
CANDIDATES = {'dem': 'HILLARY CLINTON', 'rep': 'DONALD J. TRUMP'}
TOTAL_PRECINCTS = 914 # The number of precincts in the reapportionment office's map
PHANTOM_JS_INSTALLATION = '/Users/jcox/Desktop/phantomjs/bin/phantomjs'
# Input and output file locations. Change as needed
STATS_FILE = os.path.join(DIR, 'ajc_precincts_merged_centers.csv')
MAP_INPUT = os.path.join(DIR, '2014_income_race_centers.json')
VOTES_TMP = '/tmp/vote_data.csv'
UNMERGED_TMP = '/tmp/unmerged.csv'
MAP_OUTPUT = os.path.join(BASE_DIR, 'assets', 'data', '2014_precincts_income_raceUPDATE.json')
METADATA_OUTPUT = os.path.join(BASE_DIR, 'assets', 'data', '2014_metadata.json')
AGG_STATS_OUTPUT = os.path.join(BASE_DIR, 'assets', 'data', '2014agg_stats.json')
# End constants
# Configure logging
logging.basicConfig(level=logging.INFO)
class Parser(object):
"""
Base class that provides scraping functionality for Clarity Elections site.
Use Selenium's PhantomJS headless browser to simulate clicks and get URL of detail
pages for given counties, then gets precinct-level vote data for a given race.
"""
def _build_driver(self):
"""
Create an instance of Selenium's webdriver.PhantomJS(), used to
simulate clicks on the Clarity elections site
"""
driver = webdriver.Firefox()
driver.get(self.main_url)
return driver
def get_county_urls(self, input_counties=COUNTIES, delay=5):
"""
Use Selenium to get the dynamically generated URLs for each county's
detail page by simulating clicks, and append the URLs to self.county_urls.
"""
self.county_urls = [] # Reset county URLs each time the scraper runs
logging.info('Creating Selenium driver and accessing Clarity')
driver = self._build_driver()
try:
string_counties = (', ').join(input_counties)
except TypeError:
string_counties = 'All counties'
print 'Getting detail page URLs for {}'.format(string_counties)
# Wait until counties have loaded through AJAX to run script
# Yes it's hacky but using WebDriverWait wasn't working
sleep(2)
# Get a list of all counties on the contest summary page
selector = 'table.vts-data > tbody > tr'
all_counties = driver.find_elements_by_css_selector(selector)
# Generate a list of county names
counties = []
for i, county in enumerate(all_counties):
try:
links = county.find_elements_by_tag_name('a')
name = links[0].get_attribute('id')
counties.append(name)
# Some of the rows in the table are just headers
except:
counties.append(None)
# Have to loop through names instead of looping through DOM elements because
# Selenium will throw a StaleElementReferenceException
for i, name in enumerate(counties):
# Because the page loads through AJAX wait until the information for
# the county is loaded
if name:
if input_counties is not None and name.upper() not in input_counties:
continue
try:
check = EC.presence_of_element_located((By.ID, name))
WebDriverWait(driver, delay).until(check)
except TimeoutException:
print 'Home page took too long to load'
print 'Stopping scraper. Your data has not been added'
return
else:
continue
sleep(.5) # Because, inexplicably, it takes a second after the to load the data after the precinct name loads
# Get links from the county row
county = driver.find_elements_by_css_selector(selector)[i]
links = county.find_elements_by_tag_name('a')
county_name = name
rep_votes = county.find_elements_by_css_selector('td')[2].text
dem_votes = county.find_elements_by_css_selector('td')[3].text
# The URL for each county is generated by Clarity on each page visit
# Emulating a click is a sure bet to get to the detail page
links[1].click()
# Wait until the new page loads
try:
check = EC.presence_of_element_located((By.ID, 'precinctDetailLabel'))
WebDriverWait(driver, delay).until(check)
except TimeoutException:
print 'Page took too long to load. Trying to add precincts anyway'
# Remove cruft at the end of URL and append it to our list of URLs
split_url = driver.current_url.split('/')
base_url = ('/').join(split_url[:-2])
self.county_urls.append([county_name.upper(), base_url, rep_votes, dem_votes])
print '{} county precincts added'.format(county_name)
driver.get(self.main_url)
# After looping through all the counties, close Firefox
driver.quit()
x = pd.DataFrame(self.county_urls)
# Save the county urls to the tmp directory so they can be reused on future passes
x.to_csv('/tmp/county_urls.csv', encoding='utf-8', index=False)
return
def get_precincts(self):
"""
Get JSON data from the endpoints listed in :county_urls: and parse
the precinct-level election results from each one
"""
self.precinct_results = [] # Reset the precinct results
for county_name, base_url, rep_votes, dem_votes in self.county_urls:
logging.info('Getting precinct details from {}'.format(base_url))
# Candidate names and votes are stored in separate files. God knows
# why.
candidate_data = requests.get(base_url + '/json/sum.json')
vote_data = requests.get(base_url + '/json/details.json')
# Get the list of candidates
contests = json.loads(candidate_data.content)['Contests']
# Find out which of the contests contains the candidates we're interested in.
# Clarity sometimes includes multiple contests in the same JSON file
try:
order = [i for i, val in enumerate(contests) if CANDIDATES['rep'] in val['CH']][0]
candidates = contests[order]['CH']
except:
continue
logging.error("""The contestant names you supplied don\'t match
any in the data files. Are you sure you spelled the names
correctly?""")
#Get votes for each candidate
contests = json.loads(vote_data.content)['Contests']
contest = contests[order]
for precinct, votes in zip(contest['P'], contest['V']):
data = {'precinct': precinct, 'county': county_name}
total = 0
for candidate, count in zip(candidates, votes):
if candidate == CANDIDATES['rep']:
total += int(count)
data['rep_votes'] = int(count)
elif candidate == CANDIDATES['dem']:
data['dem_votes'] = int(count)
total += int(count)
data['total'] = total
self.precinct_results.append(data)
votes = pd.DataFrame(self.precinct_results)
votes.to_csv(VOTES_TMP, index=False, encoding='utf-8')
return
class ResultSnapshot(Parser):
"""
Class that contains utilities for cleaning Georgia election results and
merging with statistical data gathered from the US Census.
"""
def _clean(self, row):
"""
Private method for renaming the few precincts scraped from the site that
have names that don't match names in the precinct shapefiles.
"""
r = re.compile(r'\d{3} ')
precinct1 = re.sub(r, '', row['precinct'])
precinct2 = re.sub(re.compile(r'EP04-05|EP04-13'), 'EP04', precinct1)
precinct3 = re.sub(re.compile(r'10H1|10H2'), '10H', precinct2)
precinct4 = re.sub(re.compile(r'CATES D - 04|CATES D - 07'), 'CATES D', precinct3)
precinct5 = re.sub(re.compile(r'AVONDALE HIGH - 05|AVONDALE HIGH - 04'), 'AVONDALE HIGH', precinct4)
precinct6 = re.sub(re.compile(r'CHAMBLEE 2'), 'CHAMBLEE', precinct5)
precinct7 = re.sub(re.compile(r'WADSWORTH ELEM - 04'), 'WADSWORTH ELEM', precinct6)
precinct8 = re.sub(re.compile(r'CP06A'), 'CP06', precinct7)
return precinct8.strip().upper()[:20] # Restrict to 20 chars
def _clean_vote_stats(self, precincts):
"""
Private method used to calculate proportions of voters for each
candidate by precinct, clean the precinct name, put the income in bins,
and perform other operations necessary before it's ready to be
consumed by the JS app
"""
cframe = precincts
# Calculate proportion of total votes that each candidate got
cframe['rep_p'] = cframe.apply(self._get_rep_proportion, axis=1)
cframe['dem_p'] = cframe.apply(self._get_dem_proportion, axis=1)
cframe['precinct'] = cframe.apply(self._clean, axis=1)
return cframe
def merge_votes(self, statsf=STATS_FILE, outf=VOTES_TMP):
"""
Public method used to merge the election result dataset with the precinct
maps from the Reapportionment office.
"""
votes_raw = self.precinct_results
votes = pd.DataFrame(votes_raw)
stats = pd.read_csv(statsf, index_col=False)
fvotes = self._clean_vote_stats(votes)
merged = stats.merge(fvotes,
left_on='ajc_precinct',
right_on='precinct',
how='left',
indicator=True)
# Write unmerged precincts to a CSV. Check this to see why you're
# missing them
self.unmerged_precincts = merged[merged._merge != 'both']
self.unmerged_precincts.to_csv(UNMERGED_TMP, index=False)
# Drop precincts with null values for the election results
self.merged_precincts = merged[merged._merge == 'both']
logging.info('Writing precinct information to csv {}'.format(outf))
self.merged_precincts.to_csv(outf)
return
def aggregate_stats(self, statsfile=STATS_FILE):
"""
Calculate an aggregate stats file that's used to populate summary
statistics in the map
"""
just_votes = self.merged_precincts
stats = pd.read_csv(statsfile)
merged = just_votes.merge(stats, how='inner')
merged['income_bin'] = merged.apply(self._get_income, axis=1)
# Calculate aggregated stats for summary table
race = merged.groupby(['county', 'race'])['rep_votes', 'dem_votes'].sum().unstack()
income = merged.groupby(['county','income_bin'])['rep_votes', 'dem_votes'].sum().unstack()
reps = race.rep_votes.merge(income.rep_votes, left_index=True, right_index=True)
reps['party'] = 'rep_votes'
repsf = reps.reset_index()
dems = race.dem_votes.merge(income.dem_votes, left_index=True, right_index=True)
dems['party'] = 'dem_votes'
demsf = dems.reset_index()
combined = pd.concat([repsf, demsf])
# Create a nested defaultdict
data = defaultdict(lambda: defaultdict(dict))
fields = ['black',
'white',
'hispanic',
'high',
'mid',
'low']
# Create a nested JSON object
for i, row in combined.iterrows():
county = row['county']
party = row['party']
county_res = [x[2:] for x in self.county_urls if x[0] == county.upper()][0]
data[county]['all'][party] = 0
for field in fields:
# Check if val is null for precincts missing a certain group
# (eg some precincts have no Hispanics)
if pd.isnull(row[field]):
continue
data[county][field][party] = row[field]
if field in ['high', 'mid', 'low']:
data[county]['all']['rep_votes'] = float(county_res[0])
data[county]['all']['dem_votes'] = float(county_res[1])
# It's impossible to use default dict for the below, because the factory can't
# generate both dicts and ints by default
try:
data['ALL COUNTIES'][field][party] += row[field]
except KeyError:
data['ALL COUNTIES'][field][party] = 0
# Lastly, calculate summary stats for counties
data['ALL COUNTIES']['all']['rep_votes'] = sum([float(x[2]) for x in self.county_urls])
data['ALL COUNTIES']['all']['dem_votes'] = sum([float(x[3]) for x in self.county_urls])
logging.info('Writing aggregated stats to {}'.format(AGG_STATS_OUTPUT))
with open(AGG_STATS_OUTPUT, 'w') as f:
f.write(json.dumps(data, indent=4))
return
def update_map(self, vote_file=VOTES_TMP, geoJSON=MAP_INPUT):
"""
Take map JSON data and generate a new map with updated election data.
"""
logging.info('Adding latest vote information to map file {}'.format(MAP_OUTPUT))
f = open(vote_file)
votes = csv.DictReader(f)
map_data = open(geoJSON, 'r').read()
map_ = json.loads(map_data)
metadata = {}
reporting = 0
for i, feature in enumerate(map_['features']):
name = feature['properties']['PRECINCT_N']
try:
f.seek(0)
match = [x for x in votes if x['PRECINCT_N'] == name][0]
# CSV DictReader automatically parses all columns as strings,
# so we need to manually convert these back to floats
floats = [
'rep_votes',
'dem_votes',
'rep_p',
'dem_p',
'total',
'avg_income'
]
for x in floats:
match[x] = float(match[x])
map_['features'][i]['properties'] = match
if int(match['dem_votes']) != 0 or int(match['rep_votes']) != 0:
reporting += 1
# Catch cases where the map has precincts that aren't in the voter
# files
except IndexError:
continue
# Add relevant metadata
f = '%-I:%M %p, %A %b %-d' # eg: 12:30 AM, Wednesday Nov. 8
metadata['last_update'] = datetime.datetime.now().strftime(f)
metadata['precincts_reporting'] = reporting
metadata['total_precincts'] = TOTAL_PRECINCTS
with open(MAP_OUTPUT, 'w') as a, open(METADATA_OUTPUT, 'w') as b:
a.write(json.dumps(map_))
b.write(json.dumps(metadata))
if __name__ == '__main__':
p = ResultSnapshot(contest_url=CONTEST_URL)
p.get_county_urls()
p.get_precincts()
p.merge_votes()
p.aggregate_stats()
p.update_map()
| [
2,
8997,
9195,
17944,
198,
6738,
25064,
1330,
1822,
85,
198,
11748,
28686,
198,
6738,
640,
1330,
3993,
198,
11748,
302,
198,
11748,
279,
9945,
198,
11748,
18931,
198,
11748,
4818,
8079,
198,
11748,
269,
21370,
198,
11748,
33918,
198,
67... | 2.252878 | 7,209 |
from datetime import timedelta
from unittest.mock import patch
from django.core.files.uploadedfile import SimpleUploadedFile
@patch('django.core.files.storage.FileSystemStorage.save')
@patch('django.core.files.storage.FileSystemStorage.save')
@patch('django.core.files.storage.FileSystemStorage.save')
| [
6738,
4818,
8079,
1330,
28805,
12514,
198,
6738,
555,
715,
395,
13,
76,
735,
1330,
8529,
198,
198,
6738,
42625,
14208,
13,
7295,
13,
16624,
13,
25850,
276,
7753,
1330,
17427,
41592,
276,
8979,
628,
628,
628,
628,
628,
628,
628,
628,
... | 3.035088 | 114 |
import pickle
from collections import defaultdict
from nltk.tokenize import word_tokenize
import time
import sys
import os
import operator
import preprocessing.config as config
import preprocessing.util as util
# TODO delete this one, no longer usefull since there is another one that also handles the conflicts
def tokenize_p_e_m():
'''
tokenizes the mention of the p(e|m) dictionary so that it is consistent with our
tokenized corpus (,.;' all these symbols separate from the previous word with whitespace)
it only modifies the mention and nothing else.
'''
#for dict_file in ["prob_wikipedia_p_e_m.txt", "prob_yago_crosswikis_wikipedia_p_e_m.txt",
# "prob_crosswikis_wikipedia_p_e_m.txt"]:
for dict_file in ["prob_yago_crosswikis_wikipedia_p_e_m.txt"]:
with open(config.base_folder+"data/p_e_m/"+dict_file) as fin, \
open(config.base_folder+"data/p_e_m/" + "tokenized/"+dict_file, "w") as fout:
diff_cnt = 0
for line in fin:
mention, rest = line.split('\t', 1)
if len(mention.split()) > 1:
tokenized_mention = ' '.join(word_tokenize(mention))
else:
tokenized_mention = mention
if mention != tokenized_mention:
diff_cnt += 1
#print(mention, " --------> ", tokenized_mention)
fout.write(tokenized_mention + "\t" + rest)
print(dict_file, "diff_cnt = ", diff_cnt)
def tokenize_p_e_m_and_merge_conflicts(filename, yago=False):
"""takes as input a p_e_m with absolute frequency, tokenizes the mention, handles conflicts
(same mention after tokenization) with merging. execute that on wiki, crosswiki, yago
absolute frequency files -> output again absolute frequency."""
p_e_m = defaultdict(lambda: defaultdict(int))
with open(config.base_folder+"data/p_e_m/"+filename) as fin:
diff_cnt = 0
conflicts_cnt = 0
for line in fin:
line = line.rstrip()
l = line.split("\t")
mention = l[0]
tokenized_mention = ' '.join(word_tokenize(mention))
if mention != tokenized_mention:
diff_cnt += 1
if tokenized_mention in p_e_m:
conflicts_cnt += 1
#print(mention, " --------> ", tokenized_mention)
for e in l[2:]:
if yago:
ent_id, _ = e.split(',', 1)
ent_id = ent_id.strip() # not necessary
freq = 1
else:
ent_id, freq, _ = e.split(',', 2)
ent_id = ent_id.strip() # not necessary
freq = int(freq)
p_e_m[tokenized_mention][ent_id] += freq
print("conflicts from tokenization counter: ", conflicts_cnt)
print_p_e_m_dictionary_to_file(p_e_m, config.base_folder+"data/p_e_m/tokenized/"+filename)
def merge_two_prob_dictionaries(filename1, filename2, newfilename):
"""merge two p_e_m dictionaries that are already in probabilities to a new one again
with probabilities."""
p_e_m = defaultdict(lambda: defaultdict(float))
for filename in [filename1, filename2]:
with open(config.base_folder+"data/p_e_m/tokenized/"+filename) as fin:
for line in fin:
line = line.rstrip()
l = line.split("\t")
mention = l[0]
for e in l[2:]:
ent_id, prob, _ = e.split(',', 2)
ent_id = ent_id.strip() # not necessary
prob = float(prob)
#p_e_m[mention][ent_id] = min(1, p_e_m[mention][ent_id] + prob)
p_e_m[mention][ent_id] = p_e_m[mention][ent_id] + prob # without min
# even without restricting it still the range of values is [0,2]
print_p_e_m_dictionary_to_file(p_e_m, config.base_folder+"data/p_e_m/tokenized/"
+ newfilename)
if __name__ == "__main__":
tokenize_p_e_m()
#tokenize_p_e_m_and_merge_conflicts("wikipedia_p_e_m.txt")
#tokenize_p_e_m_and_merge_conflicts("crosswikis_wikipedia_p_e_m.txt")
#tokenize_p_e_m_and_merge_conflicts("yago_p_e_m.txt", yago=True)
#from_freq_to_prob("wikipedia_p_e_m.txt")
#from_freq_to_prob("crosswikis_wikipedia_p_e_m.txt")
#from_freq_to_prob("yago_p_e_m.txt")
"""
merge_two_prob_dictionaries("prob_crosswikis_wikipedia_p_e_m.txt",
"prob_yago_p_e_m.txt",
"prob_yago_crosswikis_wikipedia_p_e_m.txt")
"""
# vocabulary_count_wiki()
# entity_count_wiki()
# load_p_e_m()
# from_freq_to_prob()
| [
11748,
2298,
293,
198,
6738,
17268,
1330,
4277,
11600,
198,
6738,
299,
2528,
74,
13,
30001,
1096,
1330,
1573,
62,
30001,
1096,
198,
11748,
640,
198,
11748,
25064,
198,
11748,
28686,
198,
11748,
10088,
198,
198,
11748,
662,
36948,
13,
11... | 2.009615 | 2,392 |
import logging
import os
import random
import signal
import subprocess
import time
from parsl.executors.errors import *
from parsl.utils import RepresentationMixin
logger = logging.getLogger(__name__)
class Controller(RepresentationMixin):
"""Start and maintain a IPythonParallel controller.
Parameters
----------
public_ip : str, optional
Specific IP address of the controller, as seen from the engines. If `None`, an attempt will
be made to guess the correct value. Default is None.
interfaces : str, optional
Interfaces for ZeroMQ to listen on. Default is "*".
port : int or str, optional
Port on which the iPython hub listens for registration. If set to `None`, the IPython default will be used. Default
is None.
port_range : str, optional
The minimum and maximum port values to use, in the format '<min>,<max>' (for example: '50000,60000').
If this does not equal None, random ports in `port_range` will be selected for all HubFactory listening services.
This option overrides the port setting value for registration.
reuse : bool, optional
Reuse an existing controller.
ipython_dir : str, optional
IPython directory for IPythonParallel to store config files. This will be overriden by the auto controller
start. Default is "~/.ipython".
profile : str, optional
Path to an IPython profile to use. Default is 'default'.
mode : str, optional
If "auto", controller will be created and managed automatically. If "manual" the controller
is assumed to be created by the user. Default is auto.
"""
def start(self):
"""Start the controller."""
if self.mode == "manual":
return
if self.ipython_dir is not '~/.ipython':
self.ipython_dir = os.path.abspath(os.path.expanduser(self.ipython_dir))
if self.log:
stdout = open(os.path.join(self.ipython_dir, "{0}.controller.out".format(self.profile)), 'w')
stderr = open(os.path.join(self.ipython_dir, "{0}.controller.err".format(self.profile)), 'w')
else:
stdout = open(os.devnull, 'w')
stderr = open(os.devnull, 'w')
try:
opts = [
'ipcontroller',
'' if self.ipython_dir is '~/.ipython' else '--ipython-dir={}'.format(self.ipython_dir),
self.interfaces if self.interfaces is not None else '--ip=*',
'' if self.profile is 'default' else '--profile={0}'.format(self.profile),
'--reuse' if self.reuse else '',
'--location={}'.format(self.public_ip) if self.public_ip else '',
'--port={}'.format(self.port) if self.port is not None else ''
]
if self.port_range is not None:
opts += [
'--HubFactory.hb={0},{1}'.format(self.hb_ping, self.hb_pong),
'--HubFactory.control={0},{1}'.format(self.control_client, self.control_engine),
'--HubFactory.mux={0},{1}'.format(self.mux_client, self.mux_engine),
'--HubFactory.task={0},{1}'.format(self.task_client, self.task_engine)
]
logger.debug("Starting ipcontroller with '{}'".format(' '.join([str(x) for x in opts])))
self.proc = subprocess.Popen(opts, stdout=stdout, stderr=stderr, preexec_fn=os.setsid)
except FileNotFoundError:
msg = "Could not find ipcontroller. Please make sure that ipyparallel is installed and available in your env"
logger.error(msg)
raise ControllerError(msg)
except Exception as e:
msg = "IPPController failed to start: {0}".format(e)
logger.error(msg)
raise ControllerError(msg)
@property
def engine_file(self):
"""Specify path to the ipcontroller-engine.json file.
This file is stored in in the ipython_dir/profile folders.
Returns :
- str, File path to engine file
"""
return os.path.join(self.ipython_dir,
'profile_{0}'.format(self.profile),
'security/ipcontroller-engine.json')
@property
def client_file(self):
"""Specify path to the ipcontroller-client.json file.
This file is stored in in the ipython_dir/profile folders.
Returns :
- str, File path to client file
"""
return os.path.join(self.ipython_dir,
'profile_{0}'.format(self.profile),
'security/ipcontroller-client.json')
def close(self):
"""Terminate the controller process and its child processes.
Args:
- None
"""
if self.reuse:
logger.debug("Ipcontroller not shutting down: reuse enabled")
return
if self.mode == "manual":
logger.debug("Ipcontroller not shutting down: Manual mode")
return
try:
pgid = os.getpgid(self.proc.pid)
os.killpg(pgid, signal.SIGTERM)
time.sleep(0.2)
os.killpg(pgid, signal.SIGKILL)
try:
self.proc.wait(timeout=1)
x = self.proc.returncode
if x == 0:
logger.debug("Controller exited with {0}".format(x))
else:
logger.error("Controller exited with {0}. May require manual cleanup".format(x))
except subprocess.TimeoutExpired:
logger.warn("Ipcontroller process:{0} cleanup failed. May require manual cleanup".format(self.proc.pid))
except Exception as e:
logger.warn("Failed to kill the ipcontroller process[{0}]: {1}".format(self.proc.pid, e))
| [
11748,
18931,
198,
11748,
28686,
198,
11748,
4738,
198,
11748,
6737,
198,
11748,
850,
14681,
198,
11748,
640,
198,
198,
6738,
13544,
75,
13,
18558,
315,
669,
13,
48277,
1330,
1635,
198,
6738,
13544,
75,
13,
26791,
1330,
10858,
341,
3560... | 2.270866 | 2,588 |
from clld.web.assets import environment
from clldutils.path import Path
import lexirumah
environment.append_path(
Path(lexirumah.__file__).parent.joinpath('static').as_posix(), url='/lexirumah:static/')
environment.load_path = list(reversed(environment.load_path))
| [
6738,
269,
297,
67,
13,
12384,
13,
19668,
1330,
2858,
198,
6738,
269,
297,
67,
26791,
13,
6978,
1330,
10644,
198,
198,
11748,
31191,
343,
388,
993,
628,
198,
38986,
13,
33295,
62,
6978,
7,
198,
220,
220,
220,
10644,
7,
2588,
343,
... | 2.924731 | 93 |
# -*- coding: utf-8 -*-
"""WEASEL+MUSE classifier.
multivariate dictionary based classifier based on SFA transform, dictionaries
and logistic regression.
"""
__author__ = ["patrickzib", "BINAYKUMAR943"]
__all__ = ["MUSE"]
import math
import warnings
import numpy as np
from numba import njit
from sklearn.feature_extraction import DictVectorizer
from sklearn.feature_selection import chi2
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline
from sklearn.utils import check_random_state
from sktime.classification.base import BaseClassifier
from sktime.datatypes._panel._convert import from_nested_to_3d_numpy
from sktime.transformations.panel.dictionary_based import SFA
class MUSE(BaseClassifier):
"""MUSE (MUltivariate Symbolic Extension).
Also known as WEASLE-MUSE: implementation of multivariate version of WEASEL,
referred to as just MUSE from [1].
Overview: Input n series length m
WEASEL+MUSE is a multivariate dictionary classifier that builds a
bag-of-patterns using SFA for different window lengths and learns a
logistic regression classifier on this bag.
There are these primary parameters:
alphabet_size: alphabet size
chi2-threshold: used for feature selection to select best words
anova: select best l/2 fourier coefficients other than first ones
bigrams: using bigrams of SFA words
binning_strategy: the binning strategy used to disctrtize into
SFA words.
Parameters
----------
anova: boolean, default=True
If True, the Fourier coefficient selection is done via a one-way
ANOVA test. If False, the first Fourier coefficients are selected.
Only applicable if labels are given
bigrams: boolean, default=True
whether to create bigrams of SFA words
window_inc: int, default=4
WEASEL create a BoP model for each window sizes. This is the
increment used to determine the next window size.
p_threshold: int, default=0.05 (disabled by default)
Feature selection is applied based on the chi-squared test.
This is the p-value threshold to use for chi-squared test on bag-of-words
(lower means more strict). 1 indicates that the test
should not be performed.
use_first_order_differences: boolean, default=True
If set to True will add the first order differences of each dimension
to the data.
random_state: int or None, default=None
Seed for random, integer
Attributes
----------
n_classes_ : int
The number of classes.
classes_ : list
The classes labels.
See Also
--------
WEASEL
References
----------
.. [1] Patrick Schäfer and Ulf Leser, "Multivariate time series classification
with WEASEL+MUSE", in proc 3rd ECML/PKDD Workshop on AALTD}, 2018
https://arxiv.org/abs/1711.11343
Notes
-----
For the Java version, see
`MUSE <https://github.com/uea-machine-learning/tsml/blob/master/src/main/java/tsml/
classifiers/multivariate/WEASEL_MUSE.java>`_.
Examples
--------
>>> from sktime.classification.dictionary_based import MUSE
>>> from sktime.datasets import load_unit_test
>>> X_train, y_train = load_unit_test(split="train", return_X_y=True)
>>> X_test, y_test = load_unit_test(split="test", return_X_y=True)
>>> clf = MUSE(window_inc=4, use_first_order_differences=False)
>>> clf.fit(X_train, y_train)
MUSE(...)
>>> y_pred = clf.predict(X_test)
"""
_tags = {
"capability:multivariate": True,
"capability:multithreading": True,
"coerce-X-to-numpy": False,
"coerce-X-to-pandas": True,
}
def _fit(self, X, y):
"""Build a WEASEL+MUSE classifiers from the training set (X, y).
Parameters
----------
X : nested pandas DataFrame of shape [n_instances, 1]
Nested dataframe with univariate time-series in cells.
y : array-like, shape = [n_instances]
The class labels.
Returns
-------
self :
Reference to self.
"""
y = np.asarray(y)
# add first order differences in each dimension to TS
if self.use_first_order_differences:
X = self._add_first_order_differences(X)
# Window length parameter space dependent on series length
self.col_names = X.columns
rng = check_random_state(self.random_state)
self.n_dims = len(self.col_names)
self.highest_dim_bit = (math.ceil(math.log2(self.n_dims))) + 1
self.highest_bits = np.zeros(self.n_dims)
if self.n_dims == 1:
warnings.warn(
"MUSE Warning: Input series is univariate; MUSE is designed for"
+ " multivariate series. It is recommended WEASEL is used instead."
)
self.SFA_transformers = [[] for _ in range(self.n_dims)]
# the words of all dimensions and all time series
all_words = [dict() for _ in range(X.shape[0])]
# On each dimension, perform SFA
for ind, column in enumerate(self.col_names):
X_dim = X[[column]]
X_dim = from_nested_to_3d_numpy(X_dim)
series_length = X_dim.shape[-1] # TODO compute minimum over all ts ?
# increment window size in steps of 'win_inc'
win_inc = self._compute_window_inc(series_length)
self.max_window = int(min(series_length, self.max_window))
if self.min_window > self.max_window:
raise ValueError(
f"Error in MUSE, min_window ="
f"{self.min_window} is bigger"
f" than max_window ={self.max_window}."
f" Try set min_window to be smaller than series length in "
f"the constructor, but the classifier may not work at "
f"all with very short series"
)
self.window_sizes.append(
list(range(self.min_window, self.max_window, win_inc))
)
self.highest_bits[ind] = math.ceil(math.log2(self.max_window)) + 1
for window_size in self.window_sizes[ind]:
transformer = SFA(
word_length=rng.choice(self.word_lengths),
alphabet_size=self.alphabet_size,
window_size=window_size,
norm=rng.choice(self.norm_options),
anova=self.anova,
binning_method=rng.choice(self.binning_strategies),
bigrams=self.bigrams,
remove_repeat_words=False,
lower_bounding=False,
save_words=False,
n_jobs=self._threads_to_use,
)
sfa_words = transformer.fit_transform(X_dim, y)
self.SFA_transformers[ind].append(transformer)
bag = sfa_words[0]
# chi-squared test to keep only relevant features
relevant_features = {}
apply_chi_squared = self.p_threshold < 1
if apply_chi_squared:
vectorizer = DictVectorizer(sparse=True, dtype=np.int32, sort=False)
bag_vec = vectorizer.fit_transform(bag)
chi2_statistics, p = chi2(bag_vec, y)
relevant_features_idx = np.where(p <= self.p_threshold)[0]
relevant_features = set(
np.array(vectorizer.feature_names_)[relevant_features_idx]
)
# merging bag-of-patterns of different window_sizes
# to single bag-of-patterns with prefix indicating
# the used window-length
highest = np.int32(self.highest_bits[ind])
for j in range(len(bag)):
for (key, value) in bag[j].items():
# chi-squared test
if (not apply_chi_squared) or (key in relevant_features):
# append the prefices to the words to
# distinguish between window-sizes
word = MUSE._shift_left(
key, highest, ind, self.highest_dim_bit, window_size
)
all_words[j][word] = value
self.clf = make_pipeline(
DictVectorizer(sparse=True, sort=False),
# StandardScaler(with_mean=True, copy=False),
LogisticRegression(
max_iter=5000,
solver="liblinear",
dual=True,
# class_weight="balanced",
penalty="l2",
random_state=self.random_state,
n_jobs=self._threads_to_use,
),
)
self.clf.fit(all_words, y)
return self
def _predict(self, X):
"""Predict class values of n instances in X.
Parameters
----------
X : nested pandas DataFrame of shape [n_instances, 1]
Nested dataframe with univariate time-series in cells.
Returns
-------
y : array-like, shape = [n_instances]
Predicted class labels.
"""
bag = self._transform_words(X)
return self.clf.predict(bag)
def _predict_proba(self, X):
"""Predict class probabilities for n instances in X.
Parameters
----------
X : nested pandas DataFrame of shape [n_instances, 1]
Nested dataframe with univariate time-series in cells.
Returns
-------
y : array-like, shape = [n_instances, n_classes_]
Predicted probabilities using the ordering in classes_.
"""
bag = self._transform_words(X)
return self.clf.predict_proba(bag)
@staticmethod
@njit(fastmath=True, cache=True)
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
8845,
1921,
3698,
10,
44,
19108,
1398,
7483,
13,
198,
198,
16680,
42524,
22155,
1912,
1398,
7483,
1912,
319,
311,
7708,
6121,
11,
48589,
3166,
198,
392,
2604,
256... | 2.17352 | 4,645 |
import graphistry, os, pandas as pd, streamlit as st
from components import GraphistrySt, URLParam
from graphistry import PyGraphistry
from css import all_css
from time import sleep
from util import getChild
############################################
#
# DASHBOARD SETTINGS
#
############################################
# Controls how entrypoint.py picks it up
app_id = 'app_01'
logger = getChild(app_id)
urlParams = URLParam(app_id)
############################################
#
# CUSTOM CSS
#
############################################
# Have fun!
############################################
#
# SIDEBAR RENDER AERA
#
############################################
# Given URL params, render left sidebar form and return combined filter settings
# #https://docs.streamlit.io/en/stable/api.html#display-interactive-widgets
############################################
#
# FILTER PIPELINE
#
############################################
# Given filter settings, generate/cache/return dataframes & viz
@st.cache(suppress_st_warning=True, allow_output_mutation=True)
############################################
#
# VIZ
#
############################################
############################################
#
# MAIN RENDER AERA
#
############################################
# Given configured filters and computed results (cached), render
############################################
#
# Putting it all together
#
############################################
| [
11748,
4823,
4592,
11,
28686,
11,
19798,
292,
355,
279,
67,
11,
4269,
18250,
355,
336,
198,
6738,
6805,
1330,
29681,
4592,
1273,
11,
10289,
22973,
198,
6738,
4823,
4592,
1330,
9485,
37065,
4592,
198,
6738,
269,
824,
1330,
477,
62,
254... | 4.160665 | 361 |
#
# DRAGONS
#
# cal_service
# ------------------------------------------------------------------------------
from os import path
import warnings
from importlib import import_module
from ..config import globalConf, load_config
from .userdb import UserDB
from .localdb import LocalDB
from .remotedb import RemoteDB
# ------------------------------------------------------------------------------
# BEGIN Setting up the calibs section for config files
CONFIG_SECTION = 'calibs'
# END Setting up the calibs section for config files
# ------------------------------------------------------------------------------
def get_db_path_from_config():
"""
Read the path of the local database specified in the config file. An
error will be raised if there is no such database, or more than one.
This function is used by the "caldb" script and the set_local_database()
function here.
Parameters
----------
config: str
name of the configuration file
Returns
-------
db_path : str
the path to the local database file
"""
if not globalConf.sections():
raise OSError("Cannot read config file.")
databases = parse_databases()
db_path = None
for db in databases:
if db[0] == LocalDB:
if db_path is None:
db_path = db[1]
else:
raise ValueError("Multiple local database files are listed "
"in the config file.")
if db_path is None:
raise ValueError("No local database file is listed in the config file.")
return db_path
def init_calibration_databases(inst_lookups=None, procmode=None,
ucals=None, upload=None):
"""
Initialize the calibration databases for a PrimitivesBASE object.
Parameters
----------
inst_lookups : str
local of the instrument lookups package (for the MDF lookup table)
ucals : dict
user calibrations
upload : list
things to upload (we're concerned about "calibs" and "science")
Returns
-------
A UserDB object, possibly linked to additional CalDB objects
"""
# Read the mdf_dict file and create an actual dict with the complete
# paths to each of the MDF files
try:
masks = import_module('.maskdb', inst_lookups)
mdf_dict = getattr(masks, 'mdf_dict')
except (ImportError, TypeError, AttributeError):
mdf_dict = None
else:
for k, v in mdf_dict.items():
mdf_dict[k] = path.join(path.dirname(masks.__file__),
'MDF', v)
caldb = UserDB(name="manual calibrations", mdf_dict=mdf_dict,
user_cals=ucals)
upload_calibs = upload is not None and "calibs" in upload
upload_science = upload is not None and "science" in upload
for cls, db, kwargs in parse_databases():
kwargs["procmode"] = procmode
if cls == RemoteDB:
# Actually storing to a remote DB requires that "store" is set in
# the config *and* the appropriate type is in upload
kwargs["store_science"] = kwargs["store_cal"] and upload_science
kwargs["store_cal"] &= upload_calibs
elif cls == LocalDB:
kwargs["force_init"] = False
database = cls(db, name=db, **kwargs)
caldb.add_database(database)
return caldb
def parse_databases(default_dbname="cal_manager.db"):
"""
Parse the databases listed in the global config file. This returns a list
provided information on how to build the cascase of databases, but does
not instantiate any CalDB objects, so it can be used by the caldb script
efficiently.
Parameters
----------
default_dbname : str
default name of database file (if only a directory is listed in the
config file)
Returns
-------
list of tuples (class, database name, kwargs)
"""
db_list = []
calconf = get_calconf()
if not calconf:
return db_list
upload_cookie = calconf.get("upload_cookie")
# Allow old-format file to be read
try:
databases = calconf["databases"]
except KeyError:
databases = calconf.get("database_dir")
if not databases:
return db_list
with warnings.catch_warnings():
warnings.simplefilter("always", DeprecationWarning)
warnings.warn("Use 'databases' instead of 'database_dir' in "
"config file.",
DeprecationWarning
)
for line in databases.splitlines():
if not line: # handle blank lines
continue
db, *flags = line.split()
# "get" is default if there are no flags, but if any flags are
# specified, then "get" must be there explicitly
kwargs = {"get_cal": not bool(flags),
"store_cal": False}
for flag in flags:
kwarg = f"{flag}_cal"
if kwarg in kwargs:
kwargs[kwarg] = True
else:
raise ValueError("{}: Unknown flag {!r}".format(db, flag))
expanded_db = path.expanduser(db)
if path.isdir(expanded_db):
db = path.join(db, default_dbname)
cls = LocalDB
elif path.isfile(expanded_db):
cls = LocalDB
elif "/" in expanded_db and "//" not in expanded_db:
cls = LocalDB
else: # does not check
cls = RemoteDB
kwargs["upload_cookie"] = upload_cookie
db_list.append((cls, db, kwargs))
return db_list
def set_local_database():
"""
User helper function to define a local calibration database based on
the "dragonsrc" config file.
Returns
-------
A LocalDB object
"""
load_config()
db_path = get_db_path_from_config()
db = LocalDB(db_path, log=None)
return db
| [
2,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
... | 2.370327 | 2,568 |
# test builtin property
# create a property object explicitly
property()
property(1, 2, 3)
# use its accessor methods
p = property()
p.getter(1)
p.setter(2)
p.deleter(3)
# basic use as a decorator
a = A(1)
print(a.x)
try:
a.x = 2
except AttributeError:
print("AttributeError")
# explicit use within a class
b = B(3)
print(b.x)
b.x = 4
print(b.x)
del b.x
# full use as a decorator
c = C(5)
print(c.x)
c.x = 6
print(c.x)
del c.x
# a property that has no get, set or del
d = D()
try:
d.prop
except AttributeError:
print('AttributeError')
try:
d.prop = 1
except AttributeError:
print('AttributeError')
try:
del d.prop
except AttributeError:
print('AttributeError')
# properties take keyword arguments
print(E().p)
| [
2,
1332,
3170,
259,
3119,
198,
198,
2,
2251,
257,
3119,
2134,
11777,
198,
26745,
3419,
198,
26745,
7,
16,
11,
362,
11,
513,
8,
198,
198,
2,
779,
663,
1895,
273,
5050,
198,
79,
796,
3119,
3419,
198,
79,
13,
1136,
353,
7,
16,
8,... | 2.436893 | 309 |
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Copyright 2019 The Prescience-Client Authors. All rights reserved.
import copy
from abc import ABC, abstractmethod
from prescience_client.utils.table_printable import TablePrintable, DictPrintable
from prescience_client.enum.output_format import OutputFormat
class Base(TablePrintable, DictPrintable, ABC):
"""
Prescience Model metric object
Inherit from TablePrintable so that it can be easily printed as list on stdout
Inherit from DictPrintable so that it can be easily printed as single dict object on stdout
"""
@abstractmethod
@classmethod
@classmethod
def __init__(self,
json: dict):
"""
Constructor of prescience model metric object
:param json: the source JSON dict received from prescience
"""
self.json_dict = json
| [
2,
5765,
286,
428,
2723,
2438,
318,
21825,
416,
257,
347,
10305,
12,
7635,
198,
2,
5964,
326,
460,
307,
1043,
287,
262,
38559,
24290,
2393,
13,
198,
2,
15069,
13130,
383,
1763,
4234,
12,
11792,
46665,
13,
1439,
2489,
10395,
13,
198,... | 3.110368 | 299 |
# FROM: https://gist.github.com/Skinner927/413c0e9cc8433123f426832f9fe8d931
class classproperty(object):
"""
Similar to @property but used on classes instead of instances.
The only caveat being that your class must use the
classproperty.meta metaclass.
Class properties will still work on class instances unless the
class instance has overidden the class default. This is no different
than how class instances normally work.
Derived from: https://stackoverflow.com/a/5191224/721519
class Z(object, metaclass=classproperty.meta):
@classproperty
def foo(cls):
return 123
_bar = None
@classproperty
def bar(cls):
return cls._bar
@bar.setter
def bar(cls, value):
return cls_bar = value
Z.foo # 123
Z.bar # None
Z.bar = 222
Z.bar # 222
"""
meta = ClassPropertyMeta
_fn_types = (type(__init__), classmethod, staticmethod)
@classmethod
| [
2,
16034,
25,
3740,
1378,
70,
396,
13,
12567,
13,
785,
14,
15739,
5083,
24,
1983,
14,
44103,
66,
15,
68,
24,
535,
5705,
2091,
10163,
69,
19,
25022,
2624,
69,
24,
5036,
23,
67,
24,
3132,
628,
198,
198,
4871,
1398,
26745,
7,
15252... | 2.482587 | 402 |
class Hostaddr(basestring):
"""
the individual client hosts. could be a hostname or an IP
address.
"""
@staticmethod
| [
4871,
14504,
29851,
7,
12093,
395,
1806,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
262,
1981,
5456,
11453,
13,
714,
307,
257,
2583,
3672,
393,
281,
6101,
198,
220,
220,
220,
2209,
13,
198,
220,
220,
220,
37227,
198,
220,
... | 2.491525 | 59 |
@profile
@profile
if __name__ == "__main__":
call()
| [
31,
13317,
198,
198,
31,
13317,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
869,
3419,
198
] | 2.32 | 25 |
print("Please select which presence indicator to wish to use...")
print("Press 1 to run the Teams Presence Indicator")
print("Press 2 to run the Zoom Presence Indicator")
choice = input("Indicator: ")
if choice == '1':
print("Starting the Teams Presence Indicator...")
import teamsPresence
teamsPresence.run()
if choice == '2':
print("Starting the Zoom Presence Indicator...")
import zoomPresence
zoomPresence.run()
| [
4798,
7203,
5492,
2922,
543,
4931,
16916,
284,
4601,
284,
779,
9313,
8,
198,
4798,
7203,
13800,
352,
284,
1057,
262,
24690,
46523,
1423,
26407,
4943,
198,
4798,
7203,
13800,
362,
284,
1057,
262,
40305,
46523,
1423,
26407,
4943,
198,
255... | 3.4 | 130 |
""" module init """
__title__ = 'pair'
__version__ = '0.1.0'
__author__ = 'LIU Lu'
__contact__ = 'nudtlliu@gmail.com'
__license__ = 'MIT'
__all__ = [
'base', 'servicefactory', 'mapbox', 'ors', 'google'
]
from .servicefactory import RoutingServiceFactory
| [
37811,
8265,
2315,
37227,
198,
834,
7839,
834,
796,
705,
24874,
6,
198,
834,
9641,
834,
796,
705,
15,
13,
16,
13,
15,
6,
198,
834,
9800,
834,
796,
705,
31271,
52,
6026,
6,
198,
834,
32057,
834,
796,
705,
77,
463,
83,
15516,
84,
... | 2.564356 | 101 |
import rdflib
import os
import pandas as pd
import csv_db
from demosauruswebapp.demosaurus.link_thesaurus import normalize_name
| [
11748,
374,
67,
2704,
571,
198,
11748,
28686,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
269,
21370,
62,
9945,
198,
6738,
35551,
22302,
12384,
1324,
13,
9536,
47650,
13,
8726,
62,
83,
956,
22302,
1330,
3487,
1096,
62,
3672,
628... | 3.046512 | 43 |
import numpy as np
def concatenate_fill(arrays, axis=0, fill_value=None):
"""
Appends to all the arrays so that they can be concatenated along the given axis (kwargs axis=0 by default).
The fill_value will be automatically determined from the dtype of arrays. For floating point types of arrays
it will be set to NaN, for integer arrays it will be either 0 (for unsigned int) or -1 (signed int).
>>> a = np.arange(2*3).reshape(2, 3)
>>> a
array([[0, 1, 2],
[3, 4, 5]])
>>> b = np.arange(2*2).reshape(2, 2)
>>> b
array([[0, 1],
[2, 3]])
>>> np.concatenate((a, b), axis=0)
Traceback (most recent call last):
...
ValueError: all the input array dimensions except for the concatenation axis must match exactly
>>> concatenate_fill((a, b), axis=0, fill_value=9)
array([[0, 1, 2],
[3, 4, 5],
[0, 1, 9],
[2, 3, 9]])
"""
if len(arrays) == 0:
raise ValueError("Need at least one array")
if len(arrays) == 1:
return arrays[0]
if not all(a.ndim == arrays[0].ndim for a in arrays):
raise ValueError("Requires arrays with the same number of dimensions")
if len(set(a.shape for a in arrays)) == 1:
# all arrays have the same shape, can use normal concatenate
return np.concatenate(arrays, axis=axis)
if all(a.shape[axis] == 0 for a in arrays):
# all arrays are empty along the shape that we want them to be concatenated
# in this case just return the first array (it is empty anyways)
return arrays[0]
final_shape = [(sum if ax == axis else max)(a.shape[ax] for a in arrays)
for ax in range(arrays[0].ndim)]
final_dtype = np.result_type(*arrays)
if fill_value is None:
if issubclass(final_dtype.type, np.floating):
fill_value = np.nan
elif issubclass(final_dtype.type, np.integer):
fill_value = max(-1, np.iinfo(final_dtype).min)
else:
raise ValueError("cannot automatically decide for a fill_value for dtype=%s, please specify fill_value explicitely" % str(final_dtype))
concat = np.full(final_shape, fill_value, dtype=final_dtype)
i = 0
for a in arrays:
target = [slice(0, a.shape[ax], 1) for ax in range(a.ndim)]
target[axis] = slice(i, i + a.shape[axis], 1)
concat[tuple(target)] = a
i += a.shape[axis]
return concat
| [
11748,
299,
32152,
355,
45941,
198,
198,
4299,
1673,
36686,
378,
62,
20797,
7,
3258,
592,
11,
16488,
28,
15,
11,
6070,
62,
8367,
28,
14202,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2034,
2412,
284,
477,
262,
26515,
523,
... | 2.371869 | 1,038 |
import numpy as np
import os, cv2
imgs = np.load('test_set_ck_extended_no_resize.npy')
lbls = np.load('test_labels_ck_extended_no_resize.npy')
for i in range(imgs.shape[0]):
print (lbls[i])
cv2.imshow('img', imgs[i])
cv2.waitKey(0)
| [
11748,
299,
32152,
355,
45941,
198,
11748,
28686,
11,
269,
85,
17,
198,
198,
9600,
82,
796,
45941,
13,
2220,
10786,
9288,
62,
2617,
62,
694,
62,
2302,
1631,
62,
3919,
62,
411,
1096,
13,
77,
9078,
11537,
198,
75,
2436,
82,
796,
459... | 2.043103 | 116 |
n, k = map(int, raw_input().strip().split(' '))
a = map(int, raw_input().strip().split(' '))
array_left_rotation(a, n, k);
answer = array_left_rotation(a, n, k);
print ' '.join(map(str, answer))
| [
198,
198,
77,
11,
479,
796,
3975,
7,
600,
11,
8246,
62,
15414,
22446,
36311,
22446,
35312,
10786,
705,
4008,
198,
64,
796,
3975,
7,
600,
11,
8246,
62,
15414,
22446,
36311,
22446,
35312,
10786,
705,
4008,
198,
18747,
62,
9464,
62,
10... | 2.475 | 80 |
import sys
if len(sys.argv) != 2:
print 'usage: [input edge pair path]'
exit(1)
node_set = set()
with open(sys.argv[1], 'r') as fi:
for line in fi:
line = line.strip('\n').strip('\r')
tmp = line.split('\t')
src = int(tmp[0])
node_set.add(src)
print 'node size: %d' % len(node_set)
| [
11748,
25064,
198,
198,
361,
18896,
7,
17597,
13,
853,
85,
8,
14512,
362,
25,
198,
220,
220,
220,
3601,
705,
26060,
25,
685,
15414,
5743,
5166,
3108,
49946,
198,
220,
220,
220,
8420,
7,
16,
8,
198,
17440,
62,
2617,
796,
900,
3419,... | 2.063291 | 158 |
import json
import logging
import os
import threading
from multiprocessing import Process, Queue
from queue import Empty
from typing import Tuple, Union
from docker import DockerClient
from docker.models.containers import Container
from casperlabs_local_net.errors import CommandTimeoutError, NonZeroExitCodeError
from casperlabs_local_net.docker_config import DockerConfig
def humanify(line):
"""
Decode json dump of execution engine's structured log and render a human friendly line,
containing, together with prefix rendered by the Python test framework, all useful
information. The original dictionary in the EE structured log looks like follows:
{'timestamp': '2019-06-08T17:51:35.308Z', 'process_id': 1, 'process_name': 'casperlabs-engine-grpc-server', 'host_name': 'execution-engine-0-mlgtn', 'log_level': 'Info', 'priority': 5, 'message_type': 'ee-structured', 'message_type_version': '1.0.0', 'message_id': '14039567985248808663', 'description': 'starting Execution Engine Server', 'properties': {'message': 'starting Execution Engine Server', 'message_template': '{message}'}}
"""
if "execution-engine-" not in line:
return line
try:
_, payload = line.split("payload=")
except Exception:
return line
d = json.loads(payload)
return " ".join(str(d[k]) for k in ("log_level", "description"))
class DockerBase:
"""
This holds the common base functionality for docker images.
Rather than constants, we build up properties based on values. Some only work in subclasses.
"""
DOCKER_BASE_NAME = "casperlabs"
@property
@property
@property
@property
@property
@property
@property
@property
@property
@property
@property
@property
@property
class LoggingDockerBase(DockerBase):
"""
This adds logging to DockerBase
"""
@property
| [
11748,
33918,
198,
11748,
18931,
198,
11748,
28686,
198,
11748,
4704,
278,
198,
6738,
18540,
305,
919,
278,
1330,
10854,
11,
4670,
518,
198,
6738,
16834,
1330,
33523,
198,
6738,
19720,
1330,
309,
29291,
11,
4479,
198,
6738,
36253,
1330,
... | 3.07717 | 622 |
#!/usr/bin/env python3
import os
import re
import shlex
import subprocess
import sys
GENERATED_FILE_NAME = "prometheus-metrics.md"
FILE_HEADER = """<!--
{
"name": "Prometheus Metrics",
"category": "5fcfd1ede5ded705a0bf5fd0",
"priority": 1000
}
-->
<!--
============================
GENERATED FILE - DO NOT EDIT
============================
Run `python3 server/metrics/generate_docs.py` to re-generate.
-->
# BuildBuddy metrics
BuildBuddy exposes [Prometheus](https://prometheus.io) metrics that allow monitoring the
[four golden signals](https://landing.google.com/sre/sre-book/chapters/monitoring-distributed-systems/):
latency, traffic, errors, and saturation.
To view these metrics in a live-updating dashboard, we recommend using a tool
like [Grafana](https://grafana.com).
"""
if __name__ == "__main__":
main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
11748,
28686,
198,
11748,
302,
198,
11748,
427,
2588,
198,
11748,
850,
14681,
198,
11748,
25064,
198,
198,
35353,
1137,
11617,
62,
25664,
62,
20608,
796,
366,
16963,
36916,
12,
... | 2.996441 | 281 |
from django.urls import path
from . import views
urlpatterns = [
path("", views.IndexView.as_view(), name="index"),
path("hello/<str:username>", views.HelloView.as_view(), name="hello"),
path("failing", views.FailingView.as_view(), name="failing"),
]
| [
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
198,
6738,
764,
1330,
5009,
198,
198,
6371,
33279,
82,
796,
685,
198,
220,
220,
220,
3108,
7203,
1600,
5009,
13,
15732,
7680,
13,
292,
62,
1177,
22784,
1438,
2625,
9630,
12340,
198,
... | 2.789474 | 95 |
import os
import logging
from sqlalchemy_utils import database_exists, create_database
from datetime import datetime
from sqlalchemy.dialects import postgresql
from flask_sqlalchemy import SQLAlchemy
from config import SQLALCHEMY_DATABASE_URI
db = SQLAlchemy()
| [
11748,
28686,
198,
11748,
18931,
198,
6738,
44161,
282,
26599,
62,
26791,
1330,
6831,
62,
1069,
1023,
11,
2251,
62,
48806,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
6738,
44161,
282,
26599,
13,
38969,
478,
82,
1330,
1281,
34239,
139... | 3.329268 | 82 |
# Capture multi video from webcam
# Display the frame 4 times on canvas
import numpy
import cv2
# 0 means 1st webcam
cap = cv2.VideoCapture(0)
face_cascade = cv2.CascadeClassifier(
cv2.data.haarcascades + "haarcascade_frontalface_default.xml")
eye_cascade = cv2.CascadeClassifier(
cv2.data.haarcascades + "haarcascade_eye.xml")
while True:
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.3, 2)
for (x, y, w, h) in faces:
cv2.rectangle(frame,
(x, y),
(x+w, y+h),
(0, 255, 0),
5
)
roi_gray = gray[y:y+w, x:x+w]
roi_color = frame[y:y+h, x:x+w]
eyes = eye_cascade.detectMultiScale(roi_gray, 1.3, 2)
for (ex, ey, ew, eh) in eyes:
cv2.rectangle(roi_color,
(ex, ey),
(ex+ew, ey+eh),
(0, 255, 0),
5
)
cv2.imshow("Video", frame)
if cv2.waitKey(1) == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
| [
2,
31793,
5021,
2008,
422,
49823,
198,
2,
16531,
262,
5739,
604,
1661,
319,
21978,
198,
198,
11748,
299,
32152,
198,
11748,
269,
85,
17,
198,
198,
2,
657,
1724,
352,
301,
49823,
198,
11128,
796,
269,
85,
17,
13,
10798,
49630,
7,
1... | 1.764079 | 657 |
import items_setup
import unittest
if __name__ == "__main__":
unittest.main()
| [
11748,
3709,
62,
40406,
198,
11748,
555,
715,
395,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
555,
715,
395,
13,
12417,
3419,
198
] | 2.59375 | 32 |
#!/usr/bin/env python3
############################################################################################
# #
# Program purpose: Checks whether a given string is number or not using Lambda. #
# Program Author : Happi Yvan <ivensteinpoker@gmail.com> #
# Creation Date : February 04, 2020 #
# #
############################################################################################
from typing import Callable
if __name__ == "__main__":
main_str = obtain_user_data('Enter some string to check: ')
test_func = LAMBDA_is_string_int(some_str=main_str)
print(f"Is string a number: {'YES' if test_func() else 'NO'}")
| [
2,
48443,
14629,
14,
8800,
14,
24330,
220,
21015,
18,
198,
198,
29113,
29113,
14468,
7804,
4242,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
... | 2.03532 | 453 |
'''----------------------------------------------------------------------------
Name: Heroku API Commands (commands.py)
Purpose: To setup a connection with the Heroku API and denote functions
that carry out various tasks.
Author: Nicholas Chong
Created: 2020-06-24 (YYYY/MM/DD)
----------------------------------------------------------------------------'''
import heroku3
import os
import logging
if __name__=='__main__':
restart_app() | [
7061,
6,
10097,
10541,
198,
5376,
25,
220,
220,
220,
220,
220,
220,
220,
2332,
11601,
7824,
49505,
357,
9503,
1746,
13,
9078,
8,
198,
30026,
3455,
25,
220,
220,
220,
220,
1675,
9058,
257,
4637,
351,
262,
2332,
11601,
7824,
290,
4268... | 3.593985 | 133 |
from Helpers import Logger
from Helpers import xcrun
# This is initial setup that should be done so the xcrun helper module doesn't have to be used everywhere.
import os
DEVELOPER_DIR = os.environ.get('DEVELOPER_DIR')
if DEVELOPER_DIR:
Logger.write().info('DEVELOPER_DIR environment variable is already set, existing value "%s" will be used.' % (DEVELOPER_DIR))
else:
os.environ['DEVELOPER_DIR'] = xcrun.resolve_developer_path()
import pyXcode
import xcodeproj
import xcworkspace | [
6738,
10478,
364,
1330,
5972,
1362,
198,
6738,
10478,
364,
1330,
2124,
66,
5143,
198,
198,
2,
770,
318,
4238,
9058,
326,
815,
307,
1760,
523,
262,
2124,
66,
5143,
31904,
8265,
1595,
470,
423,
284,
307,
973,
8347,
13,
198,
11748,
286... | 3.0625 | 160 |
####################
# ES-DOC CIM Questionnaire
# Copyright (c) 2017 ES-DOC. All rights reserved.
#
# University of Colorado, Boulder
# http://cires.colorado.edu/
#
# This project is distributed according to the terms of the MIT license [http://www.opensource.org/licenses/MIT].
####################
__author__ = 'allyn.treshansky'
from django.db.models.signals import post_save
from django.db.utils import ProgrammingError
from django.contrib.sites.models import Site
from Q.questionnaire.models.models_sites import QSite
from Q.questionnaire.signals.signals_base import disable_for_fixtures
from Q.questionnaire.q_utils import QError
@disable_for_fixtures
def post_save_site_handler(sender, instance, created, **kwargs):
"""
fn that gets called after a standard Django Site is saved;
if it's just been created, then the corresponding QSite needs to be setup
:param sender:
:param kwargs:
:return:
"""
if instance and created:
try:
(q_site, created_q_site) = QSite.objects.get_or_create(site=instance)
except ProgrammingError:
if instance.pk == 1:
# this might fail during initial migration b/c the full set of db tables will not have been setup yet
print("skipped creating site profile for %s" % (instance))
pass
else:
msg = "Unable to create site profile for %s" % (instance)
raise QError(msg)
post_save.connect(post_save_site_handler, sender=Site, dispatch_uid="post_save_site_handler")
| [
14468,
4242,
198,
2,
220,
220,
13380,
12,
38715,
327,
3955,
18233,
24042,
198,
2,
220,
220,
15069,
357,
66,
8,
2177,
13380,
12,
38715,
13,
1439,
2489,
10395,
13,
198,
2,
198,
2,
220,
220,
2059,
286,
7492,
11,
27437,
198,
2,
220,
... | 2.736934 | 574 |
import os
from time import time
import torch
import torch.nn.functional as F
import numpy as np
import SimpleITK as sitk
import xlsxwriter as xw
import scipy.ndimage as ndimage
from net.ResUnet_dice import Net
os.environ['CUDA_VISIBLE_DEVICES'] = '1'
val_ct_dir = './Path of original images/'
#val_seg_dir = './Training/GT/'
organ_pred_dir = './Path to save segmentation/'
module_dir = './FINAL_spleen_net.pth'
upper = 350
lower = -upper
down_scale = 0.5
size = 48
slice_thickness = 3
organ_list = [
'spleen',
]
net = torch.nn.DataParallel(Net(training=False)).cuda()
net.load_state_dict(torch.load(module_dir))
net.eval()
for file_index, file in enumerate(os.listdir(val_ct_dir)):
start_time = time()
ct = sitk.ReadImage(os.path.join(val_ct_dir, file), sitk.sitkInt16)
ct_array_ori = sitk.GetArrayFromImage(ct)
ct_array= sitk.GetArrayFromImage(ct)
print(file)
print('size of CT: ', ct_array.shape)
ct_array[ct_array > upper] = upper
ct_array[ct_array < lower] = lower
ct_array = ndimage.zoom(ct_array, (ct.GetSpacing()[-1] / slice_thickness, down_scale, down_scale), order=3)
#ct_array = ndimage.shift(ct_array,shift=[0,360,0],mode='reflect')
flag = False
start_slice = 0
end_slice = start_slice + size - 1
ct_array_list = []
while end_slice <= ct_array.shape[0] - 1:
ct_array_list.append(ct_array[start_slice:end_slice + 1, :, :])
start_slice = end_slice + 1
end_slice = start_slice + size - 1
if end_slice is not ct_array.shape[0] - 1:
flag = True
count = ct_array.shape[0] - start_slice
ct_array_list.append(ct_array[-size:, :, :])
outputs_list = []
with torch.no_grad():
for ct_array in ct_array_list:
ct_tensor = torch.FloatTensor(ct_array).cuda()
ct_tensor = ct_tensor.unsqueeze(dim=0)
ct_tensor = ct_tensor.unsqueeze(dim=0)
outputs = net(ct_tensor)
outputs = outputs.squeeze()
outputs_list.append(outputs.cpu().detach().numpy())
del outputs
pred_seg = np.concatenate(outputs_list[0:-1], axis=1)
if flag is False:
pred_seg = np.concatenate([pred_seg, outputs_list[-1]], axis=1)
else:
pred_seg = np.concatenate([pred_seg, outputs_list[-1][:, -count:, :, :]], axis=1)
pred_seg = torch.FloatTensor(pred_seg).unsqueeze(dim=0)
pred_seg = F.upsample(pred_seg, ct_array_ori.shape, mode='trilinear').squeeze().detach().numpy()
pred_seg = np.argmax(pred_seg, axis=0)
pred_seg = np.round(pred_seg).astype(np.uint8)
print('size of pred: ', pred_seg.shape)
# 将预测的结果保存为nii数据
pred_seg = sitk.GetImageFromArray(pred_seg)
pred_seg.SetDirection(ct.GetDirection())
pred_seg.SetOrigin(ct.GetOrigin())
pred_seg.SetSpacing(ct.GetSpacing())
sitk.WriteImage(pred_seg, os.path.join(organ_pred_dir, file.replace('img', 'liver')))
del pred_seg
speed = time() - start_time
# worksheet.write(14, file_index + 1, speed)
print('this case use {:.3f} s'.format(speed))
print('-----------------------')
#workbook.close()
| [
11748,
28686,
198,
6738,
640,
1330,
640,
198,
198,
11748,
28034,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
17427,
2043,
42,
355,
1650,
74,
198,
11748,
2124,
7278,
87,
16002,
... | 2.150778 | 1,479 |
import doctest
import unittest
from hypothesis import given
from hypothesis.strategies import (builds, from_regex, integers, just, lists,
recursive, tuples)
from src.main import *
strat_codeline = from_regex(r"\A[a-z]{3}\Z")
strat_nochildren = just([])
strat_children = recursive(strat_nochildren, f)
@given(strat_children)
@given(recursive(from_regex(r"\A[a-z]{3}\Z"), lists))
| [
11748,
10412,
395,
198,
11748,
555,
715,
395,
198,
198,
6738,
14078,
1330,
1813,
198,
6738,
14078,
13,
2536,
2397,
444,
1330,
357,
11249,
82,
11,
422,
62,
260,
25636,
11,
37014,
11,
655,
11,
8341,
11,
198,
220,
220,
220,
220,
220,
... | 2.347826 | 184 |
import json
import math
import os
import sys
import time
import colorama
from colorama import Style, Fore, Back
colorama.init()
import click
@click.command()
@click.option('--fields', default='')
@click.option('--hide-inactive/--no-hide-inactive', default=False)
@click.option('--only')
@click.option('--watch', type=float, default=0.)
@click.option('--limit', type=int)
@click.option('--threshold', type=float)
@click.option('--ignore-inactive-nan/--no-ignore-inactive-nan', default=True)
@click.argument('folder', required=True)
if __name__ == '__main__':
run()
| [
11748,
33918,
198,
11748,
10688,
198,
11748,
28686,
198,
11748,
25064,
198,
11748,
640,
198,
11748,
3124,
1689,
198,
6738,
3124,
1689,
1330,
17738,
11,
4558,
11,
5157,
198,
198,
8043,
1689,
13,
15003,
3419,
198,
198,
11748,
3904,
628,
6... | 2.924242 | 198 |
"""rename status retry
Revision ID: 6ef79b56ad4a
Revises: 94e7b91d83d5
Create Date: 2017-06-19 15:06:50.441524+00:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6ef79b56ad4a'
down_revision = '94e7b91d83d5'
branch_labels = None
depends_on = None
## ref http://blog.yo1.dog/updating-enum-values-in-postgresql-the-safe-and-easy-way/
| [
37811,
918,
480,
3722,
1005,
563,
198,
198,
18009,
1166,
4522,
25,
718,
891,
3720,
65,
3980,
324,
19,
64,
198,
18009,
2696,
25,
10048,
68,
22,
65,
6420,
67,
5999,
67,
20,
198,
16447,
7536,
25,
2177,
12,
3312,
12,
1129,
1315,
25,
... | 2.365269 | 167 |
"""
SparseSeriesData
"""
from __future__ import annotations
import logging
import sys
import time
import copy
from typing import Dict
# Its there not sure why pylint is unable to find it
# pylint: disable-msg=E0611 # No Name In Module
from lru import LRU
from nbdb.common.context import Context
from nbdb.common.data_point import DataPoint
from nbdb.common.data_point import FIELD
from nbdb.common.data_point import MISSING_POINT_VALUE, TOMBSTONE_VALUE
from nbdb.common.telemetry import Telemetry
from nbdb.common.tracing_config import TracingConfig
from nbdb.config.settings import Settings
from nbdb.store.sparse_store import SparseStore
from nbdb.store.sparse_series_stats_base import SeriesStatsBase
from pyformance import time_calls
logger = logging.getLogger()
# pylint: disable=R0902
class SeriesWriterBase:
"""
This class contains the common methods used in sparse series writer
and recovery series writer
"""
# pylint: disable=R0913 # Too Many Arguments
def generate_data_point_shard_by_metric(self, data_point: DataPoint,
shard: int) -> DataPoint:
"""
Generate a duplicate datapoint for the cross-cluster datasource.
Duplicating to the cross-cluster datasources enables fast cross-cluster
querying.
NOTE: We assume that the cross-cluster pattern matching has already
been done & verified before this method is called
"""
datasource_name = self.context.schema.compose_crosscluster_datasource(
shard)
dup_data_point = copy.deepcopy(data_point)
dup_data_point.datasource = datasource_name
return dup_data_point
def _run_after_interval(self, func_name, interval):
"""
Executes the function func_name if atleast interval seconds has elapsed
since last run
:param func_name:
:param interval:
:return:
"""
if func_name not in self._periodic_last_run_times:
self._periodic_last_run_times[func_name] = 0
if time.time() - self._periodic_last_run_times[func_name] < interval:
return
func = getattr(self, func_name, None)
func()
self._periodic_last_run_times[func_name] = time.time()
@time_calls
def report_stats_cache_telemetry(self) -> int:
"""
Expensive operation should be called rarely
Periodically report the stats telemetry.
This is expensive operation so should be done sparingly
:return size in bytes of the stats cache
"""
cache_size_bytes = sys.getsizeof(self.stats_cache)
stats_count = 0
transformed_count = 0
for stats_key, stats in self.stats_cache.items():
# count the items and transformations
stats_count += 1
if stats.get_pre_transform_value(-1) != -1:
transformed_count += 1
# Estimate the size of the stats entry
# add the size of key and stats primitive types
cache_size_bytes += sys.getsizeof(stats_key) + sys.getsizeof(stats)
Telemetry.inst.registry.gauge(
measurement='SparseSeriesWriter.stats_cache.size_bytes',
tag_key_values=["Topic=%s" % self.sparse_telemetry_source_id,
"ConsumerMode=%s" % self.consumer_mode]
).set_value(cache_size_bytes)
Telemetry.inst.registry.gauge(
measurement='SparseSeriesWriter.stats_cache.size',
tag_key_values=["Topic=%s" % self.sparse_telemetry_source_id,
"ConsumerMode=%s" % self.consumer_mode]
).set_value(stats_count)
Telemetry.inst.registry.gauge(
measurement='SparseSeriesWriter.stats_cache.transformed',
tag_key_values=["Topic=%s" % self.sparse_telemetry_source_id,
"ConsumerMode=%s" % self.consumer_mode]
).set_value(transformed_count)
return cache_size_bytes
def handle_series_start(self, datapoint: DataPoint, stats: SeriesStatsBase):
"""Handle additional logic when a series is created for the first time"""
# Update the cross-cluster shard value since we have encountered this
# series for the first time
cloned_tags = datapoint.tags.copy()
cloned_tags[FIELD] = datapoint.field
shard = self.context.schema.get_crosscluster_shard(cloned_tags)
if TracingConfig.TRACE_ACTIVE:
logger.info('TRACE: schema.get_crosscluster_shard() tags=%s '
'shard=%s', datapoint.tags, shard)
stats.set_crosscluster_shard(shard)
# Check if it matches one of the sparseness disabled patterns. If yes,
# store the info in a stats object
if self.context.schema.is_sparseness_disabled(cloned_tags):
stats.set_sparseness_disabled()
@time_calls
def heartbeat_scan(self, now: int = None) -> None:
"""
Expensive operation should be called rarely.
Scans the entire stats cache periodically and looks for dead series.
A dead series is explicitly marked with a tombstone value
:param now: time to compare the stats against, parameterized for
unittests
"""
if now is None:
now = time.time()
logger.info('heartbeat_scan(): now=%s', now)
# Num tombstones per datasource
num_tombstones: Dict[str, int] = dict()
for stats_key, stats in self.stats_cache.items():
# heartbeat_scan() can only be invoked in non-replay mode
replay_mode = False
tombstone = SeriesWriterBase.\
check_offline_tombstone(self.termination_detection_interval, \
self.data_gap_detection_interval, \
stats_key, stats, now)
SeriesWriterBase.\
remove_stats_cache_entry(self.stats_cache, stats_key, stats)
if tombstone is not None:
self.create_marker(tombstone, stats, replay_mode, terminate=True)
# extract datasource
datasource = DataPoint.datasource_from_series_id(stats_key)
if datasource in num_tombstones:
num_tombstones[datasource] = num_tombstones[datasource] + 1
else:
num_tombstones[datasource] = 1
for tombstones in num_tombstones.values():
Telemetry.inst.registry.meter(
'RecoverySeriesWriter.markers.tombstones').mark(tombstones)
def create_marker(self,
marker: DataPoint,
stats: SeriesStatsBase,
replay_mode: bool,
terminate: bool = False) -> None:
"""
Creates a missing / tombstone marker and updates stats appropriately
:param marker:
:param stats:
:param replay_mode:
:param terminate: IF true then series is terminated and we remove
stats object from the cache
"""
if terminate:
del self.stats_cache[marker.series_id]
self._write(marker, stats, replay_mode)
def _write_datapoint(self, data_point: DataPoint, stat: SeriesStatsBase):
"""
Write datapoint to sparse store. Write an additional cross-cluster
datapoint if series matches one of the cross-cluster rules
"""
self.sparse_store.write(data_point)
# Check if datapoint matches one of the cross-cluster patterns. If
# so, we duplicate a datapoint to the cross-cluster datasource to
# enable fast cross-cluster querying
shard = stat.get_crosscluster_shard()
if TracingConfig.TRACE_ACTIVE:
logger.info(
'TRACE: stat.get_crosscluster_shard, data_point=%s '
'shard=%s', data_point, shard)
if shard is not None:
# Datapoint matched one of the cross-cluster patterns
dup_data_point = self.generate_data_point_shard_by_metric(
data_point, shard)
self.sparse_store.write(dup_data_point)
if TracingConfig.TRACE_ACTIVE:
logger.info('TRACE: sparse_series_writer dup_cc_point: '
'data_point %s stats:%s', data_point, stat)
self.duplicated_data_points += 1
# meter.mark calls are expensive, amortize it across 1000 calls
if self.duplicated_data_points > 1000:
Telemetry.inst.registry.meter(
'MetricConsumer.duplicated_cc_data_points'
).mark(self.duplicated_data_points)
self.duplicated_data_points = 0
def _write(self, data_point: DataPoint, stat: SeriesStatsBase,
replay_mode: bool) -> None:
"""
Write the data point to store
:param data_point:
:param stat:
"""
raise NotImplementedError(
'Child class must implement the _write method')
def flush_writes(self) -> None:
"""
Flush writes. Blocks till all async writes are complete
"""
self.sparse_store.flush()
def reinitialize(self) -> None:
"""
Prepare the sparse writer to handle replayed datapoints
"""
# It is possible that the series from the older stats objects map to
# partititions that are no longer assigned to us.
#
# Instead of waiting for heartbeat scan to clean up the older object,
# which also triggers unnecessary insertions of tombstone markers, we
# clear up the entire cache and start afresh. This also helps keep our
# memory usage in check and avoid OOM
self.stats_cache.clear()
self.flush_writes()
@staticmethod
def check_offline_tombstone(termination_detection_interval,
data_gap_detection_interval,
series_id,
stats,
now):
"""
Check if a tombstone needs to be created to signal a dead series
:param series_id:
:param stats:
:param now: wall clock
:return: Returns True if tombstone was created
"""
refresh_epoch = stats.get_refresh_epoch()
if refresh_epoch <= 0:
# we cannot create a tombstone if we don't know the history
return None
time_since_last_point = now - stats.get_server_rx_time()
if time_since_last_point <= termination_detection_interval:
return None
# If we reached here, it means it has been longer than
# `termination_detection_interval` since the last point was received
if stats.is_sparseness_disabled():
# For series which have sparseness disabled, we don't generate
# tombstone values.
return None
# Generate a tombstone marker indicating series termination and
# delete stats object
tombstone_epoch = refresh_epoch + data_gap_detection_interval
tombstone = DataPoint.from_series_id(
series_id, tombstone_epoch, TOMBSTONE_VALUE,
# This is a special value. Make sure it's NOT normalized before
# storing
is_special_value=True)
return tombstone
@staticmethod
def remove_stats_cache_entry(stats_cache, series_id, stats):
"""
Remove stats cache entry which will not be used
"""
if stats.is_sparseness_disabled():
# For series which have sparseness disabled, delete the stats object
del stats_cache[series_id]
@staticmethod
def check_inline_missing_points(data_gap_detection_interval,
data_point,
stats):
"""
Checks for missing points within a single series based on the gap
between last reported point and the new point received
:param data_point:
:param stats:
"""
refresh_epoch = stats.get_refresh_epoch()
if refresh_epoch <= 0:
# we cannot create a missing point marker if we don't know the
# history
if TracingConfig.TRACE_ACTIVE:
logger.info('TRACE: sparse_series_writer.check_inline_'
'missing_points: data_point %s no missing '
'marker check due to no history stats %s',
str(data_point), str(stats))
return None
if data_point.epoch-refresh_epoch <= data_gap_detection_interval:
# The new data point came within the data gap interval
if TracingConfig.TRACE_ACTIVE:
logger.info('TRACE: sparse_series_writer.check_inline_'
'missing_points: data_point %s within '
'data_gap_detection_interval %d'
'stats %s',
str(data_point),
data_gap_detection_interval,
str(stats))
return None
missing_pt_epoch = refresh_epoch + data_gap_detection_interval
if TracingConfig.TRACE_ACTIVE:
logger.info('TRACE: sparse_series_writer.check_inline_'
'missing_points: data_point %s outside of '
'data_gap_detection_interval %d. '
'stats %s creating new missing marker at epoch=%d',
str(data_point),
data_gap_detection_interval,
str(stats),
missing_pt_epoch)
missing_pt_marker = DataPoint(data_point.datasource,
data_point.field,
data_point.tags,
missing_pt_epoch,
data_point.server_rx_epoch,
MISSING_POINT_VALUE,
# This is a special value. Make sure it's
# NOT normalized before storing
is_special_value=True,
series_id=data_point.series_id)
Telemetry.inst.registry.meter(
'SparseSeriesWriter.markers.missing_points').mark()
return missing_pt_marker
| [
37811,
198,
50,
29572,
27996,
6601,
198,
37811,
198,
6738,
11593,
37443,
834,
1330,
37647,
198,
198,
11748,
18931,
198,
11748,
25064,
198,
11748,
640,
198,
11748,
4866,
198,
6738,
19720,
1330,
360,
713,
198,
198,
2,
6363,
612,
407,
1654... | 2.160529 | 6,734 |
#!/usr/bin/env python3
import argparse
import logging
import os
import re
import sys
import time
import traceback
import Constants
import FoscamImager
import Mailer
import NetHelpers
system_healthy = True
state = dict()
message = ""
#### Helper Functions ####
# Note: For windows nodes only
# Note: For Foscam nodes only
#### Main Routine ####
if __name__ == "__main__":
parser = argparse.ArgumentParser(description = "Reboot Utility")
parser.add_argument('--mode',
help ='Foscams or Windows(i.e.:Alpha)',
choices =['foscam','windows'],
default ='foscam')
parser.add_argument('--reboot',
help ='Reboot or check only',
action ='store_true',
default =False)
parser.add_argument('--display_image',
help ='Display captured image',
action ='store_true',
default =False)
parser.add_argument('--always_email',
help ='Send email report',
action ='store_true',
default =False)
parser.add_argument('-d', '--debug', action='store_true',
help='set logging level to debug')
args = parser.parse_args()
logfile = '%s/%s.log' % (Constants.LOGGING_DIR, os.path.basename(__file__))
log_format = '%(levelname)s:%(module)s.%(lineno)d:%(asctime)s: %(message)s'
logging.basicConfig(filename=logfile, format=log_format, level=logging.INFO)
if args.debug:
logging.getLogger().setLevel(logging.DEBUG)
logging.info('============')
logging.info('Invoked command: %s' % ' '.join(sys.argv))
nodes = Constants.FOSCAM_NODES if args.mode == 'foscam' \
else Constants.WINDOWS_NODES
log_message("Checking connectivity...")
check_state(desired_up=True, attempts=5) ## Seeing intermittent nwk failures. Let's mask these
for nodeName, nodeIP in nodes.items():
if state[nodeName]:
log_message(" %s: %s online." % (args.mode, nodeName))
else:
log_message(">> ERROR %s: %s offline." % (args.mode, nodeName))
if args.reboot:
log_message("Rebooting now...")
for nodeName, nodeIP in nodes.items():
if args.mode == 'foscam':
logging.debug(reboot_foscam(nodeName))
else:
# If windows and alive, do a deep check before rebooting.
log_message(print_deep_state(nodeName))
logging.debug(reboot_windows(nodeIP))
check_state(desired_up=False, attempts=180)
for nodeName, nodeIP in nodes.items():
if state[nodeName]:
log_message(" Confirmed node is down: %s" % nodeName)
else:
log_message(">> ERROR: Oops! Node did not reboot: %s" % nodeName)
log_message("Sleep until nodes restart...")
check_state(desired_up=True, attempts=180)
for nodeName, nodeIP in nodes.items():
if state[nodeName]:
log_message(" %s: %s back online." % (args.mode, nodeName))
else:
log_message(">> ERROR: %s: %s failed online." % (args.mode, nodeName))
time.sleep(60) # generously wait for nodes to stabilize
# Do a deeper check
log_message("Check if foscams are healthy...")
for nodeName, nodeIP in nodes.items():
if state[nodeName]:
if args.mode == 'foscam':
node_healthy = check_if_can_image(nodeName, args.display_image)
system_healthy = system_healthy and node_healthy
else:
# If windows and alive, do a deep check
log_message(print_deep_state(nodeName))
# Cleanup and reporting
if not system_healthy:
log_message(">> ERROR: Node check failed!")
else:
log_message('All is well')
Mailer.sendmail(topic="[NodeCheck-%s]" %args.mode, alert=not system_healthy, \
message=message, always_email=args.always_email)
print("Done!")
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
11748,
1822,
29572,
198,
11748,
18931,
198,
11748,
28686,
198,
11748,
302,
198,
11748,
25064,
198,
11748,
640,
198,
11748,
12854,
1891,
198,
11748,
4757,
1187,
198,
11748,
376,
17500,
... | 2.387276 | 1,619 |
from typing import Tuple, Union
import gym.spaces as spaces
import numpy as np
from gym.spaces import Box
from autograph.lib.envs.adversarialenv import AdversarialEnv, PlayerID
from autograph.lib.envs.saveloadenv import SaveLoadEnv
from autograph.lib.util import element_add, element_neg
PATTERNS = ((0, 1), (1, 0), (1, 1), (1, -1))
| [
6738,
19720,
1330,
309,
29291,
11,
4479,
198,
198,
11748,
11550,
13,
2777,
2114,
355,
9029,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
11550,
13,
2777,
2114,
1330,
8315,
198,
198,
6738,
1960,
2384,
13,
8019,
13,
268,
14259,
13,
32... | 2.855932 | 118 |
arr = [64, 34, 25, 12, 22, 11, 90]
test_arr = [2, 1, 5, 3, 4, 7]
bubbleSort(test_arr)
print("排序后的数组:")
for i in range(len(test_arr)):
print("%d" % test_arr[i]),
print(bubble(test_arr)) | [
628,
198,
3258,
796,
685,
2414,
11,
4974,
11,
1679,
11,
1105,
11,
2534,
11,
1367,
11,
4101,
60,
198,
9288,
62,
3258,
796,
685,
17,
11,
352,
11,
642,
11,
513,
11,
604,
11,
767,
60,
198,
198,
46176,
903,
42758,
7,
9288,
62,
3258... | 1.839623 | 106 |
import socket
s=socket.socket()
n=int(raw_input("enter n:"))
s.connect(('127.0.0.1',2222))
for k in range(0,n):
input=raw_input()
#s.connect(('127.0.0.1',2222))
s.send(input)
k=s.recv(1024)
print k
| [
11748,
17802,
198,
82,
28,
44971,
13,
44971,
3419,
198,
77,
28,
600,
7,
1831,
62,
15414,
7203,
9255,
299,
11097,
4008,
198,
82,
13,
8443,
7,
10786,
16799,
13,
15,
13,
15,
13,
16,
3256,
1828,
1828,
4008,
198,
1640,
479,
287,
2837,
... | 2.03 | 100 |
#coding:utf-8
#
# id: functional.gtcs.external_file_04_d
# title: GTCS/tests/external-file-04-d. Test for external table with field of INTEGER datatype
# decription:
# Original test see in:
# https://github.com/FirebirdSQL/fbtcs/blob/master/GTCS/tests/EXT_REL_0_4_D.script
# Checked on: 4.0.0.2240; 3.0.7.33380
#
# tracker_id:
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
from firebird.qa import db_factory, python_act, Action
# version: 3.0
# resources: None
substitutions_1 = [('[ \t]+', ' ')]
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
#
# import os
# import sys
# import subprocess
# import time
#
# tmp_file = os.path.join(context['temp_directory'],'tmp_ext_04_d.tmp')
# if os.path.isfile( tmp_file):
# os.remove( tmp_file )
#
# this_fdb = db_conn.database_name
#
# sql_cmd='''
# connect 'localhost:%(this_fdb)s' user '%(user_name)s' password '%(user_password)s';
# create table ext_table external file '%(tmp_file)s' (f01 int);
# commit;
# insert into ext_table (f01) values ( 2147483647);
# insert into ext_table (f01) values (-2147483648);
# insert into ext_table (f01) values (1);
# insert into ext_table (f01) values (-1);
# insert into ext_table (f01) values (0);
# insert into ext_table (f01) values ( 2147483648);
# insert into ext_table (f01) values (-2147483649);
# commit;
# set list on;
# set count on;
# select * from ext_table order by f01;
# ''' % dict(globals(), **locals())
#
# runProgram('isql', [ '-q' ], sql_cmd)
#
# f_sql_chk = open( os.path.join(context['temp_directory'],'tmp_ext_04_d.sql'), 'w')
# f_sql_chk.write(sql_cmd)
# f_sql_chk.close()
#
# time.sleep(1)
#
# os.remove(f_sql_chk.name)
# os.remove( tmp_file )
#
#---
act_1 = python_act('db_1', substitutions=substitutions_1)
expected_stderr_1 = """
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
"""
expected_stdout_1 = """
F01 -2147483648
F01 -1
F01 0
F01 1
F01 2147483647
Records affected: 5
"""
@pytest.mark.version('>=3.0')
@pytest.mark.xfail
| [
2,
66,
7656,
25,
40477,
12,
23,
198,
2,
198,
2,
4686,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10345,
13,
13655,
6359,
13,
22615,
62,
7753,
62,
3023,
62,
67,
198,
2,
3670,
25,
220,
220,
220,
220,
220,
220,
220,
... | 2.189094 | 1,137 |
import numpy as np
__all__ = ('_fod_dimensionality_fixer', 'iterable_data_array', 'data_array_builder')
def _fod_dimensionality_fixer(data_dict, check_key, keys_to_fix):
"""
Checks the dimensionality of data in data_dict for function on data and reshapes them if their shape is 1d.
args:
data_dict (dict): Data
check_key (str or key): The key to check the dimensionality of
keys_to_fix (str or key or array-like(str or key)): The keys to reshape
returns:
out (tuple): The reshaped data corresponding to each key in keys to fix.
example:
```python
>>> data_dict = {'R':np.array([1,2,3])}
>>> data_dict['R'].shape
> (3,)
>>> newR = _fod_dimensionality_fixer(data_dict, 'R', 'R')
>>> newR.shape
> (1, 3)
```
"""
keys_to_fix = np.array([keys_to_fix]).flatten()
out = []
checker = data_dict[check_key]
if len(checker.shape) == 1:
for key in keys_to_fix:
out.append(data_dict[key].reshape(1, len(data_dict[key])))
else:
for key in keys_to_fix:
out.append(data_dict[key])
return tuple(out)
| [
11748,
299,
32152,
355,
45941,
198,
198,
834,
439,
834,
796,
19203,
62,
69,
375,
62,
46156,
1483,
62,
13049,
263,
3256,
705,
2676,
540,
62,
7890,
62,
18747,
3256,
705,
7890,
62,
18747,
62,
38272,
11537,
628,
628,
198,
4299,
4808,
69... | 2.244782 | 527 |
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.view import view_config
@view_config(
route_name = 'home'
renderer = 'json')
if __name__ == '__main__':
with Configurator() as config:
config.add_route('home', '/')
config.scan()
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
server.serve_forever() | [
6738,
266,
45213,
557,
69,
13,
36439,
62,
15388,
1330,
787,
62,
15388,
198,
6738,
27944,
13,
11250,
1330,
17056,
333,
1352,
198,
6738,
27944,
13,
1177,
1330,
1570,
62,
11250,
198,
198,
31,
1177,
62,
11250,
7,
198,
220,
220,
220,
633... | 2.502994 | 167 |
import logging
from libs import baseview
from rest_framework.response import Response
from django.http import HttpResponse
from core.models import (
SqlRecord,
SqlOrder
)
CUSTOM_ERROR = logging.getLogger('Yearning.core.views')
class recordorder(baseview.SuperUserpermissions):
'''
审核记录相关
'''
| [
11748,
18931,
198,
6738,
9195,
82,
1330,
2779,
1177,
198,
6738,
1334,
62,
30604,
13,
26209,
1330,
18261,
198,
6738,
42625,
14208,
13,
4023,
1330,
367,
29281,
31077,
198,
6738,
4755,
13,
27530,
1330,
357,
198,
220,
220,
220,
311,
13976,
... | 2.523077 | 130 |
from app.blueprints.user.views import user | [
6738,
598,
13,
17585,
17190,
13,
7220,
13,
33571,
1330,
2836
] | 3.818182 | 11 |
"""
mobile-block
MobileNet-style blocks for PyTorch
Author: SF-Zhou
Date: 2019-01-15
"""
from setuptools import setup
name = 'mobile_block'
setup(
name=name,
version='0.0.6',
description='MobileNet-style blocks for PyTorch',
url=f'https://github.com/SF-Zhou/{name.replace("_", "-")}',
author='SF-Zhou',
author_email='sfzhou.scut@gmail.com',
keywords='MobileNet Block PyTorch',
py_modules=[f'{name}'],
install_requires=['torch']
)
| [
37811,
198,
24896,
12,
9967,
198,
17066,
7934,
12,
7635,
7021,
329,
9485,
15884,
354,
198,
13838,
25,
14362,
12,
57,
15710,
198,
10430,
25,
13130,
12,
486,
12,
1314,
198,
37811,
198,
198,
6738,
900,
37623,
10141,
1330,
9058,
198,
198,... | 2.463158 | 190 |
import logging
from typing import Any
from json_checker.core.base import Base
from json_checker.core.exceptions import CheckerError
from json_checker.core.checkers import Validator
from json_checker.core.reports import Report
log = logging.getLogger(__name__)
| [
11748,
18931,
198,
198,
6738,
19720,
1330,
4377,
198,
198,
6738,
33918,
62,
9122,
263,
13,
7295,
13,
8692,
1330,
7308,
198,
6738,
33918,
62,
9122,
263,
13,
7295,
13,
1069,
11755,
1330,
6822,
263,
12331,
198,
6738,
33918,
62,
9122,
263... | 3.441558 | 77 |
import pytest
from ubatch.ubatch import UBatch
@pytest.fixture
| [
11748,
12972,
9288,
198,
198,
6738,
20967,
963,
13,
549,
963,
1330,
471,
33,
963,
628,
198,
198,
31,
9078,
9288,
13,
69,
9602,
198
] | 2.68 | 25 |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401
from oci.decorators import init_model_state_from_kwargs
@init_model_state_from_kwargs
class UdpOptions(object):
"""
Optional and valid only for UDP. Use to specify particular destination ports for UDP rules.
If you specify UDP as the protocol but omit this object, then all destination ports are allowed.
"""
def __init__(self, **kwargs):
"""
Initializes a new UdpOptions object with values from keyword arguments.
The following keyword arguments are supported (corresponding to the getters/setters of this class):
:param destination_port_range:
The value to assign to the destination_port_range property of this UdpOptions.
:type destination_port_range: oci.core.models.PortRange
:param source_port_range:
The value to assign to the source_port_range property of this UdpOptions.
:type source_port_range: oci.core.models.PortRange
"""
self.swagger_types = {
'destination_port_range': 'PortRange',
'source_port_range': 'PortRange'
}
self.attribute_map = {
'destination_port_range': 'destinationPortRange',
'source_port_range': 'sourcePortRange'
}
self._destination_port_range = None
self._source_port_range = None
@property
def destination_port_range(self):
"""
Gets the destination_port_range of this UdpOptions.
:return: The destination_port_range of this UdpOptions.
:rtype: oci.core.models.PortRange
"""
return self._destination_port_range
@destination_port_range.setter
def destination_port_range(self, destination_port_range):
"""
Sets the destination_port_range of this UdpOptions.
:param destination_port_range: The destination_port_range of this UdpOptions.
:type: oci.core.models.PortRange
"""
self._destination_port_range = destination_port_range
@property
def source_port_range(self):
"""
Gets the source_port_range of this UdpOptions.
:return: The source_port_range of this UdpOptions.
:rtype: oci.core.models.PortRange
"""
return self._source_port_range
@source_port_range.setter
def source_port_range(self, source_port_range):
"""
Sets the source_port_range of this UdpOptions.
:param source_port_range: The source_port_range of this UdpOptions.
:type: oci.core.models.PortRange
"""
self._source_port_range = source_port_range
| [
2,
19617,
25,
3384,
69,
12,
23,
198,
2,
15069,
357,
66,
8,
1584,
11,
33160,
11,
18650,
290,
14,
273,
663,
29116,
13,
220,
1439,
2489,
10395,
13,
198,
2,
770,
3788,
318,
10668,
12,
36612,
284,
345,
739,
262,
14499,
2448,
33532,
1... | 2.606867 | 1,165 |
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.
# Python Implementation: grib_set_keys
#
# Description: how to set key values in GRIB messages
#
from __future__ import print_function
import traceback
import sys
from eccodes import *
from datetime import date
from collections import OrderedDict
INPUT = '../../data/regular_latlon_surface_constant.grib1'
OUTPUT = 'out.set.grib'
VERBOSE = 1 # verbose error reporting
if __name__ == "__main__":
sys.exit(main())
| [
2,
357,
34,
8,
15069,
5075,
12,
13182,
14326,
37,
13,
198,
2,
198,
2,
770,
3788,
318,
11971,
739,
262,
2846,
286,
262,
24843,
10483,
594,
10628,
362,
13,
15,
198,
2,
543,
460,
307,
6492,
379,
2638,
1378,
2503,
13,
43073,
13,
239... | 3.312757 | 243 |
my_host = 'localhost'
my_port = 10000
is_emulation = False
emulator_host = '0.0.0.0'
emulator_port = 4390
apis_web_host = '0.0.0.0'
apis_web_budo_emulator_port = 43830
apis_web_api_server_port = 9999
#apis_log_group_address = 'FF02:0:0:0:0:0:0:1'
apis_log_group_address = '224.2.2.4'
apis_log_port = 8888
units = [
{
'id' : 'E001',
'name' : 'E001',
'host' : '0.0.0.0',
'dcdc_port' : 4380,
'emu_port' : 8080,
},
{
'id' : 'E002',
'name' : 'E002',
'host' : '0.0.0.0',
'dcdc_port' : 4380,
'emu_port' : 8080,
},
{
'id' : 'E003',
'name' : 'E003',
'host' : '0.0.0.0',
'dcdc_port' : 4380,
'emu_port' : 8080,
},
{
'id' : 'E004',
'name' : 'E004',
'host' : '0.0.0.0',
'dcdc_port' : 4380,
'emu_port' : 8080,
},
]
default_control_dcdc_command = 'MODE'
default_control_dcdc_mode = 'WAIT'
default_grid_voltage_v = 350
default_grid_current_a = 2.3
default_droop_ratio = 0
default_deal_grid_current_a = 2
default_deal_amount_wh = 100
default_point_per_wh = 10
default_efficient_grid_voltage_v = 330
default_error_level = 'ERROR'
default_error_extent = 'LOCAL'
default_error_category = 'HARDWARE'
default_wait_log_timeout_s = 30
default_wait_duration_s = 5
default_apis_global_operation_mode = 'Run'
default_apis_local_operation_mode = None
| [
198,
1820,
62,
4774,
796,
705,
36750,
6,
198,
1820,
62,
634,
796,
33028,
198,
198,
271,
62,
368,
1741,
796,
10352,
198,
198,
368,
8927,
62,
4774,
796,
705,
15,
13,
15,
13,
15,
13,
15,
6,
198,
368,
8927,
62,
634,
796,
604,
2596... | 2.007825 | 639 |
from datetime import datetime, timedelta
import pytest
import pytz
from tests.assertions import assert_durations_are_eq
from garden import models
from garden.formatters import WateringStationFormatter
@pytest.mark.unit
@pytest.mark.unit
@pytest.mark.unit
@pytest.mark.unit
| [
6738,
4818,
8079,
1330,
4818,
8079,
11,
28805,
12514,
198,
198,
11748,
12972,
9288,
198,
11748,
12972,
22877,
198,
6738,
5254,
13,
30493,
507,
1330,
6818,
62,
67,
20074,
62,
533,
62,
27363,
198,
198,
6738,
11376,
1330,
4981,
198,
6738,
... | 3.215909 | 88 |
"""
Copyright 2022 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
# [START slides_create_slide]
from __future__ import print_function
import google.auth
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
def create_slide(presentation_id, page_id):
"""
Creates the Presentation the user has access to.
Load pre-authorized user credentials from the environment.
TODO(developer) - See https://developers.google.com/identity
for guides on implementing OAuth2 for the application.\n"
"""
creds, _ = google.auth.default()
# pylint: disable=maybe-no-member
try:
service = build('slides', 'v1', credentials=creds)
# Add a slide at index 1 using the predefined
# 'TITLE_AND_TWO_COLUMNS' layout and the ID page_id.
requests = [
{
'createSlide': {
'objectId': page_id,
'insertionIndex': '1',
'slideLayoutReference': {
'predefinedLayout': 'TITLE_AND_TWO_COLUMNS'
}
}
}
]
# If you wish to populate the slide with elements,
# add element create requests here, using the page_id.
# Execute the request.
body = {
'requests': requests
}
response = service.presentations() \
.batchUpdate(presentationId=presentation_id, body=body).execute()
create_slide_response = response.get('replies')[0].get('createSlide')
print(f"Created slide with ID:"
f"{(create_slide_response.get('objectId'))}")
except HttpError as error:
print(f"An error occurred: {error}")
print("Slides not created")
return error
return response
if __name__ == '__main__':
# Put the presentation_id, Page_id of slides whose list needs
# to be submitted.
create_slide("12SQU9Ik-ShXecJoMtT-LlNwEPiFR7AadnxV2KiBXCnE", "My4ndpage")
# [END slides_create_slide]
| [
37811,
198,
15269,
33160,
3012,
11419,
198,
198,
26656,
15385,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
5832,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
1639,
743,
7... | 2.476004 | 1,021 |
import base64
from django.urls import reverse
from dcim.models import Device, DeviceRole, DeviceType, Manufacturer, Site
from secrets.models import Secret, SecretRole, SessionKey, UserKey
from utilities.testing import ViewTestCases
from .constants import PRIVATE_KEY, PUBLIC_KEY
| [
11748,
2779,
2414,
198,
198,
6738,
42625,
14208,
13,
6371,
82,
1330,
9575,
198,
198,
6738,
30736,
320,
13,
27530,
1330,
16232,
11,
16232,
47445,
11,
16232,
6030,
11,
40218,
11,
14413,
198,
6738,
13141,
13,
27530,
1330,
3943,
11,
3943,
... | 3.773333 | 75 |
"""
Is One Array a Rotation of Another? (Python)
Write a function that returns True if one array is a rotation of another.
Example: [1, 2, 3, 4, 5, 6, 7] is a rotation of [4, 5, 6, 7, 1, 2, 3].
NOTE: There are no duplicates in each of these arrays.
REMINDER: We're going to use lists instead of arrays in Python for simplicity.
"""
if __name__ == '__main__':
list1 = [1, 2, 3, 4, 5, 6, 7]
list2b = [4, 5, 6, 7, 1, 2, 3]
print(is_rotation(list1, list2b)) # True
list2c = [4, 5, 6, 9, 1, 2, 3]
print(is_rotation(list1, list2c)) # False
list2d = [4, 6, 5, 7, 1, 2, 3]
print(is_rotation(list1, list2d)) # False
list2e = [4, 5, 6, 7, 0, 2, 3]
print(is_rotation(list1, list2e)) # False
list2f = [1, 2, 3, 4, 5, 6, 7]
print(is_rotation(list1, list2f)) # True
| [
37811,
198,
220,
220,
220,
1148,
1881,
15690,
257,
371,
14221,
286,
6023,
30,
357,
37906,
8,
628,
220,
220,
220,
19430,
257,
2163,
326,
5860,
6407,
611,
530,
7177,
318,
257,
13179,
286,
1194,
13,
198,
220,
220,
220,
17934,
25,
685,
... | 2.245232 | 367 |
import numpy as np
from matplotlib import pyplot as plt
from scipy.ndimage import median_filter, gaussian_filter
import epics
import time
import imageio
import logging, coloredlogs
coloredlogs.install(fmt='%(asctime)s,%(msecs)d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s',datefmt='%H:%M:%S',level=logging.INFO)
"""
Assumes:
- RUBY In beam
- Ball bearing is centred on dynmrt rotation isocentre
- BDA centred on synch beam
- Masks are 20x20,10x10,5x5.
"""
##################
# INPUT PARAMETERS
##################
logging.critical("These input params are probably wrong. Should be read out of a cfg file.")
# Save images?
SAVE = False
# This is the left bottom top right of the field in RUBY in pixels.
l = 0
r = 2560
b = 1181
t = 944
# Pixel size (in mm) as calculated from COR script.
pixelSize = 0.008
#######################
# INTERNAL CALCULATIONS
#######################
# The row in the image to take.
_col = int((r-l)/2)
_row = int((b-t)/2)
###################################
# START RUBY ACQUISITION PARAMETERS
###################################
exposureTime = 0.1
logging.info("Setting up RUBY acquisition parameters.")
epics.caput('SR08ID01DET01:CAM:Acquire.VAL',0,wait=True)
epics.caput('SR08ID01DET01:CAM:AcquireTime.VAL',exposureTime)
epics.caput('SR08ID01DET01:CAM:AcquirePeriod.VAL',0.00)
epics.caput('SR08ID01DET01:CAM:ImageMode.VAL','Single',wait=True)
epics.caput('SR08ID01DET01:TIFF:AutoSave.VAL','No',wait=True)
epics.caput('SR08ID01DET01:CAM:Acquire.VAL',1,wait=True)
##########################
# GET BALLBEARING POSITION => MIGHT NOT BE NEEDED...???
##########################
# Open the shutter.
openShutter()
##########################
# CALCULATE MASK POSITIONS
##########################
d_v = []
# Iterate over all three masks.
for i in range(3):
# First mask.
logging.info("Selecting mask {}.".format(i))
horizontalImages = []
verticalImages = []
# Move to first mask.
logging.critical("Selecting a mask position is probably wrong. Not sure how epics does that. Check me. In fact, check ALL PV's!")
epics.caput('SR08ID01SST25:MASK_POS:{}.VAL'.format(i),1,wait=True)
logging.info("Acquiring images...")
# Move mask to +ve (right) edge and take an image.
epics.caput('SR08ID01SST25:MASK.TWV',10,wait=True)
epics.caput('SR08ID01SST25:MASK.TWF',1,wait=True)
horizontalImages.append(getImage(save=SAVE,fname='mask1-left'))
# Move mask to -ve (left) edge and take an image.
epics.caput('SR08ID01SST25:MASK.TWV',20,wait=True)
epics.caput('SR08ID01SST25:MASK.TWR',1,wait=True)
horizontalImages.append(getImage(save=SAVE,fname='mask1-right'))
# Put back to horizontal centre.
epics.caput('SR08ID01SST25:MASK_POS:{}.VAL'.format(i),1,wait=True)
# Get top edge.
epics.caput('SR08ID01SST25:Z.VAL',10,wait=True)
verticalImages.append(getImage(save=SAVE,fname='mask1-top'))
# Get bottom edge.
epics.caput('SR08ID01SST25:Z.VAL',-10,wait=True)
verticalImages.append(getImage(save=SAVE,fname='mask1-bottom'))
# Put back to veritcal centre.
epics.caput('SR08ID01SST25:Z.VAL',0,wait=True)
# Calculate centre.
logging.info("Calculating centre point...")
# Take line profile of each image.
horizontalLines = []
verticalLines = []
logging.critical("Finding the edges of the mask will need to be developed. Haven't worked that out yet.")
for i in range(len(horizontalImages)):
horizontalImages[i] = gaussian_filter(horizontalImages[i],sigma=10)
temp = horizontalImages[i][_row,:].astype(float)
horizontalLines.append(np.absolute(temp-temp.max()))
for i in range(len(verticalImages)):
horizontalImages[i] = gaussian_filter(horizontalImages[i],sigma=10)
temp = horizontalImages[i][_row,:].astype(float)
verticalLines.append(np.absolute(temp-temp.max()))
# Find the change.
for i in range(len(horizontalLines)):
# Horizontal lines
peak = np.argmax(horizontalLines[i])
peaks.append(peak)
# Vertical lines
peak = np.argmax(verticalLines[i])
peaks.append(peak)
# Calculate relative movements.
d_h = np.absolute(peaks[1]-peaks[3])*pixelSize/2
d_v.append(np.absolute(peaks[0]-peaks[2])*pixelSize/2)
# Apply horizontal adjustment and save to mask position.
logging.info("Adjusting horizontal centre point...")
current = epics.caget('SR08ID01SST25:MASK_POS:1.VAL')
epics.caput('SR08ID01SST25:MASK_POS:1.VAL',current+d_h,wait=True)
# Apply vertical adjustment (to table).
logging.info("Adjusting vertical centre point (set by the average of all three mask positions)...")
current = epics.caget('SR08ID01SST25:TABLE_Z.VAL')
epics.caput('SR08ID01SST25:TABLE_Z.VAL',current+np.average(d_v),wait=True)
# fig,ax = plt.subplots(2,4)
# ax = ax.flatten()
# ax[0].plot(line[0])
# # ax[0].scatter(line[0][peaks[0]],marker='+',color='r')
# ax[1].plot(line[1])
# # ax[1].scatter(line[1][peaks[1]],marker='+',color='r')
# ax[2].plot(line[2])
# # ax[2].scatter(line[2][peaks[2]],marker='+',color='r')
# ax[3].plot(line[3])
# # ax[3].scatter(line[3][peaks[3]],marker='+',color='r')
# ax[4].imshow(image[0],cmap='gray')
# ax[5].imshow(image[1],cmap='gray')
# ax[6].imshow(image[2],cmap='gray')
# ax[7].imshow(image[3],cmap='gray')
# plt.show()
# Finished, close the shutter.
closeShutter()
# Set rotation back to home.
logging.info("Moving back to Mask 1 position.")
epics.caput('SR08ID01SST25:MASK_POS:{}.VAL'.format(i),1,wait=True)
logging.info("Finished! Wasn't that easy?")
| [
11748,
299,
32152,
355,
45941,
198,
6738,
2603,
29487,
8019,
1330,
12972,
29487,
355,
458,
83,
198,
6738,
629,
541,
88,
13,
358,
9060,
1330,
14288,
62,
24455,
11,
31986,
31562,
62,
24455,
198,
11748,
2462,
873,
198,
11748,
640,
198,
1... | 2.564864 | 2,089 |
S = input()
flag1 = True
flag2 = True
flag3 = True
flag1 = S[0] == "A" and S.count("A") == 1
flag2 = S.count("C") == 1 and 2 <= S.index("C") <= len(S)-2
S = S.replace("A", "")
S = S.replace("C", "")
flag3 = S.islower()
if all([flag1, flag2, flag3]):
print("AC")
else:
print("WA") | [
50,
796,
5128,
3419,
198,
32109,
16,
796,
6407,
198,
32109,
17,
796,
6407,
198,
32109,
18,
796,
6407,
198,
198,
32109,
16,
796,
311,
58,
15,
60,
6624,
366,
32,
1,
290,
311,
13,
9127,
7203,
32,
4943,
6624,
352,
198,
32109,
17,
79... | 2.172932 | 133 |
#!/usr/bin/env python
# coding: utf-8
import os
import re
from setuptools import setup
_VERSION_RE = re.compile(r"__version__\s*?=\s*?'(.*?)'", flags=re.M)
setup(
name='pangu',
version=get_version(),
description='Paranoid text spacing for good readability, to automatically insert whitespace between CJK (Chinese, Japanese, Korean) and half-width characters (alphabetical letters, numerical digits and symbols).',
long_description=open('README.rst').read() + '\n' + open('HISTORY.rst').read(),
keywords='pangu text-spacing spacing text typesetting readability chinese japanese korean obsessive-compulsive-disorder ocd paranoia',
author='Vinta Chen',
author_email='vinta.chen@gmail.com',
url='https://github.com/vinta/pangu.py',
license='MIT',
include_package_data=True,
py_modules=['pangu'],
test_suite='test_pangu',
entry_points={
'console_scripts': ['pangu=pangu:cli'],
},
zip_safe=False,
classifiers=(
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Natural Language :: Chinese (Traditional)',
'Natural Language :: Chinese (Simplified)',
'Natural Language :: Japanese',
'Natural Language :: Korean',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Education',
'Topic :: Software Development :: Internationalization',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Text Processing',
'Topic :: Text Processing :: General',
'Topic :: Text Processing :: Linguistic',
'Topic :: Utilities',
),
)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
11748,
28686,
198,
11748,
302,
198,
198,
6738,
900,
37623,
10141,
1330,
9058,
198,
198,
62,
43717,
62,
2200,
796,
302,
13,
5589,
576,
7,
8... | 2.762861 | 797 |
# Generated by Django 2.2.2 on 2019-06-06 12:20
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
import uuid
| [
2,
2980,
515,
416,
37770,
362,
13,
17,
13,
17,
319,
13130,
12,
3312,
12,
3312,
1105,
25,
1238,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
14208,
13,
9945,
13,
27530,
13,
2934,
1616,
295,
... | 2.984375 | 64 |