content
stringlengths
1
1.05M
input_ids
listlengths
1
883k
ratio_char_token
float64
1
22.9
token_count
int64
1
883k
from graviteeio_cli.lint.types.function_result import FunctionResult def length(value, **kwargs): """Count the length of a string an or array, the number of properties in an object, or a numeric value, and define minimum and/or maximum values.""" min = None max = None if "min" in kwargs and type(kwargs["min"]) is int: min = kwargs["min"] if "max" in kwargs and type(kwargs["max"]) is int: max = kwargs["max"] value_length = 0 if value: if type(value) is (int or float): value_length = value else: value_length = len(value) results = [] if min and value_length < min: results.append( FunctionResult("min length is {}".format(min)) ) if max and value_length > max: results.append( FunctionResult("max length is {}".format(max)) ) return results
[ 6738, 9067, 578, 68, 952, 62, 44506, 13, 75, 600, 13, 19199, 13, 8818, 62, 20274, 1330, 15553, 23004, 628, 198, 4299, 4129, 7, 8367, 11, 12429, 46265, 22046, 2599, 198, 220, 220, 220, 37227, 12332, 262, 4129, 286, 257, 4731, 281, 39...
2.433155
374
# coding: utf-8 """ Unofficial python library for the SmartRecruiters API The SmartRecruiters API provides a platform to integrate services or applications, build apps and create fully customizable career sites. It exposes SmartRecruiters functionality and allows to connect and build software enhancing it. OpenAPI spec version: 1 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import sys import os import re # python 2 and python 3 compatibility library from six import iteritems from ..configuration import Configuration from ..api_client import ApiClient
[ 2, 19617, 25, 3384, 69, 12, 23, 198, 198, 37811, 198, 220, 220, 220, 791, 16841, 21015, 5888, 329, 262, 10880, 6690, 4872, 364, 7824, 628, 220, 220, 220, 383, 10880, 6690, 4872, 364, 7824, 3769, 257, 3859, 284, 19386, 2594, 393, 547...
3.869048
168
name = input('Hello! What is your name? : ') print('Nice to meet you,', name + '!') print() age = int(input('How old are you ' + name + '? : ')) print() x = age + 1 print(' ', x, end=' ') if x >= 11 and x <= 19: print('', end='') elif x % 10 == 1: print('', end='') elif x % 10 >= 2 and x % 10 <= 4: print('', end='') else: print('', end='') print('!')
[ 3672, 796, 5128, 10786, 15496, 0, 1867, 318, 534, 1438, 30, 1058, 705, 8, 198, 4798, 10786, 35284, 284, 1826, 345, 11, 3256, 1438, 1343, 705, 0, 11537, 198, 4798, 3419, 198, 198, 496, 796, 493, 7, 15414, 10786, 2437, 1468, 389, 345,...
2.308642
162
import numpy as np import pandas as pd import matplotlib.pyplot as plt import warnings warnings.filterwarnings("ignore") import yfinance as yf yf.pdr_override() import datetime as dt # input symbol = 'AAPL' start = dt.date.today() - dt.timedelta(days = 365*2) end = dt.date.today() # Read data df = yf.download(symbol,start,end) # R=red, O=orange, Y=yellow, G=green, B=blue, I = indigo, and V=violet df['Red'] = df['Adj Close'].rolling(2).mean() df['Orange'] = df['Red'].rolling(2).mean() df['Yellow'] = df['Orange'].rolling(2).mean() df['Green'] = df['Yellow'].rolling(2).mean() df['Blue'] = df['Green'].rolling(2).mean() df['Indigo'] = df['Blue'].rolling(2).mean() df['Violet'] = df['Indigo'].rolling(2).mean() df = df.dropna() colors = ['k','r', 'orange', 'yellow', 'g', 'b', 'indigo', 'violet'] df[['Adj Close','Red','Orange','Yellow','Green','Blue','Indigo','Violet']].plot(colors=colors, figsize=(18,12)) plt.fill_between(df.index, df['Low'], df['High'], color='grey', alpha=0.4) plt.plot(df['Low'], c='darkred', linestyle='--', drawstyle="steps") plt.plot(df['High'], c='forestgreen', linestyle='--', drawstyle="steps") plt.title('Rainbow Charts') plt.legend(loc='best') plt.xlabel('Date') plt.ylabel('Price') plt.show() # ## Candlestick with Rainbow from matplotlib import dates as mdates dfc = df.copy() dfc['VolumePositive'] = dfc['Open'] < dfc['Adj Close'] #dfc = dfc.dropna() dfc = dfc.reset_index() dfc['Date'] = mdates.date2num(dfc['Date'].tolist()) from mplfinance.original_flavor import candlestick_ohlc fig, ax1 = plt.subplots(figsize=(20,12)) candlestick_ohlc(ax1,dfc.values, width=0.5, colorup='g', colordown='r', alpha=1.0) #colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'] #labels = ['Red', 'Orange', 'Yellow', 'Green', 'Blue', 'Indigo', 'Violet'] for i in dfc[['Red', 'Orange', 'Yellow', 'Green', 'Blue', 'Indigo', 'Violet']]: ax1.plot(dfc['Date'], dfc[i], color=i, label=i) ax1.xaxis_date() ax1.xaxis.set_major_formatter(mdates.DateFormatter('%d-%m-%Y')) ax1.grid(True, which='both') ax1.minorticks_on() ax1v = ax1.twinx() colors = dfc.VolumePositive.map({True: 'g', False: 'r'}) ax1v.bar(dfc.Date, dfc['Volume'], color=colors, alpha=0.4) ax1v.axes.yaxis.set_ticklabels([]) ax1v.set_ylim(0, 3*df.Volume.max()) ax1.set_title('Stock '+ symbol +' Closing Price') ax1.set_ylabel('Price') ax1.set_xlabel('Date') ax1.legend(loc='best') plt.show()
[ 11748, 299, 32152, 355, 45941, 198, 11748, 19798, 292, 355, 279, 67, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 11748, 14601, 198, 40539, 654, 13, 24455, 40539, 654, 7203, 46430, 4943, 198, 11748, 331, 69, 14149,...
2.394212
1,002
import requests from urllib.request import urlopen from urllib.request import urlretrieve import cgi import os.path pdf_downloader()
[ 11748, 7007, 198, 6738, 2956, 297, 571, 13, 25927, 1330, 19016, 9654, 198, 6738, 2956, 297, 571, 13, 25927, 1330, 19016, 1186, 30227, 198, 11748, 269, 12397, 198, 11748, 28686, 13, 6978, 198, 220, 220, 220, 220, 198, 198, 12315, 62, 1...
3.136364
44
import spacy import json, os import dill as pickle import numpy as np import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from sqlalchemy import create_engine, select, MetaData, Table, Column, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from typing import List, Dict, Any from flask import current_app from app.models import Dataset # from vta.operators import featurize # from vta.operators import clean # from vta.operators import select # from vta import spacy_nlp from .tex_column import TexColumn from .tex_metadata import MetadataItem from .tex_vis import TexVis from ..types import VTAColumnType, VisType
[ 11748, 599, 1590, 198, 11748, 33918, 11, 28686, 198, 11748, 288, 359, 355, 2298, 293, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 19798, 292, 355, 279, 67, 198, 6738, 1341, 35720, 13, 30053, 62, 2302, 7861, 13, 5239, 1330, 309, 69...
3.406699
209
from uuid import uuid4 from sqlalchemy import Boolean, Column, DateTime, Integer, String from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.orm import relationship from .database import Base # class User(Base): # __tablename__ = "users" # id = Column(Integer, primary_key=True, index=True) # email = Column(String, unique=True, index=True) # hashed_password = Column(String) # is_active = Column(Boolean, default=True) # items = relationship("Item", back_populates="owner") # class Item(Base): # __tablename__ = "items" # id = Column(Integer, primary_key=True, index=True) # title = Column(String, index=True) # description = Column(String, index=True) # owner_id = Column(Integer, ForeignKey("users.id")) # owner = relationship("User", back_populates="items")
[ 6738, 334, 27112, 1330, 334, 27112, 19, 198, 198, 6738, 44161, 282, 26599, 1330, 41146, 11, 29201, 11, 7536, 7575, 11, 34142, 11, 10903, 198, 6738, 44161, 282, 26599, 13, 38969, 478, 82, 13, 7353, 34239, 13976, 1330, 471, 27586, 198, ...
2.802013
298
mesh_pic_bandits = 0 mesh_pic_mb_warrior_1 = 1 mesh_pic_messenger = 2 mesh_pic_prisoner_man = 3 mesh_pic_prisoner_fem = 4 mesh_pic_prisoner_wilderness = 5 mesh_pic_siege_sighted = 6 mesh_pic_siege_sighted_fem = 7 mesh_pic_camp = 8 mesh_pic_payment = 9 mesh_pic_escape_1 = 10 mesh_pic_escape_1_fem = 11 mesh_pic_victory = 12 mesh_pic_defeat = 13 mesh_pic_wounded = 14 mesh_pic_wounded_fem = 15 mesh_pic_steppe_bandits = 16 mesh_pic_mountain_bandits = 17 mesh_pic_sea_raiders = 18 mesh_pic_deserters = 19 mesh_pic_forest_bandits = 20 mesh_pic_cattle = 21 mesh_pic_looted_village = 22 mesh_pic_village_p = 23 mesh_pic_village_s = 24 mesh_pic_village_w = 25 mesh_pic_recruits = 26 mesh_pic_arms_swadian = 27 mesh_pic_castle1 = 28 mesh_pic_castledes = 29 mesh_pic_castlesnow = 30 mesh_pic_charge = 31 mesh_pic_khergit = 32 mesh_pic_nord = 33 mesh_pic_rhodock = 34 mesh_pic_sally_out = 35 mesh_pic_siege_attack = 36 mesh_pic_swad = 37 mesh_pic_town1 = 38 mesh_pic_towndes = 39 mesh_pic_townriot = 40 mesh_pic_townsnow = 41 mesh_pic_vaegir = 42 mesh_pic_villageriot = 43 mesh_pic_sarranid_encounter = 44 mesh_pic_mort = 45 mesh_mp_score_a = 46 mesh_mp_score_b = 47 mesh_portrait_blend_out = 48 mesh_load_window = 49 mesh_checkbox_off = 50 mesh_checkbox_on = 51 mesh_white_plane = 52 mesh_white_dot = 53 mesh_player_dot = 54 mesh_flag_infantry = 55 mesh_flag_archers = 56 mesh_flag_cavalry = 57 mesh_inv_slot = 58 mesh_mp_ingame_menu = 59 mesh_mp_inventory_left = 60 mesh_mp_inventory_right = 61 mesh_mp_inventory_choose = 62 mesh_mp_inventory_slot_glove = 63 mesh_mp_inventory_slot_horse = 64 mesh_mp_inventory_slot_armor = 65 mesh_mp_inventory_slot_helmet = 66 mesh_mp_inventory_slot_boot = 67 mesh_mp_inventory_slot_empty = 68 mesh_mp_inventory_slot_equip = 69 mesh_mp_inventory_left_arrow = 70 mesh_mp_inventory_right_arrow = 71 mesh_mp_ui_host_main = 72 mesh_mp_ui_host_maps_1 = 73 mesh_mp_ui_host_maps_2 = 74 mesh_mp_ui_host_maps_3 = 75 mesh_mp_ui_host_maps_4 = 76 mesh_mp_ui_host_maps_5 = 77 mesh_mp_ui_host_maps_6 = 78 mesh_mp_ui_host_maps_7 = 79 mesh_mp_ui_host_maps_8 = 80 mesh_mp_ui_host_maps_9 = 81 mesh_mp_ui_host_maps_10 = 82 mesh_mp_ui_host_maps_11 = 83 mesh_mp_ui_host_maps_12 = 84 mesh_mp_ui_host_maps_13 = 85 mesh_mp_ui_host_maps_randomp = 86 mesh_mp_ui_host_maps_randoms = 87 mesh_mp_ui_command_panel = 88 mesh_mp_ui_command_border_l = 89 mesh_mp_ui_command_border_r = 90 mesh_mp_ui_welcome_panel = 91 mesh_flag_project_sw = 92 mesh_flag_project_vg = 93 mesh_flag_project_kh = 94 mesh_flag_project_nd = 95 mesh_flag_project_rh = 96 mesh_flag_project_sr = 97 mesh_flag_projects_end = 98 mesh_flag_project_sw_miss = 99 mesh_flag_project_vg_miss = 100 mesh_flag_project_kh_miss = 101 mesh_flag_project_nd_miss = 102 mesh_flag_project_rh_miss = 103 mesh_flag_project_sr_miss = 104 mesh_flag_project_misses_end = 105 mesh_color_picker = 106 mesh_custom_map_banner_01 = 107 mesh_custom_map_banner_02 = 108 mesh_custom_map_banner_03 = 109 mesh_custom_banner_01 = 110 mesh_custom_banner_02 = 111 mesh_custom_banner_bg = 112 mesh_custom_banner_fg01 = 113 mesh_custom_banner_fg02 = 114 mesh_custom_banner_fg03 = 115 mesh_custom_banner_fg04 = 116 mesh_custom_banner_fg05 = 117 mesh_custom_banner_fg06 = 118 mesh_custom_banner_fg07 = 119 mesh_custom_banner_fg08 = 120 mesh_custom_banner_fg09 = 121 mesh_custom_banner_fg10 = 122 mesh_custom_banner_fg11 = 123 mesh_custom_banner_fg12 = 124 mesh_custom_banner_fg13 = 125 mesh_custom_banner_fg14 = 126 mesh_custom_banner_fg15 = 127 mesh_custom_banner_fg16 = 128 mesh_custom_banner_fg17 = 129 mesh_custom_banner_fg18 = 130 mesh_custom_banner_fg19 = 131 mesh_custom_banner_fg20 = 132 mesh_custom_banner_fg21 = 133 mesh_custom_banner_fg22 = 134 mesh_custom_banner_fg23 = 135 mesh_custom_banner_charge_01 = 136 mesh_custom_banner_charge_02 = 137 mesh_custom_banner_charge_03 = 138 mesh_custom_banner_charge_04 = 139 mesh_custom_banner_charge_05 = 140 mesh_custom_banner_charge_06 = 141 mesh_custom_banner_charge_07 = 142 mesh_custom_banner_charge_08 = 143 mesh_custom_banner_charge_09 = 144 mesh_custom_banner_charge_10 = 145 mesh_custom_banner_charge_11 = 146 mesh_custom_banner_charge_12 = 147 mesh_custom_banner_charge_13 = 148 mesh_custom_banner_charge_14 = 149 mesh_custom_banner_charge_15 = 150 mesh_custom_banner_charge_16 = 151 mesh_custom_banner_charge_17 = 152 mesh_custom_banner_charge_18 = 153 mesh_custom_banner_charge_19 = 154 mesh_custom_banner_charge_20 = 155 mesh_custom_banner_charge_21 = 156 mesh_custom_banner_charge_22 = 157 mesh_custom_banner_charge_23 = 158 mesh_custom_banner_charge_24 = 159 mesh_custom_banner_charge_25 = 160 mesh_custom_banner_charge_26 = 161 mesh_custom_banner_charge_27 = 162 mesh_custom_banner_charge_28 = 163 mesh_custom_banner_charge_29 = 164 mesh_custom_banner_charge_30 = 165 mesh_custom_banner_charge_31 = 166 mesh_custom_banner_charge_32 = 167 mesh_custom_banner_charge_33 = 168 mesh_custom_banner_charge_34 = 169 mesh_custom_banner_charge_35 = 170 mesh_custom_banner_charge_36 = 171 mesh_custom_banner_charge_37 = 172 mesh_custom_banner_charge_38 = 173 mesh_custom_banner_charge_39 = 174 mesh_custom_banner_charge_40 = 175 mesh_custom_banner_charge_41 = 176 mesh_custom_banner_charge_42 = 177 mesh_custom_banner_charge_43 = 178 mesh_custom_banner_charge_44 = 179 mesh_custom_banner_charge_45 = 180 mesh_custom_banner_charge_46 = 181 mesh_tableau_mesh_custom_banner = 182 mesh_tableau_mesh_custom_banner_square = 183 mesh_tableau_mesh_custom_banner_tall = 184 mesh_tableau_mesh_custom_banner_short = 185 mesh_tableau_mesh_shield_round_1 = 186 mesh_tableau_mesh_shield_round_2 = 187 mesh_tableau_mesh_shield_round_3 = 188 mesh_tableau_mesh_shield_round_4 = 189 mesh_tableau_mesh_shield_round_5 = 190 mesh_tableau_mesh_shield_small_round_1 = 191 mesh_tableau_mesh_shield_small_round_2 = 192 mesh_tableau_mesh_shield_small_round_3 = 193 mesh_tableau_mesh_shield_kite_1 = 194 mesh_tableau_mesh_shield_kite_2 = 195 mesh_tableau_mesh_shield_kite_3 = 196 mesh_tableau_mesh_shield_kite_4 = 197 mesh_tableau_mesh_shield_heater_1 = 198 mesh_tableau_mesh_shield_heater_2 = 199 mesh_tableau_mesh_shield_pavise_1 = 200 mesh_tableau_mesh_shield_pavise_2 = 201 mesh_heraldic_armor_bg = 202 mesh_tableau_mesh_heraldic_armor_a = 203 mesh_tableau_mesh_heraldic_armor_b = 204 mesh_tableau_mesh_heraldic_armor_c = 205 mesh_tableau_mesh_heraldic_armor_d = 206 mesh_outer_terrain_plain_1 = 207 mesh_banner_a01 = 208 mesh_banner_a02 = 209 mesh_banner_a03 = 210 mesh_banner_a04 = 211 mesh_banner_a05 = 212 mesh_banner_a06 = 213 mesh_banner_a07 = 214 mesh_banner_a08 = 215 mesh_banner_a09 = 216 mesh_banner_a10 = 217 mesh_banner_a11 = 218 mesh_banner_a12 = 219 mesh_banner_a13 = 220 mesh_banner_a14 = 221 mesh_banner_a15 = 222 mesh_banner_a16 = 223 mesh_banner_a17 = 224 mesh_banner_a18 = 225 mesh_banner_a19 = 226 mesh_banner_a20 = 227 mesh_banner_a21 = 228 mesh_banner_b01 = 229 mesh_banner_b02 = 230 mesh_banner_b03 = 231 mesh_banner_b04 = 232 mesh_banner_b05 = 233 mesh_banner_b06 = 234 mesh_banner_b07 = 235 mesh_banner_b08 = 236 mesh_banner_b09 = 237 mesh_banner_b10 = 238 mesh_banner_b11 = 239 mesh_banner_b12 = 240 mesh_banner_b13 = 241 mesh_banner_b14 = 242 mesh_banner_b15 = 243 mesh_banner_b16 = 244 mesh_banner_b17 = 245 mesh_banner_b18 = 246 mesh_banner_b19 = 247 mesh_banner_b20 = 248 mesh_banner_b21 = 249 mesh_banner_c01 = 250 mesh_banner_c02 = 251 mesh_banner_c03 = 252 mesh_banner_c04 = 253 mesh_banner_c05 = 254 mesh_banner_c06 = 255 mesh_banner_c07 = 256 mesh_banner_c08 = 257 mesh_banner_c09 = 258 mesh_banner_c10 = 259 mesh_banner_c11 = 260 mesh_banner_c12 = 261 mesh_banner_c13 = 262 mesh_banner_c14 = 263 mesh_banner_c15 = 264 mesh_banner_c16 = 265 mesh_banner_c17 = 266 mesh_banner_c18 = 267 mesh_banner_c19 = 268 mesh_banner_c20 = 269 mesh_banner_c21 = 270 mesh_banner_d01 = 271 mesh_banner_d02 = 272 mesh_banner_d03 = 273 mesh_banner_d04 = 274 mesh_banner_d05 = 275 mesh_banner_d06 = 276 mesh_banner_d07 = 277 mesh_banner_d08 = 278 mesh_banner_d09 = 279 mesh_banner_d10 = 280 mesh_banner_d11 = 281 mesh_banner_d12 = 282 mesh_banner_d13 = 283 mesh_banner_d14 = 284 mesh_banner_d15 = 285 mesh_banner_d16 = 286 mesh_banner_d17 = 287 mesh_banner_d18 = 288 mesh_banner_d19 = 289 mesh_banner_d20 = 290 mesh_banner_d21 = 291 mesh_banner_e01 = 292 mesh_banner_e02 = 293 mesh_banner_e03 = 294 mesh_banner_e04 = 295 mesh_banner_e05 = 296 mesh_banner_e06 = 297 mesh_banner_e07 = 298 mesh_banner_e08 = 299 mesh_banner_e09 = 300 mesh_banner_e10 = 301 mesh_banner_e11 = 302 mesh_banner_e12 = 303 mesh_banner_e13 = 304 mesh_banner_e14 = 305 mesh_banner_e15 = 306 mesh_banner_e16 = 307 mesh_banner_e17 = 308 mesh_banner_e18 = 309 mesh_banner_e19 = 310 mesh_banner_e20 = 311 mesh_banner_e21 = 312 mesh_banner_f01 = 313 mesh_banner_f02 = 314 mesh_banner_f03 = 315 mesh_banner_f04 = 316 mesh_banner_f05 = 317 mesh_banner_f06 = 318 mesh_banner_f07 = 319 mesh_banner_f08 = 320 mesh_banner_f09 = 321 mesh_banner_f10 = 322 mesh_banner_f11 = 323 mesh_banner_f12 = 324 mesh_banner_f13 = 325 mesh_banner_f14 = 326 mesh_banner_f15 = 327 mesh_banner_f16 = 328 mesh_banner_f17 = 329 mesh_banner_f18 = 330 mesh_banner_f19 = 331 mesh_banner_f20 = 332 mesh_banner_h01 = 333 mesh_banner_h02 = 334 mesh_banner_h03 = 335 mesh_banner_h04 = 336 mesh_banner_h05 = 337 mesh_banner_h06 = 338 mesh_banner_h07 = 339 mesh_banner_h08 = 340 mesh_banner_h09 = 341 mesh_banner_h10 = 342 mesh_banner_h11 = 343 mesh_banner_h12 = 344 mesh_banner_h13 = 345 mesh_banner_h14 = 346 mesh_banner_h15 = 347 mesh_banner_h16 = 348 mesh_banner_h17 = 349 mesh_banner_h18 = 350 mesh_banner_h19 = 351 mesh_banner_h20 = 352 mesh_banner_h21 = 353 mesh_banner_i01 = 354 mesh_banner_i02 = 355 mesh_banner_i03 = 356 mesh_banner_i04 = 357 mesh_banner_i05 = 358 mesh_banner_i06 = 359 mesh_banner_i07 = 360 mesh_banner_i08 = 361 mesh_banner_i09 = 362 mesh_banner_i10 = 363 mesh_banner_i11 = 364 mesh_banner_i12 = 365 mesh_banner_i13 = 366 mesh_banner_i14 = 367 mesh_banner_i15 = 368 mesh_banner_i16 = 369 mesh_banner_i17 = 370 mesh_banner_i18 = 371 mesh_banner_i19 = 372 mesh_banner_i20 = 373 mesh_banner_i21 = 374 mesh_banner_k01 = 375 mesh_banner_k02 = 376 mesh_banner_k03 = 377 mesh_banner_k04 = 378 mesh_banner_k05 = 379 mesh_banner_k06 = 380 mesh_banner_k07 = 381 mesh_banner_k08 = 382 mesh_banner_k09 = 383 mesh_banner_k10 = 384 mesh_banner_k11 = 385 mesh_banner_k12 = 386 mesh_banner_k13 = 387 mesh_banner_k14 = 388 mesh_banner_k15 = 389 mesh_banner_k16 = 390 mesh_banner_k17 = 391 mesh_banner_k18 = 392 mesh_banner_k19 = 393 mesh_banner_k20 = 394 mesh_banner_g01 = 395 mesh_banner_g02 = 396 mesh_banner_g03 = 397 mesh_banner_g04 = 398 mesh_banner_g05 = 399 mesh_banner_g06 = 400 mesh_banner_g07 = 401 mesh_banner_g08 = 402 mesh_banner_g09 = 403 mesh_banner_g10 = 404 mesh_banner_kingdom_a = 405 mesh_banner_kingdom_b = 406 mesh_banner_kingdom_c = 407 mesh_banner_kingdom_d = 408 mesh_banner_kingdom_e = 409 mesh_banner_kingdom_f = 410 mesh_banner_kingdom_g = 411 mesh_banner_kingdom_h = 412 mesh_banner_kingdom_i = 413 mesh_banner_kingdom_j = 414 mesh_banner_kingdom_k = 415 mesh_banner_kingdom_l = 416 mesh_banner_kingdom_ll = 417 mesh_banner_kingdom_m = 418 mesh_banner_kingdom_n = 419 mesh_banner_kingdom_o = 420 mesh_banner_kingdom_p = 421 mesh_banner_kingdom_q = 422 mesh_banner_kingdom_r = 423 mesh_banner_kingdom_s = 424 mesh_banner_kingdom_t = 425 mesh_banner_kingdom_u = 426 mesh_banner_kingdom_v = 427 mesh_banner_kingdom_w = 428 mesh_banner_kingdom_x = 429 mesh_banner_kingdom_y = 430 mesh_banner_kingdom_z = 431 mesh_banner_kingdom_2a = 432 mesh_banner_kingdom_2b = 433 mesh_banner_kingdom_2c = 434 mesh_banner_kingdom_2d = 435 mesh_banner_k21 = 436 mesh_arms_a01 = 437 mesh_arms_a02 = 438 mesh_arms_a03 = 439 mesh_arms_a04 = 440 mesh_arms_a05 = 441 mesh_arms_a06 = 442 mesh_arms_a07 = 443 mesh_arms_a08 = 444 mesh_arms_a09 = 445 mesh_arms_a10 = 446 mesh_arms_a11 = 447 mesh_arms_a12 = 448 mesh_arms_a13 = 449 mesh_arms_a14 = 450 mesh_arms_a15 = 451 mesh_arms_a16 = 452 mesh_arms_a17 = 453 mesh_arms_a18 = 454 mesh_arms_a19 = 455 mesh_arms_a20 = 456 mesh_arms_a21 = 457 mesh_arms_b01 = 458 mesh_arms_b02 = 459 mesh_arms_b03 = 460 mesh_arms_b04 = 461 mesh_arms_b05 = 462 mesh_arms_b06 = 463 mesh_arms_b07 = 464 mesh_arms_b08 = 465 mesh_arms_b09 = 466 mesh_arms_b10 = 467 mesh_arms_b11 = 468 mesh_arms_b12 = 469 mesh_arms_b13 = 470 mesh_arms_b14 = 471 mesh_arms_b15 = 472 mesh_arms_b16 = 473 mesh_arms_b17 = 474 mesh_arms_b18 = 475 mesh_arms_b19 = 476 mesh_arms_b20 = 477 mesh_arms_b21 = 478 mesh_arms_c01 = 479 mesh_arms_c02 = 480 mesh_arms_c03 = 481 mesh_arms_c04 = 482 mesh_arms_c05 = 483 mesh_arms_c06 = 484 mesh_arms_c07 = 485 mesh_arms_c08 = 486 mesh_arms_c09 = 487 mesh_arms_c10 = 488 mesh_arms_c11 = 489 mesh_arms_c12 = 490 mesh_arms_c13 = 491 mesh_arms_c14 = 492 mesh_arms_c15 = 493 mesh_arms_c16 = 494 mesh_arms_c17 = 495 mesh_arms_c18 = 496 mesh_arms_c19 = 497 mesh_arms_c20 = 498 mesh_arms_c21 = 499 mesh_arms_d01 = 500 mesh_arms_d02 = 501 mesh_arms_d03 = 502 mesh_arms_d04 = 503 mesh_arms_d05 = 504 mesh_arms_d06 = 505 mesh_arms_d07 = 506 mesh_arms_d08 = 507 mesh_arms_d09 = 508 mesh_arms_d10 = 509 mesh_arms_d11 = 510 mesh_arms_d12 = 511 mesh_arms_d13 = 512 mesh_arms_d14 = 513 mesh_arms_d15 = 514 mesh_arms_d16 = 515 mesh_arms_d17 = 516 mesh_arms_d18 = 517 mesh_arms_d19 = 518 mesh_arms_d20 = 519 mesh_arms_d21 = 520 mesh_arms_e01 = 521 mesh_arms_e02 = 522 mesh_arms_e03 = 523 mesh_arms_e04 = 524 mesh_arms_e05 = 525 mesh_arms_e06 = 526 mesh_arms_e07 = 527 mesh_arms_e08 = 528 mesh_arms_e09 = 529 mesh_arms_e10 = 530 mesh_arms_e11 = 531 mesh_arms_e12 = 532 mesh_arms_e13 = 533 mesh_arms_e14 = 534 mesh_arms_e15 = 535 mesh_arms_e16 = 536 mesh_arms_e17 = 537 mesh_arms_e18 = 538 mesh_arms_e19 = 539 mesh_arms_e20 = 540 mesh_arms_e21 = 541 mesh_arms_f01 = 542 mesh_arms_f02 = 543 mesh_arms_f03 = 544 mesh_arms_f04 = 545 mesh_arms_f05 = 546 mesh_arms_f06 = 547 mesh_arms_f07 = 548 mesh_arms_f08 = 549 mesh_arms_f09 = 550 mesh_arms_f10 = 551 mesh_arms_f11 = 552 mesh_arms_f12 = 553 mesh_arms_f13 = 554 mesh_arms_f14 = 555 mesh_arms_f15 = 556 mesh_arms_f16 = 557 mesh_arms_f17 = 558 mesh_arms_f18 = 559 mesh_arms_f19 = 560 mesh_arms_f20 = 561 mesh_arms_h01 = 562 mesh_arms_h02 = 563 mesh_arms_h03 = 564 mesh_arms_h04 = 565 mesh_arms_h05 = 566 mesh_arms_h06 = 567 mesh_arms_h07 = 568 mesh_arms_h08 = 569 mesh_arms_h09 = 570 mesh_arms_h10 = 571 mesh_arms_h11 = 572 mesh_arms_h12 = 573 mesh_arms_h13 = 574 mesh_arms_h14 = 575 mesh_arms_h15 = 576 mesh_arms_h16 = 577 mesh_arms_h17 = 578 mesh_arms_h18 = 579 mesh_arms_h19 = 580 mesh_arms_h20 = 581 mesh_arms_h21 = 582 mesh_arms_i01 = 583 mesh_arms_i02 = 584 mesh_arms_i03 = 585 mesh_arms_i04 = 586 mesh_arms_i05 = 587 mesh_arms_i06 = 588 mesh_arms_i07 = 589 mesh_arms_i08 = 590 mesh_arms_i09 = 591 mesh_arms_i10 = 592 mesh_arms_i11 = 593 mesh_arms_i12 = 594 mesh_arms_i13 = 595 mesh_arms_i14 = 596 mesh_arms_i15 = 597 mesh_arms_i16 = 598 mesh_arms_i17 = 599 mesh_arms_i18 = 600 mesh_arms_i19 = 601 mesh_arms_i20 = 602 mesh_arms_i21 = 603 mesh_arms_k01 = 604 mesh_arms_k02 = 605 mesh_arms_k03 = 606 mesh_arms_k04 = 607 mesh_arms_k05 = 608 mesh_arms_k06 = 609 mesh_arms_k07 = 610 mesh_arms_k08 = 611 mesh_arms_k09 = 612 mesh_arms_k10 = 613 mesh_arms_k11 = 614 mesh_arms_k12 = 615 mesh_arms_k13 = 616 mesh_arms_k14 = 617 mesh_arms_k15 = 618 mesh_arms_k16 = 619 mesh_arms_k17 = 620 mesh_arms_k18 = 621 mesh_arms_k19 = 622 mesh_arms_k20 = 623 mesh_arms_g01 = 624 mesh_arms_g02 = 625 mesh_arms_g03 = 626 mesh_arms_g04 = 627 mesh_arms_g05 = 628 mesh_arms_g06 = 629 mesh_arms_g07 = 630 mesh_arms_g08 = 631 mesh_arms_g09 = 632 mesh_arms_g10 = 633 mesh_arms_kingdom_a = 634 mesh_arms_kingdom_b = 635 mesh_arms_kingdom_c = 636 mesh_arms_kingdom_d = 637 mesh_arms_kingdom_e = 638 mesh_arms_kingdom_f = 639 mesh_arms_kingdom_g = 640 mesh_arms_kingdom_h = 641 mesh_arms_kingdom_i = 642 mesh_arms_kingdom_j = 643 mesh_arms_kingdom_k = 644 mesh_arms_kingdom_l = 645 mesh_arms_kingdom_ll = 646 mesh_arms_kingdom_m = 647 mesh_arms_kingdom_n = 648 mesh_arms_kingdom_o = 649 mesh_arms_kingdom_p = 650 mesh_arms_kingdom_q = 651 mesh_arms_kingdom_r = 652 mesh_arms_kingdom_s = 653 mesh_arms_kingdom_t = 654 mesh_arms_kingdom_u = 655 mesh_arms_kingdom_v = 656 mesh_arms_kingdom_w = 657 mesh_arms_kingdom_x = 658 mesh_arms_kingdom_y = 659 mesh_arms_kingdom_z = 660 mesh_arms_kingdom_2a = 661 mesh_arms_kingdom_2b = 662 mesh_arms_kingdom_2c = 663 mesh_arms_kingdom_2d = 664 mesh_arms_k21 = 665 mesh_banners_default_a = 666 mesh_banners_default_b = 667 mesh_banners_default_c = 668 mesh_banners_default_d = 669 mesh_banners_default_e = 670 mesh_troop_label_banner = 671 mesh_ui_kingdom_shield_1 = 672 mesh_ui_kingdom_shield_2 = 673 mesh_ui_kingdom_shield_3 = 674 mesh_ui_kingdom_shield_4 = 675 mesh_ui_kingdom_shield_5 = 676 mesh_ui_kingdom_shield_6 = 677 mesh_ui_kingdom_shield_7 = 678 mesh_ui_kingdom_shield_8 = 679 mesh_ui_kingdom_shield_9 = 680 mesh_ui_kingdom_shield_10 = 681 mesh_ui_kingdom_shield_11 = 682 mesh_ui_kingdom_shield_12 = 683 mesh_ui_kingdom_shield_13 = 684 mesh_ui_kingdom_shield_14 = 685 mesh_ui_kingdom_shield_15 = 686 mesh_ui_kingdom_shield_16 = 687 mesh_ui_kingdom_shield_17 = 688 mesh_ui_kingdom_shield_18 = 689 mesh_ui_kingdom_shield_19 = 690 mesh_ui_kingdom_shield_20 = 691 mesh_ui_kingdom_shield_21 = 692 mesh_ui_kingdom_shield_22 = 693 mesh_ui_kingdom_shield_23 = 694 mesh_ui_kingdom_shield_24 = 695 mesh_ui_kingdom_shield_25 = 696 mesh_ui_kingdom_shield_26 = 697 mesh_ui_kingdom_shield_27 = 698 mesh_ui_kingdom_shield_28 = 699 mesh_ui_kingdom_shield_29 = 700 mesh_ui_kingdom_shield_30 = 701 mesh_ui_kingdom_shield_31 = 702 mesh_mouse_arrow_down = 703 mesh_mouse_arrow_right = 704 mesh_mouse_arrow_left = 705 mesh_mouse_arrow_up = 706 mesh_mouse_arrow_plus = 707 mesh_mouse_left_click = 708 mesh_mouse_right_click = 709 mesh_status_ammo_ready = 710 mesh_main_menu_background = 711 mesh_loading_background = 712 mesh_ui_quick_battle_a = 713 mesh_white_bg_plane_a = 714 mesh_cb_ui_icon_infantry = 715 mesh_cb_ui_icon_archer = 716 mesh_cb_ui_icon_horseman = 717 mesh_cb_ui_main = 718 mesh_cb_ui_maps_scene_01 = 719 mesh_cb_ui_maps_scene_02 = 720 mesh_cb_ui_maps_scene_03 = 721 mesh_cb_ui_maps_scene_04 = 722 mesh_cb_ui_maps_scene_05 = 723 mesh_cb_ui_maps_scene_06 = 724 mesh_cb_ui_maps_scene_07 = 725 mesh_cb_ui_maps_scene_08 = 726 mesh_cb_ui_maps_scene_09 = 727 mesh_mp_ui_host_maps_14 = 728 mesh_mp_ui_host_maps_15 = 729 mesh_ui_kingdom_shield_7 = 730 mesh_flag_project_rb = 731 mesh_flag_project_rb_miss = 732 mesh_mp_ui_host_maps_16 = 733 mesh_mp_ui_host_maps_17 = 734 mesh_mp_ui_host_maps_18 = 735 mesh_mp_ui_host_maps_19 = 736 mesh_mp_ui_host_maps_20 = 737 mesh_pic_mb_warrior_2 = 738 mesh_pic_mb_warrior_3 = 739 mesh_pic_mb_warrior_4 = 740 mesh_pic_mercenary = 741 mesh_facegen_board = 742 mesh_status_background = 743 mesh_status_health_bar = 744 mesh_game_log_window = 745 mesh_restore_game_panel = 746 mesh_message_window = 747 mesh_party_window_b = 748 mesh_party_member_button = 749 mesh_party_member_button_pressed = 750 mesh_longer_button = 751 mesh_longer_button_down = 752 mesh_button_1 = 753 mesh_button_1_down = 754 mesh_used_button = 755 mesh_used_button_down = 756 mesh_longer_button = 757 mesh_longer_button_down = 758 mesh_options_window = 759 mesh_message_window = 760 mesh_note_window = 761 mesh_left_button = 762 mesh_left_button_down = 763 mesh_left_button_hl = 764 mesh_right_button = 765 mesh_right_button_down = 766 mesh_right_button_hl = 767 mesh_center_button = 768 mesh_drop_button = 769 mesh_drop_button_down = 770 mesh_drop_button_hl = 771 mesh_drop_button_child = 772 mesh_drop_button_child_down = 773 mesh_drop_button_child_hl = 774 mesh_num_1 = 775 mesh_num_2 = 776 mesh_num_3 = 777 mesh_num_4 = 778 mesh_num_5 = 779 mesh_num_6 = 780 mesh_num_7 = 781 mesh_num_8 = 782 mesh_num_9 = 783 mesh_num_10 = 784 mesh_num_11 = 785 mesh_num_12 = 786 mesh_num_13 = 787 mesh_num_14 = 788 mesh_num_15 = 789 mesh_num_16 = 790 mesh_num_17 = 791 mesh_num_18 = 792 mesh_num_19 = 793 mesh_num_20 = 794 mesh_num_21 = 795 mesh_num_22 = 796 mesh_num_23 = 797 mesh_num_24 = 798 mesh_num_25 = 799 mesh_num_26 = 800 mesh_num_27 = 801 mesh_num_28 = 802 mesh_num_29 = 803 mesh_num_30 = 804 mesh_num_31 = 805 mesh_num_32 = 806 mesh_num_33 = 807 mesh_num_34 = 808 mesh_num_35 = 809 mesh_num_36 = 810 mesh_num_37 = 811 mesh_num_38 = 812 mesh_num_39 = 813 mesh_num_40 = 814 mesh_num_41 = 815 mesh_num_42 = 816 mesh_num_43 = 817 mesh_num_44 = 818 mesh_num_45 = 819 mesh_num_46 = 820 mesh_num_47 = 821 mesh_num_48 = 822 mesh_message_window = 823 mesh_face_gen_window = 824 mesh_order_frame = 825 mesh_tableau_mesh_early_transitional_heraldic_banner = 826 mesh_tableau_mesh_early_transitional_heraldic = 827 mesh_tableau_mesh_samurai_heraldic_flag = 828 mesh_tableau_mesh_banner_spear = 829 mesh_invisi_st_plane_fullsc = 830 mesh_bt_flag_1 = 831 mesh_bt_flag_2 = 832 mesh_bt_flag_3 = 833 mesh_pic_bt_crossbow = 834 mesh_pic_bt_shield = 835 mesh_pic_bt_horse_archer = 836 mesh_pic_bt_twohand = 837 mesh_pic_bt_bow = 838 mesh_pic_bt_horse = 839 mesh_pic_bt_musket = 840 mesh_pic_bt_leader = 841 mesh_bt_cion_tier1 = 842 mesh_bt_cion_tier2 = 843 mesh_bt_cion_tier3 = 844 mesh_bt_cion_tier4 = 845 mesh_bt_cion_tier5 = 846 mesh_bt_cion_tier6 = 847 mesh_pic_bt_charge_auto = 848 mesh_pic_bt_hold = 849 mesh_pic_bt_followme = 850 mesh_pic_bt_unite = 851 mesh_pic_bt_divide = 852 mesh_pic_bt_advan = 853 mesh_pic_bt_fall = 854 mesh_pic_bt_holdfire = 855 mesh_pic_bt_anyw = 856 mesh_pic_bt_clicked = 857 mesh_pic_bt_return = 858 mesh_pic_camp_meet = 859 mesh_pic_meetlady = 860 mesh_pic_meetlady2 = 861 mesh_pic_meetlady3 = 862 mesh_1pic_ruin_0 = 863 mesh_1pic_ruin_1 = 864 mesh_1pic_ruin_2 = 865 mesh_1pic_ruin_3 = 866 mesh_1pic_ruin_4 = 867 mesh_1pic_ruin_5 = 868 mesh_1pic_ruin_6 = 869 mesh_1pic_ruin_7 = 870 mesh_1pic_ruin_8 = 871 mesh_1pic_ruin_9 = 872 mesh_1pic_ruin_10 = 873 mesh_1pic_ruin_11 = 874 mesh_1pic_ruin_12 = 875 mesh_1pic_ruin_13 = 876 mesh_1pic_ruin_14 = 877 mesh_1pic_ruin_15 = 878 mesh_1pic_ruin_16 = 879 mesh_1pic_ruin_17 = 880 mesh_1pic_ruin_18 = 881 mesh_1pic_ruin_19 = 882 mesh_1pic_ruin_20 = 883 mesh_1pic_ruin_21 = 884 mesh_1pic_ruin_22 = 885 mesh_1pic_ruin_23 = 886 mesh_1pic_ruin_24 = 887 mesh_1pic_ruin_25 = 888 mesh_1pic_ruin_26 = 889 mesh_1pic_ruin_27 = 890 mesh_1pic_ruin_28 = 891 mesh_1pic_ruin_29 = 892 mesh_1pic_ruin_30 = 893 mesh_1pic_ruin_31 = 894 mesh_1pic_ruin_32 = 895 mesh_1pic_ruin_33 = 896 mesh_1pic_ruin_34 = 897 mesh_1pic_ruin_35 = 898 mesh_1pic_ruin_36 = 899 mesh_1pic_ruin_37 = 900 mesh_1pic_ruin_38 = 901 mesh_1pic_ruin_39 = 902 mesh_1pic_ruin_40 = 903 mesh_1pic_ruin_41 = 904 mesh_1pic_ruin_42 = 905 mesh_1pic_ruin_43 = 906 mesh_1pic_ruin_44 = 907 mesh_1pic_ruin_45 = 908 mesh_1pic_ruin_46 = 909 mesh_1pic_ruin_47 = 910 mesh_1pic_ruin_48 = 911 mesh_1pic_ruin_49 = 912 mesh_1pic_ruin_50 = 913 mesh_1pic_ruin_51 = 914 mesh_1pic_ruin_52 = 915 mesh_1pic_ruin_53 = 916 mesh_1pic_ruin_54 = 917 mesh_1pic_ruin_55 = 918 mesh_1pic_ruin_56 = 919 mesh_1pic_ruin_57 = 920 mesh_1pic_ruin_58 = 921 mesh_1pic_ruin_59 = 922 mesh_1pic_ruin_60 = 923 mesh_1pic_ruin_61 = 924 mesh_1pic_ruin_62 = 925 mesh_1pic_ruin_63 = 926 mesh_1pic_ruin_64 = 927 mesh_1pic_ruin_65 = 928 mesh_1pic_ruin_66 = 929 mesh_1pic_ruin_67 = 930 mesh_1pic_ruin_68 = 931 mesh_1pic_ruin_69 = 932 mesh_1pic_ruin_70 = 933 mesh_1pic_ruin_71 = 934 mesh_1pic_ruin_72 = 935 mesh_1pic_ruin_73 = 936 mesh_1pic_ruin_74 = 937 mesh_1pic_ruin_75 = 938 mesh_1pic_ruin_76 = 939 mesh_1pic_ruin_77 = 940 mesh_1pic_ruin_78 = 941 mesh_1pic_ruin_79 = 942 mesh_1pic_ruin_80 = 943 mesh_1pic_ruin_81 = 944 mesh_1pic_ruin_82 = 945 mesh_1pic_ruin_83 = 946 mesh_1pic_ruin_84 = 947 mesh_1pic_ruin_85 = 948 mesh_1pic_ruin_86 = 949 mesh_1pic_ruin_87 = 950 mesh_1pic_ruin_88 = 951 mesh_1pic_ruin_89 = 952 mesh_1pic_ruin_90 = 953 mesh_1pic_ruin_91 = 954 mesh_1pic_ruin_92 = 955 mesh_1pic_ruin_93 = 956 mesh_1pic_ruin_94 = 957 mesh_1pic_ruin_95 = 958 mesh_1pic_ruin_96 = 959 mesh_1pic_ruin_97 = 960 mesh_1pic_ruin_98 = 961 mesh_1pic_ruin_99 = 962 mesh_1pic_ruin_100 = 963 mesh_1pic_ruin_101 = 964 mesh_1pic_ruin_102 = 965 mesh_1pic_ruin_103 = 966 mesh_1pic_ruin_104 = 967 mesh_1pic_ruin_105 = 968 mesh_1pic_ruin_106 = 969 mesh_1pic_ruin_107 = 970 mesh_1pic_ruin_108 = 971 mesh_1pic_ruin_109 = 972 mesh_1pic_ruin_110 = 973 mesh_1pic_ruin_111 = 974 mesh_1pic_ruin_112 = 975 mesh_1pic_ruin_113 = 976 mesh_1pic_ruin_114 = 977 mesh_1pic_ruin_115 = 978 mesh_1pic_ruin_116 = 979 mesh_1pic_ruin_117 = 980 mesh_1pic_ruin_118 = 981 mesh_1pic_ruin_119 = 982 mesh_1pic_ruin_120 = 983 mesh_1pic_ruin_121 = 984 mesh_1pic_ruin_122 = 985 mesh_1pic_ruin_123 = 986 mesh_1pic_ruin_124 = 987 mesh_1pic_ruin_125 = 988 mesh_1pic_ruin_126 = 989 mesh_1pic_ruin_127 = 990 mesh_1pic_ruin_128 = 991 mesh_1pic_ruin_129 = 992 mesh_1pic_ruin_130 = 993 mesh_1pic_ruin_131 = 994 mesh_1pic_ruin_132 = 995 mesh_1pic_ruin_133 = 996 mesh_1pic_ruin_134 = 997 mesh_1pic_ruin_135 = 998 mesh_1pic_ruin_136 = 999 mesh_1pic_ruin_137 = 1000 mesh_1pic_ruin_138 = 1001 mesh_1pic_ruin_139 = 1002 mesh_1pic_ruin_140 = 1003 mesh_1pic_ruin_141 = 1004 mesh_1pic_ruin_142 = 1005 mesh_1pic_ruin_143 = 1006 mesh_1pic_ruin_144 = 1007 mesh_1pic_ruin_145 = 1008 mesh_1pic_ruin_146 = 1009 mesh_1pic_ruin_ex1 = 1010 mesh_1pic_ruin_ex2 = 1011 mesh_1pic_ruin_ex3 = 1012 mesh_1pic_ruin_ex4 = 1013 mesh_1pic_ruin_ex5 = 1014 mesh_1pic_ruin_ex6 = 1015 mesh_1pic_ruin_ex7 = 1016 mesh_1pic_ruin_ex8 = 1017 mesh_1pic_ruin_ex9 = 1018 mesh_1pic_ruin_ex10 = 1019 mesh_1pic_ruin_ex11 = 1020 mesh_1pic_ruin_ex12 = 1021 mesh_1pic_ruin_ex13 = 1022 mesh_1pic_ruin_ex14 = 1023 mesh_1pic_ruin_ex15 = 1024 mesh_1pic_ruin_ex16 = 1025 mesh_1pic_ruin_ex17 = 1026 mesh_1pic_ruin_ex18 = 1027 mesh_1pic_ruin_ex19 = 1028 mesh_1pic_ruin_ex20 = 1029 mesh_1pic_ruin_ex21 = 1030 mesh_1pic_ruin_ex22 = 1031 mesh_1pic_ruin_ex23 = 1032 mesh_1pic_ruin_ex24 = 1033 mesh_1pic_ruin_ex25 = 1034 mesh_pic_encounter1 = 1035 mesh_pic_encounter2 = 1036 mesh_pic_encounter3 = 1037 mesh_pic_xex8 = 1038 mesh_pic_xex9 = 1039 mesh_pic_xex10 = 1040 mesh_pic_xex11 = 1041 mesh_pic_xex12 = 1042 mesh_pic_xex13 = 1043 mesh_pic_xex14 = 1044 mesh_st_tercio = 1045 mesh_st_pincer_movement = 1046 mesh_encounter4vik = 1047 mesh_encounter5pirate = 1048 mesh_pic_ship_shipyard = 1049 mesh_st_pic_plain = 1050 mesh_st_pic_desert = 1051 mesh_st_pic_mount = 1052 mesh_st_pic_snow = 1053 mesh_st_pic_sea = 1054 mesh_st_lancecharge = 1055 mesh_st_ccccharge = 1056 mesh_st_viking = 1057 mesh_black_st_plane = 1058 mesh_invisi_st_plane = 1059 mesh_pic_invisi_backgrounds = 1060 mesh_pic_policy_choose_prt = 1061 mesh_pic_policy_choose_prt_bk = 1062 mesh_pic_religion_screenn = 1063 mesh_pic_gbt_punch = 1064 mesh_pic_gbt_lick = 1065 mesh_pic_gbt_finger = 1066 mesh_pic_gbt_love = 1067 mesh_pic_gbt_place = 1068 mesh_pic_gbt_bed_sheet = 1069 mesh_pic_money_bag = 1070 mesh_pic_sea_backg = 1071 mesh_tableau_mesh_flag = 1072 mesh_pic_backg_inv = 1073 mesh_pic_library = 1074 mesh_pic_fuck_back = 1075 mesh_pic_ghost_ship_encount = 1076 mesh_pic_visit_train = 1077 mesh_pic_weknow = 1078 mesh_pic_bank_back = 1079 mesh_pic_wm_blank = 1080 mesh_pic_wm_horse = 1081 mesh_pic_wm_finewood = 1082 mesh_pic_wm_iron = 1083 mesh_pic_wm_elephant = 1084 mesh_pic_wm_whale = 1085 mesh_pic_wm_fish = 1086 mesh_pic_wm_maize = 1087 mesh_pic_wm_copper = 1088 mesh_pic_wm_marble = 1089 mesh_pic_wm_pearl = 1090 mesh_pic_wm_gem = 1091 mesh_pic_wm_ceramic = 1092 mesh_pic_wm_gold = 1093 mesh_pic_wm_silver = 1094 mesh_pic_wm_ivory = 1095 mesh_pic_wm_coffee = 1096 mesh_pic_wm_cacao = 1097 mesh_pic_wm_silk = 1098 mesh_pic_wm_nutmeg = 1099 mesh_pic_wm_allspice = 1100 mesh_pic_wm_cinnamon = 1101 mesh_pic_wm_clove = 1102 mesh_pic_wm_pepper = 1103 mesh_pic_wm_tabaco = 1104 mesh_pic_wm_tea = 1105 mesh_pic_marry = 1106 mesh_pic_religion_symbol_0 = 1107 mesh_pic_religion_symbol_1 = 1108 mesh_pic_religion_symbol_2 = 1109 mesh_pic_religion_symbol_3 = 1110 mesh_pic_religion_symbol_4 = 1111 mesh_pic_religion_symbol_5 = 1112 mesh_pic_religion_symbol_6 = 1113 mesh_pic_religion_symbol_7 = 1114 mesh_pic_religion_symbol_8 = 1115 mesh_pic_religion_symbol_9 = 1116 mesh_pic_religion_symbol_10 = 1117 mesh_pic_religion_symbol_11 = 1118 mesh_pic_religion_symbol_12 = 1119 mesh_pic_religion_symbol_13 = 1120 mesh_pic_religion_symbol_14 = 1121 mesh_pic_religion_symbol_15 = 1122 mesh_pic_religion_symbol_16 = 1123 mesh_pic_disaster_volcano = 1124 mesh_pic_disaster_earthquake = 1125 mesh_pic_disaster_storm = 1126 mesh_pic_disaster_typhoon = 1127 mesh_pic_disaster_fire = 1128 mesh_pic_disaster_sand = 1129 mesh_pic_disaster_tides = 1130 mesh_pic_disaster_ice = 1131 mesh_pic_disaster_flood = 1132 mesh_flag_div_1 = 1133 mesh_flag_div_2 = 1134 mesh_flag_div_3 = 1135 mesh_flag_div_4 = 1136 mesh_flag_div_5 = 1137 mesh_flag_div_6 = 1138 mesh_flag_div_7 = 1139 mesh_flag_div_8 = 1140 mesh_flag_div_9 = 1141 mesh_pic_battle_tile_2 = 1142 mesh_pic_battle_tile_3 = 1143 mesh_pic_battle_tile_4 = 1144 mesh_pic_battle_tile_5 = 1145 mesh_pic_battle_tile_6 = 1146 mesh_pic_battle_tile_7 = 1147 mesh_pic_battle_tile_8 = 1148 mesh_pic_battle_tile_9 = 1149 mesh_pic_battle_tile_10 = 1150 mesh_pic_battle_tile_11 = 1151 mesh_pic_battle_tile_s1 = 1152 mesh_pic_battle_tile_s2 = 1153 mesh_pic_battle_tile_s3 = 1154 mesh_pic_battle_tile_s4 = 1155 mesh_pic_battle_tile_n1 = 1156 mesh_pic_gameover = 1157 mesh_pic_cla_mercernary = 1158 mesh_pic_cla_merchant = 1159 mesh_pic_cla_adventurer = 1160 mesh_pic_cla_lord = 1161 mesh_pic_cla_bandit = 1162 mesh_pic_cla_pirate = 1163 mesh_pic_ptown_euro = 1164 mesh_pic_ptown_snow = 1165 mesh_pic_ptown_roman = 1166 mesh_pic_ptown_arab = 1167 mesh_pic_ptown_wooden = 1168 mesh_pic_ptown_asia = 1169 mesh_pic_ptown_asia_2 = 1170 mesh_pic_ptown_jap = 1171 mesh_pic_ptown_uurt = 1172 mesh_pic_ptown_teepee = 1173 mesh_pic_meetlady4 = 1174 mesh_pic_battle_formation_backriver = 1175 mesh_pic_battle_formation_sideattack = 1176 mesh_pic_battle_formation_backattack = 1177 mesh_pic_battle_formation_8door = 1178 mesh_pic_battle_formation_encampment = 1179 mesh_pic_battle_formation_lionheart = 1180 mesh_pic_battle_formation_mangudai = 1181 mesh_pic_battle_formation_pincer = 1182 mesh_pic_battle_formation_base = 1183 mesh_OrteliusWorldMap1570 = 1184 mesh_pic_portrait_yoritomo = 1185 mesh_pic_portrait_munemori = 1186 mesh_pic_portrait_xiaozong = 1187 mesh_pic_portrait_shizong = 1188 mesh_pic_portrait_genghiskhan = 1189 mesh_pic_portrait_philip_ii = 1190 mesh_pic_portrait_richard_i = 1191 mesh_pic_portrait_barbarossa = 1192 mesh_pic_portrait_alfonso_viii = 1193 mesh_pic_portrait_yaqub = 1194 mesh_pic_portrait_baldwin = 1195 mesh_pic_portrait_saladin = 1196 mesh_pic_portrait_tekish = 1197 mesh_pic_portrait_ghiyath = 1198 mesh_pic_portrait_akbar = 1199 mesh_pic_portrait_ivan = 1200 mesh_pic_portrait_frederick_ii = 1201 mesh_pic_portrait_maxi = 1202 mesh_pic_portrait_john_iii = 1203 mesh_pic_portrait_selimii = 1204 mesh_pic_portrait_stephen = 1205 mesh_pic_portrait_elizabeth = 1206 mesh_pic_portrait_philip = 1207 mesh_pic_portrait_sebastian = 1208 mesh_pic_portrait_william = 1209 mesh_pic_portrait_wanli = 1210 mesh_pic_portrait_oda = 1211 mesh_town_t_plain = 1212 mesh_town_t_water = 1213 mesh_town_t_hill = 1214 mesh_town_t_desert = 1215 mesh_town_t_snow = 1216 mesh_town_t_mountain = 1217 mesh_town_t_mil = 1218 mesh_town_t_ore = 1219 mesh_town_t_horse = 1220 mesh_town_t_holy = 1221 mesh_town_t_pasture = 1222 mesh_town_t_mine = 1223 mesh_town_t_market = 1224 mesh_town_t_barrack = 1225 mesh_town_t_farm = 1226 mesh_town_t_hall = 1227 mesh_town_t_prison = 1228 mesh_town_t_library = 1229 mesh_town_t_temple = 1230 mesh_town_t_smithy = 1231 mesh_white_plane_upper = 1232 mesh_white_plane_center = 1233 mesh_town_e_onehand = 1234 mesh_town_e_twohand = 1235 mesh_town_e_polearm = 1236 mesh_town_e_bow = 1237 mesh_town_e_crossbow = 1238 mesh_town_e_arquebus = 1239 mesh_town_e_ammo = 1240 mesh_town_e_light = 1241 mesh_town_e_heavy = 1242 mesh_town_e_horse = 1243 mesh_town_e_siege = 1244 mesh_town_e_wood = 1245 mesh_town_e_shipammo = 1246 mesh_town_d_onehand = 1247 mesh_town_d_twohand = 1248 mesh_town_d_polearm = 1249 mesh_town_d_bow = 1250 mesh_town_d_crossbow = 1251 mesh_town_d_arquebus = 1252 mesh_town_d_ammo = 1253 mesh_town_d_light = 1254 mesh_town_d_heavy = 1255 mesh_town_d_horse = 1256 mesh_town_d_siege = 1257 mesh_town_d_wood = 1258 mesh_town_d_shipammo = 1259 mesh_status_troop_ratio_bar = 1260 mesh_status_troop_ratio_bar_button = 1261
[ 76, 5069, 62, 16564, 62, 3903, 896, 796, 657, 198, 76, 5069, 62, 16564, 62, 2022, 62, 5767, 7701, 62, 16, 796, 352, 198, 76, 5069, 62, 16564, 62, 37348, 6540, 796, 362, 198, 76, 5069, 62, 16564, 62, 35156, 263, 62, 805, 796, 513...
2.031134
15,899
# ---------------------------------------------------------------------------- # Copyright (c) 2017-2018, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ---------------------------------------------------------------------------- import json import pandas as pd
[ 2, 16529, 10541, 198, 2, 15069, 357, 66, 8, 2177, 12, 7908, 11, 1195, 40, 12789, 362, 2478, 1074, 13, 198, 2, 198, 2, 4307, 6169, 739, 262, 2846, 286, 262, 40499, 347, 10305, 13789, 13, 198, 2, 198, 2, 383, 1336, 5964, 318, 287,...
5.333333
72
# -*- coding: utf-8 -*- import os import sys import state_workflow_sdk.api.state_workflow.callback_pb2 import state_workflow_sdk.api.state_workflow.createStateWorkflow_pb2 import state_workflow_sdk.model.state_workflow.stateWorkflow_pb2 import state_workflow_sdk.api.state_workflow.deleteStateWorkflow_pb2 import google.protobuf.empty_pb2 import state_workflow_sdk.api.state_workflow.filterInstanceOfStateWorkflow_pb2 import state_workflow_sdk.api.state_workflow.searchStateWorkflow_pb2 import state_workflow_sdk.api.state_workflow.transitWorkflowStatus_pb2 import state_workflow_sdk.utils.http_util import google.protobuf.json_format
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 11748, 28686, 198, 11748, 25064, 628, 198, 11748, 1181, 62, 1818, 11125, 62, 21282, 74, 13, 15042, 13, 5219, 62, 1818, 11125, 13, 47423, 62, 40842, 17, 198, 198, 11748, ...
2.723849
239
"""Test for motif.classify.mvgaussian """ from __future__ import print_function import unittest import numpy as np from motif.contour_classifiers import random_forest
[ 37811, 14402, 329, 32702, 13, 4871, 1958, 13, 76, 85, 4908, 31562, 198, 37811, 198, 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 11748, 555, 715, 395, 198, 11748, 299, 32152, 355, 45941, 198, 198, 6738, 32702, 13, 3642, 454, 62...
3.4
50
""" Profile-aware session wrapper. """ from os import environ from botocore.exceptions import ProfileNotFound from botocore.session import Session from awsenv.cache import CachedSession def get_default_profile_name(): """ Get the default profile name from the environment. """ return environ.get("AWS_DEFAULT_PROFILE", "default") class AWSProfile(AWSSession): """ AWS profile configuration. """ def __init__(self, profile, session_duration, cached_session, account_id=None): """ Configure a session for a profile. :param profile: the name of the profile to use, if any :param session_duration: the duration of the session (in seconds) must be in the range 900-3600 :param cached_session: the cached session to use, if any :param account_id: the account id for profile auto-generation (if any) """ self.session_duration = session_duration self.cached_session = cached_session self.account_id = account_id super(AWSProfile, self).__init__(profile) def to_envvars(self): return { "AWS_ACCESS_KEY_ID": self.access_key_id, "AWS_DEFAULT_REGION": self.region_name, "AWS_PROFILE": self.profile, "AWS_SECRET_ACCESS_KEY": self.secret_access_key, "AWS_SESSION_NAME": self.session_name, "AWS_SESSION_TOKEN": self.session_token, } def update_credentials(self): """ Update the profile's credentials by assuming a role, if necessary. """ if not self.role_arn: return if self.cached_session is not None: # use current role access_key, secret_key = self.current_role() else: # assume role to get a new token access_key, secret_key = self.assume_role() if access_key and secret_key: self.session.set_credentials( access_key=access_key, secret_key=secret_key, token=self.cached_session.token if self.cached_session else None, ) def current_role(self): """ Load credentials for the current role. """ return ( environ.get("AWS_ACCESS_KEY_ID", self.access_key_id), environ.get("AWS_SECRET_ACCESS_KEY", self.secret_access_key), ) def assume_role(self): """ Assume a role. """ # we need to pass in the regions and keys because botocore does not # automatically merge configuration from the source_profile sts_client = self.session.create_client( service_name="sts", region_name=self.region_name, aws_access_key_id=self.access_key_id, aws_secret_access_key=self.secret_access_key, ) session_name = CachedSession.make_name() result = sts_client.assume_role(**{ "RoleArn": self.role_arn, "RoleSessionName": session_name, "DurationSeconds": self.session_duration, }) # update the cached session self.cached_session = CachedSession( name=session_name, token=result["Credentials"]["SessionToken"], profile=self.profile, ) return ( result["Credentials"]["AccessKeyId"], result["Credentials"]["SecretAccessKey"], )
[ 37811, 198, 37046, 12, 9685, 6246, 29908, 13, 198, 37811, 198, 6738, 28686, 1330, 551, 2268, 198, 198, 6738, 10214, 420, 382, 13, 1069, 11755, 1330, 13118, 3673, 21077, 198, 6738, 10214, 420, 382, 13, 29891, 1330, 23575, 198, 198, 6738,...
2.171393
1,622
import torch import os import torch.nn.functional as F import numpy as np import copy from torch import nn from torch.optim import Adam from torch.autograd import Variable from torch.utils.tensorboard import SummaryWriter from tqdm import tqdm from typing import Tuple from .ppo import PPO, PPOExpert from .utils import CULoss from cail.network import AIRLDiscrim, Classifier from cail.buffer import SerializedBuffer
[ 11748, 28034, 201, 198, 11748, 28686, 201, 198, 11748, 28034, 13, 20471, 13, 45124, 355, 376, 201, 198, 11748, 299, 32152, 355, 45941, 201, 198, 11748, 4866, 201, 198, 201, 198, 6738, 28034, 1330, 299, 77, 201, 198, 6738, 28034, 13, 4...
3.173913
138
import numpy as np import os, shutil import imageio baseDir = "data/train_verbose" outDir = "data/train" #baseDir = "data/test_verbose" #outDir = "data/test" outDirVidCopy = "data/videos" combineVidsAll = {"smoke" : ["densMean", "densSlice", "velMean", "velSlice", "presMean", "presSlice"], "liquid": ["flagsMean", "flagsSlice", "velMean", "velSlice", "phiMean", "phiSlice"] } convertData = True processVid = True copyVidOnly = False ignoreTop = ["shapes", "waves"] ignoreSim = [] ignoreFrameDict = {} excludeIgnoreFrame = False topDirs = os.listdir(baseDir) topDirs.sort() #shutil.rmtree(outDir) #os.makedirs(outDir) # top level folders for topDir in topDirs: mantaMsg("\n" + topDir) if ignoreTop and any( item in topDir for item in ignoreTop ) : mantaMsg("Ignored") continue simDir = os.path.join(baseDir, topDir) sims = os.listdir(simDir) sims.sort() # sim_000000 folders for sim in sims: if ignoreSim and any( item in sim for item in ignoreSim ) : mantaMsg(sim + " - Ignored") continue currentDir = os.path.join(simDir, sim) files = os.listdir(currentDir) files.sort() destDir = os.path.join(outDir, topDir, sim) #if os.path.isdir(destDir): # shutil.rmtree(destDir) if not os.path.isdir(destDir): os.makedirs(destDir) # single files for file in files: filePath = os.path.join(currentDir, file) # copy src folder to destination if os.path.isdir(filePath) and file == "src": dest = os.path.join(destDir, "src") if not os.path.isdir(dest): shutil.copytree(filePath, dest, symlinks=False) # combine video files elif os.path.isdir(filePath) and file == "render": if not processVid: continue dest = os.path.join(destDir, "render") if copyVidOnly: shutil.copytree(filePath, dest, symlinks=False) continue if not os.path.isdir(dest): os.makedirs(dest) #mantaMsg(file) renderDir = os.path.join(currentDir, "render") vidFiles = os.listdir(renderDir) if "smoke" in topDir: combineVids = combineVidsAll["smoke"] elif "liquid" in topDir: combineVids = combineVidsAll["liquid"] else: combineVids = [""] for vidFile in vidFiles: if combineVids[0] + "00.mp4" not in vidFile: continue vidLine = [] for combineVid in combineVids: # find all video part files corresponding to current one vidParts = [] i = 0 while os.path.exists(os.path.join(renderDir, vidFile.replace(combineVids[0]+"00.mp4", combineVid+"%02d.mp4" % i))): vidParts.append(vidFile.replace(combineVids[0]+"00.mp4", combineVid+"%02d.mp4" % i)) i += 1 assert len(vidParts) == 11 # combine each video part file loadedVids = [] for part in vidParts: currentFile = os.path.join(renderDir, part) loaded = imageio.mimread(currentFile) #mantaMsg(len(loaded)) #mantaMsg(loaded[0].shape) loadedVids.append(loaded) #temp1 = np.concatenate(loadedVids[0:4], axis=2) #temp2 = np.concatenate(loadedVids[4:8], axis=2) #temp3 = np.concatenate(loadedVids[8:11]+[np.zeros_like(loadedVids[0])], axis=2) #vidLine.append(np.concatenate([temp1, temp2, temp3], axis=1)) vidLine.append(np.concatenate(loadedVids, axis=2)) combined = np.concatenate(vidLine, axis=1) # save combined file if combineVids[0] == "": newName = os.path.join(dest, "%s_%s_%s.mp4" % (topDir, sim, vidFile.replace("00.mp4", ".mp4"))) else: newName = os.path.join(dest, "%s_%s.mp4" % (topDir, sim)) imageio.mimwrite(newName, combined, quality=6, fps=11, ffmpeg_log_level="error") # save copy if combineVids[0] == "": newNameCopy = os.path.join(outDirVidCopy, "%s_%s_%s.mp4" % (topDir, sim, vidFile.replace("00.mp4", ".mp4"))) else: newNameCopy = os.path.join(outDirVidCopy, "%s_%s.mp4" % (topDir, sim)) imageio.mimwrite(newNameCopy, combined, quality=6, fps=11, ffmpeg_log_level="error") # copy description files to destination elif os.path.splitext(filePath)[1] == ".json" or os.path.splitext(filePath)[1] == ".py" or os.path.splitext(filePath)[1] == ".log": shutil.copy(filePath, destDir) # ignore other dirs and non .npz files elif os.path.isdir(filePath) or os.path.splitext(filePath)[1] != ".npz" or "part00" not in file: continue # combine part files else: if not convertData: continue if ignoreFrameDict: filterFrames = [] for key, value in ignoreFrameDict.items(): if key in topDir: filterFrames = value break assert (filterFrames != []), "Keys in filterFrameDict don't match dataDir structure!" # continue for frames when excluding or including according to filter if excludeIgnoreFrame == any( item in file for item in filterFrames ): continue # find all part files corresponding to current one parts = [file] i = 1 while os.path.exists(os.path.join(currentDir, file.replace("part00", "part%02d" % i))): parts.append(file.replace("part00", "part%02d" % i)) i += 1 assert len(parts) == 11 # combine each part file domain = np.load(os.path.join(currentDir, parts[0]))['arr_0'] res = domain.shape[0] combined = np.zeros([len(parts), res, res, res, domain.shape[3]]) for f in range(len(parts)): currentFile = os.path.join(currentDir, parts[f]) loaded = np.load(currentFile)['arr_0'] combined[f] = loaded # save combined file newName = file.replace("_part00", "") np.savez_compressed( os.path.join(destDir, newName), combined ) loaded = np.load( os.path.join(destDir, newName) )['arr_0'] mantaMsg(os.path.join(sim, newName) + "\t" + str(loaded.shape))
[ 11748, 299, 32152, 355, 45941, 198, 11748, 28686, 11, 4423, 346, 198, 11748, 2939, 952, 198, 198, 8692, 35277, 796, 366, 7890, 14, 27432, 62, 19011, 577, 1, 198, 448, 35277, 796, 366, 7890, 14, 27432, 1, 198, 2, 8692, 35277, 796, 36...
1.836801
3,989
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative works of this code must retain this # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. from abc import ABC, abstractmethod import warnings from qiskit import QuantumCircuit def _to_dia_matrix(self, mode=None): warnings.warn("_to_dia_matrix method is removed, use the `MatrixOperator` class to get diagonal matrix. And " "the current deprecated method does NOT modify the original object, it returns the dia_matrix", DeprecationWarning) from .op_converter import to_matrix_operator mat_op = to_matrix_operator(self) return mat_op.dia_matrix def enable_summarize_circuits(self): warnings.warn("enable_summarize_circuits method is removed. Enable the summary at QuantumInstance", DeprecationWarning) def disable_summarize_circuits(self): warnings.warn("disable_summarize_circuits method is removed. Disable the summary at QuantumInstance", DeprecationWarning) def find_Z2_symmetries(self): warnings.warn("The `find_Z2_symmetries` method is deprecated and it will be removed after 0.6, " "Use the class method in the `Z2Symmetries` class instead", DeprecationWarning) from .weighted_pauli_operator import Z2Symmetries from .op_converter import to_weighted_pauli_operator wp_op = to_weighted_pauli_operator(self) self._z2_symmetries = Z2Symmetries.find_Z2_symmetries(wp_op) return self._z2_symmetries.symmetries, self._z2_symmetries.sq_paulis, \ self._z2_symmetries.cliffords, self._z2_symmetries.sq_list def to_grouped_paulis(self): warnings.warn("to_grouped_paulis method is deprecated and it will be removed after 0.6. And the current " "deprecated method does NOT modify the original object, it returns the grouped weighted pauli " "operator. Please check the qiskit.aqua.operators.op_convertor for converting to different " "types of operators. For grouping paulis, you can create your own grouping func to create the " "class you need.", DeprecationWarning) from .op_converter import to_tpb_grouped_weighted_pauli_operator from .tpb_grouped_weighted_pauli_operator import TPBGroupedWeightedPauliOperator return to_tpb_grouped_weighted_pauli_operator(self, grouping_func=TPBGroupedWeightedPauliOperator.sorted_grouping) def to_paulis(self): warnings.warn("to_paulis method is deprecated and it will be removed after 0.6. And the current deprecated " "method does NOT modify the original object, it returns the weighted pauli operator." "Please check the qiskit.aqua.operators.op_convertor for converting to different types of " "operators", DeprecationWarning) from .op_converter import to_weighted_pauli_operator return to_weighted_pauli_operator(self) def to_matrix(self): warnings.warn("to_matrix method is deprecated and it will be removed after 0.6. And the current deprecated " "method does NOT modify the original object, it returns the matrix operator." "Please check the qiskit.aqua.operators.op_convertor for converting to different types of " "operators", DeprecationWarning) from .op_converter import to_matrix_operator return to_matrix_operator(self) def to_weighted_pauli_operator(self): warnings.warn("to_weighted_apuli_operator method is temporary helper method and it will be removed after 0.6. " "Please check the qiskit.aqua.operators.op_convertor for converting to different types of " "operators", DeprecationWarning) from .op_converter import to_weighted_pauli_operator return to_weighted_pauli_operator(self) def to_matrix_operator(self): warnings.warn("to_matrix_operator method is temporary helper method and it will be removed after 0.6. " "Please check the qiskit.aqua.operators.op_convertor for converting to different types of " "operators", DeprecationWarning) from .op_converter import to_matrix_operator return to_matrix_operator(self) def to_tpb_grouped_weighted_pauli_operator(self): warnings.warn("to_tpb_grouped_weighted_pauli_operator method is temporary helper method and it will be " "removed after 0.6. Please check the qiskit.aqua.operators.op_convertor for converting to " "different types of operators", DeprecationWarning) from .op_converter import to_tpb_grouped_weighted_pauli_operator from .tpb_grouped_weighted_pauli_operator import TPBGroupedWeightedPauliOperator return to_tpb_grouped_weighted_pauli_operator( self, grouping_func=TPBGroupedWeightedPauliOperator.sorted_grouping)
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 2, 770, 2438, 318, 636, 286, 1195, 1984, 270, 13, 198, 2, 198, 2, 357, 34, 8, 15069, 19764, 13130, 13, 198, 2, 198, 2, 770, 2438, 318, 11971, 739, 262, 24843,...
2.399828
2,331
import pandas as pd import numpy as np from sklearn.metrics import confusion_matrix import re def convert_data_sparse_matrix(df, row_label = 'stock_code', col_label = 'name_of_ccass_participant', value_label = 'shareholding'): """ Pivot table """ try: # Prepare zero matrix row_dim = len(df[row_label].unique()) col_dim = len(df[col_label].unique()) sparse_matrix = np.zeros((row_dim, col_dim)) # Prepare label to index dictionaries row_ind_dict = {label: ind for ind, label in enumerate(sorted(df[row_label].unique().tolist()))} col_ind_dict = {label: ind for ind, label in enumerate(sorted(df[col_label].unique().tolist()))} # Transform row_label column and col_label column to index df['row_ind'] = df[row_label].apply(lambda x: row_ind_dict[x]) df['col_ind'] = df[col_label].apply(lambda x: col_ind_dict[x]) for ind, row in df.iterrows(): # Get index and shareholding row_ind = row['row_ind'] col_ind = row['col_ind'] value = row[value_label] # Assign to sparse matrix sparse_matrix[row_ind, col_ind] += value return sparse_matrix, row_ind_dict, col_ind_dict except Exception as e: print(e) return None def cluster_predict(label, min_pts = 'auto'): """ Input: an array of clsutered label for each instance return: an array of anomal label for each instance """ try: # Get Unqiue label and its counts (unique, counts) = np.unique(label, return_counts = True) # Define minimum points that it should have in a cluster, if auto, it will take the min count if min_pts == 'auto': min_pts = min(counts) print('Minimum points of a cluster among the clusters: ', min_pts) else: min_pts = int(min_pts) # Prepare label_dict for mapping label_dict = {label: 0 if count > min_pts else 1 for label, count in zip(unique, counts)} # Map label_dict to label return np.array([label_dict[i] for i in label]) except Exception as e: print(e) return None
[ 11748, 19798, 292, 355, 279, 67, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 1341, 35720, 13, 4164, 10466, 1330, 10802, 62, 6759, 8609, 198, 11748, 302, 198, 198, 4299, 10385, 62, 7890, 62, 82, 29572, 62, 6759, 8609, 7, 7568, 11, ...
2.307772
965
''' Prepare some files to test the upload functionality. ''' import sys sys.path.append('../') from database import * from pymongo import MongoClient mongo = MongoClient(MONGOURI) db = mongo['SCV'] coll = db['dataset'] from gene_expression import * expr_df, meta_doc = load_read_counts_and_meta(organism='mouse', gse='GSE96870') # rename the samples expr_df.columns = ['sample_%d' % i for i in range(len(expr_df.columns))] meta_df = pd.DataFrame(meta_doc['meta_df']) meta_df.index = expr_df.columns meta_df.index.name = 'sample_ID' # parse the meta_df a bit meta_df['Sample_characteristics_ch1'] = meta_df['Sample_characteristics_ch1'].map(lambda x:x.split('\t')) keys_from_char_ch1 = [item.split(': ')[0] for item in meta_df['Sample_characteristics_ch1'][0]] for i, key in enumerate(keys_from_char_ch1): meta_df[key] = meta_df['Sample_characteristics_ch1'].map(lambda x:x[i].split(': ')[1]) # drop unnecessary columns in meta_df meta_df = meta_df.drop(['Sample_characteristics_ch1', 'Sample_relation', 'Sample_geo_accession', 'Sample_supplementary_file_1'], axis=1) # fake a column of continuous values meta_df['random_continuous_attr'] = np.random.randn(meta_df.shape[0]) meta_df.to_csv('../data/sample_metadata.csv') # raw read counts expr_df.to_csv('../data/sample_read_counts_%dx%d.csv' % expr_df.shape) # CPMs expr_df = compute_CPMs(expr_df) expr_df.to_csv('../data/sample_CPMs_%dx%d.csv' % expr_df.shape)
[ 7061, 6, 198, 37534, 533, 617, 3696, 284, 1332, 262, 9516, 11244, 13, 198, 7061, 6, 198, 11748, 25064, 198, 17597, 13, 6978, 13, 33295, 10786, 40720, 11537, 198, 6738, 6831, 1330, 1635, 198, 6738, 279, 4948, 25162, 1330, 42591, 11792, ...
2.56553
557
from flask import Flask, request from flask_restful import Resource, reqparse from flask_jwt_extended import create_access_token, jwt_required from app.api.V1.models import Product, products # Get a single specific product
[ 6738, 42903, 1330, 46947, 11, 2581, 198, 6738, 42903, 62, 2118, 913, 1330, 20857, 11, 43089, 29572, 198, 6738, 42903, 62, 73, 46569, 62, 2302, 1631, 1330, 2251, 62, 15526, 62, 30001, 11, 474, 46569, 62, 35827, 198, 198, 6738, 598, 13,...
3.677419
62
import time from multiprocessing.pool import Pool if __name__ == '__main__': t = time.time() p1 = Pool(processes=30) p2 = Pool(processes=30) p3 = Pool(processes=30) num1 = range(2, 7072) num2 = range(2, 369) num3 = range(2, 85) prime_list1 = p1.map(is_prime, num1) p1.close() p1.join() prime_list2 = p2.map(is_prime, num2) p2.close() p2.join() prime_list3 = p3.map(is_prime, num3) p3.close() p3.join() prime_list1_clear = [x for x in prime_list1 if x is not None] prime_list2_clear = [x for x in prime_list2 if x is not None] prime_list3_clear = [x for x in prime_list3 if x is not None] result_list = [] for i in prime_list1_clear: print(i) for j in prime_list2_clear: for k in prime_list3_clear: test_num = i**2 + j**3 + k**4 if test_num < 50000000: result_list.append(test_num) print(str(len(list(set(result_list))))) print('time:'+str(time.time()-t))
[ 11748, 640, 198, 6738, 18540, 305, 919, 278, 13, 7742, 1330, 19850, 628, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 256, 796, 640, 13, 2435, 3419, 198, 220, 220, 220, 279, 16, 796, 19850,...
2.017613
511
# recursion function (Clean Word) print(CleanWord("wwwooooorrrrllddd"))
[ 2, 664, 24197, 2163, 357, 32657, 9678, 8, 198, 198, 4798, 7, 32657, 26449, 7203, 2503, 13321, 273, 21062, 81, 297, 1860, 67, 48774, 198 ]
2.92
25
import typing from commands2 import CommandBase from subsystems.cameracontroller import CameraSubsystem
[ 11748, 19720, 198, 6738, 9729, 17, 1330, 9455, 14881, 198, 198, 6738, 39335, 82, 13, 66, 2382, 330, 756, 10646, 1330, 20432, 7004, 10057, 628 ]
4.24
25
from django.shortcuts import render,redirect from django.http import HttpResponse, Http404,HttpResponseRedirect import datetime as dt from .models import Post,Comment,Follow,Profile from django.contrib.auth.decorators import login_required from .forms import NewPostForm, NewCommentForm, AddProfileForm from django.contrib.auth.models import User def delete_post(request,post_id): post= Post.objects.get(pk=post_id) post.delete_post() return redirect('my_profile') return render(request, 'my_profile')
[ 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 11, 445, 1060, 198, 6738, 42625, 14208, 13, 4023, 1330, 367, 29281, 31077, 11, 367, 29281, 26429, 11, 43481, 31077, 7738, 1060, 198, 11748, 4818, 8079, 355, 288, 83, 198, 6738, 764, 2753...
3.169697
165
import sys import wx sys.path.insert(0, 'lib.zip') from lib.TetrisGame import TetrisGame if __name__ == '__main__': app = wx.PySimpleApp() frame = TetrisGame(None) frame.Show(True) app.MainLoop()
[ 11748, 25064, 201, 198, 11748, 266, 87, 201, 198, 201, 198, 17597, 13, 6978, 13, 28463, 7, 15, 11, 705, 8019, 13, 13344, 11537, 201, 198, 6738, 9195, 13, 51, 316, 2442, 8777, 1330, 27351, 2442, 8777, 201, 198, 201, 198, 201, 198, ...
2.106195
113
import argparse import torch import logger import models import utils NUM_NODES = { 'moments': 391, 'multimoments': 391, 'kinetics': 608, } CRITERIONS = { 'CE': {'func': torch.nn.CrossEntropyLoss}, 'MSE': {'func': torch.nn.MSELoss}, 'BCE': {'func': torch.nn.BCEWithLogitsLoss}, } OPTIMIZERS = { 'SGD': { 'func': torch.optim.SGD, 'lr': 0.001, 'momentum': 0.9, 'weight_decay': 5e-4, }, 'Adam': {'func': torch.optim.Adam, 'weight_decay': 5e-4}, } SCHEDULER_DEFAULTS = {'CosineAnnealingLR': {'T_max': 100}} METAFILE_FILE = { 'moments': { 'train': 'metadata/moments_train_abstraction_sets.json', 'val': 'metadata/moments_val_abstraction_sets.json', }, 'kinetics': { 'train': 'metadata/kinetics_train_abstraction_sets.json', 'val': 'metadata/kinetics_val_abstraction_sets.json', }, } FEATURES_FILE = { 'moments': { 'train': 'metadata/resnet3d50_moments_train_features.pth', 'val': 'metadata/resnet3d50_moments_val_features.pth', 'test': 'metadata/resnet3d50_moments_test_features.pth', }, 'kinetics': { 'train': 'metadata/resnet3d50_kinetics_train_features.pth', 'val': 'metadata/resnet3d50_kinetics_val_features.pth', 'test': 'metadata/resnet3d50_kinetics_test_features.pth', }, } EMBEDDING_FILE = { 'moments': { 'train': 'metadata/moments_train_embeddings.pth', 'val': 'metadata/moments_val_embeddings.pth', }, 'kinetics': { 'train': 'metadata/kinetics_train_embeddings.pth', 'val': 'metadata/kinetics_val_embeddings.pth', 'test': 'metadata/kinetics_test_embeddings.pth', }, } EMBEDDING_CATEGORIES_FILE = { 'moments': 'metadata/moments_category_embeddings.pth', 'kinetics': 'metadata/kinetics_category_embeddings.pth', } LIST_FILE = { 'moments': { 'train': 'metadata/moments_train_listfile.txt', 'val': 'metadata/moments_val_listfile.txt', 'test': 'metadata/moments_test_listfile.txt', }, 'kinetics': { 'train': 'metadata/kinetics_train_listfile.txt', 'val': 'metadata/kinetics_val_listfile.txt', 'test': 'metadata/kinetics_test_listfile.txt', }, } RANKING_FILE = { 'moments': 'metadata/moments_human_abstraction_sets.json', 'kinetics': 'metadata/kinetics_human_abstraction_sets.json', } GRAPH_FILE = { 'moments': 'metadata/moments_graph.json', 'kinetics': 'metadata/kinetics_graph.json', }
[ 11748, 1822, 29572, 198, 11748, 28034, 198, 198, 11748, 49706, 198, 11748, 4981, 198, 11748, 3384, 4487, 198, 198, 41359, 62, 45, 3727, 1546, 796, 1391, 198, 220, 220, 220, 705, 32542, 658, 10354, 5014, 16, 11, 198, 220, 220, 220, 705...
2.147708
1,178
import scrapy from bs4 import BeautifulSoup from lab3.items import Lab3Item
[ 11748, 15881, 88, 198, 6738, 275, 82, 19, 1330, 23762, 50, 10486, 198, 6738, 2248, 18, 13, 23814, 1330, 3498, 18, 7449, 628 ]
3.347826
23
import matplotlib.pyplot as plt from lifelines import (WeibullFitter, ExponentialFitter, LogNormalFitter, LogLogisticFitter) import pandas as pd data = pd.read_csv('Dataset/telco_customer.csv') data['tenure'] = pd.to_numeric(data['tenure']) data = data[data['tenure'] > 0] # Replace yes and No in the Churn column to 1 and 0. 1 for the event and 0 for the censured data. data['Churn'] = data['Churn'].apply(lambda x: 1 if x == 'Yes' else 0) fig, axes = plt.subplots(2, 2, figsize=( 16, 12)) T = data['tenure'] E = data['Churn'] wbf = WeibullFitter().fit(T, E, label='WeibullFitter') ef = ExponentialFitter().fit(T, E, label='ExponentialFitter') lnf = LogNormalFitter().fit(T, E, label='LogNormalFitter') llf = LogLogisticFitter().fit(T, E, label='LogLogisticFitter') wbf.plot_cumulative_hazard(ax=axes[0][0]) ef.plot_cumulative_hazard(ax=axes[0][1]) lnf.plot_cumulative_hazard(ax=axes[1][0]) llf.plot_cumulative_hazard(ax=axes[1][1]) plt.suptitle( 'Parametric Model Implementation of cumulative hazard function on the Telco dataset') fig.text(0.5, 0.04, 'Timeline', ha='center') fig.text(0.04, 0.5, 'Probability', va='center', rotation='vertical') plt.savefig('Images/WeiExpLogx.jpeg') plt.show()
[ 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 6738, 3868, 20655, 1330, 357, 1135, 571, 724, 37, 1967, 11, 5518, 35470, 37, 1967, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2...
2.472
500
import re import num2words INT_PATTERN = re.compile(r'^-?[0-9]+$') FLOAT_PATTERN = re.compile(r'^-?[0-9]+[,\.][0-9]+$') ORDINAL_PATTERN = re.compile(r'^[0-9]+\.?$') NUM_PATTERN = re.compile(r'^-?[0-9]+([,\.][0-9]+$)?')
[ 11748, 302, 198, 11748, 997, 17, 10879, 628, 198, 12394, 62, 47, 1404, 31800, 796, 302, 13, 5589, 576, 7, 81, 6, 61, 12, 30, 58, 15, 12, 24, 48688, 3, 11537, 198, 3697, 46, 1404, 62, 47, 1404, 31800, 796, 302, 13, 5589, 576, 7...
1.757813
128
from django.test import TransactionTestCase from django.test import TestCase from django.urls import reverse from home_page.models import Search from ebaysdk.finding import Connection as finding
[ 6738, 42625, 14208, 13, 9288, 1330, 45389, 14402, 20448, 198, 6738, 42625, 14208, 13, 9288, 1330, 6208, 20448, 198, 6738, 42625, 14208, 13, 6371, 82, 1330, 9575, 198, 6738, 1363, 62, 7700, 13, 27530, 1330, 11140, 198, 6738, 36649, 592, ...
2.345455
110
from key_generator.key_generator import generate all_sizes_required = [(100, '100'), (500, '500'), (1000, '1K'), (5000, '5K'), (10000, '10K'), (50000, '50K'), (100000, '100K'), (500000, '500K')] for file_size in all_sizes_required: OUTPUT_PATH = "./string_test_" + file_size[1] + ".txt" STRING_COUNT = file_size[0] output_file = open(OUTPUT_PATH, "w") for i in range(STRING_COUNT): string = "" recipient = generate( num_of_atom = 1, type_of_value = "hex", capital = "mix", extras = ["-", "_"], seed = i ).get_key() domain = generate( num_of_atom = 2, separator = ".", min_atom_len = 3, max_atom_len = 5, type_of_value = "hex", capital = "mix", extras = ["-"], seed = i ).get_key() string = recipient + "@" + domain output_file.write(string + "\n") output_file.close() print("Done with " + OUTPUT_PATH)
[ 6738, 1994, 62, 8612, 1352, 13, 2539, 62, 8612, 1352, 1330, 7716, 198, 198, 439, 62, 82, 4340, 62, 35827, 796, 47527, 3064, 11, 705, 3064, 33809, 357, 4059, 11, 705, 4059, 33809, 357, 12825, 11, 705, 16, 42, 33809, 357, 27641, 11, ...
2.263021
384
########################################### # Author : Bastien Girardet, Deborah De Wolff # Date : 13.05.2018 # Course : Applications in Object-oriented Programming and Databases # Teachers : Binswanger Johannes, Zrcher Ruben # Project : Bibliotek # Name : portfolio_book.py Portfolio_book Flask_restful resource # ######################################### from flask_restful import Resource, reqparse from models.portfolio_book import PortfolioBookModel from models.book import BookModel
[ 29113, 7804, 21017, 198, 2, 220, 220, 6434, 1058, 17520, 2013, 23837, 446, 316, 11, 36976, 1024, 27094, 487, 198, 2, 220, 220, 7536, 1058, 1511, 13, 2713, 13, 7908, 198, 2, 220, 220, 20537, 1058, 26622, 287, 9515, 12, 17107, 30297, ...
3.853846
130
import logging from absl import app from sensor_msgs.msg import Image from insert_table_op import InsertTableOperator from insert_block_op import InsertBlockOperator from init_robot_op import InitRobotOperator from gel_sight_op import GelSightOperator from mock_loc_obj_op import MockLocateObjectOperator from goto_xyz_op import GoToXYZOperator from move_above_object_op import MoveAboveObjectOperator from mock_gripper_op import MockGripperOperator from mock_grasp_object_op import MockGraspObjectOperator from raise_object_op import RaiseObjectOperator from mock_predict_grip_op import MockPredictGripOperator from random_position_op import RandomPositionOperator from mock_ungrasp_object_op import MockUngraspObjectOperator import erdos.graph from erdos.ros.ros_subscriber_op import ROSSubscriberOp logger = logging.getLogger(__name__) table_init_arguments = {"_x": 0.75, "_y": 0.0, "_z": 0.0, "ref_frame": "world"} block_init_arguments = { "_x": 0.4225, "_y": 0.1265, "_z": 0.7725, "ref_frame": "world" } robot_init_arguments = { "joint_angles": { 'right_j0': -0.041662954890248294, 'right_j1': -1.0258291091425074, 'right_j2': 0.0293680414401436, 'right_j3': 2.17518162913313, 'right_j4': -0.06703022873354225, 'right_j5': 0.3968371433926965, 'right_j6': 1.7659649178699421 }, "limb_name": "right" } if __name__ == "__main__": app.run(main)
[ 11748, 18931, 198, 6738, 2352, 75, 1330, 598, 198, 6738, 12694, 62, 907, 14542, 13, 19662, 1330, 7412, 198, 198, 6738, 7550, 62, 11487, 62, 404, 1330, 35835, 10962, 18843, 1352, 198, 6738, 7550, 62, 9967, 62, 404, 1330, 35835, 12235, ...
2.463248
585
# -*- coding: utf-8 -*- from __future__ import unicode_literals import jsonfield.fields from django.conf import settings from django.db import migrations, models
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 11748, 33918, 3245, 13, 25747, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 6738, 42625, 1420...
3.215686
51
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2017 Tomoki Hayashi (Nagoya University) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from __future__ import print_function import argparse import numpy as np from sklearn.preprocessing import StandardScaler from utils import read_hdf5 from utils import read_txt from utils import write_hdf5 if __name__ == "__main__": main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 2, 15069, 2177, 4186, 18228, 9075, 12144, 357, 45, 363, 23790, 2059, 8, 198, 2, 220, 24843, 362, 13, 15, 220, ...
2.789116
147
# from decimal import Decimal import collections as coll import sys import math as mt # import random as rd # import bisect as bi import time sys.setrecursionlimit(1000000) # import numpy as np # Starting Time time1 = time.time() ######## CODE STARTS FROM HERE ######## n = uno() a, b, c, ans = 0, 1, 0, 0 while c <= n: c = a + b if ~c & 1: ans += c b, a = c, b print(ans) # End Time time2 = time.time() print("\nTime Taken:", (time2 - time1) * 1000)
[ 2, 422, 32465, 1330, 4280, 4402, 198, 11748, 17268, 355, 2927, 198, 11748, 25064, 198, 11748, 10688, 355, 45079, 198, 198, 2, 1330, 4738, 355, 374, 67, 198, 2, 1330, 47457, 478, 355, 3182, 198, 11748, 640, 198, 198, 17597, 13, 2617, ...
2.560847
189
from robosuite.models.objects import MujocoXMLObject from robosuite.utils.mjcf_utils import xml_path_completion, array_to_string, string_to_array
[ 6738, 3857, 418, 84, 578, 13, 27530, 13, 48205, 1330, 8252, 73, 25634, 55, 5805, 10267, 198, 6738, 3857, 418, 84, 578, 13, 26791, 13, 76, 73, 12993, 62, 26791, 1330, 35555, 62, 6978, 62, 785, 24547, 11, 7177, 62, 1462, 62, 8841, 1...
2.839286
56
# Problem description: http://python3.softuni.bg/student/lecture/assignment/56b749af7e4f59b649b7e626/ if __name__ == '__main__': main()
[ 2, 20647, 6764, 25, 2638, 1378, 29412, 18, 13, 4215, 35657, 13, 35904, 14, 50139, 14, 801, 495, 14, 562, 16747, 14, 3980, 65, 22, 2920, 1878, 22, 68, 19, 69, 3270, 65, 33300, 65, 22, 68, 45191, 14, 628, 628, 198, 361, 11593, 367...
2.440678
59
# LOGGING # ---------------------------------------------------------------------------------------------------------------------# import logging logger = logging.getLogger('django') # IMPORTS # ---------------------------------------------------------------------------------------------------------------------# # shortcuts from django.shortcuts import render # contrib.auth from django.contrib.auth.decorators import login_required # views.generic from django.views.generic import DetailView # from .models import * # GENERIC CLASS BASED VIEWS # ---------------------------------------------------------------------------------------------------------------------# # CUSTOM VIEWS # ---------------------------------------------------------------------------------------------------------------------#
[ 2, 41605, 38, 2751, 198, 2, 16529, 3880, 19351, 12, 2, 198, 11748, 18931, 198, 6404, 1362, 796, 18931, 13, 1136, 11187, 1362, 10786, 28241, 14208, 11537, 198, 198, 2, 30023, 33002, 198, 2, 16529, 3880, 19351, 12, 2, 198, 2, 32953, 1...
6.121212
132
# Adam Beardsley # starting from from adafruit example # https://learn.adafruit.com/welcome-to-circuitpython/creating-and-editing-code # import board import digitalio import time led = digitalio.DigitalInOut(board.LED) led.direction = digitalio.Direction.OUTPUT ramp_time = 3 # Time to ramp up, in seconds period = 0.01 # Time per cycle, in seconds step = period / ramp_time # how much to increment the brightness each cycle while True: brightness = 0 # Start off while brightness < 1: T_on = brightness * period T_off = period - T_on led.value = True time.sleep(T_on) led.value = False time.sleep(T_off) brightness += step # Convince yourself the expression for step (line 14) is correct # How can you *test* that step is correct? # Can you reverse the program (start bright, get dim)
[ 2, 7244, 1355, 1371, 1636, 198, 2, 3599, 422, 422, 512, 1878, 4872, 1672, 198, 2, 3740, 1378, 35720, 13, 324, 1878, 4872, 13, 785, 14, 86, 9571, 12, 1462, 12, 21170, 5013, 29412, 14, 20123, 278, 12, 392, 12, 276, 1780, 12, 8189, ...
2.822368
304
import argparse from site_checker import SiteChecker if __name__ == "__main__": parser = argparse.ArgumentParser(description="Check sites text.") parser.add_argument("config", type=str, nargs=1, help="Path to config json file.") parser.add_argument( "-a", dest="apiKey", type=str, nargs=1, required=True, help="Pushbullet API key.", ) parser.add_argument( "-m", dest="maxFailCount", type=int, nargs=1, help="Max fail count." ) parser.add_argument( "-u", dest="updateCycle", type=int, nargs=1, help="Update cycle in second" ) parser.add_argument( "-v", dest="isVerbose", action="store_true", help="Verbose mode." ) parser.add_argument( "-q", dest="isQuiet", action="store_true", help="Quiet mode. Does not call pushbullet", ) args = parser.parse_args() k = SiteChecker( args.config[0], args.apiKey[0], args.isQuiet, args.isVerbose, args.maxFailCount, args.updateCycle, ) k.check()
[ 11748, 1822, 29572, 198, 6738, 2524, 62, 9122, 263, 1330, 14413, 9787, 263, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 30751, 796, 1822, 29572, 13, 28100, 1713, 46677, 7, 11213, 2625, 9787, ...
2.184891
503
import os from pathlib import Path from datetime import datetime from json import dumps import flask as fsk from flask import request, jsonify, Response app = fsk.Flask(__name__) app.config['DEBUG'] = False homedir = os.getenv('HOME') if __name__ == "__main__": app.run(host='0.0.0.0', port=4960)
[ 11748, 28686, 198, 6738, 3108, 8019, 1330, 10644, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 6738, 33918, 1330, 45514, 198, 198, 11748, 42903, 355, 277, 8135, 198, 6738, 42903, 1330, 2581, 11, 33918, 1958, 11, 18261, 198, 198, 1324, ...
2.816514
109
#!/usr/bin/env python3 #################################################################################################### # Created by EH (NL) https://github.com/strebrah/Solaredge_Domoticz_Modbus # # Date: August 2020 # # Version: 0.1 # # Designed for python 3.7 (based on the requirements of the 'solaredge_modbus' library.) # # Thanks to Niels for the 'solaredge_modbus' library https://pypi.org/project/solaredge-modbus/ # # Capabilities: # # * Creating a hardware device in Domoticz # # * Creating sensors for the data types in Domoticz # # * Sending the solaredge modbus data to Domoticz # # How to use # # 1. Enter your configuration in the 'dz_se_settings.ini' file # # 2. configure crontab task for periodic data transfer to Domoticz. # # example: # # sudo crontab -e # # for example, every minute # # */1 * * * * /usr/bin/python3 /home/pi/domoticz/scripts/python/dz_se_comm.py # #################################################################################################### import requests import configparser import time import solaredge_modbus from dz_se_lib import domoticz_create_hardware from dz_se_lib import domoticz_create_devices from dz_se_lib import domoticz_retrieve_device_idx from dz_se_lib import domoticz_transceive_data from dz_se_lib import get_path_to_init_file if __name__ == "__main__": settings = configparser.ConfigParser() settings._interpolation = configparser.ExtendedInterpolation() settings.read(get_path_to_init_file()) domoticz_ip = settings.get('GENERAL SETTINGS', 'domoticz_ip') domoticz_port = settings.get('GENERAL SETTINGS', 'domoticz_port') inverter = solaredge_modbus.Inverter(host=settings.get('GENERAL SETTINGS', 'solaredge_inverter_ip'), port=settings.get('GENERAL SETTINGS', 'solaredge_inverter_port'), timeout=1, unit=1) # Get values from Solaredge inverter over TCP Modbus if settings.get('GENERAL SETTINGS', 'domoticz_solaredge_comm_init_done') == '0': session = requests.Session() # SET HARDWARE IN DOMOTICZ DOMOTICZ_HW_IDX = domoticz_create_hardware(domoticz_ip, domoticz_port, settings, session) # CREATE DEVICES IN DOMOTICZ domoticz_create_devices(domoticz_ip, domoticz_port, settings, session, DOMOTICZ_HW_IDX) # GET ALL SENSOR IDX VALUES AND STORE domoticz_retrieve_device_idx(domoticz_ip, domoticz_port, settings, session) session.close() else: time.sleep(0.5) session = requests.Session() domoticz_transceive_data(domoticz_ip, domoticz_port, settings, session, inverter) session.close()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 201, 198, 29113, 29113, 29113, 4242, 201, 198, 2, 15622, 416, 412, 39, 357, 32572, 8, 3740, 1378, 12567, 13, 785, 14, 22853, 65, 11392, 14, 36949, 1144, 469, 62, 24510, 6210, 89, 62, ...
1.877487
1,910
import senti_lexis import datetime, string, numpy, spwrap, random time, sys, re from sklearn import svm from sklearn import cross_validation from sklearn.feature_extraction.text import CountVectorizer from sklearn.cross_validation import KFold from scipy.sparse import csr_matrix if __name__ == "__main__": main()
[ 198, 198, 11748, 1908, 72, 62, 2588, 271, 198, 11748, 4818, 8079, 11, 4731, 11, 299, 32152, 11, 599, 37150, 11, 4738, 640, 11, 25064, 11, 302, 198, 198, 6738, 1341, 35720, 1330, 264, 14761, 198, 6738, 1341, 35720, 1330, 3272, 62, 12...
3.106796
103
print(machine())
[ 198, 4798, 7, 30243, 28955, 628, 198 ]
2.857143
7
from numpy import isnan from wonambi import Dataset from .paths import axon_abf_file d = Dataset(axon_abf_file)
[ 6738, 299, 32152, 1330, 2125, 272, 198, 198, 6738, 1839, 4131, 72, 1330, 16092, 292, 316, 198, 198, 6738, 764, 6978, 82, 1330, 7877, 261, 62, 397, 69, 62, 7753, 628, 198, 67, 796, 16092, 292, 316, 7, 897, 261, 62, 397, 69, 62, 7...
2.458333
48
from AutoMxL.Preprocessing.Categorical import * from AutoMxL.Preprocessing.Date import * from AutoMxL.Preprocessing.Outliers import * from AutoMxL.Preprocessing.Missing_Values import * import unittest import pandas as pd import math # test config df = pd.read_csv('tests/df_test_bis.csv') """ ------------------------------------------------------------------------------------------------ """ df_to_date = all_to_date(df, ['Date_nai', 'American_date_nai'], verbose=False) df_to_anc, new_var_list = date_to_anc(df_to_date, l_var=['American_date_nai', 'Date_nai'], date_ref='27/10/2010') """ ------------------------------------------------------------------------------------------------ """ """ ------------------------------------------------------------------------------------------------ """
[ 6738, 11160, 44, 87, 43, 13, 6719, 36948, 13, 34, 2397, 12409, 1330, 1635, 198, 6738, 11160, 44, 87, 43, 13, 6719, 36948, 13, 10430, 1330, 1635, 198, 6738, 11160, 44, 87, 43, 13, 6719, 36948, 13, 7975, 75, 3183, 1330, 1635, 198, 6...
3.834123
211
""" Session: 4 Topic: Conditional: IF ELSE statement """ x = 20 y = 100 if (x > y): print ('x > y is true') print ('new line 1') else: print('x > y is false') print('new line 2') print ('new line 3')
[ 37811, 198, 36044, 25, 604, 198, 33221, 25, 9724, 1859, 25, 16876, 17852, 5188, 2643, 198, 37811, 198, 87, 796, 1160, 198, 88, 796, 1802, 628, 198, 361, 357, 87, 1875, 331, 2599, 198, 220, 220, 220, 3601, 19203, 87, 1875, 331, 318, ...
2.477273
88
if __name__ == "__main__": with open("input.txt") as f: raw = f.read() commands = [x for x in raw.split("\n")] horizontal, depth = chain_commands(commands) print(f"First answer is {horizontal*depth}") # print(f"Second answer is {count_increasing(measurements, 3)}")
[ 628, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 351, 1280, 7203, 15414, 13, 14116, 4943, 355, 277, 25, 198, 220, 220, 220, 220, 220, 220, 220, 8246, 796, 277, 13, 961, 3419, 628, 220, 220, 22...
2.525424
118
import codecs import json import rank import train_ranker #Files to be present in home dir TRAINING_FILE_CITIES = 'manual_7_cities.jl' TRAINING_FILE_NAMES = 'manual_50_names.jl' TRAINING_FILE_ETHNICITIES = 'manual_50_ethnicities.jl' ACTUAL_FILE_CITIES = 'manual_50_cities.jl' ACTUAL_FILE_NAMES = 'manual_50_names.jl' ACTUAL_FILE_ETHNICITIES = 'manual_50_ethnicities.jl' EMBEDDINGS_FILE = 'unigram-part-00000-v2.json' FIELD_NAMES_CITIES = { "text_field": "readability_text", "annotated_field":"annotated_cities", "correct_field":"correct_cities" } FIELD_NAMES_NAMES = { "text_field": "readability_text", "annotated_field":"annotated_names", "correct_field":"correct_names" } FIELD_NAMES_ETHNICITIES = { "text_field": "readability_text", "annotated_field":"annotated_ethnicities", "correct_field":"correct_ethnicities" } def get_texts(json_object): """ Parsing logic for getting texts """ texts = list() texts.append(json_object.get(FIELD_NAMES_CITIES['text_field'])) return texts def get_annotated_list(json_object): """ Parsing logic for getting annotated field """ return json_object.get(FIELD_NAMES_CITIES['annotated_field']) embeddings_dict = read_embedding_file(EMBEDDINGS_FILE) classifier = train_ranker.train_ranker(embeddings_dict, TRAINING_FILE_CITIES, FIELD_NAMES_CITIES) with codecs.open(ACTUAL_FILE_CITIES, 'r', 'utf-8') as f: for line in f: obj = json.loads(line) list_of_texts = get_texts(obj) annotated_list = get_annotated_list(obj) print "Annotated tokens:", print annotated_list ranked_list = rank.rank(embeddings_dict, list_of_texts, annotated_list, classifier) print "Ranked List:", print ranked_list
[ 11748, 40481, 82, 198, 11748, 33918, 198, 198, 11748, 4279, 198, 11748, 4512, 62, 43027, 263, 198, 198, 2, 25876, 284, 307, 1944, 287, 1363, 26672, 198, 51, 3861, 1268, 2751, 62, 25664, 62, 34, 30383, 796, 705, 805, 723, 62, 22, 62,...
2.415531
734
''' Calculat the leap year''' from datetime import date year = int(input('What year do you want to analyse? Type 0 for the current year.')) if year == 0: year = date.today().year if year%4 ==0 and year%100 != 0 or year%400 == 0: print(F"The year {year} it's a LEAP year.".) else: print(F"The year {year} isn't a LEAP year.")
[ 7061, 6, 27131, 265, 262, 16470, 614, 7061, 6, 198, 6738, 4818, 8079, 1330, 3128, 198, 1941, 796, 493, 7, 15414, 10786, 2061, 614, 466, 345, 765, 284, 39552, 30, 5994, 657, 220, 329, 262, 1459, 614, 2637, 4008, 198, 361, 614, 6624, ...
2.823529
119
#!/usr/bin/env python #coding=utf-8 import numpy if __name__ == "__main__": task_list = get_task_list() for task in task_list: print "%d\t%d" % (task.cpu, task.mem)
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 66, 7656, 28, 40477, 12, 23, 198, 198, 11748, 299, 32152, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 4876, 62, 4868, 796, 651, 62, 35...
2.152941
85
# This is an empty python file to expose this directory to it's parent
[ 2, 770, 318, 281, 6565, 21015, 2393, 284, 15651, 428, 8619, 284, 340, 338, 2560, 198 ]
4.4375
16
import os import cv2 from sklearn.cluster import KMeans, DBSCAN, MiniBatchKMeans from scipy import spatial from sklearn.preprocessing import StandardScaler import numpy as np from tqdm import tqdm import argparse parser = argparse.ArgumentParser(description='Challenge presentation example') parser.add_argument('--data_path', '-d', type=str, default='dataset', help='Dataset path') parser.add_argument('--output_dim', '-o', type=int, default=20, help='Descriptor length') parser.add_argument('--save_dir', '-s', type=str, default=None, help='Save or not gallery/query feats') parser.add_argument('--random', '-r', action='store_true', help='Random run') args = parser.parse_args() def topk_accuracy(gt_label, matched_label, k=1): matched_label = matched_label[:, :k] total = matched_label.shape[0] correct = 0 for q_idx, q_lbl in enumerate(gt_label): correct+= np.any(q_lbl == matched_label[q_idx, :]).item() acc_tmp = correct/total return acc_tmp def main(): data_path = 'C:/Users/21032/Desktop/dataset' # we define training dataset training_path = os.path.join(data_path, 'training') # we define validation dataset validation_path = os.path.join(data_path, 'validation') gallery_path = os.path.join(validation_path, 'gallery') query_path = os.path.join(validation_path, 'query') training_dataset = Dataset(data_path=training_path) gallery_dataset = Dataset(data_path=gallery_path) query_dataset = Dataset(data_path=query_path) # get training data and classes training_paths, training_classes = training_dataset.get_data_paths() # we get validation gallery and query data gallery_paths, gallery_classes = gallery_dataset.get_data_paths() query_paths, query_classes = query_dataset.get_data_paths() if not args.random: feature_extractor = cv2.SIFT_create() # we define model for clustering model = KMeans(n_clusters=args.output_dim, n_init=10, max_iter=5000, verbose=False) # model = MiniBatchKMeans(n_clusters=args.output_dim, random_state=0, batch_size=100, max_iter=100, verbose=False) scale = StandardScaler() # we define the feature extractor providing the model extractor = FeatureExtractor(feature_extractor=feature_extractor, model=model, scale=scale, out_dim=args.output_dim) # we fit the KMeans clustering model extractor.fit_model(training_paths) extractor.fit_scaler(training_paths) # now we can use features # we get query features query_features = extractor.extract_features(query_paths) query_features = extractor.scale_features(query_features) # we get gallery features gallery_features = extractor.extract_features(gallery_paths) gallery_features = extractor.scale_features(gallery_features) print(gallery_features.shape, query_features.shape) pairwise_dist = spatial.distance.cdist(query_features, gallery_features, 'minkowski', p=2.) print('--> Computed distances and got c-dist {}'.format(pairwise_dist.shape)) indices = np.argsort(pairwise_dist, axis=-1) else: indices = np.random.randint(len(gallery_paths), size=(len(query_paths), len(gallery_paths))) gallery_matches = gallery_classes[indices] print('########## RESULTS ##########') for k in [1, 3, 10]: topk_acc = topk_accuracy(query_classes, gallery_matches, k) print('--> Top-{:d} Accuracy: {:.3f}'.format(k, topk_acc)) if __name__ == '__main__': main()
[ 11748, 28686, 198, 11748, 269, 85, 17, 198, 6738, 1341, 35720, 13, 565, 5819, 1330, 509, 5308, 504, 11, 360, 4462, 44565, 11, 12558, 33, 963, 42, 5308, 504, 198, 6738, 629, 541, 88, 1330, 21739, 198, 6738, 1341, 35720, 13, 3866, 369...
2.237354
1,799
""" Prepare training, validation, and testing data after preprocessing of the large dataset. Used in training and evaluating models. """ import numpy as np import pandas as pd from sklearn.model_selection import train_test_split def feature_selection(data, features): """ Choose which features to use for training. :param data: preprocessed dataset :param features: list of features to use :return: data with selected features """ return data[features] def prepare_data(data, label="loan_status", valid_split=0.2, test_split=0.3): """ Splits and returns the training and validation sets for the data. :param data: preprocessed dataset :param label: label of data :param valid_split: percentage to use as validation data :param test_split: percentage to use as test data :returns: training, validation, testing sets """ X_train = data.drop(label, axis=1) # define training features set y_train = data[label] # define training label set # use part of the data as testing data X_train, X_test, y_train, y_test = train_test_split(X_train, y_train, test_size=test_split, random_state=0) # use part of the training data as validation data X_train, X_valid, y_train, y_valid = train_test_split(X_train, y_train, test_size=valid_split, random_state=0) return X_train, X_valid, X_test, y_train, y_valid, y_test
[ 37811, 198, 37534, 533, 3047, 11, 21201, 11, 290, 4856, 1366, 706, 662, 36948, 286, 262, 1588, 27039, 13, 16718, 287, 198, 34409, 290, 22232, 4981, 13, 198, 37811, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 19798, 292, 355, 279, ...
3.061269
457
#!/usr/bin/env python ############################################################### # \package CyberRadioDriver.radio # # \brief Defines basic functionality for radio handler objects. # # \note This module defines basic behavior only. To customize # a radio handler class for a particular radio, derive a new # class from the appropriate base class. It is recommended # that behavior specific to a given radio be placed in the # module that supports that radio. # # \author NH # \author DA # \author MN # \copyright Copyright (c) 2014-2021 CyberRadio Solutions, Inc. # All rights reserved. # ############################################################### # Imports from other modules in this package from . import command from . import components from . import configKeys from . import log from . import transport # Imports from external modules # Python standard library imports import ast import copy import datetime import json import math import sys import time import traceback import threading ## # \internal # \brief Returns the MAC address and IP address for a given Ethernet interface. # # \param ifname The name of t# \author DA # \param ifname The Ethernet system interface ("eth0", for example). # \returns A 2-tuple: (MAC Address, IP Address). ## # \internal # \brief VITA 49 interface specification class. # # The _ifSpec class describes how the VITA 49 interface is set up for # a particular radio. Each radio should have its own interface # specification, implemented as a subclass of _ifSpec. # # Radio handler classes need to set static member "ifSpec" to the interface # specification class that the radio uses. #-- Radio Handler Objects ---------------------------------------------# ## # \brief Base radio handler class. # # This class implements the CyberRadioDriver.IRadio interface. # # To add a supported radio to this driver, derive a class from # _radio and change the static members of the new class to describe the # capabilities of that particular radio. Each supported radio should # have its own module under the CyberRadioDriver.radios package tree. # # A radio handler object maintains a series of component objects, one # per component of each type (tuner, WBDDC, NBDDC, etc.). Each component # object is responsible for managing the hardware object that it represents. # Each component object is also responsible for querying the component's # current configuration and for maintaining the object's configuration # as it changes during radio operation. # # A radio handler object also maintains its own configuration, for settings # that occur at the radio level and are not managed by a component object. # # \note Several static members of this class have no function within the # code, but instead help CyberRadioDriver.getRadioObjectDocstring() generate # appropriate documentation for derived radio handler classes. # # \implements CyberRadioDriver::IRadio ## # \brief Gets the pulse-per-second (PPS) rising edge from the radio. # # \copydetails CyberRadioDriver::IRadio::getPps() def getPps(self): if self.ppsCmd is not None: cmd = command.pps(parent=self,query=True, verbose=self.verbose, logFile=self.logFile) cmd.send(self.sendCommand, timeout=cmd.timeout) return cmd.success else: return False ## # \brief Sets the time for the next PPS rising edge on the radio. # # \copydetails CyberRadioDriver::IRadio::setTimeNextPps() ## # \brief Gets the current radio time. # # \copydetails CyberRadioDriver::IRadio::getTimeNow() ## # \brief Gets the time for the next PPS rising edge on the radio. # # \copydetails CyberRadioDriver::IRadio::getTimeNextPps() ## # \brief Gets the status from the radio. # # \copydetails CyberRadioDriver::IRadio::getStatus() ## # \brief Gets the RF tuner status from the radio. # # \copydetails CyberRadioDriver::IRadio::getTstatus() ## # \brief Sets the reference mode on the radio. # # \copydetails CyberRadioDriver::IRadio::setReferenceMode() ## # \brief Sets the reference bypass mode on the radio. # # \copydetails CyberRadioDriver::IRadio::setBypassMode() ## # \brief Sets the time adjustment for tuners on the radio. # # \copydetails CyberRadioDriver::IRadio::setTimeAdjustment() ## # \brief Sets the calibration frequency on the radio. # # \copydetails CyberRadioDriver::IRadio::setCalibrationFrequency() ## # \brief Gets the current GPS position. # # \copydetails CyberRadioDriver::IRadio::getGpsPosition() ## # \brief Gets the current radio temperature. # # \copydetails CyberRadioDriver::IRadio::getTemperature() ## # \brief Gets the current GPIO output bits. # # \copydetails CyberRadioDriver::IRadio::getGpioOutput() ## # \brief Gets the GPIO output settings for a given sequence index. # # \copydetails CyberRadioDriver::IRadio::getGpioOutputByIndex() ## # \brief Sets the current GPIO output bits. # # \copydetails CyberRadioDriver::IRadio::setGpioOutput() ## # \brief Sets the GPIO output settings for a given sequence index. # # \copydetails CyberRadioDriver::IRadio::setGpioOutputByIndex() ## # \brief Gets the current bandwith of the given tuner. # \copydetails CyberRadioDriver::IRadio::getTunerBandwidth() ## # \brief Gets the name of the radio. # # \copydetails CyberRadioDriver::IRadio::getName() ## # \brief Gets the number of tuners on the radio. # # \copydetails CyberRadioDriver::IRadio::getNumTuner() ## # \brief Gets the number of tuner boards on the radio. # # \copydetails CyberRadioDriver::IRadio::getNumTunerBoards() ## # \brief Gets the index range for the tuners on the radio. # # \copydetails CyberRadioDriver::IRadio::getTunerIndexRange() ## # \brief Gets the frequency range for the tuners on the radio. # # \copydetails CyberRadioDriver::IRadio::getTunerFrequencyRange() ## # \brief Gets the frequency resolution for tuners on the radio. # # \copydetails CyberRadioDriver::IRadio::getTunerFrequencyRes() ## # \brief Gets the frequency unit for tuners on the radio. # # \copydetails CyberRadioDriver::IRadio::getTunerFrequencyUnit() ## # \brief Gets the attenuation range for the tuners on the radio. # # \copydetails CyberRadioDriver::IRadio::getTunerAttenuationRange() ## # \brief Gets the attenuation resolution for tuners on the radio. # # \copydetails CyberRadioDriver::IRadio::getTunerAttenuationRes() ## # \brief Gets the ifFilter list for the tuners of the radio # # \copydetails CyberRadioDriver::IRadio::getTunerIfFilterList() ## # \brief Gets whether or not the radio supports setting tuner # bandwidth # # \copydetails CyberRadioDriver::IRadio::isTunerBandwidthSettable() ## # \brief Gets the number of wideband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getNumWbddc() ## # \brief Gets whether the DDCs on the radio have selectable sources. # # \copydetails CyberRadioDriver::IRadio::isDdcSelectableSource() ## # \brief Gets whether the wideband or narrowband DDCs on the radio are tunable. # # \copydetails CyberRadioDriver::IRadio::isNbddcTunable() ## # \brief Gets the index range for the wideband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbddcIndexRange() ## # \brief Gets whether the wideband DDCs on the radio are tunable. # # \copydetails CyberRadioDriver::IRadio::isWbddcSelectableSource() ## # \brief Gets whether the wideband DDCs on the radio have selectable # sources. # # \copydetails CyberRadioDriver::IRadio::isWbddcTunable() ## # \brief Gets the frequency offset range for the wideband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbddcFrequencyRange() ## # \brief Gets the frequency offset resolution for wideband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbddcFrequencyRes() ## # \brief Gets the allowed rate set for the wideband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbddcRateSet() ## # \brief Gets the allowed rate list for the wideband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbddcRateList() ## # \brief Gets the allowed rate set for the wideband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbddcBwSet() ## # \brief Gets the allowed rate list for the wideband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbddcBwList() ## # \brief Gets the number of narrowband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getNumNbddc() ## # \brief Gets the index range for the narrowband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getNbddcIndexRange() ## # \brief Gets whether the narrowband DDCs on the radio are tunable. # # \copydetails CyberRadioDriver::IRadio::isNbddcTunable() ## # \brief Gets whether the narrowband DDCs on the radio have selectable # sources. # # \copydetails CyberRadioDriver::IRadio::isNbddcSelectableSource() ## # \brief Gets the frequency offset range for the narrowband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getNbddcFrequencyRange() ## # \brief Gets the frequency offset resolution for narrowband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getNbddcFrequencyRes() ## # \brief Gets the allowed rate set for the narrowband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getNbddcRateSet() ## # \brief Gets the allowed rate list for the narrowband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getNbddcRateList() ## # \brief Gets the allowed rate set for the narrowband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getNbddcBwSet() ## # \brief Gets the allowed rate list for the narrowband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getNbddcBwList() ## # \brief Gets the number of narrowband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getNumFftStream() ## # \brief Gets the index range for the narrowband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getFftStreamIndexRange() ## # \brief Gets the allowed rate set for the FFTs on the radio. # # \copydetails CyberRadioDriver::IRadio::getFftStreamRateSet() ## # \brief Gets the allowed rate list for the FFTs on the radio. # # \copydetails CyberRadioDriver::IRadio::getFftStreamRateList() ## # \brief Gets the allowed window set for the FFTs on the radio. # # \copydetails CyberRadioDriver::IRadio::getFftStreamWindowSet() ## # \brief Gets the allowed window list for the FFTs on the radio. # # \copydetails CyberRadioDriver::IRadio::getFftStreamWindowList() ## # \brief Gets the allowed size set for the FFTs on the radio. # # \copydetails CyberRadioDriver::IRadio::getFftStreamSizeSet() ## # \brief Gets the allowed size list for the FFTs on the radio. # # \copydetails CyberRadioDriver::IRadio::getFftStreamSizeList() ## # \brief Gets the ADC sample rate for the radio. # # \copydetails CyberRadioDriver::IRadio::getAdcRate() ## # \brief Gets the VITA 49 header size for the radio. # # \copydetails CyberRadioDriver::IRadio::getVitaHeaderSize() ## # \brief Gets the VITA 49 payload size for the radio. # # \copydetails CyberRadioDriver::IRadio::getVitaPayloadSize() ## # \brief Gets the VITA 49 tail size for the radio. # # \copydetails CyberRadioDriver::IRadio::getVitaTailSize() ## # \brief Gets dictionary with information about VITA 49 framing. # # \copydetails CyberRadioDriver::IRadio::getVitaFrameInfoDict() # \brief Gets whether data coming from the radio is byte-swapped with # respect to the endianness of the host operating system. # # \copydetails CyberRadioDriver::IRadio::isByteswapped() ## # \brief Gets whether data coming from the radio has I and Q data swapped. # # \copydetails CyberRadioDriver::IRadio::isIqSwapped() ## # \brief Gets the byte order for data coming from the radio. # # \copydetails CyberRadioDriver::IRadio::getByteOrder() ## # \brief Gets the number of Gigabit Ethernet interfaces on the radio. # # \copydetails CyberRadioDriver::IRadio::getNumGigE() ## # \brief Gets the index range for the Gigabit Ethernet interfaces on the radio. # # \copydetails CyberRadioDriver::IRadio::getGigEIndexRange() ## # \brief Gets the number of destination IP address table entries available for # each Gigabit Ethernet interface on the radio. # # \copydetails CyberRadioDriver::IRadio::getNumGigEDipEntries() ## # \brief Gets the index range for the destination IP address table entries # available for the Gigabit Ethernet interfaces on the radio. # # \copydetails CyberRadioDriver::IRadio::getGigEDipEntryIndexRange() ## # \brief Gets the list of connection modes that the radio supports. # # \copydetails CyberRadioDriver::IRadio::getConnectionModeList() ## # \brief Gets whether the radio supports a given connection mode. # # \copydetails CyberRadioDriver::IRadio::isConnectionModeSupported() ## # \brief Gets the radio's default baud rate. # # \copydetails CyberRadioDriver::IRadio::getDefaultBaudrate() ## # \brief Gets the radio's default control port. # # \copydetails CyberRadioDriver::IRadio::getDefaultControlPort() ## # \brief Gets the allowed VITA enable options set for the radio. # # \copydetails CyberRadioDriver::IRadio::getVitaEnableOptionSet() ## # \brief Gets the number of transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getNumTransmitters() ## # \brief Gets the index range for the transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterIndexRange() ## # \brief Gets the frequency range for the transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterFrequencyRange() ## # \brief Gets the frequency resolution for transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterFrequencyRes() ## # \brief Gets the frequency unit for transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterFrequencyUnit() ## # \brief Gets the attenuation range for the transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterAttenuationRange() ## # \brief Gets the attenuation resolution for transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterAttenuationRes() ## # \brief Gets whether transmitters on the radio support continuous-wave # (CW) tone generation. # # \copydetails CyberRadioDriver::IRadio::transmitterSupportsCW() ## # \brief Gets the number of CW tone generators for each transmitter. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWNum() ## # \brief Gets the CW tone generator index range for transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWIndexRange() ## # \brief Gets the CW tone generator frequency range for transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWFrequencyRange() ## # \brief Gets the CW tone generator frequency resolution for transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWFrequencyRes() ## # \brief Gets the CW tone generator amplitude range for transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWAmplitudeRange() ## # \brief Gets the CW tone generator amplitude resolution for transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWAmplitudeRes() ## # \brief Gets the CW tone generator phase range for transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWPhaseRange() ## # \brief Gets the CW tone generator phase resolution for transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWPhaseRes() ## # \brief Gets whether transmitters on the radio support sweep functions # during continuous-wave (CW) tone generation. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWPhaseRes() ## # \brief Gets the CW tone generator sweep start frequency range for # transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWSweepStartRange() ## # \brief Gets the CW tone generator sweep start frequency resolution for # transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWSweepStartRes() ## # \brief Gets the CW tone generator sweep stop frequency range for # transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWSweepStopRange() ## # \brief Gets the CW tone generator sweep stop frequency resolution for # transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWSweepStopRes() ## # \brief Gets the CW tone generator sweep step frequency range for # transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWSweepStepRange() ## # \brief Gets the CW tone generator sweep step frequency resolution for # transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWSweepStepRes() ## # \brief Gets the CW tone generator sweep dwell time range for # transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWSweepDwellRange() ## # \brief Gets the CW tone generator sweep dwell time resolution for # transmitters on the radio. # # \copydetails CyberRadioDriver::IRadio::getTransmitterCWSweepDwellRes() ## # \brief Gets the number of wideband DUCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getNumWbduc() ## # \brief Gets the index range for the wideband DUCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbducIndexRange() ## # \brief Gets the frequency offset range for the wideband DUCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbducFrequencyRange() ## # \brief Gets the frequency resolution for wideband DUCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbducFrequencyRes() ## # \brief Gets the frequency unit for wideband DUCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbducFrequencyUnit() ## # \brief Gets the attenuation range for the wideband DUCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbducAttenuationRange() ## # \brief Gets the attenuation resolution for wideband DUCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbducAttenuationRes() ## # \brief Gets the allowed rate set for the wideband DUCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbducRateSet() ## # \brief Gets the allowed rate list for the wideband DUCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbducRateList() ## # \brief Gets whether or not the wideband DUCs on the radio support loading # sample snapshots. # # \copydetails CyberRadioDriver::IRadio::wbducSupportsSnapshotLoad() ## # \brief Gets whether or not the wideband DUCs on the radio support # transmitting sample snapshots. # # \copydetails CyberRadioDriver::IRadio::wbducSupportsSnapshotTransmit() ## # \brief Gets the index range for the DDC groups on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbddcGroupIndexRange() ## # \brief Gets the number of wideband DDC groups on the radio. # \copydetails CyberRadioDriver::IRadio::getNumWbddcGroups() ## # \brief Gets the index range for the wideband DDC groups on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbddcGroupIndexRange() ## # \brief Gets the number of narrowband DDC groups on the radio. # \copydetails CyberRadioDriver::IRadio::getNumNbddcGroups() ## # \brief Gets the index range for the narrowband DDC groups on the radio. # # \copydetails CyberRadioDriver::IRadio::getNbddcGroupIndexRange() ## # \brief Gets the number of combined DDC groups on the radio. # \copydetails CyberRadioDriver::IRadio::getNumCombinedDdcGroups() ## # \brief Gets the index range for the combined DDC groups on the radio. # # \copydetails CyberRadioDriver::IRadio::getCombinedDdcGroupIndexRange() ## # \brief Gets the number of wideband DUC groups on the radio. # # \copydetails CyberRadioDriver::IRadio::getNumWbducGroups() ## # \brief Gets the index range for the wideband DUC groups on the radio. # # \copydetails CyberRadioDriver::IRadio::getWbducGroupIndexRange() # ------------- Deprecated/Helper Methods ----------------- # ## # \internal # \brief Define this object's string representation. def __str__(self): return self.name ## # \internal # \brief Helper function that returns an index list. def _getIndexList(self,objIndex,objDict): if objIndex is None: return list(objDict.keys()) elif type(objIndex) is int: return [objIndex,] if objIndex in list(objDict.keys()) else [] elif type(objIndex) is list: return [i for i in objIndex if i in list(objDict.keys())] else: return [] ## # \internal # \brief Helper function that "normalizes" an input configuration dictionary # section by doing the following: # <ul> # <li> Ensuring that keys for any enumerated entries are integers # <li> Expanding sub-dictionaries with the special "all" key # <li> Performing specialization for individual entries # # \param configDict The incoming configuration dictionary. # \param entryIndexList The list of entry indices (used in expanding "all" keys). # \return The new configuration dictionary. ## # \internal # \brief Helper function that "normalizes" an input configuration dictionary # by doing the following: # <ul> # <li> Ensuring that keys for component enumerations are integers # <li> Expanding sub-dictionaries with the special "all" key # <li> Performing specialization for individual components or entries # \param configDict The incoming configuration dictionary. # \return The new configuration dictionary. ## # \brief Gets the radio configuration. # # \deprecated Use getConfiguration() instead. # # \return The dictionary of radio settings. ## # \internal # \brief Helper function for setting the tuner configuration. # # Deprecated in favor of setConfiguration(). ## # \internal # \brief Helper function for getting the tuner configuration. # # Deprecated in favor of getConfiguration(). ## # \internal # \brief Helper function for querying the tuner configuration. # # Deprecated in favor of queryConfiguration(). ## # \internal # \brief Helper function for setting the DDC configuration. # # Deprecated in favor of setConfiguration(). ## # \internal # \brief Helper function for getting the DDC configuration. # # Deprecated in favor of getConfiguration(). ## # \internal # \brief Helper function for querying the DDC configuration. # # Deprecated in favor of queryConfiguration(). ## # \internal # \brief Helper function for setting the IP configuration. # # Deprecated in favor of setConfiguration(). ## # \internal # \brief Helper function for querying the IP configuration. # \param gigEPortIndex 10-Gig data port index, or None to query all data ports. ## # \internal # \brief Helper function for querying the IP configuration for radios without # 10-Gig Ethernet interfaces. ## # \internal # \brief Helper function for querying the IP configuration for radios with # 10-Gig Ethernet interfaces. # \param gigEPortIndex 10-Gig data port index, or None to query all data ports. ## # \internal # \brief Helper function for setting the transmitter configuration. # # Deprecated in favor of setConfiguration(). ## # \internal # \brief Helper function for getting the transmitter configuration. # # Deprecated in favor of getConfiguration(). ## # \internal # \brief Helper function for querying the transmitter configuration. # # Deprecated in favor of getConfiguration(). ## # \internal # \brief Helper function for setting the DUC configuration. # # Deprecated in favor of setConfiguration(). ## # \internal # \brief Helper function for getting the DUC configuration. # # Deprecated in favor of getConfiguration(). ## # \internal # \brief Helper function for querying the DUC configuration. # # Deprecated in favor of getConfiguration(). ## # \internal # \brief Helper function for getting the DDC group configuration. # # Deprecated in favor of getConfiguration(). ## # \internal # \brief Helper function for querying the DDC group configuration. # # Deprecated in favor of queryConfiguration(). ## # \internal # \brief Helper function for setting the DDC group configuration. # # Deprecated in favor of setConfiguration(). ## # \internal # \brief Helper function for getting the combined DDC group configuration. # # Deprecated in favor of getConfiguration(). ## # \internal # \brief Helper function for querying the combined DDC group configuration. # # Deprecated in favor of queryConfiguration(). ## # \internal # \brief Helper function for setting the combined DDC group configuration. # # Deprecated in favor of setConfiguration(). ## # \internal # \brief Helper function for getting the DUC group configuration. # # Deprecated in favor of getConfiguration(). ## # \internal # \brief Helper function for querying the DUC group configuration. # # Deprecated in favor of queryConfiguration(). ## # \internal # \brief Helper function for setting the DUC group configuration. # # Deprecated in favor of setConfiguration(). ## # \internal # \brief Helper function for getting the tuner group configuration. # # Deprecated in favor of getConfiguration(). ## # \internal # \brief Helper function for querying the tuner group configuration. # # Deprecated in favor of queryConfiguration(). ## # \internal # \brief Helper function for setting the tuner group configuration. # # Deprecated in favor of setConfiguration(). ## # \internal # \brief Helper function for setting the FFT stream configuration. # # Deprecated in favor of setConfiguration(). # ## # \internal # \brief Helper function for getting the FFT stream configuration. # # Deprecated in favor of getConfiguration(). ## # \internal # \brief Helper function for querying the FFT stream configuration. # # Deprecated in favor of queryConfiguration(). ## # \internal # \brief Helper function for configuring the IP addresses. ## # \brief Gets the number of DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getNumDdc() ## # \brief Gets the allowed rate set for the DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getDdcRateSet() ## # \brief Gets the allowed rate list for the DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getDdcRateList() ## # \brief Gets the allowed bandwidth set for the DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getDdcBwSet() ## # \brief Gets the allowed bandwidth list for the DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getDdcBwList() ## # \brief Gets the set of available DDC data formats. # # \copydetails CyberRadioDriver::IRadio::getDdcDataFormat() ## # \brief Gets the frequency offset range for the narrowband DDCs on the radio. # # \copydetails CyberRadioDriver::IRadio::getNbddcFrequencyRange() ## # \brief Gets the list of DDC indexes for a specified type. # # \copydetails CyberRadioDriver::IRadio::getDdcIndexRange() ## # \internal # \brief Convenience method for configuring the Ethernet addresses on a radio that does not # have Gigabit Ethernet ports. # # \param sip The source IP address. If this is None, the source IP address will not # be changed. # \param dip The destination IP address. If this is None, the destination IP address # will not be changed. # \param dmac The destination MAC address. If this is None, the destination MAC address # will not be changed. # \return True if the configuration succeeded, False otherwise. def setIpConfiguration(self, sip=None, dip=None, dmac=None): configDict = { configKeys.CONFIG_IP: { } } if sip is not None: configDict[configKeys.CONFIG_IP][configKeys.IP_SOURCE] = copy.deepcopy(sip) if dip is not None: configDict[configKeys.CONFIG_IP][configKeys.IP_DEST] = copy.deepcopy(dip) if dmac is not None: configDict[configKeys.CONFIG_IP][configKeys.MAC_DEST] = copy.deepcopy(dmac) return self._setConfiguration(configDict) ## # \internal ## # \internal # \brief Sets tuner configuration (old-style). # # \deprecated Use setConfiguration() instead. # # \param frequency Tuner frequency. # \param attenuation Tuner attenuation. # \param tunerIndex Either None (configure all tuners), an index number (configure # a specific tuner), or a list of index numbers (configure a set of tuners). # \return True if successful, False otherwise. ## # \internal # \brief Gets tuner configuration (old-style). # # \deprecated Use getConfiguration() instead. # # \param tunerIndex Either None (get for all tuners), an index number (get for # a specific tuner), or a list of index numbers (get for a set of tuners). # \return A dictionary with configuration information. ## # \internal # \brief Sets tuner frequency (old-style). # # \deprecated Use setConfiguration() instead. # # \param frequency Tuner frequency. # \param tunerIndex Either None (configure all tuners), an index number (configure # a specific tuner), or a list of index numbers (configure a set of tuners). # \return True if successful, False otherwise. ## # \internal # \brief Gets tuner frequency information (old-style). # # \deprecated Use getConfiguration() instead. # # \param tunerIndex Either None (get for all tuners), an index number (get for # a specific tuner), or a list of index numbers (get for a set of tuners). # \return A dictionary with frequency information. ## # \internal # \brief Sets tuner attenuation (old-style). # # \deprecated Use setConfiguration() instead. # # \param attenuation Tuner attenuation. # \param tunerIndex Either None (configure all tuners), an index number (configure # a specific tuner), or a list of index numbers (configure a set of tuners). # \return True if successful, False otherwise. ## # \internal # \brief Gets tuner attenuation information (old-style). # # \deprecated Use getConfiguration() instead. # # \param tunerIndex Either None (get for all tuners), an index number (get for # a specific tuner), or a list of index numbers (get for a set of tuners). # \return A dictionary with attenuation information. ## # \internal # \brief Sets DDC configuration (old-style). # # \deprecated Use setConfiguration() instead. # # \param wideband Whether the DDC is a wideband DDC. # \param ddcIndex Either None (configure all DDCs), an index number (configure # a specific DDC), or a list of index numbers (configure a set of DDCs). # \param rfIndex DDC RF index number. # \param rateIndex DDC rate index number. # \param udpDest UDP destination. # \param frequency Frequency offset. # \param enable 1 if DDC is enabled, 0 if not. # \param vitaEnable VITA 49 streaming option, as appropriate for the radio. # \param streamId VITA 49 stream ID. # \return True if successful, False otherwise. ## # \brief Disables ethernet flow control on the radio. # # \copydetails CyberRadioDriver::IRadio::disableTenGigFlowControl() ## # \brief Enables ethernet flow control on the radio. # # \copydetails CyberRadioDriver::IRadio::enableTenGigFlowControl() ## # \brief method to enable or disable ethernet flow control on the radio. # # \copydetails CyberRadioDriver::IRadio::getTenGigFlowControlStatus() ## # \brief Queries status of flow control handling. # # \copydetails CyberRadioDriver::IRadio::getTenGigFlowControlStatus() ## # \brief Performs coherent tuning. # # \copydetails CyberRadioDriver::IRadio::coherentTune() ## # \brief Gets the current FPGA state. # # \copydetails CyberRadioDriver::IRadio::getFpgaState() ## # \brief Sets the current FPGA state. # # \copydetails CyberRadioDriver::IRadio::setFpgaState() # OVERRIDE ## # \brief Sets whether or not the object is in verbose mode. # # \copydetails CyberRadioDriver::IRadio::setVerbose() ## # \brief Sets the log file. # # \copydetails CyberRadioDriver::IRadio::setLogFile() ## # \brief Gets the list of connected data port interface indices. # # \copydetails CyberRadioDriver::IRadio::getConnectedDataPorts() ## # \internal # \brief Converts a user-specified time string into a number of seconds # since 1/1/70. # # The time string can be either: # \li Absolute time, in any supported format # \li Relative time specified as now{-n}, where n is a number of seconds # \li Relative time specified as now{-[[H:]MM:]SS} # \li "begin", which is the beginning of known time (1/1/70) # \li "end", which is the end of trackable time and far beyond the # useful life of this utility (01/18/2038) # # \throws RuntimeException if the time string format cannot be understood. # \param timestr The time string. # \param utc Whether or not the user's time string is in UTC time. # \return The time, in number of seconds since the Epoch ## # Converts a time string ([+-][[H:]M:]S) to a time in seconds. # # \note Hours and minutes are not bounded in any way. These strings provide the # same result: # \li "7200" # \li "120:00" # \li "2:00:00" # # \throws RuntimeError if the time is formatted improperly. # \param timeStr The time string. # \return The number of seconds. ## # \internal # \brief Radio handler class that supports nothing more complicated than # identifying a connected radio. # # Used internally to support radio auto-detection. # # This class implements the CyberRadioDriver.IRadio interface. # ## # \brief Radio function (mode) command used by JSON-based radios. # ## # \internal # \brief Radio handler class that supports nothing more complicated than # identifying a connected radio. # # Used internally to support radio auto-detection. # # This class implements the CyberRadioDriver.IRadio interface. # #-- End Radio Handler Objects --------------------------------------------------# #-- NOTE: Radio handler objects for supporting specific radios need to be # implemented under the CyberRadioDriver.radios package tree.
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 29113, 14468, 7804, 4242, 21017, 198, 2, 3467, 26495, 15101, 26093, 32103, 13, 37004, 198, 2, 220, 198, 2, 3467, 65, 3796, 2896, 1127, 4096, 11244, 329, 5243, 21360, 5563, 13, 198, 2, ...
2.740954
13,874
from typing import List, Tuple import numpy as np from alpha_zero.Board import Board
[ 6738, 19720, 1330, 7343, 11, 309, 29291, 198, 198, 11748, 299, 32152, 355, 45941, 198, 198, 6738, 17130, 62, 22570, 13, 29828, 1330, 5926, 628 ]
3.52
25
""" Project : bugaboo Filename : forms.py Author : zhancongc Description : """ from flask_wtf import FlaskForm from wtforms import StringField, BooleanField, TextAreaField, SelectField, FileField, IntegerField, PasswordField, SubmitField from wtforms.validators import DataRequired
[ 37811, 198, 16775, 220, 220, 220, 220, 1058, 5434, 397, 2238, 198, 35063, 220, 220, 220, 1058, 5107, 13, 9078, 198, 13838, 220, 220, 220, 220, 220, 1058, 1976, 71, 1192, 506, 66, 198, 11828, 1058, 220, 198, 37811, 198, 198, 6738, 42...
3.212766
94
import pandas as pd import numpy as np from tqdm import tqdm
[ 11748, 19798, 292, 355, 279, 67, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 256, 80, 36020, 1330, 256, 80, 36020, 628 ]
2.818182
22
from django.shortcuts import render from django.utils import timezone from todo.models import Todo from django.http import HttpResponseRedirect
[ 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 198, 6738, 42625, 14208, 13, 26791, 1330, 640, 11340, 198, 6738, 284, 4598, 13, 27530, 1330, 309, 24313, 198, 6738, 42625, 14208, 13, 4023, 1330, 367, 29281, 31077, 7738, 1060, 198 ]
3.692308
39
import random category = ['python', 'java', 'kotlin', 'javascript'] computer = random.choice(category) hidden = list(len(computer) * "-") print("H A N G M A N") counter = 8 while counter > 0: print() print("".join(hidden)) letter = input("Input a letter: ") if (letter in hidden) or (letter in hidden and times == 7): counter -= 1 print("No improvements") elif letter in set(computer): where = 0 for i in range(computer.count(letter)): where = computer.index(letter, 0 + where) hidden[where] = letter where += where + 1 if "-" not in hidden: print() print("".join(hidden)) print("You guessed the word!") print("You survived!") break else: counter -= 1 print("No such letter in the word") print(counter) else: print("You are hanged!")
[ 11748, 4738, 201, 198, 201, 198, 22872, 796, 37250, 29412, 3256, 705, 12355, 3256, 705, 74, 313, 2815, 3256, 705, 37495, 20520, 201, 198, 33215, 796, 4738, 13, 25541, 7, 22872, 8, 201, 198, 30342, 796, 1351, 7, 11925, 7, 33215, 8, 1...
2.590476
315
# -*- coding: utf-8 -*- """ task """ __author__ = "XuWeitao" import CommonUtilities import rawSql def getTasksList(UserID): """ :param UserID:IDALL :return:{ "SerialNo":, "CreateTime":, "LastModifiedTime":, "ProductNo":, "ColorNo":, "ArriveTime":, "Name":, "GongYingShang":{"id":, "name":}, "WuLiao":{"id":ID, "name":, "cata":}, "DaoLiaoZongShu":, "DanWei":{"id":ID, "name":} "DaoLiaoZongShu2":, "DanWei":{"id":ID, "name":}, "XieZuoRen": } """ raw = rawSql.Raw_sql() raw.sql = """SELECT SerialNo, CONVERT(VARCHAR(16), CreateTime, 20) CreateTime, CONVERT(VARCHAR(16), LastModifiedTime, 20) LastModifiedTime, ProductNo, ColorNo, CONVERT(VARCHAR(10), ArriveTime, 20) ArriveTime, dbo.getUserNameByUserID(UserID), SupplierID, dbo.getSupplierNameByID(SupplierID), MaterialID, dbo.getMaterialNameByID(MaterialID), dbo.getMaterialTypeNameByID(dbo.getMaterialTypeIDByMaterialID(MaterialID)), DaoLiaoZongShu, UnitID, dbo.getUnitNameByID(UnitID), DaoLiaoZongShu2, UnitID2, dbo.getUnitNameByID(UnitID2) AS DanWei2, Inspectors, UserID FROM RMI_TASK WITH(NOLOCK)""" # if UserID != 'ALL': raw.sql += " WHERE CHARINDEX('%s', Inspectors) > 0 AND State = 2" % UserID else: raw.sql += " WHERE State = 0" res = raw.query_all() jsonReturn = list() for row in res: #@ Inspectors = row[18].split('@') InspectorList = list() for inspectorNo in Inspectors: if inspectorNo == row[19]: continue raw.sql = "SELECT DBO.getUserNameByUserID('%s')"%inspectorNo inspectorName = raw.query_one() if inspectorName: inspectorName = inspectorName[0] InspectorList.append({'Name':inspectorName, 'ID':inspectorNo}) jsonReturn.append({ "SerialNo":row[0], "CreateTime":row[1], "LastModifiedTime":row[2], "ProductNo":row[3], "ColorNo":row[4], "ArriveTime":row[5], "Name":row[6], "GongYingShang":{"id":row[7], "name":row[8]}, "WuLiao":{"id":row[9], "name":row[10], "cata":row[11]}, "DaoLiaoZongShu":row[12], "DanWei":{"id":row[13], "name":row[14]}, "DaoLiaoZongShu2":row[15], "DanWei2":{"id":row[16], "name":row[17]}, "XieZuoRen":InspectorList }) return jsonReturn def editTaskInfo(taskInfo, userID): """ isNew :param taskInfo: :param userID:ID :return: """ raw = rawSql.Raw_sql() # if "isReturn" in taskInfo: raw.sql = "UPDATE RMI_TASK WITH(ROWLOCK) SET State = 2 WHERE SerialNo = '%s'"%taskInfo['SerialNo'] raw.update() else: isNew = True if taskInfo['isNew'] == "True" else False #NonenullJSONNone taskInfo['DaoLiaoZongShu2'] = False if 'DaoLiaoZongShu2' not in taskInfo else taskInfo['DaoLiaoZongShu2'] taskInfo['DanWei2'] = {'id':None} if 'DanWei2' not in taskInfo else taskInfo['DanWei2'] #ID if 'XieZuoRen' in taskInfo: taskInfo['XieZuoRen'].append({'ID':userID}) taskInfo['Inspectors'] = "@".join([User['ID'] for User in taskInfo['XieZuoRen']]) else: taskInfo['Inspectors'] = userID if isNew: raw.sql = """INSERT INTO RMI_TASK WITH(ROWLOCK) (CreateTime, LastModifiedTime, ProductNo, ColorNo, ArriveTime, UserID, FlowID, MaterialID, SupplierID, UnitID, DaoLiaoZongShu, DaoLiaoZongShu2, UnitID2, Inspectors) VALUES ( getdate(), getdate(),'%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %s, %s, '%s' );""" % ( taskInfo['ProductNo'], taskInfo['ColorNo'], taskInfo['ArriveTime'][:10], userID, taskInfo['FlowID'], taskInfo['WuLiao']['id'], taskInfo['GongYingShang']['id'], taskInfo['DanWei']['id'], taskInfo['DaoLiaoZongShu'], "'"+unicode(taskInfo['DaoLiaoZongShu2'])+"'" if taskInfo['DaoLiaoZongShu2'] else "NULL", "'"+unicode(taskInfo['DanWei2']['id'])+"'" if taskInfo['DanWei2']['id'] else "NULL", taskInfo['Inspectors'] ) raw.update() # raw.sql = "SELECT TOP 1 SerialNo FROM RMI_TASK WHERE UserID = '%s' AND State = 2 ORDER BY CreateTime desc"%userID return raw.query_one()[0] else: raw.sql = """UPDATE RMI_TASK WITH(ROWLOCK) SET MaterialID = '%s',SupplierID = '%s', UnitID = '%s', DaoLiaoZongShu = '%s', ProductNo = '%s', ColorNo = '%s', ArriveTime = '%s', DaoLiaoZongShu2 = %s, UnitID2 = %s, Inspectors = '%s' WHERE SerialNo = '%s'""" % ( taskInfo['WuLiao']['id'], taskInfo['GongYingShang']['id'], taskInfo['DanWei']['id'], taskInfo['DaoLiaoZongShu'], taskInfo['ProductNo'], taskInfo['ColorNo'], taskInfo['ArriveTime'][:10].replace('-',''), "'"+unicode(taskInfo['DaoLiaoZongShu2'])+"'" if taskInfo['DaoLiaoZongShu2'] else "NULL", "'"+unicode(taskInfo['DanWei2']['id'])+"'" if taskInfo['DanWei2']['id'] else "NULL", taskInfo['Inspectors'], taskInfo['SerialNo']) raw.update() def getFlowList(): """ :return:{"name":FlowName,"value":FlowID} """ raw = rawSql.Raw_sql() raw.sql = "SELECT FlowID AS value, FlowName AS name FROM RMI_WORK_FLOW WITH(NOLOCK)" res, columns = raw.query_all(needColumnName=True) return CommonUtilities.translateQueryResIntoDict(columns, res) def commitTaskBySerialNo(SerialNo): """ :param SerialNo: :return: """ raw = rawSql.Raw_sql() raw.sql = "UPDATE RMI_TASK SET State = 0 WHERE SerialNo = '%s'"%SerialNo raw.update() return def deleteTaskBySerialNo(SerialNo): """ RMI_TASK :param SerialNo: :return: """ #TODOupdate_other_tables_when_delete_rmi_taskF01 raw = rawSql.Raw_sql() raw.sql = "DELETE FROM RMI_TASK WHERE SerialNo='%s'"%SerialNo raw.update() #call trigger delete all task info in rmi_task_process... return def getAllMaterialByName(fuzzyName): """ :param fuzzyName: :return:{'id':ID,'name':,'cata':} """ raw = rawSql.Raw_sql() raw.sql = """SELECT MaterialID AS id, MaterialName AS name, dbo.getMaterialTypeNameByID(MaterialTypeID) AS cata FROM RMI_MATERIAL_NAME WITH(NOLOCK)""" if fuzzyName: raw.sql += """ WHERE MaterialName LIKE '%%%%%s%%%%'"""%fuzzyName res, cols = raw.query_all(needColumnName=True) return CommonUtilities.translateQueryResIntoDict(cols, res) else: # return [{"name":u'', "id":"", "cata":""}]
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 35943, 198, 37811, 198, 834, 9800, 834, 796, 366, 55, 84, 1135, 5350, 78, 1, 198, 11748, 8070, 18274, 2410, 198, 11748, 8246, 50, 13976, 198, 198, 4299, 65...
2.206609
2,754
# coding=utf-8 # Copyright 2017 The Tensor2Tensor Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Creates a RevNet with the bottleneck residual function. Implements the following equations described in the RevNet paper: y1 = x1 + f(x2) y2 = x2 + g(y1) However, in practice, the authors use the following equations to downsample tensors inside a RevNet block: y1 = h(x1) + f(x2) y2 = h(x2) + g(y1) In this case, h is the downsampling function used to change number of channels. These modified equations are evident in the authors' code online: https://github.com/renmengye/revnet-public For reference, the original paper can be found here: https://arxiv.org/pdf/1707.04585.pdf """ # Dependency imports from tensor2tensor.layers import common_hparams from tensor2tensor.layers import rev_block from tensor2tensor.utils import registry from tensor2tensor.utils import t2t_model import tensorflow as tf CONFIG = {'2d': {'conv': tf.layers.conv2d, 'max_pool': tf.layers.max_pooling2d, 'avg_pool': tf.layers.average_pooling2d, 'split_axis': 3, 'reduction_dimensions': [1, 2] }, '3d': {'conv': tf.layers.conv3d, 'max_pool': tf.layers.max_pooling3d, 'avg_pool': tf.layers.average_pooling2d, 'split_axis': 4, 'reduction_dimensions': [1, 2, 3] } } def f(x, depth1, depth2, dim='2d', first_batch_norm=True, layer_stride=1, training=True, padding='SAME'): """Applies bottleneck residual function for 104-layer RevNet. Args: x: input tensor depth1: Number of output channels for the first and second conv layers. depth2: Number of output channels for the third conv layer. dim: '2d' if 2-dimensional, '3d' if 3-dimensional. first_batch_norm: Whether to keep the first batch norm layer or not. Typically used in the first RevNet block. layer_stride: Stride for the first conv filter. Note that this particular 104-layer RevNet architecture only varies the stride for the first conv filter. The stride for the second conv filter is always set to 1. training: True for train phase, False for eval phase. padding: Padding for each conv layer. Returns: Output tensor after applying residual function for 104-layer RevNet. """ conv = CONFIG[dim]['conv'] with tf.variable_scope('f'): if first_batch_norm: net = tf.layers.batch_normalization(x, training=training) net = tf.nn.relu(net) else: net = x net = conv(net, depth1, 1, strides=layer_stride, padding=padding, activation=None) net = tf.layers.batch_normalization(net, training=training) net = tf.nn.relu(net) net = conv(net, depth1, 3, strides=1, padding=padding, activation=None) net = tf.layers.batch_normalization(net, training=training) net = tf.nn.relu(net) net = conv(net, depth2, 1, strides=1, padding=padding, activation=None) return net def h(x, output_channels, dim='2d', layer_stride=1, scope='h'): """Downsamples 'x' using a 1x1 convolution filter and a chosen stride. Args: x: input tensor of size [N, H, W, C] output_channels: Desired number of output channels. dim: '2d' if 2-dimensional, '3d' if 3-dimensional. layer_stride: What stride to use. Usually 1 or 2. scope: Optional variable scope for the h function. This function uses a 1x1 convolution filter and a chosen stride to downsample the input tensor x. Returns: A downsampled tensor of size [N, H/2, W/2, output_channels] if layer_stride is 2, else returns a tensor of size [N, H, W, output_channels] if layer_stride is 1. """ conv = CONFIG[dim]['conv'] with tf.variable_scope(scope): x = conv(x, output_channels, 1, strides=layer_stride, padding='SAME', activation=None) return x def init(images, num_channels, dim='2d', training=True, scope='init'): """Standard ResNet initial block used as first RevNet block. Args: images: [N, H, W, 3] tensor of input images to the model. num_channels: Output depth of convolutional layer in initial block. dim: '2d' if 2-dimensional, '3d' if 3-dimensional. training: True for train phase, False for eval phase. scope: Optional scope for the init block. Returns: Two [N, H, W, C] output activations from input images. """ conv = CONFIG[dim]['conv'] pool = CONFIG[dim]['max_pool'] with tf.variable_scope(scope): net = conv(images, num_channels, 7, strides=2, padding='SAME', activation=None) net = tf.layers.batch_normalization(net, training=training) net = tf.nn.relu(net) net = pool(net, pool_size=3, strides=2) x1, x2 = tf.split(net, 2, axis=CONFIG[dim]['split_axis']) return x1, x2 def unit(x1, x2, block_num, depth1, depth2, num_layers, dim='2d', first_batch_norm=True, stride=1, training=True): """Implements bottleneck RevNet unit from authors' RevNet-104 architecture. Args: x1: [N, H, W, C] tensor of network activations. x2: [N, H, W, C] tensor of network activations. block_num: integer ID of block depth1: First depth in bottleneck residual unit. depth2: Second depth in bottleneck residual unit. num_layers: Number of layers in the RevNet block. dim: '2d' if 2-dimensional, '3d' if 3-dimensional. first_batch_norm: Whether to keep the first batch norm layer or not. Typically used in the first RevNet block. stride: Stride for the residual function. training: True for train phase, False for eval phase. Returns: Two [N, H, W, C] output activation tensors. """ scope_name = 'unit_%d' % block_num with tf.variable_scope(scope_name): # Manual implementation of downsampling with tf.variable_scope('downsampling'): with tf.variable_scope('x1'): hx1 = h(x1, depth2, dim=dim, layer_stride=stride) fx2 = f(x2, depth1, depth2, dim=dim, layer_stride=stride, first_batch_norm=first_batch_norm, training=training) x1 = hx1 + fx2 with tf.variable_scope('x2'): hx2 = h(x2, depth2, dim=dim, layer_stride=stride) fx1 = f(x1, depth1, depth2, dim=dim, training=training) x2 = hx2 + fx1 # Full block using memory-efficient rev_block implementation. with tf.variable_scope('full_block'): residual_func = lambda x: f(x, depth1, depth2, dim=dim, training=training) x1, x2 = rev_block.rev_block(x1, x2, residual_func, residual_func, num_layers=num_layers) return x1, x2 def final_block(x1, x2, dim='2d', training=True, scope='final_block'): """Converts activations from last RevNet block to pre-logits. Args: x1: [NxHxWxC] tensor of network activations. x2: [NxHxWxC] tensor of network activations. dim: '2d' if 2-dimensional, '3d' if 3-dimensional. training: True for train phase, False for eval phase. scope: Optional variable scope for the final block. Returns: [N, hidden_dim] pre-logits tensor from activations x1 and x2. """ # Final batch norm and relu with tf.variable_scope(scope): y = tf.concat([x1, x2], axis=CONFIG[dim]['split_axis']) y = tf.layers.batch_normalization(y, training=training) y = tf.nn.relu(y) # Global average pooling net = tf.reduce_mean(y, CONFIG[dim]['reduction_dimensions'], name='final_pool', keep_dims=True) return net def revnet104(inputs, hparams, reuse=None): """Uses Tensor2Tensor memory optimized RevNet block to build a RevNet. Args: inputs: [NxHxWx3] tensor of input images to the model. hparams: HParams object that contains the following parameters, in addition to the parameters contained in the basic_params1() object in the common_hparams module: num_channels_first - A Python list where each element represents the depth of the first and third convolutional layers in the bottleneck residual unit for a given block. num_channels_second - A Python list where each element represents the depth of the second convolutional layer in the bottleneck residual unit for a given block. num_layers_per_block - A Python list containing the number of RevNet layers for each block. first_batch_norm - A Python list containing booleans representing the presence of a batch norm layer at the beginning of a given block. strides - A Python list containing integers representing the stride of the residual function for each block. num_channels_init_block - An integer representing the number of channels for the convolutional layer in the initial block. dimension - A string (either "2d" or "3d") that decides if the RevNet is 2-dimensional or 3-dimensional. reuse: Whether to reuse the default variable scope. Returns: [batch_size, hidden_dim] pre-logits tensor from the bottleneck RevNet. """ training = hparams.mode == tf.estimator.ModeKeys.TRAIN with tf.variable_scope('RevNet104', reuse=reuse): x1, x2 = init(inputs, num_channels=hparams.num_channels_init_block, dim=hparams.dim, training=training) for block_num in range(1, len(hparams.num_layers_per_block)): block = {'depth1': hparams.num_channels_first[block_num], 'depth2': hparams.num_channels_second[block_num], 'num_layers': hparams.num_layers_per_block[block_num], 'first_batch_norm': hparams.first_batch_norm[block_num], 'stride': hparams.strides[block_num]} x1, x2 = unit(x1, x2, block_num, dim=hparams.dim, training=training, **block) pre_logits = final_block(x1, x2, dim=hparams.dim, training=training) return pre_logits
[ 2, 19617, 28, 40477, 12, 23, 198, 2, 15069, 2177, 383, 309, 22854, 17, 51, 22854, 46665, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2...
2.556661
4,121
import pytest from datetime import date, timedelta from adapters import repository from domain.model import Batch, OrderLine, allocate, OutOfStock from domain import model from service_layer import handlers, unit_of_work today = date.today() tomorrow = today + timedelta(days=1) later = tomorrow + timedelta(days=10)
[ 11748, 12972, 9288, 198, 6738, 4818, 8079, 1330, 3128, 11, 28805, 12514, 198, 198, 6738, 46363, 1330, 16099, 198, 6738, 7386, 13, 19849, 1330, 347, 963, 11, 8284, 13949, 11, 31935, 11, 3806, 5189, 26207, 198, 6738, 7386, 1330, 2746, 198...
3.569892
93
import FWCore.ParameterSet.Config as cms electronEfficiencyThresholds = [36, 68, 128, 176] electronEfficiencyBins = [] electronEfficiencyBins.extend(list(xrange(0, 120, 10))) electronEfficiencyBins.extend(list(xrange(120, 180, 20))) electronEfficiencyBins.extend(list(xrange(180, 300, 40))) electronEfficiencyBins.extend(list(xrange(300, 400, 100))) # just copy for now photonEfficiencyThresholds = electronEfficiencyThresholds photonEfficiencyBins = electronEfficiencyBins l1tEGammaOfflineDQM = cms.EDAnalyzer( "L1TEGammaOffline", electronCollection=cms.InputTag("gedGsfElectrons"), photonCollection=cms.InputTag("photons"), caloJetCollection=cms.InputTag("ak4CaloJets"), caloMETCollection=cms.InputTag("caloMet"), conversionsCollection=cms.InputTag("allConversions"), PVCollection=cms.InputTag("offlinePrimaryVerticesWithBS"), beamSpotCollection=cms.InputTag("offlineBeamSpot"), TriggerEvent=cms.InputTag('hltTriggerSummaryAOD', '', 'HLT'), TriggerResults=cms.InputTag('TriggerResults', '', 'HLT'), # last filter of HLTEle27WP80Sequence TriggerFilter=cms.InputTag('hltEle27WP80TrackIsoFilter', '', 'HLT'), TriggerPath=cms.string('HLT_Ele27_WP80_v13'), stage2CaloLayer2EGammaSource=cms.InputTag("caloStage2Digis", "EGamma"), histFolder=cms.string('L1T/L1TEGamma'), electronEfficiencyThresholds=cms.vdouble(electronEfficiencyThresholds), electronEfficiencyBins=cms.vdouble(electronEfficiencyBins), photonEfficiencyThresholds=cms.vdouble(photonEfficiencyThresholds), photonEfficiencyBins=cms.vdouble(photonEfficiencyBins), ) l1tEGammaOfflineDQMEmu = l1tEGammaOfflineDQM.clone( stage2CaloLayer2EGammaSource=cms.InputTag("simCaloStage2Digis"), histFolder=cms.string('L1TEMU/L1TEGamma'), )
[ 11748, 48849, 14055, 13, 36301, 7248, 13, 16934, 355, 269, 907, 198, 198, 9509, 1313, 36, 35590, 817, 10126, 82, 796, 685, 2623, 11, 8257, 11, 13108, 11, 26937, 60, 198, 198, 9509, 1313, 36, 35590, 33, 1040, 796, 17635, 198, 9509, 1...
2.649852
674
#!python # external import numpy as np import numba
[ 2, 0, 29412, 198, 198, 2, 7097, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 997, 7012, 628, 628, 628, 628, 628, 628, 628 ]
2.75
24
tokens = input().split(' ') print(result(tokens))
[ 198, 198, 83, 482, 641, 796, 5128, 22446, 35312, 10786, 705, 8, 198, 198, 4798, 7, 20274, 7, 83, 482, 641, 4008 ]
2.363636
22
# Order must match format junk # NOTIFY_ALL is kinda special, if you registerNotifier # with it, you get ALL notifications. NOTIFY_ALL = 0 # Get all notifications NOTIFY_SIGNAL = 1 # Callback on signal/exception NOTIFY_BREAK = 2 # Callback on breakpoint / sigtrap NOTIFY_STEP = 3 # Callback on singlestep complete NOTIFY_SYSCALL = 4 # Callback on syscall (linux only for now) NOTIFY_CONTINUE = 5 # Callback on continue (not done for step) NOTIFY_EXIT = 6 # Callback on process exit NOTIFY_ATTACH = 7 # Callback on successful attach NOTIFY_DETACH = 8 # Callback on impending process detach # The following notifiers are *only* available on some platforms # (and may be kinda faked out ala library load events on posix) NOTIFY_LOAD_LIBRARY = 9 NOTIFY_UNLOAD_LIBRARY = 10 NOTIFY_CREATE_THREAD = 11 NOTIFY_EXIT_THREAD = 12 NOTIFY_DEBUG_PRINT = 13 # Some platforms support this (win32). NOTIFY_MAX = 20 # File Descriptor / Handle Types FD_UNKNOWN = 0 # Unknown or we don't have a type for it FD_FILE = 1 FD_SOCKET = 2 FD_PIPE = 3 FD_LOCK = 4 # Win32 Mutant/Lock/Semaphore FD_EVENT = 5 # Win32 Event/KeyedEvent FD_THREAD = 6 # Win32 Thread FD_REGKEY = 7 # Win32 Registry Key # Vtrace Symbol Types SYM_MISC = -1 SYM_GLOBAL = 0 # Global (mostly vars) SYM_LOCAL = 1 # Locals SYM_FUNCTION = 2 # Functions SYM_SECTION = 3 # Binary section SYM_META = 4 # Info that we enumerate # Vtrace Symbol Offsets VSYM_NAME = 0 VSYM_ADDR = 1 VSYM_SIZE = 2 VSYM_TYPE = 3 VSYM_FILE = 4
[ 2, 8284, 1276, 2872, 5794, 18556, 198, 2, 5626, 5064, 56, 62, 7036, 318, 17855, 2041, 11, 611, 345, 7881, 3673, 7483, 198, 2, 351, 340, 11, 345, 651, 11096, 19605, 13, 198, 11929, 5064, 56, 62, 7036, 796, 657, 220, 220, 220, 220, ...
2.584746
590
# Purpose: Grouping entities by DXF attributes or a key function. # Copyright (c) 2017-2021, Manfred Moitzi # License: MIT License from typing import Iterable, Hashable, Dict, List, TYPE_CHECKING from ezdxf.lldxf.const import DXFValueError, DXFAttributeError if TYPE_CHECKING: from ezdxf.eztypes import DXFEntity, KeyFunc def groupby( entities: Iterable["DXFEntity"], dxfattrib: str = "", key: "KeyFunc" = None ) -> Dict[Hashable, List["DXFEntity"]]: """ Groups a sequence of DXF entities by a DXF attribute like ``'layer'``, returns a dict with `dxfattrib` values as key and a list of entities matching this `dxfattrib`. A `key` function can be used to combine some DXF attributes (e.g. layer and color) and should return a hashable data type like a tuple of strings, integers or floats, `key` function example:: def group_key(entity: DXFEntity): return entity.dxf.layer, entity.dxf.color For not suitable DXF entities return ``None`` to exclude this entity, in this case it's not required, because :func:`groupby` catches :class:`DXFAttributeError` exceptions to exclude entities, which do not provide layer and/or color attributes, automatically. Result dict for `dxfattrib` = ``'layer'`` may look like this:: { '0': [ ... list of entities ], 'ExampleLayer1': [ ... ], 'ExampleLayer2': [ ... ], ... } Result dict for `key` = `group_key`, which returns a ``(layer, color)`` tuple, may look like this:: { ('0', 1): [ ... list of entities ], ('0', 3): [ ... ], ('0', 7): [ ... ], ('ExampleLayer1', 1): [ ... ], ('ExampleLayer1', 2): [ ... ], ('ExampleLayer1', 5): [ ... ], ('ExampleLayer2', 7): [ ... ], ... } All entity containers (modelspace, paperspace layouts and blocks) and the :class:`~ezdxf.query.EntityQuery` object have a dedicated :meth:`groupby` method. Args: entities: sequence of DXF entities to group by a DXF attribute or a `key` function dxfattrib: grouping DXF attribute like ``'layer'`` key: key function, which accepts a :class:`DXFEntity` as argument and returns a hashable grouping key or ``None`` to ignore this entity """ if all((dxfattrib, key)): raise DXFValueError( "Specify a dxfattrib or a key function, but not both." ) if dxfattrib != "": key = lambda entity: entity.dxf.get_default(dxfattrib) if key is None: raise DXFValueError( "no valid argument found, specify a dxfattrib or a key function, " "but not both." ) result: Dict[Hashable, List["DXFEntity"]] = dict() for dxf_entity in entities: if not dxf_entity.is_alive: continue try: group_key = key(dxf_entity) except DXFAttributeError: # ignore DXF entities, which do not support all query attributes continue if group_key is not None: group = result.setdefault(group_key, []) group.append(dxf_entity) return result
[ 2, 32039, 25, 4912, 278, 12066, 416, 19393, 37, 12608, 393, 257, 1994, 2163, 13, 198, 2, 15069, 357, 66, 8, 2177, 12, 1238, 2481, 11, 1869, 39193, 4270, 4224, 72, 198, 2, 13789, 25, 17168, 13789, 198, 6738, 19720, 1330, 40806, 540, ...
2.447626
1,327
# coding=utf-8 import unittest from companycase import CompanyCase if __name__ == '__main__': unittest.main()
[ 2, 19617, 28, 40477, 12, 23, 198, 11748, 555, 715, 395, 198, 6738, 1664, 7442, 1330, 5834, 20448, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 555, 715, 395, 13, 12417, 3419, 628 ]
2.853659
41
#!/usr/bin/env python3 import os import tqdm import torch import random import numpy as np import torch.nn as nn import configargparse import torch.optim as optim from tensorboard import program from torch.utils.tensorboard import SummaryWriter import yaml from models import FeatureNet from datasets import get_dataset from losses import MemReplayLoss from utils.evaluation import RecognitionEvaluator from utils.misc import save_model, load_model, GlobalStepCounter, ProgressBarDescription if __name__ == "__main__": run()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 11748, 28686, 198, 11748, 256, 80, 36020, 198, 11748, 28034, 198, 11748, 4738, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 28034, 13, 20471, 355, 299, 77, 198, 11748, 4566, ...
3.464516
155
# from .panos import PanosSkillet # from .docker import DockerSkillet # from .pan_validation import PanValidationSkillet # from .python3 import Python3Skillet # from .rest import RestSkillet # from .template import TemplateSkillet # from .workflow import WorkflowSkillet
[ 2, 422, 764, 6839, 418, 1330, 5961, 418, 15739, 32512, 198, 2, 422, 764, 45986, 1330, 25716, 15739, 32512, 198, 2, 422, 764, 6839, 62, 12102, 341, 1330, 5961, 7762, 24765, 15739, 32512, 198, 2, 422, 764, 29412, 18, 1330, 11361, 18, ...
3.662162
74
""" Views for the rss_proxy djangoapp. """ import requests from django.conf import settings from django.core.cache import cache from django.http import HttpResponse, HttpResponseNotFound from lms.djangoapps.rss_proxy.models import WhitelistedRssUrl CACHE_KEY_RSS = "rss_proxy.{url}" def proxy(request): """ Proxy requests for the given RSS url if it has been whitelisted. """ url = request.GET.get('url') if url and WhitelistedRssUrl.objects.filter(url=url).exists(): # Check cache for RSS if the given url is whitelisted cache_key = CACHE_KEY_RSS.format(url=url) status_code = 200 rss = cache.get(cache_key, '') print(cache_key) print('Cached rss: %s' % rss) if not rss: # Go get the RSS from the URL if it was not cached resp = requests.get(url) status_code = resp.status_code if status_code == 200: # Cache RSS rss = resp.content cache.set(cache_key, rss, settings.RSS_PROXY_CACHE_TIMEOUT) return HttpResponse(rss, status=status_code, content_type='application/xml') return HttpResponseNotFound()
[ 37811, 198, 7680, 82, 329, 262, 374, 824, 62, 36436, 42625, 14208, 1324, 13, 198, 37811, 628, 198, 11748, 7007, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 6738, 42625, 14208, 13, 7295, 13, 23870, 1330, 12940, 198, 6738, 42625,...
2.337255
510
#!/usr/bin/env python numTemp = raw_input('Enter a number: ') num = int(numTemp) if num > 0: print '>0' elif num ==0: print '0' else: print '<0'
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 22510, 30782, 796, 8246, 62, 15414, 10786, 17469, 257, 1271, 25, 705, 8, 198, 22510, 796, 493, 7, 22510, 30782, 8, 198, 198, 361, 997, 1875, 657, 25, 198, 197, 4798, 705, 29, 15, 6...
2.191176
68
from django.conf.urls import url from .views import * app_name = "accounts" urlpatterns = [ url(r"^signup/$", CustomSignupView.as_view(), name="custom_signup"), url(r"^destroy/$", AjaxLogoutView.as_view(), name="destroy"), url(r"^(?P<username>[\w.@+-]+)/$", ProfileView.as_view(), name="profile"), ]
[ 6738, 42625, 14208, 13, 10414, 13, 6371, 82, 1330, 19016, 198, 6738, 764, 33571, 1330, 1635, 198, 198, 1324, 62, 3672, 796, 366, 23317, 82, 1, 198, 6371, 33279, 82, 796, 685, 198, 220, 220, 220, 19016, 7, 81, 1, 61, 12683, 929, 32...
2.492063
126
#!/usr/bin/env python Description: Load topology in Mininet Author: James Hongyi Zeng (hyzeng_at_stanford.edu) ''' from argparse import ArgumentParser from socket import gethostbyname from os import getuid from mininet.log import lg, info from mininet.cli import CLI from mininet.net import Mininet from mininet.topo import Topo from mininet.link import Link, Intf from mininet.node import Host, OVSKernelSwitch, Controller, RemoteController class StanfordTopo( Topo ): "Topology for Stanford backbone" PORT_ID_MULTIPLIER = 1 INTERMEDIATE_PORT_TYPE_CONST = 1 OUTPUT_PORT_TYPE_CONST = 2 PORT_TYPE_MULTIPLIER = 10000 SWITCH_ID_MULTIPLIER = 100000 DUMMY_SWITCH_BASE = 1000 PORT_MAP_FILENAME = "data/port_map.txt" TOPO_FILENAME = "data/backbone_topology.tf" dummy_switches = set() def __init__( self ): # Read topology info ports = self.load_ports(self.PORT_MAP_FILENAME) links = self.load_topology(self.TOPO_FILENAME) switches = ports.keys() # Add default members to class. super( StanfordTopo, self ).__init__() # Create switch nodes for s in switches: self.add_switch( "s%s" % s ) # Wire up switches self.create_links(links, ports) # Wire up hosts host_id = len(switches) + 1 for s in switches: # Edge ports for port in ports[s]: self.add_host( "h%s" % host_id ) self.add_link( "h%s" % host_id, "s%s" % s, 0, port ) host_id += 1 # Consider all switches and hosts 'on' # self.enable_all() def load_ports(self, filename): ports = {} f = open(filename, 'r') for line in f: if not line.startswith("$") and line != "": tokens = line.strip().split(":") port_flat = int(tokens[1]) dpid = port_flat / self.SWITCH_ID_MULTIPLIER port = port_flat % self.PORT_TYPE_MULTIPLIER if dpid not in ports.keys(): ports[dpid] = set() if port not in ports[dpid]: ports[dpid].add(port) f.close() return ports def load_topology(self, filename): links = set() f = open(filename, 'r') for line in f: if line.startswith("link"): tokens = line.split('$') src_port_flat = int(tokens[1].strip('[]').split(', ')[0]) dst_port_flat = int(tokens[7].strip('[]').split(', ')[0]) links.add((src_port_flat, dst_port_flat)) f.close() return links def create_links(self, links, ports): '''Generate dummy switches For example, interface A1 connects to B1 and C1 at the same time. Since Mininet uses veth, which supports point to point communication only, we need to manually create dummy switches @param links link info from the file @param ports port info from the file ''' # First pass, find special ports with more than 1 peer port first_pass = {} for (src_port_flat, dst_port_flat) in links: src_dpid = src_port_flat / self.SWITCH_ID_MULTIPLIER dst_dpid = dst_port_flat / self.SWITCH_ID_MULTIPLIER src_port = src_port_flat % self.PORT_TYPE_MULTIPLIER dst_port = dst_port_flat % self.PORT_TYPE_MULTIPLIER if (src_dpid, src_port) not in first_pass.keys(): first_pass[(src_dpid, src_port)] = set() first_pass[(src_dpid, src_port)].add((dst_dpid, dst_port)) if (dst_dpid, dst_port) not in first_pass.keys(): first_pass[(dst_dpid, dst_port)] = set() first_pass[(dst_dpid, dst_port)].add((src_dpid, src_port)) # Second pass, create new links for those special ports dummy_switch_id = self.DUMMY_SWITCH_BASE for (dpid, port) in first_pass.keys(): # Special ports! if(len(first_pass[(dpid,port)])>1): self.add_switch( "s%s" % dummy_switch_id ) self.dummy_switches.add(dummy_switch_id) self.add_link( node1="s%s" % dpid, node2="s%s" % dummy_switch_id, port1=port, port2=1 ) dummy_switch_port = 2 for (dst_dpid, dst_port) in first_pass[(dpid,port)]: first_pass[(dst_dpid, dst_port)].discard((dpid,port)) self.add_link( node1="s%s" % dummy_switch_id, node2="s%s" % dst_dpid, port1=dummy_switch_port, port2=dst_port) ports[dst_dpid].discard(dst_port) dummy_switch_port += 1 dummy_switch_id += 1 first_pass[(dpid,port)] = set() ports[dpid].discard(port) # Third pass, create the remaining links for (dpid, port) in first_pass.keys(): for (dst_dpid, dst_port) in first_pass[(dpid,port)]: self.add_link( node1="s%s" % dpid, node2="s%s" % dst_dpid, port1=port, port2=dst_port ) ports[dst_dpid].discard(dst_port) ports[dpid].discard(port) class StanfordMininet ( Mininet ): def build( self ): super( StanfordMininet, self ).build() # FIXME: One exception... Dual links between yoza and yozb # Need _manual_ modification for different topology files!!! self.topo.add_link( node1="s%s" % 15, node2="s%s" % 16, port1=7, port2=4 ) def StanfordTopoTest( controller_ip, controller_port, dummy_controller_ip, dummy_controller_port ): topo = StanfordTopo() main_controller = lambda a: RemoteController( a, ip=controller_ip, port=controller_port) net = StanfordMininet( topo=topo, switch=OVSKernelSwitch, controller=main_controller) net.start() # These switches should be set to a local controller.. dummy_switches = topo.dummy_switches dummyClass = lambda a: RemoteController( a, ip=dummy_controller_ip, port=dummy_controller_port) dummy_controller = net.addController( name='dummy_controller', controller=dummyClass) dummy_controller.start() for dpid in dummy_switches: switch = net.nameToNode["s%s" % dpid] switch.pause() switch.start( [dummy_controller] ) # Turn on STP for switchName in topo.switches(): switch = net.nameToNode[switchName] cmd = "ovs-vsctl set Bridge %s stp_enable=true" % switch.name switch.cmd(cmd) switch.cmd('ovs-vsctl set Bridge s1 other_config:stp-priority=0x10') CLI( net ) net.stop() if __name__ == '__main__': if getuid()!=0: print "Please run this script as root / use sudo." exit(-1) lg.setLogLevel( 'info') description = "Put Stanford backbone in Mininet" parser = ArgumentParser(description=description) parser.add_argument("-c", dest="controller_name", default="localhost", help="Controller's hostname or IP") parser.add_argument("-p", dest="controller_port",type=int, default=6633, help="Controller's port") parser.add_argument("-c2", dest="dummy_controller_name", default="localhost", help="Dummy controller's hostname or IP") parser.add_argument("-p2", dest="dummy_controller_port",type=int, default=6633, help="Dummy ontroller's port") args = parser.parse_args() print description print "Starting with primary controller %s:%d" % (args.controller_name, args.controller_port) print "Starting with dummy controller %s:%d" % (args.dummy_controller_name, args.dummy_controller_port) Mininet.init() StanfordTopoTest(gethostbyname(args.controller_name), args.controller_port, gethostbyname(args.dummy_controller_name), args.dummy_controller_port)
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 628, 220, 220, 220, 220, 198, 220, 220, 220, 12489, 25, 8778, 1353, 1435, 287, 1855, 42504, 198, 220, 220, 220, 6434, 25, 3700, 9764, 48111, 1168, 1516, 357, 12114, 89, 1516, 62, 265, 62,...
2.087898
3,925
""" Test a site with translated content. Do not test titles as we remove the translation. """ import io import os import shutil import lxml.html import pytest import nikola.plugins.command.init from nikola import __main__ from .helper import cd from .test_empty_build import ( # NOQA test_archive_exists, test_avoid_double_slash_in_rss, test_check_files, test_check_links, test_index_in_sitemap, ) def test_translated_titles(build, output_dir, other_locale): """Check that translated title is picked up.""" normal_file = os.path.join(output_dir, "pages", "1", "index.html") translated_file = os.path.join(output_dir, other_locale, "pages", "1", "index.html") # Files should be created assert os.path.isfile(normal_file) assert os.path.isfile(translated_file) # And now let's check the titles with io.open(normal_file, "r", encoding="utf8") as inf: doc = lxml.html.parse(inf) assert doc.find("//title").text == "Foo | Demo Site" with io.open(translated_file, "r", encoding="utf8") as inf: doc = lxml.html.parse(inf) assert doc.find("//title").text == "Bar | Demo Site"
[ 37811, 198, 14402, 257, 2524, 351, 14251, 2695, 13, 198, 198, 5211, 407, 1332, 8714, 355, 356, 4781, 262, 11059, 13, 198, 37811, 198, 198, 11748, 33245, 198, 11748, 28686, 198, 11748, 4423, 346, 198, 198, 11748, 300, 19875, 13, 6494, ...
2.636569
443
import argparse import os import torch import torch.nn.functional as F from model_ST import * import data import numpy as np import matplotlib.pyplot as plt from torch.utils.data import Dataset, DataLoader import sys from predict import evaluate_MA from tensorboardX import SummaryWriter # print model parameter # Training settings parser = argparse.ArgumentParser(description='Relation network for concurrent activity detection') parser.add_argument('--BATCH_SIZE', type=int, default=256, help='Training batch size. Default=256') parser.add_argument('--save_every', type=int, default=5, help='Save model every save_every epochs. Defualt=5') parser.add_argument('--EPOCH', type=int, default=500, help='Number of epochs to train. Default=600') parser.add_argument('--LR', type=float, default=0.001, help='Learning Rate. Default=0.001') parser.add_argument('--TRAIN', action='store_true', default=True, help='Train or test? ') parser.add_argument('--DEBUG', action='store_true', default=False, help='Debug mode (load less data)? Defualt=False') parser.add_argument('--clip_grad', type=float, default=5.0, help='Gradient clipping parameter. Default=5,0') parser.add_argument('--dataPath', type=str, default='/home/yi/PycharmProjects/relation_network/data/UCLA/new273', help='path to the data folder') parser.add_argument('--checkpoint', type=str, help='Checkpoint folder name under ./model/') parser.add_argument('--verbose', type=int, default=1, help='Print verbose information? Default=True') # model parameters parser.add_argument('--n_input', type=int, default=37, help='Input feature vector size. Default=37') parser.add_argument('--n_hidden', type=int, default=128, help='Hidden units for LSTM baseline. Default=128') parser.add_argument('--n_layers', type=int, default=2, help='LSTM layer number. Default=2') parser.add_argument('--n_class', type=int, default=12, help='Class label number. Default=12') parser.add_argument('--use_lstm', action='store_true', default=True, help='Use LSTM for relation network classifier. Default=True') parser.add_argument('--df', type=int, default=64, help='Relation feature dimension. Default=64') parser.add_argument('--dk', type=int, default=8, help='Key feature dim. Default=8') parser.add_argument('--nr', type=int, default=4, help='Multihead number. Default=4') opt = parser.parse_args() checkpoint_dir = './model/{}/'.format(opt.checkpoint) if not os.path.exists(checkpoint_dir): os.makedirs(checkpoint_dir) orig_stdout = sys.stdout f = open(checkpoint_dir + '/parameter.txt', 'w') sys.stdout = f print(opt) f.close() sys.stdout = orig_stdout # data preparation train_dataset = data.ConActDataset(opt.dataPath) test_dataset = data.ConActDataset(opt.dataPath, train=not opt.TRAIN) writer = SummaryWriter() # only take few sequences for debuging debug_seq = 3 if opt.DEBUG: train_data = [] for i in range(debug_seq): input, labels = train_dataset[i] train_data.append((input, labels)) print("%s loaded." % train_dataset.seq_list[i]) else: print('Loading training data ----------------------') train_data = [] train_labels = [] for i, (input, labels) in enumerate(train_dataset): train_data.append((input, labels)) train_labels.append(labels) print("%s loaded." % train_dataset.seq_list[i]) print('Loading testing data ----------------------') test_data = [] for i, (input, labels) in enumerate(test_dataset): test_data.append((input, labels)) print("%s loaded." % test_dataset.seq_list[i]) # for model_lstm if opt.use_lstm: rnn = RNN(opt.n_input, opt.n_hidden, opt.n_layers, opt.n_class, opt.BATCH_SIZE, opt.df, opt.dk, opt.nr).cuda() # use lstm as classifier else: rnn = RNN(opt.n_input, opt.n_hidden, opt.n_layers, opt.n_class, opt.use_lstm).cuda() # use fc as classifier print(rnn.state_dict().keys()) optimizer = torch.optim.Adam(rnn.parameters(), lr=opt.LR) scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer, 'min', factor=0.5) # set up scheduler # Keep track of losses for plotting best_loss = 10000 all_losses = [] current_loss = 3 FAA = [] # false area ration on test set INTAP = [] # overall interval AP on test set save_epoch = [] # list to save the model saving epoch # train model total_step = len(train_data) for epoch in range(opt.EPOCH): all_losses.append(current_loss) current_loss = 0 for i, (input, labels) in enumerate(train_data): optimizer.zero_grad() feats = torch.from_numpy(input).float() nframes, _ = input.shape feats = feats.reshape(-1, nframes, 273).cuda() #feats = feats.reshape(-1, nframes, opt.n_input*6).cuda() # change label 0 to -1 labels[labels<1]=-1 labels = torch.from_numpy(labels) labels = labels.float().cuda() # Forward pass outputs = rnn(feats) outputs = torch.squeeze(outputs) loss = F.mse_loss(outputs, labels) # print model parameter if loss is NaN if opt.verbose > 0: if torch.isnan(loss): print_model(rnn) print('Epoch {}, step {}'.format(epoch+1, i+1)) raw_input("Press Enter to continue ...") # Backward and optimize loss.backward() # This line is used to prevent the vanishing / exploding gradient problem torch.nn.utils.clip_grad_norm_(rnn.parameters(), opt.clip_grad) optimizer.step() print('Epoch [{}/{}], Step [{}/{}], Loss: {:.4f}' .format(epoch + 1, opt.EPOCH, i + 1, total_step, loss.item())) current_loss = current_loss + loss.item() writer.add_scalar('loss/loss', current_loss, epoch) scheduler.step(current_loss) # update lr if needed # save model parameters and loss figure if ((epoch+1) % opt.save_every) == 0: # compute false area on test set if not opt.DEBUG: false_area, overall_IAPlist = evaluate_MA(rnn, test_data) FAA.append(torch.sum(false_area).item()) INTAP.append(overall_IAPlist[-2]) # get the interval AP at threshold 0.8 save_epoch.append(epoch+1) if FAA[-1] == min(FAA): # if has the minimum test error, save model checkpoint_dir = './model/{}/'.format(opt.checkpoint) if not os.path.exists(checkpoint_dir): os.makedirs(checkpoint_dir) if epoch > 100: model_str = checkpoint_dir + 'net-best.pth' torch.save(rnn, model_str) checkpoint_dir = './model/{}/'.format(opt.checkpoint) if not os.path.exists(checkpoint_dir): os.makedirs(checkpoint_dir) if opt.verbose == 2: print('Making dir: {}'.format(checkpoint_dir)) model_str = checkpoint_dir + 'net-{}'.format(str(epoch+1)) if opt.verbose > 0: print('Model saved to: {}.pth'.format(model_str)) if epoch >= 100: torch.save(rnn, model_str+'.pth') # save interval AP np.savetxt(model_str + 'AP.csv', np.asarray(overall_IAPlist), fmt='%0.5f') # save miss detection np.savetxt(model_str + 'MD.txt', np.asarray(FAA), fmt='%0.5f') # draw miss detection v.s. epoch figure fig, ax1 = plt.subplots() color = 'tab:red' ax1.plot(range(epoch+1), all_losses, color=color) ax1.set_xlabel('Epochs') ax1.set_ylabel('Loss', color=color) ax2 = ax1.twinx() color = 'tab:blue' ax2.set_ylabel('Miss detection area ratio', color=color) ax2.plot(save_epoch, FAA, 'bd') fig.savefig(model_str+'.png') plt.close() # draw intervalAP v.s. epoch figure fig1, ax3 = plt.subplots() color = 'tab:red' ax3.plot(range(epoch+1), all_losses, color=color) ax3.set_xlabel('Epochs') ax3.set_ylabel('Loss', color=color) ax4 = ax3.twinx() color = 'tab:blue' ax4.set_ylabel('Overall interval AP', color=color) ax4.plot(save_epoch, INTAP, 'bd') fig1.savefig(model_str+'_AP.png') plt.close() # print the loss on training set and evaluation metrics on test set to file orig_stdout = sys.stdout f = open(checkpoint_dir + '/loss.txt', 'w') sys.stdout = f print('Loss over epochs:') print(all_losses) if not opt.DEBUG: print('Miss detection area ratio:') print(FAA) f.close() sys.stdout = orig_stdout
[ 11748, 1822, 29572, 198, 11748, 28686, 198, 11748, 28034, 198, 11748, 28034, 13, 20471, 13, 45124, 355, 376, 198, 6738, 2746, 62, 2257, 1330, 1635, 198, 11748, 1366, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 2603, 29487, 8019, 13, ...
2.357964
3,654
"""Raised to quit.""" from illud.exception import IlludException
[ 37811, 21762, 1417, 284, 11238, 526, 15931, 198, 6738, 2801, 463, 13, 1069, 4516, 1330, 5821, 463, 16922, 628 ]
3.473684
19
#!/usr/bin/env python import cv2 import numpy as np import os import glob import itertools import json from numpy.core.fromnumeric import argmax #SECTION 1: UNDISTORT FISHEYE #Read in OpenCV compatible instrinsics & distortion coeffs COLOR_INTRINSIC = np.load('./savedCoeff/colorIntr.npy') COLOR_DIST = np.load('./savedCoeff/colorDist.npy') IR_INTRINSIC = np.load('./savedCoeff/irIntr.npy') IR_DIST = np.load('./savedCoeff/irDist.npy') print('Undistorting images-----------------') imageDir = 'december_callibration_images' ir_images = glob.glob('./' + imageDir + '/ir-*.png') DIMS = (1024, 1024) IDENTITY = np.eye(3) for i in range(len(ir_images)): ir_img = cv2.imread(ir_images[i], cv2.IMREAD_UNCHANGED) new_K, roi = cv2.getOptimalNewCameraMatrix(IR_INTRINSIC, IR_DIST, DIMS, 1) map1, map2 = cv2.initUndistortRectifyMap(IR_INTRINSIC, IR_DIST, IDENTITY, new_K, DIMS, cv2.CV_32FC1) undistorted_ir_img = cv2.remap(ir_img, map1, map2, interpolation=cv2.INTER_LINEAR, borderMode=cv2.BORDER_CONSTANT) #save the undistorted image cv2.imwrite('./undistorted_december_ir_images/' + 'ir-' + str(i) + '.png', undistorted_ir_img)
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 11748, 269, 85, 17, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 28686, 198, 11748, 15095, 198, 11748, 340, 861, 10141, 198, 11748, 33918, 198, 6738, 299, 32152, 13, 7295, 13, ...
2.315574
488
import pytest from hypothesis import given from hypothesis.strategies import data from numpy import array, array_equal from tests.strategies import indices, tensor_data from tinytorch.tensor.data import ( IndexingError, TensorData, broadcast_index, shape_broadcast, ) # Check basic properties of layout and strides. def test_layout(): "Test basis properties of layout and strides" data = [0] * 3 * 5 tensor_data = TensorData(data, (3, 5), (5, 1)) assert tensor_data.is_contiguous() assert tensor_data.shape == (3, 5) assert tensor_data.index((1, 0)) == 5 assert tensor_data.index((1, 2)) == 7 tensor_data = TensorData(data, (5, 3), (1, 5)) assert tensor_data.shape == (5, 3) assert not tensor_data.is_contiguous() data = [0] * 4 * 2 * 2 tensor_data = TensorData(data, (4, 2, 2)) assert tensor_data.strides == (4, 2, 1) # Check basic properties of broadcasting. def test_broadcast_index_smaller(): "Tests broadcast mapping between higher and lower dim tensors" out_index = array([0, 0]) for big_index, expected_out_index in ( ([0, 0, 0], [0, 0]), ([0, 0, 1], [0, 0]), ([0, 0, 2], [0, 0]), ([0, 1, 0], [1, 0]), ([0, 1, 1], [1, 0]), ([0, 1, 2], [1, 0]), ([1, 0, 0], [0, 0]), ([1, 0, 1], [0, 0]), ([1, 0, 2], [0, 0]), ([1, 1, 0], [1, 0]), ([1, 1, 1], [1, 0]), ([1, 1, 2], [1, 0]), ): print(big_index, expected_out_index) _broadcast_index(big_index=array(big_index)) assert array_equal(out_index, expected_out_index)
[ 11748, 12972, 9288, 198, 6738, 14078, 1330, 1813, 198, 6738, 14078, 13, 2536, 2397, 444, 1330, 1366, 198, 6738, 299, 32152, 1330, 7177, 11, 7177, 62, 40496, 198, 198, 6738, 5254, 13, 2536, 2397, 444, 1330, 36525, 11, 11192, 273, 62, 7...
2.251719
727
from django.apps import AppConfig from terra_accounts.permissions_mixins import PermissionRegistrationMixin
[ 6738, 42625, 14208, 13, 18211, 1330, 2034, 16934, 198, 6738, 1059, 430, 62, 23317, 82, 13, 525, 8481, 62, 19816, 1040, 1330, 2448, 3411, 47133, 35608, 259, 628 ]
3.892857
28
#!/usr/bin/env python # Copyright 2021 Jian Wu # License: Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from typing import List, Union from aps.tokenizer.base import TokenizerAbc, ApsTokenizer
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 2, 15069, 33448, 40922, 18027, 198, 2, 13789, 25, 24843, 362, 13, 15, 357, 4023, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12, 17, 13, 15, 8, 198, ...
2.888889
72
import os from unittest import mock import pytest import requests from constants import VALID_KEY from utils import FunctionCalledException, function_called_raiser from astrometry_net_client import Session from astrometry_net_client.exceptions import APIKeyError, LoginFailedException some_key = "somekey" # Start of tests
[ 11748, 28686, 198, 6738, 555, 715, 395, 1330, 15290, 198, 198, 11748, 12972, 9288, 198, 11748, 7007, 198, 6738, 38491, 1330, 26173, 2389, 62, 20373, 198, 6738, 3384, 4487, 1330, 15553, 34, 4262, 16922, 11, 2163, 62, 7174, 62, 430, 5847,...
3.580645
93
import ast import os.path from typing import Iterable from packaging.requirements import InvalidRequirement from packaging.requirements import Requirement from packaging.utils import canonicalize_name from all_repos_depends.errors import DependsError from all_repos_depends.types import Depends NAME = 'python'
[ 11748, 6468, 198, 11748, 28686, 13, 6978, 198, 6738, 19720, 1330, 40806, 540, 198, 198, 6738, 16846, 13, 8897, 18883, 1330, 17665, 16844, 24615, 198, 6738, 16846, 13, 8897, 18883, 1330, 9394, 24615, 198, 6738, 16846, 13, 26791, 1330, 4009...
3.843373
83
from os import listdir from os.path import isfile, join default_applications = ['Utilities','App Store.app','Automator.app','Calculator.app','Calendar.app','Chess.app','Contacts.app','Dashboard.app','Dictionary.app','DVD Player.app','FaceTime.app','Font Book.app','iBooks.app','Image Capture.app','iTunes.app','Launchpad.app','Mail.app','Maps.app','Messages.app','Mission Control.app','Notes.app','Paste.app','Photo Booth.app','Photos.app','Preview.app','QuickTime Player.app','Reminders.app','Safari.app','Siri.app','Stickies.app','System Preferences.app','TextEdit.app','Time Machine.app','Utilities.app'] remaps = { "iTerm.app": "iTerm2", # brew cask install iterm2 gives iTerm.app "Alfred 3.app": "Alfred" # brew cask install alfred gives Alfred 3.app } mypath = "/Applications" installed_applications = [f for f in listdir(mypath) if not isfile(join(mypath, f))] cask_packages = Command('brew cask list').run().output.split() mac_app_store_apps = Command('mas list').run().output.splitlines() # collect applications that are not default ones. user_applications = [] for x in installed_applications: #first remap the names if(x in remaps): name = remaps[x] else: name = x #then check if they are defaults if name not in default_applications: user_applications.append(name) # determine which applications weren't installed via brew cask unmanged_applications = [] for x in user_applications: strip_dotapp = x[:-4] if (".app" in x) else x trimmed = strip_dotapp.replace(" ", "-").lower() is_casked = trimmed in cask_packages is_mas = any(strip_dotapp in s for s in mac_app_store_apps) # print('{} -> {}: {}|{}'.format(x, trimmed, is_casked, is_mas)) if(not is_casked and not is_mas): unmanged_applications.append(x) # print("-------------------") print("You have {} default applications.".format(len(default_applications))) print("Tou have {} brew cask applications.".format(len(cask_packages))) print("Tou have {} app store applications.".format(len(mac_app_store_apps))) print("You have {} user applications Applications not managed by brew cask or app store...\n------".format(len(unmanged_applications))) for x in unmanged_applications: print(x) # print(mac_app_store_apps)
[ 6738, 28686, 1330, 1351, 15908, 198, 6738, 28686, 13, 6978, 1330, 318, 7753, 11, 4654, 198, 198, 12286, 62, 1324, 677, 602, 796, 37250, 18274, 2410, 41707, 4677, 9363, 13, 1324, 41707, 38062, 1352, 13, 1324, 41707, 9771, 3129, 1352, 13,...
2.926219
759
"""StdoutItem class""" from dataclasses import asdict, dataclass from .hark_serialisable import HarkSerialisable, now_str
[ 37811, 1273, 67, 448, 7449, 1398, 37811, 198, 6738, 4818, 330, 28958, 1330, 355, 11600, 11, 4818, 330, 31172, 198, 198, 6738, 764, 71, 668, 62, 46911, 43942, 1330, 367, 668, 32634, 43942, 11, 783, 62, 2536, 628 ]
3.263158
38
# coding: utf-8
[ 2, 19617, 25, 3384, 69, 12, 23, 628 ]
2.125
8
""" Contains database models """ from sqlalchemy import Column, ForeignKey, Integer, String, Float from sqlalchemy.orm import relationship from .database import Base
[ 37811, 198, 4264, 1299, 6831, 4981, 198, 37811, 198, 6738, 44161, 282, 26599, 1330, 29201, 11, 8708, 9218, 11, 34142, 11, 10903, 11, 48436, 198, 6738, 44161, 282, 26599, 13, 579, 1330, 2776, 198, 198, 6738, 764, 48806, 1330, 7308, 628 ]
4.097561
41
# a = rwh_primes2(100) # print(a) # http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188 """ Input n>=6, Returns a list of primes, 2 <= p < n """ print(sieve_for_primes_to(3)) print(sieve_for_primes_to(1)) print(sieve_for_primes_to(100))
[ 201, 198, 2, 257, 796, 374, 1929, 62, 1050, 999, 17, 7, 3064, 8, 201, 198, 2, 3601, 7, 64, 8, 201, 198, 201, 198, 2, 2638, 1378, 25558, 2502, 11125, 13, 785, 14, 6138, 507, 14, 1238, 3104, 36720, 14, 7217, 395, 12, 1014, 12, ...
2.125
144
import numpy as np import matplotlib.pyplot as plt import copy k = 4 ratio=0.95 # push the competitive center if __name__ == '__main__': competitive_k_means()
[ 11748, 299, 32152, 355, 45941, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 11748, 4866, 198, 74, 796, 604, 198, 10366, 952, 28, 15, 13, 3865, 198, 198, 2, 4574, 262, 7606, 3641, 198, 198, 361, 11593, 3672, 834...
2.704918
61
""" Defines a Redshift class which encapsulates a database connection and utility functions for managing that database. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import os import psycopg2 from shiftmanager.mixins import AdminMixin, ReflectionMixin, S3Mixin from shiftmanager.memoized_property import memoized_property
[ 37811, 198, 7469, 1127, 257, 2297, 30846, 1398, 543, 32652, 15968, 257, 6831, 4637, 198, 392, 10361, 5499, 329, 11149, 326, 6831, 13, 198, 37811, 198, 198, 6738, 11593, 37443, 834, 1330, 357, 48546, 62, 11748, 11, 7297, 11, 3601, 62, ...
3.229508
122
#Python 3.4.3 #coding=gbk # copy file wangyuxia 20160920 import sys, shutil, os, string path = "E:\\test for qgis\\" target_path = "E:\\test for qgis\\HourScale\\" for i in range(2,31): for j in range(0,24): filename = 'N'+str(i).zfill(2)+str(j).zfill(2) shutil.copyfile(path+'d_02.hdr',target_path+filename+'.hdr') print("------------finished---------")
[ 2, 37906, 513, 13, 19, 13, 18, 198, 2, 66, 7656, 28, 22296, 74, 198, 2, 4866, 2393, 220, 266, 648, 88, 2821, 544, 1584, 2931, 1238, 198, 198, 11748, 25064, 11, 4423, 346, 11, 28686, 11, 4731, 198, 6978, 796, 366, 36, 25, 6852, ...
2.174157
178
import sys from scipy.special import softmax import torch.onnx import onnxruntime as ort import numpy as np import tensorflow as tf from tensorflow.keras import backend as K from pytorch2keras.converter import pytorch_to_keras from models.faceboxes import FaceBoxes input_dim = 1024 num_classes = 2 model_path = "weights/FaceBoxesProd.pth" net = FaceBoxes('train', input_dim, num_classes) def remove_prefix(state_dict, prefix): ''' Old style model is stored with all names of parameters sharing common prefix 'module.' ''' print('remove prefix \'{}\''.format(prefix)) f = lambda x: x.split(prefix, 1)[-1] if x.startswith(prefix) else x return {f(key): value for key, value in state_dict.items()} net = load_model(net, model_path, False) net.eval() net.to("cuda") model_name = model_path.split("/")[-1].split(".")[0] onnx_model_path = f"models/onnx/base-model.onnx" # export ONNX model dummy_input = torch.randn(1, 3, input_dim, input_dim).to("cuda") torch.onnx.export(net, dummy_input, onnx_model_path, verbose=False, input_names=['input'], output_names=['output']) """ # try using pytorch2keras keras_model = pytorch_to_keras(net, dummy_input, [(3, input_dim, input_dim)]) keras_model_path = f"models/onnx/base-model" #keras_model.save(model_path) # 0. print PyTorch outputs out = net(dummy_input) dummy_input = dummy_input.cpu().detach().numpy() out = out.cpu().detach().numpy() loc = out[:, :, 2:] conf = out[:, :, :2] scores = softmax(conf, axis=-1) print(scores) # 1. check if ONNX outputs are the same ort_session = ort.InferenceSession(onnx_model_path) input_name = ort_session.get_inputs()[0].name out = ort_session.run(None, {input_name: dummy_input})[0] loc = out[:, :, 2:] conf = out[:, :, :2] scores = softmax(conf, axis=-1) print(scores) # 2. check if Keras outputs are the same keras_model_path = f"models/onnx/base-model" keras_model = tf.keras.models.load_model(keras_model_path) out = keras_model.predict(dummy_input) loc = out[:, :, 2:] conf = out[:, :, :2] scores = softmax(conf, axis=-1) print(scores) # 3. check if intermediate results of Keras are the same test_fn = K.function([keras_model.input], [keras_model.get_layer('334').output[0]]) test_out = test_fn(dummy_input) print(np.round(np.array(test_out), 4)[:30]) """
[ 11748, 25064, 198, 6738, 629, 541, 88, 13, 20887, 1330, 2705, 9806, 198, 198, 11748, 28034, 13, 261, 77, 87, 198, 11748, 319, 77, 87, 43282, 355, 393, 83, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 11192, 273, 11125, 355, 48700, ...
2.572235
886
from setuptools import setup setup(name='pysteamcmd', version='0.1.2', description='Python package to install and utilize steamcmd', url='http://github.com/f0rkz/pysteamcmd', author='f0rkz', author_email='f0rkz@f0rkznet.net', license='MIT', packages=['pysteamcmd'], install_requires=[], zip_safe=False)
[ 6738, 900, 37623, 10141, 1330, 9058, 198, 198, 40406, 7, 3672, 11639, 9078, 21465, 28758, 3256, 198, 220, 220, 220, 220, 220, 2196, 11639, 15, 13, 16, 13, 17, 3256, 198, 220, 220, 220, 220, 220, 6764, 11639, 37906, 5301, 284, 2721, ...
2.265823
158
# Copyright (c) 2017, 2018 Jae-jun Kang # See the file LICENSE for details. from x2py.event_factory import EventFactory from x2py.links.link_events import * from x2py.links.strategy import ChannelStrategy from x2py.util.trace import Trace
[ 2, 15069, 357, 66, 8, 2177, 11, 2864, 34521, 12, 29741, 27504, 198, 2, 4091, 262, 2393, 38559, 24290, 329, 3307, 13, 198, 198, 6738, 2124, 17, 9078, 13, 15596, 62, 69, 9548, 1330, 8558, 22810, 198, 6738, 2124, 17, 9078, 13, 28751, ...
3.213333
75
import os import sys import json import time import tqdm import socket import subprocess import numpy as np import visdom from typing import Tuple from typing import Optional
[ 11748, 28686, 198, 11748, 25064, 198, 11748, 33918, 198, 11748, 640, 198, 11748, 256, 80, 36020, 198, 11748, 17802, 198, 11748, 850, 14681, 198, 11748, 299, 32152, 355, 45941, 198, 198, 11748, 1490, 3438, 198, 198, 6738, 19720, 1330, 309,...
3.714286
49
import os import time from sqlalchemy import create_engine, BigInteger, UnicodeText, Column, Integer from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, scoped_session from sqlalchemy.exc import SQLAlchemyError from aiogram import Bot, Dispatcher, executor, types from aiogram.utils.exceptions import ChatNotFound from dotenv import load_dotenv load_dotenv() # Database configuration DB = os.getenv('DB_ADDR') ENGINE = create_engine(DB) Base = declarative_base() Session = scoped_session(sessionmaker(bind=ENGINE)) # Bot configuration USAGE = """\ /status -- show how many messages are pending /receive -- receive pending messages /send [user_id] -- reply to message to send it to given user /drop -- drop all pending messages /help -- shows this message """ TOKEN = os.getenv('BOT_TOKEN') bot = Bot(token=TOKEN) dp = Dispatcher(bot) if __name__ == '__main__': Base.metadata.create_all(ENGINE) executor.start_polling(dp)
[ 11748, 28686, 198, 11748, 640, 198, 198, 6738, 44161, 282, 26599, 1330, 2251, 62, 18392, 11, 4403, 46541, 11, 34371, 8206, 11, 29201, 11, 34142, 198, 6738, 44161, 282, 26599, 13, 2302, 13, 32446, 283, 876, 1330, 2377, 283, 876, 62, 86...
3.139241
316
import numpy as np import cvnn.layers as complex_layers import tensorflow as tf from pdb import set_trace if __name__ == '__main__': test_functional_api() test_regression() test_cifar()
[ 11748, 299, 32152, 355, 45941, 198, 11748, 269, 85, 20471, 13, 75, 6962, 355, 3716, 62, 75, 6962, 198, 11748, 11192, 273, 11125, 355, 48700, 198, 6738, 279, 9945, 1330, 900, 62, 40546, 628, 628, 628, 198, 361, 11593, 3672, 834, 6624, ...
2.649351
77
"""Write a subset of keys from one CSV to another. Don't use lots of memory. Usage: %s <filename> <outputfile> [--columns=<columns>] [--htm] [--racol=<racol>] [--deccol=<deccol>] [--filtercol=<filtercol>] %s (-h | --help) %s --version Options: -h --help Show this screen. --version Show version. --columns=<columns> Comma separated (no spaces) columns. --htm Generate HTM IDs and add to the column subset. --racol=<racol> RA column, ignored if htm not specified [default: ra] --deccol=<deccol> Declination column, ignored if htm not specified [default: dec] --filtercol=<filtercol> Only write the row when this column is not blank. """ import sys __doc__ = __doc__ % (sys.argv[0], sys.argv[0], sys.argv[0]) from docopt import docopt from gkutils.commonutils import Struct, readGenericDataFile, cleanOptions import csv from gkhtm._gkhtm import htmName if __name__ == '__main__': main()
[ 37811, 16594, 257, 24637, 286, 8251, 422, 530, 44189, 284, 1194, 13, 2094, 470, 779, 6041, 286, 4088, 13, 198, 198, 28350, 25, 198, 220, 4064, 82, 1279, 34345, 29, 1279, 22915, 7753, 29, 685, 438, 28665, 82, 28, 27, 28665, 82, 37981...
2.42823
418
""" A binary tree is univalued if every node in the tree has the same value. Return trueif and only if the given tree is univalued. Example 1: Input: [1,1,1,1,1,null,1] Output: true Example 2: Input: [2,2,2,5,2] Output: false Note: The number of nodes in the given tree will be in the range [1, 100]. Each node's value will be an integer in the range [0, 99]. """ # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None
[ 37811, 198, 198, 32, 13934, 5509, 318, 555, 2473, 1739, 611, 790, 10139, 287, 262, 5509, 468, 262, 976, 1988, 13, 198, 13615, 2081, 361, 290, 691, 611, 262, 1813, 5509, 318, 555, 2473, 1739, 13, 198, 198, 16281, 352, 25, 628, 201, ...
2.557604
217
#!/usr/bin/env python """ _GetParentStatus_ MySQL implementation of DBSBufferFile.GetParentStatus """ from WMCore.Database.DBFormatter import DBFormatter
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 37811, 198, 62, 3855, 24546, 19580, 62, 198, 198, 3666, 17861, 7822, 286, 360, 4462, 28632, 8979, 13, 3855, 24546, 19580, 198, 37811, 628, 628, 198, 6738, 370, 9655, 382, 13, 38105, 13...
3.18
50