blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
281
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
6
116
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
313 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
18.2k
668M
star_events_count
int64
0
102k
fork_events_count
int64
0
38.2k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
107 values
src_encoding
stringclasses
20 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
4
6.02M
extension
stringclasses
78 values
content
stringlengths
2
6.02M
authors
listlengths
1
1
author
stringlengths
0
175
178cdd44b7132721ea8dad20f94a94752a44dbfe
a1973fa91ca1883be6143771feece9dcbdf84a72
/algo/scheduler.py
4693ff8b95500655b9e8c70296c851e720111ba5
[]
no_license
ajaytani/python
a05d3d9607ead75d8e6dc5eadadbfb28f7116623
0751bb5f22fdf512e46771391b6464d11773dc19
refs/heads/master
2021-01-19T23:44:18.968570
2020-08-11T06:34:51
2020-08-11T06:34:51
89,016,107
0
0
null
null
null
null
UTF-8
Python
false
false
3,086
py
class MinHeap: def __init__(self): self.heapList = [] self.currentSize =0 def buildHeap(self,arr): self.currentSize = len(arr) self.heapList = [0] + arr i = self.currentSize//2 while i > 0: self.percDown(i) i = i-1 def percDown(self,i): while i*2 <self.currentSize: mc = self.minChild(i) if self.heapList[i] >self.heapList[mc]: self.heapList[i],self.heapList[mc] = self.heapList[mc],self.heapList[i] i = mc def minChild(self, i): if i * 2 + 1 > self.currentSize: return i * 2 else: if self.heapList[i * 2] < self.heapList[i * 2 + 1]: return i * 2 else: return i * 2 + 1 def heapPop(self): self.currentSize -=1 return self.heapList.pop() def insert(self, k): self.heapList.append(k) self.currentSize += 1 self.percUp(self.currentSize) return self.heapList def percUp(self, i): while i // 2 > 0: if self.heapList[i] > self.heapList[i // 2]: self.heapList[i], self.heapList[i // 2] = self.heapList[i // 2],self.heapList[i] i =i // 2 def delMin(self): retVal = self.heapList[1] self.heapList[1] = self.heapList[self.currentSize] self.currentSize -= 1 self.heapList.pop() self.percdown(1) return retVal def getMini(tasks,worker): tot = sum(tasks) #sort tasks tasks.sort(reverse=True) # put in the largest time first # the idea is to get as averaged as possible, # every iteration we add the smallest value to the currently smallest worker times = [0]*worker x= MinHeap() x.buildHeap(times) for i in tasks: t=x.heapPop() times = x.insert((t+i)) return times print(getMini([2,2,36,3,5,2,4,46,76,4,23,12,41,63,34,1,13,7,3,21,4,7,1],5)) import heapq def getMini2(tasks,worker): tot = sum(tasks) tasks.sort(reverse=True) # put in the largest time first times = [0]*worker heapq.heapify(times) for i in tasks: t=heapq.heappop(times) heapq.heappush(times,(t+i)) return max(times) print(getMini2([2,2,36,3,5,2,4,46,76,4,23,12,41,63,34,1,13,7,3,21,4,7,1],5)) def find_loc(scheduler, task): w_times = [] for wrkr in scheduler: w_times.append(sum(wrkr)) max_time = max(w_times) avail_time = 0 loc = 0 for i in range(len(scheduler)): if max_time - w_times[i] > avail_time: avail_time = max_time - w_times[i] loc = i return loc def get_min_time(a, n): a.sort(reverse=True) print a scheduler = [[] for i in range(n)] scheduler[0].append(a[0]) i = 1 while i < len(a): loc = find_loc(scheduler, a[i]) scheduler[loc].append(a[i]) i += 1 return scheduler if __name__ == '__main__': scheduler = get_min_time([2, 2, 3, 7, 1], 3) print (scheduler)
[ "revathi@gmail.com" ]
revathi@gmail.com
685c3b447efa9302c1e3ac674770c6ad63a86f80
86fc644c327a8d6ea66fd045d94c7733c22df48c
/scripts/managed_cpe_services/customer/triple_cpe_site/triple_cpe_site_services/cpe_primary/ospfs/router_ospf/redistribute/redistribute_on_ospf/redistribute_on_ospf.py
37bcca908584bc95632c842448489e92bbae1610
[]
no_license
lucabrasi83/anutacpedeployment
bfe703657fbcf0375c92bcbe7560051817f1a526
96de3a4fd4adbbc0d443620f0c53f397823a1cad
refs/heads/master
2021-09-24T16:44:05.305313
2018-10-12T02:41:18
2018-10-12T02:41:18
95,190,459
0
0
null
null
null
null
UTF-8
Python
false
false
9,026
py
# # This computer program is the confidential information and proprietary trade # secret of Anuta Networks, Inc. Possessions and use of this program must # conform strictly to the license agreement between the user and # Anuta Networks, Inc., and receipt or possession does not convey any rights # to divulge, reproduce, or allow others to use this program without specific # written authorization of Anuta Networks, Inc. # # Copyright (c) 2016-2017 Anuta Networks, Inc. All Rights Reserved. # # #DO NOT EDIT THIS FILE ITS AUTOGENERATED ONE #ALL THE CUSTOMIZATIONS REGARDING DATAPROCESSING SHOULD BE WRITTEN INTO service_customization.py FILE # """ Tree Structure of Handled XPATH: services | managed-cpe-services | customer | triple-cpe-site | triple-cpe-site-services | cpe-primary | ospfs | router-ospf | redistribute | redistribute-on-ospf Schema Representation: /services/managed-cpe-services/customer/triple-cpe-site/triple-cpe-site-services/cpe-primary/ospfs/router-ospf/redistribute/redistribute-on-ospf """ from servicemodel import util from servicemodel import yang from servicemodel import devicemgr from cpedeployment.cpedeployment_lib import getLocalObject from cpedeployment.cpedeployment_lib import getDeviceObject from cpedeployment.cpedeployment_lib import getCurrentObjectConfig from cpedeployment.cpedeployment_lib import ServiceModelContext from cpedeployment.cpedeployment_lib import getParentObject from cpedeployment.cpedeployment_lib import log import service_customization class RedistributeOnOspf(yang.AbstractYangServiceHandler): _instance = None def __init__(self): self.delete_pre_processor = service_customization.DeletePreProcessor() self.create_pre_processor = service_customization.CreatePreProcessor() self.opaque_args = {} def create(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor(self.create_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'redistribute_on_ospf') #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs={} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['protocol'] = config.get_field_value('protocol') inputdict['process_id'] = config.get_field_value('process_id') inputdict['route_map'] = config.get_field_value('route_map') inputdict['metric'] = config.get_field_value('metric') inputdict['metric_type'] = config.get_field_value('metric_type') inputdict['tag'] = config.get_field_value('tag') # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'cpe-primary') device_mgmt_ip_address = _Gen_obj.cpe_primary.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) # START OF FETCHING THE PARENT KEY LEAF PARAMETERS inputkeydict['managed_cpe_services_customer_triple_cpe_site_triple_cpe_site_services_cpe_primary_ospfs_router_ospf_process_id'] = sdata.getRcPath().split('/')[-3].split('=')[1] inputkeydict['managed_cpe_services_customer_triple_cpe_site_triple_cpe_site_services_site_name'] = sdata.getRcPath().split('/')[-6].split('=')[1] inputkeydict['managed_cpe_services_customer_name'] = sdata.getRcPath().split('/')[-8].split('=')[1] # END OF FETCHING THE PARENT KEY LEAF PARAMETERS #Use the custom methods to process the data service_customization.ServiceDataCustomization.process_service_create_data(smodelctx, sdata, dev, id=id, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args) #Start of Device binding with python bindings #End of Device binding #Use the custom method to process/create payload service_customization.ServiceDataCustomization.process_service_device_bindings(smodelctx, sdata, dev, id=id, device=dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args) def update(self, id, sdata): #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'redistribute_on_ospf') opaque_args = self.opaque_args #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs={} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['protocol'] = config.get_field_value('protocol') inputdict['process_id'] = config.get_field_value('process_id') inputdict['route_map'] = config.get_field_value('route_map') inputdict['metric'] = config.get_field_value('metric') inputdict['metric_type'] = config.get_field_value('metric_type') inputdict['tag'] = config.get_field_value('tag') # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'cpe-primary') device_mgmt_ip_address = _Gen_obj.cpe_primary.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) #Use the custom method to process the data service_customization.ServiceDataCustomization.process_service_update_data(smodelctx, sdata, id=id, dev=dev, parentobj=parentobj, config=config, hopaque=opaque_args, inputdict=inputdict) def delete(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor(self.delete_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'redistribute_on_ospf') opaque_args = self.opaque_args #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs={} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['protocol'] = config.get_field_value('protocol') inputdict['process_id'] = config.get_field_value('process_id') inputdict['route_map'] = config.get_field_value('route_map') inputdict['metric'] = config.get_field_value('metric') inputdict['metric_type'] = config.get_field_value('metric_type') inputdict['tag'] = config.get_field_value('tag') # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'cpe-primary') device_mgmt_ip_address = _Gen_obj.cpe_primary.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) #Use the custom method to process the data service_customization.ServiceDataCustomization.process_service_delete_data(smodelctx, sdata, id=id, dev=dev, parentobj=parentobj, config=config, hopaque=opaque_args, inputdict=inputdict) @staticmethod def getInstance(): if(RedistributeOnOspf._instance == None): RedistributeOnOspf._instance = RedistributeOnOspf() return RedistributeOnOspf._instance #def rollbackCreate(self, id, sdata): # log('rollback: id = %s, sdata = %s' % (id, sdata)) # self.delete(id,sdata) if __name__ == 'redistribute_on_ospf': from servicemodel.yang import YangServiceData sdata = YangServiceData() instance = RedistributeOnOspf().getInstance() instance.create(None, sdata) instance.delete(None, sdata) instance.update(None, sdata)
[ "sebastien.pouplin@tatacommunications.com" ]
sebastien.pouplin@tatacommunications.com
4aa730e036b56a443beadc95859cc4b8612f6a9c
d8e972616bf3a1342a33c673f7a5d52d865a0590
/build/dwr/catkin_generated/pkg.develspace.context.pc.py
a1b0eb937abec4239e60a60d3fb31e8f28018bee
[]
no_license
ms-jagadeeshan/catkin_ws
41b859be1a6562410c955ed6e19d4f2843822938
d26c72753fc4464e77da01f7cb802340f9a6aba7
refs/heads/master
2023-08-23T16:56:39.551152
2021-10-25T17:09:46
2021-10-25T17:09:46
null
0
0
null
null
null
null
UTF-8
Python
false
false
370
py
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else [] PROJECT_CATKIN_DEPENDS = "".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else [] PROJECT_NAME = "dwr" PROJECT_SPACE_DIR = "/home/jaga_matrix/catkin_ws/devel" PROJECT_VERSION = "0.0.0"
[ "jagadeeshanmsj@gmail.com" ]
jagadeeshanmsj@gmail.com
13afaec093ca5dbb37ccc72918e13c91b3555344
2bb90b620f86d0d49f19f01593e1a4cc3c2e7ba8
/pardus/tags/2011/util/shell/command-not-found/actions.py
fd6ae5ea60b235f2996161b9d5463089b352de0a
[]
no_license
aligulle1/kuller
bda0d59ce8400aa3c7ba9c7e19589f27313492f7
7f98de19be27d7a517fe19a37c814748f7e18ba6
refs/heads/master
2021-01-20T02:22:09.451356
2013-07-23T17:57:58
2013-07-23T17:57:58
null
0
0
null
null
null
null
UTF-8
Python
false
false
647
py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2008-2010 TUBITAK/UEKAE # Licensed under the GNU General Public License, version 2. # See the file http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt from pisi.actionsapi import pisitools from pisi.actionsapi import get def install(): pisitools.dobin("src/command-not-found") pisitools.insinto("/var/db/command-not-found", "data/packages-%s.db" % get.ARCH(), "packages.db") for lang in ["da", "de", "es", "fr", "hu", "it", "nl", "ru", "sv", "tr"]: pisitools.domo("po/%s.po" % lang, lang, "command-not-found.mo") pisitools.dodoc("AUTHORS", "COPYING", "README")
[ "yusuf.aydemir@istanbul.com" ]
yusuf.aydemir@istanbul.com
d872404835b430c18e23ed2bf9c6a66acdbc380b
1b6e2b0353c6c66a5110ae761b4cacb2800431e7
/collectinfo/wsgi.py
b31da9aa19c34349a808df39200b2375d8338611
[]
no_license
whodanyalahmed/datacollection_django
2030040fd5f1b7aeaac8a693cfb8f45dd71b3282
a2be2d7089f612352f85966dbf292ed3ed868084
refs/heads/master
2020-05-29T23:16:48.705635
2019-05-30T14:47:49
2019-05-30T14:47:49
189,431,351
0
0
null
null
null
null
UTF-8
Python
false
false
399
py
""" WSGI config for collectinfo project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'collectinfo.settings') application = get_wsgi_application()
[ "Daniahmedkhatri@gmail.com" ]
Daniahmedkhatri@gmail.com
39e7aecc1b16bada819da53f5040e102cf3744ad
9bb041d300b15eb367d75972f53ee3019e59050f
/test13.py
b3fec78d0615a164ab340ed3ce5a92085b2b3898
[]
no_license
201601988jj/python1
a831d610c8a4cc1277ac385c2b036e55f16f4b11
f7b408e5f7f26edf6dc26eccee9482ca851a3633
refs/heads/master
2020-06-11T14:56:46.115157
2019-07-01T07:46:26
2019-07-01T07:46:26
194,004,357
0
0
null
null
null
null
UTF-8
Python
false
false
1,342
py
import random dice1,dice2,dice3,dice4,dice5,dice6=[0]*6 throwCount, serialCount=0,0 if __name__=="__main__": while True: throwCount+=1 dice1 = random.randrange(1,7) dice2 = random.randrange(1,7) dice3 = random.randrange(1,7) dice4 = random.randrange(1,7) dice5 = random.randrange(1,7) dice6 = random.randrange(1,7) if dice1==dice2==dice3==dice4==dice5==dice6: print('6개의 주사위가 모두 동일한 숫자가 나옴 -->', dice1,dice2,dice3,dice4,dice5,dice6 ) break elif(dice1==1 or dice2==1 or dice3==1 or dice4==1 or dice5==1 or dice6==1) and \ (dice1==2 or dice2==2 or dice3==2 or dice4==2 or dice5==2 or dice6==2) and \ (dice1==3 or dice2==3 or dice3==3 or dice4==3 or dice5==3 or dice6==3) and \ (dice1==4 or dice2==4 or dice3==4 or dice4==4 or dice5==4 or dice6==4) and \ (dice1==5 or dice2==5 or dice3==5 or dice4==5 or dice5==5 or dice6==5) and \ (dice1==6 or dice2==6 or dice3==6 or dice4==6 or dice5==6 or dice6==6): serialCount+=1 print('6개가 동일한 숫자가 나올 때까지 주사위를 던진 횟수 -->', throwCount) print('6개가 동일한 숫자가 나올 때까지, 1-6의 연속번호가 나온 횟수 -->' , serialCount)
[ "cjyhk96@gmail.com" ]
cjyhk96@gmail.com
c9f081a98579c7940a16938e3d5a2e2c3e4ee725
3188d2b4e8e9869c80819e8a3d99ebace8adfd06
/(June)30_days_Challenge/insert_delete_getRandom.py
c6fa07f71e51a473763cc61e0d8f1a1fd4a77cec
[]
no_license
Divyalok123/LeetCode_Practice
78ce9ba0deb8719b71111e17ae65422d76d2a306
2ac1dd229e7154e5ddddb0c72b9bfbb9c897d825
refs/heads/master
2023-06-30T08:55:33.369349
2021-08-01T06:17:06
2021-08-01T06:17:06
256,864,709
0
0
null
null
null
null
UTF-8
Python
false
false
1,257
py
# Design a data structure that supports all following operations in average O(1) time. # insert(val): Inserts an item val to the set if not already present. # remove(val): Removes an item val from the set if present. # getRandom: Returns a random element from current set of elements. Each element must have the same probability of being returned. import random class RandomizedSet: def __init__(self): self.d = {} self.v = [] def insert(self, val: int) -> bool: if val in self.d: return False else: self.v.append(val) self.d[val] = len(self.v)-1 return True def remove(self, val: int) -> bool: if val in self.d: temp = self.v[len(self.v)-1] self.d[temp] = self.d[val] self.v[self.d[temp]] = temp self.v.pop() del self.d[val] return True else: return False def getRandom(self) -> int: return self.v[random.randint(0, len(self.v)-1)] # Your RandomizedSet object will be instantiated and called as such: # obj = RandomizedSet() # param_1 = obj.insert(val) # param_2 = obj.remove(val) # param_3 = obj.getRandom()
[ "divyjais2001@gmail.com" ]
divyjais2001@gmail.com
57f0473df75e076251d0ff6afe0e60431dd1b124
5259532bb41382bc05c7f311fdee65c67f67990e
/Tools/SampleTool/UI_SampleMainForm.py
233a453909cfe5c2f121227d1c0c5bfe19a1f080
[]
no_license
csjy309450/MLTools_PyQt4
57905cc78284d87349eda511fc78c43f3527bbeb
d1af57c279fd12428cda303d22e7a732db3ff257
refs/heads/master
2021-04-29T10:36:54.792400
2018-02-28T17:03:08
2018-02-28T17:03:08
77,835,494
0
0
null
null
null
null
UTF-8
Python
false
false
8,513
py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'SampleToolWidget.ui' # # Created by: PyQt4 UI code generator 4.11.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui import CopyForm as cf try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) class UI_SampleMainForm(object): """ UI in Sample Tool Main Widget """ def setupUi(self, Form): """ 初始化窗口UI :param Form: :return: """ self.mainForm = Form Form.setObjectName(_fromUtf8("Form")) Form.setWindowModality(QtCore.Qt.NonModal) Form.resize(705, 579) ##对象成员变量 # QLable控件中的显示图像 self.qImg = QtGui.QPixmap() self.currentFrameNum = -1 self.filePathsList = QtCore.QStringList() #获取窗口大小 self.widRect = Form.frameGeometry() ##控件布局 #定义整个垂直布局内的QWidget面板 self.VLayoutWidget = QtGui.QWidget(Form) self.VLayoutWidget.setGeometry(self.widRect) self.VLayoutWidget.setObjectName(_fromUtf8("VLayoutWidget")) #定义第一层中的两个QSlider控件 #HSlider_copyWidScale控制copyWidget窗口的尺寸 self.HSlider_copyWidScale = QtGui.QSlider(self.VLayoutWidget) self.HSlider_copyWidScale.setCursor(QtGui.QCursor(QtCore.Qt.SizeHorCursor)) self.HSlider_copyWidScale.setOrientation(QtCore.Qt.Horizontal) self.HSlider_copyWidScale.setObjectName(_fromUtf8("HSlider_copyWidScale")) #控制图片的分辨率 self.HSlider_imgScale = QtGui.QSlider(self.VLayoutWidget) self.HSlider_imgScale.setCursor(QtGui.QCursor(QtCore.Qt.SizeHorCursor)) self.HSlider_imgScale.setOrientation(QtCore.Qt.Horizontal) self.HSlider_imgScale.setObjectName(_fromUtf8("HSlider_imgScale")) # 定义滑动区域窗口内Widget面板 self.scrollAreaWidgetContents = QtGui.QWidget() # self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 100, 100)) self.scrollAreaWidgetContents.setObjectName(_fromUtf8("scrollAreaWidgetContents")) self.scrollAreaWidgetContents.setMinimumSize(1200, 1200) # 定义滑动区域面板内的QLabel对象 self.label = QtGui.QLabel(self.scrollAreaWidgetContents) # self.label.setGeometry(QtCore.QRect(0, 0, 500, 500)) # self.label.setPixmap(self.img) # self.label.setGeometry(self.img.rect()) # self.label.setObjectName(_fromUtf8("label")) # self.scrollAreaWidgetContents.setMinimumSize(self.img.size()) #滑动区域窗口 self.scrollArea = QtGui.QScrollArea(self.VLayoutWidget) self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName(_fromUtf8("scrollArea")) self.scrollArea.setAutoFillBackground(True) self.scrollArea.setWidgetResizable(True) self.scrollArea.setGeometry(QtCore.QRect(0, 0, 80, 80)) self.scrollArea.setWidget(self.scrollAreaWidgetContents) ##layout #定义内层布局的横向网格 self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) #加入之前定义的滑动条 self.horizontalLayout.addWidget(self.HSlider_copyWidScale) self.horizontalLayout.addWidget(self.HSlider_imgScale) #按顺序定义外层布局的纵向网格 self.verticalLayout = QtGui.QVBoxLayout(self.VLayoutWidget) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) #按顺序加入定义好的横向网格和滑动区域对象 self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout.addWidget(self.scrollArea) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) self.__InitMenubar() def __InitMenubar(self): action_exit = QtGui.QAction(QtGui.QIcon(), '&exit', self.mainForm) action_exit.triggered.connect(self.mainForm.close) action_load = QtGui.QAction(QtGui.QIcon(), '&load', self.mainForm) action_load.triggered.connect(self.On_Action_Load) action_next = QtGui.QAction(QtGui.QIcon(), '&next', self.mainForm) action_next.triggered.connect(self.On_Action_Next) action_previous = QtGui.QAction(QtGui.QIcon(), '&previous', self.mainForm) action_previous.triggered.connect(self.On_Action_Previous) action_screenShot = QtGui.QAction(QtGui.QIcon(), '&screen shot', self.mainForm) action_screenShot.triggered.connect(self.On_Action_ScreenShot) menubar = self.mainForm.menuBar() fileMenu = menubar.addMenu('&file') fileMenu.addAction(action_load) fileMenu.addAction(action_next) fileMenu.addAction(action_previous) fileMenu.addAction(action_screenShot) fileMenu.addAction(action_exit) def On_Action_Load(self, event): self.filePathsList = QtGui.QFileDialog.getOpenFileNames(self.mainForm, 'Open file', '/home') for filePath in self.filePathsList: print filePath print self.filePathsList.count() self.currentFrameNum = -1 self.On_Action_Next(None) def __getParentClientSize(self): return self.scrollArea.size() - QtCore.QSize( self.scrollArea.verticalScrollBar().width(), self.scrollArea.horizontalScrollBar().height()) def showImage(self): dis = (abs(self.horizontalLayout.geometry().left() - 0), abs(self.horizontalLayout.geometry().right() - self.mainForm.width()), abs(self.horizontalLayout.geometry().top() - 0), abs(self.mainForm.height() - self.scrollArea.geometry().bottom())) #从文件夹加载图像 self.qImg.load(self.filePathsList[self.currentFrameNum]) #显示到QLabel对象,并调整QLabel对象的尺寸为图像尺寸 self.label.setPixmap(self.qImg) self.label.setGeometry(self.qImg.rect()) # #设置 QScrollArea 对象中 QWidget 区域的大小 self.scrollAreaWidgetContents.setMinimumSize(self.qImg.size()) # # #根据图像大小调整scrollArea大小 self.scrollArea.setMaximumSize(self.qImg.size() + QtCore.QSize(self.scrollArea.verticalScrollBar().width(), self.scrollArea.horizontalScrollBar().height())) #求当前图像对象的基础上窗口允许的最大尺寸 # print self.horizontalLayout.geometry() # print self.mainForm.size() # print self.scrollArea.geometry() # print dis self.mainForm.setMaximumSize(self.scrollArea.maximumSize() + QtCore.QSize( dis[0]+dis[1], self.HSlider_imgScale.height()+dis[2]+dis[3])) def On_Action_Next(self, event): if self.currentFrameNum + 1 < self.filePathsList.count(): self.currentFrameNum += 1 self.showImage() self.mainForm.repaint() try: self.copyForm.UpdateImg() except Exception, e: pass def On_Action_Previous(self, event): if self.currentFrameNum - 1 >= 0: self.currentFrameNum -= 1 self.showImage() self.mainForm.repaint() try: self.copyForm.UpdateImg() except Exception, e: pass def On_Action_ScreenShot(self, event): self.copyForm = cf.CopyForm(self.qImg, self.scrollArea) # self.mainForm.connect(self.copyForm._sinal, QtCore.SIGNAL('Signal_Key(PyQt_PyObject)'), # self.mainForm, QtCore.SLOT("On_Key_CopyForm(PyQt_PyObject)")) self.mainForm.connect(self.copyForm, QtCore.SIGNAL('Signal_Key(PyQt_PyObject)'), self.mainForm, QtCore.SLOT("On_Key_CopyForm(PyQt_PyObject)")) def retranslateUi(self, Form): """ :param Form: :return: """ Form.setWindowTitle(_translate("Form", "Sample Tool", None))
[ "=" ]
=
9c9211ba0a7b37926a9c19db8e22a715e5849baa
14dc1c553c740766f24159343051a192be6a1294
/shop/migrations/0003_contact.py
538c6bf896233d8a2ae3c89b3fe06960ccb6457e
[]
no_license
rishabhm409/webD_e-commerce
f6792f9ca61d886baad3d08edb8fed1c82fc451d
99d9a936240ae4bb3bccb4ad7e1e448166d9a79c
refs/heads/master
2022-07-29T12:17:23.479395
2020-05-18T13:13:52
2020-05-18T13:13:52
264,943,620
0
0
null
null
null
null
UTF-8
Python
false
false
650
py
# Generated by Django 2.2.4 on 2019-08-06 15:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('shop', '0002_remove_product_product_id'), ] operations = [ migrations.CreateModel( name='Contact', fields=[ ('msg_id', models.AutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=50)), ('email', models.CharField(max_length=50)), ('phone', models.CharField(max_length=50)), ('desc', models.TextField()), ], ), ]
[ "rishabhm409@gmail.com" ]
rishabhm409@gmail.com
b620ecedc10b8b97f2771f940664f15bf9ea5af2
13e6686b9c6cda9c68ec8a549229678500e90bd8
/perf_numba.py
afa9cded997bdc079cfc824d9f90b58a1dffdd38
[ "MIT" ]
permissive
pyatcoder/Microbenchmarks
461923a0c9801ec6d8b149aa848a976b79cac273
3595305060974cd0442fbc604219b1eea5081c35
refs/heads/master
2020-07-23T12:39:01.008143
2019-10-27T02:15:48
2019-10-27T02:15:48
207,558,195
0
0
NOASSERTION
2019-09-10T12:50:36
2019-09-10T12:50:36
null
UTF-8
Python
false
false
6,992
py
import numpy as np from numpy.linalg import matrix_power from numpy.random import default_rng, PCG64 from numba import jit import time rg = default_rng() x = PCG64() f_pcg64 = x.ctypes.next_double state_addr = x.ctypes.state_address ## fibonacci ## @jit(nopython=True, cache=True) def fib(n): if n < 2: return n return fib(n-1)+fib(n-2) ## quicksort ## @jit(nopython=True, cache=True) def qsort_kernel(a, lo, hi): i = lo j = hi while i < hi: pivot = a[(lo+hi) // 2] while i <= j: while a[i] < pivot: i += 1 while a[j] > pivot: j -= 1 if i <= j: a[i], a[j] = a[j], a[i] i += 1 j -= 1 if lo < j: qsort_kernel(a, lo, j) lo = i j = hi return a ## randmatstat ## @jit(nopython=True, cache=True) def randmatstat_core(t, a, b, c, d): v = np.zeros(t) w = np.zeros(t) for i in range(t): P = np.hstack((a[i], b[i], c[i], d[i])) Q = np.vstack((np.hstack((a[i], b[i])), np.hstack((c[i], d[i])))) v[i] = np.trace(matrix_power(P.T @ P, 4)) w[i] = np.trace(matrix_power(Q.T @ Q, 4)) return np.std(v)/np.mean(v), np.std(w)/np.mean(w) def randmatstat(t): n = 5 a = rg.standard_normal((t, n, n)) b = rg.standard_normal((t, n, n)) c = rg.standard_normal((t, n, n)) d = rg.standard_normal((t, n, n)) return randmatstat_core(t, a, b, c, d) ## randmatmul ## # https://docs.scipy.org/doc/numpy/reference/random/extending.html @jit(nopython=True) def pcg64_random(n, state): out = np.empty((n, n)) for i in range(n): for j in range(n): out[i, j] = f_pcg64(state) return out @jit(nopython=True) def randmatmul(n, state): a = pcg64_random(n, state) b = pcg64_random(n, state) return np.dot(a, b) ## mandelbrot ## @jit(nopython=True, cache=True) def abs2(z): return z.real*z.real + z.imag*z.imag @jit(nopython=True, cache=True) def mandel(z): maxiter = 80 c = z for n in range(maxiter): if abs2(z) > 4: return n z = z*z + c return maxiter @jit(nopython=True, cache=True) def mandelperf(): a = np.empty((21, 26), dtype=np.int64) for i in range(21): for r in range(26): a[i, r] = mandel(complex((r - 20)/10, (i - 10)/10)) return a @jit(nopython=True, cache=True) def pisum(): sum = 0.0 for j in range(500): sum = 0.0 for k in range(1, 10001): sum += 1.0/(k*k) return sum @jit(nopython=True, cache=True) def hex(b): x = b // 16 y = b % 16 return x + 48 if x < 10 else x + 55, y + 48 if y < 10 else y + 55 @jit(nopython=True, cache=True) def toint(x, y): a1 = x - 48 if x < 58 else x - 55 a2 = y - 48 if y < 58 else y - 55 return a1 * 16 + a2 @jit(nopython=True, cache=True) def int2hex(a): t = a.shape[0] u = np.empty(8 * t, dtype=np.int32) a8 = np.frombuffer(a, dtype=np.uint8) for i in range(t): for j in range(4): u[8 * i + 6 - 2 * j], u[8 * i + 7 - 2 * j] = hex(a8[4 * i + j]) return u @jit(nopython=True, cache=True) def hex2int(v): t = v.shape[0] // 8 b8 = np.empty(4 * t, dtype=np.uint8) for i in range(t): for j in range(4): b8[4 * i + j] = toint(v[8 * i + 6 - 2 * j], v[8 * i + 7 - 2 * j]) return np.frombuffer(b8, dtype=np.uint32) def parse_int(t): a = np.random.randint(0, 2 ** 32 - 1, t, dtype=np.uint32) u = int2hex(a) s = np.frombuffer(u, dtype='<U8') v = np.frombuffer(s, dtype=np.int32) b = hex2int(v) assert (a == b).all() return b[t - 1] @jit(nopython=True, cache=True) def int2ascii(n, asc): d = 0 while n > 0: asc[d] = n % 10 + 48 n = n // 10 d += 1 return d @jit(nopython=True, cache=True) def printfd_core(buf, start, t, buf_size): num = 0 asc = np.empty(20, dtype=np.int8) i = start while i < t: d = int2ascii(i, asc) for j in range(d - 1, -1, -1): buf[num] = asc[j] num += 1 buf[num] = 32 num += 1 d = int2ascii(i + 1, asc) for j in range(d - 1, -1, -1): buf[num] = asc[j] num += 1 buf[num] = 10 num += 1 i += 1 if num > buf_size: break return num, i def printfd(t): buf_size = 10000 buf = np.empty(buf_size + 50, dtype='u1') start = 1 with open("/dev/null", "wb") as f: # with open("test.txt", "wb") as f: #テスト用 while start < t: num, start = printfd_core(buf, start, t, buf_size) f.write(buf[:num].tobytes()) def print_perf(name, time): print("numba," + name + "," + str(time*1000)) ## run tests ## if __name__=="__main__": mintrials = 5 assert fib(20) == 6765 tmin = float('inf') for i in range(mintrials): t = time.time() f = fib(20) t = time.time()-t if t < tmin: tmin = t print_perf("recursion_fibonacci", tmin) tmin = float('inf') for i in range(mintrials): t = time.time() n = parse_int(1000) t = time.time()-t if t < tmin: tmin = t print_perf ("parse_integers", tmin) assert mandelperf().sum() == 14791 tmin = float('inf') for i in range(mintrials): t = time.time() mandelperf() t = time.time()-t if t < tmin: tmin = t print_perf ("userfunc_mandelbrot", tmin) tmin = float('inf') for i in range(mintrials): lst = rg.random(5000) t = time.time() qsort_kernel(lst, 0, len(lst)-1) t = time.time()-t if t < tmin: tmin = t print_perf ("recursion_quicksort", tmin) tmin = float('inf') for i in range(mintrials): lst = rg.random(5000) t = time.time() lst.sort() t = time.time()-t if t < tmin: tmin = t print_perf ("quicksort", tmin) assert abs(pisum()-1.644834071848065) < 1e-6 tmin = float('inf') for i in range(mintrials): t = time.time() pisum() t = time.time()-t if t < tmin: tmin = t print_perf ("iteration_pi_sum", tmin) (s1, s2) = randmatstat(1000) assert s1 > 0.5 and s1 < 1.0 tmin = float('inf') for i in range(mintrials): t = time.time() randmatstat(1000) t = time.time()-t if t < tmin: tmin = t print_perf ("matrix_statistics", tmin) tmin = float('inf') for i in range(mintrials): t = time.time() C = randmatmul(1000, state_addr) assert C[0,0] >= 0 t = time.time()-t if t < tmin: tmin = t print_perf ("matrix_multiply", tmin) tmin = float('inf') for i in range(mintrials): t = time.time() printfd(100000) t = time.time()-t if t < tmin: tmin = t print_perf ("print_to_file", tmin)
[ "teku@awoni.net" ]
teku@awoni.net
8b23902369e967b38763914876192dfa443865a8
43905bbb78a98b3b7464a059d57a01d2590ec437
/Py_Udemy1/Working With Return Values.py
431866906194f0e3e57c2e40fbb9c9fd7a0cadc5
[]
no_license
sharamamule/Py_Learn
1ee61c84e3228cb5b1bda91918ba8f6400460051
de00dea73dc12411617df621528542a3881c1ee5
refs/heads/master
2020-03-28T21:54:47.029327
2018-09-17T21:41:05
2018-09-17T21:41:05
149,191,393
0
0
null
null
null
null
UTF-8
Python
false
false
732
py
""" Whenever we write method we need to write 'dock-string' -like notes with in the method explaining what method is doing. """ def sum_nums(n1,n2): ## dock string example : """ Get sum of two numbers :param n1: :param n2: :return: """ return n1 + n2 sum1 = sum_nums(2,3) sum2 = sum_nums(10,5) string_add =sum_nums('Po ','bey') # This will concatinate and prints, hence a method can take any values strings,values once defined print(sum1) print(string_add) print ("*********************") def isMetro(city): l=['Hyd','Banglre','BZA','Chennai'] if city in l: return True else: return False x= isMetro('Kerala') print(x)
[ "noreply@github.com" ]
noreply@github.com
b9703a3bbb2b20023885c2f3ba74b9e79f428723
7de165c12f7940ec6a7563ba31aec4e3c342aa28
/json_zip.py
d030fec80ee5397d28077a5d988636c177d2b731
[]
no_license
rohanaras/radio
3823da8c940f38a7b035920f41970c284f8e8040
6ad065b173ee5339c9d966c189dfea5469e197ea
refs/heads/master
2022-04-27T00:39:18.004808
2020-04-28T19:24:03
2020-04-28T19:24:03
259,730,666
0
0
null
2020-04-28T19:22:44
2020-04-28T19:22:43
null
UTF-8
Python
false
false
258
py
import zlib, json, base64 ZIPJSON_KEY = 'base64(zip(o))' def json_zip(j): j = { ZIPJSON_KEY: base64.b64encode( zlib.compress( json.dumps(j).encode('utf-8') ) ).decode('ascii') } return j
[ "trd4@me.com" ]
trd4@me.com
d615b3f87e95f821b1ad96c4a961165d3dcfb242
1924da60fa3298e386acc6dac9bd390784a9b5bb
/test18.py
2eaca7b55757608822e1ea3f6eebcce199ba5a68
[]
no_license
yukitomo/NLP100DrillExercises
c8a177b56f798cef225ace540e965809a1fc1fbc
ea2ceb366de1fa1f27d084e3b9328cc6f34ac1dd
refs/heads/master
2020-06-01T02:55:11.423238
2015-06-10T15:39:03
2015-06-10T15:39:03
37,205,750
1
0
null
null
null
null
UTF-8
Python
false
false
425
py
#!/usr/bin/python #-*-coding:utf-8-*- #(18) 仙台市の住所らしき表現にマッチする正規表現を各自で設計し,抽出せよ. #python test18.py tweet.txt import sys import re pattern = re.compile(u'(仙台市)([^\s\w\d ]{1,20}[\d0-9〇一-九十上下東西]+)*') for line in sys.stdin: line = line.decode("utf-8") match=pattern.search(line) if match: print match.group(0).encode("utf-8")
[ "over.the.tr0ouble@gmail.com" ]
over.the.tr0ouble@gmail.com
7d1cce50ff5c0adc9da8f7541f86fbac58d2e9ad
318d586c90441bb53a6f31638b0012821131d796
/web/card_data.py
b566e12d9624e2850f701df8b1664f616192806f
[]
no_license
samrroyall/info.rm
d2395be1f0dffee952d9349033b535723ed03f54
ededbad946a83a1ab547fb1dcb71c068bf3917f6
refs/heads/master
2023-04-03T04:00:14.855962
2021-04-07T22:35:00
2021-04-07T22:35:00
238,979,824
0
0
null
null
null
null
UTF-8
Python
false
false
10,348
py
from django.db.models import F, FloatField, QuerySet from django.db.models.functions import Cast from typing import Dict, List, Union from .card import Card, DashCard, BioCard, CardList from .models import Season, League, Player, PlayerStat from .queryset import get_max ################################# ##### CACHE AND HELPERS ##### ################################# card_cache = { # '{League.league_id}-{Season.start_year}-{per_ninety}' -> List[ CardList ] } def clear_cache() -> None: card_cache = {} def card_cache_key(season: Season, per_ninety: bool, league: League) -> str: league_str = "Top5" if league is None else league.league_id return f"{league_str}-{season.start_year}-{per_ninety}" def get_from_cache(season: Season, per_ninety: bool, league: League) -> List[CardList]: return card_cache.get(card_cache_key(season, per_ninety, league)) def insert_to_cache(season: Season, per_ninety: bool, league: League, data: List[CardList]) -> None: card_cache[card_cache_key(season, per_ninety, league)] = data ################################# #### CARD DATA FUNCTIONS #### ################################# def get_dashboard_data(queryset: QuerySet, per_ninety: bool) -> List[CardList]: # GOALS CARDS goals_card = DashCard.from_queryset( queryset=queryset, per_ninety=per_ninety, field="goals" ) assists_card = DashCard.from_queryset( queryset=queryset, per_ninety=per_ninety, field="assists" ) goal_contributions_card = DashCard.from_queryset( queryset=queryset, per_ninety=per_ninety, field=F("goals")+F("assists"), title="Goal Contributions" ) goals_per_shot_card = DashCard.from_queryset( queryset=queryset, per_ninety=False, field=Cast(F("goals"), FloatField())/Cast(F("shots"), FloatField()), title="Goals Per Shot", lambdas=[lambda q: q.filter( shots__gte=get_max(q, "shots")/5 )] ) shots_card = DashCard.from_queryset( queryset=queryset, per_ninety=per_ninety, field="shots" ) shots_on_target_card = DashCard.from_queryset( queryset=queryset, per_ninety=per_ninety, field="shots_on_target" ) # PASSES CARDS key_passes_card = DashCard.from_queryset( queryset=queryset, per_ninety=per_ninety, field="passes_key", title="Key Passes" ) passes_card = DashCard.from_queryset( queryset=queryset, per_ninety=per_ninety, field="passes" ) pass_accuracy_card = DashCard.from_queryset( queryset=queryset, per_ninety=False, field="passes_accuracy", title="Pass Accuracy", pct=True, lambdas=[lambda q: q.filter( passes__gte=get_max(q, "passes")/5 )] ) # DRIBBLES CARDS successful_dribbles_card = DashCard.from_queryset( queryset=queryset, per_ninety=per_ninety, field="dribbles_succeeded", title="Successful Dribbles" ) attempted_dribbles_card = DashCard.from_queryset( queryset=queryset, per_ninety=per_ninety, field="dribbles_attempted", title="Attempted Dribbles" ) dribble_success_rate_card = DashCard.from_queryset( queryset=queryset, per_ninety=False, field="dribbles_succeeded_pct", title="Dribble Success Rate", pct=True, lambdas=[ lambda q: q.filter( dribbles_attempted__gte=get_max(q, "dribbles_attempted")/5 ) ] ) # DEFENSIVE CARDS tackles_card = DashCard.from_queryset( queryset=queryset, per_ninety=per_ninety, field="tackles" ) interceptions_card = DashCard.from_queryset( queryset=queryset, per_ninety=per_ninety, field="interceptions" ) blocks_card = DashCard.from_queryset( queryset=queryset, per_ninety=per_ninety, field="blocks" ) # EXTRA CARDS rating_card = DashCard.from_queryset( queryset=queryset, per_ninety=False, field="rating", title="Player Rating" ) goals_conceded_card = DashCard.from_queryset( queryset=queryset, per_ninety=True, field="goals_conceded", desc=False, lambdas=[ lambda q: q.filter(position=PlayerStat.get_position("goalkeeper")), lambda q: q.filter(minutes_played__gte=get_max(q, "minutes_played")/4) ] ) penalties_saved_card = DashCard.from_queryset( queryset=queryset, per_ninety=False, field="penalties_saved" ) return [ CardList([ goals_card, assists_card, goal_contributions_card, goals_per_shot_card ]), CardList([ shots_card, shots_on_target_card ]), CardList([ key_passes_card, passes_card, pass_accuracy_card ]), CardList([ successful_dribbles_card, attempted_dribbles_card, dribble_success_rate_card ]), CardList([ tackles_card, interceptions_card, blocks_card ] ), CardList([ rating_card, goals_conceded_card, penalties_saved_card ]) ] def get_player_data( playerstat: PlayerStat, per_ninety: bool ) -> Dict[str, List[CardList]]: player_data = {} # create bio card player_data["bio"] = CardList([ BioCard.from_playerstat(playerstat) ]) # create player stat card attacking_card = Card.from_list( title="Scoring", per_ninety=per_ninety, minutes_played=playerstat.minutes_played, stats=[ { "title": "Goals", "value": playerstat.goals }, { "title": "Goals Per Shot", "value": float(playerstat.goals)/playerstat.shots if playerstat.goals > 0 else 0.0, "per_ninety": False, }, { "title": "Shots On Target", "value": playerstat.shots_on_target }, { "title": "Shots", "value": playerstat.shots }, { "title": "Shots On Target %", "value": playerstat.shots_on_target_pct, "per_ninety": False, "pct": True }, { "title": "Penalties Scored", "value": playerstat.penalties_scored }, { "title": "Penalties Taken", "value": playerstat.penalties_taken }, { "title": "Penalty Success Rate", "value": playerstat.penalties_scored_pct, "per_ninety": False, "pct": True, }, ] ) creation_card = Card.from_list( title="Attacking", per_ninety=per_ninety, minutes_played=playerstat.minutes_played, stats=[ { "title": "Assists", "value": playerstat.assists }, { "title": "Passes", "value": playerstat.passes }, { "title": "Key Passes", "value": playerstat.passes_key }, { "title": "Pass Accuracy", "value": playerstat.passes_accuracy, "per_ninety": False, "pct": True, }, { "title": "Successful Dribble", "value": playerstat.dribbles_succeeded }, { "title": "Attempted Dribbles", "value": playerstat.dribbles_attempted }, { "title": "Dribble Success Rate", "value": playerstat.dribbles_succeeded_pct, "per_ninety": False, "pct": True, }, { "title": "Fouls Drawn", "value": playerstat.fouls_drawn }, { "title": "Penalties Drawn", "value": playerstat.penalties_won }, ] ) defensive_card = Card.from_list( title="Defense", per_ninety=per_ninety, minutes_played=playerstat.minutes_played, stats=[ { "title": "Blocks", "value": playerstat.blocks }, { "title": "Tackles", "value": playerstat.tackles }, { "title": "Interceptions", "value": playerstat.interceptions }, { "title": "Successful Duels", "value": playerstat.duels_won }, { "title": "Attempted Duels", "value": playerstat.duels }, { "title": "Duel Success Rate", "value": playerstat.duels_won_pct, "per_ninety": False, "pct": True, }, ] ) gameplay_card = Card.from_list( title="Gameplay", per_ninety=per_ninety, minutes_played=playerstat.minutes_played, stats=[ { "title": "Minutes Played", "value": playerstat.minutes_played, "per_ninety": False }, { "title": "Appearances", "value": playerstat.appearances, "per_ninety": False }, { "title": "Starts", "value": playerstat.starts, "per_ninety": False }, { "title": "Benches", "value": playerstat.benches, "per_ninety": False }, { "title": "Substitutions In", "value": playerstat.substitutions_in, "per_ninety": False }, { "title": "Substitutions Out", "value": playerstat.substitutions_out, "per_ninety": False }, ] ) fouling_card = Card.from_list( title="Fouling", per_ninety=per_ninety, minutes_played=playerstat.minutes_played, stats=[ { "title": "Yellow Cards", "value": playerstat.yellows, "per_ninety": False }, { "title": "Red Cards", "value": playerstat.reds, "per_ninety": False }, { "title": "Fouls Committed", "value": playerstat.fouls_committed }, { "title": "Penalties Committed", "value": playerstat.penalties_committed }, ] ) goalkeeping_card = Card.from_list( title="Goalkeeping", per_ninety=per_ninety, minutes_played=playerstat.minutes_played, stats=[ { "title": "Goals Conceded", "value": playerstat.goals_conceded }, { "title": "Goals Saved", "value": playerstat.goals_saved }, { "title": "Penalties Saved", "value": playerstat.penalties_saved, "per_ninety": False }, ] ) player_data["stats"] = CardList([ attacking_card, creation_card, defensive_card, gameplay_card, fouling_card, goalkeeping_card ]) return player_data
[ "samrroyall@gmail.com" ]
samrroyall@gmail.com
a739260990dcef7590c8a2791552f0ca720b2c2a
647c7c6b21afece465585699c2dd4d1949cb160a
/config.py
69e4228c3dee0b716be5b2297343ecd93746ac59
[]
no_license
jting2013/National_Grid_Web_Scraping
41395454c0999e64d56291264ee45db402dc76c2
663c7601faedb2f952d721e8db74eb643ddf87f4
refs/heads/master
2022-05-10T15:34:34.752865
2022-05-05T16:14:27
2022-05-05T16:14:27
164,162,494
0
0
null
2022-05-05T16:14:27
2019-01-04T22:53:04
Python
UTF-8
Python
false
false
181
py
Username_Electric = 'login@yahoo.com' Username = 'username' Password = 'password' Email_From = 'fromemail@hotmail.com' Email_PW_From = 'frompassword' Email_To = 'toemail@yahoo.com'
[ "jting2013@yahoo.com" ]
jting2013@yahoo.com
e43680be54a96bf074498a59db3df72db549e964
eb59f8212f40bd7c316e1ef3be03bf7da3dde65f
/annotated2_0/scr_uli.py
be140b857a325143f149a0a5aefd35636edbe6d3
[]
no_license
shtkn/frameDataParser
764cc3197051966717990f7ca3eb2f02639cf438
690d44d4bf188a14c4e5ebebd95bdc75b827f5e5
refs/heads/master
2021-07-05T00:52:53.316670
2020-10-03T18:16:52
2020-10-03T18:16:52
187,556,058
0
0
null
2019-11-25T05:36:06
2019-05-20T02:40:24
Python
UTF-8
Python
false
false
280,392
py
@Subroutine def PreInit(): Unknown12019('756c6900000000000000000000000000') Unknown12050(1) @Subroutine def MatchInit(): DashFAccel(1000) DashFMaxVelocity(32000) JumpYVelocity(31500) SuperJumpYVelocity(38000) DoubleJumpCount(2) Unknown12038(23000) Unknown12034(33) SuperFreezeDuration(-1500) AirBDashDuration(13) Unknown12037(-1800) Unknown12024(2) Unknown13039(1) Unknown2049(1) Unknown15018(2000) Move_Register('AutoFDash', 0x0) Unknown14009(6) Move_AirGround_(0x2000) Move_Input_(0x78) Unknown14013('CmnActFDash') Move_EndRegister() Move_Register('NmlAtk5A', 0x7) MoveMaxChainRepeat(1) Unknown14020(1) Unknown14015(0, 300000, -200000, 150000, 2000, 50) Move_EndRegister() Move_Register('AN_NmlAtk5A_2nd', 0x7) MoveMaxChainRepeat(1) Unknown14020(1) Unknown14005(1) Unknown15013(2000) Unknown14015(0, 350000, -200000, 200000, 1000, 50) Move_EndRegister() Move_Register('AN_NmlAtk5A_3rd', 0x7) MoveMaxChainRepeat(1) Unknown14020(1) Unknown14005(1) Unknown15013(2000) Unknown14015(0, 430000, -200000, 230000, 1000, 50) Move_EndRegister() Move_Register('AN_NmlAtk5A_4th', 0x7) MoveMaxChainRepeat(1) Unknown14020(1) Unknown14005(1) Unknown14015(0, 800000, -200000, 230000, 1000, 50) Move_EndRegister() Move_Register('NmlAtk4A', 0x6) MoveMaxChainRepeat(1) Unknown14020(1) Unknown14015(0, 250000, -200000, 150000, 1500, 50) Move_EndRegister() Move_Register('AN_NmlAtk4A_2nd', 0x6) MoveMaxChainRepeat(1) Unknown14020(1) Unknown14005(1) Unknown15013(4000) Unknown14015(0, 350000, -200000, 200000, 1000, 50) Move_EndRegister() Move_Register('AN_NmlAtk4A_3rd', 0x6) MoveMaxChainRepeat(1) Unknown14020(1) Unknown14005(1) Unknown15013(4000) Unknown14015(0, 350000, -200000, 200000, 1000, 50) Move_EndRegister() Move_Register('AN_NmlAtk4A_4th', 0x6) Unknown14013('AN_NmlAtk5A_4th') MoveMaxChainRepeat(1) Unknown14020(1) Unknown14005(1) Unknown15013(4000) Unknown14015(0, 800000, -200000, 230000, 1000, 50) Move_EndRegister() Move_Register('NmlAtk2A', 0x4) MoveMaxChainRepeat(1) Unknown14020(1) Unknown14015(0, 200000, -100000, 100000, 1200, 50) Move_EndRegister() Move_Register('NmlAtk2A_Renda', 0x4) Unknown14005(1) MoveMaxChainRepeat(2) Unknown15013(3000) Unknown14015(0, 200000, -100000, 100000, 1000, 50) Move_EndRegister() Move_Register('NmlAtk5B', 0x19) MoveMaxChainRepeat(1) Unknown14020(1) Unknown15021(1500) Unknown15006(3000) Unknown14015(0, 500000, 100000, 400000, 800, 10) Move_EndRegister() Move_Register('NmlAtk2B', 0x16) MoveMaxChainRepeat(1) Unknown14020(1) Unknown15009() Unknown15021(1) Unknown14015(0, 400000, -100000, 100000, 1000, 50) Move_EndRegister() Move_Register('AN_NmlAtk5B_2nd', 0x19) MoveMaxChainRepeat(1) Unknown14020(1) Unknown14005(1) Unknown15013(4000) Unknown14015(0, 500000, -200000, 400000, 1000, 50) Move_EndRegister() Move_Register('AN_NmlAtk5B_3rd', 0x19) MoveMaxChainRepeat(1) Unknown14020(1) Unknown14005(1) Unknown15013(4000) Unknown14015(0, 500000, -200000, 350000, 1000, 50) Move_EndRegister() Move_Register('CmnActCrushAttack', 0x66) Unknown15008() Unknown14015(0, 450000, -200000, 200000, 500, 25) Move_EndRegister() Move_Register('NmlAtk2C', 0x28) MoveMaxChainRepeat(1) Unknown14020(1) Unknown15009() Unknown14015(200000, 430000, -100000, 50000, 500, 25) Move_EndRegister() Move_Register('NmlAtk3C', 0x29) Unknown15000(0) Unknown15003(0) Move_EndRegister() Move_Register('NmlAtkAIR5A', 0x10) MoveMaxChainRepeat(1) Unknown14015(-100000, 250000, -300000, 100000, 1500, 50) Move_EndRegister() Move_Register('NmlAtkAIR5A_2nd', 0x10) MoveMaxChainRepeat(1) Unknown14005(1) Move_EndRegister() Move_Register('NmlAtkAIR5B', 0x22) MoveMaxChainRepeat(1) Unknown14015(-100000, 350000, -200000, 200000, 1000, 50) Move_EndRegister() Move_Register('NmlAtkAIR5C', 0x34) MoveMaxChainRepeat(1) Unknown14015(0, 350000, -500000, 0, 800, 40) Move_EndRegister() Move_Register('CmnActChangePartnerQuickOut', 0x63) Move_EndRegister() Move_Register('NmlAtkThrow', 0x5d) Unknown15010() Unknown15021(1) Unknown15013(1) Unknown14015(0, 350000, -200000, 200000, 1000, 0) Move_EndRegister() Move_Register('NmlAtkBackThrow', 0x61) Unknown15010() Unknown15021(1) Unknown15013(1) Unknown14015(0, 350000, -200000, 200000, 1000, 0) Move_EndRegister() Move_Register('ShotDashCancel', INPUT_SPECIALMOVE) Unknown14005(1) Move_AirGround_(0x2000) Move_Input_(0xda) Move_EndRegister() Move_Register('Shot_A', INPUT_SPECIALMOVE) Move_AirGround_(0x2000) Move_Input_(INPUT_236) Move_Input_(INPUT_PRESS_A) Unknown15013(1) Unknown15012(1) Unknown15014(1) Unknown15021(1) Unknown14015(300000, 700000, -200000, 100000, 500, 10) Move_EndRegister() Move_Register('Shot_B', INPUT_SPECIALMOVE) Move_AirGround_(0x2000) Move_Input_(INPUT_236) Move_Input_(INPUT_PRESS_B) Unknown15013(1) Unknown15012(1) Unknown15014(1) Unknown15021(1) Unknown14015(400000, 800000, -200000, 100000, 500, 10) Move_EndRegister() Move_Register('Assault_A', INPUT_SPECIALMOVE) Move_AirGround_(0x2000) Move_Input_(INPUT_214) Move_Input_(INPUT_PRESS_A) Unknown15013(1) Unknown15012(2500) Unknown14015(0, 450000, -200000, 100000, 100, 10) Move_EndRegister() Move_Register('Assault_A_Hasei', INPUT_SPECIALMOVE) Move_AirGround_(0x2000) Move_Input_(0xed) Unknown14005(1) Unknown15021(2000) Unknown14015(-250000, 250000, -200000, 200000, 750, 50) Move_EndRegister() Move_Register('Assault_B', INPUT_SPECIALMOVE) Move_AirGround_(0x2000) Move_Input_(INPUT_214) Move_Input_(INPUT_PRESS_B) Unknown15008() Unknown15016(1, 10, 20) Unknown14015(0, 450000, -200000, 200000, 500, 10) Move_EndRegister() Move_Register('AirShot_A', INPUT_SPECIALMOVE) Move_AirGround_(0x2001) Move_Input_(INPUT_236) Move_Input_(INPUT_PRESS_A) Unknown15013(1) Unknown15012(1) Unknown15014(1) Unknown14015(300000, 700000, -500000, -100000, 500, 0) Move_EndRegister() Move_Register('AirShot_B', INPUT_SPECIALMOVE) Move_AirGround_(0x2001) Move_Input_(INPUT_236) Move_Input_(INPUT_PRESS_B) Unknown15013(1) Unknown15012(1) Unknown15014(1) Unknown14015(300000, 800000, -300000, 100000, 500, 0) Move_EndRegister() Move_Register('Shot_EX', INPUT_SPECIALMOVE) Move_AirGround_(0x2000) Move_AirGround_(0x3086) Move_Input_(INPUT_236) Move_Input_(INPUT_PRESS_C) Unknown15021(1) Unknown14015(0, 800000, -200000, 150000, 250, 20) Move_EndRegister() Move_Register('Assault_EX', INPUT_SPECIALMOVE) Move_AirGround_(0x2000) Move_AirGround_(0x3086) Move_Input_(INPUT_214) Move_Input_(INPUT_PRESS_C) Unknown15008() Unknown14015(0, 600000, -200000, 200000, 100, 20) Move_EndRegister() Move_Register('AirShot_EX', INPUT_SPECIALMOVE) Move_AirGround_(0x2001) Move_AirGround_(0x3086) Move_Input_(INPUT_236) Move_Input_(INPUT_PRESS_C) Unknown15021(1) Unknown14015(300000, 700000, -100000, -500000, 100, 0) Move_EndRegister() Move_Register('CmnActInvincibleAttack', 0x64) Unknown15013(0) Unknown15012(0) Unknown15014(6000) Unknown15020(500, 1000, 100, 1000) Unknown14015(0, 300000, -100000, 300000, 250, 5) Move_EndRegister() Move_Register('CmnActInvincibleAttackAir', 0x65) Unknown15013(0) Unknown15012(0) Unknown15014(6000) Unknown15020(500, 1000, 100, 1000) Unknown14015(0, 300000, -100000, 300000, 250, 5) Move_EndRegister() Move_Register('UltimateRush', 0x68) Move_AirGround_(0x2000) Move_AirGround_(0x3089) Move_Input_(INPUT_236) Move_Input_(0xde) Unknown15012(1) Unknown15013(6000) Unknown14015(150000, 500000, -200000, 150000, 50, 0) Move_EndRegister() Move_Register('UltimateRushOD', 0x68) Move_AirGround_(0x2000) Move_AirGround_(0x3089) Move_AirGround_(0x3081) Move_Input_(INPUT_236) Move_Input_(0xde) Unknown15012(1) Unknown15013(6000) Unknown14015(150000, 500000, -200000, 150000, 50, 0) Move_EndRegister() Move_Register('UltimateRanbu', 0x68) Move_AirGround_(0x2000) Move_AirGround_(0x3089) Move_Input_(INPUT_214) Move_Input_(0xde) Unknown15012(1) Unknown15013(1) Unknown15014(6000) Unknown14015(0, 300000, -200000, 300000, 50, 0) Move_EndRegister() Move_Register('UltimateRanbuOD', 0x68) Move_AirGround_(0x2000) Move_AirGround_(0x3089) Move_AirGround_(0x3081) Move_Input_(INPUT_214) Move_Input_(0xde) Unknown15012(1) Unknown15013(1) Unknown15014(6000) Unknown14015(0, 300000, -200000, 300000, 50, 0) Move_EndRegister() Move_Register('AstralHeat', 0x69) Move_AirGround_(0x2000) Move_AirGround_(0x304a) Move_Input_(0xcd) Move_Input_(0xde) Unknown15014(3000) Unknown15013(3000) Unknown14015(0, 650000, -200000, 200000, 1000, 50) Move_EndRegister() Unknown15024('NmlAtk5A', 'AN_NmlAtk5A_2nd', 10000000) Unknown15024('AN_NmlAtk5A_2nd', 'AN_NmlAtk5A_3rd', 10000000) Unknown15024('AN_NmlAtk5A_2nd', 'NmlAtk5B', 10000000) Unknown15024('AN_NmlAtk5A_3rd', 'AN_NmlAtk5A_4th', 10000000) Unknown15024('NmlAtk4A', 'AN_NmlAtk4A_2nd', 10000000) Unknown15024('AN_NmlAtk4A_2nd', 'AN_NmlAtk4A_3rd', 10000000) Unknown15024('AN_NmlAtk4A_2nd', 'NmlAtk5A', 10000000) Unknown15024('AN_NmlAtk4A_3rd', 'AN_NmlAtk4A_4th', 10000000) Unknown15024('AN_NmlAtk4A_3rd', 'NmlAtk5A', 10000000) Unknown15024('NmlAtk5B', 'AN_NmlAtk5B_2nd', 10000000) Unknown15024('AN_NmlAtk5B_2nd', 'AN_NmlAtk5B_3rd', 10000000) Unknown15024('AN_NmlAtk5B_3rd', 'NmlAtk2C', 10000000) Unknown15024('NmlAtk2C', 'Assault_B', 10000000) Unknown15024('NmlAtkAIR5A', 'NmlAtkAIR5B', 10000000) Unknown15024('NmlAtkAIR5B', 'NmlAtkAIR5C', 10000000) Unknown14048('AntiAir', 0x4, 0xed) Unknown14048('Assault_C', 0x4, 0x79) Unknown14048('UltimateAssault2', 0x4, 0x5f) Unknown14048('UltimateAssault2_OD', 0x4, 0x5f) Unknown14048('BunshinAssault_A', 0x4, 0x45) Unknown14048('AirAssault', 0x4, 0xed) Unknown14049('NmlAtk5A', 'NmlAtk5B', 0, 0) Unknown14049('NmlAtk5B', 'NmlAtk2C', 12, 0) Unknown14049('NmlAtk5D', 'BunshinAssault_A', 0, 0) Unknown14049('NmlAtk5D', 'BunshinAssault_B', 1, 600000) Unknown14049('NmlAtk5D', 'UltimateAssault', 6, 0) Unknown14049('NmlAtk5D', 'UltimateAssault_OD', 6, 0) Unknown14049('NmlAtk2A', 'NmlAtk5B', 0, 0) Unknown14049('NmlAtk2C', 'FHighJump', 12, 0) Unknown14049('NmlAtk2C', 'NmlAtk5D', 13, 0) Unknown14049('NmlAtk2D', 'BunshinAssault_A', 0, 0) Unknown14049('NmlAtk2D', 'BunshinAssault_B', 1, 600000) Unknown14049('NmlAtkAIR5A', 'NmlAtkAIR5B', 0, 0) Unknown14049('NmlAtkAIR5B', 'NmlAtkAIR5C', 0, 0) Unknown14049('NmlAtkAIR5C', 'AirAssault', 3, 0) Unknown14049('NmlAtkAIR5C', 'FJump', 12, 0) Unknown14049('NmlAtkAIR6D', 'AirAssault', 3, 0) Unknown12018(0, 'Action_330_01') Unknown12018(1, 'Action_330_04') Unknown12018(2, 'Action_330_05') Unknown12018(3, 'Action_330_06') Unknown12018(4, 'Action_330_07') Unknown12018(5, 'Action_330_07') Unknown12018(6, 'Action_330_08') Unknown12018(7, 'Action_017_01') Unknown12018(8, 'Action_017_01') Unknown12018(9, 'Action_019_01') Unknown12018(10, 'Action_331_00') Unknown12018(11, 'Action_331_00') Unknown12018(12, 'Action_320_02') Unknown12018(13, 'Action_330_08') Unknown12018(14, 'Action_351_00') Unknown12018(15, 'Action_290_00') Unknown12018(16, 'Action_300_00') Unknown12018(17, 'Action_304_02') Unknown12018(18, 'Action_305_03') Unknown12018(19, 'Action_000_00') Unknown12018(20, 'Action_000_00') Unknown12018(25, 'Action_326_00') Unknown12018(26, 'Action_326_02') Unknown12018(27, 'Action_326_03') Unknown12018(28, 'Action_351_05') Unknown12018(29, 'Action_292_00') Unknown12018(24, 'Action_348_00') Unknown7010(0, 'uli000') Unknown7010(1, 'uli001') Unknown7010(2, 'uli002') Unknown7010(3, 'uli003') Unknown7010(4, 'uli004') Unknown7010(5, 'uli005') Unknown7010(6, 'uli006') Unknown7010(7, 'uli007') Unknown7010(8, 'uli008') Unknown7010(9, 'uli009') Unknown7010(10, 'uli010') Unknown7010(11, 'uli011') Unknown7010(12, 'uli012') Unknown7010(13, 'uli013') Unknown7010(14, 'uli014') Unknown7010(15, 'uli015') Unknown7010(16, 'uli016') Unknown7010(17, 'uli017') Unknown7010(18, 'uli018') Unknown7010(19, 'uli019') Unknown7010(20, 'uli020') Unknown7010(21, 'uli021') Unknown7010(22, 'uli022') Unknown7010(23, 'uli023') Unknown7010(24, 'uli024') Unknown7010(25, 'uli025') Unknown7010(26, 'uli026') Unknown7010(27, 'uli027') Unknown7010(28, 'uli028') Unknown7010(29, 'uli029') Unknown7010(30, 'uli030') Unknown7010(31, 'uli031') Unknown7010(32, 'uli032') Unknown7010(33, 'uli033') Unknown7010(34, 'uli034') Unknown7010(35, 'uli035') Unknown7010(36, 'uli036') Unknown7010(37, 'uli037') Unknown7010(38, 'uli038') Unknown7010(39, 'uli039') Unknown7010(40, 'Hyd500') Unknown7010(41, 'uli041') Unknown7010(42, 'uli042') Unknown7010(43, 'uli043') Unknown7010(44, 'uli044') Unknown7010(45, 'uli045') Unknown7010(46, 'uli046') Unknown7010(47, 'uli047') Unknown7010(48, 'uli048') Unknown7010(49, 'uli049') Unknown7010(50, 'uli050') Unknown7010(51, 'uli051') Unknown7010(52, 'uli052') Unknown7010(53, 'uli053') Unknown7010(54, 'uli100_0') Unknown7010(55, 'uli100_1') Unknown7010(56, 'uli100_2') Unknown7010(63, 'uli101_0') Unknown7010(64, 'uli101_1') Unknown7010(65, 'uli101_2') Unknown7010(57, 'uli102_0') Unknown7010(58, 'uli102_1') Unknown7010(59, 'uli102_2') Unknown7010(66, 'uli103_0') Unknown7010(67, 'uli103_1') Unknown7010(68, 'uli103_2') Unknown7010(60, 'uli104_0') Unknown7010(61, 'uli104_1') Unknown7010(62, 'uli104_2') Unknown7010(69, 'uli105_0') Unknown7010(70, 'uli105_1') Unknown7010(71, 'uli105_2') Unknown7010(72, 'uli150') Unknown7010(73, 'uli151') Unknown7010(74, 'uli152') Unknown7010(85, 'uli153') Unknown7010(88, 'uli155') Unknown7010(94, 'uli400_0') Unknown7010(95, 'uli401_0') Unknown7010(96, 'uli161_0') Unknown7010(97, 'uli161_1') Unknown7010(98, 'uli163_0') Unknown7010(99, 'uli163_1') Unknown7010(100, 'uli164_0') Unknown7010(101, 'uli164_1') Unknown7010(102, 'uli166_0') Unknown7010(103, 'uli166_1') Unknown7010(92, 'uli162_0') Unknown7010(93, 'uli162_1') Unknown7010(90, 'uli167_0') Unknown7010(91, 'uli167_1') Unknown7010(105, 'uli165_0') Unknown7010(106, 'uli165_1') Unknown7010(107, 'uli168_0') Unknown7010(108, 'uli168_1') Unknown7010(110, 'uli169_0') Unknown7010(111, 'uli169_1') Unknown7010(112, 'uli159_0') Unknown7010(113, 'uli159_1') Unknown12059('00000000436d6e416374496e76696e6369626c6541747461636b00000000000000000000') Unknown12059('010000004e6d6c41746b3441000000000000000000000000000000000000000000000000') Unknown12059('02000000556c74696d617465527573680000000000000000000000000000000000000000') Unknown12059('03000000556c74696d617465527573684f44000000000000000000000000000000000000') Unknown12059('04000000556c74696d61746552616e627500000000000000000000000000000000000000') Unknown12059('05000000556c74696d61746552616e62754f440000000000000000000000000000000000') Unknown12059('06000000436d6e4163744244617368000000000000000000000000000000000000000000') Unknown12059('070000004e6d6c41746b5468726f77000000000000000000000000000000000000000000') Unknown12059('08000000436d6e4163744368616e6765506172746e6572517569636b4f75740000000000') GFX_0('Geboku', -1) Unknown38(11, 1) @Subroutine def OnPreDraw(): Unknown23030('554c495f4c6967687400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000') @Subroutine def Func_BurstDD_Easy(): SLOT_47 = 0 if Unknown23145('CmnActOverDriveEnd'): SLOT_47 = 1 @Subroutine def OnActionBegin(): if Unknown46(11): if Unknown23148('CmnActTagBattleWait'): Unknown23029(11, 9901, 0) else: Unknown23029(11, 9900, 0) @Subroutine def ChainRoot(): HitOrBlockCancel('NmlAtk5A') HitOrBlockCancel('NmlAtk2A') HitOrBlockCancel('NmlAtk4A') HitOrBlockCancel('NmlAtk5B') HitOrBlockCancel('NmlAtk2B') HitOrBlockCancel('NmlAtk2C') HitOrBlockCancel('CmnActCrushAttack') HitJumpCancel(1) @State def CmnActStand(): sprite('Action_000_00', 1) # 1-1 **attackbox here** label(0) sprite('Action_000_00', 7) # 2-8 **attackbox here** sprite('Action_000_01', 7) # 9-15 **attackbox here** sprite('Action_000_02', 6) # 16-21 **attackbox here** sprite('Action_000_03', 6) # 22-27 **attackbox here** sprite('Action_000_04', 8) # 28-35 **attackbox here** sprite('Action_000_05', 5) # 36-40 **attackbox here** sprite('Action_000_06', 5) # 41-45 **attackbox here** sprite('Action_000_07', 5) # 46-50 **attackbox here** sprite('Action_000_08', 6) # 51-56 **attackbox here** sprite('Action_000_09', 5) # 57-61 **attackbox here** sprite('Action_000_10', 6) # 62-67 **attackbox here** sprite('Action_000_11', 8) # 68-75 **attackbox here** sprite('Action_000_12', 5) # 76-80 **attackbox here** sprite('Action_000_13', 5) # 81-85 **attackbox here** sprite('Action_000_14', 6) # 86-91 **attackbox here** loopRest() random_(1, 2, 87) if SLOT_ReturnVal: _gotolabel(0) random_(0, 2, 122) if SLOT_ReturnVal: _gotolabel(0) random_(2, 0, 90) if SLOT_ReturnVal: _gotolabel(0) sprite('Action_000_15', 7) # 92-98 **attackbox here** SLOT_88 = 960 sprite('Action_000_16', 4) # 99-102 **attackbox here** SFX_1('uli000') sprite('Action_000_17', 7) # 103-109 **attackbox here** SFX_0('003_swing_grap_0_0') sprite('Action_000_18', 5) # 110-114 **attackbox here** sprite('Action_000_19', 8) # 115-122 **attackbox here** sprite('Action_000_20', 10) # 123-132 **attackbox here** sprite('Action_000_21', 5) # 133-137 **attackbox here** sprite('Action_000_22', 7) # 138-144 **attackbox here** SFX_FOOTSTEP_(100, 0, 1) sprite('Action_000_23', 3) # 145-147 **attackbox here** sprite('Action_000_24', 20) # 148-167 **attackbox here** sprite('Action_000_25', 240) # 168-407 **attackbox here** sprite('Action_000_26', 5) # 408-412 **attackbox here** sprite('Action_000_27', 8) # 413-420 **attackbox here** sprite('Action_000_28', 6) # 421-426 **attackbox here** sprite('Action_000_29', 4) # 427-430 **attackbox here** sprite('Action_000_30', 4) # 431-434 **attackbox here** SFX_0('008_swing_pole_0') sprite('Action_000_31', 6) # 435-440 **attackbox here** sprite('Action_000_32', 7) # 441-447 loopRest() gotoLabel(0) @State def CmnActStandTurn(): sprite('Action_015_00', 2) # 1-2 sprite('Action_015_01', 2) # 3-4 sprite('Action_015_02', 2) # 5-6 @State def CmnActStand2Crouch(): sprite('Action_012_00', 3) # 1-3 sprite('Action_012_01', 3) # 4-6 sprite('Action_012_02', 2) # 7-8 @State def CmnActCrouch(): label(0) sprite('Action_013_00', 15) # 1-15 sprite('Action_013_01', 7) # 16-22 sprite('Action_013_02', 6) # 23-28 sprite('Action_013_03', 6) # 29-34 sprite('Action_013_04', 7) # 35-41 sprite('Action_013_05', 7) # 42-48 sprite('Action_013_06', 5) # 49-53 sprite('Action_013_07', 5) # 54-58 sprite('Action_013_08', 5) # 59-63 loopRest() gotoLabel(0) @State def CmnActCrouchTurn(): sprite('Action_016_00', 2) # 1-2 sprite('Action_016_01', 2) # 3-4 sprite('Action_016_02', 2) # 5-6 @State def CmnActCrouch2Stand(): sprite('Action_014_00', 3) # 1-3 sprite('Action_014_01', 6) # 4-9 sprite('Action_014_02', 4) # 10-13 @State def CmnActJumpPre(): sprite('Action_036_00', 4) # 1-4 @State def CmnActJumpUpper(): label(0) sprite('Action_036_01', 4) # 1-4 sprite('Action_035_02', 3) # 5-7 loopRest() gotoLabel(0) @State def CmnActJumpUpperEnd(): sprite('Action_035_03', 3) # 1-3 sprite('Action_035_04', 6) # 4-9 sprite('Action_035_05', 6) # 10-15 sprite('Action_035_06', 6) # 16-21 @State def CmnActJumpDown(): label(0) sprite('Action_022_00', 3) # 1-3 sprite('Action_022_01', 3) # 4-6 loopRest() gotoLabel(0) @State def CmnActJumpLanding(): sprite('Action_023_00', 2) # 1-2 sprite('Action_023_01', 1) # 3-3 sprite('Action_023_02', 2) # 4-5 sprite('Action_023_03', 3) # 6-8 @State def CmnActLandingStiffLoop(): sprite('Action_023_00', 2) # 1-2 sprite('Action_023_01', 2) # 3-4 sprite('Action_023_02', 32767) # 5-32771 @State def CmnActLandingStiffEnd(): sprite('Action_023_02', 3) # 1-3 sprite('Action_023_03', 3) # 4-6 @State def CmnActFWalk(): label(0) sprite('Action_010_00', 5) # 1-5 sprite('Action_010_01', 5) # 6-10 sprite('Action_010_02', 5) # 11-15 SFX_FOOTSTEP_(100, 1, 1) sprite('Action_010_03', 5) # 16-20 sprite('Action_010_04', 5) # 21-25 sprite('Action_010_05', 5) # 26-30 sprite('Action_010_06', 5) # 31-35 sprite('Action_010_07', 5) # 36-40 SFX_FOOTSTEP_(100, 1, 1) sprite('Action_010_08', 5) # 41-45 sprite('Action_010_09', 5) # 46-50 loopRest() gotoLabel(0) @State def CmnActBWalk(): sprite('Action_011_00', 2) # 1-2 sprite('Action_011_01', 2) # 3-4 label(0) sprite('Action_011_02', 4) # 5-8 SFX_FOOTSTEP_(100, 1, 1) sprite('Action_011_03', 4) # 9-12 sprite('Action_011_04', 4) # 13-16 sprite('Action_011_05', 4) # 17-20 sprite('Action_011_06', 4) # 21-24 SFX_FOOTSTEP_(100, 1, 1) sprite('Action_011_07', 4) # 25-28 sprite('Action_011_08', 4) # 29-32 sprite('Action_011_09', 4) # 33-36 sprite('Action_011_10', 4) # 37-40 sprite('Action_011_11', 4) # 41-44 sprite('Action_011_12', 4) # 45-48 sprite('Action_011_13', 4) # 49-52 loopRest() gotoLabel(0) @State def CmnActFDash(): sprite('Action_045_13', 4) # 1-4 sprite('Action_045_00', 3) # 5-7 sprite('Action_045_01', 3) # 8-10 sprite('Action_045_02', 3) # 11-13 label(0) sprite('Action_045_03', 3) # 14-16 Unknown8006(100, 1, 1) sprite('Action_045_04', 3) # 17-19 sprite('Action_045_05', 3) # 20-22 sprite('Action_045_06', 3) # 23-25 Unknown8006(100, 1, 1) sprite('Action_045_07', 3) # 26-28 sprite('Action_045_08', 3) # 29-31 sprite('Action_045_09', 3) # 32-34 sprite('Action_045_02', 3) # 35-37 loopRest() gotoLabel(0) @State def CmnActFDashStop(): sprite('Action_045_11', 2) # 1-2 sprite('Action_045_12', 3) # 3-5 sprite('Action_045_13', 4) # 6-9 @State def CmnActBDash(): def upon_IMMEDIATE(): Unknown2042(1) Unknown28(8, '_NEUTRAL') setInvincibleFor(7) Unknown1084(1) sendToLabelUpon(2, 1) Unknown23001(100, 0) Unknown23076() def upon_CLEAR_OR_EXIT(): Unknown1019(90) sprite('Action_046_00', 1) # 1-1 sprite('Action_046_01', 2) # 2-3 physicsXImpulse(-40000) physicsYImpulse(8800) setGravity(1550) Unknown8002() sprite('Action_046_02', 2) # 4-5 sprite('Action_046_02', 1) # 6-6 sprite('Action_046_03', 3) # 7-9 loopRest() label(0) sprite('Action_046_03', 3) # 10-12 sprite('Action_046_04', 3) # 13-15 loopRest() gotoLabel(0) label(1) sprite('Action_046_05', 3) # 16-18 physicsXImpulse(0) Unknown8000(100, 1, 1) clearUponHandler(3) sprite('Action_046_06', 3) # 19-21 @State def CmnActBDashLanding(): pass @State def CmnActAirFDash(): def upon_IMMEDIATE(): Unknown22001(-1) sprite('Action_068_01', 3) # 1-3 sprite('Action_068_02', 3) # 4-6 sprite('Action_068_03', 3) # 7-9 sprite('Action_068_04', 3) # 10-12 sprite('Action_068_05', 3) # 13-15 sprite('Action_068_06', 3) # 16-18 sprite('Action_068_07', 3) # 19-21 sprite('Action_068_08', 3) # 22-24 loopRest() enterState('AirFDashRigor') @State def AirFDashRigor(): def upon_IMMEDIATE(): Unknown13014(1) Unknown13015(1) Unknown13031(1) Unknown13019(1) Unknown28(2, 'CmnActJumpLanding') sprite('Action_068_09', 3) # 1-3 sprite('Action_068_10', 3) # 4-6 label(0) sprite('Action_068_11', 3) # 7-9 sprite('Action_068_12', 3) # 10-12 loopRest() gotoLabel(0) @State def CmnActAirBDash(): def upon_IMMEDIATE(): Unknown22001(-1) sprite('Action_046_03', 4) # 1-4 physicsYImpulse(12000) sprite('Action_046_04', 4) # 5-8 label(0) sprite('Action_046_03', 4) # 9-12 sprite('Action_046_04', 4) # 13-16 loopRest() gotoLabel(0) @State def CmnActHitStandLv1(): sprite('Action_300_00', 1) # 1-1 sprite('Action_300_00', 1) # 2-2 sprite('Action_300_01', 2) # 3-4 @State def CmnActHitStandLv2(): sprite('Action_300_00', 1) # 1-1 sprite('Action_300_00', 2) # 2-3 sprite('Action_300_01', 3) # 4-6 @State def CmnActHitStandLv3(): sprite('Action_303_00', 1) # 1-1 sprite('Action_303_00', 2) # 2-3 sprite('Action_303_01', 2) # 4-5 sprite('Action_303_02', 2) # 6-7 sprite('Action_303_03', 2) # 8-9 @State def CmnActHitStandLv4(): sprite('Action_303_00', 1) # 1-1 sprite('Action_303_00', 1) # 2-2 sprite('Action_303_01', 3) # 3-5 sprite('Action_303_02', 3) # 6-8 sprite('Action_303_03', 2) # 9-10 @State def CmnActHitStandLv5(): sprite('Action_303_00', 1) # 1-1 sprite('Action_303_00', 3) # 2-4 sprite('Action_303_01', 4) # 5-8 sprite('Action_303_02', 4) # 9-12 sprite('Action_303_03', 4) # 13-16 @State def CmnActHitStandLowLv1(): sprite('Action_304_02', 1) # 1-1 sprite('Action_304_02', 1) # 2-2 sprite('Action_304_03', 2) # 3-4 @State def CmnActHitStandLowLv2(): sprite('Action_304_02', 1) # 1-1 sprite('Action_304_02', 2) # 2-3 sprite('Action_304_03', 3) # 4-6 @State def CmnActHitStandLowLv3(): sprite('Action_304_00', 1) # 1-1 sprite('Action_304_00', 1) # 2-2 sprite('Action_304_01', 2) # 3-4 sprite('Action_304_02', 2) # 5-6 sprite('Action_304_03', 2) # 7-8 @State def CmnActHitStandLowLv4(): sprite('Action_304_00', 1) # 1-1 sprite('Action_304_00', 1) # 2-2 sprite('Action_304_01', 3) # 3-5 sprite('Action_304_02', 3) # 6-8 sprite('Action_304_03', 2) # 9-10 @State def CmnActHitStandLowLv5(): sprite('Action_304_00', 1) # 1-1 sprite('Action_304_00', 3) # 2-4 sprite('Action_304_01', 4) # 5-8 sprite('Action_304_02', 4) # 9-12 sprite('Action_304_03', 4) # 13-16 @State def CmnActHitCrouchLv1(): sprite('Action_305_02', 1) # 1-1 sprite('Action_305_02', 1) # 2-2 sprite('Action_305_03', 2) # 3-4 @State def CmnActHitCrouchLv2(): sprite('Action_305_02', 1) # 1-1 sprite('Action_305_02', 2) # 2-3 sprite('Action_305_03', 3) # 4-6 @State def CmnActHitCrouchLv3(): sprite('Action_305_00', 1) # 1-1 sprite('Action_305_00', 2) # 2-3 sprite('Action_305_01', 2) # 4-5 sprite('Action_305_02', 2) # 6-7 sprite('Action_305_03', 2) # 8-9 @State def CmnActHitCrouchLv4(): sprite('Action_305_00', 1) # 1-1 sprite('Action_305_00', 1) # 2-2 sprite('Action_305_01', 3) # 3-5 sprite('Action_305_02', 3) # 6-8 sprite('Action_305_03', 2) # 9-10 @State def CmnActHitCrouchLv5(): sprite('Action_305_00', 1) # 1-1 sprite('Action_305_00', 3) # 2-4 sprite('Action_305_01', 4) # 5-8 sprite('Action_305_02', 4) # 9-12 sprite('Action_305_03', 4) # 13-16 @State def CmnActBDownUpper(): sprite('Action_320_00', 4) # 1-4 label(0) sprite('Action_320_01', 4) # 5-8 sprite('Action_320_01', 4) # 9-12 loopRest() gotoLabel(0) @State def CmnActBDownUpperEnd(): sprite('Action_330_04', 3) # 1-3 sprite('Action_330_05', 3) # 4-6 @State def CmnActBDownDown(): sprite('Action_330_06', 3) # 1-3 sprite('Action_330_07', 3) # 4-6 label(0) sprite('Action_330_08', 4) # 7-10 sprite('Action_330_09', 4) # 11-14 loopRest() gotoLabel(0) @State def CmnActBDownCrash(): sprite('Action_351_00', 2) # 1-2 sprite('Action_331_01', 2) # 3-4 @State def CmnActBDownBound(): sprite('Action_350_01', 3) # 1-3 sprite('Action_350_02', 3) # 4-6 sprite('Action_350_03', 3) # 7-9 sprite('Action_350_04', 3) # 10-12 sprite('Action_350_05', 3) # 13-15 @State def CmnActBDownLoop(): sprite('Action_350_06', 1) # 1-1 @State def CmnActBDown2Stand(): sprite('Action_293_11', 4) # 1-4 sprite('Action_293_12', 4) # 5-8 sprite('Action_293_13', 3) # 9-11 sprite('Action_293_14', 3) # 12-14 sprite('Action_293_15', 4) # 15-18 sprite('Action_293_16', 4) # 19-22 sprite('Action_293_17', 4) # 23-26 @State def CmnActFDownUpper(): sprite('Action_326_00', 3) # 1-3 @State def CmnActFDownUpperEnd(): sprite('Action_326_02', 3) # 1-3 @State def CmnActFDownDown(): label(0) sprite('Action_326_03', 4) # 1-4 sprite('Action_326_04', 4) # 5-8 loopRest() gotoLabel(0) @State def CmnActFDownCrash(): sprite('Action_354_00', 3) # 1-3 @State def CmnActFDownBound(): sprite('Action_354_01', 4) # 1-4 sprite('Action_354_02', 4) # 5-8 sprite('Action_354_03', 4) # 9-12 @State def CmnActFDownLoop(): sprite('Action_292_00', 3) # 1-3 @State def CmnActFDown2Stand(): sprite('Action_294_11', 3) # 1-3 sprite('Action_294_12', 3) # 4-6 sprite('Action_294_13', 3) # 7-9 sprite('Action_294_14', 3) # 10-12 sprite('Action_294_15', 3) # 13-15 sprite('Action_294_16', 3) # 16-18 sprite('Action_294_17', 2) # 19-20 @State def CmnActVDownUpper(): sprite('Action_330_00', 3) # 1-3 label(0) sprite('Action_330_01', 3) # 4-6 sprite('Action_330_02', 3) # 7-9 loopRest() gotoLabel(0) @State def CmnActVDownUpperEnd(): sprite('Action_330_03', 2) # 1-2 sprite('Action_330_04', 2) # 3-4 sprite('Action_330_05', 2) # 5-6 @State def CmnActVDownDown(): sprite('Action_330_06', 3) # 1-3 sprite('Action_330_06', 3) # 4-6 label(0) sprite('Action_330_08', 4) # 7-10 sprite('Action_330_09', 4) # 11-14 loopRest() gotoLabel(0) @State def CmnActVDownCrash(): sprite('Action_351_00', 3) # 1-3 sprite('Action_351_01', 3) # 4-6 @State def CmnActBlowoff(): sprite('Action_331_00', 2) # 1-2 label(0) sprite('Action_331_02', 3) # 3-5 sprite('Action_331_03', 3) # 6-8 loopRest() gotoLabel(0) @State def CmnActKirimomiUpper(): label(0) sprite('Action_333_00', 2) # 1-2 sprite('Action_333_01', 2) # 3-4 sprite('Action_333_02', 2) # 5-6 sprite('Action_333_03', 2) # 7-8 sprite('Action_333_04', 2) # 9-10 sprite('Action_333_05', 2) # 11-12 sprite('Action_333_06', 2) # 13-14 loopRest() gotoLabel(0) @State def CmnActSkeleton(): label(0) sprite('Action_301_00', 2) # 1-2 sprite('Action_301_00', 2) # 3-4 loopRest() gotoLabel(0) @State def CmnActFreeze(): sprite('Action_301_00', 1) # 1-1 @State def CmnActWallBound(): sprite('Action_340_00', 2) # 1-2 sprite('Action_340_01', 2) # 3-4 sprite('Action_340_02', 2) # 5-6 @State def CmnActWallBoundDown(): sprite('Action_340_03', 3) # 1-3 sprite('Action_340_04', 3) # 4-6 label(0) sprite('Action_340_05', 3) # 7-9 loopRest() gotoLabel(0) @State def CmnActStaggerLoop(): sprite('Action_327_00', 14) # 1-14 @State def CmnActStaggerDown(): sprite('Action_327_02', 5) # 1-5 sprite('Action_327_03', 5) # 6-10 sprite('Action_327_04', 4) # 11-14 sprite('Action_328_00', 4) # 15-18 sprite('Action_328_01', 4) # 19-22 @State def CmnActUkemiStagger(): sprite('Action_327_00', 8) # 1-8 @State def CmnActUkemiAirF(): sprite('Action_032_00', 2) # 1-2 sprite('Action_032_01', 2) # 3-4 sprite('Action_032_02', 2) # 5-6 sprite('Action_032_03', 1) # 7-7 sprite('Action_032_04', 1) # 8-8 sprite('Action_032_05', 1) # 9-9 @State def CmnActUkemiAirB(): sprite('Action_032_00', 4) # 1-4 sprite('Action_032_01', 4) # 5-8 sprite('Action_032_02', 4) # 9-12 sprite('Action_032_03', 4) # 13-16 sprite('Action_032_04', 4) # 17-20 sprite('Action_032_05', 3) # 21-23 @State def CmnActUkemiAirN(): sprite('Action_032_00', 4) # 1-4 sprite('Action_032_01', 4) # 5-8 sprite('Action_032_02', 4) # 9-12 sprite('Action_032_03', 4) # 13-16 sprite('Action_032_04', 4) # 17-20 sprite('Action_032_05', 3) # 21-23 sprite('Action_032_06', 3) # 24-26 sprite('Action_032_07', 3) # 27-29 @State def CmnActUkemiLandF(): sprite('Action_041_00', 2) # 1-2 sprite('Action_041_01', 2) # 3-4 sprite('Action_041_02', 2) # 5-6 sprite('Action_041_03', 2) # 7-8 sprite('Action_041_04', 2) # 9-10 sprite('Action_041_05', 2) # 11-12 sprite('Action_041_06', 2) # 13-14 sprite('Action_041_07', 2) # 15-16 @State def CmnActUkemiLandB(): sprite('Action_041_00', 2) # 1-2 sprite('Action_041_01', 2) # 3-4 sprite('Action_041_02', 2) # 5-6 sprite('Action_041_03', 2) # 7-8 sprite('Action_041_04', 2) # 9-10 sprite('Action_041_05', 2) # 11-12 sprite('Action_041_06', 2) # 13-14 sprite('Action_041_07', 2) # 15-16 @State def CmnActUkemiLandN(): sprite('Action_041_00', 2) # 1-2 sprite('Action_041_01', 2) # 3-4 sprite('Action_041_02', 2) # 5-6 sprite('Action_041_03', 2) # 7-8 sprite('Action_041_04', 2) # 9-10 sprite('Action_041_05', 2) # 11-12 sprite('Action_041_06', 2) # 13-14 sprite('Action_041_07', 2) # 15-16 @State def CmnActUkemiLandNLanding(): sprite('Action_041_08', 5) # 1-5 sprite('Action_041_09', 5) # 6-10 sprite('Action_041_10', 5) # 11-15 @State def CmnActMidGuardPre(): sprite('Action_017_00', 3) # 1-3 sprite('Action_017_01', 3) # 4-6 @State def CmnActMidGuardLoop(): label(0) sprite('Action_017_00', 3) # 1-3 sprite('Action_017_01', 3) # 4-6 gotoLabel(0) @State def CmnActMidGuardEnd(): sprite('Action_017_06', 3) # 1-3 sprite('Action_017_07', 3) # 4-6 @State def CmnActMidHeavyGuardLoop(): sprite('Action_017_00', 3) # 1-3 sprite('Action_017_01', 3) # 4-6 @State def CmnActMidHeavyGuardEnd(): sprite('Action_017_06', 3) # 1-3 sprite('Action_017_07', 3) # 4-6 @State def CmnActHighGuardPre(): sprite('Action_017_00', 3) # 1-3 sprite('Action_017_01', 3) # 4-6 @State def CmnActHighGuardLoop(): sprite('Action_017_00', 3) # 1-3 @State def CmnActHighGuardEnd(): sprite('Action_017_06', 3) # 1-3 sprite('Action_017_07', 3) # 4-6 @State def CmnActHighHeavyGuardLoop(): sprite('Action_017_00', 3) # 1-3 sprite('Action_017_01', 3) # 4-6 @State def CmnActHighHeavyGuardEnd(): sprite('Action_017_06', 3) # 1-3 sprite('Action_017_07', 3) # 4-6 @State def CmnActCrouchGuardPre(): sprite('Action_018_00', 3) # 1-3 sprite('Action_018_01', 3) # 4-6 @State def CmnActCrouchGuardLoop(): label(0) sprite('Action_018_02', 3) # 1-3 sprite('Action_018_03', 3) # 4-6 gotoLabel(0) @State def CmnActCrouchGuardEnd(): sprite('Action_018_06', 3) # 1-3 sprite('Action_018_07', 3) # 4-6 @State def CmnActCrouchHeavyGuardLoop(): sprite('Action_018_01', 3) # 1-3 sprite('Action_018_02', 3) # 4-6 @State def CmnActCrouchHeavyGuardEnd(): sprite('Action_018_06', 3) # 1-3 sprite('Action_018_07', 3) # 4-6 @State def CmnActAirGuardPre(): sprite('Action_019_00', 3) # 1-3 sprite('Action_019_01', 3) # 4-6 @State def CmnActAirGuardLoop(): label(0) sprite('Action_019_02', 3) # 1-3 sprite('Action_019_03', 3) # 4-6 loopRest() gotoLabel(0) @State def CmnActAirGuardEnd(): sprite('Action_019_06', 3) # 1-3 sprite('Action_019_07', 3) # 4-6 @State def CmnActAirHeavyGuardLoop(): sprite('Action_019_02', 3) # 1-3 sprite('Action_019_03', 3) # 4-6 @State def CmnActAirHeavyGuardEnd(): sprite('Action_019_06', 3) # 1-3 sprite('Action_019_07', 3) # 4-6 @State def CmnActGuardBreakStand(): sprite('Action_017_00', 2) # 1-2 sprite('Action_017_01', 2) # 3-4 sprite('Action_017_01', 1) # 5-5 Unknown2042(1) sprite('Action_017_05', 6) # 6-11 sprite('Action_017_06', 6) # 12-17 @State def CmnActGuardBreakCrouch(): sprite('Action_018_00', 2) # 1-2 sprite('Action_018_01', 2) # 3-4 sprite('Action_018_00', 1) # 5-5 Unknown2042(1) sprite('Action_018_01', 6) # 6-11 sprite('Action_018_00', 6) # 12-17 @State def CmnActGuardBreakAir(): sprite('Action_019_00', 2) # 1-2 sprite('Action_019_01', 2) # 3-4 sprite('Action_019_00', 1) # 5-5 Unknown2042(1) sprite('Action_019_01', 6) # 6-11 sprite('Action_019_00', 6) # 12-17 @State def CmnActAirTurn(): sprite('Action_036_01', 9) # 1-9 @State def CmnActLockWait(): sprite('Action_017_00', 3) # 1-3 sprite('Action_017_01', 3) # 4-6 @State def CmnActLockReject(): sprite('Action_003_02', 1) # 1-1 sprite('Action_003_03', 1) # 2-2 sprite('Action_003_04', 2) # 3-4 **attackbox here** GFX_0('EffNmlAtk5CBlade', 100) sprite('Action_003_05', 4) # 5-8 **attackbox here** sprite('Action_003_06', 7) # 9-15 sprite('Action_003_07', 3) # 16-18 sprite('Action_003_08', 3) # 19-21 sprite('Action_003_09', 3) # 22-24 sprite('Action_003_10', 2) # 25-26 @State def CmnActAirLockWait(): sprite('Action_019_02', 1) # 1-1 sprite('Action_019_01', 3) # 2-4 sprite('Action_019_00', 3) # 5-7 @State def CmnActLandSpin(): sprite('hb071_00', 4) # 1-4 sprite('hb071_01', 4) # 5-8 label(0) sprite('hb071_02', 2) # 9-10 sprite('hb071_03', 2) # 11-12 sprite('hb071_04', 2) # 13-14 sprite('hb071_05', 2) # 15-16 sprite('hb071_06', 2) # 17-18 sprite('hb071_07', 2) # 19-20 sprite('hb071_08', 2) # 21-22 sprite('hb071_09', 2) # 23-24 loopRest() gotoLabel(0) @State def CmnActLandSpinDown(): sprite('hb071_10', 6) # 1-6 sprite('hb071_11', 5) # 7-11 sprite('hb071_12', 5) # 12-16 @State def CmnActVertSpin(): label(0) sprite('Action_333_00', 2) # 1-2 sprite('Action_333_01', 2) # 3-4 sprite('Action_333_02', 2) # 5-6 sprite('Action_333_03', 2) # 7-8 sprite('Action_333_04', 2) # 9-10 sprite('Action_333_05', 2) # 11-12 loopRest() gotoLabel(0) @State def CmnActSlideAir(): label(0) sprite('Action_333_00', 2) # 1-2 sprite('Action_333_01', 2) # 3-4 sprite('Action_333_02', 2) # 5-6 sprite('Action_333_03', 2) # 7-8 sprite('Action_333_04', 2) # 9-10 sprite('Action_333_05', 2) # 11-12 loopRest() gotoLabel(0) @State def CmnActSlideKeep(): sprite('Action_351_00', 1) # 1-1 label(0) sprite('Action_351_01', 3) # 2-4 loopRest() gotoLabel(0) @State def CmnActSlideEnd(): sprite('Action_351_02', 3) # 1-3 sprite('Action_351_03', 2) # 4-5 sprite('Action_351_04', 2) # 6-7 sprite('Action_351_05', 2) # 8-9 @State def CmnActAomukeSlideKeep(): sprite('Action_351_04', 1) # 1-1 label(0) sprite('Action_351_04', 3) # 2-4 loopRest() gotoLabel(0) @State def CmnActAomukeSlideEnd(): sprite('Action_351_02', 3) # 1-3 sprite('Action_351_03', 2) # 4-5 sprite('Action_351_04', 2) # 6-7 sprite('Action_351_05', 2) # 8-9 @State def CmnActBurstBegin(): sprite('Action_262_00', 4) # 1-4 label(0) sprite('Action_262_01', 5) # 5-9 loopRest() gotoLabel(0) @State def CmnActBurstLoop(): sprite('Action_262_02', 4) # 1-4 label(0) sprite('Action_262_03', 5) # 5-9 sprite('Action_262_04', 5) # 10-14 loopRest() gotoLabel(0) @State def CmnActBurstEnd(): sprite('Action_262_05', 3) # 1-3 sprite('Action_262_06', 3) # 4-6 @State def CmnActAirBurstBegin(): sprite('Action_262_02', 4) # 1-4 label(0) sprite('Action_262_03', 5) # 5-9 sprite('Action_262_04', 5) # 10-14 loopRest() gotoLabel(0) @State def CmnActAirBurstLoop(): sprite('Action_262_02', 4) # 1-4 label(0) sprite('Action_262_03', 5) # 5-9 sprite('Action_262_04', 5) # 10-14 loopRest() gotoLabel(0) @State def CmnActAirBurstEnd(): label(0) sprite('Action_262_07', 4) # 1-4 sprite('Action_262_08', 4) # 5-8 loopRest() gotoLabel(0) @State def CmnActOverDriveBegin(): sprite('Action_262_00', 4) # 1-4 sprite('Action_262_01', 32767) # 5-32771 loopRest() @State def CmnActOverDriveLoop(): sprite('Action_262_02', 4) # 1-4 label(0) sprite('Action_262_03', 5) # 5-9 sprite('Action_262_04', 5) # 10-14 loopRest() gotoLabel(0) @State def CmnActOverDriveEnd(): sprite('Action_262_05', 6) # 1-6 sprite('Action_262_06', 6) # 7-12 @State def CmnActAirOverDriveBegin(): sprite('Action_262_00', 4) # 1-4 sprite('Action_262_01', 32767) # 5-32771 loopRest() @State def CmnActAirOverDriveLoop(): sprite('Action_262_02', 4) # 1-4 label(0) sprite('Action_262_03', 5) # 5-9 sprite('Action_262_04', 5) # 10-14 loopRest() gotoLabel(0) @State def CmnActAirOverDriveEnd(): sprite('Action_262_07', 3) # 1-3 sprite('Action_262_08', 3) # 4-6 label(0) sprite('Action_022_00', 4) # 7-10 sprite('Action_022_01', 4) # 11-14 loopRest() gotoLabel(0) @State def CmnActCrossRushBegin(): sprite('Action_262_00', 4) # 1-4 sprite('Action_262_01', 32767) # 5-32771 loopRest() @State def CmnActCrossRushLoop(): sprite('Action_262_02', 4) # 1-4 label(0) sprite('Action_262_03', 5) # 5-9 sprite('Action_262_04', 5) # 10-14 loopRest() gotoLabel(0) @State def CmnActCrossRushEnd(): sprite('Action_262_05', 6) # 1-6 sprite('Action_262_06', 6) # 7-12 @State def CmnActAirCrossRushBegin(): sprite('Action_262_00', 4) # 1-4 sprite('Action_262_01', 32767) # 5-32771 loopRest() @State def CmnActAirCrossRushLoop(): sprite('Action_262_02', 4) # 1-4 label(0) sprite('Action_262_03', 5) # 5-9 sprite('Action_262_04', 5) # 10-14 loopRest() gotoLabel(0) @State def CmnActAirCrossRushEnd(): sprite('Action_262_07', 3) # 1-3 sprite('Action_262_08', 3) # 4-6 label(0) sprite('Action_022_00', 4) # 7-10 sprite('Action_022_01', 4) # 11-14 loopRest() gotoLabel(0) @State def CmnActCrossChangeBegin(): sprite('Action_262_00', 4) # 1-4 sprite('Action_262_01', 32767) # 5-32771 loopRest() @State def CmnActCrossChangeLoop(): sprite('Action_262_02', 4) # 1-4 label(0) sprite('Action_262_03', 5) # 5-9 sprite('Action_262_04', 5) # 10-14 loopRest() gotoLabel(0) @State def CmnActCrossChangeEnd(): sprite('Action_262_05', 3) # 1-3 sprite('Action_262_06', 3) # 4-6 @State def CmnActAirCrossChangeBegin(): sprite('Action_262_00', 4) # 1-4 sprite('Action_262_01', 32767) # 5-32771 loopRest() @State def CmnActAirCrossChangeLoop(): sprite('Action_262_02', 4) # 1-4 label(0) sprite('Action_262_03', 5) # 5-9 sprite('Action_262_04', 5) # 10-14 loopRest() gotoLabel(0) @State def CmnActAirCrossChangeEnd(): sprite('Action_262_07', 3) # 1-3 sprite('Action_262_08', 3) # 4-6 label(0) sprite('Action_022_00', 4) # 7-10 sprite('Action_022_01', 4) # 11-14 loopRest() gotoLabel(0) @State def CmnActAComboFinalBlow(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() def upon_LANDING(): clearUponHandler(2) sendToLabel(1) sprite('null', 30) # 1-30 sprite('null', 1) # 31-31 teleportRelativeX(-25000) Unknown1007(600000) setGravity(0) physicsYImpulse(-60000) SLOT_12 = SLOT_19 Unknown1019(4) label(0) sprite('Action_146_03ex', 3) # 32-34 **attackbox here** sprite('Action_146_04ex', 3) # 35-37 **attackbox here** loopRest() gotoLabel(0) label(1) sprite('keep', 1) # 38-38 sprite('keep', 2) # 39-40 if SLOT_3: enterState('CmnActAComboFinalBlowFinish') StartMultihit() Unknown23022(0) Unknown1084(1) sprite('Action_146_05', 5) # 41-45 Unknown8000(100, 1, 1) sprite('Action_146_06', 18) # 46-63 sprite('Action_146_07', 5) # 64-68 @State def CmnActAComboFinalBlowFinish(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() Unknown9016(1) sprite('keep', 1) # 1-1 StartMultihit() Unknown8000(100, 1, 1) sprite('Action_146_05', 4) # 2-5 sprite('Action_146_06', 5) # 6-10 sprite('Action_146_07', 5) # 11-15 sprite('Action_140_00', 3) # 16-18 sprite('Action_140_01', 6) # 19-24 sprite('Action_140_02', 6) # 25-30 sprite('Action_140_03', 4) # 31-34 Unknown7009(2) sprite('Action_140_04', 6) # 35-40 **attackbox here** GFX_0('EffNmlAtk6CBlade1st', 100) SFX_0('006_swing_blade_0') sprite('Action_140_05', 25) # 41-65 sprite('Action_140_06', 5) # 66-70 sprite('Action_140_07', 5) # 71-75 @State def NmlAtk5A(): def upon_IMMEDIATE(): AttackDefaults_StandingNormal() AttackLevel_(2) AirPushbackY(18000) Unknown1112('') callSubroutine('ChainRoot') HitOrBlockCancel('AN_NmlAtk5A_2nd') HitOrBlockCancel('NmlAtkThrow') HitOrBlockCancel('NmlAtkBackThrow') HitOrBlockJumpCancel(1) sprite('Action_002_00', 3) # 1-3 sprite('Action_002_01', 2) # 4-5 sprite('Action_002_02', 1) # 6-6 Unknown7009(0) SFX_0('004_swing_grap_1_0') sprite('Action_002_03', 4) # 7-10 **attackbox here** sprite('Action_002_04', 4) # 11-14 Recovery() Unknown2063() sprite('Action_002_05', 4) # 15-18 sprite('Action_002_06', 3) # 19-21 sprite('Action_002_07', 3) # 22-24 @State def AN_NmlAtk5A_2nd(): def upon_IMMEDIATE(): AttackDefaults_StandingNormal() AttackLevel_(3) Damage(1300) AirPushbackY(0) Unknown9016(1) callSubroutine('ChainRoot') HitOrBlockCancel('AN_NmlAtk5A_3rd') HitOrBlockCancel('NmlAtkThrow') HitOrBlockCancel('NmlAtkBackThrow') sprite('Action_145_00', 2) # 1-2 sprite('Action_145_01', 4) # 3-6 Unknown7009(1) SFX_0('010_swing_sword_1') sprite('Action_145_02', 2) # 7-8 **attackbox here** GFX_0('Lin_082', 100) sprite('Action_145_03', 3) # 9-11 Recovery() Unknown2063() sprite('Action_145_04', 6) # 12-17 sprite('Action_145_05', 5) # 18-22 sprite('Action_145_06', 4) # 23-26 @State def AN_NmlAtk5A_3rd(): def upon_IMMEDIATE(): AttackDefaults_StandingNormal() AttackLevel_(3) Damage(950) Unknown11092(1) Hitstop(7) AirPushbackY(20000) Unknown9016(1) callSubroutine('ChainRoot') sprite('Action_003_00', 2) # 1-2 sprite('Action_003_01', 3) # 3-5 sprite('Action_003_02', 3) # 6-8 sprite('Action_003_03', 1) # 9-9 Unknown7009(2) SFX_0('010_swing_sword_2') sprite('Action_003_04', 2) # 10-11 **attackbox here** GFX_0('EffNmlAtk5CBlade', 100) sprite('Action_003_05', 4) # 12-15 **attackbox here** RefreshMultihit() def upon_ON_HIT_OR_BLOCK(): HitOrBlockCancel('AN_NmlAtk5A_4th') sprite('Action_003_06', 7) # 16-22 Recovery() Unknown2063() HitOrBlockCancel('AN_NmlAtk5A_4th') sprite('Action_003_07', 4) # 23-26 sprite('Action_003_08', 4) # 27-30 sprite('Action_003_09', 3) # 31-33 sprite('Action_003_10', 3) # 34-36 @State def AN_NmlAtk5A_4th(): def upon_IMMEDIATE(): AttackDefaults_StandingNormal() AttackLevel_(4) Damage(1100) GroundedHitstunAnimation(9) AirPushbackY(5000) AirPushbackX(30000) AirUntechableTime(30) Hitstop(4) Unknown11001(5, 5, 10) Unknown9016(1) JumpCancel_(0) if Unknown23145('AN_NmlAtk5A_3rd'): Unknown11044(1) Unknown2037(1) sprite('Action_441_00', 2) # 1-2 sprite('Action_441_01', 2) # 3-4 sprite('Action_441_02', 2) # 5-6 sprite('Action_441_03', 4) # 7-10 sprite('Action_441_04', 2) # 11-12 GFX_0('Lin_430', 100) Unknown4020(1) GFX_0('Lin_433', 100) Unknown4020(1) SFX_4('uli204_2') SFX_0('006_swing_blade_1') sprite('Action_441_05', 2) # 13-14 sprite('Action_441_06', 2) # 15-16 sprite('Action_441_07', 2) # 17-18 sprite('Action_145_00', 2) # 19-20 Unknown14070('ShotDashCancel') sprite('Action_145_01', 2) # 21-22 DisableAttackRestOfMove() sprite('Action_145_02', 3) # 23-25 **attackbox here** GFX_0('Lin_432', 100) Unknown4020(1) GFX_0('Lin_434', 100) Unknown4020(1) SFX_0('006_swing_blade_2') sprite('Action_145_03', 3) # 26-28 RefreshMultihit() Unknown11001(0, 0, 5) AirPushbackY(10000) clearUponHandler(10) def upon_ON_HIT_OR_BLOCK(): Unknown14072('ShotDashCancel') if SLOT_2: Unknown30088(1) sprite('Action_145_04', 12) # 29-40 Unknown4020(0) Unknown14072('ShotDashCancel') Recovery() Unknown2063() sprite('Action_145_05', 5) # 41-45 Unknown14074('ShotDashCancel') sprite('Action_145_06', 4) # 46-49 @State def NmlAtk4A(): def upon_IMMEDIATE(): AttackDefaults_StandingNormal() AttackLevel_(2) Damage(700) AttackP2(75) Unknown11092(1) AirPushbackY(10000) PushbackX(8000) Hitstop(6) Unknown9016(1) HitOrBlockCancel('NmlAtkThrow') HitOrBlockCancel('NmlAtkBackThrow') HitOrBlockJumpCancel(1) sprite('Action_249_00', 3) # 1-3 sprite('Action_249_01', 1) # 4-4 tag_voice(1, 'uli206_0', 'uli206_1', 'uli206_2', '') SFX_0('010_swing_sword_1') sprite('Action_249_02', 1) # 5-5 **attackbox here** GFX_0('EffARushSlash00', 100) sprite('Action_249_03', 2) # 6-7 sprite('Action_249_04', 2) # 8-9 sprite('Action_249_05', 2) # 10-11 SFX_0('008_swing_pole_1') sprite('Action_249_06', 4) # 12-15 **attackbox here** GFX_0('EffARushSlash01', 100) RefreshMultihit() Hitstop(10) def upon_ON_HIT_OR_BLOCK(): callSubroutine('ChainRoot') HitOrBlockCancel('AN_NmlAtk4A_2nd') sprite('Action_249_07', 6) # 16-21 callSubroutine('ChainRoot') HitOrBlockCancel('AN_NmlAtk4A_2nd') Recovery() Unknown2063() sprite('Action_249_08', 6) # 22-27 @State def AN_NmlAtk4A_2nd(): def upon_IMMEDIATE(): AttackDefaults_StandingNormal() AttackLevel_(2) Damage(800) Unknown11092(1) AirPushbackY(10000) PushbackX(8000) Hitstop(6) Unknown9016(1) HitOrBlockCancel('NmlAtkThrow') HitOrBlockCancel('NmlAtkBackThrow') sprite('Action_253_00', 4) # 1-4 sprite('Action_253_01', 2) # 5-6 SFX_0('010_swing_sword_1') sprite('Action_253_02', 1) # 7-7 **attackbox here** GFX_0('EffARush2ndSlash00', 100) sprite('Action_253_03', 2) # 8-9 sprite('Action_253_04', 2) # 10-11 sprite('Action_253_05', 2) # 12-13 tag_voice(0, 'uli207_0', 'uli207_1', 'uli207_2', '') SFX_0('008_swing_pole_2') sprite('Action_253_06', 1) # 14-14 **attackbox here** GFX_0('EffARush2ndSlash01', 100) RefreshMultihit() Hitstop(10) PushbackX(-8000) AirPushbackX(-5000) AirPushbackY(-5000) def upon_ON_HIT_OR_BLOCK(): callSubroutine('ChainRoot') HitOrBlockCancel('AN_NmlAtk4A_3rd') sprite('Action_253_06', 3) # 15-17 **attackbox here** callSubroutine('ChainRoot') HitOrBlockCancel('AN_NmlAtk4A_3rd') sprite('Action_253_07', 2) # 18-19 Recovery() Unknown2063() sprite('Action_253_08', 8) # 20-27 sprite('Action_253_09', 6) # 28-33 @State def AN_NmlAtk4A_3rd(): def upon_IMMEDIATE(): AttackDefaults_StandingNormal() AttackLevel_(3) Damage(1000) AttackP2(70) Unknown11092(1) AirPushbackY(15000) Hitstop(6) Unknown9016(1) sprite('Action_255_07', 3) # 1-3 sprite('Action_255_08', 3) # 4-6 SFX_0('010_swing_sword_1') sprite('Action_255_09', 4) # 7-10 **attackbox here** GFX_0('EffBRush2ndSlash02', 100) RefreshMultihit() sprite('Action_255_10', 2) # 11-12 Unknown2015(125) sprite('Action_255_11', 2) # 13-14 sprite('Action_255_12', 2) # 15-16 sprite('Action_255_13', 2) # 17-18 Unknown2015(150) teleportRelativeX(55000) sprite('Action_255_14', 1) # 19-19 Unknown14070('ShotDashCancel') tag_voice(0, 'uli208_0', 'uli208_1', 'uli208_2', '') teleportRelativeX(65000) SFX_0('010_swing_sword_2') sprite('Action_255_14', 1) # 20-20 sprite('Action_255_15', 2) # 21-22 **attackbox here** GFX_0('EffEXRushSlash05', 100) RefreshMultihit() GroundedHitstunAnimation(9) AirPushbackX(20000) AirUntechableTime(30) Hitstop(13) def upon_ON_HIT_OR_BLOCK(): callSubroutine('ChainRoot') HitOrBlockCancel('AN_NmlAtk4A_4th') Unknown14072('ShotDashCancel') sprite('Action_255_16', 6) # 23-28 callSubroutine('ChainRoot') HitOrBlockCancel('AN_NmlAtk4A_4th') Unknown14072('ShotDashCancel') Recovery() Unknown2063() sprite('Action_255_17', 8) # 29-36 sprite('Action_255_18', 5) # 37-41 Unknown14074('ShotDashCancel') Unknown2015(125) teleportRelativeX(-25000) sprite('Action_255_19', 2) # 42-43 teleportRelativeX(-40000) Unknown2015(-1) sprite('Action_255_19', 2) # 44-45 @State def NmlAtk5B(): def upon_IMMEDIATE(): AttackDefaults_StandingNormal() AttackLevel_(3) AttackP1(90) GroundedHitstunAnimation(13) AirHitstunAnimation(13) AirPushbackX(8000) AirPushbackY(20000) AirUntechableTime(24) Unknown9016(1) Unknown1112('') callSubroutine('ChainRoot') HitOrBlockCancel('AN_NmlAtk5B_2nd') sprite('Action_140_00', 4) # 1-4 sprite('Action_140_01', 3) # 5-7 tag_voice(1, 'uli109_0', 'uli109_1', 'uli109_2', '') sprite('Action_140_02', 3) # 8-10 sprite('Action_140_03', 2) # 11-12 SFX_0('010_swing_sword_1') setInvincible(1) Unknown22019('0100000000000000000000000000000000000000') sprite('Action_140_04', 6) # 13-18 **attackbox here** GFX_0('EffNmlAtk6CBlade1st', 100) sprite('Action_140_04', 13) # 19-31 **attackbox here** StartMultihit() Recovery() Unknown2063() setInvincible(0) sprite('Action_140_05', 6) # 32-37 sprite('Action_140_06', 4) # 38-41 sprite('Action_140_07', 3) # 42-44 @State def AN_NmlAtk5B_2nd(): def upon_IMMEDIATE(): AttackDefaults_StandingNormal() AttackLevel_(3) AirHitstunAnimation(10) GroundedHitstunAnimation(10) AirPushbackX(1000) AirPushbackY(20000) AirUntechableTime(24) Unknown9016(1) callSubroutine('ChainRoot') HitOrBlockCancel('AN_NmlAtk5B_3rd') sprite('Action_141_00', 5) # 1-5 sprite('Action_141_01', 5) # 6-10 sprite('Action_141_02', 2) # 11-12 tag_voice(0, 'uli110_0', 'uli110_1', 'uli110_2', '') SFX_0('010_swing_sword_2') sprite('Action_141_03', 2) # 13-14 **attackbox here** GFX_0('EffNmlAtk6CBlade2nd', 100) sprite('Action_141_03', 2) # 15-16 **attackbox here** sprite('Action_141_04', 6) # 17-22 Recovery() Unknown2063() sprite('Action_141_05', 4) # 23-26 sprite('Action_141_05', 4) # 27-30 sprite('Action_141_06', 4) # 31-34 sprite('Action_141_07', 4) # 35-38 @State def AN_NmlAtk5B_3rd(): def upon_IMMEDIATE(): AttackDefaults_StandingNormal() AttackLevel_(4) GroundedHitstunAnimation(11) AirHitstunAnimation(11) AirPushbackX(20000) AirPushbackY(-60000) AirUntechableTime(24) Unknown9310(1) Unknown9016(1) Unknown11056(0) Unknown2004(1, 0) callSubroutine('ChainRoot') HitOrBlockCancel('ShotDashCancel') sprite('Action_142_00', 6) # 1-6 Unknown2015(125) sprite('Action_142_01', 3) # 7-9 Unknown2015(150) Unknown2016(250) sprite('Action_142_01', 2) # 10-11 Unknown2015(175) Unknown2016(300) sprite('Action_142_02', 4) # 12-15 Unknown2015(200) sprite('Action_142_03', 3) # 16-18 sprite('Action_142_04', 1) # 19-19 Unknown2016(400) Unknown2015(250) tag_voice(0, 'uli111_0', 'uli111_1', 'uli111_2', '') SFX_0('006_swing_blade_2') sprite('Action_142_04', 1) # 20-20 GFX_0('EffNmlAtk6CBlade3rd', 100) sprite('Action_142_05', 5) # 21-25 **attackbox here** Unknown2015(200) Unknown2016(-1) SFX_0('209_down_normal_1') sprite('Action_142_06', 8) # 26-33 Recovery() Unknown2063() Unknown2015(175) sprite('Action_142_07', 6) # 34-39 Unknown2015(150) sprite('Action_142_08', 5) # 40-44 Unknown2015(125) sprite('Action_142_09', 3) # 45-47 Unknown2015(-1) sprite('Action_142_10', 3) # 48-50 @State def NmlAtk2A(): def upon_IMMEDIATE(): AttackDefaults_CrouchingNormal() AttackLevel_(1) Unknown9016(1) callSubroutine('ChainRoot') WhiffCancel('NmlAtk2A_Renda') HitOrBlockCancel('NmlAtk2A_Renda') HitOrBlockCancel('NmlAtkThrow') HitOrBlockCancel('NmlAtkBackThrow') HitOrBlockJumpCancel(1) sprite('Action_004_00', 3) # 1-3 sprite('Action_004_01', 2) # 4-5 Unknown7009(0) SFX_0('010_swing_sword_0') sprite('Action_004_02', 2) # 6-7 **attackbox here** GFX_0('EffNmlAtk2ABlade', 100) sprite('Action_004_03', 3) # 8-10 Recovery() WhiffCancelEnable(1) sprite('Action_004_04', 3) # 11-13 sprite('Action_004_04', 2) # 14-15 WhiffCancelEnable(0) sprite('Action_004_05', 5) # 16-20 @State def NmlAtk2A_Renda(): def upon_IMMEDIATE(): AttackDefaults_CrouchingNormal() AttackLevel_(1) Unknown9016(1) callSubroutine('ChainRoot') WhiffCancel('NmlAtk2A_Renda') HitOrBlockCancel('NmlAtk2A_Renda') HitOrBlockCancel('NmlAtkThrow') HitOrBlockCancel('NmlAtkBackThrow') HitOrBlockJumpCancel(1) sprite('Action_004_00', 3) # 1-3 sprite('Action_004_01', 2) # 4-5 Unknown7009(0) SFX_0('010_swing_sword_0') sprite('Action_004_02', 2) # 6-7 **attackbox here** GFX_0('EffNmlAtk2ABlade', 100) sprite('Action_004_03', 3) # 8-10 Unknown2063() WhiffCancelEnable(1) sprite('Action_004_04', 5) # 11-15 sprite('Action_004_05', 5) # 16-20 @State def NmlAtk2B(): def upon_IMMEDIATE(): AttackDefaults_CrouchingNormal() AttackLevel_(2) AttackP1(90) HitLow(2) Unknown9016(1) callSubroutine('ChainRoot') sprite('Action_005_00', 4) # 1-4 sprite('Action_005_01', 3) # 5-7 Unknown7009(1) SFX_0('010_swing_sword_1') sprite('Action_005_02', 2) # 8-9 **attackbox here** teleportRelativeX(40000) GFX_0('EffNmlAtk2BBlade', 100) sprite('Action_005_03', 5) # 10-14 Recovery() Unknown2063() sprite('Action_005_04', 6) # 15-20 sprite('Action_005_05', 5) # 21-25 teleportRelativeX(40000) sprite('Action_005_06', 4) # 26-29 teleportRelativeX(50000) @State def NmlAtk2C(): def upon_IMMEDIATE(): AttackDefaults_CrouchingNormal() AttackLevel_(4) AttackP1(90) AttackP2(75) AirPushbackY(20000) AirUntechableTime(26) AirHitstunAnimation(11) GroundedHitstunAnimation(11) HitLow(2) Unknown9016(1) callSubroutine('ChainRoot') Unknown14085('CmnActCrushAttack') sprite('Action_006_00', 4) # 1-4 sprite('Action_006_01', 5) # 5-9 teleportRelativeX(50000) sprite('Action_006_02', 1) # 10-10 teleportRelativeX(43000) GFX_0('EffNmlAtk2CBlade', 100) tag_voice(1, 'uli107_0', 'uli107_1', 'uli107_2', '') SFX_0('010_swing_sword_2') sprite('Action_006_02', 1) # 11-11 sprite('Action_006_03', 6) # 12-17 **attackbox here** sprite('Action_006_04', 8) # 18-25 Recovery() Unknown2063() sprite('Action_006_05', 5) # 26-30 sprite('Action_006_06', 6) # 31-36 sprite('Action_006_07', 5) # 37-41 @State def NmlAtkAIR5A(): def upon_IMMEDIATE(): AttackDefaults_AirNormal() AttackLevel_(3) Unknown9016(1) AirPushbackX(10000) AirPushbackY(18000) HitOrBlockJumpCancel(1) HitOrBlockCancel('NmlAtkAIR5A_2nd') HitOrBlockCancel('NmlAtkAIR5B') HitOrBlockCancel('NmlAtkAIR5C') sprite('Action_147_08', 6) # 1-6 sprite('Action_147_09', 2) # 7-8 Unknown7009(3) sprite('Action_147_09', 2) # 9-10 SFX_0('010_swing_sword_0') sprite('Action_147_10', 4) # 11-14 **attackbox here** GFX_0('EffNmlAtkAir5BBlade', 100) sprite('Action_147_11', 5) # 15-19 Recovery() Unknown2063() sprite('Action_147_12', 5) # 20-24 sprite('Action_147_13', 5) # 25-29 @State def NmlAtkAIR5A_2nd(): def upon_IMMEDIATE(): AttackDefaults_AirNormal() AttackLevel_(3) Damage(1200) Unknown9016(1) AirPushbackX(10000) AirPushbackY(18000) HitOrBlockJumpCancel(1) HitOrBlockCancel('NmlAtkAIR5B') HitOrBlockCancel('NmlAtkAIR5C') sprite('Action_008_00', 4) # 1-4 sprite('Action_008_01', 3) # 5-7 Unknown7009(3) SFX_0('010_swing_sword_1') sprite('Action_008_02', 2) # 8-9 **attackbox here** GFX_0('EffNmlAtkAir5A2ndBlade', 100) sprite('Action_008_03', 4) # 10-13 Recovery() Unknown2063() sprite('Action_008_03', 4) # 14-17 sprite('Action_008_04', 5) # 18-22 sprite('Action_008_05', 5) # 23-27 @State def NmlAtkAIR5B(): def upon_IMMEDIATE(): AttackDefaults_AirNormal() AttackLevel_(3) Damage(1600) Unknown9016(1) AirPushbackX(10000) AirPushbackY(14000) HitOrBlockJumpCancel(1) HitOrBlockCancel('NmlAtkAIR5A') HitOrBlockCancel('NmlAtkAIR5C') sprite('Action_009_00', 2) # 1-2 sprite('Action_009_01', 4) # 3-6 sprite('Action_009_02', 2) # 7-8 Unknown7009(5) sprite('Action_009_02', 3) # 9-11 SFX_0('010_swing_sword_2') sprite('Action_009_03', 4) # 12-15 **attackbox here** GFX_0('EffNmlAtkAir5CBlade', 100) sprite('Action_009_04', 8) # 16-23 Recovery() Unknown2063() sprite('Action_009_05', 5) # 24-28 sprite('Action_009_06', 4) # 29-32 @State def NmlAtkAIR5C(): def upon_IMMEDIATE(): AttackDefaults_AirNormal() AttackLevel_(3) AirPushbackX(24000) AirPushbackY(-30000) PushbackX(10000) AirUntechableTime(30) Unknown1084(1) clearUponHandler(2) sendToLabelUpon(2, 1) HitOverhead(0) sprite('Action_146_00', 5) # 1-5 physicsXImpulse(10000) physicsYImpulse(10000) sprite('Action_146_01', 6) # 6-11 sprite('Action_146_02', 1) # 12-12 Unknown1084(1) physicsYImpulse(-30000) setGravity(5000) physicsXImpulse(30000) tag_voice(1, 'uli108_0', 'uli108_1', 'uli108_2', '') SFX_0('004_swing_grap_1_1') SFX_0('000_airdash_2') sprite('Action_146_03', 3) # 13-15 **attackbox here** sprite('Action_146_04', 3) # 16-18 **attackbox here** label(0) sprite('Action_146_03', 3) # 19-21 **attackbox here** sprite('Action_146_04', 3) # 22-24 **attackbox here** loopRest() gotoLabel(0) label(1) sprite('Action_146_05', 5) # 25-29 Unknown8000(100, 1, 1) Unknown1019(10) clearUponHandler(2) Recovery() Unknown2063() sprite('Action_146_06', 4) # 30-33 sprite('Action_146_07', 3) # 34-36 loopRest() @State def NmlAtk3C(): def upon_IMMEDIATE(): Unknown17013() sprite('Action_150_00', 5) # 1-5 Unknown18009(1) Unknown1015(34000) sprite('Action_150_01', 4) # 6-9 tag_voice(1, 'uli112_0', 'uli112_1', 'uli112_2', '') setInvincible(1) EnableCollision(0) sprite('Action_150_02', 4) # 10-13 sprite('Action_150_03', 2) # 14-15 sprite('Action_150_05', 4) # 16-19 Unknown2006() sprite('Action_150_07', 4) # 20-23 setInvincible(0) Unknown1084(1) sprite('Action_150_06', 3) # 24-26 sprite('Action_150_08', 3) # 27-29 @State def CmnActCrushAttack(): def upon_IMMEDIATE(): Unknown30072('') Unknown11058('0100000000000000000000000000000000000000') Unknown9016(1) sprite('Action_068_00', 4) # 1-4 sprite('Action_068_02', 3) # 5-7 SLOT_12 = SLOT_19 Unknown1019(5) physicsYImpulse(23000) if (SLOT_12 >= 20000): SLOT_12 = 20000 setGravity(1800) clearUponHandler(2) sendToLabelUpon(2, 1) Unknown23087(100000) sprite('Action_068_03', 3) # 8-10 sprite('Action_068_04', 3) # 11-13 tag_voice(1, 'uli156_0', 'uli156_1', '', '') sprite('Action_068_05', 3) # 14-16 sprite('Action_068_06', 3) # 17-19 sprite('Action_147_08', 3) # 20-22 sprite('Action_147_09', 3) # 23-25 sprite('Action_147_10', 3) # 26-28 **attackbox here** GFX_0('EffNmlAtkAir5BBlade', 100) SFX_0('010_swing_sword_0') sprite('Action_147_11', 6) # 29-34 sprite('Action_147_12', 6) # 35-40 sprite('Action_147_13', 7) # 41-47 label(0) sprite('Action_068_10', 3) # 48-50 sprite('Action_068_11', 2) # 51-52 loopRest() gotoLabel(0) label(1) sprite('Action_069_00', 2) # 53-54 Unknown18009(1) Unknown8000(100, 1, 1) clearUponHandler(2) Unknown1084(1) sprite('Action_069_01', 3) # 55-57 sprite('Action_069_02', 5) # 58-62 sprite('Action_069_03', 3) # 63-65 Unknown18009(0) @State def CmnActCrushAttackChase1st(): def upon_IMMEDIATE(): Unknown30073(0) Unknown9016(1) loopRelated(17, 19) def upon_17(): clearUponHandler(17) sendToLabel(2) setGravity(3000) sendToLabelUpon(2, 1) sprite('Action_147_11', 6) # 1-6 sprite('Action_147_12', 6) # 7-12 sprite('Action_147_13', 7) # 13-19 sprite('Action_068_10', 3) # 20-22 sprite('Action_068_11', 2) # 23-24 label(1) sprite('Action_069_00', 4) # 25-28 Unknown8000(100, 1, 1) sprite('Action_069_01', 50) # 29-78 label(2) sprite('Action_145_00', 4) # 79-82 clearUponHandler(17) teleportRelativeY(0) tag_voice(0, 'uli157_0', 'uli157_1', '', '') sprite('Action_145_01', 6) # 83-88 sprite('Action_145_02', 2) # 89-90 **attackbox here** GFX_0('EffNmlAtk5BBlade', 100) SFX_0('010_swing_sword_1') sprite('Action_145_03', 3) # 91-93 sprite('Action_145_04', 6) # 94-99 sprite('Action_145_05', 5) # 100-104 sprite('Action_145_06', 4) # 105-108 SFX_FOOTSTEP_(100, 1, 1) loopRelated(17, 180) def upon_17(): clearUponHandler(17) sendToLabel(11) label(10) sprite('Action_000_00', 7) # 109-115 **attackbox here** sprite('Action_000_01', 7) # 116-122 **attackbox here** sprite('Action_000_02', 6) # 123-128 **attackbox here** sprite('Action_000_03', 6) # 129-134 **attackbox here** sprite('Action_000_04', 8) # 135-142 **attackbox here** sprite('Action_000_05', 5) # 143-147 **attackbox here** sprite('Action_000_06', 5) # 148-152 **attackbox here** sprite('Action_000_07', 5) # 153-157 **attackbox here** sprite('Action_000_08', 6) # 158-163 **attackbox here** sprite('Action_000_09', 5) # 164-168 **attackbox here** sprite('Action_000_10', 6) # 169-174 **attackbox here** sprite('Action_000_11', 8) # 175-182 **attackbox here** sprite('Action_000_12', 5) # 183-187 **attackbox here** sprite('Action_000_13', 5) # 188-192 **attackbox here** sprite('Action_000_14', 6) # 193-198 **attackbox here** loopRest() gotoLabel(10) label(11) sprite('keep', 1) # 199-199 @State def CmnActCrushAttackChase2nd(): def upon_IMMEDIATE(): Unknown30074(0) Unknown9016(1) loopRelated(17, 180) def upon_17(): clearUponHandler(17) sendToLabel(1) sprite('Action_251_28', 3) # 1-3 sprite('Action_251_29', 3) # 4-6 sprite('Action_251_30', 2) # 7-8 sprite('Action_251_31', 2) # 9-10 sprite('Action_251_32', 2) # 11-12 sprite('Action_251_33', 2) # 13-14 sprite('Action_251_34', 1) # 15-15 **attackbox here** GFX_0('EffEXRushSlash05', 100) SFX_0('010_swing_sword_2') sprite('Action_251_35', 6) # 16-21 sprite('Action_251_36', 5) # 22-26 sprite('Action_251_37', 5) # 27-31 sprite('Action_251_38', 3) # 32-34 sprite('Action_000_00', 7) # 35-41 **attackbox here** sprite('Action_000_01', 7) # 42-48 **attackbox here** sprite('Action_000_02', 6) # 49-54 **attackbox here** sprite('Action_000_03', 6) # 55-60 **attackbox here** sprite('Action_000_04', 8) # 61-68 **attackbox here** sprite('Action_000_05', 5) # 69-73 **attackbox here** sprite('Action_000_06', 5) # 74-78 **attackbox here** sprite('Action_000_07', 5) # 79-83 **attackbox here** sprite('Action_000_08', 6) # 84-89 **attackbox here** sprite('Action_000_09', 5) # 90-94 **attackbox here** sprite('Action_000_10', 6) # 95-100 **attackbox here** sprite('Action_000_11', 8) # 101-108 **attackbox here** sprite('Action_000_12', 5) # 109-113 **attackbox here** sprite('Action_000_13', 5) # 114-118 **attackbox here** sprite('Action_000_14', 6) # 119-124 **attackbox here** label(0) sprite('Action_000_00', 7) # 125-131 **attackbox here** sprite('Action_000_01', 7) # 132-138 **attackbox here** sprite('Action_000_02', 6) # 139-144 **attackbox here** sprite('Action_000_03', 6) # 145-150 **attackbox here** sprite('Action_000_04', 8) # 151-158 **attackbox here** sprite('Action_000_05', 5) # 159-163 **attackbox here** sprite('Action_000_06', 5) # 164-168 **attackbox here** sprite('Action_000_07', 5) # 169-173 **attackbox here** sprite('Action_000_08', 6) # 174-179 **attackbox here** sprite('Action_000_09', 5) # 180-184 **attackbox here** sprite('Action_000_10', 6) # 185-190 **attackbox here** sprite('Action_000_11', 8) # 191-198 **attackbox here** sprite('Action_000_12', 5) # 199-203 **attackbox here** sprite('Action_000_13', 5) # 204-208 **attackbox here** sprite('Action_000_14', 6) # 209-214 **attackbox here** loopRest() gotoLabel(0) label(1) sprite('keep', 1) # 215-215 @State def CmnActCrushAttackFinish(): def upon_IMMEDIATE(): Unknown30075(0) sprite('Action_140_00', 3) # 1-3 sprite('Action_140_01', 6) # 4-9 sprite('Action_140_02', 6) # 10-15 sprite('Action_140_03', 4) # 16-19 tag_voice(0, 'uli158_0', 'uli158_1', '', '') sprite('Action_140_04', 6) # 20-25 **attackbox here** GFX_0('EffNmlAtk6CBlade1st', 100) SFX_0('006_swing_blade_0') sprite('Action_140_05', 25) # 26-50 sprite('Action_140_06', 5) # 51-55 sprite('Action_140_07', 5) # 56-60 @State def CmnActCrushAttackExFinish(): def upon_IMMEDIATE(): Unknown30089(0) loopRelated(17, 60) def upon_17(): clearUponHandler(17) sendToLabel(1) label(0) sprite('Action_000_00', 7) # 1-7 **attackbox here** sprite('Action_000_01', 7) # 8-14 **attackbox here** sprite('Action_000_02', 6) # 15-20 **attackbox here** sprite('Action_000_03', 6) # 21-26 **attackbox here** sprite('Action_000_04', 8) # 27-34 **attackbox here** sprite('Action_000_05', 5) # 35-39 **attackbox here** sprite('Action_000_06', 5) # 40-44 **attackbox here** sprite('Action_000_07', 5) # 45-49 **attackbox here** sprite('Action_000_08', 6) # 50-55 **attackbox here** sprite('Action_000_09', 5) # 56-60 **attackbox here** sprite('Action_000_10', 6) # 61-66 **attackbox here** sprite('Action_000_11', 8) # 67-74 **attackbox here** sprite('Action_000_12', 5) # 75-79 **attackbox here** sprite('Action_000_13', 5) # 80-84 **attackbox here** sprite('Action_000_14', 6) # 85-90 **attackbox here** loopRest() gotoLabel(0) label(1) sprite('Action_140_00', 3) # 91-93 sprite('Action_140_01', 6) # 94-99 sprite('Action_140_02', 6) # 100-105 sprite('Action_140_03', 4) # 106-109 tag_voice(0, 'uli158_0', 'uli158_1', '', '') sprite('Action_140_04', 6) # 110-115 **attackbox here** GFX_0('EffNmlAtk6CBlade1st', 100) SFX_0('006_swing_blade_0') sprite('Action_140_05', 25) # 116-140 sprite('Action_140_06', 5) # 141-145 sprite('Action_140_07', 5) # 146-150 @State def CmnActCrushAttackAssistChase1st(): def upon_IMMEDIATE(): Unknown30073(1) Unknown9016(1) sprite('null', 20) # 1-20 Unknown1086(22) teleportRelativeY(0) sprite('null', 1) # 21-21 Unknown30081('') Unknown1086(22) teleportRelativeX(-1000000) physicsYImpulse(-4000) setGravity(0) SLOT_12 = SLOT_19 Unknown1019(10) sprite('Action_184_00', 1) # 22-22 sprite('Action_184_01', 1) # 23-23 physicsXImpulse(38000) physicsYImpulse(23000) setGravity(3000) Unknown8001(0, 100) def upon_LANDING(): clearUponHandler(2) sendToLabel(1) sprite('Action_184_02', 1) # 24-24 sprite('Action_184_03', 1) # 25-25 sprite('Action_184_04', 2) # 26-27 sprite('Action_184_05', 2) # 28-29 sprite('Action_184_06', 3) # 30-32 sprite('Action_184_07', 4) # 33-36 Unknown1019(60) sprite('Action_184_08', 5) # 37-41 sprite('Action_184_09', 5) # 42-46 label(1) sprite('Action_184_10', 1) # 47-47 **attackbox here** GFX_0('EffEXAssaultSlash', 100) SFX_0('010_swing_sword_1') physicsXImpulse(0) clearUponHandler(2) Unknown8000(100, 1, 1) sprite('Action_184_10', 1) # 48-48 **attackbox here** sprite('Action_184_10', 1) # 49-49 **attackbox here** sprite('Action_184_11', 1) # 50-50 **attackbox here** sprite('Action_184_12', 7) # 51-57 sprite('Action_184_13', 5) # 58-62 sprite('Action_184_14', 4) # 63-66 sprite('Action_184_15', 4) # 67-70 sprite('Action_000_00', 7) # 71-77 **attackbox here** sprite('Action_000_01', 7) # 78-84 **attackbox here** sprite('Action_000_02', 6) # 85-90 **attackbox here** sprite('Action_000_03', 6) # 91-96 **attackbox here** sprite('Action_000_04', 8) # 97-104 **attackbox here** sprite('Action_000_05', 5) # 105-109 **attackbox here** sprite('Action_000_06', 5) # 110-114 **attackbox here** sprite('Action_000_07', 5) # 115-119 **attackbox here** sprite('Action_000_08', 6) # 120-125 **attackbox here** sprite('Action_000_09', 5) # 126-130 **attackbox here** sprite('Action_000_10', 6) # 131-136 **attackbox here** sprite('Action_000_11', 8) # 137-144 **attackbox here** sprite('Action_000_12', 5) # 145-149 **attackbox here** sprite('Action_000_13', 5) # 150-154 **attackbox here** sprite('Action_000_14', 6) # 155-160 **attackbox here** @State def CmnActCrushAttackAssistChase2nd(): def upon_IMMEDIATE(): Unknown30074(1) Unknown9016(1) sprite('Action_142_00', 2) # 1-2 sprite('Action_142_01', 2) # 3-4 sprite('Action_142_02', 2) # 5-6 sprite('Action_142_03', 2) # 7-8 teleportRelativeX(-40000) sprite('Action_142_04', 3) # 9-11 teleportRelativeX(-60000) sprite('Action_142_05', 3) # 12-14 **attackbox here** teleportRelativeX(-80000) GFX_0('EffNmlAtk6CBlade3rd', 100) SFX_0('010_swing_sword_2') Unknown36(1) teleportRelativeX(250000) Unknown35() sprite('Action_142_06', 3) # 15-17 sprite('Action_142_07', 3) # 18-20 sprite('Action_142_08', 3) # 21-23 teleportRelativeX(80000) sprite('Action_142_09', 3) # 24-26 teleportRelativeX(60000) sprite('Action_142_10', 3) # 27-29 teleportRelativeX(40000) sprite('Action_000_00', 7) # 30-36 **attackbox here** sprite('Action_000_01', 7) # 37-43 **attackbox here** sprite('Action_000_02', 6) # 44-49 **attackbox here** sprite('Action_000_03', 6) # 50-55 **attackbox here** sprite('Action_000_04', 8) # 56-63 **attackbox here** sprite('Action_000_05', 5) # 64-68 **attackbox here** sprite('Action_000_06', 5) # 69-73 **attackbox here** sprite('Action_000_07', 5) # 74-78 **attackbox here** sprite('Action_000_08', 6) # 79-84 **attackbox here** sprite('Action_000_09', 5) # 85-89 **attackbox here** sprite('Action_000_10', 6) # 90-95 **attackbox here** sprite('Action_000_11', 8) # 96-103 **attackbox here** sprite('Action_000_12', 5) # 104-108 **attackbox here** sprite('Action_000_13', 5) # 109-113 **attackbox here** sprite('Action_000_14', 6) # 114-119 **attackbox here** @State def CmnActCrushAttackAssistFinish(): def upon_IMMEDIATE(): Unknown30075(1) sprite('Action_140_00', 3) # 1-3 sprite('Action_140_01', 6) # 4-9 sprite('Action_140_02', 6) # 10-15 sprite('Action_140_03', 4) # 16-19 sprite('Action_140_04', 6) # 20-25 **attackbox here** GFX_0('EffNmlAtk6CBlade1st', 100) SFX_0('006_swing_blade_0') sprite('Action_140_05', 25) # 26-50 sprite('Action_140_06', 5) # 51-55 sprite('Action_140_07', 5) # 56-60 @State def CmnActCrushAttackAssistExFinish(): def upon_IMMEDIATE(): Unknown30089(1) loopRelated(17, 60) def upon_17(): clearUponHandler(17) sendToLabel(1) label(0) sprite('Action_000_00', 7) # 1-7 **attackbox here** sprite('Action_000_01', 7) # 8-14 **attackbox here** sprite('Action_000_02', 6) # 15-20 **attackbox here** sprite('Action_000_03', 6) # 21-26 **attackbox here** sprite('Action_000_04', 8) # 27-34 **attackbox here** sprite('Action_000_05', 5) # 35-39 **attackbox here** sprite('Action_000_06', 5) # 40-44 **attackbox here** sprite('Action_000_07', 5) # 45-49 **attackbox here** sprite('Action_000_08', 6) # 50-55 **attackbox here** sprite('Action_000_09', 5) # 56-60 **attackbox here** sprite('Action_000_10', 6) # 61-66 **attackbox here** sprite('Action_000_11', 8) # 67-74 **attackbox here** sprite('Action_000_12', 5) # 75-79 **attackbox here** sprite('Action_000_13', 5) # 80-84 **attackbox here** sprite('Action_000_14', 6) # 85-90 **attackbox here** loopRest() gotoLabel(0) label(1) sprite('Action_140_00', 3) # 91-93 sprite('Action_140_01', 6) # 94-99 sprite('Action_140_02', 6) # 100-105 sprite('Action_140_03', 4) # 106-109 sprite('Action_140_04', 6) # 110-115 **attackbox here** GFX_0('EffNmlAtk6CBlade1st', 100) SFX_0('006_swing_blade_0') sprite('Action_140_05', 25) # 116-140 sprite('Action_140_06', 5) # 141-145 sprite('Action_140_07', 5) # 146-150 @State def NmlAtkThrow(): def upon_IMMEDIATE(): Unknown17011('ThrowExe', 1, 0, 0) Unknown11054(120000) physicsXImpulse(8000) def upon_CLEAR_OR_EXIT(): if (SLOT_18 == 7): Unknown8007(100, 1, 1) physicsXImpulse(18000) if (SLOT_18 >= 7): Unknown1015(1000) if (SLOT_12 >= 32000): SLOT_12 = 32000 if (SLOT_18 >= 25): sendToLabel(1) if (SLOT_18 >= 3): if (SLOT_19 < 180000): sendToLabel(1) sprite('Action_045_13', 4) # 1-4 sprite('Action_045_00', 3) # 5-7 sprite('Action_045_01', 3) # 8-10 sprite('Action_045_02', 3) # 11-13 label(0) sprite('Action_045_03', 3) # 14-16 Unknown8006(100, 1, 1) sprite('Action_045_04', 3) # 17-19 sprite('Action_045_05', 3) # 20-22 sprite('Action_045_06', 3) # 23-25 Unknown8006(100, 1, 1) sprite('Action_045_07', 3) # 26-28 sprite('Action_045_08', 3) # 29-31 sprite('Action_045_09', 3) # 32-34 sprite('Action_045_02', 3) # 35-37 loopRest() gotoLabel(0) label(1) sprite('Action_055_00', 2) # 38-39 clearUponHandler(3) Unknown1019(10) Unknown8010(100, 1, 1) sprite('Action_055_01', 1) # 40-40 sprite('Action_055_02', 3) # 41-43 **attackbox here** SFX_0('003_swing_grap_0_0') Unknown1084(1) sprite('Action_055_02', 3) # 44-46 **attackbox here** StartMultihit() sprite('Action_055_03', 2) # 47-48 sprite('Action_055_04', 7) # 49-55 SFX_4('uli154') sprite('Action_055_05', 5) # 56-60 sprite('Action_055_06', 3) # 61-63 sprite('Action_055_07', 3) # 64-66 @State def ThrowExe(): def upon_IMMEDIATE(): Unknown17012(1, 0, 0) AttackLevel_(1) Damage(200) AttackP2(50) Unknown11092(1) Unknown11073(1) AirHitstunAnimation(11) GroundedHitstunAnimation(11) AirPushbackX(2000) AirPushbackY(12000) YImpluseBeforeWallbounce(1800) AirUntechableTime(40) Unknown9310(90) JumpCancel_(0) Unknown13024(0) Unknown11064(1) Unknown11069('ThrowExe') sprite('Action_055_02', 4) # 1-4 **attackbox here** Unknown5000(8, 0) Unknown5001('0000000004000000040000000000000000000000') StartMultihit() Unknown5003(1) sprite('Action_057_00', 1) # 5-5 SFX_0('003_swing_grap_0_1') sprite('Action_057_00', 1) # 6-6 Unknown5000(8, 0) Unknown5001('0000000004000000040000000000000000000000') sprite('Action_057_01', 8) # 7-14 **attackbox here** tag_voice(1, 'uli153_0', '', '', '') sprite('Action_057_02', 4) # 15-18 DisableAttackRestOfMove() sprite('Action_057_03', 2) # 19-20 sprite('Action_057_04', 2) # 21-22 sprite('Action_057_05', 3) # 23-25 sprite('Action_057_06', 4) # 26-29 physicsYImpulse(11000) setGravity(2200) teleportRelativeX(10000) sprite('Action_057_07', 3) # 30-32 teleportRelativeX(10000) sprite('Action_057_08', 3) # 33-35 teleportRelativeX(10000) sprite('Action_057_09', 1) # 36-36 **attackbox here** teleportRelativeX(20000) sprite('Action_057_10', 5) # 37-41 sprite('Action_057_11', 3) # 42-44 tag_voice(1, 'uli153_1', '', '', '') Unknown1084(1) sprite('Action_057_12', 1) # 45-45 **attackbox here** AttackLevel_(4) Damage(1800) YImpluseBeforeWallbounce(50000) Unknown11073(1) AirHitstunAnimation(11) GroundedHitstunAnimation(11) AirPushbackX(500) AirPushbackY(-40000) Unknown9310(40) Unknown9016(1) RefreshMultihit() Unknown11064(0) Unknown11069('') Unknown11083(1) clearUponHandler(78) def upon_78(): Unknown13024(1) JumpCancel_(1) sprite('Action_057_13', 6) # 46-51 sprite('Action_057_14', 3) # 52-54 sprite('Action_057_15', 2) # 55-56 sprite('Action_057_16', 5) # 57-61 physicsXImpulse(-10000) physicsYImpulse(12000) setGravity(2500) label(0) sprite('Action_057_17', 5) # 62-66 sendToLabelUpon(2, 1) loopRest() gotoLabel(0) label(1) sprite('Action_057_18', 2) # 67-68 Unknown1084(1) clearUponHandler(2) sprite('Action_057_19', 2) # 69-70 sprite('Action_057_20', 2) # 71-72 sprite('Action_057_21', 2) # 73-74 @State def NmlAtkBackThrow(): def upon_IMMEDIATE(): Unknown17011('BackThrowExe', 1, 0, 0) Unknown11054(120000) physicsXImpulse(8000) def upon_CLEAR_OR_EXIT(): if (SLOT_18 == 7): Unknown8007(100, 1, 1) physicsXImpulse(18000) if (SLOT_18 >= 7): Unknown1015(1000) if (SLOT_12 >= 32000): SLOT_12 = 32000 if (SLOT_18 >= 25): sendToLabel(1) if (SLOT_18 >= 3): if (SLOT_19 < 180000): sendToLabel(1) sprite('Action_045_13', 4) # 1-4 sprite('Action_045_00', 3) # 5-7 sprite('Action_045_01', 3) # 8-10 sprite('Action_045_02', 3) # 11-13 label(0) sprite('Action_045_03', 3) # 14-16 Unknown8006(100, 1, 1) sprite('Action_045_04', 3) # 17-19 sprite('Action_045_05', 3) # 20-22 sprite('Action_045_06', 3) # 23-25 Unknown8006(100, 1, 1) sprite('Action_045_07', 3) # 26-28 sprite('Action_045_08', 3) # 29-31 sprite('Action_045_09', 3) # 32-34 sprite('Action_045_02', 3) # 35-37 loopRest() gotoLabel(0) label(1) sprite('Action_055_00', 2) # 38-39 clearUponHandler(3) Unknown1019(10) Unknown8010(100, 1, 1) sprite('Action_055_01', 1) # 40-40 sprite('Action_055_02', 3) # 41-43 **attackbox here** SFX_0('003_swing_grap_0_0') Unknown1084(1) sprite('Action_055_02', 3) # 44-46 **attackbox here** StartMultihit() sprite('Action_055_03', 2) # 47-48 sprite('Action_055_04', 7) # 49-55 SFX_4('uli154') sprite('Action_055_05', 5) # 56-60 sprite('Action_055_06', 3) # 61-63 sprite('Action_055_07', 3) # 64-66 @State def BackThrowExe(): def upon_IMMEDIATE(): Unknown17012(1, 0, 0) AttackLevel_(1) Damage(200) AttackP2(50) Unknown11092(1) Unknown11073(1) AirHitstunAnimation(11) GroundedHitstunAnimation(11) AirPushbackX(2000) AirPushbackY(12000) YImpluseBeforeWallbounce(1800) AirUntechableTime(40) Unknown9310(90) JumpCancel_(0) Unknown13024(0) Unknown11064(1) Unknown11069('BackThrowExe') sprite('Action_055_02', 4) # 1-4 **attackbox here** Unknown5000(8, 0) Unknown5001('0000000004000000040000000000000000000000') StartMultihit() Unknown5003(1) sprite('Action_057_00', 1) # 5-5 SFX_0('003_swing_grap_0_1') Unknown2005() sprite('Action_057_00', 1) # 6-6 Unknown5000(8, 0) Unknown5001('0000000004000000040000000000000000000000') sprite('Action_057_01', 8) # 7-14 **attackbox here** tag_voice(1, 'uli153_0', '', '', '') sprite('Action_057_02', 4) # 15-18 DisableAttackRestOfMove() sprite('Action_057_03', 2) # 19-20 sprite('Action_057_04', 2) # 21-22 sprite('Action_057_05', 3) # 23-25 sprite('Action_057_06', 4) # 26-29 physicsYImpulse(11000) setGravity(2200) teleportRelativeX(10000) sprite('Action_057_07', 3) # 30-32 teleportRelativeX(10000) sprite('Action_057_08', 3) # 33-35 teleportRelativeX(10000) sprite('Action_057_09', 1) # 36-36 **attackbox here** teleportRelativeX(20000) sprite('Action_057_10', 5) # 37-41 sprite('Action_057_11', 3) # 42-44 tag_voice(1, 'uli153_1', '', '', '') Unknown1084(1) sprite('Action_057_12', 1) # 45-45 **attackbox here** AttackLevel_(4) Damage(1800) YImpluseBeforeWallbounce(50000) Unknown11073(1) AirHitstunAnimation(11) GroundedHitstunAnimation(11) AirPushbackX(500) AirPushbackY(-40000) Unknown9310(40) Unknown9016(1) RefreshMultihit() Unknown11064(0) Unknown11069('') Unknown11083(1) clearUponHandler(78) def upon_78(): Unknown13024(1) JumpCancel_(1) sprite('Action_057_13', 6) # 46-51 sprite('Action_057_14', 3) # 52-54 sprite('Action_057_15', 2) # 55-56 sprite('Action_057_16', 5) # 57-61 physicsXImpulse(-10000) physicsYImpulse(12000) setGravity(2500) label(0) sprite('Action_057_17', 5) # 62-66 sendToLabelUpon(2, 1) loopRest() gotoLabel(0) label(1) sprite('Action_057_18', 2) # 67-68 Unknown1084(1) clearUponHandler(2) sprite('Action_057_19', 2) # 69-70 sprite('Action_057_20', 2) # 71-72 sprite('Action_057_21', 2) # 73-74 @State def CmnActInvincibleAttack(): def upon_IMMEDIATE(): Unknown17024('') AttackLevel_(3) Damage(500) Unknown11092(1) AirHitstunAnimation(9) GroundedHitstunAnimation(9) AirPushbackY(15000) AirPushbackX(6000) Unknown9016(1) AirUntechableTime(60) Unknown1084(0) sendToLabelUpon(2, 1) def upon_12(): Unknown2037(1) sprite('Action_100_00', 6) # 1-6 sprite('Action_100_01', 3) # 7-9 **attackbox here** StartMultihit() sprite('Action_100_01', 3) # 10-12 **attackbox here** Hitstop(3) physicsXImpulse(11000) sprite('Action_101_02', 2) # 13-14 **attackbox here** DisableAttackRestOfMove() sprite('Action_101_03', 1) # 15-15 **attackbox here** RefreshMultihit() SFX_0('010_swing_sword_0') AirPushbackY(35000) physicsYImpulse(23000) physicsXImpulse(4000) setGravity(1800) if SLOT_2: SFX_4('uli201') else: tag_voice(1, 'uli200_0', 'uli200_1', '', '') Unknown2037(0) clearUponHandler(12) sprite('Action_101_04', 2) # 16-17 **attackbox here** GFX_0('EffNmlReversalAction00', 100) sprite('Action_101_05', 2) # 18-19 **attackbox here** RefreshMultihit() sprite('Action_101_06', 1) # 20-20 **attackbox here** sprite('Action_101_07', 1) # 21-21 setInvincible(0) sprite('Action_101_08', 1) # 22-22 sprite('Action_101_09', 1) # 23-23 sprite('Action_101_10', 3) # 24-26 sprite('Action_101_11', 2) # 27-28 sprite('Action_101_12', 1) # 29-29 physicsYImpulse(32000) physicsXImpulse(7000) setGravity(2600) sprite('Action_101_13', 1) # 30-30 sprite('Action_101_14', 2) # 31-32 **attackbox here** RefreshMultihit() SFX_0('010_swing_sword_1') Hitstop(1) GFX_0('EffNmlReversalAction01', 100) sprite('Action_101_14', 1) # 33-33 **attackbox here** if SLOT_2: SFX_4('uli202') RefreshMultihit() sprite('Action_101_15', 3) # 34-36 **attackbox here** RefreshMultihit() Hitstop(10) AirPushbackX(12500) sprite('Action_101_16', 1) # 37-37 sprite('Action_101_17', 1) # 38-38 sprite('Action_101_18', 2) # 39-40 sprite('Action_101_19', 1) # 41-41 sprite('Action_101_20', 3) # 42-44 sprite('Action_101_21', 2) # 45-46 sprite('Action_101_22', 1) # 47-47 physicsYImpulse(38000) physicsXImpulse(8000) setGravity(2600) sprite('Action_101_23', 1) # 48-48 sprite('Action_101_24', 1) # 49-49 **attackbox here** Hitstop(1) RefreshMultihit() GFX_0('EffNmlReversalAction01', 100) SFX_0('010_swing_sword_1') sprite('Action_101_24', 1) # 50-50 **attackbox here** RefreshMultihit() sprite('Action_101_25', 7) # 51-57 **attackbox here** if SLOT_2: SFX_4('uli203') Hitstop(15) RefreshMultihit() AirPushbackY(32000) AirPushbackX(9500) sprite('Action_101_26', 6) # 58-63 sprite('Action_101_27', 3) # 64-66 sprite('Action_101_28', 4) # 67-70 sprite('Action_101_29', 4) # 71-74 sprite('Action_101_30', 7) # 75-81 sprite('Action_101_31', 3) # 82-84 label(0) sprite('Action_101_32', 2) # 85-86 sprite('Action_101_33', 2) # 87-88 gotoLabel(0) label(1) sprite('Action_101_33', 4) # 89-92 Unknown8000(100, 1, 1) Unknown1084(1) clearUponHandler(2) sprite('Action_101_34', 4) # 93-96 sprite('Action_101_35', 6) # 97-102 sprite('Action_101_36', 6) # 103-108 @State def CmnActInvincibleAttackAir(): def upon_IMMEDIATE(): Unknown17025('') AttackLevel_(3) Damage(550) Unknown11092(1) AirHitstunAnimation(9) GroundedHitstunAnimation(9) AirPushbackY(35000) AirPushbackX(6000) Unknown9016(1) AirUntechableTime(39) Unknown1084(0) clearUponHandler(2) sendToLabelUpon(2, 1) sprite('Action_101_03', 9) # 1-9 **attackbox here** StartMultihit() Hitstop(3) physicsYImpulse(26500) physicsXImpulse(4000) setGravity(1650) sprite('Action_101_03', 2) # 10-11 **attackbox here** RefreshMultihit() SFX_0('010_swing_sword_0') sprite('Action_101_04', 2) # 12-13 **attackbox here** tag_voice(1, 'uli200_0', 'uli200_1', '', '') GFX_0('EffNmlReversalAction00', 100) sprite('Action_101_05', 2) # 14-15 **attackbox here** RefreshMultihit() Hitstop(3) sprite('Action_101_06', 1) # 16-16 **attackbox here** sprite('Action_101_07', 1) # 17-17 setInvincible(0) sprite('Action_101_08', 1) # 18-18 sprite('Action_101_09', 1) # 19-19 sprite('Action_101_10', 3) # 20-22 sprite('Action_101_11', 2) # 23-24 sprite('Action_101_12', 1) # 25-25 physicsYImpulse(27000) physicsXImpulse(7000) setGravity(2600) sprite('Action_101_13', 1) # 26-26 sprite('Action_101_14', 2) # 27-28 **attackbox here** RefreshMultihit() Hitstop(1) GFX_0('EffNmlReversalAction01', 100) SFX_0('010_swing_sword_1') sprite('Action_101_14', 1) # 29-29 **attackbox here** RefreshMultihit() sprite('Action_101_15', 3) # 30-32 **attackbox here** RefreshMultihit() Hitstop(10) AirPushbackX(12500) sprite('Action_101_16', 1) # 33-33 sprite('Action_101_17', 1) # 34-34 sprite('Action_101_18', 2) # 35-36 sprite('Action_101_19', 1) # 37-37 sprite('Action_101_20', 3) # 38-40 sprite('Action_101_21', 2) # 41-42 sprite('Action_101_22', 1) # 43-43 physicsYImpulse(33500) physicsXImpulse(10000) setGravity(2600) sprite('Action_101_23', 1) # 44-44 sprite('Action_101_24', 1) # 45-45 **attackbox here** Hitstop(1) RefreshMultihit() GFX_0('EffNmlReversalAction01', 100) SFX_0('010_swing_sword_1') sprite('Action_101_24', 1) # 46-46 **attackbox here** RefreshMultihit() sprite('Action_101_25', 7) # 47-53 **attackbox here** Hitstop(15) RefreshMultihit() AirPushbackY(32000) AirPushbackX(10000) sprite('Action_101_26', 6) # 54-59 sprite('Action_101_27', 3) # 60-62 sprite('Action_101_28', 4) # 63-66 sprite('Action_101_29', 4) # 67-70 sprite('Action_101_30', 7) # 71-77 sprite('Action_101_31', 3) # 78-80 label(0) sprite('Action_101_32', 2) # 81-82 sprite('Action_101_33', 2) # 83-84 gotoLabel(0) label(1) sprite('Action_101_33', 2) # 85-86 Unknown8000(100, 1, 1) Unknown1084(1) clearUponHandler(2) sprite('Action_101_34', 2) # 87-88 sprite('Action_101_35', 3) # 89-91 sprite('Action_101_36', 3) # 92-94 @State def Shot_A(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() DisableAttackRestOfMove() sprite('Action_440_00', 6) # 1-6 sprite('Action_440_01', 4) # 7-10 sprite('Action_440_02', 4) # 11-14 Unknown14070('ShotDashCancel') sprite('Action_440_03', 6) # 15-20 SFX_0('010_swing_sword_2') sprite('Action_440_04', 2) # 21-22 GFX_0('ShotA', 0) GFX_0('EffShotSlash', 100) tag_voice(1, 'uli204_0', 'uli204_1', 'uli204_2', '') sprite('Action_440_05', 6) # 23-28 Unknown14072('ShotDashCancel') sprite('Action_440_06', 7) # 29-35 sprite('Action_440_07', 5) # 36-40 sprite('Action_440_08', 5) # 41-45 Unknown14074('ShotDashCancel') Recovery() sprite('Action_440_09', 4) # 46-49 @State def Shot_B(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() DisableAttackRestOfMove() sprite('Action_441_00', 2) # 1-2 sprite('Action_441_01', 2) # 3-4 sprite('Action_441_02', 3) # 5-7 sprite('Action_441_03', 4) # 8-11 SFX_0('010_swing_sword_2') sprite('Action_441_04', 2) # 12-13 Unknown14070('ShotDashCancel') GFX_0('ShotB', 0) GFX_0('EffShotSlash', 100) tag_voice(1, 'uli204_0', 'uli204_1', 'uli204_2', '') sprite('Action_441_05', 6) # 14-19 sprite('Action_441_06', 14) # 20-33 Unknown14072('ShotDashCancel') sprite('Action_441_07', 5) # 34-38 sprite('Action_441_08', 5) # 39-43 Unknown14074('ShotDashCancel') Recovery() sprite('Action_441_09', 4) # 44-47 @State def ShotDashCancel(): def upon_IMMEDIATE(): Unknown17013() WhiffCancel('Assault_A') WhiffCancelEnable(1) sprite('Action_045_00', 3) # 1-3 sprite('Action_045_01', 3) # 4-6 physicsXImpulse(36000) sprite('Action_045_02', 3) # 7-9 sprite('Action_045_03', 3) # 10-12 Unknown8006(100, 1, 1) sprite('Action_045_04', 3) # 13-15 sprite('Action_045_05', 3) # 16-18 Unknown8006(100, 1, 1) sprite('Action_045_11', 2) # 19-20 Unknown1019(30) sprite('Action_045_12', 3) # 21-23 Unknown1019(10) sprite('Action_045_13', 2) # 24-25 physicsXImpulse(0) loopRest() @State def Assault_A(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() def upon_CLEAR_OR_EXIT(): if (SLOT_163 <= 0): Unknown2037(1) clearUponHandler(3) WhiffCancel('Assault_A_Hasei') sprite('Action_045_00', 2) # 1-2 sprite('Action_045_01', 2) # 3-4 Unknown8006(100, 1, 1) physicsXImpulse(36000) sprite('Action_150_00', 5) # 5-9 SFX_0('019_cloth_a') Unknown18009(1) EnableCollision(0) setInvincible(1) Unknown22019('0100000001000000000000000100000000000000') Unknown7006('uli112_0', 100, 828992629, 828322353, 0, 0, 100, 828992629, 845099569, 0, 0, 100, 0, 0, 0, 0, 0) sprite('Action_150_01', 2) # 10-11 sprite('Action_150_01', 2) # 12-13 WhiffCancelEnable(1) sprite('Action_150_02', 4) # 14-17 EnableCollision(1) setInvincible(0) sprite('Action_150_03', 2) # 18-19 Unknown1019(50) sprite('Action_150_05', 3) # 20-22 Unknown23183('416374696f6e5f3135305f303700000000000000000000000000000000000000030000000200000002000000') if SLOT_2: Unknown2005() Unknown1019(50) Unknown14072('Assault_A_Hasei') sprite('Action_150_06', 3) # 23-25 Unknown23183('416374696f6e5f3135305f303800000000000000000000000000000000000000030000000200000002000000') Unknown1019(0) WhiffCancelEnable(0) sprite('Action_014_01', 2) # 26-27 Unknown18009(0) sprite('Action_014_02', 2) # 28-29 @State def Assault_A_Hasei(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() AttackLevel_(3) Damage(1000) AttackP1(80) AttackP2(80) Unknown11092(1) GroundedHitstunAnimation(10) AirHitstunAnimation(10) AirPushbackX(18000) AirPushbackY(43000) AirUntechableTime(60) Unknown9016(1) Unknown2006() Unknown11064(1) Unknown11068(1) Unknown30068(1) Unknown11056(0) def upon_78(): clearUponHandler(78) sendToLabel(10) Hitstop(8) Unknown11069('Assault_A_Hasei') setInvincible(1) Unknown11044(1) Unknown14083(0) EnableCollision(0) def upon_STATE_END(): EnableCollision(1) Unknown3001(255) Unknown3004(0) sprite('Action_014_00', 5) # 1-5 Unknown1084(1) sprite('Action_014_01', 3) # 6-8 Unknown7009(2) sprite('Action_154_02', 3) # 9-11 **attackbox here** GFX_0('Lin_157', 0) SFX_0('007_swing_knife_1') sprite('Action_154_03', 9) # 12-20 Recovery() sprite('Action_154_04', 7) # 21-27 sprite('Action_154_05', 5) # 28-32 sprite('Action_154_06', 4) # 33-36 ExitState() label(10) sprite('Action_154_02', 2) # 37-38 **attackbox here** Unknown11023(1) Unknown30048(1) Unknown11066(1) setInvincible(1) AirHitstunAnimation(10) GroundedHitstunAnimation(10) Hitstop(2) SFX_0('007_swing_knife_1') Unknown11072(1, 70000, 50000) sprite('null', 2) # 39-40 GFX_0('Lin_168_2', 0) sprite('Action_160_07', 3) # 41-43 GFX_0('Lin_160_4', 0) teleportRelativeX(450000) Unknown1007(330000) Unknown2005() Unknown3001(128) Unknown3004(20) sprite('Action_160_08', 2) # 44-45 sprite('Action_160_09', 4) # 46-49 **attackbox here** GFX_0('Lin_168_3', 0) RefreshMultihit() AirHitstunAnimation(11) GroundedHitstunAnimation(11) AirPushbackY(-8000) GFX_0('Lin_091', 0) SFX_0('007_swing_knife_1') sprite('null', 1) # 50-50 teleportRelativeX(600000) teleportRelativeY(0) Unknown2005() sprite('Action_160_12', 2) # 51-52 GFX_0('Lin_160_5', 0) Unknown3001(128) Unknown3004(20) Unknown8000(100, 1, 1) sprite('Action_160_13', 2) # 53-54 sprite('Action_160_14', 2) # 55-56 sprite('Action_160_15', 3) # 57-59 **attackbox here** StartMultihit() sprite('Action_160_15', 4) # 60-63 **attackbox here** AttackLevel_(5) Damage(1000) RefreshMultihit() AirHitstunAnimation(9) GroundedHitstunAnimation(9) AirPushbackX(5000) AirPushbackY(30000) Hitstop(1) Unknown11001(0, 15, 15) Unknown11099(1) Unknown11072(1, 150000, 50000) physicsXImpulse(80000) Unknown8007(100, 1, 1) GFX_0('Lin_169', 0) SFX_0('007_swing_knife_2') SFX_4('uli303') Unknown11069('') Unknown11044(0) Unknown23072() Unknown11064(0) clearUponHandler(1) def upon_STATE_END(): Unknown2006() EnableCollision(1) Unknown3001(255) Unknown3004(0) sprite('Action_160_16', 5) # 64-68 Unknown3001(128) Unknown3004(20) Unknown1019(50) Unknown14083(1) Unknown8010(100, 1, 1) sprite('Action_160_16', 13) # 69-81 Unknown1019(20) sprite('Action_160_17', 6) # 82-87 setInvincible(0) EnableCollision(1) Unknown1084(1) sprite('Action_160_18', 5) # 88-92 sprite('Action_160_19', 5) # 93-97 sprite('Action_160_20', 4) # 98-101 @State def Assault_B(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() AttackLevel_(4) Damage(1000) AttackP1(80) Unknown11092(1) AirPushbackY(18000) AirUntechableTime(60) GroundedHitstunAnimation(10) AirHitstunAnimation(10) Hitstop(1) Unknown9016(1) HitOverhead(2) def upon_STATE_END(): Unknown3001(255) sprite('Action_182_00', 3) # 1-3 sprite('Action_182_01', 2) # 4-5 Unknown23087(50000) physicsXImpulse(24000) physicsYImpulse(16000) setGravity(2000) Unknown8001(0, 100) tag_voice(1, 'uli212_0', 'uli212_1', 'uli212_2', '') SFX_0('002_highjump_0') sprite('Action_182_02', 2) # 6-7 sendToLabelUpon(2, 1) sprite('Action_182_03', 2) # 8-9 sprite('Action_182_04', 2) # 10-11 sprite('Action_182_05', 2) # 12-13 sprite('Action_182_06', 2) # 14-15 if CheckInput(0xa): sendToLabel(10) sprite('Action_182_07', 2) # 16-17 sprite('Action_182_08', 3) # 18-20 sprite('Action_182_09', 32767) # 21-32787 label(1) sprite('Action_182_10', 1) # 32788-32788 **attackbox here** StartMultihit() GFX_0('EffAssaultSlash', 100) SFX_0('010_swing_sword_2') Unknown1084(1) Unknown8000(100, 1, 1) Unknown23087(-1) sprite('Action_182_10', 1) # 32789-32789 **attackbox here** sprite('Action_182_10', 1) # 32790-32790 **attackbox here** RefreshMultihit() Hitstop(12) PushbackX(12000) sprite('Action_182_11', 2) # 32791-32792 Recovery() sprite('Action_182_12', 4) # 32793-32796 sprite('Action_182_13', 8) # 32797-32804 sprite('Action_182_14', 4) # 32805-32808 sprite('Action_182_15', 3) # 32809-32811 ExitState() label(10) sprite('null', 1) # 32812-32812 AttackLevel_(3) Damage(1700) AttackP1(90) AttackP2(85) Unknown9016(0) AirPushbackY(5000) AirUntechableTime(26) Hitstop(12) Unknown11001(0, -5, 0) Unknown9310(1) AirHitstunAnimation(11) GroundedHitstunAnimation(11) HitLow(2) HitOverhead(0) GFX_0('Lin_177', 100) sprite('Lin104_00', 2) # 32813-32814 Unknown3001(0) Unknown3004(85) clearUponHandler(2) teleportRelativeY(0) sprite('Lin104_01', 2) # 32815-32816 GFX_0('Lin_167', 100) sprite('Lin104_02', 1) # 32817-32817 physicsXImpulse(28000) Unknown8006(100, 1, 1) sprite('Lin104_03', 4) # 32818-32821 **attackbox here** Unknown1019(30) sprite('Lin104_04', 2) # 32822-32823 DisableAttackRestOfMove() Recovery() sprite('Lin104_04', 6) # 32824-32829 Unknown1019(10) Unknown18009(1) sprite('Lin104_05', 5) # 32830-32834 Unknown1019(0) sprite('Action_013_00', 5) # 32835-32839 sprite('Action_013_01', 5) # 32840-32844 @State def AirShot_A(): def upon_IMMEDIATE(): Unknown17003() Unknown1084(1) clearUponHandler(2) sendToLabelUpon(2, 1) sprite('Action_448_00', 2) # 1-2 physicsXImpulse(3000) physicsYImpulse(16000) setGravity(1400) sprite('Action_448_01', 3) # 3-5 sprite('Action_448_02', 3) # 6-8 sprite('Action_448_03', 3) # 9-11 sprite('Action_448_04', 5) # 12-16 sprite('Action_448_05', 4) # 17-20 SFX_0('010_swing_sword_2') sprite('Action_448_06', 3) # 21-23 GFX_0('EffAirShotSlash', 100) GFX_0('AirShotA', 0) tag_voice(1, 'uli204_0', 'uli204_1', 'uli204_2', '') Unknown28(2, 'CmnActJumpLanding') sprite('Action_448_07', 10) # 24-33 sprite('Action_448_08', 6) # 34-39 sprite('Action_448_09', 4) # 40-43 Recovery() label(0) sprite('Action_448_09', 4) # 44-47 loopRest() gotoLabel(0) label(1) sprite('Action_023_00', 3) # 48-50 Unknown1084(1) clearUponHandler(2) sprite('Action_023_01', 3) # 51-53 sprite('Action_023_02', 3) # 54-56 sprite('Action_023_03', 4) # 57-60 @State def AirShot_B(): def upon_IMMEDIATE(): Unknown17003() Unknown1084(1) clearUponHandler(2) sendToLabelUpon(2, 1) sprite('Action_448_00', 2) # 1-2 physicsXImpulse(3000) physicsYImpulse(20000) setGravity(1400) sprite('Action_448_01', 3) # 3-5 sprite('Action_448_02', 3) # 6-8 sprite('Action_448_03', 3) # 9-11 sprite('Action_448_04', 10) # 12-21 sprite('Action_448_05', 4) # 22-25 SFX_0('010_swing_sword_2') sprite('Action_448_06', 3) # 26-28 GFX_0('EffAirShotSlash', 100) GFX_0('AirShotB', 0) tag_voice(1, 'uli204_0', 'uli204_1', 'uli204_2', '') Unknown28(2, 'CmnActJumpLanding') sprite('Action_448_07', 10) # 29-38 sprite('Action_448_08', 6) # 39-44 sprite('Action_448_09', 4) # 45-48 Recovery() label(0) sprite('Action_448_09', 4) # 49-52 loopRest() gotoLabel(0) label(1) sprite('Action_023_00', 3) # 53-55 Unknown1084(1) clearUponHandler(2) sprite('Action_023_01', 3) # 56-58 sprite('Action_023_02', 3) # 59-61 sprite('Action_023_03', 4) # 62-65 @State def Shot_EX(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() DisableAttackRestOfMove() sprite('Action_441_00', 2) # 1-2 sprite('Action_441_01', 1) # 3-3 sprite('Action_441_01', 1) # 4-4 Unknown23125('') ConsumeSuperMeter(-5000) tag_voice(1, 'uli205_0', 'uli205_1', 'uli205_2', '') sprite('Action_441_02', 3) # 5-7 sprite('Action_441_03', 4) # 8-11 Unknown14070('ShotDashCancel') SFX_0('010_swing_sword_2') sprite('Action_442_04', 2) # 12-13 GFX_0('EffShotSlash', 100) GFX_0('ShotEX', 0) sprite('Action_442_05', 6) # 14-19 Unknown14072('ShotDashCancel') sprite('Action_442_06', 14) # 20-33 sprite('Action_442_07', 5) # 34-38 sprite('Action_442_08', 5) # 39-43 Unknown14074('ShotDashCancel') Recovery() sprite('Action_442_09', 4) # 44-47 @State def Rush_EX(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() AttackLevel_(3) Damage(500) Unknown30065(0) AirUntechableTime(45) AirHitstunAnimation(10) GroundedHitstunAnimation(10) PushbackX(0) AirPushbackX(-5000) AirPushbackY(20000) Unknown9016(1) Unknown11001(0, 6, 6) Hitstop(6) sprite('Action_251_00', 1) # 1-1 sprite('Action_251_01', 2) # 2-3 physicsXImpulse(80000) Unknown8006(100, 1, 0) tag_voice(1, 'uli209_0', 'uli209_1', 'uli209_2', '') sprite('Action_251_02', 2) # 4-5 Unknown23125('') ConsumeSuperMeter(-5000) sprite('Action_251_03', 2) # 6-7 sprite('Action_251_04', 4) # 8-11 **attackbox here** GFX_0('EffEXRushSlash00', 100) GroundedHitstunAnimation(9) AirPushbackX(10000) AirPushbackY(12000) physicsXImpulse(0) sprite('Action_251_05', 4) # 12-15 sprite('Action_251_06', 4) # 16-19 sprite('Action_251_07', 3) # 20-22 sprite('Action_251_08', 1) # 23-23 GFX_0('EffEXRushSlash01', 100) sprite('Action_251_09', 3) # 24-26 **attackbox here** Hitstop(5) GroundedHitstunAnimation(11) AirPushbackX(1000) AirPushbackY(10000) RefreshMultihit() sprite('Action_251_10', 7) # 27-33 sprite('Action_251_11', 1) # 34-34 GFX_0('EffEXRushSlash02', 100) sprite('Action_251_12', 2) # 35-36 **attackbox here** Hitstop(4) GroundedHitstunAnimation(9) AirPushbackX(1000) RefreshMultihit() sprite('Action_251_13', 2) # 37-38 sprite('Action_251_14', 4) # 39-42 sprite('Action_251_15', 2) # 43-44 GFX_0('EffEXRushSlash03', 100) tag_voice(0, 'uli210_0', 'uli210_1', 'uli210_2', '') sprite('Action_251_16', 2) # 45-46 **attackbox here** Hitstop(3) GroundedHitstunAnimation(11) AirPushbackX(1000) RefreshMultihit() sprite('Action_251_17', 3) # 47-49 sprite('Action_251_18', 3) # 50-52 sprite('Action_251_19', 1) # 53-53 GFX_0('EffEXRushSlash04', 100) sprite('Action_251_20', 2) # 54-55 **attackbox here** GroundedHitstunAnimation(9) AirPushbackX(1000) RefreshMultihit() sprite('Action_251_21', 1) # 56-56 sprite('Action_251_22', 2) # 57-58 sprite('Action_251_23', 1) # 59-59 GFX_0('EffEXRushSlash03', 100) sprite('Action_251_24', 3) # 60-62 **attackbox here** GroundedHitstunAnimation(11) AirPushbackX(1000) AirPushbackY(8000) Hitstop(3) RefreshMultihit() sprite('Action_251_25', 2) # 63-64 sprite('Action_251_26', 2) # 65-66 sprite('Action_251_27', 5) # 67-71 **attackbox here** GFX_0('EffEXRushSlash04', 100) Hitstop(12) GroundedHitstunAnimation(9) AirPushbackX(1000) AirPushbackY(8000) PushbackX(30000) RefreshMultihit() sprite('Action_251_28', 3) # 72-74 sprite('Action_251_29', 2) # 75-76 sprite('Action_251_30', 2) # 77-78 sprite('Action_251_31', 1) # 79-79 sprite('Action_251_32', 1) # 80-80 sprite('Action_251_33', 3) # 81-83 tag_voice(0, 'uli211_0', 'uli211_1', 'uli211_2', '') sprite('Action_251_34', 1) # 84-84 **attackbox here** GFX_0('EffEXRushSlash05', 100) Damage(1000) GroundedHitstunAnimation(18) AirPushbackX(52000) AirPushbackY(23000) Unknown9178(1) Hitstop(9) PushbackX(35000) RefreshMultihit() sprite('Action_251_35', 6) # 85-90 sprite('Action_251_36', 5) # 91-95 sprite('Action_251_37', 5) # 96-100 sprite('Action_251_38', 3) # 101-103 @State def Assault_EX(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() AttackLevel_(4) Damage(1000) AttackP1(80) Unknown11092(1) AirPushbackY(18000) AirUntechableTime(60) GroundedHitstunAnimation(10) AirHitstunAnimation(10) Hitstop(1) Unknown9016(1) HitOverhead(2) Unknown30065(0) MinimumDamagePct(10) sendToLabelUpon(2, 1) sprite('Action_184_00', 3) # 1-3 sprite('Action_184_01', 2) # 4-5 Unknown23087(50000) physicsXImpulse(36000) physicsYImpulse(16000) setGravity(2300) Unknown8001(0, 100) tag_voice(1, 'uli213_0', 'uli213_1', 'uli213_2', '') SFX_0('002_highjump_0') Unknown23125('') ConsumeSuperMeter(-5000) sprite('Action_184_02', 2) # 6-7 sprite('Action_184_03', 2) # 8-9 sprite('Action_184_04', 2) # 10-11 sprite('Action_184_05', 2) # 12-13 sprite('Action_184_06', 2) # 14-15 sprite('Action_184_07', 2) # 16-17 sprite('Action_184_08', 2) # 18-19 sprite('Action_184_09', 32767) # 20-32786 label(1) sprite('Action_184_10', 1) # 32787-32787 **attackbox here** StartMultihit() GFX_0('EffEXAssaultSlash', 100) SFX_0('010_swing_sword_2') Unknown1084(1) Unknown8000(100, 1, 1) Unknown23087(-1) sprite('Action_184_10', 1) # 32788-32788 **attackbox here** RefreshMultihit() sprite('Action_184_10', 1) # 32789-32789 **attackbox here** RefreshMultihit() sprite('Action_184_11', 2) # 32790-32791 **attackbox here** RefreshMultihit() sprite('Action_184_11', 2) # 32792-32793 **attackbox here** RefreshMultihit() Hitstop(12) PushbackX(12000) sprite('Action_184_12', 4) # 32794-32797 Recovery() Unknown2063() sprite('Action_184_13', 8) # 32798-32805 sprite('Action_184_14', 4) # 32806-32809 sprite('Action_184_15', 3) # 32810-32812 @State def AirShot_EX(): def upon_IMMEDIATE(): Unknown17003() Unknown1084(1) clearUponHandler(2) clearUponHandler(2) sendToLabelUpon(2, 1) sprite('Action_450_00', 2) # 1-2 physicsXImpulse(3000) physicsYImpulse(16000) setGravity(1400) sprite('Action_450_01', 1) # 3-3 sprite('Action_450_01', 2) # 4-5 Unknown23125('') ConsumeSuperMeter(-5000) sprite('Action_450_02', 3) # 6-8 sprite('Action_450_03', 3) # 9-11 sprite('Action_450_04', 5) # 12-16 sprite('Action_450_05', 4) # 17-20 SFX_0('010_swing_sword_2') sprite('Action_450_06', 3) # 21-23 GFX_0('EffAirShotSlash', 100) GFX_0('AirShotEX', 0) tag_voice(1, 'uli205_0', 'uli205_1', 'uli205_2', '') Unknown28(2, 'CmnActJumpLanding') sprite('Action_450_07', 10) # 24-33 sprite('Action_448_08', 6) # 34-39 sprite('Action_448_09', 4) # 40-43 Recovery() label(0) sprite('Action_448_09', 4) # 44-47 loopRest() gotoLabel(0) label(1) sprite('Action_023_00', 3) # 48-50 Unknown1084(1) clearUponHandler(2) sprite('Action_023_01', 3) # 51-53 sprite('Action_023_02', 3) # 54-56 sprite('Action_023_03', 4) # 57-60 @State def UltimateRush(): def upon_IMMEDIATE(): AttackDefaults_StandingDD() Unknown23055('') AttackLevel_(4) Damage(360) MinimumDamagePct(18) AttackP2(98) GroundedHitstunAnimation(10) AirHitstunAnimation(10) AirPushbackX(6000) AirPushbackY(3000) Unknown30056('a08601003200000000000000') YImpluseBeforeWallbounce(700) AirUntechableTime(100) Unknown9310(1) Hitstop(0) Unknown11001(5, 5, 5) Unknown11056(2) Unknown9016(1) Unknown11057(800) Unknown11064(1) Unknown1084(1) GFX_0('UltimateRushEff', 100) def upon_78(): Unknown2037(1) setInvincible(0) setInvincibleFor(60) sprite('Action_189_00', 5) # 1-5 Unknown2036(60, -1, 0) ConsumeSuperMeter(-10000) setInvincible(1) Unknown30080('') tag_voice(1, 'uli250_0', 'uli250_1', '', '') sprite('Action_189_01', 8) # 6-13 SFX_3('SE_ApperLightBlade') sprite('Action_189_02', 7) # 14-20 sprite('Action_189_03', 6) # 21-26 sprite('Action_189_04', 5) # 27-31 sprite('Action_189_05', 4) # 32-35 sprite('Action_189_06', 4) # 36-39 sprite('Action_189_07', 4) # 40-43 sprite('Action_189_08', 3) # 44-46 sprite('Action_189_09', 3) # 47-49 Unknown2015(200) sprite('Action_190_00', 5) # 50-54 sprite('Action_190_01', 5) # 55-59 teleportRelativeX(20000) sprite('Action_190_02', 4) # 60-63 sprite('Action_190_03', 4) # 64-67 physicsXImpulse(5000) Unknown1028(-50) sprite('Action_190_04', 4) # 68-71 SFX_3('SE_SwingLightSword') SFX_0('010_swing_sword_2') sprite('Action_190_05', 4) # 72-75 **attackbox here** RefreshMultihit() sprite('Action_190_06', 3) # 76-78 **attackbox here** sprite('Action_190_07', 3) # 79-81 **attackbox here** RefreshMultihit() sprite('Action_190_08', 4) # 82-85 **attackbox here** sprite('Action_190_09', 2) # 86-87 if (not SLOT_2): setInvincible(0) sprite('Action_190_10', 2) # 88-89 sprite('Action_190_11', 2) # 90-91 sprite('Action_190_12', 2) # 92-93 SFX_3('SE_SwingLightSword') SFX_0('010_swing_sword_2') sprite('Action_190_13', 2) # 94-95 **attackbox here** RefreshMultihit() sprite('Action_190_14', 2) # 96-97 **attackbox here** sprite('Action_190_15', 2) # 98-99 **attackbox here** RefreshMultihit() sprite('Action_190_16', 2) # 100-101 **attackbox here** sprite('Action_190_10', 2) # 102-103 sprite('Action_190_11', 2) # 104-105 sprite('Action_190_12', 2) # 106-107 SFX_3('SE_SwingLightSword') SFX_0('010_swing_sword_2') sprite('Action_190_13', 2) # 108-109 **attackbox here** RefreshMultihit() sprite('Action_190_14', 2) # 110-111 **attackbox here** sprite('Action_190_15', 2) # 112-113 **attackbox here** RefreshMultihit() sprite('Action_190_16', 2) # 114-115 **attackbox here** sprite('Action_190_17', 2) # 116-117 Unknown1084(1) sprite('Action_190_18', 2) # 118-119 teleportRelativeX(20000) sprite('Action_190_19', 2) # 120-121 teleportRelativeX(20000) sprite('Action_190_20', 2) # 122-123 SFX_3('SE_SwingLightSword') SFX_0('010_swing_sword_2') teleportRelativeX(20000) sprite('Action_190_21', 3) # 124-126 **attackbox here** teleportRelativeX(20000) RefreshMultihit() sprite('Action_190_22', 4) # 127-130 **attackbox here** Unknown1084(1) teleportRelativeX(20000) sprite('Action_190_23', 6) # 131-136 **attackbox here** teleportRelativeX(20000) RefreshMultihit() AirPushbackX(5000) AirPushbackY(28000) YImpluseBeforeWallbounce(900) sprite('Action_190_24', 6) # 137-142 **attackbox here** teleportRelativeX(20000) sprite('Action_190_25', 7) # 143-149 physicsXImpulse(0) sprite('Action_190_26', 10) # 150-159 tag_voice(0, 'uli251_0', 'uli251_1', '', '') sprite('Action_190_27', 2) # 160-161 Unknown11057(1000) GFX_0('UltimateSlash', 100) Unknown2015(-1) SFX_3('SE_BigBomb') sprite('Action_190_28', 4) # 162-165 **attackbox here** Unknown11001(0, 0, 0) AirPushbackX(25000) AirPushbackY(-45000) Unknown30055('305705003200000000000000') Hitstop(0) RefreshMultihit() sprite('Action_190_29', 28) # 166-193 GFX_0('UltimateLightwall', 0) setInvincible(0) setInvincibleFor(0) clearUponHandler(78) sprite('Action_190_30', 2) # 194-195 sprite('Action_190_31', 6) # 196-201 sprite('Action_190_32', 3) # 202-204 sprite('Action_190_33', 5) # 205-209 sprite('Action_190_34', 3) # 210-212 sprite('Action_190_35', 6) # 213-218 sprite('Action_190_36', 3) # 219-221 sprite('Action_190_37', 4) # 222-225 **attackbox here** SFX_3('SE_SwingLightSword') GroundedHitstunAnimation(10) AirHitstunAnimation(10) GFX_0('UltimateAssaultFinish', 100) AirPushbackX(1000) AirPushbackY(20000) sprite('Action_190_38', 31) # 226-256 sprite('Action_190_39', 4) # 257-260 sprite('Action_190_40', 6) # 261-266 sprite('Action_190_41', 3) # 267-269 sprite('Action_190_42', 3) # 270-272 sprite('Action_190_43', 3) # 273-275 @State def UltimateRushOD(): def upon_IMMEDIATE(): AttackDefaults_StandingDD() Unknown23055('') AttackLevel_(4) Damage(340) MinimumDamagePct(13) AttackP2(98) GroundedHitstunAnimation(10) AirHitstunAnimation(10) AirPushbackX(5000) AirPushbackY(4500) Unknown30056('a08601003200000000000000') YImpluseBeforeWallbounce(700) AirUntechableTime(100) Unknown9310(1) Hitstop(0) Unknown11001(5, 5, 5) Unknown11056(2) Unknown9016(1) Unknown11057(800) Unknown11064(1) Unknown1084(1) GFX_0('UltimateRushEffOD', 100) def upon_78(): Unknown2037(1) setInvincible(0) setInvincibleFor(60) sprite('Action_189_00', 5) # 1-5 Unknown2036(60, -1, 0) ConsumeSuperMeter(-10000) setInvincible(1) Unknown30080('') tag_voice(1, 'uli250_0', 'uli250_1', '', '') sprite('Action_189_01', 8) # 6-13 SFX_3('SE_ApperLightBlade') sprite('Action_189_02', 7) # 14-20 sprite('Action_189_03', 6) # 21-26 sprite('Action_189_04', 5) # 27-31 sprite('Action_189_05', 4) # 32-35 sprite('Action_189_06', 4) # 36-39 sprite('Action_189_07', 4) # 40-43 sprite('Action_189_08', 3) # 44-46 sprite('Action_189_09', 3) # 47-49 Unknown2015(200) sprite('Action_190_00', 5) # 50-54 sprite('Action_190_01', 5) # 55-59 teleportRelativeX(20000) sprite('Action_190_02', 4) # 60-63 sprite('Action_190_03', 4) # 64-67 physicsXImpulse(9000) Unknown1028(-50) sprite('Action_190_04', 4) # 68-71 SFX_3('SE_SwingLightSword') sprite('Action_190_05', 4) # 72-75 **attackbox here** RefreshMultihit() sprite('Action_190_06', 3) # 76-78 **attackbox here** sprite('Action_190_07', 3) # 79-81 **attackbox here** RefreshMultihit() sprite('Action_190_08', 4) # 82-85 **attackbox here** sprite('Action_190_00', 2) # 86-87 if (not SLOT_2): setInvincible(0) sprite('Action_190_01', 2) # 88-89 sprite('Action_190_02', 2) # 90-91 sprite('Action_190_03', 2) # 92-93 sprite('Action_190_04', 2) # 94-95 SFX_3('SE_SwingLightSword') sprite('Action_190_05', 2) # 96-97 **attackbox here** RefreshMultihit() sprite('Action_190_06', 2) # 98-99 **attackbox here** sprite('Action_190_07', 2) # 100-101 **attackbox here** RefreshMultihit() sprite('Action_190_08', 2) # 102-103 **attackbox here** sprite('Action_190_01', 2) # 104-105 sprite('Action_190_02', 2) # 106-107 sprite('Action_190_03', 2) # 108-109 sprite('Action_190_04', 2) # 110-111 SFX_3('SE_SwingLightSword') sprite('Action_190_05', 2) # 112-113 **attackbox here** RefreshMultihit() sprite('Action_190_06', 2) # 114-115 **attackbox here** sprite('Action_190_07', 2) # 116-117 **attackbox here** RefreshMultihit() sprite('Action_190_08', 2) # 118-119 **attackbox here** sprite('Action_190_01', 2) # 120-121 sprite('Action_190_02', 2) # 122-123 sprite('Action_190_03', 2) # 124-125 sprite('Action_190_04', 2) # 126-127 SFX_3('SE_SwingLightSword') sprite('Action_190_05', 2) # 128-129 **attackbox here** RefreshMultihit() sprite('Action_190_06', 2) # 130-131 **attackbox here** sprite('Action_190_07', 2) # 132-133 **attackbox here** RefreshMultihit() sprite('Action_190_08', 2) # 134-135 **attackbox here** sprite('Action_190_01', 2) # 136-137 sprite('Action_190_02', 2) # 138-139 sprite('Action_190_03', 2) # 140-141 sprite('Action_190_04', 2) # 142-143 SFX_3('SE_SwingLightSword') sprite('Action_190_05', 2) # 144-145 **attackbox here** RefreshMultihit() sprite('Action_190_06', 2) # 146-147 **attackbox here** sprite('Action_190_07', 2) # 148-149 **attackbox here** RefreshMultihit() sprite('Action_190_08', 2) # 150-151 **attackbox here** sprite('Action_190_09', 2) # 152-153 sprite('Action_190_10', 2) # 154-155 sprite('Action_190_11', 2) # 156-157 sprite('Action_190_12', 2) # 158-159 SFX_3('SE_SwingLightSword') sprite('Action_190_13', 2) # 160-161 **attackbox here** RefreshMultihit() sprite('Action_190_14', 2) # 162-163 **attackbox here** sprite('Action_190_15', 2) # 164-165 **attackbox here** RefreshMultihit() sprite('Action_190_16', 2) # 166-167 **attackbox here** sprite('Action_190_17', 2) # 168-169 Unknown1084(1) sprite('Action_190_18', 2) # 170-171 teleportRelativeX(20000) sprite('Action_190_19', 2) # 172-173 teleportRelativeX(20000) sprite('Action_190_20', 2) # 174-175 SFX_3('SE_SwingLightSword') teleportRelativeX(20000) sprite('Action_190_21', 3) # 176-178 **attackbox here** teleportRelativeX(20000) RefreshMultihit() sprite('Action_190_22', 4) # 179-182 **attackbox here** teleportRelativeX(20000) sprite('Action_190_23', 6) # 183-188 **attackbox here** teleportRelativeX(20000) RefreshMultihit() AirPushbackX(5000) AirPushbackY(28000) YImpluseBeforeWallbounce(900) sprite('Action_190_24', 6) # 189-194 **attackbox here** teleportRelativeX(20000) sprite('Action_190_25', 7) # 195-201 physicsXImpulse(0) sprite('Action_190_26', 10) # 202-211 tag_voice(0, 'uli251_0', 'uli251_1', '', '') sprite('Action_190_27', 2) # 212-213 Unknown11057(1000) GFX_0('UltimateSlashOD', 100) Unknown2015(-1) SFX_3('SE_BigBomb') sprite('Action_190_28', 4) # 214-217 **attackbox here** Unknown11001(0, 0, 0) AirPushbackX(25000) AirPushbackY(-45000) Unknown30055('305705003200000000000000') Hitstop(0) RefreshMultihit() sprite('Action_190_29', 38) # 218-255 GFX_0('UltimateLightwallOD', 0) setInvincible(0) setInvincibleFor(0) clearUponHandler(78) sprite('Action_190_30', 2) # 256-257 sprite('Action_190_31', 6) # 258-263 sprite('Action_190_32', 3) # 264-266 sprite('Action_190_33', 5) # 267-271 sprite('Action_190_34', 3) # 272-274 sprite('Action_190_35', 6) # 275-280 sprite('Action_190_36', 3) # 281-283 sprite('Action_190_37', 4) # 284-287 **attackbox here** SFX_3('SE_SwingLightSword') GFX_0('UltimateAssaultFinish', 100) GroundedHitstunAnimation(10) AirHitstunAnimation(10) AirPushbackX(1000) AirPushbackY(20000) sprite('Action_190_38', 31) # 288-318 sprite('Action_190_39', 4) # 319-322 sprite('Action_190_40', 6) # 323-328 sprite('Action_190_41', 3) # 329-331 sprite('Action_190_42', 3) # 332-334 sprite('Action_190_43', 3) # 335-337 @State def UltimateShot(): def upon_IMMEDIATE(): AttackDefaults_StandingDD() Unknown23055('') Unknown2003(1) sprite('Action_262_00', 5) # 1-5 sprite('Action_262_01', 5) # 6-10 Unknown2036(60, -1, 0) ConsumeSuperMeter(-10000) setInvincible(1) Unknown30080('') sprite('Action_262_02', 5) # 11-15 sprite('Action_262_03', 3) # 16-18 sprite('Action_262_04', 3) # 19-21 sprite('Action_262_03', 3) # 22-24 sprite('Action_262_04', 3) # 25-27 sprite('Action_262_03', 3) # 28-30 sprite('Action_262_04', 3) # 31-33 sprite('Action_262_03', 3) # 34-36 sprite('Action_262_04', 3) # 37-39 sprite('Action_262_03', 3) # 40-42 sprite('Action_262_04', 3) # 43-45 sprite('Action_262_05', 5) # 46-50 sprite('Action_262_06', 5) # 51-55 sprite('Action_441_00', 2) # 56-57 sprite('Action_441_01', 2) # 58-59 sprite('Action_441_02', 2) # 60-61 sprite('Action_441_03', 4) # 62-65 sprite('Action_441_04', 2) # 66-67 SFX_0('006_swing_blade_1') GFX_0('EffShotSlash', 100) GFX_0('UltimateShot1', 0) sprite('Action_441_05', 2) # 68-69 sprite('Action_441_06', 2) # 70-71 sprite('Action_441_07', 2) # 72-73 sprite('Action_145_00', 2) # 74-75 sprite('Action_145_01', 2) # 76-77 sprite('Action_145_02', 3) # 78-80 **attackbox here** GFX_0('Lin_432', 100) GFX_0('UltimateShot2', 0) sprite('Action_145_03', 3) # 81-83 sprite('Action_145_04', 12) # 84-95 sprite('Action_145_05', 5) # 96-100 sprite('Action_145_06', 4) # 101-104 @State def UltimateRanbu(): def upon_IMMEDIATE(): AttackDefaults_StandingDD() Unknown23055('') AttackLevel_(4) MinimumDamagePct(15) AirHitstunAnimation(10) GroundedHitstunAnimation(10) AirPushbackY(40000) AirUntechableTime(60) Unknown9016(1) Unknown11069('UltimateRanbu_Exe') Unknown11064(1) Unknown2073(1) def upon_78(): Unknown13024(0) enterState('UltimateRanbu_Exe') setInvincible(1) Unknown1084(1) sprite('Action_262_00', 5) # 1-5 sprite('Action_262_01', 5) # 6-10 Unknown2036(60, -1, 0) ConsumeSuperMeter(-10000) Unknown30080('') SFX_4('uli252') sprite('Action_262_02', 5) # 11-15 sprite('Action_262_03', 3) # 16-18 sprite('Action_262_04', 3) # 19-21 sprite('Action_262_03', 3) # 22-24 sprite('Action_262_04', 3) # 25-27 sprite('Action_262_03', 3) # 28-30 sprite('Action_262_04', 3) # 31-33 sprite('Action_262_03', 3) # 34-36 sprite('Action_262_04', 3) # 37-39 sprite('Action_262_03', 3) # 40-42 sprite('Action_262_04', 3) # 43-45 sprite('Action_262_03', 3) # 46-48 sprite('Action_262_04', 3) # 49-51 sprite('Action_262_05', 5) # 52-56 sprite('Action_262_06', 5) # 57-61 sprite('Action_154_00', 6) # 62-67 sprite('Action_154_01', 4) # 68-71 Unknown1045(65000) sprite('Action_154_02', 4) # 72-75 **attackbox here** GFX_0('Lin_157', 0) Unknown1084(1) SFX_0('007_swing_knife_1') sprite('Action_154_03', 9) # 76-84 setInvincible(0) sprite('Action_154_04', 7) # 85-91 sprite('Action_154_05', 5) # 92-96 sprite('Action_154_06', 4) # 97-100 @State def UltimateRanbu_Exe(): def upon_IMMEDIATE(): AttackDefaults_StandingDD() Unknown23056('') AttackLevel_(4) Damage(790) MinimumDamagePct(8) AttackP2(100) AirHitstunAnimation(10) GroundedHitstunAnimation(10) AirPushbackY(36000) AirUntechableTime(60) Hitstop(4) Unknown30048(1) Unknown11023(1) Unknown11072(1, 150000, 50000) Unknown9016(1) Unknown11069('UltimateRanbu_Exe') Unknown11064(1) DisableAttackRestOfMove() setInvincible(1) EnableCollision(0) Unknown2015(40) def upon_ON_HIT_OR_BLOCK(): Unknown3001(200) Unknown3004(-40) def upon_STATE_END(): Unknown3001(255) Unknown3004(0) Unknown13024(0) sprite('keep', 7) # 1-7 GFX_0('Lin_166_1', 0) Unknown3004(-40) sprite('Action_160_07', 6) # 8-13 GFX_0('Lin_160_1', 0) teleportRelativeX(100000) Unknown1007(360000) Unknown3001(128) Unknown3004(20) sprite('Action_160_08', 2) # 14-15 sprite('Action_160_09', 4) # 16-19 **attackbox here** SFX_4('uli253_0') RefreshMultihit() AirHitstunAnimation(11) GroundedHitstunAnimation(11) AirPushbackX(30000) AirPushbackY(-18000) GFX_0('Lin_091', 0) SFX_0('007_swing_knife_1') sprite('null', 5) # 20-24 GFX_0('Lin_168_1', 0) teleportRelativeX(300000) teleportRelativeY(0) sprite('Action_154_00', 3) # 25-27 GFX_0('Lin_160_2', 0) Unknown3001(128) Unknown3004(20) Unknown8000(100, 1, 1) sprite('Action_154_01', 2) # 28-29 sprite('Action_154_02', 2) # 30-31 **attackbox here** RefreshMultihit() AirHitstunAnimation(10) GroundedHitstunAnimation(10) Unknown9071() AirPushbackY(40000) GFX_0('Lin_157', 0) SFX_0('007_swing_knife_1') sprite('null', 1) # 32-32 GFX_0('Lin_166_3', 0) teleportRelativeX(300000) Unknown1007(300000) Unknown2005() Unknown26('Lin_157') sprite('Action_160_03', 6) # 33-38 GFX_0('Lin_160_3', 0) Unknown3001(128) Unknown3004(20) sprite('Action_160_04', 2) # 39-40 sprite('Action_160_05', 4) # 41-44 **attackbox here** RefreshMultihit() GFX_0('EffNmlAtkAir5CBlade', 100) SFX_0('010_swing_sword_1') sprite('null', 5) # 45-49 GFX_0('Lin_168_2', 0) sprite('Action_160_07', 6) # 50-55 GFX_0('Lin_160_4', 0) teleportRelativeX(300000) Unknown1007(360000) Unknown2005() Unknown3001(128) Unknown3004(20) sprite('Action_160_08', 2) # 56-57 sprite('Action_160_09', 4) # 58-61 **attackbox here** GFX_0('Lin_168_3', 0) RefreshMultihit() AirHitstunAnimation(11) GroundedHitstunAnimation(11) AirPushbackY(-28000) GFX_0('Lin_091', 0) SFX_0('007_swing_knife_1') sprite('null', 5) # 62-66 teleportRelativeX(500000) teleportRelativeY(0) Unknown2005() sprite('Action_160_12', 4) # 67-70 GFX_0('Lin_160_5', 0) Unknown3001(128) Unknown3004(20) Unknown8000(100, 1, 1) sprite('Action_160_13', 3) # 71-73 sprite('Action_160_14', 2) # 74-75 sprite('Action_160_15', 6) # 76-81 **attackbox here** RefreshMultihit() AirHitstunAnimation(13) GroundedHitstunAnimation(13) AirPushbackX(10000) AirPushbackY(30000) Hitstop(1) Unknown11001(0, 20, 20) Unknown11099(1) MinimumDamagePct(24) physicsXImpulse(60000) Unknown8007(100, 1, 1) GFX_0('Lin_169', 0) SFX_0('007_swing_knife_2') sprite('Action_160_16', 5) # 82-86 Unknown3001(128) Unknown3004(20) Unknown1019(50) Unknown8010(100, 1, 1) sprite('Action_160_15', 1) # 87-87 **attackbox here** SFX_4('uli254') RefreshMultihit() Unknown11001(0, 0, 5) Unknown11072(0, 150000, 50000) Unknown11099(0) Unknown11069('') clearUponHandler(10) Unknown3001(128) Unknown3004(20) Unknown1019(30) Unknown8010(100, 1, 1) sprite('Action_160_15', 1) # 88-88 **attackbox here** RefreshMultihit() sprite('Action_160_15', 1) # 89-89 **attackbox here** RefreshMultihit() sprite('Action_160_15', 1) # 90-90 **attackbox here** RefreshMultihit() sprite('Action_160_15', 1) # 91-91 **attackbox here** RefreshMultihit() sprite('Action_160_15', 6) # 92-97 **attackbox here** RefreshMultihit() Unknown11064(0) sprite('Action_160_16', 11) # 98-108 Unknown1019(20) Unknown13024(1) sprite('Action_160_17', 6) # 109-114 Unknown1084(1) sprite('Action_160_18', 5) # 115-119 sprite('Action_160_19', 5) # 120-124 sprite('Action_160_20', 4) # 125-128 @State def UltimateRanbuOD(): def upon_IMMEDIATE(): AttackDefaults_StandingDD() Unknown23055('') AttackLevel_(4) MinimumDamagePct(15) AirHitstunAnimation(10) GroundedHitstunAnimation(10) AirPushbackY(40000) AirUntechableTime(60) Unknown9016(1) Unknown11069('UltimateRanbuOD_Exe') Unknown11064(1) Unknown2073(1) def upon_78(): Unknown13024(0) enterState('UltimateRanbuOD_Exe') setInvincible(1) Unknown1084(1) sprite('Action_262_00', 5) # 1-5 sprite('Action_262_01', 5) # 6-10 Unknown2036(60, -1, 0) ConsumeSuperMeter(-10000) Unknown30080('') SFX_4('uli252') sprite('Action_262_02', 5) # 11-15 sprite('Action_262_03', 3) # 16-18 sprite('Action_262_04', 3) # 19-21 sprite('Action_262_03', 3) # 22-24 sprite('Action_262_04', 3) # 25-27 sprite('Action_262_03', 3) # 28-30 sprite('Action_262_04', 3) # 31-33 sprite('Action_262_03', 3) # 34-36 sprite('Action_262_04', 3) # 37-39 sprite('Action_262_03', 3) # 40-42 sprite('Action_262_04', 3) # 43-45 sprite('Action_262_03', 3) # 46-48 sprite('Action_262_04', 3) # 49-51 sprite('Action_262_05', 5) # 52-56 sprite('Action_262_06', 5) # 57-61 sprite('Action_154_00', 6) # 62-67 sprite('Action_154_01', 4) # 68-71 Unknown1045(65000) sprite('Action_154_02', 4) # 72-75 **attackbox here** GFX_0('Lin_157', 0) Unknown1084(1) SFX_0('007_swing_knife_1') sprite('Action_154_03', 9) # 76-84 setInvincible(0) sprite('Action_154_04', 7) # 85-91 sprite('Action_154_05', 5) # 92-96 sprite('Action_154_06', 4) # 97-100 @State def UltimateRanbuOD_Exe(): def upon_IMMEDIATE(): AttackDefaults_StandingDD() Unknown23056('') AttackLevel_(4) Damage(870) MinimumDamagePct(7) AttackP2(100) AirHitstunAnimation(10) GroundedHitstunAnimation(10) AirPushbackY(36000) AirUntechableTime(60) Hitstop(4) Unknown30048(1) Unknown11023(1) Unknown11072(1, 150000, 50000) Unknown9016(1) Unknown11069('UltimateRanbuOD_Exe') Unknown11064(1) DisableAttackRestOfMove() setInvincible(1) EnableCollision(0) Unknown2015(40) def upon_ON_HIT_OR_BLOCK(): Unknown3001(200) Unknown3004(-40) def upon_STATE_END(): Unknown3001(255) Unknown3004(0) Unknown13024(0) sprite('keep', 7) # 1-7 GFX_0('Lin_166_1', 0) Unknown3004(-40) sprite('null', 1) # 8-8 teleportRelativeX(300000) Unknown1007(300000) Unknown2005() Unknown26('Lin_157') sprite('Action_160_03', 6) # 9-14 GFX_0('Lin_160_3', 0) Unknown3001(128) Unknown3004(20) sprite('Action_160_04', 2) # 15-16 sprite('Action_160_05', 4) # 17-20 **attackbox here** SFX_4('uli253_1') RefreshMultihit() GFX_0('EffNmlAtkAir5CBlade', 100) SFX_0('010_swing_sword_1') sprite('null', 5) # 21-25 GFX_0('Lin_168_2', 0) sprite('Action_160_07', 6) # 26-31 GFX_0('Lin_160_4', 0) teleportRelativeX(300000) Unknown1007(360000) Unknown2005() Unknown3001(128) Unknown3004(20) sprite('Action_160_08', 2) # 32-33 sprite('Action_160_09', 4) # 34-37 **attackbox here** GFX_0('Lin_168_3', 0) RefreshMultihit() AirHitstunAnimation(11) GroundedHitstunAnimation(11) AirPushbackY(-28000) GFX_0('Lin_091', 0) SFX_0('007_swing_knife_1') sprite('null', 5) # 38-42 teleportRelativeX(500000) teleportRelativeY(0) Unknown2005() sprite('Action_154_00', 3) # 43-45 GFX_0('Lin_160_5', 0) Unknown3001(128) Unknown3004(20) Unknown8000(100, 1, 1) sprite('Action_154_01', 2) # 46-47 sprite('Action_154_02', 2) # 48-49 **attackbox here** RefreshMultihit() AirHitstunAnimation(10) GroundedHitstunAnimation(10) Unknown9071() AirPushbackY(40000) GFX_0('Lin_157', 0) SFX_0('007_swing_knife_1') sprite('null', 1) # 50-50 GFX_0('Lin_166_3', 0) teleportRelativeX(300000) Unknown1007(300000) Unknown2005() Unknown26('Lin_157') sprite('Action_160_03', 6) # 51-56 GFX_0('Lin_160_3', 0) Unknown3001(128) Unknown3004(20) sprite('Action_160_04', 2) # 57-58 sprite('Action_160_05', 4) # 59-62 **attackbox here** RefreshMultihit() GFX_0('EffNmlAtkAir5CBlade', 100) SFX_0('010_swing_sword_1') sprite('null', 5) # 63-67 GFX_0('Lin_166_1', 0) sprite('null', 1) # 68-68 teleportRelativeX(300000) Unknown1007(300000) Unknown2005() Unknown26('Lin_157') sprite('Action_160_03', 6) # 69-74 GFX_0('Lin_160_2', 0) Unknown3001(128) Unknown3004(20) sprite('Action_160_04', 2) # 75-76 sprite('Action_160_05', 4) # 77-80 **attackbox here** RefreshMultihit() GFX_0('EffNmlAtkAir5CBlade', 100) SFX_0('010_swing_sword_1') sprite('null', 5) # 81-85 GFX_0('Lin_166_1', 0) sprite('Action_160_07', 6) # 86-91 GFX_0('Lin_160_1', 0) teleportRelativeX(300000) Unknown1007(360000) Unknown2005() Unknown3001(128) Unknown3004(20) sprite('Action_160_08', 2) # 92-93 sprite('Action_160_09', 4) # 94-97 **attackbox here** RefreshMultihit() AirHitstunAnimation(11) GroundedHitstunAnimation(11) AirPushbackY(-42000) GFX_0('Lin_091', 0) SFX_0('007_swing_knife_1') sprite('null', 6) # 98-103 GFX_0('Lin_168_3', 0) teleportRelativeX(500000) teleportRelativeY(0) Unknown2005() sprite('Action_160_12', 4) # 104-107 GFX_0('Lin_160_5', 0) Unknown3001(128) Unknown3004(20) Unknown8000(100, 1, 1) sprite('Action_160_13', 3) # 108-110 sprite('Action_160_14', 2) # 111-112 sprite('Action_160_15', 6) # 113-118 **attackbox here** SFX_4('uli254') RefreshMultihit() AirHitstunAnimation(13) GroundedHitstunAnimation(13) AirPushbackX(10000) AirPushbackY(30000) Hitstop(1) Unknown11001(0, 20, 20) Unknown11099(1) MinimumDamagePct(23) physicsXImpulse(60000) Unknown8007(100, 1, 1) GFX_0('Lin_169', 0) SFX_0('007_swing_knife_2') sprite('Action_160_16', 5) # 119-123 Unknown3001(128) Unknown3004(20) Unknown1019(50) Unknown8010(100, 1, 1) sprite('Action_160_15', 1) # 124-124 **attackbox here** RefreshMultihit() Unknown11001(0, 0, 5) Unknown11072(0, 150000, 50000) Unknown11099(0) Unknown11069('') Unknown11064(0) clearUponHandler(10) Unknown3001(128) Unknown3004(20) Unknown1019(30) Unknown8010(100, 1, 1) sprite('Action_160_15', 1) # 125-125 **attackbox here** RefreshMultihit() sprite('Action_160_15', 1) # 126-126 **attackbox here** RefreshMultihit() sprite('Action_160_15', 1) # 127-127 **attackbox here** RefreshMultihit() sprite('Action_160_15', 1) # 128-128 **attackbox here** RefreshMultihit() sprite('Action_160_15', 6) # 129-134 **attackbox here** RefreshMultihit() sprite('Action_160_16', 11) # 135-145 Unknown1019(20) Unknown13024(1) sprite('Action_160_17', 6) # 146-151 Unknown1084(1) sprite('Action_160_18', 5) # 152-156 sprite('Action_160_19', 5) # 157-161 sprite('Action_160_20', 4) # 162-165 @State def AstralHeat(): def upon_IMMEDIATE(): AttackDefaults_Astral() AttackLevel_(2) Unknown11064(1) Damage(2000) MinimumDamagePct(100) GroundedHitstunAnimation(4) AirHitstunAnimation(4) hitstun(120) Unknown11001(0, 0, 0) AirUntechableTime(300) Hitstop(0) Unknown11068(1) Unknown11078(1) Unknown11062(1) Unknown9016(1) def upon_78(): clearUponHandler(78) PushbackX(20000) sendToLabel(2) Unknown23157(1) EnableCollision(0) Unknown2053(0) Unknown2034(0) Unknown20003(1) Unknown20004(1) Unknown23084(1) Unknown23088(1, 1) Unknown11086(1) def upon_77(): Unknown21015('41737472616c5f3238395f310000000000000000000000000000000000000000581b000000000000') Unknown21015('41737472616c5f3238395f320000000000000000000000000000000000000000581b000000000000') def upon_STATE_END(): Unknown21013('43616c6c5f556e6949574542470000000000000000000000000000000000000020000000') sprite('Action_270_00', 3) # 1-3 **attackbox here** setInvincible(1) sprite('Action_270_00', 5) # 4-8 **attackbox here** Unknown2036(90, -1, 2) Unknown23147() Unknown4004('6175726100000000000000000000000000000000000000000000000000000000ffff0000') SFX_4('uli290') GFX_0('Astral_CutIn', 100) Unknown4004('43616c6c5f556e69495745424700000000000000000000000000000000000000ffff0000') sprite('Action_270_01', 3) # 9-11 **attackbox here** sprite('Action_270_02', 2) # 12-13 **attackbox here** sprite('Action_270_03', 5) # 14-18 **attackbox here** sprite('Action_270_06', 3) # 19-21 **attackbox here** sprite('Action_270_07', 3) # 22-24 **attackbox here** sprite('Action_270_08', 3) # 25-27 **attackbox here** sprite('Action_270_06', 3) # 28-30 **attackbox here** sprite('Action_270_07', 3) # 31-33 **attackbox here** sprite('Action_270_08', 3) # 34-36 **attackbox here** sprite('Action_270_06', 3) # 37-39 **attackbox here** sprite('Action_270_07', 3) # 40-42 **attackbox here** sprite('Action_270_08', 3) # 43-45 **attackbox here** sprite('Action_270_06', 3) # 46-48 **attackbox here** sprite('Action_270_07', 3) # 49-51 **attackbox here** sprite('Action_270_08', 3) # 52-54 **attackbox here** sprite('Action_270_06', 3) # 55-57 **attackbox here** sprite('Action_270_07', 3) # 58-60 **attackbox here** sprite('Action_270_08', 3) # 61-63 **attackbox here** sprite('Action_270_06', 3) # 64-66 **attackbox here** sprite('Action_270_07', 3) # 67-69 **attackbox here** sprite('Action_270_08', 3) # 70-72 **attackbox here** sprite('Action_270_06', 3) # 73-75 **attackbox here** sprite('Action_270_07', 3) # 76-78 **attackbox here** sprite('Action_270_08', 3) # 79-81 **attackbox here** sprite('Action_270_06', 3) # 82-84 **attackbox here** sprite('Action_270_07', 3) # 85-87 **attackbox here** sprite('Action_270_08', 3) # 88-90 **attackbox here** sprite('Action_270_06', 3) # 91-93 **attackbox here** sprite('Action_270_07', 3) # 94-96 **attackbox here** sprite('Action_270_08', 3) # 97-99 **attackbox here** sprite('Action_270_09', 3) # 100-102 **attackbox here** loopRest() sprite('Action_270_10', 2) # 103-104 **attackbox here** physicsXImpulse(30000) def upon_CLEAR_OR_EXIT(): if (SLOT_19 <= 200000): clearUponHandler(3) sendToLabel(1) sprite('Action_270_11', 3) # 105-107 **attackbox here** GFX_0('Astral_289_1', 100) GFX_0('Astral_289_2', 100) sprite('Action_270_12', 3) # 108-110 **attackbox here** sprite('Action_270_13', 2) # 111-112 **attackbox here** sprite('Action_270_14', 2) # 113-114 **attackbox here** sprite('Action_270_15', 2) # 115-116 **attackbox here** sprite('Action_270_16', 2) # 117-118 **attackbox here** sprite('Action_270_17', 2) # 119-120 **attackbox here** sprite('Action_270_18', 2) # 121-122 **attackbox here** label(1) sprite('Action_270_11ex', 3) # 123-125 **attackbox here** Unknown21015('41737472616c5f3238395f310000000000000000000000000000000000000000581b000000000000') Unknown21015('41737472616c5f3238395f320000000000000000000000000000000000000000581b000000000000') clearUponHandler(3) Unknown11072(1, 200000, 0) sprite('Action_045_11', 4) # 126-129 Unknown21013('43616c6c5f556e6949574542470000000000000000000000000000000000000020000000') setInvincible(0) Unknown1019(80) sprite('Action_045_12', 5) # 130-134 sprite('Action_045_11', 4) # 135-138 Unknown1019(50) sprite('Action_045_12', 5) # 139-143 Unknown1019(0) sprite('Action_045_13', 6) # 144-149 ExitState() label(2) sprite('Action_270_19', 4) # 150-153 **attackbox here** SFX_4('uli291') physicsXImpulse(6000) clearUponHandler(3) clearUponHandler(78) sprite('Action_270_20', 2) # 154-155 **attackbox here** SFX_3('SE_SwingLightSword') AttackLevel_(4) Hitstop(2) sprite('Action_270_20', 2) # 156-157 **attackbox here** SFX_3('SE_SwingLightSword') RefreshMultihit() sprite('Action_270_21', 5) # 158-162 **attackbox here** sprite('Action_270_22', 3) # 163-165 **attackbox here** GFX_0('Astral_280', 100) RefreshMultihit() sprite('Action_270_23', 2) # 166-167 **attackbox here** sprite('Action_270_24', 3) # 168-170 **attackbox here** sprite('Action_270_25', 4) # 171-174 **attackbox here** SFX_3('SE_SwingLightSword') GFX_0('Astral_281', 100) RefreshMultihit() sprite('Action_270_26', 5) # 175-179 **attackbox here** sprite('Action_270_27', 3) # 180-182 **attackbox here** sprite('Action_270_28', 4) # 183-186 **attackbox here** sprite('Action_270_29', 4) # 187-190 **attackbox here** sprite('Action_270_30', 1) # 191-191 **attackbox here** SFX_3('SE_SwingLightSword') GFX_0('Astral_282', 100) RefreshMultihit() sprite('Action_270_31', 4) # 192-195 **attackbox here** sprite('Action_270_32', 3) # 196-198 **attackbox here** sprite('Action_270_33', 2) # 199-200 **attackbox here** sprite('Action_270_34', 5) # 201-205 **attackbox here** sprite('Action_270_35', 4) # 206-209 **attackbox here** sprite('Action_270_36', 2) # 210-211 **attackbox here** sprite('Action_270_37', 5) # 212-216 **attackbox here** SFX_3('SE_SwingLightSword') GFX_0('Astral_283', 100) AirHitstunAnimation(10) GroundedHitstunAnimation(10) AirUntechableTime(600) AirPushbackX(0) AirPushbackY(80000) YImpluseBeforeWallbounce(1600) RefreshMultihit() sprite('Action_270_38', 22) # 217-238 **attackbox here** Unknown1084(1) Unknown21013('43616c6c5f556e6949574542470000000000000000000000000000000000000020000000') sprite('null', 45) # 239-283 Unknown20000(1) Unknown20003(1) Unknown20002(1) Unknown1000(0) Unknown36(22) Unknown3001(0) Unknown1000(0) physicsYImpulse(1) setGravity(0) Unknown35() sprite('null', 45) # 284-328 Unknown4004('6566666563745f32363500000000000000000000000000000000000000000000ffff0000') SFX_4('uli292') sprite('null', 40) # 329-368 SFX_3('SE039') GFX_0('Astral_277', 100) sprite('null', 20) # 369-388 Unknown36(22) Unknown3001(255) Unknown35() GFX_0('Astral_276', 100) sprite('null', 1) # 389-389 Unknown20000(0) Unknown20007(1) Unknown20001(1) sprite('null', 20) # 390-409 GFX_0('Astral_274', -1) Unknown1086(22) teleportRelativeX(-100000) Unknown1007(-30000) sprite('Action_271_03', 4) # 410-413 **attackbox here** Unknown3001(0) Unknown3004(42) Unknown3026(-16777216) Unknown3025(-1, 10) physicsXImpulse(1200) physicsYImpulse(10000) setGravity(100) sprite('Action_271_04', 4) # 414-417 **attackbox here** sprite('Action_271_05', 4) # 418-421 **attackbox here** sprite('Action_271_06', 4) # 422-425 **attackbox here** YAccel(80) sprite('Action_271_07', 4) # 426-429 **attackbox here** SFX_4('uli293') sprite('Action_271_08', 11) # 430-440 **attackbox here** sprite('Action_271_09', 10) # 441-450 **attackbox here** YAccel(50) sprite('Action_271_10', 10) # 451-460 **attackbox here** sprite('Action_271_11', 5) # 461-465 **attackbox here** YAccel(20) setGravity(0) sprite('null', 40) # 466-505 SFX_3('SE_SwingGlass') GFX_0('Astral_272', 100) Unknown36(22) Unknown3001(0) Unknown35() Unknown26('Astral_274') sprite('null', 20) # 506-525 Unknown20007(1) Unknown20001(1) physicsXImpulse(0) physicsYImpulse(0) setGravity(0) sprite('null', 90) # 526-615 GFX_0('Astral_279', -1) GFX_0('Astral_274_2', -1) GFX_0('Astral_278', 100) Unknown36(22) Unknown3001(255) Unknown23178(11) setGravity(0) Unknown35() sprite('null', 30) # 616-645 GFX_0('Astral_275', 100) SFX_3('SE_BigBomb') sprite('null', 30) # 646-675 Unknown11064(3) GFX_0('Astral_Atk_dmy', 100) Unknown26('Astral_274_2') sprite('null', 87) # 676-762 Unknown26('Astral_278') Unknown20007(0) Unknown20000(1) Unknown1000(0) teleportRelativeY(0) Unknown23024(0) sprite('Action_269_00', 122) # 763-884 sprite('Action_269_01', 15) # 885-899 Unknown20000(0) sprite('Action_269_02', 5) # 900-904 sprite('Action_269_03', 4) # 905-908 sprite('Action_269_04', 5) # 909-913 sprite('Action_269_05', 5) # 914-918 sprite('Action_269_06', 2) # 919-920 @State def CmnActTagBattleWait(): def upon_IMMEDIATE(): setInvincible(1) label(0) sprite('null', 1) # 1-1 EnableCollision(0) Unknown2034(0) teleportRelativeY(0) gotoLabel(0) @State def CmnActChangePartnerAppeal(): def upon_IMMEDIATE(): AttackDefaults_StandingNormal() sprite('Action_248_00', 3) # 1-3 Unknown4045('65665f74656b69746f755f67000000000000000000000000000000000000000067000000') sprite('Action_248_01', 3) # 4-6 sprite('Action_248_02', 3) # 7-9 sprite('Action_248_03', 3) # 10-12 sprite('Action_248_04', 3) # 13-15 sprite('Action_248_05', 3) # 16-18 sprite('Action_248_06', 3) # 19-21 sprite('Action_248_07', 3) # 22-24 sprite('Action_248_08', 3) # 25-27 sprite('Action_248_09', 3) # 28-30 sprite('Action_248_10', 20) # 31-50 sprite('Action_248_06', 3) # 51-53 sprite('Action_248_05', 3) # 54-56 sprite('Action_248_04', 3) # 57-59 sprite('Action_248_03', 3) # 60-62 sprite('Action_248_02', 3) # 63-65 sprite('Action_248_01', 3) # 66-68 sprite('Action_248_00', 3) # 69-71 @State def CmnActChangePartnerAppealAir(): def upon_IMMEDIATE(): AttackDefaults_AirNormal() sprite('Action_019_03', 2) # 1-2 Unknown1017() Unknown1022() Unknown1037() Unknown1084(1) sprite('Action_019_02', 2) # 3-4 label(0) sprite('Action_019_00', 5) # 5-9 sprite('Action_019_01', 5) # 10-14 Unknown2038(1) if (SLOT_2 == 5): Unknown1018() Unknown1023() Unknown1038() Unknown1019(40) YAccel(40) (SLOT_2 >= 6) if SLOT_ReturnVal: _gotolabel(1) loopRest() gotoLabel(0) label(1) sprite('Action_019_00', 6) # 15-20 sprite('Action_019_01', 6) # 21-26 @State def CmnActChangePartnerOut(): def upon_IMMEDIATE(): Unknown17013() sprite('Action_046_01', 3) # 1-3 sprite('Action_046_02', 3) # 4-6 sprite('Action_046_01', 3) # 7-9 sprite('Action_046_02', 3) # 10-12 sprite('Action_046_01', 3) # 13-15 sprite('Action_046_02', 3) # 16-18 sprite('Action_046_01', 3) # 19-21 sprite('Action_046_02', 3) # 22-24 sprite('Action_046_01', 3) # 25-27 sprite('Action_046_02', 3) # 28-30 sprite('Action_046_01', 30) # 31-60 @State def CmnActChangeRequest(): def upon_IMMEDIATE(): Unknown17013() Unknown1084(1) Unknown2034(0) EnableCollision(0) Unknown2053(0) Unknown2067(2500, 240) def upon_STATE_END(): Unknown2034(1) EnableCollision(1) Unknown2053(1) sprite('Action_053_00', 3) # 1-3 sprite('Action_053_01', 3) # 4-6 sprite('Action_053_02', 4) # 7-10 sprite('Action_053_03', 4) # 11-14 sprite('Action_053_04', 6) # 15-20 sprite('Action_053_05', 20) # 21-40 sprite('Action_053_06', 2) # 41-42 sprite('Action_053_07', 5) # 43-47 sprite('Action_053_08', 5) # 48-52 sprite('Action_053_09', 10) # 53-62 Unknown30042(24) if SLOT_ReturnVal: _gotolabel(2) sprite('keep', 32767) # 63-32829 label(2) sprite('Action_053_03', 3) # 32830-32832 sprite('Action_053_02', 3) # 32833-32835 sprite('Action_053_01', 3) # 32836-32838 sprite('Action_053_00', 3) # 32839-32841 @State def CmnActChangeReturnAppeal(): def upon_IMMEDIATE(): Unknown17013() sprite('Action_000_15', 1) # 1-1 **attackbox here** sprite('Action_000_16', 4) # 2-5 **attackbox here** sprite('Action_000_17', 4) # 6-9 **attackbox here** sprite('Action_000_18', 4) # 10-13 **attackbox here** sprite('Action_000_19', 4) # 14-17 **attackbox here** sprite('Action_000_20', 4) # 18-21 **attackbox here** sprite('Action_000_21', 4) # 22-25 **attackbox here** sprite('Action_000_22', 4) # 26-29 **attackbox here** SFX_FOOTSTEP_(100, 0, 1) sprite('Action_000_23', 3) # 30-32 **attackbox here** sprite('Action_000_24', 23) # 33-55 **attackbox here** sprite('Action_000_26', 4) # 56-59 **attackbox here** sprite('Action_000_27', 4) # 60-63 **attackbox here** sprite('Action_000_28', 3) # 64-66 **attackbox here** sprite('Action_000_29', 3) # 67-69 **attackbox here** sprite('Action_000_30', 3) # 70-72 **attackbox here** sprite('Action_000_31', 3) # 73-75 **attackbox here** sprite('Action_000_32', 30) # 76-105 @State def CmnActChangePartnerIn(): def upon_IMMEDIATE(): Unknown17021('') Unknown9015(1) def upon_41(): clearUponHandler(41) sendToLabel(100) def upon_LANDING(): clearUponHandler(2) sendToLabel(9) sprite('null', 2) # 1-2 sprite('null', 600) # 3-602 label(100) sprite('null', 28) # 603-630 sprite('Action_146_01', 2) # 631-632 Unknown1086(22) teleportRelativeX(-150000) teleportRelativeY(1200000) physicsYImpulse(-240000) setGravity(0) EnableCollision(1) Unknown2053(1) sprite('Action_146_02', 2) # 633-634 SFX_0('004_swing_grap_1_1') SFX_0('000_airdash_2') label(1) sprite('Action_146_03ex', 3) # 635-637 **attackbox here** sprite('Action_146_04ex', 3) # 638-640 **attackbox here** loopRest() gotoLabel(1) label(9) sprite('keep', 3) # 641-643 Unknown1084(1) sprite('Action_146_05', 4) # 644-647 Unknown8000(100, 1, 1) sprite('Action_146_06', 14) # 648-661 sprite('Action_146_07', 4) # 662-665 @State def CmnActChangeReturnAppealBurst(): sprite('Action_312_03', 2) # 1-2 sprite('Action_312_04', 2) # 3-4 sprite('Action_312_05', 32) # 5-36 sprite('Action_312_06', 4) # 37-40 sprite('Action_312_07', 4) # 41-44 sprite('Action_312_08', 4) # 45-48 sprite('Action_014_00', 4) # 49-52 sprite('Action_014_01', 4) # 53-56 sprite('Action_014_02', 4) # 57-60 sprite('Action_000_00', 30) # 61-90 **attackbox here** @State def CmnActChangePartnerQuickIn(): sprite('Action_045_03', 3) # 1-3 sprite('Action_045_04', 5) # 4-8 sprite('Action_045_11', 7) # 9-15 sprite('Action_045_12', 7) # 16-22 sprite('Action_045_13', 7) # 23-29 @State def CmnActChangePartnerQuickOut(): def upon_IMMEDIATE(): Unknown17013() def upon_LANDING(): clearUponHandler(2) Unknown1084(1) sendToLabel(1) sprite('Action_046_00', 1) # 1-1 sprite('Action_046_01', 2) # 2-3 sprite('Action_046_02', 2) # 4-5 sprite('Action_046_02', 1) # 6-6 sprite('Action_046_03', 1) # 7-7 loopRest() label(0) sprite('Action_046_03', 3) # 8-10 sprite('Action_046_04', 3) # 11-13 loopRest() gotoLabel(0) label(1) sprite('Action_046_05', 3) # 14-16 sprite('Action_046_06', 3) # 17-19 @State def CmnActChangePartnerAssistAdmiss(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() def upon_LANDING(): clearUponHandler(2) Unknown1084(1) sendToLabel(99) sprite('null', 2) # 1-2 label(0) sprite('Action_022_00', 4) # 3-6 Unknown1019(95) sprite('Action_022_01', 4) # 7-10 Unknown1019(95) loopRest() gotoLabel(0) label(99) sprite('Action_013_00', 2) # 11-12 Unknown8000(100, 1, 1) sprite('keep', 100) # 13-112 @State def CmnActChangePartnerAssistAtk_A(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() Unknown2006() def upon_STATE_END(): EnableCollision(1) Unknown2034(1) Unknown2053(1) clearUponHandler(2) sendToLabelUpon(2, 1) sprite('Action_036_00', 4) # 1-4 sprite('Action_036_01', 4) # 5-8 SLOT_12 = SLOT_19 Unknown1019(3) if (SLOT_12 <= 1000): SLOT_12 = 1000 physicsYImpulse(34000) sprite('Action_448_00', 2) # 9-10 physicsXImpulse(3000) physicsYImpulse(20000) setGravity(1400) sprite('Action_448_01', 3) # 11-13 sprite('Action_448_02', 3) # 14-16 sprite('Action_448_03', 3) # 17-19 sprite('Action_448_04', 10) # 20-29 sprite('Action_448_05', 4) # 30-33 SFX_0('010_swing_sword_2') sprite('Action_448_06', 3) # 34-36 GFX_0('EffAirShotSlash', 100) GFX_0('ShotAssist', 0) tag_voice(1, 'uli204_0', 'uli204_1', 'uli204_2', '') sprite('Action_448_07', 10) # 37-46 sprite('Action_448_08', 6) # 47-52 sprite('Action_448_09', 4) # 53-56 label(0) sprite('Action_022_00', 3) # 57-59 sprite('Action_022_01', 3) # 60-62 loopRest() gotoLabel(0) label(1) sprite('Action_023_00', 3) # 63-65 Unknown1084(1) clearUponHandler(2) sprite('Action_023_01', 3) # 66-68 sprite('Action_023_02', 3) # 69-71 sprite('Action_023_03', 4) # 72-75 @State def CmnActChangePartnerAssistAtk_B(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() AttackLevel_(3) AttackP1(70) Unknown11092(1) AirHitstunAnimation(10) GroundedHitstunAnimation(10) AirPushbackX(2000) AirPushbackY(38000) AirUntechableTime(60) Unknown9016(1) Hitstop(7) Unknown11042(1) clearUponHandler(2) sendToLabelUpon(2, 1) Unknown2006() def upon_STATE_END(): EnableCollision(1) Unknown2034(1) Unknown2053(1) sprite('Action_099_00', 6) # 1-6 physicsXImpulse(40000) sprite('Action_099_01', 3) # 7-9 physicsXImpulse(11000) Unknown7006('uli200_0', 100, 845769845, 828321840, 0, 0, 100, 845769845, 845099056, 0, 0, 100, 0, 0, 0, 0, 0) sprite('Action_099_02', 3) # 10-12 **attackbox here** sprite('Action_099_03', 1) # 13-13 SFX_0('010_swing_sword_0') physicsYImpulse(23000) physicsXImpulse(4000) setGravity(1800) sprite('Action_099_04', 2) # 14-15 GFX_0('EffNmlReversalAction00', 100) sprite('Action_099_05', 2) # 16-17 **attackbox here** RefreshMultihit() Unknown9071() Unknown9083() sprite('Action_099_06', 3) # 18-20 sprite('Action_099_07', 2) # 21-22 sprite('Action_099_08', 2) # 23-24 sprite('Action_099_09', 2) # 25-26 sprite('Action_099_10', 2) # 27-28 sprite('Action_099_11', 3) # 29-31 sprite('Action_099_12', 4) # 32-35 label(0) sprite('Action_099_13', 3) # 36-38 sprite('Action_099_14', 3) # 39-41 loopRest() gotoLabel(0) label(1) sprite('Action_099_15', 2) # 42-43 Unknown1084(1) Unknown8000(100, 1, 1) sprite('Action_099_16', 2) # 44-45 sprite('Action_099_17', 3) # 46-48 sprite('Action_099_18', 3) # 49-51 @State def CmnActChangePartnerAssistAtk_C(): def upon_IMMEDIATE(): Unknown17013() sprite('keep', 180) # 1-180 @State def CmnActChangePartnerAssistAtk_D(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() AttackLevel_(3) Damage(800) AttackP1(70) Unknown11092(1) Hitstop(2) AirPushbackX(12000) AirPushbackY(32000) AirUntechableTime(50) GroundedHitstunAnimation(13) AirHitstunAnimation(13) Unknown9016(1) Unknown11042(1) Unknown2006() def upon_STATE_END(): EnableCollision(1) Unknown2034(1) Unknown2053(1) sprite('Action_045_00', 2) # 1-2 Unknown3029(1) sprite('Action_045_01', 3) # 3-5 physicsXImpulse(38000) Unknown1028(-1000) sprite('Action_045_02', 2) # 6-7 def upon_CLEAR_OR_EXIT(): if (SLOT_19 <= 200000): sendToLabel(0) sprite('Action_045_03', 2) # 8-9 Unknown8006(100, 1, 1) label(0) sprite('Action_403_00', 1) # 10-10 clearUponHandler(3) Unknown1084(1) Unknown1045(28000) sprite('Action_403_01', 1) # 11-11 sprite('Action_403_02', 2) # 12-13 sprite('Action_403_03', 1) # 14-14 Unknown7009(2) SFX_0('010_swing_sword_2') sprite('Action_403_03', 1) # 15-15 sprite('Action_403_04', 1) # 16-16 **attackbox here** GFX_0('EffNmlAtk5CBlade', 100) RefreshMultihit() Unknown1019(80) sprite('Action_403_04', 1) # 17-17 **attackbox here** RefreshMultihit() sprite('Action_403_05', 2) # 18-19 **attackbox here** RefreshMultihit() Hitstop(7) Unknown1019(80) sprite('Action_403_06', 4) # 20-23 sprite('Action_403_07', 7) # 24-30 sprite('Action_403_08', 4) # 31-34 sprite('Action_403_09', 4) # 35-38 sprite('Action_403_10', 3) # 39-41 sprite('Action_403_11', 1) # 42-42 sprite('Action_403_11', 1) # 43-43 sprite('Action_403_11', 1) # 44-44 @State def CmnActChangePartnerAttackIn(): def upon_IMMEDIATE(): AttackDefaults_StandingSpecial() sprite('keep', 180) # 1-180 @State def CmnActChangePartnerDD(): def upon_IMMEDIATE(): setInvincible(1) Unknown30063(1) if SLOT_162: SLOT_58 = 1 def upon_LANDING(): clearUponHandler(2) Unknown1084(1) Unknown8000(100, 1, 1) sendToLabel(1) sprite('null', 1) # 1-1 Unknown2036(96, -1, 0) sprite('null', 1) # 2-2 teleportRelativeX(-1500000) teleportRelativeY(240000) setGravity(0) physicsYImpulse(-9600) SLOT_12 = SLOT_19 teleportRelativeX(-145000) Unknown1019(4) label(0) sprite('Action_022_00', 3) # 3-5 sprite('Action_022_01', 3) # 6-8 loopRest() gotoLabel(0) label(1) sprite('keep', 10) # 9-18 if SLOT_58: enterState('AN_CmnActChangePartnerDDODExe') else: enterState('AN_CmnActChangePartnerDDExe') @State def AN_CmnActChangePartnerDDExe(): def upon_IMMEDIATE(): AttackDefaults_StandingDD() Unknown23056('') AttackLevel_(4) Damage(150) MinimumDamagePct(100) AttackP1(100) AttackP2(100) GroundedHitstunAnimation(10) AirHitstunAnimation(10) AirPushbackX(6000) AirPushbackY(3000) Unknown30056('a08601003200000000000000') YImpluseBeforeWallbounce(700) AirUntechableTime(100) Unknown9310(1) Hitstop(0) Unknown11001(5, 5, 5) Unknown11056(2) Unknown11064(1) Unknown9016(1) Unknown11057(800) Unknown1084(1) Unknown30063(1) Unknown30019('0000000001000000') GFX_0('UltimateRushEff', 100) def upon_78(): Unknown2037(1) setInvincible(0) setInvincibleFor(60) sprite('Lin392_00', 5) # 1-5 setInvincible(1) sprite('Action_189_01', 8) # 6-13 SFX_3('SE_ApperLightBlade') sprite('Action_189_02', 7) # 14-20 sprite('Action_189_03', 6) # 21-26 sprite('Action_189_04', 5) # 27-31 sprite('Action_189_05', 4) # 32-35 sprite('Action_189_06', 4) # 36-39 sprite('Action_189_07', 4) # 40-43 sprite('Action_189_08', 3) # 44-46 sprite('Action_189_09', 3) # 47-49 Unknown2015(200) sprite('Action_190_00', 5) # 50-54 sprite('Action_190_01', 5) # 55-59 teleportRelativeX(20000) sprite('Action_190_02', 4) # 60-63 sprite('Action_190_03', 4) # 64-67 physicsXImpulse(5000) Unknown1028(-50) sprite('Action_190_04', 4) # 68-71 SFX_3('SE_SwingLightSword') sprite('Action_190_05duo', 4) # 72-75 **attackbox here** RefreshMultihit() sprite('Action_190_06', 3) # 76-78 **attackbox here** sprite('Action_190_07', 3) # 79-81 **attackbox here** RefreshMultihit() sprite('Action_190_08', 4) # 82-85 **attackbox here** sprite('Action_190_09', 2) # 86-87 if (not SLOT_2): setInvincible(0) sprite('Action_190_10', 2) # 88-89 sprite('Action_190_11', 2) # 90-91 sprite('Action_190_12', 2) # 92-93 SFX_3('SE_SwingLightSword') sprite('Action_190_13', 2) # 94-95 **attackbox here** RefreshMultihit() sprite('Action_190_14', 2) # 96-97 **attackbox here** sprite('Action_190_15', 2) # 98-99 **attackbox here** RefreshMultihit() sprite('Action_190_16', 2) # 100-101 **attackbox here** sprite('Action_190_10', 2) # 102-103 sprite('Action_190_11', 2) # 104-105 sprite('Action_190_12', 2) # 106-107 SFX_3('SE_SwingLightSword') sprite('Action_190_13', 2) # 108-109 **attackbox here** RefreshMultihit() sprite('Action_190_14', 2) # 110-111 **attackbox here** sprite('Action_190_15', 2) # 112-113 **attackbox here** RefreshMultihit() sprite('Action_190_16', 2) # 114-115 **attackbox here** sprite('Action_190_17', 2) # 116-117 Unknown1084(1) sprite('Action_190_18', 2) # 118-119 teleportRelativeX(20000) sprite('Action_190_19', 2) # 120-121 teleportRelativeX(20000) sprite('Action_190_20', 2) # 122-123 SFX_3('SE_SwingLightSword') teleportRelativeX(20000) sprite('Action_190_21', 3) # 124-126 **attackbox here** teleportRelativeX(20000) RefreshMultihit() SFX_0('010_swing_sword_2') sprite('Action_190_22', 4) # 127-130 **attackbox here** Unknown1084(1) teleportRelativeX(20000) sprite('Action_190_23', 6) # 131-136 **attackbox here** teleportRelativeX(20000) RefreshMultihit() AirPushbackX(5000) AirPushbackY(28000) YImpluseBeforeWallbounce(900) sprite('Action_190_24', 6) # 137-142 **attackbox here** teleportRelativeX(20000) sprite('Action_190_25', 7) # 143-149 physicsXImpulse(0) sprite('Action_190_26', 10) # 150-159 tag_voice(0, 'uli251_0', 'uli251_1', '', '') sprite('Action_190_27', 2) # 160-161 Unknown11057(1000) GFX_0('UltimateSlash', 100) Unknown2015(-1) SFX_3('SE_BigBomb') sprite('Action_190_28', 4) # 162-165 **attackbox here** Unknown11001(0, 0, 0) AirPushbackX(25000) AirPushbackY(-45000) Unknown30055('305705003200000000000000') Hitstop(0) Damage(170) RefreshMultihit() sprite('Action_190_29', 28) # 166-193 GFX_0('UltimateLightwallDDD', 0) setInvincible(0) setInvincibleFor(0) clearUponHandler(78) sprite('Action_190_30', 2) # 194-195 sprite('Action_190_31', 6) # 196-201 sprite('Action_190_32', 3) # 202-204 sprite('Action_190_33', 5) # 205-209 sprite('Action_190_34', 3) # 210-212 sprite('Action_190_35', 6) # 213-218 Unknown21012('556c74696d6174654c6967687477616c6c45666600000000000000000000000029000000') sprite('Action_190_36', 3) # 219-221 sprite('Action_190_37', 4) # 222-225 **attackbox here** SFX_3('SE_SwingLightSword') GroundedHitstunAnimation(10) AirHitstunAnimation(10) GFX_0('UltimateAssaultFinish', 100) AirPushbackX(1000) AirPushbackY(20000) sprite('Action_190_38', 31) # 226-256 sprite('Action_190_39', 4) # 257-260 sprite('Action_190_40', 6) # 261-266 sprite('Action_190_41', 3) # 267-269 sprite('Action_190_42', 3) # 270-272 sprite('Action_190_43', 3) # 273-275 @State def AN_CmnActChangePartnerDDODExe(): def upon_IMMEDIATE(): AttackDefaults_StandingDD() Unknown23056('') AttackLevel_(4) Damage(100) MinimumDamagePct(100) AttackP1(100) AttackP2(100) GroundedHitstunAnimation(10) AirHitstunAnimation(10) AirPushbackX(5000) AirPushbackY(4500) Unknown30056('a08601003200000000000000') YImpluseBeforeWallbounce(700) AirUntechableTime(100) Unknown9310(1) Hitstop(0) Unknown11001(5, 5, 5) Unknown11056(2) Unknown11064(1) Unknown9016(1) Unknown11057(800) Unknown1084(1) Unknown30063(1) GFX_0('UltimateRushEffOD', 100) def upon_78(): Unknown2037(1) setInvincible(0) setInvincibleFor(60) sprite('Lin392_00', 5) # 1-5 setInvincible(1) sprite('Action_189_01', 8) # 6-13 SFX_3('SE_ApperLightBlade') sprite('Action_189_02', 7) # 14-20 sprite('Action_189_03', 6) # 21-26 sprite('Action_189_04', 5) # 27-31 sprite('Action_189_05', 4) # 32-35 sprite('Action_189_06', 4) # 36-39 sprite('Action_189_07', 4) # 40-43 sprite('Action_189_08', 3) # 44-46 sprite('Action_189_09', 3) # 47-49 Unknown2015(200) sprite('Action_190_00', 5) # 50-54 sprite('Action_190_01', 5) # 55-59 teleportRelativeX(20000) sprite('Action_190_02', 4) # 60-63 sprite('Action_190_03', 4) # 64-67 sprite('Action_190_04', 4) # 68-71 physicsXImpulse(5000) Unknown1028(-50) SFX_3('SE_SwingLightSword') sprite('Action_190_05duo', 4) # 72-75 **attackbox here** RefreshMultihit() sprite('Action_190_06', 3) # 76-78 **attackbox here** sprite('Action_190_07', 3) # 79-81 **attackbox here** RefreshMultihit() sprite('Action_190_08', 4) # 82-85 **attackbox here** sprite('Action_190_00', 2) # 86-87 if (not SLOT_2): setInvincible(0) sprite('Action_190_01', 2) # 88-89 sprite('Action_190_02', 2) # 90-91 sprite('Action_190_03', 2) # 92-93 sprite('Action_190_04', 2) # 94-95 SFX_3('SE_SwingLightSword') sprite('Action_190_05', 2) # 96-97 **attackbox here** RefreshMultihit() sprite('Action_190_06', 2) # 98-99 **attackbox here** sprite('Action_190_07', 2) # 100-101 **attackbox here** RefreshMultihit() sprite('Action_190_08', 2) # 102-103 **attackbox here** sprite('Action_190_01', 2) # 104-105 sprite('Action_190_02', 2) # 106-107 sprite('Action_190_03', 2) # 108-109 sprite('Action_190_04', 2) # 110-111 SFX_3('SE_SwingLightSword') sprite('Action_190_05', 2) # 112-113 **attackbox here** RefreshMultihit() sprite('Action_190_06', 2) # 114-115 **attackbox here** sprite('Action_190_07', 2) # 116-117 **attackbox here** RefreshMultihit() sprite('Action_190_08', 2) # 118-119 **attackbox here** sprite('Action_190_01', 2) # 120-121 sprite('Action_190_02', 2) # 122-123 sprite('Action_190_03', 2) # 124-125 sprite('Action_190_04', 2) # 126-127 SFX_3('SE_SwingLightSword') sprite('Action_190_05', 2) # 128-129 **attackbox here** RefreshMultihit() sprite('Action_190_06', 2) # 130-131 **attackbox here** sprite('Action_190_07', 2) # 132-133 **attackbox here** RefreshMultihit() sprite('Action_190_08', 2) # 134-135 **attackbox here** sprite('Action_190_01', 2) # 136-137 sprite('Action_190_02', 2) # 138-139 sprite('Action_190_03', 2) # 140-141 sprite('Action_190_04', 2) # 142-143 SFX_3('SE_SwingLightSword') sprite('Action_190_05', 2) # 144-145 **attackbox here** RefreshMultihit() sprite('Action_190_06', 2) # 146-147 **attackbox here** sprite('Action_190_07', 2) # 148-149 **attackbox here** RefreshMultihit() sprite('Action_190_08', 2) # 150-151 **attackbox here** sprite('Action_190_09', 2) # 152-153 sprite('Action_190_10', 2) # 154-155 sprite('Action_190_11', 2) # 156-157 sprite('Action_190_12', 2) # 158-159 SFX_3('SE_SwingLightSword') sprite('Action_190_13', 2) # 160-161 **attackbox here** RefreshMultihit() sprite('Action_190_14', 2) # 162-163 **attackbox here** sprite('Action_190_15', 2) # 164-165 **attackbox here** RefreshMultihit() sprite('Action_190_16', 2) # 166-167 **attackbox here** sprite('Action_190_17', 2) # 168-169 Unknown1084(1) sprite('Action_190_18', 2) # 170-171 teleportRelativeX(20000) sprite('Action_190_19', 2) # 172-173 teleportRelativeX(20000) sprite('Action_190_20', 2) # 174-175 teleportRelativeX(20000) SFX_3('SE_SwingLightSword') sprite('Action_190_21', 3) # 176-178 **attackbox here** teleportRelativeX(20000) RefreshMultihit() sprite('Action_190_22', 4) # 179-182 **attackbox here** teleportRelativeX(20000) sprite('Action_190_23', 6) # 183-188 **attackbox here** teleportRelativeX(20000) RefreshMultihit() AirPushbackX(5000) AirPushbackY(28000) YImpluseBeforeWallbounce(900) sprite('Action_190_24', 6) # 189-194 **attackbox here** teleportRelativeX(20000) sprite('Action_190_25', 7) # 195-201 physicsXImpulse(0) sprite('Action_190_26', 10) # 202-211 tag_voice(0, 'uli251_0', 'uli251_1', '', '') sprite('Action_190_27', 2) # 212-213 Unknown11057(1000) GFX_0('UltimateSlashOD', 100) SFX_3('SE_BigBomb') Unknown2015(-1) sprite('Action_190_28', 4) # 214-217 **attackbox here** Unknown11001(0, 0, 0) AirPushbackX(25000) AirPushbackY(-45000) Unknown30055('305705003200000000000000') Hitstop(0) RefreshMultihit() sprite('Action_190_29', 38) # 218-255 GFX_0('UltimateLightwallDDDOD', 0) setInvincible(0) setInvincibleFor(0) clearUponHandler(78) sprite('Action_190_30', 2) # 256-257 sprite('Action_190_31', 6) # 258-263 sprite('Action_190_32', 3) # 264-266 sprite('Action_190_33', 5) # 267-271 sprite('Action_190_34', 3) # 272-274 sprite('Action_190_35', 6) # 275-280 sprite('Action_190_36', 3) # 281-283 sprite('Action_190_37', 4) # 284-287 **attackbox here** SFX_3('SE_SwingLightSword') GFX_0('UltimateAssaultFinish', 100) GroundedHitstunAnimation(10) AirHitstunAnimation(10) AirPushbackX(1000) AirPushbackY(20000) sprite('Action_190_38', 36) # 288-323 Unknown21012('556c74696d6174654c6967687477616c6c4566664f440000000000000000000029000000') sprite('Action_190_39', 4) # 324-327 sprite('Action_190_40', 6) # 328-333 sprite('Action_190_41', 4) # 334-337 sprite('Action_190_42', 4) # 338-341 sprite('Action_190_43', 3) # 342-344 @State def CmnActChangePartnerBurst(): def upon_IMMEDIATE(): Unknown17021('') def upon_41(): clearUponHandler(41) sendToLabel(0) def upon_LANDING(): clearUponHandler(2) sendToLabel(9) sprite('null', 120) # 1-120 label(0) sprite('null', 5) # 121-125 sprite('Action_146_01', 6) # 126-131 Unknown1086(22) teleportRelativeX(-150000) Unknown1007(2400000) physicsYImpulse(-96000) setGravity(0) Unknown2053(1) sprite('Action_146_02', 3) # 132-134 SFX_0('004_swing_grap_1_1') SFX_0('000_airdash_2') label(1) sprite('Action_146_03ex', 3) # 135-137 **attackbox here** sprite('Action_146_04ex', 3) # 138-140 **attackbox here** loopRest() gotoLabel(1) label(9) sprite('keep', 3) # 141-143 Unknown1084(1) sprite('Action_146_05', 5) # 144-148 Unknown8000(100, 1, 1) sprite('Action_146_06', 18) # 149-166 sprite('Action_146_07', 5) # 167-171 @Subroutine def MouthTableInit(): Unknown18011('uli000', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli500', 12643, 14177, 14179, 14177, 13411, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli500', '001') Unknown18011('uli501', 12643, 14177, 14179, 14177, 13411, 24887, 25399, 24887, 25399, 12337, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli501', '002') Unknown18011('uli502', 12643, 14177, 12643, 24884, 25399, 24887, 25399, 24887, 25399, 14131, 14177, 14179, 14177, 14179, 14177, 13411, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli502', '003') Unknown18011('uli503', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli503', '004') Unknown18011('uli504', 12643, 14177, 12643, 24884, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 14133, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli504', '005') Unknown18011('uli505', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13411, 24885, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli505', '006') Unknown18011('uli520', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13411, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 14131, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli520', '007') Unknown18011('uli521', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli521', '008') Unknown18011('uli522', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13667, 24887, 25399, 24887, 25399, 12337, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli522', '009') Unknown18011('uli523', 12643, 14177, 12643, 24880, 25399, 24887, 12337, 14179, 14177, 14179, 12641, 25392, 24887, 25399, 24887, 25399, 24887, 25399, 14132, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli523', '010') Unknown18011('uli524', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13155, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli524', '011') Unknown18011('uli525', 12643, 14177, 14179, 14177, 13411, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli525', '012') Unknown18011('uli402_0', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli402_1', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli403_0', 12643, 14177, 14179, 14177, 12643, 24882, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli403_1', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601bes', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13155, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli600bha', 12643, 14177, 14179, 14177, 14179, 14177, 13411, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601bpt', 12643, 14177, 14179, 14177, 13667, 24882, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli600brc', 12643, 14177, 14179, 14177, 13667, 24882, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli600pla', 12643, 14177, 12643, 24880, 25399, 24887, 25399, 24887, 25399, 14131, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601pyo', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13155, 24880, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601uhy', 12643, 14177, 13411, 24887, 25399, 13105, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 12899, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli600umi', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13155, 24887, 25399, 24887, 25399, 24887, 25399, 12337, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601uor', 12643, 12641, 25396, 14132, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13411, 24882, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli600uva', 12643, 14177, 14179, 14177, 14179, 14177, 12899, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 14132, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601uwa', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13411, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601bce', 13155, 14433, 14435, 14433, 14435, 14433, 14435, 14433, 13155, 24885, 25400, 13366, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601use', 13155, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13411, 24881, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli600pel', 12643, 14433, 14435, 14433, 14435, 14433, 14435, 14433, 13411, 24885, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601uhi', 12643, 14177, 14179, 14177, 14179, 14177, 13155, 24889, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli600bha', '017') Unknown30092('uli600brc', '018') Unknown30092('uli600pla', '019') Unknown30092('uli600umi', '020') Unknown30092('uli600uva', '021') Unknown30092('uli601bes', '022') Unknown30092('uli601bpt', '023') Unknown30092('uli601pyo', '024') Unknown30092('uli601uhy', '025') Unknown30092('uli601uor', '026') Unknown30092('uli601uwa', '027') Unknown30092('uli601bce', '028') Unknown30092('uli601use', '029') Unknown30092('uli600pel', '030') Unknown30092('uli601uhi', '031') Unknown18011('uli701bes', 12643, 12641, 25392, 12340, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701bha', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13411, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700bpt', 12643, 12641, 25394, 12341, 14177, 13155, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701brc', 12643, 12641, 25392, 14133, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700pla', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701pyo', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700uhy', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 12899, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700umi', 12643, 14177, 14179, 24880, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 12849, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701uor', 12643, 14177, 13155, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700uva', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13411, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701uwa', 12643, 14177, 12643, 24882, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 14131, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 12899, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 12594, 12643, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli703pyo', 12643, 14177, 12899, 24880, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701bce', 12899, 14177, 13667, 24885, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701use', 13155, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700pel', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13155, 24888, 25398, 24886, 25398, 24886, 25398, 24886, 25398, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700uhi', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13155, 24884, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown30092('uli700bpt', '032') Unknown30092('uli700pla', '033') Unknown30092('uli700uhy', '034') Unknown30092('uli700umi', '035') Unknown30092('uli700uva', '036') Unknown30092('uli701bes', '037') Unknown30092('uli701bha', '038') Unknown30092('uli701brc', '039') Unknown30092('uli701pyo', '040') Unknown30092('uli701uor', '041') Unknown30092('uli701uwa', '042') Unknown30092('uli703pyo', '043') Unknown30092('uli701bce', '044') Unknown30092('uli701use', '045') Unknown30092('uli700pel', '046') Unknown30092('uli700uhi', '047') if SLOT_172: Unknown18011('uli000', 12643, 12899, 14177, 14179, 14177, 14179, 14177, 12899, 12643, 14177, 14179, 13409, 12643, 14177, 14179, 14177, 14179, 13667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli500', 12643, 14177, 14179, 14177, 14179, 14177, 13411, 13155, 24880, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 25396, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli501', 12643, 12899, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 13409, 12899, 24885, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 25395, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli502', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13667, 13667, 24880, 25399, 24887, 25399, 24887, 25395, 24882, 25399, 25399, 24882, 25399, 24887, 25399, 25394, 12594, 14177, 13155, 14177, 14179, 14177, 13155, 13411, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli503', 12643, 13155, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 12643, 12643, 14177, 14179, 14177, 14179, 13409, 12643, 14177, 14179, 13921, 12643, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli504', 12643, 13667, 14177, 14179, 12897, 12899, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 12641, 13411, 24880, 25399, 24887, 25399, 24887, 25396, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli505', 12643, 13155, 14177, 14179, 14177, 14179, 13665, 12899, 14177, 12899, 13411, 24880, 25399, 24887, 25399, 24887, 25399, 24887, 25397, 24882, 25396, 24883, 25399, 24886, 25399, 25399, 24882, 25399, 24887, 25399, 24887, 25399, 25398, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli520', 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 13411, 24887, 25399, 24887, 25399, 25395, 24882, 25399, 24887, 25399, 25395, 24881, 25399, 24887, 25399, 24887, 25398, 24882, 25399, 24887, 25395, 24883, 25399, 24887, 25399, 25393, 24881, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 25394, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli521', 12643, 12643, 14177, 14179, 14177, 13667, 14177, 14179, 14177, 14179, 14177, 13667, 13667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli522', 12643, 12643, 14177, 14179, 13665, 12643, 14177, 14179, 14177, 14179, 13665, 12899, 13665, 13411, 24885, 25399, 24887, 25399, 24887, 25399, 25396, 24882, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 25397, 14385, 14177, 14179, 14177, 14179, 14177, 13923, 13667, 14177, 13923, 13155, 14177, 13411, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli523', 12643, 12643, 14177, 14179, 12643, 14177, 14179, 14177, 14179, 14177, 13667, 12643, 14177, 14179, 13153, 12899, 14177, 14179, 14177, 14179, 13409, 12899, 14177, 13923, 13665, 12899, 24881, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25393, 24881, 25399, 24887, 25393, 24881, 25399, 24887, 25394, 24883, 25399, 24887, 25399, 24887, 25399, 25396, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli524', 12643, 13155, 14177, 14179, 14177, 14179, 14177, 14179, 13411, 24884, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 25396, 24881, 25399, 24887, 25397, 12849, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli525', 12643, 12643, 14177, 14179, 14177, 13411, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 12899, 13411, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli402_0', 12643, 14177, 14179, 14177, 14179, 13155, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 13665, 13411, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli402_1', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 13411, 13411, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli403_0', 12643, 12643, 14177, 13411, 13155, 24880, 25399, 24887, 25399, 24887, 25399, 24887, 25396, 24884, 25399, 25397, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli403_1', 12643, 12899, 14177, 14179, 14177, 13155, 12643, 14177, 13923, 13155, 14177, 14179, 14177, 14179, 14177, 12899, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601bes', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 12899, 24888, 25399, 24887, 25399, 25397, 24882, 25399, 24881, 25399, 24887, 25399, 24887, 25401, 25399, 25395, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli600bha', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 13411, 24885, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25394, 24881, 25399, 24887, 25399, 25397, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601bpt', 12643, 13155, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13923, 13155, 24886, 25399, 24887, 25399, 24887, 25399, 25397, 24883, 25399, 24887, 25394, 24882, 25399, 24887, 25399, 25396, 12337, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli600brc', 12643, 12643, 14177, 14179, 12899, 14177, 12643, 12643, 24887, 25399, 24887, 25399, 24883, 25399, 24883, 25399, 24887, 25396, 24881, 25399, 25399, 24883, 25399, 24887, 25399, 25399, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli600pla', 12643, 12643, 14177, 14179, 14177, 13155, 12899, 14177, 13667, 12643, 14177, 14179, 14177, 13923, 12899, 24881, 25399, 24887, 25399, 25393, 24881, 25399, 24887, 25399, 24887, 25399, 25395, 24881, 25399, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601pyo', 12643, 12643, 14177, 14179, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 13411, 24886, 25399, 24887, 25399, 25399, 24883, 25399, 24887, 25399, 25399, 24881, 25399, 24887, 12849, 14179, 13923, 12643, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601uhy', 12643, 13667, 14177, 13923, 13667, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 25395, 24881, 25399, 24887, 25399, 25393, 12337, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli600umi', 12643, 12643, 14177, 14179, 13665, 13411, 14177, 14179, 14177, 14179, 14177, 13923, 13155, 14177, 14179, 14177, 12899, 12899, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 25396, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601uor', 12643, 12643, 14177, 14179, 13921, 13155, 24880, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 25393, 14385, 14177, 14179, 13665, 12643, 14177, 14179, 14177, 14179, 14177, 12899, 12643, 12641, 12899, 13409, 12899, 14177, 14179, 14177, 14179, 13921, 13411, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli600uva', 12643, 12643, 14177, 14179, 14177, 14179, 13921, 13923, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13411, 13155, 24889, 25399, 24887, 25399, 24882, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25395, 24885, 12849, 14179, 14179, 14435, 12643, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601uwa', 12643, 12643, 14177, 13667, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 12899, 12899, 14177, 12899, 13411, 14177, 14179, 14177, 14179, 12641, 12899, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13155, 14179, 13923, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601bce', 12643, 12643, 14177, 14179, 12897, 12899, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13155, 13411, 24881, 25399, 24887, 25395, 24882, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 25398, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601use', 12643, 12643, 14177, 14179, 14177, 14179, 13153, 13411, 14177, 14179, 13665, 13667, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 12643, 14177, 13923, 12899, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli600pel', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 12897, 12899, 14177, 14179, 12897, 12643, 14433, 14179, 13923, 12643, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli601uhi', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 12899, 14177, 14179, 13665, 12643, 13409, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13155, 12899, 14177, 12643, 13923, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701bes', 12643, 12643, 14177, 14179, 14177, 13411, 13155, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 13411, 14177, 14179, 14177, 14179, 14177, 12899, 13923, 12643, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701bha', 12643, 13155, 14177, 12899, 13155, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 13409, 12643, 24887, 25399, 24887, 25399, 24887, 25399, 25398, 24882, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 25398, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700bpt', 12643, 12643, 14177, 14179, 14177, 12643, 12643, 12641, 13155, 24887, 25399, 24887, 25399, 25397, 24884, 25399, 25394, 24881, 25399, 24887, 25399, 24881, 25399, 25393, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701brc', 12643, 12643, 14177, 14179, 14177, 13667, 12643, 24881, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24881, 25399, 25394, 24883, 25399, 24887, 25399, 25398, 24882, 25398, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700pla', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13923, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701pyo', 12643, 12643, 14177, 14179, 14177, 13411, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 12641, 25392, 25399, 25397, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700uhy', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 12643, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 13921, 12643, 14177, 13155, 12643, 14177, 14179, 14177, 14179, 14177, 13667, 12899, 14177, 12899, 13667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700umi', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 13409, 12643, 14177, 14179, 14177, 14179, 12643, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701uor', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 12897, 12643, 14177, 14179, 14177, 13411, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13923, 12643, 14177, 14179, 14177, 14179, 12641, 25394, 25396, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700uva', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 13153, 13155, 14177, 14179, 14177, 13155, 12643, 14177, 14179, 14177, 13155, 12899, 14689, 14179, 14179, 12643, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701uwa', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14435, 12641, 25393, 24887, 25399, 12593, 14433, 14179, 14177, 12643, 24880, 25399, 24887, 13105, 12643, 24880, 12849, 12643, 24880, 25399, 24887, 13361, 12643, 24887, 25399, 24887, 25399, 24887, 25399, 24884, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 25398, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli703pyo', 12643, 13155, 14177, 12643, 12643, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25397, 24883, 25399, 25393, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701bce', 12643, 14177, 14179, 12641, 13411, 24883, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 25394, 24882, 25399, 25393, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli701use', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 13923, 13923, 14177, 14179, 14177, 14179, 13153, 13667, 14177, 14179, 14177, 14179, 14177, 13667, 13923, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700pel', 12643, 12643, 14177, 14179, 13921, 12899, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 12643, 12643, 24880, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 24887, 25399, 25395, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Unknown18011('uli700uhi', 12643, 12643, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 14177, 14179, 13409, 12643, 14177, 12643, 13155, 14177, 14179, 14177, 13667, 13411, 14177, 14179, 14177, 14179, 14177, 13155, 13667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) @State def CmnActEntry(): label(0) sprite('null', 1) # 1-1 loopRest() if SLOT_17: _gotolabel(0) if SLOT_169: _gotolabel(482) if SLOT_122: _gotolabel(482) if SLOT_123: _gotolabel(482) PartnerChar('brc') if SLOT_ReturnVal: _gotolabel(100) PartnerChar('bha') if SLOT_ReturnVal: _gotolabel(110) PartnerChar('bpt') if SLOT_ReturnVal: _gotolabel(120) PartnerChar('bes') if SLOT_ReturnVal: _gotolabel(130) PartnerChar('pyo') if SLOT_ReturnVal: _gotolabel(140) PartnerChar('uhy') if SLOT_ReturnVal: _gotolabel(150) PartnerChar('uwa') if SLOT_ReturnVal: _gotolabel(160) PartnerChar('uor') if SLOT_ReturnVal: _gotolabel(170) PartnerChar('uva') if SLOT_ReturnVal: _gotolabel(180) PartnerChar('pla') if SLOT_ReturnVal: _gotolabel(190) PartnerChar('umi') if SLOT_ReturnVal: _gotolabel(200) PartnerChar('bce') if SLOT_ReturnVal: _gotolabel(210) PartnerChar('use') if SLOT_ReturnVal: _gotolabel(220) PartnerChar('uhi') if SLOT_ReturnVal: _gotolabel(230) PartnerChar('pel') if SLOT_ReturnVal: _gotolabel(240) label(482) Unknown19(991, 2, 158) sprite('Action_050_02', 5) # 2-6 **attackbox here** Unknown23029(11, 9902, 0) if SLOT_158: if random_(2, 0, 50): Unknown7006('uli500', 100, 896101493, 12592, 0, 0, 100, 896101493, 12848, 0, 0, 100, 0, 0, 0, 0, 0) else: Unknown7006('uli503', 100, 896101493, 13360, 0, 0, 100, 896101493, 13616, 0, 0, 100, 0, 0, 0, 0, 0) sprite('Action_050_03', 5) # 7-11 **attackbox here** sprite('Action_050_04', 5) # 12-16 **attackbox here** label(1) sprite('Action_050_02', 5) # 17-21 **attackbox here** sprite('Action_050_03', 5) # 22-26 **attackbox here** sprite('Action_050_04', 5) # 27-31 **attackbox here** if SLOT_97: _gotolabel(1) sprite('Action_050_05', 7) # 32-38 sprite('Action_050_06', 9) # 39-47 sprite('Action_050_07', 4) # 48-51 sprite('Action_050_08', 5) # 52-56 SFX_0('019_cloth_a') sprite('Action_050_09', 8) # 57-64 sprite('Action_050_10', 7) # 65-71 sprite('Action_050_11', 6) # 72-77 **attackbox here** sprite('Action_050_12', 5) # 78-82 **attackbox here** sprite('Action_050_13', 5) # 83-87 **attackbox here** Unknown23018(1) sprite('Action_050_14', 20) # 88-107 **attackbox here** sprite('Action_050_15', 5) # 108-112 SFX_0('019_cloth_c') sprite('Action_050_16', 4) # 113-116 sprite('Action_050_17', 5) # 117-121 SFX_3('SE010') sprite('Action_050_18', 5) # 122-126 sprite('Action_050_19', 2) # 127-128 loopRest() ExitState() label(10) sprite('Action_000_25', 32767) # 129-32895 **attackbox here** SFX_1('uli700umi') label(100) sprite('Action_000_15', 7) # 32896-32902 **attackbox here** if SLOT_158: Unknown1000(-1230000) else: Unknown1000(-1465000) Unknown23029(11, 9902, 0) sprite('Action_000_16', 4) # 32903-32906 **attackbox here** SFX_1('uli600brc') sprite('Action_000_17', 7) # 32907-32913 **attackbox here** SFX_0('003_swing_grap_0_0') sprite('Action_000_18', 5) # 32914-32918 **attackbox here** sprite('Action_000_19', 8) # 32919-32926 **attackbox here** sprite('Action_000_20', 10) # 32927-32936 **attackbox here** sprite('Action_000_21', 5) # 32937-32941 **attackbox here** sprite('Action_000_22', 7) # 32942-32948 **attackbox here** SFX_FOOTSTEP_(100, 0, 1) sprite('Action_000_23', 3) # 32949-32951 **attackbox here** sprite('Action_000_24', 20) # 32952-32971 **attackbox here** label(101) sprite('Action_000_25', 1) # 32972-32972 **attackbox here** if SLOT_97: _gotolabel(101) sprite('Action_000_25', 30) # 32973-33002 **attackbox here** sprite('Action_000_26', 5) # 33003-33007 **attackbox here** Unknown21007(24, 40) sprite('Action_000_27', 8) # 33008-33015 **attackbox here** sprite('Action_000_28', 6) # 33016-33021 **attackbox here** sprite('Action_000_29', 4) # 33022-33025 **attackbox here** sprite('Action_000_30', 4) # 33026-33029 **attackbox here** SFX_0('008_swing_pole_0') sprite('Action_000_31', 6) # 33030-33035 **attackbox here** sprite('Action_000_32', 7) # 33036-33042 Unknown21011(240) label(102) sprite('Action_000_00', 7) # 33043-33049 **attackbox here** sprite('Action_000_01', 7) # 33050-33056 **attackbox here** sprite('Action_000_02', 6) # 33057-33062 **attackbox here** sprite('Action_000_03', 6) # 33063-33068 **attackbox here** sprite('Action_000_04', 8) # 33069-33076 **attackbox here** sprite('Action_000_05', 5) # 33077-33081 **attackbox here** sprite('Action_000_06', 5) # 33082-33086 **attackbox here** sprite('Action_000_07', 5) # 33087-33091 **attackbox here** sprite('Action_000_08', 6) # 33092-33097 **attackbox here** sprite('Action_000_09', 5) # 33098-33102 **attackbox here** sprite('Action_000_10', 6) # 33103-33108 **attackbox here** sprite('Action_000_11', 8) # 33109-33116 **attackbox here** sprite('Action_000_12', 5) # 33117-33121 **attackbox here** sprite('Action_000_13', 5) # 33122-33126 **attackbox here** sprite('Action_000_14', 6) # 33127-33132 **attackbox here** gotoLabel(102) ExitState() label(110) sprite('Action_050_02', 5) # 33133-33137 **attackbox here** Unknown23029(11, 9902, 0) if SLOT_158: Unknown1000(-1230000) else: Unknown1000(-1465000) SFX_1('uli600bha') sprite('Action_050_03', 5) # 33138-33142 **attackbox here** sprite('Action_050_04', 5) # 33143-33147 **attackbox here** label(111) sprite('Action_050_02', 5) # 33148-33152 **attackbox here** sprite('Action_050_03', 5) # 33153-33157 **attackbox here** sprite('Action_050_04', 5) # 33158-33162 **attackbox here** if SLOT_97: _gotolabel(111) sprite('Action_050_05', 7) # 33163-33169 sprite('Action_050_06', 9) # 33170-33178 sprite('Action_050_07', 4) # 33179-33182 sprite('Action_050_08', 5) # 33183-33187 SFX_0('019_cloth_a') sprite('Action_050_09', 8) # 33188-33195 sprite('Action_050_10', 7) # 33196-33202 sprite('Action_050_11', 6) # 33203-33208 **attackbox here** sprite('Action_050_12', 5) # 33209-33213 **attackbox here** sprite('Action_050_13', 5) # 33214-33218 **attackbox here** sprite('Action_050_14', 20) # 33219-33238 **attackbox here** sprite('Action_050_15', 5) # 33239-33243 SFX_0('019_cloth_c') sprite('Action_050_16', 4) # 33244-33247 sprite('Action_050_17', 5) # 33248-33252 SFX_3('SE010') sprite('Action_050_18', 5) # 33253-33257 Unknown21007(24, 40) sprite('Action_050_19', 2) # 33258-33259 Unknown21011(420) label(112) sprite('Action_000_00', 7) # 33260-33266 **attackbox here** sprite('Action_000_01', 7) # 33267-33273 **attackbox here** sprite('Action_000_02', 6) # 33274-33279 **attackbox here** sprite('Action_000_03', 6) # 33280-33285 **attackbox here** sprite('Action_000_04', 8) # 33286-33293 **attackbox here** sprite('Action_000_05', 5) # 33294-33298 **attackbox here** sprite('Action_000_06', 5) # 33299-33303 **attackbox here** sprite('Action_000_07', 5) # 33304-33308 **attackbox here** sprite('Action_000_08', 6) # 33309-33314 **attackbox here** sprite('Action_000_09', 5) # 33315-33319 **attackbox here** sprite('Action_000_10', 6) # 33320-33325 **attackbox here** sprite('Action_000_11', 8) # 33326-33333 **attackbox here** sprite('Action_000_12', 5) # 33334-33338 **attackbox here** sprite('Action_000_13', 5) # 33339-33343 **attackbox here** sprite('Action_000_14', 6) # 33344-33349 **attackbox here** gotoLabel(112) ExitState() label(120) sprite('Action_050_02', 1) # 33350-33350 **attackbox here** Unknown23029(11, 9902, 0) if SLOT_158: Unknown1000(-1230000) else: Unknown1000(-1465000) def upon_40(): clearUponHandler(40) sendToLabel(122) SFX_1('uli601bpt') label(121) sprite('Action_050_02', 5) # 33351-33355 **attackbox here** sprite('Action_050_03', 5) # 33356-33360 **attackbox here** sprite('Action_050_04', 5) # 33361-33365 **attackbox here** gotoLabel(121) label(122) sprite('Action_050_02', 5) # 33366-33370 **attackbox here** sprite('Action_050_03', 5) # 33371-33375 **attackbox here** sprite('Action_050_04', 5) # 33376-33380 **attackbox here** if SLOT_97: _gotolabel(122) sprite('Action_050_05', 7) # 33381-33387 sprite('Action_050_06', 9) # 33388-33396 sprite('Action_050_07', 4) # 33397-33400 sprite('Action_050_08', 5) # 33401-33405 SFX_0('019_cloth_a') sprite('Action_050_09', 8) # 33406-33413 sprite('Action_050_10', 7) # 33414-33420 sprite('Action_050_11', 6) # 33421-33426 **attackbox here** sprite('Action_050_12', 5) # 33427-33431 **attackbox here** sprite('Action_050_13', 5) # 33432-33436 **attackbox here** sprite('Action_050_14', 20) # 33437-33456 **attackbox here** sprite('Action_050_15', 5) # 33457-33461 SFX_0('019_cloth_c') sprite('Action_050_16', 4) # 33462-33465 sprite('Action_050_17', 5) # 33466-33470 SFX_3('SE010') sprite('Action_050_18', 5) # 33471-33475 sprite('Action_050_19', 2) # 33476-33477 Unknown21011(120) label(123) sprite('Action_000_00', 7) # 33478-33484 **attackbox here** sprite('Action_000_01', 7) # 33485-33491 **attackbox here** sprite('Action_000_02', 6) # 33492-33497 **attackbox here** sprite('Action_000_03', 6) # 33498-33503 **attackbox here** sprite('Action_000_04', 8) # 33504-33511 **attackbox here** sprite('Action_000_05', 5) # 33512-33516 **attackbox here** sprite('Action_000_06', 5) # 33517-33521 **attackbox here** sprite('Action_000_07', 5) # 33522-33526 **attackbox here** sprite('Action_000_08', 6) # 33527-33532 **attackbox here** sprite('Action_000_09', 5) # 33533-33537 **attackbox here** sprite('Action_000_10', 6) # 33538-33543 **attackbox here** sprite('Action_000_11', 8) # 33544-33551 **attackbox here** sprite('Action_000_12', 5) # 33552-33556 **attackbox here** sprite('Action_000_13', 5) # 33557-33561 **attackbox here** sprite('Action_000_14', 6) # 33562-33567 **attackbox here** gotoLabel(123) ExitState() label(130) sprite('Action_000_00', 1) # 33568-33568 **attackbox here** Unknown23029(11, 9902, 0) if SLOT_158: Unknown1000(-1230000) else: Unknown1000(-1465000) def upon_40(): clearUponHandler(40) sendToLabel(132) label(131) sprite('Action_000_00', 7) # 33569-33575 **attackbox here** sprite('Action_000_01', 7) # 33576-33582 **attackbox here** sprite('Action_000_02', 6) # 33583-33588 **attackbox here** sprite('Action_000_03', 6) # 33589-33594 **attackbox here** sprite('Action_000_04', 8) # 33595-33602 **attackbox here** sprite('Action_000_05', 5) # 33603-33607 **attackbox here** sprite('Action_000_06', 5) # 33608-33612 **attackbox here** sprite('Action_000_07', 5) # 33613-33617 **attackbox here** sprite('Action_000_08', 6) # 33618-33623 **attackbox here** sprite('Action_000_09', 5) # 33624-33628 **attackbox here** sprite('Action_000_10', 6) # 33629-33634 **attackbox here** sprite('Action_000_11', 8) # 33635-33642 **attackbox here** sprite('Action_000_12', 5) # 33643-33647 **attackbox here** sprite('Action_000_13', 5) # 33648-33652 **attackbox here** sprite('Action_000_14', 6) # 33653-33658 **attackbox here** gotoLabel(131) label(132) sprite('Action_000_15', 7) # 33659-33665 **attackbox here** sprite('Action_000_16', 4) # 33666-33669 **attackbox here** SFX_1('uli601bes') sprite('Action_000_17', 7) # 33670-33676 **attackbox here** SFX_0('003_swing_grap_0_0') sprite('Action_000_18', 5) # 33677-33681 **attackbox here** sprite('Action_000_19', 8) # 33682-33689 **attackbox here** sprite('Action_000_20', 10) # 33690-33699 **attackbox here** sprite('Action_000_21', 5) # 33700-33704 **attackbox here** sprite('Action_000_22', 7) # 33705-33711 **attackbox here** SFX_FOOTSTEP_(100, 0, 1) sprite('Action_000_23', 3) # 33712-33714 **attackbox here** sprite('Action_000_24', 20) # 33715-33734 **attackbox here** label(133) sprite('Action_000_25', 1) # 33735-33735 **attackbox here** if SLOT_97: _gotolabel(133) sprite('Action_000_25', 30) # 33736-33765 **attackbox here** sprite('Action_000_26', 5) # 33766-33770 **attackbox here** sprite('Action_000_27', 8) # 33771-33778 **attackbox here** sprite('Action_000_28', 6) # 33779-33784 **attackbox here** sprite('Action_000_29', 4) # 33785-33788 **attackbox here** sprite('Action_000_30', 4) # 33789-33792 **attackbox here** SFX_0('008_swing_pole_0') sprite('Action_000_31', 6) # 33793-33798 **attackbox here** sprite('Action_000_32', 7) # 33799-33805 Unknown21011(120) label(134) sprite('Action_000_00', 7) # 33806-33812 **attackbox here** sprite('Action_000_01', 7) # 33813-33819 **attackbox here** sprite('Action_000_02', 6) # 33820-33825 **attackbox here** sprite('Action_000_03', 6) # 33826-33831 **attackbox here** sprite('Action_000_04', 8) # 33832-33839 **attackbox here** sprite('Action_000_05', 5) # 33840-33844 **attackbox here** sprite('Action_000_06', 5) # 33845-33849 **attackbox here** sprite('Action_000_07', 5) # 33850-33854 **attackbox here** sprite('Action_000_08', 6) # 33855-33860 **attackbox here** sprite('Action_000_09', 5) # 33861-33865 **attackbox here** sprite('Action_000_10', 6) # 33866-33871 **attackbox here** sprite('Action_000_11', 8) # 33872-33879 **attackbox here** sprite('Action_000_12', 5) # 33880-33884 **attackbox here** sprite('Action_000_13', 5) # 33885-33889 **attackbox here** sprite('Action_000_14', 6) # 33890-33895 **attackbox here** gotoLabel(134) ExitState() label(140) sprite('Action_050_02', 1) # 33896-33896 **attackbox here** Unknown23029(11, 9902, 0) if SLOT_158: Unknown1000(-1230000) else: Unknown1000(-1465000) def upon_40(): clearUponHandler(40) sendToLabel(142) SFX_1('uli601pyo') label(141) sprite('Action_050_02', 5) # 33897-33901 **attackbox here** sprite('Action_050_03', 5) # 33902-33906 **attackbox here** sprite('Action_050_04', 5) # 33907-33911 **attackbox here** gotoLabel(141) label(142) sprite('Action_050_02', 5) # 33912-33916 **attackbox here** sprite('Action_050_03', 5) # 33917-33921 **attackbox here** sprite('Action_050_04', 5) # 33922-33926 **attackbox here** if SLOT_97: _gotolabel(142) sprite('Action_050_05', 7) # 33927-33933 sprite('Action_050_06', 9) # 33934-33942 sprite('Action_050_07', 4) # 33943-33946 sprite('Action_050_08', 5) # 33947-33951 SFX_0('019_cloth_a') sprite('Action_050_09', 8) # 33952-33959 sprite('Action_050_10', 7) # 33960-33966 sprite('Action_050_11', 6) # 33967-33972 **attackbox here** sprite('Action_050_12', 5) # 33973-33977 **attackbox here** sprite('Action_050_13', 5) # 33978-33982 **attackbox here** sprite('Action_050_14', 20) # 33983-34002 **attackbox here** sprite('Action_050_15', 5) # 34003-34007 SFX_0('019_cloth_c') sprite('Action_050_16', 4) # 34008-34011 sprite('Action_050_17', 5) # 34012-34016 SFX_3('SE010') sprite('Action_050_18', 5) # 34017-34021 sprite('Action_050_19', 2) # 34022-34023 Unknown21011(60) label(143) sprite('Action_000_00', 7) # 34024-34030 **attackbox here** sprite('Action_000_01', 7) # 34031-34037 **attackbox here** sprite('Action_000_02', 6) # 34038-34043 **attackbox here** sprite('Action_000_03', 6) # 34044-34049 **attackbox here** sprite('Action_000_04', 8) # 34050-34057 **attackbox here** sprite('Action_000_05', 5) # 34058-34062 **attackbox here** sprite('Action_000_06', 5) # 34063-34067 **attackbox here** sprite('Action_000_07', 5) # 34068-34072 **attackbox here** sprite('Action_000_08', 6) # 34073-34078 **attackbox here** sprite('Action_000_09', 5) # 34079-34083 **attackbox here** sprite('Action_000_10', 6) # 34084-34089 **attackbox here** sprite('Action_000_11', 8) # 34090-34097 **attackbox here** sprite('Action_000_12', 5) # 34098-34102 **attackbox here** sprite('Action_000_13', 5) # 34103-34107 **attackbox here** sprite('Action_000_14', 6) # 34108-34113 **attackbox here** gotoLabel(143) ExitState() label(150) sprite('Action_000_00', 7) # 34114-34120 **attackbox here** Unknown1000(-1260000) Unknown2019(-1000) Unknown23029(11, 9902, 0) def upon_40(): clearUponHandler(40) SFX_1('uli601uhy') def upon_CLEAR_OR_EXIT(): if (not SLOT_97): clearUponHandler(3) Unknown21007(24, 40) sendToLabel(152) label(151) sprite('Action_000_01', 7) # 34121-34127 **attackbox here** sprite('Action_000_02', 6) # 34128-34133 **attackbox here** sprite('Action_000_03', 6) # 34134-34139 **attackbox here** sprite('Action_000_04', 8) # 34140-34147 **attackbox here** sprite('Action_000_05', 5) # 34148-34152 **attackbox here** sprite('Action_000_06', 5) # 34153-34157 **attackbox here** sprite('Action_000_07', 5) # 34158-34162 **attackbox here** sprite('Action_000_08', 6) # 34163-34168 **attackbox here** sprite('Action_000_09', 5) # 34169-34173 **attackbox here** sprite('Action_000_10', 6) # 34174-34179 **attackbox here** sprite('Action_000_11', 8) # 34180-34187 **attackbox here** sprite('Action_000_12', 5) # 34188-34192 **attackbox here** sprite('Action_000_13', 5) # 34193-34197 **attackbox here** sprite('Action_000_14', 6) # 34198-34203 **attackbox here** sprite('Action_000_00', 7) # 34204-34210 **attackbox here** gotoLabel(151) label(152) sprite('Action_190_34', 3) # 34211-34213 sprite('Action_190_35', 6) # 34214-34219 sprite('Action_190_36', 3) # 34220-34222 sprite('Action_190_37', 4) # 34223-34226 **attackbox here** sprite('Action_190_38', 60) # 34227-34286 sprite('Action_190_39', 4) # 34287-34290 sprite('Action_190_40', 6) # 34291-34296 sprite('Action_190_41', 3) # 34297-34299 sprite('Action_190_42', 3) # 34300-34302 sprite('Action_190_43', 3) # 34303-34305 Unknown21011(30) label(153) sprite('Action_000_00', 7) # 34306-34312 **attackbox here** sprite('Action_000_01', 7) # 34313-34319 **attackbox here** sprite('Action_000_02', 6) # 34320-34325 **attackbox here** sprite('Action_000_03', 6) # 34326-34331 **attackbox here** sprite('Action_000_04', 8) # 34332-34339 **attackbox here** sprite('Action_000_05', 5) # 34340-34344 **attackbox here** sprite('Action_000_06', 5) # 34345-34349 **attackbox here** sprite('Action_000_07', 5) # 34350-34354 **attackbox here** sprite('Action_000_08', 6) # 34355-34360 **attackbox here** sprite('Action_000_09', 5) # 34361-34365 **attackbox here** sprite('Action_000_10', 6) # 34366-34371 **attackbox here** sprite('Action_000_11', 8) # 34372-34379 **attackbox here** sprite('Action_000_12', 5) # 34380-34384 **attackbox here** sprite('Action_000_13', 5) # 34385-34389 **attackbox here** sprite('Action_000_14', 6) # 34390-34395 **attackbox here** gotoLabel(153) label(160) sprite('Lin637_00', 32767) # 34396-67162 **attackbox here** Unknown23029(11, 9902, 0) Unknown1000(-1150000) teleportRelativeY(240000) def upon_40(): clearUponHandler(40) sendToLabel(161) SFX_1('uli601uwa') label(161) sprite('Lin637_00', 1) # 67163-67163 **attackbox here** if SLOT_97: _gotolabel(161) sprite('Lin637_01', 6) # 67164-67169 sprite('Action_035_05', 6) # 67170-67175 physicsYImpulse(-1000) setGravity(1000) Unknown21007(24, 40) sendToLabelUpon(2, 163) sprite('Action_035_06', 6) # 67176-67181 label(162) sprite('Action_022_00', 3) # 67182-67184 sprite('Action_022_01', 3) # 67185-67187 gotoLabel(162) label(163) sprite('Action_023_00', 3) # 67188-67190 clearUponHandler(2) Unknown8000(100, 1, 1) sprite('Action_023_01', 3) # 67191-67193 sprite('Action_023_02', 3) # 67194-67196 Unknown21011(120) label(164) sprite('Action_000_00', 7) # 67197-67203 **attackbox here** sprite('Action_000_01', 7) # 67204-67210 **attackbox here** sprite('Action_000_02', 6) # 67211-67216 **attackbox here** sprite('Action_000_03', 6) # 67217-67222 **attackbox here** sprite('Action_000_04', 8) # 67223-67230 **attackbox here** sprite('Action_000_05', 5) # 67231-67235 **attackbox here** sprite('Action_000_06', 5) # 67236-67240 **attackbox here** sprite('Action_000_07', 5) # 67241-67245 **attackbox here** sprite('Action_000_08', 6) # 67246-67251 **attackbox here** sprite('Action_000_09', 5) # 67252-67256 **attackbox here** sprite('Action_000_10', 6) # 67257-67262 **attackbox here** sprite('Action_000_11', 8) # 67263-67270 **attackbox here** sprite('Action_000_12', 5) # 67271-67275 **attackbox here** sprite('Action_000_13', 5) # 67276-67280 **attackbox here** sprite('Action_000_14', 6) # 67281-67286 **attackbox here** gotoLabel(164) ExitState() label(170) sprite('Action_050_02', 1) # 67287-67287 **attackbox here** Unknown23029(11, 9902, 0) if SLOT_158: Unknown1000(-1230000) else: Unknown1000(-1465000) def upon_40(): clearUponHandler(40) sendToLabel(172) SFX_1('uli601uor') label(171) sprite('Action_050_02', 5) # 67288-67292 **attackbox here** sprite('Action_050_03', 5) # 67293-67297 **attackbox here** sprite('Action_050_04', 5) # 67298-67302 **attackbox here** gotoLabel(171) label(172) sprite('Action_050_02', 5) # 67303-67307 **attackbox here** sprite('Action_050_03', 5) # 67308-67312 **attackbox here** sprite('Action_050_04', 5) # 67313-67317 **attackbox here** if SLOT_97: _gotolabel(172) sprite('Action_050_05', 7) # 67318-67324 sprite('Action_050_06', 9) # 67325-67333 sprite('Action_050_07', 4) # 67334-67337 sprite('Action_050_08', 5) # 67338-67342 SFX_0('019_cloth_a') sprite('Action_050_09', 8) # 67343-67350 sprite('Action_050_10', 7) # 67351-67357 sprite('Action_050_11', 6) # 67358-67363 **attackbox here** sprite('Action_050_12', 5) # 67364-67368 **attackbox here** sprite('Action_050_13', 5) # 67369-67373 **attackbox here** sprite('Action_050_14', 20) # 67374-67393 **attackbox here** sprite('Action_050_15', 5) # 67394-67398 SFX_0('019_cloth_c') sprite('Action_050_16', 4) # 67399-67402 sprite('Action_050_17', 5) # 67403-67407 SFX_3('SE010') sprite('Action_050_18', 5) # 67408-67412 sprite('Action_050_19', 2) # 67413-67414 Unknown21011(120) label(173) sprite('Action_000_00', 7) # 67415-67421 **attackbox here** sprite('Action_000_01', 7) # 67422-67428 **attackbox here** sprite('Action_000_02', 6) # 67429-67434 **attackbox here** sprite('Action_000_03', 6) # 67435-67440 **attackbox here** sprite('Action_000_04', 8) # 67441-67448 **attackbox here** sprite('Action_000_05', 5) # 67449-67453 **attackbox here** sprite('Action_000_06', 5) # 67454-67458 **attackbox here** sprite('Action_000_07', 5) # 67459-67463 **attackbox here** sprite('Action_000_08', 6) # 67464-67469 **attackbox here** sprite('Action_000_09', 5) # 67470-67474 **attackbox here** sprite('Action_000_10', 6) # 67475-67480 **attackbox here** sprite('Action_000_11', 8) # 67481-67488 **attackbox here** sprite('Action_000_12', 5) # 67489-67493 **attackbox here** sprite('Action_000_13', 5) # 67494-67498 **attackbox here** sprite('Action_000_14', 6) # 67499-67504 **attackbox here** gotoLabel(173) ExitState() label(180) sprite('Action_050_02', 5) # 67505-67509 **attackbox here** Unknown23029(11, 9902, 0) if SLOT_158: Unknown1000(-1230000) else: Unknown1000(-1465000) sprite('Action_050_03', 5) # 67510-67514 **attackbox here** SFX_1('uli600uva') sprite('Action_050_04', 5) # 67515-67519 **attackbox here** label(181) sprite('Action_050_02', 5) # 67520-67524 **attackbox here** sprite('Action_050_03', 5) # 67525-67529 **attackbox here** sprite('Action_050_04', 5) # 67530-67534 **attackbox here** if SLOT_97: _gotolabel(181) sprite('Action_050_05', 7) # 67535-67541 sprite('Action_050_06', 9) # 67542-67550 sprite('Action_050_07', 4) # 67551-67554 sprite('Action_050_08', 5) # 67555-67559 SFX_0('019_cloth_a') sprite('Action_050_09', 8) # 67560-67567 sprite('Action_050_10', 7) # 67568-67574 sprite('Action_050_11', 6) # 67575-67580 **attackbox here** sprite('Action_050_12', 5) # 67581-67585 **attackbox here** sprite('Action_050_13', 5) # 67586-67590 **attackbox here** sprite('Action_050_14', 20) # 67591-67610 **attackbox here** sprite('Action_050_15', 5) # 67611-67615 SFX_0('019_cloth_c') sprite('Action_050_16', 4) # 67616-67619 sprite('Action_050_17', 5) # 67620-67624 SFX_3('SE010') sprite('Action_050_18', 5) # 67625-67629 Unknown21007(24, 40) sprite('Action_050_19', 2) # 67630-67631 Unknown21011(300) label(182) sprite('Action_000_00', 7) # 67632-67638 **attackbox here** sprite('Action_000_01', 7) # 67639-67645 **attackbox here** sprite('Action_000_02', 6) # 67646-67651 **attackbox here** sprite('Action_000_03', 6) # 67652-67657 **attackbox here** sprite('Action_000_04', 8) # 67658-67665 **attackbox here** sprite('Action_000_05', 5) # 67666-67670 **attackbox here** sprite('Action_000_06', 5) # 67671-67675 **attackbox here** sprite('Action_000_07', 5) # 67676-67680 **attackbox here** sprite('Action_000_08', 6) # 67681-67686 **attackbox here** sprite('Action_000_09', 5) # 67687-67691 **attackbox here** sprite('Action_000_10', 6) # 67692-67697 **attackbox here** sprite('Action_000_11', 8) # 67698-67705 **attackbox here** sprite('Action_000_12', 5) # 67706-67710 **attackbox here** sprite('Action_000_13', 5) # 67711-67715 **attackbox here** sprite('Action_000_14', 6) # 67716-67721 **attackbox here** gotoLabel(182) ExitState() label(190) sprite('Action_050_02', 5) # 67722-67726 **attackbox here** Unknown23029(11, 9902, 0) if SLOT_158: Unknown1000(-1230000) else: Unknown1000(-1465000) sprite('Action_050_03', 5) # 67727-67731 **attackbox here** SFX_1('uli600pla') sprite('Action_050_04', 5) # 67732-67736 **attackbox here** label(191) sprite('Action_050_02', 5) # 67737-67741 **attackbox here** sprite('Action_050_03', 5) # 67742-67746 **attackbox here** sprite('Action_050_04', 5) # 67747-67751 **attackbox here** if SLOT_97: _gotolabel(191) sprite('Action_050_05', 7) # 67752-67758 sprite('Action_050_06', 9) # 67759-67767 sprite('Action_050_07', 4) # 67768-67771 sprite('Action_050_08', 5) # 67772-67776 SFX_0('019_cloth_a') sprite('Action_050_09', 8) # 67777-67784 Unknown21007(24, 40) sprite('Action_050_10', 7) # 67785-67791 sprite('Action_050_11', 6) # 67792-67797 **attackbox here** sprite('Action_050_12', 5) # 67798-67802 **attackbox here** sprite('Action_050_13', 5) # 67803-67807 **attackbox here** sprite('Action_050_14', 20) # 67808-67827 **attackbox here** sprite('Action_050_15', 5) # 67828-67832 SFX_0('019_cloth_c') sprite('Action_050_16', 4) # 67833-67836 sprite('Action_050_17', 5) # 67837-67841 SFX_3('SE010') sprite('Action_050_18', 5) # 67842-67846 sprite('Action_050_19', 2) # 67847-67848 Unknown21011(240) label(192) sprite('Action_000_00', 7) # 67849-67855 **attackbox here** sprite('Action_000_01', 7) # 67856-67862 **attackbox here** sprite('Action_000_02', 6) # 67863-67868 **attackbox here** sprite('Action_000_03', 6) # 67869-67874 **attackbox here** sprite('Action_000_04', 8) # 67875-67882 **attackbox here** sprite('Action_000_05', 5) # 67883-67887 **attackbox here** sprite('Action_000_06', 5) # 67888-67892 **attackbox here** sprite('Action_000_07', 5) # 67893-67897 **attackbox here** sprite('Action_000_08', 6) # 67898-67903 **attackbox here** sprite('Action_000_09', 5) # 67904-67908 **attackbox here** sprite('Action_000_10', 6) # 67909-67914 **attackbox here** sprite('Action_000_11', 8) # 67915-67922 **attackbox here** sprite('Action_000_12', 5) # 67923-67927 **attackbox here** sprite('Action_000_13', 5) # 67928-67932 **attackbox here** sprite('Action_000_14', 6) # 67933-67938 **attackbox here** gotoLabel(192) ExitState() label(200) sprite('Action_050_02', 5) # 67939-67943 **attackbox here** Unknown23029(11, 9902, 0) if SLOT_158: Unknown1000(-1230000) else: Unknown1000(-1465000) sprite('Action_050_03', 5) # 67944-67948 **attackbox here** SFX_1('uli600umi') sprite('Action_050_04', 5) # 67949-67953 **attackbox here** label(201) sprite('Action_050_02', 5) # 67954-67958 **attackbox here** sprite('Action_050_03', 5) # 67959-67963 **attackbox here** sprite('Action_050_04', 5) # 67964-67968 **attackbox here** if SLOT_97: _gotolabel(201) sprite('Action_050_05', 7) # 67969-67975 sprite('Action_050_06', 9) # 67976-67984 sprite('Action_050_07', 4) # 67985-67988 sprite('Action_050_08', 5) # 67989-67993 SFX_0('019_cloth_a') sprite('Action_050_09', 8) # 67994-68001 Unknown21007(24, 40) Unknown21011(300) sprite('Action_050_10', 7) # 68002-68008 sprite('Action_050_11', 6) # 68009-68014 **attackbox here** sprite('Action_050_12', 5) # 68015-68019 **attackbox here** sprite('Action_050_13', 5) # 68020-68024 **attackbox here** sprite('Action_050_14', 20) # 68025-68044 **attackbox here** sprite('Action_050_15', 5) # 68045-68049 SFX_0('019_cloth_c') sprite('Action_050_16', 4) # 68050-68053 sprite('Action_050_17', 5) # 68054-68058 SFX_3('SE010') sprite('Action_050_18', 5) # 68059-68063 sprite('Action_050_19', 2) # 68064-68065 label(202) sprite('Action_000_00', 7) # 68066-68072 **attackbox here** sprite('Action_000_01', 7) # 68073-68079 **attackbox here** sprite('Action_000_02', 6) # 68080-68085 **attackbox here** sprite('Action_000_03', 6) # 68086-68091 **attackbox here** sprite('Action_000_04', 8) # 68092-68099 **attackbox here** sprite('Action_000_05', 5) # 68100-68104 **attackbox here** sprite('Action_000_06', 5) # 68105-68109 **attackbox here** sprite('Action_000_07', 5) # 68110-68114 **attackbox here** sprite('Action_000_08', 6) # 68115-68120 **attackbox here** sprite('Action_000_09', 5) # 68121-68125 **attackbox here** sprite('Action_000_10', 6) # 68126-68131 **attackbox here** sprite('Action_000_11', 8) # 68132-68139 **attackbox here** sprite('Action_000_12', 5) # 68140-68144 **attackbox here** sprite('Action_000_13', 5) # 68145-68149 **attackbox here** sprite('Action_000_14', 6) # 68150-68155 **attackbox here** gotoLabel(202) ExitState() label(210) sprite('Action_050_02', 1) # 68156-68156 **attackbox here** Unknown23029(11, 9902, 0) def upon_40(): clearUponHandler(40) SFX_1('uli601bce') def upon_CLEAR_OR_EXIT(): if (not SLOT_97): clearUponHandler(3) sendToLabel(212) label(211) sprite('Action_050_02', 5) # 68157-68161 **attackbox here** sprite('Action_050_03', 5) # 68162-68166 **attackbox here** sprite('Action_050_04', 5) # 68167-68171 **attackbox here** gotoLabel(211) label(212) sprite('Action_050_05', 7) # 68172-68178 sprite('Action_050_06', 9) # 68179-68187 sprite('Action_050_07', 4) # 68188-68191 sprite('Action_050_08', 5) # 68192-68196 SFX_0('019_cloth_a') sprite('Action_050_09', 8) # 68197-68204 sprite('Action_050_10', 7) # 68205-68211 sprite('Action_050_11', 6) # 68212-68217 **attackbox here** sprite('Action_050_12', 5) # 68218-68222 **attackbox here** sprite('Action_050_13', 5) # 68223-68227 **attackbox here** sprite('Action_050_14', 20) # 68228-68247 **attackbox here** sprite('Action_050_15', 5) # 68248-68252 SFX_0('019_cloth_c') sprite('Action_050_16', 4) # 68253-68256 sprite('Action_050_17', 5) # 68257-68261 SFX_3('SE010') sprite('Action_050_18', 5) # 68262-68266 sprite('Action_050_19', 2) # 68267-68268 Unknown23018(1) label(213) sprite('Action_000_00', 7) # 68269-68275 **attackbox here** sprite('Action_000_01', 7) # 68276-68282 **attackbox here** sprite('Action_000_02', 6) # 68283-68288 **attackbox here** sprite('Action_000_03', 6) # 68289-68294 **attackbox here** sprite('Action_000_04', 8) # 68295-68302 **attackbox here** sprite('Action_000_05', 5) # 68303-68307 **attackbox here** sprite('Action_000_06', 5) # 68308-68312 **attackbox here** sprite('Action_000_07', 5) # 68313-68317 **attackbox here** sprite('Action_000_08', 6) # 68318-68323 **attackbox here** sprite('Action_000_09', 5) # 68324-68328 **attackbox here** sprite('Action_000_10', 6) # 68329-68334 **attackbox here** sprite('Action_000_11', 8) # 68335-68342 **attackbox here** sprite('Action_000_12', 5) # 68343-68347 **attackbox here** sprite('Action_000_13', 5) # 68348-68352 **attackbox here** sprite('Action_000_14', 6) # 68353-68358 **attackbox here** gotoLabel(213) ExitState() label(220) sprite('Action_000_25', 32767) # 68359-101125 **attackbox here** Unknown1000(-1230000) Unknown2005() Unknown23029(11, 9902, 0) if SLOT_158: Unknown2019(-100) def upon_40(): clearUponHandler(40) SFX_1('uli601use') Unknown23018(1) ExitState() label(230) sprite('Action_050_02', 1) # 101126-101126 **attackbox here** Unknown23029(11, 9902, 0) def upon_40(): clearUponHandler(40) SFX_1('uli601uhi') def upon_CLEAR_OR_EXIT(): if (not SLOT_97): clearUponHandler(3) sendToLabel(232) label(231) sprite('Action_050_02', 5) # 101127-101131 **attackbox here** sprite('Action_050_03', 5) # 101132-101136 **attackbox here** sprite('Action_050_04', 5) # 101137-101141 **attackbox here** gotoLabel(231) label(232) sprite('Action_050_05', 7) # 101142-101148 sprite('Action_050_06', 9) # 101149-101157 sprite('Action_050_07', 4) # 101158-101161 sprite('Action_050_08', 5) # 101162-101166 SFX_0('019_cloth_a') sprite('Action_050_09', 8) # 101167-101174 sprite('Action_050_10', 7) # 101175-101181 sprite('Action_050_11', 6) # 101182-101187 **attackbox here** sprite('Action_050_12', 5) # 101188-101192 **attackbox here** sprite('Action_050_13', 5) # 101193-101197 **attackbox here** sprite('Action_050_14', 20) # 101198-101217 **attackbox here** sprite('Action_050_15', 5) # 101218-101222 SFX_0('019_cloth_c') sprite('Action_050_16', 4) # 101223-101226 sprite('Action_050_17', 5) # 101227-101231 SFX_3('SE010') sprite('Action_050_18', 5) # 101232-101236 sprite('Action_050_19', 2) # 101237-101238 Unknown23018(1) label(233) sprite('Action_000_00', 7) # 101239-101245 **attackbox here** sprite('Action_000_01', 7) # 101246-101252 **attackbox here** sprite('Action_000_02', 6) # 101253-101258 **attackbox here** sprite('Action_000_03', 6) # 101259-101264 **attackbox here** sprite('Action_000_04', 8) # 101265-101272 **attackbox here** sprite('Action_000_05', 5) # 101273-101277 **attackbox here** sprite('Action_000_06', 5) # 101278-101282 **attackbox here** sprite('Action_000_07', 5) # 101283-101287 **attackbox here** sprite('Action_000_08', 6) # 101288-101293 **attackbox here** sprite('Action_000_09', 5) # 101294-101298 **attackbox here** sprite('Action_000_10', 6) # 101299-101304 **attackbox here** sprite('Action_000_11', 8) # 101305-101312 **attackbox here** sprite('Action_000_12', 5) # 101313-101317 **attackbox here** sprite('Action_000_13', 5) # 101318-101322 **attackbox here** sprite('Action_000_14', 6) # 101323-101328 **attackbox here** gotoLabel(233) ExitState() label(240) sprite('Action_050_02', 5) # 101329-101333 **attackbox here** Unknown23029(11, 9902, 0) if SLOT_158: Unknown1000(-1230000) else: Unknown1000(-1465000) SFX_1('uli600pel') sprite('Action_050_03', 5) # 101334-101338 **attackbox here** sprite('Action_050_04', 5) # 101339-101343 **attackbox here** label(241) sprite('Action_050_02', 5) # 101344-101348 **attackbox here** sprite('Action_050_03', 5) # 101349-101353 **attackbox here** sprite('Action_050_04', 5) # 101354-101358 **attackbox here** if SLOT_97: _gotolabel(241) sprite('Action_050_05', 7) # 101359-101365 sprite('Action_050_06', 9) # 101366-101374 sprite('Action_050_07', 4) # 101375-101378 sprite('Action_050_08', 5) # 101379-101383 SFX_0('019_cloth_a') sprite('Action_050_09', 8) # 101384-101391 sprite('Action_050_10', 7) # 101392-101398 sprite('Action_050_11', 6) # 101399-101404 **attackbox here** sprite('Action_050_12', 5) # 101405-101409 **attackbox here** sprite('Action_050_13', 5) # 101410-101414 **attackbox here** sprite('Action_050_14', 20) # 101415-101434 **attackbox here** sprite('Action_050_15', 5) # 101435-101439 SFX_0('019_cloth_c') sprite('Action_050_16', 4) # 101440-101443 sprite('Action_050_17', 5) # 101444-101448 SFX_3('SE010') sprite('Action_050_18', 5) # 101449-101453 Unknown21007(24, 40) sprite('Action_050_19', 2) # 101454-101455 Unknown21011(120) label(242) sprite('Action_000_00', 7) # 101456-101462 **attackbox here** sprite('Action_000_01', 7) # 101463-101469 **attackbox here** sprite('Action_000_02', 6) # 101470-101475 **attackbox here** sprite('Action_000_03', 6) # 101476-101481 **attackbox here** sprite('Action_000_04', 8) # 101482-101489 **attackbox here** sprite('Action_000_05', 5) # 101490-101494 **attackbox here** sprite('Action_000_06', 5) # 101495-101499 **attackbox here** sprite('Action_000_07', 5) # 101500-101504 **attackbox here** sprite('Action_000_08', 6) # 101505-101510 **attackbox here** sprite('Action_000_09', 5) # 101511-101515 **attackbox here** sprite('Action_000_10', 6) # 101516-101521 **attackbox here** sprite('Action_000_11', 8) # 101522-101529 **attackbox here** sprite('Action_000_12', 5) # 101530-101534 **attackbox here** sprite('Action_000_13', 5) # 101535-101539 **attackbox here** sprite('Action_000_14', 6) # 101540-101545 **attackbox here** gotoLabel(242) ExitState() label(991) sprite('Action_000_00', 1) # 101546-101546 **attackbox here** Unknown23029(11, 9902, 0) Unknown2019(1000) Unknown21011(120) label(992) sprite('Action_000_00', 7) # 101547-101553 **attackbox here** sprite('Action_000_01', 7) # 101554-101560 **attackbox here** sprite('Action_000_02', 6) # 101561-101566 **attackbox here** sprite('Action_000_03', 6) # 101567-101572 **attackbox here** sprite('Action_000_04', 8) # 101573-101580 **attackbox here** sprite('Action_000_05', 5) # 101581-101585 **attackbox here** sprite('Action_000_06', 5) # 101586-101590 **attackbox here** sprite('Action_000_07', 5) # 101591-101595 **attackbox here** sprite('Action_000_08', 6) # 101596-101601 **attackbox here** sprite('Action_000_09', 5) # 101602-101606 **attackbox here** sprite('Action_000_10', 6) # 101607-101612 **attackbox here** sprite('Action_000_11', 8) # 101613-101620 **attackbox here** sprite('Action_000_12', 5) # 101621-101625 **attackbox here** sprite('Action_000_13', 5) # 101626-101630 **attackbox here** sprite('Action_000_14', 6) # 101631-101636 **attackbox here** gotoLabel(992) label(993) sprite('Action_046_00', 2) # 101637-101638 def upon_LANDING(): clearUponHandler(2) sendToLabel(995) def upon_STATE_END(): Unknown2019(0) Unknown3038(1) Unknown3001(255) Unknown2034(0) EnableCollision(0) Unknown2053(0) Unknown3001(255) Unknown3004(-20) physicsXImpulse(-51000) physicsYImpulse(18800) setGravity(1500) Unknown8002() sprite('Action_046_01', 2) # 101639-101640 label(994) sprite('Action_046_03', 3) # 101641-101643 sprite('Action_046_04', 3) # 101644-101646 loopRest() gotoLabel(994) label(995) sprite('null', 3) # 101647-101649 ExitState() @State def CmnActMatchWin(): if SLOT_169: _gotolabel(482) if SLOT_122: _gotolabel(482) if SLOT_123: _gotolabel(482) sprite('keep', 2) # 1-2 def upon_CLEAR_OR_EXIT(): SLOT_58 = 1 Unknown48('19000000020000003400000018000000020000003a000000') if SLOT_52: if PartnerChar('brc'): if (SLOT_145 <= 500000): sendToLabel(100) clearUponHandler(3) if PartnerChar('bha'): if (SLOT_145 <= 500000): sendToLabel(110) clearUponHandler(3) if PartnerChar('bpt'): if (SLOT_145 <= 500000): sendToLabel(120) clearUponHandler(3) if PartnerChar('bes'): if (SLOT_145 <= 500000): sendToLabel(130) clearUponHandler(3) if PartnerChar('pyo'): if (SLOT_145 <= 500000): sendToLabel(140) clearUponHandler(3) if PartnerChar('uhy'): if (SLOT_145 <= 500000): sendToLabel(150) clearUponHandler(3) if PartnerChar('uwa'): if (SLOT_145 <= 500000): sendToLabel(160) clearUponHandler(3) if PartnerChar('uor'): if (SLOT_145 <= 500000): sendToLabel(170) clearUponHandler(3) if PartnerChar('uva'): if (SLOT_145 <= 500000): sendToLabel(180) clearUponHandler(3) if PartnerChar('pla'): if (SLOT_145 <= 500000): sendToLabel(190) clearUponHandler(3) if PartnerChar('umi'): if (SLOT_145 <= 500000): sendToLabel(200) clearUponHandler(3) if PartnerChar('bce'): if (SLOT_145 <= 500000): sendToLabel(210) clearUponHandler(3) if PartnerChar('use'): if (SLOT_145 <= 500000): sendToLabel(220) clearUponHandler(3) if PartnerChar('uhi'): if (SLOT_145 <= 500000): sendToLabel(230) clearUponHandler(3) if PartnerChar('pel'): if (SLOT_145 <= 500000): sendToLabel(240) clearUponHandler(3) label(482) sprite('keep', 1) # 3-3 clearUponHandler(3) SLOT_58 = 0 sprite('Action_052_00', 6) # 4-9 if SLOT_158: if SLOT_52: Unknown7006('uli524', 100, 896101493, 13618, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) elif SLOT_108: Unknown7006('uli402_0', 100, 879324277, 828322352, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) else: Unknown7006('uli520', 100, 896101493, 12594, 0, 0, 100, 896101493, 12850, 0, 0, 100, 896101493, 13106, 0, 0, 100) sprite('Action_052_01', 6) # 10-15 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 16-19 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 20-26 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 27-29 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 30-39 sprite('Action_052_06', 6) # 40-45 sprite('Action_052_07', 5) # 46-50 Unknown23018(1) sprite('Action_052_08', 7) # 51-57 **attackbox here** label(1000) sprite('Action_052_09', 30) # 58-87 **attackbox here** loopRest() gotoLabel(1000) label(100) sprite('Action_000_00', 1) # 88-88 **attackbox here** Unknown2019(1000) def upon_40(): clearUponHandler(40) sendToLabel(102) label(101) sprite('Action_000_00', 7) # 89-95 **attackbox here** sprite('Action_000_01', 7) # 96-102 **attackbox here** sprite('Action_000_02', 6) # 103-108 **attackbox here** sprite('Action_000_03', 6) # 109-114 **attackbox here** sprite('Action_000_04', 8) # 115-122 **attackbox here** sprite('Action_000_05', 5) # 123-127 **attackbox here** sprite('Action_000_06', 5) # 128-132 **attackbox here** sprite('Action_000_07', 5) # 133-137 **attackbox here** sprite('Action_000_08', 6) # 138-143 **attackbox here** sprite('Action_000_09', 5) # 144-148 **attackbox here** sprite('Action_000_10', 6) # 149-154 **attackbox here** sprite('Action_000_11', 8) # 155-162 **attackbox here** sprite('Action_000_12', 5) # 163-167 **attackbox here** sprite('Action_000_13', 5) # 168-172 **attackbox here** sprite('Action_000_14', 6) # 173-178 **attackbox here** gotoLabel(101) label(102) sprite('Action_052_00', 6) # 179-184 SFX_1('uli701brc') sprite('Action_052_01', 6) # 185-190 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 191-194 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 195-201 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 202-204 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 205-214 sprite('Action_052_06', 6) # 215-220 sprite('Action_052_07', 5) # 221-225 sprite('Action_052_08', 7) # 226-232 **attackbox here** label(103) sprite('Action_052_09', 1) # 233-233 **attackbox here** if SLOT_97: _gotolabel(103) sprite('Action_052_09', 32767) # 234-33000 **attackbox here** Unknown18008() label(110) sprite('Action_000_00', 1) # 33001-33001 **attackbox here** def upon_40(): clearUponHandler(40) sendToLabel(112) label(111) sprite('Action_000_00', 7) # 33002-33008 **attackbox here** sprite('Action_000_01', 7) # 33009-33015 **attackbox here** sprite('Action_000_02', 6) # 33016-33021 **attackbox here** sprite('Action_000_03', 6) # 33022-33027 **attackbox here** sprite('Action_000_04', 8) # 33028-33035 **attackbox here** sprite('Action_000_05', 5) # 33036-33040 **attackbox here** sprite('Action_000_06', 5) # 33041-33045 **attackbox here** sprite('Action_000_07', 5) # 33046-33050 **attackbox here** sprite('Action_000_08', 6) # 33051-33056 **attackbox here** sprite('Action_000_09', 5) # 33057-33061 **attackbox here** sprite('Action_000_10', 6) # 33062-33067 **attackbox here** sprite('Action_000_11', 8) # 33068-33075 **attackbox here** sprite('Action_000_12', 5) # 33076-33080 **attackbox here** sprite('Action_000_13', 5) # 33081-33085 **attackbox here** sprite('Action_000_14', 6) # 33086-33091 **attackbox here** gotoLabel(111) label(112) sprite('Action_052_00', 6) # 33092-33097 SFX_1('uli701bha') sprite('Action_052_01', 6) # 33098-33103 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 33104-33107 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 33108-33114 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 33115-33117 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 33118-33127 sprite('Action_052_06', 6) # 33128-33133 sprite('Action_052_07', 5) # 33134-33138 sprite('Action_052_08', 7) # 33139-33145 **attackbox here** Unknown23018(1) sprite('Action_052_09', 32767) # 33146-65912 **attackbox here** label(120) sprite('Action_052_00', 6) # 65913-65918 SFX_1('uli700bpt') sprite('Action_052_01', 6) # 65919-65924 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 65925-65928 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 65929-65935 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 65936-65938 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 65939-65948 sprite('Action_052_06', 6) # 65949-65954 sprite('Action_052_07', 5) # 65955-65959 sprite('Action_052_08', 7) # 65960-65966 **attackbox here** label(121) sprite('Action_052_09', 1) # 65967-65967 **attackbox here** if SLOT_97: _gotolabel(121) sprite('Action_052_09', 45) # 65968-66012 **attackbox here** sprite('Action_052_09', 32767) # 66013-98779 **attackbox here** Unknown21007(24, 40) Unknown21011(280) label(130) sprite('Action_000_00', 1) # 98780-98780 **attackbox here** def upon_40(): clearUponHandler(40) sendToLabel(132) label(131) sprite('Action_000_00', 7) # 98781-98787 **attackbox here** sprite('Action_000_01', 7) # 98788-98794 **attackbox here** sprite('Action_000_02', 6) # 98795-98800 **attackbox here** sprite('Action_000_03', 6) # 98801-98806 **attackbox here** sprite('Action_000_04', 8) # 98807-98814 **attackbox here** sprite('Action_000_05', 5) # 98815-98819 **attackbox here** sprite('Action_000_06', 5) # 98820-98824 **attackbox here** sprite('Action_000_07', 5) # 98825-98829 **attackbox here** sprite('Action_000_08', 6) # 98830-98835 **attackbox here** sprite('Action_000_09', 5) # 98836-98840 **attackbox here** sprite('Action_000_10', 6) # 98841-98846 **attackbox here** sprite('Action_000_11', 8) # 98847-98854 **attackbox here** sprite('Action_000_12', 5) # 98855-98859 **attackbox here** sprite('Action_000_13', 5) # 98860-98864 **attackbox here** sprite('Action_000_14', 6) # 98865-98870 **attackbox here** gotoLabel(131) label(132) sprite('Action_052_00', 6) # 98871-98876 SFX_1('uli701bes') sprite('Action_052_01', 6) # 98877-98882 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 98883-98886 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 98887-98893 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 98894-98896 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 98897-98906 sprite('Action_052_06', 6) # 98907-98912 sprite('Action_052_07', 5) # 98913-98917 sprite('Action_052_08', 7) # 98918-98924 **attackbox here** label(133) sprite('Action_052_09', 1) # 98925-98925 **attackbox here** if SLOT_97: _gotolabel(133) sprite('Action_052_09', 32767) # 98926-131692 **attackbox here** Unknown21011(120) label(140) sprite('Action_000_00', 1) # 131693-131693 **attackbox here** Unknown2034(0) Unknown2053(0) def upon_40(): clearUponHandler(40) sendToLabel(142) label(141) sprite('Action_000_00', 7) # 131694-131700 **attackbox here** sprite('Action_000_01', 7) # 131701-131707 **attackbox here** sprite('Action_000_02', 6) # 131708-131713 **attackbox here** sprite('Action_000_03', 6) # 131714-131719 **attackbox here** sprite('Action_000_04', 8) # 131720-131727 **attackbox here** sprite('Action_000_05', 5) # 131728-131732 **attackbox here** sprite('Action_000_06', 5) # 131733-131737 **attackbox here** sprite('Action_000_07', 5) # 131738-131742 **attackbox here** sprite('Action_000_08', 6) # 131743-131748 **attackbox here** sprite('Action_000_09', 5) # 131749-131753 **attackbox here** sprite('Action_000_10', 6) # 131754-131759 **attackbox here** sprite('Action_000_11', 8) # 131760-131767 **attackbox here** sprite('Action_000_12', 5) # 131768-131772 **attackbox here** sprite('Action_000_13', 5) # 131773-131777 **attackbox here** sprite('Action_000_14', 6) # 131778-131783 **attackbox here** gotoLabel(141) label(142) sprite('Action_052_00', 6) # 131784-131789 sprite('Action_052_01', 6) # 131790-131795 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 131796-131799 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 131800-131806 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 131807-131809 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 131810-131819 sprite('Action_052_06', 6) # 131820-131825 sprite('Action_052_07', 5) # 131826-131830 sprite('Action_052_08', 7) # 131831-131837 **attackbox here** SFX_1('uli701pyo') label(143) sprite('Action_052_09', 1) # 131838-131838 **attackbox here** if SLOT_97: _gotolabel(143) sprite('Action_052_09', 30) # 131839-131868 **attackbox here** sprite('Action_052_09', 32767) # 131869-164635 **attackbox here** Unknown21007(24, 40) def upon_39(): clearUponHandler(39) SFX_1('uli703pyo') Unknown21011(80) label(150) sprite('Action_052_00', 6) # 164636-164641 SFX_1('uli700uhy') sprite('Action_052_01', 6) # 164642-164647 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 164648-164651 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 164652-164658 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 164659-164661 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 164662-164671 sprite('Action_052_06', 6) # 164672-164677 sprite('Action_052_07', 5) # 164678-164682 sprite('Action_052_08', 7) # 164683-164689 **attackbox here** label(151) sprite('Action_052_09', 1) # 164690-164690 **attackbox here** if SLOT_97: _gotolabel(151) sprite('Action_052_09', 30) # 164691-164720 **attackbox here** sprite('Action_052_09', 32767) # 164721-197487 **attackbox here** Unknown21007(24, 40) Unknown21011(120) label(160) sprite('Action_000_00', 1) # 197488-197488 **attackbox here** Unknown2019(-100) def upon_40(): clearUponHandler(40) sendToLabel(162) label(161) sprite('Action_000_00', 7) # 197489-197495 **attackbox here** sprite('Action_000_01', 7) # 197496-197502 **attackbox here** sprite('Action_000_02', 6) # 197503-197508 **attackbox here** sprite('Action_000_03', 6) # 197509-197514 **attackbox here** sprite('Action_000_04', 8) # 197515-197522 **attackbox here** sprite('Action_000_05', 5) # 197523-197527 **attackbox here** sprite('Action_000_06', 5) # 197528-197532 **attackbox here** sprite('Action_000_07', 5) # 197533-197537 **attackbox here** sprite('Action_000_08', 6) # 197538-197543 **attackbox here** sprite('Action_000_09', 5) # 197544-197548 **attackbox here** sprite('Action_000_10', 6) # 197549-197554 **attackbox here** sprite('Action_000_11', 8) # 197555-197562 **attackbox here** sprite('Action_000_12', 5) # 197563-197567 **attackbox here** sprite('Action_000_13', 5) # 197568-197572 **attackbox here** sprite('Action_000_14', 6) # 197573-197578 **attackbox here** gotoLabel(161) label(162) sprite('Action_052_00', 6) # 197579-197584 SFX_1('uli701uwa') sprite('Action_052_01', 6) # 197585-197590 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 197591-197594 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 197595-197601 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 197602-197604 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 197605-197614 sprite('Action_052_06', 6) # 197615-197620 sprite('Action_052_07', 5) # 197621-197625 sprite('Action_052_08', 7) # 197626-197632 **attackbox here** sprite('Action_052_09', 32767) # 197633-230399 **attackbox here** Unknown23018(1) label(170) sprite('Action_000_00', 1) # 230400-230400 **attackbox here** def upon_40(): clearUponHandler(40) sendToLabel(172) label(171) sprite('Action_000_00', 7) # 230401-230407 **attackbox here** sprite('Action_000_01', 7) # 230408-230414 **attackbox here** sprite('Action_000_02', 6) # 230415-230420 **attackbox here** sprite('Action_000_03', 6) # 230421-230426 **attackbox here** sprite('Action_000_04', 8) # 230427-230434 **attackbox here** sprite('Action_000_05', 5) # 230435-230439 **attackbox here** sprite('Action_000_06', 5) # 230440-230444 **attackbox here** sprite('Action_000_07', 5) # 230445-230449 **attackbox here** sprite('Action_000_08', 6) # 230450-230455 **attackbox here** sprite('Action_000_09', 5) # 230456-230460 **attackbox here** sprite('Action_000_10', 6) # 230461-230466 **attackbox here** sprite('Action_000_11', 8) # 230467-230474 **attackbox here** sprite('Action_000_12', 5) # 230475-230479 **attackbox here** sprite('Action_000_13', 5) # 230480-230484 **attackbox here** sprite('Action_000_14', 6) # 230485-230490 **attackbox here** gotoLabel(171) label(172) sprite('Action_052_00', 6) # 230491-230496 SFX_1('uli701uor') sprite('Action_052_01', 6) # 230497-230502 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 230503-230506 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 230507-230513 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 230514-230516 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 230517-230526 sprite('Action_052_06', 6) # 230527-230532 sprite('Action_052_07', 5) # 230533-230537 sprite('Action_052_08', 7) # 230538-230544 **attackbox here** label(173) sprite('Action_052_09', 1) # 230545-230545 **attackbox here** if SLOT_97: _gotolabel(173) sprite('Action_052_09', 32767) # 230546-263312 **attackbox here** Unknown21011(120) label(180) sprite('Action_052_00', 6) # 263313-263318 SFX_1('uli700uva') sprite('Action_052_01', 6) # 263319-263324 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 263325-263328 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 263329-263335 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 263336-263338 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 263339-263348 sprite('Action_052_06', 6) # 263349-263354 sprite('Action_052_07', 5) # 263355-263359 sprite('Action_052_08', 7) # 263360-263366 **attackbox here** label(181) sprite('Action_052_09', 1) # 263367-263367 **attackbox here** if SLOT_97: _gotolabel(181) sprite('Action_052_09', 32767) # 263368-296134 **attackbox here** Unknown21007(24, 40) Unknown21011(480) label(190) sprite('Action_052_00', 6) # 296135-296140 SFX_1('uli700pla') sprite('Action_052_01', 6) # 296141-296146 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 296147-296150 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 296151-296157 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 296158-296160 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 296161-296170 sprite('Action_052_06', 6) # 296171-296176 sprite('Action_052_07', 5) # 296177-296181 sprite('Action_052_08', 7) # 296182-296188 **attackbox here** label(191) sprite('Action_052_09', 1) # 296189-296189 **attackbox here** if SLOT_97: _gotolabel(191) sprite('Action_052_09', 20) # 296190-296209 **attackbox here** sprite('Action_052_09', 32767) # 296210-328976 **attackbox here** Unknown21007(24, 40) Unknown21011(360) label(200) sprite('Action_052_00', 6) # 328977-328982 SFX_1('uli700umi') sprite('Action_052_01', 6) # 328983-328988 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 328989-328992 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 328993-328999 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 329000-329002 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 329003-329012 sprite('Action_052_06', 6) # 329013-329018 sprite('Action_052_07', 5) # 329019-329023 sprite('Action_052_08', 7) # 329024-329030 **attackbox here** label(201) sprite('Action_052_09', 1) # 329031-329031 **attackbox here** if SLOT_97: _gotolabel(201) sprite('Action_052_09', 20) # 329032-329051 **attackbox here** sprite('Action_052_09', 32767) # 329052-361818 **attackbox here** Unknown21007(24, 40) Unknown21011(250) label(210) sprite('Action_000_00', 1) # 361819-361819 **attackbox here** Unknown2019(-1000) def upon_40(): clearUponHandler(40) sendToLabel(212) label(211) sprite('Action_000_00', 7) # 361820-361826 **attackbox here** sprite('Action_000_01', 7) # 361827-361833 **attackbox here** sprite('Action_000_02', 6) # 361834-361839 **attackbox here** sprite('Action_000_03', 6) # 361840-361845 **attackbox here** sprite('Action_000_04', 8) # 361846-361853 **attackbox here** sprite('Action_000_05', 5) # 361854-361858 **attackbox here** sprite('Action_000_06', 5) # 361859-361863 **attackbox here** sprite('Action_000_07', 5) # 361864-361868 **attackbox here** sprite('Action_000_08', 6) # 361869-361874 **attackbox here** sprite('Action_000_09', 5) # 361875-361879 **attackbox here** sprite('Action_000_10', 6) # 361880-361885 **attackbox here** sprite('Action_000_11', 8) # 361886-361893 **attackbox here** sprite('Action_000_12', 5) # 361894-361898 **attackbox here** sprite('Action_000_13', 5) # 361899-361903 **attackbox here** sprite('Action_000_14', 6) # 361904-361909 **attackbox here** gotoLabel(211) label(212) sprite('Action_052_00', 6) # 361910-361915 SFX_1('uli701bce') sprite('Action_052_01', 6) # 361916-361921 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 361922-361925 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 361926-361932 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 361933-361935 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 361936-361945 sprite('Action_052_06', 6) # 361946-361951 sprite('Action_052_07', 5) # 361952-361956 sprite('Action_052_08', 7) # 361957-361963 **attackbox here** sprite('Action_052_09', 32767) # 361964-394730 **attackbox here** Unknown23018(1) label(220) sprite('Action_000_00', 1) # 394731-394731 **attackbox here** Unknown2019(1000) def upon_40(): clearUponHandler(40) sendToLabel(222) label(221) sprite('Action_000_00', 7) # 394732-394738 **attackbox here** sprite('Action_000_01', 7) # 394739-394745 **attackbox here** sprite('Action_000_02', 6) # 394746-394751 **attackbox here** sprite('Action_000_03', 6) # 394752-394757 **attackbox here** sprite('Action_000_04', 8) # 394758-394765 **attackbox here** sprite('Action_000_05', 5) # 394766-394770 **attackbox here** sprite('Action_000_06', 5) # 394771-394775 **attackbox here** sprite('Action_000_07', 5) # 394776-394780 **attackbox here** sprite('Action_000_08', 6) # 394781-394786 **attackbox here** sprite('Action_000_09', 5) # 394787-394791 **attackbox here** sprite('Action_000_10', 6) # 394792-394797 **attackbox here** sprite('Action_000_11', 8) # 394798-394805 **attackbox here** sprite('Action_000_12', 5) # 394806-394810 **attackbox here** sprite('Action_000_13', 5) # 394811-394815 **attackbox here** sprite('Action_000_14', 6) # 394816-394821 **attackbox here** gotoLabel(221) label(222) sprite('Action_052_00', 6) # 394822-394827 SFX_1('uli701use') sprite('Action_052_01', 6) # 394828-394833 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 394834-394837 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 394838-394844 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 394845-394847 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 394848-394857 sprite('Action_052_06', 6) # 394858-394863 sprite('Action_052_07', 5) # 394864-394868 sprite('Action_052_08', 7) # 394869-394875 **attackbox here** sprite('Action_052_09', 32767) # 394876-427642 **attackbox here** Unknown23018(1) label(230) sprite('Action_052_00', 6) # 427643-427648 SFX_1('uli700uhi') sprite('Action_052_01', 6) # 427649-427654 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 427655-427658 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 427659-427665 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 427666-427668 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 427669-427678 sprite('Action_052_06', 6) # 427679-427684 sprite('Action_052_07', 5) # 427685-427689 sprite('Action_052_08', 7) # 427690-427696 **attackbox here** label(231) sprite('Action_052_09', 1) # 427697-427697 **attackbox here** if SLOT_97: _gotolabel(231) sprite('Action_052_09', 30) # 427698-427727 **attackbox here** sprite('Action_052_09', 32767) # 427728-460494 **attackbox here** Unknown21007(24, 40) Unknown21011(180) label(240) sprite('Action_052_00', 6) # 460495-460500 SFX_1('uli700pel') sprite('Action_052_01', 6) # 460501-460506 teleportRelativeX(-25000) SFX_0('003_swing_grap_0_0') sprite('Action_052_02', 4) # 460507-460510 teleportRelativeX(-5000) sprite('Action_052_03', 7) # 460511-460517 teleportRelativeX(-20000) sprite('Action_052_04', 3) # 460518-460520 SFX_3('SE010') teleportRelativeX(-20000) sprite('Action_052_05', 10) # 460521-460530 sprite('Action_052_06', 6) # 460531-460536 sprite('Action_052_07', 5) # 460537-460541 sprite('Action_052_08', 7) # 460542-460548 **attackbox here** label(241) sprite('Action_052_09', 1) # 460549-460549 **attackbox here** if SLOT_97: _gotolabel(241) sprite('Action_052_09', 30) # 460550-460579 **attackbox here** sprite('Action_052_09', 32767) # 460580-493346 **attackbox here** Unknown21007(24, 40) Unknown21011(180) @State def CmnActLose(): sprite('Action_248_00', 7) # 1-7 sprite('Action_248_01', 4) # 8-11 if SLOT_158: Unknown7006('uli403_0', 100, 879324277, 828322608, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) SFX_0('003_swing_grap_0_0') Unknown23018(1) sprite('Action_248_02', 7) # 12-18 sprite('Action_248_03', 5) # 19-23 sprite('Action_248_04', 8) # 24-31 sprite('Action_248_05', 10) # 32-41 sprite('Action_248_06', 5) # 42-46 sprite('Action_248_07', 7) # 47-53 SFX_FOOTSTEP_(100, 0, 1) sprite('Action_248_08', 3) # 54-56 sprite('Action_248_09', 3) # 57-59 sprite('Action_248_10', 32767) # 60-32826
[ "shtkn001@gmail.com" ]
shtkn001@gmail.com
168a492c64f3091f9413060341de0d14558d560c
dad3e21dd32d9625b510ba373a82d554ce92ff3f
/TennisApp/single_layer_perceptron.py
1d0decf7d2b10006b90a127f3ce6aab7dd882cf4
[]
no_license
pradyumnad/TennisML
a2c1ff72e08267c1575a710f37b737715a08a398
af323a21d1ae2f66945d3e367bb620e4b60e665e
refs/heads/master
2021-01-10T04:37:58.928943
2016-03-03T02:40:06
2016-03-03T02:40:06
51,107,480
0
0
null
null
null
null
UTF-8
Python
false
false
1,055
py
import neurolab as nl import numpy as np from data import prepare_data __author__ = 'pradyumnad' train, train_target, test, test_target = prepare_data() print('Train: ', len(train)) print('Test : ', len(test)) input = list(train[['1st serve points won Norm', '2nd serve points won Norm', 'Break points won Norm']].values) target = list(train_target) target = [[i] for i in target] # print input # print target # Create net with 3 inputs and 1 neuron net = nl.net.newp([[0, 1], [0, 1], [0, 1]], 1) error = net.train(input, target, epochs=140, show=10, lr=0.1) # Plot results import pylab as pl pl.plot(error) pl.xlabel('Epoch number') pl.ylabel('Train error') pl.grid() pl.show() # Testing test_input = list(test[['1st serve points won Norm', '2nd serve points won Norm', 'Break points won Norm']].values) target = list(test_target) target = [[i] for i in target] predictions = net.sim(test_input) print predictions print target diff = predictions - target err = np.square(diff).sum() # print('diff', diff) print('err', err / len(predictions))
[ "pradyumnadoddala@gmail.com" ]
pradyumnadoddala@gmail.com
9226629a592d1cbce6243737ba9838ff68a1135b
98404910e43b88108e658d111e9196839b7aca77
/tests/test_layers.py
f49e07677ec682f645022d76bc04813595d924fa
[ "Apache-2.0" ]
permissive
mbencherif/kraken
b45ff5c32ab7d76301f613d738a1281adb05b2ce
ffb35d101166e35fad7930d468138e216e48991a
refs/heads/master
2023-07-30T12:42:33.823848
2021-09-29T14:37:18
2021-09-29T14:37:18
null
0
0
null
null
null
null
UTF-8
Python
false
false
9,368
py
# -*- coding: utf-8 -*- import unittest from nose.tools import raises import torch from kraken.lib import layers class TestLayers(unittest.TestCase): """ Testing custom layer implementations. """ def setUp(self): torch.set_grad_enabled(False) def test_maxpool(self): """ Test maximum pooling layer. """ mp = layers.MaxPool((3, 3), (2, 2)) o = mp(torch.randn(1, 2, 32, 64)) self.assertEqual(o[0].shape, (1, 2, 15, 31)) def test_1d_dropout(self): """ Test 1d dropout layer. """ do = layers.Dropout(0.2, 1) o = do(torch.randn(1, 2, 32, 64)) self.assertEqual(o[0].shape, (1, 2, 32, 64)) def test_2d_dropout(self): """ Test 2d dropout layer. """ do = layers.Dropout(0.2, 2) o = do(torch.randn(1, 2, 32, 64)) self.assertEqual(o[0].shape, (1, 2, 32, 64)) def test_forward_rnn_layer_x(self): """ Test unidirectional RNN layer in x-dimension. """ rnn = layers.TransposedSummarizingRNN(10, 2, 'f', False, False) o = rnn(torch.randn(1, 10, 32, 64)) self.assertEqual(o[0].shape, (1, 2, 32, 64)) def test_forward_rnn_layer_y(self): """ Test unidirectional RNN layer in y-dimension. """ rnn = layers.TransposedSummarizingRNN(10, 2, 'f', True, False) o = rnn(torch.randn(1, 10, 32, 64)) self.assertEqual(o[0].shape, (1, 2, 32, 64)) def test_forward_rnn_layer_x_summarize(self): """ Test unidirectional summarizing RNN layer in x-dimension. """ rnn = layers.TransposedSummarizingRNN(10, 2, 'f', False, True) o = rnn(torch.randn(1, 10, 32, 64)) self.assertEqual(o[0].shape, (1, 2, 32, 1)) def test_forward_rnn_layer_y_summarize(self): """ Test unidirectional summarizing RNN layer in y-dimension. """ rnn = layers.TransposedSummarizingRNN(10, 2, 'f', True, True) o = rnn(torch.randn(1, 10, 32, 64)) self.assertEqual(o[0].shape, (1, 2, 1, 64)) def test_bidi_rnn_layer_x(self): """ Test bidirectional RNN layer in x-dimension. """ rnn = layers.TransposedSummarizingRNN(10, 2, 'b', False, False) o = rnn(torch.randn(1, 10, 32, 64)) self.assertEqual(o[0].shape, (1, 4, 32, 64)) def test_bidi_rnn_layer_y(self): """ Test bidirectional RNN layer in y-dimension. """ rnn = layers.TransposedSummarizingRNN(10, 2, 'b', True, False) o = rnn(torch.randn(1, 10, 32, 64)) self.assertEqual(o[0].shape, (1, 4, 32, 64)) def test_bidi_rnn_layer_x_summarize(self): """ Test bidirectional summarizing RNN layer in x-dimension. """ rnn = layers.TransposedSummarizingRNN(10, 2, 'b', False, True) o = rnn(torch.randn(1, 10, 32, 64)) self.assertEqual(o[0].shape, (1, 4, 32, 1)) def test_bidi_rnn_layer_y_summarize(self): """ Test bidirectional summarizing RNN layer in y-dimension. """ rnn = layers.TransposedSummarizingRNN(10, 2, 'b', True, True) o = rnn(torch.randn(1, 10, 32, 64)) self.assertEqual(o[0].shape, (1, 4, 1, 64)) def test_linsoftmax(self): """ Test basic function of linear layer. """ lin = layers.LinSoftmax(20, 10) o = lin(torch.randn(1, 20, 12, 24)) self.assertEqual(o[0].shape, (1, 10, 12, 24)) def test_linsoftmax_train(self): """ Test function of linear layer in training mode (log_softmax) """ lin = layers.LinSoftmax(20, 10).train() o = lin(torch.randn(1, 20, 12, 24)) self.assertLess(o[0].max(), 0) def test_linsoftmax_test(self): """ Test function of linear layer in eval mode (softmax) """ lin = layers.LinSoftmax(20, 10).eval() o = lin(torch.randn(1, 20, 12, 24)) self.assertGreaterEqual(o[0].min(), 0) def test_linsoftmax_aug(self): """ Test basic function of linear layer with 1-augmentation. """ lin = layers.LinSoftmax(20, 10, True) o = lin(torch.randn(1, 20, 12, 24)) self.assertEqual(o[0].shape, (1, 10, 12, 24)) def test_linsoftmax_aug_train(self): """ Test function of linear layer in training mode (log_softmax) with 1-augmentation """ lin = layers.LinSoftmax(20, 10, True).train() o = lin(torch.randn(1, 20, 12, 24)) self.assertLess(o[0].max(), 0) def test_linsoftmax_aug_test(self): """ Test function of linear layer in eval mode (softmax) with 1-augmentation """ lin = layers.LinSoftmax(20, 10, True).eval() o = lin(torch.randn(1, 20, 12, 24)) self.assertGreaterEqual(o[0].min(), 0) def test_actconv2d_lin(self): """ Test convolutional layer without activation. """ conv = layers.ActConv2D(5, 12, (3, 3), (1, 1), 'l') o = conv(torch.randn(1, 5, 24, 12)) self.assertEqual(o[0].shape, (1, 12, 24, 12)) def test_actconv2d_sigmoid(self): """ Test convolutional layer with sigmoid activation. """ conv = layers.ActConv2D(5, 12, (3, 3), (1, 1), 's') o = conv(torch.randn(1, 5, 24, 12)) self.assertTrue(0 <= o[0].min() <= 1) self.assertTrue(0 <= o[0].max() <= 1) def test_actconv2d_tanh(self): """ Test convolutional layer with tanh activation. """ conv = layers.ActConv2D(5, 12, (3, 3), (1, 1), 't') o = conv(torch.randn(1, 5, 24, 12)) self.assertTrue(-1 <= o[0].min() <= 1) self.assertTrue(-1 <= o[0].max() <= 1) def test_actconv2d_softmax(self): """ Test convolutional layer with softmax activation. """ conv = layers.ActConv2D(5, 12, (3, 3), (1, 1), 'm') o = conv(torch.randn(1, 5, 24, 12)) self.assertTrue(0 <= o[0].min() <= 1) self.assertTrue(0 <= o[0].max() <= 1) def test_actconv2d_relu(self): """ Test convolutional layer with relu activation. """ conv = layers.ActConv2D(5, 12, (3, 3), (1, 1), 'r') o = conv(torch.randn(1, 5, 24, 12)) self.assertLessEqual(0, o[0].min()) self.assertLessEqual(0, o[0].max()) def test_linsoftmax_resize_add(self): """ Tests resizing of a fully connected layer. """ lin = layers.LinSoftmax(20, 10) w_cp = lin.lin.weight.clone() b_cp = lin.lin.bias.clone() lin.resize(25) self.assertTrue(w_cp.eq(lin.lin.weight[:10, :]).all()) self.assertTrue(b_cp.eq(lin.lin.bias[:10]).all()) self.assertTrue(lin.lin.weight.shape[0] == 25) self.assertTrue(lin.lin.bias.shape[0] == 25) def test_linsoftmax_resize_remove(self): """ Tests resizing of a fully connected layer. """ lin = layers.LinSoftmax(20, 10) w_cp = lin.lin.weight.clone() b_cp = lin.lin.bias.clone() lin.resize(5, (1, 5, 6, 7, 9)) self.assertTrue(w_cp[(0, 2, 3, 4, 8), :].eq(lin.lin.weight).all()) self.assertTrue(b_cp[(0, 2, 3, 4, 8),].eq(lin.lin.bias).all()) def test_linsoftmax_resize_both(self): """ Tests resizing of a fully connected layer. """ lin = layers.LinSoftmax(20, 10) w_cp = lin.lin.weight.clone() b_cp = lin.lin.bias.clone() lin.resize(25, (1, 5, 6, 7, 9)) self.assertTrue(w_cp[(0, 2, 3, 4, 8), :].eq(lin.lin.weight[:5, :]).all()) self.assertTrue(b_cp[(0, 2, 3, 4, 8),].eq(lin.lin.bias[:5]).all()) self.assertTrue(lin.lin.weight.shape[0] == 25) self.assertTrue(lin.lin.bias.shape[0] == 25) def test_conv_resize_add(self): """ Tests resizing of a convolutional output layer. """ conv = layers.ActConv2D(20, 10, (1, 1), (1, 1)) w_cp = conv.co.weight.clone() b_cp = conv.co.bias.clone() conv.resize(25) self.assertTrue(w_cp.eq(conv.co.weight[:10, :]).all()) self.assertTrue(b_cp.eq(conv.co.bias[:10]).all()) self.assertTrue(conv.co.weight.shape[0] == 25) self.assertTrue(conv.co.bias.shape[0] == 25) def test_conv_resize_remove(self): """ Tests resizing of a convolutional output layer. """ conv = layers.ActConv2D(20, 10, (1, 1), (1, 1)) w_cp = conv.co.weight.clone() b_cp = conv.co.bias.clone() conv.resize(5, (1, 5, 6, 7, 9)) self.assertTrue(w_cp[(0, 2, 3, 4, 8), :].eq(conv.co.weight).all()) self.assertTrue(b_cp[(0, 2, 3, 4, 8),].eq(conv.co.bias).all()) def test_conv_resize_both(self): """ Tests resizing of a convolutional output layer. """ conv = layers.ActConv2D(20, 10, (1, 1), (1, 1)) w_cp = conv.co.weight.clone() b_cp = conv.co.bias.clone() conv.resize(25, (1, 5, 6, 7, 9)) self.assertTrue(w_cp[(0, 2, 3, 4, 8), :].eq(conv.co.weight[:5, :]).all()) self.assertTrue(b_cp[(0, 2, 3, 4, 8),].eq(conv.co.bias[:5]).all()) self.assertTrue(conv.co.weight.shape[0] == 25) self.assertTrue(conv.co.bias.shape[0] == 25)
[ "mittagessen@l.unchti.me" ]
mittagessen@l.unchti.me
13db4789fac71a6bd7a9ecc5b7802ab48098465e
a0cbae900326b91817ba2e4234a97730893bf28c
/apps/core/backends.py
cf483058ba429f1643b092bf61cf8715611994ba
[ "MIT" ]
permissive
pipoket/sparcssso
574b071990428ffd6ace1996b9fc2949e6c1a7da
ecc02b04c6630125ee841343ec73740b35c6c4b0
refs/heads/master
2020-04-07T19:52:06.939930
2016-05-28T10:25:42
2016-05-28T10:25:42
60,222,818
0
0
null
2016-06-02T01:31:04
2016-06-02T01:31:04
null
UTF-8
Python
false
false
8,418
py
# -* coding: utf-8 -*- from django.conf import settings from django.contrib.auth.models import User from django.core.mail import send_mail from django.utils import timezone from apps.core.models import ServiceMap, UserProfile, EmailAuthToken, ResetPWToken from apps.core.forms import UserForm, UserProfileForm from xml.etree.ElementTree import fromstring import cgi import datetime import requests import logging import oauth2 as oauth import os import re import urllib import urlparse logger = logging.getLogger('sso.account.backend') # {male, female, etc} -> {M, F, E} def parse_gender(gender): if gender == 'male': return 'M' elif gender == 'female': return 'F' return 'E' # get username using email def get_username(email): user = User.objects.filter(email=email).first() if user: return user.username return 'unknown' # check given email is available or not def validate_email(email): if not re.match(r'[^@]+@[^@]+\.[^@]+', email): return False return User.objects.filter(email=email).count() == 0 # give reset pw token to user def give_reset_pw_token(user): title = '[SPARCS SSO] Reset Password' message = 'To reset your password, please click <a href="https://sparcssso.kaist.ac.kr/account/password/reset/%s">this link</a> in 24 hours.' tomorrow = timezone.now() + datetime.timedelta(days=1) for token in ResetPWToken.objects.filter(user=user): token.delete() while True: tokenid = os.urandom(24).encode('hex') if not ResetPWToken.objects.filter(tokenid=tokenid).count(): break token = ResetPWToken(tokenid=tokenid, expire_time=tomorrow, user=user).save() send_mail(title, '', 'noreply@sso.sparcs.org', [user.email], html_message=message % tokenid) # give email auth token to user def give_email_auth_token(user): title = '[SPARCS SSO] Email Authentication' message = 'To authenticate your email, <a href="https://sparcssso.kaist.ac.kr/account/auth/email/%s">this link</a> in 24 hours.' tomorrow = timezone.now() + datetime.timedelta(days=1) for token in EmailAuthToken.objects.filter(user=user): token.delete() while True: tokenid = os.urandom(24).encode('hex') if not EmailAuthToken.objects.filter(tokenid=tokenid).count(): break token = EmailAuthToken(tokenid=tokenid, expire_time=tomorrow, user=user).save() send_mail(title, '', 'noreply@sso.sparcs.org', [user.email], html_message=message % tokenid) # signup core def signup_core(post): user_f = UserForm(post) profile_f = UserProfileForm(post) raw_email = post.get('email', '') if validate_email(raw_email) and user_f.is_valid() and profile_f.is_valid(): email = user_f.cleaned_data['email'] password = user_f.cleaned_data['password'] first_name = user_f.cleaned_data['first_name'] last_name = user_f.cleaned_data['last_name'] while True: username = os.urandom(10).encode('hex') if not User.objects.filter(username=username).count(): break user = User.objects.create_user(username=username, first_name=first_name, last_name=last_name, email=email, password=password) user.save() profile = profile_f.save(commit=False) profile.user = user profile.save() give_email_auth_token(user) return user else: return None # Register Service def reg_service(user, service): m = ServiceMap.objects.filter(user=user, service=service).first() if m and not m.unregister_time: return False elif m and m.unregister_time and \ (timezone.now() - m.unregister_time).days < service.cooltime: return False if m: m.delete() m = ServiceMap(user=user, service=service) while True: sid = os.urandom(10).encode('hex') if not ServiceMap.objects.filter(sid=sid).count(): break m.sid = sid m.register_time = timezone.now() m.unregister_time = None m.save() return True # Unregister Service def unreg_service(user, service): default_result = {'status': '1', 'msg': 'Unknown Error'} m = ServiceMap.objects.filter(user=user, service=service).first() if not m or m.unregister_time: return default_result r = requests.post(service.unregister_url, verify=True, data={'sid': m.sid, 'key': service.secret_key}) try: result = r.json() status = result.get('status', '1') if status != '0': return result except: return default_result m.unregister_time = timezone.now() m.save() return result # Facebook Init & Auth def init_fb(callback_url): args = { 'client_id': settings.FACEBOOK_APP_ID, 'scope': 'email', 'redirect_uri': callback_url, } return 'https://www.facebook.com/dialog/oauth?' + urllib.urlencode(args) def auth_fb(code, callback_url): args = { 'client_id': settings.FACEBOOK_APP_ID, 'client_secret': settings.FACEBOOK_APP_SECRET, 'redirect_uri': callback_url, 'code': code, } r = requests.get('https://graph.facebook.com/oauth/access_token?', params=args, verify=True) response = urlparse.parse_qs(r.text) access_token = response['access_token'][-1] args = { 'fields': 'email,first_name,last_name,gender,birthday', 'access_token': access_token } r = requests.get('https://graph.facebook.com/v2.5/me', params=args, verify=True) fb_info = r.json() info = {'userid': fb_info['id'], 'email': fb_info.get('email'), 'first_name': fb_info.get('first_name'), 'last_name': fb_info.get('last_name'), 'gender': parse_gender(fb_info.get('gender')), 'birthday': fb_info.get('birthday')} return UserProfile.objects.filter(facebook_id=info['userid']).first(), info # Twitter Init & Auth tw_consumer = oauth.Consumer(settings.TWITTER_APP_ID, settings.TWITTER_APP_SECRET) tw_client = oauth.Client(tw_consumer) def init_tw(callback_url): body = 'oauth_callback=' + callback_url resp, content = tw_client.request('https://twitter.com/oauth/request_token', 'POST', body) tokens = dict(cgi.parse_qsl(content)) url = 'https://twitter.com/oauth/authenticate?oauth_token=%s' % tokens['oauth_token'] return url, tokens def auth_tw(tokens, verifier): token = oauth.Token(tokens['oauth_token'], tokens['oauth_token_secret']) token.set_verifier(verifier) client = oauth.Client(tw_consumer, token) resp, content = client.request('https://twitter.com/oauth/access_token', 'POST') tw_info = dict(cgi.parse_qsl(content)) info = {'userid': tw_info['user_id'], 'first_name': tw_info['screen_name'], 'gender': 'E'} return UserProfile.objects.filter(twitter_id=info['userid']).first(), info # KAIST Auth def auth_kaist(token): data = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://server.com"> <soapenv:Header/> <soapenv:Body> <ser:verification> <cookieValue>%s</cookieValue> <publicKeyStr>%s</publicKeyStr> <adminVO> <adminId>%s</adminId> <password>%s</password> </adminVO> </ser:verification> </soapenv:Body> </soapenv:Envelope>""" % (token, settings.KAIST_APP_SECRET, settings.KAIST_APP_ADMIN_ID, settings.KAIST_APP_ADMIN_PW) r = requests.post('https://iam.kaist.ac.kr/iamps/services/singlauth/', data=data, verify=True) raw_info = fromstring(r.text)[0][0][0] k_info = {} for node in raw_info: k_info[node.tag] = node.text info = {'userid': k_info['kaist_uid'], 'email': k_info.get('mail'), 'first_name': k_info.get('givenname'), 'last_name': k_info.get('sn'), 'gender': k_info.get('ku_sex'), 'birthday': k_info.get('ku_born_date').replace('/', '-'), 'kaist_info': k_info} return UserProfile.objects.filter(kaist_id=info['userid']).first(), info
[ "a1sams1a@gmail.com" ]
a1sams1a@gmail.com
742a110bb63077d24dc9f3b001ade6455c465a66
0b85fbdd58eab30cf2ed5676a9c331c1ab6152f6
/cdp_viz/handlers/services/dl.py
a59f386a88dc13816e7f7bb9a1accba49a601a15
[]
no_license
pymonger/cdp-viz-pyramid
82ddac3552a0da9c1a831959ff28fdb3b21c126f
32c5f3d6f1d63c1e7e6131876da9a19ab3d25e93
refs/heads/master
2020-03-28T23:46:17.564043
2013-02-06T17:48:29
2013-02-06T17:48:29
149,307,796
0
0
null
null
null
null
UTF-8
Python
false
false
3,392
py
import logging, simplejson, pprint, re, os, sys from urllib2 import urlopen from urllib import urlencode from datetime import datetime from string import Template from Levenshtein import ratio, median from pyramid.httpexceptions import HTTPFound from pyramid_handlers import action from beaker.cache import CacheManager import cdp_viz.handlers.base as base import cdp_viz.models as model from cdp_viz.lib.timeUtils import getDatetimeFromString, getISODateTimeString from cdp_viz.lib.sparql import MD5_SPARQL_TMPL, MANIFEST_SPARQL_TMPL, sparqlQuery from cdp_viz.lib.sessionGraph import rdf2sessionGraph log = logging.getLogger(__name__) CDE_PACKAGE_TMPL = Template('''#!/bin/sh wget "${LDOS_BASE_URL}/data/download?hash=${hash}" -O $file for i in `cat session_manifest.txt`; do file=`echo $$i | awk 'BEGIN{FS=","}{print $$1}'` filebase=`basename $$file` dir=`dirname $$file` md5=`echo $$i | awk 'BEGIN{FS=","}{print $$2}'` oct_perms=`echo $$i | awk 'BEGIN{FS=","}{print $$6}'` perms=`python -c "print oct(int($$oct_perms))[-3:]"` mkdir -p $$dir wget -q "${LDOS_BASE_URL}/data/download?file=$${filebase}&hash=$${md5}" -O $$file chmod $$perms $$file echo "downloaded: $$file" done ''') class Download(base.Handler): @action(renderer="string") def sessionEntities(self): sessionId = self.request.params.get('sessionId') #log.debug("sessionId: %s" % sessionId) d = simplejson.loads(sparqlQuery(MD5_SPARQL_TMPL.substitute(uri=sessionId))) #log.debug(pprint.pformat(d)) wgetLines = [] for res in d['results']['bindings']: entity = res['entity']['value'] hash = res['md5']['value'] match = re.search(r'http://provenance\.jpl\.nasa\.gov/cdp#(.*?)/\d{4}-\d{2}-\d{2}T\d{2}_\d{2}_\d{2}.*?$', entity) if match: file = os.path.basename(match.group(1)) wgetLines.append("wget %s/data/download?hash=%s -O %s" % (self.request.registry.settings['ldos.url'], hash, file)) return "#!/bin/sh\n%s\n" % "\n".join(wgetLines) @action(renderer="string") def cde(self): self.request.response.content_disposition = 'attachment; filename="wget_cde_package.sh"' sessionId = self.request.params.get('sessionId') #log.debug("sessionId: %s" % sessionId) d = simplejson.loads(sparqlQuery(MANIFEST_SPARQL_TMPL.substitute(uri=sessionId))) #log.debug(pprint.pformat(d)) wgetLines = [] for res in d['results']['bindings']: loc = res['loc']['value'] hash = res['md5']['value'] match = re.search(r'(.*?)(?:/\d{4}-\d{2}-\d{2}T\d{2}_\d{2}_\d{2}.*?)?$', loc) if match: file = os.path.basename(match.group(1)) return CDE_PACKAGE_TMPL.substitute(LDOS_BASE_URL=self.request.registry.settings['ldos.url'], hash=hash, file=file) return "No CDE package for session %s." % sessionId def download(self): filename = self.request.params.get('filename') md5 = self.request.params.get('hash') return HTTPFound(location="%s/data/download?filename=%s&hash=%s" % ( self.request.registry.settings['ldos.url'], filename, md5))
[ "pymonger@gmail.com" ]
pymonger@gmail.com
d95f88ed338598e044b6a53db4251f64f315e6ec
94095d8679bc57b8c2e8aea2577885866aae95bd
/loopchain/container/__init__.py
220d4e66427987a2cb88ef4dc59fa786a9eef80f
[ "Apache-2.0" ]
permissive
r0hack/loopchain
7a19b6d322515785be5f8b809be1aea74fc6e555
0203e4aedbdaeae37e0aebbb4ba06db8e849f337
refs/heads/master
2023-08-08T14:07:30.312320
2019-08-20T10:09:50
2019-08-20T10:09:50
212,174,458
0
0
Apache-2.0
2023-09-05T15:14:04
2019-10-01T18:50:03
null
UTF-8
Python
false
false
729
py
# Copyright 2018 ICON Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """package for inner gRPC services and its container process""" from .container import * from .rest_service import * from .rest_service_rs import *
[ "winDy@windystudio.com" ]
winDy@windystudio.com
7a0f0a0597796fa0162856101750ed284aa1ff1a
71788a22dcaeb2fbde56b87fabf7ee21df3a770f
/students/K_Shaffer/lesson01/break_me.py
b979b120e4ee70be0f97a4f03d3b5aae925ba5cb
[]
no_license
UWPCE-PythonCert-ClassRepos/Python210_Fall2019
5bdfc1c919666eccb42ee07a1d7e385b21f11652
e45481671684a3cc8a469461a15cd9f660752ee0
refs/heads/master
2020-08-05T16:33:53.068983
2019-12-29T09:57:59
2019-12-29T09:57:59
212,615,940
4
34
null
2019-12-29T09:58:00
2019-10-03T15:38:40
Python
UTF-8
Python
false
false
315
py
''' Author: K. Shaffer Course: Python 210 Date: 10/8/2019 ''' #def nameError(): # x = yes def syntaxError(): print this will throw a SyntaxError #def typeError(): # x = "yes" # y = x^4 #def attributeError(): # x = 5 # print (x.length) #nameError() syntaxError() #typeError() #attributeError()
[ "korykumasaka@gmail.com" ]
korykumasaka@gmail.com
837fbe4686d686b4687cf0483d8c30f829dc753f
1e01bb1277476f0179a0196beb5495bfce4b9e01
/apps/admin/__init__.py
90a8e5786023c3e3e252b2ca1390023c856cbbb5
[]
no_license
DaLongmao2/MycmsPro
84d1673b248fe12e293d33d7e71ddaab9c18c601
f6600d77284b39977c5cf989ca9d1017015ca735
refs/heads/master
2023-01-23T17:24:11.484928
2020-12-04T13:45:46
2020-12-04T13:55:17
318,714,423
0
0
null
null
null
null
UTF-8
Python
false
false
66
py
#encoding:utf-8 from .views import bp from apps.admin import hooks
[ "q872039610" ]
q872039610
02b1729d71b2eb9105fa0bfcc34087f304ec5eb1
072e858f4b0c8a3f983ca3afdbd27fdf93398a47
/manage.py
fcdd636355fbf6e290a72d81f4184bf0c2a695ff
[]
no_license
jashandeep1659/techno-reuhez-testing-2
acaa84de1d22d5b4415be8c28ae6f0d08b2e41f9
6e14eb30c138447f6c34c603e447c858bdeba517
refs/heads/main
2023-05-07T15:30:37.018146
2021-05-20T15:21:16
2021-05-20T15:21:16
369,213,338
0
0
null
null
null
null
UTF-8
Python
false
false
668
py
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'techno_ruhez.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if __name__ == '__main__': main()
[ "jjashan505@gmail.com" ]
jjashan505@gmail.com
a6278c75e17da474ad8532cdb99a989ef4fa4911
51081fa3517f241b0d19039164837850de964bf0
/files_handler.py
3e60769cacbafa51576294c737e452e8867e5606
[ "MIT" ]
permissive
Nagendra1693/TER
97295f4f4f1ef0648ad7abde69a9d985432b06ae
ee437106c7e26c08c84b3c4c9c742d37f2c0b9d2
refs/heads/master
2020-03-30T08:43:43.387146
2018-10-01T04:12:08
2018-10-01T04:12:08
151,035,019
0
0
null
null
null
null
UTF-8
Python
false
false
25,554
py
import os import requests from bs4 import BeautifulSoup import pandas as pd import datetime import json import downloader import payload_data # import json_parser_3 headers = {"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"} today = datetime.datetime.now() file_date = "_" + str(today.day) + "_" + str(today.month) + "_" + str(today.year) def get_aditya_birla(): url = "https://mutualfund.adityabirlacapital.com/resources/total-expense-ratio" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") file_link = "https://mutualfund.adityabirlacapital.com/api/sitecore/ExpenseRatio/GetFundExpenseRatio" excel_template_raw = soup.find("input",{"id" : "ExcelTemplateId"}) excel_template_soup = BeautifulSoup(str(excel_template_raw), "html.parser") excel_template = excel_template_soup.find("input",{"id" : "ExcelTemplateId"})["value"] yesterday = datetime.datetime.now() - datetime.timedelta(days=1) months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"] start_date = "01-"+months[yesterday.month -1]+"-"+str(yesterday.year) end_date = str(yesterday.day)+"-"+months[yesterday.month -1]+"-"+str(yesterday.year) payload = { "ExcelTemplateId" : excel_template, "ClientIP": soup.find("input",{"id" : "ClientIP"})["value"], "ExcelTemplateRange" : soup.find("input",{"id" : "ExcelTemplateRange"})["value"], "ExcelFileName" : soup.find("input",{"id" : "ExcelFileName"})["value"], "ExpRatioFundName" : "allfunds", "ExpRatioFromDate" : start_date, "ExpRatioToDate": end_date } downloader.save_file(fund_name = "adityabirla", file_link = file_link, file_type = ".xlsx", payload = payload, session = None, verify = True) def get_axis(): url = "https://www.axismf.com/total-expense-ratio" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") set_session_url = "https://www.axismf.com/TER/SetSession" session_data = soup.find("div", {"id" : "_Ter"}).find("div", {"class" : "col-sm-12"}) session_payload = { "html" : str(session_data) } session = requests.Session() set_session = session.post(url = set_session_url, headers = headers, data = session_payload) today = datetime.datetime.now() day = str(today.day) if today.day > 9 else "0"+str(today.day) month = str(today.month) if today.month > 9 else "0"+str(today.month) start_date = str(today.year) + "-" + month + "-01" end_date = str(today.year) + "-" + month + "-" + day file_link = "https://www.axismf.com/TER/DownloadTer" payload = { "schemeCode": "ALL", "planMode": "ALL", "fromDate": start_date, "toDate": end_date } downloader.save_file(fund_name = "axis", file_link = file_link, file_type = ".html", payload = payload, session = session, verify = True) def get_baroda(): file_link = "https://online.barodapioneer.in/expenseratio/expenseratios.aspx" payload = payload_data.get_baroda_payload() downloader.save_file(fund_name = "baroda", file_link = file_link, file_type = ".xls", payload = payload, session = None, verify = True) def get_bnpparibas(): file_link = "https://www.bnpparibasmf.in/export/expense.xls" downloader.save_file(fund_name = "bnpparibas", file_link = file_link, file_type = ".xls", payload = None, session = None, verify = True) def get_boi(): url = "https://www.boiaxamf.com/AjaxService.asmx/GetDocuments" payload = { "pagno":"0", "category":None, "fromDate":None, "toDate":None, "LibraryName":"InvestorCorner", "folderName":"TOTAL EXPENSE RATIO OF MF SCHEMES", "CategoryValue":"no" } page = requests.post(url = url, headers = headers, json= payload) json_response = json.loads(page.content) json_response_sub = json_response["d"] data_raw = json.loads(json_response_sub) file_link = data_raw["Documents"][0]["FolderUrl"] downloader.save_file(fund_name = "boi", file_link = file_link, file_type = ".xlsx", payload = None, session = None, verify = True) def get_canara(): url = "https://online.canararobeco.com/crmfexptest/expenseratio.aspx" downloader.save_file(fund_name = "canara", file_link = url, file_type = ".html", payload = None, session = None, verify = True) def get_dhfl(): url = "http://dhflpramericamf.com/statutory-disclosure/portfolio-related/expense-ratio" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") file_link = "http://dhflpramericamf.com" file_link += soup.find("div", {"id":"T486E3985025_Col00"}).find("div",{"class":"section-body"}).find("a",{"title":"Expense Ratio"})["href"] downloader.save_file(fund_name = "dhfl", file_link = file_link, file_type = ".xlsx", payload = None, session = None, verify = True) def get_edelweiss(): url = "http://edelweissmf.com/StatutoryDisclosures/Expense.aspx" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") view_state = soup.find("input",{"id":"__VIEWSTATE"})["value"] view_state_generator = soup.find("input",{"id":"__VIEWSTATEGENERATOR"})["value"] file_link = "http://edelweissmf.com/StatutoryDisclosures/Expense.aspx" payload = { "__EVENTTARGET" : "ctl00$ContentPlaceHolder1$LbPath", "__EVENTARGUMENT" : "", "__VIEWSTATE" : view_state, "__VIEWSTATEGENERATOR" : view_state_generator, "__VIEWSTATEENCRYPTED" : "" } downloader.save_file(fund_name = "edelweiss", file_link = file_link, file_type = ".xls", payload = payload, session = None, verify = True) def get_essel(): url = "https://mutualfund.esselfinance.com/EsselMF_FileManager/dnd_others_expences_ratios.php" file_link = "https://mutualfund.esselfinance.com/EsselMF_FileManager/" page = requests.get(url = url, headers = headers, verify = False) soup = BeautifulSoup(page.content, "html.parser") file_link += soup.find("div",{"class" : "inner_matter_right_area"}).find("a")["href"] downloader.save_file(fund_name = "essel", file_link = file_link, file_type = ".xls", payload = None, session = None, verify = False) def get_franklintempleton(): url = "https://www.franklintempletonindia.com/content-international/data-files/en-in-retail/reportsdata.json" file_link = "https://www.franklintempletonindia.com/downloadsServlet/xls/" page = requests.get(url = url, headers = headers) json_response = json.loads(page.content) files_list = json_response["config"]["firstdropdown"][13]["dataRecords"]["linkdata"] for item in files_list: if item["assetType"] == "xlsx": name = item["name"] link = item["link"] break val = name.split(" ") for v in val: file_link += v.lower() + "-" file_link += link.split("docid=")[1] downloader.save_file(fund_name = "franklintempleton", file_link = file_link, file_type = ".xlsx", payload = None, session = None, verify = True) def get_hdfc(): url = "https://cms.hdfcfund.com/en/hdfc/api/v1/ter/reports" payload = { "year" : "2018", "month" : "9" } page = requests.post(url = url, headers =headers, data = payload) json_response = json.loads(page.content) file_link = json_response["data"]["reports"]["files"][0]["file"]["url"] downloader.save_file(fund_name = "hdfc", file_link = file_link, file_type = ".xls", payload = None, session = None, verify = True) def get_hsbc(): session = requests.Session() url = "https://www.camsonline.com/CAMS_Consent.aspx?ReturnUrl=%2fCOL_HSBCDownload.aspx" page = session.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") view_state = soup.find("input", {"id" : "__VIEWSTATE"})["value"] view_state_generator = soup.find("input", {"id" : "__VIEWSTATEGENERATOR"})["value"] payload = { "__VIEWSTATE" : view_state, "__VIEWSTATEGENERATOR": view_state_generator, "Proceed" : "rdo_accept", "btn_Proceed" : "PROCEED" } set_session = session.post(url = url, headers = headers, data = payload) file_link = "https://www.camsonline.com/COL_HSBCDownload.aspx" downloader.save_file(fund_name = "hsbc", file_link = file_link, file_type = ".xlsb", payload = None, session = session, verify = True) def get_icici(): url = "https://www.icicipruamc.com/Downloads/total-expense-ratio.aspx" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") event_target_raw = soup.find("div",{"class" : "DivContent"}).findAll("a")[1]["href"] start = event_target_raw.find("doPostBack('") + 12 end = event_target_raw.find("','')", start) event_target = event_target_raw[start:end] payload = { "__EVENTTARGET" : event_target, "__EVENTARGUMENT" : "", "__VIEWSTATE" : soup.find("input",{"id" : "__VIEWSTATE"})["value"], "__VIEWSTATEGENERATOR" : soup.find("input",{"id" : "__VIEWSTATEGENERATOR"})["value"], "ctl00$SiteSearch$SearchBox1$ctl00$ctl00$queryText" : "Site Search", "ddlGroupLinks" : "--- ICICI Bank Group Links ---" } downloader.save_file(fund_name = "icici", file_link = url, file_type = ".xlsx", payload = payload, session = None, verify = True) def get_idbi(): url = "https://www.idbimutual.co.in/statutory-disclosure/total-expense-ratio-of-mutual-fund-schemes" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") file_link ="https://www.idbimutual.co.in" + soup.find("table", {"class","our_invester_type_table footable"}).find("a")["href"] downloader.save_file(fund_name = "idbi", file_link = file_link, file_type = ".xls", payload = None, session = None, verify = True) def get_idfc(): url = "https://www.idfcmf.com/total-expense-ratio.aspx" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") file_link = "https://www.idfcmf.com/" + soup.find("div",{"class" : "quick_access_tab_cont expenses-ratioMF"}).find("a")["href"][2:] downloader.save_file(fund_name = "idfc", file_link = file_link, file_type = ".xlsx", payload = None, session = None, verify = True) def get_iifcl(): url = "http://iifclmf.com/investor-relations/grievance-redressal/" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") file_link = "" links = soup.find_all("a") for link in links: if link["href"].find("TER-Data") != -1: file_link = link["href"] break downloader.save_file(fund_name = "iifcl", file_link = file_link, file_type = ".xlsx", payload = None, session = None, verify = True) def get_iifl(): file_link = "https://www.iiflmf.com/expense-ratio-data/download" downloader.save_file(fund_name = "iifl", file_link = file_link, file_type = ".xls", payload = None, session = None, verify = True) def get_ilfs(): file_link = "http://www.ilfsinfrafund.com/otherfile/TER_IL&FS_MF_IDF.xls" downloader.save_file(fund_name = "ilfs", file_link = file_link, file_type = ".xls", payload = None, session = None, verify = True) def get_indiabulls(): url = "http://www.indiabullsamc.com/downloads/total-expense-ratio-of-mutual-fund-schemes/" page = requests.get(url = url, headers= headers) soup = BeautifulSoup(page.content, "html.parser") file_link = "" links = soup.find("div", {"class":"financial-name"}).findAll("a") for link in links: if link.get_text().find("Total Expense Ratio for all Schemes") != -1: file_link = link["href"] break downloader.save_file(fund_name = "indiabulls", file_link = file_link, file_type = ".xls", payload = None, session = None, verify = True) def get_invesco(): url = "https://invescomutualfund.com/api/TotalExpenseRatioOfMutualFundSchmes?year="+str(today.year) page = requests.get(url = url,headers = headers) json_response = json.loads(page.content) file_link = json_response[0]["tabYear"][0]["finan"][0]["Url"] downloader.save_file(fund_name = "invesco", file_link = file_link, file_type = ".xls", payload = None, session = None, verify = True) def get_jmfinancial(): file_link = "http://www.jmfinancialmf.com/CMT/Upload/TER/TER%20Format.xlsx" downloader.save_file(fund_name = "jmfinancial", file_link = file_link, file_type = ".xlsx", payload = None, session = None, verify = True) def get_kotak(): session = requests.Session() url = "https://assetmanagement.kotak.com/total-expense-ratio" page = session.get(url = url, headers= headers) soup = BeautifulSoup(page.content, "html.parser") form = soup.find("table", {"class":"product-table"}).findAll("form")[-1] file_link = form["action"] payload = { form.find("input")["name"] : form.find("input")["value"] } downloader.save_file(fund_name = "kotak", file_link = file_link, file_type = ".xls", payload = payload, session = session, verify = True) def get_ltfs(): url = "https://www.ltfs.com/companies/lnt-investment-management/downloads.html" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") file_link = "https://www.ltfs.com" + soup.find("div", {"class":"dynamic-asset-values-noticesdownloads_1699538133"}).findAll("div",{"class":"mr-notice-content-wrap"})[0].find("a")["href"] downloader.save_file(fund_name = "ltfs", file_link = file_link, file_type = ".xlsx", payload = None, session = None, verify = True) def get_lic(): session = requests.Session() url = "https://www.licmf.com/Total_Expense_Ratio" set_session = session.get(url = url, headers= headers, verify= False) file_link = "https://www.licmf.com/Total_Expense_Ratio/get_hist_exp_rat" day = str(today.day) if today.day > 9 else "0"+str(today.day) month = str(today.month) if today.month > 9 else "0"+str(today.month) start_date = "01-" + month + "-" + str(today.year) end_date = day + "-" + month + "-" + str(today.year) payload = { "cat" : "all", "scheme" : "all", "plan" : "ALL", "rang": "D", "from_date" : start_date, "todate" : end_date } downloader.save_file(fund_name = "lic", file_link = file_link, file_type = ".html", payload = payload, session = None, verify = False) def get_mahindra(): url = "https://www.mahindramutualfund.com/downloads#ter" page = requests.get(url = url, headers= headers) soup = BeautifulSoup(page.content,"html.parser") containers = soup.findAll("div",{"class":"acc_container"}) file_link = "https://www.mahindramutualfund.com/" for c in containers: title = c.find("a").get_text() if title == "Total Expense Ratio": file_link += c.find("ul",{"class" : "download-pdf"}).findAll("a")[-1]["href"] break downloader.save_file(fund_name = "mahindra", file_link = file_link, file_type = ".xlsx", payload = None, session = None, verify = True) def get_mirae(): url = "https://www.miraeassetmf.co.in/downloads/total-expense-ratio" page = requests.get(url = url, headers= headers) soup = BeautifulSoup(page.content,"html.parser") file_link = soup.find("table",{"class":"table table-archive"}).find("tbody").findAll("tr")[0].findAll("td")[1].find("a")["href"] downloader.save_file(fund_name = "mirae", file_link = file_link, file_type = ".xls", payload = None, session = None, verify = True) def get_motilal(): session = requests.Session() url = "https://www.motilaloswalmf.com/downloads/mutual-fund/totalexpenseratio" page = session.get(url = url, headers= headers) soup = BeautifulSoup(page.content,"html.parser") view_state = soup.find("input",{"id" : "__VIEWSTATE"})["value"] event_validation = soup.find("input",{"id" : "__EVENTVALIDATION"})["value"] payload = { "ctl00_ToolkitScriptManager1_HiddenField": "", "__EVENTTARGET": "", "__EVENTARGUMENT": "", "__VIEWSTATE": view_state, "__VIEWSTATEENCRYPTED": "", "__EVENTVALIDATION": event_validation, "ctl00$ContentPlaceHolder1$schemdrp": "", "ctl00$ContentPlaceHolder1$btnExcel.x": "28", "ctl00$ContentPlaceHolder1$btnExcel.y": "21", "ctl00$Ucfooter1$nwsletter": "Email Address" } downloader.save_file(fund_name = "motilal", file_link = url, file_type = ".xls", payload = payload, session = session, verify = True) def get_ppfas(): url = "https://amc.ppfas.com/statutory-disclosures/total-expense-ratio-TER/" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") file_link =soup.find("div",{"class" : "section-white"}).find("div", {"class" : "col-sm-12"}).findAll("a")[1]["href"] downloader.save_file(fund_name = "ppfas", file_link = file_link, file_type = ".xlsx", payload = None, session = None, verify = True) def get_principal(): url = "https://www.principalindia.com/downloads-disclosures.aspx" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") file_link = "https://www.principalindia.com" + soup.find("div",{"id" : "collapse-6"}).findAll("a")[-1]["href"][2:] downloader.save_file(fund_name = "principal", file_link = file_link, file_type = ".xls", payload = None, session = None, verify = True) def get_quant(): url = "http://www.escortsmutual.com/statutory-disclosures.aspx" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") links = soup.findAll("table")[3].findAll("a") for link in links: if link.get_text().find("Total Expense Ratio of Scheme") != -1: file_link = link["href"] break downloader.save_file(fund_name = "quant", file_link = file_link, file_type = ".xls", payload = None, session = None, verify = True) def get_quantum(): session = requests.Session() url = "https://www.quantumamc.com/Totalexpenseratio.aspx" set_session = session.get(url = url, headers = headers) file_link = "https://www.quantumamc.com/AjaxMain/Common.aspx?FuncName=SEBIExportExcel" downloader.save_file(fund_name = "quantum", file_link = file_link, file_type = ".xlsx", payload = None, session = session, verify = True) def get_reliance(): url = "https://www.reliancemutual.com/Pages/Total-Expense-Ratio-of-Mutual-Fund-Schemes.aspx" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") file_link = "https://www.reliancemutual.com" + soup.findAll("ul",{"class" : "pdf"})[0].findAll("a")[0]["href"] downloader.save_file(fund_name = "reliance", file_link = file_link, file_type = ".xlsx", payload = None, session = None, verify = True) def get_sahara(): url = "http://www.saharamutual.com/downloads/TotalExpenseRatio.aspx" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") file_link = "http://www.saharamutual.com" + soup.find("div",{"id" : "m1"}).findAll("a")[0]["href"][2:] downloader.save_file(fund_name = "sahara", file_link = file_link, file_type = ".xls", payload = None, session = None, verify = True) def get_sbi(): file_link = "https://www.sbimf.com/en-us/TER_Allschemes/Ter_AllSchemes.xlsx" downloader.save_file(fund_name = "sbi", file_link = file_link, file_type = ".xlsx", payload = None, session = None, verify = True) def get_shriram(): session = requests.Session() url = "http://shriramamc.com/TER-Latest.aspx" headers = {"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"} page = session.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") view_state = soup.find("input", {"id" : "__VIEWSTATE"})["value"] event_validation = soup.find("input", {"id" : "__EVENTVALIDATION"})["value"] view_state_generator = soup.find("input", {"id" : "__VIEWSTATEGENERATOR"})["value"] payload = { "__EVENTTARGET": "ctl00$ContentPlaceHolder1$dpFund", "__EVENTARGUMENT": "", "__LASTFOCUS": "", "__VIEWSTATE": view_state, "__VIEWSTATEGENERATOR": view_state_generator, "__EVENTVALIDATION": event_validation, "ctl00$ContentPlaceHolder1$dpFund": "1", "ctl00$ContentPlaceHolder1$dpScheme": "0" } page = session.post(url = url, headers = headers, data = payload) soup = BeautifulSoup(page.content, "html.parser") view_state = soup.find("input", {"id" : "__VIEWSTATE"})["value"] event_validation = soup.find("input", {"id" : "__EVENTVALIDATION"})["value"] view_state_generator = soup.find("input", {"id" : "__VIEWSTATEGENERATOR"})["value"] payload = { "__EVENTTARGET" : "", "__EVENTARGUMENT" : "", "__LASTFOCUS" : "", "__VIEWSTATE" : view_state, "__VIEWSTATEGENERATOR" : view_state_generator, "__EVENTVALIDATION" : event_validation, "ctl00$ContentPlaceHolder1$dpFund" : "1", "ctl00$ContentPlaceHolder1$dpScheme" : "1", "ctl00$ContentPlaceHolder1$SubmitImg.x" : "35", "ctl00$ContentPlaceHolder1$SubmitImg.y" : "17" } downloader.save_file(fund_name = "shriram", file_link = url, file_type = ".html", payload = payload, session = session, verify = True) def get_sundaram(): session = requests.Session() url = "https://www.sundarammutual.com/TER" page = session.get(url= url, headers = headers) file_link = "https://www.sundarammutual.com" soup = BeautifulSoup(page.content, "html.parser") scripts = soup.findAll("script") for script in scripts: try: if script["src"].find("/ajaxpro/Views_TER,App_Web") != -1: file_link += script["src"] break except: pass headers2 = { "user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36", "X-AjaxPro-Method": "DailyTER" } page = session.post(url = file_link, headers = headers2, json = {}) json_response = json.loads(page.content) foldername = file_date[1:] if foldername not in os.listdir(): os.mkdir(foldername) file_name = foldername + "/" + "sundaram" + file_date + ".json" with open(file_name,"w") as f: json.dump(json_response,f) def get_tata(): url = "http://www.tatamutualfund.com/our-funds/total-expense-ratio" page = requests.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") file_link = "http://www.tatamutualfund.com" + soup.findAll("ul",{"class" : "XlsList"})[0].find("a")["href"] downloader.save_file(fund_name = "tata", file_link = file_link, file_type = ".xls", payload = None, session = None, verify = True) def get_taurus(): url = "https://www.taurusmutualfund.com/getfundlist.php" payload = { "action" : "getinfo" } page = requests.post(url = url, headers = headers, data = payload) json_response = json.loads(page.content) json_response = json_response["tablelog"] foldername = file_date[1:] if foldername not in os.listdir(): os.mkdir(foldername) file_name = foldername + "/" + "taurus" + file_date + ".html" with open(file_name,"w") as f: json.dump(json_response,f) def get_union(): session = requests.Session() url = "http://unionmf.com/downloads/TotalExpenseRatioOfMutualFundSchemes.aspx" page = session.get(url = url, headers = headers) soup = BeautifulSoup(page.content, "html.parser") links = soup.findAll("a") file_link = "" for link in links: if link.get_text().find("Total Expense Ratio of Mutual Fund Schemes") != -1: file_link = link["href"] downloader.save_file(fund_name = "union", file_link = file_link, file_type = ".xlsx", payload = None, session = session, verify = True) def get_uti(): day = str(today.day) if today.day > 9 else "0"+str(today.day) month = str(today.month) if today.month > 9 else "0"+str(today.month) start_date = str(today.year) + "-" + month + "-01" end_date = str(today.year) + "-" + month + "-" + day file_link = "https://www.utimf.com/get-scheme-ter/?from_date=2018-09-01&to_date=2018-09-20".format(start_date,end_date) downloader.save_file(fund_name = "uti", file_link = file_link, file_type = ".xlsx", payload = None, session = None, verify = True) issues = list() try: get_aditya_birla() except: issues.append("aditya") try: get_axis() except: issues.append("axis") try: get_baroda() except: issues.append("baroda") try: get_bnpparibas() except: issues.append("bnp") try: get_boi() except: issues.append("boi") try: get_canara() except: issues.append("canara") try: get_dhfl() except: issues.append("dhfl") try: get_edelweiss() except: issues.append("edelweiss") try: get_essel() except: issues.append("essel") try: get_franklintempleton() except: issues.append("franklintempleton") try: get_hdfc() except: issues.append("hdfc") try: get_hsbc() except: issues.append("hsbc") try: get_icici() except: issues.append("icici") try: get_idbi() except: issues.append("idbi") try: get_idfc() except: issues.append("idfc") try: get_iifcl() except: issues.append("iifcl") try: get_iifl() except: issues.append("iifl") try: get_ilfs() except: issues.append("ilfs") try: get_indiabulls() except: issues.append("indiabulls") try: get_invesco() except: issues.append("invesco") try: get_jmfinancial() except: issues.append("jmfinancial") try: get_kotak() except: issues.append("kotak") try: get_ltfs() except: issues.append("ltfs") try: get_lic() except: issues.append("lic") try: get_mahindra() except: issues.append("mahindra") try: get_mirae() except: issues.append("mirae") try: get_motilal() except: issues.append("motilal") try: get_ppfas() except: issues.append("ppfas") try: get_principal() except: issues.append("principal") try: get_quant() except: issues.append("quant") try: get_quantum() except: issues.append("quantum") try: get_reliance() except: issues.append("reliance") try: get_sahara() except: issues.append("sahara") try: get_sbi() except: issues.append("sbi") try: get_shriram() except: issues.append("shriram") try: get_sundaram() except: issues.append("sundaram") try: get_tata() except: issues.append("tata") try: get_taurus() except: issues.append("taurus") try: get_union() except: issues.append("union") try: get_uti() except: issues.append("uti") if len(issues) > 0: print(issues)
[ "nagendra1693@gmail.com" ]
nagendra1693@gmail.com
5c970dffe7023ba46848e3b65f0ad476cbb2b53e
29145db13229d311269f317bf2819af6cba7d356
/april circuits/shifts.py
bb24c3d034ba66dfbb7a8eba41e99923e3127ea4
[]
no_license
rocket3989/hackerEarth2019
802d1ca6fd03e80657cbe07a3f123e087679af4d
42c0a7005e52c3762496220136cc5c1ee93571bb
refs/heads/master
2021-07-05T01:32:42.203964
2020-12-22T03:40:20
2020-12-22T03:40:20
211,607,143
1
0
null
null
null
null
UTF-8
Python
false
false
252
py
for tc in range(int(input())): N, M, c = input().split() N = int(N) M = int(M) N = bin(N)[2:].zfill(16) if c == 'L': print(int(N[M:] + N[:M], 2)) else: print(int(N[16 - M:] + N[:16 - M], 2))
[ "rocket3989@gmail.com" ]
rocket3989@gmail.com
69c14301b8ab8f06d134a13442b2f47c2380eb95
d0459fb4064f52b19aa81d090df8d8ca9edaeead
/20-29/26.py
aee78452822f0d90099c09cdf4d738daf28b3d41
[]
no_license
barrymun/euler
3d9defbe5f79a2fb4b1286d27ac8702b5444ddca
751db69ae1c1fac507aa5b4313122fcd273c2840
refs/heads/master
2022-04-15T05:45:38.456706
2020-03-24T19:56:57
2020-03-24T19:56:57
88,738,501
0
0
null
null
null
null
UTF-8
Python
false
false
1,092
py
from __future__ import division from decimal import * getcontext().prec = 10000 # set the percision of the decimal calculations # def repeats(s): # """ # https://stackoverflow.com/a/29489919 # """ # i = (s+s).find(s, 1, -1) # return None if i == -1 else s[:i] def repeats(s): """ """ for x in range(1, len(s)): ss = s[:x] if ss * (len(s)//len(ss))+(ss[:len(s)%len(ss)]) == s: if (len(ss) > int(len(s) / 2)): return '' return ss return '' def get_recurring_cycle_string(n): """ """ x = str(Decimal(1) / Decimal(n)) x = x[2:] # remove the 0. x = x[:-1] # remove the last character which will affect the recurring sequence return x if __name__ == "__main__": # print get_recurring_cycle_string(n=6) # print get_recurring_cycle_string(n=7) # print repeats(s='0045662100456621004566210045662100456621') # print repeats(s='14285714285714285714285714285714285714285') max_len = 0 r = None for i in xrange(1, 1001): s = get_recurring_cycle_string(n=i) rs = repeats(s=s) if len(rs) > max_len: max_len = len(rs) r = i print max_len print r
[ "barrymun@tcd.ie" ]
barrymun@tcd.ie
fdfa1e8a9d40bea6460eb76fe815b1577235d733
d3f5110e5782a77cae2224114e21f62231068407
/CS-Projects/WorkingToRandomizeJuli'sColor.py
46759e53aeb49cd4175db0066bc207c95312a3dc
[]
no_license
siri-palreddy/CS550-FallTerm
4504a58a95bf6cec94627176c1d2d12f8626041e
5e6676e0d048aba57f5a7e9681d4edf30ccec7c6
refs/heads/master
2021-08-23T03:35:36.072617
2017-12-02T23:50:57
2017-12-02T23:50:57
112,882,093
0
0
null
null
null
null
UTF-8
Python
false
false
2,781
py
# import the libraries you'll need import tkinter from tkinter import * import random # recursive mandelbrot function gives us the number of iterations to escape def mandelbrot(z, c, count): # the calculations that follow are how you would do it # if you didn't use complex numbers in python; # like we did on your worksheet. # calculate z squared # calculate z squared plus c to get our new z value z = z*z + c # update iteration counter count = count + 1 # if we escape or we hit the max number of iterations # stop executing and return the number of iterations if ((count>=maxIt) or (abs(z) >= 2)): return count # otherwise, since we didn't escape or hit the max iterations, # calculate a new z again (call mandelbrot function again) return mandelbrot(z, c, count) # variables we will use throughout the program WIDTH = 640 # width and height of our picture in pixels HEIGHT = 640 xmin = random.uniform(-2, 0) # the zoom we want to see xmax = random.uniform(0,3) ymin = random.uniform(-2,0) ymax = random.uniform(0,3) maxIt = 255 # max iterations; corresponds to color #xvalues = linspace(-2, 2, 1000) #yvalues = linspace(-2, 2, 1000) # create a new Tkinter window window = Tk() # create a canvas, and place it in the window canvas = Canvas(window, width = WIDTH, height = HEIGHT, bg = "#000000") # set up the canvas so it can hold a picture img = PhotoImage(width = WIDTH, height = HEIGHT) canvas.create_image((0, 0), image = img, state = "normal", anchor = tkinter.NW) # loop through all the pixels in the image a = random.uniform(-1, 1) j = random.uniform(-1, 1) r1 = random.uniform(1, 256) r2 = random.uniform(1, 256) g1 = random.uniform(1, 256) g2 = random.uniform(1, 256) b1 = random.uniform(1, 256) b2 = random.uniform(1, 256) for row in range(HEIGHT): for col in range(WIDTH): # calculate C for each pixel z = complex(xmin + (xmax - xmin) * col / WIDTH, ymin + (ymax - ymin) * row / HEIGHT) # set z to 0 #z = complex(xvalues[row],yvalues[col]) c = complex(a, j) # execute the mandelbrot calculation mandelVal =mandelbrot(z, c,0) #Note: Red(1,13) # Green() # use the mandelbrot result to create a color if (r1*r2) rd = hex(mandelVal % r1 * r2)[2:].zfill(2) gr = hex(mandelVal % g1 * g2)[2:].zfill(2) bl = hex(mandelVal % b1 * b2)[2:].zfill(2) # update the pixel at the current position to hold # the color we created with the mandelbrot result img.put("#" + rd + gr + bl, (col, row)) # update the canvas and display our drawing canvas.pack() mainloop()
[ "noreply@github.com" ]
noreply@github.com
7f44ed7c492048c7a2268982590b8ef20b58f77e
75dcb56e318688499bdab789262839e7f58bd4f6
/_algorithms_challenges/practicepython/python-exercises-master/07-list-comprehension/exercise.py
894ad5cd07e85383178aea3f7a25e85196b75242
[]
no_license
syurskyi/Algorithms_and_Data_Structure
9a1f358577e51e89c862d0f93f373b7f20ddd261
929dde1723fb2f54870c8a9badc80fc23e8400d3
refs/heads/master
2023-02-22T17:55:55.453535
2022-12-23T03:15:00
2022-12-23T03:15:00
226,243,987
4
1
null
2023-02-07T21:01:45
2019-12-06T04:14:10
Jupyter Notebook
UTF-8
Python
false
false
270
py
# /#! /urs/bin/env python if __name__ == '__main__': all = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] odd = [number for number in all if number % 2 == 1] even = [number for number in all if number % 2 == 0] print("All: " + str(all) + '\nOdd: ' + str(odd))
[ "sergejyurskyj@yahoo.com" ]
sergejyurskyj@yahoo.com
bf1fa8a73dae7278553d1c29f2634608d33f3dc7
2297110bfad913d670b040943afc8b8f32c6bba5
/Sorting and Searching/Subarray Distinct Values/gen.py
e7c17d62aae69b235e0d5a9a49629f87de9e0edf
[]
no_license
thanhtoan1742/CSES
eb2a2223f5ee1c18411439868877eaa09eed8650
2d30deb140b15f0691bade8118fc546da5c47817
refs/heads/master
2023-09-05T16:05:46.447411
2021-11-21T02:41:40
2021-11-21T02:41:40
299,819,379
1
2
null
null
null
null
UTF-8
Python
false
false
235
py
from random import randint content = '' n = 200000 k = 200000 content += str(n) + ' ' + str(k) + '\n' for i in range(n): v = randint(1, 100000) content += str(v) + ' ' with open('input.txt', 'w+') as f: f.write(content)
[ "thanhtoan1742@gmail.com" ]
thanhtoan1742@gmail.com
9e96211c98e984f047cf72ae5af36d33726dd834
8f27cfa5e22b6db010e5c2daf53b70e713a7d23a
/data_structures /merging_tables.py
63fe60a3c5df61826f1afb4433d945519d7b1b36
[]
no_license
edadasko/coursera_algorithms
a9277006ff4da2174c436863e27a6706dbef7bf9
569c59ddbe23c14d7138042323135410bb49c74c
refs/heads/master
2020-06-14T07:03:29.300869
2019-07-25T16:16:45
2019-07-25T16:16:45
194,941,316
0
0
null
null
null
null
UTF-8
Python
false
false
2,924
py
''' Merging tables Task. There are n tables stored in some database. The tables are numbered from 1 to n. All tables share the same set of columns. Each table contains either several rows with real data or a symbolic link to another table. Initially, all tables contain data, and i-th table has ri rows. You need to perform m of the following operations: 1. Consider table number destination(i). Traverse the path of symbolic links to get to the data. 2. Consider the table number source(i) and traverse the path of symbolic links from it in the same manner as for destination(i). 3. Now, destination(i) and source(i) are the numbers of two tables with real data. If destination(i) != source(i), copy all the rows from table source(i) to table destination(i), then clear the table source(i) and instead of real data put a symbolic link to destination(i) into it. 4. Print the maximum size among all n tables (recall that size is the number of rows in the table). If the table contains only a symbolic link, its size is considered to be 0. Input Format. The first line of the input contains two integers n and m — the number of tables in the database and the number of merge queries to perform, respectively. The second line of the input contains n integers ri — the number of rows in the i-th table. Then follow m lines describing merge queries. Each of them contains two integers destination(i) and source(i) — the numbers of the tables to merge. Output Format. For each query print a line containing a single integer — the maximum of the sizes of all tables (in terms of the number of rows) after the corresponding operation. ''' import sys n, m = map(int, sys.stdin.readline().split()) lines = list(map(int, sys.stdin.readline().split())) parents = list(range(0, n)) max_lines = max(lines) def get_root(node): while node != parents[node]: node = parents[node] return node def merge(destination, source): real_destination = get_root(destination) real_source = get_root(source) if real_destination == real_source: return False lines[real_destination] += lines[real_source] global max_lines if lines[real_destination] > max_lines: max_lines = lines[real_destination] lines[source] = lines[real_destination] p = parents[source] parents[source] = real_destination while p != parents[p]: lines[p] = lines[real_destination] new_p = parents[p] parents[p] = real_destination p = new_p parents[p] = real_destination return True for i in range(m): destination, source = map(int, sys.stdin.readline().split()) merge(destination - 1, source - 1) print(max_lines)
[ "edadasko@gmail.com" ]
edadasko@gmail.com
4c4e15cd470b2fa52e799f44ca1949ab8b3d5e21
590bb2a09bc77cff28af191f162f6d3891c819d0
/vendor/migrations/0002_meal_price.py
38a2058c7505ccb2ff6caf06b3829559050c4819
[]
no_license
chestnutcone/Hangry
d3adae268986e839516f3411a4bb6d7af724ebb9
d82b04927976604b3e0ee4c49b94c93209c27ea6
refs/heads/master
2021-01-25T23:52:49.288960
2020-02-29T01:01:56
2020-02-29T01:01:56
243,231,458
0
0
null
null
null
null
UTF-8
Python
false
false
366
py
# Generated by Django 3.0.3 on 2020-02-18 04:08 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('vendor', '0001_initial'), ] operations = [ migrations.AddField( model_name='meal', name='price', field=models.FloatField(default=0), ), ]
[ "oliver37215@hotmail.com" ]
oliver37215@hotmail.com
776a03aafba3bf4e3da4f7b0dad2af5cf130631e
ca567aeb715e97ca1bbe94a374520c346f1f7650
/crud/urls.py
5786d79496d3d977eefed099fab2ab6f11e7093f
[]
no_license
vranj/crud
d89d62ddde4b5325641ad54573c8847fdec2e500
e82798fe163d3ad655ac8293f648994338deee14
refs/heads/master
2023-03-05T00:45:09.017089
2021-02-19T17:19:37
2021-02-19T17:19:37
339,982,830
0
0
null
2021-02-18T10:44:25
2021-02-18T08:25:54
Python
UTF-8
Python
false
false
873
py
"""crud URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from crudapp.views import insert_view from crudapp.views import display urlpatterns = [ path('admin/', admin.site.urls), path('',insert_view), path('display/',display), ]
[ "ran4job@gmail.com" ]
ran4job@gmail.com
92d60b2e02f8ee946dcee44aab224f6120c82c74
51cbe43482e03f300ceeb9636a572bf6ebfdb568
/utils.py
e30a8bf3eb46ad3992297e9b2318e07f07fcb456
[]
no_license
jokersunited/UrlAnalyze
7794a0c007ef0fc6a6b01168316996fc785b6e83
588114f826619942a0239f70c5bf1db4c8db76e9
refs/heads/main
2023-05-03T07:29:49.804474
2021-05-25T08:25:08
2021-05-25T08:25:08
334,889,815
0
2
null
null
null
null
UTF-8
Python
false
false
311
py
def gen_char_dict(): alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-;.!?:'\"/\|_@#$%^&*~`+-=<>()[]{}" char_dict = {} char_dict["null"] = 0 for i, char in enumerate(alphabet): char_dict[char] = i + 1 char_dict["UNK"] = len(alphabet)+1 return char_dict
[ "jshwee@gmail.com" ]
jshwee@gmail.com
c93cdbf9dac1960a0b46dc94e9f866c3365ba9ec
1081df8e651cd5e6dca306cef82af8f2d64b091f
/django_multiple_image_form/django_multiple_image_form/context_processors.py
22e2abff5fa3f9bfd310969e3f7e625e3250e54c
[]
no_license
samirtendulkar/multiple_image_adder
b8e09fd3d657ce32c7aea37a586df573f719581e
7f7a3283bbc5f5dbbbf976c17fd5a583eede1270
refs/heads/master
2020-05-04T05:44:30.922373
2019-04-07T06:30:42
2019-04-07T06:30:42
178,986,861
0
0
null
null
null
null
UTF-8
Python
false
false
208
py
def sections_processor(request): user = request.user if user.is_authenticated: drafts = user.posts.filter(is_draft=True).count() else: drafts = '' return {'drafts': drafts}
[ "samnik_12345@hotmail.com" ]
samnik_12345@hotmail.com
243c193623591d29bb3fa6344bb1b2d31f4adb6f
2753757e2d13f5dd0d1faf1264031d476e162975
/others/assignment/temp.py
ae6d46f2f1fb03391ed5c73d858f9a215d0d38a0
[]
no_license
florije1988/Suggestions
c8846dd089eab816051ecc1fc43a7fcc07580194
23718968acc16fa243c248a6ac3d4715c53daaa1
refs/heads/master
2020-05-20T07:01:54.292081
2014-08-11T07:52:02
2014-08-11T07:52:02
21,298,258
1
1
null
null
null
null
UTF-8
Python
false
false
1,279
py
# -*- coding: utf-8 -*- __author__ = 'florije' import time def reverse_str(str_arg): if len(str_arg) == 1: return str_arg else: return str_arg[-1] + reverse_str(str_arg[:-1]) if __name__ == '__main__': # s_arg = input('list:') # print s_arg # print type(s_arg) # for i in range(1, 20): # print '%02d' % i # # print "Age:%02d" % 1 # title = '' # f =file("%s.html" % title, "a") u = u'汉' print repr(u) s = u.encode('UTF-8') print repr(s) u2 = s.decode('UTF-8') print u2 print repr(u2) # u'\u6c49' # 对unicode进行解码是错误的 # s2 = u.decode('UTF-8') # 同样,对str进行编码也是错误的 # u2 = s.encode('UTF-8') a = ['anhui:0', 'shtel1:0', 'shtel2:0', 'weinan3:0', 'weinan1:0', 'weinan2:0', 'luckyhost:100', 'crh:99'] a.sort(key=lambda item: int(item.split(':')[1])) print a print reverse_str('fuboqing') t = time.clock() a = [1, 2, 3, 4, 5, 6, 7, 8, 9] # print [item * 3 if tx.index(item) < 3 else item for item in tx] # tx[:3] = [i*3 for i in tx[:3]] # print tx def aa(a): a[0] = a[0] * 3 a[1] = a[1] * 3 a[2] = a[2] * 3 return a print aa(a) print time.clock() - t
[ "florije1988@gmail.com" ]
florije1988@gmail.com
37918bdb0d4e31428108d8434477b8686f64c19d
f75609812d20d46a9f94ee0cfdb91c321d26b63d
/flask/flask_fundamentals/Number_Game/server.py
6830ce31939d2a6ef2ce63d2e02eb346853fbccf
[]
no_license
IanAranha/Python2021
eff47a20451f61b144b17f48321a7b06308aadca
d9769b8b387b77753b77f6efe3a9a270a1f158d3
refs/heads/main
2023-04-02T08:20:24.382913
2021-04-10T22:27:10
2021-04-10T22:27:10
345,918,060
0
0
null
null
null
null
UTF-8
Python
false
false
865
py
from flask import Flask, redirect, render_template, session, request import random app = Flask(__name__) app.secret_key = "0004ThisIsASecretKey" @app.route("/") def index(): if "random_number" not in session: session["random_number"] = random.randrange(0, 101) return render_template("index.html") @app.route("/guess", methods=["post"]) def guess(): if request.form["input"] == "": print("Cannot be blank") return redirect("/") session["guessed_num"] = int(request.form["input"]) if session["guessed_num"] < session["random_number"]: session["state"] = "low" elif session["guessed_num"] > session["random_number"]: session["state"] = "high" else: session["state"] = "correct" return redirect("/") @app.route("/reset", methods=["post"]) def reset(): session.clear() return redirect('/') if __name__ == "__main__": app.run(debug=True)
[ "ianorama@gmail.com" ]
ianorama@gmail.com
04f1ffee4608251faec834d03e9120fe6d4a0c51
3dace62e1fed4e782b05a0b471577d102c95d32a
/src/byro/bookkeeping/models/transaction.py
fde1b517aabb0587ac104a2b835be693701f182d
[]
no_license
pc-coholic/byro
e99217f6656f7f13049bd7dccf421f234a343880
f96a58919aca7846d7d8eac121614bbda8f37a33
refs/heads/master
2020-03-30T12:34:06.569559
2018-10-02T09:23:41
2018-10-02T09:23:41
112,169,909
0
0
null
2017-11-27T08:40:09
2017-11-27T08:40:09
null
UTF-8
Python
false
false
10,999
py
from collections import Counter from django.contrib.auth import get_user_model from django.contrib.postgres.fields import JSONField from django.db import models, transaction from django.db.models import Prefetch from django.urls import reverse from django.utils.safestring import mark_safe from byro.common.models import LogTargetMixin, log_call class TransactionQuerySet(models.QuerySet): def with_balances(self): qs = self.annotate( balances_debit=models.Sum( models.Case( models.When(~models.Q(bookings__debit_account=None), then="bookings__amount"), default=0, output_field=models.DecimalField(max_digits=8, decimal_places=2) ) ), balances_credit=models.Sum( models.Case( models.When(~models.Q(bookings__credit_account=None), then="bookings__amount"), default=0, output_field=models.DecimalField(max_digits=8, decimal_places=2) ) ) ) return qs def unbalanced_transactions(self): return self.with_balances().exclude(balances_debit=models.F('balances_credit')) class TransactionManager(models.Manager): def get_queryset(self): return TransactionQuerySet(self.model, using=self._db) def with_balances(self): return self.get_queryset().with_balances() def unbalanced_transactions(self): return self.get_queryset().unbalanced_transactions() @log_call('.created') def create(self, *args, **kwargs): return super().create(*args, **kwargs) class Transaction(models.Model, LogTargetMixin): objects = TransactionManager() LOG_TARGET_BASE = 'byro.bookkeeping.transaction' memo = models.CharField(max_length=1000, null=True) booking_datetime = models.DateTimeField(null=True) value_datetime = models.DateTimeField() modified = models.DateTimeField(auto_now=True) modified_by = models.ForeignKey( to=get_user_model(), on_delete=models.PROTECT, related_name='+', # no related lookup null=True ) reverses = models.ForeignKey( to='Transaction', on_delete=models.PROTECT, related_name='reversed_by', null=True, ) data = JSONField(null=True) @log_call('.debit.created', log_on='self') def debit(self, account, *args, **kwargs): return Booking.objects.create(transaction=self, debit_account=account, *args, **kwargs) @log_call('.credit.created', log_on='self') def credit(self, account, *args, **kwargs): return Booking.objects.create(transaction=self, credit_account=account, *args, **kwargs) @transaction.atomic def reverse(self, value_datetime=None, *args, **kwargs): if 'user_or_context' not in kwargs: raise TypeError("You need to provide a 'user_or_context' named parameter which indicates the responsible user (a User model object), request (a View instance or HttpRequest object), or generic context (a str).") user_or_context = kwargs.pop('user_or_context') user = kwargs.pop('user', None) t = Transaction.objects.create( value_datetime=value_datetime or self.value_datetime, reverses=self, user_or_context=user_or_context, user=user, *args, **kwargs, ) for b in self.bookings.all(): if b.credit_account: t.debit(account=b.credit_account, amount=b.amount, member=b.member, user_or_context=user_or_context, user=user) elif b.debit_account: t.credit(account=b.debit_account, amount=b.amount, member=b.member, user_or_context=user_or_context, user=user) t.save() self.log(user_or_context, '.reversed', user=user, reversed_by=t) return t @property def debits(self): return self.bookings.exclude(debit_account=None) @property def credits(self): return self.bookings.exclude(credit_account=None) @property def balances(self): balances = { 'debit': self.debits.aggregate(total=models.Sum('amount'))['total'] or 0, 'credit': self.credits.aggregate(total=models.Sum('amount'))['total'] or 0, } return balances @property def is_read_only(self): "Advisory property: don't modify this Transaction or its Bookings" # Future proof: For now, don't modify balanced transactions return self.is_balanced @property def is_balanced(self): if hasattr(self, 'balances_debit'): return self.balances_debit == self.balances_credit else: balances = self.balances return balances['debit'] == balances['credit'] def find_memo(self): if self.memo: return self.memo if hasattr(self, 'cached_bookings'): for booking in self.cached_bookings: if booking.memo: return booking.memo booking = self.bookings.exclude(memo=None).first() if booking: return booking.memo return None @transaction.atomic def process_transaction(self): """ Collects responses to the signal `process_transaction`. Re-raises received Exceptions. Returns the number of receivers that augmented the Transaction. """ from byro.bookkeeping.signals import process_transaction response_counter = Counter() this_counter = Counter('dummy') while (not response_counter or response_counter.most_common(1)[0][1] < 5) and sum(this_counter.values()) > 0: responses = process_transaction.send_robust(sender=self) this_counter = Counter(receiver for receiver, response in responses if response) for receiver, response in responses: if isinstance(response, Exception): raise response response_counter += this_counter if sum(response_counter.values()) < 1: raise Exception('No plugin tried to augment the transaction.') response_counter += Counter() # Remove zero and negative elements return len(response_counter) def __str__(self): return "Transaction(pk={}, memo={!r}, value_datetime={!r}{})".format( self.pk, self.find_memo(), self.value_datetime.isoformat(), ", reverses={}".format(self.reverses) if self.reverses else "", ) def get_absolute_url(self): return reverse('office:finance.transactions.detail', kwargs={'pk': self.pk}) def get_object_icon(self): return mark_safe('<i class="fa fa-money"></i> ') class BookingsQuerySet(models.QuerySet): def with_transaction_balances(self): qs = self.annotate( transaction_balances_debit=models.Sum( models.Case( models.When(~models.Q(transaction__bookings__debit_account=None), then="transaction__bookings__amount"), default=0, output_field=models.DecimalField(max_digits=8, decimal_places=2) ) ), transaction_balances_credit=models.Sum( models.Case( models.When(~models.Q(transaction__bookings__credit_account=None), then="transaction__bookings__amount"), default=0, output_field=models.DecimalField(max_digits=8, decimal_places=2) ) ) ) return qs def with_transaction_data(self): qs = self.with_transaction_balances() qs = qs.select_related( 'member', 'transaction', 'credit_account', 'debit_account', ) qs = qs.prefetch_related( Prefetch('transaction__bookings', to_attr='cached_bookings'), 'transaction__cached_bookings__credit_account', 'transaction__cached_bookings__debit_account', 'transaction__cached_bookings__member', ) return qs class Booking(models.Model): objects = BookingsQuerySet.as_manager() memo = models.CharField(max_length=1000, null=True) booking_datetime = models.DateTimeField(null=True) modified = models.DateTimeField(auto_now=True) modified_by = models.ForeignKey( to=get_user_model(), on_delete=models.PROTECT, related_name='+', # no related lookup null=True ) transaction = models.ForeignKey( to='Transaction', related_name='bookings', on_delete=models.PROTECT, ) amount = models.DecimalField( max_digits=8, decimal_places=2, ) debit_account = models.ForeignKey( to='bookkeeping.Account', related_name='debits', on_delete=models.PROTECT, null=True ) credit_account = models.ForeignKey( to='bookkeeping.Account', related_name='credits', on_delete=models.PROTECT, null=True ) member = models.ForeignKey( to='members.Member', related_name='bookings', on_delete=models.PROTECT, null=True ) importer = models.CharField(null=True, max_length=500) data = JSONField(null=True) source = models.ForeignKey( to='bookkeeping.RealTransactionSource', on_delete=models.SET_NULL, related_name='bookings', null=True, ) def __str__(self): return "{booking_type} {account} {amount} {memo}".format( booking_type='debit' if self.debit_account else 'credit', account=self.debit_account or self.credit_account, amount=self.amount, memo=self.memo, ) class Meta: # This is defense in depth, per django-db-constraints module. # FUTURE: Should also add a signal or save handler for the same # constraint in pure python db_constraints = { 'exactly_either_debit_or_credit': 'CHECK (NOT ((debit_account_id IS NULL) = (credit_account_id IS NULL)))', } def find_memo(self): if self.memo: return self.memo return self.transaction.find_memo() @property def counter_bookings(self): if hasattr(self.transaction, 'cached_bookings'): # Was prefetched with with_transaction_data() if self.debit_account: return [b for b in self.transaction.cached_bookings if b.credit_account] elif self.credit_account: return [b for b in self.transaction.cached_bookings if b.debit_account] else: if self.debit_account: return self.transaction.credits elif self.credit_account: return self.transaction.debits return None
[ "henryk@ploetzli.ch" ]
henryk@ploetzli.ch
9f4bfed842a86372e09312e300493c91242bfe2d
06eb702580b99481c04b06f5cb5f95cbcf78f7d1
/Tryblock.py
a9ac4f99f91dcd75f6e1fad1da67be814d534d1a
[]
no_license
manojnookala/20A95A0503_IICSE-A-python-lab-experiments
17c3f0f6788fd791820bc011a5dbc3e599059d17
c3884160d3ada0cd78950c27692b38145ca0e76e
refs/heads/main
2023-07-02T14:26:09.655819
2021-08-09T09:43:44
2021-08-09T09:43:44
367,543,114
0
0
null
null
null
null
UTF-8
Python
false
false
156
py
try: print("python") except: print("python is in theory subject") else: print("python is program subject") OUTPUT: python python is program subject
[ "noreply@github.com" ]
noreply@github.com
208c7cc98238a16e009ecb25b02c2d1bb56135d4
fb701e7d53eaa2d1d50f70c45f6376228001f9a8
/torchplp/utils/__init__.py
4a40caa0d1cc73696e5aa977d0807cf1ed26a116
[ "MIT" ]
permissive
Dakayadah45/torchplp
24558004a8beeb29a823bd568f7361b1ceeb5dd0
2f779bdee600eb141d5205b6d38847a0cd0762fb
refs/heads/master
2023-03-25T23:24:04.830416
2019-06-27T01:47:09
2019-06-27T01:47:09
null
0
0
null
null
null
null
UTF-8
Python
false
false
156
py
# -*- coding: utf-8 -*- """ This subpackage is the collection of some usefully utils for covec :Author: Verf :Email: verf@protonmail.com :License: MIT """
[ "verf@protonmail.com" ]
verf@protonmail.com
35640e86cf28f588fc9b3db655f767140312ca16
7ad2a4ae089c27df36760007bedc973744e0d07a
/utils/test_tensorflow.py
049254f8ec9c70f267220618255ac8847120fb07
[ "BSD-2-Clause" ]
permissive
WELLBEINGLWB/vode-2020
e77bcce57b0855cbf50ec05ad4fdf65dd660eac7
592e587a608e9e5c568b70e04c142a7e8d61aa62
refs/heads/master
2022-04-13T09:44:30.271968
2020-03-29T17:28:45
2020-03-29T17:28:45
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,935
py
import tensorflow as tf import model.build_model.model_utils as mu from tensorflow.keras import layers class TestTfBug: @tf.function def test_func_in_class(self): print("\n===== start test_func_in_class") a = tf.random.uniform((8, 100, 100, 3)) b = tf.random.uniform((8, 100, 100, 3)) # !! The backslash(\) cause the problem !! c = 0.5 * tf.reduce_mean(tf.abs(a), axis=[1, 2, 3]) + \ 0.5 * tf.reduce_mean(tf.abs(b), axis=[1, 2, 3]) print("[test_func_in_class]", c) return c @tf.function def test_func_in_class_no_return(self): a = tf.random.uniform((8, 100, 100, 3)) b = tf.random.uniform((8, 100, 100, 3)) # !! The backslash(\) cause the problem !! c = 0.5 * tf.reduce_mean(tf.abs(a), axis=[1, 2, 3]) + 0.5 * tf.reduce_mean(tf.abs(b), axis=[1, 2, 3]) @tf.function def test_func_just_func(): print("\n===== start test_func_just_func") a = tf.random.uniform((8, 100, 100, 3)) b = tf.random.uniform((8, 100, 100, 3)) # !! The backslash(\) here cause the NO problem c = 0.5 * tf.reduce_mean(tf.abs(a), axis=[1, 2, 3]) + \ 0.5 * tf.reduce_mean(tf.abs(b), axis=[1, 2, 3]) print("[test_func_just_func]", c) def test_model_dict_inout(): input1 = layers.Input(shape=(100, 100, 3), batch_size=8, name="input1") conv1 = mu.convolution(input1, 32, 5, strides=1, name="conv1a") conv1 = mu.convolution(conv1, 32, 5, strides=2, name="conv1b") conv1 = mu.convolution(conv1, 64, 5, strides=1, name="conv1c") input2 = layers.Input(shape=(50, 50, 3), batch_size=8, name="input2") conv2 = mu.convolution(input2, 32, 5, strides=1, name="conv2a") conv2 = mu.convolution(conv2, 32, 5, strides=2, name="conv2b") conv2 = mu.convolution(conv2, 64, 5, strides=1, name="conv2c") feature = layers.Input(shape=(10, 10), batch_size=8, name="input1") inputs = {"input1": input1, "input2": input2} outputs = {"output1": conv1, "output2": conv2} model = tf.keras.Model(inputs=inputs, outputs=outputs, name="double_model") model.compile(loss="MSE", optimizer="SGD") model.summary() tsinput1 = tf.random.uniform(shape=(8, 100, 100, 3), minval=0, maxval=1) tsinput2 = tf.random.uniform(shape=(8, 50, 50, 3), minval=0, maxval=1) tsfeature = tf.random.uniform(shape=(8, 10, 10), minval=0, maxval=1) print("===== dict input: NO problem -> dict output") tsinputs = {"input1": tsinput1, "input2": tsinput2} predictions = model(tsinputs) for key, pred in predictions.items(): print(f"predictions: key={key}, shape={pred.get_shape().as_list()}") print("===== list input: NO problem -> dict output") predictions = model([tsinput1, tsinput2]) for key, pred in predictions.items(): print(f"predictions: key={key}, shape={pred.get_shape().as_list()}") print("===== dict input with REVERSE order: NO problem -> dict output") tsinputs = {"input2": tsinput2, "input1": tsinput1} predictions = model(tsinputs) for key, pred in predictions.items(): print(f"predictions: key={key}, shape={pred.get_shape().as_list()}") print("===== list input with REVERSE order: PROBLEM -> dict output") predictions = model([tsinput2, tsinput1]) for key, pred in predictions.items(): print(f"predictions: key={key}, shape={pred.get_shape().as_list()}") print("first element is used as 'input1', second is used as 'input2'") def test_name_scope(): # tf eager execution ignores name scope depending on circumstances # behaviour is not consistent # below name scope results in error like # ValueError: The name "image" is used 2 times in the model. All layer names should be unique. with tf.name_scope("left") as scope: image1 = layers.Input(shape=(100, 100, 3), batch_size=8, name="image") print("image1 name:", image1.name) # => image1 name: image:0 with tf.name_scope("right") as scope: image2 = layers.Input(shape=(100, 100, 3), batch_size=8, name="image") print("image2 name:", image2.name) # => image2 name: image_1:0 output = tf.concat([image1, image2], axis=1) try: model = tf.keras.Model(inputs=[image1, image2], outputs=output) model.summary() except Exception as e: print("!! Exception:", e) def test_hierarchy_model(): input1 = layers.Input(shape=(100, 100, 3), batch_size=8, name="input1") conv1 = mu.convolution(input1, 32, 5, strides=1, name="conv1a") conv1 = mu.convolution(conv1, 32, 5, strides=2, name="conv1b") conv1 = mu.convolution(conv1, 64, 5, strides=1, name="conv1c") model1 = tf.keras.Model(inputs=input1, outputs=conv1, name="model1") input2 = layers.Input(shape=(100, 100, 3), batch_size=8, name="input2") conv2 = mu.convolution(input2, 32, 5, strides=1, name="conv2a") conv2 = mu.convolution(conv2, 64, 5, strides=2, name="conv2b") conv2 = mu.convolution(conv2, 32, 5, strides=1, name="conv2c") model2 = tf.keras.Model(inputs=input2, outputs=conv2, name="model2") input3 = layers.Input(shape=(100, 100, 3), batch_size=8, name="input3") output1 = model1(input3) output2 = model2(input3) model = tf.keras.Model(inputs=input3, outputs={"out1": output1, "out2": output2}, name="higher_model") model.summary() if __name__ == "__main__": print("tensorflow version:", tf.__version__) # This function results in WARNING:tensorflow:AutoGraph could not transform ~~ TestTfBug().test_func_in_class() # This function results in ERROR like """ TypeError: in converted code: TypeError: tf__test_func_in_class_no_return() missing 1 required positional argument: 'self' """ # TestTfBug().test_func_in_class_no_return() # This function has NOOO problem test_func_just_func() test_model_dict_inout() test_name_scope() test_hierarchy_model()
[ "goodgodgd@yonsei.ac.kr" ]
goodgodgd@yonsei.ac.kr
80027986549ef286ea0fbeedef91e67f989c1b92
1d0abaa73cc6deacd4de19889169c3dc9d0124ac
/MachineLearning/Supervised_Algorithms/linear regression is failed for logistic regression.py
49e859a37e1d74a14209edcaf6321b350aeb0e7f
[]
no_license
sawantprajakta/Machine_Learning
177c79247be0957436b9c9816a7439f100174e76
544b4a7a85eed532b532194ce626e59271dd98e5
refs/heads/master
2020-08-12T11:14:57.337402
2019-10-13T04:00:06
2019-10-13T04:00:06
213,411,199
0
0
null
null
null
null
UTF-8
Python
false
false
1,463
py
#!/usr/bin/env python # coding: utf-8 # In[9]: import numpy as np import theano as th import matplotlib.pyplot as plt # In[10]: #1st step to fetch data #create some sample data and length of each should be same xdata = np.asarray([1.2,2.0,3.6,5.8,9.11,8.51,12.55,18.52,45.12,65.12]) ydata = np.asarray([1,0,0,1,1,0,1,1,1,0]) len(ydata) # In[11]: X = th.tensor.vector(name="x") y = th.tensor.vector(name="y") # In[12]: m = th.shared(np.random.random(),name = "m") c = th.shared(np.random.random(),name = "c") # In[13]: yh = np.dot(X,m) + c # In[14]: n = xdata.size cost = th.tensor.sum((y-yh)**2)/(2*n) # In[15]: djdm = th.tensor.grad(cost,m) djdc = th.tensor.grad(cost,c) mnew = m - 0.0005*djdm cnew = c - 0.0005*djdc # In[16]: train = th.function([X,y],cost,updates=[(m,mnew),(c,cnew)])#X input nad Y output cost will find diff and will update the values of m and c test = th.function([X],yh) # In[17]: costval = [] #iteration for i in range(40000): costm=train(xdata,ydata) costval.append(costm) print(costm) # In[18]: a=np.linspace(0,70,20) b = test(a) print(b) # In[19]: print("final value of m is "+str(m.get_value())) print("final value of c is "+str(c.get_value())) print(test([65.12])) plt.scatter(xdata,ydata,color="b",label = "data") plt.plot(a,b,color = 'red',label = 'regression') plt.title("Linear Regression") plt.xlabel("xdata") plt.ylabel("ydata") plt.legend(loc=4) plt.show() # In[ ]:
[ "noreply@github.com" ]
noreply@github.com
671887b95923a74ade6b13c82c33b4957f7fe8ed
7e6cc2916a08cfc65d94a7963d782696b63365ff
/polls/presenter.py
0e31176b3f9bf055ea2f43ae92d7fff00423a8a4
[]
no_license
Chithien994/myapp
63f488519195a4fecafce6ef641cf957d2a73114
ac1491fa057b2dc89357cee98856919d0c2f2a0d
refs/heads/master
2022-12-11T12:09:04.140124
2018-09-17T04:03:28
2018-09-17T04:03:28
145,932,880
1
0
null
null
null
null
UTF-8
Python
false
false
1,060
py
from .models import Question DELETE = "delete" SAVE = "save" class PollsPresenter(): def add(request): question_text = request.POST.get('question_key','') if question_text: Question.create_question(question_text) def options(request): option = request.POST.get('option',''); if option.lower() == DELETE: Question.delete_question(request.POST.getlist('id_list')) return if option.lower() == SAVE: try: id = int(request.POST.get('question_id','')) question_text = request.POST.get('question_text','') time = request.POST.get('date_time_0','')+" "+request.POST.get('date_time_1','') Question.update_question(id, question_text, time) except Exception as e: return return def ordering(request): ordering = request.GET.get('ordering') if ordering == 'pub_date': return 'pub_date' return '-pub_date' def count(request): try: count = int(request.GET.get('count')) if count > 0: return count return Question.getCount() except Exception as e: return Question.getCount()
[ "chithien994@gmail.com" ]
chithien994@gmail.com
1ad66d35e9092d3e8813413addaeda4740f0ea04
6dda5b097a5bdcc4c42c4aaa7e25fbef25443c22
/charades/charades/test/test_acting.py
e9a34eb5515bb637c9216aa4e4e3bfd8ad529afd
[]
no_license
ElliotAOram/GhostPyramid
569d90f9d848547f311d363b21248936d853ce90
5de52d27d56f73b699c4111d0d24269d55b7fc15
refs/heads/master
2020-12-30T23:59:51.302737
2018-03-21T08:58:41
2018-03-21T11:53:55
80,560,038
0
0
null
2017-05-07T15:33:48
2017-01-31T20:39:58
Python
UTF-8
Python
false
false
3,119
py
"""Tests for the acting.html and associated view""" from selenium import webdriver from django.contrib.staticfiles.testing import StaticLiveServerTestCase class ActingTests(StaticLiveServerTestCase): """ Acting.html tests for page elements and button uses """ @classmethod def setUpClass(cls): """ Start chrome instance of webdriver """ super(ActingTests, cls).setUpClass() cls.browser = webdriver.Chrome() cls.browser.implicitly_wait(10) def setUp(self): self.browser.get('%s%s' % (self.live_server_url, '/instructions/?session_id=BSW18&user_type=Actor')) def test_page_basic_page_elements(self): """ Test the basic contents of the index """ self.browser.get('%s%s' % (self.live_server_url, '/acting/?phrase=Tennis')) self.assertTrue('Charades' in self.browser.title) page_title = self.browser.find_element_by_class_name('page_title') self.assertIsNotNone(page_title) def test_buttons_present_multi_word(self): """ Tests that the buttons for word selection are present when the phrase contains multiple words """ self.browser.get('%s%s' % (self.live_server_url, '/acting/?phrase=Shot+put')) button = self.browser.find_element_by_xpath( \ "//form[@id='word_selection']/input["+ str(1) +"]") self.assertEqual(str(1), button.get_attribute("value")) button.click() self.assertTrue('current_word_index=' + str(1) in self.browser.current_url) button = self.browser.find_element_by_xpath( \ "//form[@id='word_selection']/input["+ str(1) +"]") self.assertEqual(button.get_attribute("class"), "current_word_button") def test_complete_button(self): """ Tests that the complete word button works """ self.browser.get('%s%s' % (self.live_server_url, '/acting/?phrase=Shot+put')) self.browser.get('%s%s' % (self.live_server_url, '/acting/?current_word_index=1')) self.assertEqual(self.browser.find_element_by_class_name( \ 'current_word_button').get_attribute('value'), '1') self.browser.get('%s%s' % (self.live_server_url, '/instructions/?session_id=BSW18&user_type=Viewer')) self.browser.get('%s%s' % (self.live_server_url, '/guess/?guess=Shot&guess_type=Guess+Word')) self.browser.get('%s%s' % (self.live_server_url, '/acting/?word_complete=True')) self.assertEqual(self.browser.find_element_by_class_name( \ 'completed_word_button').get_attribute('value'), '1') def tearDown(self): self.browser.refresh() self.browser.get('%s%s' % (self.live_server_url, '/reset')) self.browser.refresh() @classmethod def tearDownClass(cls): """ Close webdriver instance """ cls.browser.refresh() cls.browser.quit() super(ActingTests, cls).tearDownClass()
[ "elo9@aber.ac.uk" ]
elo9@aber.ac.uk
b5fc5c27bf55103c13421385e42b252a54f84749
0c1d6b8dff8bedfffa8703015949b6ca6cc83f86
/lib/worklists/operator/CT/v4.0/business/GPON_2+1/QoS_DSCP/script.py
8027050e03e5cef79e0d59b75c244127b0de19af
[]
no_license
samwei8/TR069
6b87252bd53f23c37186c9433ce4d79507b8c7dd
7f6b8d598359c6049a4e6cb1eb1db0899bce7f5c
refs/heads/master
2021-06-21T11:07:47.345271
2017-08-08T07:14:55
2017-08-08T07:14:55
null
0
0
null
null
null
null
UTF-8
Python
false
false
4,812
py
#coding:utf-8 # -----------------------------rpc -------------------------- import os import sys #debug DEBUG_UNIT = False if (DEBUG_UNIT): g_prj_dir = os.path.dirname(__file__) parent1 = os.path.dirname(g_prj_dir) parent2 = os.path.dirname(parent1) parent3 = os.path.dirname(parent2) parent4 = os.path.dirname(parent3) # tr069v3\lib parent5 = os.path.dirname(parent4) # tr069v3\ sys.path.insert(0, parent4) sys.path.insert(0, os.path.join(parent4, 'common')) sys.path.insert(0, os.path.join(parent4, 'worklist')) sys.path.insert(0, os.path.join(parent4, 'usercmd')) sys.path.insert(0, os.path.join(parent5, 'vendor')) from TR069.lib.common.event import * from TR069.lib.common.error import * from time import sleep import TR069.lib.common.logs.log as log g_prj_dir = os.path.dirname(__file__) parent1 = os.path.dirname(g_prj_dir) parent2 = os.path.dirname(parent1) # dir is system try: i = sys.path.index(parent2) if (i !=0): # stratege= boost priviledge sys.path.pop(i) sys.path.insert(0, parent2) except Exception,e: sys.path.insert(0, parent2) import _Common reload(_Common) from _Common import * import _QoS reload(_QoS) from _QoS import QoS def test_script(obj): """ """ sn = obj.sn # 取得SN号 DeviceType = "GPON" # 绑定tr069模板类型.只支持ADSL\LAN\EPON三种 rollbacklist = [] # 存储工单失败时需回退删除的实例.目前缺省是不开启回退 # 初始化日志 obj.dict_ret.update(str_result=u"开始执行工单:%s........\n" % os.path.basename(os.path.dirname(__file__))) # data传参 Max = obj.dict_data.get("Max")[0] Min = obj.dict_data.get("Min")[0] ClassQueue = obj.dict_data.get("ClassQueue")[0] DSCPMarkValue = obj.dict_data.get("DSCPMarkValue")[0] M802_1_P_Value = obj.dict_data.get("M802_1_P_Value")[0] # X_CT-COM_UplinkQoS节点参数 dict_root = {'Mode':[0, 'Null'], 'Enable':[1, '1'], 'Bandwidth':[0, 'Null'], 'Plan':[1, 'priority'], 'EnableForceWeight':[0, 'Null'], 'EnableDSCPMark':[1, '1'], 'Enable802-1_P':[1, '2']} # X_CT-COM_UplinkQoS.App.{i}.节点下的参数 dict_app = {'AppName':[0, 'Null'], 'ClassQueue':[0, 'Null']} # X_CT-COM_UplinkQoS.Classification.{i}.type.{i}.节点下的参数 # 注意,使用列表嵌套字典的形式,因为基于业务的QoS保障测试-UDP时需要多个实例 list_value_type = [{'Type':[1, 'DSCP'], 'Max':[1, Max], 'Min':[1, Min], 'ProtocolList':[1, 'TCP,UDP']}] # X_CT-COM_UplinkQoS.Classification.{i}.节点下的参数 dict_classification = {'ClassQueue':[1, ClassQueue], 'DSCPMarkValue':[1, DSCPMarkValue], '802-1_P_Value':[1, M802_1_P_Value]} # X_CT-COM_UplinkQoS.PriorityQueue.{i}.节点下的参数 dict_priorityQueue = {'Enable':[1, '1'], 'Priority':[1, '1'], 'Weight':[0, 'Null']} # 开始执行QoS工单 ret, ret_data = QoS(obj, sn, DeviceType, dict_root, dict_app, list_value_type, dict_classification, dict_priorityQueue, change_account=1, rollbacklist=rollbacklist) # 将工单脚本执行结果返回到OBJ的结果中 obj.dict_ret.update(str_result=obj.dict_ret["str_result"] + ret_data) # 如果执行失败,统一调用回退机制(缺省是关闭的) if ret == ERR_FAIL: ret_rollback, ret_data_rollback = rollback(sn, rollbacklist, obj) obj.dict_ret.update(str_result=obj.dict_ret["str_result"] + ret_data_rollback) info = u"工单:%s执行结束\n" % os.path.basename(os.path.dirname(__file__)) obj.dict_ret.update(str_result=obj.dict_ret["str_result"] + info) return ret if __name__ == '__main__': log_dir = g_prj_dir log.start(name="nwf", directory=log_dir, level="DebugWarn") log.set_file_id(testcase_name="tr069") obj = MsgWorklistExecute(id_="1") obj.sn = "3F3001880F5CAD80F" dict_data= {"Min":("10","1"),"Max":("10","2"), "DSCPMarkValue":("1","3"),"M802_1_P_Value":("1","4"), "ClassQueue":("1","5")} obj.dict_data = dict_data try: ret = test_script(obj) if ret == ERR_SUCCESS: print u"测试成功" else: print u"测试失败" print "****************************************" print obj.dict_ret["str_result"] except Exception, e: print u"测试异常"
[ "zhaojunhhu@gmail.com" ]
zhaojunhhu@gmail.com
77fdcc7d6682e3b9ddecb4fabf5b61a07d9b8051
39231d3a378cd8b5b79adf2205036e4e0b4d214d
/app.py
01cef072bc9cf0ac325f9578a06425351a3c3a40
[]
no_license
AlitosJM/Streambible
e2ea269637389085e31e51858a036cb63a2a1637
6b6c5248a22a8f46dbe3e963e0eb289aea63bae2
refs/heads/main
2023-02-18T19:47:54.641916
2021-01-22T07:08:30
2021-01-22T07:08:30
331,719,377
0
0
null
null
null
null
UTF-8
Python
false
false
5,390
py
# Core Pkgs import streamlit as st import streamlit.components.v1 as stc # EDA Pkgs import pandas as pd import neattext.functions as nfx import random # Data Viz Pkgs import altair as alt import matplotlib from utils import * matplotlib.use("Agg") @st.cache def load_bible(data): return pd.read_csv(data) def main(): # st.title("StreamBible") stc.html(HTML_BANNER) menu = ["Home", "MultiVerse", "About"] df = load_bible("data/KJV_Bible.csv") choice = st.sidebar.selectbox("Menu", menu) if choice == "Home": st.subheader("Single Verse Search") # st.dataframe(df) book_list = df['book'].unique().tolist() book_name = st.sidebar.selectbox("Books", book_list) chapter = st.sidebar.number_input("Chapter", 1) verse = st.sidebar.number_input("Verse", 1) bible_df = df[df['book'] == book_name] # st.dataframe(bible_df) # Layout c1, c2 = st.beta_columns([2, 1]) # Single Verse Layout with c1: try: selected_passage = bible_df[(bible_df["chapter"] == chapter) & (bible_df["verse"] == verse)] passage_details = "{0} Chapter::{1} Verse::{2}".format(book_name, chapter, verse) st.info(passage_details) passage = "{}".format(selected_passage["text"].values[0]) st.write(passage) except Exception as e: st.warning(e.args) except: st.warning("Book out of Range") with c2: st.success("Verse of the Day") chapter_list = range(10) verse_list = range(20) ch_choice = random.choice(chapter_list) vs_choice = random.choice(verse_list) random_book_name = random.choice(book_list) st.write("Book:{},Ch:{},Vs:{}".format(random_book_name, ch_choice, vs_choice)) rand_bible_df = df[df["book"] == random_book_name] try: randomly_selected_passage = rand_bible_df[ (rand_bible_df["chapter"] == ch_choice) & (rand_bible_df["verse"] == vs_choice) ] mytext = randomly_selected_passage["text"].values[0] except: mytext = rand_bible_df[ (rand_bible_df["chapter"] == 1) & (rand_bible_df["verse"] == 1) ]["text"].values[0] # st.write(mytext) stc.html(HTML_RANDOM_TEMPLATE.format(mytext), height=300) # Search Topic/Term search_term = st.text_input("Term/Topic") with st.beta_expander("View Results"): retrieved_df = df[df["text"].str.contains(search_term)] st.dataframe(retrieved_df[["book", "chapter", "verse", "text"]]) if choice == "MultiVerse": st.subheader("MultiVerse Retrieval") book_list = df["book"].unique().tolist() book_name = st.sidebar.selectbox("Book", book_list) chapter = st.sidebar.number_input("Chapter", 1) bible_df = df[df["book"] == book_name] all_verse = bible_df["verse"].unique().tolist() verse = st.sidebar.multiselect("Verse", all_verse, default=1) selected_passage = bible_df.iloc[verse] st.dataframe(selected_passage) passage_details = "{} Chapter::{} Verse::{}".format(book_name, chapter, verse) st.info(passage_details) # Layout col1, col2 = st.beta_columns(2) # Join all text as a sentence docx = " ".join(selected_passage["text"].unique().tolist()) with col1: st.info("Details") for row in selected_passage.iterrows(): st.write(row["text"]) with col2: st.success("StudyMode") with st.beta_expander("Visualize Entities"): # st.write(docx) render_entities(docx) with st.beta_expander("Visualize Pos Tags"): tagged_docx = get_tags(docx) processed_tags = mytag_visualizer(tagged_docx) # st.write(processed_tags) # Raw stc.html(processed_tags, height=1000, scrolling=True) with st.beta_expander("Keywords"): processed_docx = nfx.remove_stopwords(docx) keywords_tokens = get_most_common_tokens(processed_docx, 5) st.write(keywords_tokens) with st.beta_expander("Verse Curve"): plot_mendelhall_curve(docx) with st.beta_expander("Word Freq Plot"): plot_word_freq_with_altair(docx) with st.beta_expander("Pos Tags Plot"): tagged_docx = get_tags(docx) tagged_df = pd.DataFrame(tagged_docx, columns=["Tokens", "Tags"]) # st.dataframe(tagged_df) df_tag_count = tagged_df["Tags"].value_counts().to_frame("counts") df_tag_count["tag_type"] = df_tag_count.index # st.dataframe(df_tag_count) c = alt.Chart(df_tag_count).mark_bar().encode(x="tag_type", y="counts") st.altair_chart(c, use_container_width=True) else: st.subheader("About") st.text("Build with Streamlit") st.text("Example from Jesse E.Agbe(JCharis)") st.success(cat) if __name__ == "__main__": main()
[ "alitosjm@gmail.com" ]
alitosjm@gmail.com
0358ca87e739da637c84f2918e2b073218f3b621
cdb165eea099890b6bd1507d7704cd21d3f7ea63
/blog/migrations/0004_blogpost_user.py
8cda57d8bc91cfaa52043972516594d8cb62f0c1
[]
no_license
afsana1210/Django_practice_code
889c44d43f950ccb77d8cafe003bc63c6064dcd4
2c1408e0be446edef5b4bad551eca286b252329e
refs/heads/master
2022-11-17T23:38:30.203735
2020-07-18T10:14:54
2020-07-18T10:14:54
280,479,607
0
0
null
null
null
null
UTF-8
Python
false
false
585
py
# Generated by Django 3.0.8 on 2020-07-15 11:11 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('blog', '0003_auto_20200708_1005'), ] operations = [ migrations.AddField( model_name='blogpost', name='user', field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), ]
[ "noreply@github.com" ]
noreply@github.com
0ebdfdaf811b84504fc1706b59f28f24ac365cf9
e05b570f2f8172193adeeb14ec864491098b2749
/NLP_FakeNews/Spam_Score.py
5bb284c7c7c1e90585345b6b47a72d8368ca8a62
[]
no_license
VipinRamadas/fake-news-detection-using-ML
e4d3e4ad19ce0747d7f330ba29d552a36263f123
14065de5a63e2ef0360905ed34c89bafed40d7bc
refs/heads/main
2023-06-18T15:18:41.511132
2021-07-11T14:14:17
2021-07-11T14:14:17
373,447,858
0
0
null
null
null
null
UTF-8
Python
false
false
3,102
py
""" Created on Tue Nov 18 16:54:40 2018 @author: gpandey """ #http://www.dt.fee.unicamp.br/~tiago/smsspamcollection/smsSpamCollection.arff import numpy as np import matplotlib.pyplot as plt import pandas as pd import pickle as pkl import pandas as pd messages = pd.read_csv('dataset/SMSSpamCollection', sep='\t', names=["label", "message"]) messages.head() messages.describe() messages.groupby('label').describe() messages['length'] = messages['message'].apply(len) messages.head() import string from nltk.corpus import stopwords # text preprocessing def text_process(mess): """ Takes in a string of text, then performs the following: 1. Remove all punctuation 2. Remove all stopwords 3. Returns a list of the cleaned text """ # Check characters to see if they are in punctuation nopunc = [char for char in mess if char not in string.punctuation] # Join the characters again to form the string. nopunc = ''.join(nopunc) # Now just remove any stopwords return [word for word in nopunc.split() if word.lower() not in stopwords.words('english')] #NLP Pipeline from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.naive_bayes import MultinomialNB from sklearn.pipeline import Pipeline pipeline = Pipeline([ ('bow', CountVectorizer(analyzer=text_process)), # strings to token integer counts ('tfidf', TfidfTransformer()), # integer counts to weighted TF-IDF scores ('classifier', MultinomialNB()), # train on TF-IDF vectors w/ Naive Bayes classifier ]) from sklearn.model_selection import train_test_split msg_train, msg_test, label_train, label_test = \ train_test_split(messages['message'], messages['label'], test_size=0.2) print(len(msg_train), len(msg_test), len(msg_train) + len(msg_test)) pipeline.fit(msg_train,label_train) predictions = pipeline.predict(msg_test.head()) # predict cat conf = pipeline.predict_proba(msg_test.head()) # predicting confidence conf predictions from sklearn.metrics import classification_report print(classification_report(predictions,label_test)) predictions df = pd.read_csv('dataset/fake_real_dataset.csv') #df['content'] = df['title'] + df['text'] import seaborn as sns sns.heatmap(df.isnull(),yticklabels=False,cbar=False,cmap='viridis') def combine_column(tuple1): if(pd.notna(tuple1[1])): if(tuple1[1].strip(' \t\n\r') == ''): return 'NA spam' else: return tuple1[1] elif(pd.notna(tuple1[0])): if(tuple1[0].strip(' \t\n\r') == ''): return 'NA spam' else: return tuple1[0] else: return 'NA spam' #df.describe() #df['content'].describe() #print(text) df['content'] = df[['title', 'text']].apply(combine_column, axis=1) #df['content1'] = df[['title', 'text']].apply(lambda x: ' '.join(x), axis=1) df.head() #dataset.shape() output1 = pipeline.predict_proba(df['content']) df['spam-score'] = output1[:,0] df.to_csv('dataset/fake_real_dataset_spam.csv')
[ "noreply@github.com" ]
noreply@github.com
33fcda9693de3c66b5e8feec3f18b116df963e95
ad1a43084c709d340b70af786dc16057ffec1fbe
/Module 1/Chapter 2/prog5.py
16a511b5d68e06f161da682c557d82588efe2347
[ "MIT" ]
permissive
PacktPublishing/Raspberry-Pi-Making-Amazing-Projects-Right-from-Scratch-
f58ad7c1f567cc7dee9bde9e5d2ac00e7a652705
49fd30ca8e1e30e7d85cf14e9dcb6e1d24d4a445
refs/heads/master
2021-06-24T22:18:39.631825
2021-01-14T08:52:38
2021-01-14T08:52:38
67,773,927
3
5
null
null
null
null
UTF-8
Python
false
false
194
py
import mcpi.minecraft as minecraft import mcpi.block as block mc = minecraft.Minecraft.create() cur_x , cur_y , cur_z = mc.player.getPos() mc.setBlock(cur_x + 1 , cur_y , cur_z , block.ICE.id )
[ "akashpatel@packtpub.net" ]
akashpatel@packtpub.net
a2d10d6ff44f902b929f0b62b703589f1f7756f7
19d43b8c175bb5304393cf9c259eacb7110dd4fc
/objectModel/Python/cdm/resolvedmodel/resolved_attribute.py
77b50937eb6d60885c0362dca92be9f242d7eb5e
[ "CC-BY-4.0", "MIT" ]
permissive
bissont/CDM
3fd814566ea1bf9d19e300cd5b438b384ce4bcba
0cffb140e0b41e526be072b547cae91a03c4cd6f
refs/heads/master
2020-12-29T12:55:23.822187
2020-02-05T02:19:27
2020-02-05T02:19:27
238,614,156
1
0
null
2020-02-06T05:21:51
2020-02-06T05:21:50
null
UTF-8
Python
false
false
5,092
py
# ---------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. # All rights reserved. # ---------------------------------------------------------------------- from typing import Any, cast, Optional, Union, TYPE_CHECKING from cdm.resolvedmodel.resolved_trait_set import ResolvedTraitSet if TYPE_CHECKING: from cdm.objectmodel import CdmAttribute, CdmAttributeContext, CdmObject, SpewCatcher from cdm.resolvedmodel import AttributeResolutionContext, ResolvedAttributeSet from cdm.utilities import ApplierState, ResolveOptions, TraitToPropertyMap ResolutionTarget = Union[CdmAttribute, ResolvedAttributeSet] class ResolvedAttribute(): def __init__(self, res_opt: 'ResolveOptions', target: 'ResolutionTarget', default_name: str, att_ctx: 'CdmAttributeContext') -> None: self.applier_state = None # type: Optional[ApplierState] self.arc = None # type: Optional[AttributeResolutionContext] self.att_ctx = att_ctx # type: CdmAttributeContext self.insert_order = 0 # type: int self.previous_resolved_name = default_name # type: str self.resolved_traits = ResolvedTraitSet(res_opt) # type: ResolvedTraitSet self.target = target # type: ResolutionTarget self._resolved_name = default_name # type: str self._ttpm = None # type: Optional[TraitToPropertyMap] @property def resolved_name(self) -> str: return self._resolved_name @resolved_name.setter def resolved_name(self, value: str) -> None: self._resolved_name = value if self.previous_resolved_name is None: self.previous_resolved_name = value @property def is_primary_key(self) -> Optional[bool]: return self._trait_to_property_map.fetch_property_value('isPrimaryKey') @property def is_read_only(self) -> Optional[bool]: return self._trait_to_property_map.fetch_property_value('isReadOnly') @property def is_nullable(self) -> Optional[bool]: return self._trait_to_property_map.fetch_property_value('isNullable') @property def data_format(self) -> str: return self._trait_to_property_map.fetch_property_value('dataFormat') @property def source_name(self) -> str: return self._trait_to_property_map.fetch_property_value('sourceName') @property def source_ordering(self) -> Optional[int]: return self._trait_to_property_map.fetch_property_value('sourceOrdering') @property def display_name(self) -> str: return self._trait_to_property_map.fetch_property_value('displayName') @property def description(self) -> str: return self._trait_to_property_map.fetch_property_value('description') @property def maximum_value(self) -> str: return self._trait_to_property_map.fetch_property_value('maximumValue') @property def minimum_value(self) -> str: return self._trait_to_property_map.fetch_property_value('minimumValue') @property def maximum_length(self) -> Optional[int]: return self._trait_to_property_map.fetch_property_value('maximumLength') @property def value_constrained_to_list(self) -> Optional[bool]: return self._trait_to_property_map.fetch_property_value('valueConstrainedToList') @property def default_value(self) -> Any: return self._trait_to_property_map.fetch_property_value('defaultValue') @property def creation_sequence(self) -> int: return self.insert_order @property def _trait_to_property_map(self) -> 'TraitToPropertyMap': from cdm.utilities import TraitToPropertyMap if self._ttpm is not None: return self._ttpm self._ttpm = TraitToPropertyMap(cast('CdmObject', self.target)) return self._ttpm def copy(self) -> 'ResolvedAttribute': # Use the options from the traits. copy = ResolvedAttribute(self.resolved_traits.res_opt, self.target, self._resolved_name, self.att_ctx) copy.resolved_traits = self.resolved_traits.shallow_copy() copy.insert_order = self.insert_order copy.arc = self.arc if self.applier_state is not None: copy.applier_state = self.applier_state.copy() return copy def spew(self, res_opt: 'ResolveOptions', to: 'SpewCatcher', indent: str, name_sort: bool) -> None: to.spew_line('{}[{}]'.format(indent, self._resolved_name)) self.resolved_traits.spew(res_opt, to, indent + '-', name_sort) def complete_context(self, res_opt: 'ResolveOptions') -> None: from cdm.objectmodel import CdmAttribute if self.att_ctx is None or self.att_ctx.name is not None: return self.att_ctx.name = self._resolved_name if isinstance(self.target, CdmAttribute): self.att_ctx.definition = self.target.create_simple_reference(res_opt) self.att_ctx.at_corpus_path = str(self.att_ctx.parent.fetch_object_definition(res_opt).at_corpus_path) + '/' + self._resolved_name
[ "nebanfic@microsoft.com" ]
nebanfic@microsoft.com
2c3f36bd187b1f9313190f7d08985f04bd8353f1
32a56cf1f4764adc75b6fab32d6e14bfecdeaf97
/Django Level 3/basic_forms_2/basic_app/forms.py
26a16169e48c51fed4f7ed32c1f0b91a55719da9
[]
no_license
sanchit-zeus/Workspace_html
52dfef7881e3c1f309bc6904a8887dcbc593728c
4ab344a151be2b426ecd9271ba7d877d64ab8808
refs/heads/master
2020-05-09T13:19:41.981502
2019-04-13T09:19:25
2019-04-13T09:19:25
181,147,101
0
0
null
null
null
null
UTF-8
Python
false
false
1,005
py
from django import forms from django.core import validators # custom validators def check_for_z(value): if value[0].lower() != 'z': raise forms.ValidationError("NAME NEEDS TO START WITH Z") class FormName(forms.Form): name = forms.CharField(validators=[check_for_z]) email = forms.EmailField() verify_email = forms.EmailField(label='Enter your emal again') text = forms.CharField(widget=forms.Textarea) botcatcher = forms.CharField(required=False,widget=forms.HiddenInput,validators=[validators.MaxLengthValidator(0)]) def clean(self): all_clean_data = super().clean() email = all_clean_data['email'] vmail = all_clean_data['verify_email'] if email != vmail: raise forms.ValidationError('MAKE SURE EMAILS MATCH') # def clean_botcatcher(self): # botcatcher = self.cleaned_data['botcatcher'] # if len(botcatcher) > 0: # raise forms.ValidationError('GOTCHA BOT') # return botcatcher
[ "35419687+sanchit-zeus@users.noreply.github.com" ]
35419687+sanchit-zeus@users.noreply.github.com
11130bd887ff55c3b35d5853fb7c9211baae7e30
a8769aba8d3985f0db0a613c6a62aa1c77ce4e82
/manage.py
54bb8764709852889475d292b07c87d092ee2cb4
[]
no_license
AkankshaTiwari09/DonationProject
8963f3995d618abdd1ad79310d1ecfb89ce0526c
dd091d6fdb56965147a5ec00b511a1343d0c18c1
refs/heads/master
2023-04-26T03:24:19.733408
2021-06-01T04:21:55
2021-06-01T04:21:55
372,698,698
0
0
null
null
null
null
UTF-8
Python
false
false
634
py
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'PaymentGateway.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if __name__ == '__main__': main()
[ "akanksha28.gkp@gmail.com" ]
akanksha28.gkp@gmail.com
136df730cde345022022edb739c912f8a89d0c63
70914130eb3c95626167426557cd698f70ff1863
/scrap/api/migrations/0001_initial.py
d326c65a35d14aef0fef0c90ec5ccd3b9676c2a5
[]
no_license
R-Krishnan21/web-scraping
1031713f5bf35d6ce00dce67bdeb99173e52191b
9f9aa05514b1bdd656bad9e1df94da172dabbbf7
refs/heads/main
2023-02-19T15:33:37.437312
2021-01-18T12:53:38
2021-01-18T12:53:38
330,641,213
0
0
null
null
null
null
UTF-8
Python
false
false
764
py
# Generated by Django 3.0.7 on 2021-01-17 08:09 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Questions', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('question', models.CharField(max_length=200)), ('detail', models.TextField()), ('votes', models.IntegerField(default=0)), ('link', models.URLField()), ('views', models.IntegerField(default=0)), ('tags', models.CharField(max_length=200)), ], ), ]
[ "krishnamkr12357@gmail.com" ]
krishnamkr12357@gmail.com
6f80ded7d8f660a562afaf5e733a56123c608dae
5339ef72c3ccda405c23ff60c97c5306810c4ec9
/src/app.py
2202ae7e3acacb24a2f44e3f0489f40fb5d8c59f
[]
no_license
matheuscarino/simple-python-flask-webapp
5a44d18937ce611866e1ebe20922580a81b33032
2efe79c61714d0b2b665828e8317cd86b73db489
refs/heads/master
2023-07-10T14:17:00.212648
2023-06-24T17:22:42
2023-06-24T17:22:42
208,187,737
0
0
null
null
null
null
UTF-8
Python
false
false
181
py
from flask import Flask app = Flask(__name__) @app.route("/") def home(): return "Hello, World!" if __name__ == "__main__": app.run(host='0.0.0.0', port=8080, debug=True)
[ "matheuscarino@gmail.com" ]
matheuscarino@gmail.com
2b9e1a91205de5663111b9f61c7cc6a51b919853
53faa0ef3496997412eb5e697bc85eb09a28f8c9
/supervised_learning/0x06-keras/5-main.py
4c36d29b9b95d170647282429ea17053b98b29ca
[]
no_license
oran2527/holbertonschool-machine_learning
aaec2ffe762b959573f98a5f4e002272a5d643a3
8761eb876046ad3c0c3f85d98dbdca4007d93cd1
refs/heads/master
2023-08-14T00:37:31.163130
2021-09-20T13:34:33
2021-09-20T13:34:33
330,999,053
0
2
null
null
null
null
UTF-8
Python
false
false
1,440
py
#!/usr/bin/env python3 """ Main file """ # Force Seed - fix for Keras SEED = 0 import os os.environ['PYTHONHASHSEED'] = str(SEED) import random random.seed(SEED) import numpy as np np.random.seed(SEED) import tensorflow as tf tf.set_random_seed(SEED) import tensorflow.keras as K session_conf = tf.ConfigProto(intra_op_parallelism_threads=1, inter_op_parallelism_threads=1) sess = tf.Session(graph=tf.get_default_graph(), config=session_conf) K.backend.set_session(sess) # Imports build_model = __import__('1-input').build_model optimize_model = __import__('2-optimize').optimize_model one_hot = __import__('3-one_hot').one_hot train_model = __import__('5-train').train_model if __name__ == '__main__': datasets = np.load('../data/MNIST.npz') X_train = datasets['X_train'] X_train = X_train.reshape(X_train.shape[0], -1) Y_train = datasets['Y_train'] Y_train_oh = one_hot(Y_train) X_valid = datasets['X_valid'] X_valid = X_valid.reshape(X_valid.shape[0], -1) Y_valid = datasets['Y_valid'] Y_valid_oh = one_hot(Y_valid) lambtha = 0.0001 keep_prob = 0.95 network = build_model(784, [256, 256, 10], ['relu', 'relu', 'softmax'], lambtha, keep_prob) alpha = 0.001 beta1 = 0.9 beta2 = 0.999 optimize_model(network, alpha, beta1, beta2) batch_size = 64 epochs = 5 train_model(network, X_train, Y_train_oh, batch_size, epochs, validation_data=(X_valid, Y_valid_oh))
[ "orlago250183@gmail.com" ]
orlago250183@gmail.com
06e91545546c5d5f9f8c5ae573bbd5682f098d9e
e7b7cc34f77c71e61aa0fa05bcc62f54fc2fc0e1
/Array/test_q056_merge_intervals.py
144e68cff13f68e05cc835a31a46718e9c0dfad5
[]
no_license
sevenhe716/LeetCode
41d2ef18f5cb317858c9b69d00bcccb743cbdf48
4a1747b6497305f3821612d9c358a6795b1690da
refs/heads/master
2020-03-16T16:12:27.461172
2019-04-22T13:27:54
2019-04-22T13:27:54
130,221,784
0
0
null
null
null
null
UTF-8
Python
false
false
498
py
import unittest from Array.q056_merge_intervals import Solution from common import Interval class TestMergeIntervals(unittest.TestCase): """Test q056_merge_intervals.py""" def test_merge_intervals(self): s = Solution() self.assertEqual([[1, 6], [8, 10], [15, 18]], s.merge([Interval(1, 3), Interval(2, 6), Interval(8, 10), Interval(15, 18)])) self.assertEqual([[1, 5]], s.merge([Interval(1, 4), Interval(4, 5)])) if __name__ == '__main__': unittest.main()
[ "429134862@qq.com" ]
429134862@qq.com
da32f7c5d77290af8959d8e13d7d608b43117cd9
8f6aa9ac9c8c2e409875bbf36fbc49b3eb37d88b
/enthought/traits/ui/value_tree.py
04dc87e1db7556f3b15b867fb608ebd7c44d0b38
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
enthought/etsproxy
5660cf562c810db2ceb6b592b6c12274bce96d73
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
refs/heads/master
2023-03-27T04:51:29.297305
2020-12-02T09:05:18
2020-12-02T09:05:18
1,632,969
3
1
NOASSERTION
2020-12-02T09:05:20
2011-04-18T22:29:56
Python
UTF-8
Python
false
false
49
py
# proxy module from traitsui.value_tree import *
[ "ischnell@enthought.com" ]
ischnell@enthought.com
e18bf4f42031dc1152129e3d095e5b10e0a4547c
4244e6cc83c31f5542bd665eccc3fc48a7f8e349
/app/auth/views.py
1860e7c022d5fbc18ff1db1ae481b7186798136d
[]
no_license
ircad-taiwan-showchwan/dicomweb
0743b9c99d5d1a48ab419577e956cafe41f1641a
d2440ea88e3e5fe48f0c375ed5ae442772aa1b08
refs/heads/master
2022-12-13T08:45:47.239644
2018-08-23T03:03:46
2018-08-23T03:03:46
145,790,960
1
1
null
2022-12-08T02:22:49
2018-08-23T02:45:38
JavaScript
UTF-8
Python
false
false
1,742
py
from flask import flash,redirect,render_template,url_for,current_app from flask_login import login_required,login_user,logout_user from . import auth from forms import LoginForm,RegistrationForm from .. import db from ..models import User from datetime import datetime from app import mail # you can now import the Mail() object from flask_mail import Message @auth.route("/login",methods=["GET","POST"]) def login(): form=LoginForm() if form.validate_on_submit(): user=User.query.filter_by(email=form.email.data).first() if user is not None and user.verify_password(form.password.data): login_user(user) if user.is_admin: return redirect(url_for("home.admin_dashboard")) else: return redirect(url_for("home.dashboard")) #flash("Invalid email or password") else: flash("Invalid email or password") return render_template("auth/login.html",form=form,title="login") @auth.route("/register",methods=["GET","POST"]) def register(): form=RegistrationForm() if form.validate_on_submit(): user=User(email=form.email.data,password=form.password.data,confirmed=1,registered_on=datetime.now(),is_admin=0) db.session.add(user) db.session.commit() #msg = Message('Hello', sender = 'gregoriusairlangga@gmail.com', recipients = ['gregorius.airlangga@atmajaya.ac.id']) #msg.body = "This is the email body" #mail.send(msg) #msg.add_recipient("somename@gmail.com") flash("You have successfully registered! You may now login") return redirect(url_for("auth.login")) return render_template("auth/register.html",form=form,title="Register") @auth.route("/logout") @login_required def logout(): logout_user() flash("You have successfully been logged out.") return redirect(url_for("auth.login"))
[ "sharmaatul11@yahoo.com" ]
sharmaatul11@yahoo.com
507604caa7ea3af680f00987149f3decf47ab05e
c58b5920354503f8c3c1ec353e16f767c8cebf9f
/practice4/myvenv/bin/django-admin.py
1a666e9be7d2074d18ba31ba70ebf7ee9a6c281e
[]
no_license
nam2934/LikeLion
0ce9b6999146fa86947a44f681cbaeb0c5b9560e
f52e148fdaf7d5f678f50dec3b4dcb38d642f90a
refs/heads/master
2020-05-18T07:17:06.496475
2019-05-06T18:34:46
2019-05-06T18:34:46
184,248,805
1
0
null
null
null
null
UTF-8
Python
false
false
173
py
#!/Users/jeongnamjin/Desktop/likelion/practice4/myvenv/bin/python3 from django.core import management if __name__ == "__main__": management.execute_from_command_line()
[ "nam2934@naver.com" ]
nam2934@naver.com
26badfb0c04bfb46b37abe64726a3d5fcd24a87b
a0134ad7265d7460e7ca9127686a850e7e826da5
/models/test/chainer/ctc/test_hierarchical_ctc.py
6acb356d8f73a700f3e2254af919d20d8b8891ad
[]
no_license
carolinebear/pytorch_end2end_speech_recognition
09ce03fb878353db1e25f599a62537655650a19c
b6b60a338d65bb369d0034f423feb09db10db8b7
refs/heads/master
2020-03-19T05:56:51.396599
2018-06-01T09:35:49
2018-06-01T09:35:49
null
0
0
null
null
null
null
UTF-8
Python
false
false
8,830
py
#! /usr/bin/env python # -*- coding: utf-8 -*- """Test hierarchical CTC models (chainer).""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys import time import unittest sys.path.append('../../../../') from models.chainer.ctc.hierarchical_ctc import HierarchicalCTC from models.test.data import generate_data, idx2char, idx2word from utils.measure_time_func import measure_time from utils.evaluation.edit_distance import compute_cer, compute_wer # from utils.training.learning_rate_controller import Controller class TestCTC(unittest.TestCase): def test(self): print("Hierarchical CTC Working check.") # CNN-CTC self.check(encoder_type='cnn', batch_norm=True, activation='relu') # CLDNN-CTC self.check(encoder_type='lstm', bidirectional=True, conv=True) self.check(encoder_type='lstm', bidirectional=True, conv=True, batch_norm=True) # Label smoothing self.check(encoder_type='lstm', bidirectional=True, label_smoothing=True) # Pyramidal encoder self.check(encoder_type='lstm', bidirectional=True, subsample=True) # Projection self.check(encoder_type='lstm', bidirectional=True, projection=True) self.check(encoder_type='lstm', bidirectional=False, projection=True) # Residual LSTM-CTC self.check(encoder_type='lstm', bidirectional=True, residual=True) self.check(encoder_type='lstm', bidirectional=True, dense_residual=True) # BLSTM-CTC self.check(encoder_type='lstm', bidirectional=True) @measure_time def check(self, encoder_type, bidirectional=False, subsample=False, projection=False, conv=False, batch_norm=False, activation='relu', residual=False, dense_residual=False, label_smoothing=False): print('==================================================') print(' encoder_type: %s' % encoder_type) print(' bidirectional: %s' % str(bidirectional)) print(' projection: %s' % str(projection)) print(' subsample: %s' % str(subsample)) print(' conv: %s' % str(conv)) print(' batch_norm: %s' % str(batch_norm)) print(' residual: %s' % str(residual)) print(' dense_residual: %s' % str(dense_residual)) print(' label_smoothing: %s' % str(label_smoothing)) print('==================================================') if conv or encoder_type == 'cnn': # pattern 1 # conv_channels = [32, 32] # conv_kernel_sizes = [[41, 11], [21, 11]] # conv_strides = [[2, 2], [2, 1]] # poolings = [[], []] # pattern 2 (VGG like) conv_channels = [64, 64] conv_kernel_sizes = [[3, 3], [3, 3]] conv_strides = [[1, 1], [1, 1]] poolings = [[2, 2], [2, 2]] fc_list = [786, 786] else: conv_channels = [] conv_kernel_sizes = [] conv_strides = [] poolings = [] fc_list = [] # Load batch data num_stack = 1 if subsample or conv or encoder_type == 'cnn' else 2 splice = 1 xs, ys, ys_sub, x_lens, y_lens, y_lens_sub = generate_data( label_type='word_char', batch_size=2, num_stack=num_stack, splice=splice, backend='chainer') num_classes = 11 num_classes_sub = 27 # Load model model = HierarchicalCTC( input_size=xs[0].shape[-1] // splice // num_stack, # 120 encoder_type=encoder_type, encoder_bidirectional=bidirectional, encoder_num_units=256, encoder_num_proj=256 if projection else 0, encoder_num_layers=2, encoder_num_layers_sub=1, fc_list=fc_list, fc_list_sub=fc_list, dropout_input=0.1, dropout_encoder=0.1, main_loss_weight=0.8, sub_loss_weight=0.2, num_classes=num_classes, num_classes_sub=num_classes_sub, parameter_init_distribution='uniform', parameter_init=0.1, recurrent_weight_orthogonal=False, init_forget_gate_bias_with_one=True, subsample_list=[] if not subsample else [True, False], num_stack=num_stack, splice=splice, conv_channels=conv_channels, conv_kernel_sizes=conv_kernel_sizes, conv_strides=conv_strides, poolings=poolings, batch_norm=batch_norm, label_smoothing_prob=0.1 if label_smoothing else 0, weight_noise_std=0, encoder_residual=residual, encoder_dense_residual=dense_residual) # Count total parameters for name in sorted(list(model.num_params_dict.keys())): num_params = model.num_params_dict[name] print("%s %d" % (name, num_params)) print("Total %.3f M parameters" % (model.total_parameters / 1000000)) # Define optimizer learning_rate = 1e-3 model.set_optimizer('adam', learning_rate_init=learning_rate, weight_decay=1e-6, clip_grad_norm=5, lr_schedule=None, factor=None, patience_epoch=None) # Define learning rate controller # lr_controller = Controller(learning_rate_init=learning_rate, # backend='chainer', # decay_start_epoch=20, # decay_rate=0.9, # decay_patient_epoch=10, # lower_better=True) # GPU setting model.set_cuda(deterministic=False, benchmark=True) # Train model max_step = 300 start_time_step = time.time() for step in range(max_step): # Step for parameter update loss, loss_main, loss_sub = model( xs, ys, x_lens, y_lens, ys_sub, y_lens_sub) model.optimizer.target.cleargrads() model.cleargrads() loss.backward() loss.unchain_backward() model.optimizer.update() # Inject Gaussian noise to all parameters if (step + 1) % 10 == 0: # Compute loss loss, loss_main, loss_sub = model( xs, ys, x_lens, y_lens, ys_sub, y_lens_sub, is_eval=True) # Decode best_hyps, _, _ = model.decode( xs, x_lens, beam_width=1, task_index=0) best_hyps_sub, _, _ = model.decode( xs, x_lens, beam_width=1, task_index=1) # TODO: fix beam search str_ref = idx2word(ys[0, :y_lens[0]]) str_hyp = idx2word(best_hyps[0]) str_ref_sub = idx2char(ys_sub[0, :y_lens_sub[0]]) str_hyp_sub = idx2char(best_hyps_sub[0]) # Compute accuracy try: wer, _, _, _ = compute_wer(ref=str_ref.split('_'), hyp=str_hyp.split('_'), normalize=True) cer, _, _, _ = compute_wer( ref=list(str_ref_sub.replace('_', '')), hyp=list(str_hyp_sub.replace('_', '')), normalize=True) except: wer = 1 cer = 1 duration_step = time.time() - start_time_step print('Step %d: loss=%.3f(%.3f/%.3f) / wer=%.3f / cer=%.3f / lr=%.5f (%.3f sec)' % (step + 1, loss, loss_main, loss_sub, wer, cer, learning_rate, duration_step)) start_time_step = time.time() # Visualize print('Ref: %s' % str_ref) print('Hyp (word): %s' % str_hyp) print('Hyp (char): %s' % str_hyp_sub) if cer < 0.1: print('Modle is Converged.') break # Update learning rate # model.optimizer, learning_rate = lr_controller.decay_lr( # optimizer=model.optimizer, # learning_rate=learning_rate, # epoch=step, # value=ler) if __name__ == "__main__": unittest.main()
[ "hiro.mhbc@gmail.com" ]
hiro.mhbc@gmail.com
38d9bd39d321cb81cc866e7a38915839381c378f
a2af85d9ab17803117381fc1976c6f8d56f54dc2
/etna/records/migrations/0005_alter_reference_number.py
8e52bc3230a66138fa825a0c26da3c2d6e297000
[]
no_license
jacobtoppm/ds-wagtail
e64a046d0ce940c146cbe608415dbe20b806b1b6
c839ab7c15c2d37e4f0337ef9abbf087ff525664
refs/heads/main
2023-09-02T22:59:15.088839
2021-10-27T11:09:51
2021-10-27T11:09:51
422,595,419
0
0
null
null
null
null
UTF-8
Python
false
false
391
py
# Generated by Django 3.1.8 on 2021-06-24 13:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('records', '0004_recordpage_arrangement'), ] operations = [ migrations.AlterField( model_name='recordpage', name='reference_number', field=models.TextField(), ), ]
[ "535833+danbentley@users.noreply.github.com" ]
535833+danbentley@users.noreply.github.com
c88a4d8e2cc001c7b88a803278245d24cd0071ad
834e36fb8e87b129eb1d67d058132c32a430229a
/rest_framework/lib/orm/peewee.py
9ba14b497de2490da6db604cd9c15cbdba049227
[]
no_license
sjl421/tornado-rest-framework
bea06fa8278e4831fcd38abfb6c8aa69e4e1e436
c61d11020d5e680b8d1c01469d764517484665bd
refs/heads/master
2020-03-18T21:09:53.524478
2018-05-11T04:57:57
2018-05-11T04:57:57
null
0
0
null
null
null
null
UTF-8
Python
false
false
168,492
py
# -*- coding: utf-8 -*- import re import time import uuid import weakref import calendar import datetime import decimal import hashlib import itertools import logging import operator import threading from copy import deepcopy from functools import wraps from inspect import isclass from collections import Callable from functools import reduce from bisect import bisect_left from bisect import bisect_right from collections import deque from collections import namedtuple from collections import OrderedDict from logging import NullHandler try: import pymysql as mysql except ImportError: mysql = None def format_date_time(value, formats, post_process=None): post_process = post_process or (lambda x: x) for fmt in formats: try: return post_process(datetime.datetime.strptime(value, fmt)) except ValueError: pass return value def sort_models_topologically(models): """Sort models topologically so that parents will precede children.""" models = set(models) seen = set() ordering = [] def dfs(model): # Omit models which are already sorted # or should not be in the list at all if model in models and model not in seen: seen.add(model) # First create models on which current model depends # (either through foreign keys or through depends_on), # then create current model itself for foreign_key in model._meta.rel.values(): dfs(foreign_key.rel_model) if model._meta.depends_on: for dependency in model._meta.depends_on: dfs(dependency) ordering.append(model) # Order models by name and table initially to guarantee total ordering. names = lambda m: (m._meta.name, m._meta.db_table) for m in sorted(models, key=names): dfs(m) return ordering def strip_parens(s): # Quick sanity check. if not s or s[0] != '(': return s ct = i = 0 l = len(s) while i < l: if s[i] == '(' and s[l - 1] == ')': ct += 1 i += 1 l -= 1 else: break if ct: # If we ever end up with negatively-balanced parentheses, then we # know that one of the outer parentheses was required. unbalanced_ct = 0 required = 0 for i in range(ct, l - ct): if s[i] == '(': unbalanced_ct += 1 elif s[i] == ')': unbalanced_ct -= 1 if unbalanced_ct < 0: required += 1 unbalanced_ct = 0 if required == ct: break ct -= required if ct > 0: return s[ct:-ct] return s _DictQueryResultWrapper = _ModelQueryResultWrapper = _SortedFieldList = _TuplesQueryResultWrapper = None logger = logging.getLogger('peewee') logger.addHandler(NullHandler()) binary_construct = lambda s: bytes(s.encode('raw_unicode_escape')) _METACLASS_ = '_metaclass_helper_' def with_metaclass(meta, base=object): return meta(_METACLASS_, (base,), {}) def reraise(tp, value, tb=None): if value.__traceback__ is not tb: raise value.with_traceback(tb) raise value MYSQL_DATE_TRUNC_MAPPING = { 'year': '%Y', 'month': '%Y-%m', 'day': '%Y-%m-%d', 'hour': '%Y-%m-%d %H', 'minute': '%Y-%m-%d %H:%i', 'second': '%Y-%m-%d %H:%i:%S' } class attrdict(dict): def __getattr__(self, attr): try: return self[attr] except KeyError: raise AttributeError(attr) # Operators used in binary expressions. OP = attrdict( AND='and', OR='or', ADD='+', SUB='-', MUL='*', DIV='/', BIN_AND='&', BIN_OR='|', XOR='^', MOD='%', EQ='=', LT='<', LTE='<=', GT='>', GTE='>=', NE='!=', IN='in', NOT_IN='not in', IS='is', IS_NOT='is not', LIKE='like', ILIKE='ilike', # 忽略大小写 BETWEEN='between', REGEXP='regexp', CONCAT='||', ) JOIN = attrdict( INNER='INNER', LEFT_OUTER='LEFT OUTER', RIGHT_OUTER='RIGHT OUTER', FULL='FULL', CROSS='CROSS', ) JOIN_INNER = JOIN.INNER JOIN_LEFT_OUTER = JOIN.LEFT_OUTER JOIN_FULL = JOIN.FULL RESULTS_NAIVE = 1 RESULTS_MODELS = 2 RESULTS_TUPLES = 3 RESULTS_DICTS = 4 RESULTS_AGGREGATE_MODELS = 5 RESULTS_NAMEDTUPLES = 6 # To support "django-style" double-underscore filters, create a mapping between # operation name and operation code, e.g. "__eq" == OP.EQ. DJANGO_MAP = { 'eq': (OP.EQ,), # 相等 'lt': (OP.LT,), # 'lte': (OP.LTE,), 'gt': (OP.GT,), 'gte': (OP.GTE,), 'ne': (OP.NE,), 'in': (OP.IN,), 'is': (OP.IS,), 'like': (OP.LIKE,), 'ilike': (OP.ILIKE,), # 忽略大小写 'regexp': (OP.REGEXP,), # 补充 "exact": (OP.EQ,), # 精确等于,忽略大小写 "contains": (OP.LIKE, '%%%s%%'), # 包含 like '%aaa%' "icontains": (OP.ILIKE, '%%%s%%'), # 包含 忽略大小写 ilike '%aaa%' "startswith": (OP.LIKE, '%s%%'), # 以...开头 "istartswith": (OP.ILIKE, '%s%%'), # 以...开头 忽略大小写 "endswith": (OP.LIKE, '%%%s'), # 以...结尾 "iendswith": (OP.ILIKE, '%%%s'), # 以...结尾,忽略大小写 } # Helper functions that are used in various parts of the codebase. def merge_dict(source, overrides): merged = source.copy() merged.update(overrides) return merged def returns_clone(func): """ Method decorator that will "clone" the object before applying the given method. This ensures that state is mutated in a more predictable fashion, and promotes the use of method-chaining. """ def inner(self, *args, **kwargs): clone = self.clone() # Assumes object implements `clone`. func(clone, *args, **kwargs) return clone inner.call_local = func # Provide a way to call without cloning. return inner def not_allowed(func): """ Method decorator to indicate a method is not allowed to be called. Will raise a `NotImplementedError`. """ def inner(self, *args, **kwargs): raise NotImplementedError('%s is not allowed on %s instances' % ( func, type(self).__name__)) return inner class Proxy(object): """ Proxy class useful for situations when you wish to defer the initialization of an object. """ __slots__ = ('obj', '_callbacks') def __init__(self): self._callbacks = [] self.initialize(None) def initialize(self, obj): self.obj = obj for callback in self._callbacks: callback(obj) def attach_callback(self, callback): self._callbacks.append(callback) return callback def __getattr__(self, attr): if self.obj is None: raise AttributeError('Cannot use uninitialized Proxy.') return getattr(self.obj, attr) def __setattr__(self, attr, value): if attr not in self.__slots__: raise AttributeError('Cannot set attribute on proxy.') return super(Proxy, self).__setattr__(attr, value) class DeferredRelation(object): _unresolved = set() def __init__(self, rel_model_name=None): self.fields = [] if rel_model_name is not None: self._rel_model_name = rel_model_name.lower() self._unresolved.add(self) def set_field(self, model_class, field, name): self.fields.append((model_class, field, name)) def set_model(self, rel_model): for model, field, name in self.fields: field.rel_model = rel_model field.add_to_class(model, name) @staticmethod def resolve(model_cls): unresolved = list(DeferredRelation._unresolved) for dr in unresolved: if dr._rel_model_name == model_cls.__name__.lower(): dr.set_model(model_cls) DeferredRelation._unresolved.discard(dr) class _CDescriptor(object): def __get__(self, instance, instance_type=None): if instance is not None: return Entity(instance._alias) return self # Classes representing the query tree. class Node(object): """Base-class for any part of a query which shall be composable.""" c = _CDescriptor() _node_type = 'node' def __init__(self): self._negated = False self._alias = None self._bind_to = None self._ordering = None # ASC or DESC. @classmethod def extend(cls, name=None, clone=False): def decorator(method): method_name = name or method.__name__ if clone: method = returns_clone(method) setattr(cls, method_name, method) return method return decorator def clone_base(self): return type(self)() def clone(self): inst = self.clone_base() inst._negated = self._negated inst._alias = self._alias inst._ordering = self._ordering inst._bind_to = self._bind_to return inst @returns_clone def __invert__(self): self._negated = not self._negated @returns_clone def alias(self, a=None): self._alias = a @returns_clone def bind_to(self, bt): """ Bind the results of an expression to a specific model type. Useful when adding expressions to a select, where the result of the expression should be placed on a joined instance. """ self._bind_to = bt @returns_clone def asc(self): self._ordering = 'ASC' @returns_clone def desc(self): self._ordering = 'DESC' def __pos__(self): return self.asc() def __neg__(self): return self.desc() def _e(op, inv=False): """ Lightweight factory which returns a method that builds an Expression consisting of the left-hand and right-hand operands, using `op`. """ def inner(self, rhs): if inv: return Expression(rhs, op, self) return Expression(self, op, rhs) return inner __and__ = _e(OP.AND) __or__ = _e(OP.OR) __add__ = _e(OP.ADD) __sub__ = _e(OP.SUB) __mul__ = _e(OP.MUL) __div__ = __truediv__ = _e(OP.DIV) __xor__ = _e(OP.XOR) __radd__ = _e(OP.ADD, inv=True) __rsub__ = _e(OP.SUB, inv=True) __rmul__ = _e(OP.MUL, inv=True) __rdiv__ = __rtruediv__ = _e(OP.DIV, inv=True) __rand__ = _e(OP.AND, inv=True) __ror__ = _e(OP.OR, inv=True) __rxor__ = _e(OP.XOR, inv=True) def __eq__(self, rhs): if rhs is None: return Expression(self, OP.IS, None) return Expression(self, OP.EQ, rhs) def __ne__(self, rhs): if rhs is None: return Expression(self, OP.IS_NOT, None) return Expression(self, OP.NE, rhs) __lt__ = _e(OP.LT) __le__ = _e(OP.LTE) __gt__ = _e(OP.GT) __ge__ = _e(OP.GTE) __lshift__ = _e(OP.IN) __rshift__ = _e(OP.IS) __mod__ = _e(OP.LIKE) __pow__ = _e(OP.ILIKE) bin_and = _e(OP.BIN_AND) bin_or = _e(OP.BIN_OR) # Special expressions. def in_(self, rhs): return Expression(self, OP.IN, rhs) def not_in(self, rhs): return Expression(self, OP.NOT_IN, rhs) def is_null(self, is_null=True): if is_null: return Expression(self, OP.IS, None) return Expression(self, OP.IS_NOT, None) def contains(self, rhs): return Expression(self, OP.ILIKE, '%%%s%%' % rhs) def startswith(self, rhs): return Expression(self, OP.ILIKE, '%s%%' % rhs) def endswith(self, rhs): return Expression(self, OP.ILIKE, '%%%s' % rhs) def between(self, low, high): return Expression(self, OP.BETWEEN, Clause(low, R('AND'), high)) def regexp(self, expression): return Expression(self, OP.REGEXP, expression) def concat(self, rhs): return StringExpression(self, OP.CONCAT, rhs) class SQL(Node): """An unescaped SQL string, with optional parameters.""" _node_type = 'sql' def __init__(self, value, *params): self.value = value self.params = params super(SQL, self).__init__() def clone_base(self): return SQL(self.value, *self.params) R = SQL # backwards-compat. class Entity(Node): """A quoted-name or entity, e.g. "table"."column".""" _node_type = 'entity' def __init__(self, *path): super(Entity, self).__init__() self.path = path def clone_base(self): return Entity(*self.path) def __getattr__(self, attr): return Entity(*filter(None, self.path + (attr,))) class Func(Node): """An arbitrary SQL function call.""" _node_type = 'func' _no_coerce = set(('count', 'sum')) def __init__(self, name, *arguments): self.name = name self.arguments = arguments self._coerce = (name.lower() not in self._no_coerce) if name else False super(Func, self).__init__() @returns_clone def coerce(self, coerce=True): self._coerce = coerce def clone_base(self): res = Func(self.name, *self.arguments) res._coerce = self._coerce return res def over(self, partition_by=None, order_by=None, start=None, end=None, window=None): if isinstance(partition_by, Window) and window is None: window = partition_by if start is not None and not isinstance(start, SQL): start = SQL(*start) if end is not None and not isinstance(end, SQL): end = SQL(*end) if window is None: sql = Window(partition_by=partition_by, order_by=order_by, start=start, end=end).__sql__() else: sql = SQL(window._alias) return Clause(self, SQL('OVER'), sql) def __getattr__(self, attr): def dec(*args, **kwargs): return Func(attr, *args, **kwargs) return dec # fn is a factory for creating `Func` objects and supports a more friendly # API. So instead of `Func("LOWER", param)`, `fn.LOWER(param)`. fn = Func(None) class Expression(Node): """A binary expression, e.g `foo + 1` or `bar < 7`.""" _node_type = 'expression' def __init__(self, lhs, op, rhs, flat=False): super(Expression, self).__init__() self.lhs = lhs self.op = op self.rhs = rhs self.flat = flat def clone_base(self): return Expression(self.lhs, self.op, self.rhs, self.flat) class StringExpression(Expression): def __add__(self, other): return self.concat(other) def __radd__(self, other): return other.concat(self) class Param(Node): """ Arbitrary parameter passed into a query. Instructs the query compiler to specifically treat this value as a parameter, useful for `list` which is special-cased for `IN` lookups. """ _node_type = 'param' def __init__(self, value, adapt=None): self.value = value self.adapt = adapt super(Param, self).__init__() def clone_base(self): return Param(self.value, self.adapt) class Passthrough(Param): _node_type = 'passthrough' class Clause(Node): """A SQL clause, one or more Node objects joined by spaces.""" _node_type = 'clause' glue = ' ' parens = False def __init__(self, *nodes, **kwargs): if 'glue' in kwargs: self.glue = kwargs['glue'] if 'parens' in kwargs: self.parens = kwargs['parens'] super(Clause, self).__init__() self.nodes = list(nodes) def clone_base(self): clone = Clause(*self.nodes) clone.glue = self.glue clone.parens = self.parens return clone class CommaClause(Clause): """One or more Node objects joined by commas, no parens.""" glue = ', ' class EnclosedClause(CommaClause): """One or more Node objects joined by commas and enclosed in parens.""" parens = True Tuple = EnclosedClause class Window(Node): CURRENT_ROW = 'CURRENT ROW' def __init__(self, partition_by=None, order_by=None, start=None, end=None): super(Window, self).__init__() self.partition_by = partition_by self.order_by = order_by self.start = start self.end = end if self.start is None and self.end is not None: raise ValueError('Cannot specify WINDOW end without start.') self._alias = self._alias or 'w' @staticmethod def following(value=None): if value is None: return SQL('UNBOUNDED FOLLOWING') return SQL('%d FOLLOWING' % value) @staticmethod def preceding(value=None): if value is None: return SQL('UNBOUNDED PRECEDING') return SQL('%d PRECEDING' % value) def __sql__(self): over_clauses = [] if self.partition_by: over_clauses.append(Clause( SQL('PARTITION BY'), CommaClause(*self.partition_by))) if self.order_by: over_clauses.append(Clause( SQL('ORDER BY'), CommaClause(*self.order_by))) if self.start is not None and self.end is not None: over_clauses.append(Clause( SQL('RANGE BETWEEN'), self.start, SQL('AND'), self.end)) elif self.start is not None: over_clauses.append(Clause(SQL('RANGE'), self.start)) return EnclosedClause(Clause(*over_clauses)) def clone_base(self): return Window(self.partition_by, self.order_by) def Check(value): return SQL('CHECK (%s)' % value) class DQ(Node): """A "django-style" filter expression, e.g. {'foo__eq': 'x'}.""" def __init__(self, **query): super(DQ, self).__init__() self.query = query def clone_base(self): return DQ(**self.query) class _StripParens(Node): _node_type = 'strip_parens' def __init__(self, node): super(_StripParens, self).__init__() self.node = node JoinMetadata = namedtuple('JoinMetadata', ( 'src_model', # Source Model class. 'dest_model', # Dest Model class. 'src', # Source, may be Model, ModelAlias 'dest', # Dest, may be Model, ModelAlias, or SelectQuery. 'attr', # Attribute name joined instance(s) should be assigned to. 'primary_key', # Primary key being joined on. 'foreign_key', # Foreign key being joined from. 'is_backref', # Is this a backref, i.e. 1 -> N. 'alias', # Explicit alias given to join expression. 'is_self_join', # Is this a self-join? 'is_expression', # Is the join ON clause an Expression? )) class Join(namedtuple('_Join', ('src', 'dest', 'join_type', 'on'))): def get_foreign_key(self, source, dest, field=None): if isinstance(source, SelectQuery) or isinstance(dest, SelectQuery): return None, None fk_field = source._meta.rel_for_model(dest, field) if fk_field is not None: return fk_field, False reverse_rel = source._meta.reverse_rel_for_model(dest, field) if reverse_rel is not None: return reverse_rel, True return None, None def get_join_type(self): return self.join_type or JOIN.INNER def model_from_alias(self, model_or_alias): if isinstance(model_or_alias, ModelAlias): return model_or_alias.model_class elif isinstance(model_or_alias, SelectQuery): return model_or_alias.model_class return model_or_alias def _join_metadata(self): # Get the actual tables being joined. src = self.model_from_alias(self.src) dest = self.model_from_alias(self.dest) join_alias = isinstance(self.on, Node) and self.on._alias or None is_expression = isinstance(self.on, (Expression, Func, SQL)) on_field = isinstance(self.on, (Field, FieldProxy)) and self.on or None if on_field: fk_field = on_field is_backref = on_field.name not in src._meta.fields else: fk_field, is_backref = self.get_foreign_key(src, dest, self.on) if fk_field is None and self.on is not None: fk_field, is_backref = self.get_foreign_key(src, dest) if fk_field is not None: primary_key = fk_field.to_field else: primary_key = None if not join_alias: if fk_field is not None: if is_backref: target_attr = dest._meta.db_table else: target_attr = fk_field.name else: try: target_attr = self.on.lhs.name except AttributeError: target_attr = dest._meta.db_table else: target_attr = None return JoinMetadata( src_model=src, dest_model=dest, src=self.src, dest=self.dest, attr=join_alias or target_attr, primary_key=primary_key, foreign_key=fk_field, is_backref=is_backref, alias=join_alias, is_self_join=src is dest, is_expression=is_expression) @property def metadata(self): if not hasattr(self, '_cached_metadata'): self._cached_metadata = self._join_metadata() return self._cached_metadata class FieldDescriptor(object): # Fields are exposed as descriptors in order to control access to the # underlying "raw" data. def __init__(self, field): self.field = field self.att_name = self.field.name def __get__(self, instance, instance_type=None): if instance is not None: return instance._data.get(self.att_name) return self.field def __set__(self, instance, value): instance._data[self.att_name] = value instance._dirty.add(self.att_name) class Field(Node): """A column on a table.""" _field_counter = 0 _order = 0 _node_type = 'field' db_field = 'unknown' def __init__(self, null=False, index=False, unique=False, verbose_name=None, help_text=None, db_column=None, default=None, choices=None, primary_key=False, sequence=None, constraints=None, schema=None, undeclared=False): self.null = null self.index = index self.unique = unique self.verbose_name = verbose_name self.help_text = help_text self.db_column = db_column self.default = default self.choices = choices # Used for metadata purposes, not enforced. self.primary_key = primary_key self.sequence = sequence # Name of sequence, e.g. foo_id_seq. self.constraints = constraints # List of column constraints. self.schema = schema # Name of schema, e.g. 'public'. self.undeclared = undeclared # Whether this field is part of schema. # Used internally for recovering the order in which Fields were defined # on the Model class. Field._field_counter += 1 self._order = Field._field_counter self._sort_key = (self.primary_key and 1 or 2), self._order self._is_bound = False # Whether the Field is "bound" to a Model. super(Field, self).__init__() def clone_base(self, **kwargs): inst = type(self)( null=self.null, index=self.index, unique=self.unique, verbose_name=self.verbose_name, help_text=self.help_text, db_column=self.db_column, default=self.default, choices=self.choices, primary_key=self.primary_key, sequence=self.sequence, constraints=self.constraints, schema=self.schema, undeclared=self.undeclared, **kwargs) if self._is_bound: inst.name = self.name inst.model_class = self.model_class inst._is_bound = self._is_bound return inst def add_to_class(self, model_class, name): """ Hook that replaces the `Field` attribute on a class with a named `FieldDescriptor`. Called by the metaclass during construction of the `Model`. """ self.name = name self.model_class = model_class self.db_column = self.db_column or self.name if not self.verbose_name: self.verbose_name = re.sub('_+', ' ', name).title() model_class._meta.add_field(self) setattr(model_class, name, FieldDescriptor(self)) self._is_bound = True def get_database(self): return self.model_class._meta.database def get_column_type(self): field_type = self.get_db_field() return self.get_database().compiler().get_column_type(field_type) def get_db_field(self): return self.db_field def get_modifiers(self): return None def coerce(self, value): return value def db_value(self, value): """Convert the python value for storage in the database.""" return value if value is None else self.coerce(value) def python_value(self, value): """Convert the database value to a pythonic value.""" return value if value is None else self.coerce(value) def as_entity(self, with_table=False): if with_table: return Entity(self.model_class._meta.db_table, self.db_column) return Entity(self.db_column) def __ddl_column__(self, column_type): """Return the column type, e.g. VARCHAR(255) or REAL.""" modifiers = self.get_modifiers() if modifiers: return SQL( '%s(%s)' % (column_type, ', '.join(map(str, modifiers)))) return SQL(column_type) def __ddl__(self, column_type): """Return a list of Node instances that defines the column.""" ddl = [self.as_entity(), self.__ddl_column__(column_type)] if not self.null: ddl.append(SQL('NOT NULL')) if self.primary_key: ddl.append(SQL('PRIMARY KEY')) if self.sequence: ddl.append(SQL("DEFAULT NEXTVAL('%s')" % self.sequence)) if self.constraints: ddl.extend(self.constraints) return ddl def __hash__(self): return hash(self.name + '.' + self.model_class.__name__) class BareField(Field): db_field = 'bare' def __init__(self, coerce=None, *args, **kwargs): super(BareField, self).__init__(*args, **kwargs) if coerce is not None: self.coerce = coerce def clone_base(self, **kwargs): return super(BareField, self).clone_base(coerce=self.coerce, **kwargs) class IntegerField(Field): db_field = 'int' coerce = int class BigIntegerField(IntegerField): db_field = 'bigint' class SmallIntegerField(IntegerField): db_field = 'smallint' class PrimaryKeyField(IntegerField): db_field = 'primary_key' def __init__(self, *args, **kwargs): kwargs['primary_key'] = True super(PrimaryKeyField, self).__init__(*args, **kwargs) class _AutoPrimaryKeyField(PrimaryKeyField): _column_name = None def __init__(self, *args, **kwargs): if 'undeclared' in kwargs and not kwargs['undeclared']: raise ValueError('%r must be created with undeclared=True.' % self) kwargs['undeclared'] = True super(_AutoPrimaryKeyField, self).__init__(*args, **kwargs) def add_to_class(self, model_class, name): if name != self._column_name: raise ValueError('%s must be named `%s`.' % (type(self), name)) super(_AutoPrimaryKeyField, self).add_to_class(model_class, name) class FloatField(Field): db_field = 'float' coerce = float class DoubleField(FloatField): db_field = 'double' class DecimalField(Field): db_field = 'decimal' def __init__(self, max_digits=10, decimal_places=5, auto_round=False, rounding=None, *args, **kwargs): self.max_digits = max_digits self.decimal_places = decimal_places self.auto_round = auto_round self.rounding = rounding or decimal.DefaultContext.rounding self._exp = decimal.Decimal(10) ** (-self.decimal_places) super(DecimalField, self).__init__(*args, **kwargs) def clone_base(self, **kwargs): return super(DecimalField, self).clone_base( max_digits=self.max_digits, decimal_places=self.decimal_places, auto_round=self.auto_round, rounding=self.rounding, **kwargs) def get_modifiers(self): return [self.max_digits, self.decimal_places] def db_value(self, value): D = decimal.Decimal if not value: return value if value is None else D(0) elif self.auto_round or not isinstance(value, D): value = D(str(value)) if value.is_normal() and self.auto_round: value = value.quantize(self._exp, rounding=self.rounding) return value def python_value(self, value): if value is not None: if isinstance(value, decimal.Decimal): return value return decimal.Decimal(str(value)) def coerce_to_unicode(s, encoding='utf-8'): if isinstance(s, str): return s elif isinstance(s, bytes): try: return s.decode(encoding) except UnicodeDecodeError: return s return str(s) class _StringField(Field): def coerce(self, value): return coerce_to_unicode(value or '') def __add__(self, other): return self.concat(other) def __radd__(self, other): return other.concat(self) class CharField(_StringField): db_field = 'string' def __init__(self, max_length=255, *args, **kwargs): self.max_length = max_length super(CharField, self).__init__(*args, **kwargs) def clone_base(self, **kwargs): return super(CharField, self).clone_base( max_length=self.max_length, **kwargs) def get_modifiers(self): return self.max_length and [self.max_length] or None class FixedCharField(CharField): db_field = 'fixed_char' def python_value(self, value): value = super(FixedCharField, self).python_value(value) if value: value = value.strip() return value class TextField(_StringField): db_field = 'text' class BlobField(Field): db_field = 'blob' _constructor = binary_construct def add_to_class(self, model_class, name): if isinstance(model_class._meta.database, Proxy): model_class._meta.database.attach_callback(self._set_constructor) return super(BlobField, self).add_to_class(model_class, name) def _set_constructor(self, database): self._constructor = database.get_binary_type() def db_value(self, value): if isinstance(value, str): value = value.encode('raw_unicode_escape') if isinstance(value, str): return self._constructor(value) return value class UUIDField(Field): db_field = 'uuid' def db_value(self, value): if isinstance(value, uuid.UUID): return value.hex try: return uuid.UUID(value).hex except: return value def python_value(self, value): if isinstance(value, uuid.UUID): return value return None if value is None else uuid.UUID(value) def _date_part(date_part): def dec(self): return self.model_class._meta.database.extract_date(date_part, self) return dec class _BaseFormattedField(Field): formats = None def __init__(self, formats=None, *args, **kwargs): if formats is not None: self.formats = formats super(_BaseFormattedField, self).__init__(*args, **kwargs) def clone_base(self, **kwargs): return super(_BaseFormattedField, self).clone_base( formats=self.formats, **kwargs) class DateTimeField(_BaseFormattedField): db_field = 'datetime' formats = [ '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M:%S', '%Y-%m-%d', ] def python_value(self, value): if value and isinstance(value, str): return format_date_time(value, self.formats) return value year = property(_date_part('year')) month = property(_date_part('month')) day = property(_date_part('day')) hour = property(_date_part('hour')) minute = property(_date_part('minute')) second = property(_date_part('second')) class DateField(_BaseFormattedField): db_field = 'date' formats = [ '%Y-%m-%d', '%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', ] def python_value(self, value): if value and isinstance(value, str): pp = lambda x: x.date() return format_date_time(value, self.formats, pp) elif value and isinstance(value, datetime.datetime): return value.date() return value year = property(_date_part('year')) month = property(_date_part('month')) day = property(_date_part('day')) class TimeField(_BaseFormattedField): db_field = 'time' formats = [ '%H:%M:%S.%f', '%H:%M:%S', '%H:%M', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M:%S', ] def python_value(self, value): if value: if isinstance(value, str): pp = lambda x: x.time() return format_date_time(value, self.formats, pp) elif isinstance(value, datetime.datetime): return value.time() if value is not None and isinstance(value, datetime.timedelta): return (datetime.datetime.min + value).time() return value hour = property(_date_part('hour')) minute = property(_date_part('minute')) second = property(_date_part('second')) class TimestampField(IntegerField): # Support second -> microsecond resolution. valid_resolutions = [10 ** i for i in range(7)] zero_value = None def __init__(self, *args, **kwargs): self.resolution = kwargs.pop('resolution', 1) or 1 if self.resolution not in self.valid_resolutions: raise ValueError('TimestampField resolution must be one of: %s' % ', '.join(str(i) for i in self.valid_resolutions)) self.utc = kwargs.pop('utc', False) or False _dt = datetime.datetime self._conv = _dt.utcfromtimestamp if self.utc else _dt.fromtimestamp _default = _dt.utcnow if self.utc else _dt.now kwargs.setdefault('default', _default) self.zero_value = kwargs.pop('zero_value', None) super(TimestampField, self).__init__(*args, **kwargs) def get_db_field(self): # For second resolution we can get away (for a while) with using # 4 bytes to store the timestamp (as long as they're not > ~2038). # Otherwise we'll need to use a BigInteger type. return (self.db_field if self.resolution == 1 else BigIntegerField.db_field) def db_value(self, value): if value is None: return if isinstance(value, datetime.datetime): pass elif isinstance(value, datetime.date): value = datetime.datetime(value.year, value.month, value.day) else: return int(round(value * self.resolution)) if self.utc: timestamp = calendar.timegm(value.utctimetuple()) else: timestamp = time.mktime(value.timetuple()) timestamp += (value.microsecond * .000001) if self.resolution > 1: timestamp *= self.resolution return int(round(timestamp)) def python_value(self, value): if value is not None and isinstance(value, (int, float)): if value == 0: return self.zero_value elif self.resolution > 1: ticks_to_microsecond = 1000000 // self.resolution value, ticks = divmod(value, self.resolution) microseconds = ticks * ticks_to_microsecond return self._conv(value).replace(microsecond=microseconds) else: return self._conv(value) return value class BooleanField(Field): db_field = 'bool' coerce = bool class RelationDescriptor(FieldDescriptor): """Foreign-key abstraction to replace a related PK with a related model.""" def __init__(self, field, rel_model): self.rel_model = rel_model super(RelationDescriptor, self).__init__(field) def get_object_or_id(self, instance): rel_id = instance._data.get(self.att_name) if rel_id is not None or self.att_name in instance._obj_cache: if self.att_name not in instance._obj_cache: obj = self.rel_model.get(self.field.to_field == rel_id) instance._obj_cache[self.att_name] = obj return instance._obj_cache[self.att_name] elif not self.field.null: raise self.rel_model.DoesNotExist return rel_id def __get__(self, instance, instance_type=None): if instance is not None: return self.get_object_or_id(instance) return self.field def __set__(self, instance, value): if isinstance(value, self.rel_model): instance._data[self.att_name] = getattr( value, self.field.to_field.name) instance._obj_cache[self.att_name] = value else: orig_value = instance._data.get(self.att_name) instance._data[self.att_name] = value if orig_value != value and self.att_name in instance._obj_cache: del instance._obj_cache[self.att_name] instance._dirty.add(self.att_name) class ReverseRelationDescriptor(object): """Back-reference to expose related objects as a `SelectQuery`.""" def __init__(self, field): self.field = field self.rel_model = field.model_class def __get__(self, instance, instance_type=None): if instance is not None: return self.rel_model.select().where( self.field == getattr(instance, self.field.to_field.name)) return self class ObjectIdDescriptor(object): """Gives direct access to the underlying id""" def __init__(self, field): self.attr_name = field.name self.field = weakref.ref(field) def __get__(self, instance, instance_type=None): if instance is not None: return instance._data.get(self.attr_name) return self.field() def __set__(self, instance, value): setattr(instance, self.attr_name, value) class ForeignKeyField(IntegerField): def __init__(self, rel_model, related_name=None, on_delete=None, on_update=None, extra=None, to_field=None, object_id_name=None, *args, **kwargs): if rel_model != 'self' and not \ isinstance(rel_model, (Proxy, DeferredRelation)) and not \ issubclass(rel_model, Model): raise TypeError('Unexpected value for `rel_model`. Expected ' '`Model`, `Proxy`, `DeferredRelation`, or "self"') self.rel_model = rel_model self._related_name = related_name self.deferred = isinstance(rel_model, (Proxy, DeferredRelation)) self.on_delete = on_delete self.on_update = on_update self.extra = extra self.to_field = to_field self.object_id_name = object_id_name super(ForeignKeyField, self).__init__(*args, **kwargs) def clone_base(self, **kwargs): return super(ForeignKeyField, self).clone_base( rel_model=self.rel_model, related_name=self._get_related_name(), on_delete=self.on_delete, on_update=self.on_update, extra=self.extra, to_field=self.to_field, object_id_name=self.object_id_name, **kwargs) def _get_descriptor(self): return RelationDescriptor(self, self.rel_model) def _get_id_descriptor(self): return ObjectIdDescriptor(self) def _get_backref_descriptor(self): return ReverseRelationDescriptor(self) def _get_related_name(self): if self._related_name and isinstance(self._related_name, Callable): return self._related_name(self) return self._related_name or ('%s_set' % self.model_class._meta.name) def add_to_class(self, model_class, name): if isinstance(self.rel_model, Proxy): def callback(rel_model): self.rel_model = rel_model self.add_to_class(model_class, name) self.rel_model.attach_callback(callback) return elif isinstance(self.rel_model, DeferredRelation): self.rel_model.set_field(model_class, self, name) return self.name = name self.model_class = model_class self.db_column = self.db_column or '%s_id' % self.name obj_id_name = self.object_id_name if not obj_id_name: obj_id_name = self.db_column if obj_id_name == self.name: obj_id_name += '_id' elif obj_id_name == self.name: raise ValueError('Cannot set a foreign key object_id_name to ' 'the same name as the field itself.') if not self.verbose_name: self.verbose_name = re.sub('_+', ' ', name).title() model_class._meta.add_field(self) self.related_name = self._get_related_name() if self.rel_model == 'self': self.rel_model = self.model_class if self.to_field is not None: if not isinstance(self.to_field, Field): self.to_field = getattr(self.rel_model, self.to_field) else: self.to_field = self.rel_model._meta.primary_key # TODO: factor into separate method. if model_class._meta.validate_backrefs: def invalid(msg, **context): context.update( field='%s.%s' % (model_class._meta.name, name), backref=self.related_name, obj_id_name=obj_id_name) raise AttributeError(msg % context) if self.related_name in self.rel_model._meta.fields: invalid('The related_name of %(field)s ("%(backref)s") ' 'conflicts with a field of the same name.') elif self.related_name in self.rel_model._meta.reverse_rel: invalid('The related_name of %(field)s ("%(backref)s") ' 'is already in use by another foreign key.') if obj_id_name in model_class._meta.fields: invalid('The object id descriptor of %(field)s conflicts ' 'with a field named %(obj_id_name)s') elif obj_id_name in model_class.__dict__: invalid('Model attribute "%(obj_id_name)s" would be shadowed ' 'by the object id descriptor of %(field)s.') setattr(model_class, name, self._get_descriptor()) setattr(model_class, obj_id_name, self._get_id_descriptor()) setattr(self.rel_model, self.related_name, self._get_backref_descriptor()) self._is_bound = True model_class._meta.rel[self.name] = self self.rel_model._meta.reverse_rel[self.related_name] = self def get_db_field(self): """ Overridden to ensure Foreign Keys use same column type as the primary key they point to. """ if not isinstance(self.to_field, PrimaryKeyField): return self.to_field.get_db_field() return super(ForeignKeyField, self).get_db_field() def get_modifiers(self): if not isinstance(self.to_field, PrimaryKeyField): return self.to_field.get_modifiers() return super(ForeignKeyField, self).get_modifiers() def coerce(self, value): return self.to_field.coerce(value) def db_value(self, value): if isinstance(value, self.rel_model): value = value._get_pk_value() return self.to_field.db_value(value) def python_value(self, value): if isinstance(value, self.rel_model): return value return self.to_field.python_value(value) class CompositeKey(object): """A primary key composed of multiple columns.""" _node_type = 'composite_key' sequence = None def __init__(self, *field_names): self.field_names = field_names def add_to_class(self, model_class, name): self.name = name self.model_class = model_class setattr(model_class, name, self) def __get__(self, instance, instance_type=None): if instance is not None: return tuple([getattr(instance, field_name) for field_name in self.field_names]) return self def __set__(self, instance, value): pass def __eq__(self, other): expressions = [(self.model_class._meta.fields[field] == value) for field, value in zip(self.field_names, other)] return reduce(operator.and_, expressions) def __ne__(self, other): return ~(self == other) def __hash__(self): return hash((self.model_class.__name__, self.field_names)) class AliasMap(object): prefix = 't' def __init__(self, start=0): self._alias_map = {} self._counter = start def __repr__(self): return '<AliasMap: %s>' % self._alias_map def add(self, obj, alias=None): if obj in self._alias_map: return self._counter += 1 self._alias_map[obj] = alias or '%s%s' % (self.prefix, self._counter) def __getitem__(self, obj): if obj not in self._alias_map: self.add(obj) return self._alias_map[obj] def __contains__(self, obj): return obj in self._alias_map def update(self, alias_map): if alias_map: for obj, alias in alias_map._alias_map.items(): if obj not in self: self._alias_map[obj] = alias return self class QueryCompiler(object): # Mapping of `db_type` to actual column type used by database driver. # Database classes may provide additional column types or overrides. field_map = { 'bare': '', 'bigint': 'BIGINT', 'blob': 'BLOB', 'bool': 'SMALLINT', 'date': 'DATE', 'datetime': 'DATETIME', 'decimal': 'DECIMAL', 'double': 'REAL', 'fixed_char': 'CHAR', 'float': 'REAL', 'int': 'INTEGER', 'primary_key': 'INTEGER', 'smallint': 'SMALLINT', 'string': 'VARCHAR', 'text': 'TEXT', 'time': 'TIME', } # Mapping of OP. to actual SQL operation. For most databases this will be # the same, but some column types or databases may support additional ops. # Like `field_map`, Database classes may extend or override these. op_map = { OP.EQ: '=', OP.LT: '<', OP.LTE: '<=', OP.GT: '>', OP.GTE: '>=', OP.NE: '!=', OP.IN: 'IN', OP.NOT_IN: 'NOT IN', OP.IS: 'IS', OP.IS_NOT: 'IS NOT', OP.BIN_AND: '&', OP.BIN_OR: '|', OP.LIKE: 'LIKE', OP.ILIKE: 'ILIKE', OP.BETWEEN: 'BETWEEN', OP.ADD: '+', OP.SUB: '-', OP.MUL: '*', OP.DIV: '/', OP.XOR: '#', OP.AND: 'AND', OP.OR: 'OR', OP.MOD: '%', OP.REGEXP: 'REGEXP', OP.CONCAT: '||', } join_map = { JOIN.INNER: 'INNER JOIN', JOIN.LEFT_OUTER: 'LEFT OUTER JOIN', JOIN.RIGHT_OUTER: 'RIGHT OUTER JOIN', JOIN.FULL: 'FULL JOIN', JOIN.CROSS: 'CROSS JOIN', } alias_map_class = AliasMap def __init__(self, quote_char='"', interpolation='?', field_overrides=None, op_overrides=None): self.quote_char = quote_char self.interpolation = interpolation self._field_map = merge_dict(self.field_map, field_overrides or {}) self._op_map = merge_dict(self.op_map, op_overrides or {}) self._parse_map = self.get_parse_map() self._unknown_types = set(['param']) def get_parse_map(self): # To avoid O(n) lookups when parsing nodes, use a lookup table for # common node types O(1). return { 'expression': self._parse_expression, 'param': self._parse_param, 'passthrough': self._parse_passthrough, 'func': self._parse_func, 'clause': self._parse_clause, 'entity': self._parse_entity, 'field': self._parse_field, 'sql': self._parse_sql, 'select_query': self._parse_select_query, 'compound_select_query': self._parse_compound_select_query, 'strip_parens': self._parse_strip_parens, 'composite_key': self._parse_composite_key, } def quote(self, s): return '%s%s%s' % (self.quote_char, s, self.quote_char) def get_column_type(self, f): return self._field_map[f] if f in self._field_map else f.upper() def get_op(self, q): return self._op_map[q] def _sorted_fields(self, field_dict): return sorted(field_dict.items(), key=lambda i: i[0]._sort_key) def _parse_default(self, node, alias_map, conv): return self.interpolation, [node] def _parse_expression(self, node, alias_map, conv): if isinstance(node.lhs, Field): conv = node.lhs lhs, lparams = self.parse_node(node.lhs, alias_map, conv) rhs, rparams = self.parse_node(node.rhs, alias_map, conv) if node.op == OP.IN and rhs == '()' and not rparams: return ('0 = 1' if node.flat else '(0 = 1)'), [] template = '%s %s %s' if node.flat else '(%s %s %s)' sql = template % (lhs, self.get_op(node.op), rhs) return sql, lparams + rparams def _parse_passthrough(self, node, alias_map, conv): if node.adapt: return self.parse_node(node.adapt(node.value), alias_map, None) return self.interpolation, [node.value] def _parse_param(self, node, alias_map, conv): if node.adapt: if conv and conv.db_value is node.adapt: conv = None return self.parse_node(node.adapt(node.value), alias_map, conv) elif conv is not None: return self.parse_node(conv.db_value(node.value), alias_map) else: return self.interpolation, [node.value] def _parse_func(self, node, alias_map, conv): conv = node._coerce and conv or None sql, params = self.parse_node_list(node.arguments, alias_map, conv) return '%s(%s)' % (node.name, strip_parens(sql)), params def _parse_clause(self, node, alias_map, conv): sql, params = self.parse_node_list( node.nodes, alias_map, conv, node.glue) if node.parens: sql = '(%s)' % strip_parens(sql) return sql, params def _parse_entity(self, node, alias_map, conv): return '.'.join(map(self.quote, node.path)), [] def _parse_sql(self, node, alias_map, conv): return node.value, list(node.params) def _parse_field(self, node, alias_map, conv): if alias_map: sql = '.'.join(( self.quote(alias_map[node.model_class]), self.quote(node.db_column))) else: sql = self.quote(node.db_column) return sql, [] def _parse_composite_key(self, node, alias_map, conv): fields = [] for field_name in node.field_names: fields.append(node.model_class._meta.fields[field_name]) return self._parse_clause(CommaClause(*fields), alias_map, conv) def _parse_compound_select_query(self, node, alias_map, conv): csq = 'compound_select_query' lhs, rhs = node.lhs, node.rhs inv = rhs._node_type == csq and lhs._node_type != csq if inv: lhs, rhs = rhs, lhs new_map = self.alias_map_class() if lhs._node_type == csq: new_map._counter = alias_map._counter sql1, p1 = self.generate_select(lhs, new_map) sql2, p2 = self.generate_select(rhs, self.calculate_alias_map(rhs, new_map)) # We add outer parentheses in the event the compound query is used in # the `from_()` clause, in which case we'll need them. if node.database.compound_select_parentheses: if lhs._node_type != csq: sql1 = '(%s)' % sql1 if rhs._node_type != csq: sql2 = '(%s)' % sql2 if inv: sql1, p1, sql2, p2 = sql2, p2, sql1, p1 return '(%s %s %s)' % (sql1, node.operator, sql2), (p1 + p2) def _parse_select_query(self, node, alias_map, conv): clone = node.clone() if not node._explicit_selection: if conv and isinstance(conv, ForeignKeyField): clone._select = (conv.to_field,) else: clone._select = clone.model_class._meta.get_primary_key_fields() sub, params = self.generate_select(clone, alias_map) return '(%s)' % strip_parens(sub), params def _parse_strip_parens(self, node, alias_map, conv): sql, params = self.parse_node(node.node, alias_map, conv) return strip_parens(sql), params def _parse(self, node, alias_map, conv): # By default treat the incoming node as a raw value that should be # parameterized. node_type = getattr(node, '_node_type', None) unknown = False if node_type in self._parse_map: sql, params = self._parse_map[node_type](node, alias_map, conv) unknown = (node_type in self._unknown_types and node.adapt is None and conv is None) elif isinstance(node, (list, tuple, set)): # If you're wondering how to pass a list into your query, simply # wrap it in Param(). sql, params = self.parse_node_list(node, alias_map, conv) sql = '(%s)' % sql elif isinstance(node, Model): sql = self.interpolation if conv and isinstance(conv, ForeignKeyField): to_field = conv.to_field if isinstance(to_field, ForeignKeyField): value = conv.db_value(node) else: value = to_field.db_value(getattr(node, to_field.name)) else: value = node._get_pk_value() params = [value] elif (isclass(node) and issubclass(node, Model)) or \ isinstance(node, ModelAlias): entity = node.as_entity().alias(alias_map[node]) sql, params = self.parse_node(entity, alias_map, conv) elif conv is not None: value = conv.db_value(node) sql, params, _ = self._parse(value, alias_map, None) else: sql, params = self._parse_default(node, alias_map, None) unknown = True return sql, params, unknown def parse_node(self, node, alias_map=None, conv=None): sql, params, unknown = self._parse(node, alias_map, conv) if unknown and (conv is not None) and params: params = [conv.db_value(i) for i in params] if isinstance(node, Node): if node._negated: sql = 'NOT %s' % sql if node._alias: sql = ' '.join((sql, 'AS', node._alias)) if node._ordering: sql = ' '.join((sql, node._ordering)) if params and any(isinstance(p, Node) for p in params): clean_params = [] clean_sql = [] for idx, param in enumerate(params): if isinstance(param, Node): csql, cparams = self.parse_node(param) return sql, params def parse_node_list(self, nodes, alias_map, conv=None, glue=', '): sql = [] params = [] for node in nodes: node_sql, node_params = self.parse_node(node, alias_map, conv) sql.append(node_sql) params.extend(node_params) return glue.join(sql), params def calculate_alias_map(self, query, alias_map=None): new_map = self.alias_map_class() if alias_map is not None: new_map._counter = alias_map._counter new_map.add(query.model_class, query.model_class._meta.table_alias) for src_model, joined_models in query._joins.items(): new_map.add(src_model, src_model._meta.table_alias) for join_obj in joined_models: if isinstance(join_obj.dest, Node): new_map.add(join_obj.dest, join_obj.dest.alias) else: new_map.add(join_obj.dest, join_obj.dest._meta.table_alias) return new_map.update(alias_map) def build_query(self, clauses, alias_map=None): return self.parse_node(Clause(*clauses), alias_map) def generate_joins(self, joins, model_class, alias_map): # Joins are implemented as an adjancency-list graph. Perform a # depth-first search of the graph to generate all the necessary JOINs. clauses = [] seen = set() q = [model_class] while q: curr = q.pop() if curr not in joins or curr in seen: continue seen.add(curr) for join in joins[curr]: src = curr dest = join.dest join_type = join.get_join_type() if isinstance(join.on, (Expression, Func, Clause, Entity)): # Clear any alias on the join expression. constraint = join.on.clone().alias() elif join_type != JOIN.CROSS: metadata = join.metadata if metadata.is_backref: fk_model = join.dest pk_model = join.src else: fk_model = join.src pk_model = join.dest fk = metadata.foreign_key if fk: lhs = getattr(fk_model, fk.name) rhs = getattr(pk_model, fk.to_field.name) if metadata.is_backref: lhs, rhs = rhs, lhs constraint = (lhs == rhs) else: raise ValueError('Missing required join predicate.') if isinstance(dest, Node): # TODO: ensure alias? dest_n = dest else: q.append(dest) dest_n = dest.as_entity().alias(alias_map[dest]) join_sql = SQL(self.join_map.get(join_type) or join_type) if join_type == JOIN.CROSS: clauses.append(Clause(join_sql, dest_n)) else: clauses.append(Clause(join_sql, dest_n, SQL('ON'), constraint)) return clauses def generate_select(self, query, alias_map=None): model = query.model_class db = model._meta.database alias_map = self.calculate_alias_map(query, alias_map) if isinstance(query, CompoundSelect): clauses = [_StripParens(query)] else: if not query._distinct: clauses = [SQL('SELECT')] else: clauses = [SQL('SELECT DISTINCT')] if query._distinct not in (True, False): clauses += [SQL('ON'), EnclosedClause(*query._distinct)] select_clause = Clause(*query._select) select_clause.glue = ', ' clauses.extend((select_clause, SQL('FROM'))) if query._from is None: clauses.append(model.as_entity().alias(alias_map[model])) else: clauses.append(CommaClause(*query._from)) join_clauses = self.generate_joins(query._joins, model, alias_map) if join_clauses: clauses.extend(join_clauses) if query._where is not None: clauses.extend([SQL('WHERE'), query._where]) if query._group_by: clauses.extend([SQL('GROUP BY'), CommaClause(*query._group_by)]) if query._having: clauses.extend([SQL('HAVING'), query._having]) if query._windows is not None: clauses.append(SQL('WINDOW')) clauses.append(CommaClause(*[ Clause( SQL(window._alias), SQL('AS'), window.__sql__()) for window in query._windows])) if query._order_by: clauses.extend([SQL('ORDER BY'), CommaClause(*query._order_by)]) if query._limit is not None or (query._offset and db.limit_max): limit = query._limit if query._limit is not None else db.limit_max clauses.append(SQL('LIMIT %d' % limit)) if query._offset is not None: clauses.append(SQL('OFFSET %d' % query._offset)) if query._for_update: clauses.append(SQL(query._for_update)) return self.build_query(clauses, alias_map) def generate_update(self, query): model = query.model_class alias_map = self.alias_map_class() alias_map.add(model, model._meta.db_table) if query._on_conflict: statement = 'UPDATE OR %s' % query._on_conflict else: statement = 'UPDATE' clauses = [SQL(statement), model.as_entity(), SQL('SET')] update = [] for field, value in self._sorted_fields(query._update): if not isinstance(value, (Node, Model)): value = Param(value, adapt=field.db_value) update.append(Expression( field.as_entity(with_table=False), OP.EQ, value, flat=True)) # No outer parens, no table alias. clauses.append(CommaClause(*update)) if query._where: clauses.extend([SQL('WHERE'), query._where]) if query._returning is not None: returning_clause = Clause(*query._returning) returning_clause.glue = ', ' clauses.extend([SQL('RETURNING'), returning_clause]) return self.build_query(clauses, alias_map) def _get_field_clause(self, fields, clause_type=EnclosedClause): return clause_type(*[ field.as_entity(with_table=False) for field in fields]) def generate_insert(self, query): model = query.model_class meta = model._meta alias_map = self.alias_map_class() alias_map.add(model, model._meta.db_table) if query._upsert: statement = meta.database.upsert_sql elif query._on_conflict: statement = 'INSERT OR %s INTO' % query._on_conflict else: statement = 'INSERT INTO' clauses = [SQL(statement), model.as_entity()] if query._query is not None: # This INSERT query is of the form INSERT INTO ... SELECT FROM. if query._fields: clauses.append(self._get_field_clause(query._fields)) clauses.append(_StripParens(query._query)) elif query._rows is not None: fields, value_clauses = [], [] have_fields = False for row_dict in query._iter_rows(): if not have_fields: fields = sorted( row_dict.keys(), key=operator.attrgetter('_sort_key')) have_fields = True values = [] for field in fields: value = row_dict[field] if not isinstance(value, (Node, Model)): value = Param(value, adapt=field.db_value) values.append(value) value_clauses.append(EnclosedClause(*values)) if fields: clauses.extend([ self._get_field_clause(fields), SQL('VALUES'), CommaClause(*value_clauses)]) elif query.model_class._meta.auto_increment: # Bare insert, use default value for primary key. clauses.append(query.database.default_insert_clause( query.model_class)) if query._returning is not None: # Return the fields asked for. returning_clause = Clause(*query._returning) returning_clause.glue = ', ' clauses.extend([SQL('RETURNING'), returning_clause]) elif query.is_insert_returning: # Return the primary keys. clauses.extend([ SQL('RETURNING'), self._get_field_clause( meta.get_primary_key_fields(), clause_type=CommaClause)]) return self.build_query(clauses, alias_map) def generate_delete(self, query): model = query.model_class clauses = [SQL('DELETE FROM'), model.as_entity()] if query._where: clauses.extend([SQL('WHERE'), query._where]) if query._returning is not None: returning_clause = Clause(*query._returning) returning_clause.glue = ', ' clauses.extend([SQL('RETURNING'), returning_clause]) return self.build_query(clauses) def field_definition(self, field): column_type = self.get_column_type(field.get_db_field()) ddl = field.__ddl__(column_type) return Clause(*ddl) def foreign_key_constraint(self, field): ddl = [ SQL('FOREIGN KEY'), EnclosedClause(field.as_entity()), SQL('REFERENCES'), field.rel_model.as_entity(), EnclosedClause(field.to_field.as_entity())] if field.on_delete: ddl.append(SQL('ON DELETE %s' % field.on_delete)) if field.on_update: ddl.append(SQL('ON UPDATE %s' % field.on_update)) return Clause(*ddl) def return_parsed_node(function_name): # TODO: treat all `generate_` functions as returning clauses, instead # of SQL/params. def inner(self, *args, **kwargs): fn = getattr(self, function_name) return self.parse_node(fn(*args, **kwargs)) return inner def _create_foreign_key(self, model_class, field, constraint=None): constraint = constraint or 'fk_%s_%s_refs_%s' % ( model_class._meta.db_table, field.db_column, field.rel_model._meta.db_table) fk_clause = self.foreign_key_constraint(field) return Clause( SQL('ALTER TABLE'), model_class.as_entity(), SQL('ADD CONSTRAINT'), Entity(constraint), *fk_clause.nodes) create_foreign_key = return_parsed_node('_create_foreign_key') def _create_table(self, model_class, safe=False): statement = 'CREATE TABLE IF NOT EXISTS' if safe else 'CREATE TABLE' meta = model_class._meta columns, constraints = [], [] if meta.composite_key: pk_cols = [meta.fields[f].as_entity() for f in meta.primary_key.field_names] constraints.append(Clause( SQL('PRIMARY KEY'), EnclosedClause(*pk_cols))) for field in meta.declared_fields: columns.append(self.field_definition(field)) if isinstance(field, ForeignKeyField) and not field.deferred: constraints.append(self.foreign_key_constraint(field)) if model_class._meta.constraints: for constraint in model_class._meta.constraints: if not isinstance(constraint, Node): constraint = SQL(constraint) constraints.append(constraint) return Clause( SQL(statement), model_class.as_entity(), EnclosedClause(*(columns + constraints))) create_table = return_parsed_node('_create_table') def _drop_table(self, model_class, fail_silently=False, cascade=False): statement = 'DROP TABLE IF EXISTS' if fail_silently else 'DROP TABLE' ddl = [SQL(statement), model_class.as_entity()] if cascade: ddl.append(SQL('CASCADE')) return Clause(*ddl) drop_table = return_parsed_node('_drop_table') def _truncate_table(self, model_class, restart_identity=False, cascade=False): ddl = [SQL('TRUNCATE TABLE'), model_class.as_entity()] if restart_identity: ddl.append(SQL('RESTART IDENTITY')) if cascade: ddl.append(SQL('CASCADE')) return Clause(*ddl) truncate_table = return_parsed_node('_truncate_table') def index_name(self, table, columns): index = '%s_%s' % (table, '_'.join(columns)) if len(index) > 64: index_hash = hashlib.md5(index.encode('utf-8')).hexdigest() index = '%s_%s' % (table[:55], index_hash[:8]) # 55 + 1 + 8 = 64 return index def _create_index(self, model_class, fields, unique, *extra): tbl_name = model_class._meta.db_table statement = 'CREATE UNIQUE INDEX' if unique else 'CREATE INDEX' index_name = self.index_name(tbl_name, [f.db_column for f in fields]) return Clause( SQL(statement), Entity(index_name), SQL('ON'), model_class.as_entity(), EnclosedClause(*[field.as_entity() for field in fields]), *extra) create_index = return_parsed_node('_create_index') def _drop_index(self, model_class, fields, fail_silently=False): tbl_name = model_class._meta.db_table statement = 'DROP INDEX IF EXISTS' if fail_silently else 'DROP INDEX' index_name = self.index_name(tbl_name, [f.db_column for f in fields]) return Clause(SQL(statement), Entity(index_name)) drop_index = return_parsed_node('_drop_index') def _create_sequence(self, sequence_name): return Clause(SQL('CREATE SEQUENCE'), Entity(sequence_name)) create_sequence = return_parsed_node('_create_sequence') def _drop_sequence(self, sequence_name): return Clause(SQL('DROP SEQUENCE'), Entity(sequence_name)) drop_sequence = return_parsed_node('_drop_sequence') class ResultIterator(object): def __init__(self, qrw): self.qrw = qrw self._idx = 0 def next(self): if self._idx < self.qrw._ct: obj = self.qrw._result_cache[self._idx] elif not self.qrw._populated: obj = self.qrw.iterate() self.qrw._result_cache.append(obj) self.qrw._ct += 1 else: raise StopIteration self._idx += 1 return obj __next__ = next class QueryResultWrapper(object): """ Provides an iterator over the results of a raw Query, additionally doing two things: - converts rows from the database into python representations - ensures that multiple iterations do not result in multiple queries """ def __init__(self, model, cursor, meta=None): self.model = model self.cursor = cursor self._ct = 0 self._idx = 0 self._result_cache = [] self._populated = False self._initialized = False if meta is not None: self.column_meta, self.join_meta = meta else: self.column_meta = self.join_meta = None def __iter__(self): if self._populated: return iter(self._result_cache) else: return ResultIterator(self) @property def count(self): self.fill_cache() return self._ct def __len__(self): return self.count def process_row(self, row): return row def iterate(self): row = self.cursor.fetchone() if not row: self._populated = True if not getattr(self.cursor, 'name', None): self.cursor.close() raise StopIteration elif not self._initialized: self.initialize(self.cursor.description) self._initialized = True return self.process_row(row) def iterator(self): while True: yield self.iterate() def next(self): if self._idx < self._ct: inst = self._result_cache[self._idx] self._idx += 1 return inst elif self._populated: raise StopIteration obj = self.iterate() self._result_cache.append(obj) self._ct += 1 self._idx += 1 return obj __next__ = next def fill_cache(self, n=None): n = n or float('Inf') if n < 0: raise ValueError('Negative values are not supported.') self._idx = self._ct while not self._populated and (n > self._ct): try: next(self) except StopIteration: break class ExtQueryResultWrapper(QueryResultWrapper): def initialize(self, description): n_cols = len(description) self.conv = conv = [] if self.column_meta is not None: n_meta = len(self.column_meta) for i, node in enumerate(self.column_meta): if not self._initialize_node(node, i): self._initialize_by_name(description[i][0], i) if n_cols == n_meta: return else: i = 0 for i in range(i, n_cols): self._initialize_by_name(description[i][0], i) def _initialize_by_name(self, name, i): model_cols = self.model._meta.columns if name in model_cols: field = model_cols[name] self.conv.append((i, field.name, field.python_value)) else: self.conv.append((i, name, None)) def _initialize_node(self, node, i): if isinstance(node, Field): self.conv.append((i, node._alias or node.name, node.python_value)) return True elif isinstance(node, Func) and len(node.arguments): arg = node.arguments[0] if isinstance(arg, Field): name = node._alias or arg._alias or arg.name func = node._coerce and arg.python_value or None self.conv.append((i, name, func)) return True return False class TuplesQueryResultWrapper(ExtQueryResultWrapper): def process_row(self, row): return tuple([col if self.conv[i][2] is None else self.conv[i][2](col) for i, col in enumerate(row)]) if _TuplesQueryResultWrapper is None: _TuplesQueryResultWrapper = TuplesQueryResultWrapper class NaiveQueryResultWrapper(ExtQueryResultWrapper): def process_row(self, row): instance = self.model() for i, column, f in self.conv: setattr(instance, column, f(row[i]) if f is not None else row[i]) instance._prepare_instance() return instance if _ModelQueryResultWrapper is None: _ModelQueryResultWrapper = NaiveQueryResultWrapper class DictQueryResultWrapper(ExtQueryResultWrapper): def process_row(self, row): res = {} for i, column, f in self.conv: res[column] = f(row[i]) if f is not None else row[i] return res if _DictQueryResultWrapper is None: _DictQueryResultWrapper = DictQueryResultWrapper class NamedTupleQueryResultWrapper(ExtQueryResultWrapper): def initialize(self, description): super(NamedTupleQueryResultWrapper, self).initialize(description) columns = [column for _, column, _ in self.conv] self.constructor = namedtuple('Row', columns) def process_row(self, row): return self.constructor(*[f(row[i]) if f is not None else row[i] for i, _, f in self.conv]) class ModelQueryResultWrapper(QueryResultWrapper): def initialize(self, description): self.column_map, model_set = self.generate_column_map() self._col_set = set(col for col in self.column_meta if isinstance(col, Field)) self.join_list = self.generate_join_list(model_set) def generate_column_map(self): column_map = [] models = set([self.model]) for i, node in enumerate(self.column_meta): attr = conv = None if isinstance(node, Field): if isinstance(node, FieldProxy): key = node._model_alias constructor = node.model conv = node.field_instance.python_value else: key = constructor = node.model_class conv = node.python_value attr = node._alias or node.name else: if node._bind_to is None: key = constructor = self.model else: key = constructor = node._bind_to if isinstance(node, Node) and node._alias: attr = node._alias elif isinstance(node, Entity): attr = node.path[-1] column_map.append((key, constructor, attr, conv)) models.add(key) return column_map, models def generate_join_list(self, models): join_list = [] joins = self.join_meta stack = [self.model] while stack: current = stack.pop() if current not in joins: continue for join in joins[current]: metadata = join.metadata if metadata.dest in models or metadata.dest_model in models: if metadata.foreign_key is not None: fk_present = metadata.foreign_key in self._col_set pk_present = metadata.primary_key in self._col_set check = metadata.foreign_key.null and (fk_present or pk_present) else: check = fk_present = pk_present = False join_list.append(( metadata, check, fk_present, pk_present)) stack.append(join.dest) return join_list def process_row(self, row): collected = self.construct_instances(row) instances = self.follow_joins(collected) for i in instances: i._prepare_instance() return instances[0] def construct_instances(self, row, keys=None): collected_models = {} for i, (key, constructor, attr, conv) in enumerate(self.column_map): if keys is not None and key not in keys: continue value = row[i] if key not in collected_models: collected_models[key] = constructor() instance = collected_models[key] if attr is None: attr = self.cursor.description[i][0] setattr(instance, attr, value if conv is None else conv(value)) return collected_models def follow_joins(self, collected): prepared = [collected[self.model]] for (metadata, check_null, fk_present, pk_present) in self.join_list: inst = collected[metadata.src] try: joined_inst = collected[metadata.dest] except KeyError: joined_inst = collected[metadata.dest_model] has_fk = True if check_null: if fk_present: has_fk = inst._data.get(metadata.foreign_key.name) elif pk_present: has_fk = joined_inst._data.get(metadata.primary_key.name) if not has_fk: continue # Can we populate a value on the joined instance using the current? mpk = metadata.primary_key is not None can_populate_joined_pk = ( mpk and (metadata.attr in inst._data) and (getattr(joined_inst, metadata.primary_key.name) is None)) if can_populate_joined_pk: setattr( joined_inst, metadata.primary_key.name, inst._data[metadata.attr]) if metadata.is_backref: can_populate_joined_fk = ( mpk and (metadata.foreign_key is not None) and (getattr(inst, metadata.primary_key.name) is not None) and (joined_inst._data.get(metadata.foreign_key.name) is None)) if can_populate_joined_fk: setattr( joined_inst, metadata.foreign_key.name, inst) setattr(inst, metadata.attr, joined_inst) prepared.append(joined_inst) return prepared JoinCache = namedtuple('JoinCache', ('metadata', 'attr')) class AggregateQueryResultWrapper(ModelQueryResultWrapper): def __init__(self, *args, **kwargs): self._row = [] super(AggregateQueryResultWrapper, self).__init__(*args, **kwargs) def initialize(self, description): super(AggregateQueryResultWrapper, self).initialize(description) # Collect the set of all models (and ModelAlias objects) queried. self.all_models = set() for key, _, _, _ in self.column_map: self.all_models.add(key) # Prepare data structures for analyzing unique rows. Also cache # foreign key and attribute names for joined models. self.models_with_aggregate = set() self.back_references = {} self.source_to_dest = {} self.dest_to_source = {} for (metadata, _, _, _) in self.join_list: if metadata.is_backref: att_name = metadata.foreign_key.related_name else: att_name = metadata.attr is_backref = metadata.is_backref or metadata.is_self_join if is_backref: self.models_with_aggregate.add(metadata.src) else: self.dest_to_source.setdefault(metadata.dest, set()) self.dest_to_source[metadata.dest].add(metadata.src) self.source_to_dest.setdefault(metadata.src, {}) self.source_to_dest[metadata.src][metadata.dest] = JoinCache( metadata=metadata, attr=metadata.alias or att_name) # Determine which columns could contain "duplicate" data, e.g. if # getting Users and their Tweets, this would be the User columns. self.columns_to_compare = {} key_to_columns = {} for idx, (key, model_class, col_name, _) in enumerate(self.column_map): if key in self.models_with_aggregate: self.columns_to_compare.setdefault(key, []) self.columns_to_compare[key].append((idx, col_name)) key_to_columns.setdefault(key, []) key_to_columns[key].append((idx, col_name)) # Also compare columns for joins -> many-related model. for model_or_alias in self.models_with_aggregate: if model_or_alias not in self.columns_to_compare: continue sources = self.dest_to_source.get(model_or_alias, ()) for joined_model in sources: self.columns_to_compare[model_or_alias].extend( key_to_columns[joined_model]) def read_model_data(self, row): models = {} for model_class, column_data in self.columns_to_compare.items(): models[model_class] = [] for idx, col_name in column_data: models[model_class].append(row[idx]) return models def iterate(self): if self._row: row = self._row.pop() else: row = self.cursor.fetchone() if not row: self._populated = True if not getattr(self.cursor, 'name', None): self.cursor.close() raise StopIteration elif not self._initialized: self.initialize(self.cursor.description) self._initialized = True def _get_pk(instance): if instance._meta.composite_key: return tuple([ instance._data[field_name] for field_name in instance._meta.primary_key.field_names]) return instance._get_pk_value() identity_map = {} _constructed = self.construct_instances(row) primary_instance = _constructed[self.model] for model_or_alias, instance in _constructed.items(): identity_map[model_or_alias] = OrderedDict() identity_map[model_or_alias][_get_pk(instance)] = instance model_data = self.read_model_data(row) while True: cur_row = self.cursor.fetchone() if cur_row is None: break duplicate_models = set() cur_row_data = self.read_model_data(cur_row) for model_class, data in cur_row_data.items(): if model_data[model_class] == data: duplicate_models.add(model_class) if not duplicate_models: self._row.append(cur_row) break different_models = self.all_models - duplicate_models new_instances = self.construct_instances(cur_row, different_models) for model_or_alias, instance in new_instances.items(): # Do not include any instances which are comprised solely of # NULL values. all_none = True for value in instance._data.values(): if value is not None: all_none = False if not all_none: identity_map[model_or_alias][_get_pk(instance)] = instance stack = [self.model] instances = [primary_instance] while stack: current = stack.pop() if current not in self.join_meta: continue for join in self.join_meta[current]: try: metadata, attr = self.source_to_dest[current][join.dest] except KeyError: continue if metadata.is_backref or metadata.is_self_join: for instance in identity_map[current].values(): setattr(instance, attr, []) if join.dest not in identity_map: continue for pk, inst in identity_map[join.dest].items(): if pk is None: continue try: # XXX: if no FK exists, unable to join. joined_inst = identity_map[current][ inst._data[metadata.foreign_key.name]] except KeyError: continue getattr(joined_inst, attr).append(inst) instances.append(inst) elif attr: if join.dest not in identity_map: continue for pk, instance in identity_map[current].items(): # XXX: if no FK exists, unable to join. joined_inst = identity_map[join.dest][ instance._data[metadata.foreign_key.name]] setattr( instance, metadata.foreign_key.name, joined_inst) instances.append(joined_inst) stack.append(join.dest) for instance in instances: instance._prepare_instance() return primary_instance class Query(Node): """Base class representing a database query on one or more tables.""" require_commit = True def __init__(self, model_class): super(Query, self).__init__() self.model_class = model_class self.database = model_class._meta.database self._dirty = True self._query_ctx = model_class self._joins = {self.model_class: []} # Join graph as adjacency list. self._where = None def __repr__(self): sql, params = self.sql() return '%s %s %s' % (self.model_class, sql, params) def clone(self): query = type(self)(self.model_class) query.database = self.database return self._clone_attributes(query) def _clone_attributes(self, query): if self._where is not None: query._where = self._where.clone() query._joins = self._clone_joins() query._query_ctx = self._query_ctx return query def _clone_joins(self): return dict( (mc, list(j)) for mc, j in self._joins.items()) def _add_query_clauses(self, initial, expressions, conjunction=None): reduced = reduce(operator.and_, expressions) if initial is None: return reduced conjunction = conjunction or operator.and_ return conjunction(initial, reduced) def _model_shorthand(self, args): accum = [] for arg in args: if isinstance(arg, Node): accum.append(arg) elif isinstance(arg, Query): accum.append(arg) elif isinstance(arg, ModelAlias): accum.extend(arg.get_proxy_fields()) elif isclass(arg) and issubclass(arg, Model): accum.extend(arg._meta.declared_fields) return accum @returns_clone def where(self, *expressions): self._where = self._add_query_clauses(self._where, expressions) @returns_clone def orwhere(self, *expressions): self._where = self._add_query_clauses( self._where, expressions, operator.or_) @returns_clone def join(self, dest, join_type=None, on=None): src = self._query_ctx if on is None: require_join_condition = join_type != JOIN.CROSS and ( isinstance(dest, SelectQuery) or (isclass(dest) and not src._meta.rel_exists(dest))) if require_join_condition: raise ValueError('A join condition must be specified.') elif join_type == JOIN.CROSS: raise ValueError('A CROSS join cannot have a constraint.') elif isinstance(on, str): on = src._meta.fields[on] self._joins.setdefault(src, []) self._joins[src].append(Join(src, dest, join_type, on)) if not isinstance(dest, SelectQuery): self._query_ctx = dest @returns_clone def switch(self, model_class=None): """Change or reset the query context.""" self._query_ctx = model_class or self.model_class def ensure_join(self, lm, rm, on=None, **join_kwargs): ctx = self._query_ctx for join in self._joins.get(lm, []): if join.dest == rm: return self return self.switch(lm).join(rm, on=on, **join_kwargs).switch(ctx) def convert_dict_to_node(self, qdict): accum = [] joins = [] relationship = (ForeignKeyField, ReverseRelationDescriptor) for key, value in sorted(qdict.items()): curr = self.model_class if '__' in key and key.rsplit('__', 1)[1] in DJANGO_MAP: key, op = key.rsplit('__', 1) op_group = DJANGO_MAP[op] op, value = (op_group[0], op_group[1] % value) \ if len(op_group) == 2 else (op_group[0], value) elif value is None: op = OP.IS else: op = OP.EQ for piece in key.split('__'): model_attr = getattr(curr, piece) if value is not None and isinstance(model_attr, relationship): curr = model_attr.rel_model joins.append(model_attr) accum.append(Expression(model_attr, op, value)) return accum, joins def _filter_or_exclude(self, negate, *args, **kwargs): dq_node = Node() if args: dq_node &= reduce(operator.and_, [a.clone() for a in args]) if kwargs: dq_node &= DQ(**kwargs) # dq_node should now be an Expression, lhs = Node(), rhs = ... q = deque([dq_node]) dq_joins = set() while q: curr = q.popleft() if not isinstance(curr, Expression): continue for side, piece in (('lhs', curr.lhs), ('rhs', curr.rhs)): if isinstance(piece, DQ): query, joins = self.convert_dict_to_node(piece.query) dq_joins.update(joins) expression = reduce(operator.and_, query) # Apply values from the DQ object. expression._negated = piece._negated expression._alias = piece._alias setattr(curr, side, expression) else: q.append(piece) dq_node = dq_node.rhs query = self.clone() for field in dq_joins: if isinstance(field, ForeignKeyField): lm, rm = field.model_class, field.rel_model field_obj = field elif isinstance(field, ReverseRelationDescriptor): lm, rm = field.field.rel_model, field.rel_model field_obj = field.field query = query.ensure_join(lm, rm, field_obj) if negate: return query.where(~dq_node) else: return query.where(dq_node) def filter(self, *args, **kwargs): return self._filter_or_exclude(False, *args, **kwargs) # 增加 exclude过滤函数 def exclude(self, *args, **kwargs): return self._filter_or_exclude(True, *args, **kwargs) def compiler(self): return self.database.compiler() def sql(self): raise NotImplementedError def _execute(self): sql, params = self.sql() return self.database.execute_sql(sql, params, self.require_commit) def execute(self): raise NotImplementedError def scalar(self, as_tuple=False, convert=False): if convert: row = self.tuples().first() else: row = self._execute().fetchone() if row and not as_tuple: return row[0] else: return row class RawQuery(Query): """ Execute a SQL query, returning a standard iterable interface that returns model instances. """ def __init__(self, model, query, *params): self._sql = query self._params = list(params) self._qr = None self._tuples = False self._dicts = False super(RawQuery, self).__init__(model) def clone(self): query = RawQuery(self.model_class, self._sql, *self._params) query._tuples = self._tuples query._dicts = self._dicts return query join = not_allowed('joining') where = not_allowed('where') switch = not_allowed('switch') @returns_clone def tuples(self, tuples=True): self._tuples = tuples @returns_clone def dicts(self, dicts=True): self._dicts = dicts def sql(self): return self._sql, self._params def execute(self): if self._qr is None: if self._tuples: QRW = self.database.get_result_wrapper(RESULTS_TUPLES) elif self._dicts: QRW = self.database.get_result_wrapper(RESULTS_DICTS) else: QRW = self.database.get_result_wrapper(RESULTS_NAIVE) self._qr = QRW(self.model_class, self._execute(), None) return self._qr def __iter__(self): return iter(self.execute()) def allow_extend(orig, new_val, **kwargs): extend = kwargs.pop('extend', False) if kwargs: raise ValueError('"extend" is the only valid keyword argument.') if extend: return ((orig or []) + new_val) or None elif new_val: return new_val class SelectQuery(Query): _node_type = 'select_query' def __init__(self, model_class, *selection): super(SelectQuery, self).__init__(model_class) self.require_commit = self.database.commit_select self.__select(*selection) self._from = None self._group_by = None self._having = None self._order_by = None self._windows = None self._limit = None self._offset = None self._distinct = False self._for_update = None self._naive = False self._tuples = False self._dicts = False self._namedtuples = False self._aggregate_rows = False self._alias = None self._qr = None def _clone_attributes(self, query): query = super(SelectQuery, self)._clone_attributes(query) query._explicit_selection = self._explicit_selection query._select = list(self._select) if self._from is not None: query._from = [] for f in self._from: if isinstance(f, Node): query._from.append(f.clone()) else: query._from.append(f) if self._group_by is not None: query._group_by = list(self._group_by) if self._having: query._having = self._having.clone() if self._order_by is not None: query._order_by = list(self._order_by) if self._windows is not None: query._windows = list(self._windows) query._limit = self._limit query._offset = self._offset query._distinct = self._distinct query._for_update = self._for_update query._naive = self._naive query._tuples = self._tuples query._dicts = self._dicts query._namedtuples = self._namedtuples query._aggregate_rows = self._aggregate_rows query._alias = self._alias return query def compound_op(operator): def inner(self, other): supported_ops = self.model_class._meta.database.compound_operations if operator not in supported_ops: raise ValueError( 'Your database does not support %s' % operator) return CompoundSelect(self.model_class, self, operator, other) return inner _compound_op_static = staticmethod(compound_op) __or__ = compound_op('UNION') __and__ = compound_op('INTERSECT') __sub__ = compound_op('EXCEPT') def __xor__(self, rhs): # Symmetric difference, should just be (self | rhs) - (self & rhs)... wrapped_rhs = self.model_class.select(SQL('*')).from_( EnclosedClause((self & rhs)).alias('_')).order_by() return (self | rhs) - wrapped_rhs def union_all(self, rhs): return SelectQuery._compound_op_static('UNION ALL')(self, rhs) def __select(self, *selection): self._explicit_selection = len(selection) > 0 selection = selection or self.model_class._meta.declared_fields self._select = self._model_shorthand(selection) select = returns_clone(__select) @returns_clone def from_(self, *args): self._from = list(args) if args else None @returns_clone def group_by(self, *args, **kwargs): self._group_by = self._model_shorthand(args) if args else None @returns_clone def having(self, *expressions): self._having = self._add_query_clauses(self._having, expressions) @returns_clone def order_by(self, *args, **kwargs): self._order_by = allow_extend(self._order_by, list(args), **kwargs) @returns_clone def window(self, *windows, **kwargs): self._windows = allow_extend(self._windows, list(windows), **kwargs) @returns_clone def limit(self, lim): self._limit = lim @returns_clone def offset(self, off): self._offset = off @returns_clone def paginate(self, page, paginate_by=20): if page > 0: page -= 1 self._limit = paginate_by self._offset = page * paginate_by @returns_clone def distinct(self, is_distinct=True): self._distinct = is_distinct @returns_clone def for_update(self, for_update=True, nowait=False): self._for_update = 'FOR UPDATE NOWAIT' if for_update and nowait else \ 'FOR UPDATE' if for_update else None @returns_clone def with_lock(self, lock_type='UPDATE'): self._for_update = ('FOR %s' % lock_type) if lock_type else None @returns_clone def naive(self, naive=True): self._naive = naive @returns_clone def tuples(self, tuples=True): self._tuples = tuples if tuples: self._dicts = self._namedtuples = False @returns_clone def dicts(self, dicts=True): self._dicts = dicts if dicts: self._tuples = self._namedtuples = False @returns_clone def namedtuples(self, namedtuples=True): self._namedtuples = namedtuples if namedtuples: self._dicts = self._tuples = False @returns_clone def aggregate_rows(self, aggregate_rows=True): self._aggregate_rows = aggregate_rows @returns_clone def alias(self, alias=None): self._alias = alias def annotate(self, rel_model, annotation=None): if annotation is None: annotation = fn.Count(rel_model._meta.primary_key).alias('count') if self._query_ctx == rel_model: query = self.switch(self.model_class) else: query = self.clone() query = query.ensure_join(query._query_ctx, rel_model) if not query._group_by: query._group_by = [x.alias() for x in query._select] query._select = tuple(query._select) + (annotation,) return query def _aggregate(self, aggregation=None): if aggregation is None: aggregation = fn.Count(SQL('*')) query = self.order_by() query._select = [aggregation] return query def aggregate(self, aggregation=None, convert=True): return self._aggregate(aggregation).scalar(convert=convert) def count(self, clear_limit=False): if self._distinct or self._group_by or self._limit or self._offset: return self.wrapped_count(clear_limit=clear_limit) # defaults to a count() of the primary key return self.aggregate(convert=False) or 0 def wrapped_count(self, clear_limit=False): clone = self.order_by() if clear_limit: clone._limit = clone._offset = None sql, params = clone.sql() wrapped = 'SELECT COUNT(1) FROM (%s) AS wrapped_select' % sql rq = self.model_class.raw(wrapped, *params) return rq.scalar() or 0 def exists(self): clone = self.paginate(1, 1) clone._select = [SQL('1')] return bool(clone.scalar()) def get(self): clone = self.paginate(1, 1) try: return next(clone.execute()) except StopIteration: raise self.model_class.DoesNotExist( 'Instance matching query does not exist:\nSQL: %s\nPARAMS: %s' % self.sql()) def peek(self, n=1): res = self.execute() res.fill_cache(n) models = res._result_cache[:n] if models: return models[0] if n == 1 else models def first(self, n=1): if self._limit != n: self._limit = n self._dirty = True return self.peek(n=n) def sql(self): return self.compiler().generate_select(self) def verify_naive(self): model_class = self.model_class for node in self._select: if isinstance(node, Field) and node.model_class != model_class: return False elif isinstance(node, Node) and node._bind_to is not None: if node._bind_to != model_class: return False return True def get_query_meta(self): return (self._select, self._joins) def _get_result_wrapper(self): if self._tuples: return self.database.get_result_wrapper(RESULTS_TUPLES) elif self._dicts: return self.database.get_result_wrapper(RESULTS_DICTS) elif self._namedtuples: return self.database.get_result_wrapper(RESULTS_NAMEDTUPLES) elif self._naive or not self._joins or self.verify_naive(): return self.database.get_result_wrapper(RESULTS_NAIVE) elif self._aggregate_rows: return self.database.get_result_wrapper(RESULTS_AGGREGATE_MODELS) else: return self.database.get_result_wrapper(RESULTS_MODELS) def execute(self): if self._dirty or self._qr is None: model_class = self.model_class query_meta = self.get_query_meta() ResultWrapper = self._get_result_wrapper() self._qr = ResultWrapper(model_class, self._execute(), query_meta) self._dirty = False return self._qr else: return self._qr def real(self): """ 实时查询,去掉脏缓存 :return: """ self._dirty = True def __iter__(self): return iter(self.execute()) def iterator(self): return iter(self.execute().iterator()) def __getitem__(self, value): res = self.execute() if isinstance(value, slice): index = value.stop else: index = value if index is not None: index = index + 1 if index >= 0 else None res.fill_cache(index) return res._result_cache[value] def __len__(self): return len(self.execute()) def __hash__(self): return id(self) class NoopSelectQuery(SelectQuery): def sql(self): return (self.database.get_noop_sql(), ()) def get_query_meta(self): return None, None def _get_result_wrapper(self): return self.database.get_result_wrapper(RESULTS_TUPLES) class CompoundSelect(SelectQuery): _node_type = 'compound_select_query' def __init__(self, model_class, lhs=None, operator=None, rhs=None): self.lhs = lhs self.operator = operator self.rhs = rhs super(CompoundSelect, self).__init__(model_class, []) def _clone_attributes(self, query): query = super(CompoundSelect, self)._clone_attributes(query) query.lhs = self.lhs query.operator = self.operator query.rhs = self.rhs return query def count(self, clear_limit=False): return self.wrapped_count(clear_limit=clear_limit) def get_query_meta(self): return self.lhs.get_query_meta() def verify_naive(self): return self.lhs.verify_naive() and self.rhs.verify_naive() def _get_result_wrapper(self): if self._tuples: return self.database.get_result_wrapper(RESULTS_TUPLES) elif self._dicts: return self.database.get_result_wrapper(RESULTS_DICTS) elif self._namedtuples: return self.database.get_result_wrapper(RESULTS_NAMEDTUPLES) elif self._aggregate_rows: return self.database.get_result_wrapper(RESULTS_AGGREGATE_MODELS) has_joins = self.lhs._joins or self.rhs._joins is_naive = self.lhs._naive or self.rhs._naive or self._naive if is_naive or not has_joins or self.verify_naive(): return self.database.get_result_wrapper(RESULTS_NAIVE) else: return self.database.get_result_wrapper(RESULTS_MODELS) class _WriteQuery(Query): def __init__(self, model_class): self._returning = None self._tuples = False self._dicts = False self._namedtuples = False self._qr = None super(_WriteQuery, self).__init__(model_class) def _clone_attributes(self, query): query = super(_WriteQuery, self)._clone_attributes(query) if self._returning: query._returning = list(self._returning) query._tuples = self._tuples query._dicts = self._dicts query._namedtuples = self._namedtuples return query def requires_returning(method): def inner(self, *args, **kwargs): db = self.model_class._meta.database if not db.returning_clause: raise ValueError('RETURNING is not supported by your ' 'database: %s' % type(db)) return method(self, *args, **kwargs) return inner @requires_returning @returns_clone def returning(self, *selection): if len(selection) == 1 and selection[0] is None: self._returning = None else: if not selection: selection = self.model_class._meta.declared_fields self._returning = self._model_shorthand(selection) @requires_returning @returns_clone def tuples(self, tuples=True): self._tuples = tuples if tuples: self._dicts = self._namedtuples = False @requires_returning @returns_clone def dicts(self, dicts=True): self._dicts = dicts if dicts: self._tuples = self._namedtuples = False @requires_returning @returns_clone def namedtuples(self, namedtuples=True): self._namedtuples = namedtuples if namedtuples: self._dicts = self._tuples = False def get_result_wrapper(self): if self._returning is not None: if self._tuples: return self.database.get_result_wrapper(RESULTS_TUPLES) elif self._dicts: return self.database.get_result_wrapper(RESULTS_DICTS) elif self._namedtuples: return self.database.get_result_wrapper(RESULTS_NAMEDTUPLES) return self.database.get_result_wrapper(RESULTS_NAIVE) def _execute_with_result_wrapper(self): ResultWrapper = self.get_result_wrapper() meta = (self._returning, {self.model_class: []}) self._qr = ResultWrapper(self.model_class, self._execute(), meta) return self._qr class UpdateQuery(_WriteQuery): def __init__(self, model_class, update=None): self._update = update self._on_conflict = None super(UpdateQuery, self).__init__(model_class) def _clone_attributes(self, query): query = super(UpdateQuery, self)._clone_attributes(query) query._update = dict(self._update) query._on_conflict = self._on_conflict return query @returns_clone def on_conflict(self, action=None): self._on_conflict = action join = not_allowed('joining') def sql(self): return self.compiler().generate_update(self) def execute(self): if self._returning is not None and self._qr is None: return self._execute_with_result_wrapper() elif self._qr is not None: return self._qr else: return self.database.rows_affected(self._execute()) def __iter__(self): if not self.model_class._meta.database.returning_clause: raise ValueError('UPDATE queries cannot be iterated over unless ' 'they specify a RETURNING clause, which is not ' 'supported by your database.') return iter(self.execute()) def iterator(self): return iter(self.execute().iterator()) class InsertQuery(_WriteQuery): def __init__(self, model_class, field_dict=None, rows=None, fields=None, query=None, validate_fields=False): super(InsertQuery, self).__init__(model_class) self._upsert = False self._is_multi_row_insert = rows is not None or query is not None self._return_id_list = False if rows is not None: self._rows = rows else: self._rows = [field_dict or {}] self._fields = fields self._query = query self._validate_fields = validate_fields self._on_conflict = None def _iter_rows(self): model_meta = self.model_class._meta if self._validate_fields: valid_fields = model_meta.valid_fields def validate_field(field): if field not in valid_fields: raise KeyError('"%s" is not a recognized field.' % field) defaults = model_meta._default_dict callables = model_meta._default_callables for row_dict in self._rows: field_row = defaults.copy() seen = set() for key in row_dict: if self._validate_fields: validate_field(key) if key in model_meta.fields: field = model_meta.fields[key] else: field = key field_row[field] = row_dict[key] seen.add(field) if callables: for field in callables: if field not in seen: field_row[field] = callables[field]() yield field_row def _clone_attributes(self, query): query = super(InsertQuery, self)._clone_attributes(query) query._rows = self._rows query._upsert = self._upsert query._is_multi_row_insert = self._is_multi_row_insert query._fields = self._fields query._query = self._query query._return_id_list = self._return_id_list query._validate_fields = self._validate_fields query._on_conflict = self._on_conflict return query join = not_allowed('joining') where = not_allowed('where clause') @returns_clone def upsert(self, upsert=True): self._upsert = upsert @returns_clone def on_conflict(self, action=None): self._on_conflict = action @returns_clone def return_id_list(self, return_id_list=True): self._return_id_list = return_id_list @property def is_insert_returning(self): if self.database.insert_returning: if not self._is_multi_row_insert or self._return_id_list: return True return False def sql(self): return self.compiler().generate_insert(self) def _insert_with_loop(self): id_list = [] last_id = None return_id_list = self._return_id_list for row in self._rows: last_id = (InsertQuery(self.model_class, row) .upsert(self._upsert) .execute()) if return_id_list: id_list.append(last_id) if return_id_list: return id_list else: return last_id def execute(self): insert_with_loop = ( self._is_multi_row_insert and self._query is None and self._returning is None and not self.database.insert_many) if insert_with_loop: return self._insert_with_loop() if self._returning is not None and self._qr is None: return self._execute_with_result_wrapper() elif self._qr is not None: return self._qr else: cursor = self._execute() if not self._is_multi_row_insert: if self.database.insert_returning: pk_row = cursor.fetchone() meta = self.model_class._meta clean_data = [ field.python_value(column) for field, column in zip(meta.get_primary_key_fields(), pk_row)] if self.model_class._meta.composite_key: return clean_data return clean_data[0] return self.database.last_insert_id(cursor, self.model_class) elif self._return_id_list: return map(operator.itemgetter(0), cursor.fetchall()) else: return True class DeleteQuery(_WriteQuery): join = not_allowed('joining') def sql(self): return self.compiler().generate_delete(self) def execute(self): if self._returning is not None and self._qr is None: return self._execute_with_result_wrapper() elif self._qr is not None: return self._qr else: return self.database.rows_affected(self._execute()) IndexMetadata = namedtuple( 'IndexMetadata', ('name', 'sql', 'columns', 'unique', 'table')) ColumnMetadata = namedtuple( 'ColumnMetadata', ('name', 'data_type', 'null', 'primary_key', 'table')) ForeignKeyMetadata = namedtuple( 'ForeignKeyMetadata', ('column', 'dest_table', 'dest_column', 'table')) class PeeweeException(Exception): pass class ImproperlyConfigured(PeeweeException): pass class DatabaseError(PeeweeException): pass class DataError(DatabaseError): pass class IntegrityError(DatabaseError): pass class InterfaceError(PeeweeException): pass class InternalError(DatabaseError): pass class NotSupportedError(DatabaseError): pass class OperationalError(DatabaseError): pass class ProgrammingError(DatabaseError): pass class ExceptionWrapper(object): __slots__ = ['exceptions'] def __init__(self, exceptions): self.exceptions = exceptions def __enter__(self): pass def __exit__(self, exc_type, exc_value, traceback): if exc_type is None: return if exc_type.__name__ in self.exceptions: new_type = self.exceptions[exc_type.__name__] exc_args = exc_value.args reraise(new_type, new_type(*exc_args), traceback) class _BaseConnectionLocal(object): def __init__(self, **kwargs): super(_BaseConnectionLocal, self).__init__(**kwargs) self.autocommit = None self.closed = True self.conn = None self.context_stack = [] self.transactions = [] class _ConnectionLocal(_BaseConnectionLocal, threading.local): pass class Database(object): commit_select = False compiler_class = QueryCompiler compound_operations = ['UNION', 'INTERSECT', 'EXCEPT', 'UNION ALL'] compound_select_parentheses = False distinct_on = False drop_cascade = False field_overrides = {} foreign_keys = True for_update = False for_update_nowait = False insert_many = True insert_returning = False interpolation = '?' limit_max = None op_overrides = {} quote_char = '"' reserved_tables = [] returning_clause = False savepoints = True sequences = False subquery_delete_same_table = True upsert_sql = None window_functions = False exceptions = { 'ConstraintError': IntegrityError, 'DatabaseError': DatabaseError, 'DataError': DataError, 'IntegrityError': IntegrityError, 'InterfaceError': InterfaceError, 'InternalError': InternalError, 'NotSupportedError': NotSupportedError, 'OperationalError': OperationalError, 'ProgrammingError': ProgrammingError} def __init__(self, database, threadlocals=True, autocommit=True, fields=None, ops=None, autorollback=False, use_speedups=True, **connect_kwargs): self.connect_kwargs = {} if threadlocals: self._local = _ConnectionLocal() else: self._local = _BaseConnectionLocal() self.init(database, **connect_kwargs) self._conn_lock = threading.Lock() self.autocommit = autocommit self.autorollback = autorollback self.use_speedups = use_speedups self.field_overrides = merge_dict(self.field_overrides, fields or {}) self.op_overrides = merge_dict(self.op_overrides, ops or {}) self.exception_wrapper = ExceptionWrapper(self.exceptions) def init(self, database, **connect_kwargs): if not self.is_closed(): self.close() self.deferred = database is None self.database = database self.connect_kwargs.update(connect_kwargs) def connect(self): with self._conn_lock: if self.deferred: raise OperationalError('Database has not been initialized') if not self._local.closed: raise OperationalError('Connection already open') self._local.conn = self._create_connection() self._local.closed = False with self.exception_wrapper: self.initialize_connection(self._local.conn) def initialize_connection(self, conn): pass def close(self): with self._conn_lock: if self.deferred: raise Exception('Error, database not properly initialized ' 'before closing connection') try: with self.exception_wrapper: self._close(self._local.conn) finally: self._local.closed = True def get_conn(self): if self._local.context_stack: conn = self._local.context_stack[-1].connection if conn is not None: return conn if self._local.closed: self.connect() return self._local.conn def _create_connection(self): with self.exception_wrapper: return self._connect(self.database, **self.connect_kwargs) def is_closed(self): return self._local.closed # def get_cursor(self): # conn = self.get_conn() # if conn._sock is None: # conn.ping() # return conn.cursor() def _close(self, conn): conn.close() def _connect(self, database, **kwargs): raise NotImplementedError @classmethod def register_fields(cls, fields): cls.field_overrides = merge_dict(cls.field_overrides, fields) @classmethod def register_ops(cls, ops): cls.op_overrides = merge_dict(cls.op_overrides, ops) def get_result_wrapper(self, wrapper_type): if wrapper_type == RESULTS_NAIVE: return (_ModelQueryResultWrapper if self.use_speedups else NaiveQueryResultWrapper) elif wrapper_type == RESULTS_MODELS: return ModelQueryResultWrapper elif wrapper_type == RESULTS_TUPLES: return (_TuplesQueryResultWrapper if self.use_speedups else TuplesQueryResultWrapper) elif wrapper_type == RESULTS_DICTS: return (_DictQueryResultWrapper if self.use_speedups else DictQueryResultWrapper) elif wrapper_type == RESULTS_NAMEDTUPLES: return NamedTupleQueryResultWrapper elif wrapper_type == RESULTS_AGGREGATE_MODELS: return AggregateQueryResultWrapper else: return (_ModelQueryResultWrapper if self.use_speedups else NaiveQueryResultWrapper) def last_insert_id(self, cursor, model): if model._meta.auto_increment: return cursor.lastrowid def rows_affected(self, cursor): return cursor.rowcount def compiler(self): return self.compiler_class( self.quote_char, self.interpolation, self.field_overrides, self.op_overrides) def execute(self, clause): return self.execute_sql(*self.compiler().parse_node(clause)) def execute_sql(self, sql, params=None, require_commit=True): logger.debug((sql, params)) with self.exception_wrapper: conn = self.get_conn() if conn._sock is None: conn.ping() # cursor = self.get_cursor() try: cursor = conn.cursor() cursor.execute(sql, params or ()) cursor.close() except Exception: if self.autorollback and self.get_autocommit(): self.rollback() raise else: if require_commit and self.get_autocommit(): self.commit() finally: self._close(conn) return cursor def begin(self): pass def commit(self): with self.exception_wrapper: self.get_conn().commit() def rollback(self): with self.exception_wrapper: self.get_conn().rollback() def set_autocommit(self, autocommit): self._local.autocommit = autocommit def get_autocommit(self): if self._local.autocommit is None: self.set_autocommit(self.autocommit) return self._local.autocommit def push_execution_context(self, transaction): self._local.context_stack.append(transaction) def pop_execution_context(self): self._local.context_stack.pop() def execution_context_depth(self): return len(self._local.context_stack) def execution_context(self, with_transaction=True, transaction_type=None): return ExecutionContext(self, with_transaction, transaction_type) __call__ = execution_context def push_transaction(self, transaction): self._local.transactions.append(transaction) def pop_transaction(self): self._local.transactions.pop() def transaction_depth(self): return len(self._local.transactions) def transaction(self, transaction_type=None): return transaction(self, transaction_type) commit_on_success = property(transaction) def savepoint(self, sid=None): if not self.savepoints: raise NotImplementedError return savepoint(self, sid) def atomic(self, transaction_type=None): return _atomic(self, transaction_type) def get_tables(self, schema=None): raise NotImplementedError def get_indexes(self, table, schema=None): raise NotImplementedError def get_columns(self, table, schema=None): raise NotImplementedError def get_primary_keys(self, table, schema=None): raise NotImplementedError def get_foreign_keys(self, table, schema=None): raise NotImplementedError def sequence_exists(self, seq): raise NotImplementedError def create_table(self, model_class, safe=False): qc = self.compiler() return self.execute_sql(*qc.create_table(model_class, safe)) def create_tables(self, models, safe=False): create_model_tables(models, fail_silently=safe) def create_index(self, model_class, fields, unique=False): qc = self.compiler() if not isinstance(fields, (list, tuple)): raise ValueError('Fields passed to "create_index" must be a list ' 'or tuple: "%s"' % fields) fobjs = [ model_class._meta.fields[f] if isinstance(f, str) else f for f in fields] return self.execute_sql(*qc.create_index(model_class, fobjs, unique)) def drop_index(self, model_class, fields, safe=False): qc = self.compiler() if not isinstance(fields, (list, tuple)): raise ValueError('Fields passed to "drop_index" must be a list ' 'or tuple: "%s"' % fields) fobjs = [ model_class._meta.fields[f] if isinstance(f, str) else f for f in fields] return self.execute_sql(*qc.drop_index(model_class, fobjs, safe)) def create_foreign_key(self, model_class, field, constraint=None): qc = self.compiler() return self.execute_sql(*qc.create_foreign_key( model_class, field, constraint)) def create_sequence(self, seq): if self.sequences: qc = self.compiler() return self.execute_sql(*qc.create_sequence(seq)) def drop_table(self, model_class, fail_silently=False, cascade=False): qc = self.compiler() if cascade and not self.drop_cascade: raise ValueError('Database does not support DROP TABLE..CASCADE.') return self.execute_sql(*qc.drop_table( model_class, fail_silently, cascade)) def drop_tables(self, models, safe=False, cascade=False): drop_model_tables(models, fail_silently=safe, cascade=cascade) def truncate_table(self, model_class, restart_identity=False, cascade=False): qc = self.compiler() return self.execute_sql(*qc.truncate_table( model_class, restart_identity, cascade)) def truncate_tables(self, models, restart_identity=False, cascade=False): for model in reversed(sort_models_topologically(models)): model.truncate_table(restart_identity, cascade) def drop_sequence(self, seq): if self.sequences: qc = self.compiler() return self.execute_sql(*qc.drop_sequence(seq)) def extract_date(self, date_part, date_field): return fn.EXTRACT(Clause(date_part, R('FROM'), date_field)) def truncate_date(self, date_part, date_field): return fn.DATE_TRUNC(date_part, date_field) def default_insert_clause(self, model_class): return SQL('DEFAULT VALUES') def get_noop_sql(self): return 'SELECT 0 WHERE 0' def get_binary_type(self): return binary_construct class MySQLDatabase(Database): commit_select = True compound_select_parentheses = True compound_operations = ['UNION', 'UNION ALL'] field_overrides = { 'bool': 'BOOL', 'decimal': 'NUMERIC', 'double': 'DOUBLE PRECISION', 'float': 'FLOAT', 'primary_key': 'INTEGER AUTO_INCREMENT', 'text': 'LONGTEXT', 'uuid': 'VARCHAR(40)', } for_update = True interpolation = '%s' limit_max = 2 ** 64 - 1 # MySQL quirk op_overrides = { OP.LIKE: 'LIKE BINARY', OP.ILIKE: 'LIKE', OP.XOR: 'XOR', } quote_char = '`' subquery_delete_same_table = False upsert_sql = 'REPLACE INTO' def _connect(self, database, **kwargs): if not mysql: raise ImproperlyConfigured('MySQLdb or PyMySQL must be installed.') conn_kwargs = { 'charset': 'utf8', 'use_unicode': True, } conn_kwargs.update(kwargs) if 'password' in conn_kwargs: conn_kwargs['passwd'] = conn_kwargs.pop('password') return mysql.connect(db=database, **conn_kwargs) def get_tables(self, schema=None): return [row for row, in self.execute_sql('SHOW TABLES')] def get_indexes(self, table, schema=None): cursor = self.execute_sql('SHOW INDEX FROM `%s`' % table) unique = set() indexes = {} for row in cursor.fetchall(): if not row[1]: unique.add(row[2]) indexes.setdefault(row[2], []) indexes[row[2]].append(row[4]) return [IndexMetadata(name, None, indexes[name], name in unique, table) for name in indexes] def get_columns(self, table, schema=None): sql = """ SELECT column_name, is_nullable, data_type FROM information_schema.columns WHERE table_name = %s AND table_schema = DATABASE()""" cursor = self.execute_sql(sql, (table,)) pks = set(self.get_primary_keys(table)) return [ColumnMetadata(name, dt, null == 'YES', name in pks, table) for name, null, dt in cursor.fetchall()] def get_primary_keys(self, table, schema=None): cursor = self.execute_sql('SHOW INDEX FROM `%s`' % table) return [row[4] for row in cursor.fetchall() if row[2] == 'PRIMARY'] def get_foreign_keys(self, table, schema=None): query = """ SELECT column_name, referenced_table_name, referenced_column_name FROM information_schema.key_column_usage WHERE table_name = %s AND table_schema = DATABASE() AND referenced_table_name IS NOT NULL AND referenced_column_name IS NOT NULL""" cursor = self.execute_sql(query, (table,)) return [ ForeignKeyMetadata(column, dest_table, dest_column, table) for column, dest_table, dest_column in cursor.fetchall()] def extract_date(self, date_part, date_field): return fn.EXTRACT(Clause(R(date_part), R('FROM'), date_field)) def truncate_date(self, date_part, date_field): return fn.DATE_FORMAT(date_field, MYSQL_DATE_TRUNC_MAPPING[date_part]) def default_insert_clause(self, model_class): return Clause( EnclosedClause(model_class._meta.primary_key), SQL('VALUES (DEFAULT)')) def get_noop_sql(self): return 'DO 0' def get_binary_type(self): return mysql.Binary class _callable_context_manager(object): __slots__ = () def __call__(self, fn): @wraps(fn) def inner(*args, **kwargs): with self: return fn(*args, **kwargs) return inner class ExecutionContext(_callable_context_manager): def __init__(self, database, with_transaction=True, transaction_type=None): self.database = database self.with_transaction = with_transaction self.transaction_type = transaction_type self.connection = None def __enter__(self): with self.database._conn_lock: self.database.push_execution_context(self) self.connection = self.database._connect( self.database.database, **self.database.connect_kwargs) if self.with_transaction: self.txn = self.database.transaction() self.txn.__enter__() return self def __exit__(self, exc_type, exc_val, exc_tb): with self.database._conn_lock: if self.connection is None: self.database.pop_execution_context() else: try: if self.with_transaction: if not exc_type: self.txn.commit(False) self.txn.__exit__(exc_type, exc_val, exc_tb) finally: self.database.pop_execution_context() self.database._close(self.connection) class Using(ExecutionContext): def __init__(self, database, models, with_transaction=True): super(Using, self).__init__(database, with_transaction) self.models = models def __enter__(self): self._orig = [] for model in self.models: self._orig.append(model._meta.database) model._meta.database = self.database return super(Using, self).__enter__() def __exit__(self, exc_type, exc_val, exc_tb): super(Using, self).__exit__(exc_type, exc_val, exc_tb) for i, model in enumerate(self.models): model._meta.database = self._orig[i] class _atomic(_callable_context_manager): __slots__ = ('db', 'transaction_type', 'context_manager') def __init__(self, db, transaction_type=None): self.db = db self.transaction_type = transaction_type def __enter__(self): if self.db.transaction_depth() == 0: self.context_manager = self.db.transaction(self.transaction_type) else: self.context_manager = self.db.savepoint() return self.context_manager.__enter__() def __exit__(self, exc_type, exc_val, exc_tb): return self.context_manager.__exit__(exc_type, exc_val, exc_tb) class transaction(_callable_context_manager): __slots__ = ('db', 'autocommit', 'transaction_type') def __init__(self, db, transaction_type=None): self.db = db self.transaction_type = transaction_type def _begin(self): if self.transaction_type: self.db.begin(self.transaction_type) else: self.db.begin() def commit(self, begin=True): self.db.commit() if begin: self._begin() def rollback(self, begin=True): self.db.rollback() if begin: self._begin() def __enter__(self): self.autocommit = self.db.get_autocommit() self.db.set_autocommit(False) if self.db.transaction_depth() == 0: self._begin() self.db.push_transaction(self) return self def __exit__(self, exc_type, exc_val, exc_tb): try: if exc_type: self.rollback(False) elif self.db.transaction_depth() == 1: try: self.commit(False) except: self.rollback(False) raise finally: self.db.set_autocommit(self.autocommit) self.db.pop_transaction() class savepoint(_callable_context_manager): __slots__ = ('db', 'sid', 'quoted_sid', 'autocommit') def __init__(self, db, sid=None): self.db = db _compiler = db.compiler() self.sid = sid or 's' + uuid.uuid4().hex self.quoted_sid = _compiler.quote(self.sid) def _execute(self, query): self.db.execute_sql(query, require_commit=False) def _begin(self): self._execute('SAVEPOINT %s;' % self.quoted_sid) def commit(self, begin=True): self._execute('RELEASE SAVEPOINT %s;' % self.quoted_sid) if begin: self._begin() def rollback(self): self._execute('ROLLBACK TO SAVEPOINT %s;' % self.quoted_sid) def __enter__(self): self.autocommit = self.db.get_autocommit() self.db.set_autocommit(False) self._begin() return self def __exit__(self, exc_type, exc_val, exc_tb): try: if exc_type: self.rollback() else: try: self.commit(begin=False) except: self.rollback() raise finally: self.db.set_autocommit(self.autocommit) class FieldProxy(Field): def __init__(self, alias, field_instance): self._model_alias = alias self.model = self._model_alias.model_class self.field_instance = field_instance def clone_base(self): return FieldProxy(self._model_alias, self.field_instance) def coerce(self, value): return self.field_instance.coerce(value) def python_value(self, value): return self.field_instance.python_value(value) def db_value(self, value): return self.field_instance.db_value(value) def __getattr__(self, attr): if attr == 'model_class': return self._model_alias return getattr(self.field_instance, attr) class ModelAlias(object): def __init__(self, model_class): self.__dict__['model_class'] = model_class def __getattr__(self, attr): model_attr = getattr(self.model_class, attr) if isinstance(model_attr, Field): return FieldProxy(self, model_attr) return model_attr def __setattr__(self, attr, value): raise AttributeError('Cannot set attributes on ModelAlias instances') def get_proxy_fields(self, declared_fields=False): mm = self.model_class._meta fields = mm.declared_fields if declared_fields else mm.sorted_fields return [FieldProxy(self, f) for f in fields] def select(self, *selection): if not selection: selection = self.get_proxy_fields() query = SelectQuery(self, *selection) if self._meta.order_by: query = query.order_by(*self._meta.order_by) return query def __call__(self, **kwargs): return self.model_class(**kwargs) if _SortedFieldList is None: class _SortedFieldList(object): __slots__ = ('_keys', '_items') def __init__(self): self._keys = [] self._items = [] def __getitem__(self, i): return self._items[i] def __iter__(self): return iter(self._items) def __contains__(self, item): k = item._sort_key i = bisect_left(self._keys, k) j = bisect_right(self._keys, k) return item in self._items[i:j] def index(self, field): return self._keys.index(field._sort_key) def insert(self, item): k = item._sort_key i = bisect_left(self._keys, k) self._keys.insert(i, k) self._items.insert(i, item) def remove(self, item): idx = self.index(item) del self._items[idx] del self._keys[idx] class DoesNotExist(Exception): pass class ModelOptions(object): def __init__(self, cls, database=None, db_table=None, db_table_func=None, indexes=None, order_by=None, primary_key=None, table_alias=None, constraints=None, schema=None, validate_backrefs=True, only_save_dirty=False, depends_on=None, **kwargs): self.model_class = cls self.name = cls.__name__.lower() self.fields = {} self.columns = {} self.defaults = {} self._default_by_name = {} self._default_dict = {} self._default_callables = {} self._default_callable_list = [] self._sorted_field_list = _SortedFieldList() self.sorted_fields = [] self.sorted_field_names = [] self.valid_fields = set() self.declared_fields = [] self.database = database if database is not None else None self.db_table = db_table self.db_table_func = db_table_func self.indexes = list(indexes or []) self.order_by = order_by self.primary_key = primary_key self.table_alias = table_alias self.constraints = constraints self.schema = schema self.validate_backrefs = validate_backrefs self.only_save_dirty = only_save_dirty self.depends_on = depends_on self.auto_increment = None self.composite_key = False self.rel = {} self.reverse_rel = {} for key, value in kwargs.items(): setattr(self, key, value) self._additional_keys = set(kwargs.keys()) if self.db_table_func and not self.db_table: self.db_table = self.db_table_func(cls) def __repr__(self): return '<%s: %s>' % (self.__class__.__name__, self.name) def prepared(self): if self.order_by: norm_order_by = [] for item in self.order_by: if isinstance(item, Field): prefix = '-' if item._ordering == 'DESC' else '' item = prefix + item.name field = self.fields[item.lstrip('-')] if item.startswith('-'): norm_order_by.append(field.desc()) else: norm_order_by.append(field.asc()) self.order_by = norm_order_by def _update_field_lists(self): self.sorted_fields = list(self._sorted_field_list) self.sorted_field_names = [f.name for f in self.sorted_fields] self.valid_fields = (set(self.fields.keys()) | set(self.fields.values()) | set((self.primary_key,))) self.declared_fields = [field for field in self.sorted_fields if not field.undeclared] def add_field(self, field): self.remove_field(field.name) self.fields[field.name] = field self.columns[field.db_column] = field self._sorted_field_list.insert(field) self._update_field_lists() if field.default is not None: self.defaults[field] = field.default if isinstance(field.default, Callable): self._default_callables[field] = field.default self._default_callable_list.append((field.name, field.default)) else: self._default_dict[field] = field.default self._default_by_name[field.name] = field.default def remove_field(self, field_name): if field_name not in self.fields: return original = self.fields.pop(field_name) del self.columns[original.db_column] self._sorted_field_list.remove(original) self._update_field_lists() if original.default is not None: del self.defaults[original] if self._default_callables.pop(original, None): for i, (name, _) in enumerate(self._default_callable_list): if name == field_name: self._default_callable_list.pop(i) break else: self._default_dict.pop(original, None) self._default_by_name.pop(original.name, None) def get_default_dict(self): dd = self._default_by_name.copy() for field_name, default in self._default_callable_list: dd[field_name] = default() return dd def get_field_index(self, field): try: return self._sorted_field_list.index(field) except ValueError: return -1 def get_primary_key_fields(self): if self.composite_key: return [ self.fields[field_name] for field_name in self.primary_key.field_names] return [self.primary_key] def rel_for_model(self, model, field_obj=None, multi=False): is_field = isinstance(field_obj, Field) is_node = not is_field and isinstance(field_obj, Node) if multi: accum = [] for field in self.sorted_fields: if isinstance(field, ForeignKeyField) and field.rel_model == model: is_match = ( (field_obj is None) or (is_field and field_obj.name == field.name) or (is_node and field_obj._alias == field.name)) if is_match: if not multi: return field accum.append(field) if multi: return accum def reverse_rel_for_model(self, model, field_obj=None, multi=False): return model._meta.rel_for_model(self.model_class, field_obj, multi) def rel_exists(self, model): return self.rel_for_model(model) or self.reverse_rel_for_model(model) def related_models(self, backrefs=False): models = [] stack = [self.model_class] while stack: model = stack.pop() if model in models: continue models.append(model) for fk in model._meta.rel.values(): stack.append(fk.rel_model) if backrefs: for fk in model._meta.reverse_rel.values(): stack.append(fk.model_class) return models class BaseModel(type): inheritable = set([ 'constraints', 'database', 'db_table_func', 'indexes', 'order_by', 'primary_key', 'schema', 'validate_backrefs', 'only_save_dirty']) def __new__(cls, name, bases, attrs): if name == _METACLASS_ or bases[0].__name__ == _METACLASS_: return super(BaseModel, cls).__new__(cls, name, bases, attrs) meta_options = {"abstract": False} meta = attrs.pop('Meta', None) if meta: for k, v in meta.__dict__.items(): if not k.startswith('_'): meta_options[k] = v model_pk = getattr(meta, 'primary_key', None) parent_pk = None # inherit any field descriptors by deep copying the underlying field # into the attrs of the new model, additionally see if the bases define # inheritable model options and swipe them for b in bases: if not hasattr(b, '_meta'): continue base_meta = getattr(b, '_meta') if parent_pk is None: parent_pk = deepcopy(base_meta.primary_key) all_inheritable = cls.inheritable | base_meta._additional_keys for (k, v) in base_meta.__dict__.items(): if k in all_inheritable and k not in meta_options: meta_options[k] = v for (k, v) in b.__dict__.items(): if k in attrs: continue if isinstance(v, FieldDescriptor): if not v.field.primary_key: attrs[k] = deepcopy(v.field) # initialize the new class and set the magic attributes cls = super(BaseModel, cls).__new__(cls, name, bases, attrs) ModelOptionsBase = meta_options.get('model_options_base', ModelOptions) cls._meta = ModelOptionsBase(cls, **meta_options) cls._data = None cls._meta.indexes = list(cls._meta.indexes) if not cls._meta.db_table: cls._meta.db_table = re.sub('[^\w]+', '_', cls.__name__.lower()) # replace fields with field descriptors, calling the add_to_class hook fields = [] for name, attr in cls.__dict__.items(): if isinstance(attr, Field): if attr.primary_key and model_pk: raise ValueError('primary key is overdetermined.') elif attr.primary_key: model_pk, pk_name = attr, name else: fields.append((attr, name)) composite_key = False if model_pk is None: if parent_pk: model_pk, pk_name = parent_pk, parent_pk.name else: model_pk, pk_name = PrimaryKeyField(primary_key=True), 'id' if isinstance(model_pk, CompositeKey): pk_name = '_composite_key' composite_key = True if model_pk is not False: model_pk.add_to_class(cls, pk_name) cls._meta.primary_key = model_pk cls._meta.auto_increment = ( isinstance(model_pk, PrimaryKeyField) or bool(model_pk.sequence)) cls._meta.composite_key = composite_key for field, name in fields: field.add_to_class(cls, name) # create a repr and error class before finalizing if hasattr(cls, '__unicode__'): setattr(cls, '__repr__', lambda self: '<%s: %r>' % ( cls.__name__, self.__unicode__())) exc_name = '%sDoesNotExist' % cls.__name__ exc_attrs = {'__module__': cls.__module__} exception_class = type(exc_name, (DoesNotExist,), exc_attrs) cls.DoesNotExist = exception_class cls._meta.prepared() if hasattr(cls, 'validate_model'): cls.validate_model() DeferredRelation.resolve(cls) return cls def __iter__(self): return iter(self.select()) class Model(with_metaclass(BaseModel)): def __init__(self, *args, **kwargs): self._data = self._meta.get_default_dict() self._dirty = set(self._data) self._obj_cache = {} for k, v in kwargs.items(): setattr(self, k, v) @classmethod def alias(cls): return ModelAlias(cls) @classmethod def select(cls, *selection): query = SelectQuery(cls, *selection) if cls._meta.order_by: query = query.order_by(*cls._meta.order_by) return query @classmethod def update(cls, __data=None, **update): fdict = __data or {} fdict.update([(cls._meta.fields[f], update[f]) for f in update]) return UpdateQuery(cls, fdict) @classmethod def insert(cls, __data=None, **insert): fdict = __data or {} fdict.update([(cls._meta.fields[f], insert[f]) for f in insert]) return InsertQuery(cls, fdict) @classmethod def insert_many(cls, rows, validate_fields=True): return InsertQuery(cls, rows=rows, validate_fields=validate_fields) @classmethod def insert_from(cls, fields, query): return InsertQuery(cls, fields=fields, query=query) @classmethod def delete(cls): return DeleteQuery(cls) @classmethod def raw(cls, sql, *params): return RawQuery(cls, sql, *params) @classmethod def create(cls, **query): inst = cls(**query) inst.save(force_insert=True) inst._prepare_instance() return inst @classmethod def get(cls, *query, **kwargs): sq = cls.select().naive() if query: sq = sq.where(*query) if kwargs: sq = sq.filter(**kwargs) return sq.get() @classmethod def get_or_create(cls, **kwargs): defaults = kwargs.pop('defaults', {}) query = cls.select() for field, value in kwargs.items(): if '__' in field: query = query.filter(**{field: value}) else: query = query.where(getattr(cls, field) == value) try: return query.get(), False except cls.DoesNotExist: try: params = dict((k, v) for k, v in kwargs.items() if '__' not in k) params.update(defaults) with cls._meta.database.atomic(): return cls.create(**params), True except IntegrityError as exc: try: return query.get(), False except cls.DoesNotExist: raise exc @classmethod def filter(cls, *dq, **query): return cls.select().filter(*dq, **query) @classmethod def table_exists(cls): kwargs = {} if cls._meta.schema: kwargs['schema'] = cls._meta.schema return cls._meta.db_table in cls._meta.database.get_tables(**kwargs) @classmethod def create_table(cls, fail_silently=False): if fail_silently and cls.table_exists(): return db = cls._meta.database pk = cls._meta.primary_key if db.sequences and pk is not False and pk.sequence: if not db.sequence_exists(pk.sequence): db.create_sequence(pk.sequence) db.create_table(cls) cls._create_indexes() @classmethod def _fields_to_index(cls): fields = [] for field in cls._meta.sorted_fields: if field.primary_key: continue requires_index = any(( field.index, field.unique, isinstance(field, ForeignKeyField))) if requires_index: fields.append(field) return fields @classmethod def _index_data(cls): return itertools.chain( [((field,), field.unique) for field in cls._fields_to_index()], cls._meta.indexes or ()) @classmethod def _create_indexes(cls): for field_list, is_unique in cls._index_data(): cls._meta.database.create_index(cls, field_list, is_unique) @classmethod def _drop_indexes(cls, safe=False): for field_list, is_unique in cls._index_data(): cls._meta.database.drop_index(cls, field_list, safe) @classmethod def sqlall(cls): queries = [] compiler = cls._meta.database.compiler() pk = cls._meta.primary_key if cls._meta.database.sequences and pk.sequence: queries.append(compiler.create_sequence(pk.sequence)) queries.append(compiler.create_table(cls)) for field in cls._fields_to_index(): queries.append(compiler.create_index(cls, [field], field.unique)) if cls._meta.indexes: for field_names, unique in cls._meta.indexes: fields = [cls._meta.fields[f] for f in field_names] queries.append(compiler.create_index(cls, fields, unique)) return [sql for sql, _ in queries] @classmethod def drop_table(cls, fail_silently=False, cascade=False): cls._meta.database.drop_table(cls, fail_silently, cascade) @classmethod def truncate_table(cls, restart_identity=False, cascade=False): cls._meta.database.truncate_table(cls, restart_identity, cascade) @classmethod def as_entity(cls): if cls._meta.schema: return Entity(cls._meta.schema, cls._meta.db_table) return Entity(cls._meta.db_table) @classmethod def noop(cls, *args, **kwargs): return NoopSelectQuery(cls, *args, **kwargs) def _get_pk_value(self): return getattr(self, self._meta.primary_key.name) get_id = _get_pk_value # Backwards-compatibility. def _set_pk_value(self, value): if not self._meta.composite_key: setattr(self, self._meta.primary_key.name, value) set_id = _set_pk_value # Backwards-compatibility. def _pk_expr(self): return self._meta.primary_key == self._get_pk_value() def _prepare_instance(self): self._dirty.clear() self.prepared() def prepared(self): pass def _prune_fields(self, field_dict, only): new_data = {} for field in only: if field.name in field_dict: new_data[field.name] = field_dict[field.name] return new_data def _populate_unsaved_relations(self, field_dict): for key in self._meta.rel: conditions = ( key in self._dirty and key in field_dict and field_dict[key] is None and self._obj_cache.get(key) is not None) if conditions: setattr(self, key, getattr(self, key)) field_dict[key] = self._data[key] def save(self, force_insert=False, only=None): field_dict = dict(self._data) if self._meta.primary_key is not False: pk_field = self._meta.primary_key pk_value = self._get_pk_value() else: pk_field = pk_value = None if only: field_dict = self._prune_fields(field_dict, only) elif self._meta.only_save_dirty and not force_insert: field_dict = self._prune_fields( field_dict, self.dirty_fields) if not field_dict: self._dirty.clear() return False self._populate_unsaved_relations(field_dict) if pk_value is not None and not force_insert: if self._meta.composite_key: for pk_part_name in pk_field.field_names: field_dict.pop(pk_part_name, None) else: field_dict.pop(pk_field.name, None) rows = self.update(**field_dict).where(self._pk_expr()).execute() elif pk_field is None: self.insert(**field_dict).execute() rows = 1 else: pk_from_cursor = self.insert(**field_dict).execute() if pk_from_cursor is not None: pk_value = pk_from_cursor self._set_pk_value(pk_value) rows = 1 self._dirty.clear() return rows def is_dirty(self): return bool(self._dirty) @property def dirty_fields(self): return [f for f in self._meta.sorted_fields if f.name in self._dirty] def dependencies(self, search_nullable=False): model_class = type(self) query = self.select().where(self._pk_expr()) stack = [(type(self), query)] seen = set() while stack: klass, query = stack.pop() if klass in seen: continue seen.add(klass) for rel_name, fk in klass._meta.reverse_rel.items(): rel_model = fk.model_class if fk.rel_model is model_class: node = (fk == self._data[fk.to_field.name]) subquery = rel_model.select().where(node) else: node = fk << query subquery = rel_model.select().where(node) if not fk.null or search_nullable: stack.append((rel_model, subquery)) yield (node, fk) def delete_instance(self, recursive=False, delete_nullable=False): if recursive: dependencies = self.dependencies(delete_nullable) for query, fk in reversed(list(dependencies)): model = fk.model_class if fk.null and not delete_nullable: model.update(**{fk.name: None}).where(query).execute() else: model.delete().where(query).execute() return self.delete().where(self._pk_expr()).execute() def serializable_value(self, field_name): try: field = self._meta.fields[field_name] except KeyError: return getattr(self, field_name) return getattr(self, field.name) def __hash__(self): return hash((self.__class__, self._get_pk_value())) def __eq__(self, other): return ( other.__class__ == self.__class__ and self._get_pk_value() is not None and other._get_pk_value() == self._get_pk_value()) def __ne__(self, other): return not self == other def prefetch_add_subquery(sq, subqueries): fixed_queries = [PrefetchResult(sq)] for i, subquery in enumerate(subqueries): if isinstance(subquery, tuple): subquery, target_model = subquery else: target_model = None if not isinstance(subquery, Query) and issubclass(subquery, Model): subquery = subquery.select() subquery_model = subquery.model_class fks = backrefs = None for j in reversed(range(i + 1)): prefetch_result = fixed_queries[j] last_query = prefetch_result.query last_model = prefetch_result.model rels = subquery_model._meta.rel_for_model(last_model, multi=True) if rels: fks = [getattr(subquery_model, fk.name) for fk in rels] pks = [getattr(last_model, fk.to_field.name) for fk in rels] else: backrefs = last_model._meta.rel_for_model( subquery_model, multi=True) if (fks or backrefs) and ((target_model is last_model) or (target_model is None)): break if not (fks or backrefs): tgt_err = ' using %s' % target_model if target_model else '' raise AttributeError('Error: unable to find foreign key for ' 'query: %s%s' % (subquery, tgt_err)) if fks: expr = reduce(operator.or_, [ (fk << last_query.select(pk)) for (fk, pk) in zip(fks, pks)]) subquery = subquery.where(expr) fixed_queries.append(PrefetchResult(subquery, fks, False)) elif backrefs: expr = reduce(operator.or_, [ (backref.to_field << last_query.select(backref)) for backref in backrefs]) subquery = subquery.where(expr) fixed_queries.append(PrefetchResult(subquery, backrefs, True)) return fixed_queries __prefetched = namedtuple('__prefetched', ( 'query', 'fields', 'backref', 'rel_models', 'field_to_name', 'model')) class PrefetchResult(__prefetched): def __new__(cls, query, fields=None, backref=None, rel_models=None, field_to_name=None, model=None): if fields: if backref: rel_models = [field.model_class for field in fields] foreign_key_attrs = [field.to_field.name for field in fields] else: rel_models = [field.rel_model for field in fields] foreign_key_attrs = [field.name for field in fields] field_to_name = list(zip(fields, foreign_key_attrs)) model = query.model_class return super(PrefetchResult, cls).__new__( cls, query, fields, backref, rel_models, field_to_name, model) def populate_instance(self, instance, id_map): if self.backref: for field in self.fields: identifier = instance._data[field.name] key = (field, identifier) if key in id_map: setattr(instance, field.name, id_map[key]) else: for field, attname in self.field_to_name: identifier = instance._data[field.to_field.name] key = (field, identifier) rel_instances = id_map.get(key, []) dest = '%s_prefetch' % field.related_name for inst in rel_instances: setattr(inst, attname, instance) setattr(instance, dest, rel_instances) def store_instance(self, instance, id_map): for field, attname in self.field_to_name: identity = field.to_field.python_value(instance._data[attname]) key = (field, identity) if self.backref: id_map[key] = instance else: id_map.setdefault(key, []) id_map[key].append(instance) def prefetch(sq, *subqueries): if not subqueries: return sq fixed_queries = prefetch_add_subquery(sq, subqueries) deps = {} rel_map = {} for prefetch_result in reversed(fixed_queries): query_model = prefetch_result.model if prefetch_result.fields: for rel_model in prefetch_result.rel_models: rel_map.setdefault(rel_model, []) rel_map[rel_model].append(prefetch_result) deps[query_model] = {} id_map = deps[query_model] has_relations = bool(rel_map.get(query_model)) for instance in prefetch_result.query: if prefetch_result.fields: prefetch_result.store_instance(instance, id_map) if has_relations: for rel in rel_map[query_model]: rel.populate_instance(instance, deps[rel.model]) return prefetch_result.query def create_model_tables(models, **create_table_kwargs): """Create tables for all given models (in the right order).""" for m in sort_models_topologically(models): m.create_table(**create_table_kwargs) def drop_model_tables(models, **drop_table_kwargs): """Drop tables for all given models (in the right order).""" for m in reversed(sort_models_topologically(models)): m.drop_table(**drop_table_kwargs)
[ "caowenbin@xuetangx.com" ]
caowenbin@xuetangx.com
ec54d3609b9f2aeb8fc83b22f7257899302167a2
3930ccd1e546c3ce34282156c1e348977dcc1b36
/program_files/0707_reaction.py
4315b0eb21ec91c515522f862f068b276086098c
[]
no_license
RiordanWG/CS230-SU2021
7076c4bb439df95a9f998c7a4973fb8bd3489228
a091aa16752e63c41414cfec20c0f015f9436a5e
refs/heads/main
2023-06-19T09:30:10.331574
2021-07-12T23:34:32
2021-07-12T23:34:32
null
0
0
null
null
null
null
UTF-8
Python
false
false
274
py
# reaction time tester import time print("Welcome to the reaction time tester!") start_time = time.time() print("Hit the enter key as fast as you can.") input() elapsed_time = time.time() - start_time print("Wow, that was fast. It took " + str(elapsed_time) + " seconds")
[ "matt.macarty@gmail.com" ]
matt.macarty@gmail.com
162bbae5995ec23f5fd6e29e56fd338f22b0d3b5
8ea6fa82913d796561247bc0b7b7c31c7b61bf4f
/Dynect/get_traffic_director_service.py
48821ba6a89ff99c69aabb11d5fa4e22efe9b448
[]
no_license
mady4ever/GSLB
7b4a44192520e78bfa67de0978b7147673232c57
0a64383132b9d0d3cb24b474e9af578eb6eeef9c
refs/heads/master
2021-01-10T07:46:29.125774
2015-12-03T07:28:44
2015-12-03T07:28:44
47,315,009
1
0
null
null
null
null
UTF-8
Python
false
false
998
py
import sys from dynect.DynectDNS import DynectRest from pprint import PrettyPrinter rest_iface = DynectRest() # Log in print "Logging in to API" arguments = { 'customer_name': 'ciscocloud', 'user_name': 'UserName', 'password': 'UserAPIKey', } # ciscocloud UserName Cisco!gs1b response = rest_iface.execute('/Session/', 'POST', arguments) if response['status'] != 'success': sys.exit("Incorrect credentials") # Perform action print "Get traffic director service as authentication succeded" services = { 'label' : 'Test*', 'detail' : 'true', } response = rest_iface.execute('/REST/DSF/', 'GET', services) if response['status'] != 'success': pretty = PrettyPrinter() msg = "Getting traffic director service : %s " % pretty.pformat(response) sys.exit(msg) print "Rest call response" pretty = PrettyPrinter() msg = "Response : %s " % pretty.pformat(response['data']) print msg # Log out, to be polite print "Deleting session" rest_iface.execute('/Session/', 'DELETE')
[ "mahepate@cisco.com" ]
mahepate@cisco.com
4403e503e127c23cb397fe72eb4aca8267bc9fc4
a2d36e471988e0fae32e9a9d559204ebb065ab7f
/huaweicloud-sdk-cloudrtc/huaweicloudsdkcloudrtc/v2/model/update_url_auth_request.py
8044913f81326b931d750d21e5b323e8a54d90bf
[ "Apache-2.0" ]
permissive
zhouxy666/huaweicloud-sdk-python-v3
4d878a90b8e003875fc803a61414788e5e4c2c34
cc6f10a53205be4cb111d3ecfef8135ea804fa15
refs/heads/master
2023-09-02T07:41:12.605394
2021-11-12T03:20:11
2021-11-12T03:20:11
null
0
0
null
null
null
null
UTF-8
Python
false
false
6,802
py
# coding: utf-8 import re import six from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization class UpdateUrlAuthRequest: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ sensitive_list = [] openapi_types = { 'content_type': 'str', 'authorization': 'str', 'x_sdk_date': 'str', 'x_project_id': 'str', 'app_id': 'str', 'body': 'AppAuthReq' } attribute_map = { 'content_type': 'Content-Type', 'authorization': 'Authorization', 'x_sdk_date': 'X-Sdk-Date', 'x_project_id': 'X-Project-Id', 'app_id': 'app_id', 'body': 'body' } def __init__(self, content_type=None, authorization=None, x_sdk_date=None, x_project_id=None, app_id=None, body=None): """UpdateUrlAuthRequest - a model defined in huaweicloud sdk""" self._content_type = None self._authorization = None self._x_sdk_date = None self._x_project_id = None self._app_id = None self._body = None self.discriminator = None self.content_type = content_type if authorization is not None: self.authorization = authorization if x_sdk_date is not None: self.x_sdk_date = x_sdk_date if x_project_id is not None: self.x_project_id = x_project_id self.app_id = app_id if body is not None: self.body = body @property def content_type(self): """Gets the content_type of this UpdateUrlAuthRequest. 内容类型。 :return: The content_type of this UpdateUrlAuthRequest. :rtype: str """ return self._content_type @content_type.setter def content_type(self, content_type): """Sets the content_type of this UpdateUrlAuthRequest. 内容类型。 :param content_type: The content_type of this UpdateUrlAuthRequest. :type: str """ self._content_type = content_type @property def authorization(self): """Gets the authorization of this UpdateUrlAuthRequest. 使用AK/SK方式认证时必选,携带的鉴权信息。 :return: The authorization of this UpdateUrlAuthRequest. :rtype: str """ return self._authorization @authorization.setter def authorization(self, authorization): """Sets the authorization of this UpdateUrlAuthRequest. 使用AK/SK方式认证时必选,携带的鉴权信息。 :param authorization: The authorization of this UpdateUrlAuthRequest. :type: str """ self._authorization = authorization @property def x_sdk_date(self): """Gets the x_sdk_date of this UpdateUrlAuthRequest. 使用AK/SK方式认证时必选,请求的发生时间。 :return: The x_sdk_date of this UpdateUrlAuthRequest. :rtype: str """ return self._x_sdk_date @x_sdk_date.setter def x_sdk_date(self, x_sdk_date): """Sets the x_sdk_date of this UpdateUrlAuthRequest. 使用AK/SK方式认证时必选,请求的发生时间。 :param x_sdk_date: The x_sdk_date of this UpdateUrlAuthRequest. :type: str """ self._x_sdk_date = x_sdk_date @property def x_project_id(self): """Gets the x_project_id of this UpdateUrlAuthRequest. 使用AK/SK方式认证时必选,携带项目ID信息。 :return: The x_project_id of this UpdateUrlAuthRequest. :rtype: str """ return self._x_project_id @x_project_id.setter def x_project_id(self, x_project_id): """Sets the x_project_id of this UpdateUrlAuthRequest. 使用AK/SK方式认证时必选,携带项目ID信息。 :param x_project_id: The x_project_id of this UpdateUrlAuthRequest. :type: str """ self._x_project_id = x_project_id @property def app_id(self): """Gets the app_id of this UpdateUrlAuthRequest. 应用id :return: The app_id of this UpdateUrlAuthRequest. :rtype: str """ return self._app_id @app_id.setter def app_id(self, app_id): """Sets the app_id of this UpdateUrlAuthRequest. 应用id :param app_id: The app_id of this UpdateUrlAuthRequest. :type: str """ self._app_id = app_id @property def body(self): """Gets the body of this UpdateUrlAuthRequest. :return: The body of this UpdateUrlAuthRequest. :rtype: AppAuthReq """ return self._body @body.setter def body(self, body): """Sets the body of this UpdateUrlAuthRequest. :param body: The body of this UpdateUrlAuthRequest. :type: AppAuthReq """ self._body = body def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: if attr in self.sensitive_list: result[attr] = "****" else: result[attr] = value return result def to_str(self): """Returns the string representation of the model""" import simplejson as json if six.PY2: import sys reload(sys) sys.setdefaultencoding("utf-8") return json.dumps(sanitize_for_serialization(self), ensure_ascii=False) def __repr__(self): """For `print`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, UpdateUrlAuthRequest): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """Returns true if both objects are not equal""" return not self == other
[ "hwcloudsdk@huawei.com" ]
hwcloudsdk@huawei.com
445467631ec00a17e500cb88d7b69ac011e4e605
fc93668dd9d324e8c7de1f8f7ead0d15232e9cb8
/SSD/ssd/data/build.py
bc3907228cbfb1648c33a9ad4a4c5fd58da465f9
[ "MIT" ]
permissive
tormey97/MasterProject
551aaed2299ee3ec494691324bbbb644fe1edf2d
d4f5d6a4d6e0df83ee44c726b16878595cd5fa44
refs/heads/main
2023-06-06T22:37:32.592523
2021-06-27T07:35:58
2021-06-27T07:35:58
344,808,313
0
0
null
null
null
null
UTF-8
Python
false
false
2,492
py
import torch from torch.utils.data import DataLoader from torch.utils.data.dataloader import default_collate from SSD.ssd.data import samplers from SSD.ssd.data.datasets import build_dataset from SSD.ssd.data.transforms import build_transforms, build_target_transform from SSD.ssd.structures.container import Container class BatchCollator: def __init__(self, is_train=True): self.is_train = is_train def __call__(self, batch): transposed_batch = list(zip(*batch)) images = default_collate(transposed_batch[0]) img_ids = default_collate(transposed_batch[2]) if self.is_train: list_targets = transposed_batch[1] targets = Container( {key: default_collate([d[key] for d in list_targets]) for key in list_targets[0]} ) else: targets = None return images, targets, img_ids def make_data_loader(cfg, is_train=True, distributed=False, max_iter=None, start_iter=0): train_transform = build_transforms(cfg, is_train=is_train) target_transform = build_target_transform(cfg) if is_train else None dataset_list = cfg.DATASETS.TRAIN if is_train else cfg.DATASETS.TEST datasets = build_dataset(dataset_list, transform=train_transform, target_transform=target_transform, is_train=is_train) shuffle = is_train data_loaders = [] for dataset in datasets: if distributed: sampler = samplers.DistributedSampler(dataset, shuffle=shuffle) elif shuffle: sampler = torch.utils.data.RandomSampler(dataset) else: sampler = torch.utils.data.sampler.SequentialSampler(dataset) batch_size = cfg.SOLVER.BATCH_SIZE if is_train else cfg.TEST.BATCH_SIZE batch_sampler = torch.utils.data.sampler.BatchSampler(sampler=sampler, batch_size=batch_size, drop_last=False) if max_iter is not None: batch_sampler = samplers.IterationBasedBatchSampler(batch_sampler, num_iterations=max_iter, start_iter=start_iter) data_loader = DataLoader(dataset, num_workers=cfg.DATA_LOADER.NUM_WORKERS, batch_sampler=batch_sampler, pin_memory=cfg.DATA_LOADER.PIN_MEMORY, collate_fn=BatchCollator(is_train)) data_loaders.append(data_loader) if is_train: # during training, a single (possibly concatenated) data_loader is returned assert len(data_loaders) == 1 return data_loaders[0] return data_loaders
[ "torstme@stud.ntnu.no" ]
torstme@stud.ntnu.no
e81b96fa78bb125eb8c3180d79b972fc1c57b455
5202326728678c2da05e6b726719ce44fc502bee
/app/you_get/extractors/__init__.py
c4cd40c021b6182019fd6fdd113c1c15e221aefb
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
wnpllrzodiac/GUI-YouGet
52b454814f48a63fd27d7234131120dc8aeec348
088dc5b07acc457089364c386ea0521541fc410f
refs/heads/master
2021-01-17T22:53:37.744928
2016-06-18T14:36:59
2016-06-18T14:36:59
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,744
py
#!/usr/bin/env python from .acfun import * from .alive import * from .archive import * from .baidu import * from .bandcamp import * from .bilibili import * from .cbs import * from .ckplayer import * from .cntv import * from .dailymotion import * from .dilidili import * from .douban import * from .douyutv import * from .ehow import * from .facebook import * from .fc2video import * from .flickr import * from .freesound import * from .funshion import * from .google import * from .heavymusic import * from .huaban import * from .ifeng import * from .imgur import * from .infoq import * from .instagram import * from .interest import * from .iqilu import * from .iqiyi import * from .joy import * from .jpopsuki import * from .ku6 import * from .kugou import * from .kuwo import * from .le import * from .lizhi import * from .magisto import * from .metacafe import * from .mgtv import * from .miaopai import * from .miomio import * from .mixcloud import * from .mtv81 import * from .musicplayon import * from .nanagogo import * from .naver import * from .netease import * # from .nicovideo import * from .panda import * from .pinterest import * from .pixnet import * from .pptv import * from .qianmo import * from .qie import * from .qq import * from .sina import * from .sohu import * from .soundcloud import * from .suntv import * from .theplatform import * from .thvideo import * from .tucao import * from .tudou import * from .tumblr import * from .twitter import * from .veoh import * from .videomega import * from .vimeo import * from .vine import * from .vk import * from .w56 import * from .xiami import * from .yinyuetai import * from .yixia import * from .youku import * from .youtube import * from .ted import * from .khan import *
[ "zwkv587@gmail.com" ]
zwkv587@gmail.com
4dfa2a46bfda6ade0faa997c3a6af801ed19872e
792fc8c459f4197e53b4eacb71766e54cd3197c9
/main.py
96a683da6f46b5f5188b2f080d05d116d2e20b39
[]
no_license
davidbosc/PokemonMoveSelector
77a6e538a2abf97d4bf36b99a1261d4128a9d20b
cb3846d527d2e25d0b2e35cd5335f6fec131980b
refs/heads/master
2022-12-13T07:23:24.387780
2020-09-13T20:44:27
2020-09-13T20:44:27
293,627,058
0
0
null
null
null
null
UTF-8
Python
false
false
2,518
py
import cv2 import numpy as np from PIL import ImageGrab import win32gui import math from InputController import Input import WindowHandleUtil from TextDetectionAndRecognition import TextDetectionAndRecognition from LevenshteinDistance import LevenshteinDistanceService import TwtichOAuthGeneration import CancelAuthorizationCallback import TwitchChatScanner movesFile = "./movelists/pokemon_gen5_moves.txt" emulatorHandle = WindowHandleUtil.getWindowHandleFromTitle("DeSmuME") textInterpreter = TextDetectionAndRecognition() pokemonMoves = [line.rstrip('\n').lower() for line in open(movesFile)] maxLength = 0 for word in pokemonMoves: if len(word) > maxLength: maxLength = len(word) access_token = '' CancelAuthorizationCallback.StartCallbackServerThread() access_token = TwtichOAuthGeneration.RenderAuthorizeUI() twitch_username = '' twitch_username = input() TwitchChatScanner.StartTwitchChatScanner(twitch_username, access_token) while True: position = win32gui.GetWindowRect(emulatorHandle) imgHeight = position[3] - position[1] imgWidth = position[2] - position[0] positionHeightOffset = position[1] position = (position[0], positionHeightOffset + imgHeight / 2, position[2], position[3]) screenshot = ImageGrab.grab(position) screenshot = np.array(screenshot) screenshot = cv2.cvtColor(screenshot, cv2.COLOR_RGB2BGR) indices = textInterpreter.detectionOutput(screenshot) inputs = [] for i in indices: boundingBoxPoints = [] wordRecognized = textInterpreter.getDetectedText(screenshot, i, boundingBoxPoints) textInterpreter.drawBoundingBoxesAndText(screenshot, wordRecognized) inputs.append(Input(wordRecognized, boundingBoxPoints, position[1] - positionHeightOffset)) scaledYThreshold = imgHeight * 0.02 scaledXThreshold = imgWidth * 0.1 for x in list(inputs): x.checkForTextProximityWithinThresholds(inputs, scaledYThreshold, scaledXThreshold) for x in list(inputs): distanceFromCancel = LevenshteinDistanceService().LevenshteinDistanceMatrix(x.moveText, "cancel")[len(x.moveText)-1][5] containsPP = " pp" in x.moveText or "pp " in x.moveText or ("pp" in x.moveText and len(x.moveText) == 2) if distanceFromCancel < 3 or sum(c.isdigit() for c in x.moveText) > 1 or containsPP: inputs.remove(x) x.autoCorrectText(maxLength, len(pokemonMoves), pokemonMoves) # print(*inputs) cv2.imshow('frame', screenshot) cv2.waitKey(1)
[ "davidjnbosc@gmail.com" ]
davidjnbosc@gmail.com
990db47ec28843c8eb2d8542de7e375dbb43c859
9c37742bdd09ccfb02da09be79e20b7333694d9b
/pyswagger/tests/v1_2/test_app.py
d65c18e48ea45b37e6f89ececb380e1a155dc7f9
[ "MIT" ]
permissive
simudream/pyswagger
72eea9a24140d3dfbb4f6a4537e10a9b07c4d09f
1dcf7ab291d9535dfdb705e0cb0e2c6f2b0fb474
refs/heads/master
2020-12-11T05:32:38.335378
2015-01-22T11:39:10
2015-01-22T11:39:10
null
0
0
null
null
null
null
UTF-8
Python
false
false
8,178
py
from pyswagger import SwaggerApp, errs from ..utils import get_test_data_folder from pyswagger.spec.v2_0.objects import ( Schema, Operation, ) import unittest import httpretty import os import six class HTTPGetterTestCase(unittest.TestCase): """ test HTTPGetter """ @httpretty.activate def test_http_getter(self): """ make sure HTTPGetter works """ folder = get_test_data_folder(version='1.2', which='wordnik') resource_list = user = pet = store = None with open(os.path.join(folder, 'resource_list.json')) as f: resource_list = f.read() with open(os.path.join(folder, 'user.json')) as f: user = f.read() with open(os.path.join(folder, 'pet.json')) as f: pet = f.read() with open(os.path.join(folder, 'store.json')) as f: store = f.read() httpretty.register_uri( httpretty.GET, 'http://petstore.swagger.wordnik.com/api/api-docs', status=200, body=resource_list ) httpretty.register_uri( httpretty.GET, 'http://petstore.swagger.wordnik.com/api/api-docs/user', status=200, body=user ) httpretty.register_uri( httpretty.GET, 'http://petstore.swagger.wordnik.com/api/api-docs/pet', status=200, body=pet ) httpretty.register_uri( httpretty.GET, 'http://petstore.swagger.wordnik.com/api/api-docs/store', status=200, body=store ) local_app = SwaggerApp._create_('http://petstore.swagger.wordnik.com/api/api-docs') self.assertEqual(sorted(local_app.raw._field_names_), sorted(['info', 'authorizations', 'apiVersion', 'swaggerVersion', 'apis'])) op = local_app.raw.apis['pet'].apis['updatePet'] self.assertEqual(sorted(op._field_names_), sorted([ 'authorizations', 'consumes', 'defaultValue', 'deprecated', 'enum', 'format', 'items', 'maximum', 'method', 'minimum', 'nickname', 'parameters', 'path', 'produces', '$ref', 'responseMessages', 'type', 'uniqueItems' ])) class ValidationTestCase(unittest.TestCase): """ test case for validation """ def setUp(self): self.app = SwaggerApp.load(get_test_data_folder(version='1.2', which='err')) def test_errs(self): """ """ errs = self.app.validate(strict=False) self.maxDiff = None self.assertEqual(sorted(errs), sorted([ (('#/info', 'Info'), 'requirement description not meet.'), (('#/info', 'Info'), 'requirement title not meet.'), (('#/authorizations/oauth2', 'Authorization'), 'requirement type not meet.'), (('#/authorizations/oauth2/grantTypes/implicit/loginEndpoint', 'LoginEndpoint'), 'requirement url not meet.'), (('#/authorizations/oauth2/scopes/0', 'Scope'), 'requirement scope not meet.'), (('#/authorizations/oauth2/grantTypes/authorization_code/tokenRequestEndpoint', 'TokenRequestEndpoint'), 'requirement url not meet.'), (('#/apis/pet/apis/getPetById', 'Operation'), 'requirement method not meet.'), (('#/apis/pet/apis/getPetById/parameters/0', 'Parameter'), 'requirement name not meet.'), (('#/apis/pet/apis/getPetById/responseMessages/0', 'ResponseMessage'), 'requirement code not meet.'), (('#/apis/pet/apis', 'Operation'), 'requirement nickname not meet.'), (('#/apis/pet/models/Pet/properties/tags', 'Property'), 'array should be existed along with items'), (('#/apis/pet/apis/getPetById/parameters/0', 'Parameter'), 'allowMultiple should be applied on path, header, or query parameters'), (('#/apis/pet/apis/partialUpdate/parameters/1', 'Parameter'), 'body parameter with invalid name: qqq'), (('#/apis/pet/apis/partialUpdate/parameters/0', 'Parameter'), 'void is only allowed in Operation object.') ])) def test_raise_exception(self): """ raise exceptions in strict mode """ self.assertRaises(errs.ValidationError, self.app.validate) class SwaggerAppTestCase(unittest.TestCase): """ test case for SwaggerApp """ def setUp(self): folder = get_test_data_folder( version='1.2', ) def _hook(url): p = six.moves.urllib.parse.urlparse(url) if p.scheme != 'file': return url path = os.path.join(folder, p.path if not p.path.startswith('/') else p.path[1:]) return six.moves.urllib.parse.urlunparse(p[:2]+(path,)+p[3:]) self.app = SwaggerApp.load('wordnik', url_load_hook=_hook) self.app.prepare() def test_ref(self): """ test ref function """ self.assertRaises(ValueError, self.app.resolve, None) self.assertRaises(ValueError, self.app.resolve, '') self.assertTrue(isinstance(self.app.resolve('#/definitions/user!##!User'), Schema)) self.assertTrue(isinstance(self.app.resolve('#/paths/~1api~1user~1{username}/put'), Operation)) self.assertEqual(self.app.resolve('#/paths/~1api~1store~1order/post/produces'), ['application/json']) self.assertEqual(self.app.resolve('#/host'), 'petstore.swagger.wordnik.com') # resolve with URL part # refer to # http://stackoverflow.com/questions/10246116/python-dereferencing-weakproxy # for how to dereferencing weakref self.assertEqual( self.app.resolve('#/definitions/user!##!User').__repr__(), self.app.resolve('file:///wordnik#/definitions/user!##!User').__repr__() ) self.assertEqual( self.app.resolve('#/paths/~1api~1user~1{username}/put').__repr__(), self.app.resolve('file:///wordnik#/paths/~1api~1user~1{username}/put').__repr__() ) def test_scope_dict(self): """ ScopeDict is a syntactic suger to access scoped named object, ex. Operation, Model """ # Operation self.assertTrue(self.app.op['user', 'getUserByName'], Operation) self.assertTrue(self.app.op['user', 'getUserByName'] is self.app.op['user!##!getUserByName']) self.assertTrue(self.app.op['getUserByName'] is self.app.op['user!##!getUserByName']) def test_shortcut(self): """ a short cut to Resource, Operation, Model from SwaggerApp """ # Resource # TODO: resource is now replaced by tags #self.assertTrue(isinstance(app.rs['pet'], Resource)) #self.assertTrue(isinstance(app.rs['user'], Resource)) #self.assertTrue(isinstance(app.rs['store'], Resource)) # Operation self.assertEqual(len(self.app.op.values()), 20) self.assertEqual(sorted(self.app.op.keys()), sorted([ 'pet!##!addPet', 'pet!##!deletePet', 'pet!##!findPetsByStatus', 'pet!##!findPetsByTags', 'pet!##!getPetById', 'pet!##!partialUpdate', 'pet!##!updatePet', 'pet!##!updatePetWithForm', 'pet!##!uploadFile', 'store!##!deleteOrder', 'store!##!getOrderById', 'store!##!placeOrder', 'user!##!createUser', 'user!##!createUsersWithArrayInput', 'user!##!createUsersWithListInput', 'user!##!deleteUser', 'user!##!getUserByName', 'user!##!loginUser', 'user!##!logoutUser', 'user!##!updateUser' ])) self.assertTrue(self.app.op['user!##!getUserByName'], Operation) # Model d = self.app.resolve('#/definitions') self.assertEqual(len(d.values()), 5) self.assertEqual(sorted(d.keys()), sorted([ 'pet!##!Category', 'pet!##!Pet', 'pet!##!Tag', 'store!##!Order', 'user!##!User' ]))
[ "missionaryliao@gmail.com" ]
missionaryliao@gmail.com
29f97a8eaec13dfa7a5378896409a8b4770b2b4e
934d61923a73d6aaee0ffeb61ad9410abe17a1d0
/plugins/video/UlmenTV/default.py
329342aeb39336565fc79d38fc235fd58e44e81a
[]
no_license
quickbreach/xbmc-addons
151cdec2a946e63f7fc2d715156bedf9c308492c
7b7d3518506fbf4f590ad69ee1027a485169c03d
refs/heads/master
2021-05-29T20:31:38.134618
2012-05-25T23:40:08
2012-05-25T23:40:08
null
0
0
null
null
null
null
UTF-8
Python
false
false
11,833
py
""" A plugin to get videos from UlmenTV """ import sys, os, os.path import xbmc, xbmcgui, xbmcplugin import urllib, urllib2, re, time from shutil import rmtree, copy import traceback __plugin__ = "UlmenTV" __version__ = '1.38' __author__ = 'bootsy [bootsy82@gmail.com] with much help from BigBellyBilly' __date__ = '16-08-2009' #DIR_USERDATA = "/".join( ["special://masterprofile","plugin_data","video", __plugin__] ) # T:// - new drive DIR_USERDATA = "/".join( ["T:"+os.sep,"plugin_data","video", __plugin__] ) # translatePath() will convert to new special:// DIR_USERDATA_OLD = "/".join( ["T:"+os.sep,"plugin_data", __plugin__] ) # translatePath() will convert to new special:// BASE_URL = 'http://www.myspass.de' SVN_URL = 'http://xbmc-addons.googlecode.com/svn/tags/plugins/video/' + __plugin__ # TODO: use special:// equiv. - for now stick with translatePath() cos it converts to special:// equiv. local_base_dir = "/".join( ['Q:','plugins', 'video'] ) local_dir = xbmc.translatePath( "/".join( [local_base_dir, __plugin__] ) ) backup_base_dir = xbmc.translatePath( "/".join( [local_base_dir,'.backups'] ) ) local_backup_dir = os.path.join( backup_base_dir, __plugin__ ) #print 'local dir: ' + local_dir #print 'backup dir: ' + local_backup_dir def log(msg): if isinstance(msg,list): for i in msg: xbmc.output(str(i)) else: xbmc.output(str(msg)) def errorOK(title="", msg=""): e = str( sys.exc_info()[ 1 ] ) log(e) if not title: title = __plugin__ if not msg: msg = "ERROR!" xbmcgui.Dialog().ok( title, msg, e ) dialogProgress = xbmcgui.DialogProgress() def updateCheck(version=""): """ update plugin from svn - only works against a single file """ log("> updateCheck() version=" + version) isUpdating = False def _parseHTMLSource( htmlsource ): """ parse html source for tagged version and url """ log( "_parseHTMLSource()" ) try: url = re.search('Revision \d+:(.*?)<', htmlsource, re.IGNORECASE).group(1).strip() tagList = re.compile('<li><a href="(.*?)"', re.MULTILINE+re.IGNORECASE+re.DOTALL).findall(htmlsource) if tagList[0] == "../": del tagList[0] return tagList, url except: return None, None def _getLatestVersion(): """ checks for latest tag version """ version = "-1" try: # get version tags htmlsource = getURL( SVN_URL ) if htmlsource: tagList, url = _parseHTMLSource( htmlsource ) if tagList: version = tagList[-1].replace("/","") # remove trailing / except: errorOK() log( "_getLatestVersion() version=%s" % version ) return version # main processing of checking try: dialogProgress.create(__plugin__) path = os.getcwd().replace(';','') log('current path:' + path) if not version or path == local_dir: dialogProgress.update(0, "Checking for new version...") # get svn version and check if newer SVN_V = _getLatestVersion() currVerMsg = 'Current Version: ' + __version__ newVerMsg = 'SVN Version: ' + SVN_V if SVN_V != -1 and SVN_V > __version__ and \ xbmcgui.Dialog().yesno(__plugin__,"New version available! ", currVerMsg, newVerMsg, "Cancel", "Update"): dialogProgress.update(0, "Making backup ...") file = 'default.py' dest = os.path.join( local_backup_dir,file ) src = os.path.join( local_dir,file ) try: os.makedirs( local_backup_dir ) log("created " + local_backup_dir) except: # exists, remove file try: os.remove(dest) log("removed " + dest) except: pass try: # copy to backup log("copy file from=" + src) copy(src, dest) except: errorOK(msg="Failed to backup file") else: dialogProgress.update(100, "Issuing update ...") cmd = "XBMC.RunPlugin(plugin://%s/%s/%s?updating=%s)" % ('video', '.backups', __plugin__,SVN_V ) log("cmd=" + cmd) xbmc.executebuiltin(cmd) isUpdating = True elif version or path == local_backup_dir: dialogProgress.update(0, "Installing update ...") file = 'default.py' src = "/".join( [SVN_URL,version,file] ) dest = os.path.join( local_dir,file ) try: # remove orig os.remove(dest) log("remove orig dir=" + dest) except: pass log("urlretrieve src=%s dest=%s" % (src, dest)) urllib.urlretrieve( src, dest) dialogProgress.update(100) xbmcgui.Dialog().ok(__plugin__, "Update completed!", 'Please restart plugin') log('Update complete') isUpdating = True dialogProgress.close() except: dialogProgress.close() errorOK(msg="Update Failed!") log("< updateCheck() isUpdating=%s" % isUpdating) return isUpdating # Get all Categories. def getUlmenCats(): log("> getUlmenCats()") res=[] url = BASE_URL + "/de/ulmentv/index.html" doc = getURL(url) if doc: p=re.compile('class="(?:active|inactive).*?href="(.*?)">(.*?)</a', re.DOTALL + re.MULTILINE + re.IGNORECASE) matches=p.findall(doc) for url,name in matches: res.append((url, name.replace('<br />',' '))) log(res) log("< getUlmenCats()") return res # Get all episodes for a cat. def getUlmenepisodes(url,name): log("> getUlmenepisodes()") res=[] doc = getURL(url) if doc: p1=re.compile('class="my_chapter_headline">(.*?)</div>(.*?)<!--my_videoslider_line', re.DOTALL + re.MULTILINE + re.IGNORECASE) # bbb p2=re.compile('class="my_video_headline">(.*?)</.*?(http.*?jpg).*?href="(.*?)" title="(.*?)"', re.DOTALL + re.MULTILINE + re.IGNORECASE) chMatches=p1.findall(doc) for chname, episodes in chMatches: p2Matches=p2.findall(episodes) for part,thumbnail,id,name in p2Matches: if thumbnail=='': thumbnail='http://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk/XBMC/skin/Project%20Mayhem%20III/media/defaultVideoBig.png' name='Unbekannt' url='http://www.myspass.de'+id res.append((chname,part,thumbnail,url,name)) log(res) log("< getUlmenepisodes()") return res # Get all newest episodes. def getUlmenNewEpisodes(name): log("> getUlmenNewEpisodes()") res=[] url = BASE_URL + '/de/ajax/utv/utv_videolist_newest.html?owner=UlmenTV' doc = getURL(url) if doc: p=re.compile('url\(\'(.*?)\'.*?href="(.*?)".*?title="(.*?)"', re.DOTALL + re.MULTILINE + re.IGNORECASE) matches=p.findall(doc) for thumbnail,id,name in matches: if thumbnail=='': thumbnail='http://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk/XBMC/skin/Project%20Mayhem%20III/media/defaultVideoBig.png' if name=='': name='Unbekannt' url='http://www.myspass.de'+id res.append(('Neueste Videos','Folge 1/1',thumbnail,url,name)) log(res) log("< getUlmenNewEpisodes()") return res #fetch videolinks def fetchVideoLink(url): header = {'User-agent' : 'XBMC UlmenTV'} post_data='downloadurl='+url url='http://getvids.de/video.cgi' request=urllib2.Request(url, post_data, header) f=urllib2.urlopen(request) doc=f.read() f.close() if doc: p=re.compile('href="([^"]+)" title="Download">', re.DOTALL + re.MULTILINE + re.IGNORECASE) matches=p.findall(doc) url=matches[0] return url # fetch webpage def getURL(url): """ read a doc from a url """ try: safe_url = url.replace( " ", "%20" ) log('getURL() url=%s' % safe_url) sock = urllib.urlopen( safe_url ) doc = sock.read() sock.close() return unicode(doc, 'UTF-8') except: errorOK() return None # fetch media file def fetchBinary(url): fn = '' try: fn = os.path.join(DIR_USERDATA, os.path.basename(url)) fn = xbmc.translatePath(fn) fn = xbmc.makeLegalFilename(fn) log('fetchBinary() url=%s fn=%s' % (url,fn)) if not os.path.isfile(fn): opener = urllib.FancyURLopener() fn, resp = opener.retrieve(url, fn) opener.close() os.path.isfile(fn) except: msg = sys.exc_info()[ 1 ] print msg url = 'http://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk/XBMC/skin/Project%20Mayhem%20III/media/defaultVideoBig.png' fn = os.path.join(DIR_USERDATA, 'defaultVideoBig.png') fn = xbmc.translatePath(fn) log('fetchBinary() url=%s fn=%s' % (url,fn)) if not os.path.isfile(fn): opener = urllib.FancyURLopener() fn, resp = opener.retrieve(url, fn) opener.close() os.path.isfile(fn) if fn and os.path.isfile(fn): return fn else: return '' def get_params(): """ extract params from argv[2] to make a dict (key=value) """ paramDict = {} try: print "get_params() argv=", sys.argv if sys.argv[2]: paramPairs=sys.argv[2][1:].split( "&" ) for paramsPair in paramPairs: paramSplits = paramsPair.split('=') if (len(paramSplits))==2: paramDict[paramSplits[0]] = paramSplits[1] except: errorOK() return paramDict # add a link to directory def addLink(name, url, img, mode): log("addLink() url=%s" % url) liz=xbmcgui.ListItem(name, '', img, img) liz.setInfo( type="Video", infoLabels={ "Title": name } ) u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name) log("addLink() videourl=%s" % url) return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz) # add a folder to directory def addDir(name,url,mode): u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name) log("addDir() url=%s" % u) liz=xbmcgui.ListItem(name) liz.setInfo( type="Video", infoLabels={ "Title": name } ) return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True) # fetch Cats and add to directory def showCats(url,name): cat=getUlmenCats() for url,name in cat: addDir(name,url,1) # fetch Episodes for a Cat. and add to directory def showShows(url,name): if not url.startswith(BASE_URL): url = BASE_URL+url if url.endswith('ulmentv/index.html'): shows=getUlmenNewEpisodes(name) else: shows=getUlmenepisodes(url,name) dialogProgress.create("Downloading Shows ...") for chname,part,thumbnail,url,name in shows: ep = "%s - %s" % (part, name) dialogProgress.update(0, chname, ep, os.path.basename(thumbnail)) img = fetchBinary(thumbnail) if not img: img = "defaultVideoBig.png" if chname=='Neueste Videos': show = name else: show = "%s - %s - %s" % (chname, part, name) addLink(show,url,img,2) dialogProgress.close() def playVideo(url,name): url = fetchVideoLink(url) xbmc.Player(xbmc.PLAYER_CORE_AUTO).play(str(url)) ####################################################################################################################### # BEGIN ! ####################################################################################################################### updating = False params=get_params() if not params: # first run, check for update updating = updateCheck() else: version = params.get("updating", None) if version: updating = updateCheck(version) if not updating: try: # used to save thumbnail images d = xbmc.translatePath(DIR_USERDATA) os.makedirs( d ) log("created " + d) except: pass try: # used to remove old thumbnails + folder d = xbmc.translatePath(DIR_USERDATA_OLD) if os.path.exists( d ): rmtree( d ) log("removed " + d) except: pass url=urllib.unquote_plus(params.get("url", "")) name=urllib.unquote_plus(params.get("name","")) mode=int(params.get("mode","0")) log("Mode: "+str(mode)) log("URL: "+str(url)) log("Name: "+str(name)) if mode==0 or not url: showCats(url,name) elif mode==1: showShows(url,name) elif mode==2: playVideo(url,name) ok = True xbmcplugin.endOfDirectory(int(sys.argv[1]), ok)
[ "bootsy82@753fbab9-553a-0410-a42e-33068982fbc4" ]
bootsy82@753fbab9-553a-0410-a42e-33068982fbc4
272dc78fa2776b1b4ca51387a148e4151836292f
a53bfe90ccc561c0b97436583809bc7fbbacab27
/src/ggrc/models/hooks/proposal.py
12a8ec48bf44fda3051ad8a61271df614837b400
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
indrajithbandara/ggrc-core
ed970499bc69b587ded9e195671d4bc971b9ed6d
23bbec94d4bee0e8ce65c52bc894f6301f2b6a69
refs/heads/master
2021-04-15T13:50:36.757375
2018-03-21T16:52:40
2018-03-21T16:52:40
126,467,536
1
0
null
2018-03-23T10:08:19
2018-03-23T10:08:18
null
UTF-8
Python
false
false
3,786
py
# Copyright (C) 2018 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """AccessControlList creation hooks.""" import datetime from sqlalchemy import inspect from ggrc.services import signals from ggrc.models import all_models from ggrc.models import comment from ggrc import login from ggrc.utils.revisions_diff import applier from ggrc.models import proposal as proposal_model def is_status_changed_to(required_status, obj): return (inspect(obj).attrs.status.history.has_changes() and obj.status == required_status) def add_comment_about(proposal, reason, txt): """Create comment about proposal for reason with required text.""" if not isinstance(proposal.instance, comment.Commentable): return txt = txt or "" txt = txt.strip() if txt.startswith("<p>"): txt = txt[3:] if txt.endswith("</p>"): txt = txt[:-4] txt = txt.strip() comment_text = proposal.build_comment_text(reason, txt, proposal.proposed_by) created_comment = all_models.Comment( description=comment_text, modified_by_id=login.get_current_user_id(), initiator_instance=proposal) all_models.Relationship( source=proposal.instance, destination=created_comment) # pylint: disable=unused-argument # pylint: disable=too-many-arguments def apply_proposal( sender, obj=None, src=None, service=None, event=None, initial_state=None): # noqa """Apply proposal procedure hook.""" if not is_status_changed_to(obj.STATES.APPLIED, obj): return current_user = login.get_current_user() now = datetime.datetime.now() obj.applied_by = current_user obj.apply_datetime = now if applier.apply_action(obj.instance, obj.content): obj.instance.modified_by = current_user obj.instance.updated_at = now add_comment_about(obj, obj.STATES.APPLIED, obj.apply_reason) def decline_proposal( sender, obj=None, src=None, service=None, event=None, initial_state=None): # noqa """Decline proposal procedure hook.""" if not is_status_changed_to(obj.STATES.DECLINED, obj): return obj.declined_by = login.get_current_user() obj.decline_datetime = datetime.datetime.now() add_comment_about(obj, obj.STATES.DECLINED, obj.decline_reason) def make_proposal( sender, obj=None, src=None, service=None, event=None, initial_state=None): # noqa """Make proposal procedure hook.""" obj.proposed_by = login.get_current_user() add_comment_about(obj, obj.STATES.PROPOSED, obj.agenda) def set_permissions(sender, obj=None, src=None, service=None, event=None, initial_state=None): # noqa """Set permissions to proposals based on instance ACL model.""" if sender == all_models.Proposal: proposal_model.set_acl_to(obj) else: proposal_model.set_acl_to_all_proposals_for(obj) # pylint: enable=unused-argument # pylint: enable=too-many-arguments def init_hook(): """Init proposal signal handlers.""" signals.Restful.model_posted.connect(make_proposal, all_models.Proposal, weak=False) signals.Restful.model_put.connect(apply_proposal, all_models.Proposal, weak=False) signals.Restful.model_put.connect(decline_proposal, all_models.Proposal, weak=False) for model in all_models.all_models: signals.Restful.model_posted.connect(set_permissions, model, weak=False) signals.Restful.model_put.connect(set_permissions, model, weak=False)
[ "pod2metra@gmail.com" ]
pod2metra@gmail.com
5bf5303130e83da0c1f29e1a8dcbf3327c733a31
3df0d97012bcef27c4551aa5198ab66abea1bab1
/vk/api/api.py
9ab7d46e46ff0f529fb28b00f5804c17e4735eb8
[]
no_license
OrelSokolov/NLM
0ac7320083bdad9dd4c9f27188bb1704981cb929
310ebdae913c6e725a5ea8bad401aa6f68c65c78
refs/heads/master
2020-05-17T05:37:24.247305
2012-09-07T18:23:47
2012-09-07T18:23:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,869
py
#!/usr/bin/env python # coding: utf-8 import json from urllib import urlencode import urllib import urllib2 import time import subprocess as sps import cfg.main app_path=cfg.main.getAppPath() cfg_path=cfg.main.getCfgPath() apocalypse_time="none" token="none" user_id="none" def loadUserData(): '''Загрузка из файла пользовательских данныx: пароля, логина..''' data=open(cfg_path+"auth.data") email=data.readline()[:-1] password=data.readline()[:-1] data.close() return email, password def auth(auth_type="GUI"): if auth_type=="GUI": print "Запущена графическая авторизация." sps.call(["python", app_path+"vk/api/browser.py"]) init()#Не забываем обновить такие глобальные переменные как тукен, user_id, apocalypse_time, которые используются getToken() и др. elif auth_type=="term": print "Используем консольный вариант авторизации." import term_auth global token, user_id try: try: email, password = loadUserData() except: print "Проблема при загрузке данных из файла." try: token, user_id=term_auth.auth(email, password, "3029477", "docs,groups,video,wall,photos,messages,pages") except: print "Ошибка при вызове функции авторизации." auth=open(cfg_path+"auth.txt", "w") #Делаем запись об авторизации# auth.write(token+"\n") auth.write(user_id+"\n") auth.write(str(time.time()+10000))#86400 - время жизни ключа. Для длительных лучше не использовать точное время во избежание проблем. auth.close() init() print "Успешно авторизировались с консоли." except KeyboardInterrupt: print "Прервано пользователем." except: print "Провал консольной авторизации." raise SystemExit(1) else: print "Передан неизвестный тип авторизации. Аварийный астонов." raise SystemExit(1) def call(method, params): if time.time()>float(apocalypse_time): print "Тукен устарел, меняем на новый." auth(auth_type="term") init() #Мы должны обновить тукен и user_id для функций token() и user_id() if isinstance(params, list): params_list = [kv for kv in params] elif isinstance(params, dict): params_list = params.items() else: params_list = [params] params_list.append(("access_token", token)) url = "https://api.vk.com/method/%s?%s" % (method, urlencode(params_list)) try: return json.loads(urllib2.urlopen(url).read())["response"] except: return json.loads(urllib2.urlopen(url).read()) def getToken(): global token return token def getUserId(): global user_id return user_id def init(): #Initialization try: auth_file=open(cfg_path+"auth.txt") global token, user_id, apocalypse_time # Работаем именно с глобальными переменными token=auth_file.readline()[:-1]#Удаляем '\n' из тукена заодно if token=='none': print "Файл авторизации возможно пуст. Перезапуск..." raise ValueError user_id=auth_file.readline()[:-1] apocalypse_time=auth_file.readline()[:-1] auth_file.close() print "Данные авторизации успешно загружены из файла." except: auth(auth_type="term") #Если отсутсвует файл авторизации init() #При импорте запустится раньше обращения к тукену и user_id, что предотвратит баги.
[ "orelcokolov@gmail.com" ]
orelcokolov@gmail.com
a448c9227d0b822d8e2f908cfc10bd93e53162b2
eacfc1c0b2acd991ec2cc7021664d8e79c9e58f6
/ccpnmr2.4/python/memops/gui/DataEntry.py
e60cff844461888a85150c46163e540f8db69eb0
[]
no_license
edbrooksbank/ccpnmr2.4
cfecb0896dcf8978d796e6327f7e05a3f233a921
f279ca9bb2d972b1ce075dad5fcc16e6f4a9496c
refs/heads/master
2021-06-30T22:29:44.043951
2019-03-20T15:01:09
2019-03-20T15:01:09
176,757,815
0
1
null
2020-07-24T14:40:26
2019-03-20T14:59:23
HTML
UTF-8
Python
false
false
5,930
py
""" ======================COPYRIGHT/LICENSE START========================== DataEntry.py: <write function here> Copyright (C) 2005 Wayne Boucher, Rasmus Fogh, Tim Stevens and Wim Vranken (University of Cambridge and EBI/MSD) ======================================================================= This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. A copy of this license can be found in ../../../license/LGPL.license This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ======================COPYRIGHT/LICENSE END============================ for further information, please contact : - CCPN website (http://www.ccpn.ac.uk/) - PDBe website (http://www.ebi.ac.uk/pdbe/) ======================================================================= If you are using this software for academic purposes, we suggest quoting the following references: ===========================REFERENCE START============================= R. Fogh, J. Ionides, E. Ulrich, W. Boucher, W. Vranken, J.P. Linge, M. Habeck, W. Rieping, T.N. Bhat, J. Westbrook, K. Henrick, G. Gilliland, H. Berman, J. Thornton, M. Nilges, J. Markley and E. Laue (2002). The CCPN project: An interim report on a data model for the NMR community (Progress report). Nature Struct. Biol. 9, 416-418. Wim F. Vranken, Wayne Boucher, Tim J. Stevens, Rasmus H. Fogh, Anne Pajon, Miguel Llinas, Eldon L. Ulrich, John L. Markley, John Ionides and Ernest D. Laue (2005). The CCPN Data Model for NMR Spectroscopy: Development of a Software Pipeline. Proteins 59, 687 - 696. ===========================REFERENCE END=============================== """ import memops.gui.QueryDialogBox as QueryDialogBox from memops.gui.FileSelectPopup import FileSelectPopup def askPassword(title, prompt, parent = None): return QueryDialogBox.askPassword(title, prompt, parent=parent) def askString(title, prompt, initial_value = '', parent = None): return QueryDialogBox.askString(title, prompt,initialvalue=initial_value, parent=parent) def askInteger(title, prompt, initial_value = '', min_value = None, max_value = None, parent = None): return QueryDialogBox.askInteger(title, prompt, initialvalue=initial_value, minvalue=min_value, maxvalue=max_value, parent=parent) def askFloat(title, prompt, initial_value = '', min_value = None, max_value = None, parent = None): return QueryDialogBox.askFloat(title, prompt, initialvalue=initial_value, minvalue=min_value, maxvalue=max_value, parent=parent) def askFile(title, prompt, initial_value = '', parent = None, dismiss_text='Cancel', extra_dismiss_text = ''): if (parent): popup = FileSelectPopup(parent, title=title, prompt=prompt, show_file=True, dismiss_text=dismiss_text, extra_dismiss_text=extra_dismiss_text, file=initial_value) file = popup.getFile() popup.destroy() return file else: return askString(title, prompt, initial_value) def askDir(title, prompt, initial_value = '', parent = None, dismiss_text='Cancel', extra_dismiss_text = '', default_dir = None): if (parent): popup = FileSelectPopup(parent, title=title, prompt=prompt, show_file=False, dismiss_text=dismiss_text, extra_dismiss_text=extra_dismiss_text, file=initial_value, default_dir = default_dir) dir = popup.getDirectory() popup.destroy() return dir else: return askString(title, prompt, initial_value) class DataEntry: def askPassword(self, title, prompt, initial_value = '', parent = None, *args, **kw): return askPassword(title, prompt, initial_value, parent) def askString(self, title, prompt, initial_value = '', parent = None, *args, **kw): return askString(title, prompt, initial_value, parent) def askInteger(self, title, prompt, initial_value = '', min_value = None, max_value = None, parent = None, *args, **kw): return askInteger(title, prompt, initial_value, min_value, max_value, parent) def askFloat(self, title, prompt, initial_value = '', min_value = None, max_value = None, parent = None, *args, **kw): return askFloat(title, prompt, initial_value, min_value, max_value, parent) def askFile(self, title, prompt, initial_value = '', parent = None, dismiss_text='Cancel', extra_dismiss_text = '', *args, **kw): return askFile(title, prompt, initial_value, parent) def askDir(self, title, prompt, initial_value = '', parent = None, dismiss_text='Cancel', extra_dismiss_text = '', default_dir = None, *args, **kw): return askDir(title, prompt, initial_value, parent, default_dir = default_dir) dataEntry = DataEntry() if (__name__ == '__main__'): import Tkinter r = Tkinter.Tk() print dataEntry.askString('ask string title', 'ask string prompt') print dataEntry.askInteger('ask integer title', 'ask integer prompt') print dataEntry.askFloat('ask float title', 'ask float prompt') print dataEntry.askFile('ask file title', 'ask file prompt', parent=r) print dataEntry.askDir('ask dir title', 'ask dir prompt', parent=r)
[ "ejb66@le.ac.uk" ]
ejb66@le.ac.uk
bf78cdc562890741187c733e87401fc2b2586ed3
040c0bf71cc69e90dc37de4a155b1c910b77239b
/cocoamodel/training.py
21dad313084582d9d81aae4d908a72ee6c0ff956
[]
no_license
jurodr/CocoaModelPreTrained
712f2878f1f09778edd82f5a583849830ddb88b8
eeeb26b5d5de81d2ff90e45ca8765329849143f4
refs/heads/master
2021-08-29T20:10:36.760741
2017-12-14T22:13:07
2017-12-14T22:13:07
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,715
py
import tensorflow as tf from tensorflow.python.platform import tf_logging as logging import shutil import cocoamodel.configvalues as cv from cocoamodel import gendataset, configvalues, utils, process from inception.inception_resnet_v2 import inception_resnet_v2, inception_resnet_v2_arg_scope slim = tf.contrib.slim def get_vars_to_train_per_depth(depth): model_name = 'InceptionResnetV2/' # depth = 0 means train all layers. # depth = 1 means train only Logits layers. # depth = 2 means train Logits and Conv2d_7b_1x1. And so on. names = [ 'Logits', 'Conv2d_7b_1x1', 'Block8', 'Repeat_2', 'Mixed_7a', 'Repeat_1', 'Mixed_6a', 'Repeat', 'Mixed_5b', 'Conv2d_4a_3x3', 'Conv2d_3b_1x1', 'Conv2d_2b_3x3', 'Conv2d_2a_3x3', 'Conv2d_1a_3x3'] selected = names[0:depth] vars_to_train = [] for i in tf.trainable_variables(): for layer in selected: if i.name.startswith(model_name + layer): vars_to_train.append(i) return vars_to_train def trainmode(): dir_name = utils.gen_dir_name(cv.TRAIN_DIR) # Saves the configvalues.py file so we can keep track of all the # configuration values that were used. # TODO properly export all these configurations. shutil.copy('./cocoamodel/configvalues.py', dir_name) with tf.Graph().as_default() as graph: # This can be done in the cpu to save the gpu some memory. # Saves about 0,01 second per normal step in a gtx850M2GB with tf.device('/cpu:0'): images, labels = gendataset.get_batch_input() process.calc_steps_details(gendataset.count_samples(cv.TRAIN)) with slim.arg_scope(inception_resnet_v2_arg_scope()): logits, end_points = inception_resnet_v2(images, num_classes=cv.CLASSES, is_training=True, dropout_keep_prob=cv.KEEP_PROB) # We are not training the original ImageNet which the checkpoint was # trained to, so we should exclude the Logits scopes, since the number # of classes are obviously different. vars_restore = slim.get_variables_to_restore( exclude=['InceptionResnetV2/Logits', 'InceptionResnetV2/AuxLogits']) loss = tf.losses.softmax_cross_entropy( onehot_labels=slim.one_hot_encoding(labels, cv.CLASSES), logits=logits) total_loss = tf.losses.get_total_loss() global_step = tf.train.get_or_create_global_step() learn_rate = tf.train.exponential_decay( learning_rate=cv.INITIAL_LEARN_RATE, global_step=global_step, decay_steps=cv.DECAY_STEPS, decay_rate=cv.LEARN_DECAY_FACTOR, staircase=True) optimizer = tf.train.AdamOptimizer(learning_rate=learn_rate) # train all layers. if cv.TRAIN_DEPTH == 0: train_op = slim.learning.create_train_op(total_loss, optimizer) else: # Since we do not want to touch the lower layers' weights of this # inception model, here we select which variables to train. vars_to_train = get_vars_to_train_per_depth(cv.TRAIN_DEPTH) train_op = slim.learning.create_train_op( total_loss, optimizer, variables_to_train=vars_to_train) # Set up the metrics. tf.summary.scalar('losses/Total_Loss', total_loss) tf.summary.scalar('learning_rate', learn_rate) metrics_obj = process.Metrics(end_points['Predictions'], labels) saver = tf.train.Saver(vars_restore) def restore_fn(sess): return saver.restore(sess, cv.CHECKPOINT_FILE) supervisor = tf.train.Supervisor(logdir=dir_name, summary_op=None, init_fn=restore_fn) with supervisor.managed_session() as sess: # We do the last step out of this for loop. metrics_op, summary_op = metrics_obj.prepare_run() for step in range(cv.TOTAL_STEPS - 1): total_loss, global_step_count, _ = sess.run([train_op, global_step, metrics_op]) if step % cv.LOG_FREQ == 0: summaries = sess.run(summary_op) supervisor.summary_computed(sess, summaries) metrics_obj.log_step_loss(total_loss, global_step_count) if step % cv.BATCHES_PER_EPOCH == 0: logging.info( 'Epoch : %d', int( step / cv.BATCHES_PER_EPOCH)) metrics_obj.log_metrics(sess) supervisor.saver.save(sess, supervisor.save_path, global_step=supervisor.global_step) total_loss, global_step_count, _ = sess.run([train_op, global_step, metrics_op]) metrics_obj.log_step_loss(total_loss, global_step_count) metrics_obj.log_metrics(sess) supervisor.saver.save(sess, supervisor.save_path, global_step=supervisor.global_step)
[ "jroddeveloper@gmail.com" ]
jroddeveloper@gmail.com
6c02a222ab4aab87222e497fc1f62286d1941584
f808052dc11b7ec3b9c25b9df32ad901cdf39f3e
/misc/split_data_online.py
f2b6c221a4cb2a5e20f9109b631a8cc29356488f
[]
no_license
hatalis/DSM
96181ba7ffc8cb7d41a264113f4359411c68273f
126cc5ddadb23a7476de80bf2e8e066cf7708b4c
refs/heads/master
2021-10-12T03:02:26.680795
2019-02-01T02:21:14
2019-02-01T02:21:14
146,820,869
0
1
null
null
null
null
UTF-8
Python
false
false
581
py
def split_data_online(experiment): L_total = experiment['L_total'] N_train = experiment['N_train'] N_test = experiment['N_test'] L_total = L_total[3:] N_train = N_train -3 experiment['L_total'] = L_total experiment['N_train'] = N_train L_test_actual = L_total[N_train:] L_test_actual = L_test_actual.reshape((N_test, 1)) L_train_actual = L_total[:N_train] L_train_actual = L_train_actual.reshape((N_train, 1)) experiment['L_train_actual'] = L_train_actual experiment['L_test_actual'] = L_test_actual return experiment
[ "hatalis@gmail.com" ]
hatalis@gmail.com
21c8738e9a893aef2a171a99dc494b14dfff1afa
f9072dd9008ccdc97b887621a1b00c210f3fed82
/django_projects/mysite/ads/views.py
86efc0b9aea8a57e2f132451aafb34347deb12ba
[ "MIT" ]
permissive
zhephirothz/djangoCoursesLearning
9795359ef0e79fa12a2edcd0b41d1d99d02502cd
e4eadede3c1d78a79dd63018fbd96c350bf39f8b
refs/heads/master
2023-07-10T03:41:44.292816
2021-08-15T12:44:10
2021-08-15T12:44:10
396,346,742
0
0
null
null
null
null
UTF-8
Python
false
false
6,163
py
from django.views import View from django.shortcuts import render, redirect, get_object_or_404 from django.urls import reverse_lazy from django.http import HttpResponse from django.contrib.auth.mixins import LoginRequiredMixin from ads.models import Ad, Comment, Fav from ads.owner import OwnerListView, OwnerDetailView, OwnerCreateView, OwnerUpdateView, OwnerDeleteView from ads.forms import CreateForm, CommentForm from django.urls import reverse from django.contrib.humanize.templatetags.humanize import naturaltime from django.db.models import Q class AdListView(OwnerListView): # model = Ad # By convention: # template_name = "ads/article_list.html" template_name = "ads/ad_list.html" def get(self, request) : # ad_list = Ad.objects.all() favorites = list() strval = request.GET.get("search", False) if strval : # Simple title-only search # objects = Ad.objects.filter(title__contains=strval).select_related().order_by('-updated_at')[:10] # Multi-field search # __icontains for case-insensitive search query = Q(title__icontains=strval) query.add(Q(text__icontains=strval), Q.OR) query.add(Q(tags__name__in=[strval]), Q.OR) ad_list = Ad.objects.filter(query).select_related().distinct().order_by('-updated_at')[:10] else : ad_list = Ad.objects.all().order_by('-updated_at')[:10] # Augment the post_list for obj in ad_list: obj.natural_updated = naturaltime(obj.updated_at) if request.user.is_authenticated: # rows = [{'id': 2}, {'id': 4} ... ] (A list of rows) rows = request.user.favorite_ads.values('id') # favorites = [2, 4, ...] using list comprehension favorites = [ row['id'] for row in rows ] ctx = {'ad_list' : ad_list, 'favorites': favorites, 'search': strval} return render(request, self.template_name, ctx) class AdDetailView(OwnerDetailView): model = Ad template_name = "ads/ad_detail.html" def get(self, request, pk) : x = Ad.objects.get(id=pk) comments = Comment.objects.filter(ad=x).order_by('-updated_at') comment_form = CommentForm() context = { 'ad' : x, 'comments': comments, 'comment_form': comment_form } return render(request, self.template_name, context) class AdCreateView(LoginRequiredMixin, View): template_name = 'ads/ad_form.html' success_url = reverse_lazy('ads:all') fields = ['title', 'text', 'price', 'tags'] def get(self, request, pk=None): form = CreateForm() ctx = {'form': form} return render(request, self.template_name, ctx) def post(self, request, pk=None): form = CreateForm(request.POST, request.FILES or None) if not form.is_valid(): ctx = {'form': form} return render(request, self.template_name, ctx) # Add owner to the model before saving pic = form.save(commit=False) pic.owner = self.request.user pic.save() # https://django-taggit.readthedocs.io/en/latest/forms.html#commit-false form.save_m2m() # Add this return redirect(self.success_url) # model = Ad # fields = ['title', 'text', 'price'] class AdUpdateView(LoginRequiredMixin, View): template_name = 'ads/ad_form.html' success_url = reverse_lazy('ads:all') fields = ['title', 'text', 'price', 'tags'] def get(self, request, pk): ad = get_object_or_404(Ad, id=pk, owner=self.request.user) form = CreateForm(instance=ad) ctx = {'form': form} return render(request, self.template_name, ctx) def post(self, request, pk=None): ad = get_object_or_404(Ad, id=pk, owner=self.request.user) form = CreateForm(request.POST, request.FILES or None, instance=ad) if not form.is_valid(): ctx = {'form': form} return render(request, self.template_name, ctx) pic = form.save(commit=False) pic.save() # https://django-taggit.readthedocs.io/en/latest/forms.html#commit-false form.save_m2m() # Add this return redirect(self.success_url) # model = Ad # fields = ['title', 'text', 'price'] class AdDeleteView(OwnerDeleteView): model = Ad class CommentCreateView(LoginRequiredMixin, View): def post(self, request, pk) : f = get_object_or_404(Ad, id=pk) comment = Comment(text=request.POST['comment'], owner=request.user, ad=f) comment.save() return redirect(reverse('ads:ad_detail', args=[pk])) class CommentDeleteView(OwnerDeleteView): model = Comment template_name = "ads/comment_delete.html" # https://stackoverflow.com/questions/26290415/deleteview-with-a-dynamic-success-url-dependent-on-id def get_success_url(self): ad = self.object.ad return reverse('ads:ad_detail', args=[ad.id]) def stream_file(request, pk): ad = get_object_or_404(Ad, id=pk) response = HttpResponse() response['Content-Type'] = ad.content_type response['Content-Length'] = len(ad.picture) response.write(ad.picture) return response from django.views.decorators.csrf import csrf_exempt from django.utils.decorators import method_decorator from django.db.utils import IntegrityError @method_decorator(csrf_exempt, name='dispatch') class AddFavoriteView(LoginRequiredMixin, View): def post(self, request, pk) : print("Add PK",pk) t = get_object_or_404(Ad, id=pk) fav = Fav(user=request.user, ad=t) try: fav.save() # In case of duplicate key except IntegrityError as e: pass return HttpResponse() @method_decorator(csrf_exempt, name='dispatch') class DeleteFavoriteView(LoginRequiredMixin, View): def post(self, request, pk) : print("Delete PK",pk) t = get_object_or_404(Ad, id=pk) try: fav = Fav.objects.get(user=request.user, ad=t).delete() except Fav.DoesNotExist as e: pass return HttpResponse()
[ "zhephirothz@github.com" ]
zhephirothz@github.com
3fde9b355dbfa3a54a9aa52d7be9cb574bc0ad08
8ac8c254db733ac5c021582daeb49931f8ab1d92
/src/glomerulus/search/pws_clone/__init__.py
7e0bed2c769525c1989a012cb60860426e4325a3
[]
no_license
kaglowka/glomerulus
c5d0490427f724a733b001b200fb31cfab57f117
6f18f9961b2c17725555c5b53d9408228169be00
refs/heads/master
2022-12-10T01:40:12.374036
2018-01-22T22:14:37
2018-01-22T22:14:37
117,331,213
0
0
null
2022-12-07T23:45:30
2018-01-13T09:30:57
Jupyter Notebook
UTF-8
Python
false
false
50
py
from .google import Google from .bing import Bing
[ "krz.glowka@gmail.com" ]
krz.glowka@gmail.com
357b04a32529cb3968717f612e76cdf65e033720
afb58e8c75ad1016bcc4a622a1b29aa0d44634aa
/util/test1.py
5d29fe2c33fbcf6fc2405367bb994eb8bedef087
[]
no_license
YCBDM/Interface_Auto_test
421b3ad2e124584512bfd71e8bead2ca8ae28dea
eaeb996b969afcdd79e4b02bb6660ddf6a4e56af
refs/heads/master
2020-03-18T11:36:46.167748
2018-05-28T06:38:52
2018-05-28T06:38:52
134,681,660
0
0
null
null
null
null
UTF-8
Python
false
false
20
py
print('wertuyruiyi')
[ "835135815@qq.com" ]
835135815@qq.com
0d1cf71a2a83f1a18e5814e790288185493fcdfe
2e8784dfccaac68d4517bc3e03e027abec9db6b3
/outputToSheets.py
cafdfaf0a9207290082079f3acab76e83f44d386
[]
no_license
dmanoo526/Xbox_Friend_Finder
3203e729e278c67bcaab6a2f6ba1601da556ed94
d76e40e8e1090be6363e4fb8c7443901009ecc90
refs/heads/master
2022-12-22T01:12:24.739418
2020-09-22T23:41:39
2020-09-22T23:41:39
202,809,542
0
0
null
null
null
null
UTF-8
Python
false
false
1,749
py
""" This file is comprised of a function which takes a final master dictionary from gamertags.py and writes the data to the Friends_Of_Gamertags sheet. @Input: takes a dictionary and writes the new user values to google sheets api @Return Type: None """ #must run "pip install gspread oauth2client" in cmd local project file to allow interaction with sheets api import gspread from oauth2client.service_account import ServiceAccountCredentials scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"] creds = ServiceAccountCredentials.from_json_keyfile_name("creds.json", scope) client = gspread.authorize(creds) project = client.open("Cocal_Xbox_Users_Dhanvin_Project") #open the google sheets file with specified title(copy of original) sheet = project.worksheet("Friends_Of_Gamertags_in_Xbox_API_DATA_Dhanvin") #open specific sheet in google sheets file def print_to_sheets(dict, counter): sheets_index = 2 #keep track of current index in google sheets try: for user in dict.values(): row = [user.gamertag, user.id, user.hostid, user.popularity] sheet.insert_row(row, sheets_index) sheets_index+=1 sheet.cell(1,5).value = "Total number of successful xbox api calls: {}".format(counter) #print number of api calls to google sheets except: print("Sheets api limit reached") rows_added = sheets_index - 2 #started at index 2 find how many total rows added print("Google sheets successfully updated with {} rows added and {} original users had their friends looked up in the api before the limit was exceeded".format(rows_added,counter))
[ "dmanoo526@gmail.com" ]
dmanoo526@gmail.com
a605dfcfc2f4d00faa17e9fbac69fb61a709b560
b35469b3a3ef3ecb8da35a178ba0994bae2989b3
/kubevirt/models/v1_pci_host_device.py
65d45e6884a716731c600aef51e52b927476c143
[ "Apache-2.0" ]
permissive
CHsixnine/client-python
4802d76bbe3761a1311038665d931349298bcd81
315335602923dacbc3b73b23339002d69a5a41cc
refs/heads/master
2023-03-20T22:45:25.578704
2021-03-17T07:34:18
2021-03-17T07:34:18
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,120
py
# coding: utf-8 """ KubeVirt API This is KubeVirt API an add-on for Kubernetes. OpenAPI spec version: 1.0.0 Contact: kubevirt-dev@googlegroups.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re class V1PciHostDevice(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'external_resource_provider': 'bool', 'pci_vendor_selector': 'str', 'resource_name': 'str' } attribute_map = { 'external_resource_provider': 'externalResourceProvider', 'pci_vendor_selector': 'pciVendorSelector', 'resource_name': 'resourceName' } def __init__(self, external_resource_provider=None, pci_vendor_selector=None, resource_name=None): """ V1PciHostDevice - a model defined in Swagger """ self._external_resource_provider = None self._pci_vendor_selector = None self._resource_name = None if external_resource_provider is not None: self.external_resource_provider = external_resource_provider self.pci_vendor_selector = pci_vendor_selector self.resource_name = resource_name @property def external_resource_provider(self): """ Gets the external_resource_provider of this V1PciHostDevice. :return: The external_resource_provider of this V1PciHostDevice. :rtype: bool """ return self._external_resource_provider @external_resource_provider.setter def external_resource_provider(self, external_resource_provider): """ Sets the external_resource_provider of this V1PciHostDevice. :param external_resource_provider: The external_resource_provider of this V1PciHostDevice. :type: bool """ self._external_resource_provider = external_resource_provider @property def pci_vendor_selector(self): """ Gets the pci_vendor_selector of this V1PciHostDevice. :return: The pci_vendor_selector of this V1PciHostDevice. :rtype: str """ return self._pci_vendor_selector @pci_vendor_selector.setter def pci_vendor_selector(self, pci_vendor_selector): """ Sets the pci_vendor_selector of this V1PciHostDevice. :param pci_vendor_selector: The pci_vendor_selector of this V1PciHostDevice. :type: str """ if pci_vendor_selector is None: raise ValueError("Invalid value for `pci_vendor_selector`, must not be `None`") self._pci_vendor_selector = pci_vendor_selector @property def resource_name(self): """ Gets the resource_name of this V1PciHostDevice. :return: The resource_name of this V1PciHostDevice. :rtype: str """ return self._resource_name @resource_name.setter def resource_name(self, resource_name): """ Sets the resource_name of this V1PciHostDevice. :param resource_name: The resource_name of this V1PciHostDevice. :type: str """ if resource_name is None: raise ValueError("Invalid value for `resource_name`, must not be `None`") self._resource_name = resource_name def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ if not isinstance(other, V1PciHostDevice): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
[ "travis@travis-ci.org" ]
travis@travis-ci.org
374fb7f9548ddb214ed23c9f91baa6f51c6ecd9a
eb722922339781fa6bd9937e69383fcd06256738
/day1/kapua-python-client/swagger_client/models/user_query.py
f40b1b68ccf746a9a9f1ae2d1ffd2154a5689df1
[ "MIT" ]
permissive
mrsrinivas/diec
6a0c5da26ff23170b71217bfbc810bb98a897a83
ae9a5203b506d5cc18cb381666351bf9ce6b9b6c
refs/heads/master
2021-01-05T05:41:19.394898
2020-01-15T06:24:33
2020-01-15T06:24:33
240,901,175
1
0
MIT
2020-02-16T13:59:53
2020-02-16T13:59:52
null
UTF-8
Python
false
false
6,757
py
# coding: utf-8 """ Eclipse Kapua REST API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: 1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six from swagger_client.models.kapua_sort_criteria import KapuaSortCriteria # noqa: F401,E501 from swagger_client.models.query_predicate import QueryPredicate # noqa: F401,E501 class UserQuery(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'limit': 'int', 'scope_id': 'str', 'fetch_attributes': 'list[str]', 'predicate': 'QueryPredicate', 'sort_criteria': 'KapuaSortCriteria', 'offset': 'int' } attribute_map = { 'limit': 'limit', 'scope_id': 'scopeId', 'fetch_attributes': 'fetchAttributes', 'predicate': 'predicate', 'sort_criteria': 'sortCriteria', 'offset': 'offset' } def __init__(self, limit=None, scope_id=None, fetch_attributes=None, predicate=None, sort_criteria=None, offset=None): # noqa: E501 """UserQuery - a model defined in Swagger""" # noqa: E501 self._limit = None self._scope_id = None self._fetch_attributes = None self._predicate = None self._sort_criteria = None self._offset = None self.discriminator = None if limit is not None: self.limit = limit if scope_id is not None: self.scope_id = scope_id if fetch_attributes is not None: self.fetch_attributes = fetch_attributes if predicate is not None: self.predicate = predicate if sort_criteria is not None: self.sort_criteria = sort_criteria if offset is not None: self.offset = offset @property def limit(self): """Gets the limit of this UserQuery. # noqa: E501 :return: The limit of this UserQuery. # noqa: E501 :rtype: int """ return self._limit @limit.setter def limit(self, limit): """Sets the limit of this UserQuery. :param limit: The limit of this UserQuery. # noqa: E501 :type: int """ self._limit = limit @property def scope_id(self): """Gets the scope_id of this UserQuery. # noqa: E501 :return: The scope_id of this UserQuery. # noqa: E501 :rtype: str """ return self._scope_id @scope_id.setter def scope_id(self, scope_id): """Sets the scope_id of this UserQuery. :param scope_id: The scope_id of this UserQuery. # noqa: E501 :type: str """ self._scope_id = scope_id @property def fetch_attributes(self): """Gets the fetch_attributes of this UserQuery. # noqa: E501 :return: The fetch_attributes of this UserQuery. # noqa: E501 :rtype: list[str] """ return self._fetch_attributes @fetch_attributes.setter def fetch_attributes(self, fetch_attributes): """Sets the fetch_attributes of this UserQuery. :param fetch_attributes: The fetch_attributes of this UserQuery. # noqa: E501 :type: list[str] """ self._fetch_attributes = fetch_attributes @property def predicate(self): """Gets the predicate of this UserQuery. # noqa: E501 :return: The predicate of this UserQuery. # noqa: E501 :rtype: QueryPredicate """ return self._predicate @predicate.setter def predicate(self, predicate): """Sets the predicate of this UserQuery. :param predicate: The predicate of this UserQuery. # noqa: E501 :type: QueryPredicate """ self._predicate = predicate @property def sort_criteria(self): """Gets the sort_criteria of this UserQuery. # noqa: E501 :return: The sort_criteria of this UserQuery. # noqa: E501 :rtype: KapuaSortCriteria """ return self._sort_criteria @sort_criteria.setter def sort_criteria(self, sort_criteria): """Sets the sort_criteria of this UserQuery. :param sort_criteria: The sort_criteria of this UserQuery. # noqa: E501 :type: KapuaSortCriteria """ self._sort_criteria = sort_criteria @property def offset(self): """Gets the offset of this UserQuery. # noqa: E501 :return: The offset of this UserQuery. # noqa: E501 :rtype: int """ return self._offset @offset.setter def offset(self, offset): """Sets the offset of this UserQuery. :param offset: The offset of this UserQuery. # noqa: E501 :type: int """ self._offset = offset def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value if issubclass(UserQuery, dict): for key, value in self.items(): result[key] = value return result def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict()) def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, UserQuery): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """Returns true if both objects are not equal""" return not self == other
[ "noreply@github.com" ]
noreply@github.com
ea0a190ba1baf3bc8e415a04dcfccb386a3f0c03
cb414725a5d02aec84155237c3b3cc904ba87294
/leetcode/266. Palindrome Permutation/solution_2pass.py
3f8c4c5bb5b3598001aa6b8d82866dd26d039c35
[ "MIT" ]
permissive
vishalvb/Algorithms
7f8741d02deda55303aba2d27a8331bb1ab586b9
7085265071fd898f536f0f3d7ec9f9b15b8f93a1
refs/heads/master
2021-06-23T06:19:04.847353
2019-07-10T23:15:11
2019-07-10T23:15:11
147,115,321
0
0
null
null
null
null
UTF-8
Python
false
false
587
py
Complexity Time: O(N): we are traversing the string twice. in the first pass we create dictionary with frequency of each char and in second we check how many frequency are 1. O(2N) = O(N) Space: O(1), at max we are only storing 128 chars in the worst case for any string from collections import Counter def permuation_palindrome(string): map = Counter(string) count = 0 for s in string: if map[s] % 2 == 1: count = count + 1 return count <=1 test = ['code','aab','carerac'] for string in test: print(permuation_palindrome(string))
[ "vishal4790@gmail.com" ]
vishal4790@gmail.com
641faad44bd84d51eddb03b1bbea7ec613fb0874
cc49b6d6f496280d7acc11e33177008be24a98ae
/agent_a3c_ss.py
3780b768d803798bdee504da9ec2ff669f6403aa
[ "MIT" ]
permissive
yculcarnee/rl_3d
38789dee849b059cc31323d4767df6ea23720159
9e2816c7a7a466f843c583f312349531e3d0c4b0
refs/heads/master
2020-04-27T11:12:56.247186
2019-04-29T06:55:12
2019-04-29T06:55:12
174,287,704
0
1
MIT
2019-03-07T06:45:31
2019-03-07T06:45:30
null
UTF-8
Python
false
false
16,898
py
#!/usr/bin/env python from __future__ import print_function import numpy as np import cv2 import tensorflow as tf import threading import sys import time import os def MakeDir(path): try: os.makedirs(path) except: pass lab = False load_model = False train = True test_display = False test_write_video = True path_work_dir = "rl_3d/" vizdoom_path = "ViZDoom/" vizdoom_scenario = vizdoom_path + "scenarios/sabsesasta.wad" if (lab): from env_lab import EnvLab model_path = path_work_dir + "model_lab_a3c/" else: from env_vizdoom_mvmt import EnvVizDoom model_path = path_work_dir + "model_vizdoom_a3c/" learning_rate = 0.00025 device = "/cpu:0" num_workers = 8 t_max = 30 frame_repeat = 4 #10 # 4 gamma = 0.99 step_num = int(5e5) save_each = 0.01 * step_num step_load = 100 entropy_beta = 0.01 grad_norm_clip = 40.0 global_scope_name = "global" step = 0 train_scores = [] lock = threading.Lock() start_time = 0 # Global. env = None MakeDir(model_path) model_name = model_path + "a3c" def PrintStat(elapsed_time, step, step_num, train_scores): steps_per_s = 1.0 * step / elapsed_time steps_per_m = 60.0 * step / elapsed_time steps_per_h = 3600.0 * step / elapsed_time steps_remain = step_num - step remain_h = int(steps_remain / steps_per_h) remain_m = int((steps_remain - remain_h * steps_per_h) / steps_per_m) remain_s = int((steps_remain - remain_h * steps_per_h - remain_m * steps_per_m) / steps_per_s) elapsed_h = int(elapsed_time / 3600) elapsed_m = int((elapsed_time - elapsed_h * 3600) / 60) elapsed_s = int((elapsed_time - elapsed_h * 3600 - elapsed_m * 60)) print("{}% | Steps: {}/{}, {:.2f}M step/h, {:02}:{:02}:{:02}/{:02}:{:02}:{:02}".format( 100.0 * step / step_num, step, step_num, steps_per_h / 1e6, elapsed_h, elapsed_m, elapsed_s, remain_h, remain_m, remain_s), file=sys.stderr) mean_train = 0 std_train = 0 min_train = 0 max_train = 0 if (len(train_scores) > 0): train_scores = np.array(train_scores) mean_train = train_scores.mean() std_train = train_scores.std() min_train = train_scores.min() max_train = train_scores.max() print("Episodes: {} Rewards: mean: {:.2f}, std: {:.2f}, min: {:.2f}, max: {:.2f}".format( len(train_scores), mean_train, std_train, min_train, max_train), file=sys.stderr) channels = 3 resolution = (40, 40, channels) def Preprocess(frame): if (channels == 1): frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) frame = cv2.resize(frame, (resolution[1], resolution[0])) return np.reshape(frame, resolution) class ACNet(object): def __init__(self, num_actions, scope, trainer): with tf.variable_scope(scope): self.inputs = tf.placeholder(shape=[None] + list(resolution), dtype=tf.float32) conv1 = tf.contrib.layers.conv2d(self.inputs, num_outputs=16, kernel_size=[3, 3], stride=[2, 2]) conv2 = tf.contrib.layers.conv2d(conv1, num_outputs=32, kernel_size=[3, 3], stride=[2, 2]) conv2_flat = tf.contrib.layers.flatten(conv2) hidden = tf.contrib.layers.fully_connected(conv2_flat, 256) # Recurrent network for temporal dependencies # Introduce a "fake" batch dimension of 1 after flatten so that we can do LSTM over time dim rnn_in = tf.expand_dims(hidden, [0]) lstm_size = 256 lstm_cell = tf.contrib.rnn.BasicLSTMCell(lstm_size, state_is_tuple=True) step_size = tf.shape(self.inputs)[:1] c_init = np.zeros((1, lstm_cell.state_size.c), dtype=np.float32) h_init = np.zeros((1, lstm_cell.state_size.h), dtype=np.float32) self.state_init = [c_init, h_init] self.rnn_state = self.state_init c_in = tf.placeholder(shape=[1, lstm_cell.state_size.c], dtype=tf.float32) h_in = tf.placeholder(shape=[1, lstm_cell.state_size.h], dtype=tf.float32) self.state_in = (c_in, h_in) state_in = tf.contrib.rnn.LSTMStateTuple(c_in, h_in) lstm_outputs, lstm_state = tf.nn.dynamic_rnn(lstm_cell, rnn_in, initial_state=state_in, sequence_length=step_size, time_major=False) lstm_c, lstm_h = lstm_state rnn_out = tf.reshape(lstm_outputs, [-1, lstm_size]) self.state_out = (lstm_c[:1, :], lstm_h[:1, :]) # Output layers for policy and value estimations self.policy = tf.contrib.layers.fully_connected(rnn_out, num_actions, activation_fn=tf.nn.softmax, weights_initializer=self.normalized_columns_initializer(0.01), biases_initializer=None) self.value = tf.contrib.layers.fully_connected(rnn_out, 1, activation_fn=None, weights_initializer=self.normalized_columns_initializer(1.0), biases_initializer=None) # Only the worker network need ops for loss functions and gradient updating. if (scope != global_scope_name): self.actions = tf.placeholder(shape=[None], dtype=tf.int32) actions_onehot = tf.one_hot(self.actions, num_actions, dtype=tf.float32) self.target_v = tf.placeholder(shape=[None], dtype=tf.float32) self.advantages = tf.placeholder(shape=[None], dtype=tf.float32) responsible_outputs = tf.reduce_sum(self.policy * actions_onehot, [1]) # Loss functions value_loss = 0.5 * tf.reduce_sum(tf.square(self.target_v - tf.reshape(self.value, [-1]))) entropy = -tf.reduce_sum(self.policy * tf.log(self.policy)) policy_loss = -tf.reduce_sum(tf.log(responsible_outputs) * self.advantages) self.loss = 0.5 * value_loss + policy_loss - entropy * entropy_beta # Get gradients from local network using local losses local_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope) self.gradients = tf.gradients(self.loss, local_vars) if (grad_norm_clip != None): grads, _ = tf.clip_by_global_norm(self.gradients, grad_norm_clip) else: grads = self.gradients # Apply local gradients to global network global_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, global_scope_name) self.apply_grads = trainer.apply_gradients(zip(grads, global_vars)) # Used to initialize weights for policy and value output layers def normalized_columns_initializer(self, std = 1.0): def _initializer(shape, dtype=None, partition_info=None): out = np.random.randn(*shape).astype(np.float32) out *= std / np.sqrt(np.square(out).sum(axis=0, keepdims=True)) return tf.constant(out) return _initializer def Train(self, sess, discounted_rewards, states, actions, advantages): states = states / 255.0 self.ResetLstm() feed_dict = {self.target_v : discounted_rewards, self.inputs : np.stack(states, axis=0), self.actions : actions, self.advantages : advantages, self.state_in[0] : self.rnn_state[0], self.state_in[1] : self.rnn_state[1]} _ = sess.run([self.apply_grads], feed_dict=feed_dict) def ResetLstm(self): self.rnn_state = self.state_init def GetAction(self, sess, state): state = state / 255.0 a_dist, v, self.rnn_state = sess.run([self.policy, self.value, self.state_out], feed_dict={self.inputs: [state], self.state_in[0]: self.rnn_state[0], self.state_in[1]: self.rnn_state[1]}) a = np.random.choice(a_dist[0], p=a_dist[0]) a = np.argmax(a_dist == a) return a, v[0, 0] def GetValue(self, sess, state): state = state / 255.0 v = sess.run([self.value], feed_dict={self.inputs: [state], self.state_in[0]: self.rnn_state[0], self.state_in[1]: self.rnn_state[1]}) return v[0][0, 0] class Worker(object): def __init__(self, number, num_actions, trainer, model_name): self.name = "worker_" + str(number) self.number = number self.model_name = model_name # Create the local copy of the network and the tensorflow op to copy global paramters to local network self.local_ac = ACNet(num_actions, self.name, trainer) self.update_target_graph = self.update_target(global_scope_name, self.name) if (lab): self.env = EnvLab(80, 80, 60, "seekavoid_arena_01") else: self.env = EnvVizDoom(vizdoom_scenario) # Copies one set of variables to another. # Used to set worker network parameters to those of global network. def update_target(self, from_scope, to_scope): from_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, from_scope) to_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, to_scope) op_holder = [] for from_var, to_var in zip(from_vars, to_vars): op_holder.append(to_var.assign(from_var)) return op_holder # Calculate discounted returns. def Discount(self, x, gamma): for idx in reversed(range(len(x) - 1)): x[idx] += x[idx + 1] * gamma return x def Start(self, session, saver, coord): worker_process = lambda: self.Process(session, saver, coord) thread = threading.Thread(target=worker_process) thread.start() global start_time start_time = time.time() return thread def Train(self, episode_buffer, sess, bootstrap_value): episode_buffer = np.array(episode_buffer) states = episode_buffer[:, 0] actions = episode_buffer[:, 1] rewards = episode_buffer[:, 2] values = episode_buffer[:, 3] # Here we take the rewards and values from the episode_buffer, and use them to # generate the advantage and discounted returns. # The advantage function uses "Generalized Advantage Estimation" rewards_plus = np.asarray(rewards.tolist() + [bootstrap_value]) discounted_rewards = self.Discount(rewards_plus, gamma)[:-1] value_plus = np.asarray(values.tolist() + [bootstrap_value]) advantages = rewards + gamma * value_plus[1:] - value_plus[:-1] advantages = self.Discount(advantages, gamma) # Update the global network using gradients from loss # Generate network statistics to periodically save self.local_ac.Train(sess, discounted_rewards, states, actions, advantages) def Process(self, sess, saver, coord): global step, train_scores, start_time, lock print("Starting worker " + str(self.number)) while (not coord.should_stop()): sess.run(self.update_target_graph) episode_buffer = [] episode_reward = 0 self.env.Reset() s = self.env.Observation() s = Preprocess(s) self.local_ac.ResetLstm() while (self.env.IsRunning()): # Take an action using probabilities from policy network output. a, v = self.local_ac.GetAction(sess, s) r = self.env.Act(a, frame_repeat) finished = not self.env.IsRunning() if (not finished): s1 = self.env.Observation() s1 = Preprocess(s1) else: s1 = None episode_buffer.append([s, a, r, v]) episode_reward += r s = s1 lock.acquire() step += 1 if (step % save_each == 0): model_name_curr = self.model_name + "_{:04}".format(int(step / save_each)) print("\nSaving the network weigths to:", model_name_curr, file=sys.stderr) saver.save(sess, model_name_curr) PrintStat(time.time() - start_time, step, step_num, train_scores) train_scores = [] if (step == step_num): coord.request_stop() lock.release() # If the episode hasn't ended, but the experience buffer is full, then we # make an update step using that experience rollout. if (len(episode_buffer) == t_max or (finished and len(episode_buffer) > 0)): # Since we don't know what the true final return is, # we "bootstrap" from our current value estimation. if (not finished): v1 = self.local_ac.GetValue(sess, s) self.Train(episode_buffer, sess, v1) episode_buffer = [] sess.run(self.update_target_graph) else: self.Train(episode_buffer, sess, 0.0) lock.acquire() train_scores.append(episode_reward) lock.release() class Agent(object): def __init__(self): config = tf.ConfigProto() config.gpu_options.allow_growth = True config.log_device_placement = False config.allow_soft_placement = True self.session = tf.Session(config=config) with tf.device(device): # Global network self.global_net = ACNet(env.NumActions(), global_scope_name, None) if (train): trainer = tf.train.RMSPropOptimizer(learning_rate) workers = [] for i in range(num_workers): workers.append(Worker(i, env.NumActions(), trainer, model_name)) saver = tf.train.Saver(max_to_keep=100) if (load_model): model_name_curr = model_name + "_{:04}".format(step_load) print("Loading model from: ", model_name_curr) saver.restore(self.session, model_name_curr) else: self.session.run(tf.global_variables_initializer()) if (train): coord = tf.train.Coordinator() # Start the "work" process for each worker in a separate thread. worker_threads = [] for worker in workers: thread = worker.Start(self.session, saver, coord) worker_threads.append(thread) coord.join(worker_threads) def Reset(self): self.global_net.ResetLstm() def Act(self, state): action, _ = self.global_net.GetAction(self.session, state) return action def Test(agent): if (test_write_video): size = (640, 480) fps = 30.0 fourcc = cv2.VideoWriter_fourcc(*'XVID') # cv2.cv.CV_FOURCC(*'XVID') out_video = cv2.VideoWriter("drive/a3c_ss1.avi", fourcc, fps, size) posX = [] posY = [] posX.append('%') posY.append('%') ep_counter = 1 reward_list = [] ep_list = [] reward_total = 0 num_episodes = 30 while (num_episodes != 0): if (not env.IsRunning()): env.Reset() agent.Reset() posX.append('%') posY.append('%') print("Total reward: {}".format(reward_total)) reward_list.append(reward_total) ep_list.append(ep_counter) ep_counter+=1 reward_total = 0 num_episodes -= 1 state_raw = env.Observation() state = Preprocess(state_raw) action = agent.Act(state) for _ in range(frame_repeat): if (test_display): cv2.imshow("frame-test", state_raw) cv2.waitKey(20) if (test_write_video): out_video.write(state_raw) reward = env.Act(action, 1) reward_total += reward if (not env.IsRunning()): break state_raw = env.Observation() posX.append(env.positionX()) posY.append(env.positionY()) print(reward_list) print(ep_list) print(posX) print(posY) if __name__ == '__main__': if (lab): env = EnvLab(80, 80, 60, "seekavoid_arena_01") else: env = EnvVizDoom(vizdoom_scenario) agent = Agent() Test(agent)
[ "noreply@github.com" ]
noreply@github.com
e1b8a2a3c79e07c69c40d3e8faf146679ada1d3f
c9ddbdb5678ba6e1c5c7e64adf2802ca16df778c
/cases/synthetic/sieve-big-3235.py
b14f9bb2d964539516ff9bba1aaebca7d5ad3f67
[]
no_license
Virtlink/ccbench-chocopy
c3f7f6af6349aff6503196f727ef89f210a1eac8
c7efae43bf32696ee2b2ee781bdfe4f7730dec3f
refs/heads/main
2023-04-07T15:07:12.464038
2022-02-03T15:42:39
2022-02-03T15:42:39
451,969,776
0
0
null
null
null
null
UTF-8
Python
false
false
31,737
py
# A resizable list of integers class Vector(object): items: [int] = None size: int = 0 def __init__(self:"Vector"): self.items = [0] # Returns current capacity def capacity(self:"Vector") -> int: return len(self.items) # Increases capacity of vector by one element def increase_capacity(self:"Vector") -> int: self.items = self.items + [0] return self.capacity() # Appends one item to end of vector def append(self:"Vector", item: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends many items to end of vector def append_all(self:"Vector", new_items: [int]) -> object: item:int = 0 for item in new_items: self.append(item) # Removes an item from the middle of vector def remove_at(self:"Vector", idx: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Retrieves an item at a given index def get(self:"Vector", idx: int) -> int: return self.items[idx] # Retrieves the current size of the vector def length(self:"Vector") -> int: return self.size # A resizable list of integers class Vector2(object): items: [int] = None items2: [int] = None size: int = 0 size2: int = 0 def __init__(self:"Vector2"): self.items = [0] # Returns current capacity def capacity(self:"Vector2") -> int: return len(self.items) # Returns current capacity def capacity2(self:"Vector2") -> int: return len(self.items) # Increases capacity of vector by one element def increase_capacity(self:"Vector2") -> int: self.items = self.items + [0] return self.capacity() # Increases capacity of vector by one element def increase_capacity2(self:"Vector2") -> int: self.items = self.items + [0] return self.capacity() # Appends one item to end of vector def append(self:"Vector2", item: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends one item to end of vector def append2(self:"Vector2", item: int, item2: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends many items to end of vector def append_all(self:"Vector2", new_items: [int]) -> object: item:int = 0 for item in new_items: self.append(item) # Appends many items to end of vector def append_all2(self:"Vector2", new_items: [int], new_items2: [int]) -> object: item:int = 0 item2:int = 0 for item in new_items: self.append(item) # Removes an item from the middle of vector def remove_at(self:"Vector2", idx: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Removes an item from the middle of vector def remove_at2(self:"Vector2", idx: int, idx2: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Retrieves an item at a given index def get(self:"Vector2", idx: int) -> int: return self.items[idx] # Retrieves an item at a given index def get2(self:"Vector2", idx: int, idx2: int) -> int: return self.items[idx] # Retrieves the current size of the vector def length(self:"Vector2") -> int: return self.size # Retrieves the current size of the vector def length2(self:"Vector2") -> int: return self.size # A resizable list of integers class Vector3(object): items: [int] = None items2: [int] = None items3: [int] = None size: int = 0 size2: int = 0 size3: int = 0 def __init__(self:"Vector3"): self.items = [0] # Returns current capacity def capacity(self:"Vector3") -> int: return len(self.items) # Returns current capacity def capacity2(self:"Vector3") -> int: return len(self.items) # Returns current capacity def capacity3(self:"Vector3") -> int: return len(self.items) # Increases capacity of vector by one element def increase_capacity(self:"Vector3") -> int: self.items = self.items + [0] return self.capacity() # Increases capacity of vector by one element def increase_capacity2(self:"Vector3") -> int: self.items = self.items + [0] return self.capacity() # Increases capacity of vector by one element def increase_capacity3(self:"Vector3") -> int: self.items = self.items + [0] return self.capacity() # Appends one item to end of vector def append(self:"Vector3", item: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends one item to end of vector def append2(self:"Vector3", item: int, item2: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends one item to end of vector def append3(self:"Vector3", item: int, item2: int, item3: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends many items to end of vector def append_all(self:"Vector3", new_items: [int]) -> object: item:int = 0 for item in new_items: self.append(item) # Appends many items to end of vector def append_all2(self:"Vector3", new_items: [int], new_items2: [int]) -> object: item:int = 0 item2:int = 0 for item in new_items: self.append(item) # Appends many items to end of vector def append_all3(self:"Vector3", new_items: [int], new_items2: [int], new_items3: [int]) -> object: item:int = 0 item2:int = 0 item3:int = 0 for item in new_items: self.append(item) # Removes an item from the middle of vector def remove_at(self:"Vector3", idx: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Removes an item from the middle of vector def remove_at2(self:"Vector3", idx: int, idx2: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Removes an item from the middle of vector def remove_at3(self:"Vector3", idx: int, idx2: int, idx3: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Retrieves an item at a given index def get(self:"Vector3", idx: int) -> int: return self.items[idx] # Retrieves an item at a given index def get2(self:"Vector3", idx: int, idx2: int) -> int: return self.items[idx] # Retrieves an item at a given index def get3(self:"Vector3", idx: int, idx2: int, idx3: int) -> int: return self.items[idx] # Retrieves the current size of the vector def length(self:"Vector3") -> int: return self.size # Retrieves the current size of the vector def length2(self:"Vector3") -> int: return self.size # Retrieves the current size of the vector def length3(self:"Vector3") -> int: return self.size # A resizable list of integers class Vector4(object): items: [int] = None items2: [int] = None items3: [int] = None items4: [int] = None size: int = 0 size2: int = 0 size3: int = 0 size4: int = 0 def __init__(self:"Vector4"): self.items = [0] # Returns current capacity def capacity(self:"Vector4") -> int: return len(self.items) # Returns current capacity def capacity2(self:"Vector4") -> int: return len(self.items) # Returns current capacity def capacity3(self:"Vector4") -> int: return len(self.items) # Returns current capacity def capacity4(self:"Vector4") -> int: return len(self.items) # Increases capacity of vector by one element def increase_capacity(self:"Vector4") -> int: self.items = self.items + [0] return self.capacity() # Increases capacity of vector by one element def increase_capacity2(self:"Vector4") -> int: self.items = self.items + [0] return self.capacity() # Increases capacity of vector by one element def increase_capacity3(self:"Vector4") -> int: self.items = self.items + [0] return self.capacity() # Increases capacity of vector by one element def increase_capacity4(self:"Vector4") -> int: self.items = self.items + [0] return self.capacity() # Appends one item to end of vector def append(self:"Vector4", item: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends one item to end of vector def append2(self:"Vector4", item: int, item2: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends one item to end of vector def append3(self:"Vector4", item: int, item2: int, item3: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends one item to end of vector def append4(self:"Vector4", item: int, item2: int, item3: int, item4: int) -> object: if self.size == self.capacity(): $Exp() self.items[self.size] = item self.size = self.size + 1 # Appends many items to end of vector def append_all(self:"Vector4", new_items: [int]) -> object: item:int = 0 for item in new_items: self.append(item) # Appends many items to end of vector def append_all2(self:"Vector4", new_items: [int], new_items2: [int]) -> object: item:int = 0 item2:int = 0 for item in new_items: self.append(item) # Appends many items to end of vector def append_all3(self:"Vector4", new_items: [int], new_items2: [int], new_items3: [int]) -> object: item:int = 0 item2:int = 0 item3:int = 0 for item in new_items: self.append(item) # Appends many items to end of vector def append_all4(self:"Vector4", new_items: [int], new_items2: [int], new_items3: [int], new_items4: [int]) -> object: item:int = 0 item2:int = 0 item3:int = 0 item4:int = 0 for item in new_items: self.append(item) # Removes an item from the middle of vector def remove_at(self:"Vector4", idx: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Removes an item from the middle of vector def remove_at2(self:"Vector4", idx: int, idx2: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Removes an item from the middle of vector def remove_at3(self:"Vector4", idx: int, idx2: int, idx3: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Removes an item from the middle of vector def remove_at4(self:"Vector4", idx: int, idx2: int, idx3: int, idx4: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Retrieves an item at a given index def get(self:"Vector4", idx: int) -> int: return self.items[idx] # Retrieves an item at a given index def get2(self:"Vector4", idx: int, idx2: int) -> int: return self.items[idx] # Retrieves an item at a given index def get3(self:"Vector4", idx: int, idx2: int, idx3: int) -> int: return self.items[idx] # Retrieves an item at a given index def get4(self:"Vector4", idx: int, idx2: int, idx3: int, idx4: int) -> int: return self.items[idx] # Retrieves the current size of the vector def length(self:"Vector4") -> int: return self.size # Retrieves the current size of the vector def length2(self:"Vector4") -> int: return self.size # Retrieves the current size of the vector def length3(self:"Vector4") -> int: return self.size # Retrieves the current size of the vector def length4(self:"Vector4") -> int: return self.size # A resizable list of integers class Vector5(object): items: [int] = None items2: [int] = None items3: [int] = None items4: [int] = None items5: [int] = None size: int = 0 size2: int = 0 size3: int = 0 size4: int = 0 size5: int = 0 def __init__(self:"Vector5"): self.items = [0] # Returns current capacity def capacity(self:"Vector5") -> int: return len(self.items) # Returns current capacity def capacity2(self:"Vector5") -> int: return len(self.items) # Returns current capacity def capacity3(self:"Vector5") -> int: return len(self.items) # Returns current capacity def capacity4(self:"Vector5") -> int: return len(self.items) # Returns current capacity def capacity5(self:"Vector5") -> int: return len(self.items) # Increases capacity of vector by one element def increase_capacity(self:"Vector5") -> int: self.items = self.items + [0] return self.capacity() # Increases capacity of vector by one element def increase_capacity2(self:"Vector5") -> int: self.items = self.items + [0] return self.capacity() # Increases capacity of vector by one element def increase_capacity3(self:"Vector5") -> int: self.items = self.items + [0] return self.capacity() # Increases capacity of vector by one element def increase_capacity4(self:"Vector5") -> int: self.items = self.items + [0] return self.capacity() # Increases capacity of vector by one element def increase_capacity5(self:"Vector5") -> int: self.items = self.items + [0] return self.capacity() # Appends one item to end of vector def append(self:"Vector5", item: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends one item to end of vector def append2(self:"Vector5", item: int, item2: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends one item to end of vector def append3(self:"Vector5", item: int, item2: int, item3: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends one item to end of vector def append4(self:"Vector5", item: int, item2: int, item3: int, item4: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends one item to end of vector def append5(self:"Vector5", item: int, item2: int, item3: int, item4: int, item5: int) -> object: if self.size == self.capacity(): self.increase_capacity() self.items[self.size] = item self.size = self.size + 1 # Appends many items to end of vector def append_all(self:"Vector5", new_items: [int]) -> object: item:int = 0 for item in new_items: self.append(item) # Appends many items to end of vector def append_all2(self:"Vector5", new_items: [int], new_items2: [int]) -> object: item:int = 0 item2:int = 0 for item in new_items: self.append(item) # Appends many items to end of vector def append_all3(self:"Vector5", new_items: [int], new_items2: [int], new_items3: [int]) -> object: item:int = 0 item2:int = 0 item3:int = 0 for item in new_items: self.append(item) # Appends many items to end of vector def append_all4(self:"Vector5", new_items: [int], new_items2: [int], new_items3: [int], new_items4: [int]) -> object: item:int = 0 item2:int = 0 item3:int = 0 item4:int = 0 for item in new_items: self.append(item) # Appends many items to end of vector def append_all5(self:"Vector5", new_items: [int], new_items2: [int], new_items3: [int], new_items4: [int], new_items5: [int]) -> object: item:int = 0 item2:int = 0 item3:int = 0 item4:int = 0 item5:int = 0 for item in new_items: self.append(item) # Removes an item from the middle of vector def remove_at(self:"Vector5", idx: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Removes an item from the middle of vector def remove_at2(self:"Vector5", idx: int, idx2: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Removes an item from the middle of vector def remove_at3(self:"Vector5", idx: int, idx2: int, idx3: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Removes an item from the middle of vector def remove_at4(self:"Vector5", idx: int, idx2: int, idx3: int, idx4: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Removes an item from the middle of vector def remove_at5(self:"Vector5", idx: int, idx2: int, idx3: int, idx4: int, idx5: int) -> object: if idx < 0: return while idx < self.size - 1: self.items[idx] = self.items[idx + 1] idx = idx + 1 self.size = self.size - 1 # Retrieves an item at a given index def get(self:"Vector5", idx: int) -> int: return self.items[idx] # Retrieves an item at a given index def get2(self:"Vector5", idx: int, idx2: int) -> int: return self.items[idx] # Retrieves an item at a given index def get3(self:"Vector5", idx: int, idx2: int, idx3: int) -> int: return self.items[idx] # Retrieves an item at a given index def get4(self:"Vector5", idx: int, idx2: int, idx3: int, idx4: int) -> int: return self.items[idx] # Retrieves an item at a given index def get5(self:"Vector5", idx: int, idx2: int, idx3: int, idx4: int, idx5: int) -> int: return self.items[idx] # Retrieves the current size of the vector def length(self:"Vector5") -> int: return self.size # Retrieves the current size of the vector def length2(self:"Vector5") -> int: return self.size # Retrieves the current size of the vector def length3(self:"Vector5") -> int: return self.size # Retrieves the current size of the vector def length4(self:"Vector5") -> int: return self.size # Retrieves the current size of the vector def length5(self:"Vector5") -> int: return self.size # A faster (but more memory-consuming) implementation of vector class DoublingVector(Vector): doubling_limit:int = 1000 # Overriding to do fewer resizes def increase_capacity(self:"DoublingVector") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # A faster (but more memory-consuming) implementation of vector class DoublingVector2(Vector): doubling_limit:int = 1000 doubling_limit2:int = 1000 # Overriding to do fewer resizes def increase_capacity(self:"DoublingVector2") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # Overriding to do fewer resizes def increase_capacity2(self:"DoublingVector2") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # A faster (but more memory-consuming) implementation of vector class DoublingVector3(Vector): doubling_limit:int = 1000 doubling_limit2:int = 1000 doubling_limit3:int = 1000 # Overriding to do fewer resizes def increase_capacity(self:"DoublingVector3") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # Overriding to do fewer resizes def increase_capacity2(self:"DoublingVector3") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # Overriding to do fewer resizes def increase_capacity3(self:"DoublingVector3") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # A faster (but more memory-consuming) implementation of vector class DoublingVector4(Vector): doubling_limit:int = 1000 doubling_limit2:int = 1000 doubling_limit3:int = 1000 doubling_limit4:int = 1000 # Overriding to do fewer resizes def increase_capacity(self:"DoublingVector4") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # Overriding to do fewer resizes def increase_capacity2(self:"DoublingVector4") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # Overriding to do fewer resizes def increase_capacity3(self:"DoublingVector4") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # Overriding to do fewer resizes def increase_capacity4(self:"DoublingVector4") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # A faster (but more memory-consuming) implementation of vector class DoublingVector5(Vector): doubling_limit:int = 1000 doubling_limit2:int = 1000 doubling_limit3:int = 1000 doubling_limit4:int = 1000 doubling_limit5:int = 1000 # Overriding to do fewer resizes def increase_capacity(self:"DoublingVector5") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # Overriding to do fewer resizes def increase_capacity2(self:"DoublingVector5") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # Overriding to do fewer resizes def increase_capacity3(self:"DoublingVector5") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # Overriding to do fewer resizes def increase_capacity4(self:"DoublingVector5") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # Overriding to do fewer resizes def increase_capacity5(self:"DoublingVector5") -> int: if (self.capacity() <= self.doubling_limit // 2): self.items = self.items + self.items else: # If doubling limit has been reached, fall back to # standard capacity increases self.items = self.items + [0] return self.capacity() # Makes a vector in the range [i, j) def vrange(i:int, j:int) -> Vector: v:Vector = None v = DoublingVector() while i < j: v.append(i) i = i + 1 return v def vrange2(i:int, j:int, i2:int, j2:int) -> Vector: v:Vector = None v2:Vector = None v = DoublingVector() while i < j: v.append(i) i = i + 1 return v def vrange3(i:int, j:int, i2:int, j2:int, i3:int, j3:int) -> Vector: v:Vector = None v2:Vector = None v3:Vector = None v = DoublingVector() while i < j: v.append(i) i = i + 1 return v def vrange4(i:int, j:int, i2:int, j2:int, i3:int, j3:int, i4:int, j4:int) -> Vector: v:Vector = None v2:Vector = None v3:Vector = None v4:Vector = None v = DoublingVector() while i < j: v.append(i) i = i + 1 return v def vrange5(i:int, j:int, i2:int, j2:int, i3:int, j3:int, i4:int, j4:int, i5:int, j5:int) -> Vector: v:Vector = None v2:Vector = None v3:Vector = None v4:Vector = None v5:Vector = None v = DoublingVector() while i < j: v.append(i) i = i + 1 return v # Sieve of Eratosthenes (not really) def sieve(v:Vector) -> object: i:int = 0 j:int = 0 k:int = 0 while i < v.length(): k = v.get(i) j = i + 1 while j < v.length(): if v.get(j) % k == 0: v.remove_at(j) else: j = j + 1 i = i + 1 def sieve2(v:Vector, v2:Vector) -> object: i:int = 0 i2:int = 0 j:int = 0 j2:int = 0 k:int = 0 k2:int = 0 while i < v.length(): k = v.get(i) j = i + 1 while j < v.length(): if v.get(j) % k == 0: v.remove_at(j) else: j = j + 1 i = i + 1 def sieve3(v:Vector, v2:Vector, v3:Vector) -> object: i:int = 0 i2:int = 0 i3:int = 0 j:int = 0 j2:int = 0 j3:int = 0 k:int = 0 k2:int = 0 k3:int = 0 while i < v.length(): k = v.get(i) j = i + 1 while j < v.length(): if v.get(j) % k == 0: v.remove_at(j) else: j = j + 1 i = i + 1 def sieve4(v:Vector, v2:Vector, v3:Vector, v4:Vector) -> object: i:int = 0 i2:int = 0 i3:int = 0 i4:int = 0 j:int = 0 j2:int = 0 j3:int = 0 j4:int = 0 k:int = 0 k2:int = 0 k3:int = 0 k4:int = 0 while i < v.length(): k = v.get(i) j = i + 1 while j < v.length(): if v.get(j) % k == 0: v.remove_at(j) else: j = j + 1 i = i + 1 def sieve5(v:Vector, v2:Vector, v3:Vector, v4:Vector, v5:Vector) -> object: i:int = 0 i2:int = 0 i3:int = 0 i4:int = 0 i5:int = 0 j:int = 0 j2:int = 0 j3:int = 0 j4:int = 0 j5:int = 0 k:int = 0 k2:int = 0 k3:int = 0 k4:int = 0 k5:int = 0 while i < v.length(): k = v.get(i) j = i + 1 while j < v.length(): if v.get(j) % k == 0: v.remove_at(j) else: j = j + 1 i = i + 1 # Input parameter n:int = 50 n2:int = 50 n3:int = 50 n4:int = 50 n5:int = 50 # Data v:Vector = None v2:Vector = None v3:Vector = None v4:Vector = None v5:Vector = None i:int = 0 i2:int = 0 i3:int = 0 i4:int = 0 i5:int = 0 # Crunch v = vrange(2, n) v2 = vrange(2, n) v3 = vrange(2, n) v4 = vrange(2, n) v5 = vrange(2, n) sieve(v) # Print while i < v.length(): print(v.get(i)) i = i + 1
[ "647530+Virtlink@users.noreply.github.com" ]
647530+Virtlink@users.noreply.github.com
01d2eb55812ff8487904a61f4e4bd4e2c70635dc
30b52a486086152bab1988b9624e8efae2169401
/scrp/cmc_scrp.py
4ecd785c1027035837dd5a458574b05ad03cb9f5
[ "Apache-2.0" ]
permissive
iamrobinhood12345/coinmarketcap-data-collector
754bcd964e7048ada1b78381ab32e38d965f81fe
af0d1d96d0e5fb46623506a01fbc1d8fa24452ee
refs/heads/master
2022-12-22T11:53:37.275355
2018-07-31T21:13:07
2018-07-31T21:13:07
143,069,832
0
0
Apache-2.0
2022-12-08T00:01:46
2018-07-31T21:00:49
Python
UTF-8
Python
false
false
1,799
py
"""This file when ran from the command line scrapes CoinMarketCap for crypto data.""" from requests import get from bs4 import BeautifulSoup from datetime import datetime from pytz import timezone from os import getcwd from csv import writer SOURCE = 'https://coinmarketcap.com/all/views/all/' coins_dict = {} # scrape source for data page = get(SOURCE) c = page.content soup = BeautifulSoup(c, 'html5lib') tr_tags = soup.find_all('tr') # arrange data into coins_dict for i in range(1, len(tr_tags)): tr_split = tr_tags[i].text.split('\n') tr_strip = [s.lstrip() for s in tr_split] # coin_data = filter(None, tr_strip) # <---- Python 2 coin_data = list(filter(None, tr_strip)) # <---- Python 3 market_cap_rank = coin_data[0] name = coin_data[1] symbol = coin_data[2] market_cap = coin_data[3] price = coin_data[4] circulating_supply = coin_data[5] volume = coin_data[6] hour_percent_d = coin_data[7] day_percent_d = coin_data[8] week_percent_d = coin_data[9] coins_dict[symbol] = [market_cap_rank, name, market_cap, price, circulating_supply, volume, hour_percent_d, day_percent_d, week_percent_d] # build datetime-based csv filename utc_time = datetime.now(timezone('UTC')).strftime("%Y%m%d-%H%M%S") filename = getcwd() + '/data/cr_' + utc_time + '.csv' # create and write csv with open(filename, 'w+') as csv_file: csv_writer = writer(csv_file) csv_writer.writerow(['symbol', 'ranking by market cap', 'name', 'market cap', 'price', 'circulating supply', 'volume', '% 1h', '% 24h', '% 1wk']) for key, value in coins_dict.items(): csv_writer.writerow([key, value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], value[8]]) # print filename to console print('cr ' + utc_time)
[ "bshields23@gmail.com" ]
bshields23@gmail.com
c4437c4f53b504d44ea3ae350ef4cf622e58a3cd
d478fff490644a70434554daf9495ecc50ace755
/utils/preprocessing.py
cf24f4a2888c9995bb67a97848340ddd0f0c4010
[]
no_license
gohurali/BPE_SentenceClassification
bb79dff790d08c06fa3a18d9e6233f78998403b0
1f180beb95d899b177f1e59b79291d6f618988ab
refs/heads/master
2021-06-13T15:49:22.335638
2019-11-02T18:02:31
2019-11-02T18:02:31
176,166,582
0
0
null
2021-03-25T22:55:27
2019-03-17T22:06:52
Jupyter Notebook
UTF-8
Python
false
false
8,528
py
import numpy as np import os import re from sklearn.model_selection import train_test_split class DataPrepper(): def __init__(self,config={},dataset=None): self.config = config self.dataset_type = dataset if(self.dataset_type == 'trec'): self.x_train, self.y_train, self.x_test, self.y_test = self.read_trec_dataset( train_data_location=self.config['train_data_location']+self.config['dataset']+'/', use_default_split=True ) elif(self.dataset_type == 'subj'): dataset,labels = self.read_subj_dataset(train_data_location=self.config['train_data_location']+self.config['dataset']+'/') self.x_train, self.x_test, self.y_train, self.y_test = train_test_split( dataset, labels, test_size=0.2, random_state=1000 ) pass def read_subj_dataset(self, train_data_location): """Open and prepare the subjectivity dataset. Using Regular expressions to clean the sentences. Args: train_data_location - location of the data, specified in config Return: dataset - ndarray of each example labels - array of binary labels """ dataset = [] labels = [] for f in os.listdir(train_data_location): print(f) if(f == 'quote.tok.gt9.5000'): # Subjective Data with open(train_data_location + f, encoding = "ISO-8859-1") as subj_file: for line in subj_file: pattern = "[^a-zA-Z.' ]" cleaned_line = re.sub(pattern,' ',line) dataset.append(cleaned_line) labels.append(0) elif(f == 'plot.tok.gt9.5000'): # Objective Data with open(train_data_location + f, encoding = "ISO-8859-1") as obj_file: for line in obj_file: pattern = "[^a-zA-Z.' ]" cleaned_line = re.sub(pattern,' ',line) dataset.append(cleaned_line) labels.append(1) return np.array(dataset), np.array(labels) def read_trec_dataset(self, train_data_location, use_default_split=False): """Open and prepare the subjectivity dataset. Using Regular expressions to clean the sentences. Args: train_data_location - location of the data, specified in config Return: dataset - ndarray of each example labels - array of binary labels """ if(use_default_split == False): dataset = [] labels = [] for f in os.listdir(train_data_location): print(f) if(f == 'trec_5000_train.txt'): # Subjective Data with open(train_data_location + f, encoding = "ISO-8859-1") as subj_file: for line in subj_file: split_line = line.split(':') ques_class = split_line[0] question = split_line[1] pattern = "[^a-zA-Z.' ]" cleaned_line = re.sub(pattern,' ',question) cleaned_line = cleaned_line.lower() dataset.append(cleaned_line) if(ques_class == 'NUM'): labels.append(0) elif(ques_class == 'DESC'): labels.append(1) elif(ques_class == 'ENTY'): labels.append(2) elif(ques_class == 'HUM'): labels.append(3) elif(ques_class == 'ABBR'): labels.append(4) elif(ques_class == 'LOC'): labels.append(5) elif(f == 'trec_test.txt'): # Objective Data with open(train_data_location + f, encoding = "ISO-8859-1") as obj_file: for line in obj_file: split_line = line.split(': ') ques_class = split_line[0] question = split_line[1] pattern = "[^a-zA-Z.' ]" cleaned_line = re.sub(pattern,' ',question) cleaned_line = cleaned_line.lower() dataset.append(cleaned_line) if(ques_class == 'NUM'): labels.append(0) elif(ques_class == 'DESC'): labels.append(1) elif(ques_class == 'ENTY'): labels.append(2) elif(ques_class == 'HUM'): labels.append(3) elif(ques_class == 'ABBR'): labels.append(4) elif(ques_class == 'LOC'): labels.append(5) return np.array(dataset), np.array(labels) elif(use_default_split==True): x_train = [] x_test = [] y_train = [] y_test = [] for f in os.listdir(train_data_location): print(f) if(f == 'trec_5000_train.txt'): # Subjective Data with open(train_data_location + f, encoding = "ISO-8859-1") as subj_file: for line in subj_file: split_line = line.split(':')# ques_class = split_line[0] question = line.split(' ',1)[1]#split_line[1] pattern = "[^a-zA-Z.' ]" cleaned_line = re.sub(pattern,' ',question) cleaned_line = cleaned_line.lower() x_train.append(cleaned_line) if(ques_class == 'NUM'): y_train.append(0) elif(ques_class == 'DESC'): y_train.append(1) elif(ques_class == 'ENTY'): y_train.append(2) elif(ques_class == 'HUM'): y_train.append(3) elif(ques_class == 'ABBR'): y_train.append(4) elif(ques_class == 'LOC'): y_train.append(5) elif(f == 'trec_test.txt'): # Objective Data with open(train_data_location + f, encoding = "ISO-8859-1") as obj_file: for line in obj_file: split_line = line.split(':')#line.split(' ',1) ques_class = split_line[0] question = line.split(' ',1)[1]#split_line[1] pattern = "[^a-zA-Z.' ]" cleaned_line = re.sub(pattern,' ',question) cleaned_line = cleaned_line.lower() x_test.append(cleaned_line) if(ques_class == 'NUM'): y_test.append(0) elif(ques_class == 'DESC'): y_test.append(1) elif(ques_class == 'ENTY'): y_test.append(2) elif(ques_class == 'HUM'): y_test.append(3) elif(ques_class == 'ABBR'): y_test.append(4) elif(ques_class == 'LOC'): y_test.append(5) return np.array(x_train), np.array(y_train), np.array(x_test), np.array(y_test)
[ "gohurali@live.com" ]
gohurali@live.com
72b8dfd636e841f1210ead1a13ab5f2f46422eac
b782f8d3788d8d88ff82ba5c32a343ae60f2183c
/grocerygo/web_crawler/loblaws_get_link.py
ce6af974e0c6fff1cf669568a9061ca95059e667
[]
no_license
ChenWangCarleton/grocerygo_plus
2a91ebe26c518271cf3161c6d2c1af94f6de7fad
b70497f0d917af2d88f7e72e0af68f04cb24fcce
refs/heads/master
2022-12-03T12:40:54.750117
2020-08-19T05:05:28
2020-08-19T05:05:28
268,151,809
1
0
null
null
null
null
UTF-8
Python
false
false
19,695
py
import logging import traceback import time import os from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options from selenium.common.exceptions import NoSuchElementException, TimeoutException logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) logger.addHandler(ch) web_driver_loc = os.path.join(os.path.abspath(os.path.dirname(__file__)),'chromedriver.exe') def get_item_detail(id_url_tuple, headless=False, disableimage=False): """ This function gets the item detail from giving id_url_tuple which is a 2-element tuple that the first element is the item_id, the second element is the url of the item page. The function first check if the url is redirected to loblaws homepage which means the item is not available at the moment, if so return string unavailable If not, collect the item name, brand if exist, description if exist, ingrident list if exist then return a 6-element tuple (item_id, name, brand, description, ingrident, imgsrc) Return False when unexpected error happens :param id_url_tuple: a 2-element tuple that the first element is the item_id, the second element is the url of the item page. :param headless: boolen for representing whether it runs in headless mode :param disableimage: boolen for representing whether it runs in image-less mode :return: String unavailable when page not available False when error happens Tuple a 6-element tuple (item_id, name, brand, description, ingrident, imgsrc) """ item_id = id_url_tuple[0] url = id_url_tuple[1] options = Options() if headless: options.add_argument('--headless') options.add_argument('--disable-gpu') # Last I checked this was necessary. options.add_argument("window-size=1920,1080") if disableimage: options.add_argument('--blink-settings=imagesEnabled=false') driver = webdriver.Chrome(web_driver_loc, options=options) try: driver.get(url) driver.implicitly_wait(1) home_page = 'https://www.loblaws.ca/' unavailable_msg = 'unavailable' if home_page == driver.current_url: logger.debug('Item page unavailable for id: {} url: \n{}'.format(item_id, url)) return unavailable_msg element_present = EC.presence_of_element_located((By.CLASS_NAME, 'product-details-page-details__content__name')) WebDriverWait(driver, 10).until(element_present) name = driver.title.replace(' | Loblaws', '') name_not_right_counter = 0 while name =='Loblaws': time.sleep(1) name = driver.title.replace(' | Loblaws', '') name_not_right_counter += 1 if name_not_right_counter > 10: logger.error('name not correct after 10 attempts, title is:{}. for value\n{}'.format(driver.title, id_url_tuple)) return False current_item_element = driver.find_element_by_class_name('product-details-page-details__content__name') """current_item_element = driver.find_element_by_class_name('product-details-page-details__content__name') name = current_item_element.find_element_by_css_selector('.product-name__item.product-name__item--name').text if not name: # in case the top didn't work name = driver.title.replace(' | Loblaws','')""" brand = None try: selenium_input = '.product-name__item.product-name__item--brand' element_present = EC.presence_of_element_located( (By.CSS_SELECTOR, selenium_input)) WebDriverWait(driver, 2).until(element_present) brand = current_item_element.find_element_by_css_selector(selenium_input).text except (NoSuchElementException, TimeoutException) as e: logger.debug('no brand info for id: {} url: \n{}'.format(item_id, url)) description = None try: selenium_input = 'product-description-text__text' element_present = EC.presence_of_element_located( (By.CLASS_NAME, selenium_input)) WebDriverWait(driver, 2).until(element_present) description = driver.find_element_by_class_name(selenium_input).text except (NoSuchElementException, TimeoutException) as e: logger.debug('no description for id: {} url: \n{}'.format(item_id, url)) ingredients = None try: """class_name = "product-details-page-info-layout-content product-details-page-info-layout-content--i product-details-page-info-layout-content--n product-details-page-info-layout-content--g product-details-page-info-layout-content--r product-details-page-info-layout-content--e product-details-page-info-layout-content--d product-details-page-info-layout-content--i product-details-page-info-layout-content--e product-details-page-info-layout-content--n product-details-page-info-layout-content--t product-details-page-info-layout-content--s product-details-page-info-layout-content--active" class_name = '.'+'.'.join(class_name.split(' ')) print(class_name) selenium_input = class_name""" selenium_input = '.product-details-page-info-layout.product-details-page-info-layout--ingredients' element_present = EC.presence_of_element_located( (By.CSS_SELECTOR, selenium_input)) WebDriverWait(driver, 2).until(element_present) ingredients = driver.find_element_by_css_selector(selenium_input).find_element_by_tag_name('div').get_attribute('innerHTML') # here it seems only works with innerHTML istead of text #print('ingredi:',ingredients.get_attribute('innerHTML')) #ingredients = driver.find_element_by_css_selector('.product-details-page-info-layout.product-details-page-info-layout--ingredients').text except (NoSuchElementException, TimeoutException) as e: logger.debug('no ingredients for id: {} url: \n{}'.format(item_id, url)) imgsrc = None try: selenium_input = '.product-image-list__item.product-image-list__item--product-details-page.product-image-list__item--0' element_present = EC.presence_of_element_located( (By.CSS_SELECTOR, selenium_input)) WebDriverWait(driver, 2).until(element_present) image_element = driver.find_elements_by_css_selector(selenium_input)[0] imgsrc = image_element.find_element_by_tag_name('img').get_attribute('src') print(imgsrc) except (NoSuchElementException, TimeoutException) as e: logger.debug('no image src found for id: {} url: \n{}'.format(item_id, url)) result_tuple = (item_id,name,brand,description,ingredients, imgsrc) logger.debug('item detail got for id: {} url: \n{}\nvalue:{}'.format(item_id, url,result_tuple)) #input('hrere') return result_tuple except: logger.error('error when getting item detail for id:{} url:\n{}\n{}'.format(item_id, url,traceback.format_exc())) return False finally: driver.close() def get_link(url_category_tuple,headless=False,disableimage=False): """ This function creates a driver using the url from the first element in the parameter url_category_tuple and gets all the listed items' item-page-url :param url_category_tuple: a 2-element-tuple that the first element is the url of the webpage, it should be one of the webpage under food category from loblaws. the second element is the category list, which is a list of strings :param headless: boolen for representing whether it runs in headless mode :param disableimage: boolen for representing whether it runs in image-less mode :return: a 2-element tuple which the first element is a list of urls, the second element is the category list from the second element in the parameter url_category_tuple boolean False when error happened """ url = url_category_tuple[0] options = Options() if headless: options.add_argument('--headless') options.add_argument('--disable-gpu') # Last I checked this was necessary. options.add_argument("window-size=1920,1080") if disableimage: options.add_argument('--blink-settings=imagesEnabled=false') driver = webdriver.Chrome(web_driver_loc, options=options) driver.get(url) result = load_more(driver) logger.debug('load more button clicked total {} times for url:\n{}'.format(result,url)) try: current_pagination = driver.find_element_by_class_name('pagination').text total_item_listed = int(current_pagination[2:].split(' ')[0]) item_elements = driver.find_elements_by_class_name('product-tile__details__info__name__link') if len(item_elements) != total_item_listed: # do it again if it does not match :) time.sleep(1) item_elements = driver.find_elements_by_class_name('product-tile__details__info__name__link') if len(item_elements) != total_item_listed: logger.error('total number of item showing in pagination does not match with items found in page' ' when getting itempage urls for url:\n{}\n{}'.format(url, traceback.format_exc())) return False url_list = [] for element in item_elements: itempage_url = element.get_attribute('href') url_list.append(itempage_url) logger.info("all itempages' link collected in url\n{}".format(url)) return (url_list,url_category_tuple[1]) except: logger.error('error when getting itempage urls for url:\n{}\n{}'.format(url,traceback.format_exc())) return False finally: driver.close() def get_link_price(url_category_tuple,headless=False,disableimage=False): """ This function creates a driver using the url from the first element in the parameter url_category_tuple and gets all the listed items' item-page-url, category list and prices :param url_category_tuple: a 2-element-tuple that the first element is the url of the webpage, it should be one of the webpage under food category from loblaws. the second element is the category list, which is a list of strings :param headless: boolen for representing whether it runs in headless mode :param disableimage: boolen for representing whether it runs in image-less mode :return: a 3-element tuple list which the first element is the item page url, the second element is the category list from the second element in the parameter url_category_tuple, the third element is the current presented price & other formats of the presented price if any separated by comma boolean False when error happened """ url = url_category_tuple[0] category_list = url_category_tuple[1] options = Options() if headless: options.add_argument('--headless') options.add_argument('--disable-gpu') # Last I checked this was necessary. options.add_argument("window-size=1920,1080") if disableimage: options.add_argument('--blink-settings=imagesEnabled=false') driver = webdriver.Chrome(web_driver_loc, options=options) driver.get(url) result = load_more(driver) logger.debug('load more button clicked total {} times for url:\n{}'.format(result,url)) try: current_pagination = driver.find_element_by_class_name('pagination').text total_item_listed = int(current_pagination[2:].split(' ')[0]) item_elements = driver.find_elements_by_class_name('product-tile__details') if len(item_elements) != total_item_listed: # do it again if it does not match :) time.sleep(1) item_elements = driver.find_elements_by_class_name('product-tile__details') if len(item_elements) != total_item_listed: logger.error('total number of item showing in pagination does not match with items found in page' ' when getting itempage urls for url:\n{}\n{}'.format(url, traceback.format_exc())) return False result_list = [] print(len(item_elements)) for element in item_elements: itempage_url = element.find_element_by_class_name('product-tile__details__info__name__link').get_attribute('href') current_price = element.find_element_by_css_selector('.price.selling-price-list__item__price.selling-price-list__item__price--now-price').text comparison_price = element.find_element_by_css_selector('.comparison-price-list.comparison-price-list--product-tile.comparison-price-list--product-tile').text cp_list = comparison_price.split('$') return_price = current_price if len(cp_list) > 1: for i in range(1, len(cp_list)): return_price = return_price + ',$' + cp_list[i] """print('current price:{}:'.format(current_price)) print('comparison_price:',comparison_price) print(return_price)""" result_list.append((itempage_url,category_list,return_price)) logger.info("all itempages' link collected in url\n{}".format(url)) return result_list except: logger.error('error when getting itempage urls for url:\n{}\n{}'.format(url,traceback.format_exc())) return False finally: driver.close() def load_more(driver): """ This function loads all the "load xxx more results" on the page untill all the items are loaded Then it returns the total times of load button clicked successfully if there was any Otherwise it returns 0 The function is implemented by checking if backslash exists in pagination, no backslash example(1-166 Results) with backslash example (1-48 / 156 Results) if there is backslash in pagination, then it means load more button should be clickable, click and repeat untill no more backslash in pagination or time limit reached :param driver: the driver instance that should be the leaf category webpage :return: int number of times the load more button been pressed """ try: element_present = EC.presence_of_element_located((By.CLASS_NAME, 'pagination')) WebDriverWait(driver, 10).until(element_present) except: logger.error('time limit exceeds when waiting for loading total number of items\n{}\n{}'.driver.getCurrentUrl(), traceback.format_exc()) current_pagination = driver.find_element_by_class_name('pagination').text click_counter = 0 while '/' in current_pagination: try: element_present = EC.presence_of_element_located((By.CLASS_NAME, 'load-more-button')) WebDriverWait(driver, 10).until(element_present) except: logger.error('time limit exceeds when waiting for load more buttion to appear on page\n{}\n{}'.format(driver.getCurrentUrl(), traceback.format_exc())) return False load_more_button = driver.find_element_by_class_name('load-more-button') load_more_button.click() time.sleep(1) try: element_present = EC.presence_of_element_located((By.CLASS_NAME, 'pagination')) WebDriverWait(driver, 10).until(element_present) except: logger.error('time limit exceeds when waiting for loading pagination after clicking load more button. button click counter {}\n{}\n{}'.format(click_counter,driver.getCurrentUrl(), traceback.format_exc())) current_pagination = driver.find_element_by_class_name('pagination').text click_counter = click_counter + 1 return click_counter def has_more_subcategories(url_category_tuple,headless=False,disableimage=False): """ This function checks if there are more subcategories in the url. If there is any, it returns the list of 2 element tuple. The first element in the tuple is the url, the second element in the tuple is a list of all category If not, it returns string which is the current category, the function caller should then add the current category to category list :param url_category_tuple: a 2-element-tuple that the first element is the url of the webpage, it should be one of the webpage under food category from loblaws. the second element is the category list, which is a list of strings :param headless: boolen for representing whether it runs in headless mode :param disableimage: boolen for representing whether it runs in image-less mode :return: list a list of 2-element-tuple of url as first value , list of categories as second value, the current category is appended to the end of the list of categories string string of the current category if there is no more subcategories boolean False when error happened """ url = url_category_tuple[0] options = Options() if headless: options.add_argument('--headless') options.add_argument('--disable-gpu') # Last I checked this was necessary. options.add_argument("window-size=1920,1080") if disableimage: options.add_argument('--blink-settings=imagesEnabled=false') driver = webdriver.Chrome(web_driver_loc, options=options) try: driver.get(url) try: element_present = EC.presence_of_element_located((By.CLASS_NAME, 'category-filter__subcategories')) WebDriverWait(driver, 10).until(element_present) except: logger.error('error when waiting for element on url:\n{}\n{}'.format(url, traceback.format_exc())) subcategories_class = driver.find_element_by_class_name('category-filter__subcategories') li_elements = subcategories_class.find_elements_by_tag_name('li') current_category = li_elements[0].text print(current_category) if len(li_elements) == 1: logger.info('No more subcategory under category: {} with url:\n{}'.format(url, current_category)) return current_category elif len(li_elements) > 1: result_list = [] for i in range(1, len(li_elements)): sub_category_url = li_elements[i].find_element_by_tag_name('a').get_attribute('href') logger.debug(sub_category_url) temp_category_list = url_category_tuple[1].copy() temp_category_list.append(current_category) result_list.append((sub_category_url, temp_category_list)) return result_list else: logger.error('unexpected situation, num of li element is smaller than 0 for url \n{}\n the website code might have changed'.format(url)) return False except: logger.error('unexpected error in has_more_subcategories with url\n{}'.format(url)) finally: driver.close() #get_link_price(('https://www.loblaws.ca/Food/Deli/Deli-Meats/Beef/plp/LSL001002001002?navid=CLP-L5-Beef',[])) #print(get_link_price(('https://www.loblaws.ca/Food/Fruits-%26-Vegetables/Organic-Vegetables/plp/LSL001001006000',['test'])))
[ "wch4university@gmail.com" ]
wch4university@gmail.com
3eec9f514074995590968d1b2f6ef53b70318efe
f028a3cb303071b957d9602e587181c6b08cf9de
/alloc_test/incremental_alloc.py
086484056c00b5c41a39b1c6f41e767e79c68477
[ "BSD-2-Clause" ]
permissive
20ft/images
5f16933c05ddbca04d83237f3b56c4f1a1093f8c
1b36fdd4bfa36c19a3ef16d1d15a683cd6ae55d6
refs/heads/master
2021-09-18T14:31:06.870324
2018-07-15T22:32:45
2018-07-15T22:32:45
112,829,535
0
0
null
null
null
null
UTF-8
Python
false
false
97
py
import time allocs = [] while True: allocs.append(bytearray(8*1024*1024)) time.sleep(1)
[ "davep@zedkep.com" ]
davep@zedkep.com
4b3b743d5ee5e28933cf9146e29acdcddced8a3e
685996a29e2c70a0b7f0ab0fe28c235efc302505
/apps/dise/models.py
34314202e4f988be9114a70ced2745c4973253b8
[]
no_license
sukanya08/ilp
8bba42456e67afc75234b9adc71efb7973f5a23b
b56bc37856e9c3375c02cf99a4f2b55894620a93
refs/heads/master
2020-03-19T09:31:24.332423
2018-06-06T04:24:07
2018-06-06T04:24:07
null
0
0
null
null
null
null
UTF-8
Python
false
false
6,389
py
from django.contrib.gis.db import models # Create your models here. class BasicData(models.Model): """Basic model for DISE data""" academic_year = models.ForeignKey('common.AcademicYear') district = models.CharField(max_length=50, blank=True) school_code = models.BigIntegerField() school_name = models.CharField(max_length=200, blank=True) block_name = models.CharField(max_length=50, blank=True) cluster_name = models.CharField(max_length=50, blank=True) village_name = models.CharField(max_length=50, blank=True, null=True) pincode = models.IntegerField(null=True, blank=True) rural_urban = models.IntegerField(null=True, blank=True) medium_of_instruction = models.IntegerField(null=True, blank=True) distance_brc = models.FloatField(null=True, blank=True) distance_crc = models.FloatField(null=True, blank=True) year_estd = models.IntegerField(null=True, blank=True) pre_pry_yn = models.IntegerField(null=True, blank=True) residential_sch_yn = models.IntegerField(null=True, blank=True) sch_management = models.IntegerField( null=True, blank=True) lowest_class = models.IntegerField(null=True, blank=True) highest_class = models.IntegerField(null=True, blank=True) sch_category = models.IntegerField(null=True, blank=True) pre_pry_students = models.IntegerField(null=True, blank=True) school_type = models.IntegerField(null=True, blank=True) shift_school_yn = models.IntegerField(null=True, blank=True) no_of_working_days = models.IntegerField(null=True, blank=True) no_of_acad_inspection = models.IntegerField(null=True, blank=True) residential_sch_type = models.IntegerField(null=True, blank=True) pre_pry_teachers = models.IntegerField(null=True, blank=True) visits_by_brc = models.IntegerField(null=True, blank=True) visits_by_crc = models.IntegerField(null=True, blank=True) school_dev_grant_recd = models.FloatField(null=True, blank=True) school_dev_grant_expnd = models.FloatField(null=True, blank=True) tlm_grant_recd = models.FloatField(null=True, blank=True) tlm_grant_expnd = models.FloatField(null=True, blank=True) funds_from_students_recd = models.FloatField(null=True, blank=True) funds_from_students_expnd = models.FloatField(null=True, blank=True) building_status = models.IntegerField(null=True, blank=True) tot_clrooms = models.IntegerField(null=True, blank=True) classrooms_in_good_condition = models.IntegerField(null=True, blank=True) classrooms_require_major_repair = models.IntegerField(null=True, blank=True) classrooms_require_minor_repair = models.IntegerField(null=True, blank=True) other_rooms_in_good_cond = models.IntegerField(null=True, blank=True) other_rooms_need_major_rep = models.IntegerField(null=True, blank=True) other_rooms_need_minor_rep = models.IntegerField(null=True, blank=True) toilet_common = models.IntegerField(null=True, blank=True) toilet_boys = models.IntegerField(null=True, blank=True) toilet_girls = models.IntegerField(null=True, blank=True) kitchen_devices_grant = models.IntegerField(null=True, blank=True) status_of_mdm = models.IntegerField(null=True, blank=True) computer_aided_learnin_lab = models.IntegerField(null=True, blank=True) separate_room_for_headmaster = models.IntegerField(null=True, blank=True) electricity = models.IntegerField(null=True, blank=True) boundary_wall = models.IntegerField(null=True, blank=True) library_yn = models.IntegerField(null=True, blank=True) playground = models.IntegerField(null=True, blank=True) blackboard = models.IntegerField(null=True, blank=True) books_in_library = models.IntegerField(null=True, blank=True) drinking_water = models.IntegerField(null=True, blank=True) medical_checkup = models.IntegerField(null=True, blank=True) ramps = models.IntegerField(null=True, blank=True) no_of_computers = models.IntegerField(null=True, blank=True) male_tch = models.IntegerField(null=True, blank=True) female_tch = models.IntegerField(null=True, blank=True) noresp_tch = models.IntegerField(null=True, blank=True) head_teacher = models.IntegerField(null=True, blank=True) graduate_teachers = models.IntegerField(null=True, blank=True) tch_with_professional_qualification = models.IntegerField(null=True, blank=True) days_involved_in_non_tch_assgn = models.IntegerField(null=True, blank=True) teachers_involved_in_non_tch_assgn = models.IntegerField(null=True, blank=True) centroid = models.GeometryField(blank=True, null=True) assembly_name = models.CharField(max_length=35, blank=True, null=True) parliament_name = models.CharField(max_length=35, blank=True, null=True) class1_total_enr_boys = models.IntegerField(blank=True, null=True) class2_total_enr_boys = models.IntegerField(blank=True, null=True) class3_total_enr_boys = models.IntegerField(blank=True, null=True) class4_total_enr_boys = models.IntegerField(blank=True, null=True) class5_total_enr_boys = models.IntegerField(blank=True, null=True) class6_total_enr_boys = models.IntegerField(blank=True, null=True) class7_total_enr_boys = models.IntegerField(blank=True, null=True) class8_total_enr_boys = models.IntegerField(blank=True, null=True) class1_total_enr_girls = models.IntegerField(blank=True, null=True) class2_total_enr_girls = models.IntegerField(blank=True, null=True) class3_total_enr_girls = models.IntegerField(blank=True, null=True) class4_total_enr_girls = models.IntegerField(blank=True, null=True) class5_total_enr_girls = models.IntegerField(blank=True, null=True) class6_total_enr_girls = models.IntegerField(blank=True, null=True) class7_total_enr_girls = models.IntegerField(blank=True, null=True) class8_total_enr_girls = models.IntegerField(blank=True, null=True) total_boys = models.IntegerField(blank=True, null=True) total_girls = models.IntegerField(blank=True, null=True) new_pincode = models.IntegerField(null=True, blank=True) infered_assembly = models.CharField(max_length=256, blank=True, null=True) infered_parliament = models.CharField(max_length=256, blank=True, null=True) def __unicode__(self): return self.school_name class Meta: unique_together = (('school_code', 'academic_year'), )
[ "shivangi@klp.org.in" ]
shivangi@klp.org.in
3ce17575b5cef374bae00ec73ad679e57233f273
93e29579ef58ba73a7dc80b3e72afb5db30f0252
/app/config.py
aaf0bae7b68e7c7cec5a1a68b40f486941230b13
[]
no_license
chandanadatta9/FeatureRequest
b8a634b630b400f567f0eae539379aae1c6c5865
a89c33d4e1b8fc7d49b85dd14f22c866f0914d91
refs/heads/master
2020-05-25T15:42:55.653482
2016-11-17T03:39:38
2016-11-17T03:39:38
69,045,895
0
0
null
null
null
null
UTF-8
Python
false
false
2,533
py
import os from .constants import INSTANCE_FOLDER_PATH class BaseConfig(object): PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) PROJECT = 'app' SECRET_KEY = 'application_key_secret' DEBUG = True PROD = False TESTING = False SECRET_KEY = 'DEFAULT_SECRET_KEY' try: if not os.path.exists(INSTANCE_FOLDER_PATH): os.mkdir(INSTANCE_FOLDER_PATH) except Exception,e: raise e LOG_FOLDER = os.path.join(INSTANCE_FOLDER_PATH,'logs') try: if not os.path.exists(LOG_FOLDER): os.mkdir(LOG_FOLDER) except Exception,e: raise e class DevelopmentConfig(BaseConfig): DEBUG = True DATABASE_NAME = os.environ.get('DATABASE_DEVELOPMENT_NAME','') DATABASE_USER = os.environ.get('DATABASE_USER','') DATABASE_HOST = os.environ.get('DATABASE_HOST','') SQLALCHEMY_ECHO = True DATABASE_PASSWORD = os.environ.get('DATABASE_PASSWORD','') SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://'+DATABASE_USER+':'+DATABASE_PASSWORD+'@'+DATABASE_HOST+'/'+DATABASE_NAME SQLALCHEMY_TRACK_MODIFICATIONS= True SECRET_KEY = 'application_development_key_secret' class LocalConfig(BaseConfig): DATABASE_NAME = os.environ.get('DATABASE_LOCAL_NAME','') DATABASE_USER = os.environ.get('DATABASE_USER','') DATABASE_HOST = os.environ.get('DATABASE_HOST','') DATABASE_PASSWORD = os.environ.get('DATABASE_PASSWORD','') SQLALCHEMY_ECHO = True SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://'+DATABASE_USER+':'+DATABASE_PASSWORD+'@'+DATABASE_HOST+'/'+DATABASE_NAME SQLALCHEMY_TRACK_MODIFICATIONS= True class ProdConfig(DevelopmentConfig): DEBUG = False PROD = True DATABASE_NAME = os.environ.get('DATABASE_PRODUCTION_NAME','') DATABASE_USER = os.environ.get('DATABASE_USER','') DATABASE_HOST = os.environ.get('DATABASE_HOST','') DATABASE_PASSWORD = os.environ.get('DATABASE_PASSWORD','') SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://'+DATABASE_USER+':'+DATABASE_PASSWORD+'@'+DATABASE_HOST+'/'+DATABASE_NAME SQLALCHEMY_TRACK_MODIFICATIONS= False class TestConfig(BaseConfig): TESTING = False DATABASE_NAME = os.environ.get('DATABASE_TEST_NAME','') DATABASE_USER = os.environ.get('DATABASE_USER','') DATABASE_HOST = os.environ.get('DATABASE_HOST','') DATABASE_PASSWORD = os.environ.get('DATABASE_PASSWORD','') SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://'+DATABASE_USER+':'+DATABASE_PASSWORD+'@'+DATABASE_HOST+'/'+DATABASE_NAME SQLALCHEMY_TRACK_MODIFICATIONS = False def load_config(MODE): config_mode = {'LOCAL':LocalConfig,'TESTING':TestConfig, 'DEVELOPMENT':DevelopmentConfig,'PRODUCTION':ProdConfig} return config_mode[MODE]
[ "chandan.datta.cd@gmail.com" ]
chandan.datta.cd@gmail.com
02ef9ab30632150239fa8e78c0f44b26d4946101
909b6501bfc3f47f9c754eb49131ef0a88db5760
/libsnek/util.py
849a2d0ab731f18e777478bfd1864b3ef1d8cdf1
[]
no_license
adambard/libsnek
80b9e5fccb6255fca6dd7b16bb116eb5d91be868
a1015aed19b86d7ddcda35366baaaaafcdfe1610
refs/heads/master
2020-04-18T05:40:50.390640
2019-03-01T04:14:04
2019-03-01T04:14:04
167,287,780
0
0
null
null
null
null
UTF-8
Python
false
false
302
py
import time import logging logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) def timeit(fn, msg=None): start = time.time() result = fn() duration = time.time() - start if msg: logger.debug(msg) logger.debug("Elapsed: %0.2f", duration) return result
[ "adam@adambard.com" ]
adam@adambard.com
83f01a44d28ca3c69cc62cbd15d86a252197e2d7
6504da061a8d67e9a130d3c9bc57c6aa8ae6e6b1
/transposition.py
a25008c788fde28eef7c1d69d864b16eb0fce184
[]
no_license
rajtyagi2718/tic-tac-toe
bef4cdf364d2547934472635f98518c5367cf907
414cd261b2b76ea7862351b70a15766612dc9cf0
refs/heads/master
2020-12-22T02:15:57.111181
2020-01-29T03:28:42
2020-01-29T03:28:42
236,640,066
1
0
null
null
null
null
UTF-8
Python
false
false
5,179
py
import numpy as np import os DATA_PATH = os.getcwd() + '/data/' class Table: """ Array maps board by hash value. No reference to board object is kept. Use board hash value as unique key. Transpositions, symmetric boards collide in hash function, saving computation and memory. """ def __init__(self, values=None): self.default = 3.14159265 if values is None: values = np.empty(765) values[:] = self.default self.values = values def save_values(self, name): np.save(DATA_PATH + name + '_data_values.npy', self.values) def load_values(self, name): try: self.values = np.load(DATA_PATH + name + '_data_values.npy') return True except FileNotFoundError: return False def __setitem__(self, board, item): self.values[hash(board)] = item def __getitem__(self, board): result = self.values[hash(board)] if result != self.default: return result raise KeyError(board) def __delitem__(self, board): self.values[hash(board)] = self.default def clear(self): self.values[:] = self.default def __contains__(self, board): return self.values[hash(board)] != self.default def get(self, board, default=None): try: return self[board] except KeyError: return default class DefaultTable(Table): """Default variant of Table. Values attribute remains same. Methods allow defaultdict functionality on top of standard dict. """ def __init__(self, values=None, default_fcn=int): super().__init__(values) self.default_fcn = default_fcn def __getitem__(self, board): result = self.values[hash(board)] if result != self.default: return result return self.__missing__(board) def __missing__(self, board): self[board] = result = self.default_fcn() return result def get(self, board, default=None): result = self.values[hash(board)] if result != self.default: return result return default class Set: """ Set stores boards by hash value. No reference to board object is kept. Use board hash value as unique key. Transpositions, symmetric boards collide in hash function, saving computation and memory. """ def __init__(self, values=None): if values is None: values = set() self.values = values def __len__(self): return len(self.values) def add(self, board): self.values.add(hash(board)) def clear(self): self.values.clear() def __contains__(self, board): return hash(board) in self.values # class Table: # """ # Dict maps board by hash value. No reference to board object is kept. # # Use board hash value as unique key. Transpositions, symmetric boards # collide in hash function, saving computation and memory. # """ # # def __init__(self, values=None): # if values is None: # values = {} # self.values = values # # def __len__(self): # return len(self.values) # # def __setitem__(self, board, item): # self.values[hash(board)] = item # # def __getitem__(self, board): # return self.values[hash(board)] # # def __delitem__(self, board): # del self.values[hash(board)] # # def clear(self): # self.values.clear() # # def __contains__(self, board): # return hash(board) in self.values # # def get(self, board, default=None): # try: # return self[board] # except KeyError: # return default # # class DefaultTable(Table): # """Default dict variant of Table. # # Values attribute remains same. Methods allow defaultdict functionality on # top of standard dict. # """ # # def __init__(self, values=None, default_fcn=int): # super().__init__(values) # self.default_fcn = default_fcn # # def __getitem__(self, board): # try: # return self.values[hash(board)] # except KeyError: # return self.__missing__(board) # # def __missing__(self, board): # self[board] = result = self.default_fcn() # return result # # def get(self, board, default=None): # try: # return self.values[hash(board)] # except KeyError: # return default # # class Set: # """ # Set stores boards by hash value. No reference to board object is kept. # # Use board hash value as unique key. Transpositions, symmetric boards # collide in hash function, saving computation and memory. # """ # # def __init__(self, values=None): # if values is None: # values = set() # self.values = values # # def __len__(self): # return len(self.values) # # def add(self, board): # self.values.add(hash(board)) # # def clear(self): # self.values.clear() # # def __contains__(self, board): # return hash(board) in self.values
[ "noreply@github.com" ]
noreply@github.com
68fe9f9a172492e2317fc1fbce5239ad8857048d
33a726710580fdca28a54314b231029ecaf52db1
/21_10_2021/DP_Tabulation/DP_bestSum.py
97fd9e7d8029e4a5019a3c36ca5e2c8664ec275e
[]
no_license
douglasdotc/LeetCode_Exercises
70c8c1245a38943057e29fc332dcd223b79762eb
116e457ce8a223d235b12033dbc8a789183679d4
refs/heads/main
2023-08-31T14:12:40.672374
2021-10-21T16:07:34
2021-10-21T16:07:34
418,110,662
0
0
null
null
null
null
UTF-8
Python
false
false
1,149
py
# Write a function that return an array containing # the shortest combination of numbers that add up to exactly the targetSum import copy def bestSum(targetSum:int, nums:list[int]) -> list[int]: len_bestSumT = targetSum + 1 bestSumT = [None]*len_bestSumT bestSumT[0] = [] for t_idx in range(len_bestSumT): if bestSumT[t_idx] != None: for n in nums: if t_idx + n < len_bestSumT: curr_com = copy.copy(bestSumT[t_idx]) curr_com.append(n) if bestSumT[t_idx + n] == None or len(curr_com) < len(bestSumT[t_idx + n]): bestSumT[t_idx + n] = curr_com return bestSumT[targetSum] print(bestSum(7, [5,3,4,7])) print(bestSum(7, [2,3])) print(bestSum(7, [2,4])) print(bestSum(8, [2,3,5])) print(bestSum(300, [7, 14])) print(bestSum(100, [25,1,5,2])) # Time Complexity: # Let m = targetSum # n = length of nums # double for loop: O(mn) # copying curr_com: O(m) at most m entries, all 1s # Overall O(nm^2) # Space Complexity: # bestSumT: O(m) # curr_com: O(m) # Overall: O(m^2)
[ "douglasdothnc@gmail.com" ]
douglasdothnc@gmail.com
c1cfd00f39b6ddc83d83ac3acf0f6da9c42a1ae5
116ede6ffae8edce59a1be2a5e36ad7b8d29659b
/test_service.py
839d26dcd280ab42482cc48e67eb043c82c4afd3
[ "MIT" ]
permissive
cmput401-fall2018/web-app-ci-cd-with-travis-ci-sajjadhaiderrr
891db8133a091248a60875db0484b41299e78ae9
4344976ef65d5ed14931473d09b831ca92316eb6
refs/heads/master
2021-08-18T15:58:52.676726
2018-11-03T05:12:45
2018-11-03T05:12:45
151,894,623
0
0
MIT
2021-06-10T20:55:10
2018-10-07T01:00:26
Python
UTF-8
Python
false
false
944
py
from mock import patch from service import Service @patch('service.Service.bad_random') def test_bad_random(bad_random): service = Service() bad_random.return_value = 10 assert service.bad_random() == 10 @patch('service.Service.bad_random') def test_divide(bad_random): service = Service() assert service.divide(1) == 10 try: service.divide(0) except ZeroDivisionError: assert True def test_abs_plus(): service = Service() assert service.abs_plus(2) == 3 assert service.abs_plus(0) == 1 assert service.abs_plus(-2) == 3 @patch('service.Service.bad_random') def test_complicated_function(divide, bad_random): service = Service() assert service.complicated_function(15) == (9, 3) try: service.complicated_function(0) except ZeroDivisionError: assert True assert service.complicated_function(-15) == (-9, 3)
[ "noreply@github.com" ]
noreply@github.com
7aa7b91b48554f7ab4f4fba20e3d722d2244bbc5
57260782867a8d5588ad0bd7315746e3374a2ed6
/my_env/bin/django-admin
0a669c29ced280e6ec14526b140c456f12e62b30
[]
no_license
hrittwik/weather_webapp
2a14e2512ac93ff9600f52f75e21d1faeb5cc9e4
f92cf610e609203d19e5aec576e032fa6eb31a96
refs/heads/master
2023-01-13T18:52:32.239458
2020-10-28T01:53:57
2020-10-28T01:53:57
306,178,321
0
0
null
null
null
null
UTF-8
Python
false
false
325
#!/home/hrittwik/Documents/work/practice_projects/weather_app/my_env/bin/python3 # -*- coding: utf-8 -*- import re import sys from django.core.management import execute_from_command_line if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(execute_from_command_line())
[ "hrittwik@gmail.com" ]
hrittwik@gmail.com
a94b1d55d975be46dae258268aacd7712455dc9a
f065f257c328089ad5fc1c17d6ae0c5134b7f937
/manage.py
b45e349ef07a1a69e19a387d31d85e7c6d4bc6bc
[]
no_license
TLHM/GithubStars
08f72b00e45e10c1f93c250a2bee2469724e2e42
f27613ab9677c1b08fbdc0ce2949abc4b6ac46ee
refs/heads/master
2021-01-01T05:41:31.421614
2015-08-15T01:40:08
2015-08-15T01:40:08
40,742,742
0
0
null
null
null
null
UTF-8
Python
false
false
254
py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "GithubStars.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
[ "tlhm@serenityforge.com" ]
tlhm@serenityforge.com
a730633b744d42faf05762f39d04305fab23787a
aaa11f717302035907c69b5d15ba5c1e33e659aa
/google/cloud/dialogflowcx_v3/services/flows/pagers.py
d6b16e5d21d096bbf6564bd3c2712825b65946d0
[ "Apache-2.0" ]
permissive
ngoctram21/python-dialogflow-cx
7b34517ef65c467a1fc382b50fd0f490f64d04c4
484e13a78830a3d0ce8b1745fdf2dfce0f88a21e
refs/heads/main
2023-08-28T01:13:05.609141
2021-10-21T23:31:42
2021-10-21T23:31:42
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,580
py
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # from typing import ( Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator, ) from google.cloud.dialogflowcx_v3.types import flow class ListFlowsPager: """A pager for iterating through ``list_flows`` requests. This class thinly wraps an initial :class:`google.cloud.dialogflowcx_v3.types.ListFlowsResponse` object, and provides an ``__iter__`` method to iterate through its ``flows`` field. If there are more pages, the ``__iter__`` method will make additional ``ListFlows`` requests and continue to iterate through the ``flows`` field on the corresponding responses. All the usual :class:`google.cloud.dialogflowcx_v3.types.ListFlowsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ def __init__( self, method: Callable[..., flow.ListFlowsResponse], request: flow.ListFlowsRequest, response: flow.ListFlowsResponse, *, metadata: Sequence[Tuple[str, str]] = () ): """Instantiate the pager. Args: method (Callable): The method that was originally called, and which instantiated this pager. request (google.cloud.dialogflowcx_v3.types.ListFlowsRequest): The initial request object. response (google.cloud.dialogflowcx_v3.types.ListFlowsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. """ self._method = method self._request = flow.ListFlowsRequest(request) self._response = response self._metadata = metadata def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property def pages(self) -> Iterator[flow.ListFlowsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = self._method(self._request, metadata=self._metadata) yield self._response def __iter__(self) -> Iterator[flow.Flow]: for page in self.pages: yield from page.flows def __repr__(self) -> str: return "{0}<{1!r}>".format(self.__class__.__name__, self._response) class ListFlowsAsyncPager: """A pager for iterating through ``list_flows`` requests. This class thinly wraps an initial :class:`google.cloud.dialogflowcx_v3.types.ListFlowsResponse` object, and provides an ``__aiter__`` method to iterate through its ``flows`` field. If there are more pages, the ``__aiter__`` method will make additional ``ListFlows`` requests and continue to iterate through the ``flows`` field on the corresponding responses. All the usual :class:`google.cloud.dialogflowcx_v3.types.ListFlowsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ def __init__( self, method: Callable[..., Awaitable[flow.ListFlowsResponse]], request: flow.ListFlowsRequest, response: flow.ListFlowsResponse, *, metadata: Sequence[Tuple[str, str]] = () ): """Instantiates the pager. Args: method (Callable): The method that was originally called, and which instantiated this pager. request (google.cloud.dialogflowcx_v3.types.ListFlowsRequest): The initial request object. response (google.cloud.dialogflowcx_v3.types.ListFlowsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. """ self._method = method self._request = flow.ListFlowsRequest(request) self._response = response self._metadata = metadata def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property async def pages(self) -> AsyncIterator[flow.ListFlowsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = await self._method(self._request, metadata=self._metadata) yield self._response def __aiter__(self) -> AsyncIterator[flow.Flow]: async def async_generator(): async for page in self.pages: for response in page.flows: yield response return async_generator() def __repr__(self) -> str: return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
[ "noreply@github.com" ]
noreply@github.com
cef751349e326e1650499a6a813b76b91676a5a6
c8f00a11b8531d3afec2c481f8adcc92c3c4d898
/R2R_Simulation04.py
62a555990d7d0b46c9800fbfa0bf43bda9ca9d14
[]
no_license
ykorn012/etc
c29f21c95b6d9cc99f0610db2ed2868889ce0a75
89418a18cb5f8d0f4f47cdca02a077f3b3e9b3fa
refs/heads/master
2021-06-30T00:54:34.897056
2019-04-02T14:45:50
2019-04-02T14:45:50
116,956,062
0
0
null
null
null
null
UTF-8
Python
false
false
7,706
py
import os import copy import numpy as np from matplotlib import pyplot as plt from sklearn.cross_decomposition import PLSRegression from sklearn import metrics os.chdir("D:/11. Programming/ML/01. FabWideSimulation7/") pls = PLSRegression(n_components=6, scale=False, max_iter=1500, copy=True) lamda_PLS = 0.1 Tgt = np.array([0, 50]) A_p1 = np.array([[0.5, -0.2], [0.25, 0.15]]) d_p1 = np.array([[0.1, 0], [0.05, 0]]) C_p1 = np.transpose(np.array([[0, 0.5, 0.05, 0, 0.15, 0], [0.085, 0, 0.025, 0.2, 0, 0]])) # L1 = 0.5 * np.identity(2) # L2 = 0.5 * np.identity(2) I = np.identity(2) L1 = 0.55 * I L2 = 0.75 * I def sampling_up(): u1_p1 = np.random.normal(0.4, np.sqrt(0.2)) u2_p1 = np.random.normal(0.6, np.sqrt(0.2)) u_p1 = np.array([u1_p1, u2_p1]) return u_p1 def sampling_vp(): v1_p1 = np.random.normal(1, np.sqrt(0.2)) v2_p1 = 2 * v1_p1 v3_p1 = np.random.uniform(0.2, 1.2) v4_p1 = 3 * v3_p1 v5_p1 = np.random.uniform(0, 0.4) v6_p1 = np.random.normal(-0.6, np.sqrt(0.2)) v_p1 = np.array([v1_p1, v2_p1, v3_p1, v4_p1, v5_p1, v6_p1]) return v_p1 def sampling(k, uk = np.array([0, 0]), vp = np.array([0, 0, 0, 0, 0, 0]), initialVM = True): u1_p1 = uk[0] u2_p1 = uk[1] u_p1 = uk v1_p1 = vp[0] v2_p1 = vp[1] v3_p1 = vp[2] v4_p1 = vp[3] v5_p1 = vp[4] v6_p1 = vp[5] v_p1 = vp if initialVM == True: k1_p1 = k k2_p1 = k else: k1_p1 = k # n = 100 일 때 #1 entity maintenance event k2_p1 = k # n = 200 일 때 #1 entity maintenance event k_p1 = np.array([[k1_p1], [k2_p1]]) psi = np.array([u1_p1, u2_p1, v1_p1, v2_p1, v3_p1, v4_p1, v5_p1, v6_p1, k1_p1, k2_p1]) e1_p1 = np.random.normal(0, np.sqrt(0.2)) e2_p1 = np.random.normal(0, np.sqrt(0.4)) if initialVM: e_p1 = np.array([0, 0]) # e_p1 = np.array([e1_p1, e2_p1]) else: e_p1 = np.array([e1_p1, e2_p1]) # e_p1 = np.array([0, 0]) y_p1 = u_p1.dot(A_p1) + v_p1.dot(C_p1) + np.sum(k_p1 * d_p1, axis=0) + e_p1 # if y_p1[0] > 1 or y_p1[0] < -1: # print('k : ', k) # print('yk : %.5f' % y_p1[0]) # print('u_p1.dot(A_p1) : %.5f' % u_p1.dot(A_p1)[0]) # print('v_p1.dot(C_p1) : %.5f' % v_p1.dot(C_p1)[0]) # print('np.sum(k_p1 * d_p1, axis=0) : %.5f' % np.sum(k_p1 * d_p1, axis=0)[0]) rows = np.r_[psi, y_p1] return rows def pls_update(V, Y): pls.fit(V, Y) return pls def plt_show(n, y1_act, y1_pred): plt.plot(np.arange(1, n + 1), y1_act, 'bx--', y1_pred,'ro--', linewidth=2) plt.xticks(np.arange(0, n, 10)) plt.xlabel('Run No.') plt.ylabel('y_value') def plt_show1(n, y1_act): plt.plot(np.arange(1, n + 1), y1_act, 'ro-', linewidth=2) plt.xticks(np.arange(0, n, 10)) plt.xlabel('Run No.') plt.ylabel('y_value') N = 100 DoE_Queue = [] uk_next = np.array([0, 0]) Dk_prev = np.array([0, 0]) Kd_prev = np.array([0, 0]) for k in range(1, N + 1): # range(101) = [0, 1, 2, ..., 100]) result = sampling(k, uk_next, sampling_vp(), True) # print('yk : %.5f' % result[10:11]) while (result[10:11] > 1) or (result[10:11] < -1): result = sampling(k, uk_next, sampling_vp(), True) DoE_Queue.append(result) # ================================== R2R Control ===================================== npResult = np.array(result) yk = npResult[10:12] uk = npResult[0:2] Dk = (yk - uk.dot(A_p1)).dot(L1) + Dk_prev.dot(I - L1) Kd = (yk - uk.dot(A_p1) - Dk_prev).dot(L2) + Kd_prev.dot(I - L2) uk_next = (Tgt - Dk - Kd).dot(np.linalg.inv(A_p1)) # temp = sampling(k, uk_next, npResult[2:8], True) # print('yhatk : %.5f' % temp[10:11]) Kd_prev = Kd Dk_prev = Dk initplsWindow = DoE_Queue.copy() npPlsWindow= np.array(initplsWindow) plsWindow = [] Z = 10 M = 10 #np.savetxt("output/vm_sample1.csv", DoE_Queue, delimiter=",", fmt="%s") for z in np.arange(0, Z): npPlsWindow[z * M:(z + 1) * M - 1, 0:10] = lamda_PLS * npPlsWindow[z * M:(z + 1) * M - 1, 0:10] npPlsWindow[z * M:(z + 1) * M - 1,10:12] = lamda_PLS * (npPlsWindow[z * M:(z + 1) * M - 1, 10:12]) for i in range(len(npPlsWindow)): plsWindow.append(npPlsWindow[i]) npDoE_Queue = np.array(plsWindow) DoE_Mean = np.mean(npDoE_Queue, axis = 0) #np.savetxt("output/vm_sample2.csv", plsWindow, delimiter=",", fmt="%s") plsModelData = npDoE_Queue - DoE_Mean V0 = plsModelData[:,0:10] Y0 = plsModelData[:,10:12] pls = pls_update(V0, Y0) print('Coefficients: \n', pls.coef_) y_pred = pls.predict(V0) + DoE_Mean[10:12] y_act = npDoE_Queue[:,10:12] print("Mean squared error: %.3f" % metrics.mean_squared_error(y_act, y_pred)) print("r2 score: %.3f" % metrics.r2_score(y_act, y_pred)) #plt_show(N, y_act[:,0:1], y_pred[:,0:1]) #plt_show1(N, y_act[:,0:1]) meanVz = DoE_Mean[0:10] meanYz = DoE_Mean[10:12] ## V0, Y0 Mean Center yk = np.array([0, 0]) Dk_prev = np.array([0, 0]) Kd_prev = np.array([0, 0]) Dk = np.array([0, 0]) Kd = np.array([0, 0]) uk_next = np.array([0, 0]) Z = 10 M = 10 M_Queue = [] ez_Queue = [] ez_Queue.append([0,0]) #e0 = (0,0) y1_act1 = [] y1_pred1 = [] for z in np.arange(0, Z): for k in np.arange(z * M + 1, ((z + 1) * M) + 1): result = sampling(k, uk_next, sampling_vp(), False) # while (result[10:11] > 1) or (result[10:11] < -1): # result = sampling(k, uk_next, sampling_vp(), False) psiK = result[0:10] psiKStar = psiK - meanVz y_predK = pls.predict(psiKStar.reshape(1, 10)) + meanYz # print("k : ", k, ", z : ", z, ", psiKStar : ", psiKStar[8:10], ", y_predK : ", y_predK) rows = np.r_[result, y_predK.reshape(2,)] M_Queue.append(rows) # if k % M == 0: # y1_pred1.append(rows[10:12]) # else: # y1_pred1.append(rows[12:14]) y1_pred1.append(rows[12:14]) y1_act1.append(rows[10:12]) # ================================== R2R Control ===================================== yk = y_predK uk = psiK[0:2] Dk = (yk - uk.dot(A_p1)).dot(L1) + Dk_prev.dot((I - L1)) Kd = (yk - uk.dot(A_p1) - Dk_prev).dot(L2) + Kd_prev.dot(I - L2) uk_next = (Tgt - Dk - Kd).dot(np.linalg.inv(A_p1)) uk_next = uk_next.reshape(2,) print("uk_next : ", uk_next) print("uk_A_p1 : ", uk_next.dot(A_p1)) Kd_prev = Kd Dk_prev = Dk del plsWindow[0:M] ez = M_Queue[M - 1][10:12] - M_Queue[M - 1][12:14] ez_Queue.append(ez) npM_Queue = np.array(M_Queue) npM_Queue[0:M - 1, 0:10] = lamda_PLS * npM_Queue[0:M - 1, 0:10] npM_Queue[0:M - 1, 10:12] = lamda_PLS * (npM_Queue[0:M - 1, 12:14] + 0.5 * ez) npM_Queue = npM_Queue[:, 0:12] for i in range(M): plsWindow.append(npM_Queue[i]) M_Mean = np.mean(plsWindow, axis=0) meanVz = M_Mean[0:10] meanYz = M_Mean[10:12] plsModelData = plsWindow - M_Mean V = plsModelData[:, 0:10] Y = plsModelData[:, 10:12] # pls = copy.deepcopy(pls_udt) pls_update(V, Y) # print(pls.coef_) del M_Queue[0:M] #np.savetxt("output/vm_sample.csv", plsWindow, delimiter=",", fmt="%s") y1_act = np.array(y1_act1) y1_pred = np.array(y1_pred1) print("Mean squared error: %.3f" % metrics.mean_squared_error(y1_act[:,0:1], y1_pred[:,0:1])) print("r2 score: %.3f" % metrics.r2_score(y1_act[:,0:1], y1_pred[:,0:1])) #plt_show(Z * M, y1_act[:,0:1], y1_pred[:,0:1]) plt_show1(Z * M, y1_act[:,0:1]) met_run = np.array(ez_Queue) # plt.plot(np.arange(Z + 1), met_run[:,0:1], 'bs-', met_run[:,1:2], 'rs--', linewidth=2) # #plt.plot(np.arange(Z + 1), met_run[:,0:1], 'bs-', linewidth=2) # plt.xlabel('Metrology Run No.(z)') # plt.ylabel('Ez')
[ "noreply@github.com" ]
noreply@github.com
317ff419e09d11b560a76f243d072b84fba68453
5a6954879c1665b9f493e19a85ea3321fa42259b
/zscore.py
94448c08a26e0e29b90cfea1acd14c7cf736456b
[]
no_license
linhld0811/speech-emotion-recognition
130bf8a81cb244a3bc203f20677d9b9e352d0bcb
bba16f173f5616d5557fce9671ab0022606860f0
refs/heads/master
2020-06-12T03:30:13.014853
2019-07-29T07:35:53
2019-07-29T07:35:53
null
0
0
null
null
null
null
UTF-8
Python
false
false
8,353
py
import wave import numpy as np import python_speech_features as ps import os import glob import cPickle #import base #import sigproc eps = 1e-5 def wgn(x, snr): snr = 10**(snr/10.0) xpower = np.sum(x**2)/len(x) npower = xpower / snr return np.random.randn(len(x)) * np.sqrt(npower) def getlogspec(signal,samplerate=16000,winlen=0.02,winstep=0.01, nfilt=26,nfft=399,lowfreq=0,highfreq=None,preemph=0.97, winfunc=lambda x:np.ones((x,))): highfreq= highfreq or samplerate/2 signal = ps.sigproc.preemphasis(signal,preemph) frames = ps.sigproc.framesig(signal, winlen*samplerate, winstep*samplerate, winfunc) pspec = ps.sigproc.logpowspec(frames,nfft) return pspec def read_file(filename): file = wave.open(filename,'r') params = file.getparams() nchannels, sampwidth, framerate, wav_length = params[:4] str_data = file.readframes(wav_length) wavedata = np.fromstring(str_data, dtype = np.short) #wavedata = np.float(wavedata*1.0/max(abs(wavedata))) # normalization) time = np.arange(0,wav_length) * (1.0/framerate) file.close() return wavedata, time, framerate def dense_to_one_hot(labels_dense, num_classes): """Convert class labels from scalars to one-hot vectors.""" num_labels = labels_dense.shape[0] index_offset = np.arange(num_labels) * num_classes labels_one_hot = np.zeros((num_labels, num_classes)) labels_one_hot.flat[index_offset + labels_dense.ravel()] = 1 return labels_one_hot def zscore(data,mean,std): shape = np.array(data.shape,dtype = np.int32) for i in range(shape[0]): data[i,:,:,0] = (data[i,:,:,0]-mean)/(std) return data def normalization(data): ''' #apply zscore mean = np.mean(data,axis=0)#axis=0纵轴方向求均值 std = np.std(data,axis=0) train_data = zscore(train_data,mean,std) test_data = zscore(test_data,mean,std) ''' mean = np.mean(data,axis=0)#axis=0纵轴方向求均值 std = np.std(data,axis=0) data = (data-mean)/std return data # def mapminmax(data): # shape = np.array(data.shape,dtype = np.int32) # for i in range(shape[0]): # min = np.min(data[i,:,:,0]) # max = np.max(data[i,:,:,0]) # data[i,:,:,0] = (data[i,:,:,0] - min)/((max - min)+eps) # return data def generate_label(emotion,classnum): label = -1 if(emotion == 'ang'): label = 0 elif(emotion == 'sad'): label = 1 elif(emotion == 'hap'): label = 2 elif(emotion == 'neu'): label = 3 else: label = 4 return label def read_CASIA(): train_num = 3548 filter_num = 40 rootdir = '/home/jamhan/hxj/datasets/IEMOCAP_full_release'#link to IEMOCAP database traindata1 = np.empty((train_num*300,filter_num),dtype=np.float32) traindata2 = np.empty((train_num*300,filter_num),dtype=np.float32) traindata3 = np.empty((train_num*300,filter_num),dtype=np.float32) train_num = 0 for speaker in os.listdir(rootdir): if(speaker[0] == 'S'): sub_dir = os.path.join(rootdir,speaker,'sentences/wav') emoevl = os.path.join(rootdir,speaker,'dialog/EmoEvaluation') for sess in os.listdir(sub_dir): if(sess[7] == 'i'): emotdir = emoevl+'/'+sess+'.txt' #emotfile = open(emotdir) emot_map = {} with open(emotdir,'r') as emot_to_read: while True: line = emot_to_read.readline() if not line: break if(line[0] == '['): t = line.split() emot_map[t[3]] = t[4] file_dir = os.path.join(sub_dir, sess, '*.wav') files = glob.glob(file_dir) for filename in files:Aliases #wavname = filename[-23:-4] wavname = filename.split("/")[-1][:-4] emotion = emot_map[wavname] if(emotion in ['hap','ang','neu','sad']): data, time, rate = read_file(filename) mel_spec = ps.logfbank(data,rate,nfilt = filter_num) delta1 = ps.delta(mel_spec, 2) delta2 = ps.delta(delta1, 2) time = mel_spec.shape[0] if(speaker in ['Session1','Session2','Session3','Session4']): #training set if(time <= 300): part = mel_spec delta11 = delta1 delta21 = delta2 part = np.pad(part,((0,300 - part.shape[0]),(0,0)),'constant',constant_values = 0) delta11 = np.pad(delta11,((0,300 - delta11.shape[0]),(0,0)),'constaAliasesnt',constant_values = 0) delta21 = np.pad(delta21,((0,300 - delta21.shape[0]),(0,0)),'constant',constant_values = 0) traindata1[train_num*300:(train_num+1)*300] = part traindata2[train_num*300:(train_num+1)*300] = delta11 traindata3[train_num*300:(train_num+1)*300] = delta21 em = generate_label(emotion,6) train_num = train_num + 1 else: if(emotion in ['ang','neu','sad']): for i in range(2): if(i == 0): begin = 0 end = begin + 300 else: begin = time - 300 end = timeAliases part = mel_spec[begin:end,:] delta11 = delta1[begin:end,:] delta21 = delta2[begin:end,:] traindata1[train_num*300:(train_num+1)*300] = part traindata2[train_num*300:(train_num+1)*300] = delta11 traindata3[train_num*300:(train_num+1)*300] = delta21 train_num = train_num + 1 else: frames = divmod(time-300,100)[0] + 1 for i in range(frames): begin = 100*i end = begin + 300 part = mel_spec[begin:end,:] delta11 = delta1[begin:end,:] delta21 = delta2[begin:end,:] traindata1[train_num*300:(train_num+1)*300] = part traindata2[train_num*300:(train_num+1)*300] = delta11 traindata3[train_num*300:(train_num+1)*300] = delta21 train_num = train_num + 1 else: pass else: pass mean1 = np.mean(traindata1,axis=0) std1 = np.std(traindata1,axis=0) mean2 = np.mean(traindata2,axis=0) std2 = np.std(traindata2,axis=0) mean3 = np.mean(traindata3,axis=0) std3 = np.std(traindata3,axis=0) output = './zscore'+str(filter_num)+'.pkl' #output = './IEMOCAP'+str(m)+'_'+str(filter_num)+'.pkl' f=open(output,'wb') cPickle.dump((mean1,std1,mean2,std2,mean3,std3),f) f.close() return if __name__=='__main__': read_CASIA()
[ "noreply@github.com" ]
noreply@github.com
ae58f90a9e8415dd44142b4657c4f902cc222ef2
46289baca178de8c8cc8ebb5821c6e98fd3165a8
/bilibili_dynamic/__init__.py
e1b8e906f8775003125d902d5a92c966f9892fa3
[ "MIT" ]
permissive
othinus001/DynamicRender
31ee133a6622d90a6fe239db028b05051c36548c
0df74bde7f17c1f7c4258507269516ee0a4ddf44
refs/heads/main
2023-06-25T12:22:42.052254
2021-07-18T09:08:03
2021-07-18T09:08:03
null
0
0
null
null
null
null
UTF-8
Python
false
false
70
py
from . import _version import os __version__ = _version.__version__
[ "mikulab@163.com" ]
mikulab@163.com